Skip to content

Commit

Permalink
Merge S3C24xx branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell King authored and Russell King committed Jun 24, 2006
2 parents c1e08ad + c9b949a commit e11c910
Show file tree
Hide file tree
Showing 27 changed files with 1,530 additions and 77 deletions.
20 changes: 20 additions & 0 deletions arch/arm/mach-s3c2410/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ config SMDK2440_CPU2442
depends on ARCH_S3C2440
select CPU_S3C2442

config MACH_SMDK2413
bool "SMDK2413"
select CPU_S3C2412
select MACH_SMDK
help
Say Y here if you are using an SMDK2413

config MACH_VR1000
bool "Thorcom VR1000"
Expand Down Expand Up @@ -127,6 +133,20 @@ config CPU_S3C2410
Support for S3C2410 and S3C2410A family from the S3C24XX line
of Samsung Mobile CPUs.

# internal node to signify if we are only dealing with an S3C2412

config CPU_S3C2412_ONLY
bool
depends on ARCH_S3C2410 && !CPU_S3C2400 && !CPU_S3C2410 && \
!CPU_S3C2440 && !CPU_S3C2442 && CPU_S3C2412
default y if CPU_S3C2412

config CPU_S3C2412
bool
depends on ARCH_S3C2410
help
Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line

config CPU_S3C244X
bool
depends on ARCH_S3C2410 && (CPU_S3C2440 || CPU_S3C2442)
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-s3c2410/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ obj-$(CONFIG_S3C2410_DMA) += dma.o
obj-$(CONFIG_PM) += pm.o sleep.o
obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o

# S3C2412 support
obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o

#
# S3C244X support

obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
Expand Down Expand Up @@ -57,6 +62,7 @@ obj-$(CONFIG_ARCH_BAST) += mach-bast.o usb-simtec.o
obj-$(CONFIG_ARCH_H1940) += mach-h1940.o
obj-$(CONFIG_MACH_N30) += mach-n30.o
obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
obj-$(CONFIG_MACH_RX3715) += mach-rx3715.o
Expand Down
21 changes: 15 additions & 6 deletions arch/arm/mach-s3c2410/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,19 @@ EXPORT_SYMBOL(clk_set_parent);

/* base clocks */

static struct clk clk_xtal = {
struct clk clk_xtal = {
.name = "xtal",
.id = -1,
.rate = 0,
.parent = NULL,
.ctrlbit = 0,
};

struct clk clk_mpll = {
.name = "mpll",
.id = -1,
};

struct clk clk_upll = {
.name = "upll",
.id = -1,
Expand All @@ -232,7 +237,7 @@ struct clk clk_f = {
.name = "fclk",
.id = -1,
.rate = 0,
.parent = NULL,
.parent = &clk_mpll,
.ctrlbit = 0,
};

Expand Down Expand Up @@ -263,14 +268,14 @@ struct clk clk_usb_bus = {

static int s3c24xx_dclk_enable(struct clk *clk, int enable)
{
unsigned long dclkcon = __raw_readl(S3C2410_DCLKCON);
unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);

if (enable)
dclkcon |= clk->ctrlbit;
else
dclkcon &= ~clk->ctrlbit;

__raw_writel(dclkcon, S3C2410_DCLKCON);
__raw_writel(dclkcon, S3C24XX_DCLKCON);

return 0;
}
Expand All @@ -289,7 +294,7 @@ static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)

clk->parent = parent;

dclkcon = __raw_readl(S3C2410_DCLKCON);
dclkcon = __raw_readl(S3C24XX_DCLKCON);

if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
if (uclk)
Expand All @@ -303,7 +308,7 @@ static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
}

__raw_writel(dclkcon, S3C2410_DCLKCON);
__raw_writel(dclkcon, S3C24XX_DCLKCON);

return 0;
}
Expand Down Expand Up @@ -413,6 +418,7 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
clk_xtal.rate = xtal;
clk_upll.rate = s3c2410_get_pll(__raw_readl(S3C2410_UPLLCON), xtal);

clk_mpll.rate = fclk;
clk_h.rate = hclk;
clk_p.rate = pclk;
clk_f.rate = fclk;
Expand All @@ -424,6 +430,9 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
if (s3c24xx_register_clock(&clk_xtal) < 0)
printk(KERN_ERR "failed to register master xtal\n");

if (s3c24xx_register_clock(&clk_mpll) < 0)
printk(KERN_ERR "failed to register mpll clock\n");

if (s3c24xx_register_clock(&clk_upll) < 0)
printk(KERN_ERR "failed to register upll clock\n");

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-s3c2410/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ extern struct clk clk_usb_bus;
extern struct clk clk_f;
extern struct clk clk_h;
extern struct clk clk_p;
extern struct clk clk_mpll;
extern struct clk clk_upll;
extern struct clk clk_xtal;

