diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2010-02-24 11:40:21 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:43 -0500 |
commit | 11b897cf84c37e6522db914793677e933ef311fb (patch) | |
tree | b9d69cea86b2c1673f30332ff9b3944dc00bfc9b /drivers/pcmcia | |
parent | b9b37787d24cca9fbd63f767663e9439fa69aa22 (diff) |
MIPS: Alchemy: use 36bit addresses for PCMCIA resources.
On Alchemy the PCMCIA area lies at the end of the chips 36bit system bus
area. Currently, addresses at the far end of the 32bit area are assumed
to belong to the PCMCIA area and fixed up to the real 36bit address before
being passed to ioremap().
A previous commit enabled 64 bit physical size for the resource datatype on
Alchemy and this allows to use the correct 36bit addresses when registering
the PCMCIA sockets.
This patch removes the 32-to-36bit address fixup and registers the Alchemy
demo board pcmcia socket with the correct 36bit physical addresses.
Tested on DB1200, with a CF card (ide-cs driver) and a 3c589 PCMCIA ethernet
card.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
To: Linux-MIPS <linux-mips@linux-mips.org>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/994/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/au1000_generic.c | 10 | ||||
-rw-r--r-- | drivers/pcmcia/au1000_generic.h | 6 | ||||
-rw-r--r-- | drivers/pcmcia/db1xxx_ss.c | 25 | ||||
-rw-r--r-- | drivers/pcmcia/xxs1500_ss.c | 27 |
4 files changed, 23 insertions, 45 deletions
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index 02088704ac2c..171c8a654887 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
@@ -405,18 +405,16 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
405 | skt->virt_io = (void *) | 405 | skt->virt_io = (void *) |
406 | (ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) - | 406 | (ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) - |
407 | (u32)mips_io_port_base); | 407 | (u32)mips_io_port_base); |
408 | skt->phys_attr = AU1X_SOCK0_PSEUDO_PHYS_ATTR; | 408 | skt->phys_attr = AU1X_SOCK0_PHYS_ATTR; |
409 | skt->phys_mem = AU1X_SOCK0_PSEUDO_PHYS_MEM; | 409 | skt->phys_mem = AU1X_SOCK0_PHYS_MEM; |
410 | } | 410 | } |
411 | #ifndef CONFIG_MIPS_XXS1500 | ||
412 | else { | 411 | else { |
413 | skt->virt_io = (void *) | 412 | skt->virt_io = (void *) |
414 | (ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) - | 413 | (ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) - |
415 | (u32)mips_io_port_base); | 414 | (u32)mips_io_port_base); |
416 | skt->phys_attr = AU1X_SOCK1_PSEUDO_PHYS_ATTR; | 415 | skt->phys_attr = AU1X_SOCK1_PHYS_ATTR; |
417 | skt->phys_mem = AU1X_SOCK1_PSEUDO_PHYS_MEM; | 416 | skt->phys_mem = AU1X_SOCK1_PHYS_MEM; |
418 | } | 417 | } |
419 | #endif | ||
420 | pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io; | 418 | pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io; |
421 | ret = ops->hw_init(skt); | 419 | ret = ops->hw_init(skt); |
422 | 420 | ||
diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index aa743f6875bd..a324d329dea6 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h | |||
@@ -36,10 +36,6 @@ | |||
36 | #define AU1X_SOCK0_IO 0xF00000000ULL | 36 | #define AU1X_SOCK0_IO 0xF00000000ULL |
37 | #define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL | 37 | #define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL |
38 | #define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL | 38 | #define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL |
39 | /* pseudo 32 bit phys addresses, which get fixed up to the | ||
40 | * real 36 bit address in fixup_bigphys_addr() */ | ||
41 | #define AU1X_SOCK0_PSEUDO_PHYS_ATTR 0xF4000000 | ||
42 | #define AU1X_SOCK0_PSEUDO_PHYS_MEM 0xF8000000 | ||
43 | 39 | ||
44 | /* pcmcia socket 1 needs external glue logic so the memory map | 40 | /* pcmcia socket 1 needs external glue logic so the memory map |
45 | * differs from board to board. | 41 | * differs from board to board. |
@@ -48,8 +44,6 @@ | |||
48 | #define AU1X_SOCK1_IO 0xF08000000ULL | 44 | #define AU1X_SOCK1_IO 0xF08000000ULL |
49 | #define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL | 45 | #define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL |
50 | #define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL | 46 | #define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL |
51 | #define AU1X_SOCK1_PSEUDO_PHYS_ATTR 0xF4800000 | ||
52 | #define AU1X_SOCK1_PSEUDO_PHYS_MEM 0xF8800000 | ||
53 | #endif | 47 | #endif |
54 | 48 | ||
55 | struct pcmcia_state { | 49 | struct pcmcia_state { |
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c index b35b72b0d5b5..3889cf07d6ce 100644 --- a/drivers/pcmcia/db1xxx_ss.c +++ b/drivers/pcmcia/db1xxx_ss.c | |||
@@ -43,9 +43,9 @@ struct db1x_pcmcia_sock { | |||
43 | void *virt_io; | 43 | void *virt_io; |
44 | 44 | ||
45 | /* the "pseudo" addresses of the PCMCIA space. */ | 45 | /* the "pseudo" addresses of the PCMCIA space. */ |
46 | unsigned long phys_io; | 46 | phys_addr_t phys_io; |
47 | unsigned long phys_attr; | 47 | phys_addr_t phys_attr; |
48 | unsigned long phys_mem; | 48 | phys_addr_t phys_mem; |
49 | 49 | ||
50 | /* previous flags for set_socket() */ | 50 | /* previous flags for set_socket() */ |
51 | unsigned int old_flags; | 51 | unsigned int old_flags; |
@@ -404,7 +404,6 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
404 | { | 404 | { |
405 | struct db1x_pcmcia_sock *sock; | 405 | struct db1x_pcmcia_sock *sock; |
406 | struct resource *r; | 406 | struct resource *r; |
407 | phys_t physio; | ||
408 | int ret, bid; | 407 | int ret, bid; |
409 | 408 | ||
410 | sock = kzalloc(sizeof(struct db1x_pcmcia_sock), GFP_KERNEL); | 409 | sock = kzalloc(sizeof(struct db1x_pcmcia_sock), GFP_KERNEL); |
@@ -465,7 +464,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
465 | * for this socket (usually the 36bit address shifted 4 to the | 464 | * for this socket (usually the 36bit address shifted 4 to the |
466 | * right). | 465 | * right). |
467 | */ | 466 | */ |
468 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-attr"); | 467 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-attr"); |
469 | if (!r) { | 468 | if (!r) { |
470 | printk(KERN_ERR "pcmcia%d has no 'pseudo-attr' resource!\n", | 469 | printk(KERN_ERR "pcmcia%d has no 'pseudo-attr' resource!\n", |
471 | sock->nr); | 470 | sock->nr); |
@@ -477,7 +476,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
477 | * pseudo-mem: The 32bit address of the PCMCIA memory space for | 476 | * pseudo-mem: The 32bit address of the PCMCIA memory space for |
478 | * this socket (usually the 36bit address shifted 4 to the right) | 477 | * this socket (usually the 36bit address shifted 4 to the right) |
479 | */ | 478 | */ |
480 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-mem"); | 479 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-mem"); |
481 | if (!r) { | 480 | if (!r) { |
482 | printk(KERN_ERR "pcmcia%d has no 'pseudo-mem' resource!\n", | 481 | printk(KERN_ERR "pcmcia%d has no 'pseudo-mem' resource!\n", |
483 | sock->nr); | 482 | sock->nr); |
@@ -489,7 +488,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
489 | * pseudo-io: The 32bit address of the PCMCIA IO space for this | 488 | * pseudo-io: The 32bit address of the PCMCIA IO space for this |
490 | * socket (usually the 36bit address shifted 4 to the right). | 489 | * socket (usually the 36bit address shifted 4 to the right). |
491 | */ | 490 | */ |
492 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-io"); | 491 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-io"); |
493 | if (!r) { | 492 | if (!r) { |
494 | printk(KERN_ERR "pcmcia%d has no 'pseudo-io' resource!\n", | 493 | printk(KERN_ERR "pcmcia%d has no 'pseudo-io' resource!\n", |
495 | sock->nr); | 494 | sock->nr); |
@@ -497,12 +496,6 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
497 | } | 496 | } |
498 | sock->phys_io = r->start; | 497 | sock->phys_io = r->start; |
499 | 498 | ||
500 | |||
501 | /* IO: we must remap the full 36bit address (for reference see | ||
502 | * alchemy/common/setup.c::__fixup_bigphys_addr()) | ||
503 | */ | ||
504 | physio = ((phys_t)sock->phys_io) << 4; | ||
505 | |||
506 | /* | 499 | /* |
507 | * PCMCIA client drivers use the inb/outb macros to access | 500 | * PCMCIA client drivers use the inb/outb macros to access |
508 | * the IO registers. Since mips_io_port_base is added | 501 | * the IO registers. Since mips_io_port_base is added |
@@ -511,7 +504,7 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
511 | * to access the I/O or MEM address directly, without | 504 | * to access the I/O or MEM address directly, without |
512 | * going through this "mips_io_port_base" mechanism. | 505 | * going through this "mips_io_port_base" mechanism. |
513 | */ | 506 | */ |
514 | sock->virt_io = (void *)(ioremap(physio, IO_MAP_SIZE) - | 507 | sock->virt_io = (void *)(ioremap(sock->phys_io, IO_MAP_SIZE) - |
515 | mips_io_port_base); | 508 | mips_io_port_base); |
516 | 509 | ||
517 | if (!sock->virt_io) { | 510 | if (!sock->virt_io) { |
@@ -547,8 +540,8 @@ static int __devinit db1x_pcmcia_socket_probe(struct platform_device *pdev) | |||
547 | goto out2; | 540 | goto out2; |
548 | } | 541 | } |
549 | 542 | ||
550 | printk(KERN_INFO "Alchemy Db/Pb1xxx pcmcia%d @ io/attr/mem %08lx" | 543 | printk(KERN_INFO "Alchemy Db/Pb1xxx pcmcia%d @ io/attr/mem %09llx" |
551 | "(%p) %08lx %08lx card/insert/stschg/eject irqs @ %d " | 544 | "(%p) %09llx %09llx card/insert/stschg/eject irqs @ %d " |
552 | "%d %d %d\n", sock->nr, sock->phys_io, sock->virt_io, | 545 | "%d %d %d\n", sock->nr, sock->phys_io, sock->virt_io, |
553 | sock->phys_attr, sock->phys_mem, sock->card_irq, | 546 | sock->phys_attr, sock->phys_mem, sock->card_irq, |
554 | sock->insert_irq, sock->stschg_irq, sock->eject_irq); | 547 | sock->insert_irq, sock->stschg_irq, sock->eject_irq); |
diff --git a/drivers/pcmcia/xxs1500_ss.c b/drivers/pcmcia/xxs1500_ss.c index 4e36930b51ce..61560cd6e287 100644 --- a/drivers/pcmcia/xxs1500_ss.c +++ b/drivers/pcmcia/xxs1500_ss.c | |||
@@ -56,10 +56,9 @@ struct xxs1500_pcmcia_sock { | |||
56 | struct pcmcia_socket socket; | 56 | struct pcmcia_socket socket; |
57 | void *virt_io; | 57 | void *virt_io; |
58 | 58 | ||
59 | /* the "pseudo" addresses of the PCMCIA space. */ | 59 | phys_addr_t phys_io; |
60 | unsigned long phys_io; | 60 | phys_addr_t phys_attr; |
61 | unsigned long phys_attr; | 61 | phys_addr_t phys_mem; |
62 | unsigned long phys_mem; | ||
63 | 62 | ||
64 | /* previous flags for set_socket() */ | 63 | /* previous flags for set_socket() */ |
65 | unsigned int old_flags; | 64 | unsigned int old_flags; |
@@ -211,7 +210,6 @@ static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev) | |||
211 | { | 210 | { |
212 | struct xxs1500_pcmcia_sock *sock; | 211 | struct xxs1500_pcmcia_sock *sock; |
213 | struct resource *r; | 212 | struct resource *r; |
214 | phys_t physio; | ||
215 | int ret, irq; | 213 | int ret, irq; |
216 | 214 | ||
217 | sock = kzalloc(sizeof(struct xxs1500_pcmcia_sock), GFP_KERNEL); | 215 | sock = kzalloc(sizeof(struct xxs1500_pcmcia_sock), GFP_KERNEL); |
@@ -225,9 +223,9 @@ static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev) | |||
225 | * for this socket (usually the 36bit address shifted 4 to the | 223 | * for this socket (usually the 36bit address shifted 4 to the |
226 | * right). | 224 | * right). |
227 | */ | 225 | */ |
228 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-attr"); | 226 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-attr"); |
229 | if (!r) { | 227 | if (!r) { |
230 | dev_err(&pdev->dev, "missing 'pseudo-attr' resource!\n"); | 228 | dev_err(&pdev->dev, "missing 'pcmcia-attr' resource!\n"); |
231 | goto out0; | 229 | goto out0; |
232 | } | 230 | } |
233 | sock->phys_attr = r->start; | 231 | sock->phys_attr = r->start; |
@@ -236,9 +234,9 @@ static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev) | |||
236 | * pseudo-mem: The 32bit address of the PCMCIA memory space for | 234 | * pseudo-mem: The 32bit address of the PCMCIA memory space for |
237 | * this socket (usually the 36bit address shifted 4 to the right) | 235 | * this socket (usually the 36bit address shifted 4 to the right) |
238 | */ | 236 | */ |
239 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-mem"); | 237 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-mem"); |
240 | if (!r) { | 238 | if (!r) { |
241 | dev_err(&pdev->dev, "missing 'pseudo-mem' resource!\n"); | 239 | dev_err(&pdev->dev, "missing 'pcmcia-mem' resource!\n"); |
242 | goto out0; | 240 | goto out0; |
243 | } | 241 | } |
244 | sock->phys_mem = r->start; | 242 | sock->phys_mem = r->start; |
@@ -247,19 +245,14 @@ static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev) | |||
247 | * pseudo-io: The 32bit address of the PCMCIA IO space for this | 245 | * pseudo-io: The 32bit address of the PCMCIA IO space for this |
248 | * socket (usually the 36bit address shifted 4 to the right). | 246 | * socket (usually the 36bit address shifted 4 to the right). |
249 | */ | 247 | */ |
250 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pseudo-io"); | 248 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcmcia-io"); |
251 | if (!r) { | 249 | if (!r) { |
252 | dev_err(&pdev->dev, "missing 'pseudo-io' resource!\n"); | 250 | dev_err(&pdev->dev, "missing 'pcmcia-io' resource!\n"); |
253 | goto out0; | 251 | goto out0; |
254 | } | 252 | } |
255 | sock->phys_io = r->start; | 253 | sock->phys_io = r->start; |
256 | 254 | ||
257 | 255 | ||
258 | /* for io must remap the full 36bit address (for reference see | ||
259 | * alchemy/common/setup.c::__fixup_bigphys_addr) | ||
260 | */ | ||
261 | physio = ((phys_t)sock->phys_io) << 4; | ||
262 | |||
263 | /* | 256 | /* |
264 | * PCMCIA client drivers use the inb/outb macros to access | 257 | * PCMCIA client drivers use the inb/outb macros to access |
265 | * the IO registers. Since mips_io_port_base is added | 258 | * the IO registers. Since mips_io_port_base is added |
@@ -268,7 +261,7 @@ static int __devinit xxs1500_pcmcia_probe(struct platform_device *pdev) | |||
268 | * to access the I/O or MEM address directly, without | 261 | * to access the I/O or MEM address directly, without |
269 | * going through this "mips_io_port_base" mechanism. | 262 | * going through this "mips_io_port_base" mechanism. |
270 | */ | 263 | */ |
271 | sock->virt_io = (void *)(ioremap(physio, IO_MAP_SIZE) - | 264 | sock->virt_io = (void *)(ioremap(sock->phys_io, IO_MAP_SIZE) - |
272 | mips_io_port_base); | 265 | mips_io_port_base); |
273 | 266 | ||
274 | if (!sock->virt_io) { | 267 | if (!sock->virt_io) { |