Message ID | 1292494665-25674-6-git-send-email-r64343@freescale.com |
---|---|
State | Changes Requested |
Headers | show |
Le 16/12/2010 11:17, Jason Liu a écrit : > diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds > index 5725c30..7b6ab66 100644 > --- a/arch/arm/cpu/armv7/u-boot.lds > +++ b/arch/arm/cpu/armv7/u-boot.lds > @@ -34,6 +34,7 @@ SECTIONS > . = ALIGN(4); > .text : > { > + *(.ivt) NAK. This IVT looks suspiciously like an IPL or header for some bootloader to me. It should not be part of u-boot, but should be built separately then glued to u-boot.bin like is done for NAND bootings. U-boot LDS files for ARM should always start with the reset and exception vectors, i.e. start.o. > arch/arm/cpu/armv7/start.o (.text) > *(.text) > } > diff --git a/board/freescale/mx53evk/ivt.S b/board/freescale/mx53evk/ivt.S > new file mode 100755 > index 0000000..f7a176f > --- /dev/null > +++ b/board/freescale/mx53evk/ivt.S > @@ -0,0 +1,289 @@ > +/* > + * Copyright (C) 2010 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 > + * .word 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> > + > +.section ".ivt" > + > +ivt_header: .word 0x402000D1 /* Tag=0xD1, Len=0x0020, Ver=0x40 */ > +app_code_jump_v: .word (0xF8006400 + (plugin_start - CONFIG_SYS_TEXT_BASE)) > +reserv1: .word 0x0 > +dcd_ptr: .word 0x0 > +boot_data_ptr: .word (0xF8006400 + (boot_data - CONFIG_SYS_TEXT_BASE)) > +self_ptr: .word (0xF8006400 + (ivt_header - CONFIG_SYS_TEXT_BASE)) > +app_code_csf: .word 0x0 > +reserv2: .word 0x0 > +boot_data: .word 0xF8006000 > +image_len: .word 2*1024 > +plugin: .word 0x1 > + > +/* Second IVT to give entry point into the bootloader copied to DDR */ > +ivt2_header: .word 0x402000D1 /*Tag=0xD1, Len=0x0020, Ver=0x40 */ > +app2_code_jump_v: .word _start /*Entry point for the bootloader */ > +reserv3: .word 0x0 > +dcd2_ptr: .word 0x0 > +boot_data2_ptr: .word boot_data2 > +self_ptr2: .word ivt2_header > +app_code_csf2: .word 0x0 > +reserv4: .word 0x0 > +boot_data2: .word (CONFIG_SYS_TEXT_BASE - 0x400) > +image_len2: .word (_end - CONFIG_SYS_TEXT_BASE) > +plugin2: .word 0x0 > + > + > +/* Here starts the plugin code */ > +plugin_start: > + /* Save the return address and the function arguments */ The entry point of u-boot should be the reset vector. Obviously this is not a reset vector, and looks more like a hook that some ROM code expects to call as a subroutine. In any case, it should not be the entry code of u-boot. Please consider refactoring this into two different binaries as NAND boot does. Amicalement,
Dear Albert ARIBAUD, In message <4D09EE68.4000506@free.fr> you wrote: > > > diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds > > index 5725c30..7b6ab66 100644 > > --- a/arch/arm/cpu/armv7/u-boot.lds > > +++ b/arch/arm/cpu/armv7/u-boot.lds > > @@ -34,6 +34,7 @@ SECTIONS > > . = ALIGN(4); > > .text : > > { > > + *(.ivt) > > NAK. This IVT looks suspiciously like an IPL or header for some > bootloader to me. It should not be part of u-boot, but should be built > separately then glued to u-boot.bin like is done for NAND bootings. ... or like the u-boot.kwb or u-boot.imx images we already build for other architectures. Actually this should probably be added to u-boot.imx support? Best regards, Wolfgang Denk
On 12/16/2010 11:17 AM, Jason Liu wrote: > Add initial support for MX53EVK board support. > FEC, SD/MMC, UART, I2C, have been support. > > diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds > index 5725c30..7b6ab66 100644 > --- a/arch/arm/cpu/armv7/u-boot.lds > +++ b/arch/arm/cpu/armv7/u-boot.lds > @@ -34,6 +34,7 @@ SECTIONS > . = ALIGN(4); > .text : > { > + *(.ivt) > arch/arm/cpu/armv7/start.o (.text) > *(.text) > } We have already discussed this point, see my previous answer here: http://marc.info/?l=u-boot&m=127793013695282&w=2 The solution in u-boot is *not* to link statically the IMX header to the u-boot.bin, but to generate a u-boot.imx image with a configuration file. This solution is already provided for the i.MX51 processor (same family), and you should go on this way, modifying tools/imximage.c for your needs, if required. This solution was previously discussed and accepted on the ML and it is compatible with other processors from different manufactures (kirchwood, see also u-boot.kwb). As already answered by Albert and Wolfgang, the header must not be part of u-boot.bin. > +SOBJS := ivt.o This should be removed, and a imximage.cfg file should be written. > +plugin_start: > + /* Save the return address and the function arguments */ > + push {r0-r3, lr} > + > + ldr r0, =ROM_SI_REV > + ldr r1, [r0] > + > + cmp r1, #0x20 > + > + /* IOMUX Setup */ > + ldr r0, =0x53fa8500 > + moveq r1, #0x00180000 > + movne r1, #0x00380000 > + mov r2, #0x00380000 > + add r2, r2, #0x40 > + add r3, r1, #0x40 > + mov r4, #0x00200000 > + > + str r1, [r0, #0x54] > + str r2, [r0, #0x58] > + str r1, [r0, #0x60] > + str r3, [r0, #0x64] > + str r2, [r0, #0x68] > + > + streq r1, [r0, #0x70] > + strne r4, [r0, #0x70] > + str r1, [r0, #0x74] > + streq r1, [r0, #0x78] > + strne r4, [r0, #0x78] > + str r2, [r0, #0x7c] > + str r3, [r0, #0x80] > + str r1, [r0, #0x84] > + str r1, [r0, #0x88] > + str r2, [r0, #0x90] > + str r1, [r0, #0x94] > + > + ldr r0, =0x53fa86f0 > + str r1, [r0, #0x0] > + mov r2, #0x00000200 > + str r2, [r0, #0x4] > + mov r2, #0x00000000 > + str r2, [r0, #0xc] > + > + ldr r0, =0x53fa8700 > + str r2, [r0, #0x14] > + str r1, [r0, #0x18] > + str r1, [r0, #0x1c] > + str r1, [r0, #0x20] > + > + moveq r2, #0x02000000 > + movne r2, #0x06000000 > + > + str r2, [r0, #0x24] > + str r1, [r0, #0x28] > + str r1, [r0, #0x2c] > + > + /* Initialize DDR2 memory - Hynix H5PS2G83AFR */ > + ldr r0, =ESDCTL_BASE_ADDR > + > + ldreq r1, =0x31333530 > + ldrne r1, =0x2b2f3031 > + str r1, [r0, #0x088] > + > + ldreq r1, =0x4a474a44 > + ldrne r1, =0x40363333 > + str r1, [r0, #0x090] > + > + /* add 3 logic unit of delay to sdclk */ > + ldr r1, =0x00000f00 > + str r1, [r0, #0x098] > + > + ldr r1, =0x00000800 > + str r1, [r0, #0x0F8] > + > + ldreq r1, =0x02490241 > + ldrne r1, =0x01310132 > + str r1, [r0, #0x07c] > + > + ldreq r1, =0x01710171 > + ldrne r1, =0x0133014b > + str r1, [r0, #0x080] > + > + /* Enable bank interleaving, RALAT = 0x4, DDR2_EN = 1 */ > + ldr r1, =0x00001710 > + str r1, [r0, #0x018] > + > + ldr r1, =0xc4110000 > + str r1, [r0, #0x00] > + > + ldr r1, =0x4d5122d2 > + str r1, [r0, #0x0C] > + > + ldr r1, =0x92d18a22 > + str r1, [r0, #0x10] > + > + ldr r1, =0x00c70092 > + str r1, [r0, #0x14] > + > + ldr r1, =0x000026d2 > + str r1, [r0, #0x2C] > + > + ldr r1, =0x009f000e > + str r1, [r0, #0x30] > + > + ldr r1, =0x12272000 > + str r1, [r0, #0x08] > + > + ldr r1, =0x00030012 > + str r1, [r0, #0x04] > + > + ldr r1, =0x04008010 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008032 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008033 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008031 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0b5280b0 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x04008010 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008020 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008020 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0a528030 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x03c68031 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00468031 > + str r1, [r0, #0x1C] > + > + /* Even though Rev B does not have DDR on CSD1, keep these > + * mode register initialization sequences for future uses since > + * it does not hurt to keep them > + */ > + ldr r1, =0x04008018 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0000803a > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0000803b > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008039 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0b528138 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x04008018 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008028 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00008028 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x0a528038 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x03c68039 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00468039 > + str r1, [r0, #0x1C] > + > + ldr r1, =0x00005800 > + str r1, [r0, #0x20] > + > + ldr r1, =0x00033337 > + str r1, [r0, #0x58] > + > + ldr r1, =0x00000000 > + str r1, [r0, #0x1C] > + Why do we need to write these registers in assembly ? Why cannot we move them into board_init or board_early_init_f ? And again, should these values described better in imximage.cfg ? > diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c > new file mode 100755 > index 0000000..ff6bfb2 > --- /dev/null > +++ b/board/freescale/mx53evk/mx53evk.c > @@ -0,0 +1,412 @@ > +/* > + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> > + * > + * (C) Copyright 2009-2010 Freescale Semiconductor, Inc. > + * > + * See file CREDITS for list of people who contributed to this > + * project. It seems to me that you derived this file from mx51evk.c, but you copied the header with copyrights from another (MX31, maybe) file. > +#ifdef CONFIG_I2C_MXC > +static void setup_i2c(unsigned int module_base) I think it is better to enumerate the i2c controller as done in manual as with the physical address. Anyway, I do not see yet any released manual for this processor on Freescale's site, so I cannot be more precise. > +void power_init(void) > +{ > + unsigned char buf[4] = { 0 }; > + struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE; > + > + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); > + > + /* Set core voltage VDDGP to 1.05V for 800MHZ */ > + buf[0] = 0x45; > + buf[1] = 0x4a; > + buf[2] = 0x52; Please remove all fixed constants in the file and replaced them with named constants, defined in a header file. Check vision2.c as reference. This board uses the MC13892 PMIC controller, and ./include/mc13892.h contains all required defines. > + if (i2c_write(0x8, 24, 1, buf, 3)) > + return; Ditto. The same globally. > + if (is_soc_rev(CHIP_REV_2_0) == 0) { Please add some comments describing why depending on the processor revision we should to manage the pmic in a different way. > +int board_mmc_getcd(u8 *cd, struct mmc *mmc) > +{ > + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; > + > + if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR) > + *cd = readl(GPIO3_BASE_ADDR) & 0x2000; Please change this. There is mxc_get_gpio() and mxc_set_gpio() accessors. > +int board_init(void) > +{ > + system_rev = get_cpu_rev(); I think we can get rid of system_rev. It is not used in this function and you can call get_cpu_rev() directly in checkboard() when the value is really needed. > +#ifdef BOARD_LATE_INIT > +int board_late_init(void) > +{ > +#ifdef CONFIG_I2C_MXC Is it the board working if the pmic is not configured ? As I remember from mx51evk, the network did not work if the PMIC via SPI was not configured. If this is the case even for mx53evk, setting CONFIG_I2C_MXC is a must, else a lot of thing cannot work. Then I would prefer to remove these #ifdef and producing an error if it is not set at the beginning of the file. > +int checkboard(void) > +{ > + puts("Board: MX53EVK ["); > + > + switch (__REG(SRC_BASE_ADDR + 0x8)) { Again, there is a "src" structure for i.MX51. If it is not correct for i.MX53, you have to adapt it in imx-regs.h, but you cannot access directly to registers. Please use always the correct structure or define newer ones if they do not exist. > +/* > + * Disabled for now due to build problems under Debian and a significant > + * increase in the final file size: 144260 vs. 109536 Bytes. > + */ I see the same comment in mx51evk.h, but does it make sense ? > +/* > + * I2C Configs > + */ > +#define CONFIG_CMD_I2C 1 > +#define CONFIG_HARD_I2C 1 > +#define CONFIG_I2C_MXC 1 > +#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR As stated before: port means an enumeration value (0,1,..N), and it is set to a physical address. Best regards, Stefano Babic
Dear Jason Liu, In message <1292494665-25674-6-git-send-email-r64343@freescale.com> you wrote: > Add initial support for MX53EVK board support. > FEC, SD/MMC, UART, I2C, have been support. > > Signed-off-by: Jason Liu <r64343@freescale.com> The following is in addition to previously made comments: > --- /dev/null > +++ b/board/freescale/mx53evk/config.mk Drop that file. > +CONFIG_SYS_TEXT_BASE = 0x77800000 This goes to the board config file instead. > +/* size in bytes reserved for initial data */ > +#define BOARD_LATE_INIT Seems to be a bogus comment? > +/* > + * Hardware drivers > + */ What exactly are "Hardware drivers" ? > +#define CONFIG_SYS_MEMTEST_START 0x70000000 > +#define CONFIG_SYS_MEMTEST_END 0x10000 Please say - has this ever been tested? Best regards, Wolfgang Denk
Hi, Wolfgang, 2010/12/17 Wolfgang Denk <wd@denx.de>: > Dear Jason Liu, > > In message <1292494665-25674-6-git-send-email-r64343@freescale.com> you wrote: >> Add initial support for MX53EVK board support. >> FEC, SD/MMC, UART, I2C, have been support. >> >> Signed-off-by: Jason Liu <r64343@freescale.com> > > The following is in addition to previously made comments: > >> --- /dev/null >> +++ b/board/freescale/mx53evk/config.mk > > Drop that file. > >> +CONFIG_SYS_TEXT_BASE = 0x77800000 > > This goes to the board config file instead. A lot of board support has this file as following, ./board/freescale/m5373evb/config.mk CONFIG_SYS_TEXT_BASE = 0xFF800000 ./board/freescale/m547xevb/config.mk CONFIG_SYS_TEXT_BASE = 0xffe00000 ./board/freescale/m5275evb/config.mk CONFIG_SYS_TEXT_BASE = 0xFFE00000 ./board/freescale/m5282evb/config.mk CONFIG_SYS_TEXT_BASE = 0xffe00000 ./board/freescale/m5249evb/config.mk CONFIG_SYS_TEXT_BASE = 0xFF800000 ./board/freescale/m548xevb/config.mk ./board/freescale/mx31ads/config.mk CONFIG_SYS_TEXT_BASE = 0xffe00000 ./board/freescale/m5271evb/config.mk CONFIG_SYS_TEXT_BASE = 0x87ec0000 CONFIG_SYS_TEXT_BASE = 0x87f00000 ./board/freescale/mx31pdk/config.mk CONFIG_SYS_TEXT_BASE = 0x97800000 ./board/freescale/mx51evk/config.mk Do you mean that all the new added boards support need drop config.mk in the future? > > >> +/* size in bytes reserved for initial data */ >> +#define BOARD_LATE_INIT > > Seems to be a bogus comment? Yes, will remove it. > >> +/* >> + * Hardware drivers >> + */ > > What exactly are "Hardware drivers" ? Means uart driver, I will change it. > >> +#define CONFIG_SYS_MEMTEST_START 0x70000000 >> +#define CONFIG_SYS_MEMTEST_END 0x10000 > > Please say - has this ever been tested? Yes, tested. Thanks, BR, Jason > > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de > Put your Nose to the Grindstone! > -- Amalgamated Plastic Surgeons and Toolmakers, Ltd. > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot >
Hi, Stefano, 2010/12/16 Stefano Babic <sbabic@denx.de>: > On 12/16/2010 11:17 AM, Jason Liu wrote: >> Add initial support for MX53EVK board support. >> FEC, SD/MMC, UART, I2C, have been support. >> >> diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds >> index 5725c30..7b6ab66 100644 >> --- a/arch/arm/cpu/armv7/u-boot.lds >> +++ b/arch/arm/cpu/armv7/u-boot.lds >> @@ -34,6 +34,7 @@ SECTIONS >> . = ALIGN(4); >> .text : >> { >> + *(.ivt) >> arch/arm/cpu/armv7/start.o (.text) >> *(.text) >> } > > We have already discussed this point, see my previous answer here: > > http://marc.info/?l=u-boot&m=127793013695282&w=2 > > The solution in u-boot is *not* to link statically the IMX header to the > u-boot.bin, but to generate a u-boot.imx image with a configuration > file. This solution is already provided for the i.MX51 processor (same > family), and you should go on this way, modifying tools/imximage.c for > your needs, if required. This solution was previously discussed and > accepted on the ML and it is compatible with other processors from > different manufactures (kirchwood, see also u-boot.kwb). > > As already answered by Albert and Wolfgang, the header must not be part > of u-boot.bin. There is pretty much different with I.MX51 ROM, we will not use DCD data file to config the DDR script since ROM has the DCD size limitation and use the advance feature of what we called plug-in, the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's why we need put this code section before start.S. The plug-in code will be called by boot ROM to do DDR init first and copy u-boot to DDR and jump to _start to run it. I know that you add the .imx format support, that's is simple to add one flash header which can be calculated staticly and glue it to u-boot.bin but it's impossible for plug-in feature support of ROM by using the same way. Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL coming many SOCs support, since we will use plug-in feature of boot ROM. >> +SOBJS := ivt.o > > This should be removed, and a imximage.cfg file should be written. > >> +plugin_start: >> + /* Save the return address and the function arguments */ >> + push {r0-r3, lr} >> + >> + ldr r0, =ROM_SI_REV >> + ldr r1, [r0] >> + >> + cmp r1, #0x20 >> + >> + /* IOMUX Setup */ >> + ldr r0, =0x53fa8500 >> + moveq r1, #0x00180000 >> + movne r1, #0x00380000 >> + mov r2, #0x00380000 >> + add r2, r2, #0x40 >> + add r3, r1, #0x40 >> + mov r4, #0x00200000 >> + >> + str r1, [r0, #0x54] >> + str r2, [r0, #0x58] >> + str r1, [r0, #0x60] >> + str r3, [r0, #0x64] >> + str r2, [r0, #0x68] >> + >> + streq r1, [r0, #0x70] >> + strne r4, [r0, #0x70] >> + str r1, [r0, #0x74] >> + streq r1, [r0, #0x78] >> + strne r4, [r0, #0x78] >> + str r2, [r0, #0x7c] >> + str r3, [r0, #0x80] >> + str r1, [r0, #0x84] >> + str r1, [r0, #0x88] >> + str r2, [r0, #0x90] >> + str r1, [r0, #0x94] >> + >> + ldr r0, =0x53fa86f0 >> + str r1, [r0, #0x0] >> + mov r2, #0x00000200 >> + str r2, [r0, #0x4] >> + mov r2, #0x00000000 >> + str r2, [r0, #0xc] >> + >> + ldr r0, =0x53fa8700 >> + str r2, [r0, #0x14] >> + str r1, [r0, #0x18] >> + str r1, [r0, #0x1c] >> + str r1, [r0, #0x20] >> + >> + moveq r2, #0x02000000 >> + movne r2, #0x06000000 >> + >> + str r2, [r0, #0x24] >> + str r1, [r0, #0x28] >> + str r1, [r0, #0x2c] >> + >> + /* Initialize DDR2 memory - Hynix H5PS2G83AFR */ >> + ldr r0, =ESDCTL_BASE_ADDR >> + >> + ldreq r1, =0x31333530 >> + ldrne r1, =0x2b2f3031 >> + str r1, [r0, #0x088] >> + >> + ldreq r1, =0x4a474a44 >> + ldrne r1, =0x40363333 >> + str r1, [r0, #0x090] >> + >> + /* add 3 logic unit of delay to sdclk */ >> + ldr r1, =0x00000f00 >> + str r1, [r0, #0x098] >> + >> + ldr r1, =0x00000800 >> + str r1, [r0, #0x0F8] >> + >> + ldreq r1, =0x02490241 >> + ldrne r1, =0x01310132 >> + str r1, [r0, #0x07c] >> + >> + ldreq r1, =0x01710171 >> + ldrne r1, =0x0133014b >> + str r1, [r0, #0x080] >> + >> + /* Enable bank interleaving, RALAT = 0x4, DDR2_EN = 1 */ >> + ldr r1, =0x00001710 >> + str r1, [r0, #0x018] >> + >> + ldr r1, =0xc4110000 >> + str r1, [r0, #0x00] >> + >> + ldr r1, =0x4d5122d2 >> + str r1, [r0, #0x0C] >> + >> + ldr r1, =0x92d18a22 >> + str r1, [r0, #0x10] >> + >> + ldr r1, =0x00c70092 >> + str r1, [r0, #0x14] >> + >> + ldr r1, =0x000026d2 >> + str r1, [r0, #0x2C] >> + >> + ldr r1, =0x009f000e >> + str r1, [r0, #0x30] >> + >> + ldr r1, =0x12272000 >> + str r1, [r0, #0x08] >> + >> + ldr r1, =0x00030012 >> + str r1, [r0, #0x04] >> + >> + ldr r1, =0x04008010 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008032 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008033 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008031 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0b5280b0 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x04008010 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008020 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008020 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0a528030 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x03c68031 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00468031 >> + str r1, [r0, #0x1C] >> + >> + /* Even though Rev B does not have DDR on CSD1, keep these >> + * mode register initialization sequences for future uses since >> + * it does not hurt to keep them >> + */ >> + ldr r1, =0x04008018 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0000803a >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0000803b >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008039 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0b528138 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x04008018 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008028 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00008028 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x0a528038 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x03c68039 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00468039 >> + str r1, [r0, #0x1C] >> + >> + ldr r1, =0x00005800 >> + str r1, [r0, #0x20] >> + >> + ldr r1, =0x00033337 >> + str r1, [r0, #0x58] >> + >> + ldr r1, =0x00000000 >> + str r1, [r0, #0x1C] >> + > > Why do we need to write these registers in assembly ? Why cannot we move > them into board_init or board_early_init_f ? And again, should these > values described better in imximage.cfg ? Yes, we need write it in assembly. Please see the comments above. We can't put it into board_init or board_early_init_f, because it does DDR init. It *must* run in IRAM which load by ROM first. > >> diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c >> new file mode 100755 >> index 0000000..ff6bfb2 >> --- /dev/null >> +++ b/board/freescale/mx53evk/mx53evk.c >> @@ -0,0 +1,412 @@ >> +/* >> + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> >> + * >> + * (C) Copyright 2009-2010 Freescale Semiconductor, Inc. >> + * >> + * See file CREDITS for list of people who contributed to this >> + * project. > > It seems to me that you derived this file from mx51evk.c, but you copied > the header with copyrights from another (MX31, maybe) file. The file from FSL uboot. > >> +#ifdef CONFIG_I2C_MXC >> +static void setup_i2c(unsigned int module_base) > > I think it is better to enumerate the i2c controller as done in manual > as with the physical address. Anyway, I do not see yet any released > manual for this processor on Freescale's site, so I cannot be more precise. I can't catch your mean. The function just do i2c iomux setup, anything wrong? > >> +void power_init(void) >> +{ >> + unsigned char buf[4] = { 0 }; >> + struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE; >> + >> + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); >> + >> + /* Set core voltage VDDGP to 1.05V for 800MHZ */ >> + buf[0] = 0x45; >> + buf[1] = 0x4a; >> + buf[2] = 0x52; > > Please remove all fixed constants in the file and replaced them with > named constants, defined in a header file. Check vision2.c as reference. > This board uses the MC13892 PMIC controller, and ./include/mc13892.h > contains all required defines. OK, > >> + if (i2c_write(0x8, 24, 1, buf, 3)) >> + return; > > Ditto. The same globally. > >> + if (is_soc_rev(CHIP_REV_2_0) == 0) { > > Please add some comments describing why depending on the processor > revision we should to manage the pmic in a different way. OK, > >> +int board_mmc_getcd(u8 *cd, struct mmc *mmc) >> +{ >> + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; >> + >> + if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR) >> + *cd = readl(GPIO3_BASE_ADDR) & 0x2000; > > Please change this. There is mxc_get_gpio() and mxc_set_gpio() accessors. OK, > >> +int board_init(void) >> +{ >> + system_rev = get_cpu_rev(); > > I think we can get rid of system_rev. It is not used in this function > and you can call get_cpu_rev() directly in checkboard() when the value > is really needed. OK, currently, it's not used. > >> +#ifdef BOARD_LATE_INIT >> +int board_late_init(void) >> +{ >> +#ifdef CONFIG_I2C_MXC > > Is it the board working if the pmic is not configured ? As I remember > from mx51evk, the network did not work if the PMIC via SPI was not > configured. If this is the case even for mx53evk, setting CONFIG_I2C_MXC > is a must, else a lot of thing cannot work. Then I would prefer to > remove these #ifdef and producing an error if it is not set at the > beginning of the file. No, this is not the case like MX53. The power of FEC is default on of this board. We need change power before we can run CPU at full speed. > >> +int checkboard(void) >> +{ >> + puts("Board: MX53EVK ["); >> + >> + switch (__REG(SRC_BASE_ADDR + 0x8)) { > > Again, there is a "src" structure for i.MX51. If it is not correct for > i.MX53, you have to adapt it in imx-regs.h, but you cannot access > directly to registers. Please use always the correct structure or define > newer ones if they do not exist. Yes, OK, > >> +/* >> + * Disabled for now due to build problems under Debian and a significant >> + * increase in the final file size: 144260 vs. 109536 Bytes. >> + */ > > I see the same comment in mx51evk.h, but does it make sense ? No, I think. We need remove it from mx51 too. > >> +/* >> + * I2C Configs >> + */ >> +#define CONFIG_CMD_I2C 1 >> +#define CONFIG_HARD_I2C 1 >> +#define CONFIG_I2C_MXC 1 >> +#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR > > As stated before: port means an enumeration value (0,1,..N), and it is > set to a physical address. Yes, I will fix it. Thanks, BR, Jason > > Best regards, > Stefano Babic > > -- > ===================================================================== > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de > ===================================================================== > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot >
Dear Jason Liu, In message <AANLkTimTG7h_y5f8JwxG0QtMUEotRt73HLzsp8BMHciA@mail.gmail.com> you wrote: > > A lot of board support has this file as following, > > ./board/freescale/m5373evb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xFF800000 > ./board/freescale/m547xevb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xffe00000 > ./board/freescale/m5275evb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xFFE00000 > ./board/freescale/m5282evb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xffe00000 > ./board/freescale/m5249evb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xFF800000 > ./board/freescale/m548xevb/config.mk > ./board/freescale/mx31ads/config.mk > CONFIG_SYS_TEXT_BASE =3D 0xffe00000 > ./board/freescale/m5271evb/config.mk > CONFIG_SYS_TEXT_BASE =3D 0x87ec0000 > CONFIG_SYS_TEXT_BASE =3D 0x87f00000 > ./board/freescale/mx31pdk/config.mk > CONFIG_SYS_TEXT_BASE =3D 0x97800000 > ./board/freescale/mx51evk/config.mk Yes, these all need to be cleaned up. Patches welcome. > Do you mean that all the new added boards support need drop config.mk > in the future? Yes. At least to the extend possible - we want to concentrate all configuration information in a single location (the board config file) and not scatter it around over several places like Makefiles and config.mk Best regards, Wolfgang Denk
Dear Jason Liu, In message <AANLkTik9SB4EP2YLMeCa-TNb4c7Z-2CPphLtBqfx6J8B@mail.gmail.com> you wrote: > > There is pretty much different with I.MX51 ROM, we will not use DCD > data file to config the > DDR script since ROM has the DCD size limitation and use the advance > feature of what we > called plug-in, the plug-in code must be in the first 2K of MMC card > from 0x400 offset, that's > why we need put this code section before start.S. The plug-in code > will be called by boot ROM > to do DDR init first and copy u-boot to DDR and jump to _start to run it. It seems you did not try to think what it would actually mean to change your code as requested. Actually nne of the above is reason that it must be done in your way. All this can be acchieved in the way Stefano suggested as well. > I know that you add the .imx format support, that's is simple to add > one flash header which can be > calculated staticly and glue it to u-boot.bin but it's impossible for > plug-in feature support of ROM by > using the same way. Please explain why is should be impossible? I cannot follow that. > Does anyone of expert like you and Albert and Wolfgang tell me how to > do it? It's very important for FSL Um.. this statement is not very friendly. Do you mean you consider Stefano to be no expert? He is the iMX custodian, and there is reason for that. > coming many SOCs support, since we will use plug-in feature of boot ROM. You have received a clear NAK from three persons on that: from Stefano (iMX custodian), Albert (ARM custodian), and me. Is this not clear enough? Best regards, Wolfgang Denk
Le 17/12/2010 04:05, Jason Liu a écrit : > There is pretty much different with I.MX51 ROM, we will not use DCD > data file to config the > DDR script since ROM has the DCD size limitation and use the advance > feature of what we > called plug-in, the plug-in code must be in the first 2K of MMC card > from 0x400 offset, that's > why we need put this code section before start.S. This implication is simply not true, as far as I can tell. You do need to have this "plug-in" (will you explain in the end what it is exactly?) in the first 2K of MMC; but that does not mean it has to be put in u-boot and u-boot stored at start of MMC. You could just as well put the "plug-in" alone in the first 2K and u-boot from the second 2K onward, for all I understand: > The plug-in code > will be called by boot ROM > to do DDR init first and copy u-boot to DDR and jump to _start to run it. If it has to copy u-boot to DDR, then it should ne be part of u-boot. > Does anyone of expert like you and Albert and Wolfgang tell me how to > do it? It's very important for FSL > coming many SOCs support, since we will use plug-in feature of boot ROM. The first thing, I think, would be to get back to gathering your exact requirements, and only those, as per your SoC specs. From what you say of these, the requirements are not "have u-boot start in the first 2K of MMC with the "plug-in' coming first", but "have some routine in the first 2K of MMC, said routine assumed to do DDR init and payload copy"; and then, start from these reqs *only*. Amicalement,
On 12/17/2010 04:05 AM, Jason Liu wrote: > There is pretty much different with I.MX51 ROM, we will not use DCD > data file to config the > DDR script since ROM has the DCD size limitation and use the advance > feature of what we > called plug-in, the plug-in code must be in the first 2K of MMC card > from 0x400 offset, that's > why we need put this code section before start.S. The plug-in code > will be called by boot ROM > to do DDR init first and copy u-boot to DDR and jump to _start to run it. As I am not understanding what you mean as "plugin", it seems to me you need some code able to set-up RAM and copy the u-boot code. This method looks like very similar to other SoCs, where a first stage boot loader is needed or when we boot from NAND. I do not find any reasonable argument to follow the methods you are proposing and to link statically this code to u-boot. In U-Boot we have already two mechanisms for do this initial setup, one using special images (with .kwb and .imx images when the RBL of the SoC is able to do the whole job), the second one with a first stage bootloader as nand_spl does and as Albert has already suggested. > Does anyone of expert like you and Albert and Wolfgang tell me how to > do it? It's very important for FSL > coming many SOCs support, since we will use plug-in feature of boot ROM. I am really not understanding if this "plugin" feature is really different as what we have with other SoCs or when we boot from NAND on other SOCs. As I can up now understand, it is similar to other approaches we have support already and I do not see a reason to implement a new one. Is there some released Freescale's documentation to allow to me to better understand what you are meaning ? > Yes, we need write it in assembly. Please see the comments above. > We can't put it into board_init or board_early_init_f, because it does > DDR init. > It *must* run in IRAM which load by ROM first. Running in IRAM is not a sufficient reason to do in this way. If I am not wrong, we could reach the same behavior on a i.MX51, too, if we set the app_code_jump in the header to point to an IRAM address. Then even the i.MX51 RBL should copy the code from storage to IRAM and then jump to this address, isnt it ? > I can't catch your mean. The function just do i2c iomux setup, anything wrong? My concern is related to the fact that the controllers are normally enumerated as "port numbers" and you make the selection based on the base address, that could be confusing. I see an approach of the type: static void setup_i2c(unsigned int port_number) { switch (port_number) { 0: ..... break; 1: ......... } more intuitive to understand. >>> + /* Set core voltage VDDGP to 1.05V for 800MHZ */ >>> + buf[0] = 0x45; >>> + buf[1] = 0x4a; >>> + buf[2] = 0x52; >> >> Please remove all fixed constants in the file and replaced them with >> named constants, defined in a header file. Check vision2.c as reference. >> This board uses the MC13892 PMIC controller, and ./include/mc13892.h >> contains all required defines. > > OK, As further comment: there is already a pmic driver in u-boot (fsl_pmic.c), that hides the underlying communication between processor and pmic itself. At the moment, only spi is implemented. It is better to expand the fsl_pmic code to support i2c, too, and to use the accessors pmic_reg_read() and pmic_reg_write() to access to the pmic internal registers in the board related code. > No, this is not the case like MX53. The power of FEC is default on of > this board. > We need change power before we can run CPU at full speed. Ok, understood. >>> +#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR >> >> As stated before: port means an enumeration value (0,1,..N), and it is >> set to a physical address. > > Yes, I will fix it. This comment is related to the previous one for the setup_i2c() function. Sorry if I was not clear enough. As you describe the define CONFIG_SYS_I2C_PORT, this should be a port number (0,1,..N) and the setup_i2() should accept as parameter this enumeration value, not a base address. Best regards, Stefano Babic
Hi, Stefano, 2010/12/17 Stefano Babic <sbabic@denx.de>: > On 12/17/2010 04:05 AM, Jason Liu wrote: >> There is pretty much different with I.MX51 ROM, we will not use DCD >> data file to config the >> DDR script since ROM has the DCD size limitation and use the advance >> feature of what we >> called plug-in, the plug-in code must be in the first 2K of MMC card >> from 0x400 offset, that's >> why we need put this code section before start.S. The plug-in code >> will be called by boot ROM >> to do DDR init first and copy u-boot to DDR and jump to _start to run it. > > As I am not understanding what you mean as "plugin", it seems to me you > need some code able to set-up RAM and copy the u-boot code. This method > looks like very similar to other SoCs, where a first stage boot loader > is needed or when we boot from NAND. Forget about the case about boot From NAND, we are talking about boot from SD/MMC card here. Why I call it here"plug-in", it due to it use the plugin feature of ROM. This section of code is for ROM to load and run, thus it should meet the ROM boot structure requirement. The plugin feature of ROM can give more flexibility and it can overcome some shortcomings of DCD(used on mx51). By using this plugin we can get around the following issues: 1. DCD size limitation issue, plugin can be the size of OCRAM free space region. 2. Safe environment to re-configure PLL1 (without impacting SDRAM) as the plugin runs from OCRAM. > > I do not find any reasonable argument to follow the methods you are > proposing and to link statically this code to u-boot. In U-Boot we have > already two mechanisms for do this initial setup, one using special > images (with .kwb and .imx images when the RBL of the SoC is able to do > the whole job), the second one with a first stage bootloader as nand_spl > does and as Albert has already suggested. I don't know .kwb format, but know .imx format. Here the .imx use the DCD table to do DDR init but with plugin, it need run the binary code not the DCD configure table. So, We need use assembly code to run the DDR init script. > >> Does anyone of expert like you and Albert and Wolfgang tell me how to >> do it? It's very important for FSL >> coming many SOCs support, since we will use plug-in feature of boot ROM. > > I am really not understanding if this "plugin" feature is really > different as what we have with other SoCs or when we boot from NAND on > other SOCs. As I can up now understand, it is similar to other > approaches we have support already and I do not see a reason to > implement a new one. Here, We can talking about SD/MMC boot. It's some different with NAND boot. It's different with MX51 DCD approach. > > Is there some released Freescale's documentation to allow to me to > better understand what you are meaning ? > >> Yes, we need write it in assembly. Please see the comments above. >> We can't put it into board_init or board_early_init_f, because it does >> DDR init. >> It *must* run in IRAM which load by ROM first. > > Running in IRAM is not a sufficient reason to do in this way. If I am > not wrong, we could reach the same behavior on a i.MX51, too, if we set > the app_code_jump in the header to point to an IRAM address. Then even > the i.MX51 RBL should copy the code from storage to IRAM and then jump > to this address, isnt it ? ROM will only load 2KB data from the beginning of SD/MMC card. The first 1KB is not used, it means that only 1KB data is used. We need put ivt table and ddr init assembly code into this 1KB section. So, we can't put the assembly code into board_init or board_early_init_f. > >> I can't catch your mean. The function just do i2c iomux setup, anything wrong? > > My concern is related to the fact that the controllers are normally > enumerated as "port numbers" and you make the selection based on the > base address, that could be confusing. I see an approach of the type: > > static void setup_i2c(unsigned int port_number) > { > > switch (port_number) { > 0: > ..... > break; > 1: > > ......... > } > > > more intuitive to understand. Yes, agree. > >>>> + /* Set core voltage VDDGP to 1.05V for 800MHZ */ >>>> + buf[0] = 0x45; >>>> + buf[1] = 0x4a; >>>> + buf[2] = 0x52; >>> >>> Please remove all fixed constants in the file and replaced them with >>> named constants, defined in a header file. Check vision2.c as reference. >>> This board uses the MC13892 PMIC controller, and ./include/mc13892.h >>> contains all required defines. >> >> OK, > > As further comment: there is already a pmic driver in u-boot > (fsl_pmic.c), that hides the underlying communication between processor > and pmic itself. At the moment, only spi is implemented. It is better to > expand the fsl_pmic code to support i2c, too, and to use the accessors > pmic_reg_read() and pmic_reg_write() to access to the pmic internal > registers in the board related code. OK, I will check that code and see how hard to expand fsl_pmic to support i2c, which depends on the code scalability. > >> No, this is not the case like MX53. The power of FEC is default on of >> this board. >> We need change power before we can run CPU at full speed. > > Ok, understood. > >>>> +#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR >>> >>> As stated before: port means an enumeration value (0,1,..N), and it is >>> set to a physical address. >> >> Yes, I will fix it. > > This comment is related to the previous one for the setup_i2c() > function. Sorry if I was not clear enough. As you describe the define > CONFIG_SYS_I2C_PORT, this should be a port number (0,1,..N) and the > setup_i2() should accept as parameter this enumeration value, not a base > address. OK, I get it. Thanks, > > Best regards, > Stefano Babic > > > -- > ===================================================================== > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de > ===================================================================== >
On Sun, Dec 19, 2010 at 10:19 PM, Jason Liu <liu.h.jason@gmail.com> wrote: > Hi, Stefano, > > 2010/12/17 Stefano Babic <sbabic@denx.de>: >> On 12/17/2010 04:05 AM, Jason Liu wrote: >>> There is pretty much different with I.MX51 ROM, we will not use DCD >>> data file to config the >>> DDR script since ROM has the DCD size limitation and use the advance >>> feature of what we >>> called plug-in, the plug-in code must be in the first 2K of MMC card >>> from 0x400 offset, that's >>> why we need put this code section before start.S. The plug-in code >>> will be called by boot ROM >>> to do DDR init first and copy u-boot to DDR and jump to _start to run it. >> >> As I am not understanding what you mean as "plugin", it seems to me you >> need some code able to set-up RAM and copy the u-boot code. This method >> looks like very similar to other SoCs, where a first stage boot loader >> is needed or when we boot from NAND. > > Forget about the case about boot From NAND, we are talking about boot > from SD/MMC card here. > Why I call it here"plug-in", it due to it use the plugin feature of ROM. > > This section of code is for ROM to load and run, thus it should meet > the ROM boot structure requirement. > The plugin feature of ROM can give more flexibility and it can > overcome some shortcomings of DCD(used on mx51). > > By using this plugin we can get around the following issues: > 1. DCD size limitation issue, plugin can be the size of OCRAM free space region. > 2. Safe environment to re-configure PLL1 (without impacting SDRAM) as > the plugin runs from OCRAM. > > Jason: No one is arguing about the use the plugin feature. The objection is to how you are getting the plugin bits into the u-boot image. You should use a tool to prepend the plugins to the u-boot.bin file in a similar way to how mkimage is used for i.mx51 and others. Stefano: I know Freescale has a binary to do this but I don't believe the source is available. The binary is included as a package in the i.mx28 BSP as well as some sample plugins. You can find your way to the i.mx28 page by googling "site:freescale.com i.mx28 BSP" and following the top most hit. You have to register to download the BSP. Once you download the BSP you will find a source archive called L2.6.31_10.08.01_SDK_source.tar.gz. The sample plugin package is in the archive in a file called L2.6.31_10.08.01_SDK_source/pkgs/imx-bootlets-src-10.08.01.tar.gz. I guess bootlets are another name for plugins. The binary utility for creating bootlets from elf files is called elftosb-0.4.tar.bz2 in the same archive. The utility appears to be a typical over engineered c++ pile of stuff. One would think that you could accomplish the same thing with objdump, and a patch to mkimage. Chapter 12 of the i.mx28 Technical Reference Manual describes this, I have not seen a doc for i.mx53 yet and am just assuming that it is the same as i.mx28. http://cache.freescale.com/files/dsp/doc/ref_manual/MCIMX28RM.pdf br, John
Hi Jason, (cutting to essential parts of the discussion) Le 20/12/2010 06:19, Jason Liu a écrit : > Forget about the case about boot From NAND, we are talking about boot > from SD/MMC card here. Which is exactly the same: usually the ROM code is just sophisticated enough to do a single, small, read from the lowest address and execute what was read. How this small piece of code is called varies, but basically it does a first-stage bootstrap and loads the next piece, usually a (more) full-fledged bootloader. > Why I call it here"plug-in", it due to it use the plugin feature of ROM. > > This section of code is for ROM to load and run, thus it should meet > the ROM boot structure requirement. > The plugin feature of ROM can give more flexibility and it can > overcome some shortcomings of DCD(used on mx51). > > By using this plugin we can get around the following issues: > 1. DCD size limitation issue, plugin can be the size of OCRAM free space region. > 2. Safe environment to re-configure PLL1 (without impacting SDRAM) as > the plugin runs from OCRAM. This is certainly good, although I'm not familiar enough with the mx series to appreciate the improvements. What I can appreciate, though, is that you're decribing a first-stage bootloader of sorts, and that nothing in your description forces this "plug-in" to be linked with u-boot, and even less, to be linked instead of u(boot's start code. > I don't know .kwb format, but know .imx format. Here the .imx use the > DCD table to do DDR init > but with plugin, it need run the binary code not the DCD configure > table. So, We need use assembly > code to run the DDR init script. Right! But you don't need to tack this code inside the u-boot binary. > Here, We can talking about SD/MMC boot. It's some different with NAND > boot. Not really. for this "plug-in" boot, the ROM loads a small "plug-in" from some fixed location in SD/MMC and executes it, hoping that it'll contribute to some initializations and to loading the next payload. Ditto for NAND boot. > It's different with MX51 DCD approach. AIUI, for mx51 providing added inits and payload info are is done by a pure-data header; that is indeed different from NAND and SD/MMC boot where doing inits and putting payload in RAM are done by code. But your approach, from what I see, is not a third way; it seems to be a combination of both the data and code approaches. > ROM will only load 2KB data from the beginning of SD/MMC card. The > first 1KB is not used, it means > that only 1KB data is used. We need put ivt table and ddr init > assembly code into this > 1KB section. So, we can't put the assembly code into board_init or > board_early_init_f. I don't get this. Why can you only use 1 KB of IRAM? If your plugin is supposed to setup DDR, how come it cannot fit in the IRAM which is the only place where it can go? When the plug-in feature was designed, surely people knew about that 1 KB constraint, right? Please, check your requirements and actual hardware constraints and come back with a simpler design where first stage bootloader will not "bleed over" the payload. Amicalement,
Hi, Stefano, Wolfgang, Albert, John 2010/12/20 John Rigby <john.rigby@linaro.org>: > On Sun, Dec 19, 2010 at 10:19 PM, Jason Liu <liu.h.jason@gmail.com> wrote: > Jason: > No one is arguing about the use the plugin feature. The objection is > to how you are getting the plugin bits into the u-boot image. You > should use a tool to prepend the plugins to the u-boot.bin file in a > similar way to how mkimage is used for i.mx51 and others. I will change back to follow i.mx51 imximage format. Patch has been sent out. Thanks for your comments on this issue. BR, Jason > > br, > > John >
On 12/20/2010 07:52 AM, John Rigby wrote: > Jason: > No one is arguing about the use the plugin feature. The objection is > to how you are getting the plugin bits into the u-boot image. You > should use a tool to prepend the plugins to the u-boot.bin file in a > similar way to how mkimage is used for i.mx51 and others. Exactly. > > Stefano: > I know Freescale has a binary to do this but I don't believe the > source is available. The binary is included as a package in the > i.mx28 BSP as well as some sample plugins. Thanks for hints ! Best regards, Stefano Babic
diff --git a/MAINTAINERS b/MAINTAINERS index 0590ad9..c87ca56 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1085,6 +1085,9 @@ Peter Meerwald <devel@bct-electronic.com> bct-brettl2 BF536 +Jason Liu <r64343@freescale.com> + + MX53evk i.MX53 ######################################################################### # End of MAINTAINERS list # ######################################################################### diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds index 5725c30..7b6ab66 100644 --- a/arch/arm/cpu/armv7/u-boot.lds +++ b/arch/arm/cpu/armv7/u-boot.lds @@ -34,6 +34,7 @@ SECTIONS . = ALIGN(4); .text : { + *(.ivt) arch/arm/cpu/armv7/start.o (.text) *(.text) } diff --git a/board/freescale/mx53evk/Makefile b/board/freescale/mx53evk/Makefile new file mode 100755 index 0000000..c6dc1cd --- /dev/null +++ b/board/freescale/mx53evk/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> +# +# (C) Copyright 2010 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 $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mx53evk.o +SOBJS := ivt.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/freescale/mx53evk/config.mk b/board/freescale/mx53evk/config.mk new file mode 100755 index 0000000..2b21a08 --- /dev/null +++ b/board/freescale/mx53evk/config.mk @@ -0,0 +1,23 @@ +# +# Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved. +# +# 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 +# + +CONFIG_SYS_TEXT_BASE = 0x77800000 diff --git a/board/freescale/mx53evk/ivt.S b/board/freescale/mx53evk/ivt.S new file mode 100755 index 0000000..f7a176f --- /dev/null +++ b/board/freescale/mx53evk/ivt.S @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2010 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 + * .word 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> + +.section ".ivt" + +ivt_header: .word 0x402000D1 /* Tag=0xD1, Len=0x0020, Ver=0x40 */ +app_code_jump_v: .word (0xF8006400 + (plugin_start - CONFIG_SYS_TEXT_BASE)) +reserv1: .word 0x0 +dcd_ptr: .word 0x0 +boot_data_ptr: .word (0xF8006400 + (boot_data - CONFIG_SYS_TEXT_BASE)) +self_ptr: .word (0xF8006400 + (ivt_header - CONFIG_SYS_TEXT_BASE)) +app_code_csf: .word 0x0 +reserv2: .word 0x0 +boot_data: .word 0xF8006000 +image_len: .word 2*1024 +plugin: .word 0x1 + +/* Second IVT to give entry point into the bootloader copied to DDR */ +ivt2_header: .word 0x402000D1 /*Tag=0xD1, Len=0x0020, Ver=0x40 */ +app2_code_jump_v: .word _start /*Entry point for the bootloader */ +reserv3: .word 0x0 +dcd2_ptr: .word 0x0 +boot_data2_ptr: .word boot_data2 +self_ptr2: .word ivt2_header +app_code_csf2: .word 0x0 +reserv4: .word 0x0 +boot_data2: .word (CONFIG_SYS_TEXT_BASE - 0x400) +image_len2: .word (_end - CONFIG_SYS_TEXT_BASE) +plugin2: .word 0x0 + + +/* Here starts the plugin code */ +plugin_start: + /* Save the return address and the function arguments */ + push {r0-r3, lr} + + ldr r0, =ROM_SI_REV + ldr r1, [r0] + + cmp r1, #0x20 + + /* IOMUX Setup */ + ldr r0, =0x53fa8500 + moveq r1, #0x00180000 + movne r1, #0x00380000 + mov r2, #0x00380000 + add r2, r2, #0x40 + add r3, r1, #0x40 + mov r4, #0x00200000 + + str r1, [r0, #0x54] + str r2, [r0, #0x58] + str r1, [r0, #0x60] + str r3, [r0, #0x64] + str r2, [r0, #0x68] + + streq r1, [r0, #0x70] + strne r4, [r0, #0x70] + str r1, [r0, #0x74] + streq r1, [r0, #0x78] + strne r4, [r0, #0x78] + str r2, [r0, #0x7c] + str r3, [r0, #0x80] + str r1, [r0, #0x84] + str r1, [r0, #0x88] + str r2, [r0, #0x90] + str r1, [r0, #0x94] + + ldr r0, =0x53fa86f0 + str r1, [r0, #0x0] + mov r2, #0x00000200 + str r2, [r0, #0x4] + mov r2, #0x00000000 + str r2, [r0, #0xc] + + ldr r0, =0x53fa8700 + str r2, [r0, #0x14] + str r1, [r0, #0x18] + str r1, [r0, #0x1c] + str r1, [r0, #0x20] + + moveq r2, #0x02000000 + movne r2, #0x06000000 + + str r2, [r0, #0x24] + str r1, [r0, #0x28] + str r1, [r0, #0x2c] + + /* Initialize DDR2 memory - Hynix H5PS2G83AFR */ + ldr r0, =ESDCTL_BASE_ADDR + + ldreq r1, =0x31333530 + ldrne r1, =0x2b2f3031 + str r1, [r0, #0x088] + + ldreq r1, =0x4a474a44 + ldrne r1, =0x40363333 + str r1, [r0, #0x090] + + /* add 3 logic unit of delay to sdclk */ + ldr r1, =0x00000f00 + str r1, [r0, #0x098] + + ldr r1, =0x00000800 + str r1, [r0, #0x0F8] + + ldreq r1, =0x02490241 + ldrne r1, =0x01310132 + str r1, [r0, #0x07c] + + ldreq r1, =0x01710171 + ldrne r1, =0x0133014b + str r1, [r0, #0x080] + + /* Enable bank interleaving, RALAT = 0x4, DDR2_EN = 1 */ + ldr r1, =0x00001710 + str r1, [r0, #0x018] + + ldr r1, =0xc4110000 + str r1, [r0, #0x00] + + ldr r1, =0x4d5122d2 + str r1, [r0, #0x0C] + + ldr r1, =0x92d18a22 + str r1, [r0, #0x10] + + ldr r1, =0x00c70092 + str r1, [r0, #0x14] + + ldr r1, =0x000026d2 + str r1, [r0, #0x2C] + + ldr r1, =0x009f000e + str r1, [r0, #0x30] + + ldr r1, =0x12272000 + str r1, [r0, #0x08] + + ldr r1, =0x00030012 + str r1, [r0, #0x04] + + ldr r1, =0x04008010 + str r1, [r0, #0x1C] + + ldr r1, =0x00008032 + str r1, [r0, #0x1C] + + ldr r1, =0x00008033 + str r1, [r0, #0x1C] + + ldr r1, =0x00008031 + str r1, [r0, #0x1C] + + ldr r1, =0x0b5280b0 + str r1, [r0, #0x1C] + + ldr r1, =0x04008010 + str r1, [r0, #0x1C] + + ldr r1, =0x00008020 + str r1, [r0, #0x1C] + + ldr r1, =0x00008020 + str r1, [r0, #0x1C] + + ldr r1, =0x0a528030 + str r1, [r0, #0x1C] + + ldr r1, =0x03c68031 + str r1, [r0, #0x1C] + + ldr r1, =0x00468031 + str r1, [r0, #0x1C] + + /* Even though Rev B does not have DDR on CSD1, keep these + * mode register initialization sequences for future uses since + * it does not hurt to keep them + */ + ldr r1, =0x04008018 + str r1, [r0, #0x1C] + + ldr r1, =0x0000803a + str r1, [r0, #0x1C] + + ldr r1, =0x0000803b + str r1, [r0, #0x1C] + + ldr r1, =0x00008039 + str r1, [r0, #0x1C] + + ldr r1, =0x0b528138 + str r1, [r0, #0x1C] + + ldr r1, =0x04008018 + str r1, [r0, #0x1C] + + ldr r1, =0x00008028 + str r1, [r0, #0x1C] + + ldr r1, =0x00008028 + str r1, [r0, #0x1C] + + ldr r1, =0x0a528038 + str r1, [r0, #0x1C] + + ldr r1, =0x03c68039 + str r1, [r0, #0x1C] + + ldr r1, =0x00468039 + str r1, [r0, #0x1C] + + ldr r1, =0x00005800 + str r1, [r0, #0x20] + + ldr r1, =0x00033337 + str r1, [r0, #0x58] + + ldr r1, =0x00000000 + str r1, [r0, #0x1C] + + /* + * The following is to fill in those arguments for this ROM function pu_ + * irom_hwcnfg_setup(void **start, size_t *bytes, const void *boot_data) + * + * This function is used to copy data from the storage media into DDR. + * + * start - Initial (possibly partial) image load address on entry. Final + * image load address on exit. + * bytes - Initial (possibly partial) image size on entry. Final image + * size on exit. + * boot_data - Initial @ref ivt Boot Data load address. + */ + adr r0, DDR_DEST_ADDR + adr r1, COPY_SIZE + adr r2, BOOT_DATA +before_calling_rom___pu_irom_hwcnfg_setup: + + /* Different ROM address for TO 1.0 & TO 2.0 */ + moveq r4, #0x1800 + addeq r4, r4, #0x4d + beq 2f + mov r4, #0x400000 + add r4, r4, #0x5000 + add r4, r4, #0xc7 + +2: blx r4 /* This address might change in future ROM versions */ +after_calling_rom___pu_irom_hwcnfg_setup: + + /* To return to ROM from plugin, we need to fill in these argument. + * Here is what need to do: + * Need to construct the param for the function before return to ROM: + * plugin_download(void **start, size_t *bytes, UINT32 *ivt_offset) + */ + pop {r0-r3, lr} + ldr r4, DDR_DEST_ADDR + str r4, [r0] + ldr r4, COPY_SIZE + str r4, [r1] + mov r4, #0x400 /* Point to the second IVT table at offset 0x42C */ + add r4, r4, #0x2C + str r4, [r2] + mov r0, #1 + + bx lr /* return back to ROM code */ + +DDR_DEST_ADDR: .word (CONFIG_SYS_TEXT_BASE - 0x400) +COPY_SIZE: .word _end - CONFIG_SYS_TEXT_BASE +BOOT_DATA: .word (CONFIG_SYS_TEXT_BASE - 0x400) + .word _end - CONFIG_SYS_TEXT_BASE + .word 0 diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c new file mode 100755 index 0000000..ff6bfb2 --- /dev/null +++ b/board/freescale/mx53evk/mx53evk.c @@ -0,0 +1,412 @@ +/* + * Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> + * + * (C) Copyright 2009-2010 Freescale Semiconductor, Inc. + * + * 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 + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/imx-regs.h> +#include <asm/arch/mx5x_pins.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/crm_regs.h> +#include <asm/arch/iomux.h> +#include <asm/errno.h> +#include <netdev.h> +#include <i2c.h> +#include <mmc.h> +#include <fsl_esdhc.h> + +DECLARE_GLOBAL_DATA_PTR; + +static u32 system_rev; + +u32 get_board_rev(void) +{ + return system_rev; +} + +int dram_init(void) +{ + /* dram_init must store complete ramsize in gd->ram_size */ + gd->ram_size = get_ram_size((volatile void *)CONFIG_SYS_SDRAM_BASE, + PHYS_SDRAM_1_SIZE); + return 0; +} + +static void setup_iomux_uart(void) +{ + /* UART1 RXD */ + mxc_request_iomux(MX53_PIN_CSI0_D11, IOMUX_CONFIG_ALT2); + mxc_iomux_set_pad(MX53_PIN_CSI0_D11, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU | + PAD_CTL_ODE_OPENDRAIN_ENABLE); + mxc_iomux_set_input(MX53_UART1_IPP_UART_RXD_MUX_SELECT_INPUT, 0x1); + + /* UART1 TXD */ + mxc_request_iomux(MX53_PIN_CSI0_D10, IOMUX_CONFIG_ALT2); + mxc_iomux_set_pad(MX53_PIN_CSI0_D10, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU | + PAD_CTL_ODE_OPENDRAIN_ENABLE); +} + +#ifdef CONFIG_I2C_MXC +static void setup_i2c(unsigned int module_base) +{ + switch (module_base) { + case I2C1_BASE_ADDR: + /* i2c1 SDA */ + mxc_request_iomux(MX53_PIN_CSI0_D8, + IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION); + mxc_iomux_set_input(MX53_I2C1_IPP_SDA_IN_SELECT_INPUT, + INPUT_CTL_PATH0); + mxc_iomux_set_pad(MX53_PIN_CSI0_D8, + PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | + PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE | + PAD_CTL_ODE_OPENDRAIN_ENABLE); + /* i2c1 SCL */ + mxc_request_iomux(MX53_PIN_CSI0_D9, + IOMUX_CONFIG_ALT5 | IOMUX_CONFIG_SION); + mxc_iomux_set_input(MX53_I2C1_IPP_SCL_IN_SELECT_INPUT, + INPUT_CTL_PATH0); + mxc_iomux_set_pad(MX53_PIN_CSI0_D9, + PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | + PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE | + PAD_CTL_ODE_OPENDRAIN_ENABLE); + break; + case I2C2_BASE_ADDR: + /* i2c2 SDA */ + mxc_request_iomux(MX53_PIN_KEY_ROW3, + IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION); + mxc_iomux_set_input(MX53_I2C2_IPP_SDA_IN_SELECT_INPUT, + INPUT_CTL_PATH0); + mxc_iomux_set_pad(MX53_PIN_KEY_ROW3, + PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | + PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE | + PAD_CTL_ODE_OPENDRAIN_ENABLE); + + /* i2c2 SCL */ + mxc_request_iomux(MX53_PIN_KEY_COL3, + IOMUX_CONFIG_ALT4 | IOMUX_CONFIG_SION); + mxc_iomux_set_input(MX53_I2C2_IPP_SCL_IN_SELECT_INPUT, + INPUT_CTL_PATH0); + mxc_iomux_set_pad(MX53_PIN_KEY_COL3, + PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH | + PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE | + PAD_CTL_ODE_OPENDRAIN_ENABLE); + + break; + default: + printf("Invalid I2C base: 0x%x\n", module_base); + break; + } +} + +void power_init(void) +{ + unsigned char buf[4] = { 0 }; + struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE; + + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + + /* Set core voltage VDDGP to 1.05V for 800MHZ */ + buf[0] = 0x45; + buf[1] = 0x4a; + buf[2] = 0x52; + if (i2c_write(0x8, 24, 1, buf, 3)) + return; + + /* Set DDR voltage VDDA to 1.25V */ + buf[0] = 0; + buf[1] = 0; + buf[2] = 0x1a; + if (i2c_write(0x8, 26, 1, buf, 3)) + return; + + if (is_soc_rev(CHIP_REV_2_0) == 0) { + /* Set VCC to 1.3V for TO2 */ + buf[0] = 0; + buf[1] = 0; + buf[2] = 0x1C; + if (i2c_write(0x8, 25, 1, buf, 3)) + return; + + /* Set VDDA to 1.3V for TO2 */ + buf[0] = 0; + buf[1] = 0; + buf[2] = 0x1C; + if (i2c_write(0x8, 26, 1, buf, 3)) + return; + } + + /* need to delay 100 ms to allow power supplies to ramp-up */ + udelay(100000); + + /* Raise the core frequency to 800MHz */ + writel(0x0, &mxc_ccm->cacrr); +} +#endif + +static void setup_iomux_fec(void) +{ + /*FEC_MDIO*/ + mxc_request_iomux(MX53_PIN_FEC_MDIO, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_MDIO, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_22K_PU | PAD_CTL_ODE_OPENDRAIN_ENABLE); + mxc_iomux_set_input(MX53_FEC_FEC_MDI_SELECT_INPUT, 0x1); + + /*FEC_MDC*/ + mxc_request_iomux(MX53_PIN_FEC_MDC, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_MDC, PAD_CTL_DRV_HIGH); + + /* FEC RXD1 */ + mxc_request_iomux(MX53_PIN_FEC_RXD1, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_RXD1, + PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE); + + /* FEC RXD0 */ + mxc_request_iomux(MX53_PIN_FEC_RXD0, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_RXD0, + PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE); + + /* FEC TXD1 */ + mxc_request_iomux(MX53_PIN_FEC_TXD1, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_TXD1, PAD_CTL_DRV_HIGH); + + /* FEC TXD0 */ + mxc_request_iomux(MX53_PIN_FEC_TXD0, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_TXD0, PAD_CTL_DRV_HIGH); + + /* FEC TX_EN */ + mxc_request_iomux(MX53_PIN_FEC_TX_EN, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_TX_EN, PAD_CTL_DRV_HIGH); + + /* FEC TX_CLK */ + mxc_request_iomux(MX53_PIN_FEC_REF_CLK, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_REF_CLK, + PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE); + + /* FEC RX_ER */ + mxc_request_iomux(MX53_PIN_FEC_RX_ER, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_RX_ER, + PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE); + + /* FEC CRS */ + mxc_request_iomux(MX53_PIN_FEC_CRS_DV, IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX53_PIN_FEC_CRS_DV, + PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE); +} + +#ifdef CONFIG_FSL_ESDHC +struct fsl_esdhc_cfg esdhc_cfg[2] = { + {MMC_SDHC1_BASE_ADDR, 1}, + {MMC_SDHC3_BASE_ADDR, 1}, +}; + +int board_mmc_getcd(u8 *cd, struct mmc *mmc) +{ + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; + + if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR) + *cd = readl(GPIO3_BASE_ADDR) & 0x2000; + else + *cd = readl(GPIO3_BASE_ADDR) & 0x800; + + return 0; +} + +int board_mmc_init(bd_t *bis) +{ + u32 index; + s32 status = 0; + + for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) { + switch (index) { + case 0: + mxc_request_iomux(MX53_PIN_SD1_CMD, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_SD1_CLK, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_SD1_DATA0, + IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_SD1_DATA1, + IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_SD1_DATA2, + IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_SD1_DATA3, + IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX53_PIN_EIM_DA13, + IOMUX_CONFIG_ALT1); + + mxc_iomux_set_pad(MX53_PIN_SD1_CMD, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU); + mxc_iomux_set_pad(MX53_PIN_SD1_CLK, + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU | + PAD_CTL_DRV_HIGH); + mxc_iomux_set_pad(MX53_PIN_SD1_DATA0, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_SD1_DATA1, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_SD1_DATA2, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_SD1_DATA3, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + break; + case 1: + mxc_request_iomux(MX53_PIN_ATA_RESET_B, + IOMUX_CONFIG_ALT2); + mxc_request_iomux(MX53_PIN_ATA_IORDY, + IOMUX_CONFIG_ALT2); + mxc_request_iomux(MX53_PIN_ATA_DATA8, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA9, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA10, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA11, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA0, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA1, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA2, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_ATA_DATA3, + IOMUX_CONFIG_ALT4); + mxc_request_iomux(MX53_PIN_EIM_DA11, + IOMUX_CONFIG_ALT1); + + mxc_iomux_set_pad(MX53_PIN_ATA_RESET_B, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_100K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_IORDY, + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU | + PAD_CTL_DRV_HIGH); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA8, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA9, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA10, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA11, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA0, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA1, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA2, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + mxc_iomux_set_pad(MX53_PIN_ATA_DATA3, + PAD_CTL_HYS_ENABLE | PAD_CTL_DRV_HIGH | + PAD_CTL_PUE_PULL | PAD_CTL_PKE_ENABLE | + PAD_CTL_HYS_ENABLE | PAD_CTL_47K_PU); + + break; + default: + printf("Warning: you configured more ESDHC controller" + "(%d) as supported by the board(2)\n", + CONFIG_SYS_FSL_ESDHC_NUM); + return status; + } + status |= fsl_esdhc_initialize(bis, &esdhc_cfg[index]); + } + + return status; +} +#endif + +int board_init(void) +{ + system_rev = get_cpu_rev(); + + gd->bd->bi_arch_number = MACH_TYPE_MX53_EVK; + /* address of boot parameters */ + gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; + + setup_iomux_uart(); + setup_iomux_fec(); + + return 0; +} + +#ifdef BOARD_LATE_INIT +int board_late_init(void) +{ +#ifdef CONFIG_I2C_MXC + setup_i2c(CONFIG_SYS_I2C_PORT); + power_init(); +#endif + return 0; +} +#endif + +int checkboard(void) +{ + puts("Board: MX53EVK ["); + + switch (__REG(SRC_BASE_ADDR + 0x8)) { + case 0x0001: + printf("POR"); + break; + case 0x0009: + printf("RST"); + break; + case 0x0010: + case 0x0011: + printf("WDOG"); + break; + default: + printf("unknown"); + } + printf("]\n"); + return 0; +} diff --git a/boards.cfg b/boards.cfg index dcd5a12..736e88e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -101,6 +101,7 @@ omap5912osk arm arm926ejs - ti edminiv2 arm arm926ejs - LaCie orion5x ca9x4_ct_vxp arm armv7 vexpress armltd mx51evk arm armv7 mx51evk freescale mx5 +mx53evk arm armv7 mx53evk freescale mx5 vision2 arm armv7 vision2 ttcontrol mx5 omap3_overo arm armv7 overo - omap3 omap3_pandora arm armv7 pandora - omap3 diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h new file mode 100755 index 0000000..d8b39ad --- /dev/null +++ b/include/configs/mx53evk.h @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2010 Freescale Semiconductor, Inc. + * + * Configuration settings for the MX53-EVK Freescale board. + * + * 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 __CONFIG_H +#define __CONFIG_H + + /* High Level Configuration Options */ + +#define CONFIG_MX53 + +#define CONFIG_SYS_MX5_HCLK 24000000 +#define CONFIG_SYS_MX5_CLK32 32768 +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_L2_OFF + +#include <asm/arch/imx-regs.h> +/* + * Disabled for now due to build problems under Debian and a significant + * increase in the final file size: 144260 vs. 109536 Bytes. + */ + +#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ +#define CONFIG_REVISION_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_INITRD_TAG 1 + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024) +/* size in bytes reserved for initial data */ +#define BOARD_LATE_INIT + +/* + * Hardware drivers + */ +#define CONFIG_MXC_UART +#define CONFIG_SYS_MX53_UART1 +/* + * I2C Configs + */ +#define CONFIG_CMD_I2C 1 +#define CONFIG_HARD_I2C 1 +#define CONFIG_I2C_MXC 1 +#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR +#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SLAVE 0xfe +/* + * MMC Configs + * */ +#define CONFIG_FSL_ESDHC +#define CONFIG_SYS_FSL_ESDHC_ADDR 0 +#define CONFIG_SYS_FSL_ESDHC_NUM 2 + +#define CONFIG_MMC + +#define CONFIG_CMD_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_CMD_FAT +#define CONFIG_DOS_PARTITION + +/* + * Eth Configs + */ +#define CONFIG_HAS_ETH1 +#define CONFIG_NET_MULTI +#define CONFIG_MII +#define CONFIG_DISCOVER_PHY + +#define CONFIG_FEC_MXC +#define IMX_FEC_BASE FEC_BASE_ADDR +#define CONFIG_FEC_MXC_PHYADDR 0x1F + +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_MII +#define CONFIG_CMD_NET + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_CONS_INDEX 1 +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} + +/*********************************************************** + * Command definition + ***********************************************************/ + +#include <config_cmd_default.h> + +#undef CONFIG_CMD_IMLS + +#define CONFIG_BOOTDELAY 3 + +#define CONFIG_PRIME "FEC0" + +#define CONFIG_LOADADDR 0x70800000 /* loadaddr env var */ + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "script=boot.scr\0" \ + "uimage=uImage\0" \ + "mmcdev=0\0" \ + "mmcpart=2\0" \ + "mmcroot=/dev/mmcblk0p3 rw\0" \ + "mmcrootfstype=ext3 rootwait\0" \ + "mmcargs=setenv bootargs console=ttymxc0,${baudrate} " \ + "root=${mmcroot} " \ + "rootfstype=${mmcrootfstype}\0" \ + "loadbootscript=" \ + "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ + "source\0" \ + "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "run mmcargs; " \ + "bootm\0" \ + "netargs=setenv bootargs console=ttymxc0,${baudrate} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "dhcp ${uimage}; bootm\0" \ + +#define CONFIG_BOOTCOMMAND \ + "if mmc rescan ${mmcdev}; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loaduimage; then " \ + "run mmcboot; " \ + "else run netboot; " \ + "fi; " \ + "fi; " \ + "else run netboot; fi" + +#define CONFIG_ARP_TIMEOUT 200UL + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT "MX53EVK U-Boot > " +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */ + +#define CONFIG_SYS_MEMTEST_START 0x70000000 +#define CONFIG_SYS_MEMTEST_END 0x10000 + +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR + +#define CONFIG_SYS_HZ 1000 +#define CONFIG_CMDLINE_EDITING + +/*----------------------------------------------------------------------- + * Stack sizes + * + * The stack sizes are set up in start.S using the settings below + */ +#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */ + +/*----------------------------------------------------------------------- + * Physical Memory Map + */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1 CSD0_BASE_ADDR +#define PHYS_SDRAM_1_SIZE (512 * 1024 * 1024) + +#define CONFIG_SYS_SDRAM_BASE (PHYS_SDRAM_1) +#define CONFIG_SYS_INIT_RAM_ADDR (IRAM_BASE_ADDR) +#define CONFIG_SYS_INIT_RAM_SIZE (IRAM_SIZE) + +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +/*----------------------------------------------------------------------- + * FLASH and environment organization + */ +#define CONFIG_SYS_NO_FLASH + +#define CONFIG_ENV_OFFSET (6 * 64 * 1024) +#define CONFIG_ENV_SIZE (8 * 1024) +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 0 + +#endif /* __CONFIG_H */
Add initial support for MX53EVK board support. FEC, SD/MMC, UART, I2C, have been support. Signed-off-by: Jason Liu <r64343@freescale.com> --- MAINTAINERS | 3 + arch/arm/cpu/armv7/u-boot.lds | 1 + board/freescale/mx53evk/Makefile | 49 +++++ board/freescale/mx53evk/config.mk | 23 ++ board/freescale/mx53evk/ivt.S | 289 ++++++++++++++++++++++++++ board/freescale/mx53evk/mx53evk.c | 412 +++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/mx53evk.h | 213 +++++++++++++++++++ 8 files changed, 991 insertions(+), 0 deletions(-) create mode 100755 board/freescale/mx53evk/Makefile create mode 100755 board/freescale/mx53evk/config.mk create mode 100755 board/freescale/mx53evk/ivt.S create mode 100755 board/freescale/mx53evk/mx53evk.c create mode 100755 include/configs/mx53evk.h