Revised S5PV210 DRAM support
Subsystems (3)
cover Revised S5PV210 DRAM support
This is S5PV210 DRAM support without #ifdefs. Any comments are welcome.
Alexey Galakhov (2):
S5P DRAM support
Add FriendlyArm Tiny210 board (S5PV210)
arch/arm/Makefile | 1 + arch/arm/boards/tiny210/Makefile | 1 + arch/arm/boards/tiny210/config.h | 19 ++ arch/arm/boards/tiny210/lowlevel.c | 76 +++++ arch/arm/boards/tiny210/tiny210.c | 113 ++++++++ arch/arm/configs/tiny210_defconfig | 17 ++ arch/arm/mach-samsung/Kconfig | 7 + arch/arm/mach-samsung/Makefile | 2 +- arch/arm/mach-samsung/include/mach/s3c-generic.h | 6 + arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h | 3 + arch/arm/mach-samsung/mem-s5pcxx.c | 319 +++++++++++++++++++++ 11 files changed, 563 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boards/tiny210/Makefile create mode 100644 arch/arm/boards/tiny210/config.h create mode 100644 arch/arm/boards/tiny210/lowlevel.c create mode 100644 arch/arm/boards/tiny210/tiny210.c create mode 100644 arch/arm/configs/tiny210_defconfig create mode 100644 arch/arm/mach-samsung/mem-s5pcxx.c
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/2 S5P DRAM support
--- arch/arm/mach-samsung/Makefile | 2 +- arch/arm/mach-samsung/include/mach/s3c-generic.h | 6 + arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h | 3 + arch/arm/mach-samsung/mem-s5pcxx.c | 319 +++++++++++++++++++++ 4 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-samsung/mem-s5pcxx.c
arch/arm/mach-samsung/Makefile +1 -1
@@ -2,5 +2,5 @@ obj-y += s3c-timer.o generic.o obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o obj-lowlevel-$(CONFIG_ARCH_S5PCxx) += lowlevel-s5pcxx.o obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o s3c24xx-clocks.o mem-s3c24x0.o -obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o +obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o mem-s5pcxx.o obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y)
arch/arm/mach-samsung/include/mach/s3c-generic.h +6 -0
@@ -24,6 +24,8 @@* MA 02111-1307 USA */ +#include <common.h> +uint32_t s3c_get_mpllclk (void );uint32_t s3c_get_upllclk (void );uint32_t s3c_get_fclk (void );
@@ -40,4 +42,8 @@ void s3c24xx_disable_second_sdram_bank(void);#ifdef CONFIG_ARCH_S5PCxxvoid s5p_init_pll (void ); +void s5p_init_dram_bank_lpddr (phys_addr_t base,uint32_t mc0,uint32_t mc1,int bus16); +void s5p_init_dram_bank_lpddr2 (phys_addr_t base,uint32_t mc0,uint32_t mc1,int bus16); +void s5p_init_dram_bank_ddr2 (phys_addr_t base,uint32_t mc0,uint32_t mc1,int bus16); +uint32_t s5p_get_memory_size (void );#endif
arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h +3 -0
@@ -47,3 +47,6 @@#define S3C_UART3_SIZE 0x400#define S3C_UART_HAS_UBRDIVSLOT #define S3C_UART_HAS_UINTM + +#define S5P_DMC0_BASE 0xF0000000 +#define S5P_DMC1_BASE 0xF1400000
arch/arm/mach-samsung/mem-s5pcxx.c new file +319 -0
319 lines not on this page · raw message
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/2] S5P DRAM support
Quoted 9 lines · Alexey Galakhov
Signed-off-by Alexey Galakhov <[email protected]>--- arch/arm/mach-samsung/Makefile | 2 +- arch/arm/mach-samsung/include/mach/s3c-generic.h | 6 + arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h | 3 + arch/arm/mach-samsung/mem-s5pcxx.c | 319 +++++++++++++++++++++ 4 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-samsung/mem-s5pcxx.c
arch/arm/mach-samsung/mem-s5pcxx.c line 113
Quoted 8 lines
arch/arm/mach-samsung/mem-s5pcxx.c new file +8
-0+ +static void __bare_init s5p_dram_init_seq_lpddr(phys_addr_t base, unsigned chip) +{ +const uint32_t emr =0x400 ;/* DQS disable */ +const uint32_t mr = (((S5P_DRAM_WR ) -1 ) <<9 ) + | ((S5P_DRAM_CAS ) <<4 ) + | (S5P_DRAM_BURST ); +/* FIXME this sequence is untested */
Maybe add these comments to the exported functions rather than in the helpers? It would be more prominent and people would see it more easily.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 Add FriendlyArm Tiny210 board (S5PV210)
In reply to Alexey Galakhov--- arch/arm/Makefile | 1 + arch/arm/boards/tiny210/Makefile | 1 + arch/arm/boards/tiny210/config.h | 19 ++++++ arch/arm/boards/tiny210/lowlevel.c | 76 ++++++++++++++++++++++++ arch/arm/boards/tiny210/tiny210.c | 113 ++++++++++++++++++++++++++++++++++++ arch/arm/configs/tiny210_defconfig | 17 ++++++ arch/arm/mach-samsung/Kconfig | 7 +++ 7 files changed, 234 insertions(+) create mode 100644 arch/arm/boards/tiny210/Makefile create mode 100644 arch/arm/boards/tiny210/config.h create mode 100644 arch/arm/boards/tiny210/lowlevel.c create mode 100644 arch/arm/boards/tiny210/tiny210.c create mode 100644 arch/arm/configs/tiny210_defconfig
arch/arm/Makefile +1 -0
@@ -133,6 +133,7 @@ board-$(CONFIG_MACH_TX25) := karo-tx25 board-$(CONFIG_MACH_TQMA53) := tqma53 board-$(CONFIG_MACH_TX51) := karo-tx51 board-$(CONFIG_MACH_MX6Q_ARM2) := freescale-mx6-arm2 +board-$(CONFIG_MACH_TINY210) := tiny210 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
arch/arm/boards/tiny210/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += tiny210.o lowlevel.o
arch/arm/boards/tiny210/config.h new file +19 -0
@@ -0,0 +1,19 @@ +#define S5PCXX_CLOCK_REFERENCE 24000000 + +#define set_pll (mdiv, pdiv, sdiv) (1<<31 | mdiv<<16 | pdiv<<8 | sdiv) + +#define BOARD_APLL_VAL set_pll(0x7d, 0x3, 0x1) +#define BOARD_MPLL_VAL set_pll(0x29b, 0xc, 0x1) +#define BOARD_EPLL_VAL set_pll(0x60, 0x6, 0x2) +#define BOARD_VPLL_VAL set_pll(0x6c, 0x6, 0x3) + +#define BOARD_CLK_DIV0_MASK 0xFFFFFFFF +#define BOARD_CLK_DIV0_VAL 0x14131440 +#define BOARD_APLL_LOCKTIME 0x2cf + +#define S5P_DRAM_WR 3 +#define S5P_DRAM_CAS 4 +#define DMC_TIMING_AREF 0x00000618 +#define DMC_TIMING_ROW 0x2B34438A +#define DMC_TIMING_DATA 0x24240000 +#define DMC_TIMING_PWR 0x0BDC0343
arch/arm/boards/tiny210/lowlevel.c new file +76 -0
76 lines not on this page · raw message
arch/arm/boards/tiny210/tiny210.c new file +113 -0
113 lines not on this page · raw message
arch/arm/configs/tiny210_defconfig new file +17 -0
@@ -0,0 +1,17 @@ +CONFIG_ARCH_S5PCxx=y +CONFIG_CPU_V7=y +CONFIG_CPU_32v7=y +CONFIG_BOARDINFO="Tiny 210" +CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE=0x1ff0 +CONFIG_ARCH_SAMSUNG=y +CONFIG_CPU_S5PV210=y +CONFIG_MACH_TINY210=y +CONFIG_S3C_LOWLEVEL_INIT=y +CONFIG_S3C_PLL_INIT=y +CONFIG_S3C_SDRAM_INIT=y +CONFIG_CMD_LED=y +CONFIG_CMD_LED_TRIGGER=y +CONFIG_DRIVER_SERIAL_S3C=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_LED_TRIGGERS=y
arch/arm/mach-samsung/Kconfig +7 -0
@@ -8,11 +8,13 @@ config ARCH_TEXT_BASE default 0x31fc0000 if MACH_MINI2440 default 0x31fc0000 if MACH_A9M2440 default 0x31fc0000 if MACH_A9M2410 + default 0x23e00000 if MACH_TINY210 config BOARDINFO default "Mini 2440" if MACH_MINI2440 default "Digi A9M2440" if MACH_A9M2440 default "Digi A9M2410" if MACH_A9M2410 + default "Tiny 210" if MACH_TINY210 config ARCH_BAREBOX_MAX_BARE_INIT_SIZE hex
@@ -96,6 +98,11 @@ choice prompt "S5PCxx board type" +config MACH_TINY210 + bool "Tiny 210" + select CPU_S5PV210 + select MACH_HAS_LOWLEVEL_INIT + select MACH_DO_LOWLEVEL_INIT endchoice
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] Add FriendlyArm Tiny210 board (S5PV210)
arch/arm/boards/tiny210/lowlevel.c line 41
Quoted 8 lines · Alexey Galakhov
Signed-off-by Alexey Galakhov <[email protected]>---
arch/arm/boards/tiny210/lowlevel.c new file +6
-0+ +#define ADDR_V210_SDMMC_BASE 0xD0037488 +#define ADDR_CopySDMMCtoMem 0xD0037F98 + +#define RR (x) (*(volatile uint32_t*)(x)) +
why not use regular readl/writel here?
Quoted 9 lines
arch/arm/boards/tiny210/lowlevel.c new file +9
-0+int __bare_init s5p_irom_load_mmc(void *dest, uint32_t start_block, uint16_t block_count) +{ +typedef uint32_t (*func_t ) (int32_t ,uint32_t ,uint16_t ,uint32_t *,int8_t ); +uint32_t chbase =RR (ADDR_V210_SDMMC_BASE ); +func_t func = (func_t )RR (ADDR_CopySDMMCtoMem); +int chan = (chbase -0xEB000000 ) >>20 ; +if (chan !=0 && chan !=2 ) +return 0 ; +return func (chan, start_block, block_count, (uint32_t *)dest,0 ) ?1 :0 ;
arch/arm/boards/tiny210/lowlevel.c line 60
Quoted 10 lines
arch/arm/boards/tiny210/lowlevel.c new file +10
-0+} + + +void __bare_init board_init_lowlevel(void) +{ +uint32_t r; + +#ifdef CONFIG_S3C_PLL_INIT +s5p_init_pll (); +#endif
Can we do without pll init? If not, the ifdef should not be here.
arch/arm/boards/tiny210/lowlevel.c line 67
Quoted 7 lines
arch/arm/boards/tiny210/lowlevel.c new file +7
-0+ +if (get_pc () <0xD0000000 )/* Are we running from iRAM? */ +return ;/* No, we don't. */ + +#ifdef CONFIG_S3C_SDRAM_INIT +s5p_init_dram_bank_ddr2 (S5P_DMC0_BASE ,0x20E00323 ,0 ,0 ); +#endif
Does it make sense to run this code without SDRAM setup code? It seems the ifdef should not be here. Without SDRAM setup code you'll jump to nirvana below.
Quoted 19 lines
arch/arm/boards/tiny210/lowlevel.c new file +9
-0+ +if (!s5p_irom_load_mmc ((void *)TEXT_BASE -16 ,1 , (barebox_image_size +16 +511 ) /512 )) +while (1 ) { }/* hang */ + +/* Jump to SDRAM */ + r = (unsigned )TEXT_BASE ; + __asm__ __volatile__("mov pc, %0" : :"r" (r)); +while (1 ) { }/* hang */ +}arch/arm/boards/tiny210/tiny210.c +9
-0+static int tiny210_mem_init (void ) +{ +arm_add_mem_device ("ram0" ,S3C_SDRAM_BASE ,s5p_get_memory_size ()); +return 0 ; +} +mem_initcall (tiny210_mem_init); + +static int tiny210_console_init (void ) +{
arch/arm/boards/tiny210/tiny210.c line 89
Quoted 10 lines
arch/arm/boards/tiny210/tiny210.c +10
-0+/* +* configure the UART1 right now, as barebox will +* start to send data immediately +*/ +s3c_gpio_mode (GPA00_RXD0 |ENABLE_PU ); +s3c_gpio_mode (GPA01_TXD0 ); +s3c_gpio_mode (GPA02_NCTS0 |ENABLE_PU ); +s3c_gpio_mode (GPA03_NRTS0 ); + + add_generic_device("s3c_serial", -1, NULL,
Please use DEVICE_ID_DYNAMIC instead of -1.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/2] Add FriendlyArm Tiny210 board (S5PV210)
Quoted 11 lines · Sascha Hauer
arch/arm/boards/tiny210/lowlevel.c line 41
Quoted 8 lines · Alexey Galakhov
Signed-off-by Alexey Galakhov <[email protected]>---
arch/arm/boards/tiny210/lowlevel.c new file +6
-0+ +#define ADDR_V210_SDMMC_BASE 0xD0037488 +#define ADDR_CopySDMMCtoMem 0xD0037F98 + +#define RR (x) (*(volatile uint32_t*)(x)) +why not use regular readl/writel here?
Ok. Aren't readl/writel for register access? This is "not a register" (although there is in fact no differnce).
Quoted 1 line
Can we do without pll init? If not, the ifdef should not be here.
The PLL comes initialized in some way from the iROM boot. It may or may not work depending on the hardware actually used. Looks like DRAM and UART are OK but others may not work.
Quoted 3 lines
Does it make sense to run this code without SDRAM setup code? It seems the ifdef should not be here. Without SDRAM setup code you'll jump to nirvana below.
Ok. Thanks.
Quoted 1 line
Please use
DEVICE_ID_DYNAMICinstead of -1.
Ok, thanks.
Regards,
Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox