Skip to contentSkip to conversation

Porting RapidIO driver from ppc to powerpc architecture and adding memory mapped RapidIO driver.

PATCH Superseded Zhang Wei 4 participants 17 messages Jun 27, 2007 – Jun 29, 2007

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Zhang Wei

author
#0 lore raw

v2 cover Porting RapidIO driver from ppc to powerpc architecture and adding memory mapped RapidIO driver.

Hi, Matt Porter,

These are the version 2 patches for RapidIO with dts update and some minor fixups.

These patches are used for supporting RapidIO controllers of Freescale. I ported them from ppc architecture to powerpc architecture and added some new features, such as memory mapped driver.

[PATCH 1/5] Add the explanation and sample of RapidIO DTS sector to the document of booting-without-of.txt file. [PATCH 2/5] Add RapidIO sector to MPC8641HPCN board dts file.
[PATCH 3/5] Add the platform device support with RapidIO to MPC8641HPCN platform.
[PATCH 4/5] Add RapidIO support to powerpc architecture.
[PATCH 5/5] Add the memory management driver to RapidIO.

Please see below descriptions of these patches:
1. Add the RapidIO driver of-device support.
2. Add the RapidIO driver support to MPC8641HPCN board.
3. Port the RapidIO from ppc to powerpc architecture.
4. Add Memory mapped RapidIO driver.
5. Add the support to multi master ports.
6. Add a simple bitmap RapidIO space allocator driver.
7. Change the RapidIO system size of menuconfig to automatically detection.

Thanks!

Best Regards,
Zhang Wei

author
#1 lore raw

PATCH v2 1/5 Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

---
 Documentation/powerpc/booting-without-of.txt |   34 ++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
Documentation/powerpc/booting-without-of.txt +34 -0
index b49ce16..98692ca 100644
@@ -1727,6 +1727,40 @@ platforms are moved over to use the flattened-device-tree model.
  		partition-names = "fs\0firmware";
  	};
 
+   k) RapidIO
+
+   Required properties:
+
+    - compatible : Should be "fsl,rapidio-delta" for Freescale
+      PowerPC RapidIO controller.
+    - #address-cells : Address representation for "rapidio" devices.
+      This field represents the number of cells needed to represent
+      the RapidIO address of the registers.  For supporting more than
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.
+    - reg : Offset and length of the register set for the device
+    - ranges : Should be defined as specified in 1) to describe the
+      translation of addresses for memory mapped RapidIO memory
+      space.
+    - interrupts : binding interrupts for this device sector,
+      please follow below orders:
+      <err_irq bell_outb_irq bell_inb_irq msg1_tx_irq msg1_rx_irq
+      msg2_tx_irq msg2_rx_irq ... msgN_tx_irq msgN_rx_irq>.
+
+  Example:
+
+	srio@c0000{
+		compatible = "fsl,rapidio-delta";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <c0000 20000>;
+		ranges = <0 0 c0000000 20000000>;
+		interrupt-parent = <&mpic>;
+		/* err_irq bell_outb_irq bell_inb_irq msg1_tx_irq msg1_rx_irq
+						      msg2_tx_irq msg2_rx_irq */
+		interrupts = <30 2 31 2 32 2 35 2 36 2 37 2 38 2>;
+	};
+
    More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
Signature · 1 line
1.5.1
author
#2 lore raw

PATCH v2 2/5 Add RapidIO sector to the MPC8641HPCN board dts file.

Add RapidIO sector to the MPC8641HPCN board dts file.

---
 arch/powerpc/boot/dts/mpc8641_hpcn.dts |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8641_hpcn.dts +13 -0
index 04626b1..abc9ff3 100644
@@ -329,6 +329,19 @@
 				>;
 		};
 
+		srio@c0000 {
+			compatible = "fsl,rapidio-delta";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			reg = <c0000 20000>;
+			ranges = <0 0 c0000000 20000000>;
+			interrupt-parent = <&mpic>;
+			/* err_irq bell_outb_irq bell_inb_irq
+						msg1_tx_irq msg1_rx_irq
+						msg2_tx_irq msg2_rx_irq */
+			interrupts = <30 2 31 2 32 2 35 2 36 2 37 2 38 2>;
+		};
+
 		mpic: pic@40000 {
 			clock-frequency = <0>;
 			interrupt-controller;
Signature · 1 line
1.5.1
author
#3 lore raw

PATCH v2 3/5 Add the platform device support with RapidIO to MPC8641HPCN platform.

Add the platform device support with RapidIO to MPC8641HPCN platform.

---
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +16 -0
index 7034bca..5518ed3 100644
@@ -28,6 +28,8 @@
 #include <mm/mmu_decl.h>
 #include <asm/udbg.h>
 #include <asm/i8259.h>
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
 
 #include <asm/mpic.h>
 
@@ -467,3 +469,17 @@ define_machine(mpc86xx_hpcn) {
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
 };
+
+
+static struct of_device_id mpc86xx_of_ids[] = {
+	{ .type = "soc", },
+	{ .compatible = "fsl,rapidio-delta", },
+	{},
+};
+
+static __init int mpc86xx_of_device_init(void)
+{
+	return of_platform_bus_probe(NULL, mpc86xx_of_ids, NULL);
+}
+
+device_initcall(mpc86xx_of_device_init);
Signature · 1 line
1.5.1
author
#4 lore raw

PATCH v2 4/5 Add RapidIO support to powerpc architecture.

This patch adds the RapidIO support to the powerpc architecture. Some files are moved from ppc. OF-tree and OF-device supports are added. New silicons such as MPC8548, MPC8641 with serial RapidIO controller are all supported.
Memory driver hardware operations are added.
Global mport variables are changed to master port private variables. Multi master ports are supported.

---
 arch/powerpc/Kconfig          |    8 +
 arch/powerpc/kernel/Makefile  |    1 +
 arch/powerpc/kernel/rio.c     |   64 ++
 arch/powerpc/sysdev/Makefile  |    1 +
 arch/powerpc/sysdev/fsl_rio.c | 1455 +++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/fsl_rio.h |   20 +
 6 files changed, 1549 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/kernel/rio.c
 create mode 100644 arch/powerpc/sysdev/fsl_rio.c
 create mode 100644 arch/powerpc/sysdev/fsl_rio.h
arch/powerpc/Kconfig +8 -0
index e683668..a41aaac 100644
@@ -742,6 +742,14 @@ source "drivers/pci/Kconfig"
 
 source "drivers/pcmcia/Kconfig"
 
+config RAPIDIO
+	bool "RapidIO support" if MPC8540 || MPC8560 || MPC8641 || MPC8548
+	help
+	  If you say Y here, the kernel will include drivers and
+	  infrastructure code to support RapidIO interconnect devices.
+
+source "drivers/rapidio/Kconfig"
+
 source "drivers/pci/hotplug/Kconfig"
 
 endmenu
arch/powerpc/kernel/Makefile +1 -0
index 3e779f0..9ed2367 100644
@@ -69,6 +69,7 @@ pci64-$(CONFIG_PPC64)		+= pci_64.o pci_dn.o
 pci32-$(CONFIG_PPC32)		:= pci_32.o
 obj-$(CONFIG_PCI)		+= $(pci64-y) $(pci32-y)
 obj-$(CONFIG_PCI_MSI)		+= msi.o
+obj-$(CONFIG_RAPIDIO)		+= rio.o
 kexec-$(CONFIG_PPC64)		:= machine_kexec_64.o
 kexec-$(CONFIG_PPC32)		:= machine_kexec_32.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o crash.o $(kexec-y)
arch/powerpc/kernel/rio.c new file +64 -0

64 lines not on this page · raw message

arch/powerpc/sysdev/Makefile +1 -0
index c3ce0bd..5d6d66b 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_U3_DART)		+= dart_iommu.o
 obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
 obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_FSL_PCIE)		+= fsl_pcie.o
+obj-$(CONFIG_RAPIDIO)		+= fsl_rio.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
 mv64x60-$(CONFIG_PCI)		+= mv64x60_pci.o
arch/powerpc/sysdev/fsl_rio.c new file +1455 -0

1,455 lines not on this page · raw message

arch/powerpc/sysdev/fsl_rio.h new file +20 -0
new file mode 100644
index 0000000..34231df
@@ -0,0 +1,20 @@
+/*
+ * Freescale PowerPC RapidIO definitions
+ *
+ * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+ * Zhang Wei <[email protected]>, Jun 2007
+ *
+ * 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 __POWERPC_SYSDEV_FSL_RIO_H
+#define __POWERPC_SYSDEV_FSL_RIO_H
+
+#include <linux/init.h>
+
+extern int fsl_rio_setup(struct of_device *of_dev);
+
+#endif				/* __POWERPC_SYSDEV_FSL_RIO_H */
Signature · 1 line
1.5.1
author
#5 lore raw

