arm: atmel: sama5d3: enable spl boot from SD card
Subsystems (2)
cover arm: atmel: sama5d3: enable spl boot from SD card
This patch series enable spl boot from SD card, it only can boot u-boot itself.
Bo Shen (7):
arm: atmel: sama5d3: early enable PIO peripherals
arm: atmel: sama5d3: correct the ID for DBGU and PIT
arm: atmel: the offset of MULA is 18 in sama5d3
arm: atmel: sama5: correct the error define of DIV
arm: atmel: add plla and mck initialize function
arm: atmel: add ddr2 initialization function
spl: mmc: FAT support boot u-boot
arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/at91/Makefile | 1 + arch/arm/cpu/armv7/at91/clock.c | 27 ++++++ arch/arm/cpu/armv7/at91/mpddrc.c | 123 ++++++++++++++++++++++++ arch/arm/cpu/armv7/at91/sama5d3_devices.c | 2 +- arch/arm/cpu/armv7/at91/timer.c | 2 +- arch/arm/cpu/armv7/at91/u-boot-spl.lds | 50 ++++++++++ arch/arm/include/asm/arch-at91/at91_common.h | 2 + arch/arm/include/asm/arch-at91/at91_pmc.h | 8 +- arch/arm/include/asm/arch-at91/atmel_mpddrc.h | 111 ++++++++++++++++++++++ arch/arm/include/asm/arch-at91/spl.h | 17 ++++ board/atmel/sama5d3xek/sama5d3xek.c | 126 +++++++++++++++++++++++++ include/configs/sama5d3xek.h | 37 ++++++++ 13 files changed, 503 insertions(+), 5 deletions(-) create mode 100644 arch/arm/cpu/armv7/at91/mpddrc.c create mode 100644 arch/arm/cpu/armv7/at91/u-boot-spl.lds create mode 100644 arch/arm/include/asm/arch-at91/atmel_mpddrc.h create mode 100644 arch/arm/include/asm/arch-at91/spl.h
Signature · 1 line
1.7.9.5
RFC PATCH 1/7 arm: atmel: sama5d3: early enable PIO peripherals
Enable the PIO peripherals early that other peripherals.
--- board/atmel/sama5d3xek/sama5d3xek.c | 3 +++ 1 file changed, 3 insertions(+)
board/atmel/sama5d3xek/sama5d3xek.c +3 -0
@@ -158,6 +158,9 @@ void lcd_show_board_info(void)int board_early_init_f (void ) { +at91_periph_clk_enable (ATMEL_ID_PIOA |ATMEL_ID_PIOB |ATMEL_ID_PIOC | +ATMEL_ID_PIOD |ATMEL_ID_PIOE ); +at91_seriald_hw_init ();return 0 ;
Signature · 1 line
1.7.9.5
RFC PATCH 1/7 arm: atmel: sama5d3: early enable PIO peripherals
Hello bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
Quoted 12 lines
Enable the PIO peripherals early that other peripherals.
Signed-off-by Bo Shen<[email protected]>--- board/atmel/sama5d3xek/sama5d3xek.c | 3 +++ 1 file changed, 3 insertions(+)board/atmel/sama5d3xek/sama5d3xek.c +0
-0
board/atmel/sama5d3xek/sama5d3xek.c void lcd_show_board_info(void) · line 166
Quoted 9 lines
board/atmel/sama5d3xek/sama5d3xek.c +3
-0@@ -158,6 +158,9 @@ void lcd_show_board_info(void)int board_early_init_f (void ) { +at91_periph_clk_enable (ATMEL_ID_PIOA |ATMEL_ID_PIOB |ATMEL_ID_PIOC | +ATMEL_ID_PIOD |ATMEL_ID_PIOE ); +at91_seriald_hw_init ();return 0 ;
Hmm.. you do this board specific. I think, we should make there a more generic approach.
Could we create here a
arch/arm/cpu/arm926ejs/at91/spl.c
and collect such common code?
This comment aplly also for your patch:
http://patchwork.ozlabs.org/patch/287165/
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RFC PATCH 1/7 arm: atmel: sama5d3: early enable PIO peripherals
In reply to Bo ShenHi Bo,
Quoted 12 lines · Bo Shen
Enable the PIO peripherals early that other peripherals.
Signed-off-by Bo Shen <[email protected]>--- board/atmel/sama5d3xek/sama5d3xek.c | 3 +++ 1 file changed, 3 insertions(+)board/atmel/sama5d3xek/sama5d3xek.c +0
-0
board/atmel/sama5d3xek/sama5d3xek.c void lcd_show_board_info(void) · line 163
Quoted 6 lines
board/atmel/sama5d3xek/sama5d3xek.c +3
-0@@ -158,6 +158,9 @@ void lcd_show_board_info(void)int board_early_init_f (void ) { +at91_periph_clk_enable (ATMEL_ID_PIOA |ATMEL_ID_PIOB |ATMEL_ID_PIOC | +ATMEL_ID_PIOD |ATMEL_ID_PIOE ); +
that should be done in some SPL specific 'main()'. I dunno which is the entry point for SPL, but we should provide such a function and there should we do such stuff.
Best regards
Andreas Bie?mann
RFC PATCH 1/7 arm: atmel: sama5d3: early enable PIO peripherals
Hi Andreas,
Quoted 16 lines · Andreas Bie?mann
Hi Bo,
Quoted 13 lines · Bo Shen
Enable the PIO peripherals early that other peripherals.
Signed-off-by Bo Shen <[email protected]>--- board/atmel/sama5d3xek/sama5d3xek.c | 3 +++ 1 file changed, 3 insertions(+)board/atmel/sama5d3xek/sama5d3xek.c +0
-0@@ -158,6 +158,9 @@ void lcd_show_board_info(void)
Quoted 9 lines
board/atmel/sama5d3xek/sama5d3xek.c void lcd_show_board_info(void) · line 163
Quoted 5 lines
board/atmel/sama5d3xek/sama5d3xek.c +3
-0int board_early_init_f (void ) { +at91_periph_clk_enable (ATMEL_ID_PIOA |ATMEL_ID_PIOB |ATMEL_ID_PIOC | +ATMEL_ID_PIOD |ATMEL_ID_PIOE ); +that should be done in some SPL specific '
main()'. I dunno which is the entry point for SPL, but we should provide such a function and there should we do such stuff.
As before, we depends on the at91bootstrap to enable the PIO clock. Now, I think we need to enable PIO clock in u-boot by itself. So, we need this.
Quoted 3 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
RFC PATCH 2/7 arm: atmel: sama5d3: correct the ID for DBGU and PIT
In reply to Bo ShenAs the DBGU and PIT has its own ID on sama5d3 SoC, while not share with SYS ID. So, correct them.
--- arch/arm/cpu/armv7/at91/sama5d3_devices.c | 2 +- arch/arm/cpu/armv7/at91/timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/at91/sama5d3_devices.c +1 -1
@@ -82,7 +82,7 @@ void at91_seriald_hw_init(void)at91_set_a_periph (AT91_PIO_PORTB ,30 ,0 );/* DRXD */ /* Enable clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_DBGU ); }#if defined(CONFIG_ATMEL_SPI )
arch/arm/cpu/armv7/at91/timer.c +1 -1
@@ -60,7 +60,7 @@ int timer_init(void)at91_pit_t *pit = (at91_pit_t *)ATMEL_BASE_PIT ;/* Enable PITC Clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_PIT );/* Enable PITC */ writel (TIMER_LOAD_VAL |AT91_PIT_MR_EN , &pit->mr);
Signature · 1 line
1.7.9.5
RFC PATCH 2/7 arm: atmel: sama5d3: correct the ID for DBGU and PIT
Hi Bo,
Quoted 28 lines · Bo Shen
As the DBGU and PIT has its own ID on sama5d3 SoC, while not share with SYS ID. So, correct them.
Signed-off-by Bo Shen <[email protected]>--- arch/arm/cpu/armv7/at91/sama5d3_devices.c | 2 +- arch/arm/cpu/armv7/at91/timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/cpu/armv7/at91/sama5d3_devices.c +1
-1@@ -82,7 +82,7 @@ void at91_seriald_hw_init(void)at91_set_a_periph (AT91_PIO_PORTB ,30 ,0 );/* DRXD */ /* Enable clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_DBGU ); }#if defined(CONFIG_ATMEL_SPI )arch/arm/cpu/armv7/at91/timer.c +0
-0
arch/arm/cpu/armv7/at91/timer.c int timer_init(void) · line 66
Quoted 8 lines
arch/arm/cpu/armv7/at91/timer.c +1
-1@@ -60,7 +60,7 @@ int timer_init(void)at91_pit_t *pit = (at91_pit_t *)ATMEL_BASE_PIT ;/* Enable PITC Clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_PIT );/* Enable PITC */ writel (TIMER_LOAD_VAL |AT91_PIT_MR_EN , &pit->mr);
I think these two are generic bug fixes, could you please send them as not RFC for inclusion?
Best regards
Andreas Bie?mann
RFC PATCH 2/7 arm: atmel: sama5d3: correct the ID for DBGU and PIT
Hi Andreas,
Quoted 36 lines · Andreas Bie?mann
Hi Bo,
Quoted 33 lines · Bo Shen
As the DBGU and PIT has its own ID on sama5d3 SoC, while not share with SYS ID. So, correct them.
Signed-off-by Bo Shen <[email protected]>--- arch/arm/cpu/armv7/at91/sama5d3_devices.c | 2 +- arch/arm/cpu/armv7/at91/timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/cpu/armv7/at91/sama5d3_devices.c +1
-1@@ -82,7 +82,7 @@ void at91_seriald_hw_init(void)at91_set_a_periph (AT91_PIO_PORTB ,30 ,0 );/* DRXD */ /* Enable clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_DBGU ); }#if defined(CONFIG_ATMEL_SPI )arch/arm/cpu/armv7/at91/timer.c +1
-1@@ -60,7 +60,7 @@ int timer_init(void)at91_pit_t *pit = (at91_pit_t *)ATMEL_BASE_PIT ;/* Enable PITC Clock */ -at91_periph_clk_enable (ATMEL_ID_SYS ); +at91_periph_clk_enable (ATMEL_ID_PIT );
Quoted 6 lines
arch/arm/cpu/armv7/at91/timer.c int timer_init(void) · line 66
Quoted 3 lines
arch/arm/cpu/armv7/at91/timer.c +0
-0/* Enable PITC */ writel (TIMER_LOAD_VAL |AT91_PIT_MR_EN , &pit->mr);I think these two are generic bug fixes, could you please send them as not RFC for inclusion?
OK, I will remove RFC for inclusion in v2.
Quoted 4 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
RFC PATCH 3/7 arm: atmel: the offset of MULA is 18 in sama5d3
In reply to Bo ShenThe offset of MULA field in PLLA register in sama5d3 is 18, and the length only 7 bits.
--- arch/arm/include/asm/arch-at91/at91_pmc.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/arch-at91/at91_pmc.h +4 -0
@@ -73,7 +73,11 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) +#ifdef CONFIG_SAMA5D3 +#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18) +#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16) +#endif #define AT91_PMC_PLLAR_29 0x20000000#define AT91_PMC_PLLBR_USBDIV_1 0x00000000#define AT91_PMC_PLLBR_USBDIV_2 0x10000000
Signature · 1 line
1.7.9.5
RFC PATCH 4/7 arm: atmel: sama5: correct the error define of DIV
In reply to Bo ShenCorrect the error define of DIV.
--- arch/arm/include/asm/arch-at91/at91_pmc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-at91/at91_pmc.h +2 -2
@@ -128,8 +128,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif -#define AT91_PMC_MCKR_PLLADIV_1 0x00001000 -#define AT91_PMC_MCKR_PLLADIV_2 0x00002000 +#define AT91_PMC_MCKR_PLLADIV_1 0x00000000 +#define AT91_PMC_MCKR_PLLADIV_2 0x00001000#define AT91_PMC_IXR_MOSCS 0x00000001#define AT91_PMC_IXR_LOCKA 0x00000002
Signature · 1 line
1.7.9.5
RFC PATCH 5/7 arm: atmel: add plla and mck initialize function
In reply to Bo ShenAdd plla and mck initialize function.
--- arch/arm/cpu/armv7/at91/clock.c | 27 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-at91/at91_common.h | 2 ++ 2 files changed, 29 insertions(+)
arch/arm/cpu/armv7/at91/clock.c +27 -0
@@ -120,3 +120,30 @@ void at91_periph_clk_enable(int id)else writel (1 << id, &pmc->pcer); } + +void at91_plla_init (u32 pllar,int timeout) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (pllar, &pmc->pllar); +while (!(readl (&pmc->sr) & (AT91_PMC_LOCKA |AT91_PMC_MCKRDY ))) + timeout--; +} + +void at91_mck_init (u32 mckr,int timeout) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; +u32 tmp; + + tmp =readl (&pmc->mckr); + tmp &= ~(AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); + tmp |= mckr & (AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); +writel (tmp, &pmc->mckr); + +while (!(readl (&pmc->sr) &AT91_PMC_MCKRDY )) + timeout--; +}
arch/arm/include/asm/arch-at91/at91_common.h +2 -0
@@ -22,5 +22,7 @@ void at91_spi1_hw_init(unsigned long cs_mask);void at91_udp_hw_init (void );void at91_uhp_hw_init (void );void at91_lcd_hw_init (void ); +void at91_plla_init (u32 pllar,int timeout); +void at91_mck_init (u32 mckr,int timeout);#endif /* AT91_COMMON_H */
Signature · 1 line
1.7.9.5
RFC PATCH 5/7 arm: atmel: add plla and mck initialize function
Hi Bo,
Quoted 14 lines · Bo Shen
Add plla and mck initialize function.
Signed-off-by Bo Shen <[email protected]>--- arch/arm/cpu/armv7/at91/clock.c | 27 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-at91/at91_common.h | 2 ++ 2 files changed, 29 insertions(+)arch/arm/cpu/armv7/at91/clock.c +0
-0@@ -120,3 +120,30 @@ void at91_periph_clk_enable(int id)else
arch/arm/cpu/armv7/at91/clock.c void at91_periph_clk_enable(int id) · line 130
Quoted 10 lines
arch/arm/cpu/armv7/at91/clock.c +8
-0writel (1 << id, &pmc->pcer); } + +void at91_plla_init (u32 pllar,int timeout) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (pllar, &pmc->pllar); +while (!(readl (&pmc->sr) & (AT91_PMC_LOCKA |AT91_PMC_MCKRDY ))) + timeout--;
I do not understand use of this timeout here ... You do not check it nor return something ... It would make sense to add an check into the wile() and return upon the state of timeout true/false.
This however is not needed here cause we either succeed to setup the PLL or not. If not we could not proceed anyways, so why check it here?
In connection with a watchdog it could make sense to kick it while waiting for PLL initialisation.
arch/arm/cpu/armv7/at91/clock.c void at91_periph_clk_enable(int id) · line 133
Quoted 3 lines
arch/arm/cpu/armv7/at91/clock.c +3
-0+} + +void at91_mck_init (u32 mckr,int timeout)
I wonder if it would make sense to abstract the functionality of mckr to the function parameters. Something like 'I want to set 400MHz, do it for me'. Maybe this doesn't make any sense, lets discuss.
Quoted 29 lines
arch/arm/cpu/armv7/at91/clock.c +16
-0+{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; +u32 tmp; + + tmp =readl (&pmc->mckr); + tmp &= ~(AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); + tmp |= mckr & (AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); +writel (tmp, &pmc->mckr); + +while (!(readl (&pmc->sr) &AT91_PMC_MCKRDY )) + timeout--; +}arch/arm/include/asm/arch-at91/at91_common.h +2
-0@@ -22,5 +22,7 @@ void at91_spi1_hw_init(unsigned long cs_mask);void at91_udp_hw_init (void );void at91_uhp_hw_init (void );void at91_lcd_hw_init (void ); +void at91_plla_init (u32 pllar,int timeout); +void at91_mck_init (u32 mckr,int timeout);#endif /* AT91_COMMON_H */
RFC PATCH 5/7 arm: atmel: add plla and mck initialize function
Hi Andreas,
Quoted 25 lines · Andreas Bie?mann
Hi Bo,
Quoted 22 lines · Bo Shen
Add plla and mck initialize function.
Signed-off-by Bo Shen <[email protected]>--- arch/arm/cpu/armv7/at91/clock.c | 27 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-at91/at91_common.h | 2 ++ 2 files changed, 29 insertions(+)arch/arm/cpu/armv7/at91/clock.c +6
-0@@ -120,3 +120,30 @@ void at91_periph_clk_enable(int id)else writel (1 << id, &pmc->pcer); } + +void at91_plla_init (u32 pllar,int timeout) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (pllar, &pmc->pllar);
Quoted 8 lines
arch/arm/cpu/armv7/at91/clock.c void at91_periph_clk_enable(int id) · line 130
Quoted 2 lines
arch/arm/cpu/armv7/at91/clock.c +2
-0+while (!(readl (&pmc->sr) & (AT91_PMC_LOCKA |AT91_PMC_MCKRDY ))) + timeout--;I do not understand use of this timeout here ... You do not check it nor return something ... It would make sense to add an check into the
wile()and return upon the state of timeout true/false.
This however is not needed here cause we either succeed to setup the PLL or not. If not we could not proceed anyways, so why check it here?
OK, I will remove this timeout here.
Quoted 2 lines
In connection with a watchdog it could make sense to kick it while waiting for PLL initialisation.
As watchdog is disabled, so can not use it.
Quoted 7 lines
arch/arm/cpu/armv7/at91/clock.c void at91_periph_clk_enable(int id) · line 133
Quoted 3 lines
arch/arm/cpu/armv7/at91/clock.c +3
-0+} + +void at91_mck_init (u32 mckr,int timeout)I wonder if it would make sense to abstract the functionality of mckr to the function parameters. Something like 'I want to set 400MHz, do it for me'. Maybe this doesn't make any sense, lets discuss.
As the SoC can run in 132MHz * (2, 3, 4), if it runs in different frequency, the mckr configuration is different, so we need this function,
Quoted 27 lines
Quoted 27 lines
arch/arm/cpu/armv7/at91/clock.c +16
-0+{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; +u32 tmp; + + tmp =readl (&pmc->mckr); + tmp &= ~(AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); + tmp |= mckr & (AT91_PMC_MCKR_PRES_MASK | +AT91_PMC_MCKR_MDIV_MASK | +AT91_PMC_MCKR_PLLADIV_2 ); +writel (tmp, &pmc->mckr); + +while (!(readl (&pmc->sr) &AT91_PMC_MCKRDY )) + timeout--; +}arch/arm/include/asm/arch-at91/at91_common.h +2
-0@@ -22,5 +22,7 @@ void at91_spi1_hw_init(unsigned long cs_mask);void at91_udp_hw_init (void );void at91_uhp_hw_init (void );void at91_lcd_hw_init (void ); +void at91_plla_init (u32 pllar,int timeout); +void at91_mck_init (u32 mckr,int timeout);
Quoted 3 lines
arch/arm/include/asm/arch-at91/at91_common.h void at91_spi1_hw_init(unsigned long cs_mask); · line 28
Quoted 2 lines
arch/arm/include/asm/arch-at91/at91_common.h +0
-0#endif /* AT91_COMMON_H */
Best Regards,
Bo Shen
RFC PATCH 6/7 arm: atmel: add ddr2 initialization function
In reply to Bo ShenThe MPDDRC supports different type of SDRAM
This patch add ddr2 initialization function
--- arch/arm/cpu/armv7/at91/Makefile | 1 + arch/arm/cpu/armv7/at91/mpddrc.c | 123 +++++++++++++++++++++++++ arch/arm/include/asm/arch-at91/atmel_mpddrc.h | 111 ++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 arch/arm/cpu/armv7/at91/mpddrc.c create mode 100644 arch/arm/include/asm/arch-at91/atmel_mpddrc.h
arch/arm/cpu/armv7/at91/Makefile +1 -0
@@ -17,6 +17,7 @@ COBJS-y += clock.o COBJS-y += cpu.o COBJS-y += reset.o COBJS-y += timer.o +COBJS-$(CONFIG_SPL_BUILD) += mpddrc.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
arch/arm/cpu/armv7/at91/mpddrc.c new file +123 -0
123 lines not on this page · raw message
arch/arm/include/asm/arch-at91/atmel_mpddrc.h new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
In reply to Bo ShenEnable SPL support which can load u-boot from SD card in FAT format.
--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/at91/u-boot-spl.lds | 50 +++++++++++++ arch/arm/include/asm/arch-at91/spl.h | 17 +++++ board/atmel/sama5d3xek/sama5d3xek.c | 123 ++++++++++++++++++++++++++++++++ include/configs/sama5d3xek.h | 37 ++++++++++ 5 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 arch/arm/cpu/armv7/at91/u-boot-spl.lds create mode 100644 arch/arm/include/asm/arch-at91/spl.h
arch/arm/cpu/armv7/Makefile +1 -1
@@ -16,7 +16,7 @@ COBJS += cache_v7.o COBJS += cpu.o COBJS += syslib.o -ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX),) +ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_SAMA5D3),) SOBJS += lowlevel_init.o endif
arch/arm/cpu/armv7/at91/u-boot-spl.lds new file +50 -0
50 lines not on this page · raw message
arch/arm/include/asm/arch-at91/spl.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright (C) 2013 Atmel Corporation +* Bo Shen <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _ASM_ARCH_SPL_H_ +#define _ASM_ARCH_SPL_H_ + +enum { +BOOT_DEVICE_MMC1 , +BOOT_DEVICE_MMC2 , +BOOT_DEVICE_MMC2_2 , +}; + +#endif
board/atmel/sama5d3xek/sama5d3xek.c +123 -0
132 lines not on this page · raw message
include/configs/sama5d3xek.h +37 -0
@@ -25,7 +25,10 @@#define CONFIG_AT91FAMILY #define CONFIG_ARCH_CPU_INIT +#ifndef CONFIG_SPL_BUILD #define CONFIG_SKIP_LOWLEVEL_INIT +#endif +#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO
@@ -94,8 +97,12 @@#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS#define CONFIG_SYS_SDRAM_SIZE 0x20000000 +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_INIT_SP_ADDR 0x310000 +#else #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) +#endif /* SerialFlash */ #define CONFIG_CMD_SF
@@ -235,4 +242,34 @@/* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +/* SPL */ +#define CONFIG_SPL +#define CONFIG_SPL_FRAMEWORK + +#define CONFIG_SPL_TEXT_BASE 0x300000 +#define CONFIG_SPL_MAX_SIZE 0x10000 + +#define CONFIG_SPL_BSS_START_ADDR 0x20000000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x80000 + +#define CONFIG_SYS_SPL_MALLOC_START 0x20080000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x80000 + +#define CONFIG_SPL_LDSCRIPT $(CPUDIR)/at91/u-boot-spl.lds + +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT + +#define CONFIG_SPL_BOARD_INIT +#define CONFIG_SPL_MMC_SUPPORT +#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x400 +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200 +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION 1 +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME "u-boot.img" + +#define CONFIG_SPL_FAT_SUPPORT +#define CONFIG_SPL_LIBDISK_SUPPORT +#endif
Signature · 1 line
1.7.9.5
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
Quoted 13 lines
Enable SPL support which can load u-boot from SD card in FAT format.
Signed-off-by Bo Shen<[email protected]>--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/at91/u-boot-spl.lds | 50 +++++++++++++ arch/arm/include/asm/arch-at91/spl.h | 17 +++++ board/atmel/sama5d3xek/sama5d3xek.c | 123 ++++++++++++++++++++++++++++++++ include/configs/sama5d3xek.h | 37 ++++++++++ 5 files changed, 228 insertions(+), 1 deletion(-)create mode 100644
arch/arm/cpu/armv7/at91/u-boot-spl.ldscreate mode 100644arch/arm/include/asm/arch-at91/spl.h
[...]
Quoted 128 lines
board/atmel/sama5d3xek/sama5d3xek.c +113
-0@@ -20,6 +20,9 @@#include <micrel.h> #include <net.h> #include <netdev.h> +#include <spl.h> +#include <asm/arch/atmel_mpddrc.h> +#include <asm/arch/at91_wdt.h> #ifdef CONFIG_USB_GADGET_ATMEL_USBA #include <asm/arch/atmel_usba_udc.h> @@ -293,3 +296,123 @@ void spi_cs_deactivate(struct spi_slave *slave) } }#endif /* CONFIG_ATMEL_SPI */ + +/* NAND SPL */ +#ifdef CONFIG_SPL_BUILD +void spl_board_init (void ) +{ +sama5d3xek_mci_hw_init (); +} + +u32 spl_boot_device (void ) +{ +return BOOT_DEVICE_MMC1 ; +} + +u32 spl_boot_mode (void ) +{ +switch (spl_boot_device ()) { +case BOOT_DEVICE_MMC1 : +return MMCSD_MODE_FAT ; +break ; +default : +hang (); + } +} + +void ddr2_conf (struct atmel_mpddr *ddr2) +{ + ddr2->mdr = (ATMEL_MPDDRC_MDR_DBW_32BITS |ATMEL_MPDDRC_MDR_DDR2_SDRAM ); + + ddr2->cr = (ATMEL_MPDDRC_CR_NC_COL_10 | +ATMEL_MPDDRC_CR_NR_ROW_14 | +ATMEL_MPDDRC_CR_CAS_3 | +ATMEL_MPDDRC_CR_EN_ENRDM | +ATMEL_MPDDRC_CR_NB_8BANKS | +ATMEL_MPDDRC_CR_DIS_NDQS | +ATMEL_MPDDRC_CR_DECOD_INTERLEAVED | +ATMEL_MPDDRC_CR_UNAL_SUPPORTED ); + + ddr2->rtr =0x411 ; + + ddr2->tp0r = (6 <<ATMEL_MPDDRC_TP0R_TRAS_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TRCD_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TWR_OFFSET | +8 <<ATMEL_MPDDRC_TP0R_TRC_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TRP_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TRRD_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TWTR_OFFSET | +2 <<ATMEL_MPDDRC_TP0R_TMRD_OFFSET ); + + ddr2->tp1r = (2 <<ATMEL_MPDDRC_TP1R_TXP_OFFSET | +200 <<ATMEL_MPDDRC_TP1R_TXSRD_OFFSET | +28 <<ATMEL_MPDDRC_TP1R_TXSNR_OFFSET | +26 <<ATMEL_MPDDRC_TP1R_TRFC_OFFSET ); + + ddr2->tp2r = (7 <<ATMEL_MPDDRC_TP2R_TFAW_OFFSET | +2 <<ATMEL_MPDDRC_TP2R_TRTP_OFFSET | +2 <<ATMEL_MPDDRC_TP2R_TRPA_OFFSET | +7 <<ATMEL_MPDDRC_TP2R_TXARDS_OFFSET | +8 <<ATMEL_MPDDRC_TP2R_TXARD_OFFSET ); +} + +void mem_init (void ) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; +struct atmel_mpddr ddr2; + +ddr2_conf (&ddr2); + +/* enable MPDDR clock */ +at91_periph_clk_enable (ATMEL_ID_MPDDRC ); +writel (0x4 ,&pmc->scer); + +/* DDRAM2 Controller initialize */ +ddr2_init (ATMEL_BASE_DDRCS ,&ddr2); +} + +static void at91_disable_wdt (void ) +{ +struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT ; + +writel (AT91_WDT_MR_WDDIS ,&wdt->mr); +} + +static void sama5d3xek_plla_init (void ) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; +u32 tmp; + + tmp =AT91_PMC_PLLAR_29 | +AT91_PMC_PLLXR_PLLCOUNT (0x3f ) | +AT91_PMC_PLLXR_MUL (43 ) | +AT91_PMC_PLLXR_DIV (1 ); +at91_plla_init (tmp,10000 ); + +writel (0x3 <<8 ,&pmc->pllicpr); +} + +void s_init (void ) +{ +u32 tmp; + +/* disable watchdog */ +at91_disable_wdt (); + +/* PMC configuration */ +sama5d3xek_plla_init (); + tmp =AT91_PMC_MCKR_MDIV_4 | +AT91_PMC_MCKR_CSS_PLLA ; +at91_mck_init (tmp,10000 ); + +at91_clock_init (CONFIG_SYS_AT91_MAIN_CLOCK );
board/atmel/sama5d3xek/sama5d3xek.c void spi_cs_deactivate(struct spi_slave *slave) · line 418
Quoted 10 lines
board/atmel/sama5d3xek/sama5d3xek.c +10
-0+ +timer_init (); + +board_early_init_f (); + +preloader_console_init (); + + mem_init(); +} +#endif
All this functions could be moved to a common file, I vote for:
arch/arm/cpu/arm926ejs/at91/spl.c
What do you think?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hello Heiko,
Quoted 3 lines · Heiko Schocher
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
<snip code>
Quoted 5 lines
All this functions could be moved to a common file, I vote for:
arch/arm/cpu/arm926ejs/at91/spl.cWhat do you think?
That's not that easy ... sama5 is an armv7 SoC. So we need some special at91 library directory or something like this.
Best regards
Andreas Bie?mann
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hello Andreas,
Am 30.10.2013 11:43, schrieb Andreas Bie?mann:
Quoted 9 lines
Hello Heiko,
Quoted 3 lines · Heiko Schocher
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
<snip code>
Quoted 8 lines
Quoted 5 lines
All this functions could be moved to a common file, I vote for:
arch/arm/cpu/arm926ejs/at91/spl.cWhat do you think?
That's not that easy ... sama5 is an armv7 SoC. So we need some special at91 library directory or something like this.
Ah, armv7 and I work on an at91sam920, which is arm926 ... Hmm... I started with a
arch/arm/cpu/arm926ejs/at91/spl.c
Ok... so we need a place for both archs ... Hmm, something like
arch/arm/cpu/at91-common/spl.c ?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hi Heiko,
+Albert
Quoted 21 lines · Heiko Schocher
Hello Andreas,
Am 30.10.2013 11:43, schrieb Andreas Bie?mann:
Quoted 9 lines
Hello Heiko,
Quoted 3 lines · Heiko Schocher
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
<snip code>
Quoted 8 lines
Quoted 5 lines
All this functions could be moved to a common file, I vote for:
arch/arm/cpu/arm926ejs/at91/spl.cWhat do you think?
That's not that easy ... sama5 is an armv7 SoC. So we need some special at91 library directory or something like this.
Quoted 8 lines
Ah, armv7 and I work on an at91sam920, which is arm926 ... Hmm... I started with a
arch/arm/cpu/arm926ejs/at91/spl.cOk... so we need a place for both archs ... Hmm, something like
arch/arm/cpu/at91-common/spl.c?
I think that is Ok.
Best regards
Andreas Bie?mann
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hi Heiko, Andreas,
Quoted 29 lines · Andreas Bie?mann
Hi Heiko,
+Albert
Quoted 24 lines · Heiko Schocher
Hello Andreas,
Am 30.10.2013 11:43, schrieb Andreas Bie?mann:
Quoted 9 lines
Hello Heiko,
Quoted 3 lines · Heiko Schocher
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
<snip code>
Quoted 8 lines
Quoted 5 lines
All this functions could be moved to a common file, I vote for:
arch/arm/cpu/arm926ejs/at91/spl.cWhat do you think?
That's not that easy ... sama5 is an armv7 SoC. So we need some special at91 library directory or something like this.
Ah, armv7 and I work on an at91sam920, which is arm926 ... Hmm... I started with a
Quoted 7 lines
Quoted 5 lines
arch/arm/cpu/arm926ejs/at91/spl.cOk... so we need a place for both archs ... Hmm, something like
arch/arm/cpu/at91-common/spl.c?I think that is Ok.
OK, I will try this in RFC v2.
Quoted 3 lines
Best regards
Andreas Bie?mann
Best Regards,
Bo Shen
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
In reply to Bo ShenHello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
Quoted 7 lines
Enable SPL support which can load u-boot from SD card in FAT format.
Signed-off-by Bo Shen<[email protected]>--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/at91/u-boot-spl.lds | 50 +++++++++++++
Why do you need a special lds file?
Does arch/arm/cpu/u-boot-spl.lds not fit for you?
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RFC PATCH 7/7 spl: mmc: FAT support boot u-boot
Hi Heiko,
Quoted 7 lines · Heiko Schocher
Hello Bo,
Am 30.10.2013 10:15, schrieb Bo Shen:
Quoted 4 lines
Enable SPL support which can load u-boot from SD card in FAT format.
Signed-off-by Bo Shen<[email protected]>
Quoted 7 lines
Quoted 3 lines
--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/at91/u-boot-spl.lds | 50 +++++++++++++Why do you need a special lds file?
Does
arch/arm/cpu/u-boot-spl.ldsnot fit for you?
As the bss segment is too big, which exceed the size of sram, it needs to put the bss into sdram. So, I add this lds file.
Quoted 2 lines
bye,
Heiko
Best Regards,
Bo Shen