aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-07-17 18:59:06 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-03 21:36:35 -0400
commit7ae870368d198affa249ed3382a8a288167ce885 (patch)
tree8c8ee001f8b4e39ca45696938a7e4c2f9d0b243e /drivers/serial
parenta94b89a4813bddf85c052f8d04021688c5dfe0d7 (diff)
[POWERPC] cpm_uart: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.
The existing OF glue code was crufty and broken. Rather than fix it, it has been removed, and the serial driver now talks to the device tree directly. The non-CONFIG_PPC_CPM_NEW_BINDING code can go away once CPM platforms are dropped from arch/ppc (which will hopefully be soon), and existing arch/powerpc boards that I wasn't able to test on for this patchset get converted (which should be even sooner). Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/cpm_uart/cpm_uart.h6
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c241
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c16
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.h2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c18
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.h2
6 files changed, 260 insertions, 25 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index a8f894c78194..4e1987adc23b 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -80,14 +80,18 @@ struct uart_cpm_port {
80 int is_portb; 80 int is_portb;
81 /* wait on close if needed */ 81 /* wait on close if needed */
82 int wait_closing; 82 int wait_closing;
83 /* value to combine with opcode to form cpm command */
84 u32 command;
83}; 85};
84 86
87#ifndef CONFIG_PPC_CPM_NEW_BINDING
85extern int cpm_uart_port_map[UART_NR]; 88extern int cpm_uart_port_map[UART_NR];
89#endif
86extern int cpm_uart_nr; 90extern int cpm_uart_nr;
87extern struct uart_cpm_port cpm_uart_ports[UART_NR]; 91extern struct uart_cpm_port cpm_uart_ports[UART_NR];
88 92
89/* these are located in their respective files */ 93/* these are located in their respective files */
90void cpm_line_cr_cmd(int line, int cmd); 94void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
91int cpm_uart_init_portdesc(void); 95int cpm_uart_init_portdesc(void);
92int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); 96int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
93void cpm_uart_freebuf(struct uart_cpm_port *pinfo); 97void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index cefde58dbad2..8564ba2f3ec2 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -10,7 +10,7 @@
10 * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2) 10 * Maintainer: Kumar Gala (galak@kernel.crashing.org) (CPM2)
11 * Pantelis Antoniou (panto@intracom.gr) (CPM1) 11 * Pantelis Antoniou (panto@intracom.gr) (CPM1)
12 * 12 *
13 * Copyright (C) 2004 Freescale Semiconductor, Inc. 13 * Copyright (C) 2004, 2007 Freescale Semiconductor, Inc.
14 * (C) 2004 Intracom, S.A. 14 * (C) 2004 Intracom, S.A.
15 * (C) 2005-2006 MontaVista Software, Inc. 15 * (C) 2005-2006 MontaVista Software, Inc.
16 * Vitaly Bordug <vbordug@ru.mvista.com> 16 * Vitaly Bordug <vbordug@ru.mvista.com>
@@ -47,6 +47,11 @@
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/delay.h> 48#include <asm/delay.h>
49#include <asm/fs_pd.h> 49#include <asm/fs_pd.h>
50#include <asm/udbg.h>
51
52#ifdef CONFIG_PPC_CPM_NEW_BINDING
53#include <linux/of_platform.h>
54#endif
50 55
51#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 56#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
52#define SUPPORT_SYSRQ 57#define SUPPORT_SYSRQ
@@ -57,12 +62,6 @@
57 62
58#include "cpm_uart.h" 63#include "cpm_uart.h"
59 64
60/***********************************************************************/
61
62/* Track which ports are configured as uarts */
63int cpm_uart_port_map[UART_NR];
64/* How many ports did we config as uarts */
65int cpm_uart_nr = 0;
66 65
67/**************************************************************/ 66/**************************************************************/
68 67
@@ -73,6 +72,11 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo);
73 72
74/**************************************************************/ 73/**************************************************************/
75 74
75#ifndef CONFIG_PPC_CPM_NEW_BINDING
76/* Track which ports are configured as uarts */
77int cpm_uart_port_map[UART_NR];
78/* How many ports did we config as uarts */
79int cpm_uart_nr;
76 80
77/* Place-holder for board-specific stuff */ 81/* Place-holder for board-specific stuff */
78struct platform_device* __attribute__ ((weak)) __init 82struct platform_device* __attribute__ ((weak)) __init
@@ -119,6 +123,7 @@ static int cpm_uart_id2nr(int id)
119 /* not found or invalid argument */ 123 /* not found or invalid argument */
120 return -1; 124 return -1;
121} 125}
126#endif
122 127
123/* 128/*
124 * Check, if transmit buffers are processed 129 * Check, if transmit buffers are processed
@@ -232,15 +237,14 @@ static void cpm_uart_enable_ms(struct uart_port *port)
232static void cpm_uart_break_ctl(struct uart_port *port, int break_state) 237static void cpm_uart_break_ctl(struct uart_port *port, int break_state)
233{ 238{
234 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; 239 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
235 int line = pinfo - cpm_uart_ports;
236 240
237 pr_debug("CPM uart[%d]:break ctrl, break_state: %d\n", port->line, 241 pr_debug("CPM uart[%d]:break ctrl, break_state: %d\n", port->line,
238 break_state); 242 break_state);
239 243
240 if (break_state) 244 if (break_state)
241 cpm_line_cr_cmd(line, CPM_CR_STOP_TX); 245 cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
242 else 246 else
243 cpm_line_cr_cmd(line, CPM_CR_RESTART_TX); 247 cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
244} 248}
245 249
246/* 250/*
@@ -407,7 +411,6 @@ static int cpm_uart_startup(struct uart_port *port)
407{ 411{
408 int retval; 412 int retval;
409 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; 413 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
410 int line = pinfo - cpm_uart_ports;
411 414
412 pr_debug("CPM uart[%d]:startup\n", port->line); 415 pr_debug("CPM uart[%d]:startup\n", port->line);
413 416
@@ -426,7 +429,7 @@ static int cpm_uart_startup(struct uart_port *port)
426 } 429 }
427 430
428 if (!(pinfo->flags & FLAG_CONSOLE)) 431 if (!(pinfo->flags & FLAG_CONSOLE))
429 cpm_line_cr_cmd(line,CPM_CR_INIT_TRX); 432 cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
430 return 0; 433 return 0;
431} 434}
432 435
@@ -442,7 +445,6 @@ inline void cpm_uart_wait_until_send(struct uart_cpm_port *pinfo)
442static void cpm_uart_shutdown(struct uart_port *port) 445static void cpm_uart_shutdown(struct uart_port *port)
443{ 446{
444 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; 447 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
445 int line = pinfo - cpm_uart_ports;
446 448
447 pr_debug("CPM uart[%d]:shutdown\n", port->line); 449 pr_debug("CPM uart[%d]:shutdown\n", port->line);
448 450
@@ -473,9 +475,9 @@ static void cpm_uart_shutdown(struct uart_port *port)
473 475
474 /* Shut them really down and reinit buffer descriptors */ 476 /* Shut them really down and reinit buffer descriptors */
475 if (IS_SMC(pinfo)) 477 if (IS_SMC(pinfo))
476 cpm_line_cr_cmd(line, CPM_CR_STOP_TX); 478 cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
477 else 479 else
478 cpm_line_cr_cmd(line, CPM_CR_GRA_STOP_TX); 480 cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX);
479 481
480 cpm_uart_initbd(pinfo); 482 cpm_uart_initbd(pinfo);
481 } 483 }
@@ -595,7 +597,6 @@ static void cpm_uart_set_termios(struct uart_port *port,
595 597
596 cpm_set_brg(pinfo->brg - 1, baud); 598 cpm_set_brg(pinfo->brg - 1, baud);
597 spin_unlock_irqrestore(&port->lock, flags); 599 spin_unlock_irqrestore(&port->lock, flags);
598
599} 600}
600 601
601static const char *cpm_uart_type(struct uart_port *port) 602static const char *cpm_uart_type(struct uart_port *port)
@@ -742,7 +743,6 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo)
742 743
743static void cpm_uart_init_scc(struct uart_cpm_port *pinfo) 744static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
744{ 745{
745 int line = pinfo - cpm_uart_ports;
746 volatile scc_t *scp; 746 volatile scc_t *scp;
747 volatile scc_uart_t *sup; 747 volatile scc_uart_t *sup;
748 748
@@ -783,7 +783,7 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
783 783
784 /* Send the CPM an initialize command. 784 /* Send the CPM an initialize command.
785 */ 785 */
786 cpm_line_cr_cmd(line, CPM_CR_INIT_TRX); 786 cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
787 787
788 /* Set UART mode, 8 bit, no parity, one stop. 788 /* Set UART mode, 8 bit, no parity, one stop.
789 * Enable receive and transmit. 789 * Enable receive and transmit.
@@ -803,7 +803,6 @@ static void cpm_uart_init_scc(struct uart_cpm_port *pinfo)
803 803
804static void cpm_uart_init_smc(struct uart_cpm_port *pinfo) 804static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
805{ 805{
806 int line = pinfo - cpm_uart_ports;
807 volatile smc_t *sp; 806 volatile smc_t *sp;
808 volatile smc_uart_t *up; 807 volatile smc_uart_t *up;
809 808
@@ -840,7 +839,7 @@ static void cpm_uart_init_smc(struct uart_cpm_port *pinfo)
840 up->smc_brkec = 0; 839 up->smc_brkec = 0;
841 up->smc_brkcr = 1; 840 up->smc_brkcr = 1;
842 841
843 cpm_line_cr_cmd(line, CPM_CR_INIT_TRX); 842 cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
844 843
845 /* Set UART mode, 8 bit, no parity, one stop. 844 /* Set UART mode, 8 bit, no parity, one stop.
846 * Enable receive and transmit. 845 * Enable receive and transmit.
@@ -929,6 +928,85 @@ static struct uart_ops cpm_uart_pops = {
929 .verify_port = cpm_uart_verify_port, 928 .verify_port = cpm_uart_verify_port,
930}; 929};
931 930
931#ifdef CONFIG_PPC_CPM_NEW_BINDING
932struct uart_cpm_port cpm_uart_ports[UART_NR];
933
934int cpm_uart_init_port(struct device_node *np, struct uart_cpm_port *pinfo)
935{
936 const u32 *data;
937 void __iomem *mem, __iomem *pram;
938 int len;
939 int ret;
940
941 data = of_get_property(np, "fsl,cpm-brg", &len);
942 if (!data || len != 4) {
943 printk(KERN_ERR "CPM UART %s has no/invalid "
944 "fsl,cpm-brg property.\n", np->name);
945 return -EINVAL;
946 }
947 pinfo->brg = *data;
948
949 data = of_get_property(np, "fsl,cpm-command", &len);
950 if (!data || len != 4) {
951 printk(KERN_ERR "CPM UART %s has no/invalid "
952 "fsl,cpm-command property.\n", np->name);
953 return -EINVAL;
954 }
955 pinfo->command = *data;
956
957 mem = of_iomap(np, 0);
958 if (!mem)
959 return -ENOMEM;
960
961 pram = of_iomap(np, 1);
962 if (!pram) {
963 ret = -ENOMEM;
964 goto out_mem;
965 }
966
967 if (of_device_is_compatible(np, "fsl,cpm1-scc-uart") ||
968 of_device_is_compatible(np, "fsl,cpm2-scc-uart")) {
969 pinfo->sccp = mem;
970 pinfo->sccup = pram;
971 } else if (of_device_is_compatible(np, "fsl,cpm1-smc-uart") ||
972 of_device_is_compatible(np, "fsl,cpm2-smc-uart")) {
973 pinfo->flags |= FLAG_SMC;
974 pinfo->smcp = mem;
975 pinfo->smcup = pram;
976 } else {
977 ret = -ENODEV;
978 goto out_pram;
979 }
980
981 pinfo->tx_nrfifos = TX_NUM_FIFO;
982 pinfo->tx_fifosize = TX_BUF_SIZE;
983 pinfo->rx_nrfifos = RX_NUM_FIFO;
984 pinfo->rx_fifosize = RX_BUF_SIZE;
985
986 pinfo->port.uartclk = ppc_proc_freq;
987 pinfo->port.mapbase = (unsigned long)mem;
988 pinfo->port.type = PORT_CPM;
989 pinfo->port.ops = &cpm_uart_pops,
990 pinfo->port.iotype = UPIO_MEM;
991 spin_lock_init(&pinfo->port.lock);
992
993 pinfo->port.irq = of_irq_to_resource(np, 0, NULL);
994 if (pinfo->port.irq == NO_IRQ) {
995 ret = -EINVAL;
996 goto out_pram;
997 }
998
999 return cpm_uart_request_port(&pinfo->port);
1000
1001out_pram:
1002 iounmap(pram);
1003out_mem:
1004 iounmap(mem);
1005 return ret;
1006}
1007
1008#else
1009
932struct uart_cpm_port cpm_uart_ports[UART_NR] = { 1010struct uart_cpm_port cpm_uart_ports[UART_NR] = {
933 [UART_SMC1] = { 1011 [UART_SMC1] = {
934 .port = { 1012 .port = {
@@ -1072,6 +1150,7 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1072 1150
1073 return 0; 1151 return 0;
1074} 1152}
1153#endif
1075 1154
1076#ifdef CONFIG_SERIAL_CPM_CONSOLE 1155#ifdef CONFIG_SERIAL_CPM_CONSOLE
1077/* 1156/*
@@ -1083,8 +1162,12 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1083static void cpm_uart_console_write(struct console *co, const char *s, 1162static void cpm_uart_console_write(struct console *co, const char *s,
1084 u_int count) 1163 u_int count)
1085{ 1164{
1165#ifdef CONFIG_PPC_CPM_NEW_BINDING
1166 struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];
1167#else
1086 struct uart_cpm_port *pinfo = 1168 struct uart_cpm_port *pinfo =
1087 &cpm_uart_ports[cpm_uart_port_map[co->index]]; 1169 &cpm_uart_ports[cpm_uart_port_map[co->index]];
1170#endif
1088 unsigned int i; 1171 unsigned int i;
1089 volatile cbd_t *bdp, *bdbase; 1172 volatile cbd_t *bdp, *bdbase;
1090 volatile unsigned char *cp; 1173 volatile unsigned char *cp;
@@ -1155,13 +1238,47 @@ static void cpm_uart_console_write(struct console *co, const char *s,
1155 1238
1156static int __init cpm_uart_console_setup(struct console *co, char *options) 1239static int __init cpm_uart_console_setup(struct console *co, char *options)
1157{ 1240{
1158 struct uart_port *port;
1159 struct uart_cpm_port *pinfo;
1160 int baud = 38400; 1241 int baud = 38400;
1161 int bits = 8; 1242 int bits = 8;
1162 int parity = 'n'; 1243 int parity = 'n';
1163 int flow = 'n'; 1244 int flow = 'n';
1164 int ret; 1245 int ret;
1246 struct uart_cpm_port *pinfo;
1247 struct uart_port *port;
1248
1249#ifdef CONFIG_PPC_CPM_NEW_BINDING
1250 struct device_node *np = NULL;
1251 int i = 0;
1252
1253 if (co->index >= UART_NR) {
1254 printk(KERN_ERR "cpm_uart: console index %d too high\n",
1255 co->index);
1256 return -ENODEV;
1257 }
1258
1259 do {
1260 np = of_find_node_by_type(np, "serial");
1261 if (!np)
1262 return -ENODEV;
1263
1264 if (!of_device_is_compatible(np, "fsl,cpm1-smc-uart") &&
1265 !of_device_is_compatible(np, "fsl,cpm1-scc-uart") &&
1266 !of_device_is_compatible(np, "fsl,cpm2-smc-uart") &&
1267 !of_device_is_compatible(np, "fsl,cpm2-scc-uart"))
1268 i--;
1269 } while (i++ != co->index);
1270
1271 pinfo = &cpm_uart_ports[co->index];
1272
1273 pinfo->flags |= FLAG_CONSOLE;
1274 port = &pinfo->port;
1275
1276 ret = cpm_uart_init_port(np, pinfo);
1277 of_node_put(np);
1278 if (ret)
1279 return ret;
1280
1281#else
1165 1282
1166 struct fs_uart_platform_info *pdata; 1283 struct fs_uart_platform_info *pdata;
1167 struct platform_device* pdev = early_uart_get_pdev(co->index); 1284 struct platform_device* pdev = early_uart_get_pdev(co->index);
@@ -1188,6 +1305,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
1188 } 1305 }
1189 1306
1190 pinfo->flags |= FLAG_CONSOLE; 1307 pinfo->flags |= FLAG_CONSOLE;
1308#endif
1191 1309
1192 if (options) { 1310 if (options) {
1193 uart_parse_options(options, &baud, &parity, &bits, &flow); 1311 uart_parse_options(options, &baud, &parity, &bits, &flow);
@@ -1196,6 +1314,10 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
1196 baud = 9600; 1314 baud = 9600;
1197 } 1315 }
1198 1316
1317#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
1318 udbg_putc = NULL;
1319#endif
1320
1199 if (IS_SMC(pinfo)) { 1321 if (IS_SMC(pinfo)) {
1200 pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); 1322 pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX);
1201 pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 1323 pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
@@ -1252,7 +1374,81 @@ static struct uart_driver cpm_reg = {
1252 .major = SERIAL_CPM_MAJOR, 1374 .major = SERIAL_CPM_MAJOR,
1253 .minor = SERIAL_CPM_MINOR, 1375 .minor = SERIAL_CPM_MINOR,
1254 .cons = CPM_UART_CONSOLE, 1376 .cons = CPM_UART_CONSOLE,
1377 .nr = UART_NR,
1378};
1379
1380#ifdef CONFIG_PPC_CPM_NEW_BINDING
1381static int probe_index;
1382
1383static int __devinit cpm_uart_probe(struct of_device *ofdev,
1384 const struct of_device_id *match)
1385{
1386 int index = probe_index++;
1387 struct uart_cpm_port *pinfo = &cpm_uart_ports[index];
1388 int ret;
1389
1390 pinfo->port.line = index;
1391
1392 if (index >= UART_NR)
1393 return -ENODEV;
1394
1395 dev_set_drvdata(&ofdev->dev, pinfo);
1396
1397 ret = cpm_uart_init_port(ofdev->node, pinfo);
1398 if (ret)
1399 return ret;
1400
1401 return uart_add_one_port(&cpm_reg, &pinfo->port);
1402}
1403
1404static int __devexit cpm_uart_remove(struct of_device *ofdev)
1405{
1406 struct uart_cpm_port *pinfo = dev_get_drvdata(&ofdev->dev);
1407 return uart_remove_one_port(&cpm_reg, &pinfo->port);
1408}
1409
1410static struct of_device_id cpm_uart_match[] = {
1411 {
1412 .compatible = "fsl,cpm1-smc-uart",
1413 },
1414 {
1415 .compatible = "fsl,cpm1-scc-uart",
1416 },
1417 {
1418 .compatible = "fsl,cpm2-smc-uart",
1419 },
1420 {
1421 .compatible = "fsl,cpm2-scc-uart",
1422 },
1423 {}
1255}; 1424};
1425
1426static struct of_platform_driver cpm_uart_driver = {
1427 .name = "cpm_uart",
1428 .match_table = cpm_uart_match,
1429 .probe = cpm_uart_probe,
1430 .remove = cpm_uart_remove,
1431 };
1432
1433static int __init cpm_uart_init(void)
1434{
1435 int ret = uart_register_driver(&cpm_reg);
1436 if (ret)
1437 return ret;
1438
1439 ret = of_register_platform_driver(&cpm_uart_driver);
1440 if (ret)
1441 uart_unregister_driver(&cpm_reg);
1442
1443 return ret;
1444}
1445
1446static void __exit cpm_uart_exit(void)
1447{
1448 of_unregister_platform_driver(&cpm_uart_driver);
1449 uart_unregister_driver(&cpm_reg);
1450}
1451#else
1256static int cpm_uart_drv_probe(struct device *dev) 1452static int cpm_uart_drv_probe(struct device *dev)
1257{ 1453{
1258 struct platform_device *pdev = to_platform_device(dev); 1454 struct platform_device *pdev = to_platform_device(dev);
@@ -1380,6 +1576,7 @@ static void __exit cpm_uart_exit(void)
1380 driver_unregister(&cpm_smc_uart_driver); 1576 driver_unregister(&cpm_smc_uart_driver);
1381 uart_unregister_driver(&cpm_reg); 1577 uart_unregister_driver(&cpm_reg);
1382} 1578}
1579#endif
1383 1580
1384module_init(cpm_uart_init); 1581module_init(cpm_uart_init);
1385module_exit(cpm_uart_exit); 1582module_exit(cpm_uart_exit);
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 8c6324ed0202..4647f55e19f1 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -49,9 +49,20 @@
49 49
50/**************************************************************/ 50/**************************************************************/
51 51
52void cpm_line_cr_cmd(int line, int cmd) 52#ifdef CONFIG_PPC_CPM_NEW_BINDING
53void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
54{
55 u16 __iomem *cpcr = &cpmp->cp_cpcr;
56
57 out_be16(cpcr, port->command | (cmd << 8) | CPM_CR_FLG);
58 while (in_be16(cpcr) & CPM_CR_FLG)
59 ;
60}
61#else
62void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
53{ 63{
54 ushort val; 64 ushort val;
65 int line = port - cpm_uart_ports;
55 volatile cpm8xx_t *cp = cpmp; 66 volatile cpm8xx_t *cp = cpmp;
56 67
57 switch (line) { 68 switch (line) {
@@ -114,6 +125,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
114 /* XXX SCC4: insert port configuration here */ 125 /* XXX SCC4: insert port configuration here */
115 pinfo->brg = 4; 126 pinfo->brg = 4;
116} 127}
128#endif
117 129
118/* 130/*
119 * Allocate DP-Ram and memory buffers. We need to allocate a transmit and 131 * Allocate DP-Ram and memory buffers. We need to allocate a transmit and
@@ -184,6 +196,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
184 cpm_dpfree(pinfo->dp_addr); 196 cpm_dpfree(pinfo->dp_addr);
185} 197}
186 198
199#ifndef CONFIG_PPC_CPM_NEW_BINDING
187/* Setup any dynamic params in the uart desc */ 200/* Setup any dynamic params in the uart desc */
188int cpm_uart_init_portdesc(void) 201int cpm_uart_init_portdesc(void)
189{ 202{
@@ -279,3 +292,4 @@ int cpm_uart_init_portdesc(void)
279#endif 292#endif
280 return 0; 293 return 0;
281} 294}
295#endif
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index 2a6477834c3e..69f523a442e0 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -13,12 +13,14 @@
13#include <asm/commproc.h> 13#include <asm/commproc.h>
14 14
15/* defines for IRQs */ 15/* defines for IRQs */
16#ifndef CONFIG_PPC_CPM_NEW_BINDING
16#define SMC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC1) 17#define SMC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC1)
17#define SMC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC2) 18#define SMC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SMC2)
18#define SCC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC1) 19#define SCC1_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC1)
19#define SCC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC2) 20#define SCC2_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC2)
20#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3) 21#define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3)
21#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4) 22#define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4)
23#endif
22 24
23static inline void cpm_set_brg(int brg, int baud) 25static inline void cpm_set_brg(int brg, int baud)
24{ 26{
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index 7b61d805ebe9..7ebce263ad40 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -49,9 +49,22 @@
49 49
50/**************************************************************/ 50/**************************************************************/
51 51
52void cpm_line_cr_cmd(int line, int cmd) 52#ifdef CONFIG_PPC_CPM_NEW_BINDING
53void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
54{
55 cpm_cpm2_t __iomem *cp = cpm2_map(im_cpm);
56
57 out_be32(&cp->cp_cpcr, port->command | cmd | CPM_CR_FLG);
58 while (in_be32(&cp->cp_cpcr) & CPM_CR_FLG)
59 ;
60
61 cpm2_unmap(cp);
62}
63#else
64void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
53{ 65{
54 ulong val; 66 ulong val;
67 int line = port - cpm_uart_ports;
55 volatile cpm_cpm2_t *cp = cpm2_map(im_cpm); 68 volatile cpm_cpm2_t *cp = cpm2_map(im_cpm);
56 69
57 70
@@ -211,6 +224,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
211 cpm2_unmap(cpmux); 224 cpm2_unmap(cpmux);
212 cpm2_unmap(io); 225 cpm2_unmap(io);
213} 226}
227#endif
214 228
215/* 229/*
216 * Allocate DP-Ram and memory buffers. We need to allocate a transmit and 230 * Allocate DP-Ram and memory buffers. We need to allocate a transmit and
@@ -281,6 +295,7 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
281 cpm_dpfree(pinfo->dp_addr); 295 cpm_dpfree(pinfo->dp_addr);
282} 296}
283 297
298#ifndef CONFIG_PPC_CPM_NEW_BINDING
284/* Setup any dynamic params in the uart desc */ 299/* Setup any dynamic params in the uart desc */
285int cpm_uart_init_portdesc(void) 300int cpm_uart_init_portdesc(void)
286{ 301{
@@ -386,3 +401,4 @@ int cpm_uart_init_portdesc(void)
386 401
387 return 0; 402 return 0;
388} 403}
404#endif
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
index 1b3219f56c81..e7717ece0831 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
@@ -13,12 +13,14 @@
13#include <asm/cpm2.h> 13#include <asm/cpm2.h>
14 14
15/* defines for IRQs */ 15/* defines for IRQs */
16#ifndef CONFIG_PPC_CPM_NEW_BINDING
16#define SMC1_IRQ SIU_INT_SMC1 17#define SMC1_IRQ SIU_INT_SMC1
17#define SMC2_IRQ SIU_INT_SMC2 18#define SMC2_IRQ SIU_INT_SMC2
18#define SCC1_IRQ SIU_INT_SCC1 19#define SCC1_IRQ SIU_INT_SCC1
19#define SCC2_IRQ SIU_INT_SCC2 20#define SCC2_IRQ SIU_INT_SCC2
20#define SCC3_IRQ SIU_INT_SCC3 21#define SCC3_IRQ SIU_INT_SCC3
21#define SCC4_IRQ SIU_INT_SCC4 22#define SCC4_IRQ SIU_INT_SCC4
23#endif
22 24
23static inline void cpm_set_brg(int brg, int baud) 25static inline void cpm_set_brg(int brg, int baud)
24{ 26{