diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 20:34:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 20:34:23 -0500 |
commit | f90203e0cf0d5a8b027d511af318bb3db4758fe2 (patch) | |
tree | d2d9157331857b4220198e053e30ce3427c5140e /drivers | |
parent | 33e563c1190c26b6bf61990c505cdcb5cdbba7e4 (diff) | |
parent | 719c91ccadd3ed26570dbb29d54166914832eee9 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc
* master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc: (61 commits)
[POWERPC] Use udbg_early_init() on ppc32
[POWERPC] Open Firmware serial port driver
[POWERPC] Move MPIC smp routines into mpic.c
[POWERPC] Cleanup pseries kexec code
[POWERPC] Cleanup pseries smp initialisation code
[POWERPC] Consolidate pseries platform header files into pseries.h
[POWERPC] 85xx: Drop use of SYNC macro in head_fsl_booke.S
[POWERPC] cell: pm_rtas_activat_signals routine cleanup
[POWERPC] cell: PPU Oprofile cleanup patch
[POWERPC] spufs: avoid accessing kernel memory through mmapped /mem node
[POWERPC] spu sched: static timeslicing for SCHED_RR contexts
[POWERPC] spu sched: use DECLARE_BITMAP
[POWERPC] spu sched: forced preemption at execution
[POWERPC] spu sched: update some comments
[POWERPC] spu sched: simplity spu_remove_from_active_list
[POWERPC] spufs: optimize spu_run
[POWERPC] spufs: runqueue simplification
[POWERPC] spufs: move prio to spu_context
[POWERPC] spufs: state_mutex cleanup
[POWERPC] spufs: simplify state_mutex
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_mpc52xx.c | 6 | ||||
-rw-r--r-- | drivers/macintosh/adbhid.c | 4 | ||||
-rw-r--r-- | drivers/macintosh/apm_emu.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/mac_hid.c | 4 | ||||
-rw-r--r-- | drivers/macintosh/therm_adt746x.c | 6 | ||||
-rw-r--r-- | drivers/macintosh/via-cuda.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/via-macii.c | 10 | ||||
-rw-r--r-- | drivers/macintosh/via-maciisi.c | 6 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu.c | 13 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu68k.c | 4 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 10 | ||||
-rw-r--r-- | drivers/serial/Makefile | 1 | ||||
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 5 | ||||
-rw-r--r-- | drivers/serial/of_serial.c | 143 |
14 files changed, 183 insertions, 33 deletions
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index d7378df44970..29e1809e5ecf 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -484,10 +484,8 @@ mpc52xx_ata_resume(struct of_device *op) | |||
484 | 484 | ||
485 | static struct of_device_id mpc52xx_ata_of_match[] = { | 485 | static struct of_device_id mpc52xx_ata_of_match[] = { |
486 | { | 486 | { |
487 | .compatible = "mpc5200-ata", | 487 | .type = "ata", |
488 | }, | 488 | .compatible = "mpc5200-ata", |
489 | { | ||
490 | .compatible = "mpc52xx-ata", | ||
491 | }, | 489 | }, |
492 | {}, | 490 | {}, |
493 | }; | 491 | }; |
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index 1c7d6f221b55..b77ef5187d6d 100644 --- a/drivers/macintosh/adbhid.c +++ b/drivers/macintosh/adbhid.c | |||
@@ -574,8 +574,8 @@ static struct adb_request led_request; | |||
574 | static int leds_pending[16]; | 574 | static int leds_pending[16]; |
575 | static int leds_req_pending; | 575 | static int leds_req_pending; |
576 | static int pending_devs[16]; | 576 | static int pending_devs[16]; |
577 | static int pending_led_start=0; | 577 | static int pending_led_start; |
578 | static int pending_led_end=0; | 578 | static int pending_led_end; |
579 | static DEFINE_SPINLOCK(leds_lock); | 579 | static DEFINE_SPINLOCK(leds_lock); |
580 | 580 | ||
581 | static void leds_done(struct adb_request *req) | 581 | static void leds_done(struct adb_request *req) |
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c index a6d50f4fabd7..c5e4d43f97fc 100644 --- a/drivers/macintosh/apm_emu.c +++ b/drivers/macintosh/apm_emu.c | |||
@@ -102,7 +102,7 @@ static struct pmu_sleep_notifier apm_sleep_notifier = { | |||
102 | SLEEP_LEVEL_USERLAND, | 102 | SLEEP_LEVEL_USERLAND, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static char driver_version[] = "0.5"; /* no spaces */ | 105 | static const char driver_version[] = "0.5"; /* no spaces */ |
106 | 106 | ||
107 | #ifdef DEBUG | 107 | #ifdef DEBUG |
108 | static char * apm_event_name[] = { | 108 | static char * apm_event_name[] = { |
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index ee6b4ca69130..f632cec9ce45 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c | |||
@@ -17,10 +17,10 @@ | |||
17 | 17 | ||
18 | static struct input_dev *emumousebtn; | 18 | static struct input_dev *emumousebtn; |
19 | static int emumousebtn_input_register(void); | 19 | static int emumousebtn_input_register(void); |
20 | static int mouse_emulate_buttons = 0; | 20 | static int mouse_emulate_buttons; |
21 | static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ | 21 | static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ |
22 | static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ | 22 | static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ |
23 | static int mouse_last_keycode = 0; | 23 | static int mouse_last_keycode; |
24 | 24 | ||
25 | #if defined(CONFIG_SYSCTL) | 25 | #if defined(CONFIG_SYSCTL) |
26 | /* file(s) in /proc/sys/dev/mac_hid */ | 26 | /* file(s) in /proc/sys/dev/mac_hid */ |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 3d3bf1643e73..a7ce55926638 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -48,11 +48,11 @@ static u8 FAN_SPD_SET[2] = {0x30, 0x31}; | |||
48 | 48 | ||
49 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ | 49 | static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ |
50 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ | 50 | static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ |
51 | static const char *sensor_location[3] = {NULL, NULL, NULL}; | 51 | static const char *sensor_location[3]; |
52 | 52 | ||
53 | static int limit_adjust = 0; | 53 | static int limit_adjust; |
54 | static int fan_speed = -1; | 54 | static int fan_speed = -1; |
55 | static int verbose = 0; | 55 | static int verbose; |
56 | 56 | ||
57 | MODULE_AUTHOR("Colin Leroy <colin@colino.net>"); | 57 | MODULE_AUTHOR("Colin Leroy <colin@colino.net>"); |
58 | MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and " | 58 | MODULE_DESCRIPTION("Driver for ADT746x thermostat in iBook G4 and " |
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index df66291b1322..3797f503cd6c 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c | |||
@@ -86,7 +86,7 @@ static int data_index; | |||
86 | #ifdef CONFIG_PPC | 86 | #ifdef CONFIG_PPC |
87 | static struct device_node *vias; | 87 | static struct device_node *vias; |
88 | #endif | 88 | #endif |
89 | static int cuda_fully_inited = 0; | 89 | static int cuda_fully_inited; |
90 | 90 | ||
91 | #ifdef CONFIG_ADB | 91 | #ifdef CONFIG_ADB |
92 | static int cuda_probe(void); | 92 | static int cuda_probe(void); |
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c index 5d88d5b0ad99..175b3e56e375 100644 --- a/drivers/macintosh/via-macii.c +++ b/drivers/macintosh/via-macii.c | |||
@@ -107,10 +107,10 @@ static enum macii_state { | |||
107 | awaiting_reply | 107 | awaiting_reply |
108 | } macii_state; | 108 | } macii_state; |
109 | 109 | ||
110 | static int need_poll = 0; | 110 | static int need_poll; |
111 | static int command_byte = 0; | 111 | static int command_byte; |
112 | static int last_reply = 0; | 112 | static int last_reply; |
113 | static int last_active = 0; | 113 | static int last_active; |
114 | 114 | ||
115 | static struct adb_request *current_req; | 115 | static struct adb_request *current_req; |
116 | static struct adb_request *last_req; | 116 | static struct adb_request *last_req; |
@@ -124,7 +124,7 @@ static int first_byte; | |||
124 | static int prefix_len; | 124 | static int prefix_len; |
125 | static int status = ST_IDLE|TREQ; | 125 | static int status = ST_IDLE|TREQ; |
126 | static int last_status; | 126 | static int last_status; |
127 | static int driver_running = 0; | 127 | static int driver_running; |
128 | 128 | ||
129 | /* debug level 10 required for ADB logging (should be && debug_adb, ideally) */ | 129 | /* debug level 10 required for ADB logging (should be && debug_adb, ideally) */ |
130 | 130 | ||
diff --git a/drivers/macintosh/via-maciisi.c b/drivers/macintosh/via-maciisi.c index 1f0aa5dc9aa5..10051db48d23 100644 --- a/drivers/macintosh/via-maciisi.c +++ b/drivers/macintosh/via-maciisi.c | |||
@@ -63,10 +63,10 @@ static volatile unsigned char *via; | |||
63 | 63 | ||
64 | #undef DEBUG_MACIISI_ADB | 64 | #undef DEBUG_MACIISI_ADB |
65 | 65 | ||
66 | static struct adb_request* current_req = NULL; | 66 | static struct adb_request* current_req; |
67 | static struct adb_request* last_req = NULL; | 67 | static struct adb_request* last_req; |
68 | static unsigned char maciisi_rbuf[16]; | 68 | static unsigned char maciisi_rbuf[16]; |
69 | static unsigned char *reply_ptr = NULL; | 69 | static unsigned char *reply_ptr; |
70 | static int data_index; | 70 | static int data_index; |
71 | static int reading_reply; | 71 | static int reading_reply; |
72 | static int reply_len; | 72 | static int reply_len; |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 96bea4b62c43..b6073bdb50c3 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -141,13 +141,13 @@ static volatile int adb_int_pending; | |||
141 | static volatile int disable_poll; | 141 | static volatile int disable_poll; |
142 | static struct device_node *vias; | 142 | static struct device_node *vias; |
143 | static int pmu_kind = PMU_UNKNOWN; | 143 | static int pmu_kind = PMU_UNKNOWN; |
144 | static int pmu_fully_inited = 0; | 144 | static int pmu_fully_inited; |
145 | static int pmu_has_adb; | 145 | static int pmu_has_adb; |
146 | static struct device_node *gpio_node; | 146 | static struct device_node *gpio_node; |
147 | static unsigned char __iomem *gpio_reg = NULL; | 147 | static unsigned char __iomem *gpio_reg; |
148 | static int gpio_irq = NO_IRQ; | 148 | static int gpio_irq = NO_IRQ; |
149 | static int gpio_irq_enabled = -1; | 149 | static int gpio_irq_enabled = -1; |
150 | static volatile int pmu_suspended = 0; | 150 | static volatile int pmu_suspended; |
151 | static spinlock_t pmu_lock; | 151 | static spinlock_t pmu_lock; |
152 | static u8 pmu_intr_mask; | 152 | static u8 pmu_intr_mask; |
153 | static int pmu_version; | 153 | static int pmu_version; |
@@ -169,7 +169,7 @@ static int option_server_mode; | |||
169 | 169 | ||
170 | int pmu_battery_count; | 170 | int pmu_battery_count; |
171 | int pmu_cur_battery; | 171 | int pmu_cur_battery; |
172 | unsigned int pmu_power_flags; | 172 | unsigned int pmu_power_flags = PMU_PWR_AC_PRESENT; |
173 | struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; | 173 | struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; |
174 | static int query_batt_timer = BATTERY_POLLING_COUNT; | 174 | static int query_batt_timer = BATTERY_POLLING_COUNT; |
175 | static struct adb_request batt_req; | 175 | static struct adb_request batt_req; |
@@ -180,7 +180,7 @@ int asleep; | |||
180 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); | 180 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); |
181 | 181 | ||
182 | #ifdef CONFIG_ADB | 182 | #ifdef CONFIG_ADB |
183 | static int adb_dev_map = 0; | 183 | static int adb_dev_map; |
184 | static int pmu_adb_flags; | 184 | static int pmu_adb_flags; |
185 | 185 | ||
186 | static int pmu_probe(void); | 186 | static int pmu_probe(void); |
@@ -2776,7 +2776,7 @@ pmu_polled_request(struct adb_request *req) | |||
2776 | 2776 | ||
2777 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 2777 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) |
2778 | 2778 | ||
2779 | static int pmu_sys_suspended = 0; | 2779 | static int pmu_sys_suspended; |
2780 | 2780 | ||
2781 | static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) | 2781 | static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) |
2782 | { | 2782 | { |
@@ -2816,7 +2816,6 @@ static struct sysdev_class pmu_sysclass = { | |||
2816 | }; | 2816 | }; |
2817 | 2817 | ||
2818 | static struct sys_device device_pmu = { | 2818 | static struct sys_device device_pmu = { |
2819 | .id = 0, | ||
2820 | .cls = &pmu_sysclass, | 2819 | .cls = &pmu_sysclass, |
2821 | }; | 2820 | }; |
2822 | 2821 | ||
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index 4f5b6fa196c5..54baee57d2f8 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c | |||
@@ -96,10 +96,10 @@ static int data_index; | |||
96 | static int data_len; | 96 | static int data_len; |
97 | static int adb_int_pending; | 97 | static int adb_int_pending; |
98 | static int pmu_adb_flags; | 98 | static int pmu_adb_flags; |
99 | static int adb_dev_map = 0; | 99 | static int adb_dev_map; |
100 | static struct adb_request bright_req_1, bright_req_2, bright_req_3; | 100 | static struct adb_request bright_req_1, bright_req_2, bright_req_3; |
101 | static int pmu_kind = PMU_UNKNOWN; | 101 | static int pmu_kind = PMU_UNKNOWN; |
102 | static int pmu_fully_inited = 0; | 102 | static int pmu_fully_inited; |
103 | 103 | ||
104 | int asleep; | 104 | int asleep; |
105 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); | 105 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 5cc6b91f8408..d0edbaacb1f7 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -999,4 +999,14 @@ config SERIAL_NETX_CONSOLE | |||
999 | If you have enabled the serial port on the Motorola IMX | 999 | If you have enabled the serial port on the Motorola IMX |
1000 | CPU you can make it the console by answering Y to this option. | 1000 | CPU you can make it the console by answering Y to this option. |
1001 | 1001 | ||
1002 | config SERIAL_OF_PLATFORM | ||
1003 | tristate "Serial port on Open Firmware platform bus" | ||
1004 | depends on PPC_OF | ||
1005 | depends on SERIAL_8250 | ||
1006 | help | ||
1007 | If you have a PowerPC based system that has serial ports | ||
1008 | on a platform specific bus, you should enable this option. | ||
1009 | Currently, only 8250 compatible ports are supported, but | ||
1010 | others can easily be added. | ||
1011 | |||
1002 | endmenu | 1012 | endmenu |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index df3632cd7df9..f3f82587b5fa 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -58,3 +58,4 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o | |||
58 | obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o | 58 | obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o |
59 | obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o | 59 | obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o |
60 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o | 60 | obj-$(CONFIG_SERIAL_NETX) += netx-serial.o |
61 | obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 3c4b6c243712..955bbd653e22 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -127,8 +127,7 @@ static irqreturn_t mpc52xx_uart_int(int irq,void *dev_id); | |||
127 | 127 | ||
128 | #if defined(CONFIG_PPC_MERGE) | 128 | #if defined(CONFIG_PPC_MERGE) |
129 | static struct of_device_id mpc52xx_uart_of_match[] = { | 129 | static struct of_device_id mpc52xx_uart_of_match[] = { |
130 | { .type = "serial", .compatible = "mpc52xx-psc-uart", }, | 130 | { .type = "serial", .compatible = "mpc5200-psc-uart", }, |
131 | { .type = "serial", .compatible = "mpc5200-psc", }, /* Efika only! */ | ||
132 | {}, | 131 | {}, |
133 | }; | 132 | }; |
134 | #endif | 133 | #endif |
@@ -1068,7 +1067,7 @@ mpc52xx_uart_of_enumerate(void) | |||
1068 | continue; | 1067 | continue; |
1069 | 1068 | ||
1070 | /* Is a particular device number requested? */ | 1069 | /* Is a particular device number requested? */ |
1071 | devno = get_property(np, "device_no", NULL); | 1070 | devno = get_property(np, "port-number", NULL); |
1072 | mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1); | 1071 | mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1); |
1073 | } | 1072 | } |
1074 | 1073 | ||
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c new file mode 100644 index 000000000000..09b0b736a751 --- /dev/null +++ b/drivers/serial/of_serial.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * Serial Port driver for Open Firmware platform devices | ||
3 | * | ||
4 | * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/serial_core.h> | ||
15 | #include <linux/serial_8250.h> | ||
16 | |||
17 | #include <asm/of_platform.h> | ||
18 | #include <asm/prom.h> | ||
19 | |||
20 | /* | ||
21 | * Fill a struct uart_port for a given device node | ||
22 | */ | ||
23 | static int __devinit of_platform_serial_setup(struct of_device *ofdev, | ||
24 | int type, struct uart_port *port) | ||
25 | { | ||
26 | struct resource resource; | ||
27 | struct device_node *np = ofdev->node; | ||
28 | const unsigned int *clk, *spd; | ||
29 | int ret; | ||
30 | |||
31 | memset(port, 0, sizeof *port); | ||
32 | spd = get_property(np, "current-speed", NULL); | ||
33 | clk = get_property(np, "clock-frequency", NULL); | ||
34 | if (!clk) { | ||
35 | dev_warn(&ofdev->dev, "no clock-frequency property set\n"); | ||
36 | return -ENODEV; | ||
37 | } | ||
38 | |||
39 | ret = of_address_to_resource(np, 0, &resource); | ||
40 | if (ret) { | ||
41 | dev_warn(&ofdev->dev, "invalid address\n"); | ||
42 | return ret; | ||
43 | } | ||
44 | |||
45 | spin_lock_init(&port->lock); | ||
46 | port->mapbase = resource.start; | ||
47 | port->irq = irq_of_parse_and_map(np, 0); | ||
48 | port->iotype = UPIO_MEM; | ||
49 | port->type = type; | ||
50 | port->uartclk = *clk; | ||
51 | port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP; | ||
52 | port->dev = &ofdev->dev; | ||
53 | port->custom_divisor = *clk / (16 * (*spd)); | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | /* | ||
59 | * Try to register a serial port | ||
60 | */ | ||
61 | static int __devinit of_platform_serial_probe(struct of_device *ofdev, | ||
62 | const struct of_device_id *id) | ||
63 | { | ||
64 | struct uart_port port; | ||
65 | int port_type; | ||
66 | int ret; | ||
67 | |||
68 | if (of_find_property(ofdev->node, "used-by-rtas", NULL)) | ||
69 | return -EBUSY; | ||
70 | |||
71 | port_type = (unsigned long)id->data; | ||
72 | ret = of_platform_serial_setup(ofdev, port_type, &port); | ||
73 | if (ret) | ||
74 | goto out; | ||
75 | |||
76 | switch (port_type) { | ||
77 | case PORT_UNKNOWN: | ||
78 | dev_info(&ofdev->dev, "Unknown serial port found, " | ||
79 | "attempting to use 8250 driver\n"); | ||
80 | /* fallthrough */ | ||
81 | case PORT_8250 ... PORT_MAX_8250: | ||
82 | ret = serial8250_register_port(&port); | ||
83 | break; | ||
84 | default: | ||
85 | /* need to add code for these */ | ||
86 | ret = -ENODEV; | ||
87 | break; | ||
88 | } | ||
89 | if (ret < 0) | ||
90 | goto out; | ||
91 | |||
92 | ofdev->dev.driver_data = (void *)(unsigned long)ret; | ||
93 | return 0; | ||
94 | out: | ||
95 | irq_dispose_mapping(port.irq); | ||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * Release a line | ||
101 | */ | ||
102 | static int of_platform_serial_remove(struct of_device *ofdev) | ||
103 | { | ||
104 | int line = (unsigned long)ofdev->dev.driver_data; | ||
105 | serial8250_unregister_port(line); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * A few common types, add more as needed. | ||
111 | */ | ||
112 | static struct of_device_id __devinitdata of_platform_serial_table[] = { | ||
113 | { .type = "serial", .compatible = "ns8250", .data = (void *)PORT_8250, }, | ||
114 | { .type = "serial", .compatible = "ns16450", .data = (void *)PORT_16450, }, | ||
115 | { .type = "serial", .compatible = "ns16550", .data = (void *)PORT_16550, }, | ||
116 | { .type = "serial", .compatible = "ns16750", .data = (void *)PORT_16750, }, | ||
117 | { .type = "serial", .data = (void *)PORT_UNKNOWN, }, | ||
118 | { /* end of list */ }, | ||
119 | }; | ||
120 | |||
121 | static struct of_platform_driver __devinitdata of_platform_serial_driver = { | ||
122 | .owner = THIS_MODULE, | ||
123 | .name = "of_serial", | ||
124 | .probe = of_platform_serial_probe, | ||
125 | .remove = of_platform_serial_remove, | ||
126 | .match_table = of_platform_serial_table, | ||
127 | }; | ||
128 | |||
129 | static int __init of_platform_serial_init(void) | ||
130 | { | ||
131 | return of_register_platform_driver(&of_platform_serial_driver); | ||
132 | } | ||
133 | module_init(of_platform_serial_init); | ||
134 | |||
135 | static void __exit of_platform_serial_exit(void) | ||
136 | { | ||
137 | return of_unregister_platform_driver(&of_platform_serial_driver); | ||
138 | }; | ||
139 | module_exit(of_platform_serial_exit); | ||
140 | |||
141 | MODULE_AUTHOR("Arnd Bergmann <arnd@arndb.de>"); | ||
142 | MODULE_LICENSE("GPL"); | ||
143 | MODULE_DESCRIPTION("Serial Port driver for Open Firmware platform devices"); | ||