aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-07-04 00:14:07 -0400
committerPaul Mackerras <paulus@samba.org>2006-07-25 11:27:27 -0400
commit45507ff3a2c58bc4781688eac1a80979ea972dce (patch)
treeb4e6db21249a59bf03d7e63d1539166421040a75
parent171505dafef56e4c84c48399b36604f4be55cf36 (diff)
[POWERPC] Fix legacy_serial.c error handling on 32 bits
The code in legacy_serial.c wouldn't properly compare OF translation results against OF_BAD_ADDR as it's using a phys_addr_t which is 32 bits on some 32-bit powerpc platforms. This fixes it by always using a u64 which is what is returned by the OF parsing routines. It also makes translation failure harmless for ISA serial ports. If they can't translate, we can't use the UART early, but we can still let the 8250 driver use it later on by using IO port accessors. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/legacy_serial.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 7e98e778b52f..359ab89748e0 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -112,7 +112,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
112static int __init add_legacy_soc_port(struct device_node *np, 112static int __init add_legacy_soc_port(struct device_node *np,
113 struct device_node *soc_dev) 113 struct device_node *soc_dev)
114{ 114{
115 phys_addr_t addr; 115 u64 addr;
116 u32 *addrp; 116 u32 *addrp;
117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
118 118
@@ -143,7 +143,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
143 u32 *reg; 143 u32 *reg;
144 char *typep; 144 char *typep;
145 int index = -1; 145 int index = -1;
146 phys_addr_t taddr; 146 u64 taddr;
147 147
148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
149 149
@@ -165,10 +165,13 @@ static int __init add_legacy_isa_port(struct device_node *np,
165 if (typep && *typep == 'S') 165 if (typep && *typep == 'S')
166 index = simple_strtol(typep+1, NULL, 0) - 1; 166 index = simple_strtol(typep+1, NULL, 0) - 1;
167 167
168 /* Translate ISA address */ 168 /* Translate ISA address. If it fails, we still register the port
169 * with no translated address so that it can be picked up as an IO
170 * port later by the serial driver
171 */
169 taddr = of_translate_address(np, reg); 172 taddr = of_translate_address(np, reg);
170 if (taddr == OF_BAD_ADDR) 173 if (taddr == OF_BAD_ADDR)
171 return -1; 174 taddr = 0;
172 175
173 /* Add port, irq will be dealt with later */ 176 /* Add port, irq will be dealt with later */
174 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, 177 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr,
@@ -180,7 +183,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
180static int __init add_legacy_pci_port(struct device_node *np, 183static int __init add_legacy_pci_port(struct device_node *np,
181 struct device_node *pci_dev) 184 struct device_node *pci_dev)
182{ 185{
183 phys_addr_t addr, base; 186 u64 addr, base;
184 u32 *addrp; 187 u32 *addrp;
185 unsigned int flags; 188 unsigned int flags;
186 int iotype, index = -1, lindex = 0; 189 int iotype, index = -1, lindex = 0;