LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* linux @ xup
From: Joachim Meyer @ 2008-01-30 10:03 UTC (permalink / raw)
  To: linuxppc-embedded

Hi

I already succeded in setting up a Linux for the ml310. I'm trying to do it for the XUP Board now. The Problem I have is, that
in every HowTo I read I should set at the EDK's software settings under Library/OS Parameters:
Set PLB_CLOCK_FREQ_HZ to the PLB speed (usually 100000000)

But I can't find where to set it. With the ml310 there was this option. I'm using the EDK Board Definition File (.xbd), Pcores & Drivers from Xilinx:
http://www.xilinx.com/univ/xupv2p.html
EDK Version 9.1 SP2

If I ignore it and build the BSP there comes out an xparameters_ml300.h file which I copy to my Kernel sources.
When I try to compile, I get errors that the PLB_CLOCK_FREQ_HZ isn't defined.
Can I just add it to the xparameters_ml300.h file file (which I rename "xparameters_xupv2p.h") by Hand?

Greez and thx
Joachim
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114

^ permalink raw reply

* [PATCH 2/6] Add RapidIO option to kernel configuration.
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1201689053956-git-send-email-wei.zhang@freescale.com>

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/Kconfig                |   13 +++++++++++++
 arch/powerpc/platforms/86xx/Kconfig |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 47fe256..ad07964 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -535,6 +535,19 @@ source "drivers/pcmcia/Kconfig"
 
 source "drivers/pci/hotplug/Kconfig"
 
+config HAS_RAPIDIO
+	bool
+	default n
+
+config RAPIDIO
+	bool "RapidIO support"
+	depends on HAS_RAPIDIO
+	help
+	  If you say Y here, the kernel will include drivers and
+	  infrastructure code to support RapidIO interconnect devices.
+
+source "drivers/rapidio/Kconfig"
+
 endmenu
 
 menu "Advanced setup"
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 21d1135..8c7c5ff 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -8,6 +8,7 @@ config MPC8641_HPCN
 	select PPC_I8259
 	select DEFAULT_UIMAGE
 	select FSL_ULI1575
+	select HAS_RAPIDIO
 	help
 	  This option enables support for the MPC8641 HPCN board.
 
-- 
1.5.2

^ permalink raw reply related

* [PATCH 3/6] Move include/asm-ppc/rio.h to include/asm-powerpc/rio.h
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <12016890621727-git-send-email-wei.zhang@freescale.com>

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 include/asm-powerpc/rio.h |   18 ++++++++++++++++++
 include/asm-ppc/rio.h     |   18 ------------------
 2 files changed, 18 insertions(+), 18 deletions(-)
 create mode 100644 include/asm-powerpc/rio.h
 delete mode 100644 include/asm-ppc/rio.h

diff --git a/include/asm-powerpc/rio.h b/include/asm-powerpc/rio.h
new file mode 100644
index 0000000..0018bf8
--- /dev/null
+++ b/include/asm-powerpc/rio.h
@@ -0,0 +1,18 @@
+/*
+ * RapidIO architecture support
+ *
+ * Copyright 2005 MontaVista Software, Inc.
+ * Matt Porter <mporter@kernel.crashing.org>
+ *
+ * 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.
+ */
+
+#ifndef ASM_PPC_RIO_H
+#define ASM_PPC_RIO_H
+
+extern void platform_rio_init(void);
+
+#endif				/* ASM_PPC_RIO_H */
diff --git a/include/asm-ppc/rio.h b/include/asm-ppc/rio.h
deleted file mode 100644
index 0018bf8..0000000
--- a/include/asm-ppc/rio.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * RapidIO architecture support
- *
- * Copyright 2005 MontaVista Software, Inc.
- * Matt Porter <mporter@kernel.crashing.org>
- *
- * 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.
- */
-
-#ifndef ASM_PPC_RIO_H
-#define ASM_PPC_RIO_H
-
-extern void platform_rio_init(void);
-
-#endif				/* ASM_PPC_RIO_H */
-- 
1.5.2

^ permalink raw reply related

* [PATCH 4/6] Add multi mport support.
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <120168907160-git-send-email-wei.zhang@freescale.com>

Change lots of static variable to mport private. And add mport to some
function declaration.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/sysdev/fsl_rio.c |  353 +++++++++++++++++++++++------------------
 drivers/rapidio/rio-access.c  |   10 +-
 include/linux/rio.h           |   18 ++-
 3 files changed, 218 insertions(+), 163 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 36c4be4..3907a2c 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1,6 +1,9 @@
 /*
  * Freescale MPC85xx/MPC86xx RapidIO support
  *
+ * Copyright (C) 2007, 2008 Freescale Semiconductor, Inc.
+ * Zhang Wei <wei.zhang@freescale.com>
+ *
  * Copyright 2005 MontaVista Software, Inc.
  * Matt Porter <mporter@kernel.crashing.org>
  *
@@ -20,6 +23,11 @@
 
 #include <asm/io.h>
 
+/* RapidIO definition irq, which read from OF-tree */
+#define IRQ_RIO_BELL(m)		(((struct rio_priv *)(m->priv))->bellirq)
+#define IRQ_RIO_TX(m)		(((struct rio_priv *)(m->priv))->txirq)
+#define IRQ_RIO_RX(m)		(((struct rio_priv *)(m->priv))->rxirq)
+
 #define RIO_REGS_BASE		(CCSRBAR + 0xc0000)
 #define RIO_ATMU_REGS_OFFSET	0x10c00
 #define RIO_MSG_REGS_OFFSET	0x11000
@@ -112,20 +120,12 @@ struct rio_tx_desc {
 	u32 res4;
 };
 
-static u32 regs_win;
-static struct rio_atmu_regs *atmu_regs;
-static struct rio_atmu_regs *maint_atmu_regs;
-static struct rio_atmu_regs *dbell_atmu_regs;
-static u32 dbell_win;
-static u32 maint_win;
-static struct rio_msg_regs *msg_regs;
-
-static struct rio_dbell_ring {
+struct rio_dbell_ring {
 	void *virt;
 	dma_addr_t phys;
-} dbell_ring;
+};
 
-static struct rio_msg_tx_ring {
+struct rio_msg_tx_ring {
 	void *virt;
 	dma_addr_t phys;
 	void *virt_buffer[RIO_MAX_TX_RING_SIZE];
@@ -133,16 +133,32 @@ static struct rio_msg_tx_ring {
 	int tx_slot;
 	int size;
 	void *dev_id;
-} msg_tx_ring;
+};
 
-static struct rio_msg_rx_ring {
+struct rio_msg_rx_ring {
 	void *virt;
 	dma_addr_t phys;
 	void *virt_buffer[RIO_MAX_RX_RING_SIZE];
 	int rx_slot;
 	int size;
 	void *dev_id;
-} msg_rx_ring;
+};
+
+struct rio_priv {
+	void __iomem *regs_win;
+	struct rio_atmu_regs __iomem *atmu_regs;
+	struct rio_atmu_regs __iomem *maint_atmu_regs;
+	struct rio_atmu_regs __iomem *dbell_atmu_regs;
+	void __iomem *dbell_win;
+	void __iomem *maint_win;
+	struct rio_msg_regs __iomem *msg_regs;
+	struct rio_dbell_ring dbell_ring;
+	struct rio_msg_tx_ring msg_tx_ring;
+	struct rio_msg_rx_ring msg_rx_ring;
+	int bellirq;
+	int txirq;
+	int rxirq;
+};
 
 /**
  * fsl_rio_doorbell_send - Send a MPC85xx doorbell message
@@ -153,12 +169,14 @@ static struct rio_msg_rx_ring {
  * Sends a MPC85xx doorbell message. Returns %0 on success or
  * %-EINVAL on failure.
  */
-static int fsl_rio_doorbell_send(int index, u16 destid, u16 data)
+static int fsl_rio_doorbell_send(struct rio_mport *mport,
+				int index, u16 destid, u16 data)
 {
+	struct rio_priv *priv = mport->priv;
 	pr_debug("fsl_doorbell_send: index %d destid %4.4x data %4.4x\n",
 		 index, destid, data);
-	out_be32((void *)&dbell_atmu_regs->rowtar, destid << 22);
-	out_be16((void *)(dbell_win), data);
+	out_be32(&priv->dbell_atmu_regs->rowtar, destid << 22);
+	out_be16(priv->dbell_win, data);
 
 	return 0;
 }
@@ -173,11 +191,13 @@ static int fsl_rio_doorbell_send(int index, u16 destid, u16 data)
  * Generates a MPC85xx local configuration space read. Returns %0 on
  * success or %-EINVAL on failure.
  */
-static int fsl_local_config_read(int index, u32 offset, int len, u32 * data)
+static int fsl_local_config_read(struct rio_mport *mport,
+				int index, u32 offset, int len, u32 * data)
 {
+	struct rio_priv *priv = mport->priv;
 	pr_debug("fsl_local_config_read: index %d offset %8.8x\n", index,
 		 offset);
-	*data = in_be32((void *)(regs_win + offset));
+	*data = in_be32(priv->regs_win + offset);
 
 	return 0;
 }
@@ -192,12 +212,14 @@ static int fsl_local_config_read(int index, u32 offset, int len, u32 * data)
  * Generates a MPC85xx local configuration space write. Returns %0 on
  * success or %-EINVAL on failure.
  */
-static int fsl_local_config_write(int index, u32 offset, int len, u32 data)
+static int fsl_local_config_write(struct rio_mport *mport,
+				int index, u32 offset, int len, u32 data)
 {
+	struct rio_priv *priv = mport->priv;
 	pr_debug
 	    ("fsl_local_config_write: index %d offset %8.8x data %8.8x\n",
 	     index, offset, data);
-	out_be32((void *)(regs_win + offset), data);
+	out_be32(priv->regs_win + offset, data);
 
 	return 0;
 }
@@ -215,18 +237,19 @@ static int fsl_local_config_write(int index, u32 offset, int len, u32 data)
  * success or %-EINVAL on failure.
  */
 static int
-fsl_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
-			u32 * val)
+fsl_rio_config_read(struct rio_mport *mport, int index, u16 destid,
+			u8 hopcount, u32 offset, int len, u32 * val)
 {
+	struct rio_priv *priv = mport->priv;
 	u8 *data;
 
 	pr_debug
 	    ("fsl_rio_config_read: index %d destid %d hopcount %d offset %8.8x len %d\n",
 	     index, destid, hopcount, offset, len);
-	out_be32((void *)&maint_atmu_regs->rowtar,
+	out_be32(&priv->maint_atmu_regs->rowtar,
 		 (destid << 22) | (hopcount << 12) | ((offset & ~0x3) >> 9));
 
-	data = (u8 *) maint_win + offset;
+	data = (u8 *) priv->maint_win + offset;
 	switch (len) {
 	case 1:
 		*val = in_8((u8 *) data);
@@ -255,17 +278,18 @@ fsl_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
  * success or %-EINVAL on failure.
  */
 static int
-fsl_rio_config_write(int index, u16 destid, u8 hopcount, u32 offset,
-			 int len, u32 val)
+fsl_rio_config_write(struct rio_mport *mport, int index, u16 destid,
+			u8 hopcount, u32 offset, int len, u32 val)
 {
+	struct rio_priv *priv = mport->priv;
 	u8 *data;
 	pr_debug
 	    ("fsl_rio_config_write: index %d destid %d hopcount %d offset %8.8x len %d val %8.8x\n",
 	     index, destid, hopcount, offset, len, val);
-	out_be32((void *)&maint_atmu_regs->rowtar,
+	out_be32(&priv->maint_atmu_regs->rowtar,
 		 (destid << 22) | (hopcount << 12) | ((offset & ~0x3) >> 9));
 
-	data = (u8 *) maint_win + offset;
+	data = (u8 *) priv->maint_win + offset;
 	switch (len) {
 	case 1:
 		out_8((u8 *) data, val);
@@ -296,9 +320,10 @@ int
 rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
 			void *buffer, size_t len)
 {
+	struct rio_priv *priv = mport->priv;
 	u32 omr;
-	struct rio_tx_desc *desc =
-	    (struct rio_tx_desc *)msg_tx_ring.virt + msg_tx_ring.tx_slot;
+	struct rio_tx_desc *desc = (struct rio_tx_desc *)priv->msg_tx_ring.virt
+		    		+ priv->msg_tx_ring.tx_slot;
 	int ret = 0;
 
 	pr_debug
@@ -311,11 +336,11 @@ rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
 	}
 
 	/* Copy and clear rest of buffer */
-	memcpy(msg_tx_ring.virt_buffer[msg_tx_ring.tx_slot], buffer, len);
+	memcpy(priv->msg_tx_ring.virt_buffer[priv->msg_tx_ring.tx_slot], buffer,
+			len);
 	if (len < (RIO_MAX_MSG_SIZE - 4))
-		memset((void *)((u32) msg_tx_ring.
-				virt_buffer[msg_tx_ring.tx_slot] + len), 0,
-		       RIO_MAX_MSG_SIZE - len);
+		memset(priv->msg_tx_ring.virt_buffer[priv->msg_tx_ring.tx_slot]
+				+ len, 0, RIO_MAX_MSG_SIZE - len);
 
 	/* Set mbox field for message */
 	desc->dport = mbox & 0x3;
@@ -327,15 +352,16 @@ rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
 	desc->dwcnt = is_power_of_2(len) ? len : 1 << get_bitmask_order(len);
 
 	/* Set snooping and source buffer address */
-	desc->saddr = 0x00000004 | msg_tx_ring.phys_buffer[msg_tx_ring.tx_slot];
+	desc->saddr = 0x00000004
+		| priv->msg_tx_ring.phys_buffer[priv->msg_tx_ring.tx_slot];
 
 	/* Increment enqueue pointer */
-	omr = in_be32((void *)&msg_regs->omr);
-	out_be32((void *)&msg_regs->omr, omr | RIO_MSG_OMR_MUI);
+	omr = in_be32(&priv->msg_regs->omr);
+	out_be32(&priv->msg_regs->omr, omr | RIO_MSG_OMR_MUI);
 
 	/* Go to next descriptor */
-	if (++msg_tx_ring.tx_slot == msg_tx_ring.size)
-		msg_tx_ring.tx_slot = 0;
+	if (++priv->msg_tx_ring.tx_slot == priv->msg_tx_ring.size)
+		priv->msg_tx_ring.tx_slot = 0;
 
       out:
 	return ret;
@@ -356,28 +382,30 @@ fsl_rio_tx_handler(int irq, void *dev_instance)
 {
 	int osr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
+	struct rio_priv *priv = port->priv;
 
-	osr = in_be32((void *)&msg_regs->osr);
+	osr = in_be32(&priv->msg_regs->osr);
 
 	if (osr & RIO_MSG_OSR_TE) {
 		pr_info("RIO: outbound message transmission error\n");
-		out_be32((void *)&msg_regs->osr, RIO_MSG_OSR_TE);
+		out_be32(&priv->msg_regs->osr, RIO_MSG_OSR_TE);
 		goto out;
 	}
 
 	if (osr & RIO_MSG_OSR_QOI) {
 		pr_info("RIO: outbound message queue overflow\n");
-		out_be32((void *)&msg_regs->osr, RIO_MSG_OSR_QOI);
+		out_be32(&priv->msg_regs->osr, RIO_MSG_OSR_QOI);
 		goto out;
 	}
 
 	if (osr & RIO_MSG_OSR_EOMI) {
-		u32 dqp = in_be32((void *)&msg_regs->odqdpar);
-		int slot = (dqp - msg_tx_ring.phys) >> 5;
-		port->outb_msg[0].mcback(port, msg_tx_ring.dev_id, -1, slot);
+		u32 dqp = in_be32(&priv->msg_regs->odqdpar);
+		int slot = (dqp - priv->msg_tx_ring.phys) >> 5;
+		port->outb_msg[0].mcback(port, priv->msg_tx_ring.dev_id, -1,
+				slot);
 
 		/* Ack the end-of-message interrupt */
-		out_be32((void *)&msg_regs->osr, RIO_MSG_OSR_EOMI);
+		out_be32(&priv->msg_regs->osr, RIO_MSG_OSR_EOMI);
 	}
 
       out:
@@ -398,6 +426,7 @@ fsl_rio_tx_handler(int irq, void *dev_instance)
 int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
 {
 	int i, j, rc = 0;
+	struct rio_priv *priv = mport->priv;
 
 	if ((entries < RIO_MIN_TX_RING_SIZE) ||
 	    (entries > RIO_MAX_TX_RING_SIZE) || (!is_power_of_2(entries))) {
@@ -406,53 +435,54 @@ int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entr
 	}
 
 	/* Initialize shadow copy ring */
-	msg_tx_ring.dev_id = dev_id;
-	msg_tx_ring.size = entries;
+	priv->msg_tx_ring.dev_id = dev_id;
+	priv->msg_tx_ring.size = entries;
 
-	for (i = 0; i < msg_tx_ring.size; i++) {
+	for (i = 0; i < priv->msg_tx_ring.size; i++) {
 		if (!
-		    (msg_tx_ring.virt_buffer[i] =
+		    (priv->msg_tx_ring.virt_buffer[i] =
 		     dma_alloc_coherent(NULL, RIO_MSG_BUFFER_SIZE,
-					&msg_tx_ring.phys_buffer[i],
+					&priv->msg_tx_ring.phys_buffer[i],
 					GFP_KERNEL))) {
 			rc = -ENOMEM;
-			for (j = 0; j < msg_tx_ring.size; j++)
-				if (msg_tx_ring.virt_buffer[j])
+			for (j = 0; j < priv->msg_tx_ring.size; j++)
+				if (priv->msg_tx_ring.virt_buffer[j])
 					dma_free_coherent(NULL,
 							  RIO_MSG_BUFFER_SIZE,
-							  msg_tx_ring.
+							  priv->msg_tx_ring.
 							  virt_buffer[j],
-							  msg_tx_ring.
+							  priv->msg_tx_ring.
 							  phys_buffer[j]);
 			goto out;
 		}
 	}
 
 	/* Initialize outbound message descriptor ring */
-	if (!(msg_tx_ring.virt = dma_alloc_coherent(NULL,
-						    msg_tx_ring.size *
+	if (!(priv->msg_tx_ring.virt = dma_alloc_coherent(NULL,
+						    priv->msg_tx_ring.size *
 						    RIO_MSG_DESC_SIZE,
-						    &msg_tx_ring.phys,
+						    &priv->msg_tx_ring.phys,
 						    GFP_KERNEL))) {
 		rc = -ENOMEM;
 		goto out_dma;
 	}
-	memset(msg_tx_ring.virt, 0, msg_tx_ring.size * RIO_MSG_DESC_SIZE);
-	msg_tx_ring.tx_slot = 0;
+	memset(priv->msg_tx_ring.virt, 0,
+			priv->msg_tx_ring.size * RIO_MSG_DESC_SIZE);
+	priv->msg_tx_ring.tx_slot = 0;
 
 	/* Point dequeue/enqueue pointers at first entry in ring */
-	out_be32((void *)&msg_regs->odqdpar, msg_tx_ring.phys);
-	out_be32((void *)&msg_regs->odqepar, msg_tx_ring.phys);
+	out_be32(&priv->msg_regs->odqdpar, priv->msg_tx_ring.phys);
+	out_be32(&priv->msg_regs->odqepar, priv->msg_tx_ring.phys);
 
 	/* Configure for snooping */
-	out_be32((void *)&msg_regs->osar, 0x00000004);
+	out_be32(&priv->msg_regs->osar, 0x00000004);
 
 	/* Clear interrupt status */
-	out_be32((void *)&msg_regs->osr, 0x000000b3);
+	out_be32(&priv->msg_regs->osr, 0x000000b3);
 
 	/* Hook up outbound message handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_TX, fsl_rio_tx_handler, 0,
+	     request_irq(IRQ_RIO_TX(mport), fsl_rio_tx_handler, 0,
 			 "msg_tx", (void *)mport)) < 0)
 		goto out_irq;
 
@@ -463,28 +493,28 @@ int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entr
 	 *      Chaining mode
 	 *      Disable
 	 */
-	out_be32((void *)&msg_regs->omr, 0x00100220);
+	out_be32(&priv->msg_regs->omr, 0x00100220);
 
 	/* Set number of entries */
-	out_be32((void *)&msg_regs->omr,
-		 in_be32((void *)&msg_regs->omr) |
+	out_be32(&priv->msg_regs->omr,
+		 in_be32(&priv->msg_regs->omr) |
 		 ((get_bitmask_order(entries) - 2) << 12));
 
 	/* Now enable the unit */
-	out_be32((void *)&msg_regs->omr, in_be32((void *)&msg_regs->omr) | 0x1);
+	out_be32(&priv->msg_regs->omr, in_be32(&priv->msg_regs->omr) | 0x1);
 
       out:
 	return rc;
 
       out_irq:
-	dma_free_coherent(NULL, msg_tx_ring.size * RIO_MSG_DESC_SIZE,
-			  msg_tx_ring.virt, msg_tx_ring.phys);
+	dma_free_coherent(NULL, priv->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
+			  priv->msg_tx_ring.virt, priv->msg_tx_ring.phys);
 
       out_dma:
-	for (i = 0; i < msg_tx_ring.size; i++)
+	for (i = 0; i < priv->msg_tx_ring.size; i++)
 		dma_free_coherent(NULL, RIO_MSG_BUFFER_SIZE,
-				  msg_tx_ring.virt_buffer[i],
-				  msg_tx_ring.phys_buffer[i]);
+				  priv->msg_tx_ring.virt_buffer[i],
+				  priv->msg_tx_ring.phys_buffer[i]);
 
 	return rc;
 }
@@ -499,15 +529,16 @@ int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entr
  */
 void rio_close_outb_mbox(struct rio_mport *mport, int mbox)
 {
+	struct rio_priv *priv = mport->priv;
 	/* Disable inbound message unit */
-	out_be32((void *)&msg_regs->omr, 0);
+	out_be32(&priv->msg_regs->omr, 0);
 
 	/* Free ring */
-	dma_free_coherent(NULL, msg_tx_ring.size * RIO_MSG_DESC_SIZE,
-			  msg_tx_ring.virt, msg_tx_ring.phys);
+	dma_free_coherent(NULL, priv->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
+			  priv->msg_tx_ring.virt, priv->msg_tx_ring.phys);
 
 	/* Free interrupt */
-	free_irq(MPC85xx_IRQ_RIO_TX, (void *)mport);
+	free_irq(IRQ_RIO_TX(mport), (void *)mport);
 }
 
 /**
@@ -523,12 +554,13 @@ fsl_rio_rx_handler(int irq, void *dev_instance)
 {
 	int isr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
+	struct rio_priv *priv = port->priv;
 
-	isr = in_be32((void *)&msg_regs->isr);
+	isr = in_be32(&priv->msg_regs->isr);
 
 	if (isr & RIO_MSG_ISR_TE) {
 		pr_info("RIO: inbound message reception error\n");
-		out_be32((void *)&msg_regs->isr, RIO_MSG_ISR_TE);
+		out_be32((void *)&priv->msg_regs->isr, RIO_MSG_ISR_TE);
 		goto out;
 	}
 
@@ -540,10 +572,10 @@ fsl_rio_rx_handler(int irq, void *dev_instance)
 		 * make the callback with an unknown/invalid mailbox number
 		 * argument.
 		 */
-		port->inb_msg[0].mcback(port, msg_rx_ring.dev_id, -1, -1);
+		port->inb_msg[0].mcback(port, priv->msg_rx_ring.dev_id, -1, -1);
 
 		/* Ack the queueing interrupt */
-		out_be32((void *)&msg_regs->isr, RIO_MSG_ISR_DIQI);
+		out_be32(&priv->msg_regs->isr, RIO_MSG_ISR_DIQI);
 	}
 
       out:
@@ -564,6 +596,7 @@ fsl_rio_rx_handler(int irq, void *dev_instance)
 int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
 {
 	int i, rc = 0;
+	struct rio_priv *priv = mport->priv;
 
 	if ((entries < RIO_MIN_RX_RING_SIZE) ||
 	    (entries > RIO_MAX_RX_RING_SIZE) || (!is_power_of_2(entries))) {
@@ -572,36 +605,36 @@ int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entri
 	}
 
 	/* Initialize client buffer ring */
-	msg_rx_ring.dev_id = dev_id;
-	msg_rx_ring.size = entries;
-	msg_rx_ring.rx_slot = 0;
-	for (i = 0; i < msg_rx_ring.size; i++)
-		msg_rx_ring.virt_buffer[i] = NULL;
+	priv->msg_rx_ring.dev_id = dev_id;
+	priv->msg_rx_ring.size = entries;
+	priv->msg_rx_ring.rx_slot = 0;
+	for (i = 0; i < priv->msg_rx_ring.size; i++)
+		priv->msg_rx_ring.virt_buffer[i] = NULL;
 
 	/* Initialize inbound message ring */
-	if (!(msg_rx_ring.virt = dma_alloc_coherent(NULL,
-						    msg_rx_ring.size *
+	if (!(priv->msg_rx_ring.virt = dma_alloc_coherent(NULL,
+						    priv->msg_rx_ring.size *
 						    RIO_MAX_MSG_SIZE,
-						    &msg_rx_ring.phys,
+						    &priv->msg_rx_ring.phys,
 						    GFP_KERNEL))) {
 		rc = -ENOMEM;
 		goto out;
 	}
 
 	/* Point dequeue/enqueue pointers at first entry in ring */
-	out_be32((void *)&msg_regs->ifqdpar, (u32) msg_rx_ring.phys);
-	out_be32((void *)&msg_regs->ifqepar, (u32) msg_rx_ring.phys);
+	out_be32(&priv->msg_regs->ifqdpar, (u32) priv->msg_rx_ring.phys);
+	out_be32(&priv->msg_regs->ifqepar, (u32) priv->msg_rx_ring.phys);
 
 	/* Clear interrupt status */
-	out_be32((void *)&msg_regs->isr, 0x00000091);
+	out_be32(&priv->msg_regs->isr, 0x00000091);
 
 	/* Hook up inbound message handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_RX, fsl_rio_rx_handler, 0,
+	     request_irq(IRQ_RIO_RX(mport), fsl_rio_rx_handler, 0,
 			 "msg_rx", (void *)mport)) < 0) {
 		dma_free_coherent(NULL, RIO_MSG_BUFFER_SIZE,
-				  msg_tx_ring.virt_buffer[i],
-				  msg_tx_ring.phys_buffer[i]);
+				  priv->msg_tx_ring.virt_buffer[i],
+				  priv->msg_tx_ring.phys_buffer[i]);
 		goto out;
 	}
 
@@ -612,15 +645,13 @@ int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entri
 	 *      Unmask all interrupt sources
 	 *      Disable
 	 */
-	out_be32((void *)&msg_regs->imr, 0x001b0060);
+	out_be32(&priv->msg_regs->imr, 0x001b0060);
 
 	/* Set number of queue entries */
-	out_be32((void *)&msg_regs->imr,
-		 in_be32((void *)&msg_regs->imr) |
-		 ((get_bitmask_order(entries) - 2) << 12));
+	setbits32(&priv->msg_regs->imr, (get_bitmask_order(entries) - 2) << 12);
 
 	/* Now enable the unit */
-	out_be32((void *)&msg_regs->imr, in_be32((void *)&msg_regs->imr) | 0x1);
+	setbits32(&priv->msg_regs->imr, 0x1);
 
       out:
 	return rc;
@@ -636,15 +667,16 @@ int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entri
  */
 void rio_close_inb_mbox(struct rio_mport *mport, int mbox)
 {
+	struct rio_priv *priv = mport->priv;
 	/* Disable inbound message unit */
-	out_be32((void *)&msg_regs->imr, 0);
+	out_be32(&priv->msg_regs->imr, 0);
 
 	/* Free ring */
-	dma_free_coherent(NULL, msg_rx_ring.size * RIO_MAX_MSG_SIZE,
-			  msg_rx_ring.virt, msg_rx_ring.phys);
+	dma_free_coherent(NULL, priv->msg_rx_ring.size * RIO_MAX_MSG_SIZE,
+			  priv->msg_rx_ring.virt, priv->msg_rx_ring.phys);
 
 	/* Free interrupt */
-	free_irq(MPC85xx_IRQ_RIO_RX, (void *)mport);
+	free_irq(IRQ_RIO_RX(mport), (void *)mport);
 }
 
 /**
@@ -659,21 +691,22 @@ void rio_close_inb_mbox(struct rio_mport *mport, int mbox)
 int rio_hw_add_inb_buffer(struct rio_mport *mport, int mbox, void *buf)
 {
 	int rc = 0;
+	struct rio_priv *priv = mport->priv;
 
 	pr_debug("RIO: rio_hw_add_inb_buffer(), msg_rx_ring.rx_slot %d\n",
-		 msg_rx_ring.rx_slot);
+		 priv->msg_rx_ring.rx_slot);
 
-	if (msg_rx_ring.virt_buffer[msg_rx_ring.rx_slot]) {
+	if (priv->msg_rx_ring.virt_buffer[priv->msg_rx_ring.rx_slot]) {
 		printk(KERN_ERR
 		       "RIO: error adding inbound buffer %d, buffer exists\n",
-		       msg_rx_ring.rx_slot);
+		       priv->msg_rx_ring.rx_slot);
 		rc = -EINVAL;
 		goto out;
 	}
 
-	msg_rx_ring.virt_buffer[msg_rx_ring.rx_slot] = buf;
-	if (++msg_rx_ring.rx_slot == msg_rx_ring.size)
-		msg_rx_ring.rx_slot = 0;
+	priv->msg_rx_ring.virt_buffer[priv->msg_rx_ring.rx_slot] = buf;
+	if (++priv->msg_rx_ring.rx_slot == priv->msg_rx_ring.size)
+		priv->msg_rx_ring.rx_slot = 0;
 
       out:
 	return rc;
@@ -691,20 +724,20 @@ EXPORT_SYMBOL_GPL(rio_hw_add_inb_buffer);
  */
 void *rio_hw_get_inb_message(struct rio_mport *mport, int mbox)
 {
-	u32 imr;
+	struct rio_priv *priv = mport->priv;
 	u32 phys_buf, virt_buf;
 	void *buf = NULL;
 	int buf_idx;
 
-	phys_buf = in_be32((void *)&msg_regs->ifqdpar);
+	phys_buf = in_be32(&priv->msg_regs->ifqdpar);
 
 	/* If no more messages, then bail out */
-	if (phys_buf == in_be32((void *)&msg_regs->ifqepar))
+	if (phys_buf == in_be32(&priv->msg_regs->ifqepar))
 		goto out2;
 
-	virt_buf = (u32) msg_rx_ring.virt + (phys_buf - msg_rx_ring.phys);
-	buf_idx = (phys_buf - msg_rx_ring.phys) / RIO_MAX_MSG_SIZE;
-	buf = msg_rx_ring.virt_buffer[buf_idx];
+	virt_buf = (u32) priv->msg_rx_ring.virt + (phys_buf - priv->msg_rx_ring.phys);
+	buf_idx = (phys_buf - priv->msg_rx_ring.phys) / RIO_MAX_MSG_SIZE;
+	buf = priv->msg_rx_ring.virt_buffer[buf_idx];
 
 	if (!buf) {
 		printk(KERN_ERR
@@ -716,11 +749,10 @@ void *rio_hw_get_inb_message(struct rio_mport *mport, int mbox)
 	memcpy(buf, (void *)virt_buf, RIO_MAX_MSG_SIZE);
 
 	/* Clear the available buffer */
-	msg_rx_ring.virt_buffer[buf_idx] = NULL;
+	priv->msg_rx_ring.virt_buffer[buf_idx] = NULL;
 
       out1:
-	imr = in_be32((void *)&msg_regs->imr);
-	out_be32((void *)&msg_regs->imr, imr | RIO_MSG_IMR_MI);
+	setbits32(&priv->msg_regs->imr, RIO_MSG_IMR_MI);
 
       out2:
 	return buf;
@@ -741,27 +773,27 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
 {
 	int dsr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
+	struct rio_priv *priv = port->priv;
 
-	dsr = in_be32((void *)&msg_regs->dsr);
+	dsr = in_be32(&priv->msg_regs->dsr);
 
 	if (dsr & DOORBELL_DSR_TE) {
 		pr_info("RIO: doorbell reception error\n");
-		out_be32((void *)&msg_regs->dsr, DOORBELL_DSR_TE);
+		out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_TE);
 		goto out;
 	}
 
 	if (dsr & DOORBELL_DSR_QFI) {
 		pr_info("RIO: doorbell queue full\n");
-		out_be32((void *)&msg_regs->dsr, DOORBELL_DSR_QFI);
+		out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_QFI);
 		goto out;
 	}
 
 	/* XXX Need to check/dispatch until queue empty */
 	if (dsr & DOORBELL_DSR_DIQI) {
 		u32 dmsg =
-		    (u32) dbell_ring.virt +
-		    (in_be32((void *)&msg_regs->dqdpar) & 0xfff);
-		u32 dmr;
+		    (u32) priv->dbell_ring.virt +
+		    (in_be32(&priv->msg_regs->dqdpar) & 0xfff);
 		struct rio_dbell *dbell;
 		int found = 0;
 
@@ -784,9 +816,8 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
 			    ("RIO: spurious doorbell, sid %2.2x tid %2.2x info %4.4x\n",
 			     DBELL_SID(dmsg), DBELL_TID(dmsg), DBELL_INF(dmsg));
 		}
-		dmr = in_be32((void *)&msg_regs->dmr);
-		out_be32((void *)&msg_regs->dmr, dmr | DOORBELL_DMR_DI);
-		out_be32((void *)&msg_regs->dsr, DOORBELL_DSR_DIQI);
+		setbits32(&priv->msg_regs->dmr, DOORBELL_DMR_DI);
+		out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_DIQI);
 	}
 
       out:
@@ -803,10 +834,11 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)
  */
 static int fsl_rio_doorbell_init(struct rio_mport *mport)
 {
+	struct rio_priv *priv = mport->priv;
 	int rc = 0;
 
 	/* Map outbound doorbell window immediately after maintenance window */
-	if (!(dbell_win =
+	if (!(priv->dbell_win =
 	      (u32) ioremap(mport->iores.start + RIO_MAINT_WIN_SIZE,
 			    RIO_DBELL_WIN_SIZE))) {
 		printk(KERN_ERR
@@ -816,37 +848,37 @@ static int fsl_rio_doorbell_init(struct rio_mport *mport)
 	}
 
 	/* Initialize inbound doorbells */
-	if (!(dbell_ring.virt = dma_alloc_coherent(NULL,
+	if (!(priv->dbell_ring.virt = dma_alloc_coherent(NULL,
 						   512 * DOORBELL_MESSAGE_SIZE,
-						   &dbell_ring.phys,
+						   &priv->dbell_ring.phys,
 						   GFP_KERNEL))) {
 		printk(KERN_ERR "RIO: unable allocate inbound doorbell ring\n");
 		rc = -ENOMEM;
-		iounmap((void *)dbell_win);
+		iounmap(priv->dbell_win);
 		goto out;
 	}
 
 	/* Point dequeue/enqueue pointers at first entry in ring */
-	out_be32((void *)&msg_regs->dqdpar, (u32) dbell_ring.phys);
-	out_be32((void *)&msg_regs->dqepar, (u32) dbell_ring.phys);
+	out_be32(&priv->msg_regs->dqdpar, (u32) priv->dbell_ring.phys);
+	out_be32(&priv->msg_regs->dqepar, (u32) priv->dbell_ring.phys);
 
 	/* Clear interrupt status */
-	out_be32((void *)&msg_regs->dsr, 0x00000091);
+	out_be32(&priv->msg_regs->dsr, 0x00000091);
 
 	/* Hook up doorbell handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_BELL, fsl_rio_dbell_handler, 0,
+	     request_irq(IRQ_RIO_BELL(mport), fsl_rio_dbell_handler, 0,
 			 "dbell_rx", (void *)mport) < 0)) {
-		iounmap((void *)dbell_win);
+		iounmap(priv->dbell_win);
 		dma_free_coherent(NULL, 512 * DOORBELL_MESSAGE_SIZE,
-				  dbell_ring.virt, dbell_ring.phys);
+				  priv->dbell_ring.virt, priv->dbell_ring.phys);
 		printk(KERN_ERR
 		       "MPC85xx RIO: unable to request inbound doorbell irq");
 		goto out;
 	}
 
 	/* Configure doorbells for snooping, 512 entries, and enable */
-	out_be32((void *)&msg_regs->dmr, 0x00108161);
+	out_be32(&priv->msg_regs->dmr, 0x00108161);
 
       out:
 	return rc;
@@ -887,6 +919,8 @@ void fsl_rio_setup(int law_start, int law_size)
 {
 	struct rio_ops *ops;
 	struct rio_mport *port;
+	struct rio_priv *priv = NULL;
+	int rc;
 
 	ops = kmalloc(sizeof(struct rio_ops), GFP_KERNEL);
 	ops->lcread = fsl_local_config_read;
@@ -898,6 +932,14 @@ void fsl_rio_setup(int law_start, int law_size)
 	port = kmalloc(sizeof(struct rio_mport), GFP_KERNEL);
 	port->id = 0;
 	port->index = 0;
+
+	priv = kzalloc(sizeof(struct rio_priv), GFP_KERNEL);
+	if (!priv) {
+		printk(KERN_ERR "Can't alloc memory for 'priv'\n");
+		rc = -ENOMEM;
+		goto err;
+	}
+
 	INIT_LIST_HEAD(&port->dbells);
 	port->iores.start = law_start;
 	port->iores.end = law_start + law_size;
@@ -911,22 +953,31 @@ void fsl_rio_setup(int law_start, int law_size)
 	port->ops = ops;
 	port->host_deviceid = fsl_rio_get_hdid(port->id);
 
+	port->priv = priv;
 	rio_register_mport(port);
 
-	regs_win = (u32) ioremap(RIO_REGS_BASE, 0x20000);
-	atmu_regs = (struct rio_atmu_regs *)(regs_win + RIO_ATMU_REGS_OFFSET);
-	maint_atmu_regs = atmu_regs + 1;
-	dbell_atmu_regs = atmu_regs + 2;
-	msg_regs = (struct rio_msg_regs *)(regs_win + RIO_MSG_REGS_OFFSET);
+	priv->regs_win = (u32) ioremap(RIO_REGS_BASE, 0x20000);
+	priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win
+					+ RIO_ATMU_REGS_OFFSET);
+	priv->maint_atmu_regs = priv->atmu_regs + 1;
+	priv->dbell_atmu_regs = priv->atmu_regs + 2;
+	priv->msg_regs = (struct rio_msg_regs *)(priv->regs_win + RIO_MSG_REGS_OFFSET);
 
 	/* Configure maintenance transaction window */
-	out_be32((void *)&maint_atmu_regs->rowbar, 0x000c0000);
-	out_be32((void *)&maint_atmu_regs->rowar, 0x80077015);
+	out_be32(&priv->maint_atmu_regs->rowbar, 0x000c0000);
+	out_be32(&priv->maint_atmu_regs->rowar, 0x80077015);
 
-	maint_win = (u32) ioremap(law_start, RIO_MAINT_WIN_SIZE);
+	priv->maint_win = (u32) ioremap(law_start, RIO_MAINT_WIN_SIZE);
 
 	/* Configure outbound doorbell window */
-	out_be32((void *)&dbell_atmu_regs->rowbar, 0x000c0400);
-	out_be32((void *)&dbell_atmu_regs->rowar, 0x8004200b);
+	out_be32(&priv->dbell_atmu_regs->rowbar, 0x000c0400);
+	out_be32(&priv->dbell_atmu_regs->rowar, 0x8004200b);
 	fsl_rio_doorbell_init(port);
+
+	return;
+err:
+	if (priv)
+		iounmap(priv->regs_win);
+	kfree(priv);
+	kfree(port);
 }
diff --git a/drivers/rapidio/rio-access.c b/drivers/rapidio/rio-access.c
index 8b56bbd..a3824ba 100644
--- a/drivers/rapidio/rio-access.c
+++ b/drivers/rapidio/rio-access.c
@@ -48,7 +48,7 @@ int __rio_local_read_config_##size \
 	u32 data = 0;							\
 	if (RIO_##size##_BAD) return RIO_BAD_SIZE;			\
 	spin_lock_irqsave(&rio_config_lock, flags);			\
-	res = mport->ops->lcread(mport->id, offset, len, &data);	\
+	res = mport->ops->lcread(mport, mport->id, offset, len, &data);	\
 	*value = (type)data;						\
 	spin_unlock_irqrestore(&rio_config_lock, flags);		\
 	return res;							\
@@ -71,7 +71,7 @@ int __rio_local_write_config_##size \
 	unsigned long flags;						\
 	if (RIO_##size##_BAD) return RIO_BAD_SIZE;			\
 	spin_lock_irqsave(&rio_config_lock, flags);			\
-	res = mport->ops->lcwrite(mport->id, offset, len, value);	\
+	res = mport->ops->lcwrite(mport, mport->id, offset, len, value);\
 	spin_unlock_irqrestore(&rio_config_lock, flags);		\
 	return res;							\
 }
@@ -108,7 +108,7 @@ int rio_mport_read_config_##size \
 	u32 data = 0;							\
 	if (RIO_##size##_BAD) return RIO_BAD_SIZE;			\
 	spin_lock_irqsave(&rio_config_lock, flags);			\
-	res = mport->ops->cread(mport->id, destid, hopcount, offset, len, &data); \
+	res = mport->ops->cread(mport, mport->id, destid, hopcount, offset, len, &data); \
 	*value = (type)data;						\
 	spin_unlock_irqrestore(&rio_config_lock, flags);		\
 	return res;							\
@@ -131,7 +131,7 @@ int rio_mport_write_config_##size \
 	unsigned long flags;						\
 	if (RIO_##size##_BAD) return RIO_BAD_SIZE;			\
 	spin_lock_irqsave(&rio_config_lock, flags);			\
-	res = mport->ops->cwrite(mport->id, destid, hopcount, offset, len, value); \
+	res = mport->ops->cwrite(mport, mport->id, destid, hopcount, offset, len, value); \
 	spin_unlock_irqrestore(&rio_config_lock, flags);		\
 	return res;							\
 }
@@ -166,7 +166,7 @@ int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, u16 data)
 	unsigned long flags;
 
 	spin_lock_irqsave(&rio_doorbell_lock, flags);
-	res = mport->ops->dsend(mport->id, destid, data);
+	res = mport->ops->dsend(mport, mport->id, destid, data);
 	spin_unlock_irqrestore(&rio_doorbell_lock, flags);
 
 	return res;
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 68e3f68..9ed78dc 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -163,6 +163,7 @@ struct rio_dbell {
  * @id: Port ID, unique among all ports
  * @index: Port index, unique among all port interfaces of the same type
  * @name: Port name string
+ * @priv: Master port private data
  */
 struct rio_mport {
 	struct list_head dbells;	/* list of doorbell events */
@@ -178,6 +179,7 @@ struct rio_mport {
 	unsigned char index;	/* port index, unique among all port
 				   interfaces of the same type */
 	unsigned char name[40];
+	void *priv;		/* Master port private data */
 };
 
 /**
@@ -229,13 +231,15 @@ struct rio_switch {
  * @dsend: Callback to send a doorbell message.
  */
 struct rio_ops {
-	int (*lcread) (int index, u32 offset, int len, u32 * data);
-	int (*lcwrite) (int index, u32 offset, int len, u32 data);
-	int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len,
-		      u32 * data);
-	int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len,
-		       u32 data);
-	int (*dsend) (int index, u16 destid, u16 data);
+	int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
+			u32 * data);
+	int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len,
+			u32 data);
+	int (*cread) (struct rio_mport *mport, int index, u16 destid,
+			u8 hopcount, u32 offset, int len, u32 * data);
+	int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
+			u8 hopcount, u32 offset, int len, u32 data);
+	int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
 };
 
 #define RIO_RESOURCE_MEM	0x00000100
-- 
1.5.2

^ permalink raw reply related

* [PATCH 5/6] Add OF-tree support to RapidIO controller driver.
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <12016890773706-git-send-email-wei.zhang@freescale.com>

Now, RapidIO driver for powerpc architecture is also support OF-device.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/kernel/Makefile  |    1 -
 arch/powerpc/kernel/rio.c     |   52 ---------------------
 arch/powerpc/sysdev/fsl_rio.c |  101 +++++++++++++++++++++++++++++++++++++---
 arch/powerpc/sysdev/fsl_rio.h |   20 --------
 4 files changed, 93 insertions(+), 81 deletions(-)
 delete mode 100644 arch/powerpc/kernel/rio.c
 delete mode 100644 arch/powerpc/sysdev/fsl_rio.h

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 58dbfef..d9b3770 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -70,7 +70,6 @@ pci64-$(CONFIG_PPC64)		+= pci_dn.o isa-bridge.o
 obj-$(CONFIG_PCI)		+= pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
 				   pci-common.o
 obj-$(CONFIG_PCI_MSI)		+= msi.o
-obj-$(CONFIG_RAPIDIO)		+= rio.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o crash.o \
 				   machine_kexec_$(CONFIG_WORD_SIZE).o
 obj-$(CONFIG_AUDIT)		+= audit.o
diff --git a/arch/powerpc/kernel/rio.c b/arch/powerpc/kernel/rio.c
deleted file mode 100644
index 29487fe..0000000
--- a/arch/powerpc/kernel/rio.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * RapidIO PPC32 support
- *
- * Copyright 2005 MontaVista Software, Inc.
- * Matt Porter <mporter@kernel.crashing.org>
- *
- * 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.
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/rio.h>
-
-#include <asm/rio.h>
-
-/**
- * platform_rio_init - Do platform specific RIO init
- *
- * Any platform specific initialization of RapdIO
- * hardware is done here as well as registration
- * of any active master ports in the system.
- */
-void __attribute__ ((weak))
-    platform_rio_init(void)
-{
-	printk(KERN_WARNING "RIO: No platform_rio_init() present\n");
-}
-
-/**
- * ppc_rio_init - Do PPC32 RIO init
- *
- * Calls platform-specific RIO init code and then calls
- * rio_init_mports() to initialize any master ports that
- * have been registered with the RIO subsystem.
- */
-static int __init ppc_rio_init(void)
-{
-	printk(KERN_INFO "RIO: RapidIO init\n");
-
-	/* Platform specific initialization */
-	platform_rio_init();
-
-	/* Enumerate all registered ports */
-	rio_init_mports();
-
-	return 0;
-}
-
-subsys_initcall(ppc_rio_init);
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 3907a2c..36b43ec 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -20,6 +20,7 @@
 #include <linux/interrupt.h>
 #include <linux/rio.h>
 #include <linux/rio_drv.h>
+#include <linux/of_platform.h>
 
 #include <asm/io.h>
 
@@ -28,7 +29,6 @@
 #define IRQ_RIO_TX(m)		(((struct rio_priv *)(m->priv))->txirq)
 #define IRQ_RIO_RX(m)		(((struct rio_priv *)(m->priv))->rxirq)
 
-#define RIO_REGS_BASE		(CCSRBAR + 0xc0000)
 #define RIO_ATMU_REGS_OFFSET	0x10c00
 #define RIO_MSG_REGS_OFFSET	0x11000
 #define RIO_MAINT_WIN_SIZE	0x400000
@@ -908,19 +908,57 @@ __setup("riohdid=", fsl_rio_get_cmdline);
 
 /**
  * fsl_rio_setup - Setup MPC85xx RapidIO interface
- * @law_start: Starting physical address of RapidIO LAW
- * @law_size: Size of RapidIO LAW
+ * @fsl_rio_setup - Setup Freescale PowerPC RapidIO interface
  *
  * Initializes MPC85xx RapidIO hardware interface, configures
  * master port with system-specific info, and registers the
  * master port with the RapidIO subsystem.
  */
-void fsl_rio_setup(int law_start, int law_size)
+int fsl_rio_setup(struct of_device *dev)
 {
 	struct rio_ops *ops;
 	struct rio_mport *port;
-	struct rio_priv *priv = NULL;
-	int rc;
+	struct rio_priv *priv;
+	int rc = 0;
+	const u32 *dt_range;
+	struct resource regs;
+	int rlen;
+	u64 law_start, law_size;
+	int paw, aw, sw;
+
+	if (!dev->node) {
+		dev_err(&dev->dev, "Device OF-Node is NULL");
+		return -EFAULT;
+	}
+
+	rc = of_address_to_resource(dev->node, 0, &regs);
+	if (rc) {
+		dev_err(&dev->dev, "Can't get %s property 'reg'\n",
+				dev->node->full_name);
+		return -EFAULT;
+	}
+	dev_info(&dev->dev, "Of-device full name %s\n", dev->node->full_name);
+	dev_info(&dev->dev, "Regs start 0x%08x size 0x%08x\n",	regs.start,
+						regs.end - regs.start + 1);
+
+	dt_range = of_get_property(dev->node, "ranges", &rlen);
+	if (!dt_range) {
+		dev_err(&dev->dev, "Can't get %s property 'ranges'\n",
+				dev->node->full_name);
+		return -EFAULT;
+	}
+
+	/* Get node address wide */
+	aw = *(u32 *)of_get_property(dev->node, "#address-cells", NULL);
+	sw = *(u32 *)of_get_property(dev->node, "#size-cells", NULL);
+	/* Get parent address wide and size wide */
+	paw = of_n_addr_cells(dev->node);
+
+	law_start = of_read_number(dt_range + aw, paw);
+	law_size = of_read_number(dt_range + aw + paw, sw);
+
+	dev_info(&dev->dev, "LAW start 0x%016llx, size 0x%016llx.\n",
+			law_start, law_size);
 
 	ops = kmalloc(sizeof(struct rio_ops), GFP_KERNEL);
 	ops->lcread = fsl_local_config_read;
@@ -945,6 +983,12 @@ void fsl_rio_setup(int law_start, int law_size)
 	port->iores.end = law_start + law_size;
 	port->iores.flags = IORESOURCE_MEM;
 
+	priv->bellirq = irq_of_parse_and_map(dev->node, 2);
+	priv->txirq = irq_of_parse_and_map(dev->node, 3);
+	priv->rxirq = irq_of_parse_and_map(dev->node, 4);
+	dev_info(&dev->dev, "bellirq: %d, txirq: %d, rxirq %d\n", priv->bellirq,
+				priv->txirq, priv->rxirq);
+
 	rio_init_dbell_res(&port->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff);
 	rio_init_mbox_res(&port->riores[RIO_INB_MBOX_RESOURCE], 0, 0);
 	rio_init_mbox_res(&port->riores[RIO_OUTB_MBOX_RESOURCE], 0, 0);
@@ -956,7 +1000,7 @@ void fsl_rio_setup(int law_start, int law_size)
 	port->priv = priv;
 	rio_register_mport(port);
 
-	priv->regs_win = (u32) ioremap(RIO_REGS_BASE, 0x20000);
+	priv->regs_win = (u32) ioremap(regs.start, regs.end - regs.start + 1);
 	priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win
 					+ RIO_ATMU_REGS_OFFSET);
 	priv->maint_atmu_regs = priv->atmu_regs + 1;
@@ -974,10 +1018,51 @@ void fsl_rio_setup(int law_start, int law_size)
 	out_be32(&priv->dbell_atmu_regs->rowar, 0x8004200b);
 	fsl_rio_doorbell_init(port);
 
-	return;
+	return 0;
 err:
 	if (priv)
 		iounmap(priv->regs_win);
+	kfree(ops);
 	kfree(priv);
 	kfree(port);
+	return rc;
 }
+
+/* The probe function for RapidIO peer-to-peer network.
+ */
+static int __devinit fsl_of_rio_rpn_probe(struct of_device *dev,
+				     const struct of_device_id *match)
+{
+	int rc;
+	printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n",
+			dev->node->full_name);
+
+	rc = fsl_rio_setup(dev);
+	if (rc)
+		goto out;
+
+	/* Enumerate all registered ports */
+	rc = rio_init_mports();
+out:
+	return rc;
+};
+
+static struct of_device_id fsl_of_rio_rpn_ids[] = {
+	{
+		.compatible = "fsl,rapidio-delta",
+	},
+	{},
+};
+
+static struct of_platform_driver fsl_of_rio_rpn_driver = {
+	.name = "fsl-of-rio",
+	.match_table = fsl_of_rio_rpn_ids,
+	.probe = fsl_of_rio_rpn_probe,
+};
+
+static __init int fsl_of_rio_rpn_init(void)
+{
+	return of_register_platform_driver(&fsl_of_rio_rpn_driver);
+}
+
+subsys_initcall(fsl_of_rio_rpn_init);
diff --git a/arch/powerpc/sysdev/fsl_rio.h b/arch/powerpc/sysdev/fsl_rio.h
deleted file mode 100644
index 6d3ff30..0000000
--- a/arch/powerpc/sysdev/fsl_rio.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * MPC85xx RapidIO definitions
- *
- * Copyright 2005 MontaVista Software, Inc.
- * Matt Porter <mporter@kernel.crashing.org>
- *
- * 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.
- */
-
-#ifndef __PPC_SYSLIB_PPC85XX_RIO_H
-#define __PPC_SYSLIB_PPC85XX_RIO_H
-
-#include <linux/init.h>
-
-extern void mpc85xx_rio_setup(int law_start, int law_size);
-
-#endif				/* __PPC_SYSLIB_PPC85XX_RIO_H */
-- 
1.5.2

^ permalink raw reply related

* [PATCH 1/6] Change RIO function mpc85xx_ to fsl_ .
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel

The driver is also fit for Freescale MPC8641 processor.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/sysdev/fsl_rio.c |   80 ++++++++++++++++++++--------------------
 1 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index af2425e..36c4be4 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1,5 +1,5 @@
 /*
- * MPC85xx RapidIO support
+ * Freescale MPC85xx/MPC86xx RapidIO support
  *
  * Copyright 2005 MontaVista Software, Inc.
  * Matt Porter <mporter@kernel.crashing.org>
@@ -145,7 +145,7 @@ static struct rio_msg_rx_ring {
 } msg_rx_ring;
 
 /**
- * mpc85xx_rio_doorbell_send - Send a MPC85xx doorbell message
+ * fsl_rio_doorbell_send - Send a MPC85xx doorbell message
  * @index: ID of RapidIO interface
  * @destid: Destination ID of target device
  * @data: 16-bit info field of RapidIO doorbell message
@@ -153,9 +153,9 @@ static struct rio_msg_rx_ring {
  * Sends a MPC85xx doorbell message. Returns %0 on success or
  * %-EINVAL on failure.
  */
-static int mpc85xx_rio_doorbell_send(int index, u16 destid, u16 data)
+static int fsl_rio_doorbell_send(int index, u16 destid, u16 data)
 {
-	pr_debug("mpc85xx_doorbell_send: index %d destid %4.4x data %4.4x\n",
+	pr_debug("fsl_doorbell_send: index %d destid %4.4x data %4.4x\n",
 		 index, destid, data);
 	out_be32((void *)&dbell_atmu_regs->rowtar, destid << 22);
 	out_be16((void *)(dbell_win), data);
@@ -164,7 +164,7 @@ static int mpc85xx_rio_doorbell_send(int index, u16 destid, u16 data)
 }
 
 /**
- * mpc85xx_local_config_read - Generate a MPC85xx local config space read
+ * fsl_local_config_read - Generate a MPC85xx local config space read
  * @index: ID of RapdiIO interface
  * @offset: Offset into configuration space
  * @len: Length (in bytes) of the maintenance transaction
@@ -173,9 +173,9 @@ static int mpc85xx_rio_doorbell_send(int index, u16 destid, u16 data)
  * Generates a MPC85xx local configuration space read. Returns %0 on
  * success or %-EINVAL on failure.
  */
-static int mpc85xx_local_config_read(int index, u32 offset, int len, u32 * data)
+static int fsl_local_config_read(int index, u32 offset, int len, u32 * data)
 {
-	pr_debug("mpc85xx_local_config_read: index %d offset %8.8x\n", index,
+	pr_debug("fsl_local_config_read: index %d offset %8.8x\n", index,
 		 offset);
 	*data = in_be32((void *)(regs_win + offset));
 
@@ -183,7 +183,7 @@ static int mpc85xx_local_config_read(int index, u32 offset, int len, u32 * data)
 }
 
 /**
- * mpc85xx_local_config_write - Generate a MPC85xx local config space write
+ * fsl_local_config_write - Generate a MPC85xx local config space write
  * @index: ID of RapdiIO interface
  * @offset: Offset into configuration space
  * @len: Length (in bytes) of the maintenance transaction
@@ -192,10 +192,10 @@ static int mpc85xx_local_config_read(int index, u32 offset, int len, u32 * data)
  * Generates a MPC85xx local configuration space write. Returns %0 on
  * success or %-EINVAL on failure.
  */
-static int mpc85xx_local_config_write(int index, u32 offset, int len, u32 data)
+static int fsl_local_config_write(int index, u32 offset, int len, u32 data)
 {
 	pr_debug
-	    ("mpc85xx_local_config_write: index %d offset %8.8x data %8.8x\n",
+	    ("fsl_local_config_write: index %d offset %8.8x data %8.8x\n",
 	     index, offset, data);
 	out_be32((void *)(regs_win + offset), data);
 
@@ -203,7 +203,7 @@ static int mpc85xx_local_config_write(int index, u32 offset, int len, u32 data)
 }
 
 /**
- * mpc85xx_rio_config_read - Generate a MPC85xx read maintenance transaction
+ * fsl_rio_config_read - Generate a MPC85xx read maintenance transaction
  * @index: ID of RapdiIO interface
  * @destid: Destination ID of transaction
  * @hopcount: Number of hops to target device
@@ -215,13 +215,13 @@ static int mpc85xx_local_config_write(int index, u32 offset, int len, u32 data)
  * success or %-EINVAL on failure.
  */
 static int
-mpc85xx_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
+fsl_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
 			u32 * val)
 {
 	u8 *data;
 
 	pr_debug
-	    ("mpc85xx_rio_config_read: index %d destid %d hopcount %d offset %8.8x len %d\n",
+	    ("fsl_rio_config_read: index %d destid %d hopcount %d offset %8.8x len %d\n",
 	     index, destid, hopcount, offset, len);
 	out_be32((void *)&maint_atmu_regs->rowtar,
 		 (destid << 22) | (hopcount << 12) | ((offset & ~0x3) >> 9));
@@ -243,7 +243,7 @@ mpc85xx_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
 }
 
 /**
- * mpc85xx_rio_config_write - Generate a MPC85xx write maintenance transaction
+ * fsl_rio_config_write - Generate a MPC85xx write maintenance transaction
  * @index: ID of RapdiIO interface
  * @destid: Destination ID of transaction
  * @hopcount: Number of hops to target device
@@ -255,12 +255,12 @@ mpc85xx_rio_config_read(int index, u16 destid, u8 hopcount, u32 offset, int len,
  * success or %-EINVAL on failure.
  */
 static int
-mpc85xx_rio_config_write(int index, u16 destid, u8 hopcount, u32 offset,
+fsl_rio_config_write(int index, u16 destid, u8 hopcount, u32 offset,
 			 int len, u32 val)
 {
 	u8 *data;
 	pr_debug
-	    ("mpc85xx_rio_config_write: index %d destid %d hopcount %d offset %8.8x len %d val %8.8x\n",
+	    ("fsl_rio_config_write: index %d destid %d hopcount %d offset %8.8x len %d val %8.8x\n",
 	     index, destid, hopcount, offset, len, val);
 	out_be32((void *)&maint_atmu_regs->rowtar,
 		 (destid << 22) | (hopcount << 12) | ((offset & ~0x3) >> 9));
@@ -344,7 +344,7 @@ rio_hw_add_outb_message(struct rio_mport *mport, struct rio_dev *rdev, int mbox,
 EXPORT_SYMBOL_GPL(rio_hw_add_outb_message);
 
 /**
- * mpc85xx_rio_tx_handler - MPC85xx outbound message interrupt handler
+ * fsl_rio_tx_handler - MPC85xx outbound message interrupt handler
  * @irq: Linux interrupt number
  * @dev_instance: Pointer to interrupt-specific data
  *
@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(rio_hw_add_outb_message);
  * mailbox event handler and acks the interrupt occurrence.
  */
 static irqreturn_t
-mpc85xx_rio_tx_handler(int irq, void *dev_instance)
+fsl_rio_tx_handler(int irq, void *dev_instance)
 {
 	int osr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
@@ -452,7 +452,7 @@ int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entr
 
 	/* Hook up outbound message handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_TX, mpc85xx_rio_tx_handler, 0,
+	     request_irq(MPC85xx_IRQ_RIO_TX, fsl_rio_tx_handler, 0,
 			 "msg_tx", (void *)mport)) < 0)
 		goto out_irq;
 
@@ -511,7 +511,7 @@ void rio_close_outb_mbox(struct rio_mport *mport, int mbox)
 }
 
 /**
- * mpc85xx_rio_rx_handler - MPC85xx inbound message interrupt handler
+ * fsl_rio_rx_handler - MPC85xx inbound message interrupt handler
  * @irq: Linux interrupt number
  * @dev_instance: Pointer to interrupt-specific data
  *
@@ -519,7 +519,7 @@ void rio_close_outb_mbox(struct rio_mport *mport, int mbox)
  * mailbox event handler and acks the interrupt occurrence.
  */
 static irqreturn_t
-mpc85xx_rio_rx_handler(int irq, void *dev_instance)
+fsl_rio_rx_handler(int irq, void *dev_instance)
 {
 	int isr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
@@ -597,7 +597,7 @@ int rio_open_inb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entri
 
 	/* Hook up inbound message handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_RX, mpc85xx_rio_rx_handler, 0,
+	     request_irq(MPC85xx_IRQ_RIO_RX, fsl_rio_rx_handler, 0,
 			 "msg_rx", (void *)mport)) < 0) {
 		dma_free_coherent(NULL, RIO_MSG_BUFFER_SIZE,
 				  msg_tx_ring.virt_buffer[i],
@@ -729,7 +729,7 @@ void *rio_hw_get_inb_message(struct rio_mport *mport, int mbox)
 EXPORT_SYMBOL_GPL(rio_hw_get_inb_message);
 
 /**
- * mpc85xx_rio_dbell_handler - MPC85xx doorbell interrupt handler
+ * fsl_rio_dbell_handler - MPC85xx doorbell interrupt handler
  * @irq: Linux interrupt number
  * @dev_instance: Pointer to interrupt-specific data
  *
@@ -737,7 +737,7 @@ EXPORT_SYMBOL_GPL(rio_hw_get_inb_message);
  * doorbell event handlers and executes a matching event handler.
  */
 static irqreturn_t
-mpc85xx_rio_dbell_handler(int irq, void *dev_instance)
+fsl_rio_dbell_handler(int irq, void *dev_instance)
 {
 	int dsr;
 	struct rio_mport *port = (struct rio_mport *)dev_instance;
@@ -794,14 +794,14 @@ mpc85xx_rio_dbell_handler(int irq, void *dev_instance)
 }
 
 /**
- * mpc85xx_rio_doorbell_init - MPC85xx doorbell interface init
+ * fsl_rio_doorbell_init - MPC85xx doorbell interface init
  * @mport: Master port implementing the inbound doorbell unit
  *
  * Initializes doorbell unit hardware and inbound DMA buffer
- * ring. Called from mpc85xx_rio_setup(). Returns %0 on success
+ * ring. Called from fsl_rio_setup(). Returns %0 on success
  * or %-ENOMEM on failure.
  */
-static int mpc85xx_rio_doorbell_init(struct rio_mport *mport)
+static int fsl_rio_doorbell_init(struct rio_mport *mport)
 {
 	int rc = 0;
 
@@ -835,7 +835,7 @@ static int mpc85xx_rio_doorbell_init(struct rio_mport *mport)
 
 	/* Hook up doorbell handler */
 	if ((rc =
-	     request_irq(MPC85xx_IRQ_RIO_BELL, mpc85xx_rio_dbell_handler, 0,
+	     request_irq(MPC85xx_IRQ_RIO_BELL, fsl_rio_dbell_handler, 0,
 			 "dbell_rx", (void *)mport) < 0)) {
 		iounmap((void *)dbell_win);
 		dma_free_coherent(NULL, 512 * DOORBELL_MESSAGE_SIZE,
@@ -854,7 +854,7 @@ static int mpc85xx_rio_doorbell_init(struct rio_mport *mport)
 
 static char *cmdline = NULL;
 
-static int mpc85xx_rio_get_hdid(int index)
+static int fsl_rio_get_hdid(int index)
 {
 	/* XXX Need to parse multiple entries in some format */
 	if (!cmdline)
@@ -863,7 +863,7 @@ static int mpc85xx_rio_get_hdid(int index)
 	return simple_strtol(cmdline, NULL, 0);
 }
 
-static int mpc85xx_rio_get_cmdline(char *s)
+static int fsl_rio_get_cmdline(char *s)
 {
 	if (!s)
 		return 0;
@@ -872,10 +872,10 @@ static int mpc85xx_rio_get_cmdline(char *s)
 	return 1;
 }
 
-__setup("riohdid=", mpc85xx_rio_get_cmdline);
+__setup("riohdid=", fsl_rio_get_cmdline);
 
 /**
- * mpc85xx_rio_setup - Setup MPC85xx RapidIO interface
+ * fsl_rio_setup - Setup MPC85xx RapidIO interface
  * @law_start: Starting physical address of RapidIO LAW
  * @law_size: Size of RapidIO LAW
  *
@@ -883,17 +883,17 @@ __setup("riohdid=", mpc85xx_rio_get_cmdline);
  * master port with system-specific info, and registers the
  * master port with the RapidIO subsystem.
  */
-void mpc85xx_rio_setup(int law_start, int law_size)
+void fsl_rio_setup(int law_start, int law_size)
 {
 	struct rio_ops *ops;
 	struct rio_mport *port;
 
 	ops = kmalloc(sizeof(struct rio_ops), GFP_KERNEL);
-	ops->lcread = mpc85xx_local_config_read;
-	ops->lcwrite = mpc85xx_local_config_write;
-	ops->cread = mpc85xx_rio_config_read;
-	ops->cwrite = mpc85xx_rio_config_write;
-	ops->dsend = mpc85xx_rio_doorbell_send;
+	ops->lcread = fsl_local_config_read;
+	ops->lcwrite = fsl_local_config_write;
+	ops->cread = fsl_rio_config_read;
+	ops->cwrite = fsl_rio_config_write;
+	ops->dsend = fsl_rio_doorbell_send;
 
 	port = kmalloc(sizeof(struct rio_mport), GFP_KERNEL);
 	port->id = 0;
@@ -909,7 +909,7 @@ void mpc85xx_rio_setup(int law_start, int law_size)
 	strcpy(port->name, "RIO0 mport");
 
 	port->ops = ops;
-	port->host_deviceid = mpc85xx_rio_get_hdid(port->id);
+	port->host_deviceid = fsl_rio_get_hdid(port->id);
 
 	rio_register_mport(port);
 
@@ -928,5 +928,5 @@ void mpc85xx_rio_setup(int law_start, int law_size)
 	/* Configure outbound doorbell window */
 	out_be32((void *)&dbell_atmu_regs->rowbar, 0x000c0400);
 	out_be32((void *)&dbell_atmu_regs->rowar, 0x8004200b);
-	mpc85xx_rio_doorbell_init(port);
+	fsl_rio_doorbell_init(port);
 }
-- 
1.5.2

^ permalink raw reply related

* [PATCH 6/6] Change the kernel configurated RapidIO system size to auto-probing.
From: Zhang Wei @ 2008-01-30 10:30 UTC (permalink / raw)
  To: mporter, galak; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <12016890832943-git-send-email-wei.zhang@freescale.com>

The RapidIO system size will auto probe in RIO setup. The route
table and rionet_active in rionet.c are changed to be allocated
dynamically according the system size.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 arch/powerpc/sysdev/fsl_rio.c |    6 +++++
 drivers/net/rionet.c          |   16 +++++++++++-
 drivers/rapidio/Kconfig       |    8 ------
 drivers/rapidio/rio-scan.c    |   51 +++++++++++++++++++++++++++++------------
 drivers/rapidio/rio-sysfs.c   |    3 +-
 drivers/rapidio/rio.c         |    2 +-
 drivers/rapidio/rio.h         |    9 +-----
 include/linux/rio.h           |   14 +++++-----
 8 files changed, 68 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 36b43ec..4877203 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1001,6 +1001,12 @@ int fsl_rio_setup(struct of_device *dev)
 	rio_register_mport(port);
 
 	priv->regs_win = (u32) ioremap(regs.start, regs.end - regs.start + 1);
+
+	port->sys_size = (in_be32((priv->regs_win + RIO_PEF_CAR))
+					& RIO_PEF_CTLS) >> 4;
+	dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n",
+			port->sys_size ? 65536 : 256);
+
 	priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win
 					+ RIO_ATMU_REGS_OFFSET);
 	priv->maint_atmu_regs = priv->atmu_regs + 1;
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index e7fd08a..f2c103b 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -77,7 +77,7 @@ static int rionet_capable = 1;
  * could be made into a hash table to save memory depending
  * on system trade-offs.
  */
-static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES];
+static struct rio_dev **rionet_active;
 
 #define is_rionet_capable(pef, src_ops, dst_ops)		\
 			((pef & RIO_PEF_INB_MBOX) &&		\
@@ -195,7 +195,8 @@ static int rionet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	}
 
 	if (eth->h_dest[0] & 0x01) {
-		for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++)
+		for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rnet->mport->syssize);
+				i++)
 			if (rionet_active[i])
 				rionet_queue_tx_msg(skb, ndev,
 						    rionet_active[i]);
@@ -385,6 +386,8 @@ static void rionet_remove(struct rio_dev *rdev)
 	struct net_device *ndev = NULL;
 	struct rionet_peer *peer, *tmp;
 
+	free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ?
+					__ilog2(sizeof(void *)) + 4 : 0);
 	unregister_netdev(ndev);
 	kfree(ndev);
 
@@ -443,6 +446,15 @@ static int rionet_setup_netdev(struct rio_mport *mport)
 		goto out;
 	}
 
+	if (!(rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL,
+				mport->sys_size ? __ilog2(sizeof(void *)) + 4
+				: 0))) {
+		rc = -ENOMEM;
+		goto out;
+	}
+	memset((void *)rionet_active, 0, sizeof(void *) *
+				RIO_MAX_ROUTE_ENTRIES(mport->sys_size));
+
 	/* Set up private area */
 	rnet = (struct rionet_private *)ndev->priv;
 	rnet->mport = mport;
diff --git a/drivers/rapidio/Kconfig b/drivers/rapidio/Kconfig
index 4142115..c32822a 100644
--- a/drivers/rapidio/Kconfig
+++ b/drivers/rapidio/Kconfig
@@ -1,14 +1,6 @@
 #
 # RapidIO configuration
 #
-config RAPIDIO_8_BIT_TRANSPORT
-	bool "8-bit transport addressing"
-	depends on RAPIDIO
-	---help---
-	  By default, the kernel assumes a 16-bit addressed RapidIO
-	  network. By selecting this option, the kernel will support
-	  an 8-bit addressed network.
-
 config RAPIDIO_DISC_TIMEOUT
 	int "Discovery timeout duration (seconds)"
 	depends on RAPIDIO
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 4442072..ca895d1 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -73,7 +73,7 @@ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
 
 	rio_mport_read_config_32(port, destid, hopcount, RIO_DID_CSR, &result);
 
-	return RIO_GET_DID(result);
+	return RIO_GET_DID(port->sys_size, result);
 }
 
 /**
@@ -88,7 +88,7 @@ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
 static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u16 did)
 {
 	rio_mport_write_config_32(port, destid, hopcount, RIO_DID_CSR,
-				  RIO_SET_DID(did));
+				  RIO_SET_DID(port->sys_size, did));
 }
 
 /**
@@ -100,7 +100,8 @@ static void rio_set_device_id(struct rio_mport *port, u16 destid, u8 hopcount, u
  */
 static void rio_local_set_device_id(struct rio_mport *port, u16 did)
 {
-	rio_local_write_config_32(port, RIO_DID_CSR, RIO_SET_DID(did));
+	rio_local_write_config_32(port, RIO_DID_CSR, RIO_SET_DID(port->sys_size,
+				did));
 }
 
 /**
@@ -350,8 +351,17 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
 		rswitch->switchid = next_switchid;
 		rswitch->hopcount = hopcount;
 		rswitch->destid = destid;
+		if (!(rswitch->route_table = kzalloc(sizeof(u8)*
+					RIO_MAX_ROUTE_ENTRIES(port->sys_size),
+					GFP_KERNEL))) {
+			kfree(rdev);
+			rdev = NULL;
+			kfree(rswitch);
+			goto out;
+		}
 		/* Initialize switch route table */
-		for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES; rdid++)
+		for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES(port->sys_size);
+				rdid++)
 			rswitch->route_table[rdid] = RIO_INVALID_ROUTE;
 		rdev->rswitch = rswitch;
 		sprintf(rio_name(rdev), "%02x:s:%04x", rdev->net->id,
@@ -480,7 +490,7 @@ static u16 rio_get_host_deviceid_lock(struct rio_mport *port, u8 hopcount)
 {
 	u32 result;
 
-	rio_mport_read_config_32(port, RIO_ANY_DESTID, hopcount,
+	rio_mport_read_config_32(port, RIO_ANY_DESTID(port->sys_size), hopcount,
 				 RIO_HOST_DID_LOCK_CSR, &result);
 
 	return (u16) (result & 0xffff);
@@ -571,14 +581,16 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 	}
 
 	/* Attempt to acquire device lock */
-	rio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount,
+	rio_mport_write_config_32(port, RIO_ANY_DESTID(port->sys_size),
+				  hopcount,
 				  RIO_HOST_DID_LOCK_CSR, port->host_deviceid);
 	while ((tmp = rio_get_host_deviceid_lock(port, hopcount))
 	       < port->host_deviceid) {
 		/* Delay a bit */
 		mdelay(1);
 		/* Attempt to acquire device lock again */
-		rio_mport_write_config_32(port, RIO_ANY_DESTID, hopcount,
+		rio_mport_write_config_32(port, RIO_ANY_DESTID(port->sys_size),
+					  hopcount,
 					  RIO_HOST_DID_LOCK_CSR,
 					  port->host_deviceid);
 	}
@@ -590,7 +602,8 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 	}
 
 	/* Setup new RIO device */
-	if ((rdev = rio_setup_device(net, port, RIO_ANY_DESTID, hopcount, 1))) {
+	if ((rdev = rio_setup_device(net, port, RIO_ANY_DESTID(port->sys_size),
+					hopcount, 1))) {
 		/* Add device to the global and bus/net specific list. */
 		list_add_tail(&rdev->net_list, &net->devices);
 	} else
@@ -598,7 +611,8 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 
 	if (rio_is_switch(rdev)) {
 		next_switchid++;
-		sw_inport = rio_get_swpinfo_inport(port, RIO_ANY_DESTID, hopcount);
+		sw_inport = rio_get_swpinfo_inport(port,
+				RIO_ANY_DESTID(port->sys_size), hopcount);
 		rio_route_add_entry(port, rdev->rswitch, RIO_GLOBAL_TABLE,
 				    port->host_deviceid, sw_inport);
 		rdev->rswitch->route_table[port->host_deviceid] = sw_inport;
@@ -612,7 +626,8 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 		}
 
 		num_ports =
-		    rio_get_swpinfo_tports(port, RIO_ANY_DESTID, hopcount);
+		    rio_get_swpinfo_tports(port, RIO_ANY_DESTID(port->sys_size),
+						hopcount);
 		pr_debug(
 		    "RIO: found %s (vid %4.4x did %4.4x) with %d ports\n",
 		    rio_name(rdev), rdev->vid, rdev->did, num_ports);
@@ -624,13 +639,15 @@ static int rio_enum_peer(struct rio_net *net, struct rio_mport *port,
 			cur_destid = next_destid;
 
 			if (rio_sport_is_active
-			    (port, RIO_ANY_DESTID, hopcount, port_num)) {
+			    (port, RIO_ANY_DESTID(port->sys_size), hopcount,
+			     port_num)) {
 				pr_debug(
 				    "RIO: scanning device on port %d\n",
 				    port_num);
 				rio_route_add_entry(port, rdev->rswitch,
 						    RIO_GLOBAL_TABLE,
-						    RIO_ANY_DESTID, port_num);
+						    RIO_ANY_DESTID(port->sys_size),
+						    port_num);
 
 				if (rio_enum_peer(net, port, hopcount + 1) < 0)
 					return -1;
@@ -735,7 +752,8 @@ rio_disc_peer(struct rio_net *net, struct rio_mport *port, u16 destid,
 				pr_debug(
 				    "RIO: scanning device on port %d\n",
 				    port_num);
-				for (ndestid = 0; ndestid < RIO_ANY_DESTID;
+				for (ndestid = 0;
+				     ndestid < RIO_ANY_DESTID(port->sys_size);
 				     ndestid++) {
 					rio_route_get_entry(port, rdev->rswitch,
 							    RIO_GLOBAL_TABLE,
@@ -917,7 +935,9 @@ static void rio_build_route_tables(void)
 
 	list_for_each_entry(rdev, &rio_devices, global_list)
 	    if (rio_is_switch(rdev))
-		for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {
+		for (i = 0;
+		     i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size);
+		     i++) {
 			if (rio_route_get_entry
 			    (rdev->net->hport, rdev->rswitch, RIO_GLOBAL_TABLE,
 			     i, &sport) < 0)
@@ -981,7 +1001,8 @@ int rio_disc_mport(struct rio_mport *mport)
 		del_timer_sync(&rio_enum_timer);
 
 		pr_debug("done\n");
-		if (rio_disc_peer(net, mport, RIO_ANY_DESTID, 0) < 0) {
+		if (rio_disc_peer(net, mport, RIO_ANY_DESTID(mport->sys_size),
+					0) < 0) {
 			printk(KERN_INFO
 			       "RIO: master port %d device has failed discovery\n",
 			       mport->id);
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 659e311..97a147f 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -43,7 +43,8 @@ static ssize_t routes_show(struct device *dev, struct device_attribute *attr, ch
 	if (!rdev->rswitch)
 		goto out;
 
-	for (i = 0; i < RIO_MAX_ROUTE_ENTRIES; i++) {
+	for (i = 0; i < RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size);
+			i++) {
 		if (rdev->rswitch->route_table[i] == RIO_INVALID_ROUTE)
 			continue;
 		str +=
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 80c5f1b..680661a 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -43,7 +43,7 @@ u16 rio_local_get_device_id(struct rio_mport *port)
 
 	rio_local_read_config_32(port, RIO_DID_CSR, &result);
 
-	return (RIO_GET_DID(result));
+	return (RIO_GET_DID(port->sys_size, result));
 }
 
 /**
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index b242cee..7a3b62e 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -51,10 +51,5 @@ extern struct rio_route_ops __end_rio_route_ops[];
 	DECLARE_RIO_ROUTE_SECTION(.rio_route_ops,			\
 			vid, did, add_hook, get_hook)
 
-#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT
-#define RIO_GET_DID(x)	((x & 0x00ff0000) >> 16)
-#define RIO_SET_DID(x)	((x & 0x000000ff) << 16)
-#else
-#define RIO_GET_DID(x)	(x & 0xffff)
-#define RIO_SET_DID(x)	(x & 0xffff)
-#endif
+#define RIO_GET_DID(size, x)	(size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))
+#define RIO_SET_DID(size, x)	(size ? (x & 0xffff) : ((x & 0x000000ff) << 16))
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 9ed78dc..4b0156d 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -23,7 +23,6 @@
 #include <linux/device.h>
 #include <linux/rio_regs.h>
 
-#define RIO_ANY_DESTID		0xff
 #define RIO_NO_HOPCOUNT		-1
 #define RIO_INVALID_DESTID	0xffff
 
@@ -39,11 +38,8 @@
 					   entry is invalid (no route
 					   exists for the device ID) */
 
-#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT
-#define RIO_MAX_ROUTE_ENTRIES	(1 << 8)
-#else
-#define RIO_MAX_ROUTE_ENTRIES	(1 << 16)
-#endif
+#define RIO_MAX_ROUTE_ENTRIES(size)	(size ? (1 << 16) : (1 << 8))
+#define RIO_ANY_DESTID(size)		(size ? 0xffff : 0xff)
 
 #define RIO_MAX_MBOX		4
 #define RIO_MAX_MSG_SIZE	0x1000
@@ -178,6 +174,10 @@ struct rio_mport {
 	unsigned char id;	/* port ID, unique among all ports */
 	unsigned char index;	/* port index, unique among all port
 				   interfaces of the same type */
+	unsigned int sys_size;	/* RapidIO common transport system size.
+				 * 0 - Small size. 256 devices.
+				 * 1 - Large size, 65536 devices.
+				 */
 	unsigned char name[40];
 	void *priv;		/* Master port private data */
 };
@@ -213,7 +213,7 @@ struct rio_switch {
 	u16 switchid;
 	u16 hopcount;
 	u16 destid;
-	u8 route_table[RIO_MAX_ROUTE_ENTRIES];
+	u8 *route_table;
 	int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
 			  u16 table, u16 route_destid, u8 route_port);
 	int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
-- 
1.5.2

^ permalink raw reply related

* Re: linux @ xup
From: greenlean @ 2008-01-30 11:10 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <568740669@web.de>


Hi, 

You should set the Software/Software Platforms Settings/Os and Libraries/
UART16550 bus clock freq to the Bus Speed to 100000000 usually, this is the
OPB bus speed. And in Core_Clock_Frequency you insert the PLB bus speed.

You don't have to edit manually the file xparameters_ml300.h. 

If your are using Grant's kernel, from secretlab git, you should name the
file xparameters_ml300.h.
If your using the xilinx kernel you could change the name of the file and
use xparameters_xupv2p.h but you have to select this platform in the kernel
configuration...

I don't know if your asking for this, but I wish it could help.

Bye.


Joachim Meyer wrote:
> 
> Hi
> 
> I already succeded in setting up a Linux for the ml310. I'm trying to do
> it for the XUP Board now. The Problem I have is, that
> in every HowTo I read I should set at the EDK's software settings under
> Library/OS Parameters:
> Set PLB_CLOCK_FREQ_HZ to the PLB speed (usually 100000000)
> 
> But I can't find where to set it. With the ml310 there was this option.
> I'm using the EDK Board Definition File (.xbd), Pcores & Drivers from
> Xilinx:
> http://www.xilinx.com/univ/xupv2p.html
> EDK Version 9.1 SP2
> 
> If I ignore it and build the BSP there comes out an xparameters_ml300.h
> file which I copy to my Kernel sources.
> When I try to compile, I get errors that the PLB_CLOCK_FREQ_HZ isn't
> defined.
> Can I just add it to the xparameters_ml300.h file file (which I rename
> "xparameters_xupv2p.h") by Hand?
> 
> Greez and thx
> Joachim
> _________________________________________________________________________
> In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
> Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 
> 

-- 
View this message in context: http://www.nabble.com/linux-%40-xup-tp15179005p15179875.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* rootfs problem kernel 2.6 XUPV2P
From: greenlean @ 2008-01-30 13:34 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all, I'm having some problems with the rootfs:

If I use an initial ram disk, such as the initramfs  from ELDK4.1 to build
an zImage.ielf file, I've got this log:
It looks like no image have been loaded!!!  I have supplied a directory,
where I''ve mounted the EDLK ramdisk image, to the kernel and let him to
build the ramdisk (to avoid mistakes):

loaded at:     00400000 006691A0                                           =
    =20
board data at: 00667124 006671A0                                           =
    =20
relocated to:  004040A8 00404124                  <-- I think that here
should be line showing the direction where the                             =
 =20
zimage at:     00404E99 00666C26                         RAMDISK have been
loaded, I've seen it on other boot logs!!!
avail ram:     0066A000 0F424000                                           =
    =20
                                                                           =
    =20
Linux/PPC load: console=3DttyS0,9600 root=3D/dev/ram0 rw                   =
        =20
Uncompressing Linux...done.                                                =
    =20
Now booting the kernel                                                     =
    =20
[    0.000000] Linux version 2.6.23-rc9-dirty (jmgomez@jmgomez-laptop) (gcc
ver8
[    0.000000] Xilinx ML300 Reference System (Virtex-II Pro)               =
    =20
[    0.000000] Zone PFN ranges:                                            =
    =20
[    0.000000]   DMA             0 ->    62500                             =
    =20
[    0.000000]   Normal      62500 ->    62500                             =
    =20
[    0.000000] Movable zone start PFN for each node                        =
    =20
[    0.000000] early_node_map[1] active PFN ranges                         =
    =20
[    0.000000]     0:        0 ->    62500                                 =
    =20
[    0.000000] Built 1 zonelists in Zone order.  Total pages: 62012        =
    =20
[    0.000000] Kernel command line: console=3DttyS0,9600 root=3D/dev/ram0 r=
w       =20
[    0.000000] Xilinx INTC #0 at 0x41200000 mapped to 0xFDFFE000           =
    =20
[    0.000000] PID hash table entries: 1024 (order: 10, 4096 bytes)        =
    =20
[    0.000349] Console: colour dummy device 80x25                          =
    =20
[    0.004726] Dentry cache hash table entries: 32768 (order: 5, 131072
bytes) =20
[    0.010854] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes=
)   =20
[    0.117251] Memory: 244224k available (1424k kernel code, 480k data,
1640k i)
[    0.304888] Mount-cache hash table entries: 512                         =
    =20
[    0.315611] NET: Registered protocol family 16                          =
    =20
[    0.370262] NET: Registered protocol family 2                           =
    =20
[    0.436663] IP route cache hash table entries: 2048 (order: 1, 8192
bytes)  =20
[    0.438058] TCP established hash table entries: 8192 (order: 4, 65536
bytes)=20
[    0.440252] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)   =
    =20
[    0.441291] TCP: Hash tables configured (established 8192 bind 8192)    =
    =20
[    0.441332] TCP reno registered                                         =
    =20
[    1.545621] io scheduler noop registered                                =
    =20
[    1.545703] io scheduler anticipatory registered (default)              =
    =20
[    1.545740] io scheduler deadline registered                            =
    =20
[    1.545963] io scheduler cfq registered                                 =
    =20
[    1.657974] Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ
sharingd
[    1.668865] serial8250.0: ttyS0 at MMIO 0x40401003 (irq =3D 2) is a 1655=
0A    =20
[    1.670637] console [ttyS0] enabled                                     =
    =20
[    3.764034] RAMDISK driver initialized: 16 RAM disks of 65536K size 1024
bloe
[    3.857351] xsysace xsysace.0: Xilinx SystemACE revision 1.0.12         =
    =20
[    3.929487] xsysace xsysace.0: capacity: 986320 sectors                 =
    =20
[    3.992901]  xsa: unknown partition table                               =
    =20
[    4.049520] tun: Universal TUN/TAP device driver, 1.6                   =
    =20
[    4.110425] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>      =
    =20
[    4.187993] mice: PS/2 mouse device common for all mice                 =
    =20
[    4.251498] TCP cubic registered                                        =
    =20
[    4.290639] NET: Registered protocol family 1                           =
    =20
[    4.343201] NET: Registered protocol family 17                          =
    =20
[    4.400662] VFS: Cannot open root device "ram0" or unknown-block(1,0)   =
    =20
[    4.478329] Please append a correct "root=3D" boot option; here are the
availa:
[    4.578874] fe00     493160 xsa (driver?)                               =
    =20
[    4.627166] Kernel panic - not syncing: VFS: Unable to mount root fs on
unkn)
[    4.726623] Rebooting in 180 seconds..

The ramdisk have not been loaded to memory, or anything similar!!!


//**********************************************************///
Linux/PPC load: console=3DttyS0,9600 root=3D/dev/xsa3 rw           =20

I've also tried to boot from SystemACE but I've got a partition table error
( xsa: unknown partition table ).  I've reformat my CF card for some times,
and nothing have change:


The partition table must be MS-DOS, type 6 on fdisk.

That's the fdisk partition table:
Disco /dev/sdc: 521 MB, 521773056 bytes
17 cabezas, 59 sectores/pistas, 1016 cilindros
Unidades =3D cilindros de 1003 * 512 =3D 513536 bytes
Disk identifier: 0x537c213d

Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema
/dev/sdc1               1         300      150420+   6  FAT16
/dev/sdc2             301         418       59177   82  Linux swap / Solari=
s
/dev/sdc3             419        1016      299897   83  Linux


0x1B0: 00 00 00 00 00 00 00 00 3D 21 7C 53 00 00 00 01
0x1C0: 01 00 06 10 7B 2B 3B 00 00 00 29 97 04 00 00 00
0x1D0: 41 2C 82 10 7B A1 64 97 04 00 52 CE 01 00 00 00
0x1E0: 41 A2 83 10 FB F7 B6 65 06 00 F2 26 09 00 00 00
0x1F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA

That's the dump of my CF Card maybe some one could send me a dump of yours.

One of my tries, after using the CF Card in the XUPV2P, I get this message:=
=20
El dispositivo no contiene una tabla de particiones DOS v=C3=A1lida ni una
etiqueta de disco Sun o SGI o OSF
Building a new DOS disklabel with disk identifier 0x0eb5b431.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Atenci=C3=B3n: el indicador 0x0000 inv=C3=A1lido de la tabla de particiones=
 4 se
corregir=C3=A1 mediante w(rite)

But It didn't repeat anymore.. So I suppose that the CF card isn't valid fo=
r
the SystemAce of the board!! But I don't know why??

I don't know what is the problem, if anyone knows, reply please=20

Thanx

PD: Sorry for writing so large messages but I've included all the info I've
recover..
--=20
View this message in context: http://www.nabble.com/rootfs-problem-kernel-2=
.6-XUPV2P-tp15182195p15182195.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* External Interrupt
From: Marco Stornelli @ 2008-01-30 13:31 UTC (permalink / raw)
  To: LinuxPPC-Dev Mailing List

Hi all,


I used the linux kernel 2.6.10 with a processor MPC8548E. I wrote a
driver for a device connected with the local bus. This device has an
external interrupt. In the local bus driver I have used the macro
MPC85xx_IRQ_EXT<X> to get the interrupt number and pass it to the driver
and after that register the ISR. Now with a kernel 2.6.21 this macro
isn't available because in the header file irq.h there is the option
CONFIG_PPC_MERGE that disable those options. I think this problem is
related to the migration of ppc code towards powerpc. I know that now
there is the new device tree source file but I think in this file I
should describe only the platform device, and this device is not a
platform device. Then, how can I get now this value? Is there some
function to call?

Thanks in advance.

Marco

^ permalink raw reply

* [PATCH][drivers/net/fec_mpc52xx.c] duplicate NETIF_MSG_IFDOWN in MPC52xx_MESSAGES_DEFAULT
From: Roel Kluin @ 2008-01-30 14:18 UTC (permalink / raw)
  To: tnt, grant.likely; +Cc: linuxppc-dev, lkml

Untested patch below, please confirm it's the right fix.
--
duplicate NETIF_MSG_IFDOWN, 2nd should be NETIF_MSG_IFUP

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index f91ee70..ca3c3b3 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -55,7 +55,7 @@ module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, NULL, 0);
 MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe");
 
 #define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \
-		NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN )
+		NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP)
 static int debug = -1;	/* the above default */
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "debugging messages level");

^ permalink raw reply related

* Re: [PATCH 3/6] Move include/asm-ppc/rio.h to include/asm-powerpc/rio.h
From: Kumar Gala @ 2008-01-30 14:20 UTC (permalink / raw)
  To: Zhang Wei; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <120168907160-git-send-email-wei.zhang@freescale.com>


On Jan 30, 2008, at 4:30 AM, Zhang Wei wrote:

> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
> ---
> include/asm-powerpc/rio.h |   18 ++++++++++++++++++
> include/asm-ppc/rio.h     |   18 ------------------
> 2 files changed, 18 insertions(+), 18 deletions(-)
> create mode 100644 include/asm-powerpc/rio.h
> delete mode 100644 include/asm-ppc/rio.h

it seems with OF we can just git rid of this?

-k

^ permalink raw reply

* Re: PCI configuration with multiple PCI controllers
From: Kumar Gala @ 2008-01-30 14:24 UTC (permalink / raw)
  To: Laurent Lagrange; +Cc: linuxppc-dev
In-Reply-To: <000501c86282$2a5ba9e0$a501a8c0@GEGE6600V>


On Jan 29, 2008, at 8:20 AM, Laurent Lagrange wrote:

> Hello,
>
> I have a MPC8641 based board. I try to use the two PCIe controllers.  
> My
> firmware configures (physically) the PCI buses as follow:
>
> ------------------+
> MPC8641 PCIe 1	|	bus 1		+--------------+
> 			| --------------> | PCI device 0 |
> 	BUS 0		|			+--------------+
> - - - - - - - - - +
> MPC8641 PCIe 2	|	bus 3		+--------------+
> 			| --------------> | PCI device 1 |
> 	BUS 2		|			+--------------+
> ------------------+
>
> I launch the Linux image (2.6.23.9). During the Kernel PCI  
> configuration,
> buses behind the 2nd MPC8641 PCIe are skipped because its primary  
> bus don't
> start at bus number 0. The kernel reconfigure the primary bus number  
> of the
> MPC8641 PCIe 2 controller from 2 to 0.
>
> I can patch the kernel to work with my firmware but I don't know if  
> my PCI
> configuration is the good one.
>
> What is the common way to configure the PCI for Linux when a new  
> controller
> is found: start the bus number to 0 or to the last bus number + 1?

Linux now has the concept of PCI domains so each controller is a new  
domain and thus the first bus should be 0 in each domain.  (at least  
that's the "normal" way we handle things).

- k

^ permalink raw reply

* Re: [PATCH 4/6] Add multi mport support.
From: Kumar Gala @ 2008-01-30 14:27 UTC (permalink / raw)
  To: Zhang Wei; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <12016890773706-git-send-email-wei.zhang@freescale.com>


On Jan 30, 2008, at 4:30 AM, Zhang Wei wrote:

> Change lots of static variable to mport private. And add mport to some
> function declaration.

Can you explain this patch further.  Its not clear exactly from this  
commit message why we are doing this.

- k

^ permalink raw reply

* Re: [PATCH 1/6] Change RIO function mpc85xx_ to fsl_ .
From: Kumar Gala @ 2008-01-30 14:43 UTC (permalink / raw)
  To: Zhang Wei; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1201689053956-git-send-email-wei.zhang@freescale.com>

Can you post a device tree update as well.

The older patches on the list for the 86xx .dts should NOT put the rio  
node under the soc.  It should be at the same level as PCI.

- k

^ permalink raw reply

* Re: [patch v6 3/4] USB: add Cypress c67x00 OTG controller HCD driver
From: Alan Stern @ 2008-01-30 15:19 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: linuxppc-dev, dbrownell, USB list
In-Reply-To: <87r6fzd5bm.fsf@macbook.be.48ers.dk>

On Wed, 30 Jan 2008, Peter Korsgaard wrote:

>  >> +static void c67x00_sched_done(unsigned long __c67x00)
>  >> +{
>  >> +	struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
>  >> +	struct c67x00_urb_priv *urbp, *tmp;
>  >> +	struct urb *urb;
>  >> +
>  >> +	spin_lock(&c67x00->lock);
>  >> +
>  >> +	/* Loop over the done list and give back all the urbs */
>  >> +	list_for_each_entry_safe(urbp, tmp, &c67x00->done_list, hep_node) {
>  >> +		urb = urbp->urb;
>  >> +		c67x00_release_urb(c67x00, urb);
>  >> +		if (!usb_hcd_check_unlink_urb(c67x00_hcd_to_hcd(c67x00),
>  >> +					      urb, urbp->status)) {
> 
>  Alan> The function call above is completely wrong.  It is meant to be used only
>  Alan> from within the dequeue method.
> 
> Ahh, so should I just unconditionally do the unlink_urb_from_ep and
> giveback_urb?

Yes, that's right.  The check_unlink_urb routine merely verifies that 
an unlink is valid.  If you're about to giveback an URB then you 
already know it's valid to do so.

Alan Stern

^ permalink raw reply

* Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
From: Geert Uytterhoeven @ 2008-01-30 15:27 UTC (permalink / raw)
  To: Linus Torvalds, Ingo Molnar, Thomas Gleixner, Mike Travis
  Cc: sparclinux, Linux/PPC Development, linux-ia64,
	Linux Kernel Development
In-Reply-To: <200801301414.m0UEEgCC006371@hera.kernel.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4814 bytes --]

On Wed, 30 Jan 2008, Linux Kernel Mailing List wrote:
> Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd5af90a7f3d79e04b7eace9a98644dbf2038f4d
> Commit:     dd5af90a7f3d79e04b7eace9a98644dbf2038f4d
> Parent:     3212bff370c2f22e4987c6679ba485654cefb178
> Author:     Mike Travis <travis@sgi.com>
> AuthorDate: Wed Jan 30 13:33:32 2008 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed Jan 30 13:33:32 2008 +0100
> 
>     x86/non-x86: percpu, node ids, apic ids x86.git fixup
>     
>     Signed-off-by: Ingo Molnar <mingo@elte.hu>
>     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/Kconfig             |    2 +-
>  include/asm-generic/percpu.h |   12 ++----------
>  init/main.c                  |    4 ++--
>  kernel/module.c              |    8 ++++++++

This broke powerpc (and presumably ia64 and sparc64) in current linux-2.6.git:

| init/main.c:376: error: static declaration of 'setup_per_cpu_areas' follows non-static declaration
| include2/asm/percpu.h:33: error: previous declaration of 'setup_per_cpu_areas' was here

as the generic and x86-specific parts were integrated, while the
powerpc/ia64/sparc64-specific parts are still missing.

>  4 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index f0887d1..8e1b33c 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -97,7 +97,7 @@ config GENERIC_TIME_VSYSCALL
>  	bool
>  	default X86_64
>  
> -config ARCH_SETS_UP_PER_CPU_AREA
> +config HAVE_SETUP_PER_CPU_AREA
>  	def_bool X86_64
>  
>  config ARCH_SUPPORTS_OPROFILE
> diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
> index c41b1a7..4b8d31c 100644
> --- a/include/asm-generic/percpu.h
> +++ b/include/asm-generic/percpu.h
> @@ -47,7 +47,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
>  #endif
>  
>  /*
> - * A percpu variable may point to a discarded reghions. The following are
> + * A percpu variable may point to a discarded regions. The following are
>   * established ways to produce a usable pointer from the percpu variable
>   * offset.
>   */
> @@ -59,18 +59,10 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
>  	(*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset))
>  
>  
> -#ifdef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
> +#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
>  extern void setup_per_cpu_areas(void);
>  #endif
>  
> -/* A macro to avoid #include hell... */
> -#define percpu_modcopy(pcpudst, src, size)			\
> -do {								\
> -	unsigned int __i;					\
> -	for_each_possible_cpu(__i)				\
> -		memcpy((pcpudst)+per_cpu_offset(__i),		\
> -		       (src), (size));				\
> -} while (0)
>  #else /* ! SMP */
>  
>  #define per_cpu(var, cpu)			(*((void)(cpu), &per_cpu_var(var)))
> diff --git a/init/main.c b/init/main.c
> index 5843fe9..3316dff 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -363,7 +363,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
>  
>  #else
>  
> -#ifndef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
> +#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
>  unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
>  
>  EXPORT_SYMBOL(__per_cpu_offset);
> @@ -384,7 +384,7 @@ static void __init setup_per_cpu_areas(void)
>  		ptr += size;
>  	}
>  }
> -#endif /* CONFIG_ARCH_SETS_UP_CPU_AREA */
> +#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
>  
>  /* Called by boot processor to activate the rest. */
>  static void __init smp_init(void)
> diff --git a/kernel/module.c b/kernel/module.c
> index f6a4e72..bd60278 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -430,6 +430,14 @@ static unsigned int find_pcpusec(Elf_Ehdr *hdr,
>  	return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
>  }
>  
> +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
> +{
> +	int cpu;
> +
> +	for_each_possible_cpu(cpu)
> +		memcpy(pcpudest + per_cpu_offset(cpu), from, size);
> +}
> +
>  static int percpu_modinit(void)
>  {
>  	pcpu_num_used = 2;
> -
> To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

^ permalink raw reply

* Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
From: Mike Travis @ 2008-01-30 16:02 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-ia64, Linux Kernel Development, Linux/PPC Development,
	sparclinux, Ingo Molnar, Linus Torvalds, Thomas Gleixner
In-Reply-To: <Pine.LNX.4.64.0801301622460.11859@vixen.sonytel.be>

Geert Uytterhoeven wrote:
> On Wed, 30 Jan 2008, Linux Kernel Mailing List wrote:
>> Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dd5af90a7f3d79e04b7eace9a98644dbf2038f4d
>> Commit:     dd5af90a7f3d79e04b7eace9a98644dbf2038f4d
>> Parent:     3212bff370c2f22e4987c6679ba485654cefb178
>> Author:     Mike Travis <travis@sgi.com>
>> AuthorDate: Wed Jan 30 13:33:32 2008 +0100
>> Committer:  Ingo Molnar <mingo@elte.hu>
>> CommitDate: Wed Jan 30 13:33:32 2008 +0100
>>
>>     x86/non-x86: percpu, node ids, apic ids x86.git fixup
>>     
>>     Signed-off-by: Ingo Molnar <mingo@elte.hu>
>>     Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>> ---
>>  arch/x86/Kconfig             |    2 +-
>>  include/asm-generic/percpu.h |   12 ++----------
>>  init/main.c                  |    4 ++--
>>  kernel/module.c              |    8 ++++++++
> 
> This broke powerpc (and presumably ia64 and sparc64) in current linux-2.6.git:

I'm generating a "fixup patch" right now... 

-Mike
> 
> | init/main.c:376: error: static declaration of 'setup_per_cpu_areas' follows non-static declaration
> | include2/asm/percpu.h:33: error: previous declaration of 'setup_per_cpu_areas' was here
> 
> as the generic and x86-specific parts were integrated, while the
> powerpc/ia64/sparc64-specific parts are still missing.
> 
>>  4 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index f0887d1..8e1b33c 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -97,7 +97,7 @@ config GENERIC_TIME_VSYSCALL
>>  	bool
>>  	default X86_64
>>  
>> -config ARCH_SETS_UP_PER_CPU_AREA
>> +config HAVE_SETUP_PER_CPU_AREA
>>  	def_bool X86_64
>>  
>>  config ARCH_SUPPORTS_OPROFILE
>> diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
>> index c41b1a7..4b8d31c 100644
>> --- a/include/asm-generic/percpu.h
>> +++ b/include/asm-generic/percpu.h
>> @@ -47,7 +47,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
>>  #endif
>>  
>>  /*
>> - * A percpu variable may point to a discarded reghions. The following are
>> + * A percpu variable may point to a discarded regions. The following are
>>   * established ways to produce a usable pointer from the percpu variable
>>   * offset.
>>   */
>> @@ -59,18 +59,10 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
>>  	(*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset))
>>  
>>  
>> -#ifdef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
>> +#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
>>  extern void setup_per_cpu_areas(void);
>>  #endif
>>  
>> -/* A macro to avoid #include hell... */
>> -#define percpu_modcopy(pcpudst, src, size)			\
>> -do {								\
>> -	unsigned int __i;					\
>> -	for_each_possible_cpu(__i)				\
>> -		memcpy((pcpudst)+per_cpu_offset(__i),		\
>> -		       (src), (size));				\
>> -} while (0)
>>  #else /* ! SMP */
>>  
>>  #define per_cpu(var, cpu)			(*((void)(cpu), &per_cpu_var(var)))
>> diff --git a/init/main.c b/init/main.c
>> index 5843fe9..3316dff 100644
>> --- a/init/main.c
>> +++ b/init/main.c
>> @@ -363,7 +363,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
>>  
>>  #else
>>  
>> -#ifndef CONFIG_ARCH_SETS_UP_PER_CPU_AREA
>> +#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
>>  unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
>>  
>>  EXPORT_SYMBOL(__per_cpu_offset);
>> @@ -384,7 +384,7 @@ static void __init setup_per_cpu_areas(void)
>>  		ptr += size;
>>  	}
>>  }
>> -#endif /* CONFIG_ARCH_SETS_UP_CPU_AREA */
>> +#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */
>>  
>>  /* Called by boot processor to activate the rest. */
>>  static void __init smp_init(void)
>> diff --git a/kernel/module.c b/kernel/module.c
>> index f6a4e72..bd60278 100644
>> --- a/kernel/module.c
>> +++ b/kernel/module.c
>> @@ -430,6 +430,14 @@ static unsigned int find_pcpusec(Elf_Ehdr *hdr,
>>  	return find_sec(hdr, sechdrs, secstrings, ".data.percpu");
>>  }
>>  
>> +static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size)
>> +{
>> +	int cpu;
>> +
>> +	for_each_possible_cpu(cpu)
>> +		memcpy(pcpudest + per_cpu_offset(cpu), from, size);
>> +}
>> +
>>  static int percpu_modinit(void)
>>  {
>>  	pcpu_num_used = 2;
>> -
>> To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> With kind regards,
> 
> Geert Uytterhoeven
> Software Architect
> 
> Sony Network and Software Technology Center Europe
> The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
> 
> Phone:    +32 (0)2 700 8453
> Fax:      +32 (0)2 700 8622
> E-mail:   Geert.Uytterhoeven@sonycom.com
> Internet: http://www.sony-europe.com/
> 
> Sony Network and Software Technology Center Europe
> A division of Sony Service Centre (Europe) N.V.
> Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
> VAT BE 0413.825.160 · RPR Brussels
> Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

^ permalink raw reply

* Re: x86/non-x86: percpu, node ids, apic ids x86.git fixup
From: Ingo Molnar @ 2008-01-30 16:10 UTC (permalink / raw)
  To: Mike Travis
  Cc: sparclinux, linux-ia64, Linux Kernel Development,
	Linux/PPC Development, Geert Uytterhoeven, Thomas Gleixner,
	Linus Torvalds
In-Reply-To: <47A09F8A.3000309@sgi.com>


* Mike Travis <travis@sgi.com> wrote:

> > This broke powerpc (and presumably ia64 and sparc64) in current 
> > linux-2.6.git:
> 
> I'm generating a "fixup patch" right now...

thanks! Sorry about that: we cross-built on ARM but not on SMP non-x86 
platforms so this dependency/breakage went unnoticed.

	Ingo

^ permalink raw reply

* [BUILD FAILURE] 2.6.24-git7 section type conflict at various drivers on powerpc
From: Kamalesh Babulal @ 2008-01-30 16:19 UTC (permalink / raw)
  To: LKML, netdev, linuxppc-dev, Sam Ravnborg, Andy Whitcroft

Hi,

Following are the different build failure with 2.6.24-git7 kernel on the powerpc

drivers/net/typhoon.c:181: error: typhoon_card_info causes a section type conflict
make[2]: *** [drivers/net/typhoon.o] Error 1

drivers/net/natsemi.c:259: error: natsemi_pci_info causes a section type conflict
make[2]: *** [drivers/net/natsemi.o] Error 1

drivers/net/bnx2.c:95: error: board_info causes a section type conflict
make[2]: *** [drivers/net/bnx2.o] Error 1

drivers/net/via-velocity.c:454: error: velocity_id_table causes a section type conflict
make[2]: *** [drivers/net/via-velocity.o] Error 1


Following are warning with section mismatch CONFIG_DEBUG_SECTION_MISMATCH enabled,

WARNING: kernel/built-in.o(.text+0x423f4): Section mismatch in reference from the function .enable_nonboot_cpus() to the function .cpuinit.text:._cpu_up()
The function  .enable_nonboot_cpus() references
the function __cpuinit ._cpu_up().
This is often because .enable_nonboot_cpus lacks a __cpuinit 
annotation or the annotation of ._cpu_up is wrong.

WARNING: drivers/net/ibm_newemac/ibm_newemac.o(.devinit.text+0x1bb4): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.tah_detach()
The function __devinit .emac_probe() references
a function __devexit .tah_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.tah_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/ibm_newemac.o(.devinit.text+0x1bd0): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.rgmii_detach()
The function __devinit .emac_probe() references
a function __devexit .rgmii_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.rgmii_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/ibm_newemac.o(.devinit.text+0x1bec): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.zmii_detach()
The function __devinit .emac_probe() references
a function __devexit .zmii_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.zmii_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/ibm_newemac.o(.devinit.text+0x1bfc): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.mal_unregister_commac()
The function __devinit .emac_probe() references
a function __devexit .mal_unregister_commac().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.mal_unregister_commac() so it may be used outside an exit section.

  LD      drivers/net/ibm_newemac/built-in.o
WARNING: drivers/net/ibm_newemac/built-in.o(.devinit.text+0x1bb4): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.tah_detach()
The function __devinit .emac_probe() references
a function __devexit .tah_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.tah_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/built-in.o(.devinit.text+0x1bd0): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.rgmii_detach()
The function __devinit .emac_probe() references
a function __devexit .rgmii_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.rgmii_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/built-in.o(.devinit.text+0x1bec): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.zmii_detach()
The function __devinit .emac_probe() references
a function __devexit .zmii_detach().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.zmii_detach() so it may be used outside an exit section.

WARNING: drivers/net/ibm_newemac/built-in.o(.devinit.text+0x1bfc): Section mismatch in reference from the function .emac_probe() to the function .devexit.text:.mal_unregister_commac()
The function __devinit .emac_probe() references
a function __devexit .mal_unregister_commac().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __devexit annotation of
.mal_unregister_commac() so it may be used outside an exit section.

WARNING: drivers/net/mlx4/mlx4_core.o(.text+0x6cf8): Section mismatch in reference from the function .mlx4_init_icm() to the function .devinit.text:.mlx4_init_cmpt_table()
The function  .mlx4_init_icm() references
the function __devinit .mlx4_init_cmpt_table().
This is often because .mlx4_init_icm lacks a __devinit 
annotation or the annotation of .mlx4_init_cmpt_table is wrong.

WARNING: drivers/net/mlx4/mlx4_core.o(.text+0x728c): Section mismatch in reference from the function .mlx4_init_hca() to the function .devinit.text:.mlx4_load_fw()
The function  .mlx4_init_hca() references
the function __devinit .mlx4_load_fw().
This is often because .mlx4_init_hca lacks a __devinit 
annotation or the annotation of .mlx4_load_fw is wrong.

WARNING: drivers/net/mlx4/mlx4_core.o(.text+0x7c98): Section mismatch in reference from the function .__mlx4_init_one() to the function .devinit.text:.mlx4_enable_msi_x()
The function  .__mlx4_init_one() references
the function __devinit .mlx4_enable_msi_x().
This is often because .__mlx4_init_one lacks a __devinit 
annotation or the annotation of .mlx4_enable_msi_x is wrong.

WARNING: drivers/net/mlx4/mlx4_core.o(.text+0x97ac): Section mismatch in reference from the function .mlx4_init_mr_table() to the function .devinit.text:.mlx4_buddy_init()
The function  .mlx4_init_mr_table() references
the function __devinit .mlx4_buddy_init().
This is often because .mlx4_init_mr_table lacks a __devinit 
annotation or the annotation of .mlx4_buddy_init is wrong.

  LD      drivers/net/mlx4/built-in.o
WARNING: drivers/net/mlx4/built-in.o(.text+0x6cf8): Section mismatch in reference from the function .mlx4_init_icm() to the function .devinit.text:.mlx4_init_cmpt_table()
The function  .mlx4_init_icm() references
the function __devinit .mlx4_init_cmpt_table().
This is often because .mlx4_init_icm lacks a __devinit 
annotation or the annotation of .mlx4_init_cmpt_table is wrong.

WARNING: drivers/net/mlx4/built-in.o(.text+0x728c): Section mismatch in reference from the function .mlx4_init_hca() to the function .devinit.text:.mlx4_load_fw()
The function  .mlx4_init_hca() references
the function __devinit .mlx4_load_fw().
This is often because .mlx4_init_hca lacks a __devinit 
annotation or the annotation of .mlx4_load_fw is wrong.

WARNING: drivers/net/mlx4/built-in.o(.text+0x7c98): Section mismatch in reference from the function .__mlx4_init_one() to the function .devinit.text:.mlx4_enable_msi_x()
The function  .__mlx4_init_one() references
the function __devinit .mlx4_enable_msi_x().
This is often because .__mlx4_init_one lacks a __devinit 
annotation or the annotation of .mlx4_enable_msi_x is wrong.

WARNING: drivers/net/mlx4/built-in.o(.text+0x97ac): Section mismatch in reference from the function .mlx4_init_mr_table() to the function .devinit.text:.mlx4_buddy_init()
The function  .mlx4_init_mr_table() references
the function __devinit .mlx4_buddy_init().
This is often because .mlx4_init_mr_table lacks a __devinit 
annotation or the annotation of .mlx4_buddy_init is wrong.

WARNING: drivers/net/tokenring/built-in.o(.text+0x4d64): Section mismatch in reference from the function .olympic_open() to the function .devinit.text:.olympic_init()
The function  .olympic_open() references
the function __devinit .olympic_init().
This is often because .olympic_open lacks a __devinit 
annotation or the annotation of .olympic_init is wrong.


-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.

^ permalink raw reply

* Re: [PATCH] [NET] cpmac: convert to new Fixed PHY infrastructure (was: Re: fixed phy support (warning related to FIXED_MII_100_FDX))
From: Kumar Gala @ 2008-01-30 16:35 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linuxppc-dev list, Eugene Konev, netdev
In-Reply-To: <20080121204953.GA11384@localhost.localdomain>


On Jan 21, 2008, at 2:49 PM, Anton Vorontsov wrote:

> On Mon, Jan 21, 2008 at 01:19:41PM -0600, Kumar Gala wrote:
>> Anton,
>>
>> it looks like the "TI AR7 CPMAC Ethernet support" uses FIXED_PHY and
>> was selecting FIXED_MII_100_FDX which is gone.
>>
>> Can you look into this.  I get the following warning now:
>>
>> scripts/kconfig/conf -s arch/powerpc/Kconfig
>> drivers/net/Kconfig:1713:warning: 'select' used by config symbol
>> 'CPMAC' refers to undefined symbol 'FIXED_MII_100_FDX'
>
> Wow. I thought there were no Fixed PHY users. :-)
>
> Jeff, as you've already Acked Fixed PHY rework to go through powerpc
> tree, would you please Ack this patch in addition? I hope cpmac
> maintainer will fix remaining issues as time goes by.
>
> Thanks!

Jeff, just a reminder to look at this.

- k

> - - - -
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> Subject: [PATCH] [NET] cpmac: convert to new Fixed PHY infrastructure
>
> This patch converts cpmac to the new Fixed PHY infrastructure,  
> though it
> doesn't fix all the problems with that driver. I didn't even bother to
> test this patch to compile, because cpmac driver is broken in  
> several ways:
>
> 1. This driver won't compile by itself because lack of its header  
> describing
>   platform data;
> 2. It assumes that fixed PHYs should be created by the ethernet  
> driver.
>   It is wrong assumption: fixed PHYs creation is platform code  
> authority,
>   driver must blindly accept bus_id and phy_id platform data variables
>   instead.
>
> Also, it seem that that driver doesn't have actual in-tree users, so
> nothing to fix further.
>
> The main purpose of that patch is to get rid of the following Kconfig
> warning:
>
> scripts/kconfig/conf -s arch/powerpc/Kconfig
> drivers/net/Kconfig:1713:warning: 'select' used by config symbol
> 'CPMAC' refers to undefined symbol 'FIXED_MII_100_FDX'
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
> drivers/net/Kconfig |    4 +--
> drivers/net/cpmac.c |   55 +++++++++++++++ 
> +----------------------------------
> 2 files changed, 19 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 114771a..5380ff9 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -1707,10 +1707,8 @@ config SC92031
>
> config CPMAC
> 	tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)"
> -	depends on NET_ETHERNET && EXPERIMENTAL && AR7
> +	depends on NET_ETHERNET && EXPERIMENTAL && AR7 && BROKEN
> 	select PHYLIB
> -	select FIXED_PHY
> -	select FIXED_MII_100_FDX
> 	help
> 	  TI AR7 CPMAC Ethernet support
>
> diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
> index 6fd95a2..88eeb1d 100644
> --- a/drivers/net/cpmac.c
> +++ b/drivers/net/cpmac.c
> @@ -848,15 +848,6 @@ static void cpmac_adjust_link(struct net_device  
> *dev)
> 	spin_unlock(&priv->lock);
> }
>
> -static int cpmac_link_update(struct net_device *dev,
> -			     struct fixed_phy_status *status)
> -{
> -	status->link = 1;
> -	status->speed = 100;
> -	status->duplex = 1;
> -	return 0;
> -}
> -
> static int cpmac_open(struct net_device *dev)
> {
> 	int i, size, res;
> @@ -999,11 +990,11 @@ static int external_switch;
> static int __devinit cpmac_probe(struct platform_device *pdev)
> {
> 	int rc, phy_id, i;
> +	int mdio_bus_id = cpmac_mii.id;
> 	struct resource *mem;
> 	struct cpmac_priv *priv;
> 	struct net_device *dev;
> 	struct plat_cpmac_data *pdata;
> -	struct fixed_info *fixed_phy;
> 	DECLARE_MAC_BUF(mac);
>
> 	pdata = pdev->dev.platform_data;
> @@ -1017,9 +1008,23 @@ static int __devinit cpmac_probe(struct  
> platform_device *pdev)
> 	}
>
> 	if (phy_id == PHY_MAX_ADDR) {
> -		if (external_switch || dumb_switch)
> +		if (external_switch || dumb_switch) {
> +			struct fixed_phy_status status = {};
> +
> +			mdio_bus_id = 0;
> +
> +			/*
> +			 * FIXME: this should be in the platform code!
> +			 * Since there is not platform code at all (that is,
> +			 * no mainline users of that driver), place it here
> +			 * for now.
> +			 */
> 			phy_id = 0;
> -		else {
> +			status.link = 1;
> +			status.duplex = 1;
> +			status.speed = 100;
> +			fixed_phy_add(PHY_POLL, phy_id, &status);
> +		} else {
> 			printk(KERN_ERR "cpmac: no PHY present\n");
> 			return -ENODEV;
> 		}
> @@ -1063,32 +1068,8 @@ static int __devinit cpmac_probe(struct  
> platform_device *pdev)
> 	priv->msg_enable = netif_msg_init(debug_level, 0xff);
> 	memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
>
> -	if (phy_id == 31) {
> -		snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id,
> -			 phy_id);
> -	} else {
> -		/* Let's try to get a free fixed phy... */
> -		for (i = 0; i < MAX_PHY_AMNT; i++) {
> -			fixed_phy = fixed_mdio_get_phydev(i);
> -			if (!fixed_phy)
> -				continue;
> -			if (!fixed_phy->phydev->attached_dev) {
> -				strncpy(priv->phy_name,
> -					fixed_phy->phydev->dev.bus_id,
> -					BUS_ID_SIZE);
> -				fixed_mdio_set_link_update(fixed_phy->phydev,
> -							   &cpmac_link_update);
> -				goto phy_found;
> -			}
> -		}
> -		if (netif_msg_drv(priv))
> -			printk(KERN_ERR "%s: Could not find fixed PHY\n",
> -			       dev->name);
> -		rc = -ENODEV;
> -		goto fail;
> -	}
> +	snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id,  
> phy_id);
>
> -phy_found:
> 	priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
> 				PHY_INTERFACE_MODE_MII);
> 	if (IS_ERR(priv->phy)) {
> -- 
> 1.5.2.2

^ permalink raw reply

* [PATCH] powerpc: configure USB clock for MPC8315E
From: Kim Phillips @ 2008-01-30 16:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jerry Huang

SCCR USB bits are in a different location on the mpc8315.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
 arch/powerpc/platforms/83xx/mpc83xx.h |    2 ++
 arch/powerpc/platforms/83xx/usb.c     |   12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 88bb748..68065e6 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,8 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
 #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
 #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
+#define MPC8315_SCCR_USB_MASK      0x00c00000
+#define MPC8315_SCCR_USB_DRCM_11   0x00c00000
 #define MPC837X_SCCR_USB_DRCM_11   0x00c00000
 
 /* system i/o configuration register low */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 681230a..b3b650e 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
 	}
 
 	/* Configure clock */
-	temp = in_be32(immap + MPC83XX_SCCR_OFFS);
-	temp &= ~MPC83XX_SCCR_USB_MASK;
-	temp |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
-	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
+	if (of_find_compatible_node(NULL, NULL, "fsl,mpc8315erdb"))
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC8315_SCCR_USB_MASK,
+		                MPC8315_SCCR_USB_DRCM_11);
+	else
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC83XX_SCCR_USB_MASK,
+		                MPC83XX_SCCR_USB_DRCM_11);
 
 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
 	if (prop && !strcmp(prop, "ulpi")) {
-- 
1.5.2.2

^ permalink raw reply related

* Re: [PATCH] powerpc: configure USB clock for MPC8315E
From: Kumar Gala @ 2008-01-30 16:38 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev, Jerry Huang
In-Reply-To: <20080130103644.bbfe82a5.kim.phillips@freescale.com>


On Jan 30, 2008, at 10:36 AM, Kim Phillips wrote:

> SCCR USB bits are in a different location on the mpc8315.
>
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> arch/powerpc/platforms/83xx/mpc83xx.h |    2 ++
> arch/powerpc/platforms/83xx/usb.c     |   12 ++++++++----
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/ 
> platforms/83xx/mpc83xx.h
> index 88bb748..68065e6 100644
> --- a/arch/powerpc/platforms/83xx/mpc83xx.h
> +++ b/arch/powerpc/platforms/83xx/mpc83xx.h
> @@ -14,6 +14,8 @@
> #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
> #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
> #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
> +#define MPC8315_SCCR_USB_MASK      0x00c00000
> +#define MPC8315_SCCR_USB_DRCM_11   0x00c00000
> #define MPC837X_SCCR_USB_DRCM_11   0x00c00000
>
> /* system i/o configuration register low */
> diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/ 
> platforms/83xx/usb.c
> index 681230a..b3b650e 100644
> --- a/arch/powerpc/platforms/83xx/usb.c
> +++ b/arch/powerpc/platforms/83xx/usb.c
> @@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
> 	}
>
> 	/* Configure clock */
> -	temp = in_be32(immap + MPC83XX_SCCR_OFFS);
> -	temp &= ~MPC83XX_SCCR_USB_MASK;
> -	temp |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
> -	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
> +	if (of_find_compatible_node(NULL, NULL, "fsl,mpc8315erdb"))

Nope.  I don't want a board specific compat check in this code.

>
> +		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
> +		                MPC8315_SCCR_USB_MASK,
> +		                MPC8315_SCCR_USB_DRCM_11);
> +	else
> +		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
> +		                MPC83XX_SCCR_USB_MASK,
> +		                MPC83XX_SCCR_USB_DRCM_11);
>
> 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
> 	if (prop && !strcmp(prop, "ulpi")) {

- k

^ permalink raw reply

* Re: [BUILD FAILURE] 2.6.24-git7 section type conflict at various drivers on powerpc
From: Sam Ravnborg @ 2008-01-30 17:04 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: netdev, LKML, linuxppc-dev
In-Reply-To: <47A0A3AF.5050005@linux.vnet.ibm.com>

On Wed, Jan 30, 2008 at 09:49:59PM +0530, Kamalesh Babulal wrote:
> Hi,
> 
> Following are the different build failure with 2.6.24-git7 kernel on the powerpc
> 
> drivers/net/typhoon.c:181: error: typhoon_card_info causes a section type conflict
> make[2]: *** [drivers/net/typhoon.o] Error 1
> 
> drivers/net/natsemi.c:259: error: natsemi_pci_info causes a section type conflict
> make[2]: *** [drivers/net/natsemi.o] Error 1
> 
> drivers/net/bnx2.c:95: error: board_info causes a section type conflict
> make[2]: *** [drivers/net/bnx2.o] Error 1
> 
> drivers/net/via-velocity.c:454: error: velocity_id_table causes a section type conflict
> make[2]: *** [drivers/net/via-velocity.o] Error 1

A quick look told me that they are all caused by const data
annotated with __devinitdata.
Try replacing all annotations of const variables
from __devinitdata to __devinitconst.

	Sam

^ permalink raw reply

* [PATCH v2] powerpc: configure USB clock for MPC8315E
From: Kim Phillips @ 2008-01-30 17:08 UTC (permalink / raw)
  To: linuxppc-dev, Kumar Gala; +Cc: Jerry Huang

SCCR USB bits are in a different location on the mpc8315.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
changed to match compatible on non-board specific "fsl,mpc8315-usb2-dr".

 arch/powerpc/boot/dts/mpc8315erdb.dts |    2 +-
 arch/powerpc/platforms/83xx/mpc83xx.h |    2 ++
 arch/powerpc/platforms/83xx/usb.c     |   12 ++++++++----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index b582032..59b1f05 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -133,7 +133,7 @@
 		};
 
 		usb@23000 {
-			compatible = "fsl-usb2-dr";
+			compatible = "fsl-usb2-dr", "fsl,mpc8315-usb2-dr";
 			reg = <0x23000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 88bb748..68065e6 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,8 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
 #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
 #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
+#define MPC8315_SCCR_USB_MASK      0x00c00000
+#define MPC8315_SCCR_USB_DRCM_11   0x00c00000
 #define MPC837X_SCCR_USB_DRCM_11   0x00c00000
 
 /* system i/o configuration register low */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 681230a..14c83f1 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
 	}
 
 	/* Configure clock */
-	temp = in_be32(immap + MPC83XX_SCCR_OFFS);
-	temp &= ~MPC83XX_SCCR_USB_MASK;
-	temp |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
-	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
+	if (of_find_compatible_node(NULL, NULL, "fsl,mpc8315-usb2-dr"))
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC8315_SCCR_USB_MASK,
+		                MPC8315_SCCR_USB_DRCM_11);
+	else
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC83XX_SCCR_USB_MASK,
+		                MPC83XX_SCCR_USB_DRCM_11);
 
 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
 	if (prop && !strcmp(prop, "ulpi")) {
-- 
1.5.2.2

^ permalink raw reply related


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