s3c2412 support
Subsystems (2)
PATCH 1/1 s3c2412 support
From: Koen Martens <[email protected]>
Changes are:
- Added s3c2412-specific files to arch/arm/mach-s3c2410
- Added s3c2412 detection to arch/arm/mach-s3c2410/cpu.c
- Added CONFIG_CPU_S3C2412
- Added s3c2412 specific registers and register addresses to various regs-*.h files in include/asm-arm/arch-s3c2410
All changes are preliminary, final documentation is not yet available from samsung. We did test on actual hardware, but outside the linux kernel (due to limited number of actual chips we have available and lack of proper PCB with serial lines exported).
Have fun,
Koen Martens
Signature · 5 lines
K.F.J. Martens, Sonologic, http://www.sonologic.nl/ Networking, hosting, embedded systems, unix, artificial intelligence. Public PGP key: http://www.metro.cx/pubkey-gmc.asc Wondering about the funny attachment your mail program can't read? Visit http://www.openpgp.org/
--- linux-2.6.15.4/arch/arm/mach-s3c2410/Kconfig 2006-02-10 08:22:48.000000000 +0100
+++ golinux/arch/arm/mach-s3c2410/Kconfig 2006-02-27 16:23:34.000000000 +0100
+config CPU_S3C2412
+ bool
+ depends on ARCH_S3C2410
+ help
+ Support for S3C2412 and S3C2413 family from the S3C24XX line
+ of Samsung Mobile CPUs.
+
config CPU_S3C2440
bool
depends on ARCH_S3C2410
arch/arm/mach-s3c2410/Makefile +6 -0
@@ -20,24 +20,26 @@ obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o +# S3C2412 support + +obj-$(CONFIG_CPU_S3C2412) += s3c2412.o s3c2440-dsc.o +# obj-$(CONFIG_CPU_S3C2412) += s3c2412-irq.o +# obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o + # S3C2440 support obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o
arch/arm/mach-s3c2410/cpu.c +36 -4
@@ -41,6 +41,7 @@#include "cpu.h" #include "clock.h" #include "s3c2410.h" +#include "s3c2412.h" #include "s3c2440.h" struct cpu_table {
@@ -58,7 +59,9 @@static const char name_s3c2410[] ="S3C2410" ;static const char name_s3c2440[] ="S3C2440" ;static const char name_s3c2410a[] ="S3C2410A" ; +static const char name_s3c2412[] ="S3C2412" ;static const char name_s3c2440a[] ="S3C2440A" ; +static const char name_s3c2442x[] ="S3C2442X" ;static struct cpu_table cpu_ids[]__initdata = { {
@@ -96,6 +99,27 @@ .init_uarts = s3c2440_init_uarts, .init = s3c2440_init, .name = name_s3c2440a + }, + { + .idcode = 0x32440aaa, + .idmask = 0xffffffff, + .map_io = s3c2440_map_io, + .init_clocks = s3c2440_init_clocks, + .init_uarts = s3c2440_init_uarts, + .init = s3c2440_init, + .name = name_s3c2442x + } +}; + +static struct cpu_table alternative_cpu_ids[]__initdata = { + { + .idcode =0x32410002 , + .idmask =0xffffffff , + .map_io = s3c2412_map_io, + .init_clocks = s3c2412_init_clocks, + .init_uarts = s3c2412_init_uarts, + .init = s3c2412_init, + .name = name_s3c2412 } };
@@ -110,13 +134,16 @@static struct cpu_table * -s3c_lookup_cpu (unsigned long idcode) +s3c_lookup_cpu (unsigned long idcode,int alt) {struct cpu_table *tab;int count; +int size; - tab = cpu_ids; -for (count =0 ; count <ARRAY_SIZE (cpu_ids); count++, tab++) { + tab = alt?alternative_cpu_ids:cpu_ids; + size = alt?ARRAY_SIZE (alternative_cpu_ids):ARRAY_SIZE (cpu_ids); + +for (count =0 ; count < size; count++, tab++) {if ((idcode & tab->idmask) == tab->idcode)return tab; }
@@ -154,7 +181,12 @@iotable_init (s3c_iodesc,ARRAY_SIZE (s3c_iodesc)); idcode =__raw_readl (S3C2410_GSTATUS1 ); - cpu =s3c_lookup_cpu (idcode); + cpu =s3c_lookup_cpu (idcode,0 ); + +if (cpu ==NULL ) { + idcode =__raw_readl (S3C2412_GSTATUS1 ); + cpu =s3c_lookup_cpu (idcode,1 ); + }if (cpu ==NULL ) {printk (KERN_ERR "Unknown CPU type 0x%08lx\n" , idcode);
include/asm-arm/arch-s3c2410/hardware.h +3 -0
@@ -86,18 +86,17 @@extern void s3c2410_gpio_pullup (unsigned int pin,unsigned int to);extern void s3c2410_gpio_setpin (unsigned int pin,unsigned int to);extern unsigned int s3c2410_gpio_getpin (unsigned int pin);extern unsigned int s3c2410_modify_misccr (unsigned int clr,unsigned int chg); +#ifdef CONFIG_CPU_S3C2412 +extern unsigned int s3c2412_modify_misccr (unsigned int clr,unsigned int chg); +#endif #endif /* __ASSEMBLY__ */
include/asm-arm/arch-s3c2410/regs-clock.h +35 -0
@@ -112,6 +112,25 @@ return (unsigned int)fvco; } +#ifdef CONFIG_CPU_S3C2412 +static inline unsigned int +s3c2412_get_pll (int pllval,int baseclk) +{ +int mdiv, pdiv, sdiv; + + mdiv = pllval >>S3C2410_PLLCON_MDIVSHIFT ; + pdiv = pllval >>S3C2410_PLLCON_PDIVSHIFT ; + sdiv = pllval >>S3C2410_PLLCON_SDIVSHIFT ; + + mdiv &=S3C2410_PLLCON_MDIVMASK ; + pdiv &=S3C2410_PLLCON_PDIVMASK ; + sdiv &=S3C2410_PLLCON_SDIVMASK ; + +return (baseclk * ((mdiv +8 )<<1 ) ) / ((pdiv +2 ) << sdiv); + } +#endif /* CONFIG_CPU_S3C2412 */ + +#endif /* __ASSEMBLY__ */ #ifdef CONFIG_CPU_S3C2440
@@ -138,5 +157,21 @@#endif /* CONFIG_CPU_S3C2440 */ +#ifdef CONFIG_CPU_S3C2412 + +#define S3C2412_CLKDIVN_HCLKDIV_MASK (3<<0) +#define S3C2412_CLKDIVN_HCLKDIV_1_2 (0<<0) +#define S3C2412_CLKDIVN_HCLKDIV_2_4 (1<<0) +#define S3C2412_CLKDIVN_HCLKDIV_3_6 (2<<0) +#define S3C2412_CLKDIVN_HCLKDIV_4_8 (3<<0) +#define S3C2412_CLKDIVN_PCLKDIV (1<<2) +#define S3C2412_CLKDIVN_ARMDIV (1<<3) +#define S3C2412_CLKDIVN_DVSEN (1<<4) +#define S3C2412_CLKDIVN_HALFHCLK (1<<5) +#define S3C2412_CLKDIVN_USB48DIV (1<<6) +#define S3C2412_CLKDIVN_UARTCLK_MASK (15<<8) +#define S3C2412_CLKDIVN_I2SCLK_MASK (15<<12) + +#endif /* CONFIG_CPU_S3C2412 */ #endif /* __ASM_ARM_REGS_CLOCK */
include/asm-arm/arch-s3c2410/regs-dsc.h +170 -0
181 lines not on this page · raw message
include/asm-arm/arch-s3c2410/regs-gpio.h +4 -0
@@ -22,6 +22,7 @@* 28-Mar-2005 LCVR Fixed definition of GPB10 * 26-Oct-2005 BJD Added generic configuration types * 27-Nov-2005 LCVR Added definitions to S3C2400 registers +* 27-Feb-2006 KM Added definitions to S3C2412 registers */
@@ -183,10 +184,12 @@#define S3C2410_GPBCON S3C2410_GPIOREG(0x10)#define S3C2410_GPBDAT S3C2410_GPIOREG(0x14)#define S3C2410_GPBUP S3C2410_GPIOREG(0x18)#define S3C2400_GPBCON S3C2410_GPIOREG(0x08)#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C)#define S3C2400_GPBUP S3C2410_GPIOREG(0x10) +#ifdef CONFIG_CPU_S3C2412 +#define S3C2410_GPBSLPCON S3C2410_GPIOREG(0x1c) +#endif /* no i/o pin in port b can have value 3! */
@@ -306,6 +309,10 @@
#define S3C2400_GPCDAT S3C2410_GPIOREG(0x18)
#define S3C2400_GPCUP S3C2410_GPIOREG(0x1C)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2410_GPCSLPCON S3C2410_GPIOREG(0x2c)
+#endif
+
#define S3C2410_GPC0 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 0)
#define S3C2410_GPC0_INP (0x00 << 0)
#define S3C2410_GPC0_OUTP (0x01 << 0)
@@ -423,6 +430,10 @@
#define S3C2400_GPDDAT S3C2410_GPIOREG(0x24)
#define S3C2400_GPDUP S3C2410_GPIOREG(0x28)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2410_GPDSLPCON S3C2410_GPIOREG(0x3c)
+#endif
+
#define S3C2410_GPD0 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 0)
#define S3C2410_GPD0_INP (0x00 << 0)
#define S3C2410_GPD0_OUTP (0x01 << 0)
@@ -537,6 +548,10 @@
#define S3C2400_GPEDAT S3C2410_GPIOREG(0x30)
#define S3C2400_GPEUP S3C2410_GPIOREG(0x34)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2410_GPESLPCON S3C2410_GPIOREG(0x4c)
+#endif
+
#define S3C2410_GPE0 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 0) #define S3C2410_GPE0_INP (0x00 << 0) #define S3C2410_GPE0_OUTP (0x01 << 0)
@@ -870,6 +885,10 @@
#define S3C2410_GPHDAT S3C2410_GPIOREG(0x74)
#define S3C2410_GPHUP S3C2410_GPIOREG(0x78)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2410_GPHSLPCON S3C2410_GPIOREG(0x7c)
+#endif
+
#define S3C2410_GPH0 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 0) #define S3C2410_GPH0_INP (0x00 << 0) #define S3C2410_GPH0_OUTP (0x01 << 0)
@@ -932,6 +951,11 @@
#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2412_MISCCR S3C2410_GPIOREG(0x90)
+#define S3C2412_DCLKCON S3C2410_GPIOREG(0x94)
+#endif
+
/* see clock.h for dclk definitions */
/* pullup control on databus */
@@ -948,6 +972,18 @@
#define S3C2400_MISCCR_HZ_STOPEN (0<<2)
#define S3C2400_MISCCR_HZ_STOPPREV (1<<2)
+#ifdef CONFIG_CPU_S3C2412
+
+#define S3C2412_MISCCR_SPUCR_HEN (0) +#define S3C2412_MISCCR_SPUCR_HDIS (1<<1) +#define S3C2412_MISCCR_SPUCR_LEN (0) +#define S3C2412_MISCCR_SPUCR_LDIS (1<<0)
+
+#define S3C2412_MISCCR_SPUCR2_EN (0<<2)
+#define S3C2412_MISCCR_SPUCR2_DIS (1<<2)
+
+#endif
+
#define S3C2410_MISCCR_USBDEV (0<<3)
#define S3C2410_MISCCR_USBHOST (1<<3)
@@ -989,6 +1025,12 @@
#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2412_EXTINT0 S3C2410_GPIOREG(0x98) +#define S3C2412_EXTINT1 S3C2410_GPIOREG(0x9C) +#define S3C2412_EXTINT2 S3C2410_GPIOREG(0xA0)
+#endif
+
/* values for S3C2410_EXTINT0/1/2 */
#define S3C2410_EXTINT_LOWLEV (0x00)
#define S3C2410_EXTINT_HILEV (0x01)
@@ -1002,6 +1044,13 @@
#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C)
#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0)
+#ifdef CONFIG_CPU_S3C2412
+#define S3C2412_EINFLT0 S3C2410_GPIOREG(0xA4) +#define S3C2412_EINFLT1 S3C2410_GPIOREG(0xA8) +#define S3C2412_EINFLT2 S3C2410_GPIOREG(0xAc) +#define S3C2412_EINFLT3 S3C2410_GPIOREG(0xB0)
+#endif
+
/* values for interrupt filtering */
#define S3C2410_EINTFLT_PCLK (0x00)
#define S3C2410_EINTFLT_EXTCLK (1<<7)
@@ -1019,6 +1068,17 @@
#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8)
#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC)
+#ifdef CONFIG_CPU_S3C2412
+
+#define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC) +#define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0) +#define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4) +#define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8) +#define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC) +#define S3C2412_GSTATUS5 S3C2410_GPIOREG(0x0D0)
+
+#endif
+
#define S3C2410_GSTATUS0_nWAIT (1<<3)
#define S3C2410_GSTATUS0_NCON (1<<2)
#define S3C2410_GSTATUS0_RnB (1<<1)
include/asm-arm/arch-s3c2410/regs-iis.h +97 -0
107 lines not on this page · raw message
include/asm-arm/arch-s3c2410/regs-irq.h +8 -0
@@ -13,6 +13,7 @@* 19-06-2003 BJD Created file * 12-03-2004 BJD Updated include protection * 10-03-2005 LCVR Changed S3C2410_VA to S3C24XX_VA +* 17-02-2006 KM Added S3C2412/S3C2413 defines */
@@ -41,4 +42,11 @@#define S3C2410_EINTMASK S3C2410_EINTREG(0x0A4)#define S3C2410_EINTPEND S3C2410_EINTREG(0X0A8) +#ifdef CONFIG_CPU_S3C2412 + +#define S3C2412_EINTMASK S3C2410_EINTREG(0x0B4) +#define S3C2412_EINTPEND S3C2410_EINTREG(0X0B8) + +#endif /* CONFIG_CPU_S3C2412 */ +#endif /* ___ASM_ARCH_REGS_IRQ_H */
include/asm-arm/arch-s3c2410/regs-rtc.h +12 -0
@@ -13,6 +13,7 @@* 19-06-2003 BJD Created file * 12-03-2004 BJD Updated include protection * 15-01-2005 LCVR Changed S3C2410_VA to S3C24XX_VA (s3c2400 support) +* 17-02-2006 KM Added S3C2412 / S3C2413 registers */ #ifndef __ASM_ARCH_REGS_RTC_H
@@ -25,11 +26,22 @@#define S3C2410_RTCCON_CLKSEL (1<<1)#define S3C2410_RTCCON_CNTSEL (1<<2)#define S3C2410_RTCCON_CLKRST (1<<3) +#define S3C2410_RTCCON_TICSEL (1<<4)#define S3C2410_TICNT S3C2410_RTCREG(0x44)#define S3C2410_TICNT_ENABLE (1<<7) +#define S3C2410_TICNT0 S3C2410_TICNT +#define S3C2410_TICNT0_ENABLE (1<<7) + +#ifdef CONFIG_CPU_S3C2412 + +#define S3C2410_TICNT1 S3C2410_RTCREG(0x4C) // S3C2412 & S3C2413 + +#endif /* CONFIG_CPU_S3C2412 */ +#define S3C2410_RTCALM S3C2410_RTCREG(0x50) +#define S3C2410_RTCALM_XTBSEL (1<<7)#define S3C2410_RTCALM_ALMEN (1<<6)#define S3C2410_RTCALM_YEAREN (1<<5)#define S3C2410_RTCALM_MONEN (1<<4)
arch/arm/mach-s3c2410/s3c2412-dsc.c +60 -0
60 lines not on this page · raw message
arch/arm/mach-s3c2410/s3c2412.c +276 -0
276 lines not on this page · raw message
arch/arm/mach-s3c2410/s3c2412.h +36 -0
@@ -0,0 +1,36 @@ +/* arch/arm/mach-s3c2410/s3c2440.h +* +* Copyright (c) 2004-2005 Simtec Electronics +* Ben Dooks <[email protected]> +* +* Header file for s3c2412 cpu support +* +* 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. +* +* Modifications: +* 24-Aug-2004 BJD Start of S3C2440 CPU support +* 04-Nov-2004 BJD Added s3c2440_init_uarts() +* 04-Jan-2005 BJD Moved uart init to cpu code +* 10-Jan-2005 BJD Moved 2440 specific init here +* 14-Jan-2005 BJD Split the clock initialisation code +* 27-Feb-2006 KM Start of S3C2412 CPU support +*/ + +#ifdef CONFIG_CPU_S3C2412 + +extern int s3c2412_init (void ); + +extern void s3c2412_map_io (struct map_desc *mach_desc,int size); + +extern void s3c2412_init_uarts (struct s3c2410_uartcfg *cfg,int no); + +extern void s3c2412_init_clocks (int xtal); + +#else +#define s3c2412_init_clocks NULL +#define s3c2412_init_uarts NULL +#define s3c2412_map_io NULL +#define s3c2412_init NULL +#endif
include/asm-arm/arch-s3c2410/uncompress.h +9 -0
@@ -17,6 +17,7 @@* 15-Nov-2004 BJD Fixed uart configuration * 22-Feb-2005 BJD Added watchdog to uncompress * 04-Apr-2005 LCVR Added support to S3C2400 (no cpuid at GSTATUS1) +* 28-Feb-2006 KM Added support for S3C2412/13 (cpuid moved to different addr) */ #ifndef __ASM_ARCH_UNCOMPRESS_H
@@ -75,6 +76,14 @@#ifndef CONFIG_CPU_S3C2400 cpuid = *((volatile unsigned int *)S3C2410_GSTATUS1 ); cpuid &=S3C2410_GSTATUS1_IDMASK ; + +#ifdef CONFIG_CPU_S3C2412 +if (cpuid!=S3C2410_GSTATUS1_2440 && cpuid!=S3C2410_GSTATUS1_2410 ) { + cpuid = *((volatile unsigned int *)S3C2412_GSTATUS1 ); + cpuid &=S3C2410_GSTATUS1_IDMASK ; + } +#endif +#endif if (ch =='\n' )
Quoted 8 lines · Koen Martens
From: Koen Martens <[email protected]>
Changes are:
- Added s3c2412-specific files toarch/arm/mach-s3c2410
- Added s3c2412 detection toarch/arm/mach-s3c2410/cpu.c
- AddedCONFIG_CPU_S3C2412
- Added s3c2412 specific registers and register addresses to various regs-*.h files ininclude/asm-arm/arch-s3c2410
It would help to split these emails into smaller chunks than all the files so that comments could be with the chunks that it goes with.
Kconfig.diff - fine, no problems here
Makefile.diff - going to have to remove those #s at somepoint
regs-clock.diff - didn't need to add s3c2412_get_pll, same as s3c2410_get_pll
regs-gpio.diff - group the s3c2412 changes together into larger #ifdefs
regs-irq.diff - looks fine
regs-rtc.diff - two sets of changes here? 2410 and 2412 additions
s3c2412_c.diff - looks fine
s3c2412_h.diff - looks fine
cpu.diff:
the 2412 is an ARM926EJS, so I'd expect the core-ID accessed via the co-processor registers to be diffeernt, so this could give the indication of what sort of CPU to try.
this also seems to have the S3C2442 ID patch from the patch-q in it, please be careful about merging patches like that.
Quoted 4 lines
All changes are preliminary, final documentation is not yet available from samsung. We did test on actual hardware, but outside the linux kernel (due to limited number of actual chips we have available and lack of proper PCB with serial lines exported).
[snip]
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 4 lines · Ben Dooks
It would help to split these emails into smaller chunks than all the files so that comments could be with the chunks that it goes with.
All right, i'll repost in a minute..
Quoted 3 lines
Makefile.diff - going to have to remove those #s at somepoint
True, but i can't submit those as long as i use tomtom specific cpu-type registers (see reply to other post later today).
Quoted 3 lines
regs-clock.diff - didn't need to add
s3c2412_get_pll, same ass3c2410_get_pll
Hmm, i disagree.. The term (mdiv+8) is multiplied by 2 for s3c2412, this is not the case for s3c2410.. I changed it to use the 64 bit arithmetic like s3c2410_get_pll and you'll notice the difference is this line:
+ fvco = (uint64_t)baseclk * ((mdiv + 8)<<1);
Maybe it is better to use one get_pll and add an extra parameter to indicate the multiplication of (mdiv+8) ?
Quoted 3 lines
regs-gpio.diff - group the s3c2412 changes together into larger #ifdefs
Done.
Quoted 3 lines
regs-rtc.diff - two sets of changes here? 2410 and 2412 additions
Ok, cleaned that up..
Quoted 10 lines
cpu.diff:
the 2412 is an ARM926EJS, so I'd expect the core-ID accessed via the co-processor registers to be diffeernt, so this could give the indication of what sort of CPU to try.
this also seems to have the S3C2442 ID patch from the patch-q in it, please be careful about merging patches like that.
Ok, cleaned that up a bit too.. As for the core-ID remark, i will try and have a look at it today, but as it is my last day at this firm today i can't make any guarantees. Maybe Dimitry Andric will pick this up when i'm gone..
Best,
Koen
Signature · 5 lines
K.F.J. Martens, Sonologic, http://www.sonologic.nl/ Networking, hosting, embedded systems, unix, artificial intelligence. Public PGP key: http://www.metro.cx/pubkey-gmc.asc Wondering about the funny attachment your mail program can't read? Visit http://www.openpgp.org/