Skip to contentSkip to conversation

MPC52xx updates : lite5200b + ide support

PATCH In review Sylvain Munaut 2 participants 7 messages Mar 26, 2006 – Mar 27, 2006 PCI

lore
Share & tools
lore
#0 lore raw

cover MPC52xx updates : lite5200b + ide support

Hi Paul,
Hi everyone,

This set of updates mainly adds support for the new lite5200B devboard from Freescale and support for IDE.

Theses have been posted on the ppc-embedded mailing list some time ago, they've been tested and reported working by a few people, so Paul it'd be nice to get those merged upstream. If you were not the one to cc about this, let me know, I'll forward those to Andrew.

Thanks !

Regards,
Sylvain

#1 lore raw

PATCH 1/4 ppc32: Adds support for the PCI hostbridge in MPC5200B

ppc32: Adds support for the PCI hostbridge in MPC5200B

---
commit d2c9f75189b6bd63b94cc78f8522a44c4476939a tree 384ab1d358439be5cddbab68cfa542390ac784f4 parent 3cbb90a9cb7854b1110663919d5bc3da3f46d5e3 author Sylvain Munaut <[email protected]> 1138559991 +0100 committer Sylvain Munaut <[email protected]> 1143311787 +0100

 arch/ppc/syslib/mpc52xx_pci.c |    3 ++-
 include/linux/pci_ids.h       |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

---
d2c9f75189b6bd63b94cc78f8522a44c4476939a

arch/ppc/syslib/mpc52xx_pci.c +2 -1
index 9ec525f..5a5a7a9 100644
@@ -225,7 +225,8 @@ mpc52xx_pci_fixup_resources(struct pci_d
 	/* The PCI Host bridge of MPC52xx has a prefetch memory resource
 	   fixed to 1Gb. Doesn't fit in the resource system so we remove it */
 	if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
-	     (dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200) ) {
+	     (   dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200
+	      || dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200B) ) {
 		struct resource *res = &dev->resource[1];
 		res->start = res->end = res->flags = 0;
 	}
include/linux/pci_ids.h +1 -0
index 6f080ae..72d1b67 100644
@@ -772,6 +772,7 @@
 #define PCI_DEVICE_ID_MOTOROLA_HAWK	0x4803
 #define PCI_DEVICE_ID_MOTOROLA_HARRIER	0x480b
 #define PCI_DEVICE_ID_MOTOROLA_MPC5200	0x5803
+#define PCI_DEVICE_ID_MOTOROLA_MPC5200B	0x5809
 
 #define PCI_VENDOR_ID_PROMISE		0x105a
 #define PCI_DEVICE_ID_PROMISE_20265	0x0d30
#2 lore raw

PATCH 2/4 ppc32: Adds support for the LITE5200B dev board

In reply to Sylvain Munaut

ppc32: Adds support for the LITE5200B dev board

This LITE5200B devboard is the new development board for the Freescale MPC5200 processor. It has two PCI slots and so a different PCI IRQ routing.

---
commit 37ffaaccad4fb48c8416e610aab4d3bed41dfc80 tree 3f7b1b661e3ea7c6830c020e42948c575e73d52f parent d2c9f75189b6bd63b94cc78f8522a44c4476939a author Sylvain Munaut <[email protected]> 1138562427 +0100 committer Sylvain Munaut <[email protected]> 1143311804 +0100

 Kconfig              |    7 +++++++
 platforms/lite5200.c |   33 ++++++++++++++++++++++++++++++---
 2 files changed, 37 insertions(+), 3 deletions(-)

---
37ffaaccad4fb48c8416e610aab4d3bed41dfc80

arch/ppc/Kconfig +7 -0
index 54a0a9b..1c12da2 100644
@@ -711,6 +711,13 @@ config LITE5200
 	  much but it's only been tested on this board version. I think this
 	  board is also known as IceCube.
 
+config LITE5200B
+	bool "Freescale LITE5200B"
+	depends LITE5200
+	help
+	  Support for the LITE5200B dev board for the MPC5200 from Freescale.
+	  This is the new board with 2 PCI slots.
+
 config MPC834x_SYS
 	bool "Freescale MPC834x SYS"
 	help
arch/ppc/platforms/lite5200.c +30 -3
index 5171b53..d91efe1 100644
@@ -34,6 +34,7 @@
 #include <asm/mpc52xx.h>
 #include <asm/ppc_sys.h>
 #include <asm/machdep.h>
+#include <asm/pci-bridge.h>
 
 #include <syslib/mpc52xx_pci.h>
 
@@ -68,12 +69,32 @@ lite5200_show_cpuinfo(struct seq_file *m
 }
 
 #ifdef CONFIG_PCI
+#ifdef CONFIG_LITE5200B
+static int
+lite5200_map_irq(struct pci_dev *dev, unsigned char idsel,
+		    unsigned char pin)
+{
+	static char pci_irq_table[][4] =
+	/*
+	 *      PCI IDSEL/INTPIN->INTLINE
+	 *        A             B             C             D
+	 */
+	{
+		{MPC52xx_IRQ0, MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3},
+		{MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3, MPC52xx_IRQ0},
+	};
+
+	const long min_idsel = 24, max_idsel = 25, irqs_per_slot = 4;
+	return PCI_IRQ_TABLE_LOOKUP;
+}
+#else /* Original Lite */
 static int
 lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
 {
 	return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
 }
 #endif
+#endif
 
 static void __init
 lite5200_setup_cpu(void)
@@ -127,11 +148,17 @@ lite5200_setup_cpu(void)
 	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
 	out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
 
-	/* IRQ[0-3] setup : IRQ0     - Level Active Low  */
-	/*                  IRQ[1-3] - Level Active High */
+	/* IRQ[0-3] setup */
 	intr_ctrl = in_be32(&intr->ctrl);
 	intr_ctrl &= ~0x00ff0000;
-	intr_ctrl |=  0x00c00000;
+#ifdef CONFIG_LITE5200B
+	/* IRQ[0-3] Level Active Low */
+	intr_ctrl |=  0x00ff0000;
+#else
+	/* IRQ0 Level Active Low
+	 * IRQ[1-3] Level Active High */
+ 	intr_ctrl |=  0x00c00000;
+#endif
 	out_be32(&intr->ctrl, intr_ctrl);
 
 	/* Unmap reg zone */
#3 lore raw

PATCH 3/4 ppc32: Reorganize and complete MPC52xx initial cpu setup

In reply to Sylvain Munaut

ppc32: Reorganize and complete MPC52xx initial cpu setup

This patch splits up the CPU setup into a generic part and a platform specific part. We also add a few missing init at the same time.

---
commit 67015426ff51ba857b7678a993f4ffd6def1941e tree cca92c1916ede8f67fe8d16987a54303c76f31f8 parent 37ffaaccad4fb48c8416e610aab4d3bed41dfc80 author Sylvain Munaut <[email protected]> 1143311892 +0100 committer Sylvain Munaut <[email protected]> 1143311892 +0100

 arch/ppc/platforms/lite5200.c   |   38 ++++++++-----------------------
 arch/ppc/syslib/mpc52xx_setup.c |   48 ++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/mpc52xx.h       |    4 +++
 3 files changed, 62 insertions(+), 28 deletions(-)

---
67015426ff51ba857b7678a993f4ffd6def1941e

arch/ppc/platforms/lite5200.c +10 -28
index d91efe1..fecbe9a 100644
@@ -36,8 +36,6 @@
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 
-#include <syslib/mpc52xx_pci.h>
-
 
 extern int powersave_nap;
 
@@ -99,34 +97,23 @@ lite5200_map_irq(struct pci_dev *dev, un
 static void __init
 lite5200_setup_cpu(void)
 {
-	struct mpc52xx_cdm  __iomem *cdm;
 	struct mpc52xx_gpio __iomem *gpio;
 	struct mpc52xx_intr __iomem *intr;
-	struct mpc52xx_xlb  __iomem *xlb;
 
 	u32 port_config;
 	u32 intr_ctrl;
 
 	/* Map zones */
-	cdm  = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
 	gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
-	xlb  = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
 	intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
 
-	if (!cdm || !gpio || !xlb || !intr) {
-		printk("lite5200.c: Error while mapping CDM/GPIO/XLB/INTR during"
-				"lite5200_setup_cpu\n");
+	if (!gpio || !intr) {
+		printk(KERN_ERR __FILE__ ": "
+			"Error while mapping GPIO/INTR during "
+			"lite5200_setup_cpu\n");
 		goto unmap_regs;
 	}
 
-	/* Use internal 48 Mhz */
-	out_8(&cdm->ext_48mhz_en, 0x00);
-	out_8(&cdm->fd_enable, 0x01);
-	if (in_be32(&cdm->rstcfg) & 0x40)	/* Assumes 33Mhz clock */
-		out_be16(&cdm->fd_counters, 0x0001);
-	else
-		out_be16(&cdm->fd_counters, 0x5555);
-
 	/* Get port mux config */
 	port_config = in_be32(&gpio->port_config);
 
@@ -137,17 +124,13 @@ lite5200_setup_cpu(void)
 	port_config &= ~0x00007000;	/* Differential mode - USB1 only */
 	port_config |=  0x00001000;
 
+	/* ATA CS is on csb_4/5 */
+	port_config &= ~0x03000000;
+	port_config |=  0x01000000;
+
 	/* Commit port config */
 	out_be32(&gpio->port_config, port_config);
 
-	/* Configure the XLB Arbiter */
-	out_be32(&xlb->master_pri_enable, 0xff);
-	out_be32(&xlb->master_priority, 0x11111111);
-
-	/* Enable ram snooping for 1GB window */
-	out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
-	out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
-
 	/* IRQ[0-3] setup */
 	intr_ctrl = in_be32(&intr->ctrl);
 	intr_ctrl &= ~0x00ff0000;
@@ -163,9 +146,7 @@ lite5200_setup_cpu(void)
 
 	/* Unmap reg zone */
 unmap_regs:
-	if (cdm)  iounmap(cdm);
 	if (gpio) iounmap(gpio);
-	if (xlb)  iounmap(xlb);
 	if (intr) iounmap(intr);
 }
 
@@ -173,7 +154,8 @@ static void __init
 lite5200_setup_arch(void)
 {
 	/* CPU & Port mux setup */
-	lite5200_setup_cpu();
+	mpc52xx_setup_cpu();	/* Generic */
+	lite5200_setup_cpu();	/* Platform specific */
 
 #ifdef CONFIG_PCI
 	/* PCI Bridge setup */
arch/ppc/syslib/mpc52xx_setup.c +48 -0

60 lines not on this page · raw message

include/asm-ppc/mpc52xx.h +4 -0
index 6167f74..7e98428 100644
@@ -355,6 +355,7 @@ struct mpc52xx_xlb {
 	u32	snoop_window;		/* XLB + 0x70 */
 };
 
+#define MPC52xx_XLB_CFG_PLDIS		(1 << 31)
 #define MPC52xx_XLB_CFG_SNOOP		(1 << 15)
 
 /* Clock Distribution control */
@@ -427,6 +428,9 @@ extern void mpc52xx_calibrate_decr(void)
 
 extern void mpc52xx_find_bridges(void);
 
+extern void mpc52xx_setup_cpu(void);
+
+
 
 	/* Matching of PSC function */
 struct mpc52xx_psc_func {
#4 lore raw

PATCH 4/4 ppc32/ide: Add support for MPC52xx on-chip ATA controller

In reply to Sylvain Munaut

ppc32/ide: Add support for MPC52xx on-chip ATA controller

This patch adds initial support for Freescale MPC52xx on-chip ATA controller. It's currently PIO-mode only and all the erratas are not handled since some of them requires hw tricks ...

---
commit f3180ffadd5dddcfa9d11da4f7637e3e907e6aaa tree d9bf294057a0dcdda25ba6c6ea3fcc9748d87e93 parent 67015426ff51ba857b7678a993f4ffd6def1941e author Sylvain Munaut <[email protected]> 1139147442 +0100 committer Sylvain Munaut <[email protected]> 1143312600 +0100

 drivers/ide/Kconfig                |    4 
 drivers/ide/Makefile               |    1 
 drivers/ide/ppc/mpc52xx_ide.c      |  420 +++++++++++++++++++++++++++++++++++++
 drivers/ide/ppc/mpc52xx_ide.h      |  129 +++++++++++
 drivers/ide/ppc/mpc52xx_ide_iops.c |  151 +++++++++++++
 include/linux/ide.h                |    2 
 6 files changed, 706 insertions(+), 1 deletion(-)

---
f3180ffadd5dddcfa9d11da4f7637e3e907e6aaa

drivers/ide/Kconfig +4 -0
index d633081..3a10fec 100644
@@ -962,6 +962,10 @@ config IDE_EXT_DIRECT
 
 endchoice
 
+config BLK_DEV_MPC52xx_IDE
+	tristate "MPC52xx Builtin IDE support"
+	depends on PPC_MPC52xx && IDE=y
+
 # no isa -> no vlb
 config IDE_CHIPSETS
 	bool "Other IDE chipset support"
drivers/ide/Makefile +1 -0
index 569fae7..fcca1f3 100644
@@ -34,6 +34,7 @@ ide-core-$(CONFIG_BLK_DEV_MAC_IDE)	+= le
 ide-core-$(CONFIG_BLK_DEV_Q40IDE)	+= legacy/q40ide.o
 
 # built-in only drivers from ppc/
+ide-core-$(CONFIG_BLK_DEV_MPC52xx_IDE)	+= ppc/mpc52xx_ide.o ppc/mpc52xx_ide_iops.o
 ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE)	+= ppc/mpc8xx.o
 ide-core-$(CONFIG_BLK_DEV_IDE_PMAC)	+= ppc/pmac.o
 
drivers/ide/ppc/mpc52xx_ide.c new file +420 -0

420 lines not on this page · raw message

drivers/ide/ppc/mpc52xx_ide.h new file +129 -0

129 lines not on this page · raw message

drivers/ide/ppc/mpc52xx_ide_iops.c new file +151 -0

151 lines not on this page · raw message

include/linux/ide.h +1 -1
index 8d2db41..793c70a 100644
@@ -203,7 +203,7 @@ typedef enum {	ide_unknown,	ide_generic,
 		ide_rz1000,	ide_trm290,
 		ide_cmd646,	ide_cy82c693,	ide_4drives,
 		ide_pmac,	ide_etrax100,	ide_acorn,
-		ide_au1xxx, ide_forced
+		ide_au1xxx,	ide_mpc52xx,	ide_forced
 } hwif_chipset_t;
 
 /*
#5 lore raw
In reply to Sylvain Munaut
Quoted 8 lines · Sylvain Munaut

This set of updates mainly adds support for the new lite5200B devboard from Freescale and support for IDE.

Theses have been posted on the ppc-embedded mailing list some time ago, they've been tested and reported working by a few people, so Paul it'd be nice to get those merged upstream. If you were not the one to cc about this, let me know, I'll forward those to Andrew.

I'll handle patches 1-3, but you will need to send the IDE patch to the IDE maintainer, Bartlomiej Zolnierkiewicz <[email protected]>.

Paul.

#6 lore raw
Quoted 13 lines · Paul Mackerras
Quoted 9 lines · Sylvain Munaut

This set of updates mainly adds support for the new lite5200B devboard from Freescale and support for IDE.

Theses have been posted on the ppc-embedded mailing list some time ago, they've been tested and reported working by a few people, so Paul it'd be nice to get those merged upstream. If you were not the one to cc about this, let me know, I'll forward those to Andrew.

Quoted 6 lines

I'll handle patches 1-3, but you will need to send the IDE patch to the IDE maintainer, Bartlomiej Zolnierkiewicz <[email protected]>.

Paul.

Ok, thanks, I'll do that.

Sylvain