PATCH v2 5/5 Add the memory management driver to RapidIO.

This patch adds the memory management driver to RapidIO. The RapidIO system size is changed to automatically detection. Add the memory mapping driver to RapidIO basic driver. Multi master ports are supported.
Add a simple Bitmap RapidIO space allocator driver.

---
 drivers/net/rionet.c                |   17 +-
 drivers/rapidio/Kconfig             |   18 +-
 drivers/rapidio/Makefile            |    1 +
 drivers/rapidio/rio-access.c        |   10 +-
 drivers/rapidio/rio-scan.c          |   53 +++--
 drivers/rapidio/rio-sysfs.c         |    3 +-
 drivers/rapidio/rio.c               |  479 ++++++++++++++++++++++++++++++++++-
 drivers/rapidio/rio.h               |    9 +-
 drivers/rapidio/sallocator/Kconfig  |    9 +
 drivers/rapidio/sallocator/Makefile |   12 +
 drivers/rapidio/sallocator/bitmap.c |  384 ++++++++++++++++++++++++++++
 include/linux/rio.h                 |   71 +++++-
 include/linux/rio_drv.h             |   41 +++-
 13 files changed, 1048 insertions(+), 59 deletions(-)
 create mode 100644 drivers/rapidio/sallocator/Kconfig
 create mode 100644 drivers/rapidio/sallocator/Makefile
 create mode 100644 drivers/rapidio/sallocator/bitmap.c
drivers/net/rionet.c +15 -2
index df6b738..8dcda4d 100644
@@ -78,7 +78,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) &&		\
@@ -115,6 +115,7 @@ static int rionet_rx_clean(struct net_device *ndev)
 
 		rnet->rx_skb[i]->data = data;
 		skb_put(rnet->rx_skb[i], RIO_MAX_MSG_SIZE);
+		rnet->rx_skb[i]->dev = ndev;
 		rnet->rx_skb[i]->protocol =
 		    eth_type_trans(rnet->rx_skb[i], ndev);
 		error = netif_rx(rnet->rx_skb[i]);
@@ -202,7 +203,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->sys_size);
+				i++)
 			if (rionet_active[i])
 				rionet_queue_tx_msg(skb, ndev,
 						    rionet_active[i]);
@@ -392,6 +394,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);
 
@@ -449,6 +453,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;
drivers/rapidio/Kconfig +10 -8
index 4142115..f669108 100644
@@ -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
@@ -16,3 +8,13 @@ config RAPIDIO_DISC_TIMEOUT
 	---help---
 	  Amount of time a discovery node waits for a host to complete
 	  enumeration before giving up.
+
+config RAPIDIO_PROC_FS
+	bool "I/O and Memory resource debug"
+	depends on RAPIDIO && PROC_FS
+	default y
+	---help---
+	  Enable this option, it will create a /proc/riores node for
+	  monitoring the RapidIO I/O and Memory resource.
+
+source "drivers/rapidio/sallocator/Kconfig"
drivers/rapidio/Makefile +1 -0
index 7c0e181..e5b2f11 100644
@@ -4,3 +4,4 @@
 obj-y += rio.o rio-access.o rio-driver.o rio-scan.o rio-sysfs.o
 
 obj-$(CONFIG_RAPIDIO)		+= switches/
+obj-$(CONFIG_RAPIDIO)		+= sallocator/
drivers/rapidio/rio-access.c +5 -5
index 8b56bbd..a3824ba 100644
@@ -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;
drivers/rapidio/rio-scan.c +37 -16

149 lines not on this page · raw message

drivers/rapidio/rio-sysfs.c +2 -1
index eed9143..691c1be 100644
@@ -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 +=
drivers/rapidio/rio.c +476 -3

516 lines not on this page · raw message

drivers/rapidio/rio.h +2 -7
index b242cee..7a3b62e 100644
@@ -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))
drivers/rapidio/sallocator/Kconfig new file +9 -0
new file mode 100644
index 0000000..a33a1b8
@@ -0,0 +1,9 @@
+choice
+	prompt "Default RapidIO Space Allocator"
+	depends on RAPIDIO
+	default RIO_SA_DEFAULT_BITMAP
+
+	config RIO_SA_DEFAULT_BITMAP
+		bool "Bitmap"
+
+endchoice
drivers/rapidio/sallocator/Makefile new file +12 -0
new file mode 100644
index 0000000..437201c
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+#
+# Author: Zhang Wei, [email protected], Jun 2007
+#
+# This 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.
+#
+
+obj-$(CONFIG_RIO_SA_DEFAULT_BITMAP) += bitmap.o
drivers/rapidio/sallocator/bitmap.c new file +384 -0

