Skip to contentSkip to conversation

PCMCIA on AU1200

DISCUSSION Matej Kupljen 3 participants 4 messages Jan 31, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi

I am trying to use PCMCIA on a DBAU1200 with 16bit card. From the docs for the board, I see that the PCMCIA interface is on CE[3], but the value of the mem_staddr3 is 0x1000000.

Looking at the Linux source code, I see that the PCMCIA is ioremap-ed to 0xf00000000 (36 bit). It also uses PSEUDO addresses for the skt->phys_attr and skt->phys_mem.

At what (physical) address can I find the card's I/O space, so I can use tools like devmem2 to see the cards CIS? Should I configure mem_stadd3 to same other value? To 0xf0000000?

BR,
Matej

#1 lore raw
Quoted 6 lines · Matej Kupljen

I am trying to use PCMCIA on a DBAU1200 with 16bit card.

From the docs for the board, I see that the PCMCIA interface is on CE[3], but the value of the mem_staddr3 is 0x1000000.

Quoted 8 lines

Looking at the Linux source code, I see that the PCMCIA is ioremap-ed to 0xf00000000 (36 bit). It also uses PSEUDO addresses for the skt->phys_attr and skt->phys_mem.

At what (physical) address can I find the card's I/O space, so I can use tools like devmem2 to see the cards CIS? Should I configure mem_stadd3 to same other value? To 0xf0000000?

I'm not exactly sure what your problems are, but maybe this helps you achieve what you want.

Firstly, 0xf 0000 0000 is the 36 bit physical address. This address is mapped by the driver via ioremap() into a 32 bit virtual address. Now, I think there are three macros for the PCMCIA memory regions (at least there were for the Au1100), which you can ioremap() separately.

Now, what gave me most trouble where two other things that needed to be done for my board (they might be different for you):
1. configure the static bus controller
This mainly means selecting the right timing parameters and switching the right bits on and off. You definitely need to read the programmer's handbook from AMD/Alchemy.
2. turn on power
In my case, power on and card detect were wired to some GPIO pins, so I had to switch them to the right level. This might require additional configuration in advance, too, but you can check the results using a simple voltmeter.

However: The DB boards are generally supported by Linux, so I wonder why you need to do anything at all.

Uli

#2 lore raw

Hi

Quoted 5 lines

I'm not exactly sure what your problems are, but maybe this helps you achieve what you want.

Firstly, 0xf 0000 0000 is the 36 bit physical address. This address is mapped by the driver via ioremap() into a 32 bit virtual address.

Yes, in the drivers/pcmcia/au1000_generic.c.
Also, the skt->phys_attr and the skt->phys_mem are set to 0xF4000000 and 0xF8000000 respectively and I wonder, where they got those values?

Quoted 10 lines

Now, I think there
are three macros for the PCMCIA memory regions (at least there were for the Au1100), which you can ioremap() separately.

Now, what gave me most trouble where two other things that needed to be done for my board (they might be different for you):
1. configure the static bus controller
This mainly means selecting the right timing parameters and switching the right bits on and off. You definitely need to read the programmer's handbook from AMD/Alchemy.

I am reading the specs for the CPU.
That is my problem, I do not to what value should I set CE[3], namely mem_stadd3 register. which select the physical address that asserts the CE[3]. I think this should be set up by bootloader. I am using U-Boot, but I have checked also the Yamon and it does not work, also.

Quoted 4 lines

2. turn on power
In my case, power on and card detect were wired to some GPIO pins, so I had to switch them to the right level. This might require additional configuration in advance, too, but you can check the results using a simple voltmeter.

The power is detected and the power is turned ON (I can set the LED on the PCMCIA card blinking).

Quoted 2 lines

However: The DB boards are generally supported by Linux, so I wonder why you need to do anything at all.

Yes. I am using kernel 2.6.15 and when I insert card into the slot, Linux detects it and turns on the power.
I do not have the board here right now, so I'll post the messages from the cardmngr tomorrow.

Thanks for the answers.

BR,
Matej

#3 lore raw

I wasn't aware of any outstanding problems with PCMCIA here, so I went back to see if we had any changes laying around for the DB1200, and we did. That patch is attached. Basically, we avoid a PCI quirk introduced by the 1550, and re-adjust some of the ioremap()s and other sundry macros to account for the fact that the physical address is larger then a u_long. Also, the kernel was missing some PB1200 defines, so I threw those in for fun.

Quoted 4 lines

Yes, in the drivers/pcmcia/au1000_generic.c.
Also, the skt->phys_attr and the skt->phys_mem are set to 0xF4000000 and 0xF8000000 respectively and I wonder, where they got those values?

Those are the pseudo values that are fixed up in the appropriately named __fixup_bigphys_addr to be the actual 36 bit addresses, which are 0xF40000000 and 0xF80000000 respectively.

But other then that, I think that Ulrich is right -the DB board should just work. If we *are* depending on a setting from the bootloader, thats a bug, and should be fixed posthaste.

Ralf and others, let me know if the patch freaks you out.

Jordan

Signature · 4 lines
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>

PATCH: Misc PCMCIA fixes for DB1200

---

 arch/mips/au1000/common/setup.c       |    2 +-
 drivers/pcmcia/au1000_generic.c       |    5 +++--
 include/asm-mips/mach-pb1x00/pb1200.h |    8 ++++++++
 include/pcmcia/cs_types.h             |    5 +++--
 include/pcmcia/ss.h                   |    2 +-
 5 files changed, 16 insertions(+), 6 deletions(-)
arch/mips/au1000/common/setup.c +1 -1
index eb155c0..fcfe306 100644
@@ -153,7 +153,7 @@ phys_t __fixup_bigphys_addr(phys_t phys_
 	/* Don't fixup 36 bit addresses */
 	if ((phys_addr >> 32) != 0) return phys_addr;
 
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && !defined(CONFIG_SOC_AU1200)
 	start = (u32)Au1500_PCI_MEM_START;
 	end = (u32)Au1500_PCI_MEM_END;
 	/* check for pci memory window */
drivers/pcmcia/au1000_generic.c +3 -2
index 971a352..55a46e2 100644
@@ -402,7 +402,7 @@ int au1x00_pcmcia_socket_probe(struct de
 		 */
 		if (i == 0) {
 			skt->virt_io = (void *)
-				(ioremap((phys_t)AU1X_SOCK0_IO, 0x1000) -
+				(u32)(ioremap((ioaddr_t)AU1X_SOCK0_IO, 0x1000) -
 				(u32)mips_io_port_base);
 			skt->phys_attr = AU1X_SOCK0_PSEUDO_PHYS_ATTR;
 			skt->phys_mem = AU1X_SOCK0_PSEUDO_PHYS_MEM;
@@ -410,7 +410,7 @@ int au1x00_pcmcia_socket_probe(struct de
 #ifndef CONFIG_MIPS_XXS1500
 		else  {
 			skt->virt_io = (void *)
-				(ioremap((phys_t)AU1X_SOCK1_IO, 0x1000) -
+				(u32)(ioremap((ioaddr_t)AU1X_SOCK1_IO, 0x1000) -
 				(u32)mips_io_port_base);
 			skt->phys_attr = AU1X_SOCK1_PSEUDO_PHYS_ATTR;
 			skt->phys_mem = AU1X_SOCK1_PSEUDO_PHYS_MEM;
@@ -420,6 +420,7 @@ int au1x00_pcmcia_socket_probe(struct de
 		ret = ops->hw_init(skt);
 
 		skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
+		skt->socket.resource_ops = &pccard_static_ops;
 		skt->socket.irq_mask = 0;
 		skt->socket.map_size = MAP_SIZE;
 		skt->socket.pci_irq = skt->irq;
include/asm-mips/mach-pb1x00/pb1200.h +8 -0
index 409d443..15823eb 100644
@@ -181,6 +181,14 @@ static BCSR * const bcsr = (BCSR *)BCSR_
 #define SET_VCC_VPP(VCC, VPP, SLOT)\
 	((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
 
+/* PCMCIA Db1x00 specific defines */
+#define PCMCIA_MAX_SOCK 1
+#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK+1)
+
+/* VPP/VCC */
+#define SET_VCC_VPP(VCC, VPP, SLOT)\
+	((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
+
 #define AU1XXX_SMC91111_PHYS_ADDR	(0x0D000300)
 #define AU1XXX_SMC91111_IRQ			PB1200_ETH_INT
 
include/pcmcia/cs_types.h +3 -2
index c1d1629..8e8c20d 100644
@@ -21,9 +21,10 @@
 #include <sys/types.h>
 #endif
 
-#if defined(__arm__) || defined(__mips__)
-/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
+#if defined(__arm__)
 typedef u_int   ioaddr_t;
+#elif defined(__mips__)
+typedef unsigned long long ioaddr_t;
 #else
 typedef u_short	ioaddr_t;
 #endif
include/pcmcia/ss.h +1 -1
index 2889a69..b828471 100644
@@ -99,7 +99,7 @@ typedef struct pccard_mem_map {
     u_char	map;
     u_char	flags;
     u_short	speed;
-    u_long	static_start;
+    ioaddr_t	static_start;
     u_int	card_start;
     struct resource *res;
 } pccard_mem_map;