Add support for Embest SBC2440-II Board 4/7
Subsystems (8)
This patch re-formats the s3c24x0 NAND driver code in preparation for changes to make the NAND driver support both s3c2410 and s3c2440 CPU's, ready for the addition of the Embest SBC2440-II Board.
The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct, from a comment by Wolfgang on 03/06/2009
- replace the upper-case typedef'ed C struct names with lower case non-typedef'ed ones, from a comment by Scott on 22/06/2009
- make sure registers are accessed using the proper accessor functions, from a comment by Wolfgang on 03/06/2009
- run checkpatch.pl and fix any error reports
The patches were tested after applying patches 1-4. Testing was done by running MAKEALL for all ARM9 targets and checking that no new warnings or errors were introduced.
--- drivers/mtd/nand/s3c2410_nand.c | 62 +++++++++++++++----------------------- 1 files changed, 25 insertions(+), 37 deletions(-)
drivers/mtd/nand/s3c2410_nand.c +25 -37
@@ -20,29 +20,10 @@#include <common.h> -#if 0 -#define DEBUGN printf -#else -#define DEBUGN(x, args ...) {} -#endif -#include <nand.h> #include <s3c2410.h> #include <asm/io.h> -#define __REGb (x) (*(volatile unsigned char *)(x)) -#define __REGi (x) (*(volatile unsigned int *)(x)) - -#define NF_BASE 0x4e000000 -#define NFCONF __REGi(NF_BASE + 0x0) -#define NFCMD __REGb(NF_BASE + 0x4) -#define NFADDR __REGb(NF_BASE + 0x8) -#define NFDATA __REGb(NF_BASE + 0xc) -#define NFSTAT __REGb(NF_BASE + 0x10) -#define NFECC0 __REGb(NF_BASE + 0x14) -#define NFECC1 __REGb(NF_BASE + 0x15) -#define NFECC2 __REGb(NF_BASE + 0x16) -#define S3C2410_NFCONF_EN (1<<15)#define S3C2410_NFCONF_512BYTE (1<<14)#define S3C2410_NFCONF_4STEP (1<<13)
@@ -58,11 +39,12 @@static void s3c2410_hwcontrol (struct mtd_info *mtd,int cmd,unsigned int ctrl) {struct nand_chip *chip = mtd->priv; +struct s3c2410_nand *nand =S3C2410_GetBase_NAND (); -DEBUGN ("hwcontrol(): 0x%02x 0x%02x\n" , cmd, ctrl); +debugX (1 ,"hwcontrol(): 0x%02x 0x%02x\n" , cmd, ctrl);if (ctrl &NAND_CTRL_CHANGE ) { -ulong IO_ADDR_W =NF_BASE ; +ulong IO_ADDR_W = (ulong )nand;if (!(ctrl &NAND_CLE ))IO_ADDR_W |=S3C2410_ADDR_NCLE ;
@@ -72,9 +54,11 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) chip->IO_ADDR_W = (void *)IO_ADDR_W ;if (ctrl &NAND_NCE ) -NFCONF &= ~S3C2410_NFCONF_nFCE; +writel (readl (&nand->NFCONF) & ~S3C2410_NFCONF_nFCE, + &nand->NFCONF);else -NFCONF |= S3C2410_NFCONF_nFCE; +writel (readl (&nand->NFCONF) | S3C2410_NFCONF_nFCE, + &nand->NFCONF); }if (cmd !=NAND_CMD_NONE )
@@ -83,15 +67,17 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)static int s3c2410_dev_ready (struct mtd_info *mtd) { -DEBUGN ("dev_ready\n" ); -return (NFSTAT &0x01 ); +struct s3c2410_nand *nand =S3C2410_GetBase_NAND (); +debugX (1 ,"dev_ready\n" ); +return readl (&nand->NFSTAT) &0x01 ; }#ifdef CONFIG_S3C2410_NAND_HWECC void s3c2410_nand_enable_hwecc (struct mtd_info *mtd,int mode) { -DEBUGN ("s3c2410_nand_enable_hwecc(%p, %d)\n" , mtd, mode); -NFCONF |=S3C2410_NFCONF_INITECC ; +struct s3c2410_nand *nand =S3C2410_GetBase_NAND (); +debugX (1 ,"s3c2410_nand_enable_hwecc(%p, %d)\n" , mtd, mode); +writel (readl (&nand->NFCONF) |S3C2410_NFCONF_INITECC , &nand->NFCONF); } static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
@@ -100,8 +86,8 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, ecc_code[0 ] =NFECC0 ; ecc_code[1 ] =NFECC1 ; ecc_code[2 ] =NFECC2 ; -DEBUGN ("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n" , - mtd , ecc_code[0 ], ecc_code[1 ], ecc_code[2 ]); +debugX (1 ,"s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n" , + mtd , ecc_code[0 ], ecc_code[1 ], ecc_code[2 ]);return 0 ; }
@@ -123,24 +109,26 @@ int board_nand_init(struct nand_chip *nand) {u_int32_t cfg;u_int8_t tacls, twrph0, twrph1; -S3C24X0_CLOCK_POWER *const clk_power =S3C24X0_GetBase_CLOCK_POWER (); +struct s3c24x0_clock_power *clk_power =S3C24X0_GetBase_CLOCK_POWER (); +struct s3c2410_nand *nand_reg =S3C2410_GetBase_NAND (); -DEBUGN ("board_nand_init()\n" ); +debugX (1 ,"board_nand_init()\n" ); - clk_power->CLKCON |= (1 <<4 ); +writel (readl (&clk_power->CLKCON) | (1 <<4 ), &clk_power->CLKCON);/* initialize hardware */ - twrph0 =3 ; twrph1 =0 ; tacls =0 ; + twrph0 =3 ; + twrph1 =0 ; + tacls =0 ; cfg =S3C2410_NFCONF_EN ; cfg |=S3C2410_NFCONF_TACLS (tacls -1 ); cfg |=S3C2410_NFCONF_TWRPH0 (twrph0 -1 ); cfg |=S3C2410_NFCONF_TWRPH1 (twrph1 -1 ); - -NFCONF = cfg; +writel (cfg, &nand_reg->NFCONF);/* initialize nand_chip data structure */ - nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)0x4e00000c ; + nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)&nand_reg->NFDATA;/* read_buf and write_buf are default */ /* read_byte and write_byte are default */
@@ -165,7 +153,7 @@ int board_nand_init(struct nand_chip *nand) nand->options =0 ;#endif -DEBUGN ("end of nand_init\n" ); +debugX (1 ,"end of nand_init\n" );return 0 ; }
Signature · 1 line
1.6.0.6
[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7
Patches 5 to 7, replace "[PATCH-ARM 2/2] Add support for the Embest SBC2440-II Board 2/2" submitted on 19/06/2009.
This patch adds support for the s3c2440 cpu, excluding the NAND driver which is in patch 6/7.
This patch assume the following patches have already been applied:
- [PATCH-ARM] Bug-fix in drivers mtd nand Makefile, sent 18/06/2009
- [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards, sent 21/06/2009
The patch was tested by running MAKEALL for all ARM9 targets and checking that no new warnings or errors were introduced.
--- common/serial.c | 4 +- cpu/arm920t/s3c24x0/Makefile | 2 + cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S | 81 +++++++++++++ cpu/arm920t/s3c24x0/speed.c | 41 +++++-- cpu/arm920t/s3c24x0/timer.c | 20 +--- cpu/arm920t/s3c24x0/usb.c | 17 +-- cpu/arm920t/s3c24x0/usb_ohci.c | 11 +-- cpu/arm920t/start.S | 39 +------ drivers/i2c/s3c24x0_i2c.c | 18 ++-- drivers/mtd/nand/s3c2410_nand.c | 2 +- drivers/rtc/s3c24x0_rtc.c | 7 +- drivers/serial/serial_s3c24x0.c | 6 +- drivers/usb/host/ohci-hcd.c | 3 +- include/common.h | 5 +- include/configs/VCMA9.h | 4 +- include/configs/sbc2410x.h | 4 +- include/configs/smdk2400.h | 4 +- include/configs/smdk2410.h | 4 +- include/configs/trab.h | 4 +- include/s3c2410.h | 25 ++++ include/s3c2440.h | 162 ++++++++++++++++++++++++++ include/s3c24x0.h | 94 ++++++++++++++- include/s3c24x0_cpu.h | 29 +++++ 23 files changed, 468 insertions(+), 118 deletions(-) create mode 100644 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S create mode 100644 include/s3c2440.h create mode 100644 include/s3c24x0_cpu.h
common/serial.c +2 -2
@@ -58,7 +58,7 @@ struct serial_device *__default_serial_console (void)#else return &serial0_device;#endif -#elif defined(CONFIG_S3C2410) +#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)#if defined(CONFIG_SERIAL1 )return &s3c24xx_serial0_device;#elif defined(CONFIG_SERIAL2 )
@@ -133,7 +133,7 @@ void serial_initialize (void)#if defined (CONFIG_STUART )serial_register (&serial_stuart_device);#endif -#if defined(CONFIG_S3C2410 ) +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )serial_register (&s3c24xx_serial0_device);serial_register (&s3c24xx_serial1_device);serial_register (&s3c24xx_serial2_device);
cpu/arm920t/s3c24x0/Makefile +2 -0
@@ -25,6 +25,8 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a +SOBJS += arch_pre_lowlevel_init.o + COBJS += speed.o COBJS += timer.o COBJS += usb.o
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +81 -0
81 lines not on this page · raw message
cpu/arm920t/s3c24x0/speed.c +31 -10
68 lines not on this page · raw message
cpu/arm920t/s3c24x0/timer.c +5 -15
@@ -30,17 +30,10 @@*/ #include <common.h> -#if defined(CONFIG_S3C2400 ) || \ - defined(CONFIG_S3C2410 ) || \ - defined(CONFIG_TRAB ) +#ifdef CONFIG_S3C24X0 #include <asm/io.h> - -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#include <s3c24x0_cpu.h> static unsigned long get_timer_raw (void );int timer_load_val =0 ;
@@ -192,8 +185,8 @@ ulong get_tbclk(void)#if defined(CONFIG_SMDK2400 ) || defined(CONFIG_TRAB ) tbclk = timer_load_val *100 ; -#elif defined(CONFIG_SBC2410X ) || \ - defined(CONFIG_SMDK2410 ) || \ +#elif defined(CONFIG_SBC2410X ) || \ + defined(CONFIG_SMDK2410 ) || \ defined(CONFIG_VCMA9 ) tbclk =CONFIG_SYS_HZ ;#else
@@ -239,7 +232,4 @@ void s3c2410_irq(void) }#endif /* USE_IRQ */ -#endif /* defined(CONFIG_S3C2400) || -defined (CONFIG_S3C2410) || -defined (CONFIG_TRAB) */ - +#endif /* CONFIG_S3C24X0 */
cpu/arm920t/s3c24x0/usb.c +7 -10
@@ -23,15 +23,11 @@#include <common.h> -#if defined(CONFIG_USB_OHCI_NEW ) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT ) -# if defined(CONFIG_S3C2400 ) || defined(CONFIG_S3C2410 ) - -#if defined(CONFIG_S3C2400 ) -# include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -# include <s3c2410.h> -#endif +#if defined(CONFIG_USB_OHCI_NEW ) && \ + defined(CONFIG_SYS_USB_OHCI_CPU_INIT ) && \ + defined(CONFIG_S3C24X0 ) +#include <s3c24x0_cpu.h> #include <asm/io.h> int usb_cpu_init (void )
@@ -70,5 +66,6 @@ int usb_cpu_init_fail(void) return 0; } -# endif /* defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) */ -#endif /* defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */ +#endif /* defined(CONFIG_USB_OHCI_NEW) && \ +defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \ +defined(CONFIG_S3C24X0) */
cpu/arm920t/s3c24x0/usb_ohci.c +3 -8
@@ -36,14 +36,9 @@#include <common.h> /* #include <pci.h> no PCI on the S3C24X0 */ -#ifdef CONFIG_USB_OHCI - -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#if defined(CONFIG_USB_OHCI ) && defined(CONFIG_S3C24X0 ) +#include <s3c24x0_cpu.h> #include <asm/io.h> #include <malloc.h> #include <usb.h>
@@ -1750,4 +1745,4 @@ int usb_lowlevel_stop(void) return 0; } -#endif /* CONFIG_USB_OHCI */ +#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0) */
cpu/arm920t/start.S +3 -36
@@ -132,42 +132,9 @@ copyex: bne copyex #endif -#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) - /* turn off the watchdog */ - -# if defined(CONFIG_S3C2400) -# define pWTCON 0x15300000 -# define INTMSK 0x14400008 /* Interupt-Controller base addresses */ -# define CLKDIVN 0x14800014 /* clock divisor register */ -#else -# define pWTCON 0x53000000 -# define INTMSK 0x4A000008 /* Interupt-Controller base addresses */ -# define INTSUBMSK 0x4A00001C -# define CLKDIVN 0x4C000014 /* clock divisor register */ -# endif - - ldr r0, =pWTCON - mov r1, #0x0 - str r1, [r0] - - /* - * mask all IRQs by setting all bits in the INTMR - default - */ - mov r1, #0xffffffff - ldr r0, =INTMSK - str r1, [r0] -# if defined(CONFIG_S3C2410) - ldr r1, =0x3ff - ldr r0, =INTSUBMSK - str r1, [r0] -# endif - - /* FCLK:HCLK:PCLK = 1:2:4 */ - /* default FCLK is 120 MHz ! */ - ldr r0, =CLKDIVN - mov r1, #3 - str r1, [r0] -#endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */ +#ifdef CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT + bl arch_pre_lowlevel_init +#endif /* * we do sys-critical inits only at reboot,
drivers/i2c/s3c24x0_i2c.c +8 -10
@@ -27,12 +27,9 @@*/ #include <common.h> -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#ifdef CONFIG_S3C24X0 +#include <s3c24x0_cpu.h> #include <asm/io.h> #include <i2c.h>
@@ -61,7 +58,7 @@ static int GetI2CSDA(void) {struct s3c24x0_gpio *gpio =S3C24X0_GetBase_GPIO (); -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )return (readl (&gpio->GPEDAT) &0x8000 ) >>15 ;#endif #ifdef CONFIG_S3C2400
@@ -80,7 +77,7 @@ static void SetI2CSCL(int x) {struct s3c24x0_gpio *gpio =S3C24X0_GetBase_GPIO (); -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )writel ((readl (&gpio->GPEDAT) & ~0x4000 ) | (x &1 ) <<14 , &gpio->GPEDAT);#endif #ifdef CONFIG_S3C2400
@@ -132,7 +129,7 @@ void i2c_init(int speed, int slaveadd) }if ((readl (&i2c->IICSTAT) &I2CSTAT_BSY ) ||GetI2CSDA () ==0 ) { -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )ulong old_gpecon =readl (&gpio->GPECON);#endif #ifdef CONFIG_S3C2400
@@ -141,7 +138,7 @@ void i2c_init(int speed, int slaveadd)/* bus still busy probably by (most) previously interrupted transfer */ -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )/* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */ writel ((readl (&gpio->GPECON) & ~0xF0000000 ) |0x10000000 , &gpio->GPECON);
@@ -167,7 +164,7 @@ void i2c_init(int speed, int slaveadd)udelay (1000 );/* restore pin functions */ -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )writel (old_gpecon, &gpio->GPECON);#endif #ifdef CONFIG_S3C2400
@@ -445,3 +442,4 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) len) != 0); }#endif /* CONFIG_HARD_I2C */ +#endif /* CONFIG_S3C24X0 */
drivers/mtd/nand/s3c2410_nand.c +1 -1
@@ -21,7 +21,7 @@#include <common.h> #include <nand.h> -#include <s3c2410.h> +#include <s3c24x0_cpu.h> #include <asm/io.h> #define S3C2410_NFCONF_EN (1<<15)
drivers/rtc/s3c24x0_rtc.c +1 -6
@@ -30,12 +30,7 @@#if (defined(CONFIG_CMD_DATE )) -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif - +#include <s3c24x0_cpu.h> #include <rtc.h> #include <asm/io.h>
drivers/serial/serial_s3c24x0.c +1 -5
@@ -19,11 +19,7 @@*/ #include <common.h> -#if defined(CONFIG_S3C2400 ) || defined(CONFIG_TRAB ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#include <s3c24x0_cpu.h> DECLARE_GLOBAL_DATA_PTR ;
drivers/usb/host/ohci-hcd.c +1 -2
@@ -65,8 +65,7 @@#endif #if defined(CONFIG_ARM920T) || \ - defined(CONFIG_S3C2400) || \ - defined(CONFIG_S3C2410) || \ + defined(CONFIG_S3C24X0) || \ defined(CONFIG_S3C6400) || \ defined(CONFIG_440EP) || \ defined(CONFIG_PCI_OHCI) || \
include/common.h +3 -2
@@ -491,8 +491,9 @@ int prt_mpc8220_clks (void);ulong get_OPB_freq (void );ulong get_PCI_freq (void );#endif -#if defined(CONFIG_S3C2400 ) || defined(CONFIG_S3C2410 ) || \ - defined(CONFIG_LH7A40X ) || defined(CONFIG_S3C6400 ) +#if defined(CONFIG_S3C24X0 ) || \ + defined(CONFIG_LH7A40X ) || \ + defined(CONFIG_S3C6400 )void s3c2410_irq (void );#define ARM920_IRQ_CALLBACK s3c2410_irqulong get_FCLK (void );
include/configs/VCMA9.h +3 -1
@@ -34,8 +34,10 @@* (easy to change) */ #define CONFIG_ARM920T 1/* This is an ARM920T Core */ -#define CONFIG_S3C2410 1/* in a SAMSUNG S3C2410 SoC */ +#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C24x0-type SoC */ +#define CONFIG_S3C2410 1/* specifically a SAMSUNG S3C2410 SoC */ #define CONFIG_VCMA9 1/* on a MPL VCMA9 Board */ +#define CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT /* input clock of PLL */ #define CONFIG_SYS_CLK_FREQ 12000000/* VCMA9 has 12MHz input clock */
include/configs/sbc2410x.h +3 -1
@@ -44,8 +44,10 @@* (easy to change) */ #define CONFIG_ARM920T 1/* This is an ARM920T Core */ -#define CONFIG_S3C2410 1/* in a SAMSUNG S3C2410 SoC */ +#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C24x0-type SoC */ +#define CONFIG_S3C2410 1/* specifically a SAMSUNG S3C2410 SoC */ #define CONFIG_SBC2410X 1/* on a friendly-arm SBC-2410X Board */ +#define CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT /* input clock of PLL */ #define CONFIG_SYS_CLK_FREQ 12000000/* the SBC2410X has 12MHz input clock */
include/configs/smdk2400.h +3 -1
@@ -35,8 +35,10 @@* (easy to change) */ #define CONFIG_ARM920T 1/* This is an ARM920T core */ -#define CONFIG_S3C2400 1/* in a SAMSUNG S3C2400 SoC */ +#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C24x0-type SoC */ +#define CONFIG_S3C2400 1/* specifically a SAMSUNG S3C2400 SoC */ #define CONFIG_SMDK2400 1/* on an SAMSUNG SMDK2400 Board */ +#define CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT /* input clock of PLL */ #define CONFIG_SYS_CLK_FREQ 12000000/* SMDK2400 has 12 MHz input clock */
include/configs/smdk2410.h +3 -1
@@ -34,8 +34,10 @@* (easy to change) */ #define CONFIG_ARM920T 1/* This is an ARM920T Core */ -#define CONFIG_S3C2410 1/* in a SAMSUNG S3C2410 SoC */ +#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C24x0-type SoC */ +#define CONFIG_S3C2410 1/* specifically a SAMSUNG S3C2410 SoC */ #define CONFIG_SMDK2410 1/* on a SAMSUNG SMDK2410 Board */ +#define CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT /* input clock of PLL */ #define CONFIG_SYS_CLK_FREQ 12000000/* the SMDK2410 has 12MHz input clock */
include/configs/trab.h +3 -1
@@ -41,9 +41,11 @@* (easy to change) */ #define CONFIG_ARM920T 1/* This is an arm920t CPU */ -#define CONFIG_S3C2400 1/* in a SAMSUNG S3C2400 SoC */ +#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C24x0-type SoC */ +#define CONFIG_S3C2400 1/* specifically a SAMSUNG S3C2400 SoC */ #define CONFIG_TRAB 1/* on a TRAB Board */ #undef CONFIG_TRAB_50MHZ/* run the CPU at 50 MHz */ +#define CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT /* automatic software updates (see board/trab/auto_update.c) */ #define CONFIG_AUTO_UPDATE 1
include/s3c2410.h +25 -0
@@ -142,4 +142,29 @@ static inline struct s3c2410_sdi *S3C2410_GetBase_SDI(void) return (struct s3c2410_sdi *)S3C2410_SDI_BASE; } +/* Define the registers and bits to use to operate the NAND flash controller. */ + +/* The NAND control register, */ +#define S3C24X0_NAND_CTRL_REG NFCONF +/* NAND Enable/disable bit. */ +#define S3C24X0_NAND_EN_BIT (1 << 15) +/* NAND CE enable/disable bit, */ +#define S3C24X0_NAND_nFCE_BIT (1 << 11) +/* NAND init ECC bit. */ +#define S3C24X0_NAND_INITECC_BIT (1 << 12) + +/* The NAND timimg register. */ +#define S3C24X0_NAND_TIMING_REG NFCONF +/* NAND TACLS field. */ +#define S3C24X0_NAND_TACLS_BITS (x) ((x) << 8) +/* NAND TWRPH0 field. */ +#define S3C24X0_NAND_TWRPH0_BITS (x) ((x) << 4) +/* NAND TWRPH1 field. */ +#define S3C24X0_NAND_TWRPH1_BITS (x) ((x) << 0) + +/* The NAND ECC register. */ +#define S3C24X0_NAND_ECC_REG NFECC +/* NAND INIT ECC bit. */ +#define S3C24X0_NAND_INITECC_BIT (1 << 12) +#endif /*__S3C2410_H__*/
include/s3c2440.h new file +162 -0
162 lines not on this page · raw message
include/s3c24x0.h +88 -6
152 lines not on this page · raw message
include/s3c24x0_cpu.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* (C) Copyright 2009 +* Kevin Morfitt, Fearnside Systems Ltd, <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifdef CONFIG_S3C2400 +#include <s3c2400.h> +#elif definedCONFIG_S3C2410 +#include <s3c2410.h> +#elif definedCONFIG_S3C2440 +#include <s3c2440.h> +#else +#error Please define the s3c24x0 cpu type +#endif
Signature · 1 line
1.6.1.2
[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7
Quoted 6 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +6
-0+ +#include <config.h> + +#ifdef CONFIG_S3C24X0 + +/* Register addresses. */
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 35
Quoted 10 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +10
-0+# ifdef CONFIG_S3C2400 + #define pWTCON 0x15300000 + #define INTMSK 0x14400008 + #define CLKDIVN 0x14800014 +#else + #define pWTCON 0x53000000 + #define INTMSK 0x4A000008 + #define INTSUBMSK 0x4A00001C + #define CLKDIVN 0x4C000014 +#endif
pplease move this to soc header
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 44
Quoted 9 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +9
-0+ +/* Configuration values. */ +#ifdef CONFIG_S3C2440 + #define INTSMASK 0xffff + #define CLKDIVVAL 0x5 +#else + #define INTSMASK 0x3ff + #define CLKDIVVAL 0x3 +#endif
ditto
Quoted 20 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +20
-0+ +.globl arch_pre_lowlevel_init +arch_pre_lowlevel_init: + + /* turn off the watchdog */ + ldr r0, =pWTCON + mov r1, #0x0 + str r1, [r0] + + /* + * mask all IRQs by setting all bits in the INTMR - default + */ + mov r1, #0xffffffff + ldr r0, =INTMSK + str r1, [r0] +# if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) + ldr r1, =INTSMASK + ldr r0, =INTSUBMSK + str r1, [r0] +# endif
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 74
Quoted 10 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +10
-0+ + /* FCLK:HCLK:PCLK = 1:2:4 */ + /* default FCLK is 120 MHz ! */ + ldr r0, =CLKDIVN + mov r1, #CLKDIVVAL + str r1, [r0] + +#ifdef CONFIG_S3C2440 + /* Set asynchronous bus mode */ + mrc p15, 0, r1, c1, c0, 0 /* read ctrl register */
whitespace please fix
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 75
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ orr r1, r1, #0xc0000000 /* Asynchronous */
whitespace please fix
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 76
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ mcr p15, 0, r1, c1, c0, 0 /* write ctrl register */
whitespace please fix
Quoted 1 line
+#endif /*
CONFIG_S3C2440*/
whitespace please fix
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 81
Quoted 4 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +4
-0+ + mov pc, lr + +#endif /* CONFIG_S3C24X0 */
whitespace please fix
cpu/arm920t/s3c24x0/speed.c static ulong get_PLLCLK(int pllreg)
Quoted 23 lines
cpu/arm920t/s3c24x0/speed.c +2
-7@@ -30,15 +30,10 @@*/ #include <common.h> -#if defined(CONFIG_S3C2400 ) || defined (CONFIG_S3C2410 ) || defined (CONFIG_TRAB ) +#ifdef CONFIG_S3C24X0 #include <asm/io.h> - -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#include <s3c24x0_cpu.h> #define MPLL 0#define UPLL 1@@ -69,6 +64,11 @@ static ulong get_PLLCLK(int pllreg)
please rename it as get_pll_clk_rate
cpu/arm920t/s3c24x0/speed.c ulong get_HCLK(void)
Quoted 12 lines
cpu/arm920t/s3c24x0/speed.c +5
-0p = ((r &0x003F0 ) >>4 ) +2 ; s = r &0x3 ; +#ifdef CONFIG_S3C2440 +if (pllreg ==MPLL ) +return (2 *CONFIG_SYS_CLK_FREQ * m) / (p << s); + else +#endif return (CONFIG_SYS_CLK_FREQ * m) / (p << s); }@@ -83,7 +83,23 @@ ulong get_HCLK(void)
please use this style get_xxx_clk_rate
Best Regards,
J.
[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7
Hi Jean-Christophe
Quoted 58 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +6
-0+ +#include <config.h> + +#ifdef CONFIG_S3C24X0 + +/* Register addresses. */cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 35
Quoted 10 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +10
-0+# ifdef CONFIG_S3C2400 + #define pWTCON 0x15300000 + #define INTMSK 0x14400008 + #define CLKDIVN 0x14800014 +#else + #define pWTCON 0x53000000 + #define INTMSK 0x4A000008 + #define INTSUBMSK 0x4A00001C + #define CLKDIVN 0x4C000014 +#endifpplease move this to soc header
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 44
Quoted 9 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +9
-0+ +/* Configuration values. */ +#ifdef CONFIG_S3C2440 + #define INTSMASK 0xffff + #define CLKDIVVAL 0x5 +#else + #define INTSMASK 0x3ff + #define CLKDIVVAL 0x3 +#endifditto
Quoted 20 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +20
-0+ +.globl arch_pre_lowlevel_init +arch_pre_lowlevel_init: + + /* turn off the watchdog */ + ldr r0, =pWTCON + mov r1, #0x0 + str r1, [r0] + + /* + * mask all IRQs by setting all bits in the INTMR - default + */ + mov r1, #0xffffffff + ldr r0, =INTMSK + str r1, [r0] +# if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) + ldr r1, =INTSMASK + ldr r0, =INTSUBMSK + str r1, [r0] +# endifcpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 74
Quoted 10 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +10
-0+ + /* FCLK:HCLK:PCLK = 1:2:4 */ + /* default FCLK is 120 MHz ! */ + ldr r0, =CLKDIVN + mov r1, #CLKDIVVAL + str r1, [r0] + +#ifdef CONFIG_S3C2440 + /* Set asynchronous bus mode */ + mrc p15, 0, r1, c1, c0, 0 /* read ctrl register */whitespace please fix
Quoted 6 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 75
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ orr r1, r1, #0xc0000000 /* Asynchronous */whitespace please fix
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 76
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ mcr p15, 0, r1, c1, c0, 0 /* write ctrl register */whitespace please fix
Quoted 1 line
+#endif /*
CONFIG_S3C2440*/whitespace please fix
I'm not sure what the problem is - should the comments be indented with a tab?
By the way, I'm on vacation for the next 2 weeks so I won't be able to make the changes before the merge window closes. Do I need to wait until v2009.08 is released and re-base my changes to that?
Quoted 46 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 81
Quoted 4 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +4
-0+ + mov pc, lr + +#endif /* CONFIG_S3C24X0 */whitespace please fix
cpu/arm920t/s3c24x0/speed.c static ulong get_PLLCLK(int pllreg)
Quoted 23 lines
cpu/arm920t/s3c24x0/speed.c +2
-7@@ -30,15 +30,10 @@*/ #include <common.h> -#if defined(CONFIG_S3C2400 ) || defined (CONFIG_S3C2410 ) || defined (CONFIG_TRAB ) +#ifdef CONFIG_S3C24X0 #include <asm/io.h> - -#if defined(CONFIG_S3C2400 ) -#include <s3c2400.h> -#elif defined(CONFIG_S3C2410 ) -#include <s3c2410.h> -#endif +#include <s3c24x0_cpu.h> #define MPLL 0#define UPLL 1@@ -69,6 +64,11 @@ static ulong get_PLLCLK(int pllreg)please rename it as
get_pll_clk_ratecpu/arm920t/s3c24x0/speed.c ulong get_HCLK(void)
Quoted 12 lines
cpu/arm920t/s3c24x0/speed.c +5
-0p = ((r &0x003F0 ) >>4 ) +2 ; s = r &0x3 ; +#ifdef CONFIG_S3C2440 +if (pllreg ==MPLL ) +return (2 *CONFIG_SYS_CLK_FREQ * m) / (p << s); + else +#endif return (CONFIG_SYS_CLK_FREQ * m) / (p << s); }@@ -83,7 +83,23 @@ ulong get_HCLK(void)please use this style
get_xxx_clk_rateBest Regards,
J.
[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7
Quoted 24 lines
Quoted 24 lines
Quoted 11 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +11
-0+ /* + * mask all IRQs by setting all bits in the INTMR - default + */ + mov r1, #0xffffffff + ldr r0, =INTMSK + str r1, [r0] +# if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) + ldr r1, =INTSMASK + ldr r0, =INTSUBMSK + str r1, [r0] +# endifcpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 74
Quoted 10 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +10
-0+ + /* FCLK:HCLK:PCLK = 1:2:4 */ + /* default FCLK is 120 MHz ! */ + ldr r0, =CLKDIVN + mov r1, #CLKDIVVAL + str r1, [r0] + +#ifdef CONFIG_S3C2440 + /* Set asynchronous bus mode */ + mrc p15, 0, r1, c1, c0, 0 /* read ctrl register */whitespace please fix
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 75
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ orr r1, r1, #0xc0000000 /* Asynchronous */whitespace please fix
Quoted 7 lines
Quoted 4 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 76
Quoted 1 line
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +1
-0+ mcr p15, 0, r1, c1, c0, 0 /* write ctrl register */whitespace please fix
Quoted 1 line
+#endif /*
CONFIG_S3C2440*/whitespace please fix
I'm not sure what the problem is - should the comments be indented with a tab?
no with space here
Quoted 4 lines
By the way, I'm on vacation for the next 2 weeks so I won't be able to make the changes before the merge window closes. Do I need to wait until v2009.08 is released and re-base my changes to that?
after the merge will be close I'll open the next branch and depending on the time I may ask to have it for this release to wd
Quoted 5 lines
Quoted 5 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S line 81
Quoted 5 lines
cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S new file +4
-0+ + mov pc, lr + +#endif /* CONFIG_S3C24X0 */
Best Regards,
J.