Commit a2132900 authored by Ben Dooks's avatar Ben Dooks Committed by Russell King

[ARM PATCH] 2043/1: S3C2410 update to registered devices

Patch from Ben Dooks

Updated all arch/arm/mach-s3c2410/mach-XXX.c files to
register default set of devices

Added new board struct to keep this sort of info, as it
isn't possible to register platform_devices until after
the init_io functions have been called.
parent 3ecf83f8
/* linux/arch/arm/mach-s3c2410/mach-bast.c /* linux/arch/arm/mach-s3c2410/mach-bast.c
* *
* Copyright (c) 2003 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/
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* Modifications: * Modifications:
* 20-Aug-2004 BJD Added s3c2410_board struct
* 18-Aug-2004 BJD Added platform devices from default set
* 16-May-2003 BJD Created initial version * 16-May-2003 BJD Created initial version
* 16-Aug-2003 BJD Fixed header files and copyright, added URL * 16-Aug-2003 BJD Fixed header files and copyright, added URL
* 05-Sep-2003 BJD Moved to v2.6 kernel * 05-Sep-2003 BJD Moved to v2.6 kernel
...@@ -23,6 +25,7 @@ ...@@ -23,6 +25,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -39,6 +42,7 @@ ...@@ -39,6 +42,7 @@
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "devs.h"
/* macros for virtual address mods for the io space entries */ /* macros for virtual address mods for the io space entries */
#define VA_C5(item) ((item) + BAST_VAM_CS5) #define VA_C5(item) ((item) + BAST_VAM_CS5)
...@@ -154,6 +158,7 @@ static struct s3c2410_uartcfg bast_uartcfgs[] = { ...@@ -154,6 +158,7 @@ static struct s3c2410_uartcfg bast_uartcfgs[] = {
[1] = { [1] = {
.hwport = 1, .hwport = 1,
.flags = 0, .flags = 0,
.clock = &bast_serial_clock, .clock = &bast_serial_clock,
.ucon = UCON, .ucon = UCON,
.ulcon = ULCON, .ulcon = ULCON,
...@@ -170,19 +175,30 @@ static struct s3c2410_uartcfg bast_uartcfgs[] = { ...@@ -170,19 +175,30 @@ static struct s3c2410_uartcfg bast_uartcfgs[] = {
} }
}; };
static struct platform_device *bast_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
};
static struct s3c2410_board bast_board __initdata = {
.devices = bast_devices,
.devices_count = ARRAY_SIZE(bast_devices)
};
void __init bast_map_io(void) void __init bast_map_io(void)
{ {
s3c2410_map_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); s3c2410_map_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
s3c2410_uartcfgs = bast_uartcfgs; s3c2410_uartcfgs = bast_uartcfgs;
s3c2410_set_board(&bast_board);
} }
void __init bast_init_irq(void) void __init bast_init_irq(void)
{ {
//llprintk("bast_init_irq:\n");
s3c2410_init_irq(); s3c2410_init_irq();
} }
void __init bast_init_time(void) void __init bast_init_time(void)
......
/* linux/arch/arm/mach-s3c2410/mach-ipaq.c /* linux/arch/arm/mach-s3c2410/mach-h1940.c
* *
* Copyright (c) 2003 Simtec Electronics * Copyright (c) 2003,2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk> * Ben Dooks <ben@simtec.co.uk>
* *
* http://www.handhelds.org/projects/h1940.html * http://www.handhelds.org/projects/h1940.html
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,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
* 17-Feb-2003 BJD Copied to mach-ipaq.c * 17-Feb-2003 BJD Copied to mach-ipaq.c
* 21-Aug-2004 BJD Added struct s3c2410_board
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "devs.h"
static struct map_desc ipaq_iodesc[] __initdata = { static struct map_desc ipaq_iodesc[] __initdata = {
/* nothing here yet */ /* nothing here yet */
...@@ -77,10 +79,27 @@ static struct s3c2410_uartcfg ipaq_uartcfgs[] = { ...@@ -77,10 +79,27 @@ static struct s3c2410_uartcfg ipaq_uartcfgs[] = {
}; };
static struct platform_device *h1940_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
};
static struct s3c2410_board h1940_board __initdata = {
.devices = h1940_devices,
.devices_count = ARRAY_SIZE(h1940_devices)
};
void __init ipaq_map_io(void) void __init ipaq_map_io(void)
{ {
s3c2410_map_io(ipaq_iodesc, ARRAY_SIZE(ipaq_iodesc)); s3c2410_map_io(ipaq_iodesc, ARRAY_SIZE(ipaq_iodesc));
s3c2410_uartcfgs = ipaq_uartcfgs; s3c2410_uartcfgs = ipaq_uartcfgs;
s3c2410_set_board(&h1940_board);
} }
void __init ipaq_init_irq(void) void __init ipaq_init_irq(void)
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "devs.h"
static struct map_desc smdk2410_iodesc[] __initdata = { static struct map_desc smdk2410_iodesc[] __initdata = {
/* nothing here yet */ /* nothing here yet */
...@@ -87,11 +87,25 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { ...@@ -87,11 +87,25 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
} }
}; };
static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
};
static struct s3c2410_board smdk2410_board __initdata = {
.devices = smdk2410_devices,
.devices_count = ARRAY_SIZE(smdk2410_devices)
};
void __init smdk2410_map_io(void) void __init smdk2410_map_io(void)
{ {
s3c2410_map_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); s3c2410_map_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
s3c2410_uartcfgs = smdk2410_uartcfgs; s3c2410_uartcfgs = smdk2410_uartcfgs;
s3c2410_set_board(&smdk2410_board);
} }
void __init smdk2410_init_irq(void) void __init smdk2410_init_irq(void)
......
...@@ -11,13 +11,8 @@ ...@@ -11,13 +11,8 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
* *
* Modifications: * Modifications:
* 21-Aug-2004 BJD Added struct s3c2410_board
* 06-Aug-2004 BJD Fixed call to time initialisation * 06-Aug-2004 BJD Fixed call to time initialisation
* 12-Jul-2004 BJD Renamed machine
* 16-May-2003 BJD Created initial version
* 16-Aug-2003 BJD Fixed header files and copyright, added URL
* 05-Sep-2003 BJD Moved to v2.6 kernel
* 06-Jan-2003 BJD Updates for <arch/map.h>
* 18-Jan-2003 BJD Added serial port configuration
* 05-Apr-2004 BJD Copied to make mach-vr1000.c * 05-Apr-2004 BJD Copied to make mach-vr1000.c
*/ */
...@@ -44,6 +39,7 @@ ...@@ -44,6 +39,7 @@
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h" #include "s3c2410.h"
#include "devs.h"
/* macros for virtual address mods for the io space entries */ /* macros for virtual address mods for the io space entries */
#define VA_C5(item) ((item) + BAST_VAM_CS5) #define VA_C5(item) ((item) + BAST_VAM_CS5)
...@@ -143,11 +139,26 @@ static struct s3c2410_uartcfg vr1000_uartcfgs[] = { ...@@ -143,11 +139,26 @@ static struct s3c2410_uartcfg vr1000_uartcfgs[] = {
} }
}; };
static struct platform_device *vr1000_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
};
static struct s3c2410_board vr1000_board __initdata = {
.devices = vr1000_devices,
.devices_count = ARRAY_SIZE(vr1000_devices)
};
void __init vr1000_map_io(void) void __init vr1000_map_io(void)
{ {
s3c2410_map_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); s3c2410_map_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
s3c2410_uartcfgs = vr1000_uartcfgs; s3c2410_uartcfgs = vr1000_uartcfgs;
s3c2410_set_board(&vr1000_board);
} }
void __init vr1000_init_irq(void) void __init vr1000_init_irq(void)
......
/* linux/arch/arm/mach-s3c2410/s3c2410.c /* linux/arch/arm/mach-s3c2410/s3c2410.c
* *
* Copyright (c) 2003 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/
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
* 16-May-2003 BJD Created initial version * 16-May-2003 BJD Created initial version
* 16-Aug-2003 BJD Fixed header files and copyright, added URL * 16-Aug-2003 BJD Fixed header files and copyright, added URL
* 05-Sep-2003 BJD Moved to kernel v2.6 * 05-Sep-2003 BJD Moved to kernel v2.6
* 18-Jan-2003 BJD Added serial port configuration * 18-Jan-2004 BJD Added serial port configuration
* 21-Aug-2004 BJD Added new struct s3c2410_board handler
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -35,6 +36,8 @@ ...@@ -35,6 +36,8 @@
#include <asm/arch/regs-clock.h> #include <asm/arch/regs-clock.h>
#include <asm/arch/regs-serial.h> #include <asm/arch/regs-serial.h>
#include "s3c2410.h"
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 */ /* serial port setup */
...@@ -59,21 +62,12 @@ static struct map_desc s3c2410_iodesc[] __initdata = { ...@@ -59,21 +62,12 @@ static struct map_desc s3c2410_iodesc[] __initdata = {
IODESC_ENT(IRQ), IODESC_ENT(IRQ),
IODESC_ENT(MEMCTRL), IODESC_ENT(MEMCTRL),
IODESC_ENT(USBHOST), IODESC_ENT(USBHOST),
IODESC_ENT(DMA),
IODESC_ENT(CLKPWR), IODESC_ENT(CLKPWR),
IODESC_ENT(LCD), IODESC_ENT(LCD),
IODESC_ENT(NAND),
IODESC_ENT(UART), IODESC_ENT(UART),
IODESC_ENT(TIMER), IODESC_ENT(TIMER),
IODESC_ENT(USBDEV),
IODESC_ENT(WATCHDOG),
IODESC_ENT(IIC),
IODESC_ENT(IIS),
IODESC_ENT(GPIO), IODESC_ENT(GPIO),
IODESC_ENT(RTC),
IODESC_ENT(ADC), IODESC_ENT(ADC),
IODESC_ENT(SPI),
IODESC_ENT(SDI)
}; };
static struct resource s3c_uart0_resource[] = { static struct resource s3c_uart0_resource[] = {
...@@ -175,6 +169,12 @@ void __init s3c2410_map_io(struct map_desc *mach_desc, int size) ...@@ -175,6 +169,12 @@ void __init s3c2410_map_io(struct map_desc *mach_desc, int size)
print_mhz(s3c2410_pclk)); print_mhz(s3c2410_pclk));
} }
static struct s3c2410_board *board;
void s3c2410_set_board(struct s3c2410_board *b)
{
board = b;
}
static int __init s3c2410_init(void) static int __init s3c2410_init(void)
{ {
...@@ -183,6 +183,22 @@ static int __init s3c2410_init(void) ...@@ -183,6 +183,22 @@ static int __init s3c2410_init(void)
printk("S3C2410: Initialising architecture\n"); printk("S3C2410: Initialising architecture\n");
ret = platform_add_devices(uart_devices, ARRAY_SIZE(uart_devices)); ret = platform_add_devices(uart_devices, ARRAY_SIZE(uart_devices));
if (ret)
return ret;
if (board != NULL) {
if (board->devices != NULL) {
ret = platform_add_devices(board->devices,
board->devices_count);
if (ret) {
printk(KERN_ERR "s3c2410: failed to add board devices (%d)\n", ret);
}
}
/* not adding board devices may not be fatal */
ret = 0;
}
return ret; return ret;
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Modifications: * Modifications:
* 18-Aug-2004 BJD Created initial version * 18-Aug-2004 BJD Created initial version
* * 20-Aug-2004 BJD Added s3c2410_board struct
*/ */
extern void s3c2410_map_io(struct map_desc *, int count); extern void s3c2410_map_io(struct map_desc *, int count);
...@@ -20,3 +20,16 @@ extern void s3c2410_init_irq(void); ...@@ -20,3 +20,16 @@ extern void s3c2410_init_irq(void);
extern void s3c2410_init_time(void); extern void s3c2410_init_time(void);
/* the board structure is used at first initialsation time
* to get info such as the devices to register for this
* board. This is done because platfrom_add_devices() cannot
* be called from the map_io entry.
*
*/
struct s3c2410_board {
struct platform_device **devices;
unsigned int devices_count;
};
extern void s3c2410_set_board(struct s3c2410_board *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