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

Bug#503172: linux-image-2.6.26-1-orion5x: Improve support for the DNS-323



On Thu, Oct 23, 2008 at 10:00:23AM +0200, Martin Michlmayr wrote:
> * Matthew Palmer <mpalmer@debian.org> [2008-10-23 18:23]:
> > The attached patch improves the kernel's support for the DNS-323 in a few
> > areas:
> > 
> > * It reads the MAC address for the on-board NIC out of flash, and uses it in
> >   the NIC initialisation (all DNS-323 models); and
> 
> I put the MAC patch into 2.6.26-9 already.  Can you please make a
> patch with only the rev B1 changes (again 2.6.26-9)?  (Sorry, short on
> time right now.)

Sure, I've attached a SATA-only patch.  I didn't realise you were so
efficient.  <grin>

- Matt
--- dns323-setup.c.orig	2008-10-23 21:16:57.000000000 +1100
+++ dns323-setup.c	2008-10-23 21:17:12.000000000 +1100
@@ -21,6 +21,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
+#include <linux/ata_platform.h>
 #include <asm/mach-types.h>
 #include <asm/gpio.h>
 #include <asm/mach/arch.h>
@@ -67,8 +68,18 @@
 
 static int __init dns323_pci_init(void)
 {
-	if (machine_is_dns323())
-		pci_common_init(&dns323_pci);
+	u32 dev, rev;
+	
+	orion5x_pcie_id(&dev, &rev);
+	
+	if (machine_is_dns323()) {
+		if (dev != MV88F5182_DEV_ID) {
+			/* The 5182 doesn't really use it's PCI bus, so
+			 * we don't initialise it.
+			 */
+			pci_common_init(&dns323_pci);
+		}
+	}
 
 	return 0;
 }
@@ -204,6 +215,13 @@
 	.dev		= { .platform_data  = &dns323_button_data, },
 };
 
+/*****************************************************************************
+ * SATA
+ ****************************************************************************/
+static struct mv_sata_platform_data dns323_sata_data = {
+	.n_ports        = 2,
+};
+
 /****************************************************************************
  * General Setup
  */
@@ -247,6 +265,11 @@
 
 static void __init dns323_init(void)
 {
+	u32 rev, dev;
+	
+	/* Whooooooo are we?  Who who, who who? */
+	orion5x_pcie_id(&dev, &rev);
+	
 	/* Setup basic Orion functions. Need to be called early. */
 	orion5x_init();
 
@@ -262,11 +285,21 @@
 	orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
 				ORION5X_PCIE_WA_SIZE);
 
-	/* set MPP to 0 as D-Link's 2.6.12.6 kernel did */
-	orion5x_write(MPP_0_7_CTRL, 0);
-	orion5x_write(MPP_8_15_CTRL, 0);
-	orion5x_write(MPP_16_19_CTRL, 0);
-	orion5x_write(MPP_DEV_CTRL, 0);
+	if (dev == MV88F5182_DEV_ID) {
+		/* The 5182 has a different MPP map, so we wire it up this way
+		 * to let the HDD LEDs do their thing.  Values taken directly
+		 * from the D-Link kernel.
+		 */
+		orion5x_write(MPP_0_7_CTRL, 0x3);
+		orion5x_write(MPP_8_15_CTRL, 0x55550000);
+		orion5x_write(MPP_16_19_CTRL, 0x5555);
+	} else {
+		/* set MPP to 0 as D-Link's 2.6.12.6 kernel did */
+		orion5x_write(MPP_0_7_CTRL, 0);
+		orion5x_write(MPP_8_15_CTRL, 0);
+		orion5x_write(MPP_16_19_CTRL, 0);
+		orion5x_write(MPP_DEV_CTRL, 0);
+	}
 
 	/* Define used GPIO pins
 
@@ -306,6 +339,11 @@
 				ARRAY_SIZE(dns323_i2c_devices));
 
 	orion5x_eth_init(&dns323_eth_data);
+	/* The 5182 has it's SATA controller internally, and it needs it's own
+	 * little init routine.
+	 */
+	if (dev == MV88F5182_DEV_ID)
+		orion5x_sata_init(&dns323_sata_data);
 }
 
 /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */

Reply to: