linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Tokyo Electron SDIO controller (Ellen) support
@ 2007-12-01  8:27 Vitaly Luban
  2007-12-01 20:50 ` Pierre Ossman
  2008-08-06 22:39 ` Pierre Ossman
  0 siblings, 2 replies; 6+ messages in thread
From: Vitaly Luban @ 2007-12-01  8:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Pierre Ossman, Vitaly Luban

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

Kernel "pci_ids.h" file has data for that card missing.

Also, Ellen needs some control bits flipped before it functions properly 
as SDIO controller by the spec.
Should apply clenly to Linus and Drzeus trees. Please apply.

Signed-off-by:  Vitaly Luban <vitaly@luban.org>



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

--- drzeus/drivers/mmc/host/sdhci.c	2007-11-27 19:51:35.000000000 -0800
+++ linux-2.6.23/drivers/mmc/host/sdhci.c	2007-11-30 18:43:02.000000000 -0800
@@ -97,6 +99,13 @@
 				  SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
 	},
 
+        {
+                .vendor         = PCI_VENDOR_ID_TOKYO_ELECTRON,
+                .device         = PCI_DEVICE_ID_ELLEN,
+                .subvendor      = PCI_ANY_ID,
+                .subdevice      = PCI_ANY_ID,
+        },
+
 	{	/* Generic SD host controller */
 		PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
 	},
@@ -1205,10 +1214,43 @@
  *                                                                           *
 \*****************************************************************************/
 
