diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-07-04 00:14:07 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-07-07 06:19:15 -0400 |
commit | f704b8d1f080ee71b7a9a88bcf585e7dd4272f4b (patch) | |
tree | c3a1306ef6f17652ea8464bcde3479255251caf2 /arch/powerpc/kernel/legacy_serial.c | |
parent | e70e943847bdae13175bf3a8bca6328e369de90a (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>
Diffstat (limited to 'arch/powerpc/kernel/legacy_serial.c')
-rw-r--r-- | arch/powerpc/kernel/legacy_serial.c | 13 |
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, | |||
112 | static int __init add_legacy_soc_port(struct device_node *np, | 112 | static 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, | |||
180 | static int __init add_legacy_pci_port(struct device_node *np, | 183 | static 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; |