Commit 353c291b authored by Ben Dooks's avatar Ben Dooks Committed by Russell King

[ARM PATCH] 2236/1: S3C2410 - new serial driver - machine updates (3/4)

Patch from Ben Dooks

Update the s3c2410 machines for the new serial handling,
as well as add the clock sources the bast and vr1000
rely on.

Signed-off-by: Ben Dooks
Signed-off-by: Russell King
parent 99d55c05
...@@ -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);
......
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