384 lines not on this page · raw message

include/linux/rio.h +59 -12

129 lines not on this page · raw message

include/linux/rio_drv.h +36 -5

61 lines not on this page · raw message

Signature · 1 line
1.5.1
#6 lore raw

Re: [PATCH 3/5 v2] Add the platform device support with RapidIO to MPC8641HPCN platform.

In reply to Zhang Wei

Review

Quoted 9 lines · Zhang Wei
(quoted diff) +9 -0
+static struct of_device_id mpc86xx_of_ids[] =3D {
+=A0=A0=A0=A0=A0=A0=A0{ .type =3D "soc", },
+=A0=A0=A0=A0=A0=A0=A0{ .compatible =3D "fsl,rapidio-delta", },
+=A0=A0=A0=A0=A0=A0=A0{},
+};
+
+static __init int mpc86xx_of_device_init(void)
+{
+=A0=A0=A0=A0=A0=A0=A0return of_platform_bus_probe(NULL, mpc86xx_of_ids, =

NULL);

Quoted 1 line

+}

This will add any devices below the "fsl,rapidio-delta" device as an of_device. Is that what you actually want? I would guess that you want to add the bridge itself, not the devices below it.

Is the rapidio device at the root of the device tree, and if so, why not under the soc bus?

	Arnd <><
#7 lore raw

RE: [PATCH 3/5 v2] Add the platform device support with RapidIO to MPC8641HPCN platform.

Hi, Arnd,

Quoted 11 lines

=20

Review

Quoted 9 lines · Zhang Wei
(quoted diff) +9 -0
+static struct of_device_id mpc86xx_of_ids[] =3D {
+=A0=A0=A0=A0=A0=A0=A0{ .type =3D "soc", },
+=A0=A0=A0=A0=A0=A0=A0{ .compatible =3D "fsl,rapidio-delta", },
+=A0=A0=A0=A0=A0=A0=A0{},
+};
+
+static __init int mpc86xx_of_device_init(void)
+{
+=A0=A0=A0=A0=A0=A0=A0return of_platform_bus_probe(NULL, =

mpc86xx_of_ids, NULL);

Quoted 9 lines
Quoted 1 line

+}

=20
This will add any devices below the "fsl,rapidio-delta" device as an of_device. Is that what you actually want? I would guess that you want to add the bridge itself, not the devices below it. =20
Is the rapidio device at the root of the device tree, and if so, why not under the soc bus?
=20

RapidIO is rather a bus that a device although these is no other nodes = defined in its sector now.

Thanks!
Wei.

#8 lore raw

Re: [PATCH 3/5 v2] Add the platform device support with RapidIO to MPC8641HPCN platform.

Quoted 3 lines · On Thursday 28 June 2007, Zhang Wei-r63237 wrote:
Quoted 3 lines

arch/powerpc/platforms/86xx/mpc86xx_hpcn.c define_machine(mpc86xx_hpcn) {

Quoted 3 lines
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +3 -0
+static __init int mpc86xx_of_device_init(void)
+{
+=A0=A0=A0=A0=A0=A0=A0return of_platform_bus_probe(NULL, mpc86xx_of_i=

ds, NULL);

Quoted 11 lines
Quoted 9 lines
Quoted 1 line

+}

=20
This will add any devices below the "fsl,rapidio-delta" device as an of_device. Is that what you actually want? I would guess that you want to add the bridge itself, not the devices below it. =20
Is the rapidio device at the root of the device tree, and if so, why not under the soc bus?
=20

=20
RapidIO is rather a bus that a device although these is no other nodes de=

fined in its sector now.

Quoted 1 line

=20

That's exactly my point. The meaning of of_platform_bus_probe() is 'add all direct children of these nodes', not 'add these nodes', although it happens to do that in the process.

Of course, looking at the device tree, rapidio is a device, not a bus, because it does not have a device_type and it does not have any children of its own.

	Arnd <><
#9 lore raw

Re: [PATCH 3/5 v2] Add the platform device support with RapidIO to MPC8641HPCN platform.

Quoted 3 lines

Of course, looking at the device tree, rapidio is a device, not a bus, because it does not have a device_type and it does not have any children of its own.

It's a device _of course_, but it's also a bus parent, since it has a "#address-cells" not equal to zero (and, if this used real OF, it would have decode-unit and encode-unit methods). A quite empty bus perhaps heh (in this device tree, anyway).

Segher

#10 lore raw

Re: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

In reply to Zhang Wei
Quoted 12 lines · Zhang Wei

Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

---
 Documentation/powerpc/booting-without-of.txt |   34 ++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
Documentation/powerpc/booting-without-of.txt +0 -0
index b49ce16..98692ca 100644

Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1733

Quoted 7 lines
Documentation/powerpc/booting-without-of.txt +4 -0
@@ -1727,6 +1727,40 @@ platforms are moved over to use the flattened-device-tree model.
  		partition-names = "fs\0firmware";
  	};
 
+   k) RapidIO
+
+   Required properties:
+

Should probably recommend a name for the node here, as well. "srio" I guess, from the example below.

Quoted 33 lines
Documentation/powerpc/booting-without-of.txt +30 -0
+    - compatible : Should be "fsl,rapidio-delta" for Freescale
+      PowerPC RapidIO controller.
+    - #address-cells : Address representation for "rapidio" devices.
+      This field represents the number of cells needed to represent
+      the RapidIO address of the registers.  For supporting more than
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.
+    - reg : Offset and length of the register set for the device
+    - ranges : Should be defined as specified in 1) to describe the
+      translation of addresses for memory mapped RapidIO memory
+      space.
+    - interrupts : binding interrupts for this device sector,
+      please follow below orders:
+      <err_irq bell_outb_irq bell_inb_irq msg1_tx_irq msg1_rx_irq
+      msg2_tx_irq msg2_rx_irq ... msgN_tx_irq msgN_rx_irq>.
+
+  Example:
+
+	srio@c0000{
+		compatible = "fsl,rapidio-delta";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <c0000 20000>;
+		ranges = <0 0 c0000000 20000000>;
+		interrupt-parent = <&mpic>;
+		/* err_irq bell_outb_irq bell_inb_irq msg1_tx_irq msg1_rx_irq
+						      msg2_tx_irq msg2_rx_irq */
+		interrupts = <30 2 31 2 32 2 35 2 36 2 37 2 38 2>;
+	};
+
    More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#11 lore raw

Re: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Quoted 6 lines

Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1732

Quoted 3 lines
Documentation/powerpc/booting-without-of.txt +3 -0
+   k) RapidIO
+
+   Required properties:

Should probably recommend a name for the node here, as well. "srio" I guess, from the example below.

I would prefer "rapidio", being more generic and more readable. What would parallel RapidIO be, "prio"? No thanks :-)

Segher

#12 lore raw

Re: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

In reply to Zhang Wei

Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1740

Quoted 5 lines
Documentation/powerpc/booting-without-of.txt +5 -0
+    - #address-cells : Address representation for "rapidio" devices.
+      This field represents the number of cells needed to represent
+      the RapidIO address of the registers.  For supporting more than
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.

What does the RapidIO standard say about number of address bits? You want to follow that, so all RapidIO devices can use the same #address-cells, not just the FSL ones. Also, are there different kinds of address spaces on the bus, or is it just one big memory-like space?

Segher

#13 lore raw

RE: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Hi, Segher,=20
=20

Quoted 7 lines
Quoted 1 line

+ - #address-cells : Address representation for=20

"rapidio" devices.

Review

Quoted 2 lines
(quoted diff) +2 -0
+      This field represents the number of cells needed to represent
+      the RapidIO address of the registers.  For=20

supporting more than

Documentation/powerpc/booting-without-of.txt platforms are moved over to use the flattened-device-tree model. · line 1740

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.
Quoted 8 lines

=20
What does the RapidIO standard say about number of address bits? You want to follow that, so all RapidIO devices can use the same #address-cells, not just the FSL ones. Also, are there different kinds of address spaces on the bus, or is it just one big memory-like space?
=20
=20

I've checked the specification of RapidIO. The supporting of RapidIO extended address modes are 66, 50 and 34 bit.
The Freescale's silicons is only support 34 bit address now. Do you mean I should not use words -- 'should be <2>'? The #address-cells should be assigned according the address mode supported by silicon.

Thanks!
Wei.

#14 lore raw

Re: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

+ - #address-cells : Address representation for

"rapidio" devices.

Review

Quoted 2 lines
(quoted diff) +2 -0
+      This field represents the number of cells needed to represent
+      the RapidIO address of the registers.  For

supporting more than

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.
Quoted 8 lines
Quoted 5 lines

What does the RapidIO standard say about number of address bits? You want to follow that, so all RapidIO devices can use the same #address-cells, not just the FSL ones. Also, are there different kinds of address spaces on the bus, or is it just one big memory-like space?

I've checked the specification of RapidIO. The supporting of RapidIO extended address modes are 66, 50 and 34 bit.

These three are all two bits more than some "regular" size -- do those two extra bits have some special meaning perhaps, like an address space identifier or something?

Quoted 4 lines

The Freescale's silicons is only support 34 bit address now. Do you mean I should not use words -- 'should be <2>'? The #address-cells should be assigned according the address mode supported by silicon.

No. The #address-cells is determined by the bus binding, so that all RapidIO busses on the planet can be represented in a similar way in the OF device tree. Take for example the PCI binding, which gives you three address cells -- one to distinguish between different address spaces (configuration space, legacy I/O space, memory mapped space) and to contain some flags (prefetchable vs. non-prefetchable, etc.); the other two 32-bit cells contain a 64-bit address, although config and legacy I/O never are more than 32 bit, and many PCI devices can't do 64-bit addressing at all.

Now, there is no OF binding for RapidIO yet of course, but it would be good to start thinking about one while doing the binding for your specific controller -- it will make life easier down the line for everyone, including yourself.

Segher

#15 lore raw

RE: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Hi, Segher,=20

Quoted 37 lines

DTS sector to the document of booting-without-of.txt file. =20

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+ - #address-cells : Address representation for

"rapidio" devices.

Quoted 1 line

+ This field represents the number of cells needed=20

to represent

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

+ the RapidIO address of the registers. For

supporting more than

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+      32-bits RapidIO address, this field should be <2>.
+      See 1) above for more details on defining #address-cells.
Quoted 8 lines
Quoted 5 lines

What does the RapidIO standard say about number of address bits? You want to follow that, so all RapidIO devices can use the same #address-cells, not just the FSL ones. Also, are there different kinds of address spaces on the bus, or is it just one big memory-like space?

I've checked the specification of RapidIO. The supporting of RapidIO extended address modes are 66, 50 and 34 bit.

=20
These three are all two bits more than some "regular" size -- do those two extra bits have some special meaning perhaps, like an address space identifier or something?
=20

Quoted 4 lines

The Freescale's silicons is only support 34 bit address now. Do you mean I should not use words -- 'should be <2>'? The #address-cells should be assigned according the address mode supported by silicon.

=20
No. The #address-cells is determined by the bus binding, so that all RapidIO busses on the planet can be represented in a similar way in the OF device tree. Take for example the PCI binding, which gives you three address cells -- one to distinguish between different address spaces (configuration space, legacy I/O space, memory mapped space) and to contain some flags (prefetchable vs. non-prefetchable, etc.); the other two 32-bit cells contain a 64-bit address, although

Quoted 8 lines

config and legacy I/O never are more than 32 bit, and many PCI devices can't do 64-bit addressing at all.
=20
Now, there is no OF binding for RapidIO yet of course, but it would be good to start thinking about one while doing the binding for your specific controller -- it will make life easier down the line for everyone, including yourself. =20

How about I add more words here for more clear expression? Such as "<2> for 34 and 50 bit address, <3> for 66 bit address".

Thanks!
Wei.

#16 lore raw

Re: [PATCH 1/5 v2] Add the explanation and a sample of RapidIO DTS sector to the document of booting-without-of.txt file.

Quoted 11 lines
Quoted 11 lines

No. The #address-cells is determined by the bus binding, so that all RapidIO busses on the planet can be represented in a similar way in the OF device tree. Take for example the PCI binding, which gives you three address cells -- one to distinguish between different address spaces (configuration space, legacy I/O space, memory mapped space) and to contain some flags (prefetchable vs. non-prefetchable, etc.); the other two 32-bit cells contain a 64-bit address, although config and legacy I/O never are more than 32 bit, and many PCI devices can't do 64-bit addressing at all.

Quoted 7 lines
Quoted 5 lines

Now, there is no OF binding for RapidIO yet of course, but it would be good to start thinking about one while doing the binding for your specific controller -- it will make life easier down the line for everyone, including yourself.

How about I add more words here for more clear expression? Such as "<2> for 34 and 50 bit address, <3> for 66 bit address".

You should more explicitly define the address format, i.e. what every bit means -- just saying it is 64 or 96 bits isn't enough. While you're doing that, think of a way that can represent _every possible_ RapidIO address, not just the ones supported by this particular controller.

Segher