arm, davinci: add support for dm368 based cam_enc_4xx board
Subsystems (8)
v5 cover arm, davinci: add support for dm368 based cam_enc_4xx board
This is a repost of the cam_enc_4xx board support patches from
http://lists.denx.de/pipermail/u-boot/2011-October/106692.html
changes for v5:
- rebase against TOT ce5207e191c59b3135303fd03b98dd2ac3701ba2
- add comment from Christian Riesch:
use lpsc_on() and lpsc_syncreset(), remove dm365_lpc_transition() patches
http://patchwork.ozlabs.org/patch/114942/
http://patchwork.ozlabs.org/patch/119375/
needed for this.
Patches are checkpatch clean
"./MAKEALL -a arm --soc davinci" compiles clean with patch: http://patchwork.ozlabs.org/patch/122348/
Also needed patches:
[U-Boot] net, davinci_emac: fix compiler error
http://patchwork.ozlabs.org/patch/122348/
arm, arm926: fix missing symbols in NAND_SPL mode
http://patchwork.ozlabs.org/patch/104942/
arm, davinci: replace CONFIG_PRELOADER with CONFIG_SPL_BUILD
http://patchwork.ozlabs.org/patch/106983/
[U-Boot,v2,2/3] arm, davinci: Add function lpsc_syncreset()
http://patchwork.ozlabs.org/patch/119375/
Albert? Maybe this patchset has a chance to go now in mainline? It is pending now since Sat Jul 16 12:06:41 CEST 2011, see:
http://lists.denx.de/pipermail/u-boot/2011-July/096302.html
Heiko Schocher (11):
usb, davinci: add enable_vbus() weak function
arm, usb, davinci: make USBPHY_CTL register configurable net, davinci_emac: make clock divider in MDIO control register
configurable
spl: add option for adding post memory test to the SPL framework arm, davinci: add support for new spl framework
spl, nand: add 4bit HW ecc oob first nand_read_page function arm, davinci: add header files for dm365
arm, davinci: add lowlevel function for dm365 soc arm926ejs, davinci: add cpuinfo for dm365
arm926ejs, davinci: add missing spi defines for dm365 arm, davinci: add cam_enc_4xx support
MAINTAINERS | 1 + Makefile | 8 +- README | 5 + arch/arm/cpu/arm926ejs/davinci/Makefile | 8 + arch/arm/cpu/arm926ejs/davinci/cpu.c | 27 ++- arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c | 439 +++++++++++++++++++ arch/arm/cpu/arm926ejs/davinci/spl.c | 63 +++ arch/arm/cpu/arm926ejs/davinci/spl_nand.c | 57 +++ arch/arm/cpu/arm926ejs/start.S | 25 +- arch/arm/include/asm/arch-davinci/aintc_defs.h | 50 +++ arch/arm/include/asm/arch-davinci/dm365_lowlevel.h | 41 ++ arch/arm/include/asm/arch-davinci/hardware.h | 15 + arch/arm/include/asm/arch-davinci/pll_defs.h | 84 ++++ arch/arm/include/asm/arch-davinci/psc_defs.h | 86 ++++ arch/arm/include/asm/arch-davinci/syscfg_defs.h | 66 +++ board/ait/cam_enc_4xx/Makefile | 46 ++ board/ait/cam_enc_4xx/cam_enc_4xx.c | 446 +++++++++++++++++++ board/ait/cam_enc_4xx/config.mk | 15 + board/ait/cam_enc_4xx/u-boot-spl.lds | 73 ++++ board/ait/cam_enc_4xx/ublimage.cfg | 48 ++ boards.cfg | 1 + doc/README.SPL | 1 + doc/README.davinci.nand_spl | 141 ++++++ drivers/mtd/nand/nand_spl_simple.c | 43 ++- drivers/net/davinci_emac.c | 9 +- drivers/usb/musb/davinci.c | 18 +- include/configs/cam_enc_4xx.h | 452 ++++++++++++++++++++ spl/Makefile | 1 + tools/ublimage.h | 2 +- 29 files changed, 2261 insertions(+), 10 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl.c create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c create mode 100644 arch/arm/include/asm/arch-davinci/aintc_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/dm365_lowlevel.h create mode 100644 arch/arm/include/asm/arch-davinci/pll_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/psc_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/syscfg_defs.h create mode 100644 board/ait/cam_enc_4xx/Makefile create mode 100644 board/ait/cam_enc_4xx/cam_enc_4xx.c create mode 100644 board/ait/cam_enc_4xx/config.mk create mode 100644 board/ait/cam_enc_4xx/u-boot-spl.lds create mode 100644 board/ait/cam_enc_4xx/ublimage.cfg create mode 100644 doc/README.davinci.nand_spl create mode 100644 include/configs/cam_enc_4xx.h
Signature · 1 line
1.7.6.4
PATCH v5 1/11 usb, davinci: add enable_vbus() weak function
---
changes for v4:
- patch is new since v4, as Igor Grinberg suggested.
drivers/usb/musb/davinci.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/usb/musb/davinci.c +12 -0
@@ -78,6 +78,18 @@ static void phy_off(void)writel (USBPHY_OSCPDWN |USBPHY_PHYPDWN ,USBPHY_CTL_PADDR ); } +#ifndef DAVINCI_DM365EVM +__attribute__((weak)) +void enable_vbus (void ) +{ +/* +* nothing to do, vbus is handled through the cpu. +* Define this function in board code, if it is +* different on your board. +*/ +} +#endif +/* * This function performs Davinci platform specific initialization for usb0. */
Signature · 1 line
1.7.6.4
PATCH v5 1/11 usb, davinci: add enable_vbus() weak function
Hi Heiko,
Quoted 21 lines · Heiko Schocher
Signed-off-by Heiko Schocher <[email protected]>Cc Remy Bohmer <[email protected]>Cc Albert ARIBAUD <[email protected]>Cc Igor Grinberg <[email protected]>---
changes for v4:
- patch is new since v4, as Igor Grinberg suggested.drivers/usb/musb/davinci.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)drivers/usb/musb/davinci.c +1
-0@@ -78,6 +78,18 @@ static void phy_off(void)writel (USBPHY_OSCPDWN |USBPHY_PHYPDWN ,USBPHY_CTL_PADDR ); } +#ifndef DAVINCI_DM365EVM
drivers/usb/musb/davinci.c static void phy_off(void) · line 91
Quoted 10 lines
drivers/usb/musb/davinci.c +10
-0+__attribute__((weak)) +void enable_vbus (void ) +{ +/* +* nothing to do, vbus is handled through the cpu. +* Define this function in board code, if it is +* different on your board. +*/ +} +#endif
I'd suggest, instead of closing the weak declaration inside ifdef/ifndef, make it available to all boards with alias.
Quoted 4 lines
drivers/usb/musb/davinci.c +1
-0+/* * This function performs Davinci platform specific initialization for usb0. */
Signature · 2 lines
Regards, Igor.
PATCH v5 1/11 usb, davinci: add enable_vbus() weak function
Hello Igor,
Quoted 23 lines · Igor Grinberg
Hi Heiko,
Quoted 20 lines · Heiko Schocher
Signed-off-by Heiko Schocher <[email protected]>Cc Remy Bohmer <[email protected]>Cc Albert ARIBAUD <[email protected]>Cc Igor Grinberg <[email protected]>---
changes for v4:
- patch is new since v4, as Igor Grinberg suggested.drivers/usb/musb/davinci.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)drivers/usb/musb/davinci.c +0
-0@@ -78,6 +78,18 @@ static void phy_off(void)writel (USBPHY_OSCPDWN |USBPHY_PHYPDWN ,USBPHY_CTL_PADDR ); }
Quoted 14 lines
drivers/usb/musb/davinci.c static void phy_off(void) · line 91
Quoted 11 lines
drivers/usb/musb/davinci.c +11
-0+#ifndef DAVINCI_DM365EVM +__attribute__((weak)) +void enable_vbus (void ) +{ +/* +* nothing to do, vbus is handled through the cpu. +* Define this function in board code, if it is +* different on your board. +*/ +} +#endif I'd suggest, instead of closing the weak declaration inside ifdef/ifndef, make it available to all boards with alias.
OK, done.
Thanks for the review.
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v5 2/11 arm, usb, davinci: make USBPHY_CTL register configurable
In reply to Heiko SchocherDefine CONFIG_DV_USBPHY_CTL for setting the USB PHY control register.
---
drivers/usb/musb/davinci.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/usb/musb/davinci.c +5 -1
@@ -26,6 +26,10 @@#include "davinci.h" #include <asm/arch/hardware.h> +#if !defined(CONFIG_DV_USBPHY_CTL ) +#define CONFIG_DV_USBPHY_CTL (USBPHY_SESNDEN | USBPHY_VBDTCTEN) +#endif +/* MUSB platform configuration */ struct musb_config musb_cfg = { .regs = (struct musb_regs *)MENTOR_USB0_BASE ,
@@ -50,7 +54,7 @@ static u8 phy_on(void)writel (USBPHY_PHY24MHZ |USBPHY_SESNDEN |USBPHY_VBDTCTEN ,USBPHY_CTL_PADDR );#else -writel (USBPHY_SESNDEN |USBPHY_VBDTCTEN ,USBPHY_CTL_PADDR ); +writel (CONFIG_DV_USBPHY_CTL ,USBPHY_CTL_PADDR );#endif timeout = musb_cfg.timeout;
Signature · 1 line
1.7.6.4
PATCH v5 3/11 net, davinci_emac: make clock divider in MDIO control register configurable
In reply to Heiko SchocherDefine CONFIG_SYS_EMAC_TI_CLKDIV for setting the clkdiv value in the MDIO control register.
--- drivers/net/davinci_emac.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/davinci_emac.c +7 -2
@@ -53,6 +53,11 @@ unsigned int emac_dbg = 0;#define emac_gigabit_enable (phy_addr)/* no gigabit to enable */ #endif +#if !defined(CONFIG_SYS_EMAC_TI_CLKDIV ) +#define CONFIG_SYS_EMAC_TI_CLKDIV ((EMAC_MDIO_BUS_FREQ / \ + EMAC_MDIO_CLOCK_FREQ) - 1) +#endif +static void davinci_eth_mdio_enable (void );static int gen_init_phy (int phy_addr);
@@ -131,7 +136,7 @@ static void davinci_eth_mdio_enable(void) {u_int32_t clkdiv; - clkdiv = (EMAC_MDIO_BUS_FREQ /EMAC_MDIO_CLOCK_FREQ ) -1 ; + clkdiv =CONFIG_SYS_EMAC_TI_CLKDIV ; writel((clkdiv & 0xff) | MDIO_CONTROL_ENABLE |
@@ -473,7 +478,7 @@ static int davinci_eth_open(struct eth_device *dev, bd_t *bis)#endif /* Init MDIO & get link state */ - clkdiv = (EMAC_MDIO_BUS_FREQ /EMAC_MDIO_CLOCK_FREQ ) -1 ; + clkdiv =CONFIG_SYS_EMAC_TI_CLKDIV ;writel ((clkdiv &0xff ) |MDIO_CONTROL_ENABLE |MDIO_CONTROL_FAULT , &adap_mdio->CONTROL);
Signature · 1 line
1.7.6.4
PATCH v5 4/11 spl: add option for adding post memory test to the SPL framework
In reply to Heiko Schocher---
changes for v4:
- add comment from Sergei Shtylyov:
- remove Leftmost open parent in dox/README.SPL
doc/README.SPL | 1 + spl/Makefile | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
doc/README.SPL +1 -0
@@ -63,3 +63,4 @@ CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o) CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o) +CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
spl/Makefile +1 -0
@@ -55,6 +55,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/libdma.o +LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o ifeq ($(SOC),omap3) LIBS-y += $(CPUDIR)/omap-common/libomap-common.o
Signature · 1 line
1.7.6.4
PATCH v5 5/11 arm, davinci: add support for new spl framework
In reply to Heiko Schocher--- Makefile | 8 +++- arch/arm/cpu/arm926ejs/davinci/Makefile | 8 ++++ arch/arm/cpu/arm926ejs/davinci/spl.c | 63 +++++++++++++++++++++++++++++ arch/arm/cpu/arm926ejs/davinci/spl_nand.c | 57 ++++++++++++++++++++++++++ arch/arm/cpu/arm926ejs/start.S | 25 +++++++++++- 5 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl.c create mode 100644 arch/arm/cpu/arm926ejs/davinci/spl_nand.c
Makefile +6 -2
@@ -415,9 +415,13 @@ $(obj)u-boot.sha1: $(obj)u-boot.bin $(obj)u-boot.dis: $(obj)u-boot $(OBJDUMP) -d $< > $@ -$(obj)u-boot.ubl: $(obj)u-boot-nand.bin +$(obj)u-boot.ubl: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin + cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \ - -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ + -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl + rm $(obj)u-boot-ubl.bin + rm $(obj)spl/u-boot-spl-pad.bin ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \
arch/arm/cpu/arm926ejs/davinci/Makefile +8 -0
@@ -35,6 +35,14 @@ COBJS-$(CONFIG_SOC_DM644X) += dm644x.o COBJS-$(CONFIG_SOC_DM646X) += dm646x.o COBJS-$(CONFIG_DRIVER_TI_EMAC) += lxt972.o dp83848.o et1011c.o ksz8873.o +ifdef CONFIG_SPL_BUILD +COBJS-y += spl.o +COBJS-y += dm365_lowlevel.o +ifdef CONFIG_SPL_NAND_SUPPORT +COBJS-y += spl_nand.o +endif +endif + SOBJS = reset.o ifndef CONFIG_SKIP_LOWLEVEL_INIT
arch/arm/cpu/arm926ejs/davinci/spl.c new file +63 -0
63 lines not on this page · raw message
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +57 -0
57 lines not on this page · raw message
arch/arm/cpu/arm926ejs/start.S +24 -1
@@ -126,7 +126,15 @@ _fiq: .globl _TEXT_BASE _TEXT_BASE: +#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */ .word CONFIG_SYS_TEXT_BASE +#else +#ifdef CONFIG_SPL_BUILD + .word CONFIG_SPL_TEXT_BASE +#else + .word CONFIG_SYS_TEXT_BASE +#endif +#endif /* * These are defined in the board-specific linker script.
@@ -192,7 +200,15 @@ reset: /* Set stackpointer in internal RAM to call board_init_f */ call_board_init_f: +#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */ + ldr sp, =(CONFIG_SYS_INIT_SP_ADDR) +#else +#ifdef CONFIG_SPL_BUILD + ldr sp, =(CONFIG_SPL_STACK) +#else ldr sp, =(CONFIG_SYS_INIT_SP_ADDR) +#endif +#endif bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ ldr r0,=0x00000000 bl board_init_f
@@ -217,6 +233,7 @@ stack_setup: mov sp, r4 adr r0, _start + sub r9, r6, r0 /* r9 <- relocation offset */ cmp r0, r6 beq clear_bss /* skip relocation */ mov r1, r6 /* r1 <- scratch for copy loop */
@@ -271,12 +288,17 @@ fixnext: #endif clear_bss: -#ifndef CONFIG_SPL_BUILD +#ifdef CONFIG_SPL_BUILD + /* No relocation for SPL */ + ldr r0, =__bss_start + ldr r1, =__bss_end__ +#else ldr r0, _bss_start_ofs ldr r1, _bss_end_ofs mov r4, r6 /* reloc addr */ add r0, r0, r4 add r1, r1, r4 +#endif mov r2, #0x00000000 /* clear */ clbss_l:str r2, [r0] /* clear loop... */
@@ -284,6 +306,7 @@ clbss_l:str r2, [r0] /* clear loop... */ cmp r0, r1 bne clbss_l +#ifndef CONFIG_SPL_BUILD bl coloured_LED_init bl red_led_on #endif
Signature · 1 line
1.7.6.4
PATCH v5 5/11 arm, davinci: add support for new spl framework
Quoted 19 lines · Heiko Schocher
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +13
-0@@ -0,0 +1,57 @@ +/* +* Copyright (C) 2011 +* Heiko Schocher, DENX Software Engineering, hs at denx.de. +* +* 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.
arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 23
Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +10
-0+* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <nand.h> +#include <asm/io.h>
Does this file use anything from asm/io.h?
Quoted 23 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +23
-0+/* +* The main entry for NAND booting. It's necessary that SDRAM is already +* configured and available since this code loads the main U-Boot image +* from NAND into SDRAM and starts it from there. +*/ +void nand_boot (void ) +{ +int ret; + __attribute__((noreturn))void (*uboot)(void ); + +/* +* Load U-Boot image from NAND into RAM +*/ + ret =nand_spl_load_image (CONFIG_SYS_NAND_U_BOOT_OFFS , +CONFIG_SYS_NAND_U_BOOT_SIZE , + (void *)CONFIG_SYS_NAND_U_BOOT_DST ); + +#ifdef CONFIG_NAND_ENV_DST + ret =nand_spl_load_image (CONFIG_ENV_OFFSET ,CONFIG_ENV_SIZE , + (void *)CONFIG_NAND_ENV_DST ); + +#ifdef CONFIG_ENV_OFFSET_REDUND + ret = nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 57
Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +10
-0+ (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); +#endif +#endif + +/* +* Jump to U-Boot image +*/ + uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START ; + (*uboot)(); +}
This is common to most NAND SPLs. It would be nice to stick this in a common place (at least the loading part, maybe not the jump). Not nand_spl_simple.c, as it's utility is not limited to the simple driver.
Maybe drivers/mtd/nand/nand_spl_load.c?
-Scott
PATCH v5 5/11 arm, davinci: add support for new spl framework
Quoted 63 lines · Scott Wood
Quoted 19 lines · Heiko Schocher
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +13
-0@@ -0,0 +1,57 @@ +/* +* Copyright (C) 2011 +* Heiko Schocher, DENX Software Engineering, hs at denx.de. +* +* 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. arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 23
Quoted 10 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +10
-0+* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <nand.h> +#include <asm/io.h> Does this file use anything from
asm/io.h?Quoted 30 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +30
-0+/* +* The main entry for NAND booting. It's necessary that SDRAM is already +* configured and available since this code loads the main U-Boot image +* from NAND into SDRAM and starts it from there. +*/ +void nand_boot (void ) +{ + ? ? int ret; + ? ? __attribute__((noreturn)) void (*uboot)(void); + + ? ? /* + ? ? ?* Load U-Boot image from NAND into RAM + ? ? ?*/ + ? ? ret = ?nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, + ? ? ? ? ? ? ? ? ? ? CONFIG_SYS_NAND_U_BOOT_SIZE, + ? ? ? ? ? ? (void *)CONFIG_SYS_NAND_U_BOOT_DST); + +#ifdef CONFIG_NAND_ENV_DST + ? ? ret = ?nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, + ? ? ? ? ? ? (void *)CONFIG_NAND_ENV_DST); + +#ifdef CONFIG_ENV_OFFSET_REDUND + ? ? ret = ?nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE, + ? ? ? ? ? ? (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE); +#endif +#endif + + ? ? /* +? ? ?* Jump to U-Boot image +? ? ?*/
Quoted 8 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 56
Quoted 3 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +3
-0+ ? ? uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; + ? ? (*uboot)(); +}This is common to most NAND SPLs. ?It would be nice to stick this in a common place (at least the loading part, maybe not the jump). ?Not
nand_spl_simple.c, as it's utility is not limited to the simple driver. ?Maybedrivers/mtd/nand/nand_spl_load.c?
Indeed, the difference right here between davinci and omap*(/am335x) is parsing u-boot.img for the size or just using a hard-coded size variable.
Signature · 1 line
Tom
PATCH v5 5/11 arm, davinci: add support for new spl framework
In reply to Scott WoodHello Scott,
Quoted 7 lines · Scott Wood
Quoted 6 lines · Heiko Schocher
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +0
-0@@ -0,0 +1,57 @@
[...]
Quoted 5 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 23
Quoted 3 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +3
-0+#include <common.h> +#include <nand.h> +#include <asm/io.h> Does this file use anything from
asm/io.h?
removed.
Quoted 5 lines
Quoted 5 lines
+/*
+ * The main entry for NAND booting. It's necessary that SDRAM is already
+ * configured and available since this code loads the main U-Boot image
+ * from NAND into SDRAM and starts it from there.
+ */
[...]
Quoted 11 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c line 57
Quoted 6 lines
arch/arm/cpu/arm926ejs/davinci/spl_nand.c new file +6
-0+/* +* Jump to U-Boot image +*/ + uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START ; + (*uboot)(); +}This is common to most NAND SPLs. It would be nice to stick this in a common place (at least the loading part, maybe not the jump). Not
nand_spl_simple.c, as it's utility is not limited to the simple driver.
Maybedrivers/mtd/nand/nand_spl_load.c?
moved to drivers/mtd/nand/spl_nand_load.c, also I want to let the jump in this file. I prefer the name "spl_nand_load.c as we have already a
CONFIG_SPL_NAND_SIMPLE -> CONFIG_SPL_NAND_LOAD -> spl_nand_load.c
Is this OK for you?
Shouldn;t we rename nand_spl_simple.c to spl_nand_simple.c also?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH v5 5/11 arm, davinci: add support for new spl framework
Quoted 9 lines · Heiko Schocher
Hello Scott,
Quoted 5 lines · Scott Wood
On 10/30/2011 11:53 PM, Heiko Schocher wrote:
This is common to most NAND SPLs. It would be nice to stick this in a common place (at least the loading part, maybe not the jump). Notnand_spl_simple.c, as it's utility is not limited to the simple driver.
Maybedrivers/mtd/nand/nand_spl_load.c?
Quoted 8 lines
moved to
drivers/mtd/nand/spl_nand_load.c, also I want to let the jump in this file. I prefer the name "spl_nand_load.cas we have already a
CONFIG_SPL_NAND_SIMPLE->CONFIG_SPL_NAND_LOAD->spl_nand_load.cIs this OK for you?
Shouldn;t we rename
nand_spl_simple.ctospl_nand_simple.calso?
I suggested nand_spl_load.c because we already have a nand_spl_simple.c. :-)
I don't really care which way it goes, as long as it's consistent.
-Scott
PATCH v5 6/11 spl, nand: add 4bit HW ecc oob first nand_read_page function
In reply to Heiko Schochersimiliar to commit dc7cd8e59ba077f3b4c1a4557c9cd86a31b9ab1f, only adapted for the new spl framework.
---
changes for v2:
- add comment from Scott Wood:
as BSS is cleared, no need for intializing vars with 0 remove this.
changes for v3:
- add comment from Scoot Wood and Tom Rini
- rename CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST to CONFIG_SYS_NAND_HW_ECC_OOBFIRST
- add dokumentation in README
changes for v4:
- added Acked-by: Tom Rini <[email protected]>
changes for v5:
- added Acked-by: Scott Wood <[email protected]>
README | 5 ++++ drivers/mtd/nand/nand_spl_simple.c | 43 +++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletions(-)
README +5 -0
@@ -3261,6 +3261,11 @@ Low Level (hardware related) configuration options: that is executed before the actual U-Boot. E.g. when compiling a NAND SPL. +- CONFIG_SYS_NAND_HW_ECC_OOBFIRST + define this, if you want to read first the oob data + and then the data. This is used for example on + davinci plattforms. + - CONFIG_USE_ARCH_MEMCPY CONFIG_USE_ARCH_MEMSET If these options are used a optimized version of memcpy/memset will
drivers/mtd/nand/nand_spl_simple.c +42 -1
61 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH v5 7/11 arm, davinci: add header files for dm365
In reply to Heiko Schocher---
changes for v2:
- rebase to TOT
- add defines for timer 3 and 4
- delete "struct dv_timer_regs" as it is now "davinci_timer"
changes for v5:
- add comment from Christian Riesch:
use lpsc_on() and lpsc_syncreset(), remove dm365_lpc_transition() patches
http://patchwork.ozlabs.org/patch/114942/
http://patchwork.ozlabs.org/patch/119375/
needed for this.
arch/arm/include/asm/arch-davinci/aintc_defs.h | 50 +++++++++++++ arch/arm/include/asm/arch-davinci/hardware.h | 13 ++++ arch/arm/include/asm/arch-davinci/pll_defs.h | 79 +++++++++++++++++++++ arch/arm/include/asm/arch-davinci/psc_defs.h | 86 +++++++++++++++++++++++ arch/arm/include/asm/arch-davinci/syscfg_defs.h | 66 +++++++++++++++++ 5 files changed, 294 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-davinci/aintc_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/pll_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/psc_defs.h create mode 100644 arch/arm/include/asm/arch-davinci/syscfg_defs.h
arch/arm/include/asm/arch-davinci/aintc_defs.h new file +50 -0
@@ -0,0 +1,50 @@ +/* +* Copyright (C) 2011 +* Heiko Schocher, DENX Software Engineering, hs at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#ifndef _DV_AINTC_DEFS_H_ +#define _DV_AINTC_DEFS_H_ + +struct dv_aintc_regs { +unsigned int fiq0;/* 0x00 */ +unsigned int fiq1;/* 0x04 */ +unsigned int irq0;/* 0x08 */ +unsigned int irq1;/* 0x0c */ +unsigned int fiqentry;/* 0x10 */ +unsigned int irqentry;/* 0x14 */ +unsigned int eint0;/* 0x18 */ +unsigned int eint1;/* 0x1c */ +unsigned int intctl;/* 0x20 */ +unsigned int eabase;/* 0x24 */ +unsigned char rsvd0[8 ];/* 0x28 */ +unsigned int intpri0;/* 0x30 */ +unsigned int intpri1;/* 0x34 */ +unsigned int intpri2;/* 0x38 */ +unsigned int intpri3;/* 0x3c */ +unsigned int intpri4;/* 0x40 */ +unsigned int intpri5;/* 0x44 */ +unsigned int intpri6;/* 0x48 */ +unsigned int intpri7;/* 0x4c */ +}; + +#define dv_aintc_regs ((struct dv_aintc_regs *)DAVINCI_ARM_INTC_BASE) + +#endif /* _DV_AINTC_DEFS_H_ */
arch/arm/include/asm/arch-davinci/hardware.h +13 -0
@@ -56,6 +56,7 @@ typedef volatile unsigned int * dv_reg_p;#define DAVINCI_DMA_3PTC1_BASE (0x01c10400)#define DAVINCI_UART0_BASE (0x01c20000)#define DAVINCI_UART1_BASE (0x01c20400) +#define DAVINCI_TIMER3_BASE (0x01c20800)#define DAVINCI_I2C_BASE (0x01c21000)#define DAVINCI_TIMER0_BASE (0x01c21400)#define DAVINCI_TIMER1_BASE (0x01c21800)
@@ -63,6 +64,7 @@ typedef volatile unsigned int * dv_reg_p;#define DAVINCI_PWM0_BASE (0x01c22000)#define DAVINCI_PWM1_BASE (0x01c22400)#define DAVINCI_PWM2_BASE (0x01c22800) +#define DAVINCI_TIMER4_BASE (0x01c23800)#define DAVINCI_SYSTEM_MODULE_BASE (0x01c40000)#define DAVINCI_PLL_CNTRL0_BASE (0x01c40800)#define DAVINCI_PLL_CNTRL1_BASE (0x01c40c00)
@@ -108,6 +110,7 @@ typedef volatile unsigned int * dv_reg_p;#define DAVINCI_MMC_SD1_BASE 0x01d00000#define DAVINCI_ASYNC_EMIF_CNTRL_BASE 0x01d10000#define DAVINCI_MMC_SD0_BASE 0x01d11000 +#define DAVINCI_DDR_EMIF_CTRL_BASE 0x20000000#elif defined(CONFIG_SOC_DM646X )#define DAVINCI_ASYNC_EMIF_CNTRL_BASE 0x20008000
@@ -543,4 +546,14 @@ static inline int get_async3_src(void)#endif /* CONFIG_SOC_DA8XX */ +#if defined(CONFIG_SOC_DM365 ) +#include <asm/arch/aintc_defs.h> +#include <asm/arch/ddr2_defs.h> +#include <asm/arch/emif_defs.h> +#include <asm/arch/gpio.h> +#include <asm/arch/pll_defs.h> +#include <asm/arch/psc_defs.h> +#include <asm/arch/syscfg_defs.h> +#include <asm/arch/timer_defs.h> +#endif #endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-davinci/pll_defs.h new file +79 -0
79 lines not on this page · raw message
arch/arm/include/asm/arch-davinci/psc_defs.h new file +86 -0
86 lines not on this page · raw message
arch/arm/include/asm/arch-davinci/syscfg_defs.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH v5 8/11 arm, davinci: add lowlevel function for dm365 soc
In reply to Heiko Schocherused for booting (for example) from NAND using spl code.
---
changes for v2:
- fix bug for dm365 if setup A2CR register
- rebase to TOT:
- rename DM36x_DDR_* to DV_DDR_*
- add support for new SPL framework
changes for v5:
- add comment from Christian Riesch:
use lpsc_on() and lpsc_syncreset(), remove dm365_lpc_transition() patches
http://patchwork.ozlabs.org/patch/114942/
http://patchwork.ozlabs.org/patch/119375/
needed for this.
arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c | 439 ++++++++++++++++++++ arch/arm/include/asm/arch-davinci/dm365_lowlevel.h | 41 ++ 2 files changed, 480 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c create mode 100644 arch/arm/include/asm/arch-davinci/dm365_lowlevel.h
arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c new file +439 -0
@@ -0,0 +1,439 @@ +/* +* SoC-specific lowlevel code for tms320dm365 and similar chips +* Actually used for booting from NAND with nand_spl. +* +* Copyright (C) 2011 +* Heiko Schocher, DENX Software Engineering, hs at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include <common.h> +#include <nand.h> +#include <ns16550.h> +#include <post.h> +#include <asm/arch/dm365_lowlevel.h> +#include <asm/arch/hardware.h> + +void dm365_waitloop (unsigned long loopcnt) +{ +unsigned long i; + +for (i =0 ; i < loopcnt; i++) + asm(" NOP" ); +} + +int dm365_pll1_init (unsigned long pllmult,unsigned long prediv) +{ +unsigned int clksrc =0x0 ; + +/* Power up the PLL */ +clrbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLPWRDN ); + +clrbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_RES_9 ); +setbits_le32 (&dv_pll0_regs->pllctl, clksrc <<8 ); + +/* +* Set PLLENSRC '0', PLL Enable(PLLEN) selection is controlled +* through MMR +*/ +clrbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLENSRC ); + +/* Set PLLEN=0 => PLL BYPASS MODE */ +clrbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLEN ); + +dm365_waitloop (150 ); + +/* PLLRST=1(reset assert) */ +setbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLRST ); + +dm365_waitloop (300 ); + +/*Bring PLL out of Reset*/ +clrbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLRST ); + +/* Program the Multiper and Pre-Divider for PLL1 */ +writel (pllmult, &dv_pll0_regs->pllm); +writel (prediv, &dv_pll0_regs->prediv); + +/* Assert TENABLE = 1, TENABLEDIV = 1, TINITZ = 1 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TENABLEDIV |PLLSECCTL_TENABLE | +PLLSECCTL_TINITZ , &dv_pll0_regs->secctl); +/* Assert TENABLE = 1, TENABLEDIV = 1, TINITZ = 0 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TENABLEDIV |PLLSECCTL_TENABLE , + &dv_pll0_regs->secctl); +/* Assert TENABLE = 0, TENABLEDIV = 0, TINITZ = 0 */ +writel (PLLSECCTL_STOPMODE , &dv_pll0_regs->secctl); +/* Assert TENABLE = 0, TENABLEDIV = 0, TINITZ = 1 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TINITZ , &dv_pll0_regs->secctl); + +/* Program the PostDiv for PLL1 */ +writel (0x8000 , &dv_pll0_regs->postdiv); + +/* Post divider setting for PLL1 */ +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV1, &dv_pll0_regs->plldiv1); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV2, &dv_pll0_regs->plldiv2); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV3, &dv_pll0_regs->plldiv3); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV4, &dv_pll0_regs->plldiv4); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV5, &dv_pll0_regs->plldiv5); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV6, &dv_pll0_regs->plldiv6); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV7, &dv_pll0_regs->plldiv7); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV8, &dv_pll0_regs->plldiv8); +writel (CONFIG_SYS_DM36x_PLL1_PLLDIV9, &dv_pll0_regs->plldiv9); + +dm365_waitloop (300 ); + +/* Set the GOSET bit */ +writel (PLLCMD_GOSET , &dv_pll0_regs->pllcmd);/* Go */ + +dm365_waitloop (300 ); + +/* Wait for PLL to LOCK */ +while (!((readl (&dv_sys_module_regs->pll0_config) &PLL0_LOCK ) + ==PLL0_LOCK )) + ; + +/* Enable the PLL Bit of PLLCTL*/ +setbits_le32 (&dv_pll0_regs->pllctl,PLLCTL_PLLEN ); + +return 0 ; +} + +int dm365_pll2_init (unsigned long pllm,unsigned long prediv) +{ +unsigned int clksrc =0x0 ; + +/* Power up the PLL*/ +clrbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLPWRDN ); + +/* +* Select the Clock Mode as Onchip Oscilator or External Clock on +* MXI pin +* VDB has input on MXI pin +*/ +clrbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_RES_9 ); +setbits_le32 (&dv_pll1_regs->pllctl, clksrc <<8 ); + +/* +* Set PLLENSRC '0', PLL Enable(PLLEN) selection is controlled +* through MMR +*/ +clrbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLENSRC ); + +/* Set PLLEN=0 => PLL BYPASS MODE */ +clrbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLEN ); + +dm365_waitloop (50 ); + +/* PLLRST=1(reset assert) */ +setbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLRST ); + +dm365_waitloop (300 ); + +/* Bring PLL out of Reset */ +clrbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLRST ); + +/* Program the Multiper and Pre-Divider for PLL2 */ +writel (pllm, &dv_pll1_regs->pllm); +writel (prediv, &dv_pll1_regs->prediv); + +writel (0x8000 , &dv_pll1_regs->postdiv); + +/* Assert TENABLE = 1, TENABLEDIV = 1, TINITZ = 1 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TENABLEDIV |PLLSECCTL_TENABLE | +PLLSECCTL_TINITZ , &dv_pll1_regs->secctl); +/* Assert TENABLE = 1, TENABLEDIV = 1, TINITZ = 0 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TENABLEDIV |PLLSECCTL_TENABLE , + &dv_pll1_regs->secctl); +/* Assert TENABLE = 0, TENABLEDIV = 0, TINITZ = 0 */ +writel (PLLSECCTL_STOPMODE , &dv_pll1_regs->secctl); +/* Assert TENABLE = 0, TENABLEDIV = 0, TINITZ = 1 */ +writel (PLLSECCTL_STOPMODE |PLLSECCTL_TINITZ , &dv_pll1_regs->secctl); + +/* Post divider setting for PLL2 */ +writel (CONFIG_SYS_DM36x_PLL2_PLLDIV1, &dv_pll1_regs->plldiv1); +writel (CONFIG_SYS_DM36x_PLL2_PLLDIV2, &dv_pll1_regs->plldiv2); +writel (CONFIG_SYS_DM36x_PLL2_PLLDIV3, &dv_pll1_regs->plldiv3); +writel (CONFIG_SYS_DM36x_PLL2_PLLDIV4, &dv_pll1_regs->plldiv4); +writel (CONFIG_SYS_DM36x_PLL2_PLLDIV5, &dv_pll1_regs->plldiv5); + +/* GoCmd for PostDivider to take effect */ +writel (PLLCMD_GOSET , &dv_pll1_regs->pllcmd); + +dm365_waitloop (150 ); + +/* Wait for PLL to LOCK */ +while (!((readl (&dv_sys_module_regs->pll1_config) &PLL1_LOCK ) + ==PLL1_LOCK )) + ; + +dm365_waitloop (4100 ); + +/* Enable the PLL2 */ +setbits_le32 (&dv_pll1_regs->pllctl,PLLCTL_PLLEN ); + +/* do this after PLL's have been set up */ +writel (CONFIG_SYS_DM36x_PERI_CLK_CTRL, + &dv_sys_module_regs->peri_clkctl); + +return 0 ; +} + +int dm365_ddr_setup (void ) +{ +lpsc_on (DAVINCI_LPSC_DDR_EMIF ); +clrbits_le32 (&dv_sys_module_regs->vtpiocr, +VPTIO_IOPWRDN |VPTIO_CLRZ |VPTIO_LOCK |VPTIO_PWRDN ); + +/* Set bit CLRZ (bit 13) */ +setbits_le32 (&dv_sys_module_regs->vtpiocr,VPTIO_CLRZ ); + +/* Check VTP READY Status */ +while (!(readl (&dv_sys_module_regs->vtpiocr) &VPTIO_RDY )) + ; + +/* Set bit VTP_IOPWRDWN bit 14 for DDR input buffers) */ +setbits_le32 (&dv_sys_module_regs->vtpiocr,VPTIO_IOPWRDN ); + +/* Set bit LOCK(bit7) */ +setbits_le32 (&dv_sys_module_regs->vtpiocr,VPTIO_LOCK ); + +/* +* Powerdown VTP as it is locked (bit 6) +* Set bit VTP_IOPWRDWN bit 14 for DDR input buffers) +*/ +setbits_le32 (&dv_sys_module_regs->vtpiocr, +VPTIO_IOPWRDN |VPTIO_PWRDN ); + +/* Wait for calibration to complete */ +dm365_waitloop (150 ); + +/* Set the DDR2 to synreset, then enable it again */ +lpsc_syncreset (DAVINCI_LPSC_DDR_EMIF ); +lpsc_on (DAVINCI_LPSC_DDR_EMIF ); + +writel (CONFIG_SYS_DM36x_DDR2_DDRPHYCR, &dv_ddr2_regs_ctrl->ddrphycr); + +/* Program SDRAM Bank Config Register */ +writel ((CONFIG_SYS_DM36x_DDR2_SDBCR |DV_DDR_BOOTUNLOCK ), + &dv_ddr2_regs_ctrl->sdbcr); +writel ((CONFIG_SYS_DM36x_DDR2_SDBCR |DV_DDR_TIMUNLOCK ), + &dv_ddr2_regs_ctrl->sdbcr); + +/* Program SDRAM Timing Control Register1 */ +writel (CONFIG_SYS_DM36x_DDR2_SDTIMR, &dv_ddr2_regs_ctrl->sdtimr); +/* Program SDRAM Timing Control Register2 */ +writel (CONFIG_SYS_DM36x_DDR2_SDTIMR2, &dv_ddr2_regs_ctrl->sdtimr2); + +writel (CONFIG_SYS_DM36x_DDR2_PBBPR, &dv_ddr2_regs_ctrl->pbbpr); + +writel (CONFIG_SYS_DM36x_DDR2_SDBCR, &dv_ddr2_regs_ctrl->sdbcr); + +/* Program SDRAM Refresh Control Register */ +writel (CONFIG_SYS_DM36x_DDR2_SDRCR, &dv_ddr2_regs_ctrl->sdrcr); + +lpsc_syncreset (DAVINCI_LPSC_DDR_EMIF ); +lpsc_on (DAVINCI_LPSC_DDR_EMIF ); + +return 0 ; +} + +void dm365_vpss_sync_reset (void ) +{ +unsigned int PdNum =0 ; + +/* VPSS_CLKMD 1:1 */ +setbits_le32 (&dv_sys_module_regs->vpss_clkctl, +VPSS_CLK_CTL_VPSS_CLKMD ); + +/* LPSC SyncReset DDR Clock Enable */ +writel (((readl (&dv_psc_regs->mdctl[47 ]) & ~PSC_MD_STATE_MSK ) | +PSC_SYNCRESET ), &dv_psc_regs->mdctl[47 ]); + +writel ((1 << PdNum), &dv_psc_regs->ptcmd); + +while (!(((readl (&dv_psc_regs->ptstat) >> PdNum) &PSC_GOSTAT ) ==0 )) + ; +while (!((readl (&dv_psc_regs->mdstat[47 ]) &PSC_MD_STATE_MSK ) == +PSC_SYNCRESET )) + ; +} + +void dm365_por_reset (void ) +{ +if (readl (&dv_pll0_regs->rstype) &3 ) +dm365_vpss_sync_reset (); +} + +void dm365_psc_init (void ) +{ +unsigned char i =0 ; +unsigned char lpsc_start; +unsigned char lpsc_end, lpscgroup, lpscmin, lpscmax; +unsigned int PdNum =0 ; + + lpscmin =0 ; + lpscmax =2 ; + +for (lpscgroup = lpscmin; lpscgroup <= lpscmax; lpscgroup++) { +if (lpscgroup ==0 ) { + lpsc_start =0 ;/* Enabling LPSC 3 to 28 SCR first */ + lpsc_end =28 ; + }else if (lpscgroup ==1 ) {/* Skip locked LPSCs [29-37] */ + lpsc_start =38 ; + lpsc_end =47 ; + }else { + lpsc_start =50 ; + lpsc_end =51 ; + } + +/* NEXT=0x3, Enable LPSC's */ +for (i = lpsc_start; i <= lpsc_end; i++) +setbits_le32 (&dv_psc_regs->mdctl[i],0x3 ); + +/* +* Program goctl to start transition sequence for LPSCs +* CSL_PSC_0_REGS->PTCMD = (1<<PdNum); Kick off Power +* Domain 0 Modules +*/ +writel ((1 << PdNum), &dv_psc_regs->ptcmd); + +/* +* Wait for GOSTAT = NO TRANSITION from PSC for Powerdomain 0 +*/ +while (!(((readl (&dv_psc_regs->ptstat) >> PdNum) &PSC_GOSTAT ) + ==0 )) + ; + +/* Wait for MODSTAT = ENABLE from LPSC's */ +for (i = lpsc_start; i <= lpsc_end; i++) +while (!((readl (&dv_psc_regs->mdstat[i]) & +PSC_MD_STATE_MSK ) ==0x3 )) + ; + } +} + +static void dm365_emif_init (void ) +{ +writel (CONFIG_SYS_DM36x_AWCCR, &davinci_emif_regs->awccr); +writel (CONFIG_SYS_DM36x_AB1CR, &davinci_emif_regs->ab1cr); + +setbits_le32 (&davinci_emif_regs->nandfcr,1 ); + +writel (CONFIG_SYS_DM36x_AB2CR, &davinci_emif_regs->ab2cr); + +return ; +} + +void dm365_pinmux_ctl (unsigned long offset,unsigned long mask, +unsigned long value) +{ +clrbits_le32 (&dv_sys_module_regs->pinmux[offset], mask); +setbits_le32 (&dv_sys_module_regs->pinmux[offset], (mask & value)); +} + +__attribute__((weak)) +void board_gpio_init (void ) +{ +return ; +} + +#if defined(CONFIG_POST ) +int post_log (char *format, ...) +{ +return 0 ; +} +#endif + +void dm36x_lowlevel_init (ulong bootflag) +{ +/* +* copied from arch/arm/cpu/arm926ejs/start.S +* +* flush v4 I/D caches +*/ + asm("mov r0, #0" ); + asm("mcr p15, 0, r0, c7, c7, 0" );/* flush v3/v4 cache */ + asm("mcr p15, 0, r0, c8, c7, 0" );/* flush v4 TLB */ + +/* +* disable MMU stuff and caches +*/ + asm("mrc p15, 0, r0, c1, c0, 0" ); +/* clear bits 13, 9:8 (--V- --RS) */ + asm("bic r0, r0, #0x00002300" ); +/* clear bits 7, 2:0 (B--- -CAM) */ + asm("bic r0, r0, #0x00000087" ); +/* set bit 2 (A) Align */ + asm("orr r0, r0, #0x00000002" ); +/* set bit 12 (I) I-Cache */ + asm("orr r0, r0, #0x00001000" ); + asm("mcr p15, 0, r0, c1, c0, 0" ); + +/* Mask all interrupts */ +writel (0x04 , &dv_aintc_regs->intctl); +writel (0x0 , &dv_aintc_regs->eabase); +writel (0x0 , &dv_aintc_regs->eint0); +writel (0x0 , &dv_aintc_regs->eint1); + +/* Clear all interrupts */ +writel (0xffffffff , &dv_aintc_regs->fiq0); +writel (0xffffffff , &dv_aintc_regs->fiq1); +writel (0xffffffff , &dv_aintc_regs->irq0); +writel (0xffffffff , &dv_aintc_regs->irq1); + +/* System PSC setup - enable all */ +dm365_psc_init (); + +/* Setup Pinmux */ +dm365_pinmux_ctl (0 ,0xFFFFFFFF , CONFIG_SYS_DM36x_PINMUX0); +dm365_pinmux_ctl (1 ,0xFFFFFFFF , CONFIG_SYS_DM36x_PINMUX1); +dm365_pinmux_ctl (2 ,0xFFFFFFFF , CONFIG_SYS_DM36x_PINMUX2); +dm365_pinmux_ctl (3 ,0xFFFFFFFF , CONFIG_SYS_DM36x_PINMUX3); +dm365_pinmux_ctl (4 ,0xFFFFFFFF , CONFIG_SYS_DM36x_PINMUX4); + +/* PLL setup */ +dm365_pll1_init (CONFIG_SYS_DM36x_PLL1_PLLM, + CONFIG_SYS_DM36x_PLL1_PREDIV); +dm365_pll2_init (CONFIG_SYS_DM36x_PLL2_PLLM, + CONFIG_SYS_DM36x_PLL2_PREDIV); + +/* GPIO setup */ +board_gpio_init (); + +NS16550_init ((NS16550_t)(CONFIG_SYS_NS16550_COM1 ), +CONFIG_SYS_NS16550_CLK /16 /CONFIG_BAUDRATE ); + +/* +* Fix Power and Emulation Management Register +* see sprufh2.pdf page 38 Table 22 +*/ +writel (0x0000e003 , (CONFIG_SYS_NS16550_COM1 +0x30 )); +puts ("ddr init\n" ); +dm365_ddr_setup (); + +puts ("emif init\n" ); +dm365_emif_init (); + +#if defined(CONFIG_POST ) +/* +* Do memory tests, calls arch_memory_failure_handle() +* if error detected. +*/ +memory_post_test (0 ); +#endif +}
arch/arm/include/asm/arch-davinci/dm365_lowlevel.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH v5 9/11 arm926ejs, davinci: add cpuinfo for dm365
In reply to Heiko Schocher---
Changes for v2:
- rebase to TOT
arch/arm/cpu/arm926ejs/davinci/cpu.c | 27 ++++++++++++++++++++++++- arch/arm/include/asm/arch-davinci/pll_defs.h | 4 +++ 2 files changed, 29 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/davinci/cpu.c +25 -2
@@ -146,13 +146,15 @@ static inline unsigned pll_prediv(volatile void *pllbase)return 8 ; else return pll_div(pllbase, PLLC_PREDIV); +#elif defined(CONFIG_SOC_DM365 ) +return pll_div (pllbase,PLLC_PREDIV );#endif return 1 ; }static inline unsigned pll_postdiv (volatile void *pllbase) { -#ifdef CONFIG_SOC_DM355 +#if defined(CONFIG_SOC_DM355 ) || defined(CONFIG_SOC_DM365 )return pll_div (pllbase,PLLC_POSTDIV );#elif defined(CONFIG_SOC_DM6446 )if (pllbase == (volatile void *)DAVINCI_PLL_CNTRL0_BASE )
@@ -171,9 +173,13 @@ static unsigned pll_sysclk_mhz(unsigned pll_addr, unsigned div)#endif /* the PLL might be bypassed */ -if (REG (pllbase +PLLC_PLLCTL ) &BIT (0 )) { +if (readl (pllbase +PLLC_PLLCTL ) &BIT (0 )) { base /=pll_prediv (pllbase); +#if defined(CONFIG_SOC_DM365 ) + base *=2 * (readl (pllbase +PLLC_PLLM ) &0x0ff ); +#else base *=1 + (REG (pllbase +PLLC_PLLM ) &0x0ff ); +#endif base /=pll_postdiv (pllbase); }return DIV_ROUND_UP (base,1000 *pll_div (pllbase, div));
@@ -184,8 +190,13 @@ int print_cpuinfo(void)/* REVISIT fetch and display CPU ID and revision information * too ... that will matter as more revisions appear. */ +#if defined(CONFIG_SOC_DM365 ) +printf ("Cores: ARM %d MHz" , +pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,ARM_PLLDIV )); +#else printf ("Cores: ARM %d MHz" ,pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,ARM_PLLDIV )); +#endif #ifdef DSP_PLLDIV printf(", DSP %d MHz",
@@ -194,8 +205,13 @@ int print_cpuinfo(void) printf("\nDDR: %d MHz\n",/* DDR PHY uses an x2 input clock */ +#if defined(CONFIG_SOC_DM365 ) +pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DDR_PLLDIV ) + / 2); +#else pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,DDR_PLLDIV ) / 2); +#endif return 0 ; }
@@ -205,6 +221,13 @@ unsigned int davinci_arm_clk_get()return pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,ARM_PLLDIV ) *1000000 ; }#endif + +#if defined(CONFIG_SOC_DM365 ) +unsigned int davinci_clk_get (unsigned int div) +{ +return pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE , div) *1000000 ; +} +#endif #endif /* CONFIG_DISPLAY_CPUINFO */ #endif /* !CONFIG_SOC_DA8XX */
arch/arm/include/asm/arch-davinci/pll_defs.h +4 -0
@@ -76,4 +76,8 @@ struct dv_pll_regs {#define dv_pll0_regs ((struct dv_pll_regs *)DAVINCI_PLL_CNTRL0_BASE)#define dv_pll1_regs ((struct dv_pll_regs *)DAVINCI_PLL_CNTRL1_BASE) +#define ARM_PLLDIV (offsetof(struct dv_pll_regs, plldiv2)) +#define DDR_PLLDIV (offsetof(struct dv_pll_regs, plldiv7)) + +unsigned int davinci_clk_get (unsigned int div);#endif /* _DV_PLL_DEFS_H_ */
Signature · 1 line
1.7.6.4
PATCH v5 9/11 arm926ejs, davinci: add cpuinfo for dm365
Hi Heiko,
I already see a patch for printing cpu info for dm365(rather for all davinci family) .
Link for the patch<http://www.mail-archive.com/[email protected]/msg65514.html>, which is more cleaner.
Regards
--Prabhakar Lad
Quoted 119 lines · Heiko Schocher
Signed-off-by Heiko Schocher <[email protected]>Cc Albert ARIBAUD <[email protected]>Cc Sandeep Paulraj <[email protected]>---
Changes for v2:
- rebase to TOTarch/arm/cpu/arm926ejs/davinci/cpu.c | 27 ++++++++++++++++++++++++- arch/arm/include/asm/arch-davinci/pll_defs.h | 4 +++ 2 files changed, 29 insertions(+), 2 deletions(-)arch/arm/cpu/arm926ejs/davinci/cpu.c +3
-1@@ -146,13 +146,15 @@ static inline unsigned pll_prediv(volatile void *pllbase)return 8 ; else return pll_div(pllbase, PLLC_PREDIV); +#elif defined(CONFIG_SOC_DM365 ) +return pll_div (pllbase,PLLC_PREDIV );#endif return 1 ; }static inline unsigned pll_postdiv (volatile void *pllbase) { -#ifdef CONFIG_SOC_DM355 +#if defined(CONFIG_SOC_DM355 ) || defined(CONFIG_SOC_DM365 )return pll_div (pllbase,PLLC_POSTDIV );#elif defined(CONFIG_SOC_DM6446 )if (pllbase == (volatile void *)DAVINCI_PLL_CNTRL0_BASE)arch/arm/cpu/arm926ejs/davinci/cpu.c +5
-1@@ -171,9 +173,13 @@ static unsigned pll_sysclk_mhz(unsigned pll_addr, unsigned div)#endif /* the PLL might be bypassed */ -if (REG (pllbase +PLLC_PLLCTL ) &BIT (0 )) { +if (readl (pllbase +PLLC_PLLCTL ) &BIT (0 )) { base /=pll_prediv (pllbase); +#if defined(CONFIG_SOC_DM365 ) + base *=2 * (readl (pllbase +PLLC_PLLM ) &0x0ff ); +#else base *=1 + (REG (pllbase +PLLC_PLLM ) &0x0ff ); +#endif base /=pll_postdiv (pllbase); }return DIV_ROUND_UP(base, 1000 * pll_div(pllbase, div));arch/arm/cpu/arm926ejs/davinci/cpu.c +5
-0@@ -184,8 +190,13 @@ int print_cpuinfo(void)/* REVISIT fetch and display CPU ID and revision information * too ... that will matter as more revisions appear. */ +#if defined(CONFIG_SOC_DM365 ) +printf ("Cores: ARM %d MHz" , +pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,ARM_PLLDIV )); +#else printf ("Cores: ARM %d MHz" ,pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,ARM_PLLDIV )); +#endif #ifdef DSP_PLLDIV printf(", DSP %d MHz",arch/arm/cpu/arm926ejs/davinci/cpu.c +12
-0@@ -194,8 +205,13 @@ int print_cpuinfo(void) printf("\nDDR: %d MHz\n",/* DDR PHY uses an x2 input clock */ +#if defined(CONFIG_SOC_DM365 ) +pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,DDR_PLLDIV ) + / 2); +#else pll_sysclk_mhz (DAVINCI_PLL_CNTRL1_BASE ,DDR_PLLDIV ) / 2); +#endif return 0 ; }@@ -205,6 +221,13 @@ unsigned int davinci_arm_clk_get()return pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE ,ARM_PLLDIV ) *1000000 ; }#endif + +#if defined(CONFIG_SOC_DM365 ) +unsigned int davinci_clk_get (unsigned int div) +{ +return pll_sysclk_mhz (DAVINCI_PLL_CNTRL0_BASE , div) *1000000 ; +} +#endif #endif /* CONFIG_DISPLAY_CPUINFO */ #endif /* !CONFIG_SOC_DA8XX */ arch/arm/include/asm/arch-davinci/pll_defs.h +4
-1@@ -76,4 +76,8 @@ struct dv_pll_regs {#define dv_pll0_regs ((struct dv_pll_regs *)DAVINCI_PLL_CNTRL0_BASE)#define dv_pll1_regs ((struct dv_pll_regs *)DAVINCI_PLL_CNTRL1_BASE) +#define ARM_PLLDIV (offsetof(struct dv_pll_regs, plldiv2)) +#define DDR_PLLDIV (offsetof(struct dv_pll_regs, plldiv7)) + +unsigned int davinci_clk_get (unsigned int div);#endif /* _DV_PLL_DEFS_H_ */ --1.7.6.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v5 10/11 arm926ejs, davinci: add missing spi defines for dm365
In reply to Heiko Schocher--- arch/arm/include/asm/arch-davinci/hardware.h | 2 ++ arch/arm/include/asm/arch-davinci/pll_defs.h | 1 + 2 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-davinci/hardware.h +2 -0
@@ -111,6 +111,8 @@ typedef volatile unsigned int * dv_reg_p;#define DAVINCI_ASYNC_EMIF_CNTRL_BASE 0x01d10000#define DAVINCI_MMC_SD0_BASE 0x01d11000#define DAVINCI_DDR_EMIF_CTRL_BASE 0x20000000 +#define DAVINCI_SPI0_BASE 0x01c66000 +#define DAVINCI_SPI1_BASE 0x01c66800#elif defined(CONFIG_SOC_DM646X )#define DAVINCI_ASYNC_EMIF_CNTRL_BASE 0x20008000
arch/arm/include/asm/arch-davinci/pll_defs.h +1 -0
@@ -78,6 +78,7 @@ struct dv_pll_regs {#define ARM_PLLDIV (offsetof(struct dv_pll_regs, plldiv2))#define DDR_PLLDIV (offsetof(struct dv_pll_regs, plldiv7)) +#define SPI_PLLDIV (offsetof(struct dv_pll_regs, plldiv4))unsigned int davinci_clk_get (unsigned int div);#endif /* _DV_PLL_DEFS_H_ */
Signature · 1 line
1.7.6.4
PATCH v5 11/11 arm, davinci: add cam_enc_4xx support
In reply to Heiko Schocher- DM368 SOC
- booting with spl not with UBL from TI
- before loading u-boot from NAND into RAM, test
the RAM with the post memory test. If error
is found, switch all LEDs on and halt system.
- SPI Flash
Dataflash Typ: M25PE80
- Ethernet DM9161BI
- MMC
- USB
---
changes for v2:
- rebase to TOT
- adapted to new spl framework
- add USB support
- MDIO Clk only 1MHz
- LED: set LED in spl code, and clear them after 1 second
- add "bdinfo" command
- add nandrbl board specific command for switching between rbl and uboot ecc calculation algorithm
changes for v3:
- add CONFIG_SYS_NAND_HW_ECC_OOBFIRST
changes for v4:
- add comments from Igor Grinberg
- remove in board/ait/cam_enc_4xx/Makefile unnecessary targets clean, distcelan
- use CONFIG_MACH_TYPE option
- removed some unnecessary brackets
- new patch: add a weak enable_vbus() in drivers/usb/musb/davinci.c
- add a comment to an "#else" to make it clearer to which "#if" it belongs
- fix ALL to ALL-y in board config.mk, and add this only if CONFIG_SPL_BUILD is not set.
MAINTAINERS | 1 + board/ait/cam_enc_4xx/Makefile | 46 ++++ board/ait/cam_enc_4xx/cam_enc_4xx.c | 446 +++++++++++++++++++++++++++++++++ board/ait/cam_enc_4xx/config.mk | 15 ++ board/ait/cam_enc_4xx/u-boot-spl.lds | 73 ++++++ board/ait/cam_enc_4xx/ublimage.cfg | 48 ++++ boards.cfg | 1 + doc/README.davinci.nand_spl | 141 +++++++++++ include/configs/cam_enc_4xx.h | 452 ++++++++++++++++++++++++++++++++++ tools/ublimage.h | 2 +- 10 files changed, 1224 insertions(+), 1 deletions(-) create mode 100644 board/ait/cam_enc_4xx/Makefile create mode 100644 board/ait/cam_enc_4xx/cam_enc_4xx.c create mode 100644 board/ait/cam_enc_4xx/config.mk create mode 100644 board/ait/cam_enc_4xx/u-boot-spl.lds create mode 100644 board/ait/cam_enc_4xx/ublimage.cfg create mode 100644 doc/README.davinci.nand_spl create mode 100644 include/configs/cam_enc_4xx.h
MAINTAINERS +1 -0
@@ -421,6 +421,7 @@ Georg Schardt <[email protected]> Heiko Schocher <[email protected]> + cam_enc_4xx davinci/ARM926EJS charon MPC5200 ids8247 MPC8247 jupiter MPC5200
board/ait/cam_enc_4xx/Makefile new file +46 -0
46 lines not on this page · raw message
board/ait/cam_enc_4xx/cam_enc_4xx.c new file +446 -0
446 lines not on this page · raw message
board/ait/cam_enc_4xx/config.mk new file +15 -0
@@ -0,0 +1,15 @@ +# +# AIT cam_enc_4xx board +# cam_enc_4xx board has 1 bank of 256 MB DDR RAM +# Physical Address: 8000'0000 to 9000'0000 +# +# Linux Kernel is expected to be at 8000'8000, entry 8000'8000 +# (mem base + reserved) +# + +#Provide at least 16MB spacing between us and the Linux Kernel image +PAD_TO := 12320 +UBL_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/ublimage.cfg +ifndef CONFIG_SPL_BUILD +ALL-y += $(obj)u-boot.ubl +endif
board/ait/cam_enc_4xx/u-boot-spl.lds new file +73 -0
73 lines not on this page · raw message
board/ait/cam_enc_4xx/ublimage.cfg new file +48 -0
48 lines not on this page · raw message
boards.cfg +1 -0
@@ -119,6 +119,7 @@ pm9263 arm arm926ejs pm9263 ronetix pm9g45 arm arm926ejs pm9g45 ronetix at91 pm9g45:AT91SAM9G45 da830evm arm arm926ejs da8xxevm davinci davinci da850evm arm arm926ejs da8xxevm davinci davinci +cam_enc_4xx arm arm926ejs cam_enc_4xx ait davinci cam_enc_4xx hawkboard arm arm926ejs da8xxevm davinci davinci hawkboard_nand arm arm926ejs da8xxevm davinci davinci hawkboard:NAND_U_BOOT hawkboard_uart arm arm926ejs da8xxevm davinci davinci hawkboard:UART_U_BOOT
doc/README.davinci.nand_spl new file +141 -0
141 lines not on this page · raw message
include/configs/cam_enc_4xx.h new file +452 -0
452 lines not on this page · raw message
tools/ublimage.h +1 -1
@@ -66,7 +66,7 @@ enum ublimage_fld_types {#define UBL_IMAGE_SIZE (0x00003800u)/* one NAND block */ -#define UBL_BLOCK_SIZE 512 +#define UBL_BLOCK_SIZE 2048/* from sprufg5a.pdf Table 109 */ struct ubl_header {
Signature · 1 line
1.7.6.4