Commit 808235d0 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 95cadf99 353c291b
...@@ -503,27 +503,33 @@ void ecard_disablefiq(unsigned int fiqnr) ...@@ -503,27 +503,33 @@ void ecard_disablefiq(unsigned int fiqnr)
} }
} }
static void static void ecard_dump_irq_state(void)
ecard_dump_irq_state(ecard_t *ec)
{ {
printk(" %d: %sclaimed, ", ecard_t *ec;
ec->slot_no,
ec->claimed ? "" : "not "); printk("Expansion card IRQ state:\n");
if (ec->ops && ec->ops->irqpending && for (ec = cards; ec; ec = ec->next) {
ec->ops != &ecard_default_ops) if (ec->slot_no == 8)
printk("irq %spending\n", continue;
ec->ops->irqpending(ec) ? "" : "not ");
else printk(" %d: %sclaimed, ",
printk("irqaddr %p, mask = %02X, status = %02X\n", ec->slot_no, ec->claimed ? "" : "not ");
ec->irqaddr, ec->irqmask, *ec->irqaddr);
if (ec->ops && ec->ops->irqpending &&
ec->ops != &ecard_default_ops)
printk("irq %spending\n",
ec->ops->irqpending(ec) ? "" : "not ");
else
printk("irqaddr %p, mask = %02X, status = %02X\n",
ec->irqaddr, ec->irqmask, *ec->irqaddr);
}
} }
static void ecard_check_lockup(struct irqdesc *desc) static void ecard_check_lockup(struct irqdesc *desc)
{ {
static unsigned long last; static unsigned long last;
static int lockup; static int lockup;
ecard_t *ec;
/* /*
* If the timer interrupt has not run since the last million * If the timer interrupt has not run since the last million
...@@ -541,11 +547,7 @@ static void ecard_check_lockup(struct irqdesc *desc) ...@@ -541,11 +547,7 @@ static void ecard_check_lockup(struct irqdesc *desc)
"disabling all expansion card interrupts\n"); "disabling all expansion card interrupts\n");
desc->chip->mask(IRQ_EXPANSIONCARD); desc->chip->mask(IRQ_EXPANSIONCARD);
ecard_dump_irq_state();
printk("Expansion card IRQ state:\n");
for (ec = cards; ec; ec = ec->next)
ecard_dump_irq_state(ec);
} }
} else } else
lockup = 0; lockup = 0;
...@@ -557,6 +559,7 @@ static void ecard_check_lockup(struct irqdesc *desc) ...@@ -557,6 +559,7 @@ static void ecard_check_lockup(struct irqdesc *desc)
if (!last || time_after(jiffies, last + 5*HZ)) { if (!last || time_after(jiffies, last + 5*HZ)) {
last = jiffies; last = jiffies;
printk(KERN_WARNING "Unrecognised interrupt from backplane\n"); printk(KERN_WARNING "Unrecognised interrupt from backplane\n");
ecard_dump_irq_state();
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -99,17 +100,35 @@ struct clk *clk_get(struct device *dev, const char *id) ...@@ -99,17 +100,35 @@ struct clk *clk_get(struct device *dev, const char *id)
{ {
struct clk *p; struct clk *p;
struct clk *clk = ERR_PTR(-ENOENT); struct clk *clk = ERR_PTR(-ENOENT);
int idno;
idno = (dev == NULL) ? -1 : to_platform_device(dev)->id;
down(&clocks_sem); down(&clocks_sem);
list_for_each_entry(p, &clocks, list) { list_for_each_entry(p, &clocks, list) {
if (strcmp(id, p->name) == 0 && if (p->id == idno &&
strcmp(id, p->name) == 0 &&
try_module_get(p->owner)) { try_module_get(p->owner)) {
clk = p; clk = p;
break; break;
} }
} }
up(&clocks_sem);
/* check for the case where a device was supplied, but the
* clock that was being searched for is not device specific */
if (IS_ERR(clk)) {
list_for_each_entry(p, &clocks, list) {
if (p->id == -1 && strcmp(id, p->name) == 0 &&
try_module_get(p->owner)) {
clk = p;
break;
}
}
}
up(&clocks_sem);
return clk; return clk;
} }
...@@ -147,6 +166,9 @@ void clk_unuse(struct clk *clk) ...@@ -147,6 +166,9 @@ void clk_unuse(struct clk *clk)
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
if (IS_ERR(clk))
return 0;
if (clk->rate != 0) if (clk->rate != 0)
return clk->rate; return clk->rate;
...@@ -185,46 +207,54 @@ EXPORT_SYMBOL(clk_get_parent); ...@@ -185,46 +207,54 @@ EXPORT_SYMBOL(clk_get_parent);
/* base clocks */ /* base clocks */
static struct clk clk_f = { static struct clk clk_f = {
.name = "fclk", .name = "fclk",
.rate = 0, .id = -1,
.parent = NULL, .rate = 0,
.ctrlbit = 0 .parent = NULL,
.ctrlbit = 0,
}; };
static struct clk clk_h = { static struct clk clk_h = {
.name = "hclk", .name = "hclk",
.rate = 0, .id = -1,
.parent = NULL, .rate = 0,
.ctrlbit = 0 .parent = NULL,
.ctrlbit = 0,
}; };
static struct clk clk_p = { static struct clk clk_p = {
.name = "pclk", .name = "pclk",
.rate = 0, .id = -1,
.parent = NULL, .rate = 0,
.ctrlbit = 0 .parent = NULL,
.ctrlbit = 0,
}; };
/* clocks that could be registered by external code */ /* clocks that could be registered by external code */
struct clk s3c24xx_dclk0 = { struct clk s3c24xx_dclk0 = {
.name = "dclk0", .name = "dclk0",
.id = -1,
}; };
struct clk s3c24xx_dclk1 = { struct clk s3c24xx_dclk1 = {
.name = "dclk1", .name = "dclk1",
.id = -1,
}; };
struct clk s3c24xx_clkout0 = { struct clk s3c24xx_clkout0 = {
.name = "clkout1", .name = "clkout1",
.id = -1,
}; };
struct clk s3c24xx_clkout1 = { struct clk s3c24xx_clkout1 = {
.name = "clkout1", .name = "clkout1",
.id = -1,
}; };
struct clk s3c24xx_uclk = { struct clk s3c24xx_uclk = {
.name = "uclk", .name = "uclk",
.id = -1,
}; };
...@@ -232,21 +262,25 @@ struct clk s3c24xx_uclk = { ...@@ -232,21 +262,25 @@ struct clk s3c24xx_uclk = {
static struct clk init_clocks[] = { static struct clk init_clocks[] = {
{ .name = "nand", { .name = "nand",
.id = -1,
.parent = &clk_h, .parent = &clk_h,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_NAND .ctrlbit = S3C2410_CLKCON_NAND
}, },
{ .name = "lcd", { .name = "lcd",
.id = -1,
.parent = &clk_h, .parent = &clk_h,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_LCDC .ctrlbit = S3C2410_CLKCON_LCDC
}, },
{ .name = "usb-host", { .name = "usb-host",
.id = -1,
.parent = &clk_h, .parent = &clk_h,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_USBH .ctrlbit = S3C2410_CLKCON_USBH
}, },
{ .name = "usb-device", { .name = "usb-device",
.id = -1,
.parent = &clk_h, .parent = &clk_h,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_USBD .ctrlbit = S3C2410_CLKCON_USBD
...@@ -257,56 +291,67 @@ static struct clk init_clocks[] = { ...@@ -257,56 +291,67 @@ static struct clk init_clocks[] = {
.ctrlbit = S3C2410_CLKCON_PWMT .ctrlbit = S3C2410_CLKCON_PWMT
}, },
{ .name = "sdi", { .name = "sdi",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_SDI .ctrlbit = S3C2410_CLKCON_SDI
}, },
{ .name = "uart0", { .name = "uart",
.id = 0,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_UART0 .ctrlbit = S3C2410_CLKCON_UART0
}, },
{ .name = "uart1", { .name = "uart",
.id = 1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_UART1 .ctrlbit = S3C2410_CLKCON_UART1
}, },
{ .name = "uart2", { .name = "uart",
.id = 2,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_UART2 .ctrlbit = S3C2410_CLKCON_UART2
}, },
{ .name = "gpio", { .name = "gpio",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_GPIO .ctrlbit = S3C2410_CLKCON_GPIO
}, },
{ .name = "rtc", { .name = "rtc",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_RTC .ctrlbit = S3C2410_CLKCON_RTC
}, },
{ .name = "adc", { .name = "adc",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_ADC .ctrlbit = S3C2410_CLKCON_ADC
}, },
{ .name = "i2c", { .name = "i2c",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_IIC .ctrlbit = S3C2410_CLKCON_IIC
}, },
{ .name = "iis", { .name = "iis",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_IIS .ctrlbit = S3C2410_CLKCON_IIS
}, },
{ .name = "spi", { .name = "spi",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_SPI .ctrlbit = S3C2410_CLKCON_SPI
}, },
{ .name = "watchdog", { .name = "watchdog",
.id = -1,
.parent = &clk_p, .parent = &clk_p,
.ctrlbit = 0 .ctrlbit = 0
} }
......
...@@ -14,6 +14,7 @@ struct clk { ...@@ -14,6 +14,7 @@ struct clk {
struct module *owner; struct module *owner;
struct clk *parent; struct clk *parent;
const char *name; const char *name;
int id;
atomic_t used; atomic_t used;
unsigned long rate; unsigned long rate;
unsigned long ctrlbit; unsigned long ctrlbit;
......
...@@ -32,8 +32,14 @@ ...@@ -32,8 +32,14 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/arch/regs-serial.h>
#include "devs.h" #include "devs.h"
/* Serial port registrations */
struct platform_device *s3c24xx_uart_devs[3];
/* USB Host Controller */ /* USB Host Controller */
static struct resource s3c_usb_resource[] = { static struct resource s3c_usb_resource[] = {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* 06-Jan-2003 BJD Updates for <arch/map.h> * 06-Jan-2003 BJD Updates for <arch/map.h>
* 18-Jan-2003 BJD Added serial port configuration * 18-Jan-2003 BJD Added serial port configuration
* 05-Oct-2004 BJD Power management code * 05-Oct-2004 BJD Power management code
* 04-Nov-2004 BJD Updated serial port clocks
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
#include <asm/arch/regs-mem.h> #include <asm/arch/regs-mem.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "clock.h"
#include "devs.h" #include "devs.h"
#include "cpu.h" #include "cpu.h"
#include "usb-simtec.h" #include "usb-simtec.h"
...@@ -153,35 +155,50 @@ static struct map_desc bast_iodesc[] __initdata = { ...@@ -153,35 +155,50 @@ static struct map_desc bast_iodesc[] __initdata = {
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
/* base baud rate for all our UARTs */ static struct s3c24xx_uart_clksrc bast_serial_clocks[] = {
static unsigned long bast_serial_clock = 24*1000*1000; [0] = {
.name = "uclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0,
},
[1] = {
.name = "pclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0.
}
};
static struct s3c2410_uartcfg bast_uartcfgs[] = { static struct s3c2410_uartcfg bast_uartcfgs[] = {
[0] = { [0] = {
.hwport = 0, .hwport = 0,
.flags = 0, .flags = 0,
.clock = &bast_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = bast_serial_clocks,
.clocks_size = ARRAY_SIZE(bast_serial_clocks)
}, },
[1] = { [1] = {
.hwport = 1, .hwport = 1,
.flags = 0, .flags = 0,
.clock = &bast_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = bast_serial_clocks,
.clocks_size = ARRAY_SIZE(bast_serial_clocks)
}, },
/* port 2 is not actually used */ /* port 2 is not actually used */
[2] = { [2] = {
.hwport = 2, .hwport = 2,
.flags = 0, .flags = 0,
.clock = &bast_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = bast_serial_clocks,
.clocks_size = ARRAY_SIZE(bast_serial_clocks)
} }
}; };
...@@ -214,13 +231,36 @@ static struct platform_device *bast_devices[] __initdata = { ...@@ -214,13 +231,36 @@ static struct platform_device *bast_devices[] __initdata = {
&bast_device_nor &bast_device_nor
}; };
static struct clk *bast_clocks[] = {
&s3c24xx_dclk0,
&s3c24xx_dclk1,
&s3c24xx_clkout0,
&s3c24xx_clkout1,
&s3c24xx_uclk,
};
static struct s3c24xx_board bast_board __initdata = { static struct s3c24xx_board bast_board __initdata = {
.devices = bast_devices, .devices = bast_devices,
.devices_count = ARRAY_SIZE(bast_devices) .devices_count = ARRAY_SIZE(bast_devices),
.clocks = bast_clocks,
.clocks_count = ARRAY_SIZE(bast_clocks)
}; };
void __init bast_map_io(void) void __init bast_map_io(void)
{ {
/* initialise the clocks */
s3c24xx_dclk0.parent = NULL;
s3c24xx_dclk0.rate = 12*1000*1000;
s3c24xx_dclk1.parent = NULL;
s3c24xx_dclk1.rate = 24*1000*1000;
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
s3c24xx_uclk.parent = &s3c24xx_clkout1;
s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
s3c2410_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); s3c2410_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
s3c24xx_set_board(&bast_board); s3c24xx_set_board(&bast_board);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* 21-Aug-2004 BJD Added struct s3c2410_board * 21-Aug-2004 BJD Added struct s3c2410_board
* 04-Sep-2004 BJD Changed uart init, renamed ipaq_ -> h1940_ * 04-Sep-2004 BJD Changed uart init, renamed ipaq_ -> h1940_
* 18-Oct-2004 BJD Updated new board structure name * 18-Oct-2004 BJD Updated new board structure name
* 04-Nov-2004 BJD Change for new serial clock
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -41,6 +42,8 @@ ...@@ -41,6 +42,8 @@
//#include <asm/debug-ll.h> //#include <asm/debug-ll.h>
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include <linux/serial_core.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "clock.h" #include "clock.h"
#include "devs.h" #include "devs.h"
...@@ -58,7 +61,6 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = { ...@@ -58,7 +61,6 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
[0] = { [0] = {
.hwport = 0, .hwport = 0,
.flags = 0, .flags = 0,
.clock = &s3c24xx_pclk,
.ucon = 0x3c5, .ucon = 0x3c5,
.ulcon = 0x03, .ulcon = 0x03,
.ufcon = 0x51, .ufcon = 0x51,
...@@ -66,7 +68,6 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = { ...@@ -66,7 +68,6 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
[1] = { [1] = {
.hwport = 1, .hwport = 1,
.flags = 0, .flags = 0,
.clock = &s3c24xx_pclk,
.ucon = 0x245, .ucon = 0x245,
.ulcon = 0x03, .ulcon = 0x03,
.ufcon = 0x00, .ufcon = 0x00,
...@@ -75,7 +76,7 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = { ...@@ -75,7 +76,7 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] = {
[2] = { [2] = {
.hwport = 2, .hwport = 2,
.flags = 0, .flags = 0,
.clock = &s3c24xx_pclk, .uart_flags = UPF_CONS_FLOW,
.ucon = 0x3c5, .ucon = 0x3c5,
.ulcon = 0x43, .ulcon = 0x43,
.ufcon = 0x51, .ufcon = 0x51,
......
...@@ -58,14 +58,10 @@ static struct map_desc smdk2410_iodesc[] __initdata = { ...@@ -58,14 +58,10 @@ static struct map_desc smdk2410_iodesc[] __initdata = {
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
/* base baud rate for all our UARTs */
static unsigned long smdk2410_serial_clock = 24*1000*1000;
static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
[0] = { [0] = {
.hwport = 0, .hwport = 0,
.flags = 0, .flags = 0,
.clock = &smdk2410_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
...@@ -73,7 +69,6 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { ...@@ -73,7 +69,6 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
[1] = { [1] = {
.hwport = 1, .hwport = 1,
.flags = 0, .flags = 0,
.clock = &smdk2410_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
...@@ -81,7 +76,6 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { ...@@ -81,7 +76,6 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
[2] = { [2] = {
.hwport = 2, .hwport = 2,
.flags = 0, .flags = 0,
.clock = &smdk2410_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* 06-Aug-2004 BJD Fixed call to time initialisation * 06-Aug-2004 BJD Fixed call to time initialisation
* 05-Apr-2004 BJD Copied to make mach-vr1000.c * 05-Apr-2004 BJD Copied to make mach-vr1000.c
* 18-Oct-2004 BJD Updated board struct * 18-Oct-2004 BJD Updated board struct
* 04-Nov-2004 BJD Clock and serial configuration update
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "clock.h"
#include "devs.h" #include "devs.h"
#include "cpu.h" #include "cpu.h"
#include "usb-simtec.h" #include "usb-simtec.h"
...@@ -113,34 +115,52 @@ static struct map_desc vr1000_iodesc[] __initdata = { ...@@ -113,34 +115,52 @@ static struct map_desc vr1000_iodesc[] __initdata = {
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
/* base baud rate for all our UARTs */ /* uart clock source(s) */
static unsigned long vr1000_serial_clock = 3692307;
static struct s3c24xx_uart_clksrc vr1000_serial_clocks[] = {
[0] = {
.name = "uclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0,
},
[1] = {
.name = "pclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0.
}
};
static struct s3c2410_uartcfg vr1000_uartcfgs[] = { static struct s3c2410_uartcfg vr1000_uartcfgs[] = {
[0] = { [0] = {
.hwport = 0, .hwport = 0,
.flags = 0, .flags = 0,
.clock = &vr1000_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = vr1000_serial_clocks,
.clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
}, },
[1] = { [1] = {
.hwport = 1, .hwport = 1,
.flags = 0, .flags = 0,
.clock = &vr1000_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = vr1000_serial_clocks,
.clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
}, },
/* port 2 is not actually used */ /* port 2 is not actually used */
[2] = { [2] = {
.hwport = 2, .hwport = 2,
.flags = 0, .flags = 0,
.clock = &vr1000_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
.ufcon = UFCON, .ufcon = UFCON,
.clocks = vr1000_serial_clocks,
.clocks_size = ARRAY_SIZE(vr1000_serial_clocks),
} }
}; };
...@@ -152,14 +172,37 @@ static struct platform_device *vr1000_devices[] __initdata = { ...@@ -152,14 +172,37 @@ static struct platform_device *vr1000_devices[] __initdata = {
&s3c_device_iis, &s3c_device_iis,
}; };
static struct clk *vr1000_clocks[] = {
&s3c24xx_dclk0,
&s3c24xx_dclk1,
&s3c24xx_clkout0,
&s3c24xx_clkout1,
&s3c24xx_uclk,
};
static struct s3c24xx_board vr1000_board __initdata = { static struct s3c24xx_board vr1000_board __initdata = {
.devices = vr1000_devices, .devices = vr1000_devices,
.devices_count = ARRAY_SIZE(vr1000_devices) .devices_count = ARRAY_SIZE(vr1000_devices),
.clocks = vr1000_clocks,
.clocks_count = ARRAY_SIZE(vr1000_clocks),
}; };
void __init vr1000_map_io(void) void __init vr1000_map_io(void)
{ {
/* initialise clock sources */
s3c24xx_dclk0.parent = NULL;
s3c24xx_dclk0.rate = 12*1000*1000;
s3c24xx_dclk1.parent = NULL;
s3c24xx_dclk1.rate = 3692307;
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
s3c24xx_uclk.parent = &s3c24xx_clkout1;
s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
s3c2410_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); s3c2410_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
s3c24xx_set_board(&vr1000_board); s3c24xx_set_board(&vr1000_board);
......
/* linux/arch/arm/mach-s3c2410/s3c2410.c /* linux/arch/arm/mach-s3c2410/s3c2410.c
* *
* Copyright (c) 2003,2004 Simtec Electronics * Copyright (c) 2003,2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk> * Ben Dooks <ben@simtec.co.uk>
* *
* http://www.simtec.co.uk/products/EB2410ITX/ * http://www.simtec.co.uk/products/EB2410ITX/
* *
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* 18-Jan-2004 BJD Added serial port configuration * 18-Jan-2004 BJD Added serial port configuration
* 21-Aug-2004 BJD Added new struct s3c2410_board handler * 21-Aug-2004 BJD Added new struct s3c2410_board handler
* 28-Sep-2004 BJD Updates for new serial port bits * 28-Sep-2004 BJD Updates for new serial port bits
* 04-Nov-2004 BJD Updated UART configuration process
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -43,10 +44,6 @@ ...@@ -43,10 +44,6 @@
int s3c2410_clock_tick_rate = 12*1000*1000; /* current timers at 12MHz */ int s3c2410_clock_tick_rate = 12*1000*1000; /* current timers at 12MHz */
/* serial port setup */
struct s3c2410_uartcfg *s3c2410_uartcfgs;
/* Initial IO mappings */ /* Initial IO mappings */
static struct map_desc s3c2410_iodesc[] __initdata = { static struct map_desc s3c2410_iodesc[] __initdata = {
...@@ -141,12 +138,10 @@ void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no) ...@@ -141,12 +138,10 @@ void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
struct platform_device *platdev; struct platform_device *platdev;
int uart; int uart;
s3c2410_uartcfgs = cfg; /* compatibility */
for (uart = 0; uart < no; uart++, cfg++) { for (uart = 0; uart < no; uart++, cfg++) {
platdev = uart_devices[cfg->hwport]; platdev = uart_devices[cfg->hwport];
s3c2410_uart_devices[uart] = platdev; s3c24xx_uart_devs[uart] = platdev;
platdev->dev.platform_data = cfg; platdev->dev.platform_data = cfg;
} }
...@@ -199,10 +194,7 @@ void __init s3c2410_map_io(struct map_desc *mach_desc, int mach_size) ...@@ -199,10 +194,7 @@ void __init s3c2410_map_io(struct map_desc *mach_desc, int mach_size)
int __init s3c2410_init(void) int __init s3c2410_init(void)
{ {
int ret;
printk("S3C2410: Initialising architecture\n"); printk("S3C2410: Initialising architecture\n");
ret = platform_add_devices(uart_devices, ARRAY_SIZE(uart_devices)); return platform_add_devices(s3c24xx_uart_devs, s3c2410_uart_count);
return ret;
} }
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* 12-Oct-2004 BJD Moved clock info out to clock.c * 12-Oct-2004 BJD Moved clock info out to clock.c
* 01-Nov-2004 BJD Fixed clock build code * 01-Nov-2004 BJD Fixed clock build code
* 09-Nov-2004 BJD Added sysdev for power management * 09-Nov-2004 BJD Added sysdev for power management
* 04-Nov-2004 BJD New serial registration
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -129,6 +130,25 @@ static struct platform_device *uart_devices[] __initdata = { ...@@ -129,6 +130,25 @@ static struct platform_device *uart_devices[] __initdata = {
&s3c_uart2 &s3c_uart2
}; };
/* uart initialisation */
static int __initdata s3c2440_uart_count;
void __init s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no)
{
struct platform_device *platdev;
int uart;
for (uart = 0; uart < no; uart++, cfg++) {
platdev = uart_devices[cfg->hwport];
s3c24xx_uart_devs[uart] = platdev;
platdev->dev.platform_data = cfg;
}
s3c2440_uart_count = uart;
}
/* s3c2440 specific clock sources */ /* s3c2440 specific clock sources */
static struct clk s3c2440_clk_cam = { static struct clk s3c2440_clk_cam = {
...@@ -259,9 +279,8 @@ int __init s3c2440_init(void) ...@@ -259,9 +279,8 @@ int __init s3c2440_init(void)
if (ret != 0) if (ret != 0)
printk(KERN_ERR "failed to register sysdev for s3c2440\n"); printk(KERN_ERR "failed to register sysdev for s3c2440\n");
if (ret != 0) if (ret == 0)
ret = platform_add_devices(uart_devices, ret = platform_add_devices(s3c24xx_uart_devs, s3c2440_uart_count);
ARRAY_SIZE(uart_devices));
return ret; return ret;
} }
...@@ -10,9 +10,14 @@ ...@@ -10,9 +10,14 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* Modifications: * Modifications:
* 24-Aug-2004 BJD Start of S3C2440 CPU support * 24-Aug-2004 BJD Start of S3C2440 CPU support
* 04-Nov-2004 BJD Added s3c2440_init_uarts()
*/ */
struct s3c2410_uartcfg;
extern void s3c2440_init_irq(void); extern void s3c2440_init_irq(void);
extern void s3c2440_init_time(void); extern void s3c2440_init_time(void);
extern void s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no);
This diff is collapsed.
...@@ -13,32 +13,91 @@ ...@@ -13,32 +13,91 @@
#include <asm/ecard.h> #include <asm/ecard.h>
static int __devinit /*
rapide_probe(struct expansion_card *ec, const struct ecard_id *id) * Something like this really should be in generic code, but isn't.
*/
static ide_hwif_t *
rapide_locate_hwif(void __iomem *base, void *ctrl, unsigned int sz, int irq)
{ {
unsigned long port = ecard_address (ec, ECARD_MEMC, 0); unsigned long port = (unsigned long)base;
hw_regs_t hw; ide_hwif_t *hwif;
int i, ret; int index, i;
for (index = 0; index < MAX_HWIFS; ++index) {
hwif = ide_hwifs + index;
if (hwif->io_ports[IDE_DATA_OFFSET] == port)
goto found;
}
for (index = 0; index < MAX_HWIFS; ++index) {
hwif = ide_hwifs + index;
if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
goto found;
}
memset(&hw, 0, sizeof(hw)); return NULL;
found:
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw.io_ports[i] = port; hwif->hw.io_ports[i] = port;
port += 1 << 4; hwif->io_ports[i] = port;
port += sz;
} }
hw.io_ports[IDE_CONTROL_OFFSET] = port + 0x206; hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
hw.irq = ec->irq; hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
hwif->hw.irq = hwif->irq = irq;
hwif->mmio = 2;
default_hwif_mmiops(hwif);
return hwif;
}
ret = ide_register_hw(&hw, NULL); static int __devinit
rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
{
ide_hwif_t *hwif;
void __iomem *base;
int ret;
ret = ecard_request_resources(ec);
if (ret) if (ret)
ecard_release(ec); goto out;
base = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC),
ecard_resource_len(ec, ECARD_RES_MEMC));
if (!base) {
ret = -ENOMEM;
goto release;
}
hwif = rapide_locate_hwif(base, base + 0x818, 1 << 6, ec->irq);
if (hwif) {
hwif->hwif_data = base;
hwif->gendev.parent = &ec->dev;
hwif->noprobe = 0;
probe_hwif_init(hwif);
create_proc_ide_interfaces();
ecard_set_drvdata(ec, hwif);
goto out;
}
iounmap(base);
release:
ecard_release_resources(ec);
out:
return ret; return ret;
} }
static void __devexit rapide_remove(struct expansion_card *ec) static void __devexit rapide_remove(struct expansion_card *ec)
{ {
/* need to do more */ ide_hwif_t *hwif = ecard_get_drvdata(ec);
ecard_set_drvdata(ec, NULL);
/* there must be a better way */
ide_unregister(hwif - ide_hwifs);
iounmap(hwif->hwif_data);
ecard_release_resources(ec);
} }
static struct ecard_id rapide_ids[] = { static struct ecard_id rapide_ids[] = {
......
...@@ -286,14 +286,12 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -286,14 +286,12 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
unsigned char *base; unsigned char *base;
int ret; int ret;
resbase = ecard_resource_start(ec, ECARD_RES_MEMC); ret = ecard_request_resources(ec);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC); if (ret)
if (!request_mem_region(resbase, reslen, "arxescsi")) {
ret = -EBUSY;
goto out; goto out;
}
resbase = ecard_resource_start(ec, ECARD_RES_MEMC);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
base = ioremap(resbase, reslen); base = ioremap(resbase, reslen);
if (!base) { if (!base) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -345,7 +343,7 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -345,7 +343,7 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
out_unmap: out_unmap:
iounmap(base); iounmap(base);
out_region: out_region:
release_mem_region(resbase, reslen); ecard_release_resources(ec);
out: out:
return ret; return ret;
} }
...@@ -353,20 +351,15 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -353,20 +351,15 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
static void __devexit arxescsi_remove(struct expansion_card *ec) static void __devexit arxescsi_remove(struct expansion_card *ec)
{ {
struct Scsi_Host *host = ecard_get_drvdata(ec); struct Scsi_Host *host = ecard_get_drvdata(ec);
unsigned long resbase, reslen;
ecard_set_drvdata(ec, NULL); ecard_set_drvdata(ec, NULL);
fas216_remove(host); fas216_remove(host);
iounmap((void *)host->base); iounmap((void *)host->base);
resbase = ecard_resource_start(ec, ECARD_RES_MEMC);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
release_mem_region(resbase, reslen);
fas216_release(host); fas216_release(host);
scsi_host_put(host); scsi_host_put(host);
ecard_release_resources(ec);
} }
static const struct ecard_id arxescsi_cids[] = { static const struct ecard_id arxescsi_cids[] = {
......
...@@ -408,14 +408,12 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -408,14 +408,12 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
unsigned char *base; unsigned char *base;
int ret; int ret;
resbase = ecard_resource_start(ec, ECARD_RES_MEMC); ret = ecard_request_resources(ec);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC); if (ret)
if (!request_mem_region(resbase, reslen, "cumanascsi2")) {
ret = -EBUSY;
goto out; goto out;
}
resbase = ecard_resource_start(ec, ECARD_RES_MEMC);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
base = ioremap(resbase, reslen); base = ioremap(resbase, reslen);
if (!base) { if (!base) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -504,7 +502,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -504,7 +502,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
iounmap(base); iounmap(base);
out_region: out_region:
release_mem_region(resbase, reslen); ecard_release_resources(ec);
out: out:
return ret; return ret;
...@@ -514,7 +512,6 @@ static void __devexit cumanascsi2_remove(struct expansion_card *ec) ...@@ -514,7 +512,6 @@ static void __devexit cumanascsi2_remove(struct expansion_card *ec)
{ {
struct Scsi_Host *host = ecard_get_drvdata(ec); struct Scsi_Host *host = ecard_get_drvdata(ec);
struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata;
unsigned long resbase, reslen;
ecard_set_drvdata(ec, NULL); ecard_set_drvdata(ec, NULL);
fas216_remove(host); fas216_remove(host);
...@@ -525,13 +522,9 @@ static void __devexit cumanascsi2_remove(struct expansion_card *ec) ...@@ -525,13 +522,9 @@ static void __devexit cumanascsi2_remove(struct expansion_card *ec)
iounmap((void *)host->base); iounmap((void *)host->base);
resbase = ecard_resource_start(ec, ECARD_RES_MEMC);
reslen = ecard_resource_len(ec, ECARD_RES_MEMC);
release_mem_region(resbase, reslen);
fas216_release(host); fas216_release(host);
scsi_host_put(host); scsi_host_put(host);
ecard_release_resources(ec);
} }
static const struct ecard_id cumanascsi2_cids[] = { static const struct ecard_id cumanascsi2_cids[] = {
......
...@@ -525,14 +525,12 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -525,14 +525,12 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
unsigned char *base; unsigned char *base;
int ret; int ret;
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST); ret = ecard_request_resources(ec);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST); if (ret)
if (!request_mem_region(resbase, reslen, "eesoxscsi")) {
ret = -EBUSY;
goto out; goto out;
}
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
base = ioremap(resbase, reslen); base = ioremap(resbase, reslen);
if (!base) { if (!base) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -622,7 +620,7 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -622,7 +620,7 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
iounmap(base); iounmap(base);
out_region: out_region:
release_mem_region(resbase, reslen); ecard_release_resources(ec);
out: out:
return ret; return ret;
...@@ -632,7 +630,6 @@ static void __devexit eesoxscsi_remove(struct expansion_card *ec) ...@@ -632,7 +630,6 @@ static void __devexit eesoxscsi_remove(struct expansion_card *ec)
{ {
struct Scsi_Host *host = ecard_get_drvdata(ec); struct Scsi_Host *host = ecard_get_drvdata(ec);
struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
unsigned long resbase, reslen;
ecard_set_drvdata(ec, NULL); ecard_set_drvdata(ec, NULL);
fas216_remove(host); fas216_remove(host);
...@@ -645,13 +642,9 @@ static void __devexit eesoxscsi_remove(struct expansion_card *ec) ...@@ -645,13 +642,9 @@ static void __devexit eesoxscsi_remove(struct expansion_card *ec)
iounmap((void *)host->base); iounmap((void *)host->base);
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
release_mem_region(resbase, reslen);
fas216_release(host); fas216_release(host);
scsi_host_put(host); scsi_host_put(host);
ecard_release_resources(ec);
} }
static const struct ecard_id eesoxscsi_cids[] = { static const struct ecard_id eesoxscsi_cids[] = {
......
...@@ -318,14 +318,12 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -318,14 +318,12 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
unsigned char *base; unsigned char *base;
int ret; int ret;
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST); ret = ecard_request_resources(ec);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST); if (ret)
if (!request_mem_region(resbase, reslen, "powertecscsi")) {
ret = -EBUSY;
goto out; goto out;
}
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
base = ioremap(resbase, reslen); base = ioremap(resbase, reslen);
if (!base) { if (!base) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -413,7 +411,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -413,7 +411,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
iounmap(base); iounmap(base);
out_region: out_region:
release_mem_region(resbase, reslen); ecard_release_resources(ec);
out: out:
return ret; return ret;
...@@ -423,7 +421,6 @@ static void __devexit powertecscsi_remove(struct expansion_card *ec) ...@@ -423,7 +421,6 @@ static void __devexit powertecscsi_remove(struct expansion_card *ec)
{ {
struct Scsi_Host *host = ecard_get_drvdata(ec); struct Scsi_Host *host = ecard_get_drvdata(ec);
struct powertecscsi_info *info = (struct powertecscsi_info *)host->hostdata; struct powertecscsi_info *info = (struct powertecscsi_info *)host->hostdata;
unsigned long resbase, reslen;
ecard_set_drvdata(ec, NULL); ecard_set_drvdata(ec, NULL);
fas216_remove(host); fas216_remove(host);
...@@ -436,13 +433,9 @@ static void __devexit powertecscsi_remove(struct expansion_card *ec) ...@@ -436,13 +433,9 @@ static void __devexit powertecscsi_remove(struct expansion_card *ec)
iounmap((void *)host->base); iounmap((void *)host->base);
resbase = ecard_resource_start(ec, ECARD_RES_IOCFAST);
reslen = ecard_resource_len(ec, ECARD_RES_IOCFAST);
release_mem_region(resbase, reslen);
fas216_release(host); fas216_release(host);
scsi_host_put(host); scsi_host_put(host);
ecard_release_resources(ec);
} }
static const struct ecard_id powertecscsi_cids[] = { static const struct ecard_id powertecscsi_cids[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment