Support Samsung S5PV210 CPU
Subsystems (6)
cover Support Samsung S5PV210 CPU
This is a series of patches to add very minimal support of Samsung S5PV210 CPU. This can be booted from another bootloader. It also adds very minimal support for tiny210, a low-cost S5PV210 board from FriendlyArm.
The full support (including NAND flash, DRAM initialization and complete booting) is being debugged right now. It seems to work. I'll post it later since it requires lot of code cleanup.
Alexey Galakhov (4):
Support most Samsung SoCs in S3C serial driver Fine split S3C arch dependencies from generic code Minimal S5PV210 + Tiny210 support (2nd stage only) S5PV210 iROM magic boot code
arch/arm/Kconfig | 6 + arch/arm/Makefile | 1 + arch/arm/boards/a9m2410/a9m2410.c | 12 +- arch/arm/boards/a9m2410/config.h | 2 +- arch/arm/boards/a9m2410/lowlevel_init.S | 2 +- arch/arm/boards/a9m2440/a9m2410dev.c | 2 +- arch/arm/boards/a9m2440/a9m2440.c | 12 +- arch/arm/boards/a9m2440/config.h | 2 +- arch/arm/boards/a9m2440/lowlevel_init.S | 4 +- arch/arm/boards/mini2440/config.h | 2 +- arch/arm/boards/mini2440/lowlevel_init.S | 2 +- arch/arm/boards/mini2440/mini2440.c | 12 +- arch/arm/boards/tiny210/Makefile | 1 + arch/arm/boards/tiny210/config.h | 1 + arch/arm/boards/tiny210/lowlevel.c | 31 + arch/arm/boards/tiny210/tiny210.c | 113 +++ arch/arm/configs/a9m2410_defconfig | 2 +- arch/arm/configs/a9m2440_defconfig | 4 +- arch/arm/configs/mini2440_defconfig | 2 +- arch/arm/mach-samsung/Kconfig | 54 +- arch/arm/mach-samsung/Makefile | 7 +- arch/arm/mach-samsung/clocks-s3c24x0.c | 157 ++++ arch/arm/mach-samsung/clocks-s5pcxx.c | 98 +++ arch/arm/mach-samsung/generic.c | 112 --- arch/arm/mach-samsung/gpio-s3c24x0.c | 2 +- arch/arm/mach-samsung/gpio-s5pcxx.c | 123 +++ .../arm/mach-samsung/include/mach/clocks-s3c24x0.h | 24 + arch/arm/mach-samsung/include/mach/clocks-s5pcxx.h | 55 ++ arch/arm/mach-samsung/include/mach/gpio-s3c24x0.h | 77 ++ arch/arm/mach-samsung/include/mach/gpio.h | 3 + arch/arm/mach-samsung/include/mach/iomap-s3c24x0.h | 69 ++ arch/arm/mach-samsung/include/mach/iomap-s5pcxx.h | 49 ++ arch/arm/mach-samsung/include/mach/iomux-s5pcxx.h | 798 ++++++++++++++++++++ arch/arm/mach-samsung/include/mach/s3c-clocks.h | 25 +- arch/arm/mach-samsung/include/mach/s3c-generic.h | 12 +- arch/arm/mach-samsung/include/mach/s3c-iomap.h | 56 +- arch/arm/mach-samsung/include/mach/s3c-nand.h | 54 ++ arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h | 77 -- arch/arm/mach-samsung/include/mach/s3c24xx-nand.h | 54 -- arch/arm/mach-samsung/lowlevel-init.S | 317 -------- arch/arm/mach-samsung/lowlevel-s3c24x0.S | 317 ++++++++ arch/arm/mach-samsung/mem-s3c24x0.c | 143 ++++ arch/arm/mach-samsung/s3c24xx-clocks.c | 140 ---- arch/arm/mach-samsung/s5p-irom-boot.c | 64 ++ drivers/mtd/nand/Kconfig | 4 +- drivers/mtd/nand/Makefile | 2 +- drivers/mtd/nand/nand_s3c.c | 665 ++++++++++++++++ drivers/mtd/nand/nand_s3c24xx.c | 665 ---------------- drivers/serial/Kconfig | 2 +- drivers/serial/serial_s3c.c | 55 +- 50 files changed, 2997 insertions(+), 1496 deletions(-) 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/mach-samsung/clocks-s3c24x0.c create mode 100644 arch/arm/mach-samsung/clocks-s5pcxx.c create mode 100644 arch/arm/mach-samsung/gpio-s5pcxx.c create mode 100644 arch/arm/mach-samsung/include/mach/clocks-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/clocks-s5pcxx.h create mode 100644 arch/arm/mach-samsung/include/mach/gpio-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/iomap-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/iomap-s5pcxx.h create mode 100644 arch/arm/mach-samsung/include/mach/iomux-s5pcxx.h create mode 100644 arch/arm/mach-samsung/include/mach/s3c-nand.h delete mode 100644 arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h delete mode 100644 arch/arm/mach-samsung/include/mach/s3c24xx-nand.h delete mode 100644 arch/arm/mach-samsung/lowlevel-init.S create mode 100644 arch/arm/mach-samsung/lowlevel-s3c24x0.S create mode 100644 arch/arm/mach-samsung/mem-s3c24x0.c delete mode 100644 arch/arm/mach-samsung/s3c24xx-clocks.c create mode 100644 arch/arm/mach-samsung/s5p-irom-boot.c create mode 100644 drivers/mtd/nand/nand_s3c.c delete mode 100644 drivers/mtd/nand/nand_s3c24xx.c
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/4 Support most Samsung SoCs in S3C serial driver
--- arch/arm/mach-samsung/include/mach/s3c-generic.h | 4 ++ arch/arm/mach-samsung/s3c24xx-clocks.c | 17 +++++++ drivers/serial/serial_s3c.c | 55 +++++++++++++++------- 3 files changed, 59 insertions(+), 17 deletions(-)
arch/arm/mach-samsung/include/mach/s3c-generic.h +4 -0
@@ -30,5 +30,9 @@ uint32_t s3c_get_fclk(void);uint32_t s3c_get_hclk (void );uint32_t s3c_get_pclk (void );uint32_t s3c_get_uclk (void ); + +unsigned s3c_get_uart_clk (unsigned src); +uint32_t s3c24xx_get_memory_size (void ); +void s3c24xx_disable_second_sdram_bank (void );
arch/arm/mach-samsung/s3c24xx-clocks.c +17 -0
@@ -117,6 +117,23 @@ uint32_t s3c24_get_uclk(void)return s3c_get_upllclk (); } +/** +* Return correct UART frequency based on the UCON register +*/ +unsigned s3c_get_uart_clk (unsigned src) +{ +switch (src &3 ) { +case 0 : +case 2 : +return s3c_get_pclk (); +case 1 : +return 0 ;/* TODO UEXTCLK */ +case 3 : +return 0 ;/* TODO FCLK/n */ + } +return 0 ;/* not reached, to make compiler happy */ +} +/** * Show the user the current clock settings */
drivers/serial/serial_s3c.c +38 -17
81 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
PATCH 2/4 Fine split S3C arch dependencies from generic code
In reply to Alexey Galakhov--- arch/arm/boards/a9m2410/a9m2410.c | 12 +- arch/arm/boards/a9m2410/config.h | 2 +- arch/arm/boards/a9m2410/lowlevel_init.S | 2 +- arch/arm/boards/a9m2440/a9m2410dev.c | 2 +- arch/arm/boards/a9m2440/a9m2440.c | 12 +- arch/arm/boards/a9m2440/config.h | 2 +- arch/arm/boards/a9m2440/lowlevel_init.S | 4 +- arch/arm/boards/mini2440/config.h | 2 +- arch/arm/boards/mini2440/lowlevel_init.S | 2 +- arch/arm/boards/mini2440/mini2440.c | 12 +- arch/arm/configs/a9m2410_defconfig | 2 +- arch/arm/configs/a9m2440_defconfig | 4 +- arch/arm/configs/mini2440_defconfig | 2 +- arch/arm/mach-samsung/Kconfig | 30 +- arch/arm/mach-samsung/Makefile | 5 +- arch/arm/mach-samsung/clocks-s3c24x0.c | 157 +++++ arch/arm/mach-samsung/generic.c | 112 ---- arch/arm/mach-samsung/gpio-s3c24x0.c | 2 +- .../arm/mach-samsung/include/mach/clocks-s3c24x0.h | 24 + arch/arm/mach-samsung/include/mach/gpio-s3c24x0.h | 77 +++ arch/arm/mach-samsung/include/mach/iomap-s3c24x0.h | 69 ++ arch/arm/mach-samsung/include/mach/s3c-clocks.h | 22 +- arch/arm/mach-samsung/include/mach/s3c-generic.h | 4 +- arch/arm/mach-samsung/include/mach/s3c-iomap.h | 53 +- arch/arm/mach-samsung/include/mach/s3c-nand.h | 54 ++ arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h | 77 --- arch/arm/mach-samsung/include/mach/s3c24xx-nand.h | 54 -- arch/arm/mach-samsung/lowlevel-init.S | 317 ---------- arch/arm/mach-samsung/lowlevel-s3c24x0.S | 317 ++++++++++ arch/arm/mach-samsung/mem-s3c24x0.c | 143 +++++ arch/arm/mach-samsung/s3c24xx-clocks.c | 157 ----- drivers/mtd/nand/Kconfig | 4 +- drivers/mtd/nand/Makefile | 2 +- drivers/mtd/nand/nand_s3c.c | 665 ++++++++++++++++++++ drivers/mtd/nand/nand_s3c24xx.c | 665 -------------------- drivers/serial/Kconfig | 2 +- 36 files changed, 1576 insertions(+), 1496 deletions(-) create mode 100644 arch/arm/mach-samsung/clocks-s3c24x0.c create mode 100644 arch/arm/mach-samsung/include/mach/clocks-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/gpio-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/iomap-s3c24x0.h create mode 100644 arch/arm/mach-samsung/include/mach/s3c-nand.h delete mode 100644 arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h delete mode 100644 arch/arm/mach-samsung/include/mach/s3c24xx-nand.h delete mode 100644 arch/arm/mach-samsung/lowlevel-init.S create mode 100644 arch/arm/mach-samsung/lowlevel-s3c24x0.S create mode 100644 arch/arm/mach-samsung/mem-s3c24x0.c delete mode 100644 arch/arm/mach-samsung/s3c24xx-clocks.c create mode 100644 drivers/mtd/nand/nand_s3c.c delete mode 100644 drivers/mtd/nand/nand_s3c24xx.c
arch/arm/boards/a9m2410/a9m2410.c +6 -6
@@ -33,13 +33,13 @@#include <nand.h> #include <io.h> #include <mach/s3c-iomap.h> -#include <mach/s3c24xx-nand.h> +#include <mach/s3c-nand.h> #include <mach/s3c-generic.h> #include <mach/s3c-busctl.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> // {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, -static struct s3c24x0_nand_platform_data nand_info = { +static struct s3c_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2410_TACLS ,A9M2410_TWRPH0 ,A9M2410_TWRPH1 ) };
@@ -51,7 +51,7 @@ static int a9m2410_mem_init(void)* Note: On this card the second SDRAM page is not used */ s3c24xx_disable_second_sdram_bank (); - size =s3c24xx_get_memory_size (); + size =s3c_get_memory_size ();/* ---------- configure the GPIOs ------------- */ writel (0x007FFFFF ,S3C_GPACON );
@@ -136,10 +136,10 @@ static int a9m2410_devices_init(void)device_initcall (a9m2410_devices_init); -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT void __bare_init nand_boot(void) { -s3c24x0_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); +s3c_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); }#endif
arch/arm/boards/a9m2410/config.h +1 -1
@@ -115,7 +115,7 @@#define A9M2410_TWRPH1 1/* needed in the generic NAND boot code only */ -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT # define BOARD_DEFAULT_NAND_TIMING CALC_NFCONF_TIMING(A9M2410_TACLS, A9M2410_TWRPH0, A9M2410_TWRPH1)#endif
arch/arm/boards/a9m2410/lowlevel_init.S +1 -1
@@ -28,7 +28,7 @@ board_init_lowlevel: bl s3c24x0_sdram_init -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT mov lr, r10 /* restore the link register */ /* up to here we are running from the internal SRAM area */ b s3c24x0_nand_boot /* does return directly to our caller into SDRAM */
arch/arm/boards/a9m2440/a9m2410dev.c +1 -1
@@ -30,7 +30,7 @@#include <io.h> #include <mach/s3c-iomap.h> #include <mach/s3c-busctl.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> /** * Initialize the CPU to be able to work with the a9m2410dev evaluation board
arch/arm/boards/a9m2440/a9m2440.c +6 -6
@@ -33,14 +33,14 @@#include <nand.h> #include <io.h> #include <mach/s3c-iomap.h> -#include <mach/s3c24xx-nand.h> +#include <mach/s3c-nand.h> #include <mach/s3c-generic.h> #include <mach/s3c-busctl.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> #include "baseboards.h" -static struct s3c24x0_nand_platform_data nand_info = { +static struct s3c_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (A9M2440_TACLS ,A9M2440_TWRPH0 ,A9M2440_TWRPH1 ) };
@@ -99,7 +99,7 @@ static int a9m2440_mem_init(void)break ; } -arm_add_mem_device ("ram0" ,S3C_SDRAM_BASE ,s3c24xx_get_memory_size ()); +arm_add_mem_device ("ram0" ,S3C_SDRAM_BASE ,s3c_get_memory_size ());return 0 ; }
@@ -155,10 +155,10 @@ static int a9m2440_devices_init(void)device_initcall (a9m2440_devices_init); -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT void __bare_init nand_boot(void) { -s3c24x0_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); +s3c_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); }#endif
arch/arm/boards/a9m2440/config.h +1 -1
@@ -66,7 +66,7 @@#define A9M2440_TWRPH1 1/* needed in the generic NAND boot code only */ -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT # define BOARD_DEFAULT_NAND_TIMING CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1)#endif
arch/arm/boards/a9m2440/lowlevel_init.S +2 -2
@@ -4,7 +4,7 @@ #include <config.h> #include <mach/s3c-iomap.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> .section ".text_bare_init.board_init_lowlevel","ax"
@@ -232,7 +232,7 @@ board_init_lowlevel: bl sdram_init -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT mov lr, r10 /* restore the link register */ /* up to here we are running from the internal SRAM area */ b s3c24x0_nand_boot /* does return directly to our caller into SDRAM */
arch/arm/boards/mini2440/config.h +1 -1
@@ -66,7 +66,7 @@#define MINI2440_TWRPH1 1/* needed in the generic NAND boot code only */ -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT # define BOARD_DEFAULT_NAND_TIMING \ CALC_NFCONF_TIMING(MINI2440_TACLS, MINI2440_TWRPH0, MINI2440_TWRPH1)#endif
arch/arm/boards/mini2440/lowlevel_init.S +1 -1
@@ -30,7 +30,7 @@ board_init_lowlevel: bl s3c24x0_sdram_init -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT mov lr, r10 /* restore the link register */ /* up to here we are running from the internal SRAM area */ b s3c24x0_nand_boot /* does return directly to our caller into SDRAM */
arch/arm/boards/mini2440/mini2440.c +6 -6
@@ -39,14 +39,14 @@#include <io.h> #include <mach/gpio.h> #include <mach/s3c-iomap.h> -#include <mach/s3c24xx-nand.h> +#include <mach/s3c-nand.h> #include <mach/s3c-generic.h> #include <mach/s3c-mci.h> #include <mach/s3c24xx-fb.h> #include <mach/s3c-busctl.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> -static struct s3c24x0_nand_platform_data nand_info = { +static struct s3c_nand_platform_data nand_info = { .nand_timing =CALC_NFCONF_TIMING (MINI2440_TACLS ,MINI2440_TWRPH0 ,MINI2440_TWRPH1 ), .flash_bbt =1 ,/* same as the kernel */
@@ -268,7 +268,7 @@ static const unsigned pin_usage[] = {static int mini2440_mem_init (void ) { -arm_add_mem_device ("ram0" ,S3C_SDRAM_BASE ,s3c24xx_get_memory_size ()); +arm_add_mem_device ("ram0" ,S3C_SDRAM_BASE ,s3c_get_memory_size ());return 0 ; }
@@ -326,10 +326,10 @@ static int mini2440_devices_init(void)device_initcall (mini2440_devices_init); -#ifdef CONFIG_S3C24XX_NAND_BOOT +#ifdef CONFIG_S3C_NAND_BOOT void __bare_init nand_boot(void) { -s3c24x0_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); +s3c_nand_load_image ((void *)TEXT_BASE ,256 *1024 ,0 ); }#endif
arch/arm/configs/a9m2410_defconfig +1 -1
@@ -1,5 +1,5 @@ CONFIG_ARCH_S3C24xx=y -CONFIG_S3C24XX_NAND_BOOT=y +CONFIG_S3C_NAND_BOOT=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_BROKEN=y CONFIG_EXPERIMENTAL=y
arch/arm/configs/a9m2440_defconfig +2 -2
@@ -1,7 +1,7 @@ CONFIG_ARCH_S3C24xx=y CONFIG_MACH_A9M2440=y -CONFIG_S3C24XX_SDRAM_INIT=y -CONFIG_S3C24XX_NAND_BOOT=y +CONFIG_S3C_SDRAM_INIT=y +CONFIG_S3C_NAND_BOOT=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_BROKEN=y CONFIG_EXPERIMENTAL=y
arch/arm/configs/mini2440_defconfig +1 -1
@@ -1,7 +1,7 @@ CONFIG_ARCH_S3C24xx=y CONFIG_MACH_MINI2440=y CONFIG_MINI2440_VIDEO_N35=y -CONFIG_S3C24XX_NAND_BOOT=y +CONFIG_S3C_NAND_BOOT=y CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_TEXT_BASE=0x33e00000
arch/arm/mach-samsung/Kconfig +15 -15
@@ -30,8 +30,8 @@ config MACH_A9M2410 bool "Digi A9M2410" select CPU_S3C2410 select MACH_HAS_LOWLEVEL_INIT - select S3C24XX_PLL_INIT - select S3C24XX_SDRAM_INIT + select S3C_PLL_INIT + select S3C_SDRAM_INIT help Say Y here if you are using Digi's Connect Core 9M equipped with a Samsung S3C2410 Processor
@@ -40,7 +40,7 @@ config MACH_A9M2440 bool "Digi A9M2440" select CPU_S3C2440 select MACH_HAS_LOWLEVEL_INIT - select S3C24XX_PLL_INIT + select S3C_PLL_INIT help Say Y here if you are using Digi's Connect Core 9M equipped with a Samsung S3C2440 Processor
@@ -50,8 +50,8 @@ config MACH_MINI2440 select CPU_S3C2440 select MACH_HAS_LOWLEVEL_INIT select MACH_DO_LOWLEVEL_INIT - select S3C24XX_PLL_INIT - select S3C24XX_SDRAM_INIT + select S3C_PLL_INIT + select S3C_SDRAM_INIT select HAS_DM9000 help Say Y here if you are using Mini 2440 dev board equipped
@@ -78,34 +78,36 @@ source arch/arm/boards/mini2440/Kconfig endmenu -menu "S3C24X0 Features " +endif + +menu "S3C Features " -config S3C24XX_LOW_LEVEL_INIT +config S3C_LOWLEVEL_INIT bool -config S3C24XX_PLL_INIT +config S3C_PLL_INIT bool prompt "Reconfigure PLL" - select S3C24XX_LOW_LEVEL_INIT + select S3C_LOWLEVEL_INIT help This adds generic code to reconfigure the internal PLL very early after reset. -config S3C24XX_SDRAM_INIT +config S3C_SDRAM_INIT bool prompt "Initialize SDRAM" - select S3C24XX_LOW_LEVEL_INIT + select S3C_LOWLEVEL_INIT help This adds generic code to configure the SDRAM controller after reset. The initialisation will be skipped if the code is already running from SDRAM. -config S3C24XX_NAND_BOOT +config S3C_NAND_BOOT bool prompt "Booting from NAND" select MTD select NAND - select NAND_S3C24XX + select NAND_S3C help Add generic support to boot from NAND flash. Image loading will be skipped if the code is running from NOR or already from SDRAM.
@@ -113,5 +115,3 @@ config S3C24XX_NAND_BOOT endmenu endif - -endif
arch/arm/mach-samsung/Makefile +3 -2
@@ -1,3 +1,4 @@ obj-y += s3c-timer.o generic.o -obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o s3c24xx-clocks.o -obj-$(CONFIG_S3C24XX_LOW_LEVEL_INIT) += lowlevel-init.o +obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o +obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o clocks-s3c24x0.o mem-s3c24x0.o +obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y)
arch/arm/mach-samsung/clocks-s3c24x0.c new file +157 -0
157 lines not on this page · raw message
arch/arm/mach-samsung/generic.c +0 -112
125 lines not on this page · raw message
arch/arm/mach-samsung/gpio-s3c24x0.c +1 -1
@@ -20,7 +20,7 @@#include <io.h> #include <mach/s3c-iomap.h> #include <mach/gpio.h> -#include <mach/s3c24xx-gpio.h> +#include <mach/gpio-s3c24x0.h> static const unsigned char group_offset[] = {
arch/arm/mach-samsung/include/mach/clocks-s3c24x0.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (C) 2011 Juergen Beisert, Pengutronix +* +* 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. +*/ + +# define S3C_LOCKTIME (S3C_CLOCK_POWER_BASE) +# define S3C_MPLLCON (S3C_CLOCK_POWER_BASE + 0x4) +# define S3C_UPLLCON (S3C_CLOCK_POWER_BASE + 0x8) +# define S3C_CLKCON (S3C_CLOCK_POWER_BASE + 0xc) +# define S3C_CLKSLOW (S3C_CLOCK_POWER_BASE + 0x10) +# define S3C_CLKDIVN (S3C_CLOCK_POWER_BASE + 0x14) + +# define S3C_MPLLCON_GET_MDIV (x) ((((x) >> 12) & 0xff) + 8) +# define S3C_MPLLCON_GET_PDIV (x) ((((x) >> 4) & 0x3f) + 2) +# define S3C_MPLLCON_GET_SDIV (x) ((x) & 0x3)
arch/arm/mach-samsung/include/mach/gpio-s3c24x0.h new file +77 -0
77 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/iomap-s3c24x0.h new file +69 -0
69 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/s3c-clocks.h +10 -12
@@ -1,5 +1,6 @@/* -* Copyright (C) 2011 Juergen Beisert, Pengutronix +* 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
@@ -10,22 +11,19 @@* 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 __MACH_S3C_CLOCKS_H -# define __MACH_S3C_CLOCKS_H +#define __MACH_S3C_CLOCKS_H#ifdef CONFIG_ARCH_S3C24xx -# define S3C_LOCKTIME (S3C_CLOCK_POWER_BASE) -# define S3C_MPLLCON (S3C_CLOCK_POWER_BASE + 0x4) -# define S3C_UPLLCON (S3C_CLOCK_POWER_BASE + 0x8) -# define S3C_CLKCON (S3C_CLOCK_POWER_BASE + 0xc) -# define S3C_CLKSLOW (S3C_CLOCK_POWER_BASE + 0x10) -# define S3C_CLKDIVN (S3C_CLOCK_POWER_BASE + 0x14) - -# define S3C_MPLLCON_GET_MDIV (x) ((((x) >> 12) & 0xff) + 8) -# define S3C_MPLLCON_GET_PDIV (x) ((((x) >> 4) & 0x3f) + 2) -# define S3C_MPLLCON_GET_SDIV (x) ((x) & 0x3) +# include <mach/clocks-s3c24x0.h> #endif #endif /* __MACH_S3C_CLOCKS_H */
arch/arm/mach-samsung/include/mach/s3c-generic.h +3 -1
@@ -33,6 +33,8 @@ uint32_t s3c_get_uclk(void);unsigned s3c_get_uart_clk (unsigned src); -uint32_t s3c24xx_get_memory_size (void ); +uint32_t s3c_get_memory_size (void ); +#ifdef CONFIG_ARCH_S3C24xxvoid s3c24xx_disable_second_sdram_bank (void ); +#endif
arch/arm/mach-samsung/include/mach/s3c-iomap.h +4 -49
61 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/s3c-nand.h new file +54 -0
54 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h deleted +0 -77
77 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/s3c24xx-nand.h deleted +0 -54
54 lines not on this page · raw message
arch/arm/mach-samsung/lowlevel-init.S deleted +0 -317
317 lines not on this page · raw message
arch/arm/mach-samsung/lowlevel-s3c24x0.S new file +317 -0
317 lines not on this page · raw message
arch/arm/mach-samsung/mem-s3c24x0.c new file +143 -0
143 lines not on this page · raw message
arch/arm/mach-samsung/s3c24xx-clocks.c deleted +0 -157
157 lines not on this page · raw message
drivers/mtd/nand/Kconfig +2 -2
@@ -65,9 +65,9 @@ config NAND_ATMEL prompt "Atmel (AT91SAM9xxx) NAND driver" depends on ARCH_AT91 -config NAND_S3C24XX +config NAND_S3C bool - prompt "Samsung S3C24XX NAND driver" + prompt "Samsung S3C NAND driver" depends on ARCH_S3C24xx help Add support for processor's NAND device controller.
drivers/mtd/nand/Makefile +1 -1
@@ -14,4 +14,4 @@ obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o obj-$(CONFIG_NAND_IMX) += nand_imx.o obj-$(CONFIG_NAND_OMAP_GPMC) += nand_omap_gpmc.o nand_omap_bch_decoder.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o -obj-$(CONFIG_NAND_S3C24XX) += nand_s3c24xx.o +obj-$(CONFIG_NAND_S3C) += nand_s3c.o
drivers/mtd/nand/nand_s3c.c new file +665 -0
665 lines not on this page · raw message
drivers/mtd/nand/nand_s3c24xx.c deleted +0 -665
353 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Part of the diff is not shown here. View the raw message.
PATCH 4/4 S5PV210 iROM magic boot code
In reply to Alexey Galakhov--- arch/arm/mach-samsung/Makefile | 1 + arch/arm/mach-samsung/include/mach/s3c-generic.h | 4 ++ arch/arm/mach-samsung/s5p-irom-boot.c | 64 ++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 arch/arm/mach-samsung/s5p-irom-boot.c
arch/arm/mach-samsung/Makefile +1 -0
@@ -2,4 +2,5 @@ obj-y += s3c-timer.o generic.o obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o clocks-s3c24x0.o mem-s3c24x0.o obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o +obj-$(CONFIG_ARCH_S5PCxx) += s5p-irom-boot.o obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y)
arch/arm/mach-samsung/include/mach/s3c-generic.h +4 -0
@@ -38,3 +38,7 @@ uint32_t s3c_get_memory_size(void);#ifdef CONFIG_ARCH_S3C24xxvoid s3c24xx_disable_second_sdram_bank (void );#endif + +#ifdef CONFIG_ARCH_S5PCxx +int s5p_irom_mmc_load (void *dest,uint32_t start_block,uint16_t block_count); +#endif
arch/arm/mach-samsung/s5p-irom-boot.c new file +64 -0
64 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
PATCH 3/4 Minimal S5PV210 + Tiny210 support (2nd stage only)
In reply to Alexey Galakhov--- arch/arm/Kconfig | 6 + arch/arm/Makefile | 1 + arch/arm/boards/tiny210/Makefile | 1 + arch/arm/boards/tiny210/config.h | 1 + arch/arm/boards/tiny210/lowlevel.c | 31 + arch/arm/boards/tiny210/tiny210.c | 113 +++ arch/arm/mach-samsung/Kconfig | 24 + arch/arm/mach-samsung/Makefile | 1 + arch/arm/mach-samsung/clocks-s5pcxx.c | 98 +++ arch/arm/mach-samsung/gpio-s5pcxx.c | 123 +++ arch/arm/mach-samsung/include/mach/clocks-s5pcxx.h | 55 ++ arch/arm/mach-samsung/include/mach/gpio.h | 3 + arch/arm/mach-samsung/include/mach/iomap-s5pcxx.h | 49 ++ arch/arm/mach-samsung/include/mach/iomux-s5pcxx.h | 798 ++++++++++++++++++++ arch/arm/mach-samsung/include/mach/s3c-clocks.h | 3 + arch/arm/mach-samsung/include/mach/s3c-iomap.h | 3 + 16 files changed, 1310 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/mach-samsung/clocks-s5pcxx.c create mode 100644 arch/arm/mach-samsung/gpio-s5pcxx.c create mode 100644 arch/arm/mach-samsung/include/mach/clocks-s5pcxx.h create mode 100644 arch/arm/mach-samsung/include/mach/iomap-s5pcxx.h create mode 100644 arch/arm/mach-samsung/include/mach/iomux-s5pcxx.h
arch/arm/Kconfig +6 -0
@@ -73,6 +73,12 @@ config ARCH_S3C24xx select CPU_ARM920T select GENERIC_GPIO +config ARCH_S5PCxx + bool "Samsung S5PC110, S5PV210" + select ARCH_SAMSUNG + select CPU_V7 + select GENERIC_GPIO + config ARCH_VERSATILE bool "ARM Versatile boards (ARM926EJ-S)" select CPU_ARM926T
arch/arm/Makefile +1 -0
@@ -130,6 +130,7 @@ board-$(CONFIG_MACH_USB_A9G20) := usb-a926x board-$(CONFIG_MACH_VERSATILEPB) := versatile board-$(CONFIG_MACH_TX25) := karo-tx25 board-$(CONFIG_MACH_TQMA53) := tqma53 +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 +1 -0
@@ -0,0 +1 @@ +#define S5PCXX_CLOCK_REFERENCE 24000000
arch/arm/boards/tiny210/lowlevel.c new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2012 Alexey Galakhov +* +* 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 +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#include <config.h> +#include <common.h> +#include <init.h> +#include <io.h> +#include <asm/barebox-arm.h> +#include <mach/s3c-iomap.h> +#include <mach/s3c-clocks.h> + +void __bare_init board_init_lowlevel(void) +{ +}
arch/arm/boards/tiny210/tiny210.c new file +113 -0
113 lines not on this page · raw message
arch/arm/mach-samsung/Kconfig +24 -0
@@ -13,6 +13,7 @@ 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 if ARCH_S3C24xx
@@ -80,6 +81,29 @@ endmenu endif +if ARCH_S5PCxx + +config CPU_S5PC110 + bool + +config CPU_S5PV210 + bool + +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 + +endif + + menu "S3C Features " config S3C_LOWLEVEL_INIT
arch/arm/mach-samsung/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-y += s3c-timer.o generic.o obj-lowlevel-$(CONFIG_ARCH_S3C24xx) += lowlevel-s3c24x0.o obj-$(CONFIG_ARCH_S3C24xx) += gpio-s3c24x0.o clocks-s3c24x0.o mem-s3c24x0.o +obj-$(CONFIG_ARCH_S5PCxx) += gpio-s5pcxx.o clocks-s5pcxx.o obj-$(CONFIG_S3C_LOWLEVEL_INIT) += $(obj-lowlevel-y)
arch/arm/mach-samsung/clocks-s5pcxx.c new file +98 -0
98 lines not on this page · raw message
arch/arm/mach-samsung/gpio-s5pcxx.c new file +123 -0
123 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/clocks-s5pcxx.h new file +55 -0
55 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/gpio.h +3 -0
@@ -16,6 +16,9 @@#ifdef CONFIG_ARCH_S3C24xx# include <mach/iomux-s3c24x0.h> #endif +#ifdef CONFIG_ARCH_S5PCxx +# include <mach/iomux-s5pcxx.h> +#endif void gpio_set_value (unsigned ,int );int gpio_direction_input (unsigned );
arch/arm/mach-samsung/include/mach/iomap-s5pcxx.h new file +49 -0
49 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/iomux-s5pcxx.h new file +798 -0
798 lines not on this page · raw message
arch/arm/mach-samsung/include/mach/s3c-clocks.h +3 -0
@@ -25,5 +25,8 @@#ifdef CONFIG_ARCH_S3C24xx# include <mach/clocks-s3c24x0.h> #endif +#ifdef CONFIG_ARCH_S5PCxx +# include <mach/clocks-s5pcxx.h> +#endif #endif /* __MACH_S3C_CLOCKS_H */
arch/arm/mach-samsung/include/mach/s3c-iomap.h +3 -0
@@ -22,3 +22,6 @@#ifdef CONFIG_ARCH_S3C24xx# include <mach/iomap-s3c24x0.h> #endif +#ifdef CONFIG_ARCH_S5PCxx +# include <mach/iomap-s5pcxx.h> +#endif
Signature · 7 lines
1.7.10 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Alexey GalakhovQuoted 11 lines · Alexey Galakhov
drivers/mtd/nand/Makefile +1
-1@@ -14,4 +14,4 @@ obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o obj-$(CONFIG_NAND_IMX) += nand_imx.o obj-$(CONFIG_NAND_OMAP_GPMC) += nand_omap_gpmc.o nand_omap_bch_decoder.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o -obj-$(CONFIG_NAND_S3C24XX) += nand_s3c24xx.o +obj-$(CONFIG_NAND_S3C) += nand_s3c.o
Quoted 5 lines
delete mode 100644
drivers/mtd/nand/nand_s3c24xx.ccreate mode 100644drivers/mtd/nand/nand_s3c.ccreate mode 100644
arch/arm/mach-samsung/include/mach/s3c-nand.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-nand.h
That is a really bad idea. I just renamed these files at January 2012 to reflect their CPU (refer b29b8f43d56b62e406349a5cf1ed56f17454c1f7). Why do you revert this change again? The NAND controller in the S3C24XX CPU is unique to this CPU. The NAND controller in the S3C6410 differs from it, and I guess the same is true in the S5 CPU. So, the newer CPUs need their own NAND drivers.
What is the sense of renaming these files?
Quoted 5 lines
create mode 100644
arch/arm/mach-samsung/clocks-s3c24x0.cdelete mode 100644arch/arm/mach-samsung/s3c24xx-clocks.ccreate mode 100644
arch/arm/mach-samsung/include/mach/gpio-s3c24x0.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-gpio.h
This rename _could_ make sense:
Quoted 2 lines
delete mode 100644
arch/arm/mach-samsung/lowlevel-init.Screate mode 100644arch/arm/mach-samsung/lowlevel-s3c24x0.S
But on the other hand, this lowlevel init is only required on the S3C24xx CPUs, as all newer CPUs are coming with an internal ROM (called iROM) and booting completely different. So, for these CPUs there is no need for such lowlevel functions.
So sorry, this patch doesn't do a "Fine split".
My b29b8f43d56b62e406349a5cf1ed56f17454c1f7 already separated the S3C24xx from other Samsung implementations. I think there is no need to touch all the S3C24xx related files again when adding a new Samsung CPU.
Juergen
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/4] Minimal S5PV210 + Tiny210 support (2nd stage only)
In reply to Alexey GalakhovQuoted 28 lines · Alexey Galakhov
[...]
arch/arm/boards/tiny210/lowlevel.c new file +21
-0@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2012 Alexey Galakhov +* +* 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 +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#include <config.h>
arch/arm/boards/tiny210/lowlevel.c line 31
Quoted 10 lines
arch/arm/boards/tiny210/lowlevel.c new file +10
-0+#include <common.h> +#include <init.h> +#include <io.h> +#include <asm/barebox-arm.h> +#include <mach/s3c-iomap.h> +#include <mach/s3c-clocks.h> + +void __bare_init board_init_lowlevel(void) +{ +}
Why do you add an empty function?
[...]
Juergen
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 4/4] S5PV210 iROM magic boot code
In reply to Alexey GalakhovQuoted 61 lines · Alexey Galakhov
[...]
arch/arm/mach-samsung/s5p-irom-boot.c new file +54
-0@@ -0,0 +1,64 @@ +/* +* Copyright (C) 2012 Alexey Galakhov +* +* Based on code from u-boot found somewhere on the web +* that seems to originate from Samsung +* +* 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. +*/ + +#include <config.h> +#include <common.h> +#include <init.h> +#include <mach/s3c-generic.h> + +/* +* These magical address values are from u-boot +* Not sure what they really mean but they work +*/ +#if 1 /* S5PV210 and other CPUs */ +# define MADDR_CH 0xD0037488 +# define MADDR_CP 0xD0037F98 +#else /* not sure when, some older CPUs */ +# define MADDR_CH 0xD003A508 +# define MADDR_CP 0xD003E008 +#endif + +typedef uint32_t (*mmc2mem_func ) +(uint32_t channel,uint32_t start_block,uint16_t block_count,uint32_t *dest,uint32_t init); + +/* +* Call to the magical iROM code present on S5P CPUs +* Block seems to be 512 bytes +*/ +int __bare_init s5p_irom_mmc_load(void *dest, uint32_t start_block, uint16_t block_count) +{ +uint32_t ret; +uint32_t chan; +uint32_t ch = *(volatile uint32_t *)(MADDR_CH ); +mmc2mem_func cp_func = (mmc2mem_func)(*(uint32_t *)(MADDR_CP )); +switch (ch) + { +case 0xEB000000 : + chan =0 ; +break ; +case 0xEB200000 : + chan =2 ;
arch/arm/mach-samsung/s5p-irom-boot.c line 64
Quoted 10 lines
arch/arm/mach-samsung/s5p-irom-boot.c new file +10
-0+break ; +default : +return 0 ; + } + + ret =cp_func (chan, start_block, block_count, (uint32_t *)dest,0 ); +if (ret ==0 ) +return 0 ;/* error */ +return 1 ; +}
It seems to be a low hanging fruit to use the iROM to access some of the peripherals. But there is no way to tell the compiler the calling convention to the ROM functions. And the entry points seems guessed only. This results into "it works for me with this compiler and these compiler flags and that CPU's silicon revision"...
The S3C6410 CPU comes also with such an iROM. But calling it is only useful in the first stage loader (and the S3C6410 iROM has a defined jump table to call specific functions, there is no need to guess the real entry points).
Writing a Barebox driver for this MMC/SD unit instead should be the correct way.
Juergen
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Juergen BeisertQuoted 10 lines · Juergen Beisert
Quoted 2 lines
create mode 100644
arch/arm/mach-samsung/include/mach/s3c-nand.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-nand.hThat is a really bad idea. I just renamed these files at January 2012 to reflect their CPU (refer
b29b8f43d56b62e406349a5cf1ed56f17454c1f7). Why do you revert this change again? The NAND controller in the S3C24XX CPU is unique to this CPU. The NAND controller in the S3C6410 differs from it, and I guess the same is true in the S5 CPU. So, the newer CPUs need their own NAND drivers.What is the sense of renaming these files?
In fact, exactly the opposite is true. The NAND controller in S5PV210 is almost exactly the same as in S3C24xx. The only difference is the numbering of registers. Also S5P suports 1-bit and 4-bit HW ECC while S3C has only 1-bit. The algorithm is the same, even s3c2440_nand_read_buf() works correctly.
S3C6410 has the same controller as well.
Right now I have working S5PV210 NAND driver, I did it like that:
#ifdef CONFIG_ARCH_S5PCxx
#define NFCONT 0x04
#define NFCMD 0x08
#define NFADDR 0x0C
#define NFDATA 0x10
#define NFSTAT 0x28
#define NFECC 0x34
etc.
The driver IS the same, yes. It works for both S5P and S3C.
Regards,
Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/4] Minimal S5PV210 + Tiny210 support (2nd stage only)
In reply to Juergen BeisertQuoted 11 lines · Juergen Beisert
arch/arm/boards/tiny210/lowlevel.c line 31
Quoted 3 lines · Alexey Galakhov
arch/arm/boards/tiny210/lowlevel.c new file +3
-0+void __bare_init board_init_lowlevel(void) +{ +}Why do you add an empty function?
[...]
Juergen
A placeholder for now. I'll fill it in the next few days (DRAM controller init).
S5PV210 won't work without lowlevel init, so I preferred to add an empty function in order to make low level init Kconfig option mandatory.
Regards,
Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 4/4] S5PV210 iROM magic boot code
In reply to Juergen BeisertQuoted 6 lines · Juergen Beisert
It seems to be a low hanging fruit to use the iROM to access some of the peripherals. But there is no way to tell the compiler the calling convention to the ROM functions. And the entry points seems guessed only. This results into "it works for me with this compiler and these compiler flags and that CPU's silicon revision"...
Quoted 8 lines
The S3C6410 CPU comes also with such an iROM. But calling it is only useful in the first stage loader (and the S3C6410 iROM has a defined jump table to call specific functions, there is no need to guess the real entry points).
Writing a Barebox driver for this MMC/SD unit instead should be the correct way.
Juergen
Agree.
This function is for 1st stage only. I plan to remove it as soon as MMC driver will be complete. Right now it is needed, however, to boot 2nd stage.
Right not I have working NAND, DRAM and UART. I plan to get working USB soon. MMC seems to be (almost) generic SDHCI (very similar to existing imx driver).
Regards,
Alex
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Alexey GalakhovQuoted 11 lines · Alexey Galakhov
Quoted 10 lines · Juergen Beisert
Quoted 2 lines
create mode 100644
arch/arm/mach-samsung/include/mach/s3c-nand.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-nand.hThat is a really bad idea. I just renamed these files at January 2012 to reflect their CPU (refer
b29b8f43d56b62e406349a5cf1ed56f17454c1f7). Why do you revert this change again? The NAND controller in the S3C24XX CPU is unique to this CPU. The NAND controller in the S3C6410 differs from it, and I guess the same is true in the S5 CPU. So, the newer CPUs need their own NAND drivers.
Quoted 6 lines
Quoted 1 line
What is the sense of renaming these files?
In fact, exactly the opposite is true. The NAND controller in S5PV210 is almost exactly the same as in S3C24xx. The only difference is the numbering of registers. Also S5P suports 1-bit and 4-bit HW ECC while S3C has only 1-bit.
Does the S5P not support 8 bit ECC? That would be a step backwards and would make it useless for recent MLC NAND devices.
Quoted 1 line
The algorithm is the same, even
s3c2440_nand_read_buf()works correctly.
These routines are useless for NANDs of type MLC which are the standard today.
Quoted 1 line
S3C6410 has the same controller as well.
No it hasn't. Believe me. Using the old 1 bit ECC (and also the 4 bit ECC) makes no sense any more. Even the built-in iROM forces the 8 bit ECC mode if you want to boot it from NAND. And I guess it is the same on the S5P CPU.
Regards,
Juergen
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
Quoted 14 lines · Juergen Beisert
Quoted 13 lines · Alexey Galakhov
Quoted 11 lines · Juergen Beisert
Quoted 2 lines
create mode 100644
arch/arm/mach-samsung/include/mach/s3c-nand.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-nand.hThat is a really bad idea. I just renamed these files at January 2012 to reflect their CPU (refer
b29b8f43d56b62e406349a5cf1ed56f17454c1f7). Why do you revert this change again? The NAND controller in the S3C24XX CPU is unique to this CPU. The NAND controller in the S3C6410 differs from it, and I guess the same is true in the S5 CPU. So, the newer CPUs need their own NAND drivers.What is the sense of renaming these files?
Quoted 7 lines
Quoted 4 lines
In fact, exactly the opposite is true. The NAND controller in S5PV210 is almost exactly the same as in S3C24xx. The only difference is the numbering of registers. Also S5P suports 1-bit and 4-bit HW ECC while S3C has only 1-bit.
Does the S5P not support 8 bit ECC? That would be a step backwards and would make it useless for recent MLC NAND devices.
It has two ECC modes, SLC and MLC.
The SLC mode is exactly the same as S3C2440. The MLC mode has "4-8-16-32 bit support". Looks like this is achieved by using the same 4-bit hardware calculator.
Quoted 3 lines
Quoted 1 line
The algorithm is the same, even
s3c2440_nand_read_buf()works correctly.These routines are useless for NANDs of type MLC which are the standard today.
According to the datasheet, the only difference between SLC and MLC handling from the software point of view is ECC calculation. The block reading is exactly the same, just reading the data register multiple times. The ECC engine in both SLC and MLC modes works just like S3C2440. The only differnce is that one has to set ECC data direction bit prior to operation.
Quoted 5 lines
Quoted 1 line
S3C6410 has the same controller as well.
No it hasn't. Believe me. Using the old 1 bit ECC (and also the 4 bit ECC) makes no sense any more. Even the built-in iROM forces the 8 bit ECC mode if you want to boot it from NAND. And I guess it is the same on the S5P CPU.
Hm, looks like my board is not the case. Anyway, this seems to be just adding one more HW specific ECC function and not a complete rewrite.
There is a Linux driver from Samsung, named "s3c_nand.c", found in S5PVxx kernel patches here and there (not in mainstream). It works for S3C2416 and up and supports SLC and MLC. I use it for reference.
I.e., here:
https://e60-open.googlecode.com/svn/patches/kernel/samsung-e60-kernel-mtd.patch
Its ECC function looks like that:
static int s3c_nand_calculate_ecc(struct mtd_info *mtd,
const u_char *dat, u_char *ecc_code)
{
u_long nfcont, nfmecc0, nfmecc1;
void __iomem *regs = s3c_nand.regs;
/* Lock */
nfcont = readl(regs + S3C_NFCONT);
nfcont |= S3C_NFCONT_MECCLOCK; // <---- this is recommended for
S3C2440 too - Alex
writel(nfcont, regs + S3C_NFCONT);
if (nand_type == S3C_NAND_TYPE_SLC) {
nfmecc0 = readl(regs + S3C_NFMECC0);
ecc_code[0] = nfmecc0 & 0xff;
ecc_code[1] = (nfmecc0 >> 8) & 0xff;
ecc_code[2] = (nfmecc0 >> 16) & 0xff;
ecc_code[3] = (nfmecc0 >> 24) & 0xff;
} else {
if (cur_ecc_mode == NAND_ECC_READ)
s3c_nand_wait_dec(); // <--- another difference,
MLC needs "wait ready"< SLC doesn't - Alex
else {
s3c_nand_wait_enc();
nfmecc0 = readl(regs + S3C_NFMECC0);
nfmecc1 = readl(regs + S3C_NFMECC1);
ecc_code[0] = nfmecc0 & 0xff;
ecc_code[1] = (nfmecc0 >> 8) & 0xff;
ecc_code[2] = (nfmecc0 >> 16) & 0xff;
ecc_code[3] = (nfmecc0 >> 24) & 0xff;
ecc_code[4] = nfmecc1 & 0xff;
ecc_code[5] = (nfmecc1 >> 8) & 0xff;
ecc_code[6] = (nfmecc1 >> 16) & 0xff;
ecc_code[7] = (nfmecc1 >> 24) & 0xff;
}
}
return 0;
}I suggest to support both new and old hardware in the same code. Why not? It is 95% the same.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Juergen BeisertQuoted 3 lines · Juergen Beisert
No it hasn't. Believe me. Using the old 1 bit ECC (and also the 4 bit ECC) makes no sense any more. Even the built-in iROM forces the 8 bit ECC mode if you want to boot it from NAND. And I guess it is the same on the S5P CPU.
Ok, how about using nand-s3c.c for generic read and write procedures (same for all S3C and S5P) and adding nand-s3c-mlc.c for MLC ECC support only?
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Alexey GalakhovQuoted 34 lines · Alexey Galakhov
Quoted 14 lines · Juergen Beisert
Quoted 13 lines · Alexey Galakhov
Quoted 11 lines · Juergen Beisert
Quoted 2 lines
create mode 100644
arch/arm/mach-samsung/include/mach/s3c-nand.hdelete mode 100644arch/arm/mach-samsung/include/mach/s3c24xx-nand.hThat is a really bad idea. I just renamed these files at January 2012 to reflect their CPU (refer
b29b8f43d56b62e406349a5cf1ed56f17454c1f7). Why do you revert this change again? The NAND controller in the S3C24XX CPU is unique to this CPU. The NAND controller in the S3C6410 differs from it, and I guess the same is true in the S5 CPU. So, the newer CPUs need their own NAND drivers.What is the sense of renaming these files?
Quoted 7 lines
Quoted 4 lines
In fact, exactly the opposite is true. The NAND controller in S5PV210 is almost exactly the same as in S3C24xx. The only difference is the numbering of registers. Also S5P suports 1-bit and 4-bit HW ECC while S3C has only 1-bit.
Does the S5P not support 8 bit ECC? That would be a step backwards and would make it useless for recent MLC NAND devices.
It has two ECC modes, SLC and MLC.
The SLC mode is exactly the same as S3C2440. The MLC mode has "4-8-16-32 bit support". Looks like this is achieved by using the same 4-bit hardware calculator.
Quoted 4 lines
Quoted 1 line
The algorithm is the same, even
s3c2440_nand_read_buf()works correctly.These routines are useless for NANDs of type MLC which are the standard today.
Quoted 6 lines
According to the datasheet, the only difference between SLC and MLC handling from the software point of view is ECC calculation. The block reading is exactly the same, just reading the data register multiple times. The ECC engine in both SLC and MLC modes works just like S3C2440. The only differnce is that one has to set ECC data direction bit prior to operation.
AFAIR the MLC ECC generator is different in its handling. At least it is much slower than the 1 bit ECC generator and so the routines must wait the result to continue on the block data.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
S3C6410 has the same controller as well.
No it hasn't. Believe me. Using the old 1 bit ECC (and also the 4 bit ECC) makes no sense any more. Even the built-in iROM forces the 8 bit ECC mode if you want to boot it from NAND. And I guess it is the same on the S5P CPU.
Quoted 6 lines
Hm, looks like my board is not the case. Anyway, this seems to be just adding one more HW specific ECC function and not a complete rewrite.
There is a Linux driver from Samsung, named "
s3c_nand.c", found in S5PVxx kernel patches here and there (not in mainstream). It works for S3C2416 and up and supports SLC and MLC. I use it for reference.
I know a similar driver for the S3C6410 CPU.
Quoted 2 lines
I suggest to support both new and old hardware in the same code. Why not? It is 95% the same.
Instead of making the S3c2440 NAND driver more and more complicated (what is the benefit of all in one driver?) I would vote for fading it out (as its hardware do not change anymore). And creating a new driver for all more recent CPUs with MLC support.
My idea was also to not support simple ECC on these newer CPUs anymore. Using the 8 bit reed-solomon checksum would be an improvement for SLCs as well (and also their OOB sizes are large enough to store the 8 bit checksums). And at least if we want to boot from NAND we cannot continue to use simple ECC checksums anymore.
Regards,
Juergen
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
missing sscanf
hi there,
i am missing scanf(..) and sscanf(..) in the barebox/include/stdio.h. Is there another function for such tasks?
- christian
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
In reply to Juergen BeisertQuoted 3 lines · Juergen Beisert
AFAIR the MLC ECC generator is different in its handling. At least it is much slower than the 1 bit ECC generator and so the routines must wait the result to continue on the block data.
Correct.
This is achieved by adding register polling loop at the beginning of corresponding calculate() function. The rest of function is almost the same, just the number of ECC bytes is larger.
The S3C2440 has a hardware ECC corrector which we do not use yet.
Quoted 8 lines
Quoted 2 lines
I suggest to support both new and old hardware in the same code. Why not? It is 95% the same.
Instead of making the S3c2440 NAND driver more and more complicated (what is the benefit of all in one driver?) I would vote for fading it out (as its hardware do not change anymore). And creating a new driver for all more recent CPUs with MLC support.
Quoted 5 lines
My idea was also to not support simple ECC on these newer CPUs anymore. Using the 8 bit reed-solomon checksum would be an improvement for SLCs as well (and also their OOB sizes are large enough to store the 8 bit checksums). And at least if we want to boot from NAND we cannot continue to use simple ECC checksums anymore.
Maybe that's right. But simple ECC support is very simple anyway, harmless to keep. And looks like some low-cost Chinese boards still have SLC even with newer CPUs.
I think that the new driver with MLC support with MLC support off will be able to support older CPUs too. Probably with one exception for S3C2410 which has no NFCONT. If so, there's no reason to keep the old driver at all. Am I right?
BTW, do we want software ECC support too? I added sw ecc to my working copy of NAND driver just for debugging, and now I think about keeping it.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
Quoted 5 lines · Alexey Galakhov
Quoted 3 lines · Juergen Beisert
AFAIR the MLC ECC generator is different in its handling. At least it is much slower than the 1 bit ECC generator and so the routines must wait the result to continue on the block data.
Quoted 7 lines
Correct.
This is achieved by adding register polling loop at the beginning of corresponding
calculate()function. The rest of function is almost the same, just the number of ECC bytes is larger.The S3C2440 has a hardware ECC corrector which we do not use yet.
AFAIK only a hardware ECC _calculator_, but no correction unit. It must be done in software.
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
I suggest to support both new and old hardware in the same code. Why not? It is 95% the same.
Instead of making the S3c2440 NAND driver more and more complicated (what is the benefit of all in one driver?) I would vote for fading it out (as its hardware do not change anymore). And creating a new driver for all more recent CPUs with MLC support.
Quoted 8 lines
Quoted 5 lines
My idea was also to not support simple ECC on these newer CPUs anymore. Using the 8 bit reed-solomon checksum would be an improvement for SLCs as well (and also their OOB sizes are large enough to store the 8 bit checksums). And at least if we want to boot from NAND we cannot continue to use simple ECC checksums anymore.
Maybe that's right. But simple ECC support is very simple anyway, harmless to keep.
Or _useless_ to keep ;)
Quoted 2 lines
And looks like some low-cost Chinese boards still have SLC even with newer CPUs.
The better the checksum the saver your NAND data content is. That is why I want to use reed-solomon checksums even for SLCs (and keep in mind: you _must_ use 8 bit reed-solomon checksums if you want to boot from NAND).
Quoted 2 lines
[...]
BTW, do we want software ECC support too?
No. Nobody needs it and nobody wants it (ways to slow).
jbe
Signature · 7 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/4] Fine split S3C arch dependencies from generic code
Quoted 8 lines · Juergen Beisert
Quoted 7 lines · Alexey Galakhov
Quoted 3 lines · Juergen Beisert
AFAIR the MLC ECC generator is different in its handling. At least it is much slower than the 1 bit ECC generator and so the routines must wait the result to continue on the block data.
Correct.
Quoted 8 lines
Quoted 5 lines
This is achieved by adding register polling loop at the beginning of corresponding
calculate()function. The rest of function is almost the same, just the number of ECC bytes is larger.The S3C2440 has a hardware ECC corrector which we do not use yet.
AFAIK only a hardware ECC _calculator_, but no correction unit. It must be done in software.
At least S5PV210 has a correction unit. If you provide correct ECC to the unit (write into NFxECCDx), you may then read back the exact byte and bit position of the error from NFESTAT.
S3C2440 seems to have something very similar. At least it has bits with same names in NFESTAT. Its usage is not documented in my copy of datasheet, perhaps in some appnote?
The "s3c_nand.c" driver does like that, even for 2440:
nfmeccdata0 = (read_ecc[1] << 16) | read_ecc[0];
nfmeccdata1 = (read_ecc[3] << 16) | read_ecc[2];
writel(nfmeccdata0, regs + S3C_NFMECCDATA0);
writel(nfmeccdata1, regs + S3C_NFMECCDATA1);
nfestat0 = readl(regs + S3C_NFMECCERR0);
err_type = nfestat0 & 0x3;
and then (if err_type == 1):
dat[(nfestat0 >> 7) & 0x7ff] ^= (1 << ((nfestat0 >> 4) & 0x7));The MLC case is very similar. The only exception is that there is no write-back of ECC values, instead one should READ the corresponding part of OOB immediately after reading the data.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox