LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 10/15] [POWERPC] fix iSeries PCI resource management
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

The way iSeries manages PCI IO and Memory resources is a bit strange
and is based on overriding the content of those resources with home
cooked ones afterward.

This changes it a bit to better integrate with the new resource handling
so that the "virtual" tokens that iSeries replaces resources with are
done from the proper per-device fixup hook, and bridge resources are
set to enclose that token space. This fixes various things such as
the output of /proc/iomem & ioports, among others. The patch also fixup
various boot messages as well.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 
 arch/powerpc/kernel/pci-common.c       |   16 ++++
 arch/powerpc/kernel/pci_64.c           |   19 ++++-
 arch/powerpc/platforms/iseries/pci.c   |  123 +++++++++++++++++----------------
 arch/powerpc/platforms/iseries/pci.h   |    4 +
 arch/powerpc/platforms/iseries/setup.c |   37 +++++----
 5 files changed, 121 insertions(+), 78 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:32.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:33.000000000 +1100
@@ -190,6 +190,20 @@ int pci_read_irq_line(struct pci_dev *pc
 	struct of_irq oirq;
 	unsigned int virq;
 
+	/* The current device-tree that iSeries generates from the HV
+	 * PCI informations doesn't contain proper interrupt routing,
+	 * and all the fallback would do is print out crap, so we
+	 * don't attempt to resolve the interrupts here at all, some
+	 * iSeries specific fixup does it.
+	 *
+	 * In the long run, we will hopefully fix the generated device-tree
+	 * instead.
+	 */
+#ifdef CONFIG_PPC_ISERIES
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return -1;
+#endif
+
 	DBG("Try to map irq for %s...\n", pci_name(pci_dev));
 
 #ifdef DEBUG
@@ -946,7 +960,7 @@ static void __init pcibios_allocate_bus_
 			    || res->start > res->end)
 				continue;
 			if (bus->parent == NULL)
-				pr = (res->flags & IORESOURCE_IO)?
+				pr = (res->flags & IORESOURCE_IO) ?
 					&ioport_resource : &iomem_resource;
 			else {
 				/* Don't bother with non-root busses when
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c	2007-12-14 15:49:32.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c	2007-12-14 15:49:33.000000000 +1100
@@ -343,7 +343,7 @@ void __devinit scan_phb(struct pci_contr
 	int i, mode;
 	struct resource *res;
 
-	DBG("Scanning PHB %s\n", node ? node->full_name : "<NO NAME>");
+	DBG("PCI: Scanning PHB %s\n", node ? node->full_name : "<NO NAME>");
 
 	/* Create an empty bus for the toplevel */
 	bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node);
@@ -359,9 +359,22 @@ void __devinit scan_phb(struct pci_contr
 	pcibios_map_io_space(bus);
 
 	/* Wire up PHB bus resources */
-	bus->resource[0] = res = &hose->io_resource;
-	for (i = 0; i < 3; ++i)
+	if (hose->io_resource.flags) {
+		DBG("PCI: PHB IO resource    = %016lx-%016lx [%lx]\n",
+		    hose->io_resource.start, hose->io_resource.end,
+		    hose->io_resource.flags);
+		bus->resource[0] = res = &hose->io_resource;
+	}
+	for (i = 0; i < 3; ++i) {
+		DBG("PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n", i,
+		    hose->mem_resources[i].start,
+		    hose->mem_resources[i].end,
+		    hose->mem_resources[i].flags);
 		bus->resource[i+1] = &hose->mem_resources[i];
+	}
+	DBG("PCI: PHB MEM offset     = %016lx\n", hose->pci_mem_offset);
+	DBG("PCI: PHB IO  offset     = %08lx\n",
+	    (unsigned long)hose->io_base_virt - _IO_BASE);
 
 	/* Get probe mode and perform scan */
 	mode = PCI_PROBE_NORMAL;
Index: linux-merge/arch/powerpc/platforms/iseries/pci.c
===================================================================
--- linux-merge.orig/arch/powerpc/platforms/iseries/pci.c	2007-12-14 15:48:59.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/iseries/pci.c	2007-12-14 15:49:33.000000000 +1100
@@ -20,6 +20,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
+
+#undef DEBUG
+
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/string.h>
@@ -58,6 +61,7 @@ static int limit_pci_retries = 1;	/* Set
 #define IOMM_TABLE_MAX_ENTRIES	1024
 #define IOMM_TABLE_ENTRY_SIZE	0x0000000000400000UL
 #define BASE_IO_MEMORY		0xE000000000000000UL
+#define END_IO_MEMORY		0xEFFFFFFFFFFFFFFFUL
 
 static unsigned long max_io_memory = BASE_IO_MEMORY;
 static long current_iomm_table_entry;
@@ -68,7 +72,6 @@ static long current_iomm_table_entry;
 static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
 static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
 
-static const char pci_io_text[] = "iSeries PCI I/O";
 static DEFINE_SPINLOCK(iomm_table_lock);
 
 /*
@@ -279,8 +282,8 @@ out_free:
  * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
  * controller
  */
-static void __init iseries_device_information(struct pci_dev *pdev, int count,
-		u16 bus, HvSubBusNumber subbus)
+static void __init iseries_device_information(struct pci_dev *pdev,
+					      u16 bus, HvSubBusNumber subbus)
 {
 	u8 frame = 0;
 	char card[4];
@@ -290,10 +293,9 @@ static void __init iseries_device_inform
 			ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
 
 	if (iseries_get_location_code(bus, agent, &frame, card)) {
-		printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, "
-			"Card %4s  0x%04X\n", count, bus,
-			PCI_SLOT(pdev->devfn), pdev->vendor, frame,
-			card, (int)(pdev->class >> 8));
+		printk(KERN_INFO "PCI: %s, Vendor %04X Frame%3d, "
+		       "Card %4s  0x%04X\n", pci_name(pdev), pdev->vendor,
+		       frame, card, (int)(pdev->class >> 8));
 	}
 }
 
@@ -323,7 +325,6 @@ static void __init iomm_table_allocate_e
 	 * Set Resource values.
 	 */
 	spin_lock(&iomm_table_lock);
-	bar_res->name = pci_io_text;
 	bar_res->start = BASE_IO_MEMORY +
 		IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry;
 	bar_res->end = bar_res->start + bar_size - 1;
@@ -393,61 +394,63 @@ static struct device_node *find_device_n
 }
 
 /*
- * iSeries_pci_final_fixup(void)
+ * iSeries_pcibios_fixup_resources
+ *
+ * Fixes up all resources for devices
  */
