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 @@
#include <linux/pm.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/device.h>
#include <asm/elf.h>
#include <asm/io.h>
......@@ -84,6 +85,64 @@ static void __init rpc_map_io(void)
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;
MACHINE_START(RISCPC, "Acorn-RiscPC")
......
......@@ -45,9 +45,6 @@ MODULE_AUTHOR("Vojtech Pavlik, Russell King");
MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver");
MODULE_LICENSE("GPL");
static struct serio *rpckbd_port;
static struct platform_device *rpckbd_device;
static int rpckbd_write(struct serio *port, unsigned char val)
{
while (!(iomd_readb(IOMD_KCTRL) & (1 << 7)))
......@@ -109,45 +106,50 @@ static void rpckbd_close(struct serio *port)
* Allocate and initialize serio structure for subsequent registration
* with serio core.
*/
static struct serio * __init rpckbd_allocate_port(void)
static int __devinit rpckbd_probe(struct device *dev)
{
struct serio *serio;
serio = kmalloc(sizeof(struct serio), GFP_KERNEL);
if (serio) {
memset(serio, 0, sizeof(struct serio));
serio->type = SERIO_8042;
serio->write = rpckbd_write;
serio->open = rpckbd_open;
serio->close = rpckbd_close;
serio->dev.parent = &rpckbd_device->dev;
strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name));
strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys));
}
if (!serio)
return -ENOMEM;
return serio;
memset(serio, 0, sizeof(struct serio));
serio->type = SERIO_8042;
serio->write = rpckbd_write;
serio->open = rpckbd_open;
serio->close = rpckbd_close;
serio->dev.parent = dev;
strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name));
strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys));
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);
if (IS_ERR(rpckbd_device))
return PTR_ERR(rpckbd_device);
struct serio *serio = dev_get_drvdata(dev);
serio_unregister_port(serio);
return 0;
}
if (!(rpckbd_port = rpckbd_allocate_port())) {
platform_device_unregister(rpckbd_device);
return -ENOMEM;
}
static struct device_driver rpckbd_driver = {
.name = "kart",
.bus = &platform_bus_type,
.probe = rpckbd_probe,
.remove = __devexit_p(rpckbd_remove),
};
serio_register_port(rpckbd_port);
return 0;
static int __init rpckbd_init(void)
{
return driver_register(&rpckbd_driver);
}
static void __exit rpckbd_exit(void)
{
serio_unregister_port(rpckbd_port);
platform_device_unregister(rpckbd_device);
driver_unregister(&rpckbd_driver);
}
module_init(rpckbd_init);
......
......@@ -1280,13 +1280,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
printk("acornfb: freed %dK memory\n", mb_freed);
}
static struct device acornfb_device = {
.bus_id = "acornfb",
.coherent_dma_mask = 0xffffffff,
};
int __init
acornfb_init(void)
static int __init acornfb_probe(struct device *dev)
{
unsigned long size;
u_int h_sync, v_sync;
......@@ -1299,7 +1293,7 @@ acornfb_init(void)
acornfb_init_fbinfo();
current_par.dev = &acornfb_device;
current_par.dev = dev;
if (current_par.montype == -1)
current_par.montype = acornfb_detect_monitortype();
......@@ -1461,6 +1455,17 @@ acornfb_init(void)
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_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