diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_core.c | 2 | ||||
-rw-r--r-- | drivers/serial/of_serial.c | 33 |
2 files changed, 27 insertions, 8 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index b63ff8dd7304..cefde58dbad2 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -678,7 +678,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
678 | } | 678 | } |
679 | bdp->cbd_datlen = count; | 679 | bdp->cbd_datlen = count; |
680 | bdp->cbd_sc |= BD_SC_READY; | 680 | bdp->cbd_sc |= BD_SC_READY; |
681 | __asm__("eieio"); | 681 | eieio(); |
682 | /* Get next BD. */ | 682 | /* Get next BD. */ |
683 | if (bdp->cbd_sc & BD_SC_WRAP) | 683 | if (bdp->cbd_sc & BD_SC_WRAP) |
684 | bdp = pinfo->tx_bd_base; | 684 | bdp = pinfo->tx_bd_base; |
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index 7ffdaeaf0545..a64d85821996 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
@@ -17,6 +17,11 @@ | |||
17 | #include <asm/of_platform.h> | 17 | #include <asm/of_platform.h> |
18 | #include <asm/prom.h> | 18 | #include <asm/prom.h> |
19 | 19 | ||
20 | struct of_serial_info { | ||
21 | int type; | ||
22 | int line; | ||
23 | }; | ||
24 | |||
20 | /* | 25 | /* |
21 | * Fill a struct uart_port for a given device node | 26 | * Fill a struct uart_port for a given device node |
22 | */ | 27 | */ |
@@ -62,6 +67,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev, | |||
62 | static int __devinit of_platform_serial_probe(struct of_device *ofdev, | 67 | static int __devinit of_platform_serial_probe(struct of_device *ofdev, |
63 | const struct of_device_id *id) | 68 | const struct of_device_id *id) |
64 | { | 69 | { |
70 | struct of_serial_info *info; | ||
65 | struct uart_port port; | 71 | struct uart_port port; |
66 | int port_type; | 72 | int port_type; |
67 | int ret; | 73 | int ret; |
@@ -69,30 +75,35 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev, | |||
69 | if (of_find_property(ofdev->node, "used-by-rtas", NULL)) | 75 | if (of_find_property(ofdev->node, "used-by-rtas", NULL)) |
70 | return -EBUSY; | 76 | return -EBUSY; |
71 | 77 | ||
78 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
79 | if (info == NULL) | ||
80 | return -ENOMEM; | ||
81 | |||
72 | port_type = (unsigned long)id->data; | 82 | port_type = (unsigned long)id->data; |
73 | ret = of_platform_serial_setup(ofdev, port_type, &port); | 83 | ret = of_platform_serial_setup(ofdev, port_type, &port); |
74 | if (ret) | 84 | if (ret) |
75 | goto out; | 85 | goto out; |
76 | 86 | ||
77 | switch (port_type) { | 87 | switch (port_type) { |
78 | case PORT_UNKNOWN: | ||
79 | dev_info(&ofdev->dev, "Unknown serial port found, " | ||
80 | "attempting to use 8250 driver\n"); | ||
81 | /* fallthrough */ | ||
82 | case PORT_8250 ... PORT_MAX_8250: | 88 | case PORT_8250 ... PORT_MAX_8250: |
83 | ret = serial8250_register_port(&port); | 89 | ret = serial8250_register_port(&port); |
84 | break; | 90 | break; |
85 | default: | 91 | default: |
86 | /* need to add code for these */ | 92 | /* need to add code for these */ |
93 | case PORT_UNKNOWN: | ||
94 | dev_info(&ofdev->dev, "Unknown serial port found, ignored\n"); | ||
87 | ret = -ENODEV; | 95 | ret = -ENODEV; |
88 | break; | 96 | break; |
89 | } | 97 | } |
90 | if (ret < 0) | 98 | if (ret < 0) |
91 | goto out; | 99 | goto out; |
92 | 100 | ||
93 | ofdev->dev.driver_data = (void *)(unsigned long)ret; | 101 | info->type = port_type; |
102 | info->line = ret; | ||
103 | ofdev->dev.driver_data = info; | ||
94 | return 0; | 104 | return 0; |
95 | out: | 105 | out: |
106 | kfree(info); | ||
96 | irq_dispose_mapping(port.irq); | 107 | irq_dispose_mapping(port.irq); |
97 | return ret; | 108 | return ret; |
98 | } | 109 | } |
@@ -102,8 +113,16 @@ out: | |||
102 | */ | 113 | */ |
103 | static int of_platform_serial_remove(struct of_device *ofdev) | 114 | static int of_platform_serial_remove(struct of_device *ofdev) |
104 | { | 115 | { |
105 | int line = (unsigned long)ofdev->dev.driver_data; | 116 | struct of_serial_info *info = ofdev->dev.driver_data; |
106 | serial8250_unregister_port(line); | 117 | switch (info->type) { |
118 | case PORT_8250 ... PORT_MAX_8250: | ||
119 | serial8250_unregister_port(info->line); | ||
120 | break; | ||
121 | default: | ||
122 | /* need to add code for these */ | ||
123 | break; | ||
124 | } | ||
125 | kfree(info); | ||
107 | return 0; | 126 | return 0; |
108 | } | 127 | } |
109 | 128 | ||