Commit 608c81fb authored by Russell King's avatar Russell King

[ARM] riscpc: add iomd, keyboard and acornfb platform devices.

- Add iomd, keyboard and acornfb platform devices.
- Convert rpckbd to use centrally registered platform device.
- Convert acornfb to use a platform device.
parent 7a57a3eb
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/device.h>
#include <asm/elf.h> #include <asm/elf.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -84,6 +85,64 @@ static void __init rpc_map_io(void) ...@@ -84,6 +85,64 @@ static void __init rpc_map_io(void)
elf_hwcap &= ~HWCAP_HALF; elf_hwcap &= ~HWCAP_HALF;
} }
static struct resource acornfb_resources[] = {
{ /* VIDC */
.start = 0x03400000,
.end = 0x035fffff,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_VSYNCPULSE,
.end = IRQ_VSYNCPULSE,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device acornfb_device = {
.name = "acornfb",
.id = -1,
.dev = {
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(acornfb_resources),
.resource = acornfb_resources,
};
static struct resource iomd_resources[] = {
{
.start = 0x03200000,
.end = 0x0320ffff,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device iomd_device = {
.name = "iomd",
.id = -1,
.num_resources = ARRAY_SIZE(iomd_resources),
.resource = iomd_resources,
};
static struct platform_device kbd_device = {
.name = "kart",
.id = -1,
.dev = {
.parent = &iomd_device.dev,
},
};
static struct platform_device *devs[] __initdata = {
&iomd_device,
&kbd_device,
&acornfb_device,
};
static int __init rpc_init(void)
{
return platform_add_devices(devs, ARRAY_SIZE(devs));
}
arch_initcall(rpc_init);
extern struct sys_timer ioc_timer; extern struct sys_timer ioc_timer;
MACHINE_START(RISCPC, "Acorn-RiscPC") MACHINE_START(RISCPC, "Acorn-RiscPC")
......
...@@ -45,9 +45,6 @@ MODULE_AUTHOR("Vojtech Pavlik, Russell King"); ...@@ -45,9 +45,6 @@ MODULE_AUTHOR("Vojtech Pavlik, Russell King");
MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static struct serio *rpckbd_port;
static struct platform_device *rpckbd_device;
static int rpckbd_write(struct serio *port, unsigned char val) static int rpckbd_write(struct serio *port, unsigned char val)
{ {
while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) while (!(iomd_readb(IOMD_KCTRL) & (1 << 7)))
...@@ -109,45 +106,50 @@ static void rpckbd_close(struct serio *port) ...@@ -109,45 +106,50 @@ static void rpckbd_close(struct serio *port)
* Allocate and initialize serio structure for subsequent registration * Allocate and initialize serio structure for subsequent registration
* with serio core. * with serio core.
*/ */
static int __devinit rpckbd_probe(struct device *dev)
static struct serio * __init rpckbd_allocate_port(void)
{ {
struct serio *serio; struct serio *serio;
serio = kmalloc(sizeof(struct serio), GFP_KERNEL); serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
if (serio) { if (!serio)
return -ENOMEM;
memset(serio, 0, sizeof(struct serio)); memset(serio, 0, sizeof(struct serio));
serio->type = SERIO_8042; serio->type = SERIO_8042;
serio->write = rpckbd_write; serio->write = rpckbd_write;
serio->open = rpckbd_open; serio->open = rpckbd_open;
serio->close = rpckbd_close; serio->close = rpckbd_close;
serio->dev.parent = &rpckbd_device->dev; serio->dev.parent = dev;
strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name));
strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys));
}
return serio; dev_set_drvdata(dev, serio);
serio_register_port(serio);
return 0;
} }
static int __init rpckbd_init(void) static int __devexit rpckbd_remove(struct device *dev)
{ {
rpckbd_device = platform_device_register_simple("rpckbd", -1, NULL, 0); struct serio *serio = dev_get_drvdata(dev);
if (IS_ERR(rpckbd_device)) serio_unregister_port(serio);
return PTR_ERR(rpckbd_device); return 0;
}
if (!(rpckbd_port = rpckbd_allocate_port())) { static struct device_driver rpckbd_driver = {
platform_device_unregister(rpckbd_device); .name = "kart",
return -ENOMEM; .bus = &platform_bus_type,
} .probe = rpckbd_probe,
.remove = __devexit_p(rpckbd_remove),
};
serio_register_port(rpckbd_port); static int __init rpckbd_init(void)
return 0; {
return driver_register(&rpckbd_driver);
} }
static void __exit rpckbd_exit(void) static void __exit rpckbd_exit(void)
{ {
serio_unregister_port(rpckbd_port); driver_unregister(&rpckbd_driver);
platform_device_unregister(rpckbd_device);
} }
module_init(rpckbd_init); module_init(rpckbd_init);
......
...@@ -1280,13 +1280,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) ...@@ -1280,13 +1280,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
printk("acornfb: freed %dK memory\n", mb_freed); printk("acornfb: freed %dK memory\n", mb_freed);
} }
static struct device acornfb_device = { static int __init acornfb_probe(struct device *dev)
.bus_id = "acornfb",
.coherent_dma_mask = 0xffffffff,
};
int __init
acornfb_init(void)
{ {
unsigned long size; unsigned long size;
u_int h_sync, v_sync; u_int h_sync, v_sync;
...@@ -1299,7 +1293,7 @@ acornfb_init(void) ...@@ -1299,7 +1293,7 @@ acornfb_init(void)
acornfb_init_fbinfo(); acornfb_init_fbinfo();
current_par.dev = &acornfb_device; current_par.dev = dev;
if (current_par.montype == -1) if (current_par.montype == -1)
current_par.montype = acornfb_detect_monitortype(); current_par.montype = acornfb_detect_monitortype();
...@@ -1461,6 +1455,17 @@ acornfb_init(void) ...@@ -1461,6 +1455,17 @@ acornfb_init(void)
return 0; return 0;
} }
static struct device_driver acornfb_driver = {
.name = "acornfb",
.bus = &platform_bus_type,
.probe = acornfb_probe,
};
static int __init acornfb_init(void)
{
return driver_register(&acornfb_driver);
}
module_init(acornfb_init); module_init(acornfb_init);
MODULE_AUTHOR("Russell King"); MODULE_AUTHOR("Russell King");
......
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