Re: [U-Boot] [RFC PATCH] arm, davinci: Remove board specific code from da850_lowlevel.c
Hello Heiko, Thank you for your reply! On Wed, Nov 9, 2011 at 6:37 AM, Heiko Schocher wrote: > Hello Christian, > > Christian Riesch wrote: >> Signed-off-by: Christian Riesch >> --- >> >> Hello Heiko, >> >> On my board I cannot use your code in arch_cpu_init() in da850_lowlevel.c >> since I have different versions of my board with different input >> clock frequencies. Here u-boot should first determine the board >> revision number and then configure the SoC accordingly. Therefore I would >> like to move all board-specific parts (and PLL and memory configuration is >> board-specific since it depends on the memory chips and oscillators >> deployed on the board) to board_early_init_f which is called right after >> arch_cpu_init() and keep only a few initializiation steps in arch_cpu_init(). > > Ok, if you have other needs on your board we must change something. > But I want to prevent, that all the code you remove in your patch is > moved to board code, so all boards must (copy?) it. Instead you should > move it to a weak function, which you can replace for your specific > needs. (I thought the code was common enough ...) > > What do you think? That's fine for me, I tried it now with __attribute__((weak)) int arch_cpu_init(void) and added my own arch_cpu_init() to my board specific file. Of course I had to add all those CONFIG_SYS_DA850_PINMUXn with dummy values to my board config file to make it build... I don't like those defines because the values are difficult to read and we already have code for pinmuxing in board/davinci/common/davinci_pinmux.c so it is duplicate code. Couldn't we move this davinci_pinmux.c to arch/arm/cpu/arm926ejs/davinci and use it instead? What do you think? I'll submit a patch for adding the weak attribute. Regards, Christian ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/17 RESEND] iMX28: Add SSP MMC driver
On 11/08/2011 10:50 PM, Andy Fleming wrote: > On Tue, Nov 8, 2011 at 3:42 PM, Marek Vasut wrote: >>> On Fri, Oct 21, 2011 at 5:44 PM, Marek Vasut wrote: Signed-off-by: Marek Vasut Cc: Andy Fleming Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel >>> >>> Acked-by: Andy Fleming >>> >>> I can't apply this because of the >>> arch/arm/include/asm/arch-mx28/sys_proto.h change, which is a file >>> that doesn't yet exist in mainline. >> >> Andy, will it be OK to push it all through stefano's tree then ? > > Sure. I have actually delegated the patch to him. Ok, thanks . I will do it. Stefano -- = 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: off...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] dwcddr21mctl: Synopsys DWC DDR2/1 Memory Controller
Hi Macpaul, 2011/10/26 Macpaul Lin : > Header definitions of Synopsys DWC DDR2/1 Memory Controller. > > Signed-off-by: Macpaul Lin > --- > include/synopsys/dwcddr21mctl.h | 337 > +++ > 1 files changed, 337 insertions(+), 0 deletions(-) > create mode 100644 include/synopsys/dwcddr21mctl.h > Applied to u-boot-nds32/master, thanks. Best regards, Macpaul Lin ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] andes_pcu.h: header file of andes_pcu power control unit
Hi Macpaul, 2011/10/27 Macpaul Lin : > header file of andes_pcu power control unit > > Signed-off-by: Macpaul Lin > --- Applied to u-boot-nds32/master, thanks. Best regards, Macpaul Lin ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
This patch allows replacing arch_cpu_init() if a custom initialization is required. Signed-off-by: Christian Riesch Cc: Sandeep Paulraj Cc: Heiko Schocher --- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index 327ff97..fe142dc 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -263,6 +263,7 @@ void nand_boot(void) #if defined(CONFIG_NAND_SPL) void board_init_f(ulong bootflag) #else +__attribute__ ((weak)) int arch_cpu_init(void) #endif { -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] mvgbe: remove setting of ethaddr within the driver
Am Mi, 9.11.2011, 00:26 schrieb Michael Walle: > atm there is the mvgbe driver: > - which has a hardcoded mac address (or if enabled, a randomized mac > address) >and > - touches the environment oh and i've forgot to mention, that the driver is broken for boards with #define CONFIG_MVGBE_PORTS {0,1} which is the reason why i initially submitted the patch. -- Michael ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] nds32: fix data section of linker script
Make linker script handles .data.rel sections. Signed-off-by: Macpaul Lin Tested-by: Macpaul Lin Cc: Mike Frysinger --- arch/nds32/cpu/n1213/u-boot.lds |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/nds32/cpu/n1213/u-boot.lds b/arch/nds32/cpu/n1213/u-boot.lds index 45221ee..1903420 100644 --- a/arch/nds32/cpu/n1213/u-boot.lds +++ b/arch/nds32/cpu/n1213/u-boot.lds @@ -41,7 +41,7 @@ SECTIONS .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } . = ALIGN(4); - .data : { *(.data) } + .data : { *(.data*) } . = ALIGN(4); -- 1.7.3.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] nds32: fix data section of linker script
Hi Macpaul, 2011/11/9 Macpaul Lin : > Make linker script handles .data.rel sections. > > Signed-off-by: Macpaul Lin > Tested-by: Macpaul Lin > Cc: Mike Frysinger Applied to u-boot-nds32/master, thanks. Best regards, Macpaul Lin ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [RFC PATCH] arm, davinci: Remove board specific code from da850_lowlevel.c
Hello Christian, Christian Riesch wrote: > Hello Heiko, > Thank you for your reply! > > On Wed, Nov 9, 2011 at 6:37 AM, Heiko Schocher wrote: >> Hello Christian, >> >> Christian Riesch wrote: >>> Signed-off-by: Christian Riesch >>> --- >>> >>> Hello Heiko, >>> >>> On my board I cannot use your code in arch_cpu_init() in da850_lowlevel.c >>> since I have different versions of my board with different input >>> clock frequencies. Here u-boot should first determine the board >>> revision number and then configure the SoC accordingly. Therefore I would >>> like to move all board-specific parts (and PLL and memory configuration is >>> board-specific since it depends on the memory chips and oscillators >>> deployed on the board) to board_early_init_f which is called right after >>> arch_cpu_init() and keep only a few initializiation steps in >>> arch_cpu_init(). >> Ok, if you have other needs on your board we must change something. >> But I want to prevent, that all the code you remove in your patch is >> moved to board code, so all boards must (copy?) it. Instead you should >> move it to a weak function, which you can replace for your specific >> needs. (I thought the code was common enough ...) >> >> What do you think? > > That's fine for me, I tried it now with > > __attribute__((weak)) int arch_cpu_init(void) > > and added my own arch_cpu_init() to my board specific file. > > Of course I had to add all those CONFIG_SYS_DA850_PINMUXn with dummy > values to my board config file to make it build... I don't like those > defines because the values are difficult to read and we already have Why? They are in sync with the doc ... > code for pinmuxing in board/davinci/common/davinci_pinmux.c so it is > duplicate code. Couldn't we move this davinci_pinmux.c to > arch/arm/cpu/arm926ejs/davinci and use it instead? What do you think? Hmm.. if you use the http://www-s.ti.com/sc/techlit/spraba2.zip utility from ti, you exactly get the values for the defines ... so I prefered to go this way, but have no real objections against using the code from board/davinci/common/davinci_pinmux.c (Of course, it should be moved to arch/arm/cpu/arm926ejs/davinci) added Sandeep to cc. Sandeep, what do you think? > I'll submit a patch for adding the weak attribute. Thanks! bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/17 RESEND] iMX28: Add SSP MMC driver
> On 11/08/2011 10:50 PM, Andy Fleming wrote: > > On Tue, Nov 8, 2011 at 3:42 PM, Marek Vasut wrote: > >>> On Fri, Oct 21, 2011 at 5:44 PM, Marek Vasut wrote: > Signed-off-by: Marek Vasut > Cc: Andy Fleming > Cc: Stefano Babic > Cc: Wolfgang Denk > Cc: Detlev Zundel > >>> > >>> Acked-by: Andy Fleming > >>> > >>> I can't apply this because of the > >>> arch/arm/include/asm/arch-mx28/sys_proto.h change, which is a file > >>> that doesn't yet exist in mainline. > >> > >> Andy, will it be OK to push it all through stefano's tree then ? > > > > Sure. I have actually delegated the patch to him. > > Ok, thanks . I will do it. > > Stefano Stefano, I'll rebase the patches and repost so you can apply. Can you rebase your u-boot-imx/master on top of u-boot-arm/master so I can use that? Thanks! ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] devkit8000: Fix NAND SPL on boards with 256MB NAND
Hello Tom, Am 08.11.2011 21:53, schrieb Thomas Weber: > Am 26.10.2011 20:09, schrieb Tom Rini: >> The devkit8000 ships with either a 128MB or 256MB NAND chip. In >> order for SPL to work with 256MB NAND CONFIG_SYS_NAND_5_ADDR_CYCLE >> needs to be set. After talking with Scott Wood this should be >> safe to set even for smaller NAND chips. >> >> Cc: Scott Wood >> Cc: Frederik Kriewitz >> Cc: Albert ARIBAUD >> Signed-off-by: Tom Rini >> --- >> include/configs/devkit8000.h |1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h >> index ba0d23e..1856aa9 100644 >> --- a/include/configs/devkit8000.h >> +++ b/include/configs/devkit8000.h >> @@ -332,6 +332,7 @@ >> #define CONFIG_SPL_BSS_MAX_SIZE 0x8 >> >> /* NAND boot config */ >> +#define CONFIG_SYS_NAND_5_ADDR_CYCLE >> #define CONFIG_SYS_NAND_PAGE_COUNT 64 >> #define CONFIG_SYS_NAND_PAGE_SIZE 2048 >> #define CONFIG_SYS_NAND_OOBSIZE 64 > > Tested-by: Thomas Weber > > on Devkit8000 with 256 MB NAND. > > Tomorrow I will test it with a 128 MB NAND devkit8000. > > Thomas Also on Devkit8000 with 128 MB NAND successful tested. Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 02/17 RESEND] iMX28: Add SSP MMC driver
On 11/09/2011 09:38 AM, Marek Vasut wrote: > Stefano, I'll rebase the patches and repost so you can apply. Can you rebase > your u-boot-imx/master on top of u-boot-arm/master so I can use that? Thanks! Done - you can take it Stefano -- = 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: off...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: add DAVINCI_SYSCFG_SUSPSRC_UART2
On 11/09/2011 07:09 AM, Heiko Schocher wrote: > commit f9fc237f1f07d4e5ff7c9c2da39cabc8d3d7b339 > Author: Bastian Ruppert > Date: Tue Oct 4 23:43:28 2011 + > > Davinci: ea20: set console on UART0 > > replaced DAVINCI_SYSCFG_SUSPSRC_UART2 with DAVINCI_SYSCFG_SUSPSRC_UART0 > but DAVINCI_SYSCFG_SUSPSRC_UART2 is needed on the enbw_cmc > board, see patches: > > http://lists.denx.de/pipermail/u-boot/2011-October/104399.html > > Signed-off-by: Heiko Schocher > Cc: Bastian Ruppert > Cc: Stefano Babic > Cc: Sandeep Paulraj > --- > arch/arm/include/asm/arch-davinci/hardware.h |1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/include/asm/arch-davinci/hardware.h > b/arch/arm/include/asm/arch-davinci/hardware.h > index 8e7d97e..aba517e 100644 > --- a/arch/arm/include/asm/arch-davinci/hardware.h > +++ b/arch/arm/include/asm/arch-davinci/hardware.h > @@ -469,6 +469,7 @@ struct davinci_syscfg_regs { > #define DAVINCI_SYSCFG_SUSPSRC_SPI0 (1 << 21) > #define DAVINCI_SYSCFG_SUSPSRC_SPI1 (1 << 22) > #define DAVINCI_SYSCFG_SUSPSRC_UART0 (1 << 18) > +#define DAVINCI_SYSCFG_SUSPSRC_UART2 (1 << 20) > #define DAVINCI_SYSCFG_SUSPSRC_TIMER0(1 << 27) > > struct davinci_syscfg1_regs { Acked-by: Stefano Babic 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: off...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Pull request: u-boot-nds32
Dear Wolfgang, Could you please pull these 3 patches to your tree. Thanks, Macpaul The following changes since commit 5721385b187b3154c7768e6c182501022f4e2e45: Merge branch 'master' of git://git.denx.de/u-boot-mpc83xx (2011-11-08 07:44:52 +0100) are available in the git repository at: git://git.denx.de/u-boot-nds32.git master Macpaul Lin (3): andes_pcu.h: header file of andes_pcu power control unit dwcddr21mctl: Synopsys DWC DDR2/1 Memory Controller nds32: fix data section of linker script arch/nds32/cpu/n1213/u-boot.lds |2 +- include/andestech/andes_pcu.h | 367 +++ include/synopsys/dwcddr21mctl.h | 337 +++ 3 files changed, 705 insertions(+), 1 deletions(-) create mode 100644 include/andestech/andes_pcu.h create mode 100644 include/synopsys/dwcddr21mctl.h -- Best regards, Macpaul Lin ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 00/20 FINAL] Support for the DENX M28 SoM
This series adds support for DENX M28 SoM and M28EVK kit. This series depends on previous series: * Support for both FEC interfaces on i.MX28 * Random NAND fixes and improvements * SPL modifications NOTE: Final version of the patchset, rebased on top of u-boot-imx/master as of commit 021ac2c4c80d272f140cd24ac292b826066d6c3c Marek Vasut (20): iMX28: Initial support for iMX28 CPU iMX28: Add SSP MMC driver FEC: Add support for iMX28 quirks iMX28: Add PINMUX control iMX28: Add I2C bus driver iMX28: Add GPIO control iMX28: Add SPI driver iMX28: Add APBH DMA driver iMX28: Add GPMI NAND driver iMX28: Add driver for internal RTC iMX28: Add image header generator tool iMX28: Add u-boot.sb target to Makefile iMX28: Add support for DENX M28EVK board M28: Add MMC SPL M28: Add doc/README.m28 documentation iMX28: Fix ARM vector handling M28: Add memory detection into SPL iMX28: Add USB and USB PHY register definitions iMX28: Add USB HOST driver M28EVK: Enable USB HOST support .gitignore|1 + MAINTAINERS |1 + Makefile |5 + arch/arm/cpu/arm926ejs/mx28/Makefile | 46 + arch/arm/cpu/arm926ejs/mx28/clock.c | 355 +++ arch/arm/cpu/arm926ejs/mx28/iomux.c | 109 +++ arch/arm/cpu/arm926ejs/mx28/mx28.c| 221 + arch/arm/cpu/arm926ejs/mx28/timer.c | 141 +++ arch/arm/include/asm/arch-mx28/clock.h| 61 ++ arch/arm/include/asm/arch-mx28/dma.h | 170 arch/arm/include/asm/arch-mx28/gpio.h | 32 + arch/arm/include/asm/arch-mx28/imx-regs.h | 39 + arch/arm/include/asm/arch-mx28/iomux-mx28.h | 537 +++ arch/arm/include/asm/arch-mx28/iomux.h| 168 arch/arm/include/asm/arch-mx28/regs-apbh.h| 466 + arch/arm/include/asm/arch-mx28/regs-base.h| 88 ++ arch/arm/include/asm/arch-mx28/regs-bch.h | 230 + arch/arm/include/asm/arch-mx28/regs-clkctrl.h | 312 ++ arch/arm/include/asm/arch-mx28/regs-common.h | 66 ++ arch/arm/include/asm/arch-mx28/regs-gpmi.h| 222 + arch/arm/include/asm/arch-mx28/regs-i2c.h | 207 arch/arm/include/asm/arch-mx28/regs-ocotp.h | 173 arch/arm/include/asm/arch-mx28/regs-pinctrl.h | 1284 + arch/arm/include/asm/arch-mx28/regs-power.h | 413 arch/arm/include/asm/arch-mx28/regs-rtc.h | 147 +++ arch/arm/include/asm/arch-mx28/regs-ssp.h | 349 +++ arch/arm/include/asm/arch-mx28/regs-timrot.h | 171 arch/arm/include/asm/arch-mx28/regs-usb.h | 178 arch/arm/include/asm/arch-mx28/regs-usbphy.h | 151 +++ arch/arm/include/asm/arch-mx28/sys_proto.h| 32 + board/denx/m28evk/Makefile| 56 ++ board/denx/m28evk/m28_init.h | 41 + board/denx/m28evk/m28evk.c| 216 + board/denx/m28evk/mem_init.c | 240 + board/denx/m28evk/mmc_boot.c | 273 ++ board/denx/m28evk/power_init.c| 913 ++ board/denx/m28evk/start.S | 234 + board/denx/m28evk/u-boot-spl.lds | 87 ++ board/denx/m28evk/u-boot.bd | 14 + boards.cfg|1 + doc/README.m28| 223 + drivers/dma/Makefile |1 + drivers/dma/apbh_dma.c| 691 + drivers/gpio/Makefile |1 + drivers/gpio/mxs_gpio.c | 136 +++ drivers/i2c/Makefile |1 + drivers/i2c/mxs_i2c.c | 246 + drivers/mmc/Makefile |1 + drivers/mmc/mxsmmc.c | 351 +++ drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/mxs_nand.c | 1118 + drivers/net/fec_mxc.c | 44 +- drivers/rtc/Makefile |1 + drivers/rtc/mxsrtc.c | 86 ++ drivers/spi/Makefile |1 + drivers/spi/mxs_spi.c | 186 drivers/usb/host/Makefile |1 + drivers/usb/host/ehci-mxs.c | 154 +++ include/configs/m28evk.h | 303 ++ tools/.gitignore |1 + tools/Makefile|6 + tools/mxsboot.c | 684 + 62 files changed, 12685 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx28/Makefile create mode 100644 arch/arm/cpu/arm926ejs/mx28/clock.c create mode 100644 arch/arm/cpu/arm926ejs/mx28/iomux.c create mode 100644 arch/arm/cpu/arm926ejs/mx28/mx28.c create mode
[U-Boot] [PATCH 02/20] iMX28: Add SSP MMC driver
Signed-off-by: Marek Vasut Cc: Andy Fleming Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- arch/arm/include/asm/arch-mx28/sys_proto.h |2 + drivers/mmc/Makefile |1 + drivers/mmc/mxsmmc.c | 351 3 files changed, 354 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/mxsmmc.c diff --git a/arch/arm/include/asm/arch-mx28/sys_proto.h b/arch/arm/include/asm/arch-mx28/sys_proto.h index a262c05..a226ea4 100644 --- a/arch/arm/include/asm/arch-mx28/sys_proto.h +++ b/arch/arm/include/asm/arch-mx28/sys_proto.h @@ -27,4 +27,6 @@ int mx28_reset_block(struct mx28_register *reg); int mx28_wait_mask_set(struct mx28_register *reg, uint32_t mask, int timeout); int mx28_wait_mask_clr(struct mx28_register *reg, uint32_t mask, int timeout); +int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int)); + #endif /* __MX28_H__ */ diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 9f9db75..506f1d6 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -36,6 +36,7 @@ COBJS-$(CONFIG_MMC_SPI) += mmc_spi.o COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o COBJS-$(CONFIG_MV_SDHCI) += mv_sdhci.o COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o +COBJS-$(CONFIG_MXS_MMC) += mxsmmc.o COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c new file mode 100644 index 000..2a9949e --- /dev/null +++ b/drivers/mmc/mxsmmc.c @@ -0,0 +1,351 @@ +/* + * Freescale i.MX28 SSP MMC driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * Based on code from LTIB: + * (C) Copyright 2008-2010 Freescale Semiconductor, Inc. + * Terry Lv + * + * Copyright 2007, Freescale Semiconductor, Inc + * Andy Fleming + * + * Based vaguely on the pxa mmc code: + * (C) Copyright 2003 + * Kyle Harris, Nexus Technologies, Inc. khar...@nexus-tech.net + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +struct mxsmmc_priv { + int id; + struct mx28_ssp_regs*regs; + uint32_tclkseq_bypass; + uint32_t*clkctrl_ssp; + uint32_tbuswidth; + int (*mmc_is_wp)(int); +}; + +#defineMXSMMC_MAX_TIMEOUT 1 + +/* + * Sends a command out on the bus. Takes the mmc pointer, + * a command pointer, and an optional data pointer. + */ +static int +mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) +{ + struct mxsmmc_priv *priv = (struct mxsmmc_priv *)mmc->priv; + struct mx28_ssp_regs *ssp_regs = priv->regs; + uint32_t reg; + int timeout; + uint32_t data_count; + uint32_t *data_ptr; + uint32_t ctrl0; + + debug("MMC%d: CMD%d\n", mmc->block_dev.dev, cmd->cmdidx); + + /* Check bus busy */ + timeout = MXSMMC_MAX_TIMEOUT; + while (--timeout) { + udelay(1000); + reg = readl(&ssp_regs->hw_ssp_status); + if (!(reg & + (SSP_STATUS_BUSY | SSP_STATUS_DATA_BUSY | + SSP_STATUS_CMD_BUSY))) { + break; + } + } + + if (!timeout) { + printf("MMC%d: Bus busy timeout!\n", mmc->block_dev.dev); + return TIMEOUT; + } + + /* See if card is present */ + if (readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_CARD_DETECT) { + printf("MMC%d: No card detected!\n", mmc->block_dev.dev); + return NO_CARD_ERR; + } + + /* Start building CTRL0 contents */ + ctrl0 = priv->buswidth; + + /* Set up command */ + if (!(cmd->resp_type & MMC_RSP_CRC)) + ctrl0 |= SSP_CTRL0_IGNORE_CRC; + if (cmd->resp_type & MMC_RSP_PRESENT) /* Need to get response */ + ctrl0 |= SSP_CTRL0_GET_RESP; + if (cmd->resp_type & MMC_RSP_136) /* It's a 136 bits response */ + ctrl0 |= SSP_CTRL0_LONG_RESP; + +
[U-Boot] [PATCH 03/20] FEC: Add support for iMX28 quirks
Signed-off-by: Marek Vasut Cc: Ben Warren Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/net/fec_mxc.c | 44 ++-- 1 files changed, 42 insertions(+), 2 deletions(-) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 0c0c7cd..b05a4c0 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -42,6 +42,14 @@ DECLARE_GLOBAL_DATA_PTR; #defineCONFIG_FEC_XCV_TYPE MII100 #endif +/* + * The i.MX28 operates with packets in big endian. We need to swap them before + * sending and after receiving. + */ +#ifdef CONFIG_MX28 +#defineCONFIG_FEC_MXC_SWAP_PACKET +#endif + #undef DEBUG struct nbuf { @@ -51,6 +59,32 @@ struct nbuf { uint8_t head[16]; /**< MAC header(6 + 6 + 2) + 2(aligned) */ }; +#ifdef CONFIG_FEC_MXC_SWAP_PACKET +static void swap_packet(uint32_t *packet, int length) +{ + int i; + + for (i = 0; i < DIV_ROUND_UP(length, 4); i++) + packet[i] = __swab32(packet[i]); +} +#endif + +/* + * The i.MX28 has two ethernet interfaces, but they are not equal. + * Only the first one can access the MDIO bus. + */ +#ifdef CONFIG_MX28 +static inline struct ethernet_regs *fec_miiphy_fec_to_eth(struct fec_priv *fec) +{ + return (struct ethernet_regs *)MXS_ENET0_BASE; +} +#else +static inline struct ethernet_regs *fec_miiphy_fec_to_eth(struct fec_priv *fec) +{ + return fec->eth; +} +#endif + /* * MII-interface related functions */ @@ -59,7 +93,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr, { struct eth_device *edev = eth_get_dev_by_name(dev); struct fec_priv *fec = (struct fec_priv *)edev->priv; - struct ethernet_regs *eth = fec->eth; + struct ethernet_regs *eth = fec_miiphy_fec_to_eth(fec); uint32_t reg; /* convenient holder for the PHY register */ uint32_t phy; /* convenient holder for the PHY */ @@ -117,7 +151,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr, { struct eth_device *edev = eth_get_dev_by_name(dev); struct fec_priv *fec = (struct fec_priv *)edev->priv; - struct ethernet_regs *eth = fec->eth; + struct ethernet_regs *eth = fec_miiphy_fec_to_eth(fec); uint32_t reg; /* convenient holder for the PHY register */ uint32_t phy; /* convenient holder for the PHY */ @@ -572,6 +606,9 @@ static int fec_send(struct eth_device *dev, volatile void* packet, int length) * Note: We are always using the first buffer for transmission, * the second will be empty and only used to stop the DMA engine */ +#ifdef CONFIG_FEC_MXC_SWAP_PACKET + swap_packet((uint32_t *)packet, length); +#endif writew(length, &fec->tbd_base[fec->tbd_index].data_length); writel((uint32_t)packet, &fec->tbd_base[fec->tbd_index].data_pointer); /* @@ -668,6 +705,9 @@ static int fec_recv(struct eth_device *dev) /* * Fill the buffer and pass it to upper layers */ +#ifdef CONFIG_FEC_MXC_SWAP_PACKET + swap_packet((uint32_t *)frame->data, frame_length); +#endif memcpy(buff, frame->data, frame_length); NetReceive(buff, frame_length); len = frame_length; -- 1.7.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/20] iMX28: Add PINMUX control
Taken from Linux kernel with minor modifications: commit bf985969e27b507f734435a99df8bf745a3dbb2b Author: Shawn Guo Date: Mon Dec 20 22:57:43 2010 +0800 ARM: mxs: Add iomux support Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- arch/arm/cpu/arm926ejs/mx28/Makefile|2 +- arch/arm/cpu/arm926ejs/mx28/iomux.c | 109 ++ arch/arm/include/asm/arch-mx28/iomux-mx28.h | 537 +++ arch/arm/include/asm/arch-mx28/iomux.h | 168 + 4 files changed, 815 insertions(+), 1 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mx28/iomux.c create mode 100644 arch/arm/include/asm/arch-mx28/iomux-mx28.h create mode 100644 arch/arm/include/asm/arch-mx28/iomux.h diff --git a/arch/arm/cpu/arm926ejs/mx28/Makefile b/arch/arm/cpu/arm926ejs/mx28/Makefile index 98504f9..7845310 100644 --- a/arch/arm/cpu/arm926ejs/mx28/Makefile +++ b/arch/arm/cpu/arm926ejs/mx28/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(SOC).o -COBJS = clock.o mx28.o timer.o +COBJS = clock.o mx28.o iomux.o timer.o SRCS := $(START:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/arch/arm/cpu/arm926ejs/mx28/iomux.c b/arch/arm/cpu/arm926ejs/mx28/iomux.c new file mode 100644 index 000..9ea411f --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mx28/iomux.c @@ -0,0 +1,109 @@ +/* + * Copyright 2004-2006,2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2008 by Sascha Hauer + * Copyright (C) 2009 by Jan Weitzel Phytec Messtechnik GmbH, + * + * + * 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include + +#ifdefined(CONFIG_MX23) +#defineDRIVE_OFFSET0x200 +#definePULL_OFFSET 0x400 +#elif defined(CONFIG_MX28) +#defineDRIVE_OFFSET0x300 +#definePULL_OFFSET 0x600 +#else +#error "Please select CONFIG_MX23 or CONFIG_MX28" +#endif + +/* + * configures a single pad in the iomuxer + */ +int mxs_iomux_setup_pad(iomux_cfg_t pad) +{ + u32 reg, ofs, bp, bm; + void *iomux_base = (void *)MXS_PINCTRL_BASE; + struct mx28_register *mxs_reg; + + /* muxsel */ + ofs = 0x100; + ofs += PAD_BANK(pad) * 0x20 + PAD_PIN(pad) / 16 * 0x10; + bp = PAD_PIN(pad) % 16 * 2; + bm = 0x3 << bp; + reg = readl(iomux_base + ofs); + reg &= ~bm; + reg |= PAD_MUXSEL(pad) << bp; + writel(reg, iomux_base + ofs); + + /* drive */ + ofs = DRIVE_OFFSET; + ofs += PAD_BANK(pad) * 0x40 + PAD_PIN(pad) / 8 * 0x10; + /* mA */ + if (PAD_MA_VALID(pad)) { + bp = PAD_PIN(pad) % 8 * 4; + bm = 0x3 << bp; + reg = readl(iomux_base + ofs); + reg &= ~bm; + reg |= PAD_MA(pad) << bp; + writel(reg, iomux_base + ofs); + } + /* vol */ + if (PAD_VOL_VALID(pad)) { + bp = PAD_PIN(pad) % 8 * 4 + 2; + mxs_reg = (struct mx28_register *)(iomux_base + ofs); + if (PAD_VOL(pad)) + writel(1 << bp, &mxs_reg->reg_set); + else + writel(1 << bp, &mxs_reg->reg_clr); + } + + /* pull */ + if (PAD_PULL_VALID(pad)) { + ofs = PULL_OFFSET; + ofs += PAD_BANK(pad) * 0x10; + bp = PAD_PIN(pad); + mxs_reg = (struct mx28_register *)(iomux_base + ofs); + if (PAD_PULL(pad)) + writel(1 << bp, &mxs_reg->reg_set); + else + writel(1 << bp, &mxs_reg->reg_clr); + } + + return 0; +} + +int mxs_iomux_setup_multiple_pads(const iomux_cfg_t *pad_list, unsigned count) +{ + const iomux_cfg_t *p = pad_list; + int i; + int ret; + + for (i = 0; i < count; i++) { + ret = mxs_iomux_setup_pad(*p); + if (ret) + return ret; + p++; + } + + return 0; +} diff --git a/arch/arm/include/asm/arch-mx28/iomux-mx28.h b/arch/arm/include/asm/arch-mx28/iomux-mx28.h new file mode 100644 index 000..b42820d --- /dev/null +++ b/arch/arm/includ
[U-Boot] [PATCH 05/20] iMX28: Add I2C bus driver
Signed-off-by: Marek Vasut Cc: Heiko Schocher Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/i2c/Makefile |1 + drivers/i2c/mxs_i2c.c | 246 + 2 files changed, 247 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/mxs_i2c.c diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index a48047a..2fb521e 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -31,6 +31,7 @@ COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o COBJS-$(CONFIG_I2C_MV) += mv_i2c.o COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o +COBJS-$(CONFIG_I2C_MXS) += mxs_i2c.o COBJS-$(CONFIG_DRIVER_OMAP1510_I2C) += omap1510_i2c.o COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.o COBJS-$(CONFIG_DRIVER_OMAP34XX_I2C) += omap24xx_i2c.o diff --git a/drivers/i2c/mxs_i2c.c b/drivers/i2c/mxs_i2c.c new file mode 100644 index 000..c8fea32 --- /dev/null +++ b/drivers/i2c/mxs_i2c.c @@ -0,0 +1,246 @@ +/* + * Freescale i.MX28 I2C Driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * Partly based on Linux kernel i2c-mxs.c driver: + * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K. + * + * Which was based on a (non-working) driver which was: + * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * 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 +#include +#include +#include +#include +#include +#include + +#defineMXS_I2C_MAX_TIMEOUT 100 + +void mxs_i2c_reset(void) +{ + struct mx28_i2c_regs *i2c_regs = (struct mx28_i2c_regs *)MXS_I2C0_BASE; + int ret; + + ret = mx28_reset_block(&i2c_regs->hw_i2c_ctrl0_reg); + if (ret) { + debug("MXS I2C: Block reset timeout\n"); + return; + } + + writel(I2C_CTRL1_DATA_ENGINE_CMPLT_IRQ | I2C_CTRL1_NO_SLAVE_ACK_IRQ | + I2C_CTRL1_EARLY_TERM_IRQ | I2C_CTRL1_MASTER_LOSS_IRQ | + I2C_CTRL1_SLAVE_STOP_IRQ | I2C_CTRL1_SLAVE_IRQ, + &i2c_regs->hw_i2c_ctrl1_clr); + + writel(I2C_QUEUECTRL_PIO_QUEUE_MODE, &i2c_regs->hw_i2c_queuectrl_set); +} + +void mxs_i2c_setup_read(uint8_t chip, int len) +{ + struct mx28_i2c_regs *i2c_regs = (struct mx28_i2c_regs *)MXS_I2C0_BASE; + + writel(I2C_QUEUECMD_RETAIN_CLOCK | I2C_QUEUECMD_PRE_SEND_START | + I2C_QUEUECMD_MASTER_MODE | I2C_QUEUECMD_DIRECTION | + (1 << I2C_QUEUECMD_XFER_COUNT_OFFSET), + &i2c_regs->hw_i2c_queuecmd); + + writel((chip << 1) | 1, &i2c_regs->hw_i2c_data); + + writel(I2C_QUEUECMD_SEND_NAK_ON_LAST | I2C_QUEUECMD_MASTER_MODE | + (len << I2C_QUEUECMD_XFER_COUNT_OFFSET) | + I2C_QUEUECMD_POST_SEND_STOP, &i2c_regs->hw_i2c_queuecmd); + + writel(I2C_QUEUECTRL_QUEUE_RUN, &i2c_regs->hw_i2c_queuectrl_set); +} + +void mxs_i2c_write(uchar chip, uint addr, int alen, + uchar *buf, int blen, int stop) +{ + struct mx28_i2c_regs *i2c_regs = (struct mx28_i2c_regs *)MXS_I2C0_BASE; + uint32_t data; + int i, remain, off; + + if ((alen > 4) || (alen == 0)) { + debug("MXS I2C: Invalid address length\n"); + return; + } + + if (stop) + stop = I2C_QUEUECMD_POST_SEND_STOP; + + writel(I2C_QUEUECMD_PRE_SEND_START | + I2C_QUEUECMD_MASTER_MODE | I2C_QUEUECMD_DIRECTION | + ((blen + alen + 1) << I2C_QUEUECMD_XFER_COUNT_OFFSET) | stop, + &i2c_regs->hw_i2c_queuecmd); + + data = (chip << 1) << 24; + + for (i = 0; i < alen; i++) { + data >>= 8; + data |= ((char *)&addr)[i] << 24; + if ((i & 3) == 2) + writel(data, &i2c_regs->hw_i2c_data); + } + + off = i; + for (; i < off + blen; i++) { + data >>= 8; + data |= buf[i - off] << 24; + if ((i & 3) == 2) + writel(data, &i2c_regs->hw_i2c_data); + } + + remain = 24 - ((i & 3) * 8); + if (remain) + writel(data >> remain, &i2c_regs->hw_i2c_data); + + writel(I2C_QUEUECTRL_QUEUE_RUN, &i2c_regs->hw_i2c_queuectrl_set); +} + +int mxs_
[U-Boot] [PATCH 07/20] iMX28: Add SPI driver
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/spi/Makefile |1 + drivers/spi/mxs_spi.c | 186 + 2 files changed, 187 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/mxs_spi.c diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 84ad6fa..6f389f0 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -37,6 +37,7 @@ COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o +COBJS-$(CONFIG_MXS_SPI) += mxs_spi.o COBJS-$(CONFIG_OC_TINY_SPI) += oc_tiny_spi.o COBJS-$(CONFIG_OMAP3_SPI) += omap3_spi.o COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c new file mode 100644 index 000..4c27fef --- /dev/null +++ b/drivers/spi/mxs_spi.c @@ -0,0 +1,186 @@ +/* + * Freescale i.MX28 SPI driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 + * + * NOTE: This driver only supports the SPI-controller chipselects, + * GPIO driven chipselects are not supported. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#defineMXS_SPI_MAX_TIMEOUT 100 +#defineMXS_SPI_PORT_OFFSET 0x2000 + +struct mxs_spi_slave { + struct spi_slaveslave; + uint32_tmax_khz; + uint32_tmode; + struct mx28_ssp_regs*regs; +}; + +static inline struct mxs_spi_slave *to_mxs_slave(struct spi_slave *slave) +{ + return container_of(slave, struct mxs_spi_slave, slave); +} + +void spi_init(void) +{ +} + +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + struct mxs_spi_slave *mxs_slave; + uint32_t addr; + + if (bus > 3) { + printf("MXS SPI: Max bus number is 3\n"); + return NULL; + } + + mxs_slave = malloc(sizeof(struct mxs_spi_slave)); + if (!mxs_slave) + return NULL; + + addr = MXS_SSP0_BASE + (bus * MXS_SPI_PORT_OFFSET); + + mxs_slave->slave.bus = bus; + mxs_slave->slave.cs = cs; + mxs_slave->max_khz = max_hz / 1000; + mxs_slave->mode = mode; + mxs_slave->regs = (struct mx28_ssp_regs *)addr; + + return &mxs_slave->slave; +} + +void spi_free_slave(struct spi_slave *slave) +{ + struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); + free(mxs_slave); +} + +int spi_claim_bus(struct spi_slave *slave) +{ + struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); + struct mx28_ssp_regs *ssp_regs = mxs_slave->regs; + uint32_t reg = 0; + + mx28_reset_block(&ssp_regs->hw_ssp_ctrl0_reg); + + writel(SSP_CTRL0_BUS_WIDTH_ONE_BIT, &ssp_regs->hw_ssp_ctrl0); + + reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; + reg |= (mxs_slave->mode & SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; + reg |= (mxs_slave->mode & SPI_CPHA) ? SSP_CTRL1_PHASE : 0; + writel(reg, &ssp_regs->hw_ssp_ctrl1); + + writel(0, &ssp_regs->hw_ssp_cmd0); + + mx28_set_ssp_busclock(slave->bus, mxs_slave->max_khz); + + return 0; +} + +void spi_release_bus(struct spi_slave *slave) +{ +} + +static void mxs_spi_start_xfer(struct mx28_ssp_regs *ssp_regs) +{ + writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_set); + writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_clr); +} + +static void mxs_spi_end_xfer(struct mx28_ssp_regs *ssp_regs) +{ + writel(SSP_CTRL0_LOCK_CS, &ssp_regs->hw_ssp_ctrl0_clr); + writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set); +} + +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, + const void *dout, void *din, unsigned long flags) +{ + struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); + struct mx28_ssp_regs *ssp_regs = mxs_slave->regs; + int len = bitlen / 8; + const char *tx = dout; + char *rx = din; + + if (bitlen == 0) + return 0; + + if (!rx && !tx) +
[U-Boot] [PATCH 08/20] iMX28: Add APBH DMA driver
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- arch/arm/include/asm/arch-mx28/dma.h | 170 +++ arch/arm/include/asm/arch-mx28/imx-regs.h |1 + arch/arm/include/asm/arch-mx28/regs-apbh.h | 466 +++ drivers/dma/Makefile |1 + drivers/dma/apbh_dma.c | 691 5 files changed, 1329 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-mx28/dma.h create mode 100644 arch/arm/include/asm/arch-mx28/regs-apbh.h create mode 100644 drivers/dma/apbh_dma.c diff --git a/arch/arm/include/asm/arch-mx28/dma.h b/arch/arm/include/asm/arch-mx28/dma.h new file mode 100644 index 000..7061e7c --- /dev/null +++ b/arch/arm/include/asm/arch-mx28/dma.h @@ -0,0 +1,170 @@ +/* + * Freescale i.MX28 APBH DMA + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * Based on code from LTIB: + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * 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 __DMA_H__ +#define __DMA_H__ + +#include + +#ifndefCONFIG_ARCH_DMA_PIO_WORDS +#defineDMA_PIO_WORDS 15 +#else +#defineDMA_PIO_WORDS CONFIG_ARCH_DMA_PIO_WORDS +#endif + +#define MXS_DMA_ALIGNMENT 32 + +/* + * MXS DMA channels + */ +enum { + MXS_DMA_CHANNEL_AHB_APBH_SSP0 = 0, + MXS_DMA_CHANNEL_AHB_APBH_SSP1, + MXS_DMA_CHANNEL_AHB_APBH_SSP2, + MXS_DMA_CHANNEL_AHB_APBH_SSP3, + MXS_DMA_CHANNEL_AHB_APBH_GPMI0, + MXS_DMA_CHANNEL_AHB_APBH_GPMI1, + MXS_DMA_CHANNEL_AHB_APBH_GPMI2, + MXS_DMA_CHANNEL_AHB_APBH_GPMI3, + MXS_DMA_CHANNEL_AHB_APBH_GPMI4, + MXS_DMA_CHANNEL_AHB_APBH_GPMI5, + MXS_DMA_CHANNEL_AHB_APBH_GPMI6, + MXS_DMA_CHANNEL_AHB_APBH_GPMI7, + MXS_DMA_CHANNEL_AHB_APBH_SSP, + MXS_MAX_DMA_CHANNELS, +}; + +/* + * MXS DMA hardware command. + * + * This structure describes the in-memory layout of an entire DMA command, + * including space for the maximum number of PIO accesses. See the appropriate + * reference manual for a detailed description of what these fields mean to the + * DMA hardware. + */ +#defineMXS_DMA_DESC_COMMAND_MASK 0x3 +#defineMXS_DMA_DESC_COMMAND_OFFSET 0 +#defineMXS_DMA_DESC_COMMAND_NO_DMAXFER 0x0 +#defineMXS_DMA_DESC_COMMAND_DMA_WRITE 0x1 +#defineMXS_DMA_DESC_COMMAND_DMA_READ 0x2 +#defineMXS_DMA_DESC_COMMAND_DMA_SENSE 0x3 +#defineMXS_DMA_DESC_CHAIN (1 << 2) +#defineMXS_DMA_DESC_IRQ(1 << 3) +#defineMXS_DMA_DESC_NAND_LOCK (1 << 4) +#defineMXS_DMA_DESC_NAND_WAIT_4_READY (1 << 5) +#defineMXS_DMA_DESC_DEC_SEM(1 << 6) +#defineMXS_DMA_DESC_WAIT4END (1 << 7) +#defineMXS_DMA_DESC_HALT_ON_TERMINATE (1 << 8) +#defineMXS_DMA_DESC_TERMINATE_FLUSH(1 << 9) +#defineMXS_DMA_DESC_PIO_WORDS_MASK (0xf << 12) +#defineMXS_DMA_DESC_PIO_WORDS_OFFSET 12 +#defineMXS_DMA_DESC_BYTES_MASK (0x << 16) +#defineMXS_DMA_DESC_BYTES_OFFSET 16 + +struct mxs_dma_cmd { + unsigned long next; + unsigned long data; + union { + dma_addr_t address; + unsigned long alternate; + }; + unsigned long pio_words[DMA_PIO_WORDS]; +}; + +/* + * MXS DMA command descriptor. + * + * This structure incorporates an MXS DMA hardware command structure, along + * with metadata. + */ +#defineMXS_DMA_DESC_FIRST (1 << 0) +#defineMXS_DMA_DESC_LAST (1 << 1) +#defineMXS_DMA_DESC_READY (1 << 31) + +struct mxs_dma_desc { + struct mxs_dma_cmd cmd; + unsigned intflags; + dma_addr_t address; + void*buffer; + struct list_headnode; +}; + +/** + * MXS DMA channel + * + * This structure represents a single DMA channel. The MXS platform code + * maintains an array of these structures to represent every DMA channel in the + * system (see mxs_dma_channels). + */ +#defineMXS_DMA_FLAGS_IDLE 0 +#
[U-Boot] [PATCH 09/20] iMX28: Add GPMI NAND driver
Signed-off-by: Marek Vasut Cc: Scott Wood Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/mxs_nand.c | 1118 +++ 2 files changed, 1119 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/mxs_nand.c diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 28bd350..36ee454 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -54,6 +54,7 @@ COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o COBJS-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o COBJS-$(CONFIG_NAND_MXC) += mxc_nand.o +COBJS-$(CONFIG_NAND_MXS) += mxs_nand.o COBJS-$(CONFIG_NAND_NDFC) += ndfc.o COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c new file mode 100644 index 000..ce2a326 --- /dev/null +++ b/drivers/mtd/nand/mxs_nand.c @@ -0,0 +1,1118 @@ +/* + * Freescale i.MX28 NAND flash driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * Based on code from LTIB: + * Freescale GPMI NFC NAND Flash Driver + * + * Copyright (C) 2010 Freescale Semiconductor, Inc. + * Copyright (C) 2008 Embedded Alley Solutions, 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#defineMXS_NAND_DMA_DESCRIPTOR_COUNT 4 + +#defineMXS_NAND_CHUNK_DATA_CHUNK_SIZE 512 +#defineMXS_NAND_METADATA_SIZE 10 + +#defineMXS_NAND_COMMAND_BUFFER_SIZE32 + +#defineMXS_NAND_BCH_TIMEOUT1 + +struct mxs_nand_info { + int cur_chip; + + uint32_tcmd_queue_len; + + uint8_t *cmd_buf; + uint8_t *data_buf; + uint8_t *oob_buf; + + uint8_t marking_block_bad; + uint8_t raw_oob_mode; + + /* Functions with altered behaviour */ + int (*hooked_read_oob)(struct mtd_info *mtd, + loff_t from, struct mtd_oob_ops *ops); + int (*hooked_write_oob)(struct mtd_info *mtd, + loff_t to, struct mtd_oob_ops *ops); + int (*hooked_block_markbad)(struct mtd_info *mtd, + loff_t ofs); + + /* DMA descriptors */ + struct mxs_dma_desc **desc; + uint32_tdesc_index; +}; + +struct nand_ecclayout fake_ecc_layout; + +static struct mxs_dma_desc *mxs_nand_get_dma_desc(struct mxs_nand_info *info) +{ + struct mxs_dma_desc *desc; + + if (info->desc_index >= MXS_NAND_DMA_DESCRIPTOR_COUNT) { + printf("MXS NAND: Too many DMA descriptors requested\n"); + return NULL; + } + + desc = info->desc[info->desc_index]; + info->desc_index++; + + return desc; +} + +static void mxs_nand_return_dma_descs(struct mxs_nand_info *info) +{ + int i; + struct mxs_dma_desc *desc; + + for (i = 0; i < info->desc_index; i++) { + desc = info->desc[i]; + memset(desc, 0, sizeof(struct mxs_dma_desc)); + desc->address = (dma_addr_t)desc; + } + + info->desc_index = 0; +} + +static uint32_t mxs_nand_ecc_chunk_cnt(uint32_t page_data_size) +{ + return page_data_size / MXS_NAND_CHUNK_DATA_CHUNK_SIZE; +} + +static uint32_t mxs_nand_ecc_size_in_bits(uint32_t ecc_strength) +{ + return ecc_strength * 13; +} + +static uint32_t mxs_nand_aux_status_offset(void) +{ + return (MXS_NAND_METADATA_SIZE + 0x3) & ~0x3; +} + +static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, + uint32_t page_oob_size) +{ + if (page_data_size == 2048) + return 8; + + if (page_data_size == 4096) { + if (page_oob_size == 128) + return 8; + + if (page_oob_size == 218) + return 16; + } + + return 0; +} + +static inline uin
[U-Boot] [PATCH 10/20] iMX28: Add driver for internal RTC
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- drivers/rtc/Makefile |1 + drivers/rtc/mxsrtc.c | 86 ++ 2 files changed, 87 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/mxsrtc.c diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index a16f590..faf4fcd 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -57,6 +57,7 @@ COBJS-$(CONFIG_RTC_MK48T59) += mk48t59.o COBJS-$(CONFIG_RTC_MPC5200) += mpc5xxx.o COBJS-$(CONFIG_RTC_MPC8xx) += mpc8xx.o COBJS-$(CONFIG_RTC_MV) += mvrtc.o +COBJS-$(CONFIG_RTC_MXS) += mxsrtc.o COBJS-$(CONFIG_RTC_PCF8563) += pcf8563.o COBJS-$(CONFIG_RTC_PL031) += pl031.o COBJS-$(CONFIG_RTC_PT7C4338) += pt7c4338.o diff --git a/drivers/rtc/mxsrtc.c b/drivers/rtc/mxsrtc.c new file mode 100644 index 000..5beb1a0 --- /dev/null +++ b/drivers/rtc/mxsrtc.c @@ -0,0 +1,86 @@ +/* + * Freescale i.MX28 RTC Driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 +#include +#include +#include +#include + +#defineMXS_RTC_MAX_TIMEOUT 100 + +/* Set time in seconds since 1970-01-01 */ +int mxs_rtc_set_time(uint32_t secs) +{ + struct mx28_rtc_regs *rtc_regs = (struct mx28_rtc_regs *)MXS_RTC_BASE; + int ret; + + writel(secs, &rtc_regs->hw_rtc_seconds); + + /* +* The 0x80 here means seconds were copied to analog. This information +* is taken from the linux kernel driver for the STMP37xx RTC since +* documentation doesn't mention it. +*/ + ret = mx28_wait_mask_clr(&rtc_regs->hw_rtc_stat_reg, + 0x80 << RTC_STAT_STALE_REGS_OFFSET, MXS_RTC_MAX_TIMEOUT); + + if (ret) + printf("MXS RTC: Timeout waiting for update\n"); + + return ret; +} + +int rtc_get(struct rtc_time *time) +{ + struct mx28_rtc_regs *rtc_regs = (struct mx28_rtc_regs *)MXS_RTC_BASE; + uint32_t secs; + + secs = readl(&rtc_regs->hw_rtc_seconds); + to_tm(secs, time); + + return 0; +} + +int rtc_set(struct rtc_time *time) +{ + uint32_t secs; + + secs = mktime(time->tm_year, time->tm_mon, time->tm_mday, + time->tm_hour, time->tm_min, time->tm_sec); + + return mxs_rtc_set_time(secs); +} + +void rtc_reset(void) +{ + struct mx28_rtc_regs *rtc_regs = (struct mx28_rtc_regs *)MXS_RTC_BASE; + int ret; + + /* Set time to 1970-01-01 */ + mxs_rtc_set_time(0); + + /* Reset the RTC block */ + ret = mx28_reset_block(&rtc_regs->hw_rtc_ctrl_reg); + if (ret) + printf("MXS RTC: Block reset timeout\n"); +} -- 1.7.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/20] iMX28: Add image header generator tool
This tool can now generate proper image for "BootStream" files. NOTE: This tool now works only for NAND. Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- tools/.gitignore |1 + tools/Makefile |6 + tools/mxsboot.c | 684 ++ 3 files changed, 691 insertions(+), 0 deletions(-) create mode 100644 tools/mxsboot.c diff --git a/tools/.gitignore b/tools/.gitignore index 07f21a3..98a5c78 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -4,6 +4,7 @@ /img2srec /mkimage /mpc86x_clk +/mxsboot /ncb /ncp /ubsha1 diff --git a/tools/Makefile b/tools/Makefile index df56a25..ca93156 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -67,6 +67,7 @@ BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX) BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX) BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX) BIN_FILES-y += mkimage$(SFX) +BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX) BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) @@ -91,6 +92,7 @@ NOPED_OBJ_FILES-y += kwbimage.o NOPED_OBJ_FILES-y += imximage.o NOPED_OBJ_FILES-y += omapimage.o NOPED_OBJ_FILES-y += mkimage.o +OBJ_FILES-$(CONFIG_MX28) += mxsboot.o OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o NOPED_OBJ_FILES-y += os_support.o OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o @@ -206,6 +208,10 @@ $(obj)mpc86x_clk$(SFX):$(obj)mpc86x_clk.o $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTSTRIP) $@ +$(obj)mxsboot$(SFX): $(obj)mxsboot.o + $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ + $(HOSTSTRIP) $@ + $(obj)ncb$(SFX): $(obj)ncb.o $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTSTRIP) $@ diff --git a/tools/mxsboot.c b/tools/mxsboot.c new file mode 100644 index 000..176753d --- /dev/null +++ b/tools/mxsboot.c @@ -0,0 +1,684 @@ +/* + * Freescale i.MX28 image generator + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 +#include +#include +#include + +#include "compiler.h" + +/* + * Default BCB layout. + * + * TWEAK this if you have blown any OCOTP fuses. + */ +#defineSTRIDE_PAGES64 +#defineSTRIDE_COUNT4 + +/* + * Layout for 256Mb big NAND with 2048b page size, 64b OOB size and + * 128kb erase size. + * + * TWEAK this if you have different kind of NAND chip. + */ +uint32_t nand_writesize = 2048; +uint32_t nand_oobsize = 64; +uint32_t nand_erasesize = 128 * 1024; + +/* + * Sector on which the SigmaTel boot partition (0x53) starts. + */ +uint32_t sd_sector = 2048; + +/* + * Each of the U-Boot bootstreams is at maximum 1MB big. + * + * TWEAK this if, for some wild reason, you need to boot bigger image. + */ +#defineMAX_BOOTSTREAM_SIZE (1 * 1024 * 1024) + +/* i.MX28 NAND controller-specific constants. DO NOT TWEAK! */ +#defineMXS_NAND_DMA_DESCRIPTOR_COUNT 4 +#defineMXS_NAND_CHUNK_DATA_CHUNK_SIZE 512 +#defineMXS_NAND_METADATA_SIZE 10 +#defineMXS_NAND_COMMAND_BUFFER_SIZE32 + +struct mx28_nand_fcb { + uint32_tchecksum; + uint32_tfingerprint; + uint32_tversion; + struct { + uint8_t data_setup; + uint8_t data_hold; + uint8_t address_setup; + uint8_t dsample_time; + uint8_t nand_timing_state; + uint8_t rea; + uint8_t rloh; + uint8_t rhoh; + } timing; + uint32_tpage_data_size; + uint32_ttotal_page_size; + uint32_tsectors_per_block; + uint32_tnumber_of_nands;/* Ignored */ + uint32_ttotal_internal_die; /* Ignored */ + uint32_tcell_type; /* Ignor
[U-Boot] [PATCH 12/20] iMX28: Add u-boot.sb target to Makefile
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- .gitignore |1 + Makefile |5 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 70a11f7..ff4bae0 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ /u-boot.lds /u-boot.ubl /u-boot.dtb +/u-boot.sb # # Generated files diff --git a/Makefile b/Makefile index 294c762..c9e2624 100644 --- a/Makefile +++ b/Makefile @@ -424,6 +424,10 @@ $(obj)u-boot.ubl: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin rm $(obj)u-boot-ubl.bin rm $(obj)spl/u-boot-spl-pad.bin +$(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin + elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \ + -o $(obj)u-boot.sb + ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \ cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ @@ -791,6 +795,7 @@ clobber:clean @rm -f $(obj)u-boot.imx @rm -f $(obj)u-boot.ubl @rm -f $(obj)u-boot.dtb + @rm -f $(obj)u-boot.sb @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes} @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm -- 1.7.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 15/20] M28: Add doc/README.m28 documentation
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- doc/README.m28 | 223 1 files changed, 223 insertions(+), 0 deletions(-) create mode 100644 doc/README.m28 diff --git a/doc/README.m28 b/doc/README.m28 new file mode 100644 index 000..b749ce0 --- /dev/null +++ b/doc/README.m28 @@ -0,0 +1,223 @@ +DENX M28EVK +=== + +This document describes the DENX M28/M28EVK U-Boot port. This document mostly +covers topics related to making the module/board bootable. + +Terminology +--- + +The dollar symbol ($) introduces a snipped of shell code. This shall be typed +into the unix command prompt in U-Boot source code root directory. + +The (=>) introduces a snipped of code that should by typed into U-Boot command +prompt. + +Contents + + +0) Files of the M28/M28EVK port +1) Prerequisites +2) Compiling U-Boot for M28 +3) Installation of U-Boot for M28EVK to SD card +4) Installation of U-Boot for M28 to NAND flash + +0) Files of the M28/M28EVK port +--- + +arch/arm/cpu/arm926ejs/mx28/ - The CPU support code for the Freescale i.MX28 +arch/arm/include/asm/arch-mx28/- Header files for the Freescale i.MX28 +board/denx/m28evk/ - M28EVK board specific files +include/configs/m28evk.h - M28EVK configuration file + +1) Prerequisites + + +To make the M28 module or the M28 module or M28EVK board bootable, some tools +are necessary. The first one is the "elftosb" tool distributed by Freescale +Semiconductor. The other tool is the "mxsboot" tool found in U-Boot source tree. + +Firstly, obtain the elftosb archive from the following location: + + http://foss.doredevelopment.dk/mirrors/imx/elftosb-10.12.01.tar.gz + +We use a $VER variable here to denote the current version. At the time of +writing of this document, that is "10.12.01". To obtain the file from command +line, use: + + $ VER="10.12.01" + $ wget http://foss.doredevelopment.dk/mirrors/imx/elftosb-${VER}.tar.gz + +Extract the file: + + $ tar xzf elftosb-${VER}.tar.gz + +Compile the file. We need to manually tell the linker to use also libm: + + $ cd elftosb-${VER}/ + $ make LIBS="-lstdc++ -lm" elftosb + +Optionally, remove debugging symbols from elftosb: + + $ strip bld/linux/elftosb + +Finally, install the "elftosb" binary. The "install" target is missing, so just +copy the binary by hand: + + $ sudo cp bld/linux/elftosb /usr/local/bin/ + +Make sure the "elftosb" binary can be found in your $PATH, in this case this +means "/usr/local/bin/" has to be in your $PATH. + +2) Compiling U-Boot for M28 +--- + +Compiling the U-Boot for M28 is straightforward and done as compiling U-Boot +for any other ARM device. For cross-compiler setup, please refer to ELDK5.0 +documentation. First, clean up the source code: + + $ make mrproper + +Next, configure U-Boot for M28EVK: + + $ make m28evk_config + +Lastly, compile U-Boot and prepare a "BootStream". The "BootStream" is a special +type of file, which the i.MX28 CPU can boot. This is handled by the following +command: + + $ make u-boot.sb + +HINT: To speed-up the build process, you can add -j, where N is number of + compiler instances that'll run in parallel. + +The code produces "u-boot.sb" file. This file needs to be augmented with a +proper header to allow successful boot from SD or NAND. Adding the header is +discussed in the following chapters. + +3) Installation of U-Boot for M28EVK to SD card +--- + +To boot an M28 from SD, set the boot mode DIP switches according to i.MX28 +manual chapter 12.2.1 (Table 12-2), PORT=SSP0, SD/MMC master on SSP0, 3.3V. + +An SD card the i.MX28 CPU can use to boot U-Boot must contain a DOS partition +table, which in turn carries a partition of special type and which contains a +special header. The rest of partitions in the DOS partition table can be used +by the user. + +To prepare such partition, use your favourite partitioning tool. The partition +must have the following parameters: + + * Start sector .. sector 2048 + * Partition size at least 1024 kb + * Partition type 0x53 (sometimes "OnTrack DM6 Aux3") + +For example in Linux fdisk, the sequence for a clear card is the following: + + * o . create a clear partition table + * n . create new partition + * p . primary partition + * 1 . first partition + * 2048 .. first sector is 2048 + * +1M ... make the partition 1Mb big + * t 1 ... change first partition ID + * 53 change the ID to 0x53 (OnTrack DM6 Aux3) + * + * w . write partition table to disk + +The p
[U-Boot] [PATCH 13/20] iMX28: Add support for DENX M28EVK board
This contains support for the following components: - DUART - MMC - Both FEC interfaces - NAND - I2C (RTC, EEPROM) - SPI (FLASH) Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- MAINTAINERS|1 + board/denx/m28evk/Makefile | 43 +++ board/denx/m28evk/m28evk.c | 195 ++ boards.cfg |1 + include/configs/m28evk.h | 282 5 files changed, 522 insertions(+), 0 deletions(-) create mode 100644 board/denx/m28evk/Makefile create mode 100644 board/denx/m28evk/m28evk.c create mode 100644 include/configs/m28evk.h diff --git a/MAINTAINERS b/MAINTAINERS index 030fe4a..3fa2b70 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -859,6 +859,7 @@ Marek Vasut palmtc xscale/pxa vpac270 xscale/pxa zipitz2 xscale/pxa + m28evk i.MX28 efikamx i.MX51 efikasb i.MX51 diff --git a/board/denx/m28evk/Makefile b/board/denx/m28evk/Makefile new file mode 100644 index 000..e6aba9a --- /dev/null +++ b/board/denx/m28evk/Makefile @@ -0,0 +1,43 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, w...@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 +# + +include $(TOPDIR)/config.mk + +LIB= $(obj)lib$(BOARD).o + +COBJS := m28evk.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB):$(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c new file mode 100644 index 000..118e222 --- /dev/null +++ b/board/denx/m28evk/m28evk.c @@ -0,0 +1,195 @@ +/* + * DENX M28 module + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Functions + */ +int board_early_init_f(void) +{ + /* IO0 clock at 480MHz */ + mx28_set_ioclk(MXC_IOCLK0, 48); + /* IO1 clock at 480MHz */ + mx28_set_ioclk(MXC_IOCLK1, 48); + + /* SSP0 clock at 96MHz */ + mx28_set_sspclk(MXC_SSPCLK0, 96000, 0); + /* SSP2 clock at 96MHz */ + mx28_set_sspclk(MXC_SSPCLK2, 96000, 0); + + return 0; +} + +int board_init(void) +{ + /* Adress of boot parameters */ + gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; + + return 0; +} + +int dram_init(void) +{ + /* dram_init must store complete ramsize in gd->ram_size */ + gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); + return 0; +} + +#ifdef CONFIG_CMD_MMC +static int m28_mmc_wp(int id) +{ + if (id != 0) { + printf("MXS MMC: Invalid card selected (card id = %d)\n", id); + return 1; + } + + return gpio_get_value(MX28_PAD_AUART2_CTS__GPIO_3_10); +} + +int board_mmc_init(bd_t *bis) +{ + /* Configure WP as output */ + gpio_direction_input(MX28_PAD_AUART2_CTS__GPIO_3_10); + + return mxsmmc_initialize(bis, 0, m
[U-Boot] [PATCH 16/20] iMX28: Fix ARM vector handling
This patch introduces proper ARM vector handling for i.MX28 CPU. This issue wasn't addressed because the interrupts weren't enabled on any ARMv5 core, therefore the issue wasn't noticed earlier. In previous implementation, the vectoring code used by i.MX28 CPU when an exception happened was that of the SPL. With this change, the branch target when an exception happens can be reconfigured by U-Boot. Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- arch/arm/cpu/arm926ejs/mx28/mx28.c | 22 +++ board/denx/m28evk/start.S | 264 +++- include/configs/m28evk.h |1 + 3 files changed, 74 insertions(+), 213 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c index e990f3c..088c019 100644 --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c @@ -35,6 +35,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + /* 1 second delay should be plenty of time for block reset. */ #defineRESET_MAX_TIMEOUT 100 @@ -116,11 +118,31 @@ int mx28_reset_block(struct mx28_register *reg) return 0; } +void mx28_fixup_vt(uint32_t start_addr) +{ + uint32_t *vt = (uint32_t *)0x20; + int i; + + for (i = 0; i < 8; i++) + vt[i] = start_addr + (4 * i); +} + +#ifdef CONFIG_ARCH_MISC_INIT +int arch_misc_init(void) +{ + mx28_fixup_vt(gd->relocaddr); + return 0; +} +#endif + #ifdef CONFIG_ARCH_CPU_INIT int arch_cpu_init(void) { struct mx28_clkctrl_regs *clkctrl_regs = (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; + extern uint32_t _start; + + mx28_fixup_vt((uint32_t)&_start); /* * Enable NAND clock diff --git a/board/denx/m28evk/start.S b/board/denx/m28evk/start.S index cf67599..94696d6 100644 --- a/board/denx/m28evk/start.S +++ b/board/denx/m28evk/start.S @@ -58,54 +58,58 @@ .globl _start _start: b reset -#ifdef CONFIG_SPL_BUILD -/* No exception handlers in preloader */ - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - b reset - ldr pc, _hang - ldr pc, _hang + b undefined_instruction + b software_interrupt + b prefetch_abort + b data_abort + b not_used + b irq + b fiq -_hang: - .word do_hang -/* pad to 64 byte boundary */ - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 -#else - ldr pc, _undefined_instruction - ldr pc, _software_interrupt - ldr pc, _prefetch_abort - ldr pc, _data_abort - ldr pc, _not_used - ldr pc, _irq - ldr pc, _fiq +/* + * Vector table, located at address 0x20. + * This table allows the code running AFTER SPL, the U-Boot, to install it's + * interrupt handlers here. The problem is that the U-Boot is loaded into RAM, + * including it's interrupt vectoring table and the table at 0x0 is still the + * SPLs. So if interrupt happens in U-Boot, the SPLs interrupt vectoring table + * is still used. + */ +_vt_reset: + .word _reset +_vt_undefined_instruction: + .word _hang +_vt_software_interrupt: + .word _hang +_vt_prefetch_abort: + .word _hang +_vt_data_abort: + .word _hang +_vt_not_used: + .word _reset +_vt_irq: + .word _hang +_vt_fiq: + .word _hang -_undefined_instruction: - .word undefined_instruction -_software_interrupt: - .word software_interrupt -_prefetch_abort: - .word prefetch_abort -_data_abort: - .word data_abort -_not_used: - .word not_used -_irq: - .word irq -_fiq: - .word fiq +reset: + ldr pc, _vt_reset +undefined_instruction: + ldr pc, _vt_undefined_instruction +software_interrupt: + ldr pc, _vt_software_interrupt +prefetch_abort: + ldr pc, _vt_prefetch_abort +data_abort: + ldr pc, _vt_data_abort +not_used: + ldr pc, _vt_not_used +irq: + ldr pc, _vt_irq +fiq: + ldr pc, _vt_fiq -#endif /* CONFIG_SPL_BUILD */ .balignl 16,0xdeadbeef - /* * * @@ -162,7 +166,7 @@ IRQ_STACK_START_IN: * the actual reset code */ -reset: +_reset: /* * Store all registers on old stack pointer, this will allow us later to * return to the BootROM and let the BootROM load U-Boot into RAM. @@ -220,177 +224,11 @@ cpu_init_crit: mcr p15, 0, r0, c1, c0, 0 mov pc, lr /* back to my caller */ -#endif /* CONFIG_SKIP_LOWLEVEL_INIT */ - -#ifndef CONFIG_SPL_BUILD -/* - ***
[U-Boot] [PATCH 17/20] M28: Add memory detection into SPL
This code allows the DDR DRAM size to be detected at runtime. The RAM size is stored into two scratch registers, from which it is then fetched in U-Boot. Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- board/denx/m28evk/Makefile |7 ++- board/denx/m28evk/m28evk.c | 18 -- board/denx/m28evk/mem_init.c | 27 +++ include/configs/m28evk.h |2 +- 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/board/denx/m28evk/Makefile b/board/denx/m28evk/Makefile index 47229e6..b6f002f 100644 --- a/board/denx/m28evk/Makefile +++ b/board/denx/m28evk/Makefile @@ -30,7 +30,7 @@ COBJS := m28evk.o endif ifdef CONFIG_SPL_BUILD -COBJS := mem_init.o mmc_boot.o power_init.o +COBJS := mem_init.o mmc_boot.o power_init.o memsize.o endif SRCS := $(COBJS:.o=.c) @@ -41,6 +41,11 @@ $(LIB): $(obj).depend $(OBJS) all: $(ALL) +ifdef CONFIG_SPL_BUILD +memsize.c: + ln -sf $(TOPDIR)/common/memsize.c $@ +endif + # # defines $(obj).depend target diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c index 118e222..168ceeb 100644 --- a/board/denx/m28evk/m28evk.c +++ b/board/denx/m28evk/m28evk.c @@ -63,10 +63,24 @@ int board_init(void) return 0; } +#defineHW_DIGCTRL_SCRATCH0 0x8001c280 +#defineHW_DIGCTRL_SCRATCH1 0x8001c290 int dram_init(void) { - /* dram_init must store complete ramsize in gd->ram_size */ - gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); + uint32_t sz[2]; + + sz[0] = readl(HW_DIGCTRL_SCRATCH0); + sz[1] = readl(HW_DIGCTRL_SCRATCH1); + + if (sz[0] != sz[1]) { + printf("MX28:\n" + "Error, the RAM size in HW_DIGCTRL_SCRATCH0 and\n" + "HW_DIGCTRL_SCRATCH1 is not the same. Please\n" + "verify these two registers contain valid RAM size!\n"); + hang(); + } + + gd->ram_size = sz[0]; return 0; } diff --git a/board/denx/m28evk/mem_init.c b/board/denx/m28evk/mem_init.c index 066fe0d..17d1f9b 100644 --- a/board/denx/m28evk/mem_init.c +++ b/board/denx/m28evk/mem_init.c @@ -165,6 +165,31 @@ void mx28_mem_setup_vddd(void) &power_regs->hw_power_vdddctrl); } +#defineHW_DIGCTRL_SCRATCH0 0x8001c280 +#defineHW_DIGCTRL_SCRATCH1 0x8001c290 +void data_abort_memdetect_handler(void) __attribute__((naked)); +void data_abort_memdetect_handler(void) +{ + asm volatile("subs pc, r14, #4"); +} + +void mx28_mem_get_size(void) +{ + uint32_t sz, da; + uint32_t *vt = (uint32_t *)0x20; + + /* Replace the DABT handler. */ + da = vt[4]; + vt[4] = (uint32_t)&data_abort_memdetect_handler; + + sz = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); + writel(sz, HW_DIGCTRL_SCRATCH0); + writel(sz, HW_DIGCTRL_SCRATCH1); + + /* Restore the old DABT handler. */ + vt[4] = da; +} + void mx28_mem_init(void) { struct mx28_clkctrl_regs *clkctrl_regs = @@ -210,4 +235,6 @@ void mx28_mem_init(void) early_delay(1); mx28_mem_setup_cpu_and_hbus(); + + mx28_mem_get_size(); } diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h index 381b01e..c8b0cf5 100644 --- a/include/configs/m28evk.h +++ b/include/configs/m28evk.h @@ -81,7 +81,7 @@ */ #defineCONFIG_NR_DRAM_BANKS1 /* 2 banks of DRAM */ #definePHYS_SDRAM_10x4000 /* Base address */ -#definePHYS_SDRAM_1_SIZE 0x0800 /* 128 MB */ +#definePHYS_SDRAM_1_SIZE 0x4000 /* Max 1 GB RAM */ #defineCONFIG_STACKSIZE0x0001 /* 128 KB stack */ #defineCONFIG_SYS_MALLOC_LEN 0x0040 /* 4 MB for malloc */ #defineCONFIG_SYS_GBL_DATA_SIZE128 /* Initial data */ -- 1.7.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 06/20] iMX28: Add GPIO control
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel --- arch/arm/cpu/arm926ejs/mx28/mx28.c|6 ++ arch/arm/include/asm/arch-mx28/gpio.h | 32 drivers/gpio/Makefile |1 + drivers/gpio/mxs_gpio.c | 136 + 4 files changed, 175 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-mx28/gpio.h create mode 100644 drivers/gpio/mxs_gpio.c diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c index 446ea8b..e990f3c 100644 --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -134,6 +135,11 @@ int arch_cpu_init(void) udelay(1000); + /* +* Configure GPIO unit +*/ + mxs_gpio_init(); + return 0; } #endif diff --git a/arch/arm/include/asm/arch-mx28/gpio.h b/arch/arm/include/asm/arch-mx28/gpio.h new file mode 100644 index 000..be1c944 --- /dev/null +++ b/arch/arm/include/asm/arch-mx28/gpio.h @@ -0,0 +1,32 @@ +/* + * Freescale i.MX28 GPIO + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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__MX28_GPIO_H__ +#define__MX28_GPIO_H__ + +#ifdef CONFIG_MXS_GPIO +void mxs_gpio_init(void); +#else +inline void mxs_gpio_init(void) {} +#endif + +#endif /* __MX28_GPIO_H__ */ diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index f505813..e1142d1 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -30,6 +30,7 @@ COBJS-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o COBJS-$(CONFIG_MARVELL_GPIO) += mvgpio.o COBJS-$(CONFIG_MARVELL_MFP)+= mvmfp.o COBJS-$(CONFIG_MXC_GPIO) += mxc_gpio.o +COBJS-$(CONFIG_MXS_GPIO) += mxs_gpio.o COBJS-$(CONFIG_PCA953X)+= pca953x.o COBJS-$(CONFIG_PCA9698)+= pca9698.o COBJS-$(CONFIG_S5P)+= s5p_gpio.o diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c new file mode 100644 index 000..b7e9591 --- /dev/null +++ b/drivers/gpio/mxs_gpio.c @@ -0,0 +1,136 @@ +/* + * Freescale i.MX28 GPIO control code + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 +#include +#include +#include +#include +#include + +#ifdefined(CONFIG_MX23) +#definePINCTRL_BANKS 3 +#definePINCTRL_DOUT(n) (0x0500 + ((n) * 0x10)) +#definePINCTRL_DIN(n) (0x0600 + ((n) * 0x10)) +#definePINCTRL_DOE(n) (0x0700 + ((n) * 0x10)) +#definePINCTRL_PIN2IRQ(n) (0x0800 + ((n) * 0x10)) +#definePINCTRL_IRQEN(n)(0x0900 + ((n) * 0x10)) +#definePINCTRL_IRQSTAT(n) (0x0c00 + ((n) * 0x10)) +#elif defined(CONFIG_MX28) +#definePINCTRL_BANKS 5 +#definePINCTRL_DOUT(n) (0x0700 + ((n) * 0x10)) +#definePINCTRL_DIN(n) (0x0900 + ((n) * 0x10)) +#definePINCTRL_DOE(n) (0x0b00 + ((n) * 0x10)) +#definePINCTRL_PIN2IRQ(n) (0x1000 + ((n) * 0x10)) +#definePINCTRL_IRQEN(n)(0x1100 + ((n) * 0x10)) +#definePINCTRL_IRQSTAT(n) (0x1400 + ((n) * 0x10)) +#else +#error "Please select CONFIG_MX23 or CONFIG_MX28" +#endif + +#define GPIO_INT_FALL_EDGE 0x0 +#define GPIO_INT_LOW_LEV 0x1 +#define GPIO
[U-Boot] [PATCH 18/20] iMX28: Add USB and USB PHY register definitions
Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel Cc: Remy Bohmer --- arch/arm/include/asm/arch-mx28/regs-usb.h| 178 ++ arch/arm/include/asm/arch-mx28/regs-usbphy.h | 151 ++ 2 files changed, 329 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-mx28/regs-usb.h create mode 100644 arch/arm/include/asm/arch-mx28/regs-usbphy.h diff --git a/arch/arm/include/asm/arch-mx28/regs-usb.h b/arch/arm/include/asm/arch-mx28/regs-usb.h new file mode 100644 index 000..ea61de8 --- /dev/null +++ b/arch/arm/include/asm/arch-mx28/regs-usb.h @@ -0,0 +1,178 @@ +/* + * Freescale i.MX28 USB OTG Register Definitions + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 __REGS_USB_H__ +#define __REGS_USB_H__ + +struct mx28_usb_regs { + uint32_thw_usbctrl_id; /* 0x000 */ + uint32_thw_usbctrl_hwgeneral; /* 0x004 */ + uint32_thw_usbctrl_hwhost; /* 0x008 */ + uint32_thw_usbctrl_hwdevice;/* 0x00c */ + uint32_thw_usbctrl_hwtxbuf; /* 0x010 */ + uint32_thw_usbctrl_hwrxbuf; /* 0x014 */ + + uint32_treserved1[26]; + + uint32_thw_usbctrl_gptimer0ld; /* 0x080 */ + uint32_thw_usbctrl_gptimer0ctrl;/* 0x084 */ + uint32_thw_usbctrl_gptimer1ld; /* 0x088 */ + uint32_thw_usbctrl_gptimer1ctrl;/* 0x08c */ + uint32_thw_usbctrl_sbuscfg; /* 0x090 */ + + uint32_treserved2[27]; + + uint32_thw_usbctrl_caplength; /* 0x100 */ + uint32_thw_usbctrl_hcsparams; /* 0x104 */ + uint32_thw_usbctrl_hccparams; /* 0x108 */ + + uint32_treserved3[5]; + + uint32_thw_usbctrl_dciversion; /* 0x120 */ + uint32_thw_usbctrl_dccparams; /* 0x124 */ + + uint32_treserved4[6]; + + uint32_thw_usbctrl_usbcmd; /* 0x140 */ + uint32_thw_usbctrl_usbsts; /* 0x144 */ + uint32_thw_usbctrl_usbintr; /* 0x148 */ + uint32_thw_usbctrl_frindex; /* 0x14c */ + + uint32_treserved5; + + union { + uint32_thw_usbctrl_periodiclistbase;/* 0x154 */ + uint32_thw_usbctrl_deviceaddr; /* 0x154 */ + }; + union { + uint32_thw_usbctrl_asynclistaddr; /* 0x158 */ + uint32_thw_usbctrl_endpointlistaddr;/* 0x158 */ + }; + + uint32_thw_usbctrl_ttctrl; /* 0x15c */ + uint32_thw_usbctrl_burstsize; /* 0x160 */ + uint32_thw_usbctrl_txfilltuning;/* 0x164 */ + + uint32_treserved6; + + uint32_thw_usbctrl_ic_usb; /* 0x16c */ + uint32_thw_usbctrl_ulpi;/* 0x170 */ + + uint32_treserved7; + + uint32_thw_usbctrl_endptnak;/* 0x178 */ + uint32_thw_usbctrl_endptnaken; /* 0x17c */ + + uint32_treserved8; + + uint32_thw_usbctrl_portsc1; /* 0x184 */ + + uint32_treserved9[7]; + + uint32_thw_usbctrl_otgsc; /* 0x1a4 */ + uint32_thw_usbctrl_usbmode; /* 0x1a8 */ + uint32_thw_usbctrl_endptsetupstat; /* 0x1ac */ + uint32_thw_usbctrl_endptprime; /* 0x1b0 */ + uint32_thw_usbctrl_endptflush; /* 0x1b4 */ + uint32_thw_usbctrl_endptstat; /* 0x
[U-Boot] [PATCH 19/20] iMX28: Add USB HOST driver
This driver supports both EHCI ports on the i.MX28 CPU. Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel Cc: Remy Bohmer --- drivers/usb/host/Makefile |1 + drivers/usb/host/ehci-mxs.c | 154 +++ 2 files changed, 155 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-mxs.c diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 51b2494..09abb75 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -41,6 +41,7 @@ else COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o endif COBJS-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o +COBJS-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c new file mode 100644 index 000..c795f23 --- /dev/null +++ b/drivers/usb/host/ehci-mxs.c @@ -0,0 +1,154 @@ +/* + * Freescale i.MX28 USB Host driver + * + * Copyright (C) 2011 Marek Vasut + * on behalf of DENX Software Engineering GmbH + * + * 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 +#include +#include +#include +#include +#include +#include + +#include "ehci-core.h" +#include "ehci.h" + +#if(CONFIG_EHCI_MXS_PORT != 0) && (CONFIG_EHCI_MXS_PORT != 1) +#error "MXS EHCI: Invalid port selected!" +#endif + +#ifndefCONFIG_EHCI_MXS_PORT +#error "MXS EHCI: Please define correct port using CONFIG_EHCI_MXS_PORT!" +#endif + +static struct ehci_mxs { + struct mx28_usb_regs*usb_regs; + struct mx28_usbphy_regs *phy_regs; +} ehci_mxs; + +int mxs_ehci_get_port(struct ehci_mxs *mxs_usb, int port) +{ + uint32_t usb_base, phy_base; + switch (port) { + case 0: + usb_base = MXS_USBCTRL0_BASE; + phy_base = MXS_USBPHY0_BASE; + break; + case 1: + usb_base = MXS_USBCTRL1_BASE; + phy_base = MXS_USBPHY1_BASE; + break; + default: + printf("CONFIG_EHCI_MXS_PORT (port = %d)\n", port); + return -1; + } + + mxs_usb->usb_regs = (struct mx28_usb_regs *)usb_base; + mxs_usb->phy_regs = (struct mx28_usbphy_regs *)phy_base; + return 0; +} + +/* This DIGCTL register ungates clock to USB */ +#defineHW_DIGCTL_CTRL 0x8001c000 +#defineHW_DIGCTL_CTRL_USB0_CLKGATE (1 << 2) +#defineHW_DIGCTL_CTRL_USB1_CLKGATE (1 << 16) + +int ehci_hcd_init(void) +{ + + int ret; + uint32_t usb_base, cap_base; + struct mx28_register *digctl_ctrl = + (struct mx28_register *)HW_DIGCTL_CTRL; + struct mx28_clkctrl_regs *clkctrl_regs = + (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE; + + ret = mxs_ehci_get_port(&ehci_mxs, CONFIG_EHCI_MXS_PORT); + if (ret) + return ret; + + /* Reset the PHY block */ + writel(USBPHY_CTRL_SFTRST, &ehci_mxs.phy_regs->hw_usbphy_ctrl_set); + udelay(10); + writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE, + &ehci_mxs.phy_regs->hw_usbphy_ctrl_clr); + + /* Enable USB clock */ + writel(CLKCTRL_PLL0CTRL0_EN_USB_CLKS | CLKCTRL_PLL0CTRL0_POWER, + &clkctrl_regs->hw_clkctrl_pll0ctrl0_set); + writel(CLKCTRL_PLL1CTRL0_EN_USB_CLKS | CLKCTRL_PLL1CTRL0_POWER, + &clkctrl_regs->hw_clkctrl_pll1ctrl0_set); + + writel(HW_DIGCTL_CTRL_USB0_CLKGATE | HW_DIGCTL_CTRL_USB1_CLKGATE, + &digctl_ctrl->reg_clr); + + /* Start USB PHY */ + writel(0, &ehci_mxs.phy_regs->hw_usbphy_pwd); + + /* Enable UTMI+ Level 2 and Level 3 compatibility */ + writel(USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2 | 1, + &ehci_mxs.phy_regs->hw_usbphy_ctrl_set); + + usb_base = ((uint32_t)ehci_mxs.usb_regs) + 0x100; + hccr = (struct ehci_hccr *)usb_base; + + cap_base = ehci_readl(&hccr->cr_capbase); + hcor = (struct ehci_hcor *)(usb_base + HC_LENGTH(cap_base)); + + return 0; +} + +int ehci_hcd_stop(void) +{ + int ret; + uint32_t tmp; + struct mx28_register *digctl_ctrl = +
[U-Boot] [PATCH 20/20] M28EVK: Enable USB HOST support
This enables the second port, aka. the port with the USB connector on the M28EVK. Signed-off-by: Marek Vasut Cc: Stefano Babic Cc: Wolfgang Denk Cc: Detlev Zundel Cc: Remy Bohmer --- board/denx/m28evk/m28evk.c |7 +++ include/configs/m28evk.h | 12 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c index 168ceeb..8cf3dc9 100644 --- a/board/denx/m28evk/m28evk.c +++ b/board/denx/m28evk/m28evk.c @@ -52,6 +52,13 @@ int board_early_init_f(void) /* SSP2 clock at 96MHz */ mx28_set_sspclk(MXC_SSPCLK2, 96000, 0); +#ifdef CONFIG_CMD_USB + mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT); + mxs_iomux_setup_pad(MX28_PAD_AUART3_TX__GPIO_3_13 | + MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP); + gpio_direction_output(MX28_PAD_AUART3_TX__GPIO_3_13, 0); +#endif + return 0; } diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h index c8b0cf5..52dcd4a 100644 --- a/include/configs/m28evk.h +++ b/include/configs/m28evk.h @@ -75,6 +75,7 @@ #defineCONFIG_CMD_SETEXPR #defineCONFIG_CMD_SF #defineCONFIG_CMD_SPI +#defineCONFIG_CMD_USB /* * Memory configurations @@ -218,6 +219,17 @@ #endif /* + * USB + */ +#ifdef CONFIG_CMD_USB +#defineCONFIG_USB_EHCI +#defineCONFIG_USB_EHCI_MXS +#defineCONFIG_EHCI_MXS_PORT1 +#defineCONFIG_EHCI_IS_TDI +#defineCONFIG_USB_STORAGE +#endif + +/* * SPI */ #ifdef CONFIG_CMD_SPI -- 1.7.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/20] iMX28: Add I2C bus driver
Hello Marek, Marek Vasut wrote: > Signed-off-by: Marek Vasut > Cc: Heiko Schocher > Cc: Stefano Babic > Cc: Wolfgang Denk > Cc: Detlev Zundel > --- > drivers/i2c/Makefile |1 + > drivers/i2c/mxs_i2c.c | 246 > + > 2 files changed, 247 insertions(+), 0 deletions(-) > create mode 100644 drivers/i2c/mxs_i2c.c Is this a repost from: http://lists.denx.de/pipermail/u-boot/2011-September/100716.html I acked this patch here: http://lists.denx.de/pipermail/u-boot/2011-September/100771.html missing in this patch, so again: Acked-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] DFU initial implementation
Dear All, This is a quick-and-dirty proof-of-concept for splitting the dfu into core dfu gadget, generic parts of dfu backend, dfu command and target-specific implementation for Goni. This patch definitely needs some coding style cleanups. Also, the place for storing generic parts of dfu was chosen somewhat arbitrary and can be changed if a better alternative is found. The original idea of the flash_entity was to equip it with a void * to a context structure, which is not interpreted by the dfu gadget but passed to the dfu backend and understood there. I am still hesitating if flash_entity_ctx is generic enough to be generalized, as of now I assumed it is. If it wasn't then less common code could be extracted. @Stefan: you need the first 3 patches from this series, and then you need to implement your own target-specific parts. In fact, all is expected from the target, is to provide board_dfu_init/cleanup pair and call register_flash_entities. Andrzej Pietrasiewicz (4): dfu: protocol initial implementation dfu: generic backend parts dfu: command implementation dfu: target-specific implementation for Goni Makefile|1 + board/samsung/goni/Makefile |2 + board/samsung/goni/flash.c | 341 board/samsung/goni/flash.h | 28 ++ board/samsung/goni/goni.c | 17 + common/Makefile |1 + common/cmd_dfu.c| 51 +++ drivers/usb/dfu/Makefile| 33 ++ drivers/usb/dfu/dfu.c | 109 + drivers/usb/dfu/fat.c | 77 drivers/usb/dfu/mmc.c | 124 ++ drivers/usb/gadget/Makefile |1 + drivers/usb/gadget/dfu.c| 920 +++ drivers/usb/gadget/dfu.h| 171 include/configs/s5p_goni.h |4 + include/dfu.h | 28 ++ include/dfu_backend.h | 71 include/flash_entity.h | 39 ++ include/mbr.h | 49 +++ 19 files changed, 2067 insertions(+), 0 deletions(-) create mode 100644 board/samsung/goni/flash.c create mode 100644 board/samsung/goni/flash.h create mode 100644 common/cmd_dfu.c create mode 100644 drivers/usb/dfu/Makefile create mode 100644 drivers/usb/dfu/dfu.c create mode 100644 drivers/usb/dfu/fat.c create mode 100644 drivers/usb/dfu/mmc.c create mode 100644 drivers/usb/gadget/dfu.c create mode 100644 drivers/usb/gadget/dfu.h create mode 100644 include/dfu.h create mode 100644 include/dfu_backend.h create mode 100644 include/flash_entity.h create mode 100644 include/mbr.h ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/4] dfu: protocol initial implementation
Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park --- drivers/usb/gadget/Makefile |1 + drivers/usb/gadget/dfu.c| 920 +++ drivers/usb/gadget/dfu.h| 171 include/dfu.h | 28 ++ include/flash_entity.h | 39 ++ 5 files changed, 1159 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/gadget/dfu.c create mode 100644 drivers/usb/gadget/dfu.h create mode 100644 include/dfu.h create mode 100644 include/flash_entity.h diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index cd22bbe..4b173e2 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -28,6 +28,7 @@ LIB := $(obj)libusb_gadget.o # new USB gadget layer dependencies ifdef CONFIG_USB_GADGET COBJS-y += epautoconf.o config.o usbstring.o +COBJS-$(CONFIG_DFU_GADGET) += dfu.o COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o endif ifdef CONFIG_USB_ETHER diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c new file mode 100644 index 000..535e194 --- /dev/null +++ b/drivers/usb/gadget/dfu.c @@ -0,0 +1,920 @@ +/* + * dfu.c -- Device Firmware Update gadget + * + * Copyright (C) 2011 Samsung Electronics + * author: Andrzej Pietrasiewicz + * + * Based on gadget zero: + * Copyright (C) 2003-2007 David Brownell + * All rights reserved. + * + * 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 + */ + +#define VERBOSE_DEBUG +#define DEBUG + +/* +#include +#include +#include +*/ + +#include +#include +#include +#include + +#include + +#include "gadget_chips.h" +/* #include "epautoconf.c" */ +/* #include "config.c" */ +/* #include "usbstring.c" */ + +#include +#include "dfu.h" + +static struct flash_entity *flash_ents; +static int num_flash_ents; + +static struct usb_device_descriptor device_desc = { + .bLength = sizeof device_desc, + .bDescriptorType = USB_DT_DEVICE, + .bcdUSB = __constant_cpu_to_le16(0x0100), + .bDeviceClass = USB_CLASS_VENDOR_SPEC, + .idVendor = __constant_cpu_to_le16(DRIVER_VENDOR_NUM), + .idProduct =__constant_cpu_to_le16(DRIVER_PRODUCT_NUM), + .iManufacturer =STRING_MANUFACTURER, + .iProduct = STRING_PRODUCT, + .iSerialNumber =STRING_SERIAL, + .bNumConfigurations = 1, +}; + +static struct usb_config_descriptor dfu_config = { + .bLength = sizeof dfu_config, + .bDescriptorType = USB_DT_CONFIG, + /* compute wTotalLength on the fly */ + .bNumInterfaces = 1, + .bConfigurationValue = DFU_CONFIG_VAL, + .iConfiguration = STRING_DFU_NAME, + .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, + .bMaxPower =1, /* self-powered */ +}; + +static struct usb_otg_descriptor otg_descriptor = { + .bLength = sizeof otg_descriptor, + .bDescriptorType = USB_DT_OTG, + .bmAttributes = USB_OTG_SRP, +}; + +static const struct dfu_function_descriptor dfu_func = { + .bLength = sizeof dfu_func, + .bDescriptorType = DFU_DT_FUNC, + .bmAttributes = DFU_BIT_WILL_DETACH | + DFU_BIT_MANIFESTATION_TOLERANT | + DFU_BIT_CAN_UPLOAD | + DFU_BIT_CAN_DNLOAD, + .wDetachTimeOut = 0, + .wTransferSize =USB_BUFSIZ, + .bcdDFUVersion =__constant_cpu_to_le16(0x0110), +}; + +static const struct usb_interface_descriptor dfu_intf_runtime = { + .bLength = sizeof dfu_intf_runtime, + .bDescriptorType = USB_DT_INTERFACE, + .bNumEndpoints =0, + .bInterfaceClass = USB_CLASS_APP_SPEC, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 1, + .iInterface = STRING_DFU_NAME, +}; + +static const struct usb_descriptor_header *dfu_function_runtime[] = { + (struct usb_descriptor_header *) &otg_descriptor, + (struct usb_descriptor_header *) &dfu_func, + (struct usb_descriptor_header *) &dfu_intf_runtime, + NULL, +}; + +static struct usb_qualifier_descriptor dev_qualifier = { +
[U-Boot] [PATCH 3/4] dfu: command implementation
Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park --- common/Makefile |1 + common/cmd_dfu.c | 51 +++ 2 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 common/cmd_dfu.c diff --git a/common/Makefile b/common/Makefile index 1b672ad..3322b97 100644 --- a/common/Makefile +++ b/common/Makefile @@ -162,6 +162,7 @@ COBJS-y += cmd_usb.o COBJS-y += usb.o COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o endif +COBJS-$(CONFIG_CMD_DEVICE_FIRMWARE_UPGRADE) += cmd_dfu.o COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c new file mode 100644 index 000..93d8918 --- /dev/null +++ b/common/cmd_dfu.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 Samsung Electrnoics + * author: Andrzej Pietrasiewicz + * + * 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 +#include +#include +#include +#include + +static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + board_dfu_init(); + dfu_init(); + while (1) { + int irq_res; + /* Handle control-c and timeouts */ + if (ctrlc()) { + printf("The remote end did not respond in time.\n"); + goto fail; + } + + irq_res = usb_gadget_handle_interrupts(); + } +fail: + dfu_cleanup(); + board_dfu_cleanup(); + return -1; +} + +U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu, + "Use the DFU [Device Firmware Upgrade]", + "dfu - device firmware upgrade" +); + -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/4] dfu: target-specific implementation for Goni
Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park --- board/samsung/goni/Makefile |2 + board/samsung/goni/flash.c | 341 +++ board/samsung/goni/flash.h | 28 board/samsung/goni/goni.c | 17 ++ include/configs/s5p_goni.h |4 + 5 files changed, 392 insertions(+), 0 deletions(-) create mode 100644 board/samsung/goni/flash.c create mode 100644 board/samsung/goni/flash.h diff --git a/board/samsung/goni/Makefile b/board/samsung/goni/Makefile index ecde7a7..3f13cb8 100644 --- a/board/samsung/goni/Makefile +++ b/board/samsung/goni/Makefile @@ -31,6 +31,8 @@ LIB = $(obj)lib$(BOARD).o COBJS-y:= goni.o onenand.o SOBJS := lowlevel_init.o +COBJS-$(CONFIG_DFU_FOR_BOARD) += flash.o + SRCS:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y)) SOBJS := $(addprefix $(obj),$(SOBJS)) diff --git a/board/samsung/goni/flash.c b/board/samsung/goni/flash.c new file mode 100644 index 000..29c7ec1 --- /dev/null +++ b/board/samsung/goni/flash.c @@ -0,0 +1,341 @@ +/* + * flash.c -- board flashing routines + * + * Copyright (C) 2011 Samsung Electronics + * author: Andrzej Pietrasiewicz + * + * 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 +#include +#include +#include +#include +#include +#include + +#define MMC_BLOCK_SZ (256 * 1024) +#define MMC_UBOOT_OFFSET 128 +#define MMC_UBOOT_SZ 512 +#define MMC_NAME_LEN 12 +#define SHORT_PART_NAME15 +#define LONG_PART_NAME 20 +#define CALLOC_STRUCT(n, type) (struct type *) calloc(n, sizeof(struct type)) +#define DEFAULT_MMC_PART_NAME "mmc-default-part" + +/* partition IDs counted from 0, eg. mmc0-pri-1's ID is 0 */ +#define UIMAGE_PART_ID 1 +#define EXTENDED_PART_ID 3 +#define UMS_PART_ID7 +#define UIMAGE_PART_NAME "mmc0-pri-2" + +#define USE_MMC_UBOOT +#define USE_MMC + +/* + * MMC u-boot partitions + */ +static struct mbr_part_data *uboot_pdata; + +static u8 uboot_part_num; +static u8 used_uboot_parts; + +int use_uboot(struct mbr_part_data *pdata, u8 i) +{ + /* +* Use i and pdata[i] members to decide if the partition is used +*/ + return 1; +} + +char *alloc_uboot_name(u8 i) +{ + char *name = calloc(SHORT_PART_NAME, 1); + + if (name) { + sprintf(name, "mmc-u-boot"); + return name; + } + + return DEFAULT_MMC_PART_NAME; +} + +/* + * MMC partitions and MMC operations + */ +struct mmc *mmc; + +static struct mbr_part_data *mmc_pdata; + +static u8 mmc_part_num; +static u8 used_mmc_parts; + +static u8 mmc_buf[MMC_BLOCK_SZ]; + +static int extended_lba; + +static int mmc_mbr_dev; + +static u8 pri_count; +static u8 ext_count = 4; + +/* + * Define files available in the UIMAGE partition which has FAT on it. + * Only flat structure without subdirectories is supported. + */ +static char *uImage_part_files[] = { + "uImage", +}; +#define UIMAGE_PART_NUM_FILES ARRAY_SIZE(uImage_part_files) + +/* + * Return number of flash entities per this partition + */ +u8 use_mmc(struct mbr_part_data *pdata, u8 i) +{ + /* +* Use i and pdata[i] members to decide if the partition is used +*/ + if (i == UIMAGE_PART_ID) + return UIMAGE_PART_NUM_FILES; + if (i == EXTENDED_PART_ID) + return 0; /* do not expose the extended partition as a whole */ + if (i == UMS_PART_ID) + return 0; /* do not expose UMS; there is a separate command */ + return 1; +} + +char *alloc_mmc_name(struct mbr_part_data *pdata, u8 i, u8 l) +{ + char *name = calloc(MMC_NAME_LEN, 1); + + if (name) { + sprintf(name, "mmc0-"); + if (pdata[i].primary) + sprintf(name + strlen(name), "pri-%d", + l ? pri_count : ++pri_count); + else + sprintf(name + strlen(name), "ext-%d", + l ? ext_count : ++ext_count); + + return name; + } + + return DEFAULT_MMC_PART_NAME; +} + +/* + * FAT operations + */ +static u8 fat_buf[MMC_FAT_BLOCK_SZ]; + +/* + * Transport layer to storage adaptation + */ + +static int prepare_f
[U-Boot] [PATCH 2/4] dfu: generic backend parts
Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park --- Makefile |1 + drivers/usb/dfu/Makefile | 33 drivers/usb/dfu/dfu.c| 109 drivers/usb/dfu/fat.c| 77 drivers/usb/dfu/mmc.c| 124 ++ include/dfu_backend.h| 71 ++ include/mbr.h| 49 ++ 7 files changed, 464 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/dfu/Makefile create mode 100644 drivers/usb/dfu/dfu.c create mode 100644 drivers/usb/dfu/fat.c create mode 100644 drivers/usb/dfu/mmc.c create mode 100644 include/dfu_backend.h create mode 100644 include/mbr.h diff --git a/Makefile b/Makefile index bd72286..83ea3d0 100644 --- a/Makefile +++ b/Makefile @@ -283,6 +283,7 @@ LIBS += drivers/usb/gadget/libusb_gadget.o LIBS += drivers/usb/host/libusb_host.o LIBS += drivers/usb/musb/libusb_musb.o LIBS += drivers/usb/phy/libusb_phy.o +LIBS += drivers/usb/dfu/libusb_dfu.o LIBS += drivers/video/libvideo.o LIBS += drivers/watchdog/libwatchdog.o LIBS += common/libcommon.o diff --git a/drivers/usb/dfu/Makefile b/drivers/usb/dfu/Makefile new file mode 100644 index 000..c2fe049 --- /dev/null +++ b/drivers/usb/dfu/Makefile @@ -0,0 +1,33 @@ +include $(TOPDIR)/config.mk + +LIB:= $(obj)libusb_dfu.o + +# new USB gadget layer dependencies +COBJS-y += dfu.o + +ifdef CONFIG_MMC +COBJS-y += mmc.o +endif + +ifdef CONFIG_CMD_FAT +COBJS-y += fat.o +endif + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB):$(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# + diff --git a/drivers/usb/dfu/dfu.c b/drivers/usb/dfu/dfu.c new file mode 100644 index 000..2f5492d --- /dev/null +++ b/drivers/usb/dfu/dfu.c @@ -0,0 +1,109 @@ +#include +#include +#include + +/* + * Adapt transport layer buffer size to storage chunk size + * + * return < n to indicate no more data to read + */ +int read_block(void *ctx, unsigned int n, void *buf) +{ + struct flash_entity_ctx *ct = ctx; + unsigned int nread = 0; + + if (n == 0) + return n; + + while (nread < n) { + unsigned int copy; + + if (ct->num_done >= ct->length) + break; + if (ct->buffered == 0) { + ct->read(ct->buf, ct->buf_len, +ct->offset + ct->num_done); + ct->buffered = ct->buf_len; + } + copy = min(n - nread, ct->buffered); + + memcpy(buf + nread, ct->buf + ct->buf_len - ct->buffered, copy); + nread += copy; + ct->buffered -= copy; + ct->num_done += copy; + } + + return nread; +} + +/* + * Adapt transport layer buffer size to storage chunk size + */ +int write_block(void *ctx, unsigned int n, void *buf) +{ + struct flash_entity_ctx *ct = ctx; + unsigned int nwritten = 0; + + if (n == 0) + return n; + + while (nwritten < n) { + unsigned int copy; + + if (ct->num_done >= ct->length) + break; + if (ct->buffered >= ct->buf_len) { + ct->write(ct->buf, ct->buf_len, + ct->offset + ct->num_done); + ct->buffered = 0; + ct->num_done += ct->buf_len; + if (ct->num_done >= ct->length) + break; + } + copy = min(n - nwritten, ct->buf_len - ct->buffered); + + memcpy(ct->buf + ct->buffered, buf + nwritten, copy); + nwritten += copy; + ct->buffered += copy; + } + + return nwritten; +} + +/* + * Entity-specific prepare and finish + */ +static void reset_ctx(struct flash_entity_ctx *ctx) +{ + ctx->buffered = 0; + ctx->num_done = 0; +} + +int generic_prepare(void *ctx, u8 mode) +{ + struct flash_entity_ctx *ct = ctx; + + reset_ctx(ct); + memset(ct->buf, 0, ct->buf_len); + if (mode == FLASH_WRITE) { + if (ct->erase) { + printf("Erase entity: %s ", ct->this_entity->name); + ct->erase(ct->length, ct->offset); + } + printf("Write entity: %s ", ct->this_entity->name); + } else if (mode == FLASH_READ) { + printf("Read entity: %s ", ct->this_entity->name); + } + return 0; +} + +int generic_finish(void *ctx, u8 mode) +{ +
Re: [U-Boot] [PATCH v2] x86: Fix how the location of the realmode and bios blobs are calculated
On 09/11/11 09:19, Gabe Black wrote: > There are two blobs embedded into the u-boot image which are linked to run > at an address which is different from where they actually end up in the > ROM, one called "realmode" and one called "bios". There are realmode_setup > and bios_setup functions which prepare those blobs by copying them into the > location they're supposed to run from, among other things. > > During u-boot relocation from ROM to RAM, the text and a few data segments > are copied over. The realmode and bios sections are not copied, and so the > only place they can be read from is their original location in the ROM. > Looking specifically at the bios blob, there are symbols defined in the > linker script called __bios_start and __bios_size which are defined to be > the start and size of the blob in the ROM. > > In the bios_setup function, there seem to be two mistakes happening. First, > the offset from ROM to RAM is being added to __bios_start which implies that > this code expects to use the copy moved to RAM. No such copy is made, so > that's wrong. More subtly, when u-boot relocates itself, it goes through > all of the relocations stored in .rel.dyn and fixes them up. This has the > effect of transforming the __bios_start reference in bios_setup so that it > refers to the version in RAM (if one existed) instead of the one in ROM. To > correct for that, the offset actually needs to be subtracted out again to > translate the address back into the ROM. > > The net effect is that for both blobs, a + needs to be changed to a -. > > Signed-off-by: Gabe Black Fixes breakage introduced by commit 5fed8211... 'x86: Fix incorrect usage of relocation offset' Acked-by: Graeme Russ ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Business Proposal..
I am Mr. Wen Lee director of operations of the Bank Of Taipei Taiwan. I have an obscured business proposal for you. Reply if interested. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Business Proposal..
I am Mr. Wen Lee director of operations of the Bank Of Taipei Taiwan. I have an obscured business proposal for you. Reply if interested. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Dear Christian Riesch, In message <1320830586-19124-1-git-send-email-christian.rie...@omicron.at> you wrote: > This patch allows replacing arch_cpu_init() if a custom initialization > is required. > > Signed-off-by: Christian Riesch > Cc: Sandeep Paulraj > Cc: Heiko Schocher > --- > arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c |1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c > b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c > index 327ff97..fe142dc 100644 > --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c > +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c > @@ -263,6 +263,7 @@ void nand_boot(void) > #if defined(CONFIG_NAND_SPL) > void board_init_f(ulong bootflag) > #else > +__attribute__ ((weak)) > int arch_cpu_init(void) > #endif Stop please. This whole code is crap and needs to be changed. 281 asm("mrcp15, 0, r0, c1, c0, 0"); 282 /* clear bits 13, 9:8 (--V- --RS) */ 283 asm("bicr0, r0, #0x2300"); 284 /* clear bits 7, 2:0 (B--- -CAM) */ 285 asm("bicr0, r0, #0x0087"); 286 /* set bit 2 (A) Align */ 287 asm("orrr0, r0, #0x0002"); 288 /* set bit 12 (I) I-Cache */ 289 asm("orrr0, r0, #0x1000"); 290 asm("mcrp15, 0, r0, c1, c0, 0"); What is #0x2300? #0x0087? #0x0002? #0x1000? 293 writel(0x83e70b13, &davinci_syscfg_regs->kick0); 294 writel(0x95a4f1e0, &davinci_syscfg_regs->kick1); What is 0x83e70b13? 0x95a4f1e0? 296 dv_maskbits(&davinci_syscfg_regs->suspsrc, 297 ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16))); What is ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16))) ? 336 /* 337 * Fix Power and Emulation Management Register 338 * see sprufw3a.pdf page 37 Table 24 339 */ 340 writel(readl((CONFIG_SYS_NS16550_COM1 + 0x30)) | 0x6001, 341 (CONFIG_SYS_NS16550_COM1 + 0x30)); What is CONFIG_SYS_NS16550_COM1 + 0x30 don't we have proper NS16550 register definitions? And what is 0x6001 ?? All this needs a _thorough_ cleanup before I'm willing to accept this for mainline. Heiko, Christian: please negotiate who performs which part of the cleanup. But I expect that with proper symbolic names instead of the hardwired constants the need for a wek function will go away. Albert, please make sure to block this current code. I do not want to see this in mainline as is. Thanks. 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: w...@denx.de Another megabytes the dust. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hi Wolfgang, On Wed, Nov 9, 2011 at 11:12 AM, Wolfgang Denk wrote: > In message <1320830586-19124-1-git-send-email-christian.rie...@omicron.at> > you wrote: >> This patch allows replacing arch_cpu_init() if a custom initialization >> is required. >> >> Signed-off-by: Christian Riesch >> Cc: Sandeep Paulraj >> Cc: Heiko Schocher >> --- >> arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> index 327ff97..fe142dc 100644 >> --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> @@ -263,6 +263,7 @@ void nand_boot(void) >> #if defined(CONFIG_NAND_SPL) >> void board_init_f(ulong bootflag) >> #else >> +__attribute__ ((weak)) >> int arch_cpu_init(void) >> #endif > > Stop please. > > This whole code is crap and needs to be changed. > > > 281 asm("mrc p15, 0, r0, c1, c0, 0"); > 282 /* clear bits 13, 9:8 (--V- --RS) */ > 283 asm("bic r0, r0, #0x2300"); > 284 /* clear bits 7, 2:0 (B--- -CAM) */ > 285 asm("bic r0, r0, #0x0087"); > 286 /* set bit 2 (A) Align */ > 287 asm("orr r0, r0, #0x0002"); > 288 /* set bit 12 (I) I-Cache */ > 289 asm("orr r0, r0, #0x1000"); > 290 asm("mcr p15, 0, r0, c1, c0, 0"); > > What is #0x2300? #0x0087? #0x0002? #0x1000? > > 293 writel(0x83e70b13, &davinci_syscfg_regs->kick0); > 294 writel(0x95a4f1e0, &davinci_syscfg_regs->kick1); > > What is 0x83e70b13? 0x95a4f1e0? > > 296 dv_maskbits(&davinci_syscfg_regs->suspsrc, > 297 ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << > 16))); > > What is ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16))) ? > > 336 /* > 337 * Fix Power and Emulation Management Register > 338 * see sprufw3a.pdf page 37 Table 24 > 339 */ > 340 writel(readl((CONFIG_SYS_NS16550_COM1 + 0x30)) | 0x6001, > 341 (CONFIG_SYS_NS16550_COM1 + 0x30)); > > What is CONFIG_SYS_NS16550_COM1 + 0x30 don't we have proper > NS16550 register definitions? And what is 0x6001 ?? > > > All this needs a _thorough_ cleanup before I'm willing to accept this > for mainline. This is already in mainline, see commit 310ae55efe14aa7923b16c718cbdb22ec364b18b Author: Heiko Schocher Date: Wed Sep 14 19:59:38 2011 + arm, davinci, am1808: add lowlevel functions for booting from NOR Regards, Christian > > > Heiko, Christian: please negotiate who performs which part of the > cleanup. But I expect that with proper symbolic names instead of the > hardwired constants the need for a wek function will go away. > > Albert, please make sure to block this current code. I do not want to > see this in mainline as is. > > > Thanks. > > 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: w...@denx.de > Another megabytes the dust. > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC] x86: Do no use reparm as it break libgcc linkage
Hi Gabe, Can you please try this patch - If it solves your libgcc problem, I will add it to the misc cleanup patch Thanks, Graeme --- arch/x86/config.mk|3 --- arch/x86/cpu/interrupts.c |2 +- arch/x86/cpu/start.S |5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/config.mk b/arch/x86/config.mk index fe9083f..ec5f707 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -23,10 +23,7 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x4 -PLATFORM_CPPFLAGS += -fno-strict-aliasing PLATFORM_CPPFLAGS += -Wstrict-prototypes -PLATFORM_CPPFLAGS += -mregparm=3 -PLATFORM_CPPFLAGS += -fomit-frame-pointer PF_CPPFLAGS_X86 := $(call cc-option, -ffreestanding) \ $(call cc-option, -fno-toplevel-reorder, \ $(call cc-option, -fno-unit-at-a-time)) \ diff --git a/arch/x86/cpu/interrupts.c b/arch/x86/cpu/interrupts.c index e0958eb..a15d70a 100644 --- a/arch/x86/cpu/interrupts.c +++ b/arch/x86/cpu/interrupts.c @@ -249,7 +249,7 @@ int disable_interrupts(void) } /* IRQ Low-Level Service Routine */ -void irq_llsr(struct irq_regs *regs) +void __attribute__ ((regparm(1))) irq_llsr(struct irq_regs *regs) { /* * For detailed description of each exception, refer to: diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S index f87633b..119ca2d 100644 --- a/arch/x86/cpu/start.S +++ b/arch/x86/cpu/start.S @@ -84,9 +84,8 @@ car_init_ret: */ movl$CONFIG_SYS_INIT_SP_ADDR, %esp - /* Set parameter to board_init_f() to boot flags */ - xorl%eax, %eax - movw%bx, %ax + /* Set parameter to board_init_f() - Unused dummy value */ + pushl $0 /* Enter, U-boot! */ callboard_init_f -- 1.7.5.2.317.g391b14 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Dear Christian Riesch, In message you wrote: > > > All this needs a _thorough_ cleanup before I'm willing to accept this > > for mainline. > > This is already in mainline, see Indeed. What a pity. Anyway. We should clean it up first, before attempting any other changes. I don't understand yet what your exact requirements are - can you confirm that my assumption is correct that you can do without the "weak" if the hardwired constants in this fle get replaced by symbolic names that can be set from the board config file? 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: w...@denx.de Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition. - Isaac Asimov ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hello Wolfgang, Christian, Wolfgang Denk wrote: > Dear Christian Riesch, > > In message <1320830586-19124-1-git-send-email-christian.rie...@omicron.at> > you wrote: >> This patch allows replacing arch_cpu_init() if a custom initialization >> is required. >> >> Signed-off-by: Christian Riesch >> Cc: Sandeep Paulraj >> Cc: Heiko Schocher >> --- >> arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c |1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> index 327ff97..fe142dc 100644 >> --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c >> @@ -263,6 +263,7 @@ void nand_boot(void) >> #if defined(CONFIG_NAND_SPL) >> void board_init_f(ulong bootflag) >> #else >> +__attribute__ ((weak)) >> int arch_cpu_init(void) >> #endif > > Stop please. > > This whole code is crap and needs to be changed. [...] > Heiko, Christian: please negotiate who performs which part of the > cleanup. But I expect that with proper symbolic names instead of the > hardwired constants the need for a wek function will go away. I rework this. > Albert, please make sure to block this current code. I do not want to > see this in mainline as is. Is it OK, if I send a cleanup patch against current u-boot-arm.git? bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 05/20] iMX28: Add I2C bus driver
> Hello Marek, > > Marek Vasut wrote: > > Signed-off-by: Marek Vasut > > Cc: Heiko Schocher > > Cc: Stefano Babic > > Cc: Wolfgang Denk > > Cc: Detlev Zundel > > --- > > > > drivers/i2c/Makefile |1 + > > drivers/i2c/mxs_i2c.c | 246 > > + 2 files changed, 247 > > insertions(+), 0 deletions(-) > > create mode 100644 drivers/i2c/mxs_i2c.c > > Is this a repost from: > > http://lists.denx.de/pipermail/u-boot/2011-September/100716.html > > I acked this patch here: > > http://lists.denx.de/pipermail/u-boot/2011-September/100771.html > > missing in this patch, so again: > > Acked-by: Heiko Schocher > > bye, > Heiko Sorry Heiko, yes, it's a repost. I resent it to make Stefano's job easier when picking the whole series. M ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 08/12] OMAP3 SPL: Add identify_pop_memory function
Hi Tom, On 11/08/11 17:21, Tom Rini wrote: > On 11/08/2011 12:45 AM, Igor Grinberg wrote: >> On 11/07/11 22:05, Tom Rini wrote: >>> A number of boards are populated with a PoP chip for both DDR and NAND >>> memory. So to determine DDR timings the NAND chip needs to be probed >>> and mfr/id returned to the board to make decisions with. All of this >>> code is put into spl_pop_probe.c and controlled via >>> CONFIG_SPL_OMAP3_POP_PROBE. >> >> I don't see how POP is different from other types of packages >> in terms of DRAM. >> The same thing can be true also for non-POP packages. >> What I'm saying here is, I understand the necessity of that code, >> but why call it POP specific? >> If it is not POP specific, then please call it some other way >> (e.g. ...DRAM_NAND_PROBE). >> Also, hypothetically, some other means can be used for DRAM type >> identification, so it will be a good thing to split it, but again >> it is only hypothetically and it is only my thoughts, so you don't >> have to... > > Well, that gets at why I called it spl_pop_probe. If you have a POP > package, this is how you would do the probe. I can see in theory > wanting to probe NAND as a way to see board rev on a non-POP package, > but I'd like to see a real example first. That's the problem we see in Linux OMAP... some guys don't think forward and submit stuff on a per case basis, then when it comes to a bit different case, they are trying to reuse (which is fine) and end up renaming stuff all around - generating huge diff stat. Why not just do the generic stuff from the start of it? Why wait for a new case? It is pretty simple, just don't name it POP, so it can serve w/o any confusion for more cases. > >>> diff --git a/arch/arm/cpu/armv7/omap3/Makefile >>> b/arch/arm/cpu/armv7/omap3/Makefile >>> index 8e85891..772f3d4 100644 >>> --- a/arch/arm/cpu/armv7/omap3/Makefile >>> +++ b/arch/arm/cpu/armv7/omap3/Makefile >>> @@ -31,6 +31,9 @@ COBJS += board.o >>> COBJS += clock.o >>> COBJS += mem.o >>> COBJS += sys_info.o >>> +ifdef CONFIG_SPL_BUILD >>> +COBJS-$(CONFIG_SPL_OMAP3_POP_PROBE)+= spl_pop_probe.o >>> +endif >> >> Can't CONFIG_SPL_OMAP3_..._PROBE symbol default to "no" >> and depend on CONFIG_SPL_BUILD, so you don't need to enclose >> it in #ifdef? > > But then it would build for both SPL and non-SPL cases. No, it should not. What do you think of the following: In the Makefile have only: COBJS-$(CONFIG_SPL_OMAP3_POP_PROBE) += spl_pop_probe.o Then in the spl_pop_probe.c have this type of check: #ifndef CONFIG_SPL_BUILD # error CONFIG_SPL_OMAP3_POP_PROBE requires CONFIG_SPL_BUILD #endif This way, you require the CONFIG_SPL_OMAP3_POP_PROBE symbol be a part of the CONFIG_SPL_BUILD symbols group. > > [snip] >>> + * 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 >> >> The address is subject to change so probably it will be >> a good thing to drop the address part (but leave the rest). > > Just following existing examples. Existing examples can be wrong and as Wolfgang said, it is not a good justification, but I don't really mind, just trying to raise people awareness. > >> >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#ifdef CONFIG_SPL_BUILD >> >> no need for this #ifdef, the whole file compilation depends >> on that symbol being defined. > > True, will fix, thanks. > >> >>> +static struct gpmc *gpmc_config = (struct gpmc *)GPMC_BASE; >>> + >>> +/* nand_command: Send a flash command to the flash chip */ >>> +static void nand_command(u8 command) >>> +{ >>> + writeb(command, &gpmc_config->cs[0].nand_cmd); >>> + >>> + if (command == NAND_CMD_RESET) { >>> + unsigned char ret_val; >>> + nand_command(NAND_CMD_STATUS); >> >> This recursion looks redundant. >> Why not just replace it with: >> writeb(NAND_CMD_STATUS, &gpmc_config->cs[0].nand_cmd); > > OK, thanks. > >>> + do { >>> + /* Wait until ready */ >>> + ret_val = readl(&gpmc_config->cs[0].nand_dat); >>> + } while ((ret_val & 0x40) != 0x40); >> >> Can't 0x40 magic be defined to have some more understandable name? >> Probably kind of NAND_CMD_READY mask? > > I'll see if the datasheet defines this particular bit of magic. > >> >>> + } >>> +} >>> + >>> +/* >>> + * Many boards ship with a PoP chip of both NAND and DDR, so we need >>> + * probe the NAND side, very earily, to see what it says and pass this >> >> s/earily/early/ > > Thanks. > >>> + * along to the board. The board code will then use this information >>> + * to decide what DDR timings to use. >>> + */ >>> +void identify_pop_memory(int *mfr, int *id) >>> +{ >>> + /* Make sure that we have setup GPMC for NAND correctly. */ >>> + writel(M_NAND_GPMC_CONFIG1, &gpmc_config->cs
Re: [U-Boot] [PATCH 09/12] OMAP3: Add SPL support to Beagleboard
On 11/08/11 17:28, Tom Rini wrote: > On 11/08/2011 12:57 AM, Igor Grinberg wrote: >> On 11/07/11 22:05, Tom Rini wrote: >>> This introduces 200MHz Micron parts timing information based on x-loader >>> to . The memory init logic is also based on what >>> x-loader does in these cases. Note that while previously u-boot would >>> be flashed in with SW ECC in this case it now must be flashed with HW >>> ECC. > [snip] >>> +#ifdef CONFIG_SPL_BUILD >>> +/* >>> + * Routine: board_early_sdrc_init >> >> s/board_early_sdrc_init/get_board_mem_timings/ >> >>> + * Description: If we use SPL then there is no x-loader nor config header >>> + * so we have to setup the DDR timings outself on both banks. >> >> s/outself/ourself/ > > Thanks. > > [snip] >>> + case REVISION_C4: >>> + if ((pop_mfr == NAND_MFR_STMICRO) && (pop_id == 0xba)) { >> >> No need for extra parenthesis. > > I'll double check all these cases, thanks. > >>> + *mcfg = 0x04590099; >>> + *ctrla = NUMONYX_V_ACTIMA_165; >>> + *ctrlb = NUMONYX_V_ACTIMB_165; >>> + *rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; >> >> This will look much better if it will be aligned. > > It's not in CodingStyle tho ;) Right, you don't have to, but it will look better... > > [snip] >>> -# For use with external or internal boots. >>> -CONFIG_SYS_TEXT_BASE = 0x80008000 >> >> Removing needless crap is a very good thing, but does not >> belong to this patch, is it? > > I thought I said in this commit message, but I know I did for am3517 > evm/crane, we change CONFIG_SYS_TEXT_BASE which is why we remove this > file here. It could be done as a two-step if it's a hard objection tho. Yeah, I've sent this email before I saw the AM3517 changes. Ok. -- Regards, Igor. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hello Wolfgang, On Wed, Nov 9, 2011 at 11:44 AM, Wolfgang Denk wrote: > In message > you > wrote: >> >> > All this needs a _thorough_ cleanup before I'm willing to accept this >> > for mainline. >> >> This is already in mainline, see > > Indeed. What a pity. > > Anyway. We should clean it up first, before attempting any other > changes. > > > I don't understand yet what your exact requirements are - can you > confirm that my assumption is correct that you can do without the > "weak" if the hardwired constants in this fle get replaced by symbolic > names that can be set from the board config file? I'll comment on the code that is currently in u-boot-arm:arch /arm/cpu/arm926ejs/davinci/da850_lowlevel.c 263 #if defined(CONFIG_NAND_SPL) I guess this will become obsolete soon, in the new SPL framework this should be done in another way, right? 264 void board_init_f(ulong bootflag) 265 #else 266 int arch_cpu_init(void) 267 #endif 268 { 269 /* 270 * copied from arch/arm/cpu/arm926ejs/start.S 271 * 272 * flush v4 I/D caches 273 */ 274 asm("movr0, #0"); 275 asm("mcrp15, 0, r0, c7, c7, 0");/* flush v3/v4 cache */ 276 asm("mcrp15, 0, r0, c8, c7, 0");/* flush v4 TLB */ 277 278 /* 279 * disable MMU stuff and caches 280 */ 281 asm("mrcp15, 0, r0, c1, c0, 0"); 282 /* clear bits 13, 9:8 (--V- --RS) */ 283 asm("bicr0, r0, #0x2300"); 284 /* clear bits 7, 2:0 (B--- -CAM) */ 285 asm("bicr0, r0, #0x0087"); 286 /* set bit 2 (A) Align */ 287 asm("orrr0, r0, #0x0002"); 288 /* set bit 12 (I) I-Cache */ 289 asm("orrr0, r0, #0x1000"); 290 asm("mcrp15, 0, r0, c1, c0, 0"); 291 Heiko, why do we need this? I noticed, that u-boot takes longer to start when I remove this code. 292 /* Unlock kick registers */ 293 writel(0x83e70b13, &davinci_syscfg_regs->kick0); 294 writel(0x95a4f1e0, &davinci_syscfg_regs->kick1); 295 hawkboard has two defines HAWKBOARD_KICK0_UNLOCK and HAWKBOARD_KICK1_UNLOCK for these magic numbers. Maybe we should rename them because they are not HAWKBOARD specific and use them? see board/davinci/da8xxevm/hawkboard.c 296 dv_maskbits(&davinci_syscfg_regs->suspsrc, 297 ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16))); 298 This is done in a nicer way in board/davinci/da8xxevm/da850evm.c I wonder if these settings work for all boards or if any boards wound need different settings here. 299 /* Setup Pinmux */ 300 da850_pinmux_ctl(0, 0x, CONFIG_SYS_DA850_PINMUX0); 301 da850_pinmux_ctl(1, 0x, CONFIG_SYS_DA850_PINMUX1); 302 da850_pinmux_ctl(2, 0x, CONFIG_SYS_DA850_PINMUX2); 303 da850_pinmux_ctl(3, 0x, CONFIG_SYS_DA850_PINMUX3); 304 da850_pinmux_ctl(4, 0x, CONFIG_SYS_DA850_PINMUX4); 305 da850_pinmux_ctl(5, 0x, CONFIG_SYS_DA850_PINMUX5); 306 da850_pinmux_ctl(6, 0x, CONFIG_SYS_DA850_PINMUX6); 307 da850_pinmux_ctl(7, 0x, CONFIG_SYS_DA850_PINMUX7); 308 da850_pinmux_ctl(8, 0x, CONFIG_SYS_DA850_PINMUX8); 309 da850_pinmux_ctl(9, 0x, CONFIG_SYS_DA850_PINMUX9); 310 da850_pinmux_ctl(10, 0x, CONFIG_SYS_DA850_PINMUX10); 311 da850_pinmux_ctl(11, 0x, CONFIG_SYS_DA850_PINMUX11); 312 da850_pinmux_ctl(12, 0x, CONFIG_SYS_DA850_PINMUX12); 313 da850_pinmux_ctl(13, 0x, CONFIG_SYS_DA850_PINMUX13); 314 da850_pinmux_ctl(14, 0x, CONFIG_SYS_DA850_PINMUX14); 315 da850_pinmux_ctl(15, 0x, CONFIG_SYS_DA850_PINMUX15); 316 da850_pinmux_ctl(16, 0x, CONFIG_SYS_DA850_PINMUX16); 317 da850_pinmux_ctl(17, 0x, CONFIG_SYS_DA850_PINMUX17); 318 da850_pinmux_ctl(18, 0x, CONFIG_SYS_DA850_PINMUX18); 319 da850_pinmux_ctl(19, 0x, CONFIG_SYS_DA850_PINMUX19); 320 I could do with this code and setting my custom PINMUX constants. However, the da850evm uses a different way of configuring pinmux, so we have a duplication of code here. I'd prefer the da850evm way because the code is still readable when you don't use the TI tool mentioned by Heiko in [1] (I was not aware of this tool, thanks for the hint, Heiko!). 321 /* PLL setup */ 322 da850_pll_init(davinci_pllc0_regs, CONFIG_SYS_DA850_PLL0_PLLM); 323 da850_pll_init(davinci_pllc1_regs, CONFIG_SYS_DA850_PLL1_PLLM); On my board I need to determine the hardware revision first and then set the values of CONFIG_SYS_DA850_PLL0_PLLM and CONFIG_SYS_DA850_PLL1_PLLM accordingly. But maybe I could uses something like #define CONFIG_SYS_DA850_PLL1_PLLM board_get_pllm1() and write a func
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hello Heiko, On Wed, Nov 9, 2011 at 11:44 AM, Heiko Schocher wrote: >> Heiko, Christian: please negotiate who performs which part of the >> cleanup. But I expect that with proper symbolic names instead of the >> hardwired constants the need for a wek function will go away. > > I rework this. I'd like to help but since we have different custom boards it's a bit hard to test. Therefore I'd like to get this lowlevel initialization working on the da850evm board. Since it boots from SPI I guess I'll need an SPL for SPI flash, right? Could we try to clean it up in a way so it nicely integrates with your SPL code in arch/arm/cpu/arm926ejs/davinci/spl.c? Regards, Christian ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci_emac: fixup
Hi Heiko, On Wed, Nov 9, 2011 at 11:56 AM, Heiko Schocher wrote: > since commits: > davinci: emac: add support for more than 1 PHYs > 062fe7d332c28ede25626f448681e43d76bb312e > > davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM > fb1d6332b5430b90a8fa8ebab709f33a60e9f816 > > I get following warning on the enbw_cmc board: > > Err: serial > Net:5 ETH PHY detected > miiphy_register: non unique device name 'KSZ8873 @ 0x01' > DaVinci-EMAC > Hit any key to stop autoboot: 0 > > Also I see some debug printfs: > > => run load > + emac_close > + emac_ch_teardown > - emac_ch_teardown > + emac_ch_teardown > - emac_ch_teardown > - emac_close > + emac_open > - emac_open > Using DaVinci-EMAC device > > reason is 062fe7d332c28ede25626f448681e43d76bb312e new define MAX_PHY. > This is set to 3! I get on this board 5 active phys, so > this leads in wrong memory writes ... > > so I changed: > > - MAX_PHY from 3 to 7 > - print an error message if more then MAX_PHYs are > detected. > - fill the active_phy_addr array in a for loop with > 0xff > - changed printf() in debug_emac() > > Signed-off-by: Heiko Schocher > Cc: Sandeep Paulraj > Cc: Albert ARIBAUD > Cc: Wolfgang Denk > Cc: Manjunath Hadli > --- > drivers/net/davinci_emac.c | 17 +++-- > 1 files changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c > index fa31159..a31e9f1 100644 > --- a/drivers/net/davinci_emac.c > +++ b/drivers/net/davinci_emac.c > @@ -85,7 +85,7 @@ static intemac_rx_queue_active = 0; > /* Receive packet buffers */ > static unsigned char emac_rx_buffers[EMAC_MAX_RX_BUFFERS * > (EMAC_MAX_ETHERNET_PKT_SIZE + EMAC_PKT_ALIGN)]; > > -#define MAX_PHY3 > +#define MAX_PHY7 > > /* PHY address for a discovered PHY (0xff - not found) */ > static u_int8_tactive_phy_addr[MAX_PHY] = { 0xff, 0xff, 0xff }; > @@ -160,9 +160,8 @@ static int davinci_eth_phy_detect(void) >int j; >unsigned intcount = 0; > > - active_phy_addr[0] = 0xff; > - active_phy_addr[1] = 0xff; > - active_phy_addr[2] = 0xff; > + for (i = 0; i < MAX_PHY; i++) > + active_phy_addr[i] = 0xff; > >udelay(1000); >phy_act_state = readl(&adap_mdio->ALIVE); > @@ -175,7 +174,13 @@ static int davinci_eth_phy_detect(void) >for (i = 0, j = 0; i < 32; i++) >if (phy_act_state & (1 << i)) { >count++; > - active_phy_addr[j++] = i; > + if (count < MAX_PHY) > + active_phy_addr[j++] = i; > + else { > + printf("%s: to much PHYs detected.\n", > + __func__); > why not make here count = 0 and then break, so that later in davinci_emac_initialize() it wont initializes the phy's Regards, --Prabhakar Lad > + break; > + } >} > >num_phy = count; > @@ -752,7 +757,7 @@ int davinci_emac_initialize(void) >if (!ret) >return(0); >else > - printf(" %d ETH PHY detected\n", ret); > + debug_emac(" %d ETH PHY detected\n", ret); > >/* Get PHY ID and initialize phy_ops for a detected PHY */ >for (i = 0; i < num_phy; i++) { > -- > 1.7.6.4 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hello Christian, Christian Riesch wrote: > Hello Wolfgang, > > On Wed, Nov 9, 2011 at 11:44 AM, Wolfgang Denk wrote: >> In message >> you >> wrote: All this needs a _thorough_ cleanup before I'm willing to accept this for mainline. >>> This is already in mainline, see >> Indeed. What a pity. >> >> Anyway. We should clean it up first, before attempting any other >> changes. >> >> >> I don't understand yet what your exact requirements are - can you >> confirm that my assumption is correct that you can do without the >> "weak" if the hardwired constants in this fle get replaced by symbolic >> names that can be set from the board config file? > > I'll comment on the code that is currently in u-boot-arm:arch > /arm/cpu/arm926ejs/davinci/da850_lowlevel.c > > 263 #if defined(CONFIG_NAND_SPL) > > I guess this will become obsolete soon, in the new SPL framework this > should be done in another way, right? Yes. I prefer actually to remove the old NAND_SPL style complete in this cleanup step, because nobody is using it yet. And if someone use this code for SPL, it must be adapted. > 264 void board_init_f(ulong bootflag) > 265 #else > 266 int arch_cpu_init(void) > 267 #endif > 268 { > 269 /* > 270 * copied from arch/arm/cpu/arm926ejs/start.S > 271 * > 272 * flush v4 I/D caches > 273 */ > 274 asm("movr0, #0"); > 275 asm("mcrp15, 0, r0, c7, c7, 0");/* flush > v3/v4 cache */ > 276 asm("mcrp15, 0, r0, c8, c7, 0");/* flush v4 TLB > */ > 277 > 278 /* > 279 * disable MMU stuff and caches > 280 */ > 281 asm("mrcp15, 0, r0, c1, c0, 0"); > 282 /* clear bits 13, 9:8 (--V- --RS) */ > 283 asm("bicr0, r0, #0x2300"); > 284 /* clear bits 7, 2:0 (B--- -CAM) */ > 285 asm("bicr0, r0, #0x0087"); > 286 /* set bit 2 (A) Align */ > 287 asm("orrr0, r0, #0x0002"); > 288 /* set bit 12 (I) I-Cache */ > 289 asm("orrr0, r0, #0x1000"); > 290 asm("mcrp15, 0, r0, c1, c0, 0"); > 291 > > Heiko, why do we need this? I noticed, that u-boot takes longer to > start when I remove this code. We need it, because we have defined CONFIG_SKIP_LOWLEVEL_INIT (at least for the enbw_cmc board), and this is a copy from arch/arm/cpu/arm926ejs/start.S ... I tend to change arch/arm/cpu/arm926ejs/start.S, so we always execute this code from arch/arm/cpu/arm926ejs/start.S and don't need it here anymore: diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S index 339c5ed..73ceb30 100644 --- a/arch/arm/cpu/arm926ejs/start.S +++ b/arch/arm/cpu/arm926ejs/start.S @@ -353,7 +353,6 @@ _dynsym_start_ofs: * * */ -#ifndef CONFIG_SKIP_LOWLEVEL_INIT cpu_init_crit: /* * flush v4 I/D caches @@ -372,14 +371,15 @@ cpu_init_crit: orr r0, r0, #0x1000 /* set bit 12 (I) I-Cache */ mcr p15, 0, r0, c1, c0, 0 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT /* * Go setup Memory and board specific bits prior to relocation. */ mov ip, lr /* perserve link reg across call */ bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ - mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ + mov pc, lr /* back to my caller */ #ifndef CONFIG_SPL_BUILD /* Albert, what do you think? Do you see some problems against this? > > 292 /* Unlock kick registers */ > 293 writel(0x83e70b13, &davinci_syscfg_regs->kick0); > 294 writel(0x95a4f1e0, &davinci_syscfg_regs->kick1); > 295 > > hawkboard has two defines HAWKBOARD_KICK0_UNLOCK and > HAWKBOARD_KICK1_UNLOCK for these magic numbers. Maybe we should rename > them because they are not HAWKBOARD specific and use them? > see board/davinci/da8xxevm/hawkboard.c added this defines to arch/arm/include/asm/arch-davinci/hardware.h > 296 dv_maskbits(&davinci_syscfg_regs->suspsrc, > 297 ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | > (1 << 16))); > 298 > > This is done in a nicer way in board/davinci/da8xxevm/da850evm.c > I wonder if these settings work for all boards or if any boards wound > need different settings here. Changed this. You need now a CONFIG_SYS_DA850_SYSCFG_SUSPSRC in your board config. > > 299 /* Setup Pinmux */ > 300 da850_pinmux_ctl(0, 0x, CONFIG_SYS_DA850_PINMUX0); > 301 da850_pinmux_ctl(1, 0x, CONFIG_SYS_DA850_PINMUX1); > 302 da850_pinmux_ctl(2, 0x, CONFIG_SYS_DA850_PINMUX2); > 303 da850_pinmux_ctl(3, 0x, CONFIG_SYS_DA850_PINMUX3); > 304 da850_pinmux_ctl(4, 0x, CONFIG_S
Re: [U-Boot] [PATCH] arm, davinci_emac: fixup
Hello Prabhakar Lad, Prabhakar Lad wrote: > Hi Heiko, > > On Wed, Nov 9, 2011 at 11:56 AM, Heiko Schocher wrote: [...] >> Signed-off-by: Heiko Schocher >> Cc: Sandeep Paulraj >> Cc: Albert ARIBAUD >> Cc: Wolfgang Denk >> Cc: Manjunath Hadli >> --- >> drivers/net/davinci_emac.c | 17 +++-- >> 1 files changed, 11 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c >> index fa31159..a31e9f1 100644 >> --- a/drivers/net/davinci_emac.c >> +++ b/drivers/net/davinci_emac.c [...] >> @@ -175,7 +174,13 @@ static int davinci_eth_phy_detect(void) >>for (i = 0, j = 0; i < 32; i++) >>if (phy_act_state & (1 << i)) { >>count++; >> - active_phy_addr[j++] = i; >> + if (count < MAX_PHY) >> + active_phy_addr[j++] = i; >> + else { >> + printf("%s: to much PHYs detected.\n", >> + __func__); >> >why not make here count = 0 and then break, so that later >in davinci_emac_initialize() it wont initializes the phy's I prefer here the error printf, because you see immediately what is wrong... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci: make arch_cpu_init() in da850_lowlevel.c weak
Hello Christian, Christian Riesch wrote: > Hello Heiko, > > On Wed, Nov 9, 2011 at 11:44 AM, Heiko Schocher wrote: >>> Heiko, Christian: please negotiate who performs which part of the >>> cleanup. But I expect that with proper symbolic names instead of the >>> hardwired constants the need for a wek function will go away. >> I rework this. > > I'd like to help but since we have different custom boards it's a bit > hard to test. Therefore I'd like to get this lowlevel initialization Do you plan to post your patches for your custom board to the ML? > working on the da850evm board. Since it boots from SPI I guess I'll > need an SPL for SPI flash, right? Could we try to clean it up in a way Yes. > so it nicely integrates with your SPL code in > arch/arm/cpu/arm926ejs/davinci/spl.c? I soon post the cleanup for the da850_lowlevel.c file, so you can do this based on that patch. You only have to adapt board_init_f() in arch/arm/cpu/arm926ejs/davinci/spl.c. There for the da850 case, arch_cpu_init() or for the spl case better called da850_lowlevel_init() from arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c must be called. bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci_emac: fixup
Hi Heiko, On Wed, Nov 9, 2011 at 5:56 PM, Heiko Schocher wrote: > Hello Prabhakar Lad, > > Prabhakar Lad wrote: > > Hi Heiko, > > > > On Wed, Nov 9, 2011 at 11:56 AM, Heiko Schocher wrote: > [...] > >> Signed-off-by: Heiko Schocher > >> Cc: Sandeep Paulraj > >> Cc: Albert ARIBAUD > >> Cc: Wolfgang Denk > >> Cc: Manjunath Hadli > >> --- > >> drivers/net/davinci_emac.c | 17 +++-- > >> 1 files changed, 11 insertions(+), 6 deletions(-) > >> > >> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c > >> index fa31159..a31e9f1 100644 > >> --- a/drivers/net/davinci_emac.c > >> +++ b/drivers/net/davinci_emac.c > [...] > >> @@ -175,7 +174,13 @@ static int davinci_eth_phy_detect(void) > >>for (i = 0, j = 0; i < 32; i++) > >>if (phy_act_state & (1 << i)) { > >>count++; > >> - active_phy_addr[j++] = i; > >> + if (count < MAX_PHY) > >> + active_phy_addr[j++] = i; > >> + else { > >> + printf("%s: to much PHYs detected.\n", > >> + __func__); > >> > >why not make here count = 0 and then break, so that later > >in davinci_emac_initialize() it wont initializes the phy's > > I prefer here the error printf, because you see immediately what > is wrong... > >Agreed to have a printf, I was suggesting to even have a statement count = 0; in that block, if you don't make count zero later davinci_emac_initialize() function it will proceed further in initializing the phys , which i believe is not correct. Regards, --Prabhakar Lad > bye, > Heiko > -- > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] arm, davinci_emac: fixup
Hello Prabhakar Lad, Prabhakar Lad wrote: > Hi Heiko, > > On Wed, Nov 9, 2011 at 5:56 PM, Heiko Schocher wrote: > >> Hello Prabhakar Lad, >> >> Prabhakar Lad wrote: >>> Hi Heiko, >>> >>> On Wed, Nov 9, 2011 at 11:56 AM, Heiko Schocher wrote: >> [...] Signed-off-by: Heiko Schocher Cc: Sandeep Paulraj Cc: Albert ARIBAUD Cc: Wolfgang Denk Cc: Manjunath Hadli --- drivers/net/davinci_emac.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index fa31159..a31e9f1 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c >> [...] @@ -175,7 +174,13 @@ static int davinci_eth_phy_detect(void) for (i = 0, j = 0; i < 32; i++) if (phy_act_state & (1 << i)) { count++; - active_phy_addr[j++] = i; + if (count < MAX_PHY) + active_phy_addr[j++] = i; + else { + printf("%s: to much PHYs detected.\n", + __func__); >>>why not make here count = 0 and then break, so that later >>>in davinci_emac_initialize() it wont initializes the phy's >> I prefer here the error printf, because you see immediately what >> is wrong... >> >>Agreed to have a printf, I was suggesting to even have a statement > count = 0; >in that block, if you don't make count zero later > davinci_emac_initialize() function >it will proceed further in initializing the phys , which i believe is > not correct. Ah, Ok, yes, I change this, thanks! bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] arm, davinci_emac: fixup
since commits: davinci: emac: add support for more than 1 PHYs 062fe7d332c28ede25626f448681e43d76bb312e davinci: remove obsolete macro CONFIG_EMAC_MDIO_PHY_NUM fb1d6332b5430b90a8fa8ebab709f33a60e9f816 I get following warning on the enbw_cmc board: Err: serial Net:5 ETH PHY detected miiphy_register: non unique device name 'KSZ8873 @ 0x01' DaVinci-EMAC Hit any key to stop autoboot: 0 Also I see some debug printfs: => run load + emac_close + emac_ch_teardown - emac_ch_teardown + emac_ch_teardown - emac_ch_teardown - emac_close + emac_open - emac_open Using DaVinci-EMAC device reason is 062fe7d332c28ede25626f448681e43d76bb312e new define MAX_PHY. This is set to 3! I get on this board 5 active phys, so this leads in wrong memory writes ... so I changed: - MAX_PHY from 3 to 7 - print an error message if more then MAX_PHYs are detected. - fill the active_phy_addr array in a for loop with 0xff - changed printf() in debug_emac() Signed-off-by: Heiko Schocher Cc: Sandeep Paulraj Cc: Albert ARIBAUD Cc: Wolfgang Denk Cc: Manjunath Hadli Cc: Prabhakar Lad --- - changes for v2: - add comments from Wolfgang Denk - Codingstyle cleanup if the "else" branch uses braces, the "if" branch shall use braces, too. - s/too much/too many/ in the added printf() - add comment from Prabhakar Lad: - add count = 0 in error case, so that no phys are initialized later. --- drivers/net/davinci_emac.c | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index fa31159..1648e24 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -85,7 +85,7 @@ static intemac_rx_queue_active = 0; /* Receive packet buffers */ static unsigned char emac_rx_buffers[EMAC_MAX_RX_BUFFERS * (EMAC_MAX_ETHERNET_PKT_SIZE + EMAC_PKT_ALIGN)]; -#define MAX_PHY3 +#define MAX_PHY7 /* PHY address for a discovered PHY (0xff - not found) */ static u_int8_tactive_phy_addr[MAX_PHY] = { 0xff, 0xff, 0xff }; @@ -160,9 +160,8 @@ static int davinci_eth_phy_detect(void) int j; unsigned intcount = 0; - active_phy_addr[0] = 0xff; - active_phy_addr[1] = 0xff; - active_phy_addr[2] = 0xff; + for (i = 0; i < MAX_PHY; i++) + active_phy_addr[i] = 0xff; udelay(1000); phy_act_state = readl(&adap_mdio->ALIVE); @@ -175,7 +174,14 @@ static int davinci_eth_phy_detect(void) for (i = 0, j = 0; i < 32; i++) if (phy_act_state & (1 << i)) { count++; - active_phy_addr[j++] = i; + if (count < MAX_PHY) { + active_phy_addr[j++] = i; + } else { + printf("%s: to many PHYs detected.\n", + __func__); + count = 0; + break; + } } num_phy = count; @@ -752,7 +758,7 @@ int davinci_emac_initialize(void) if (!ret) return(0); else - printf(" %d ETH PHY detected\n", ret); + debug_emac(" %d ETH PHY detected\n", ret); /* Get PHY ID and initialize phy_ops for a detected PHY */ for (i = 0; i < num_phy; i++) { -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Hello Friend
Těší mě, Jsem slečna Rebeca, zájem o vás, a přejí si, že jste jako můj přítel, pro přítele je především o respekt, obdiv a lásku i vášeň Přátelství se skládá ze sdílení nápadů a plánování společně, Chci, aby vám moje fotografie pro vás, pokud jste odpovězte mi. poděkování od Rebeca. Nice to meet you, Am miss Rebeca ,interested in you, and wish to have you as my friend, for a friend is all about Respect,Admiration and love passion also friendship is consist of sharing of ideas and planing together, i intend to send you my picture for you,if you reply me. thanks from Rebeca.___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: Correct build error introduced by getenv_ulong() patch
Hi Graeme, > Hi Wolfgang > > On Wed, Nov 9, 2011 at 9:49 AM, Wolfgang Denk wrote: >> Dear Simon Glass, >> >> In message >> you >> wrote: >>> >>> This discussion was regarding the need to #ifdef the variable declaration, >>> viz: >>> >>> #if defined(THING1) || defined(THING2) >>> const char *cat; >>> #endif >>> >>> ... >>> >>> >>> #ifdef THING1 >>>cat = getenv("cat"); >>> >>>send_back(cat); >>> #endif >>> >>> >>> >>> #ifdef THING2 >>>cat = check_outside("cat"); >>> >>>if (cat) >>> wibble(cat); >>> #endif >>> >>> >>> and whether the top bit would be better as: >>> >>> __maybe_unused const char *cat; >>> >>> But more generally, lots of #ifdefs do make the code harder to read, >>> and potentially more brittle in the face of config changes. >> >> I would like to see only a minimal number of "__maybe_unused" in the >> code - in cases, where this is the way that hurts least. >> >> In the examples above, it might be better to use local blocks, like: >> >> #ifdef THING1 >>{ >>const char *cat = getenv("cat"); >> >>send_back(cat); >>} >> #endif > > I honestly think most of these cases can be factored out into functions. > The compiler should inline them anyway so the overhead should be zero. > The various board.c files are a prime example of where this should be > done as a matter of principle to reduce the complexity and lenght of > the primary function anyway I would even like to skip the ifdefs completely. Modern compilers with dead code elimination will completely do away unneeded code _but still do syntax checks on the parts every time_. So maybe we should simply try to use if (THING1) { ... } I know that this would need an "#ifdef THING1 1" but errors in this would be caught immediately (and not only under a certain combination of ifdefs) by the compiler so I don't think this is a problem. I don't know how often I repeat my mantra, but every ifdef doubles the number of _different source codes_ that we deal with. Cheers Detlev -- Lotus Notes (GUI): Run away from it. -- linux/Documentation/email-clients.txt -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Remove broken boards csb226 and innokom
Hi Albert, > Signed-off-by: Albert ARIBAUD > --- > CREDITS |4 > MAINTAINERS |5 - > arch/arm/include/asm/arch-pxa/hardware.h |8 > boards.cfg |2 -- > doc/README.scrapyard |2 ++ > 5 files changed, 2 insertions(+), 19 deletions(-) [...] > diff --git a/arch/arm/include/asm/arch-pxa/hardware.h > b/arch/arm/include/asm/arch-pxa/hardware.h > index 44b800f..655c0b9 100644 > --- a/arch/arm/include/asm/arch-pxa/hardware.h > +++ b/arch/arm/include/asm/arch-pxa/hardware.h > @@ -108,14 +108,6 @@ extern unsigned int get_lclk_frequency_10khz(void); > #include "cerf.h" > #endif > > -#ifdef CONFIG_ARCH_CSB226 > -#include "csb226.h" > -#endif > - > -#ifdef CONFIG_ARCH_INNOKOM > -#include "innokom.h" > -#endif Could you please also remove these header files? Also the whole board/{innokom,csb226} directories are now superflous, right? Cheers Detlev -- Two monks went fishing in an electron river. The first monk drew out his network, and out flopped a hacker. The second monk cried, "The poor hacker! How can it live outside of the network?" The first monk said, "When you have learned to live outside the network, then you will know." -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: Correct build error introduced by getenv_ulong() patch
Hi Wolfgang, On Tue, Nov 8, 2011 at 2:49 PM, Wolfgang Denk wrote: > Dear Simon Glass, > > In message > you > wrote: >> >> This discussion was regarding the need to #ifdef the variable declaration, >> viz: >> >> #if defined(THING1) || defined(THING2) >> const char *cat; >> #endif >> >> ... >> >> >> #ifdef THING1 >> cat = getenv("cat"); >> >> send_back(cat); >> #endif >> >> >> >> #ifdef THING2 >> cat = check_outside("cat"); >> >> if (cat) >> wibble(cat); >> #endif >> >> >> and whether the top bit would be better as: >> >> __maybe_unused const char *cat; >> >> But more generally, lots of #ifdefs do make the code harder to read, >> and potentially more brittle in the face of config changes. > > I would like to see only a minimal number of "__maybe_unused" in the > code - in cases, where this is the way that hurts least. > > In the examples above, it might be better to use local blocks, like: > > #ifdef THING1 > { > const char *cat = getenv("cat"); > > send_back(cat); > } > #endif > Noted, thanks. Regards, Simon > > 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: w...@denx.de > "There is such a fine line between genius and stupidity." > - David St. Hubbins, "Spinal Tap" > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/4] mx31: Use proper IO accessor for GPR register
Use proper IO accessor for GPR register. Signed-off-by: Fabio Estevam --- arch/arm/cpu/arm1136/mx31/generic.c |5 +++-- arch/arm/include/asm/arch-mx31/imx-regs.h |7 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c index 1621e9e..167e97a 100644 --- a/arch/arm/cpu/arm1136/mx31/generic.c +++ b/arch/arm/cpu/arm1136/mx31/generic.c @@ -144,14 +144,15 @@ void mx31_set_pad(enum iomux_pins pin, u32 config) void mx31_set_gpr(enum iomux_gp_func gp, char en) { u32 l; + struct iomuxc_regs *iomuxc = (struct iomuxc_regs *)IOMUXC_BASE; - l = readl(IOMUXC_GPR); + l = readl(&iomuxc->gpr); if (en) l |= gp; else l &= ~gp; - writel(l, IOMUXC_GPR); + writel(l, &iomuxc->gpr); } void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs) diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h b/arch/arm/include/asm/arch-mx31/imx-regs.h index afdaa1c..0147920 100644 --- a/arch/arm/include/asm/arch-mx31/imx-regs.h +++ b/arch/arm/include/asm/arch-mx31/imx-regs.h @@ -98,6 +98,12 @@ struct iim_regs { u32 iim_scs3; }; +struct iomuxc_regs { + u32 unused1; + u32 unused2; + u32 gpr; +}; + struct mx3_cpu_type { u8 srev; u32 v; @@ -636,7 +642,6 @@ struct esdc_regs { #define WEIM_BASE 0xb8002000 #define IOMUXC_BASE0x43FAC000 -#define IOMUXC_GPR (IOMUXC_BASE + 0x8) #define IOMUXC_SW_MUX_CTL(x) (IOMUXC_BASE + 0xc + (x) * 4) #define IOMUXC_SW_PAD_CTL(x) (IOMUXC_BASE + 0x154 + (x) * 4) -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/4] mx31: Fix checkpatch warnings in generic.c
Fix checkpatch warnings in generic.c. Signed-off-by: Fabio Estevam --- arch/arm/cpu/arm1136/mx31/generic.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c index 167e97a..f458281 100644 --- a/arch/arm/cpu/arm1136/mx31/generic.c +++ b/arch/arm/cpu/arm1136/mx31/generic.c @@ -87,7 +87,7 @@ static u32 mx31_get_hsp_clk(void) void mx31_dump_clocks(void) { u32 cpufreq = mx31_get_mcu_main_clk(); - printf("mx31 cpu clock: %dMHz\n",cpufreq / 100); + printf("mx31 cpu clock: %dMHz\n", cpufreq / 100); printf("ipg clock : %dHz\n", mx31_get_ipg_clk()); printf("hsp clock : %dHz\n", mx31_get_hsp_clk()); } @@ -215,7 +215,7 @@ static char *get_reset_cause(void) } #if defined(CONFIG_DISPLAY_CPUINFO) -int print_cpuinfo (void) +int print_cpuinfo(void) { u32 srev = get_cpu_rev(); -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/4] mx31: Remove duplicate definition for GPR register
GPR register definition is already available at imx-regs.h, so remove the duplication. Signed-off-by: Fabio Estevam --- arch/arm/cpu/arm1136/mx31/generic.c |6 ++ 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c index 4f27e25..1621e9e 100644 --- a/arch/arm/cpu/arm1136/mx31/generic.c +++ b/arch/arm/cpu/arm1136/mx31/generic.c @@ -27,8 +27,6 @@ #include #include -#define IOMUXGPR (IOMUXC_BASE + 0x008) - static u32 mx31_decode_pll(u32 reg, u32 infreq) { u32 mfi = GET_PLL_MFI(reg); @@ -147,13 +145,13 @@ void mx31_set_gpr(enum iomux_gp_func gp, char en) { u32 l; - l = readl(IOMUXGPR); + l = readl(IOMUXC_GPR); if (en) l |= gp; else l &= ~gp; - writel(l, IOMUXGPR); + writel(l, IOMUXC_GPR); } void mxc_setup_weimcs(int cs, const struct mxc_weimcs *weimcs) -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/4] qong: Use generic function for configuring GPR register
Use generic function for configuring GPR register. Signed-off-by: Fabio Estevam --- board/davedenx/qong/qong.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/board/davedenx/qong/qong.c b/board/davedenx/qong/qong.c index 665aedf..c41f11d 100644 --- a/board/davedenx/qong/qong.c +++ b/board/davedenx/qong/qong.c @@ -231,7 +231,7 @@ static void board_nand_setup(void) mxc_setup_weimcs(3, &cs3); - __REG(IOMUXC_GPR) |= 1 << 13; + mx31_set_gpr(MUX_SDCTL_CSD1_SEL, 1); mx31_gpio_mux(IOMUX_MODE(MUX_CTL_NFC_WP, MUX_CTL_IN_GPIO)); mx31_gpio_mux(IOMUX_MODE(MUX_CTL_NFC_CE, MUX_CTL_IN_GPIO)); -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: Correct build error introduced by getenv_ulong() patch
Hi Detlev, On Wed, Nov 9, 2011 at 5:45 AM, Detlev Zundel wrote: > Hi Graeme, > >> Hi Wolfgang >> >> On Wed, Nov 9, 2011 at 9:49 AM, Wolfgang Denk wrote: >>> Dear Simon Glass, >>> >>> In message >>> you >>> wrote: This discussion was regarding the need to #ifdef the variable declaration, viz: #if defined(THING1) || defined(THING2) const char *cat; #endif ... #ifdef THING1 cat = getenv("cat"); send_back(cat); #endif #ifdef THING2 cat = check_outside("cat"); if (cat) wibble(cat); #endif and whether the top bit would be better as: __maybe_unused const char *cat; But more generally, lots of #ifdefs do make the code harder to read, and potentially more brittle in the face of config changes. >>> >>> I would like to see only a minimal number of "__maybe_unused" in the >>> code - in cases, where this is the way that hurts least. >>> >>> In the examples above, it might be better to use local blocks, like: >>> >>> #ifdef THING1 >>> { >>> const char *cat = getenv("cat"); >>> >>> send_back(cat); >>> } >>> #endif >> >> I honestly think most of these cases can be factored out into functions. >> The compiler should inline them anyway so the overhead should be zero. >> The various board.c files are a prime example of where this should be >> done as a matter of principle to reduce the complexity and lenght of >> the primary function anyway > > I would even like to skip the ifdefs completely. Modern compilers with > dead code elimination will completely do away unneeded code _but still > do syntax checks on the parts every time_. Yes I agree it is better and we are heading that way (e.g. debug macro). But there are details... > > So maybe we should simply try to use > > if (THING1) > { > ... > } > > I know that this would need an "#ifdef THING1 1" but errors in this > would be caught immediately (and not only under a certain combination of > ifdefs) by the compiler so I don't think this is a problem. Do you mean '#define THING1 1"? Can you please restate this without the code inside {} removed? And let's change the example to CONFIG. Sadly I much prefer #ifdef to #if. #ifdef CONFIG_THING1 { const char *cat; cat = getenv("cat"); send_back(cat); } #endif Things to consider: - do we include the cat.h header file unconditionally? I assume yes - iwc does the cat.h header file have #ifdefs to hide its functions / data structures? If so you get compile errors when you make a mistake; if not you get link errors which are normally worse - under what circs. should we define static inline send_back(void) {} for the case where CONFIG_THING1 is not defined (or is 0)? - if send_back() is in a C file which is only linked in if THING1 is defined, does this work as expected? - CONFIG_THING1 is normally defined but not given a '1' value. Doesn't this break things? > > I don't know how often I repeat my mantra, but every ifdef doubles > the number of _different source codes_ that we deal with. Yes of course at the compiler level. Look at all the build errors/warnings when the new debug() macro came in. But if() creates different executable code too, and if we resort to hiding lots of things in static inlines and dead code calls to functions which are not linked, it can create confusion. It would be good to get some guidelines on this. Regards, Simon > > Cheers > Detlev > > -- > Lotus Notes (GUI): Run away from it. > -- linux/Documentation/email-clients.txt > -- > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] BAB7xx board: build warnigns
Dear Frank, the BAB7xx throws a number of build warnings: misc.c: In function 'misc_init_r': misc.c:159:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] misc.c:247:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] misc.c:249:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] misc.c:252:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] misc.c:280:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] misc.c:345:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Is it still worth to fix these (then please provide a patch), or should we rather drop that board? 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: w...@denx.de The ideal situation is to have massive computing power right at home. Something that dims the streetlights and shrinks the picture on the neighbours' TVs when you boot it up. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] powerpc/85xx: Fix NAND SPL support
We cause CCSRBAR to be relocated in the SPL phase of NAND boot which isn't expected and breaks things. Fixing the board config.h to NOT relocate CCSR during the CONFIG_NAND_SPL phase. Signed-off-by: Kumar Gala --- include/configs/MPC8536DS.h|2 +- include/configs/MPC8569MDS.h |2 +- include/configs/MPC8572DS.h|2 +- include/configs/P1_P2_RDB.h|2 +- include/configs/p1_p2_rdb_pc.h |2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index d4e3ef5..16db98f 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -131,7 +131,7 @@ #define CONFIG_SYS_CCSRBAR 0xffe0 #define CONFIG_SYS_CCSRBAR_PHYS_LOWCONFIG_SYS_CCSRBAR -#if defined(CONFIG_RAMBOOT_NAND) && !defined(CONFIG_NAND_SPL) +#if defined(CONFIG_NAND_SPL) #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE #endif diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index 19d3271..ab27b98 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -108,7 +108,7 @@ extern unsigned long get_clock_freq(void); #define CONFIG_SYS_CCSRBAR 0xe000 #define CONFIG_SYS_CCSRBAR_PHYS_LOWCONFIG_SYS_CCSRBAR -#if defined(CONFIG_RAMBOOT_NAND) && !defined(CONFIG_NAND_SPL) +#if defined(CONFIG_NAND_SPL) #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE #endif diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index ffee8fc..d7910e1 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -115,7 +115,7 @@ #define CONFIG_SYS_CCSRBAR 0xffe0 #define CONFIG_SYS_CCSRBAR_PHYS_LOWCONFIG_SYS_CCSRBAR -#if defined(CONFIG_RAMBOOT_NAND) && !defined(CONFIG_NAND_SPL) +#if defined(CONFIG_NAND_SPL) #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE #endif diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h index 883d44e..00fa74d 100644 --- a/include/configs/P1_P2_RDB.h +++ b/include/configs/P1_P2_RDB.h @@ -151,7 +151,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_CCSRBAR 0xffe0 #define CONFIG_SYS_CCSRBAR_PHYS_LOWCONFIG_SYS_CCSRBAR -#if defined(CONFIG_RAMBOOT_NAND) && !defined(CONFIG_NAND_SPL) +#if defined(CONFIG_NAND_SPL) #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE #endif diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index bcfb034..5a69902 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -221,7 +221,7 @@ /* IN case of NAND bootloader relocate CCSRBAR in RAMboot code not in the 4k SPL code*/ -#if defined(CONFIG_NAND_U_BOOT) && defined(CONFIG_NAND_SPL) +#if defined(CONFIG_NAND_SPL) #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE #endif -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] ELPPC board: build warnigns
Dear Frank, the ELPPC throws a build warning: misc.c: In function 'misc_init_r': misc.c:120:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-al Is it still worth to fix this (then please provide a patch), or should we rather drop that board? 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: w...@denx.de A stone was placed at a ford in a river with the inscription: "When this stone is covered it is dangerous to ford here." ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] CPCI750 board: build warnigns
Dear Reinhard, the CPCI750 board throws a number of build warnings: mv_eth.c: In function 'mv64360_eth_real_open': mv_eth.c:425:6: warning: variable 'port_status' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_stop': mv_eth.c:643:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_xmit': mv_eth.c:719:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_receive': mv_eth.c:804:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_get_stats': mv_eth.c:903:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_update_stat': mv_eth.c:931:24: warning: variable 'dummy' set but not used [-Wunused-but-set-variable] mv_eth.c:930:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'mv64360_eth_print_stat': mv_eth.c:1012:15: warning: variable 'port_num' set but not used [-Wunused-but-set-variable] mv_eth.c: In function 'eth_clear_mib_counters': mv_eth.c:2069:15: warning: variable 'dummy' set but not used [-Wunused-but-set-variable] Can you please fix these? Thanks. 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: w...@denx.de Eureka! -- Archimedes ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/7 v3] integrator: use io-accessors for board init
Casting around to *(volatile ulong *) doesn't look good, so include the macros and use good old readl() instead. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- board/armltd/integrator/integrator.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index 83f047c..780218c 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -35,6 +35,7 @@ #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -101,15 +102,15 @@ int dram_init (void) #ifdef CONFIG_CM_SPD_DETECT { extern void dram_query(void); - unsigned long cm_reg_sdram; - unsigned long sdram_shift; + u32 cm_reg_sdram; + u32 sdram_shift; dram_query(); /* Assembler accesses to CM registers */ /* Queries the SPD values */ /* Obtain the SDRAM size from the CM SDRAM register */ - cm_reg_sdram = *(volatile ulong *)(CM_BASE + OS_SDRAM); + cm_reg_sdram = readl(CM_BASE + OS_SDRAM); /* Register SDRAM size * * 0xXXbbb000bb16 MB @@ -119,7 +120,7 @@ extern void dram_query(void); * 0xXXbbb100bb 256 MB * */ - sdram_shift = ((cm_reg_sdram & 0x001C)/4)%4; + sdram_shift = ((cm_reg_sdram & 0x001C)/4)%4; gd->ram_size = get_ram_size((long *) CONFIG_SYS_SDRAM_BASE + REMAPPED_FLASH_SZ, 0x0100 << sdram_shift); -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/7 v3] integrator: pass configs for core modules
Alter the board.cfg to pass core module configuration flags so we can make compile-time switches for different core modules. These are already in use for some low-level code, they just got lost in the conversion to the new build system. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- boards.cfg | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/boards.cfg b/boards.cfg index 88be71b..7113745 100644 --- a/boards.cfg +++ b/boards.cfg @@ -35,7 +35,7 @@ # Target ARCHCPU Board name VendorSoC Options ### -integratorcp_cm1136 arm arm1136 integrator armltd - integratorcp +integratorcp_cm1136 arm arm1136 integrator armltd - integratorcp:CM1136 qong arm arm1136 - davedenx mx31 mx31ads arm arm1136 - freescale mx31 imx31_litekitarm arm1136 - logicpdmx31 @@ -47,9 +47,9 @@ flea3arm arm1136 - CarMedi mx35pdk arm arm1136 - freescale mx35 omap2420h4 arm arm1136 - ti omap24xx tnetv107x_evmarm arm1176 tnetv107xevmti tnetv107x -integratorap_cm720t arm arm720t integrator armltd - integratorap -integratorap_cm920t arm arm920t integrator armltd - integratorap -integratorcp_cm920t arm arm920t integrator armltd - integratorcp +integratorap_cm720t arm arm720t integrator armltd - integratorap:CM720T +integratorap_cm920t arm arm920t integrator armltd - integratorap:CM920T +integratorcp_cm920t arm arm920t integrator armltd - integratorcp:CM920T a320evb arm arm920t - faradaya320 at91rm9200ek arm arm920t at91rm9200ekatmel at91at91rm9200ek at91rm9200ek_ram arm arm920t at91rm9200ekatmel at91at91rm9200ek:RAMBOOT @@ -63,8 +63,8 @@ cm41xx arm arm920t - - VCMA9arm arm920t vcma9 mpl s3c24x0 smdk2410 arm arm920t - samsungs3c24x0 omap1510inn arm arm925t - ti -integratorap_cm926ejsarm arm926ejs integrator armltd - integratorap -integratorcp_cm926ejsarm arm926ejs integrator armltd - integratorcp +integratorap_cm926ejsarm arm926ejs integrator armltd - integratorap:CM926EJ_S +integratorcp_cm926ejsarm arm926ejs integrator armltd - integratorcp:CM924EJ_S versatileqemuarm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_QEMU,ARCH_VERSATILE_PB versatilepb arm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_PB versatileab arm arm926ejs versatile armltd versatile versatile:ARCH_VERSATILE_AB @@ -162,8 +162,8 @@ nhk8815_onenand arm arm926ejs nhk8815 st omap5912osk arm arm926ejs - ti omap edminiv2 arm arm926ejs - LaCie orion5x dkb arm arm926ejs - Marvellpantheon -integratorap_cm946es arm arm946esintegrator armltd - integratorap -integratorcp_cm946es arm arm946esintegrator armltd - integratorcp +integratorap_cm946es arm arm946esintegrator armltd - integratorap:CM946ES +integratorcp_cm946es arm arm946esintegrator armltd -
[U-Boot] [PATCH 2/7 v3] integrator: move text offset to config
Do away with the config.mk file and move the text offset to the config files to make things easier. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- board/armltd/integrator/config.mk |5 - include/configs/integratorap.h|1 + include/configs/integratorcp.h|1 + 3 files changed, 2 insertions(+), 5 deletions(-) delete mode 100644 board/armltd/integrator/config.mk diff --git a/board/armltd/integrator/config.mk b/board/armltd/integrator/config.mk deleted file mode 100644 index 8b57af1..000 --- a/board/armltd/integrator/config.mk +++ /dev/null @@ -1,5 +0,0 @@ -# -# image should be loaded at 0x0100 -# - -CONFIG_SYS_TEXT_BASE = 0x0100 diff --git a/include/configs/integratorap.h b/include/configs/integratorap.h index 61b8761..a1fdbb8 100644 --- a/include/configs/integratorap.h +++ b/include/configs/integratorap.h @@ -37,6 +37,7 @@ * High Level Configuration Options * (easy to change) */ +#define CONFIG_SYS_TEXT_BASE 0x0100 #define CONFIG_SYS_MEMTEST_START 0x10 #define CONFIG_SYS_MEMTEST_END 0x1000 #define CONFIG_SYS_HZ 1000 diff --git a/include/configs/integratorcp.h b/include/configs/integratorcp.h index 7ae34b7..ccbdf44 100644 --- a/include/configs/integratorcp.h +++ b/include/configs/integratorcp.h @@ -37,6 +37,7 @@ * High Level Configuration Options * (easy to change) */ +#define CONFIG_SYS_TEXT_BASE 0x0100 #define CONFIG_SYS_MEMTEST_START 0x10 #define CONFIG_SYS_MEMTEST_END 0x1000 #define CONFIG_SYS_HZ 1000 -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] drivers/block/ahci.c: Fix GCC 4.6 build warning
Fix: ahci.c: In function 'ata_scsiop_read10': ahci.c:564:6: warning: variable 'lba' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- drivers/block/ahci.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index 015b341..7b2ec50 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -561,12 +561,9 @@ static int ata_scsiop_inquiry(ccb *pccb) */ static int ata_scsiop_read10(ccb * pccb) { - u64 lba = 0; u32 len = 0; u8 fis[20]; - lba = (((u64) pccb->cmd[2]) << 24) | (((u64) pccb->cmd[3]) << 16) - | (((u64) pccb->cmd[4]) << 8) | ((u64) pccb->cmd[5]); len = (((u32) pccb->cmd[7]) << 8) | ((u32) pccb->cmd[8]); /* For 10-byte and 16-byte SCSI R/W commands, transfer -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] drivers/bios_emulator/x86emu/ops.c: Fix GCC 4.6 build warning
Fix: x86emu/ops.c: In function 'x86emuOp_int3': x86emu/ops.c:3521:9: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] x86emu/ops.c: In function 'x86emuOp_int_IMM': x86emu/ops.c:3549:9: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] x86emu/ops.c: In function 'x86emuOp_into': x86emu/ops.c:3579:9: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] x86emu/ops.c: In function 'x86emuOp_aad': x86emu/ops.c:3993:8: warning: variable 'a' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- drivers/bios_emulator/x86emu/ops.c | 15 --- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/bios_emulator/x86emu/ops.c b/drivers/bios_emulator/x86emu/ops.c index c836a20..f8e093d 100644 --- a/drivers/bios_emulator/x86emu/ops.c +++ b/drivers/bios_emulator/x86emu/ops.c @@ -3518,11 +3518,9 @@ Handles opcode 0xcc / void x86emuOp_int3(u8 X86EMU_UNUSED(op1)) { -u16 tmp; - START_OF_INSTR(); DECODE_PRINTF("INT 3\n"); -tmp = (u16) mem_access_word(3 * 4 + 2); +(void)mem_access_word(3 * 4 + 2); /* access the segment register */ TRACE_AND_STEP(); if (_X86EMU_intrTab[3]) { @@ -3546,14 +3544,13 @@ Handles opcode 0xcd / void x86emuOp_int_IMM(u8 X86EMU_UNUSED(op1)) { -u16 tmp; u8 intnum; START_OF_INSTR(); DECODE_PRINTF("INT\t"); intnum = fetch_byte_imm(); DECODE_PRINTF2("%x\n", intnum); -tmp = mem_access_word(intnum * 4 + 2); +(void)mem_access_word(intnum * 4 + 2); TRACE_AND_STEP(); if (_X86EMU_intrTab[intnum]) { (*_X86EMU_intrTab[intnum])(intnum); @@ -3576,13 +3573,11 @@ Handles opcode 0xce / void x86emuOp_into(u8 X86EMU_UNUSED(op1)) { -u16 tmp; - START_OF_INSTR(); DECODE_PRINTF("INTO\n"); TRACE_AND_STEP(); if (ACCESS_FLAG(F_OF)) { - tmp = mem_access_word(4 * 4 + 2); + (void)mem_access_word(4 * 4 + 2); if (_X86EMU_intrTab[4]) { (*_X86EMU_intrTab[4])(4); } else { @@ -3990,11 +3985,9 @@ Handles opcode 0xd5 / void x86emuOp_aad(u8 X86EMU_UNUSED(op1)) { -u8 a; - START_OF_INSTR(); DECODE_PRINTF("AAD\n"); -a = fetch_byte_imm(); +(void)fetch_byte_imm(); TRACE_AND_STEP(); M.x86.R_AX = aad_word(M.x86.R_AX); DECODE_CLEAR_SEGOVR(); -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] drivers/block/sata_sil3114.c: Fix GCC 4.6 build warning
Fix: sata_sil3114.c: In function 'scan_sata': sata_sil3114.c:793:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:794:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:795:39: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:795:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:797:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:800:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:801:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:802:39: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:802:7: warning: array subscript is above array bounds [-Warray-bounds] sata_sil3114.c:804:7: warning: array subscript is above array bounds [-Warray-bounds] Signed-off-by: Kumar Gala --- drivers/block/sata_sil3114.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/block/sata_sil3114.c b/drivers/block/sata_sil3114.c index 1e60636..34fe038 100644 --- a/drivers/block/sata_sil3114.c +++ b/drivers/block/sata_sil3114.c @@ -782,6 +782,7 @@ int scan_sata (int dev) (iobase[5] + VND_TF2_CH0) | ATA_PCI_CTL_OFS; port[0].ioaddr.bmdma_addr = iobase[5] + VND_BMDMA_CH0; break; +#if (CONFIG_SYS_SATA_MAX_DEVICE >= 1) case 1: port[1].port_no = 0; port[1].ioaddr.cmd_addr = iobase[5] + VND_TF0_CH1; @@ -789,6 +790,7 @@ int scan_sata (int dev) (iobase[5] + VND_TF2_CH1) | ATA_PCI_CTL_OFS; port[1].ioaddr.bmdma_addr = iobase[5] + VND_BMDMA_CH1; break; +#elif (CONFIG_SYS_SATA_MAX_DEVICE >= 2) case 2: port[2].port_no = 0; port[2].ioaddr.cmd_addr = iobase[5] + VND_TF0_CH2; @@ -796,6 +798,7 @@ int scan_sata (int dev) (iobase[5] + VND_TF2_CH2) | ATA_PCI_CTL_OFS; port[2].ioaddr.bmdma_addr = iobase[5] + VND_BMDMA_CH2; break; +#elif (CONFIG_SYS_SATA_MAX_DEVICE >= 3) case 3: port[3].port_no = 0; port[3].ioaddr.cmd_addr = iobase[5] + VND_TF0_CH3; @@ -803,6 +806,7 @@ int scan_sata (int dev) (iobase[5] + VND_TF2_CH3) | ATA_PCI_CTL_OFS; port[3].ioaddr.bmdma_addr = iobase[5] + VND_BMDMA_CH3; break; +#endif default: printf ("Tried to scan unknown port: ata%d\n", dev); return 1; -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/7 v2] integrator: pass configs for core modules
On Mon, Nov 7, 2011 at 10:00 PM, Albert ARIBAUD wrote: > Can you please rebase them on top of current u-boot-arm/master? OK I rebased and sent them off with the same series enumeration. Since 3/7 was merged out-of-series I've only rebased and sent out 1,2,4,5,6,7. (Just as it appears in patchwork FTM.) Yours, Linus Walleij ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm, davinci_emac: fixup
the summary "fixup" tells us nothing as to what you're fixing. could you use a little more descriptive summary ? -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 7/7 v3] integrator: enable Vpp and disable flash protection
This enables Vpp and disables the flash protection on the Integrator when starting U-Boot. The integrator/AP has double protection mechanisms: this one and the EBI protection bit (patch earlier), the Integrator/CP has only one line of protection in these registers. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- board/armltd/integrator/integrator.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index dd83ca5..a507c09 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -37,6 +37,7 @@ #include #include #include "arm-ebi.h" +#include "integrator-sc.h" DECLARE_GLOBAL_DATA_PTR; @@ -76,7 +77,19 @@ extern void cm_remap(void); cm_remap(); /* remaps writeable memory to 0x */ #endif +#ifdef CONFIG_ARCH_CINTEGRATOR /* +* Flash protection on the Integrator/CP is in a simple register +*/ + val = readl(CP_FLASHPROG); + val |= (CP_FLASHPROG_FLVPPEN | CP_FLASHPROG_FLWREN); + writel(val, CP_FLASHPROG); +#else + /* +* The Integrator/AP has some special protection mechanisms +* for the external memories, first the External Bus Interface (EBI) +* then the system controller (SC). +* * The system comes up with the flash memory non-writable and * configuration locked. If we want U-Boot to be used for flash * access we cannot have the flash memory locked. @@ -88,6 +101,13 @@ extern void cm_remap(void); writel(val, EBI_BASE + EBI_CSR1_REG); writel(0, EBI_BASE + EBI_LOCK_REG); + /* +* Set up the system controller to remove write protection from +* the flash memory and enable Vpp +*/ + writel(SC_CTRL_FLASHVPP | SC_CTRL_FLASHWP, SC_CTRLS); +#endif + icache_enable (); return 0; -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/7 v4] integrator: make flash writeable on boot
This reconfigures the EBI (External Bus Interface) on the integrator so that chip select 1, handling the flash memory, is set to writeable. Without this it is not possible for U-Boot to access flash memory and it crashes on startup since CFI won't work properly. Since this is the first time we use the EBI, we create a header file for its registers. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Moved the arm-ebi.h file from the global include/ dir to the board/armltd/integrator/ dir since it's only needed by the Integrator. ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v3->v4: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- board/armltd/integrator/arm-ebi.h| 62 ++ board/armltd/integrator/integrator.c | 15 2 files changed, 77 insertions(+), 0 deletions(-) create mode 100644 board/armltd/integrator/arm-ebi.h diff --git a/board/armltd/integrator/arm-ebi.h b/board/armltd/integrator/arm-ebi.h new file mode 100644 index 000..2d85e3f --- /dev/null +++ b/board/armltd/integrator/arm-ebi.h @@ -0,0 +1,62 @@ +/* + * (C) Copyright 2011 + * Linaro + * Linus Walleij + * Register definitions for the External Bus Interface (EBI) + * found in the ARM Integrator AP and CP reference designs + * + * 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 __ARM_EBI_H +#define __ARM_EBI_H + +#define EBI_BASE 0x1200 + +#define EBI_CSR0_REG 0x00 /* CS0 = Boot ROM */ +#define EBI_CSR1_REG 0x04 /* CS1 = Flash */ +#define EBI_CSR2_REG 0x08 /* CS2 = SSRAM */ +#define EBI_CSR3_REG 0x0C /* CS3 = Expansion memory */ +/* + * The four upper bits are the waitstates for each chip select + * 0x00 = 2 cycles, 0x10 = 3 cycles, ... 0xe0 = 16 cycles, 0xf0 = 16 cycles + */ +#define EBI_CSR_WAIT_MASK 0xF0 +/* Whether memory is synchronous or asynchronous */ +#define EBI_CSR_SYNC_MASK 0xF7 +#define EBI_CSR_ASYNC 0x00 +#define EBI_CSR_SYNC 0x08 +/* Whether memory is write enabled or not */ +#define EBI_CSR_WREN_MASK 0xFB +#define EBI_CSR_WREN_DISABLE 0x00 +#define EBI_CSR_WREN_ENABLE0x04 +/* Memory bit width for each chip select */ +#define EBI_CSR_MEMSIZE_MASK 0xFC +#define EBI_CSR_MEMSIZE_8BIT 0x00 +#define EBI_CSR_MEMSIZE_16BIT 0x01 +#define EBI_CSR_MEMSIZE_32BIT 0x02 + +/* + * The lock register need to be written with 0xa05f before anything in the + * EBI can be changed. + */ +#define EBI_LOCK_REG 0x20 +#define EBI_UNLOCK_MAGIC 0xA05F + +#endif diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c index 780218c..dd83ca5 100644 --- a/board/armltd/integrator/integrator.c +++ b/board/armltd/integrator/integrator.c @@ -36,6 +36,7 @@ #include #include #include +#include "arm-ebi.h" DECLARE_GLOBAL_DATA_PTR; @@ -56,6 +57,8 @@ void show_boot_progress(int progress) int board_init (void) { + u32 val; + /* arch number of Integrator Board */ #ifdef CONFIG_ARCH_CINTEGRATOR gd->bd->bi_arch_number = MACH_TYPE_CINTEGRATOR; @@ -73,6 +76,18 @@ extern void cm_remap(void); cm_remap(); /* remaps writeable memory to 0x */ #endif + /* +* The system comes up with the flash memory non-writable and +* configuration locked. If we want U-Boot to be used for flash +* access we cannot have the flash memory locked. +*/ + writel(EBI_UNLOCK_MAGIC, EBI_BASE + EBI_LOCK_REG); + val = readl(EBI_BASE + EBI_CSR1_REG); + val &= EBI_CSR_WREN_MASK; + val |= EBI_CSR_WREN_ENABLE; + writel(val, EBI_BASE + EBI_CSR1_REG); + writel(0, EBI_BASE + EBI_LOCK_REG); + icache_enable (); return 0; -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 6/7 v3] integrator: add system controller header
Break out the AP system controller and CP "CP controller" registers into a header file, it gives better overview than hardcoding its values and other disturbing practices. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4ea1c8e7.7090...@aribaud.net ChangeLog v2->v3: - Rebased to U-Boot ARM HEAD at Alberts request, see message 4eb84700.1030...@aribaud.net --- board/armltd/integrator/integrator-sc.h | 91 +++ 1 files changed, 91 insertions(+), 0 deletions(-) create mode 100644 board/armltd/integrator/integrator-sc.h diff --git a/board/armltd/integrator/integrator-sc.h b/board/armltd/integrator/integrator-sc.h new file mode 100644 index 000..279dc55 --- /dev/null +++ b/board/armltd/integrator/integrator-sc.h @@ -0,0 +1,91 @@ +/* + * (C) Copyright 2011 + * Linaro + * Linus Walleij + * Register definitions for the System Controller (SC) and + * the similar "CP Controller" found in the ARM Integrator/AP and + * Integrator/CP reference designs + * + * 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 __ARM_SC_H +#define __ARM_SC_H + +#define SC_BASE0x1100 + +/* + * The system controller registers + */ +#define SC_ID_OFFSET 0x00 +#define SC_OSC_OFFSET 0x04 +/* Setting this bit switches to 25 MHz mode, clear means 33 MHz */ +#define SC_OSC_DIVXY (1 << 8) +#define SC_CTRLS_OFFSET0x08 +#define SC_CTRLC_OFFSET0x0C +/* Set bits by writing CTRLS, clear bits by writing CTRLC */ +#define SC_CTRL_SOFTRESET (1 << 0) +#define SC_CTRL_FLASHVPP (1 << 1) +#define SC_CTRL_FLASHWP(1 << 2) +#define SC_CTRL_UART1DTR (1 << 4) +#define SC_CTRL_UART1RTS (1 << 5) +#define SC_CTRL_UART0DTR (1 << 6) +#define SC_CTRL_UART0RTS (1 << 7) +#define SC_DEC_OFFSET 0x10 +#define SC_ARB_OFFSET 0x14 +#define SC_PCI_OFFSET 0x18 +#define SC_PCI_PCIEN (1 << 0) +#define SC_PCI_PCIBINT_CLR (1 << 1) +#define SC_LOCK_OFFSET 0x1C +#define SC_LBFADDR_OFFSET 0x20 +#define SC_LBFCODE_OFFSET 0x24 + +#define SC_ID (SC_BASE + SC_ID_OFFSET) +#define SC_OSC (SC_BASE + SC_OSC_OFFSET) +#define SC_CTRLS (SC_BASE + SC_CTRLS_OFFSET) +#define SC_CTRLC (SC_BASE + SC_CTRLC_OFFSET) +#define SC_DEC (SC_BASE + SC_DEC_OFFSET) +#define SC_ARB (SC_BASE + SC_ARB_OFFSET) +#define SC_PCI (SC_BASE + SC_PCI_OFFSET) +#define SC_LOCK (SC_BASE + SC_LOCK_OFFSET) +#define SC_LBFADDR (SC_BASE + SC_LBFADDR_OFFSET) +#define SC_LBFCODE (SC_BASE + SC_LBFCODE_OFFSET) + +/* + * The Integrator/CP as a smaller set of registers, at a different + * offset - probably not to disturb old software. + */ + +#define CP_BASE0xCB00 + +#define CP_IDFIELD_OFFSET 0x00 +#define CP_FLASHPROG_OFFSET0x04 +#define CP_FLASHPROG_FLVPPEN (1 << 0) +#define CP_FLASHPROG_FLWREN(1 << 1) +#define CP_FLASHPROG_FLASHSIZE (1 << 2) +#define CP_FLASHPROG_EXTRABANK (1 << 3) +#define CP_INTREG_OFFSET 0x08 +#define CP_DECODE_OFFSET 0x0C + +#define CP_IDFIELD (CP_BASE + CP_ID_OFFSET) +#define CP_FLASHPROG (CP_BASE + CP_FLASHPROG_OFFSET) +#define CP_INTREG (CP_BASE + CP_INTREG_OFFSET) +#define CP_DECODE (CP_BASE + CP_DECODE_OFFSET) + +#endif -- 1.7.6.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 00/16] Fix GCC 4.6 build warning related to MPC85xx builds
Address 85xx specific gcc 4.6 warnings - k ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 01/16] arch/powerpc/cpu/mpc85xx/cpu_init.c: Fix GCC 4.6 build warning
Fix: cpu_init.c: In function 'cpu_init_r': cpu_init.c:320:7: warning: variable 'l2srbar' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc85xx/cpu_init.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 0a4ce53..b9a8193 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -317,7 +317,6 @@ int cpu_init_r(void) volatile ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR; volatile uint cache_ctl; uint svr, ver; - uint l2srbar; u32 l2siz_field; svr = get_svr(); @@ -385,8 +384,8 @@ int cpu_init_r(void) if (l2cache->l2ctl & MPC85xx_L2CTL_L2E) { puts("already enabled"); - l2srbar = l2cache->l2srbar0; #if defined(CONFIG_SYS_INIT_L2_ADDR) && defined(CONFIG_SYS_FLASH_BASE) + u32 l2srbar = l2cache->l2srbar0; if (l2cache->l2ctl & MPC85xx_L2CTL_L2SRAM_ENTIRE && l2srbar >= CONFIG_SYS_FLASH_BASE) { l2srbar = CONFIG_SYS_INIT_L2_ADDR; -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/16] arch/powerpc/cpu/mpc85xx/tlb.c: Fix GCC 4.6 build warning
Fix: tlb.c: In function 'disable_tlb': tlb.c:175:34: warning: variable '_mas7' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc85xx/tlb.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c index 80ad04a..929f6a6 100644 --- a/arch/powerpc/cpu/mpc85xx/tlb.c +++ b/arch/powerpc/cpu/mpc85xx/tlb.c @@ -172,7 +172,7 @@ void set_tlb(u8 tlb, u32 epn, u64 rpn, void disable_tlb(u8 esel) { - u32 _mas0, _mas1, _mas2, _mas3, _mas7; + u32 _mas0, _mas1, _mas2, _mas3; free_tlb_cam(esel); @@ -180,14 +180,13 @@ void disable_tlb(u8 esel) _mas1 = 0; _mas2 = 0; _mas3 = 0; - _mas7 = 0; mtspr(MAS0, _mas0); mtspr(MAS1, _mas1); mtspr(MAS2, _mas2); mtspr(MAS3, _mas3); #ifdef CONFIG_ENABLE_36BIT_PHYS - mtspr(MAS7, _mas7); + mtspr(MAS7, 0); #endif asm volatile("isync;msync;tlbwe;isync"); -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 03/16] arch/powerpc/cpu/mpc8xxx/fsl_lbc.c: Fix GCC 4.6 build warning
Fix: fsl_lbc.c: In function 'upmconfig': fsl_lbc.c:110:9: warning: variable 'mdr' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc8xxx/fsl_lbc.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c b/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c index d78962f..587576b 100644 --- a/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c +++ b/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c @@ -107,7 +107,7 @@ void init_early_memctl_regs(void) void upmconfig(uint upm, uint *table, uint size) { fsl_lbc_t *lbc = LBC_BASE_ADDR; - int i, mdr, mad, old_mad = 0; + int i, mad, old_mad = 0; u32 mask = (~MxMR_OP_MSK & ~MxMR_MAD_MSK); u32 msel = BR_UPMx_TO_MSEL(upm); u32 *mxmr = &lbc->mamr + upm; @@ -138,7 +138,7 @@ void upmconfig(uint upm, uint *table, uint size) for (i = 0; i < size; i++) { out_be32(mxmr, (in_be32(mxmr) & mask) | MxMR_OP_WARR | i); out_be32(&lbc->mdr, table[i]); - mdr = in_be32(&lbc->mdr); + (void)in_be32(&lbc->mdr); *dummy = 0; do { mad = in_be32(mxmr) & MxMR_MAD_MSK; -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 04/16] board/freescale/common/cds_pci_ft.c: Fix GCC 4.6 build warning
Fix: cds_pci_ft.c: In function 'cds_pci_fixup': cds_pci_ft.c:31:12: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/freescale/common/cds_pci_ft.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/board/freescale/common/cds_pci_ft.c b/board/freescale/common/cds_pci_ft.c index 6f221af..8a09f99 100644 --- a/board/freescale/common/cds_pci_ft.c +++ b/board/freescale/common/cds_pci_ft.c @@ -28,13 +28,12 @@ #if defined(CONFIG_OF_BOARD_SETUP) static void cds_pci_fixup(void *blob) { - int node, tmp[2]; + int node; const char *path; int len, slot, i; u32 *map = NULL; node = fdt_path_offset(blob, "/aliases"); - tmp[0] = 0; if (node >= 0) { path = fdt_getprop(blob, node, "pci0", NULL); if (path) { -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 05/16] board/freescale/common/pixis.c: Fix GCC 4.6 build warning
Fix: pixis.c: In function 'strfractoint': pixis.c:383:6: warning: variable 'intarr_len' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/freescale/common/pixis.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/board/freescale/common/pixis.c b/board/freescale/common/pixis.c index a35b5cf..8d07061 100644 --- a/board/freescale/common/pixis.c +++ b/board/freescale/common/pixis.c @@ -380,7 +380,7 @@ static unsigned long strfractoint(char *strptr) { int i, j; int mulconst; - int intarr_len, no_dec = 0; + int no_dec = 0; unsigned long intval = 0, decval = 0; char intarr[3], decarr[3]; @@ -399,8 +399,6 @@ static unsigned long strfractoint(char *strptr) i++; } - /* Assign length of integer part to intarr_len. */ - intarr_len = i; intarr[i] = '\0'; if (no_dec) { -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 06/16] board/freescale/mpc8548cds/mpc8548cds.c: Fix GCC 4.6 build warning
Fix: mpc8548cds.c: In function 'local_bus_init': mpc8548cds.c:87:7: warning: variable 'lbc_hz' set but not used [-Wunused-but-set-variable] mpc8548cds.c: In function 'lbc_sdram_init': mpc8548cds.c:121:7: warning: variable 'cpu_board_rev' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/freescale/mpc8548cds/mpc8548cds.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/board/freescale/mpc8548cds/mpc8548cds.c b/board/freescale/mpc8548cds/mpc8548cds.c index d33ef7e..e5563f7 100644 --- a/board/freescale/mpc8548cds/mpc8548cds.c +++ b/board/freescale/mpc8548cds/mpc8548cds.c @@ -84,12 +84,10 @@ local_bus_init(void) volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; uint clkdiv; - uint lbc_hz; sys_info_t sysinfo; get_sys_info(&sysinfo); clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2; - lbc_hz = sysinfo.freqSystemBus / 100 / clkdiv; gur->lbiuiplldcr1 = 0x00078080; if (clkdiv == 16) { @@ -118,7 +116,6 @@ void lbc_sdram_init(void) uint idx; volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE; - uint cpu_board_rev; uint lsdmr_common; puts("LBC SDRAM: "); @@ -140,7 +137,6 @@ void lbc_sdram_init(void) /* * MPC8548 uses "new" 15-16 style addressing. */ - cpu_board_rev = get_cpu_board_revision(); lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON; lsdmr_common |= LSDMR_BSMA1516; -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 07/16] board/freescale/mpc8568mds/mpc8568mds.c: Fix GCC 4.6 build warning
Fix: mpc8568mds.c: In function 'local_bus_init': mpc8568mds.c:150:7: warning: variable 'lbc_hz' set but not used [-Wunused-but-set-variable] mpc8568mds.c: In function 'pib_init': mpc8568mds.c:271:11: warning: variable 'orig_i2c_bus' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/freescale/mpc8568mds/mpc8568mds.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/board/freescale/mpc8568mds/mpc8568mds.c b/board/freescale/mpc8568mds/mpc8568mds.c index 225c5d8..6e3945e 100644 --- a/board/freescale/mpc8568mds/mpc8568mds.c +++ b/board/freescale/mpc8568mds/mpc8568mds.c @@ -147,12 +147,10 @@ local_bus_init(void) volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; uint clkdiv; - uint lbc_hz; sys_info_t sysinfo; get_sys_info(&sysinfo); clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2; - lbc_hz = sysinfo.freqSystemBus / 100 / clkdiv; gur->lbiuiplldcr1 = 0x00078080; if (clkdiv == 16) { @@ -302,6 +300,7 @@ pib_init(void) i2c_write(0x27, 0x3, 1, &val8, 1); asm("eieio"); + i2c_set_bus_num(orig_i2c_bus); } #ifdef CONFIG_PCI -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/16] board/sbc8548/sbc8548.c: Fix GCC 4.6 build warning
Fix: sbc8548.c: In function 'local_bus_init': sbc8548.c:80:7: warning: variable 'lbc_hz' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/sbc8548/sbc8548.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c index e1a3ea3..26095a5 100644 --- a/board/sbc8548/sbc8548.c +++ b/board/sbc8548/sbc8548.c @@ -77,12 +77,10 @@ local_bus_init(void) volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; uint clkdiv; - uint lbc_hz; sys_info_t sysinfo; get_sys_info(&sysinfo); clkdiv = (in_be32(&lbc->lcrr) & LCRR_CLKDIV) * 2; - lbc_hz = sysinfo.freqSystemBus / 100 / clkdiv; out_be32(&gur->lbiuiplldcr1, 0x00078080); if (clkdiv == 16) { -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/16] board/sbc8560/sbc8560.c: Fix GCC 4.6 build warning
Fix: sbc8560.c: In function 'ft_board_setup': sbc8560.c:351:12: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/sbc8560/sbc8560.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/board/sbc8560/sbc8560.c b/board/sbc8560/sbc8560.c index c5fe92e..98bc7df 100644 --- a/board/sbc8560/sbc8560.c +++ b/board/sbc8560/sbc8560.c @@ -348,7 +348,7 @@ phys_size_t fixed_sdram(void) void ft_board_setup(void *blob, bd_t *bd) { - int node, tmp[2]; + int node; #ifdef CONFIG_PCI const char *path; #endif @@ -356,7 +356,6 @@ ft_board_setup(void *blob, bd_t *bd) ft_cpu_setup(blob, bd); node = fdt_path_offset(blob, "/aliases"); - tmp[0] = 0; if (node >= 0) { #ifdef CONFIG_PCI path = fdt_getprop(blob, node, "pci0", NULL); -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 08/16] board/freescale/mpc8569mds/mpc8569mds.c: Fix GCC 4.6 build warning
mpc8569mds.c: In function 'local_bus_init': mpc8569mds.c:306:7: warning: variable 'lbc_hz' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- board/freescale/mpc8569mds/mpc8569mds.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c index 89557d2..d119c65 100644 --- a/board/freescale/mpc8569mds/mpc8569mds.c +++ b/board/freescale/mpc8569mds/mpc8569mds.c @@ -303,12 +303,10 @@ local_bus_init(void) volatile fsl_lbc_t *lbc = LBC_BASE_ADDR; uint clkdiv; - uint lbc_hz; sys_info_t sysinfo; get_sys_info(&sysinfo); clkdiv = (lbc->lcrr & LCRR_CLKDIV) * 2; - lbc_hz = sysinfo.freqSystemBus / 100 / clkdiv; out_be32(&gur->lbiuiplldcr1, 0x00078080); if (clkdiv == 16) -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/16] drivers/net/fm/fm.c: Fix GCC 4.6 build warning
Fix: fm.c: In function 'fm_init_common': fm.c:398:6: warning: variable 'n' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- drivers/net/fm/fm.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c index 23ef14b..846c372 100644 --- a/drivers/net/fm/fm.c +++ b/drivers/net/fm/fm.c @@ -395,7 +395,6 @@ int fm_init_common(int index, struct ccsr_fman *reg) int dev = CONFIG_SYS_MMC_ENV_DEV; void *addr = malloc(CONFIG_SYS_FMAN_FW_LENGTH); u32 cnt = CONFIG_SYS_FMAN_FW_LENGTH / 512; - u32 n; u32 blk = CONFIG_SYS_QE_FW_IN_MMC / 512; struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV); @@ -405,7 +404,7 @@ int fm_init_common(int index, struct ccsr_fman *reg) printf("\nMMC read: dev # %u, block # %u, count %u ...\n", dev, blk, cnt); mmc_init(mmc); - n = mmc->block_dev.block_read(dev, blk, cnt, addr); + (void)mmc->block_dev.block_read(dev, blk, cnt, addr); /* flush cache after read */ flush_cache((ulong)addr, cnt * 512); } -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 13/16] drivers/qe/uec.c: Fix GCC 4.6 build warning
uec.c: In function 'uec_stop': uec.c:267:22: warning: variable 'uccf' set but not used [-Wunused-but-set-variable] uec.c: In function 'uec_set_mac_if_mode': uec.c:328:15: warning: variable 'uec_info' set but not used [-Wunused-but-set-variable] uec.c: In function 'adjust_link': uec.c:519:11: warning: variable 'uec_regs' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- drivers/qe/uec.c |7 --- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index 1ecb137..3e46e35 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -264,13 +264,10 @@ static int uec_open(uec_private_t *uec, comm_dir_e mode) static int uec_stop(uec_private_t *uec, comm_dir_e mode) { - ucc_fast_private_t *uccf; - if (!uec || !uec->uccf) { printf("%s: No handle passed.\n", __FUNCTION__); return -EINVAL; } - uccf = uec->uccf; /* check if the UCC number is in range. */ if (uec->uec_info->uf_info.ucc_num >= UCC_MAX_NUM) { @@ -325,7 +322,6 @@ static int uec_set_mac_if_mode(uec_private_t *uec, phy_interface_t if_mode, int speed) { phy_interface_t enet_if_mode; - uec_info_t *uec_info; uec_t *uec_regs; u32 upsmr; u32 maccfg2; @@ -335,7 +331,6 @@ static int uec_set_mac_if_mode(uec_private_t *uec, return -EINVAL; } - uec_info = uec->uec_info; uec_regs = uec->uec_regs; enet_if_mode = if_mode; @@ -516,12 +511,10 @@ bus_fail: static void adjust_link(struct eth_device *dev) { uec_private_t *uec = (uec_private_t *)dev->priv; - uec_t *uec_regs; struct uec_mii_info *mii_info = uec->mii_info; extern void change_phy_interface_mode(struct eth_device *dev, phy_interface_t mode, int speed); - uec_regs = uec->uec_regs; if (mii_info->link) { /* Now we make sure that we can be in full duplex mode. -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 12/16] drivers/usb/host/ehci-fsl.c: Fix GCC 4.6 build warning
Fix: ehci-fsl.c: In function 'ehci_hcd_init': ehci-fsl.c:43:7: warning: variable 'usb_phy' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- drivers/usb/host/ehci-fsl.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 5a65d92..b2d294e 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -40,11 +40,13 @@ int ehci_hcd_init(void) { struct usb_ehci *ehci; - char usb_phy[5]; const char *phy_type = NULL; size_t len; +#ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY + char usb_phy[5]; usb_phy[0] = '\0'; +#endif ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR; hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 14/16] arch/powerpc/cpu/mpc8xxx/ddr/options.c: Fix GCC 4.6 build warning
Fix: options.c: In function 'populate_memctl_options': options.c:486:28: warning: variable 'pdodt' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc8xxx/ddr/options.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/options.c b/arch/powerpc/cpu/mpc8xxx/ddr/options.c index 4dc748b..00ec57b 100644 --- a/arch/powerpc/cpu/mpc8xxx/ddr/options.c +++ b/arch/powerpc/cpu/mpc8xxx/ddr/options.c @@ -483,7 +483,9 @@ unsigned int populate_memctl_options(int all_DIMMs_registered, unsigned int i; char buffer[HWCONFIG_BUFFER_SIZE]; char *buf = NULL; +#if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2) const struct dynamic_odt *pdodt = odt_unknown; +#endif ulong ddr_freq; /* @@ -493,6 +495,7 @@ unsigned int populate_memctl_options(int all_DIMMs_registered, if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0) buf = buffer; +#if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2) /* Chip select options. */ if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) { switch (pdimm[0].n_ranks) { @@ -546,6 +549,7 @@ unsigned int populate_memctl_options(int all_DIMMs_registered, break; } } +#endif /* Pick chip-select local options. */ for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) { -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 15/16] arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c: Fix GCC 4.6 build warning
Fix: fsl_corenet_serdes.c: In function 'fsl_serdes_init': fsl_corenet_serdes.c:511:8: warning: variable 'buf' set but not used [-Wunused-but-set-variable] fsl_corenet_serdes.c:498:18: warning: variable 'lane_prtcl' set but not used [-Wunused-but-set-variable] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c index 89ed5b4..4b52dad 100644 --- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c @@ -495,7 +495,6 @@ void fsl_serdes_init(void) int cfg; serdes_corenet_t *srds_regs; int lane, bank, idx; - enum srds_prtcl lane_prtcl; int have_bank[SRDS_MAX_BANK] = {}; #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8 u32 serdes8_devdisr = 0; @@ -507,6 +506,7 @@ void fsl_serdes_init(void) #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES_A001 int need_serdes_a001; /* TRUE == need work-around for SERDES A001 */ #endif +#ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8 char buffer[HWCONFIG_BUFFER_SIZE]; char *buf = NULL; @@ -516,6 +516,7 @@ void fsl_serdes_init(void) */ if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0) buf = buffer; +#endif /* Is serdes enabled at all? */ if (!(in_be32(&gur->rcwsr[5]) & FSL_CORENET_RCWSR5_SRDS_EN)) @@ -617,7 +618,10 @@ void fsl_serdes_init(void) } } +#if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8) || defined (CONFIG_SYS_P4080_ERRATUM_SERDES9) for (lane = 0; lane < SRDS_MAX_LANES; lane++) { + enum srds_prtcl lane_prtcl; + idx = serdes_get_lane_idx(lane); lane_prtcl = serdes_get_prtcl(cfg, lane); @@ -729,6 +733,7 @@ void fsl_serdes_init(void) #endif } +#endif #ifdef DEBUG puts("\n"); -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 16/16] arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c: Fix GCC 4.6 build warning
Fix: ctrl_regs.c: In function 'set_ddr_sdram_cfg_2': ctrl_regs.c:641:15: warning: variable 'rcw_en' set but not used [-Wunused-but-set-variable] ctrl_regs.c: In function 'compute_fsl_memctl_config_regs': ctrl_regs.c:951:31: warning: array subscript is above array bounds [-Warray-bounds] ctrl_regs.c:752:34: warning: array subscript is above array bounds [-Warray-bounds] Signed-off-by: Kumar Gala --- arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c b/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c index 15cd375..2067d53 100644 --- a/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +++ b/arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c @@ -672,7 +672,6 @@ static void set_ddr_sdram_cfg_2(fsl_ddr_cfg_regs_t *ddr, rcw_en = 1; ap_en = popts->ap_en; } else { - rcw_en = 0; ap_en = 0; } @@ -702,9 +701,7 @@ static void set_ddr_sdram_cfg_2(fsl_ddr_cfg_regs_t *ddr, | ((obc_cfg & 0x1) << 6) | ((ap_en & 0x1) << 5) | ((d_init & 0x1) << 4) -#ifdef CONFIG_FSL_DDR3 | ((rcw_en & 0x1) << 2) -#endif | ((md_en & 0x1) << 0) ); debug("FSLDDR: ddr_sdram_cfg_2 = 0x%08x\n", ddr->ddr_sdram_cfg_2); @@ -745,7 +742,7 @@ static void set_ddr_sdram_mode_2(fsl_ddr_cfg_regs_t *ddr, #ifdef CONFIG_FSL_DDR3 if (unq_mrs_en) { /* unique mode registers are supported */ - for (i = 1; i < 4; i++) { + for (i = 1; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) { if (popts->rtt_override) rtt_wr = popts->rtt_wr_override_value; else @@ -944,7 +941,7 @@ static void set_ddr_sdram_mode(fsl_ddr_cfg_regs_t *ddr, debug("FSLDDR: ddr_sdram_mode = 0x%08x\n", ddr->ddr_sdram_mode); if (unq_mrs_en) { /* unique mode registers are supported */ - for (i = 1; i < 4; i++) { + for (i = 1; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) { if (popts->rtt_override) rtt = popts->rtt_override_value; else -- 1.7.3.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot