All of lore.kernel.org
 help / color / mirror / Atom feed
* PCMCIA on AU1200
@ 2006-01-31 10:39 ` Matej Kupljen
  0 siblings, 0 replies; 5+ messages in thread
From: Matej Kupljen @ 2006-01-31 10:39 UTC (permalink / raw)
  To: linux-mips

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* PCMCIA on AU1200
@ 2006-01-31 10:39 ` Matej Kupljen
  0 siblings, 0 replies; 5+ messages in thread
From: Matej Kupljen @ 2006-01-31 10:39 UTC (permalink / raw)
  To: linux-mips

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PCMCIA on AU1200
  2006-01-31 10:39 ` Matej Kupljen
  (?)
@ 2006-01-31 14:03 ` Ulrich Eckhardt
  2006-01-31 19:41   ` Matej Kupljen
  -1 siblings, 1 reply; 5+ messages in thread
From: Ulrich Eckhardt @ 2006-01-31 14:03 UTC (permalink / raw)
  To: linux-mips

On Tuesday 31 January 2006 11:39, Matej Kupljen wrote:
> 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?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PCMCIA on AU1200
  2006-01-31 14:03 ` Ulrich Eckhardt
@ 2006-01-31 19:41   ` Matej Kupljen
  2006-01-31 20:49     ` Jordan Crouse
  0 siblings, 1 reply; 5+ messages in thread
From: Matej Kupljen @ 2006-01-31 19:41 UTC (permalink / raw)
  To: Ulrich Eckhardt; +Cc: linux-mips

Hi

> 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? 

> 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.

> 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).

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PCMCIA on AU1200
  2006-01-31 19:41   ` Matej Kupljen
@ 2006-01-31 20:49     ` Jordan Crouse
  0 siblings, 0 replies; 5+ messages in thread
From: Jordan Crouse @ 2006-01-31 20:49 UTC (permalink / raw)
  To: Matej Kupljen; +Cc: Ulrich Eckhardt, linux-mips

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

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.

> 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
-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>

[-- Attachment #2: pcmcia.patch --]
[-- Type: text/plain, Size: 3619 bytes --]

PATCH:  Misc PCMCIA fixes for DB1200

Signed-off-by:  Jordan Crouse <jordan.crouse@amd.com>
---

 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(-)

diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index eb155c0..fcfe306 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -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 */
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 971a352..55a46e2 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -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;
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
index 409d443..15823eb 100644
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -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
 
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index c1d1629..8e8c20d 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -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
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 2889a69..b828471 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-31 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-31 10:39 PCMCIA on AU1200 Matej Kupljen
2006-01-31 10:39 ` Matej Kupljen
2006-01-31 14:03 ` Ulrich Eckhardt
2006-01-31 19:41   ` Matej Kupljen
2006-01-31 20:49     ` Jordan Crouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.