[U-Boot] [PATCH 2/6] i.mx: Add the initial support for freescale i.MX6Q processor

Jason Hui jason.hui at linaro.org
Tue Nov 15 11:10:20 CET 2011


On Mon, Nov 14, 2011 at 6:45 PM, Marek Vasut <marek.vasut at gmail.com> wrote:
>> On Mon, Nov 14, 2011 at 7:11 AM, Marek Vasut <marek.vasut at gmail.com> wrote:
>> >> i.MX6Q is freescale quad core processors with ARM cortex_a9 complex.
>> >> This patch is to add the initial support for this processor.
>> >>
>> >> Signed-off-by: Jason Liu <jason.hui at linaro.org>
>> >> ---
>> >>  arch/arm/cpu/armv7/mx6/Makefile           |   48 +
>> >>  arch/arm/cpu/armv7/mx6/clock.c            |  388 +++++++
>> >>  arch/arm/cpu/armv7/mx6/iomux-v3.c         |   76 ++
>> >>  arch/arm/cpu/armv7/mx6/lowlevel_init.S    |   60 +
>> >>  arch/arm/cpu/armv7/mx6/soc.c              |   57 +
>> >>  arch/arm/include/asm/arch-mx6/ccm_regs.h  |  894 +++++++++++++++
>> >>  arch/arm/include/asm/arch-mx6/clock.h     |   50 +
>> >>  arch/arm/include/asm/arch-mx6/gpio.h      |   35 +
>> >>  arch/arm/include/asm/arch-mx6/imx-regs.h  |  233 ++++
>> >>  arch/arm/include/asm/arch-mx6/iomux-v3.h  |  104 ++
>> >>  arch/arm/include/asm/arch-mx6/mx6x_pins.h | 1683
>> >> +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx6/sys_proto.h
>> >> | 38 +
>> >>  12 files changed, 3666 insertions(+), 0 deletions(-)
>> >
>> > [...]
>> >
>> >> diff --git a/arch/arm/cpu/armv7/mx6/lowlevel_init.S
>> >> b/arch/arm/cpu/armv7/mx6/lowlevel_init.S new file mode 100644
>> >> index 0000000..7a03f59
>> >> --- /dev/null
>> >> +++ b/arch/arm/cpu/armv7/mx6/lowlevel_init.S
>> >> @@ -0,0 +1,60 @@
>> >> +/*
>> >> + * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
>> >> + *
>> >> + * This program is free software; you can redistribute it and/or
>> >> + * modify it under the terms of the GNU General Public License as
>> >> + * published by the Free Software Foundation; either version 2 of
>> >> + * the License, or (at your option) any later version.
>> >> + *
>> >> + * This program is distributed in the hope that it will be useful,
>> >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> >> + * GNU General Public License for more details.
>> >> + *
>> >> + * You should have received a copy of the GNU General Public License
>> >> + * along with this program; if not, write to the Free Software
>> >> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
>> >> + * MA 02111-1307 USA
>> >> + */
>> >> +
>> >> +#include <config.h>
>> >> +#include <asm/arch/imx-regs.h>
>> >> +
>> >> +/*
>> >> + * AIPS setup - Only setup MPROTx registers.
>> >> + * Set all MPROTx to be non-bufferable,
>> >> + * trusted for R/W, not forced to user-mode.
>> >> + * The PACR default values are good.
>> >> + */
>> >> +.macro init_aips
>> >> +     ldr r0, =AIPS1_ON_BASE_ADDR
>> >> +     ldr r1, =0x77777777
>> >> +     str r1, [r0, #0x0]
>> >> +     str r1, [r0, #0x4]
>> >> +     ldr r1, =0x0
>> >> +     str r1, [r0, #0x40]
>> >> +     str r1, [r0, #0x44]
>> >> +     str r1, [r0, #0x48]
>> >> +     str r1, [r0, #0x4C]
>> >> +     str r1, [r0, #0x50]
>> >> +
>> >> +     ldr r0, =AIPS2_ON_BASE_ADDR
>> >> +     ldr r1, =0x77777777
>> >> +     str r1, [r0, #0x0]
>> >> +     str r1, [r0, #0x4]
>> >> +     ldr r1, =0x0
>> >> +     str r1, [r0, #0x40]
>> >> +     str r1, [r0, #0x44]
>> >> +     str r1, [r0, #0x48]
>> >> +     str r1, [r0, #0x4C]
>> >> +     str r1, [r0, #0x50]
>> >> +.endm /* init_aips */
>> >
>> > Can't this be done in C code? Why the assembly ?
>>
>> I think this should be initialized as early as possible, so I put it here.
>
> As early as arch_cpu_init is late (see arch/arm/lib/board.c)?

ok, Let's put it to arch_cpu_init. Thanks.

>>
>> >> +
>> >> +.section ".text.init", "x"
>> >> +
>> >> +.globl lowlevel_init
>> >> +lowlevel_init:
>> >> +
>> >> +     init_aips
>> >> +
>> >> +     mov pc, lr
>> >
>> > [...]
>> >
>> >> +#define MXC_CCM_CSCMR2_CAN_CLK_SEL_OFFSET            (2)
>> >
>> > Drop parenthesis around stuff similar to this.
>>
>> Yes, thanks.
>>
>> >> +#endif /*__ARCH_ARM_MACH_MX6_CCM_REGS_H__ */
>> >> diff --git a/arch/arm/include/asm/arch-mx6/clock.h
>> >> b/arch/arm/include/asm/arch-mx6/clock.h new file mode 100644
>> >> index 0000000..636458f
>> >> --- /dev/null
>> >> +++ b/arch/arm/include/asm/arch-mx6/clock.h
>> >> @@ -0,0 +1,50 @@
>> >> +/*
>> >> + * (C) Copyright 2009
>> >> + * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
>> >> + *
>> >> + * See file CREDITS for list of people who contributed to this
>> >> + * project.
>> >> + *
>> >> + * This program is free software; you can redistribute it and/or
>> >> + * modify it under the terms of the GNU General Public License as
>> >> + * published by the Free Software Foundation; either version 2 of
>> >> + * the License, or (at your option) any later version.
>> >> + *
>> >> + * This program is distributed in the hope that it will be useful,
>> >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> >> + * GNU General Public License for more details.
>> >> + *
>> >> + * You should have received a copy of the GNU General Public License
>> >> + * along with this program; if not, write to the Free Software
>> >> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
>> >> + * MA 02111-1307 USA
>> >> + */
>> >> +
>> >> +#ifndef __ASM_ARCH_CLOCK_H
>> >> +#define __ASM_ARCH_CLOCK_H
>> >> +
>> >> +enum mxc_clock {
>> >> +     MXC_ARM_CLK = 0,
>> >> +     MXC_PER_CLK,
>> >> +     MXC_AHB_CLK,
>> >> +     MXC_IPG_CLK,
>> >> +     MXC_IPG_PERCLK,
>> >> +     MXC_UART_CLK,
>> >> +     MXC_CSPI_CLK,
>> >> +     MXC_AXI_CLK,
>> >> +     MXC_EMI_SLOW_CLK,
>> >> +     MXC_DDR_CLK,
>> >> +     MXC_ESDHC_CLK,
>> >> +     MXC_ESDHC2_CLK,
>> >> +     MXC_ESDHC3_CLK,
>> >> +     MXC_ESDHC4_CLK,
>> >> +     MXC_SATA_CLK,
>> >> +     MXC_NFC_CLK,
>> >> +};
>> >> +
>> >> +u32 imx_get_uartclk(void);
>> >> +u32 imx_get_fecclk(void);
>> >> +unsigned int mxc_get_clock(enum mxc_clock clk);
>> >> +
>> >> +#endif /* __ASM_ARCH_CLOCK_H */
>> >> diff --git a/arch/arm/include/asm/arch-mx6/gpio.h
>> >> b/arch/arm/include/asm/arch-mx6/gpio.h new file mode 100644
>> >> index 0000000..1dc34e9
>> >> --- /dev/null
>> >> +++ b/arch/arm/include/asm/arch-mx6/gpio.h
>> >> @@ -0,0 +1,35 @@
>> >> +/*
>> >> + * Copyright (C) 2011
>> >> + * Stefano Babic, DENX Software Engineering, <sbabic at denx.de>
>> >> + *
>> >> + * See file CREDITS for list of people who contributed to this
>> >> + * project.
>> >> + *
>> >> + * This program is free software; you can redistribute it and/or
>> >> + * modify it under the terms of the GNU General Public License as
>> >> + * published by the Free Software Foundation; either version 2 of
>> >> + * the License, or (at your option) any later version.
>> >> + *
>> >> + * This program is distributed in the hope that it will be useful,
>> >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> >> + * GNU General Public License for more details.
>> >> + *
>> >> + * You should have received a copy of the GNU General Public License
>> >> + * along with this program; if not, write to the Free Software
>> >> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
>> >> + * MA 02111-1307 USA
>> >> + */
>> >> +
>> >>
>> >> +/* GPIO registers */
>> >> +struct gpio_regs {
>> >> +     u32     gpio_dr;
>> >> +     u32     gpio_dir;
>> >> +     u32     gpio_psr;
>> >> +};
>> >> +
>> >
>> > You'll have GPIO driver, so why expose this structure ?
>>
>> yes, we already had drivers/gpio/mxc_gpio.c driver. In this driver, we will
>> use this structure. And it's the same as i.mx5 before.
>
> So why do you need to expose the structure, isn't it internal to the driver?
Yes, it's internal to the gpio driver, but, all the soc does not have
the same gpio_regs layout,
so we put it here in order to have multiple #ifdef.
Stefano, any comments for this?

>
>>
>> Jason Liu
>>
>> >> +#endif
>> >
>> > M
>


More information about the U-Boot mailing list