-void __init iSeries_pci_final_fixup(void)
+void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
 {
-	struct pci_dev *pdev = NULL;
+	const u32 *agent;
+	const u32 *sub_bus;
+	unsigned char bus = pdev->bus->number;
 	struct device_node *node;
-	int num_dev = 0;
-
-	/* Fix up at the device node and pci_dev relationship */
-	mf_display_src(0xC9000100);
+	int i;
 
-	printk("pcibios_final_fixup\n");
-	for_each_pci_dev(pdev) {
-		const u32 *agent;
-		const u32 *sub_bus;
-		unsigned char bus = pdev->bus->number;
-
-		node = find_device_node(bus, pdev->devfn);
-		printk("pci dev %p (%x.%x), node %p\n", pdev, bus,
-			pdev->devfn, node);
-		if (!node) {
-			printk("PCI: Device Tree not found for 0x%016lX\n",
-					(unsigned long)pdev);
-			continue;
-		}
-
-		agent = of_get_property(node, "linux,agent-id", NULL);
-		sub_bus = of_get_property(node, "linux,subbus", NULL);
-		if (agent && sub_bus) {
-			u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
-			int err;
-
-			err = HvCallXm_connectBusUnit(bus, *sub_bus,
-					*agent, irq);
-			if (err)
-				pci_log_error("Connect Bus Unit",
-					bus, *sub_bus, *agent, err);
-			else {
-				err = HvCallPci_configStore8(bus, *sub_bus,
+	node = find_device_node(bus, pdev->devfn);
+	pr_debug("PCI: iSeries %s, pdev %p, node %p\n",
+		 pci_name(pdev), pdev, node);
+	if (!node) {
+		printk("PCI: %s disabled, device tree entry not found !\n",
+		       pci_name(pdev));
+		for (i = 0; i <= PCI_ROM_RESOURCE; i++)
+			pdev->resource[i].flags = 0;
+		return;
+	}
+	sub_bus = of_get_property(node, "linux,subbus", NULL);
+	agent = of_get_property(node, "linux,agent-id", NULL);
+	if (agent && sub_bus) {
+		u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
+		int err;
+
+		err = HvCallXm_connectBusUnit(bus, *sub_bus, *agent, irq);
+		if (err)
+			pci_log_error("Connect Bus Unit",
+				      bus, *sub_bus, *agent, err);
+		else {
+			err = HvCallPci_configStore8(bus, *sub_bus,
 					*agent, PCI_INTERRUPT_LINE, irq);
-				if (err)
-					pci_log_error("PciCfgStore Irq Failed!",
+			if (err)
+				pci_log_error("PciCfgStore Irq Failed!",
 						bus, *sub_bus, *agent, err);
-				else
-					pdev->irq = irq;
-			}
+			else
+				pdev->irq = irq;
 		}
-
-		num_dev++;
-		pdev->sysdata = node;
-		PCI_DN(node)->pcidev = pdev;
-		allocate_device_bars(pdev);
-		iseries_device_information(pdev, num_dev, bus, *sub_bus);
-		iommu_devnode_init_iSeries(pdev, node);
 	}
+
+	pdev->sysdata = node;
+	PCI_DN(node)->pcidev = pdev;
+	allocate_device_bars(pdev);
+	iseries_device_information(pdev, bus, *sub_bus);
+	iommu_devnode_init_iSeries(pdev, node);
+}
+
+/*
+ * iSeries_pci_final_fixup(void)
+ */
+void __init iSeries_pci_final_fixup(void)
+{
+	/* Fix up at the device node and pci_dev relationship */
+	mf_display_src(0xC9000100);
 	iSeries_activate_IRQs();
 	mf_display_src(0xC9000200);
 }
@@ -894,10 +897,18 @@ void __init iSeries_pcibios_init(void)
 		/* All legacy iSeries PHBs are in domain zero */
 		phb->global_number = 0;
 
-		phb->pci_mem_offset = bus;
 		phb->first_busno = bus;
 		phb->last_busno = bus;
 		phb->ops = &iSeries_pci_ops;
+		phb->io_base_virt = (void __iomem *)_IO_BASE;
+		phb->io_resource.flags = IORESOURCE_IO;
+		phb->io_resource.start = BASE_IO_MEMORY;
+		phb->io_resource.end = END_IO_MEMORY;
+		phb->io_resource.name = "iSeries PCI IO";
+		phb->mem_resources[0].flags = IORESOURCE_MEM;
+		phb->mem_resources[0].start = BASE_IO_MEMORY;
+		phb->mem_resources[0].end = END_IO_MEMORY;
+		phb->mem_resources[0].name = "Series PCI MEM";
 	}
 
 	of_node_put(root);
Index: linux-merge/arch/powerpc/platforms/iseries/pci.h
===================================================================
--- linux-merge.orig/arch/powerpc/platforms/iseries/pci.h	2007-12-14 15:48:59.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/iseries/pci.h	2007-12-14 15:49:33.000000000 +1100
@@ -43,12 +43,16 @@
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)		((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)	((subbus >> 2) & 0x7)
 
+struct pci_dev;
+
 #ifdef CONFIG_PCI
 extern void	iSeries_pcibios_init(void);
 extern void	iSeries_pci_final_fixup(void);
+extern void 	iSeries_pcibios_fixup_resources(struct pci_dev *dev);
 #else
 static inline void	iSeries_pcibios_init(void) { }
 static inline void	iSeries_pci_final_fixup(void) { }
+static inline void 	iSeries_pcibios_fixup_resources(struct pci_dev *dev) {}
 #endif
 
 #endif /* _PLATFORMS_ISERIES_PCI_H */
Index: linux-merge/arch/powerpc/platforms/iseries/setup.c
===================================================================
--- linux-merge.orig/arch/powerpc/platforms/iseries/setup.c	2007-12-14 15:48:59.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/iseries/setup.c	2007-12-14 15:49:33.000000000 +1100
@@ -639,24 +639,25 @@ static int __init iseries_probe(void)
 }
 
 define_machine(iseries) {
-	.name		= "iSeries",
-	.setup_arch	= iSeries_setup_arch,
-	.show_cpuinfo	= iSeries_show_cpuinfo,
-	.init_IRQ	= iSeries_init_IRQ,
-	.get_irq	= iSeries_get_irq,
-	.init_early	= iSeries_init_early,
-	.pcibios_fixup	= iSeries_pci_final_fixup,
-	.restart	= mf_reboot,
-	.power_off	= mf_power_off,
-	.halt		= mf_power_off,
-	.get_boot_time	= iSeries_get_boot_time,
-	.set_rtc_time	= iSeries_set_rtc_time,
-	.get_rtc_time	= iSeries_get_rtc_time,
-	.calibrate_decr	= generic_calibrate_decr,
-	.progress	= iSeries_progress,
-	.probe		= iseries_probe,
-	.ioremap	= iseries_ioremap,
-	.iounmap	= iseries_iounmap,
+	.name			= "iSeries",
+	.setup_arch		= iSeries_setup_arch,
+	.show_cpuinfo		= iSeries_show_cpuinfo,
+	.init_IRQ		= iSeries_init_IRQ,
+	.get_irq		= iSeries_get_irq,
+	.init_early		= iSeries_init_early,
+	.pcibios_fixup		= iSeries_pci_final_fixup,
+	.pcibios_fixup_resources= iSeries_pcibios_fixup_resources,
+	.restart		= mf_reboot,
+	.power_off		= mf_power_off,
+	.halt			= mf_power_off,
+	.get_boot_time		= iSeries_get_boot_time,
+	.set_rtc_time		= iSeries_set_rtc_time,
+	.get_rtc_time		= iSeries_get_rtc_time,
+	.calibrate_decr		= generic_calibrate_decr,
+	.progress		= iSeries_progress,
+	.probe			= iseries_probe,
+	.ioremap		= iseries_ioremap,
+	.iounmap		= iseries_iounmap,
 	/* XXX Implement enable_pmcs for iSeries */
 };
 

^ permalink raw reply

* [PATCH 11/15] [POWERPC] Updates/fixes to 32 bits pcibios_enable_device()
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

Our implementation of pcibios_enable_device() incorrectly ignores
the mask argument and always checks that all resources have been
allocated which isn't the right thing to do anymore.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/kernel/pci_32.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c	2007-12-14 15:49:32.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c	2007-12-14 15:49:33.000000000 +1100
@@ -530,10 +530,16 @@ int pcibios_enable_device(struct pci_dev
 		
 	pci_read_config_word(dev, PCI_COMMAND, &cmd);
 	old_cmd = cmd;
-	for (idx=0; idx<6; idx++) {
+	for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
+		/* Only set up the requested stuff */
+		if (!(mask & (1 << idx)))
+			continue;
 		r = &dev->resource[idx];
+		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
+			continue;
 		if (r->flags & IORESOURCE_UNSET) {
-			printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
+			printk(KERN_ERR "PCI: Device %s not available because"
+			       " of resource collisions\n", pci_name(dev));
 			return -EINVAL;
 		}
 		if (r->flags & IORESOURCE_IO)

^ permalink raw reply

* [PATCH 12/15] [POWERPC] Merge 32 and 64 bits pcibios_enable_device
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

This merge the two implementations, based on the previously
fixed up 32 bits one. The pcibios_enable_device_hook in ppc_md
is now available for ppc64 use. Also remove the new unused
"initial" parameter from it and fixup users.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/kernel/pci-common.c       |   38 +++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/pci_32.c           |   37 --------------------------------
 arch/powerpc/kernel/pci_64.c           |   30 --------------------------
 arch/powerpc/platforms/powermac/pci.c  |   22 ++++++++-----------
 arch/powerpc/platforms/powermac/pmac.h |    2 -
 include/asm-powerpc/machdep.h          |   10 +++-----
 6 files changed, 53 insertions(+), 86 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:33.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:34.000000000 +1100
@@ -1127,3 +1127,41 @@ void __devinit pcibios_claim_one_bus(str
 }
 EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
 #endif /* CONFIG_HOTPLUG */
+
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+	u16 cmd, old_cmd;
+	int idx;
+	struct resource *r;
+
+	if (ppc_md.pcibios_enable_device_hook)
+		if (ppc_md.pcibios_enable_device_hook(dev))
+			return -EINVAL;
+
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	old_cmd = cmd;
+	for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
+		/* Only set up the requested stuff */
+		if (!(mask & (1 << idx)))
+			continue;
+		r = &dev->resource[idx];
+		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
+			continue;
+		if (r->flags & IORESOURCE_UNSET) {
+			printk(KERN_ERR "PCI: Device %s not available because"
+			       " of resource collisions\n", pci_name(dev));
+			return -EINVAL;
+		}
+		if (r->flags & IORESOURCE_IO)
+			cmd |= PCI_COMMAND_IO;
+		if (r->flags & IORESOURCE_MEM)
+			cmd |= PCI_COMMAND_MEMORY;
+	}
+	if (cmd != old_cmd) {
+		printk("PCI: Enabling device %s (%04x -> %04x)\n",
+		       pci_name(dev), old_cmd, cmd);
+		pci_write_config_word(dev, PCI_COMMAND, cmd);
+	}
+	return 0;
+}
+
Index: linux-merge/include/asm-powerpc/machdep.h
===================================================================
--- linux-merge.orig/include/asm-powerpc/machdep.h	2007-12-14 15:49:31.000000000 +1100
+++ linux-merge/include/asm-powerpc/machdep.h	2007-12-14 15:49:34.000000000 +1100
@@ -204,12 +204,6 @@ struct machdep_calls {
 	/*
 	 * optional PCI "hooks"
 	 */
-
-	/* Called when pci_enable_device() is called (initial=0) or
-	 * when a device with no assigned resource is found (initial=1).
-	 * Returns 0 to allow assignment/enabling of the device. */
-	int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
-
 	/* Called in indirect_* to avoid touching devices */
 	int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
 
@@ -225,6 +219,10 @@ struct machdep_calls {
 	/* Called for each PCI bus in the system when it's probed */
 	void (*pcibios_fixup_bus)(struct pci_bus *);
 
+	/* Called when pci_enable_device() is called. Returns 0 to
+	 * allow assignment/enabling of the device. */
+	int  (*pcibios_enable_device_hook)(struct pci_dev *);
+
 	/* Called to shutdown machine specific hardware not already controlled
 	 * by other drivers.
 	 */
Index: linux-merge/arch/powerpc/kernel/pci_32.c
===================================================================
--- linux-merge.orig/arch/powerpc/kernel/pci_32.c	2007-12-14 15:49:33.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c	2007-12-14 15:49:34.000000000 +1100
@@ -518,43 +518,6 @@ pcibios_update_irq(struct pci_dev *dev, 
 	/* XXX FIXME - update OF device tree node interrupt property */
 }
 
-int pcibios_enable_device(struct pci_dev *dev, int mask)
-{
-	u16 cmd, old_cmd;
-	int idx;
-	struct resource *r;
-
-	if (ppc_md.pcibios_enable_device_hook)
-		if (ppc_md.pcibios_enable_device_hook(dev, 0))
-			return -EINVAL;
-		
-	pci_read_config_word(dev, PCI_COMMAND, &cmd);
-	old_cmd = cmd;
-	for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
-		/* Only set up the requested stuff */
-		if (!(mask & (1 << idx)))
-			continue;
-		r = &dev->resource[idx];
-		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
-			continue;
-		if (r->flags & IORESOURCE_UNSET) {
-			printk(KERN_ERR "PCI: Device %s not available because"
-			       " of resource collisions\n", pci_name(dev));
-			return -EINVAL;
-		}
-		if (r->flags & IORESOURCE_IO)
-			cmd |= PCI_COMMAND_IO;
-		if (r->flags & IORESOURCE_MEM)
-			cmd |= PCI_COMMAND_MEMORY;
-	}
-	if (cmd != old_cmd) {
-		printk("PCI: Enabling device %s (%04x -> %04x)\n",
-		       pci_name(dev), old_cmd, cmd);
-		pci_write_config_word(dev, PCI_COMMAND, cmd);
-	}
-	return 0;
-}
-
 static struct pci_controller*
 pci_bus_to_hose(int bus)
 {
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c	2007-12-14 15:49:33.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c	2007-12-14 15:49:34.000000000 +1100
@@ -420,36 +420,6 @@ static int __init pcibios_init(void)
 
 subsys_initcall(pcibios_init);
 
-int pcibios_enable_device(struct pci_dev *dev, int mask)
-{
-	u16 cmd, oldcmd;
-	int i;
-
-	pci_read_config_word(dev, PCI_COMMAND, &cmd);
-	oldcmd = cmd;
-
-	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
-		struct resource *res = &dev->resource[i];
-
-		/* Only set up the requested stuff */
-		if (!(mask & (1<<i)))
-			continue;
-
-		if (res->flags & IORESOURCE_IO)
-			cmd |= PCI_COMMAND_IO;
-		if (res->flags & IORESOURCE_MEM)
-			cmd |= PCI_COMMAND_MEMORY;
-	}
-
-	if (cmd != oldcmd) {
-		printk(KERN_DEBUG "PCI: Enabling device: (%s), cmd %x\n",
-		       pci_name(dev), cmd);
-                /* Enable the appropriate bits in the PCI command register.  */
-		pci_write_config_word(dev, PCI_COMMAND, cmd);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_HOTPLUG
 
 int pcibios_unmap_io_space(struct pci_bus *bus)
Index: linux-merge/arch/powerpc/platforms/powermac/pci.c
===================================================================
--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:32.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:34.000000000 +1100
@@ -1058,8 +1058,7 @@ void __init pmac_pci_init(void)
 #endif
 }
 
-int
-pmac_pci_enable_device_hook(struct pci_dev *dev, int initial)
+int pmac_pci_enable_device_hook(struct pci_dev *dev)
 {
 	struct device_node* node;
 	int updatecfg = 0;
@@ -1101,26 +1100,25 @@ pmac_pci_enable_device_hook(struct pci_d
 		updatecfg = 1;
 	}
 
+	/*
+	 * Fixup various header fields on 32 bits. We don't do that on
+	 * 64 bits as some of these have strange values behind the HT
+	 * bridge and we must not, for example, enable MWI or set the
+	 * cache line size on them.
+	 */
+#ifdef CONFIG_PPC32
 	if (updatecfg) {
 		u16 cmd;
 
-		/*
-		 * Make sure PCI is correctly configured
-		 *
-		 * We use old pci_bios versions of the function since, by
-		 * default, gmac is not powered up, and so will be absent
-		 * from the kernel initial PCI lookup.
-		 *
-		 * Should be replaced by 2.4 new PCI mechanisms and really
-		 * register the device.
-		 */
 		pci_read_config_word(dev, PCI_COMMAND, &cmd);
 		cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
 			| PCI_COMMAND_INVALIDATE;
 		pci_write_config_word(dev, PCI_COMMAND, cmd);
 		pci_write_config_byte(dev, PCI_LATENCY_TIMER, 16);
+
 		pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
 				      L1_CACHE_BYTES >> 2);
+#endif
 	}
 
 	return 0;
Index: linux-merge/arch/powerpc/platforms/powermac/pmac.h
===================================================================
--- linux-merge.orig/arch/powerpc/platforms/powermac/pmac.h	2007-12-14 15:48:58.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pmac.h	2007-12-14 15:49:34.000000000 +1100
@@ -26,7 +26,7 @@ extern void pmac_pci_init(void);
 extern void pmac_nvram_update(void);
 extern unsigned char pmac_nvram_read_byte(int addr);
 extern void pmac_nvram_write_byte(int addr, unsigned char val);
-extern int pmac_pci_enable_device_hook(struct pci_dev *dev, int initial);
+extern int pmac_pci_enable_device_hook(struct pci_dev *dev);
 extern void pmac_pcibios_after_init(void);
 extern int of_show_percpuinfo(struct seq_file *m, int i);
 

^ permalink raw reply

* [PATCH 13/15] [POWERPC] Fixup powermac enable device hook
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

Powermac's use of the pcibios_enable_device_hook() got slightly
broken by the recent PCI merge in that it won't be called for
the "initial" case of assigning resources to a previously
unassigned device. This was an abuse of that hook anyway, so
instead we now use a header quirk.

While at it, we move a #ifdef CONFIG_PPC32 to enclose more code
that is only ever used on 32 bits.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/platforms/powermac/pci.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:34.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:34.000000000 +1100
@@ -1058,6 +1058,7 @@ void __init pmac_pci_init(void)
 #endif
 }
 
+#ifdef CONFIG_PPC32
 int pmac_pci_enable_device_hook(struct pci_dev *dev)
 {
 	struct device_node* node;
@@ -1106,7 +1107,6 @@ int pmac_pci_enable_device_hook(struct p
 	 * bridge and we must not, for example, enable MWI or set the
 	 * cache line size on them.
 	 */
-#ifdef CONFIG_PPC32
 	if (updatecfg) {
 		u16 cmd;
 
@@ -1118,12 +1118,23 @@ int pmac_pci_enable_device_hook(struct p
 
 		pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
 				      L1_CACHE_BYTES >> 2);
-#endif
 	}
 
 	return 0;
 }
 
+void __devinit pmac_pci_fixup_ohci(struct pci_dev *dev)
+{
+	struct device_node *node = pci_device_to_OF_node(dev);
+
+	/* We don't want to assign resources to USB controllers
+	 * absent from the OF tree (iBook second controller)
+	 */
+	if (dev->class == PCI_CLASS_SERIAL_USB_OHCI && !node)
+		dev->resource[0].flags = 0;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_ANY_ID, pmac_pci_fixup_ohci);
+
 /* We power down some devices after they have been probed. They'll
  * be powered back on later on
  */
@@ -1171,7 +1182,6 @@ void __init pmac_pcibios_after_init(void
 	of_node_put(nd);
 }
 
-#ifdef CONFIG_PPC32
 void pmac_pci_fixup_cardbus(struct pci_dev* dev)
 {
 	if (!machine_is(powermac))
@@ -1259,7 +1269,7 @@ void pmac_pci_fixup_pciata(struct pci_de
 	}
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
-#endif
+#endif /* CONFIG_PPC32 */
 
 /*
  * Disable second function on K2-SATA, it's broken

^ permalink raw reply

* [PATCH 14/15] [POWERPC] Clear pci_probe_only on 64 bits PowerMac
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

It should now be safe to re-assign unassigned resources on 64 bits PowerMac
machines (G5s). This clears pci_probe_only on those.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/platforms/powermac/pci.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:34.000000000 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c	2007-12-14 15:49:35.000000000 +1100
@@ -1041,8 +1041,8 @@ void __init pmac_pci_init(void)
 	}
 	/* pmac_check_ht_link(); */
 
-	/* Tell pci.c to not use the common resource allocation mechanism */
-	pci_probe_only = 1;
+	/* We can allocate missing resources if any */
+	pci_probe_only = 0;
 
 #else /* CONFIG_PPC64 */
 	init_p2pbridge();

^ permalink raw reply

* [PATCH 15/15] [POWERPC] Various fixes to pcibios_enable_device()
From: Benjamin Herrenschmidt @ 2007-12-14  4:56 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1197608163.200976.87755569596.qpush@grosgo>

Our implementation of pcibios_enable_device() has a couple of problems.

One is that it should not check IORESOURCE_UNSET, as this might be
left dangling after resource assignment (shouldn't but there are
bugs), but instead, we make it check resource->parent which should
be a reliable indication that the resource has been successfully
claimed (it's in the resource tree).

Then, we also need to skip ROM resources that haven't been enabled
as x86 does.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 arch/powerpc/kernel/pci-common.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:34.000000000 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c	2007-12-14 15:49:36.000000000 +1100
@@ -1147,7 +1147,10 @@ int pcibios_enable_device(struct pci_dev
 		r = &dev->resource[idx];
 		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
 			continue;
-		if (r->flags & IORESOURCE_UNSET) {
+		if ((idx == PCI_ROM_RESOURCE) &&
+				(!(r->flags & IORESOURCE_ROM_ENABLE)))
+			continue;
+		if (r->parent == NULL) {
 			printk(KERN_ERR "PCI: Device %s not available because"
 			       " of resource collisions\n", pci_name(dev));
 			return -EINVAL;

^ permalink raw reply

* Re: [PATCH] Fix rounding bug in emulation for double float operating
From: Kumar Gala @ 2007-12-14  5:01 UTC (permalink / raw)
  To: Liu Yu; +Cc: linuxppc-dev
In-Reply-To: <11972628522442-git-send-email-b13201@freescale.com>


On Dec 9, 2007, at 11:00 PM, Liu Yu wrote:

>
> This patch fixes rounding bug in emulation for double float  
> operating on PowerPC platform.
>
> When pack double float operand, it need to truncate the tail due to  
> the limited precision.
> If the truncated part is not zero, the last bit of work bit (totally  
> 3 bits) need to '|' 1.
>
> This patch is completed in _FP_FRAC_SRS_2(X,N,sz) (arch/powerpc/math- 
> emu/op-2.h).
> Originally the code leftwards rotates the operand to just keep the  
> truncated part,
> then check whether it is zero. However, the number it rotates is not  
> correct when
> N is not smaller than _FP_W_TYPE_SIZE, and it will cause the work  
> bit '|' 1 in the improper case.
>
> This patch fixes this issue.
>
> Signed-off-by: Liu Yu <b13201@freescale.com>
>
> ---
> arch/powerpc/math-emu/op-2.h |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)

applied.

- k

^ permalink raw reply

* Re: any more patches for 2.6.24?
From: Kumar Gala @ 2007-12-14  5:02 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18274.3076.467791.719752@cargo.ozlabs.ibm.com>


On Dec 13, 2007, at 10:52 PM, Paul Mackerras wrote:

> Currently I have just this one bugfix queued up to go to Linus for
> 2.6.24:
>
> Stephen Rothwell (1):
>      [POWERPC] iSeries: don't printk with HV spinlock held
>
> Does anyone else have bugfixes that need to go in 2.6.24?

I've got a pull request I'm about to send you.

- k

^ permalink raw reply

* Please pull from 'for-2.6.24' branch
From: Kumar Gala @ 2007-12-14  5:04 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Vitaly Bordug

Please pull from 'for-2.6.24' branch of

	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

to receive the following updates:

 arch/powerpc/configs/mpc8272_ads_defconfig |    6 +++---
 arch/powerpc/configs/pq2fads_defconfig     |    6 +++---
 arch/powerpc/kernel/ppc_ksyms.c            |   12 ------------
 arch/powerpc/math-emu/op-2.h               |    3 ++-
 arch/powerpc/sysdev/cpm2_common.c          |    3 +--
 drivers/net/fs_enet/mac-scc.c              |    2 +-
 include/asm-powerpc/commproc.h             |    3 ---
 7 files changed, 10 insertions(+), 25 deletions(-)

Jochen Friedrich (2):
      [POWERPC] Fix typo #ifdef -> #ifndef
      [POWERPC] Kill non-existent symbols from ksyms and commproc.h

Liu Yu (1):
      [POWERPC] Fix rounding bug in emulation for double float operating

Scott Wood (2):
      [POWRPC] CPM2: Eliminate section mismatch warning in cpm2_reset().
      [POWERPC] 82xx: mpc8272ads, pq2fads: Update defconfig with CONFIG_FS_ENET_MDIO_FCC

^ permalink raw reply

* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
From: Kumar Gala @ 2007-12-14  5:07 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Timur Tabi, linuxppc-dev list
In-Reply-To: <1196716685975-git-send-email-timur@freescale.com>


On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:

> Updates the ucc_geth device driver to check the new rx-clock-name and
> tx-clock-name properties first.  If present, it uses the new function
> qe_clock_source() to obtain the clock source.  Otherwise, it checks  
> the
> deprecated rx-clock and tx-clock properties.
>
> Update the device trees for 832x, 836x, and 8568 to contain the new  
> property
> names only.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch applies to Kumar's for-2.6.25 branch.  ucc_geth will  
> compile but not
> run if my other patch, "qe: add function qe_clock_source" has not  
> also been
> applied.

Jeff, I'll take this patch via powerpc.git if you don't have any issue  
since its just touching probe/setup bits.

- k

> arch/powerpc/boot/dts/mpc832x_mds.dts |    8 ++--
> arch/powerpc/boot/dts/mpc832x_rdb.dts |    8 ++--
> arch/powerpc/boot/dts/mpc836x_mds.dts |    8 ++--
> arch/powerpc/boot/dts/mpc8568mds.dts  |    8 ++--
> drivers/net/ucc_geth.c                |   55 ++++++++++++++++++++++++ 
> ++++++--
> 5 files changed, 67 insertions(+), 20 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/ 
> boot/dts/mpc832x_mds.dts
> index c64f303..fe54489 100644
> --- a/arch/powerpc/boot/dts/mpc832x_mds.dts
> +++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
> @@ -223,8 +223,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <19>;
> -			tx-clock = <1a>;
> +			rx-clock-name = "clk9";
> +			tx-clock-name = "clk10";
> 			phy-handle = < &phy3 >;
> 			pio-handle = < &pio3 >;
> 		};
> @@ -244,8 +244,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <17>;
> -			tx-clock = <18>;
> +			rx-clock-name = "clk7";
> +			tx-clock-name = "clk8";
> 			phy-handle = < &phy4 >;
> 			pio-handle = < &pio4 >;
> 		};
> diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/ 
> boot/dts/mpc832x_rdb.dts
> index 388c8a7..e68a08b 100644
> --- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
> +++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
> @@ -202,8 +202,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <20>;
> -			tx-clock = <13>;
> +			rx-clock-name = "clk16";
> +			tx-clock-name = "clk3";
> 			phy-handle = <&phy00>;
> 			pio-handle = <&ucc2pio>;
> 		};
> @@ -223,8 +223,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <19>;
> -			tx-clock = <1a>;
> +			rx-clock-name = "clk9";
> +			tx-clock-name = "clk10";
> 			phy-handle = <&phy04>;
> 			pio-handle = <&ucc3pio>;
> 		};
> diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/ 
> boot/dts/mpc836x_mds.dts
> index 0b2d2b5..bfd48d0 100644
> --- a/arch/powerpc/boot/dts/mpc836x_mds.dts
> +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
> @@ -254,8 +254,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <0>;
> -			tx-clock = <19>;
> +			rx-clock-name = "none";
> +			tx-clock-name = "clk9";
> 			phy-handle = < &phy0 >;
> 			phy-connection-type = "rgmii-id";
> 			pio-handle = < &pio1 >;
> @@ -276,8 +276,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <0>;
> -			tx-clock = <14>;
> +			rx-clock-name = "none";
> +			tx-clock-name = "clk4";
> 			phy-handle = < &phy1 >;
> 			phy-connection-type = "rgmii-id";
> 			pio-handle = < &pio2 >;
> diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/ 
> boot/dts/mpc8568mds.dts
> index 5439437..cf45aab 100644
> --- a/arch/powerpc/boot/dts/mpc8568mds.dts
> +++ b/arch/powerpc/boot/dts/mpc8568mds.dts
> @@ -333,8 +333,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <0>;
> -			tx-clock = <20>;
> +			rx-clock-name = "none";
> +			tx-clock-name = "clk16";
> 			pio-handle = <&pio1>;
> 			phy-handle = <&phy0>;
> 			phy-connection-type = "rgmii-id";
> @@ -355,8 +355,8 @@
> 			 */
> 			mac-address = [ 00 00 00 00 00 00 ];
> 			local-mac-address = [ 00 00 00 00 00 00 ];
> -			rx-clock = <0>;
> -			tx-clock = <20>;
> +			rx-clock-name = "none";
> +			tx-clock-name = "clk16";
> 			pio-handle = <&pio2>;
> 			phy-handle = <&phy1>;
> 			phy-connection-type = "rgmii-id";
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index a3ff270..a93342e 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -3814,6 +3814,7 @@ static int ucc_geth_probe(struct of_device*  
> ofdev, const struct of_device_id *ma
> 	int err, ucc_num, max_speed = 0;
> 	const phandle *ph;
> 	const unsigned int *prop;
> +	const char *sprop;
> 	const void *mac_addr;
> 	phy_interface_t phy_interface;
> 	static const int enet_to_speed[] = {
> @@ -3846,10 +3847,56 @@ static int ucc_geth_probe(struct of_device*  
> ofdev, const struct of_device_id *ma
>
> 	ug_info->uf_info.ucc_num = ucc_num;
>
> -	prop = of_get_property(np, "rx-clock", NULL);
> -	ug_info->uf_info.rx_clock = *prop;
> -	prop = of_get_property(np, "tx-clock", NULL);
> -	ug_info->uf_info.tx_clock = *prop;
> +	sprop = of_get_property(np, "rx-clock-name", NULL);
> +	if (sprop) {
> +		ug_info->uf_info.rx_clock = qe_clock_source(sprop);
> +		if ((ug_info->uf_info.rx_clock < QE_CLK_NONE) ||
> +		    (ug_info->uf_info.rx_clock > QE_CLK24)) {
> +			printk(KERN_ERR
> +				"ucc_geth: invalid rx-clock-name property\n");
> +			return -EINVAL;
> +		}
> +	} else {
> +		prop = of_get_property(np, "rx-clock", NULL);
> +		if (!prop) {
> +			/* If both rx-clock-name and rx-clock are missing,
> +			   we want to tell people to use rx-clock-name. */
> +			printk(KERN_ERR
> +				"ucc_geth: missing rx-clock-name property\n");
> +			return -EINVAL;
> +		}
> +		if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
> +			printk(KERN_ERR
> +				"ucc_geth: invalid rx-clock propperty\n");
> +			return -EINVAL;
> +		}
> +		ug_info->uf_info.rx_clock = *prop;
> +	}
> +
> +	sprop = of_get_property(np, "tx-clock-name", NULL);
> +	if (sprop) {
> +		ug_info->uf_info.tx_clock = qe_clock_source(sprop);
> +		if ((ug_info->uf_info.tx_clock < QE_CLK_NONE) ||
> +		    (ug_info->uf_info.tx_clock > QE_CLK24)) {
> +			printk(KERN_ERR
> +				"ucc_geth: invalid tx-clock-name property\n");
> +			return -EINVAL;
> +		}
> +	} else {
> +		prop = of_get_property(np, "rx-clock", NULL);
> +		if (!prop) {
> +			printk(KERN_ERR
> +				"ucc_geth: mising tx-clock-name property\n");
> +			return -EINVAL;
> +		}
> +		if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) {
> +			printk(KERN_ERR
> +				"ucc_geth: invalid tx-clock property\n");
> +			return -EINVAL;
> +		}
> +		ug_info->uf_info.tx_clock = *prop;
> +	}
> +
> 	err = of_address_to_resource(np, 0, &res);
> 	if (err)
> 		return -EINVAL;
> -- 
> 1.5.2.4

^ permalink raw reply

* Re: [PATCH 4/4] MPC8313 enhanced Local Bus Controller NAND support.
From: Kumar Gala @ 2007-12-14  5:14 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, dwmw2, linux-mtd
In-Reply-To: <20071213171554.GC4459@loki.buserror.net>

Patch title should really be someting like FSL enhanced local bus (not  
mpc8313).

On Dec 13, 2007, at 11:15 AM, Scott Wood wrote:

> Signed-off-by: Nick Spence <nick.spence@freescale.com>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> drivers/mtd/nand/Kconfig         |    9 +
> drivers/mtd/nand/Makefile        |    1 +
> drivers/mtd/nand/fsl_elbc_nand.c | 1281 +++++++++++++++++++++++++++++ 
> +++++++++
> 3 files changed, 1291 insertions(+), 0 deletions(-)
> create mode 100644 drivers/mtd/nand/fsl_elbc_nand.c
>
> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> index 246d451..05d976c 100644
> --- a/drivers/mtd/nand/Kconfig
> +++ b/drivers/mtd/nand/Kconfig
> @@ -306,4 +306,13 @@ config MTD_ALAUDA
> 	  These two (and possibly other) Alauda-based cardreaders for
> 	  SmartMedia and xD allow raw flash access.
>
> +config MTD_NAND_FSL_ELBC
> +	tristate "NAND support for Freescale eLBC controllers"
> +	depends on MTD_NAND && PPC_OF
> +	help
> +	  Various Freescale chips, including the 8313, include a NAND Flash
> +	  Controller Module with built-in hardware ECC capabilities.
> +	  Enabling this option will enable you to use this to control
> +	  external NAND devices.
> +
> endif # MTD_NAND
> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
> index 3ad6c01..d0d4de2 100644
> --- a/drivers/mtd/nand/Makefile
> +++ b/drivers/mtd/nand/Makefile
> @@ -29,5 +29,6 @@ obj-$(CONFIG_MTD_NAND_CM_X270)		+= cmx270_nand.o
> obj-$(CONFIG_MTD_NAND_BASLER_EXCITE)	+= excite_nandflash.o
> obj-$(CONFIG_MTD_NAND_PLATFORM)		+= plat_nand.o
> obj-$(CONFIG_MTD_ALAUDA)		+= alauda.o
> +obj-$(CONFIG_MTD_NAND_FSL_ELBC)		+= fsl_elbc_nand.o
>
> nand-objs := nand_base.o nand_bbt.o
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/ 
> fsl_elbc_nand.c
> new file mode 100644
> index 0000000..ce8b0bf
> --- /dev/null
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
> @@ -0,0 +1,1281 @@
> +/* Freescale Enhanced Local Bus Controller NAND driver
> + *
> + * Copyright (c) 2006-2007 Freescale Semiconductor
> + *
> + * Authors: Nick Spence <nick.spence@freescale.com>,
> + *          Scott Wood <scottwood@freescale.com>
> + *
> + * This program is free software; you can redistribute it and/or  
> modify
> + * it under the terms of the GNU General Public License as  
> published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
> 02111-1307  USA
> + */
> +
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/string.h>
> +#include <linux/ioport.h>
> +#include <linux/of_platform.h>
> +#include <linux/slab.h>
> +#include <linux/interrupt.h>
> +
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/nand.h>
> +#include <linux/mtd/nand_ecc.h>
> +#include <linux/mtd/partitions.h>
> +
> +#include <asm/io.h>
> +
> +
> +//#define ELBC_NAND_DEBUG_LVL 6

undef or something, not C++ comment.

>
> +
> +#ifdef ELBC_NAND_DEBUG_LVL
> +static int fcm_debug_level = ELBC_NAND_DEBUG_LVL;
> +#define FCM_DEBUG(n, args...)		\
> +	do {					\
> +		if (n <= fcm_debug_level)	\
> +			pr_dbg(args);	\
> +	} while(0)
> +#else
> +#define FCM_DEBUG(n, dev, args...) do { } while(0)
> +#endif
> +
> +#define MAX_BANKS 8
> +#define ERR_BYTE 0xFF /* Value returned for read bytes when read  
> failed */
> +#define FCM_TIMEOUT_MSECS 500 /* Maximum number of mSecs to wait  
> for FCM */
> +
> +struct elbc_bank {
> +	u32 br;             /**< Base Register  */
> +#define BR_BA           0xFFFF8000
> +#define BR_BA_SHIFT             15
> +#define BR_PS           0x00001800
> +#define BR_PS_SHIFT             11
> +#define BR_PS_8         0x00000800  /* Port Size 8 bit */
> +#define BR_PS_16        0x00001000  /* Port Size 16 bit */
> +#define BR_PS_32        0x00001800  /* Port Size 32 bit */
> +#define BR_DECC         0x00000600
> +#define BR_DECC_SHIFT            9
> +#define BR_DECC_OFF     0x00000000  /* HW ECC checking and  
> generation off */
> +#define BR_DECC_CHK     0x00000200  /* HW ECC checking on,  
> generation off */
> +#define BR_DECC_CHK_GEN 0x00000400  /* HW ECC checking and  
> generation on */
> +#define BR_WP           0x00000100
> +#define BR_WP_SHIFT              8
> +#define BR_MSEL         0x000000E0
> +#define BR_MSEL_SHIFT            5
> +#define BR_MS_GPCM      0x00000000  /* GPCM */
> +#define BR_MS_FCM       0x00000020  /* FCM */
> +#define BR_MS_SDRAM     0x00000060  /* SDRAM */
> +#define BR_MS_UPMA      0x00000080  /* UPMA */
> +#define BR_MS_UPMB      0x000000A0  /* UPMB */
> +#define BR_MS_UPMC      0x000000C0  /* UPMC */
> +#define BR_V            0x00000001
> +#define BR_V_SHIFT               0
> +#define BR_RES          ~(BR_BA|BR_PS|BR_DECC|BR_WP|BR_MSEL|BR_V)
> +
> +	u32 or;             /**< Base Register  */
> +#define OR0 0x5004
> +#define OR1 0x500C
> +#define OR2 0x5014
> +#define OR3 0x501C
> +#define OR4 0x5024
> +#define OR5 0x502C
> +#define OR6 0x5034
> +#define OR7 0x503C
> +
> +#define OR_GPCM_AM              0xFFFF8000
> +#define OR_GPCM_AM_SHIFT                15
> +#define OR_GPCM_BCTLD           0x00001000
> +#define OR_GPCM_BCTLD_SHIFT             12
> +#define OR_GPCM_CSNT            0x00000800
> +#define OR_GPCM_CSNT_SHIFT              11
> +#define OR_GPCM_ACS             0x00000600
> +#define OR_GPCM_ACS_SHIFT                9
> +#define OR_GPCM_ACS_0b10        0x00000400
> +#define OR_GPCM_ACS_0b11        0x00000600
> +#define OR_GPCM_XACS            0x00000100
> +#define OR_GPCM_XACS_SHIFT               8
> +#define OR_GPCM_SCY             0x000000F0
> +#define OR_GPCM_SCY_SHIFT                4
> +#define OR_GPCM_SCY_1           0x00000010
> +#define OR_GPCM_SCY_2           0x00000020
> +#define OR_GPCM_SCY_3           0x00000030
> +#define OR_GPCM_SCY_4           0x00000040
> +#define OR_GPCM_SCY_5           0x00000050
> +#define OR_GPCM_SCY_6           0x00000060
> +#define OR_GPCM_SCY_7           0x00000070
> +#define OR_GPCM_SCY_8           0x00000080
> +#define OR_GPCM_SCY_9           0x00000090
> +#define OR_GPCM_SCY_10          0x000000a0
> +#define OR_GPCM_SCY_11          0x000000b0
> +#define OR_GPCM_SCY_12          0x000000c0
> +#define OR_GPCM_SCY_13          0x000000d0
> +#define OR_GPCM_SCY_14          0x000000e0
> +#define OR_GPCM_SCY_15          0x000000f0
> +#define OR_GPCM_SETA            0x00000008
> +#define OR_GPCM_SETA_SHIFT               3
> +#define OR_GPCM_TRLX            0x00000004
> +#define OR_GPCM_TRLX_SHIFT               2
> +#define OR_GPCM_EHTR            0x00000002
> +#define OR_GPCM_EHTR_SHIFT               1
> +#define OR_GPCM_EAD             0x00000001
> +#define OR_GPCM_EAD_SHIFT                0
> +
> +#define OR_UPM_AM    0xFFFF8000
> +#define OR_UPM_AM_SHIFT      15
> +#define OR_UPM_XAM   0x00006000
> +#define OR_UPM_XAM_SHIFT     13
> +#define OR_UPM_BCTLD 0x00001000
> +#define OR_UPM_BCTLD_SHIFT   12
> +#define OR_UPM_BI    0x00000100
> +#define OR_UPM_BI_SHIFT       8
> +#define OR_UPM_TRLX  0x00000004
> +#define OR_UPM_TRLX_SHIFT     2
> +#define OR_UPM_EHTR  0x00000002
> +#define OR_UPM_EHTR_SHIFT     1
> +#define OR_UPM_EAD   0x00000001
> +#define OR_UPM_EAD_SHIFT      0
> +
> +#define OR_SDRAM_AM    0xFFFF8000
> +#define OR_SDRAM_AM_SHIFT      15
> +#define OR_SDRAM_XAM   0x00006000
> +#define OR_SDRAM_XAM_SHIFT     13
> +#define OR_SDRAM_COLS  0x00001C00
> +#define OR_SDRAM_COLS_SHIFT    10
> +#define OR_SDRAM_ROWS  0x000001C0
> +#define OR_SDRAM_ROWS_SHIFT     6
> +#define OR_SDRAM_PMSEL 0x00000020
> +#define OR_SDRAM_PMSEL_SHIFT    5
> +#define OR_SDRAM_EAD   0x00000001
> +#define OR_SDRAM_EAD_SHIFT      0

remove all OR_GPCM_*, OR_UPM_*, OR_SDRAM_* not used anywhere

[snip]

>
> +struct elbc_regs {
> +	struct elbc_bank bank[8];
> +	u8 res0[0x28];
> +	u32 mar;                /**< UPM Address Register */
> +	u8 res1[0x4];
> +	u32 mamr;               /**< UPMA Mode Register */
> +	u32 mbmr;               /**< UPMB Mode Register */
> +	u32 mcmr;               /**< UPMC Mode Register */
> +	u8 res2[0x8];
> +	u32 mrtpr;              /**< Memory Refresh Timer Prescaler  
> Register */
> +	u32 mdr;                /**< UPM Data Register */
> +	u8 res3[0x4];
> +	u32 lsor;               /**< Special Operation Initiation Register  
> */
> +	u32 lsdmr;              /**< SDRAM Mode Register */
> +	u8 res4[0x8];
> +	u32 lurt;               /**< UPM Refresh Timer */
> +	u32 lsrt;               /**< SDRAM Refresh Timer */
> +	u8 res5[0x8];
> +	u32 ltesr;              /**< Transfer Error Status Register */
> +#define LTESR_BM   0x80000000
> +#define LTESR_FCT  0x40000000
> +#define LTESR_PAR  0x20000000
> +#define LTESR_WP   0x04000000
> +#define LTESR_ATMW 0x00800000
> +#define LTESR_ATMR 0x00400000
> +#define LTESR_CS   0x00080000
> +#define LTESR_CC   0x00000001
> +#define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC)
> +	u32 ltedr;              /**< Transfer Error Disable Register */
> +	u32 lteir;              /**< Transfer Error Interrupt Register */
> +	u32 lteatr;             /**< Transfer Error Attributes Register */
> +	u32 ltear;              /**< Transfer Error Address Register */
> +	u8 res6[0xC];
> +	u32 lbcr;               /**< Configuration Register */
> +#define LBCR_LDIS  0x80000000
> +#define LBCR_LDIS_SHIFT    31
> +#define LBCR_BCTLC 0x00C00000
> +#define LBCR_BCTLC_SHIFT   22
> +#define LBCR_AHD   0x00200000
> +#define LBCR_LPBSE 0x00020000
> +#define LBCR_LPBSE_SHIFT   17
> +#define LBCR_EPAR  0x00010000
> +#define LBCR_EPAR_SHIFT    16
> +#define LBCR_BMT   0x0000FF00
> +#define LBCR_BMT_SHIFT      8
> +#define LBCR_INIT  0x00040000
> +	u32 lcrr;               /**< Clock Ratio Register */
> +#define LCRR_DBYP    0x80000000
> +#define LCRR_DBYP_SHIFT      31
> +#define LCRR_BUFCMDC 0x30000000
> +#define LCRR_BUFCMDC_SHIFT   28
> +#define LCRR_ECL     0x03000000
> +#define LCRR_ECL_SHIFT       24
> +#define LCRR_EADC    0x00030000
> +#define LCRR_EADC_SHIFT      16
> +#define LCRR_CLKDIV  0x0000000F
> +#define LCRR_CLKDIV_SHIFT     0
> +	u8 res7[0x8];
> +	u32 fmr;               /**< Flash Mode Register */
> +#define FMR_CWTO     0x0000F000
> +#define FMR_CWTO_SHIFT       12
> +#define FMR_BOOT     0x00000800
> +#define FMR_ECCM     0x00000100
> +#define FMR_AL       0x00000030
> +#define FMR_AL_SHIFT          4
> +#define FMR_OP       0x00000003
> +#define FMR_OP_SHIFT          0
> +	u32 fir;               /**< Flash Instruction Register */
> +#define FIR_OP0      0xF0000000
> +#define FIR_OP0_SHIFT        28
> +#define FIR_OP1      0x0F000000
> +#define FIR_OP1_SHIFT        24
> +#define FIR_OP2      0x00F00000
> +#define FIR_OP2_SHIFT        20
> +#define FIR_OP3      0x000F0000
> +#define FIR_OP3_SHIFT        16
> +#define FIR_OP4      0x0000F000
> +#define FIR_OP4_SHIFT        12
> +#define FIR_OP5      0x00000F00
> +#define FIR_OP5_SHIFT         8
> +#define FIR_OP6      0x000000F0
> +#define FIR_OP6_SHIFT         4
> +#define FIR_OP7      0x0000000F
> +#define FIR_OP7_SHIFT         0
> +#define FIR_OP_NOP   0x0	/* No operation and end of sequence */
> +#define FIR_OP_CA    0x1        /* Issue current column address */
> +#define FIR_OP_PA    0x2        /* Issue current block+page address  
> */
> +#define FIR_OP_UA    0x3        /* Issue user defined address */
> +#define FIR_OP_CM0   0x4        /* Issue command from FCR[CMD0] */
> +#define FIR_OP_CM1   0x5        /* Issue command from FCR[CMD1] */
> +#define FIR_OP_CM2   0x6        /* Issue command from FCR[CMD2] */
> +#define FIR_OP_CM3   0x7        /* Issue command from FCR[CMD3] */
> +#define FIR_OP_WB    0x8        /* Write FBCR bytes from FCM buffer  
> */
> +#define FIR_OP_WS    0x9        /* Write 1 or 2 bytes from MDR[AS] */
> +#define FIR_OP_RB    0xA        /* Read FBCR bytes to FCM buffer */
> +#define FIR_OP_RS    0xB        /* Read 1 or 2 bytes to MDR[AS] */
> +#define FIR_OP_CW0   0xC        /* Wait then issue FCR[CMD0] */
> +#define FIR_OP_CW1   0xD        /* Wait then issue FCR[CMD1] */
> +#define FIR_OP_RBW   0xE        /* Wait then read FBCR bytes */
> +#define FIR_OP_RSW   0xE        /* Wait then read 1 or 2 bytes */
> +	u32 fcr;               /**< Flash Command Register */
> +#define FCR_CMD0     0xFF000000
> +#define FCR_CMD0_SHIFT       24
> +#define FCR_CMD1     0x00FF0000
> +#define FCR_CMD1_SHIFT       16
> +#define FCR_CMD2     0x0000FF00
> +#define FCR_CMD2_SHIFT        8
> +#define FCR_CMD3     0x000000FF
> +#define FCR_CMD3_SHIFT        0
> +	u32 fbar;              /**< Flash Block Address Register */
> +#define FBAR_BLK     0x00FFFFFF
> +	u32 fpar;              /**< Flash Page Address Register */
> +#define FPAR_SP_PI   0x00007C00
> +#define FPAR_SP_PI_SHIFT     10
> +#define FPAR_SP_MS   0x00000200
> +#define FPAR_SP_CI   0x000001FF
> +#define FPAR_SP_CI_SHIFT      0
> +#define FPAR_LP_PI   0x0003F000
> +#define FPAR_LP_PI_SHIFT     12
> +#define FPAR_LP_MS   0x00000800
> +#define FPAR_LP_CI   0x000007FF
> +#define FPAR_LP_CI_SHIFT      0
> +	u32 fbcr;              /**< Flash Byte Count Register */
> +#define FBCR_BC      0x00000FFF
> +	u8 res11[0x8];
> +	u8 res8[0xF00];

we really should use __be32


- k

^ permalink raw reply

* Re: [PATCH 2/3] mpc82xx: Embedded Planet EP8248E support
From: Kumar Gala @ 2007-12-14  5:19 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <20071211212247.GB3620@loki.buserror.net>


On Dec 11, 2007, at 3:22 PM, Scott Wood wrote:

> This board is also resold by Freescale under the names
> "QUICCStart MPC8248 Evaluation System" and "CWH-PPC-8248N-VE".
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> arch/powerpc/boot/Makefile             |    3 +-
> arch/powerpc/boot/dts/ep8248e.dts      |  193 +++++++
> arch/powerpc/boot/ep8248e.c            |   55 ++
> arch/powerpc/boot/wrapper              |    2 +-
> arch/powerpc/configs/ep8248e_defconfig |  864 +++++++++++++++++++++++ 
> +++++++++
> arch/powerpc/platforms/82xx/Kconfig    |   13 +
> arch/powerpc/platforms/82xx/Makefile   |    1 +
> arch/powerpc/platforms/82xx/ep8248e.c  |  321 ++++++++++++
> include/asm-powerpc/mpc8260.h          |    1 +
> 9 files changed, 1451 insertions(+), 2 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/ep8248e.dts
> create mode 100644 arch/powerpc/boot/ep8248e.c
> create mode 100644 arch/powerpc/configs/ep8248e_defconfig
> create mode 100644 arch/powerpc/platforms/82xx/ep8248e.c


>
> diff --git a/arch/powerpc/boot/dts/ep8248e.dts b/arch/powerpc/boot/ 
> dts/ep8248e.dts
> new file mode 100644
> index 0000000..ee8405d
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/ep8248e.dts
> @@ -0,0 +1,193 @@
> +/*
> + * Device Tree for the Embedded Planet EP8248E board running  
> PlanetCore.
> + *
> + * Copyright 2007 Freescale Semiconductor Inc.
> + *
> + * This program is free software; you can redistribute  it and/or  
> modify it
> + * under  the terms of  the GNU General  Public License as  
> published by the
> + * Free Software Foundation;  either version 2 of the  License, or  
> (at your
> + * option) any later version.
> + */
> +

Can we make this a /dts-v1/; since its new.
>
> +/ {
> +	model = "EP8248E";
> +	compatible = "fsl,ep8248e";
> +	#address-cells = <1>;
> +	#size-cells = <1>;

Add a aliases { } and can we use that instead of linux,network-index  
and linux,planetcore-label.

> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		PowerPC,8248@0 {
> +			device_type = "cpu";
> +			reg = <0>;
> +			d-cache-line-size = <d#32>;
> +			i-cache-line-size = <d#32>;
> +			d-cache-size = <d#16384>;
> +			i-cache-size = <d#16384>;
> +			timebase-frequency = <0>;
> +			clock-frequency = <0>;
> +		};
> +	};
> +
> +	localbus {
> +		compatible = "fsl,ep8248e-localbus",
> +		             "fsl,mpc8248-localbus",
> +		             "fsl,pq2-localbus";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +		reg = <f0010100 40>;
> +
> +		ranges = <0 0 fc000000 04000000
> +		          1 0 fa000000 00008000>;
> +
> +		flash@0,3800000 {
> +			compatible = "cfi-flash";
> +			reg = <0 3800000 800000>;
> +			bank-width = <4>;
> +			device-width = <2>;
> +		};
> +
> +		bcsr@1,0 {
> +			#address-cells = <2>;
> +			#size-cells = <1>;
> +			reg = <1 0 10>;
> +			compatible = "fsl,ep8248e-bcsr";
> +			ranges;
> +
> +			mdio {
> +				device_type = "mdio";
> +				compatible = "fsl,ep8248e-mdio-bitbang";
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +				reg = <1 8 1>;
> +
> +				PHY0: ethernet-phy@0 {
> +					interrupt-parent = <&PIC>;
> +					reg = <0>;
> +					device_type = "ethernet-phy";
> +				};
> +
> +				PHY1: ethernet-phy@1 {
> +					interrupt-parent = <&PIC>;
> +					reg = <1>;
> +					device_type = "ethernet-phy";
> +				};
> +			};
> +		};
> +	};
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0 0>;
> +	};
> +
> +	soc@f0000000 {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		device_type = "soc";
> +		compatible = "fsl,mpc8248", "fsl,pq2-soc";
> +		ranges = <00000000 f0000000 00053000>;
> +
> +		// Temporary -- will go away once kernel uses ranges for  
> get_immrbase().
> +		reg = <f0000000 00053000>;
> +
> +		cpm@119c0 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			#interrupt-cells = <2>;
> +			compatible = "fsl,mpc8248-cpm", "fsl,cpm2";
> +			reg = <119c0 30>;
> +			ranges;
> +
> +			muram {
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +				ranges = <0 0 10000>;
> +
> +				data@0 {
> +					compatible = "fsl,cpm-muram-data";
> +					reg = <0 1100 1140 ec0 9800 800>;
> +				};
> +			};
> +
> +			brg@119f0 {
> +				compatible = "fsl,mpc8272-brg",
> +				             "fsl,cpm2-brg",
> +				             "fsl,cpm-brg";
> +				reg = <119f0 10 115f0 10>;
> +			};
> +
> +			/* Monitor port/SMC1 */
> +			serial@11a80 {
> +				device_type = "serial";
> +				compatible = "fsl,mpc8248-smc-uart",
> +				             "fsl,cpm2-smc-uart";
> +				reg = <11a80 20 1100 40>;
> +				interrupts = <4 8>;
> +				interrupt-parent = <&PIC>;
> +				fsl,cpm-brg = <7>;
> +				fsl,cpm-command = <1d000000>;
> +				linux,planetcore-label = "SMC1";
> +			};
> +
> +			/* "Serial" port/SCC1 */
> +			serial@11a00 {
> +				device_type = "serial";
> +				compatible = "fsl,mpc8248-scc-uart",
> +				             "fsl,cpm2-scc-uart";
> +				reg = <11a00 20 8000 100>;
> +				interrupts = <28 8>;
> +				interrupt-parent = <&PIC>;
> +				fsl,cpm-brg = <1>;
> +				fsl,cpm-command = <00800000>;
> +				linux,planetcore-label = "SCC1";
> +			};
> +
> +			ethernet@11300 {
> +				device_type = "network";
> +				compatible = "fsl,mpc8248-fcc-enet",
> +				             "fsl,cpm2-fcc-enet";
> +				reg = <11300 20 8400 100 11390 1>;
> +				local-mac-address = [ 00 00 00 00 00 00 ];
> +				interrupts = <20 8>;
> +				interrupt-parent = <&PIC>;
> +				phy-handle = <&PHY0>;
> +				linux,network-index = <0>;
> +				fsl,cpm-command = <12000300>;
> +			};
> +
> +			ethernet@11320 {
> +				device_type = "network";
> +				compatible = "fsl,mpc8248-fcc-enet",
> +				             "fsl,cpm2-fcc-enet";
> +				reg = <11320 20 8500 100 113b0 1>;
> +				local-mac-address = [ 00 00 00 00 00 00 ];
> +				interrupts = <21 8>;
> +				interrupt-parent = <&PIC>;
> +				phy-handle = <&PHY1>;
> +				linux,network-index = <1>;
> +				fsl,cpm-command = <16200300>;
> +			};
> +
> +			usb@11b60 {
> +				#address-cells = <1>;
> +				#size-cells = <0>;
> +				compatible = "fsl,mpc8248-usb",
> +				             "fsl,cpm2-usb";
> +				reg = <11b60 18 8b00 100>;
> +				interrupt-parent = <&PIC>;
> +				interrupts = <b 8>;
> +				fsl,cpm-command = <2e600000>;
> +			};
> +		};
> +
> +		PIC: interrupt-controller@10c00 {
> +			#interrupt-cells = <2>;
> +			interrupt-controller;
> +			reg = <10c00 80>;
> +			compatible = "fsl,mpc8248-pic", "fsl,pq2-pic";
> +		};
> +	};
> +};

- k

^ permalink raw reply

* Re: [PATCH 2/2] powerpc: Add IPIC MSI support
From: Kumar Gala @ 2007-12-14  5:44 UTC (permalink / raw)
  To: Li Li; +Cc: linuxppc-dev, kim phillips
In-Reply-To: <1196764760.2573.10.camel@Guyver>


On Dec 4, 2007, at 4:39 AM, Li Li wrote:

> Modified based on discussion on list.
>
> 1. Adopt virq_to_hw routine
> 2. Correct a legacy bug
>
> Implements the IPIC MSI as two level interrupt controller.
>
> Signed-off-by: Tony Li <tony.li@freescale.com>

Tony, have you looked at the 85xx/86xx PCIe MSI mechanism?  The 2nd  
level PIC handling seems like its pretty similar between IPIC and  
MPIC.  Would like to see if we could somehow make the code common for  
to handle MSIs from both?

- k

^ permalink raw reply

* Re: [PATCH] Fix rounding bug in emulation for double floatoperating
From: Kumar Gala @ 2007-12-14  5:46 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: linuxppc-dev list, Liu Yu, David Gibson
In-Reply-To: <1197448223.29372.12.camel@localhost.localdomain>

>> When I run this on a G5 (w/HW FP) I get:
>>
>> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
>> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
>> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
>>
>> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
>>
>> and on the 85xx w/FP emu:
>>
>> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
>> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
>> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
>>
>> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
>>
>> Maybe I'm missing where the error is.
> I am missing ...
> It is supposed to run based on previous IEEE 754 patch.
> http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html

I'd really like to see to see a testcase show the issue with "classic  
FP emu" on a 85xx system.

(seems like it should be pretty straight forward).

- k

^ permalink raw reply

* Re: Please pull linux-2.6-8xx.git for-paulus branch
From: Kumar Gala @ 2007-12-14  5:47 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20071209115353.1ae09ee1@kernel.crashing.org>


On Dec 9, 2007, at 2:53 AM, Vitaly Bordug wrote:

> On Sat, 8 Dec 2007 09:17:06 -0600
> Kumar Gala wrote:
>
>>
>> On Dec 8, 2007, at 4:09 AM, Vitaly Bordug wrote:
>>
>>> On Sat, 8 Dec 2007 13:00:25 +0300
>>> Vitaly Bordug wrote:
>>>
>>>> Paul,
>>>>
>>>> please do
>>>> git-pull
>>>> git://git.kernel.org/pub/scm/linux/kernel/git/vitb/ 
>>>> linux-2.6-8xx.git
>>>> for-paulus
>>>>
>>>> to receive the following updates:
>>>>
>>> Forgot to tell that this is .25 material...
>>
>> Vitaly, if you don't mind I'll pull these into my tree for Paul to
>> collect all the FSL stuff in one place.
>>
> I'm ok with either way.

I've pulled this and split the patches between for-2.6.24 (sent pull  
request to paulus) and for-2.6.25

- k

^ permalink raw reply

* Re: [PATCH 19/20] [POWERPC] pci32: 4xx embedded platforms want to reassign all PCI resources
From: Stefan Roese @ 2007-12-14  5:48 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20071213155946.0e0c39a0@weaponx>

On Thursday 13 December 2007, Josh Boyer wrote:
> > Keeping your embedded design tiny (and thus your own BSP) is one thing,
> > but adding ifdef's all over the place so that somebody can tinify an
> > eval board, I'm less sure about this... but if you want, you can fixup
> > my patches.
>
> I'm not really advocating for ifdefs.  If it annoys me enough (which I
> doubt it will), then I'd try to come up with some way to avoid those
> too.  For now, I think selecting PCI in Kconfig for those boards is OK.

Yes, I think it is OK to select it this way an those boards since they are 
evaluation boards with PCI slots.

Ciao,
Stefan

^ permalink raw reply

* Re: [DTC][PATCH] Fix cross-compile building
From: Kumar Gala @ 2007-12-14  5:57 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, Jon Loeliger, stuarth
In-Reply-To: <20071208003604.GH566@localhost.localdomain>


On Dec 7, 2007, at 6:36 PM, David Gibson wrote:

> On Fri, Dec 07, 2007 at 12:28:20PM -0600, Kumar Gala wrote:
>> From: Stuart Hughes <stuarth@freescale.com>
>>
>> This patch allows you to build the DTC source without making the
>> tests directory.  This is necessary when cross compiling as the
>> dumptest (and other) files cannot be run/used on the host system.
>> To use this use: 'make TESTS='
>
> I think this is a silly way of doing this.  Instead create a new
> target which builds everything but the tests.
>
> Say,
>
> 	all: cross tests
>
> 	cross: dtc ftdump libfdt

shouldn't we do this the other way around, it seems odd to build the  
tests always or at least as part of the all target.

- k

^ permalink raw reply

* Re: [PATCH] Fix rounding bug in emulation for double floatoperating
From: Zang Roy-r61911 @ 2007-12-14  6:06 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev list, Liu Yu, David Gibson
In-Reply-To: <BB2AC24A-6336-4270-9124-734BCC09F7DA@kernel.crashing.org>

On Fri, 2007-12-14 at 13:46, Kumar Gala wrote:
> >> When I run this on a G5 (w/HW FP) I get:
> >>
> >> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
> >> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
> >> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
> >>
> >> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
> >>
> >> and on the 85xx w/FP emu:
> >>
> >> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
> >> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
> >> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
> >>
> >> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
> >>
> >> Maybe I'm missing where the error is.
> > I am missing ...
> > It is supposed to run based on previous IEEE 754 patch.
> > http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html
> 
> I'd really like to see to see a testcase show the issue with "classic 
> FP emu" on a 85xx system.
I can understand. 
You know, For a 85xx system without the previous patch or other
'classic' powerpc, it is hard to trigger this issue. Although I believe
it is a problem fixed up.
Do you have any idea?
Roy

^ permalink raw reply

* Re: [PATCH] Fix rounding bug in emulation for double floatoperating
From: Kumar Gala @ 2007-12-14  6:14 UTC (permalink / raw)
  To: Zang Roy-r61911; +Cc: linuxppc-dev list, Liu Yu, David Gibson
In-Reply-To: <1197612373.10259.9.camel@localhost.localdomain>


On Dec 14, 2007, at 12:06 AM, Zang Roy-r61911 wrote:

> On Fri, 2007-12-14 at 13:46, Kumar Gala wrote:
>>>> When I run this on a G5 (w/HW FP) I get:
>>>>
>>>> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
>>>> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
>>>> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
>>>>
>>>> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
>>>>
>>>> and on the 85xx w/FP emu:
>>>>
>>>> dmul 3fe0000000000000 * 1 = 0 expected 0 (PASS)
>>>> dmul bfe0000000000000 * 1 = 8000000000000000 expected 0 (PASS)
>>>> dmul 8000000000000001 * bfe0000000000000 = 0 expected 0 (PASS)
>>>>
>>>> ddiv 1 / 4000000000000000 = 0 expected 0 (PASS)
>>>>
>>>> Maybe I'm missing where the error is.
>>> I am missing ...
>>> It is supposed to run based on previous IEEE 754 patch.
>>> http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031351.html
>>
>> I'd really like to see to see a testcase show the issue with "classic
>> FP emu" on a 85xx system.
> I can understand.
> You know, For a 85xx system without the previous patch or other
> 'classic' powerpc, it is hard to trigger this issue. Although I  
> believe
> it is a problem fixed up.
> Do you have any idea?

maybe I'm missing it, but can we not do the same operation w/classic  
FP that you are doing w/SPE fp?

is this in standard rounding mode, etc?

- k

^ permalink raw reply

* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
From: Jeff Garzik @ 2007-12-14  6:45 UTC (permalink / raw)
  To: Kumar Gala; +Cc: netdev, Timur Tabi, linuxppc-dev list
In-Reply-To: <4373ED4B-5EDD-4725-9D99-BE39B0656E19@kernel.crashing.org>

Kumar Gala wrote:
> 
> On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:
> 
>> Updates the ucc_geth device driver to check the new rx-clock-name and
>> tx-clock-name properties first.  If present, it uses the new function
>> qe_clock_source() to obtain the clock source.  Otherwise, it checks the
>> deprecated rx-clock and tx-clock properties.
>>
>> Update the device trees for 832x, 836x, and 8568 to contain the new 
>> property
>> names only.
>>
>> Signed-off-by: Timur Tabi <timur@freescale.com>
>> ---
>>
>> This patch applies to Kumar's for-2.6.25 branch.  ucc_geth will 
>> compile but not
>> run if my other patch, "qe: add function qe_clock_source" has not also 
>> been
>> applied.
> 
> Jeff, I'll take this patch via powerpc.git if you don't have any issue 
> since its just touching probe/setup bits.

ACK

^ permalink raw reply

* Re: [PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
From: Kumar Gala @ 2007-12-14  7:19 UTC (permalink / raw)
  To: Timur Tabi; +Cc: netdev, linuxppc-dev
In-Reply-To: <1196716685975-git-send-email-timur@freescale.com>


On Dec 3, 2007, at 3:17 PM, Timur Tabi wrote:

> Updates the ucc_geth device driver to check the new rx-clock-name and
> tx-clock-name properties first.  If present, it uses the new function
> qe_clock_source() to obtain the clock source.  Otherwise, it checks  
> the
> deprecated rx-clock and tx-clock properties.
>
> Update the device trees for 832x, 836x, and 8568 to contain the new  
> property
> names only.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch applies to Kumar's for-2.6.25 branch.  ucc_geth will  
> compile but not
> run if my other patch, "qe: add function qe_clock_source" has not  
> also been
> applied.
>
> arch/powerpc/boot/dts/mpc832x_mds.dts |    8 ++--
> arch/powerpc/boot/dts/mpc832x_rdb.dts |    8 ++--
> arch/powerpc/boot/dts/mpc836x_mds.dts |    8 ++--
> arch/powerpc/boot/dts/mpc8568mds.dts  |    8 ++--
> drivers/net/ucc_geth.c                |   55 ++++++++++++++++++++++++ 
> ++++++--
> 5 files changed, 67 insertions(+), 20 deletions(-)

applied.

- k

^ permalink raw reply

* Please pull from 'for-2.6.25' branch
From: Kumar Gala @ 2007-12-14  7:58 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Please pull from 'for-2.6.25' branch of

	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.25

to receive the following updates:

 Documentation/powerpc/booting-without-of.txt |   19
 arch/powerpc/boot/dts/kuroboxHD.dts          |   16
 arch/powerpc/boot/dts/kuroboxHG.dts          |   16
 arch/powerpc/boot/dts/lite5200.dts           |    6
 arch/powerpc/boot/dts/lite5200b.dts          |    6
 arch/powerpc/boot/dts/mpc8313erdb.dts        |   36 -
 arch/powerpc/boot/dts/mpc832x_mds.dts        |   45 -
 arch/powerpc/boot/dts/mpc832x_rdb.dts        |   47 -
 arch/powerpc/boot/dts/mpc8349emitx.dts       |   54 -
 arch/powerpc/boot/dts/mpc8349emitxgp.dts     |   32
 arch/powerpc/boot/dts/mpc834x_mds.dts        |   51 -
 arch/powerpc/boot/dts/mpc836x_mds.dts        |   47 -
 arch/powerpc/boot/dts/mpc8540ads.dts         |   59 -
 arch/powerpc/boot/dts/mpc8541cds.dts         |   41 -
 arch/powerpc/boot/dts/mpc8544ds.dts          |   59 +
 arch/powerpc/boot/dts/mpc8548cds.dts         |   68 +-
 arch/powerpc/boot/dts/mpc8555cds.dts         |   41 -
 arch/powerpc/boot/dts/mpc8560ads.dts         |   59 -
 arch/powerpc/boot/dts/mpc8568mds.dts         |   80 +-
 arch/powerpc/boot/dts/mpc8572ds.dts          |   59 +
 arch/powerpc/boot/dts/mpc8610_hpcd.dts       |   28
 arch/powerpc/boot/dts/mpc8641_hpcn.dts       |   80 +-
 arch/powerpc/boot/dts/mpc866ads.dts          |  156 ++--
 arch/powerpc/configs/mpc837x_mds_defconfig   |  878 +++++++++++++++++++++++++++
 arch/powerpc/kernel/cputable.c               |   13
 arch/powerpc/kernel/traps.c                  |   25
 arch/powerpc/platforms/82xx/pq2fads.c        |    2
 arch/powerpc/platforms/83xx/Kconfig          |   11
 arch/powerpc/platforms/83xx/Makefile         |    1
 arch/powerpc/platforms/83xx/mpc8313_rdb.c    |    4
 arch/powerpc/platforms/83xx/mpc832x_mds.c    |    4
 arch/powerpc/platforms/83xx/mpc832x_rdb.c    |    2
 arch/powerpc/platforms/83xx/mpc834x_mds.c    |   21
 arch/powerpc/platforms/83xx/mpc836x_mds.c    |    4
 arch/powerpc/platforms/83xx/mpc837x_mds.c    |  104 +++
 arch/powerpc/platforms/85xx/mpc85xx_mds.c    |    4
 arch/powerpc/platforms/8xx/Kconfig           |    1
 arch/powerpc/platforms/8xx/mpc86xads.h       |   44 -
 arch/powerpc/platforms/8xx/mpc86xads_setup.c |  289 ++------
 arch/powerpc/sysdev/commproc.c               |   47 +
 arch/powerpc/sysdev/cpm2_common.c            |   25
 arch/powerpc/sysdev/fsl_soc.c                |   23
 arch/powerpc/sysdev/ipic.c                   |  219 ++++--
 arch/powerpc/sysdev/ipic.h                   |   13
 arch/powerpc/sysdev/qe_lib/qe.c              |   46 +
 drivers/net/fs_enet/mac-fcc.c                |   10
 drivers/net/fs_enet/mac-scc.c                |   11
 drivers/net/ucc_geth.c                       |   55 +
 drivers/serial/cpm_uart/cpm_uart_cpm1.c      |    6
 drivers/serial/cpm_uart/cpm_uart_cpm2.c      |    8
 include/asm-powerpc/cpm.h                    |    1
 include/asm-powerpc/immap_86xx.h             |   25
 include/asm-powerpc/ipic.h                   |   12
 include/asm-powerpc/qe.h                     |   95 +-
 include/asm-powerpc/reg_booke.h              |   13
 55 files changed, 2214 insertions(+), 907 deletions(-)

Jochen Friedrich (2):
      [POWERPC] Add support for PORTA and PORTB odr registers
      [POWERPC] Move CPM command handling into the cpm drivers

Jon Loeliger (2):
      [POWERPC] 8xxx: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
      [POWERPC] 86xx: Add aliases node to 8641hpcn DTS file.

Kumar Gala (5):
      [POWERPC] Add SPRN for Embedded registers specified in PowerISA 2.04
      [POWERPC] Emulate isel (Integer Select) instruction
      [POWERPC] FSL: I2C device tree cleanups
      [POWERPC] FSL: enet device tree cleanups
      [POWERPC] FSL: Added aliases node to device trees

Li Yang (5):
      [POWERPC] add e300c4 entry to cputable
      [POWERPC] ipic: add new interrupts introduced by new chip
      [POWERPC] 83xx: Add platform support for MPC837x MDS board
      [POWERPC] 83xx: Add MPC837x MDS default kernel configuration
      [POWERPC] ipic: ack only for edge interrupts

Scott Wood (3):
      [POWERPC] 8xx: Convert mpc866ads to the new device binding.
      [POWERPC] 83xx: mpc834x_mds: Fix whitespace and call of_platform_bus_probe().
      [POWERPC] 83xx: mpc8313erdb: Fix whitespace.

Timur Tabi (4):
      [POWERPC] 86xx: fix guts_set_dmacr() and add guts_set_pmuxcr_dma() to immap_86xx.h
      [POWERPC] QE: change qe_setbrg() to take an enum qe_clock instead of an integer
      [POWERPC] qe: add function qe_clock_source()
      [POWERPC] ucc_geth: use rx-clock-name and tx-clock-name device tree properties

^ permalink raw reply

* [PATCH] [POWERPC] pasemi: export pasemi_dma_init()
From: Olof Johansson @ 2007-12-14  8:06 UTC (permalink / raw)
  To: jgarzik; +Cc: linuxppc-dev

Forgot to export this one. Needed when pasemi_mac is compiled as a module.

Signed-off-by: Olof Johansson <olof@lixom.net>

---

Jeff, since the dma_lib stuff went up through netdev-2.6, please apply and
feed this one up with the rest.


Thanks,

Olof

Index: 2.6.24/arch/powerpc/platforms/pasemi/dma_lib.c
===================================================================
--- 2.6.24.orig/arch/powerpc/platforms/pasemi/dma_lib.c
+++ 2.6.24/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -485,3 +485,4 @@ out:
 	spin_unlock(&init_lock);
 	return err;
 }
+EXPORT_SYMBOL(pasemi_dma_init);

^ permalink raw reply

* Re: [PATCH] [POWERPC] Emulate isel (Integer Select) instruction
From: Olof Johansson @ 2007-12-14  8:12 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linuxppc-dev
In-Reply-To: <Pine.LNX.4.62.0711291612290.24058@pademelon.sonytel.be>

On Thu, Nov 29, 2007 at 04:13:14PM +0100, Geert Uytterhoeven wrote:
> On Wed, 28 Nov 2007, Geert Uytterhoeven wrote:
> > +static inline void warn_emulated_sysctl_register(void)
> > +{
> > +	int res = register_sysctl_table(warn_emulated_sysctl_root);
>         ^^^^^^^^^^
> > +	printk("@@@ register_sysctl_table() returned %d\n", res);
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > +}
> 
> Woops, that part shouldn't have been there...

Care to resubmit a clean patch under a fresh subject? Paul didn't chime
in but hopefully he can pick it up for 2.6.25.


Thanks,

Olof

^ permalink raw reply

* Re: [PATCH] [POWERPC] Emulate isel (Integer Select) instruction
From: Kumar Gala @ 2007-12-14  8:08 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Geert Uytterhoeven, linuxppc-dev
In-Reply-To: <20071214081210.GB27284@lixom.net>


On Dec 14, 2007, at 2:12 AM, Olof Johansson wrote:

> On Thu, Nov 29, 2007 at 04:13:14PM +0100, Geert Uytterhoeven wrote:
>> On Wed, 28 Nov 2007, Geert Uytterhoeven wrote:
>>> +static inline void warn_emulated_sysctl_register(void)
>>> +{
>>> +	int res = register_sysctl_table(warn_emulated_sysctl_root);
>>        ^^^^^^^^^^
>>> +	printk("@@@ register_sysctl_table() returned %d\n", res);
>>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> +}
>>
>> Woops, that part shouldn't have been there...
>
> Care to resubmit a clean patch under a fresh subject? Paul didn't  
> chime
> in but hopefully he can pick it up for 2.6.25.

I'd say wait for Paul to pickup my 2.6.25 request.  Than the base will  
have the isel emulation as well.

- k

^ permalink raw reply


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