[PATCH 22/24] jmicron: Jmicron multifunction setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alan Cox <alan@xxxxxxxxxx>

JMicron controllers start out in life pretending to be a single legacy IDE
interface with the ports magically mangled into it. When prodding they turn
into a dual function device which has an AHCI controller for SATA and a
PATA controller for the PATA ports.

Do the prodding early enough that our PCI layer enumeration finds and
discovers the extra functions.

Signed-off-by: Alan Cox <alan@xxxxxxxxxx>


---

 drivers/pci/quirks.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

e2b0e59a480b7d437b387cced5d96f60e6cb7aff
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5f7e0a9..0a115ca 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1186,7 +1186,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S
 static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev)
 {
 	u32 conf;
+	u8 hdr;
 
+	/* Only poke fn 0 */	
 	if (PCI_FUNC(pdev->devfn))
 		return;
 		
@@ -1206,11 +1208,19 @@ static void __devinit quirk_jmicron_dual
 			conf &= ~0x000F0200;	/* Clear bit 9 and 16-19 */
 			conf |=  0x00C20002;	/* Set bit 1, 17, 22, 23 */
 			pci_write_config_dword(pdev, 0x40, conf);
+			
+			/* Reconfigure so that the PCI scanner discovers the
+			   device is now multifunction */
+			   
+			pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr);
+			pdev->hdr_type = hdr & 0x7f;
+			pdev->multifunction = !!(hdr & 0x80);
+			
 			break;
 	}
 }
 
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
 
 #endif
 
-- 
1.2.GIT

-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux