aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-08-01 12:09:34 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-09-25 11:28:26 -0400
commit8d1fb8cbaa74938d8c4379adb693d1d5f5c9e130 (patch)
tree936dc9061e2a9d15c3c53e6578949235066fe5a8 /drivers
parent782f04fc0c2af3c1e92c9d561926a2056b1c72e8 (diff)
serial/mpc52xx_uart: remove code associated with !CONFIG_PPC_MERGE
Now that arch/ppc is gone we don't need CONFIG_PPC_MERGE anymore remove the dead code associated with !CONFIG_PPC_MERGE. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/mpc52xx_uart.c181
1 files changed, 1 insertions, 180 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 36126070d9af..6117d3db0b66 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -72,13 +72,8 @@
72#include <linux/console.h> 72#include <linux/console.h>
73#include <linux/delay.h> 73#include <linux/delay.h>
74#include <linux/io.h> 74#include <linux/io.h>
75
76#if defined(CONFIG_PPC_MERGE)
77#include <linux/of.h> 75#include <linux/of.h>
78#include <linux/of_platform.h> 76#include <linux/of_platform.h>
79#else
80#include <linux/platform_device.h>
81#endif
82 77
83#include <asm/mpc52xx.h> 78#include <asm/mpc52xx.h>
84#include <asm/mpc512x.h> 79#include <asm/mpc512x.h>
@@ -107,12 +102,11 @@ static struct uart_port mpc52xx_uart_ports[MPC52xx_PSC_MAXNUM];
107 * it's cleared, then a memset(...,0,...) should be added to 102 * it's cleared, then a memset(...,0,...) should be added to
108 * the console_init 103 * the console_init
109 */ 104 */
110#if defined(CONFIG_PPC_MERGE) 105
111/* lookup table for matching device nodes to index numbers */ 106/* lookup table for matching device nodes to index numbers */
112static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; 107static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM];
113 108
114static void mpc52xx_uart_of_enumerate(void); 109static void mpc52xx_uart_of_enumerate(void);
115#endif
116 110
117 111
118#define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) 112#define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase))
@@ -255,17 +249,12 @@ static void mpc52xx_psc_cw_restore_ints(struct uart_port *port)
255/* Search for bus-frequency property in this node or a parent */ 249/* Search for bus-frequency property in this node or a parent */
256static unsigned long mpc52xx_getuartclk(void *p) 250static unsigned long mpc52xx_getuartclk(void *p)
257{ 251{
258#if defined(CONFIG_PPC_MERGE)
259 /* 252 /*
260 * 5200 UARTs have a / 32 prescaler 253 * 5200 UARTs have a / 32 prescaler
261 * but the generic serial code assumes 16 254 * but the generic serial code assumes 16
262 * so return ipb freq / 2 255 * so return ipb freq / 2
263 */ 256 */
264 return mpc52xx_find_ipb_freq(p) / 2; 257 return mpc52xx_find_ipb_freq(p) / 2;
265#else
266 pr_debug("unexpected call to mpc52xx_getuartclk with arch/ppc\n");
267 return NULL;
268#endif
269} 258}
270 259
271static struct psc_ops mpc52xx_psc_ops = { 260static struct psc_ops mpc52xx_psc_ops = {
@@ -886,10 +875,6 @@ mpc52xx_console_get_options(struct uart_port *port,
886 875
887 /* CT{U,L}R are write-only ! */ 876 /* CT{U,L}R are write-only ! */
888 *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; 877 *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD;
889#if !defined(CONFIG_PPC_MERGE)
890 if (__res.bi_baudrate)
891 *baud = __res.bi_baudrate;
892#endif
893 878
894 /* Parse them */ 879 /* Parse them */
895 switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { 880 switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
@@ -946,42 +931,6 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count)
946 psc_ops->cw_restore_ints(port); 931 psc_ops->cw_restore_ints(port);
947} 932}
948 933
949#if !defined(CONFIG_PPC_MERGE)
950static int __init
951mpc52xx_console_setup(struct console *co, char *options)
952{
953 struct uart_port *port = &mpc52xx_uart_ports[co->index];
954
955 int baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD;
956 int bits = 8;
957 int parity = 'n';
958 int flow = 'n';
959
960 if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM)
961 return -EINVAL;
962
963 /* Basic port init. Needed since we use some uart_??? func before
964 * real init for early access */
965 spin_lock_init(&port->lock);
966 port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
967 port->ops = &mpc52xx_uart_ops;
968 port->mapbase = MPC52xx_PA(MPC52xx_PSCx_OFFSET(co->index+1));
969
970 /* We ioremap ourself */
971 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE);
972 if (port->membase == NULL)
973 return -EINVAL;
974
975 /* Setup the port parameters accoding to options */
976 if (options)
977 uart_parse_options(options, &baud, &parity, &bits, &flow);
978 else
979 mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow);
980
981 return uart_set_options(port, co, baud, parity, bits, flow);
982}
983
984#else
985 934
986static int __init 935static int __init
987mpc52xx_console_setup(struct console *co, char *options) 936mpc52xx_console_setup(struct console *co, char *options)
@@ -1053,7 +1002,6 @@ mpc52xx_console_setup(struct console *co, char *options)
1053 1002
1054 return uart_set_options(port, co, baud, parity, bits, flow); 1003 return uart_set_options(port, co, baud, parity, bits, flow);
1055} 1004}
1056#endif /* defined(CONFIG_PPC_MERGE) */
1057 1005
1058 1006
1059static struct uart_driver mpc52xx_uart_driver; 1007static struct uart_driver mpc52xx_uart_driver;
@@ -1072,9 +1020,7 @@ static struct console mpc52xx_console = {
1072static int __init 1020static int __init
1073mpc52xx_console_init(void) 1021mpc52xx_console_init(void)
1074{ 1022{
1075#if defined(CONFIG_PPC_MERGE)
1076 mpc52xx_uart_of_enumerate(); 1023 mpc52xx_uart_of_enumerate();
1077#endif
1078 register_console(&mpc52xx_console); 1024 register_console(&mpc52xx_console);
1079 return 0; 1025 return 0;
1080} 1026}
@@ -1100,115 +1046,6 @@ static struct uart_driver mpc52xx_uart_driver = {
1100 .cons = MPC52xx_PSC_CONSOLE, 1046 .cons = MPC52xx_PSC_CONSOLE,
1101}; 1047};
1102 1048
1103
1104#if !defined(CONFIG_PPC_MERGE)
1105/* ======================================================================== */
1106/* Platform Driver */
1107/* ======================================================================== */
1108
1109static int __devinit
1110mpc52xx_uart_probe(struct platform_device *dev)
1111{
1112 struct resource *res = dev->resource;
1113
1114 struct uart_port *port = NULL;
1115 int i, idx, ret;
1116
1117 /* Check validity & presence */
1118 idx = dev->id;
1119 if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM)
1120 return -EINVAL;
1121
1122 if (!mpc52xx_match_psc_function(idx, "uart"))
1123 return -ENODEV;
1124
1125 /* Init the port structure */
1126 port = &mpc52xx_uart_ports[idx];
1127
1128 spin_lock_init(&port->lock);
1129 port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */
1130 port->fifosize = 512;
1131 port->iotype = UPIO_MEM;
1132 port->flags = UPF_BOOT_AUTOCONF |
1133 (uart_console(port) ? 0 : UPF_IOREMAP);
1134 port->line = idx;
1135 port->ops = &mpc52xx_uart_ops;
1136 port->dev = &dev->dev;
1137
1138 /* Search for IRQ and mapbase */
1139 for (i = 0 ; i < dev->num_resources ; i++, res++) {
1140 if (res->flags & IORESOURCE_MEM)
1141 port->mapbase = res->start;
1142 else if (res->flags & IORESOURCE_IRQ)
1143 port->irq = res->start;
1144 }
1145 if (!port->irq || !port->mapbase)
1146 return -EINVAL;
1147
1148 /* Add the port to the uart sub-system */
1149 ret = uart_add_one_port(&mpc52xx_uart_driver, port);
1150 if (!ret)
1151 platform_set_drvdata(dev, (void *)port);
1152
1153 return ret;
1154}
1155
1156static int
1157mpc52xx_uart_remove(struct platform_device *dev)
1158{
1159 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
1160
1161 platform_set_drvdata(dev, NULL);
1162
1163 if (port)
1164 uart_remove_one_port(&mpc52xx_uart_driver, port);
1165
1166 return 0;
1167}
1168
1169#ifdef CONFIG_PM
1170static int
1171mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state)
1172{
1173 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
1174
1175 if (port)
1176 uart_suspend_port(&mpc52xx_uart_driver, port);
1177
1178 return 0;
1179}
1180
1181static int
1182mpc52xx_uart_resume(struct platform_device *dev)
1183{
1184 struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
1185
1186 if (port)
1187 uart_resume_port(&mpc52xx_uart_driver, port);
1188
1189 return 0;
1190}
1191#endif
1192
1193/* work with hotplug and coldplug */
1194MODULE_ALIAS("platform:mpc52xx-psc");
1195
1196static struct platform_driver mpc52xx_uart_platform_driver = {
1197 .probe = mpc52xx_uart_probe,
1198 .remove = mpc52xx_uart_remove,
1199#ifdef CONFIG_PM
1200 .suspend = mpc52xx_uart_suspend,
1201 .resume = mpc52xx_uart_resume,
1202#endif
1203 .driver = {
1204 .owner = THIS_MODULE,
1205 .name = "mpc52xx-psc",
1206 },
1207};
1208#endif /* !defined(CONFIG_PPC_MERGE) */
1209
1210
1211#if defined(CONFIG_PPC_MERGE)
1212/* ======================================================================== */ 1049/* ======================================================================== */
1213/* OF Platform Driver */ 1050/* OF Platform Driver */
1214/* ======================================================================== */ 1051/* ======================================================================== */
@@ -1402,7 +1239,6 @@ static struct of_platform_driver mpc52xx_uart_of_driver = {
1402 .name = "mpc52xx-psc-uart", 1239 .name = "mpc52xx-psc-uart",
1403 }, 1240 },
1404}; 1241};
1405#endif /* defined(CONFIG_PPC_MERGE) */
1406 1242
1407 1243
1408/* ======================================================================== */ 1244/* ======================================================================== */
@@ -1423,7 +1259,6 @@ mpc52xx_uart_init(void)
1423 return ret; 1259 return ret;
1424 } 1260 }
1425 1261
1426#if defined(CONFIG_PPC_MERGE)
1427 mpc52xx_uart_of_enumerate(); 1262 mpc52xx_uart_of_enumerate();
1428 1263
1429 ret = of_register_platform_driver(&mpc52xx_uart_of_driver); 1264 ret = of_register_platform_driver(&mpc52xx_uart_of_driver);
@@ -1433,16 +1268,6 @@ mpc52xx_uart_init(void)
1433 uart_unregister_driver(&mpc52xx_uart_driver); 1268 uart_unregister_driver(&mpc52xx_uart_driver);
1434 return ret; 1269 return ret;
1435 } 1270 }
1436#else
1437 psc_ops = &mpc52xx_psc_ops;
1438 ret = platform_driver_register(&mpc52xx_uart_platform_driver);
1439 if (ret) {
1440 printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1441 __FILE__, ret);
1442 uart_unregister_driver(&mpc52xx_uart_driver);
1443 return ret;
1444 }
1445#endif
1446 1271
1447 return 0; 1272 return 0;
1448} 1273}
@@ -1450,11 +1275,7 @@ mpc52xx_uart_init(void)
1450static void __exit 1275static void __exit
1451mpc52xx_uart_exit(void) 1276mpc52xx_uart_exit(void)
1452{ 1277{
1453#if defined(CONFIG_PPC_MERGE)
1454 of_unregister_platform_driver(&mpc52xx_uart_of_driver); 1278 of_unregister_platform_driver(&mpc52xx_uart_of_driver);
1455#else
1456 platform_driver_unregister(&mpc52xx_uart_platform_driver);
1457#endif
1458 uart_unregister_driver(&mpc52xx_uart_driver); 1279 uart_unregister_driver(&mpc52xx_uart_driver);
1459} 1280}
1460 1281