/* exports for arch/arm/mach-s3c2410
*
Expand Down
37 changes: 34 additions & 3 deletions arch/arm/mach-s3c2410/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "clock.h"
#include "s3c2400.h"
#include "s3c2410.h"
#include "s3c2412.h"
#include "s3c244x.h"
#include "s3c2440.h"
#include "s3c2442.h"
Expand All @@ -62,6 +63,7 @@ struct cpu_table {

static const char name_s3c2400[] = "S3C2400";
static const char name_s3c2410[] = "S3C2410";
static const char name_s3c2412[] = "S3C2412";
static const char name_s3c2440[] = "S3C2440";
static const char name_s3c2442[] = "S3C2442";
static const char name_s3c2410a[] = "S3C2410A";
Expand Down Expand Up @@ -113,6 +115,15 @@ static struct cpu_table cpu_ids[] __initdata = {
.init = s3c2442_init,
.name = name_s3c2442
},
{
.idcode = 0x32412001,
.idmask = 0xffffffff,
.map_io = s3c2412_map_io,
.init_clocks = s3c2412_init_clocks,
.init_uarts = s3c2412_init_uarts,
.init = s3c2412_init,
.name = name_s3c2412,
},
{
.idcode = 0x0, /* S3C2400 doesn't have an idcode */
.idmask = 0xffffffff,
Expand Down Expand Up @@ -171,16 +182,36 @@ void s3c24xx_set_board(struct s3c24xx_board *b)

static struct cpu_table *cpu;

static unsigned long s3c24xx_read_idcode_v5(void)
{
#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
return __raw_readl(S3C2412_GSTATUS1);
#else
return 1UL; /* don't look like an 2400 */
#endif
}

static unsigned long s3c24xx_read_idcode_v4(void)
{
#ifndef CONFIG_CPU_S3C2400
return __raw_readl(S3C2410_GSTATUS1);
#else
return 0UL;
#endif
}

void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
{
unsigned long idcode = 0x0;

/* initialise the io descriptors we need for initialisation */
iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));

#ifndef CONFIG_CPU_S3C2400
idcode = __raw_readl(S3C2410_GSTATUS1);
#endif
if (cpu_architecture() >= CPU_ARCH_ARMv5) {
idcode = s3c24xx_read_idcode_v5();
} else {
idcode = s3c24xx_read_idcode_v4();
}

cpu = s3c_lookup_cpu(idcode);

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-s3c2410/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ extern struct sys_timer s3c24xx_timer;
/* system device classes */

extern struct sysdev_class s3c2410_sysclass;
extern struct sysdev_class s3c2412_sysclass;
extern struct sysdev_class s3c2440_sysclass;
extern struct sysdev_class s3c2442_sysclass;
57 changes: 37 additions & 20 deletions arch/arm/mach-s3c2410/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,19 @@ static struct irqchip s3c_irq_chip = {
.ack = s3c_irq_ack,
.mask = s3c_irq_mask,
.unmask = s3c_irq_unmask,
.set_wake = s3c_irq_wake
.set_wake = s3c_irq_wake
};

/* S3C2410_EINTMASK
* S3C2410_EINTPEND
*/

