Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) |
| 7 | */ |
| 8 | #include <linux/module.h> |
Ralf Baechle | e971290 | 2007-05-24 12:54:04 +0100 | [diff] [blame] | 9 | #include <linux/init.h> |
| 10 | #include <linux/platform_device.h> |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 11 | #include <linux/serial_8250.h> |
| 12 | |
| 13 | #include <asm/ip32/mace.h> |
| 14 | #include <asm/ip32/ip32_ints.h> |
| 15 | |
Thomas Bogendoerfer | c990081 | 2008-01-05 12:13:11 +0100 | [diff] [blame] | 16 | #define MACEISA_SERIAL1_OFFS offsetof(struct sgi_mace, isa.serial1) |
| 17 | #define MACEISA_SERIAL2_OFFS offsetof(struct sgi_mace, isa.serial2) |
| 18 | |
| 19 | #define MACE_PORT(offset,_irq) \ |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 20 | { \ |
Thomas Bogendoerfer | c990081 | 2008-01-05 12:13:11 +0100 | [diff] [blame] | 21 | .mapbase = MACE_BASE + offset, \ |
| 22 | .irq = _irq, \ |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 23 | .uartclk = 1843200, \ |
| 24 | .iotype = UPIO_MEM, \ |
Thomas Bogendoerfer | c990081 | 2008-01-05 12:13:11 +0100 | [diff] [blame] | 25 | .flags = UPF_SKIP_TEST|UPF_IOREMAP, \ |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 26 | .regshift = 8, \ |
| 27 | } |
| 28 | |
| 29 | static struct plat_serial8250_port uart8250_data[] = { |
Thomas Bogendoerfer | c990081 | 2008-01-05 12:13:11 +0100 | [diff] [blame] | 30 | MACE_PORT(MACEISA_SERIAL1_OFFS, MACEISA_SERIAL1_IRQ), |
| 31 | MACE_PORT(MACEISA_SERIAL2_OFFS, MACEISA_SERIAL2_IRQ), |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 32 | { }, |
| 33 | }; |
| 34 | |
| 35 | static struct platform_device uart8250_device = { |
| 36 | .name = "serial8250", |
| 37 | .id = PLAT8250_DEV_PLATFORM, |
| 38 | .dev = { |
| 39 | .platform_data = uart8250_data, |
| 40 | }, |
| 41 | }; |
| 42 | |
| 43 | static int __init uart8250_init(void) |
| 44 | { |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 45 | return platform_device_register(&uart8250_device); |
| 46 | } |
| 47 | |
| 48 | device_initcall(uart8250_init); |
Ralf Baechle | e971290 | 2007-05-24 12:54:04 +0100 | [diff] [blame] | 49 | |
| 50 | static __init int meth_devinit(void) |
| 51 | { |
| 52 | struct platform_device *pd; |
| 53 | int ret; |
| 54 | |
| 55 | pd = platform_device_alloc("meth", -1); |
| 56 | if (!pd) |
| 57 | return -ENOMEM; |
| 58 | |
| 59 | ret = platform_device_add(pd); |
| 60 | if (ret) |
| 61 | platform_device_put(pd); |
| 62 | |
| 63 | return ret; |
| 64 | } |
| 65 | |
| 66 | device_initcall(meth_devinit); |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 67 | |
Thomas Bogendoerfer | 8fa9cc1 | 2008-07-05 01:12:13 +0200 | [diff] [blame] | 68 | static __init int sgio2audio_devinit(void) |
| 69 | { |
| 70 | struct platform_device *pd; |
| 71 | int ret; |
| 72 | |
| 73 | pd = platform_device_alloc("sgio2audio", -1); |
| 74 | if (!pd) |
| 75 | return -ENOMEM; |
| 76 | |
| 77 | ret = platform_device_add(pd); |
| 78 | if (ret) |
| 79 | platform_device_put(pd); |
| 80 | |
| 81 | return ret; |
| 82 | } |
| 83 | |
| 84 | device_initcall(sgio2audio_devinit); |
| 85 | |
| 86 | static __init int sgio2btns_devinit(void) |
| 87 | { |
Thomas Bogendoerfer | 36a0a3c | 2008-07-16 15:18:58 +0200 | [diff] [blame] | 88 | return IS_ERR(platform_device_register_simple("sgibtns", -1, NULL, 0)); |
Thomas Bogendoerfer | 8fa9cc1 | 2008-07-05 01:12:13 +0200 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | device_initcall(sgio2btns_devinit); |
| 92 | |
Thomas Bogendoerfer | 656e950 | 2008-09-23 00:53:20 +0200 | [diff] [blame] | 93 | static struct resource sgio2_cmos_rsrc[] = { |
| 94 | { |
| 95 | .start = 0x70, |
| 96 | .end = 0x71, |
| 97 | .flags = IORESOURCE_IO |
| 98 | } |
| 99 | }; |
| 100 | |
| 101 | static __init int sgio2_cmos_devinit(void) |
| 102 | { |
| 103 | return IS_ERR(platform_device_register_simple("rtc_cmos", -1, |
| 104 | sgio2_cmos_rsrc, 1)); |
| 105 | } |
| 106 | |
| 107 | device_initcall(sgio2_cmos_devinit); |
| 108 | |
Ralf Baechle | e7c4782 | 2007-07-10 17:33:01 +0100 | [diff] [blame] | 109 | MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>"); |
| 110 | MODULE_LICENSE("GPL"); |
| 111 | MODULE_DESCRIPTION("8250 UART probe driver for SGI IP32 aka O2"); |