public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: sata_sil 3112 activity LED patch
@ 2005-07-15  2:15 Christian Kroll
  2005-07-15  5:57 ` Aric Cyr
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Kroll @ 2005-07-15  2:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: acyr

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I have tested the patch against my DawiControl DC-150 RAID controller
which is basically an add-on card with a SiI 3112 ASIC and a flash ROM.
The activity LED of my case is directly connected to the add-on card.

Unfortunately your patch doesn't have any effect on the LED. The
activity LED gets turned on by the card's BIOS at boot time and
continues to shine until I shut down the computer.
On the other hand it did not erase my Flash ROM and I haven't spotted
any data loss so far.

The LED does work as expected under that other OS as soon as Silicon
Image's reference driver is loaded, hence it is connected correctly.

Test setup:
I'm using DawiControl's version of the BIOS and not the reference BIOS
of Silicon Image. The test system is a Tualatin Celeron 1400 with an
i440BX based mainboard. The following hard disk is connected to the
controller: Seagate ST3160827AS (native SATA interface). The sata_sil
driver is loaded as a module.
Test kernel is vanilla 2.6.12.2. No tainted modules were used
while doing these tests.

If you require more information, don't hesitate to contact me.

Regards
Christian Kroll

- --
Christian Kroll <christian dot kroll at bglug dot org>
GnuPG Fingerprint: DA5D 5BFA 5C95 FD09 2A72  517E 10CB DCD5 71ED 7E35

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1xsQEMvc1XHtfjURAqKQAJ0fp5EtdymeUsiklcqYsCR9Q7VyngCeIfKV
Sb/wTjlvfk6MPMk/KEBkBPY=
=g7Vc
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 8+ messages in thread
* sata_sil 3112 activity LED patch
@ 2005-07-06  2:51 Aric Cyr
  2005-07-06 15:07 ` Jeff Garzik
  0 siblings, 1 reply; 8+ messages in thread
From: Aric Cyr @ 2005-07-06  2:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: jgarzik, linux-ide


[-- Attachment #1.1: Type: text/plain, Size: 2211 bytes --]

After finally getting fed up with not having my activity light working
for my SATA drives, I came up with a small patch (more like hack) to
make it work.  It works quite well, but I'm afraid that there are many
restriction that this patch does not check for that it probably
should... so consider this a work-in-progress.  My information is
based on a document from Silicon Image that appears to no longer be
available on their website (Sil-AN-0082-E; 8112-0082.pdf).  I still
have a copy if anyone is interested.

There are two restrictions that are not checked:

1) Is the chip a 3112 or 3114?  I assume that this would only work on
   a 3112, but whether it is "a bad thing" on a 3114 I do not know.

2) BAR5 + 0x54 is apparently used for the flash memory address and
   data lines.  However for most motherboards (i.e. not add-on cards)
   with the chip, like my EPOX 8RDA3+, there is no flash memory, so
   these lines are hijacked as LED GPIO.  I assume that this is a
   common practice for motherboard makers using the sil3112 since
   Silicon Image went out of their way to produce the above mentioned
   document.  Anyways, the problem is that this patch does not check
   if flash memory is installed or not before twiddling with the GPIO
   lines.  This could be extremely bad for people running the 3112
   from add-on cards (or any implementation with flash memory
   installed).

Setting the low 8bits at BAR5+54h seems to enable the LED circuit.  It
seems that this circuit is patched through into the motherboard as it
lights the regular hard drive light on the front of my case.  Setting
bits [8:15] at BAR5+54h clears the bits, disabling the LED.  I hooked
this logic into the ata_bmdma_start and ata_bmdma_stop which were made
into simple wrapper functions in sata_sil.c that just set the GPIO
bits and calls ata_bmdma_*.

As a sanity test, I ran my drive, loaded, overnight with no problems.

If there is a better way to do this, I would be happy to hear any
suggestions... it is kind of ugly as it is now.

-- 
Aric Cyr <acyr at alumni dot uwaterloo dot ca>    (http://acyr.net)
gpg fingerprint: 943A 1549 47AC D766 B7F8  D551 6703 7142 C282 D542

[-- Attachment #1.2: sata_sil-led.patch --]
[-- Type: text/plain, Size: 2117 bytes --]

--- sata_sil.c.orig	2005-06-15 17:48:23.000000000 +0900
+++ sata_sil.c	2005-07-06 01:58:28.000000000 +0900
@@ -45,6 +45,7 @@
 	sil_3114		= 1,
 
 	SIL_SYSCFG		= 0x48,
+	SIL_GPIO                = 0x54,
 	SIL_MASK_IDE0_INT	= (1 << 22),
 	SIL_MASK_IDE1_INT	= (1 << 23),
 	SIL_MASK_IDE2_INT	= (1 << 24),
@@ -65,6 +66,8 @@
 static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static void sil_post_set_mode (struct ata_port *ap);
+static void sil_bmdma_start(struct ata_queued_cmd *qc);
+static void sil_bmdma_stop(struct ata_port *ap);
 
 static struct pci_device_id sil_pci_tbl[] = {
 	{ 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 },
@@ -138,8 +140,8 @@
 	.phy_reset		= sata_phy_reset,
 	.post_set_mode		= sil_post_set_mode,
 	.bmdma_setup            = ata_bmdma_setup,
-	.bmdma_start            = ata_bmdma_start,
-	.bmdma_stop		= ata_bmdma_stop,
+	.bmdma_start            = sil_bmdma_start,
+	.bmdma_stop		= sil_bmdma_stop,
 	.bmdma_status		= ata_bmdma_status,
 	.qc_prep		= ata_qc_prep,
 	.qc_issue		= ata_qc_issue_prot,
@@ -198,6 +200,35 @@
 MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
+static void sil_bmdma_start(struct ata_queued_cmd *qc)
+{
+  void* mmio_base = qc->ap->host_set->mmio_base;
+  u32 gpio = readl(mmio_base + SIL_GPIO);
+
+  /* setting the lower 8 bits to activate the activity LED */
+  gpio |= 0x00ff;
+  writel(gpio, mmio_base + SIL_GPIO);
+  readl(mmio_base + SIL_GPIO);	/* flush */
+
+  ata_bmdma_start(qc);
+}
+
+static void sil_bmdma_stop(struct ata_port *ap)
+{
+  void* mmio_base = ap->host_set->mmio_base;
+  u32 gpio = readl(mmio_base + SIL_GPIO);
+
+  ata_bmdma_stop(ap);
+
+  /* 
+   * setting bits [8:15] clears the lower 8 bits,
+   * deactivating the activity LED
+   */
+  gpio |= 0xff00;
+  writel(gpio, mmio_base + SIL_GPIO);
+  readl(mmio_base + SIL_GPIO);	/* flush */
+}
+
 static void sil_post_set_mode (struct ata_port *ap)
 {
 	struct ata_host_set *host_set = ap->host_set;

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

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

end of thread, other threads:[~2005-07-15 10:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-15  2:15 sata_sil 3112 activity LED patch Christian Kroll
2005-07-15  5:57 ` Aric Cyr
2005-07-15 10:34   ` Christian Kroll
  -- strict thread matches above, loose matches on Subject: below --
2005-07-06  2:51 Aric Cyr
2005-07-06 15:07 ` Jeff Garzik
2005-07-07 12:47   ` Jens Axboe
2005-07-07 14:23     ` Aric Cyr
2005-07-07 15:11       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox