aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
commit9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch)
treea77532ce4d6d56be6c6c7f405cd901a0184250fb /drivers/serial
parente80ab411e589e00550e2e6e5a6a02d59cc730357 (diff)
parent14b3ca4022f050f8622ed282b734ddf445464583 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits) [POWERPC] Fix compile breakage for 64-bit UP configs [POWERPC] Define copy_siginfo_from_user32 [POWERPC] Add compat handler for PTRACE_GETSIGINFO [POWERPC] i2c: Fix build breakage introduced by OF helpers [POWERPC] Optimize fls64() on 64-bit processors [POWERPC] irqtrace support for 64-bit powerpc [POWERPC] Stacktrace support for lockdep [POWERPC] Move stackframe definitions to common header [POWERPC] Fix device-tree locking vs. interrupts [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const [POWERPC] Remove unused __max_memory variable [POWERPC] Simplify xics direct/lpar irq_host setup [POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() [POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() [POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c [POWERPC] Use asm-generic/bitops/find.h in bitops.h [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup [POWERPC] 85xx: Fix the size of qe muram for MPC8568E [POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier. [POWERPC] 86xx: mark functions static, other minor cleanups ...
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/cpm_uart/cpm_uart.h3
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c19
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c14
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c52
-rw-r--r--drivers/serial/of_serial.c4
-rw-r--r--drivers/serial/ucc_uart.c16
6 files changed, 93 insertions, 15 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index 32b9737759c4..0cc39f82d7c5 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -92,6 +92,9 @@ extern struct uart_cpm_port cpm_uart_ports[UART_NR];
92 92
93/* these are located in their respective files */ 93/* these are located in their respective files */
94void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd); 94void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
95void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
96 struct device_node *np);
97void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram);
95int cpm_uart_init_portdesc(void); 98int cpm_uart_init_portdesc(void);
96int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); 99int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
97void cpm_uart_freebuf(struct uart_cpm_port *pinfo); 100void 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 236af9d33851..a638ba0679ac 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -966,24 +966,23 @@ static int cpm_uart_init_port(struct device_node *np,
966 if (!mem) 966 if (!mem)
967 return -ENOMEM; 967 return -ENOMEM;
968 968
969 pram = of_iomap(np, 1);
970 if (!pram) {
971 ret = -ENOMEM;
972 goto out_mem;
973 }
974
975 if (of_device_is_compatible(np, "fsl,cpm1-scc-uart") || 969 if (of_device_is_compatible(np, "fsl,cpm1-scc-uart") ||
976 of_device_is_compatible(np, "fsl,cpm2-scc-uart")) { 970 of_device_is_compatible(np, "fsl,cpm2-scc-uart")) {
977 pinfo->sccp = mem; 971 pinfo->sccp = mem;
978 pinfo->sccup = pram; 972 pinfo->sccup = pram = cpm_uart_map_pram(pinfo, np);
979 } else if (of_device_is_compatible(np, "fsl,cpm1-smc-uart") || 973 } else if (of_device_is_compatible(np, "fsl,cpm1-smc-uart") ||
980 of_device_is_compatible(np, "fsl,cpm2-smc-uart")) { 974 of_device_is_compatible(np, "fsl,cpm2-smc-uart")) {
981 pinfo->flags |= FLAG_SMC; 975 pinfo->flags |= FLAG_SMC;
982 pinfo->smcp = mem; 976 pinfo->smcp = mem;
983 pinfo->smcup = pram; 977 pinfo->smcup = pram = cpm_uart_map_pram(pinfo, np);
984 } else { 978 } else {
985 ret = -ENODEV; 979 ret = -ENODEV;
986 goto out_pram; 980 goto out_mem;
981 }
982
983 if (!pram) {
984 ret = -ENOMEM;
985 goto out_mem;
987 } 986 }
988 987
989 pinfo->tx_nrfifos = TX_NUM_FIFO; 988 pinfo->tx_nrfifos = TX_NUM_FIFO;
@@ -1007,7 +1006,7 @@ static int cpm_uart_init_port(struct device_node *np,
1007 return cpm_uart_request_port(&pinfo->port); 1006 return cpm_uart_request_port(&pinfo->port);
1008 1007
1009out_pram: 1008out_pram:
1010 iounmap(pram); 1009 cpm_uart_unmap_pram(pinfo, pram);
1011out_mem: 1010out_mem:
1012 iounmap(mem); 1011 iounmap(mem);
1013 return ret; 1012 return ret;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 6ea0366e26ae..74f1432bb248 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -45,6 +45,8 @@
45#include <linux/serial_core.h> 45#include <linux/serial_core.h>
46#include <linux/kernel.h> 46#include <linux/kernel.h>
47 47
48#include <linux/of.h>
49
48#include "cpm_uart.h" 50#include "cpm_uart.h"
49 51
50/**************************************************************/ 52/**************************************************************/
@@ -54,6 +56,18 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
54{ 56{
55 cpm_command(port->command, cmd); 57 cpm_command(port->command, cmd);
56} 58}
59
60void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
61 struct device_node *np)
62{
63 return of_iomap(np, 1);
64}
65
66void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
67{
68 iounmap(pram);
69}
70
57#else 71#else
58void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd) 72void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
59{ 73{
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index d9af06a791ba..bb862e2f54cf 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -41,6 +41,9 @@
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/fs_pd.h> 43#include <asm/fs_pd.h>
44#ifdef CONFIG_PPC_CPM_NEW_BINDING
45#include <asm/prom.h>
46#endif
44 47
45#include <linux/serial_core.h> 48#include <linux/serial_core.h>
46#include <linux/kernel.h> 49#include <linux/kernel.h>
@@ -54,6 +57,55 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
54{ 57{
55 cpm_command(port->command, cmd); 58 cpm_command(port->command, cmd);
56} 59}
60
61void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
62 struct device_node *np)
63{
64 void __iomem *pram;
65 unsigned long offset;
66 struct resource res;
67 unsigned long len;
68
69 /* Don't remap parameter RAM if it has already been initialized
70 * during console setup.
71 */
72 if (IS_SMC(port) && port->smcup)
73 return port->smcup;
74 else if (!IS_SMC(port) && port->sccup)
75 return port->sccup;
76
77 if (of_address_to_resource(np, 1, &res))
78 return NULL;
79
80 len = 1 + res.end - res.start;
81 pram = ioremap(res.start, len);
82 if (!pram)
83 return NULL;
84
85 if (!IS_SMC(port))
86 return pram;
87
88 if (len != 2) {
89 printk(KERN_WARNING "cpm_uart[%d]: device tree references "
90 "SMC pram, using boot loader/wrapper pram mapping. "
91 "Please fix your device tree to reference the pram "
92 "base register instead.\n",
93 port->port.line);
94 return pram;
95 }
96
97 offset = cpm_dpalloc(PROFF_SMC_SIZE, 64);
98 out_be16(pram, offset);
99 iounmap(pram);
100 return cpm_muram_addr(offset);
101}
102
103void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
104{
105 if (!IS_SMC(port))
106 iounmap(pram);
107}
108
57#else 109#else
58void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd) 110void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
59{ 111{
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index c0e50a461055..8aacfb78deab 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -56,7 +56,9 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
56 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP 56 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
57 | UPF_FIXED_PORT; 57 | UPF_FIXED_PORT;
58 port->dev = &ofdev->dev; 58 port->dev = &ofdev->dev;
59 port->custom_divisor = *clk / (16 * (*spd)); 59 /* If current-speed was set, then try not to change it. */
60 if (spd)
61 port->custom_divisor = *clk / (16 * (*spd));
60 62
61 return 0; 63 return 0;
62} 64}
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index e0994f061001..5e4310ccd591 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -1270,10 +1270,18 @@ static int ucc_uart_probe(struct of_device *ofdev,
1270 1270
1271 /* Get the UCC number (device ID) */ 1271 /* Get the UCC number (device ID) */
1272 /* UCCs are numbered 1-7 */ 1272 /* UCCs are numbered 1-7 */
1273 iprop = of_get_property(np, "device-id", NULL); 1273 iprop = of_get_property(np, "cell-index", NULL);
1274 if (!iprop || (*iprop < 1) || (*iprop > UCC_MAX_NUM)) { 1274 if (!iprop) {
1275 dev_err(&ofdev->dev, 1275 iprop = of_get_property(np, "device-id", NULL);
1276 "missing or invalid UCC specified in device tree\n"); 1276 if (!iprop) {
1277 dev_err(&ofdev->dev, "UCC is unspecified in "
1278 "device tree\n");
1279 return -EINVAL;
1280 }
1281 }
1282
1283 if ((*iprop < 1) || (*iprop > UCC_MAX_NUM)) {
1284 dev_err(&ofdev->dev, "no support for UCC%u\n", *iprop);
1277 kfree(qe_port); 1285 kfree(qe_port);
1278 return -ENODEV; 1286 return -ENODEV;
1279 } 1287 }