static void
s3c_irqext_mask(unsigned int irqno)
{
unsigned long mask;

irqno -= EXTINT_OFF;

mask = __raw_readl(S3C2410_EINTMASK);
mask = __raw_readl(S3C24XX_EINTMASK);
mask |= ( 1UL << irqno);
__raw_writel(mask, S3C2410_EINTMASK);
__raw_writel(mask, S3C24XX_EINTMASK);

if (irqno <= (IRQ_EINT7 - EXTINT_OFF)) {
/* check to see if all need masking */
Expand All @@ -232,11 +228,11 @@ s3c_irqext_ack(unsigned int irqno)
bit = 1UL << (irqno - EXTINT_OFF);


mask = __raw_readl(S3C2410_EINTMASK);
mask = __raw_readl(S3C24XX_EINTMASK);

__raw_writel(bit, S3C2410_EINTPEND);
__raw_writel(bit, S3C24XX_EINTPEND);

req = __raw_readl(S3C2410_EINTPEND);
req = __raw_readl(S3C24XX_EINTPEND);
req &= ~mask;

/* not sure if we should be acking the parent irq... */
Expand All @@ -257,9 +253,9 @@ s3c_irqext_unmask(unsigned int irqno)

irqno -= EXTINT_OFF;

mask = __raw_readl(S3C2410_EINTMASK);
mask = __raw_readl(S3C24XX_EINTMASK);
mask &= ~( 1UL << irqno);
__raw_writel(mask, S3C2410_EINTMASK);
__raw_writel(mask, S3C24XX_EINTMASK);

s3c_irq_unmask((irqno <= (IRQ_EINT7 - EXTINT_OFF)) ? IRQ_EINT4t7 : IRQ_EINT8t23);
}
Expand All @@ -275,28 +271,28 @@ s3c_irqext_type(unsigned int irq, unsigned int type)
if ((irq >= IRQ_EINT0) && (irq <= IRQ_EINT3))
{
gpcon_reg = S3C2410_GPFCON;
extint_reg = S3C2410_EXTINT0;
extint_reg = S3C24XX_EXTINT0;
gpcon_offset = (irq - IRQ_EINT0) * 2;
extint_offset = (irq - IRQ_EINT0) * 4;
}
else if ((irq >= IRQ_EINT4) && (irq <= IRQ_EINT7))
{
gpcon_reg = S3C2410_GPFCON;
extint_reg = S3C2410_EXTINT0;
extint_reg = S3C24XX_EXTINT0;
gpcon_offset = (irq - (EXTINT_OFF)) * 2;
extint_offset = (irq - (EXTINT_OFF)) * 4;
}
else if ((irq >= IRQ_EINT8) && (irq <= IRQ_EINT15))
{
gpcon_reg = S3C2410_GPGCON;
extint_reg = S3C2410_EXTINT1;
extint_reg = S3C24XX_EXTINT1;
gpcon_offset = (irq - IRQ_EINT8) * 2;
extint_offset = (irq - IRQ_EINT8) * 4;
}
else if ((irq >= IRQ_EINT16) && (irq <= IRQ_EINT23))
{
gpcon_reg = S3C2410_GPGCON;
extint_reg = S3C2410_EXTINT2;
extint_reg = S3C24XX_EXTINT2;
gpcon_offset = (irq - IRQ_EINT8) * 2;
extint_offset = (irq - IRQ_EINT16) * 4;
} else
Expand Down Expand Up @@ -572,6 +568,23 @@ s3c_irq_demux_uart2(unsigned int irq,
s3c_irq_demux_uart(IRQ_S3CUART_RX2, regs);
}

static void
s3c_irq_demux_extint(unsigned int irq,
struct irqdesc *desc,
struct pt_regs *regs)
{
unsigned long eintpnd = __raw_readl(S3C24XX_EINTPEND);
unsigned long eintmsk = __raw_readl(S3C24XX_EINTMASK);

eintpnd &= ~eintmsk;

if (eintpnd) {
irq = fls(eintpnd);
irq += (IRQ_EINT4 - (4 + 1));

desc_handle_irq(irq, irq_desc + irq, regs);
}
}

/* s3c24xx_init_irq
*
Expand All @@ -591,12 +604,12 @@ void __init s3c24xx_init_irq(void)

last = 0;
for (i = 0; i < 4; i++) {
pend = __raw_readl(S3C2410_EINTPEND);
pend = __raw_readl(S3C24XX_EINTPEND);

if (pend == 0 || pend == last)
break;

__raw_writel(pend, S3C2410_EINTPEND);
__raw_writel(pend, S3C24XX_EINTPEND);
printk("irq: clearing pending ext status %08x\n", (int)pend);
last = pend;
}
Expand Down Expand Up @@ -630,12 +643,14 @@ void __init s3c24xx_init_irq(void)

irqdbf("s3c2410_init_irq: registering s3c2410 interrupt handlers\n");

for (irqno = IRQ_BATT_FLT; irqno <= IRQ_ADCPARENT; irqno++) {
for (irqno = IRQ_EINT4t7; irqno <= IRQ_ADCPARENT; irqno++) {
/* set all the s3c2410 internal irqs */

switch (irqno) {
/* deal with the special IRQs (cascaded) */

case IRQ_EINT4t7:
case IRQ_EINT8t23:
case IRQ_UART0:
case IRQ_UART1:
case IRQ_UART2:
Expand All @@ -659,12 +674,14 @@ void __init s3c24xx_init_irq(void)

/* setup the cascade irq handlers */

set_irq_chained_handler(IRQ_EINT4t7, s3c_irq_demux_extint);
set_irq_chained_handler(IRQ_EINT8t23, s3c_irq_demux_extint);

set_irq_chained_handler(IRQ_UART0, s3c_irq_demux_uart0);
set_irq_chained_handler(IRQ_UART1, s3c_irq_demux_uart1);
set_irq_chained_handler(IRQ_UART2, s3c_irq_demux_uart2);
set_irq_chained_handler(IRQ_ADCPARENT, s3c_irq_demux_adc);


/* external interrupts */

for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) {
Expand Down
Loading

0 comments on commit e11c910

Please sign in to comment.