+static int __devinit sdhci_ellen_init(struct pci_dev *pdev)
+{
+	int                 ret;
+	unsigned int        config;
+	void __iomem *      ioaddr;
+	 
+	if (pci_resource_flags(pdev, 0) & PCI_BASE_ADDRESS_SPACE)
+		return -ENOMEM;
+	
+	ret = pci_request_region(pdev, 0, "EllenPCI");
+	if (ret)
+		return -ENOMEM;
+	
+	ioaddr = ioremap_nocache(pci_resource_start(pdev, 0), 
+	                         pci_resource_len(pdev, 0));
+	if (!ioaddr) {
+		ret = -ENOMEM;
+		goto release;
+	}
+	
+	/* Do some magic passes to enable Ellen PCI interrupts */
+	config = readw(ioaddr + 0x4c);
+	config |= (1) | (1<<3) | (1<<6);
+	writew(config, ioaddr + 0x4c);
+	/* Retire last write by read */
+	config = readw(ioaddr + 0x4c);
+	
+	iounmap(ioaddr);
+release:
+	pci_release_region(pdev, 0);
+	return ret;
+}
+
 static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
 {
 	int ret;
-	unsigned int version;
+	unsigned int version, temp, iomemsize;
 	struct sdhci_chip *chip;
 	struct mmc_host *mmc;
 	struct sdhci_host *host;
@@ -1225,6 +1267,15 @@
 
 	first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
 
+	if ((pdev->vendor == PCI_VENDOR_ID_TOKYO_ELECTRON) &&
+	    (pdev->device == PCI_DEVICE_ID_ELLEN)) {
+		first_bar = 2;
+		iomemsize = 0x400;
+	}
+	else {
+		iomemsize = 0x100;
+	}
+
 	if (first_bar > 5) {
 		printk(KERN_ERR DRIVER_NAME ": Invalid first BAR. Aborting.\n");
 		return -ENODEV;
@@ -1235,9 +1286,9 @@
 		return -ENODEV;
 	}
 
-	if (pci_resource_len(pdev, first_bar + slot) != 0x100) {
-		printk(KERN_ERR DRIVER_NAME ": Invalid iomem size. "
-			"You may experience problems.\n");
+	if ((temp = pci_resource_len(pdev, first_bar + slot)) != iomemsize) {
+		printk(KERN_ERR DRIVER_NAME ": Invalid iomem size %x. "
+			"You may experience problems.\n", temp);
 	}
 
 	if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) {
@@ -1526,6 +1577,24 @@
 	chip->pdev = pdev;
 	chip->quirks = ent->driver_data;
 
+	if ((pdev->vendor == PCI_VENDOR_ID_TOKYO_ELECTRON) &&
+	    (pdev->device == PCI_DEVICE_ID_ELLEN)) {
+		ret = pci_read_config_byte(pdev, PCI_CLASS_PROG, &rev);
+		if (ret)
+			goto free;
+		
+		if( rev & 0x1 ) {
+			/* Ellen indicates DMA support by this bit */
+			chip->quirks |= SDHCI_QUIRK_FORCE_DMA;
+		}
+		
+		ret = sdhci_ellen_init(pdev);
+		if (ret) {
+			ret = -ENODEV;
+			goto free;
+		}
+	}
+
 	if (debug_quirks)
 		chip->quirks = debug_quirks;
 
--- drzeus/include/linux/pci_ids.h	2007-11-30 19:15:24.000000000 -0800
+++ linux-2.6.23/include/linux/pci_ids.h	2007-11-30 19:15:01.000000000 -0800
@@ -2057,6 +2057,9 @@
 #define PCI_DEVICE_ID_BCM1250_PCI	0x0001
 #define PCI_DEVICE_ID_BCM1250_HT	0x0002
 
+#define PCI_VENDOR_ID_TOKYO_ELECTRON	0x1679
+#define PCI_DEVICE_ID_ELLEN		0x3000
+
 #define PCI_VENDOR_ID_ATHEROS		0x168c
 
 #define PCI_VENDOR_ID_NETCELL		0x169c

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

* Re: [PATCH] Tokyo Electron SDIO controller (Ellen) support
  2007-12-01  8:27 [PATCH] Tokyo Electron SDIO controller (Ellen) support Vitaly Luban
@ 2007-12-01 20:50 ` Pierre Ossman
  2007-12-03 14:22   ` Matt Porter
  2008-08-06 22:39 ` Pierre Ossman
  1 sibling, 1 reply; 6+ messages in thread
From: Pierre Ossman @ 2007-12-01 20:50 UTC (permalink / raw)
  To: Vitaly Luban; +Cc: linux-kernel, Vitaly Luban

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

On Sat, 01 Dec 2007 00:27:06 -0800
Vitaly Luban <vitaly@luban.org> wrote:

> Kernel "pci_ids.h" file has data for that card missing.
> 
> Also, Ellen needs some control bits flipped before it functions properly 
> as SDIO controller by the spec.
> Should apply clenly to Linus and Drzeus trees. Please apply.
> 
> Signed-off-by:  Vitaly Luban <vitaly@luban.org>
> 
> 

The illiteracy rates for hardware engineers must be through the roof. Nobody seems capable of reading specifications anymore...

As for the patch, it's a big NAK at this point. Vendors who can't be bothered to follow the standard will have to wait for Ben's separation patches before they can be supported. Then they can have some voodoo front-end to handle their mistakes instead of turning sdhci.c into a collection of hacks and workarounds.

Rgds
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Tokyo Electron SDIO controller (Ellen) support
  2007-12-01 20:50 ` Pierre Ossman
@ 2007-12-03 14:22   ` Matt Porter
  2007-12-03 14:39     ` Ben Dooks
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Porter @ 2007-12-03 14:22 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: Vitaly Luban, linux-kernel

On Sat, Dec 01, 2007 at 09:50:10PM +0100, Pierre Ossman wrote:
> As for the patch, it's a big NAK at this point. Vendors who can't be bothered to follow
> the standard will have to wait for Ben's separation patches before they can be supported.
> Then they can have some voodoo front-end to handle their mistakes instead of turning
> sdhci.c into a collection of hacks and workarounds.

What's the status of Ben's separation patches? I haven't seen a posting of those
versus a recent kernel. I've got some SDHCI driver glue for the non-pci Arasan core
running in an older kernel tree with those patches. It's just waiting for the separation
patches to hit the mmc or mainline tree.

-Matt

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

* Re: [PATCH] Tokyo Electron SDIO controller (Ellen) support
  2007-12-03 14:22   ` Matt Porter
@ 2007-12-03 14:39     ` Ben Dooks
  2008-02-08 23:06       ` Pierre Ossman
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Dooks @ 2007-12-03 14:39 UTC (permalink / raw)
  To: Matt Porter; +Cc: Pierre Ossman, Vitaly Luban, linux-kernel

On Mon, Dec 03, 2007 at 08:22:07AM -0600, Matt Porter wrote:
> On Sat, Dec 01, 2007 at 09:50:10PM +0100, Pierre Ossman wrote:
> > As for the patch, it's a big NAK at this point. Vendors who can't be bothered to follow
> > the standard will have to wait for Ben's separation patches before they can be supported.
> > Then they can have some voodoo front-end to handle their mistakes instead of turning
> > sdhci.c into a collection of hacks and workarounds.
> 
> What's the status of Ben's separation patches? I haven't seen a posting of those
> versus a recent kernel. I've got some SDHCI driver glue for the non-pci Arasan core
> running in an older kernel tree with those patches. It's just waiting for the separation
> patches to hit the mmc or mainline tree.

I need to go back and try and sort out the last of Pierre's last
comments, and update to the latest kernel version. I was waiting
for 2.6.24-rc4 to re-start the effort to try and ensure there are
fewer changes due to fixes.

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* Re: [PATCH] Tokyo Electron SDIO controller (Ellen) support
  2007-12-03 14:39     ` Ben Dooks
@ 2008-02-08 23:06       ` Pierre Ossman
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre Ossman @ 2008-02-08 23:06 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Matt Porter, Vitaly Luban, linux-kernel

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

On Mon, 3 Dec 2007 14:39:26 +0000
Ben Dooks <ben@fluff.org> wrote:

> On Mon, Dec 03, 2007 at 08:22:07AM -0600, Matt Porter wrote:
> > 
> > What's the status of Ben's separation patches? I haven't seen a posting of those
> > versus a recent kernel. I've got some SDHCI driver glue for the non-pci Arasan core
> > running in an older kernel tree with those patches. It's just waiting for the separation
> > patches to hit the mmc or mainline tree.
> 
> I need to go back and try and sort out the last of Pierre's last
> comments, and update to the latest kernel version. I was waiting
> for 2.6.24-rc4 to re-start the effort to try and ensure there are
> fewer changes due to fixes.
> 

Any progress on this little project?

Rgds
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] Tokyo Electron SDIO controller (Ellen) support
  2007-12-01  8:27 [PATCH] Tokyo Electron SDIO controller (Ellen) support Vitaly Luban
  2007-12-01 20:50 ` Pierre Ossman
@ 2008-08-06 22:39 ` Pierre Ossman
  1 sibling, 0 replies; 6+ messages in thread
From: Pierre Ossman @ 2008-08-06 22:39 UTC (permalink / raw)
  To: Vitaly Luban; +Cc: linux-kernel, Vitaly Luban

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

On Sat, 01 Dec 2007 00:27:06 -0800
Vitaly Luban <vitaly@luban.org> wrote:

> Kernel "pci_ids.h" file has data for that card missing.
> 
> Also, Ellen needs some control bits flipped before it functions properly 
> as SDIO controller by the spec.
> Should apply clenly to Linus and Drzeus trees. Please apply.
> 
> Signed-off-by:  Vitaly Luban <vitaly@luban.org>
> 
> 

The separation has now finally been performed in case you want to
revisit this patch.

Rgds
-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-08-06 22:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-01  8:27 [PATCH] Tokyo Electron SDIO controller (Ellen) support Vitaly Luban
2007-12-01 20:50 ` Pierre Ossman
2007-12-03 14:22   ` Matt Porter
2007-12-03 14:39     ` Ben Dooks
2008-02-08 23:06       ` Pierre Ossman
2008-08-06 22:39 ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).