linux-3.4-rc1 PXA2xx PCMCIA possible regression
On linux-3.3 the PCMCIA/CF on my hx4700 worked OK.
On linux-3.4-rc1 the PCMCIA/CF has stopped working:
pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 156)pata_pcmcia: probe of 0.0 failed with error -12
I've traced the -ENOMEM error back to pcmcia_init_one() in drivers/ata/pata_pcmcia.c:
237 /* iomap */ 238 ret = -ENOMEM; 239 io_addr = devm_ioport_map(&pdev->dev, io_base, 8); 240 ctl_addr = devm_ioport_map(&pdev->dev, ctl_base, 1); 241 if (!io_addr || !ctl_addr) 242 goto failed;
Both calls to devm_ioport_map() return NULL.
The ultimate source of both NULL values appears to be __io() and thence __typesafe_io(), both defined in arch/arm/include/asm/io.h
Quoted 18 lines · Paul Parsons
On linux-3.3 the PCMCIA/CF on my hx4700 worked OK.
On linux-3.4-rc1 the PCMCIA/CF has stopped working:
pcmcia_socketpcmcia_socket0: pccard: PCMCIA card inserted into slot 0 pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 156)pata_pcmcia: probe of 0.0 failed with error -12I've traced the
-ENOMEMerror back topcmcia_init_one()indrivers/ata/pata_pcmcia.c:237 /* iomap */ 238 ret = -ENOMEM; 239 io_addr = devm_ioport_map(&pdev->dev, io_base, 8); 240 ctl_addr = devm_ioport_map(&pdev->dev, ctl_base, 1); 241 if (!io_addr || !ctl_addr) 242 goto failed;
Quoted 4 lines
Both calls to
devm_ioport_map()return NULL.The ultimate source of both NULL values appears to be
__io()and thence__typesafe_io(), both defined inarch/arm/include/asm/io.h
I broke it with the io.h clean-up. It seems PCMCIA drivers rely on __io() just being a cast. The easy fix is just restore that behavior for PCMCIA:
arch/arm/include/asm/io.h +0 -0
@@ -118,6 +118,8 @@ static inline void __iomem *__typesafe_io(unsigned
long addr)
*/
#ifdef CONFIG_NEED_MACH_IO_H
#include <mach/io.h>
+#elif defined(CONFIG_PCMCIA)
+#define __io(a) __typesafe_io(a)
#else
#define __io(a) ({ (void)(a); __typesafe_io(0); })
#endif
Can you please test this change. This is what we'll have to do for 3.4, but this is not really the right solution. io_base should not be a virtual address here, but an i/o address in the range of 0-64K. We need to move PCMCIA to the fixed i/o mapping I've posted:
http://www.spinics.net/lists/arm-kernel/msg162547.html
I've been trying to get PCMCIA to work on spitz in QEMU to test out fixes, but haven't had much luck. I'm not getting a card detected even though QEMU thinks one is present.
Rob
Quoted 6 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hello Rob,
Quoted 70 lines · Rob Herring
Quoted 5 lines · Paul Parsons
On linux-3.3 the PCMCIA/CF on my hx4700 worked OK.
On linux-3.4-rc1 the PCMCIA/CF has stopped working:
pcmcia_socketpcmcia_socket0: pccard: PCMCIA cardinserted into slot 0
Quoted 1 line
pcmcia 0.0: pcmcia: registering new device pcmcia0.0
(IRQ: 156)
Quoted 3 lines
pata_pcmcia: probe of 0.0 failed with error -12I've traced the
-ENOMEMerror back topcmcia_init_one()in
Quoted 3 lines
drivers/ata/pata_pcmcia.c:? ? 237??? ???
/* iomap */
Quoted 1 line
? ? 238??? ???
ret =
-ENOMEM;Quoted 1 line
? ? 239??? ???
io_addr=devm_ioport_map(&pdev->dev, io_base, 8);Quoted 1 line
? ? 240??? ???
ctl_addr=devm_ioport_map(&pdev->dev, ctl_base, 1);Quoted 1 line
? ? 241??? ???
if (!io_addr || !ctl_addr)
Quoted 1 line
? ? 242??? ???
??? goto failed;
Quoted 4 lines
Both calls to
devm_ioport_map()return NULL.The ultimate source of both NULL values appears to be
__io()andQuoted 1 line
thence
__typesafe_io(), both defined in
arch/arm/include/asm/io.hI broke it with the
io.hclean-up. It seems PCMCIA drivers rely on__io()just being a cast. The easy fix is just restore that behavior for
PCMCIA:arch/arm/include/asm/io.h +0
-0@@ -118,6 +118,8 @@ static inline void __iomem *__typesafe_io (unsigned long addr)? */
#ifdefCONFIG_NEED_MACH_IO_H
#include <mach/io.h>arch/arm/include/asm/io.h +2
-0+#elif defined(CONFIG_PCMCIA ) +#define __io (a)? ? ? ? ? ?? ?
__typesafe_io(a)
#else
#define__io(a)? ? ? ? ? ?
? ? ({ (void)(a);__typesafe_io(0); })
#endifCan you please test this change. This is what we'll have to do for 3.4,
but this is not really the right solution.io_baseshould not be a
virtual address here, but an i/o address in the range of 0-64K. We need
to move PCMCIA to the fixed i/o mapping I've posted:
Quoted 7 lines
http://www.spinics.net/lists/arm-kernel/msg162547.html
I've been trying to get PCMCIA to work on spitz in QEMU to test out
fixes, but haven't had much luck. I'm not getting a card detected even
though QEMU thinks one is present.
Yes, this change fixes the PCMCIA/CF on my hx4700 (PXA270).
Thanks,
Paul
Quoted 7 lines · Paul Parsons
On linux-3.3 the PCMCIA/CF on my hx4700 worked OK.
On linux-3.4-rc1 the PCMCIA/CF has stopped working:
pcmcia_socketpcmcia_socket0: pccard: PCMCIA card inserted into slot 0 pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 156)pata_pcmcia: probe of 0.0 failed with error -12
I see no PCMCIA support for HX4700 in mainline. Where is it?
Hello Russell,
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Paul Parsons
On linux-3.3 the PCMCIA/CF on my hx4700 worked OK.
On linux-3.4-rc1 the PCMCIA/CF has stopped working:
Quoted 8 lines
Quoted 1 line
pcmcia_socketpcmcia_socket0: pccard: PCMCIA cardinserted into slot 0
Quoted 1 line
pcmcia 0.0: pcmcia: registering new device pcmcia0.0
(IRQ: 156)
Quoted 1 line
pata_pcmcia: probe of 0.0 failed with error -12I see no PCMCIA support for HX4700 in mainline.? Where is it?
It is languishing in pending patch land:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/089266.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/088988.html
Regards,
Paul
Quoted 4 lines · Paul Parsons
It is languishing in pending patch land:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/089266.html
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/088988.html
These links aren't working for me at the moment. I found the patches in my mailbox nevertheless.
As you're using the PXA stuff, that selects PCMCIA_SOC_COMMON, which means this part of Rob's patch is rubbish, because you'll get the 4GB IO space precisely because of PCMCIA_SOC_COMMON being enabled.
#ifndef IO_SPACE_LIMIT
-#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE) +#if defined(CONFIG_PCCARD)
#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
-#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) +#elif defined(CONFIG_PCI) || defined(CONFIG_ISA)
So it all hinges around what we supply for the __io() macro.