powerpc/fsl: Document rapidio node binding-information
Subsystems (3)
PATCH v2 4/5 powerpc/85xx: Update SRIO device tree nodes
In reply to Kumar GalaUpdate all dts files that support SRIO controllers to match the new fsl,srio device tree binding.
--- arch/powerpc/boot/dts/mpc8568mds.dts | 66 ++++++++++++++++++++++------- arch/powerpc/boot/dts/mpc8569mds.dts | 72 +++++++++++++++++++++++++------ arch/powerpc/boot/dts/mpc8641_hpcn.dts | 69 ++++++++++++++++++++++++------- arch/powerpc/boot/dts/p2041rdb.dts | 11 +++++ arch/powerpc/boot/dts/p2041si.dtsi | 20 +++++++++ arch/powerpc/boot/dts/p3041ds.dts | 11 +++++ arch/powerpc/boot/dts/p3041si.dtsi | 26 ++++++++--- arch/powerpc/boot/dts/p4080ds.dts | 12 ++++- arch/powerpc/boot/dts/p4080si.dtsi | 64 +++++++++++++++++++++++----- arch/powerpc/boot/dts/p5020ds.dts | 11 +++++ arch/powerpc/boot/dts/p5020si.dtsi | 26 ++++++++--- 11 files changed, 314 insertions(+), 74 deletions(-)
arch/powerpc/boot/dts/mpc8568mds.dts +50 -16
@@ -26,7 +26,6 @@ serial1 = &serial1; pci0 = &pci0; pci1 = &pci1; - rapidio0 = &rio0; }; cpus {
@@ -331,6 +330,41 @@ }; }; + rmu: rmu@d3000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,srio-rmu"; + reg = <0xd3000 0x500>; + ranges = <0x0 0xd3000 0x500>; + + message-unit@0 { + compatible = "fsl,srio-msg-unit"; + reg = <0x0 0x100>; + interrupts = < + 53 2 /* msg1_tx_irq */ + 54 2>;/* msg1_rx_irq */ + }; + message-unit@100 { + compatible = "fsl,srio-msg-unit"; + reg = <0x100 0x100>; + interrupts = < + 55 2 /* msg2_tx_irq */ + 56 2>;/* msg2_rx_irq */ + }; + doorbell-unit@400 { + compatible = "fsl,srio-dbell-unit"; + reg = <0x400 0x80>; + interrupts = < + 49 2 /* bell_outb_irq */ + 50 2>;/* bell_inb_irq */ + }; + port-write-unit@4e0 { + compatible = "fsl,srio-port-write-unit"; + reg = <0x4e0 0x20>; + interrupts = <48 2>; + }; + }; + global-utilities@e0000 { #address-cells = <1>; #size-cells = <1>;
@@ -638,22 +672,22 @@ }; }; - rio0: rapidio@e00c00000 { - #address-cells = <2>; - #size-cells = <2>; - compatible = "fsl,mpc8568-rapidio", "fsl,rapidio-delta"; - reg = <0xe00c0000 0x20000>; - ranges = <0x0 0x0 0xc0000000 0x0 0x20000000>; - interrupts = <48 2 /* error */ - 49 2 /* bell_outb */ - 50 2 /* bell_inb */ - 53 2 /* msg1_tx */ - 54 2 /* msg1_rx */ - 55 2 /* msg2_tx */ - 56 2 /* msg2_rx */>; + rapidio@e00c0000 { + reg = <0xe00c0000 0x11000>; + compatible = "fsl,srio"; interrupt-parent = <&mpic>; - sleep = <&pmc 0x00080000 /* controller */ - &pmc 0x00040000>; /* message unit */ + interrupts = <48 2>; + #address-cells = <1>; + #size-cells = <1>; + fsl,srio-rmu-handle = <&rmu>; + ranges; + + port1 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <1>; + ranges = <0x0 0x0 0xc0000000 0x0 0x20000000>; + }; }; leds {
arch/powerpc/boot/dts/mpc8569mds.dts +58 -14
91 lines not on this page · raw message
arch/powerpc/boot/dts/mpc8641_hpcn.dts +54 -15
89 lines not on this page · raw message
arch/powerpc/boot/dts/p2041rdb.dts +11 -0
@@ -102,6 +102,17 @@ }; }; + rapidio@ffe0c0000 { + reg = <0xf 0xfe0c0000 0 0x11000>; + + port1 { + ranges = <0 0 0xc 0x20000000 0 0x10000000>; + }; + port2 { + ranges = <0 0 0xc 0x30000000 0 0x10000000>; + }; + }; + localbus@ffe124000 { reg = <0xf 0xfe124000 0 0x1000>; ranges = <0 0 0xf 0xe8000000 0x08000000>;
arch/powerpc/boot/dts/p2041si.dtsi +20 -0
@@ -533,6 +533,26 @@ }; + rapidio@ffe0c0000 { + compatible = "fsl,srio"; + interrupts = <16 2 1 11>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + port1 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <1>; + }; + + port2 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <2>; + }; + }; + localbus@ffe124000 { compatible = "fsl,p2041-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/p3041ds.dts +11 -0
@@ -95,6 +95,17 @@ }; }; + rapidio@ffe0c0000 { + reg = <0xf 0xfe0c0000 0 0x11000>; + + port1 { + ranges = <0 0 0xc 0x20000000 0 0x10000000>; + }; + port2 { + ranges = <0 0 0xc 0x30000000 0 0x10000000>; + }; + }; + localbus@ffe124000 { reg = <0xf 0xfe124000 0 0x1000>; ranges = <0 0 0xf 0xe8000000 0x08000000
arch/powerpc/boot/dts/p3041si.dtsi +19 -7
@@ -70,10 +70,6 @@ rtic_c = &rtic_c; rtic_d = &rtic_d; sec_mon = &sec_mon; - -/* - rio0 = &rapidio0; - */ }; cpus {
@@ -538,9 +534,25 @@ }; }; -/* - rapidio0: rapidio@ffe0c0000 -*/ + rapidio@ffe0c0000 { + compatible = "fsl,srio"; + interrupts = <16 2 1 11>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + port1 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <1>; + }; + + port2 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <2>; + }; + }; localbus@ffe124000 { compatible = "fsl,p3041-elbc", "fsl,elbc", "simple-bus";
arch/powerpc/boot/dts/p4080ds.dts +9 -3
@@ -101,9 +101,15 @@ }; }; - rapidio0: rapidio@ffe0c0000 { - reg = <0xf 0xfe0c0000 0 0x20000>; - ranges = <0 0 0xc 0x20000000 0 0x01000000>; + rapidio@ffe0c0000 { + reg = <0xf 0xfe0c0000 0 0x11000>; + + port1 { + ranges = <0 0 0xc 0x20000000 0 0x10000000>; + }; + port2 { + ranges = <0 0 0xc 0x30000000 0 0x10000000>; + }; }; localbus@ffe124000 {
arch/powerpc/boot/dts/p4080si.dtsi +52 -12
84 lines not on this page · raw message
arch/powerpc/boot/dts/p5020ds.dts +11 -0
@@ -95,6 +95,17 @@ }; }; + rapidio@ffe0c0000 { + reg = <0xf 0xfe0c0000 0 0x11000>; + + port1 { + ranges = <0 0 0xc 0x20000000 0 0x10000000>; + }; + port2 { + ranges = <0 0 0xc 0x30000000 0 0x10000000>; + }; + }; + localbus@ffe124000 { reg = <0xf 0xfe124000 0 0x1000>; ranges = <0 0 0xf 0xe8000000 0x08000000
arch/powerpc/boot/dts/p5020si.dtsi +19 -7
@@ -70,10 +70,6 @@ rtic_c = &rtic_c; rtic_d = &rtic_d; sec_mon = &sec_mon; - -/* - rio0 = &rapidio0; - */ }; cpus {
@@ -530,9 +526,25 @@ }; }; -/* - rapidio0: rapidio@ffe0c0000 -*/ + rapidio@ffe0c0000 { + compatible = "fsl,srio"; + interrupts = <16 2 1 11>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + port1 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <1>; + }; + + port2 { + #address-cells = <2>; + #size-cells = <2>; + cell-index = <2>; + }; + }; localbus@ffe124000 { compatible = "fsl,p5020-elbc", "fsl,elbc", "simple-bus";
Signature · 1 line
1.7.3.4
PATCH v2 1/5 powerpc/fsl: Document rapidio node binding-information
From: Liu Gang <[email protected]>
This document is created for powerpc rapidio and rmu nodes in dts file. These nodes can support two rapidio ports and message units. In addition, It explicates the properties and gives examples about rapidio and rmu nodes.
--- .../devicetree/bindings/powerpc/fsl/srio-rmu.txt | 163 ++++++++++++++++++++ .../devicetree/bindings/powerpc/fsl/srio.txt | 103 ++++++++++++ 2 files changed, 266 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/srio-rmu.txt create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/srio.txt
Documentation/devicetree/bindings/powerpc/fsl/srio-rmu.txt new file +163 -0
@@ -0,0 +1,163 @@ +Message unit node: + +For SRIO controllers that implement the message unit as part of the controller +this node is required. For devices with RMAN this node should NOT exist. The +node is composed of three types of sub-nodes ("fsl-srio-msg-unit", +"fsl-srio-dbell-unit" and "fsl-srio-port-write-unit"). + +See srio.txt for more details about generic SRIO controller details. + + - compatible + Usage: required + Value type: <string> + Definition: Must include "fsl,srio-rmu-vX.Y", "fsl,srio-rmu". + + The version X.Y should match the general SRIO controller's IP Block + revision register's Major(X) and Minor (Y) value. + + - reg + Usage: required + Value type: <prop-encoded-array> + Definition: A standard property. Specifies the physical address and + length of the SRIO configuration registers for message units + and doorbell units. + + - fsl,liodn + Usage: optional-but-recommended (for devices with PAMU) + Value type: <prop-encoded-array> + Definition: The logical I/O device number for the PAMU (IOMMU) to be + correctly configured for SRIO accesses. The property should + not exist on devices that do not support PAMU. + + The LIODN value is associated with all RMU transactions + (msg-unit, doorbell, port-write). + +Sub-Nodes for RMU: The RMU node is composed of multiple sub-nodes that +correspond to the actual sub-controllers in the RMU. The manual for a given +SoC will detail which and how many of these sub-controllers are implemented. + +Message Unit: + + - compatible + Usage: required + Value type: <string> + Definition: Must include "fsl,srio-msg-unit-vX.Y", "fsl,srio-msg-unit". + + The version X.Y should match the general SRIO controller's IP Block + revision register's Major(X) and Minor (Y) value. + + - reg + Usage: required + Value type: <prop-encoded-array> + Definition: A standard property. Specifies the physical address and + length of the SRIO configuration registers for message units + and doorbell units. + + - interrupts + Usage: required + Value type: <prop_encoded-array> + Definition: Specifies the interrupts generated by this device. The + value of the interrupts property consists of one interrupt + specifier. The format of the specifier is defined by the + binding document describing the node's interrupt parent. + + A pair of IRQs are specified in this property. The first + element is associated with the transmit (TX) interrupt and the + second element is associated with the receive (RX) interrupt. + +Doorbell Unit: + + - compatible + Usage: required + Value type: <string> + Definition: Must include: + "fsl,srio-dbell-unit-vX.Y", "fsl,srio-dbell-unit" + + The version X.Y should match the general SRIO controller's IP Block + revision register's Major(X) and Minor (Y) value. + + - reg + Usage: required + Value type: <prop-encoded-array> + Definition: A standard property. Specifies the physical address and + length of the SRIO configuration registers for message units + and doorbell units. + + - interrupts + Usage: required + Value type: <prop_encoded-array> + Definition: Specifies the interrupts generated by this device. The + value of the interrupts property consists of one interrupt + specifier. The format of the specifier is defined by the + binding document describing the node's interrupt parent. + + A pair of IRQs are specified in this property. The first + element is associated with the transmit (TX) interrupt and the + second element is associated with the receive (RX) interrupt. + +Port-Write Unit: + + - compatible + Usage: required + Value type: <string> + Definition: Must include: + "fsl,srio-port-write-unit-vX.Y", "fsl,srio-port-write-unit" + + The version X.Y should match the general SRIO controller's IP Block + revision register's Major(X) and Minor (Y) value. + + - reg + Usage: required + Value type: <prop-encoded-array> + Definition: A standard property. Specifies the physical address and + length of the SRIO configuration registers for message units + and doorbell units. + + - interrupts + Usage: required + Value type: <prop_encoded-array> + Definition: Specifies the interrupts generated by this device. The + value of the interrupts property consists of one interrupt + specifier. The format of the specifier is defined by the + binding document describing the node's interrupt parent. + + A single IRQ that handles port-write conditions is + specified by this property. (Typically shared with error). + + Note: All other standard properties (see the ePAPR) are allowed + but are optional. + +Example: + rmu: rmu@d3000 { + compatible = "fsl,srio-rmu"; + reg = <0xd3000 0x400>; + ranges = <0x0 0xd3000 0x400>; + fsl,liodn = <0xc8>; + + message-unit@0 { + compatible = "fsl,srio-msg-unit"; + reg = <0x0 0x100>; + interrupts = < + 60 2 0 0 /* msg1_tx_irq */ + 61 2 0 0>;/* msg1_rx_irq */ + }; + message-unit@100 { + compatible = "fsl,srio-msg-unit"; + reg = <0x100 0x100>; + interrupts = < + 62 2 0 0 /* msg2_tx_irq */ + 63 2 0 0>;/* msg2_rx_irq */ + }; + doorbell-unit@400 { + compatible = "fsl,srio-dbell-unit"; + reg = <0x400 0x80>; + interrupts = < + 56 2 0 0 /* bell_outb_irq */ + 57 2 0 0>;/* bell_inb_irq */ + }; + port-write-unit@4e0 { + compatible = "fsl,srio-port-write-unit"; + reg = <0x4e0 0x20>; + interrupts = <16 2 1 11>; + }; + };
Documentation/devicetree/bindings/powerpc/fsl/srio.txt new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH v2 5/5 powerpc/8xxx: Update device tree bus probe for new RapidIO node binding
In reply to Kumar GalaFrom: Kai Jiang <[email protected]>
Update of_platform_bus_probe() RapidIO node to be compitable with new RapidIO dts compatible property.
--- arch/powerpc/platforms/85xx/corenet_ds.c | 2 +- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 +- arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/platforms/85xx/corenet_ds.c +1 -1
@@ -112,7 +112,7 @@ static const struct of_device_id of_device_ids[] __devinitconst = { .compatible = "simple-bus" }, { - .compatible = "fsl,rapidio-delta", + .compatible = "fsl,srio", }, { .compatible = "fsl,p4080-pcie",
arch/powerpc/platforms/85xx/mpc85xx_mds.c +1 -1
@@ -433,7 +433,7 @@ static struct of_device_id mpc85xx_ids[] = { { .compatible = "soc", }, { .compatible = "simple-bus", }, { .compatible = "gianfar", }, - { .compatible = "fsl,rapidio-delta", }, + { .compatible = "fsl,srio", }, { .compatible = "fsl,mpc8548-guts", }, { .compatible = "gpio-leds", }, {},
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +1 -1
@@ -161,7 +161,7 @@ mpc86xx_time_init(void)static __initdata struct of_device_id of_bus_ids[] = { { .compatible ="simple-bus" , }, - { .compatible ="fsl,rapidio-delta" , }, + { .compatible ="fsl,srio" , }, { .compatible ="gianfar" , }, {}, };
Signature · 1 line
1.7.3.4
PATCH v2 2/5 fsl-rio: Split rio driver into two parts, RapidIO endpoint and message unit
In reply to Kumar GalaFrom: Liu Gang <[email protected]>
The Freescale PowerPC RapidIO controller consists of a RapidIO endpoint and a RapidIO message unit(RMU). Or use RapidIO message manager(RMan) to replace the RMU in DPAA architecture. Therefore, we should split the code into two function modules according to the hardware architecture. Add new struct for RMU module, and new initialization function to set up RMU module. This policy is very conducive to adding new module like RMan, or adding multi-ports or message units support.
--- arch/powerpc/sysdev/Makefile | 2 +- arch/powerpc/sysdev/fsl_rio.c | 1152 +--------------------------------------- arch/powerpc/sysdev/fsl_rio.h | 78 +++ arch/powerpc/sysdev/fsl_rmu.c | 1163 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1267 insertions(+), 1128 deletions(-) create mode 100644 arch/powerpc/sysdev/fsl_rio.h create mode 100644 arch/powerpc/sysdev/fsl_rmu.c
arch/powerpc/sysdev/Makefile +1 -1
@@ -20,7 +20,7 @@ obj-$(CONFIG_FSL_LBC) += fsl_lbc.o obj-$(CONFIG_FSL_GTM) += fsl_gtm.o obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o -obj-$(CONFIG_FSL_RIO) += fsl_rio.o +obj-$(CONFIG_FSL_RIO) += fsl_rio.o fsl_rmu.o obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o obj-$(CONFIG_QUICC_ENGINE) += qe_lib/ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/
arch/powerpc/sysdev/fsl_rio.c +25 -1127
1,283 lines not on this page · raw message
arch/powerpc/sysdev/fsl_rio.h new file +78 -0
78 lines not on this page · raw message
arch/powerpc/sysdev/fsl_rmu.c new file +1163 -0
1,163 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH v2 3/5 fsl-rio: Add two ports and rapidio message units support
From: Liu Gang <[email protected]>
Usually, freescale rapidio endpoint can support one 1X or two 4X LP-Serial link interfaces, and rapidio message transactions can be implemented by two message units. This patch adds the support of two rapidio ports and initializes message unit 0 and message unit 1. And these ports and message units can work simultaneously.
--- arch/powerpc/sysdev/fsl_rio.c | 406 +++++++++++++++++++++++++------------- arch/powerpc/sysdev/fsl_rio.h | 73 ++++++- arch/powerpc/sysdev/fsl_rmu.c | 440 ++++++++++++++++++++--------------------- 3 files changed, 551 insertions(+), 368 deletions(-)
arch/powerpc/sysdev/fsl_rio.c +271 -135
@@ -45,7 +45,6 @@#define RIO_PORT1_IECSR 0x10130#define RIO_PORT2_IECSR 0x101B0 -#define RIO_ATMU_REGS_OFFSET 0x10c00#define RIO_GCCSR 0x13c#define RIO_ESCSR 0x158#define ESCSR_CLEAR 0x07120204
@@ -74,6 +73,11 @@ : "b" (addr), "i" (-EFAULT), "0" (err))void __iomem *rio_regs_win; +void __iomem *rmu_regs_win; +resource_size_t rio_law_start; + +struct fsl_rio_dbell *dbell; +struct fsl_rio_pw *pw;#ifdef CONFIG_E500 int fsl_rio_mcheck_exception (struct pt_regs *regs)
@@ -120,7 +124,7 @@ static int fsl_local_config_read(struct rio_mport *mport, {struct rio_priv *priv = mport->priv;pr_debug ("fsl_local_config_read: index %d offset %8.8x\n" , index, - offset); + offset); *data =in_be32 (priv->regs_win + offset);return 0 ;
@@ -173,7 +177,7 @@ fsl_rio_config_read(struct rio_mport *mport, int index, u16 destid,pr_debug ("fsl_rio_config_read:" " index %d destid %d hopcount %d offset %8.8x len %d\n" , - index, destid, hopcount, offset, len); + index, destid, hopcount, offset, len);/* 16MB maintenance window possible */ /* allow only aligned access to maintenance registers */
@@ -230,8 +234,8 @@ fsl_rio_config_write(struct rio_mport *mport, int index, u16 destid,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); +" index %d destid %d hopcount %d offset %8.8x len %d val %8.8x\n" , + index, destid, hopcount, offset, len, val);/* 16MB maintenance windows possible */ /* allow only aligned access to maintenance registers */
@@ -260,7 +264,7 @@ fsl_rio_config_write(struct rio_mport *mport, int index, u16 destid,return 0 ; } -void fsl_rio_port_error_handler (struct rio_mport *port,int offset) +void fsl_rio_port_error_handler (int offset) {/*XXX: Error recovery is not implemented, we just clear errors */ out_be32 ((u32 *)(rio_regs_win +RIO_LTLEDCSR ),0 );
@@ -331,16 +335,21 @@ int fsl_rio_setup(struct platform_device *dev)struct rio_mport *port;struct rio_priv *priv;int rc =0 ; -const u32 *dt_range, *cell; -struct resource regs; +const u32 *dt_range, *cell, *port_index; +u32 active_ports =0 ; +struct resource regs, rmu_regs; +struct device_node *np, *rmu_node;int rlen;u32 ccsr; -u64 law_start, law_size; +u64 range_start, range_size;int paw, aw, sw; +u32 i; +static int tmp; +struct device_node *rmu_np[MAX_MSG_UNIT_NUM ] = {NULL };if (!dev->dev.of_node) {dev_err (&dev->dev,"Device OF-Node is NULL" ); -return -EFAULT ; +return -ENODEV ; } rc =of_address_to_resource (dev->dev.of_node,0 , ®s);
@@ -353,34 +362,13 @@ int fsl_rio_setup(struct platform_device *dev) dev->dev.of_node->full_name);dev_info (&dev->dev,"Regs: %pR\n" , ®s); - dt_range =of_get_property (dev->dev.of_node,"ranges" , &rlen); -if (!dt_range) { -dev_err (&dev->dev,"Can't get %s property 'ranges'\n" , - dev->dev.of_node->full_name); -return -EFAULT ; + rio_regs_win =ioremap (regs.start,resource_size (®s)); +if (!rio_regs_win) { +dev_err (&dev->dev,"Unable to map rio register window\n" ); + rc = -ENOMEM ; + goto err_rio_regs; } -/* Get node address wide */ - cell =of_get_property (dev->dev.of_node,"#address-cells" ,NULL ); -if (cell) - aw = *cell; -else - aw =of_n_addr_cells (dev->dev.of_node); -/* Get node size wide */ - cell =of_get_property (dev->dev.of_node,"#size-cells" ,NULL ); -if (cell) - sw = *cell; -else - sw =of_n_size_cells (dev->dev.of_node); -/* Get parent address wide wide */ - paw =of_n_addr_cells (dev->dev.of_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 =kzalloc (sizeof (struct rio_ops ),GFP_KERNEL );if (!ops) { rc = -ENOMEM ;
@@ -390,130 +378,278 @@ int fsl_rio_setup(struct platform_device *dev) ops->lcwrite = fsl_local_config_write; ops->cread = fsl_rio_config_read; ops->cwrite = fsl_rio_config_write; + ops->dsend = fsl_rio_doorbell_send; ops->pwenable = fsl_rio_pw_enable; - - port =kzalloc (sizeof (struct rio_mport ),GFP_KERNEL ); -if (!port) { + ops->open_outb_mbox = fsl_open_outb_mbox; + ops->open_inb_mbox = fsl_open_inb_mbox; + ops->close_outb_mbox = fsl_close_outb_mbox; + ops->close_inb_mbox = fsl_close_inb_mbox; + ops->add_outb_message = fsl_add_outb_message; + ops->add_inb_buffer = fsl_add_inb_buffer; + ops->get_inb_message = fsl_get_inb_message; + + rmu_node =of_parse_phandle (dev->dev.of_node,"fsl,srio-rmu-handle" ,0 ); +if (!rmu_node) + goto err_rmu; + rc =of_address_to_resource (rmu_node,0 , &rmu_regs); +if (rc) { +dev_err (&dev->dev,"Can't get %s property 'reg'\n" , + rmu_node->full_name); + goto err_rmu; + } + rmu_regs_win =ioremap (rmu_regs.start,resource_size (&rmu_regs)); +if (!rmu_regs_win) { +dev_err (&dev->dev,"Unable to map rmu register window\n" ); rc = -ENOMEM ; - goto err_port; + goto err_rmu; + } +for_each_compatible_node (np,NULL ,"fsl,srio-msg-unit" ) { + rmu_np[tmp] = np; + tmp++; } - port->index =0 ; - priv =kzalloc (sizeof (struct rio_priv ),GFP_KERNEL ); -if (!priv) { -printk (KERN_ERR "Can't alloc memory for 'priv'\n" ); +/*set up doobell node*/ + np =of_find_compatible_node (NULL ,NULL ,"fsl,srio-dbell-unit" ); +if (!np) { + rc = -ENODEV ; + goto err_dbell; + } + dbell =kzalloc (sizeof (struct fsl_rio_dbell ),GFP_KERNEL ); +if (!(dbell)) { +dev_err (&dev->dev,"Can't alloc memory for 'fsl_rio_dbell'\n" ); rc = -ENOMEM ; - goto err_priv; + goto err_dbell; } + dbell->dev = &dev->dev; + dbell->bellirq =irq_of_parse_and_map (np,1 ); +dev_info (&dev->dev,"bellirq: %d\n" , dbell->bellirq); -INIT_LIST_HEAD (&port->dbells); - port->iores.start = law_start; - port->iores.end = law_start + law_size -1 ; - port->iores.flags =IORESOURCE_MEM ; - port->iores.name ="rio_io_win" ; - -if (request_resource (&iomem_resource, &port->iores) <0 ) { -dev_err (&dev->dev,"RIO: Error requesting master port region" -" 0x%016llx-0x%016llx\n" , - (u64 )port->iores.start, (u64 )port->iores.end); - rc = -ENOMEM ; - goto err_res; + aw =of_n_addr_cells (np); + dt_range =of_get_property (np,"reg" , &rlen); +if (!dt_range) { +pr_err ("%s: unable to find 'reg' property\n" , + np->full_name); + rc = -ENOMEM ; + goto err_pw; + } + range_start =of_read_number (dt_range, aw); + dbell->dbell_regs = (struct rio_dbell_regs *)(rmu_regs_win + + (u32 )range_start); + dbell->dbell_atmu_regs = (struct rio_atmu_regs *)(rio_regs_win + +RIO_ATMU_REGS_DBELL_OFFSET ); + +/*set up port write node*/ + np =of_find_compatible_node (NULL ,NULL ,"fsl,srio-port-write-unit" ); +if (!np) { + rc = -ENODEV ; + goto err_pw; + } + pw =kzalloc (sizeof (struct fsl_rio_pw ),GFP_KERNEL ); +if (!(pw)) { +dev_err (&dev->dev,"Can't alloc memory for 'fsl_rio_pw'\n" ); + rc = -ENOMEM ; + goto err_pw; + } + pw->dev = &dev->dev; + pw->pwirq =irq_of_parse_and_map (np,0 ); +dev_info (&dev->dev,"pwirq: %d\n" , pw->pwirq); + aw =of_n_addr_cells (np); + dt_range =of_get_property (np,"reg" , &rlen); +if (!dt_range) { +pr_err ("%s: unable to find 'reg' property\n" , + np->full_name); + rc = -ENOMEM ; + goto err; } + range_start =of_read_number (dt_range, aw); + pw->pw_regs = (struct rio_pw_regs *)(rmu_regs_win + (u32 )range_start); + +/*set up ports node*/ +for_each_child_of_node (dev->dev.of_node, np) { + port_index =of_get_property (np,"cell-index" ,NULL ); +if (!port_index) { +dev_err (&dev->dev,"Can't get %s property 'cell-index'\n" , + np->full_name); +continue ; + } - priv->pwirq =irq_of_parse_and_map (dev->dev.of_node,0 ); -dev_info (&dev->dev,"pwirq: %d\n" , priv->pwirq); -strcpy (port->name,"RIO0 mport" ); - - priv->dev = &dev->dev; - - port->ops = ops; - port->priv = priv; - port->phys_efptr =0x100 ; - - priv->regs_win =ioremap (regs.start,resource_size (®s)); - rio_regs_win = priv->regs_win; - -/* Probe the master port phy type */ - ccsr =in_be32 (priv->regs_win +RIO_CCSR ); - port->phy_type = (ccsr &1 ) ?RIO_PHY_SERIAL :RIO_PHY_PARALLEL ; -dev_info (&dev->dev,"RapidIO PHY type: %s\n" , - (port->phy_type ==RIO_PHY_PARALLEL ) ?"parallel" : - ((port->phy_type ==RIO_PHY_SERIAL ) ?"serial" : -"unknown" )); -/* Checking the port training status */ -if (in_be32 ((priv->regs_win +RIO_ESCSR )) &1 ) { -dev_err (&dev->dev,"Port is not ready. " -"Try to restart connection...\n" ); -switch (port->phy_type) { -case RIO_PHY_SERIAL : -/* Disable ports */ -out_be32 (priv->regs_win +RIO_CCSR ,0 ); -/* Set 1x lane */ -setbits32 (priv->regs_win +RIO_CCSR ,0x02000000 ); -/* Enable ports */ -setbits32 (priv->regs_win +RIO_CCSR ,0x00600000 ); -break ; -case RIO_PHY_PARALLEL : -/* Disable ports */ -out_be32 (priv->regs_win +RIO_CCSR ,0x22000000 ); -/* Enable ports */ -out_be32 (priv->regs_win +RIO_CCSR ,0x44000000 ); -break ; + dt_range =of_get_property (np,"ranges" , &rlen); +if (!dt_range) { +dev_err (&dev->dev,"Can't get %s property 'ranges'\n" , + np->full_name); +continue ; } -msleep (100 ); -if (in_be32 ((priv->regs_win +RIO_ESCSR )) &1 ) { -dev_err (&dev->dev,"Port restart failed.\n" ); - rc = -ENOLINK ; - goto err; + +/* Get node address wide */ + cell =of_get_property (np,"#address-cells" ,NULL ); +if (cell) + aw = *cell; +else + aw =of_n_addr_cells (np); +/* Get node size wide */ + cell =of_get_property (np,"#size-cells" ,NULL ); +if (cell) + sw = *cell; +else + sw =of_n_size_cells (np); +/* Get parent address wide wide */ + paw =of_n_addr_cells (np); + range_start =of_read_number (dt_range + aw, paw); + range_size =of_read_number (dt_range + aw + paw, sw); + +dev_info (&dev->dev,"%s: LAW start 0x%016llx, size 0x%016llx.\n" , + np->full_name, range_start, range_size); + + port =kzalloc (sizeof (struct rio_mport ),GFP_KERNEL ); +if (!port) +continue ; + + i = *port_index -1 ; + port->index = (unsigned char )i; + + priv =kzalloc (sizeof (struct rio_priv ),GFP_KERNEL ); +if (!priv) { +dev_err (&dev->dev,"Can't alloc memory for 'priv'\n" ); +kfree (port); +continue ; } -dev_info (&dev->dev,"Port restart success!\n" ); - } -fsl_rio_info (&dev->dev, ccsr); - port->sys_size = (in_be32 ((priv->regs_win +RIO_PEF_CAR )) +INIT_LIST_HEAD (&port->dbells); + port->iores.start = range_start; + port->iores.end = port->iores.start + range_size -1 ; + port->iores.flags =IORESOURCE_MEM ; + port->iores.name ="rio_io_win" ; + +if (request_resource (&iomem_resource, &port->iores) <0 ) { +dev_err (&dev->dev,"RIO: Error requesting master port region" +" 0x%016llx-0x%016llx\n" , + (u64 )port->iores.start, (u64 )port->iores.end); +kfree (priv); +kfree (port); +continue ; + } +sprintf (port->name,"RIO mport %d" , i); + + priv->dev = &dev->dev; + port->ops = ops; + port->priv = priv; + port->phys_efptr =0x100 ; + priv->regs_win = rio_regs_win; + +/* Probe the master port phy type */ + ccsr =in_be32 (priv->regs_win +RIO_CCSR + i*0x20 ); + port->phy_type = (ccsr &1 ) ?RIO_PHY_SERIAL :RIO_PHY_PARALLEL ; +dev_info (&dev->dev,"RapidIO PHY type: %s\n" , + (port->phy_type ==RIO_PHY_PARALLEL ) ? +"parallel" : + ((port->phy_type ==RIO_PHY_SERIAL ) ?"serial" : +"unknown" )); +/* Checking the port training status */ +if (in_be32 ((priv->regs_win +RIO_ESCSR + i*0x20 )) &1 ) { +dev_err (&dev->dev,"Port %d is not ready. " +"Try to restart connection...\n" , i); +switch (port->phy_type) { +case RIO_PHY_SERIAL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0 ); +/* Set 1x lane */ +setbits32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0x02000000 ); +/* Enable ports */ +setbits32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0x00600000 ); +break ; +case RIO_PHY_PARALLEL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0x22000000 ); +/* Enable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0x44000000 ); +break ; + } +msleep (100 ); +if (in_be32 ((priv->regs_win + +RIO_ESCSR + i*0x20 )) &1 ) { +dev_err (&dev->dev, +"Port %d restart failed.\n" , i); +release_resource (&port->iores); +kfree (priv); +kfree (port); +continue ; + } +dev_info (&dev->dev,"Port %d restart success!\n" , i); + } +fsl_rio_info (&dev->dev, ccsr); + + 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 ); +dev_info (&dev->dev,"RapidIO Common Transport System size: %d\n" , + port->sys_size ?65536 :256 ); + +if (rio_register_mport (port)) { +release_resource (&port->iores); +kfree (priv); +kfree (port); +continue ; + } +if (port->host_deviceid >=0 ) +out_be32 (priv->regs_win +RIO_GCCSR ,RIO_PORT_GEN_HOST | +RIO_PORT_GEN_MASTER |RIO_PORT_GEN_DISCOVERED ); +else +out_be32 (priv->regs_win +RIO_GCCSR , +RIO_PORT_GEN_MASTER ); -if (rio_register_mport (port)) - goto err; + priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win + + ((i ==0 ) ?RIO_ATMU_REGS_PORT1_OFFSET : +RIO_ATMU_REGS_PORT2_OFFSET )); + + priv->maint_atmu_regs = priv->atmu_regs +1 ; + +/* Set to receive any dist ID for serial RapidIO controller. */ +if (port->phy_type ==RIO_PHY_SERIAL ) +out_be32 ((priv->regs_win + +RIO_ISR_AACR + i*0x80 ),RIO_ISR_AACR_AA ); -if (port->host_deviceid >=0 ) -out_be32 (priv->regs_win +RIO_GCCSR ,RIO_PORT_GEN_HOST | -RIO_PORT_GEN_MASTER |RIO_PORT_GEN_DISCOVERED ); -else -out_be32 (priv->regs_win +RIO_GCCSR ,0x00000000 ); +/* Configure maintenance transaction window */ +out_be32 (&priv->maint_atmu_regs->rowbar, + port->iores.start >>12 ); +out_be32 (&priv->maint_atmu_regs->rowar, +0x80077000 | (ilog2 (RIO_MAINT_WIN_SIZE ) -1 )); - priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win - +RIO_ATMU_REGS_OFFSET ); - priv->maint_atmu_regs = priv->atmu_regs +1 ; + priv->maint_win =ioremap (port->iores.start, +RIO_MAINT_WIN_SIZE ); -/* Set to receive any dist ID for serial RapidIO controller. */ -if (port->phy_type ==RIO_PHY_SERIAL ) -out_be32 ((priv->regs_win +RIO_ISR_AACR ),RIO_ISR_AACR_AA ); + rio_law_start = range_start; -/* Configure maintenance transaction window */ -out_be32 (&priv->maint_atmu_regs->rowbar, law_start >>12 ); -out_be32 (&priv->maint_atmu_regs->rowar, -0x80077000 | (ilog2 (RIO_MAINT_WIN_SIZE ) -1 )); +fsl_rio_setup_rmu (port, rmu_np[i]); - priv->maint_win =ioremap (law_start,RIO_MAINT_WIN_SIZE ); + dbell->mport[i] = port; -fsl_rio_setup_rmu (port, dev->dev.of_node); + active_ports++; + } + +if (!active_ports) { + rc = -ENOLINK ; + goto err; + } -fsl_rio_port_write_init (port); +fsl_rio_doorbell_init (dbell); +fsl_rio_port_write_init (pw);return 0 ; err: -iounmap (priv->regs_win); -release_resource (&port->iores); -err_res: -kfree (priv); -err_priv: -kfree (port); -err_port: +kfree (pw); +err_pw: +kfree (dbell); +err_dbell: +iounmap (rmu_regs_win); +err_rmu:kfree (ops); err_ops: +iounmap (rio_regs_win); +err_rio_regs:return rc; }
@@ -529,7 +665,7 @@ static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev)static const struct of_device_id fsl_of_rio_rpn_ids[] = { { - .compatible ="fsl,rapidio-delta" , + .compatible ="fsl,srio" , }, {}, };
arch/powerpc/sysdev/fsl_rio.h +66 -7
104 lines not on this page · raw message
arch/powerpc/sysdev/fsl_rmu.c +214 -226
803 lines not on this page · raw message
Signature · 1 line
1.7.3.4
RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
Quoted 6 lines · Kumar Gala
From: Liu Gang <[email protected]>
Usually, freescale rapidio endpoint can support one 1X or two 4X LP- Serial
link interfaces, and rapidio message transactions can be implemented
by
Quoted 1 line
two
Is the number of 1x ports described correctly?
Can we have two 1x ports as well?
Quoted 3 lines
message units. This patch adds the support of two rapidio ports and initializes message unit 0 and message unit 1. And these ports and message
... skip ...
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 9 lines
arch/powerpc/sysdev/fsl_rio.c +4
-0+ +/* Probe the master port phy type */ + ccsr =in_be32 (priv->regs_win +RIO_CCSR + i*0x20 ); + port->phy_type = (ccsr & 1) ? RIO_PHY_SERIAL :
RIO_PHY_PARALLEL;arch/powerpc/sysdev/fsl_rio.c +4
-0+ dev_info(&dev->dev, "RapidIO PHY type: %s\n", + (port->phy_type == RIO_PHY_PARALLEL) ? + "parallel" : + ((port->phy_type == RIO_PHY_SERIAL) ?
"serial"
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 4 lines
:
arch/powerpc/sysdev/fsl_rio.c +3
-0+ "unknown")); +/* Checking the port training status */ +if (in_be32 ((priv->regs_win +RIO_ESCSR + i*0x20 )) &1 )
{
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rio.c +10
-0+dev_err (&dev->dev,"Port %d is not ready. " +"Try to restart connection...\n" , i); +switch (port->phy_type) { +case RIO_PHY_SERIAL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0 ); +/* Set 1x lane */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x02000000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x00600000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 5 lines
arch/powerpc/sysdev/fsl_rio.c +5
-0+break ; +case RIO_PHY_PARALLEL : +/* Disable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x22000000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x44000000);
Review
Quoted 2 lines
(quoted diff) +2
-0+ break; + }
Probably this may be a good moment to drop the support for parallel link.
Especially after you renamed controller to "srio" in the device tree.
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rio.c +11
-0+msleep (100 ); +if (in_be32 ((priv->regs_win + +RIO_ESCSR + i*0x20 )) &1 ) { +dev_err (&dev->dev, +"Port %d restart failed.\n" , i); +release_resource (&port->iores); +kfree (priv); +kfree (port); +continue ; + } + dev_info(&dev->dev, "Port %d restart
success!\n", i);
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+ } +fsl_rio_info (&dev->dev, ccsr); +
... skip ...
Review
Quoted 3 lines
struct
rio_msg_regs{(quoted diff) +0
-1- u32 omr; /* 0xD_3000 - Outbound message 0 mode register
*/
Review
Quoted 1 line
(quoted diff) +0
-1- u32 osr; /* 0xD_3004 - Outbound message 0 status register
*/
arch/powerpc/sysdev/fsl_rmu.c
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +2
-1+u32 omr; +u32 osr;u32 pad1; -u32 odqdpar;/* 0xD_300C - Outbound message 0 descriptor queue
arch/powerpc/sysdev/fsl_rmu.c +1
-4-dequeue pointer address register */ +u32 odqdpar;u32 pad2; -u32 osar;/* 0xD_3014 - Outbound message 0 source address -register */ -u32 odpr;/* 0xD_3018 - Outbound message 0 destination
port
Review
Quoted 5 lines
(quoted diff) +0
-2- register */ - u32 odatr; /* 0xD_301C - Outbound message 0 destinationattributes
(quoted diff) +0
-2- Register*/ - u32 odcr; /* 0xD_3020 - Outbound message 0 double-word
count
arch/powerpc/sysdev/fsl_rmu.c
Quoted 13 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-2-register */ +u32 osar; +u32 odpr; +u32 odatr; +u32 odcr;u32 pad3; -u32 odqepar;/* 0xD_3028 - Outbound message 0 descriptor queue
arch/powerpc/sysdev/fsl_rmu.c +1
-3-enqueue pointer address register */ +u32 odqepar;u32 pad4[13 ]; -u32 imr;/* 0xD_3060 - Inbound message 0 mode register */ -u32 isr;/* 0xD_3064 - Inbound message 0 status register
*/
Quoted 10 lines
arch/powerpc/sysdev/fsl_rmu.c +2
-1+u32 imr; +u32 isr;u32 pad5; -u32 ifqdpar;/* 0xD_306C - Inbound message 0 frame queue dequeue
arch/powerpc/sysdev/fsl_rmu.c +1
-2-pointer address register*/ +u32 ifqdpar;u32 pad6; -u32 ifqepar;/* 0xD_3074 - Inbound message 0 frame queue enqueue
arch/powerpc/sysdev/fsl_rmu.c
Quoted 4 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-4-pointer address register */ -u32 pad7[226 ]; -u32 odmr;/* 0xD_3400 - Outbound doorbell mode register */ -u32 odsr;/* 0xD_3404 - Outbound doorbell status register
*/
arch/powerpc/sysdev/fsl_rmu.c line 134
Quoted 2 lines
arch/powerpc/sysdev/fsl_rmu.c +2
-0+u32 ifqepar; +u32 pad7;
Do we need pad7 here?
Quoted 8 lines
arch/powerpc/sysdev/fsl_rmu.c +5
-2+}; + +struct rio_dbell_regs { +u32 odmr; +u32 odsr;u32 res0[4 ]; -u32 oddpr;/* 0xD_3418 - Outbound doorbell destination port -register */
... skip ...
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void · line 329
Quoted 5 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0@@ -340,35 +327,45 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)" sid %2.2x tid %2.2x info %4.4x\n" , DBELL_SID(dmsg), DBELL_TID(dmsg),
DBELL_INF(dmsg));
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-5-list_for_each_entry (dbell, &port->dbells, node) { -if ((dbell->res->start <=DBELL_INF (dmsg)) && - (dbell->res->end >=DBELL_INF (dmsg))) { - found =1 ; -break ; +for (i =0 ; i <MAX_PORT_NUM ; i++) { +if (fsl_dbell->mport[i]) { + list_for_each_entry(dbell, + &fsl_dbell->mport[i]->dbells,
node) {
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +11
-0+if ((dbell->res->start + <=DBELL_INF (dmsg)) + && (dbell->res->end + >=DBELL_INF (dmsg))) { + found =1 ; +break ; + } + } +if (found && dbell->dinb) { + dbell->dinb(fsl_dbell->mport[i], + dbell->dev_id,
DBELL_SID(dmsg),
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance) · line 350
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-0+DBELL_TID (dmsg), + DBELL_INF(dmsg)); +break ; + } } }
Do we need to check for matching DBELL_TID and mport destID here and scan only doorbell list attached to the right port? Otherwise this may call service routine associated with doorbell on a wrong port.
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 4 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-4-if (found) { - dbell->dinb(port, dbell->dev_id, - DBELL_SID(dmsg), - DBELL_TID(dmsg),
DBELL_INF(dmsg));
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 13 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-3- }else { + +if (!found) {pr_debug ("RIO: spurious doorbell," " sid %2.2x tid %2.2x info %4.4x\n" ,DBELL_SID (dmsg),DBELL_TID (dmsg),DBELL_INF (dmsg)); } -setbits32 (&rmu->msg_regs->dmr,DOORBELL_DMR_DI ); -out_be32 (&rmu->msg_regs->dsr,DOORBELL_DSR_DIQI ); +setbits32 (&fsl_dbell->dbell_regs->dmr,DOORBELL_DMR_DI ); + out_be32(&fsl_dbell->dbell_regs->dsr,
DOORBELL_DSR_DIQI);
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0} out:return IRQ_HANDLED ; }
... skip ...
Quoted 5 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0@@ -1114,50 +1104,48 @@ int fsl_rio_setup_rmu(struct rio_mport *mport, struct device_node *node) {struct rio_priv *priv;struct fsl_rmu *rmu;
arch/powerpc/sysdev/fsl_rmu.c int fsl_rio_setup_rmu(struct rio_mport *mport, · line 1114
Quoted 10 lines
arch/powerpc/sysdev/fsl_rmu.c +6
-3-struct rio_ops *ops; +u64 msg_start; +const u32 *msg_addr; +int mlen; +int aw; -if (!mport || !mport->priv || !node) -return -1 ; +if (!mport || !mport->priv) +return -EFAULT ;
EINVAL may be better here?
arch/powerpc/sysdev/fsl_rmu.c int fsl_rio_setup_rmu(struct rio_mport *mport, struct device_node *node) · line 1120
Quoted 7 lines
arch/powerpc/sysdev/fsl_rmu.c +7
-0+ + priv = mport->priv; + +if (!node) { +dev_warn (priv->dev,"Can't get %s property 'fsl,rmu'\n" , + priv->dev->of_node->full_name); +return -EFAULT ;
EINVAL as well?
Review int fsl_rio_setup_rmu(struct rio_mport *mport, · line 1122
Quoted 1 line
(quoted diff) +1
-0+ }
Regards,
Alex.
RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
Hi, Alex,
Thanks for your comments, please find my replies inlines.
-----Original Message-----
From: Bounine, Alexandre [mailto:[email protected]]=20
Sent: Thursday, October 20, 2011 3:54 AM
To: Kumar Gala; [email protected]
Cc: Andrew Morton; Liu Gang-B34182; [email protected]
Subject: RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message uni= ts support
Quoted 6 lines · Kumar Gala
=20
From: Liu Gang <[email protected]>
=20
Usually, freescale rapidio endpoint can support one 1X or two 4X LP-=20 Serial link interfaces, and rapidio message transactions can be=20 implemented
by
Quoted 1 line
two
Is the number of 1x ports described correctly?
Can we have two 1x ports as well?=20
[Liu Gang-B34182] Yes you are right. endpoint can also have two 1x ports. I= 'll correct it.
Quoted 3 lines
message units. This patch adds the support of two rapidio ports and=20 initializes message unit 0 and message unit 1. And these ports and=20 message
... skip ...
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 9 lines
arch/powerpc/sysdev/fsl_rio.c +4
-0+ +/* Probe the master port phy type */ + ccsr =3D in_be32(priv->regs_win + RIO_CCSR + i*0x20); + port->phy_type =3D (ccsr & 1) ? RIO_PHY_SERIAL :
RIO_PHY_PARALLEL;arch/powerpc/sysdev/fsl_rio.c +4
-0+dev_info (&dev->dev,"RapidIO PHY type: %s\n" , + (port->phy_type =3D=3D RIO_PHY_PARALLEL) ? +"parallel" : + ((port->phy_type =3D=3D RIO_PHY_SERIAL) ?
"serial"
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 4 lines
:
arch/powerpc/sysdev/fsl_rio.c +3
-0+ "unknown")); +/* Checking the port training status */ +if (in_be32 ((priv->regs_win +RIO_ESCSR + i*0x20 )) &1 )
{
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rio.c +10
-0+dev_err (&dev->dev,"Port %d is not ready. " +"Try to restart connection...\n" , i); +switch (port->phy_type) { +case RIO_PHY_SERIAL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0 ); +/* Set 1x lane */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x02000000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x00600000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 5 lines
arch/powerpc/sysdev/fsl_rio.c +5
-0+break ; +case RIO_PHY_PARALLEL : +/* Disable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x22000000);
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x44000000);
Review
Quoted 2 lines
(quoted diff) +2
-0+ break; + }
Probably this may be a good moment to drop the support for parallel link. Especially after you renamed controller to "srio" in the device tree. [Liu Gang-B34182] I'm also considering if we should drop the parallel link = support and doorbell outbound ATMU configuration.
I found some older powerpc chips support parallel link, like mpc8540 and so=
on. But DTS files of these chips do not support
Rapidio nodes. For example we can't find rapidio node in arch/powerpc/boot/= dts/mpc8540ads.dts file. So can we conclude that
these chips with parallel rapidio link do not need the support for rapidio = module and the code for parallel link can be removed?=20
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rio.c +11
-0+msleep (100 ); +if (in_be32 ((priv->regs_win + +RIO_ESCSR + i*0x20 )) &1 ) { +dev_err (&dev->dev, +"Port %d restart failed.\n" , i); +release_resource (&port->iores); +kfree (priv); +kfree (port); +continue ; + } + dev_info(&dev->dev, "Port %d restart
success!\n", i);
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+ } +fsl_rio_info (&dev->dev, ccsr); +
... skip ...
Quoted 3 lines
=20
structrio_msg_regs{
- u32 omr; /* 0xD_3000 - Outbound message 0 mode register
*/
Quoted 1 line
- u32 osr; /* 0xD_3004 - Outbound message 0 status register
*/
arch/powerpc/sysdev/fsl_rmu.c
Quoted 11 lines
+ u32 omr;
+ u32 osr;
u32 pad1;
- u32 odqdpar; /* 0xD_300C - Outbound message 0 descriptor queuearch/powerpc/sysdev/fsl_rmu.c +1
-4-dequeue pointer address register */ +u32 odqdpar;u32 pad2; -u32 osar;/* 0xD_3014 - Outbound message 0 source address -register */ -u32 odpr;/* 0xD_3018 - Outbound message 0 destination
port
Quoted 5 lines
- register */
- u32 odatr; /* 0xD_301C - Outbound message 0 destination attributes
- Register*/
- u32 odcr; /* 0xD_3020 - Outbound message 0 double-word
count
Quoted 5 lines
- register */
+ u32 osar;
+ u32 odpr;
+ u32 odatr;
+ u32 odcr;
Quoted 8 lines
u32 pad3;
- u32 odqepar; /* 0xD_3028 - Outbound message 0 descriptor queue
- enqueue pointer address register */
+ u32 odqepar;
u32 pad4[13];
- u32 imr; /* 0xD_3060 - Inbound message 0 mode register */
- u32 isr; /* 0xD_3064 - Inbound message 0 status register
*/
Quoted 6 lines
+ u32 imr;
+ u32 isr;
u32 pad5;
- u32 ifqdpar; /* 0xD_306C - Inbound message 0 frame queue dequeue
- pointer address register*/
Quoted 8 lines
+ u32 ifqdpar;
u32 pad6;
- u32 ifqepar; /* 0xD_3074 - Inbound message 0 frame queue enqueue
- pointer address register */
- u32 pad7[226];
- u32 odmr; /* 0xD_3400 - Outbound doorbell mode register */
- u32 odsr; /* 0xD_3404 - Outbound doorbell status register
*/
Quoted 2 lines
+ u32 ifqepar;
+ u32 pad7;
Do we need pad7 here?
[Liu Gang-B34182] Yeah, it's not required here. Forgot to remove it when re= -wrote this struct.
Quoted 8 lines
arch/powerpc/sysdev/fsl_rmu.c +5
-2+}; + +struct rio_dbell_regs { +u32 odmr; +u32 odsr;u32 res0[4 ]; -u32 oddpr;/* 0xD_3418 - Outbound doorbell destination port -register */
... skip ...
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void · line 329
Quoted 5 lines
=20
arch/powerpc/sysdev/fsl_rmu.c +0
-0@@ -340,35 +327,45 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)" sid %2.2x tid %2.2x info %4.4x\n" , DBELL_SID(dmsg), DBELL_TID(dmsg),
DBELL_INF(dmsg));
Review
Quoted 10 lines
=20
(quoted diff) +4
-5- list_for_each_entry(dbell, &port->dbells, node) { - if ((dbell->res->start <=3D DBELL_INF(dmsg)) && - (dbell->res->end >=3D DBELL_INF(dmsg))) { - found =3D 1; - break; + for (i =3D 0; i < MAX_PORT_NUM; i++) { + if (fsl_dbell->mport[i]) { + list_for_each_entry(dbell, + &fsl_dbell->mport[i]->dbells,
node) {
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +11
-0+if ((dbell->res->start + <=3D DBELL_INF(dmsg)) + && (dbell->res->end + >=3D DBELL_INF(dmsg))) { + found =3D 1; +break ; + } + } +if (found && dbell->dinb) { + dbell->dinb(fsl_dbell->mport[i], + dbell->dev_id,
DBELL_SID(dmsg),
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance) · line 350
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-0+DBELL_TID (dmsg), + DBELL_INF(dmsg)); +break ; + } } }
Do we need to check for matching DBELL_TID and mport destID here and scan o= nly doorbell list attached to the right port? Otherwise this may call servi= ce routine associated with doorbell on a wrong port.
[Liu Gang-B34182] Do you mean to match DBELL_TID and mport DevID? Usually t= his is a reliable method, but for the rapidio module of powerpc, will encou= nter some problem. We set the port's DevID by
the register "Base Device ID CSR" defined in Rapidio Specification. The rap= idio module of powerpc can support two ports but have only one the Base Dev= ice ID CSR. So these two ports will have the same
DevID. Although there are two registers "Alternate Device ID CSR" to separa= te deviceIDs for each port, they are specific registers of the freescale ra= pidio and can't be accessed by getting the extended feature space block offset. For this doobell issue, in order to call a right servic= e routine, perhaps we should ensure that different ports in different "res-=
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 6 lines
start and
res->end" configurations.arch/powerpc/sysdev/fsl_rmu.c +0
-4-if (found) { - dbell->dinb(port, dbell->dev_id, - DBELL_SID(dmsg), - DBELL_TID(dmsg),
DBELL_INF(dmsg));
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 13 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-3- }else { + +if (!found) {pr_debug ("RIO: spurious doorbell," " sid %2.2x tid %2.2x info %4.4x\n" ,DBELL_SID (dmsg),DBELL_TID (dmsg),DBELL_INF (dmsg)); } -setbits32 (&rmu->msg_regs->dmr,DOORBELL_DMR_DI ); -out_be32 (&rmu->msg_regs->dsr,DOORBELL_DSR_DIQI ); +setbits32 (&fsl_dbell->dbell_regs->dmr,DOORBELL_DMR_DI ); + out_be32(&fsl_dbell->dbell_regs->dsr,
DOORBELL_DSR_DIQI);
Quoted 6 lines
}
=20
out:
returnIRQ_HANDLED;
}
=20
... skip ...
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-1@@ -1114,50 +1104,48 @@ int fsl_rio_setup_rmu(struct rio_mport *mport,=20 struct device_node *node) {struct rio_priv *priv;struct fsl_rmu *rmu; -struct rio_ops *ops; +u64 msg_start; +const u32 *msg_addr; +int mlen; +int aw;=20
- if (!mport || !mport->priv || !node)
arch/powerpc/sysdev/fsl_rmu.c int fsl_rio_setup_rmu(struct rio_mport *mport, struct device_node *node) · line 1113
Quoted 3 lines
arch/powerpc/sysdev/fsl_rmu.c +2
-1-return -1 ; +if (!mport || !mport->priv) +return -EFAULT ;
EINVAL may be better here?
[Liu Gang-B34182] Yes EINVAL will be better and I'll correct. Thanks!
arch/powerpc/sysdev/fsl_rmu.c int fsl_rio_setup_rmu(struct rio_mport *mport, struct device_node *node) · line 1120
Quoted 7 lines
arch/powerpc/sysdev/fsl_rmu.c +7
-0+ + priv =3D mport->priv; + +if (!node) { +dev_warn (priv->dev,"Can't get %s property 'fsl,rmu'\n" , + priv->dev->of_node->full_name); +return -EFAULT ;
EINVAL as well?
[Liu Gang-B34182] Ditto.
Quoted 1 line
+ }
Regards,
Alex.=
RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
Quoted 6 lines · On Sat, Oct 22, 2011 at 1:15 AM, Liu Gang-B34182 <[email protected]> wrote:
=20
From: Bounine, Alexandre [mailto:[email protected]]
Sent: Thursday, October 20, 2011 3:54 AM
To: Kumar Gala; [email protected]
Cc: Andrew Morton; Liu Gang-B34182; [email protected]
Subject: RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio
message
Quoted 63 lines
units support
=20Quoted 6 lines · Kumar Gala
From: Liu Gang <[email protected]>
Usually, freescale rapidio endpoint can support one 1X or two 4X LP- Serial link interfaces, and rapidio message transactions can be implemented
by
Quoted 1 line
two
=20
Is the number of 1x ports described correctly?
Can we have two 1x ports as well?
[Liu Gang-B34182] Yes you are right. endpoint can also have two 1x ports. I'll correct it.
=20Quoted 3 lines
message units. This patch adds the support of two rapidio ports and initializes message unit 0 and message unit 1. And these ports and message
... skip ...
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 9 lines
arch/powerpc/sysdev/fsl_rio.c +4
-0+ +/* Probe the master port phy type */ + ccsr =3D in_be32(priv->regs_win + RIO_CCSR + i*0x20); + port->phy_type =3D (ccsr & 1) ? RIO_PHY_SERIAL :
RIO_PHY_PARALLEL;arch/powerpc/sysdev/fsl_rio.c +4
-0+dev_info (&dev->dev,"RapidIO PHY type: %s\n" , + (port->phy_type =3D=3D RIO_PHY_PARALLEL) ? +"parallel" : + ((port->phy_type =3D=3D RIO_PHY_SERIAL) ?"serial"
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 4 lines
:
arch/powerpc/sysdev/fsl_rio.c +3
-0+ "unknown")); +/* Checking the port training status */ +if (in_be32 ((priv->regs_win +RIO_ESCSR + i*0x20 )) &1 ){
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rio.c +10
-0+dev_err (&dev->dev,"Port %d is not ready. " +"Try to restart connection...\n" , i); +switch (port->phy_type) { +case RIO_PHY_SERIAL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0 ); +/* Set 1x lane */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x02000000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x00600000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 5 lines
arch/powerpc/sysdev/fsl_rio.c +5
-0+break ; +case RIO_PHY_PARALLEL : +/* Disable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x22000000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x44000000);Review
Quoted 2 lines
(quoted diff) +2
-0+ break; + }
Quoted 12 lines
=20
Probably this may be a good moment to drop the support for parallel link.
Especially after you renamed controller to "srio" in the device tree. [Liu Gang-B34182] I'm also considering if we should drop the parallel link support and doorbell outbound ATMU configuration.
I found some older powerpc chips support parallel link, like mpc8540 and so on. But DTS files of these chips do not support Rapidio nodes. For example we can't find rapidio node inarch/powerpc/boot/dts/mpc8540ads.dtsfile. So can we conclude that these chips with parallel rapidio link do not need the support for rapidio module and the code for parallel link can be removed?
We are not aware about any use of tsi500 P-RIO switches. I would consider parallel implementation as an early stage of RapidIO development which may be safely dropped.
I will keep P-RIO related definitions only because they are part of the spec. I consider removing tsi500 switch driver as well.
Quoted 2 lines
=20
Quoted 1 line
+ msleep(100);
... skip ...
Quoted 36 lines
=20
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void · line 329
Quoted 5 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0@@ -340,35 +327,45 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)" sid %2.2x tid %2.2x info %4.4x\n" , DBELL_SID(dmsg), DBELL_TID(dmsg),
DBELL_INF(dmsg));Review fsl_rio_dbell_handler(int irq, void · line 333
Quoted 10 lines
(quoted diff) +4
-5- list_for_each_entry(dbell, &port->dbells, node) { - if ((dbell->res->start <=3D DBELL_INF(dmsg)) && - (dbell->res->end >=3D DBELL_INF(dmsg))) { - found =3D 1; - break; + for (i =3D 0; i < MAX_PORT_NUM; i++) { + if (fsl_dbell->mport[i]) { + list_for_each_entry(dbell, + &fsl_dbell->mport[i]->dbells,node) {
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +11
-0+if ((dbell->res->start + <=3D DBELL_INF(dmsg)) + && (dbell->res->end + >=3D DBELL_INF(dmsg))) { + found =3D 1; +break ; + } + } +if (found && dbell->dinb) { + dbell->dinb(fsl_dbell->mport[i], + dbell->dev_id,
DBELL_SID(dmsg),arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance) · line 350
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-0+DBELL_TID (dmsg), + DBELL_INF(dmsg)); +break ; + } } }
Quoted 5 lines
=20
Do we need to check for matchingDBELL_TIDand mport destID here and scan only doorbell list attached to the right port? Otherwise this may call service routine associated with doorbell on a wrong port. [Liu Gang-B34182] Do you mean to matchDBELL_TIDand mport DevID?
Yes.
Quoted 3 lines
Usually this is a reliable method, but for the rapidio module of powerpc, will encounter some problem. We set the port's DevID by the register "Base Device ID CSR" defined in Rapidio Specification.
The
Quoted 5 lines
rapidio module of powerpc can support two ports but have only one the Base Device ID CSR. So these two ports will have the same DevID. Although there are two registers "Alternate Device ID CSR" to separate deviceIDs for each port, they are specific registers of the freescale rapidio and can't be accessed by getting the extended
feature
Quoted 3 lines
space block offset. For this doobell issue, in order to call a right service routine, perhaps we should ensure that different ports in different "
res->startandres->end" configurations.
This gives us an issue that has to be solved at some point. Splitting doorbell resources may be a way in this case but should be considered in context of RIO network with different endpoints and therefore
it will be some device-specific quirk.
Probably the best approach in this case is to keep doorbell handler as it is now (for purpose of this patchset) and address doorbell resource assignment during enumeration/discovery. At least this has to be well commented.=20
Quoted 19 lines
=20
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 4 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-4-if (found) { - dbell->dinb(port, dbell->dev_id, - DBELL_SID(dmsg), - DBELL_TID(dmsg),
DBELL_INF(dmsg));arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 13 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-3- }else { + +if (!found) {pr_debug ("RIO: spurious doorbell," " sid %2.2x tid %2.2x info %4.4x\n" ,DBELL_SID (dmsg),DBELL_TID (dmsg),DBELL_INF (dmsg)); } -setbits32 (&rmu->msg_regs->dmr,DOORBELL_DMR_DI ); -out_be32 (&rmu->msg_regs->dsr,DOORBELL_DSR_DIQI ); +setbits32 (&fsl_dbell->dbell_regs->dmr,DOORBELL_DMR_DI ); + out_be32(&fsl_dbell->dbell_regs->dsr,
Quoted 7 lines
DOORBELL_DSR_DIQI);Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0} out:return IRQ_HANDLED ; }
... skip ...
=20
Regards,
Alex.
RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
-----Original Message-----
From: Bounine, Alexandre [mailto:[email protected]]
Sent: Monday, October 24, 2011 9:51 PM
To: Liu Gang-B34182; Kumar Gala; [email protected]; Zang Roy-R61911
Cc: Andrew Morton; [email protected]
Subject: RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
Quoted 6 lines · On Sat, Oct 22, 2011 at 1:15 AM, Liu Gang-B34182 <[email protected]> wrote:
From: Bounine, Alexandre [mailto:[email protected]]
Sent: Thursday, October 20, 2011 3:54 AM
To: Kumar Gala; [email protected]
Cc: Andrew Morton; Liu Gang-B34182; [email protected]
Subject: RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio
message
Quoted 64 lines
units support
Quoted 6 lines · Kumar Gala
From: Liu Gang <[email protected]>
Usually, freescale rapidio endpoint can support one 1X or two 4X LP- Serial link interfaces, and rapidio message transactions can be implemented
by
Quoted 1 line
two
Is the number of 1x ports described correctly?
Can we have two 1x ports as well?
[Liu Gang-B34182] Yes you are right. endpoint can also have two 1x ports. I'll correct it.Quoted 3 lines
message units. This patch adds the support of two rapidio ports and initializes message unit 0 and message unit 1. And these ports and message
... skip ...
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 9 lines
(quoted diff) +4
-0+ + /* Probe the master port phy type */ ccsr = + in_be32(priv->regs_win + RIO_CCSR + i*0x20); port->phy_type = + (ccsr & 1) ? RIO_PHY_SERIAL :
RIO_PHY_PARALLEL;arch/powerpc/sysdev/fsl_rio.c +4
-0+ dev_info(&dev->dev, "RapidIO PHY type: %s\n", + (port->phy_type == RIO_PHY_PARALLEL) ? + "parallel" : + ((port->phy_type == RIO_PHY_SERIAL) ?"serial"
Review
Quoted 4 lines
:
(quoted diff) +3
-0+ "unknown")); + /* Checking the port training status */ if + (in_be32((priv->regs_win + RIO_ESCSR + i*0x20)) & 1){
arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rio.c +10
-0+dev_err (&dev->dev,"Port %d is not ready. " +"Try to restart connection...\n" , i); +switch (port->phy_type) { +case RIO_PHY_SERIAL : +/* Disable ports */ +out_be32 (priv->regs_win + +RIO_CCSR + i*0x20 ,0 ); +/* Set 1x lane */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x02000000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + setbits32(priv->regs_win + + RIO_CCSR + i*0x20,
0x00600000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 5 lines
arch/powerpc/sysdev/fsl_rio.c +5
-0+break ; +case RIO_PHY_PARALLEL : +/* Disable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x22000000);arch/powerpc/sysdev/fsl_rio.c int fsl_rio_setup(struct platform_device *dev)
Quoted 3 lines
arch/powerpc/sysdev/fsl_rio.c +3
-0+/* Enable ports */ + out_be32(priv->regs_win + + RIO_CCSR + i*0x20,
0x44000000);Review
Quoted 2 lines
(quoted diff) +2
-0+ break; + }
Quoted 11 lines
Probably this may be a good moment to drop the support for parallel link.
Especially after you renamed controller to "srio" in the device tree. [Liu Gang-B34182] I'm also considering if we should drop the parallel link support and doorbell outbound ATMU configuration.
I found some older powerpc chips support parallel link, like mpc8540 and so on. But DTS files of these chips do not support Rapidio nodes. For example we can't find rapidio node inarch/powerpc/boot/dts/mpc8540ads.dtsfile. So can we conclude that these chips with parallel rapidio link do not need the support for rapidio module and the code for parallel link can be removed?
We are not aware about any use of tsi500 P-RIO switches.
[Liu Gang-B34182] Yes perhaps no one uses the P-RIO switches now. I have used the tsi578 and remembered that this switch supports only 1x and 4x srio ports. I would consider parallel implementation as an early stage of RapidIO development which may be safely dropped.
[Liu Gang-B34182] Yeah, I agree with you.
I will keep P-RIO related definitions only because they are part of the spec. I consider removing tsi500 switch driver as well. [Liu Gang-B34182] I'll remove the support for P-RIO in fsl-rio driver. I think it's better to keep clear code than keep a rarely used function. Moreover, we can provide separate patches if P-RIO needed again.
Quoted 2 lines
Quoted 2 lines
+ msleep(100);
... skip ...
Quoted 37 lines
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void · line 329
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0@@ -340,35 +327,45 @@ fsl_rio_dbell_handler(int irq, void *dev_instance)" sid %2.2x tid %2.2x info %4.4x\n" , DBELL_SID(dmsg), DBELL_TID(dmsg),
DBELL_INF(dmsg));arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 10 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-5-list_for_each_entry (dbell, &port->dbells, node) { -if ((dbell->res->start <=DBELL_INF (dmsg)) && - (dbell->res->end >=DBELL_INF (dmsg))) { - found =1 ; -break ; +for (i =0 ; i <MAX_PORT_NUM ; i++) { +if (fsl_dbell->mport[i]) { + list_for_each_entry(dbell, + &fsl_dbell->mport[i]->dbells,node) {
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 11 lines
arch/powerpc/sysdev/fsl_rmu.c +11
-0+if ((dbell->res->start + <=DBELL_INF (dmsg)) + && (dbell->res->end + >=DBELL_INF (dmsg))) { + found =1 ; +break ; + } + } +if (found && dbell->dinb) { + dbell->dinb(fsl_dbell->mport[i], + dbell->dev_id,
DBELL_SID(dmsg),arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance) · line 350
Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-0+DBELL_TID (dmsg), + DBELL_INF(dmsg)); +break ; + } } }
Quoted 4 lines
Do we need to check for matching
DBELL_TIDand mport destID here and scan only doorbell list attached to the right port? Otherwise this may call service routine associated with doorbell on a wrong port. [Liu Gang-B34182] Do you mean to matchDBELL_TIDand mport DevID?
Yes.
Quoted 3 lines
Usually this is a reliable method, but for the rapidio module of powerpc, will encounter some problem. We set the port's DevID by the register "Base Device ID CSR" defined in Rapidio Specification.
The
Quoted 5 lines
rapidio module of powerpc can support two ports but have only one the Base Device ID CSR. So these two ports will have the same DevID. Although there are two registers "Alternate Device ID CSR" to separate deviceIDs for each port, they are specific registers of the freescale rapidio and can't be accessed by getting the extended
feature
Quoted 3 lines
space block offset. For this doobell issue, in order to call a right service routine, perhaps we should ensure that different ports in different "
res->startandres->end" configurations.
This gives us an issue that has to be solved at some point.
Splitting doorbell resources may be a way in this case but should be considered in context of RIO network with different endpoints and therefore it will be some device-specific quirk.
Probably the best approach in this case is to keep doorbell handler as it is now (for purpose of this patchset) and address doorbell resource assignment during enumeration/discovery. At least this has to be well commented. [Liu Gang-B34182] I think this is a very complex issue, and could be very difficult to be resolved if we can't separate DevIDs for each port.
Based on the current architecture of the RIO driver, the doorbell resource will be assigned by the application. For example, RIONET will assign the doorbell resource like this:
if ((rc = rio_request_inb_dbell(rnet->mport, (void *)ndev, RIONET_DOORBELL_JOIN, RIONET_DOORBELL_LEAVE, rionet_dbell_event)) < 0) goto out; The res->start and res->end were defined by RIONET to RIONET_DOORBELL_JOIN (0x1000) and RIONET_DOORBELL_LEAVE (0x1001). And RIONET will send a doorbell package like this: rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN);
When the destination port of this doorbell package has been assigned the same res->start and res->end, it can work well. But when we try to address doorbell resource assignment during enumeration/discovery, and give the different doorbell resource to different port, how an endpoint to get the destination port resource it wants to send to a doorbell package?
In fact, I also encountered some other issues due to the two ports sharing one CSR. For example the "Host base device ID lock command and status register" and "Port General control command and status register", these caused some issues when enumeration/discovery, and very difficult to be resolved based on current RIO architecture.
Quoted 19 lines
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 5 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-4-if (found) { - dbell->dinb(port, dbell->dev_id, - DBELL_SID(dmsg), - DBELL_TID(dmsg),
DBELL_INF(dmsg));arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance)
Quoted 13 lines
arch/powerpc/sysdev/fsl_rmu.c +4
-3- }else { + +if (!found) {pr_debug ("RIO: spurious doorbell," " sid %2.2x tid %2.2x info %4.4x\n" ,DBELL_SID (dmsg),DBELL_TID (dmsg),DBELL_INF (dmsg)); } -setbits32 (&rmu->msg_regs->dmr,DOORBELL_DMR_DI ); -out_be32 (&rmu->msg_regs->dsr,DOORBELL_DSR_DIQI ); +setbits32 (&fsl_dbell->dbell_regs->dmr,DOORBELL_DMR_DI ); + out_be32(&fsl_dbell->dbell_regs->dsr,
Quoted 7 lines
DOORBELL_DSR_DIQI);Quoted 6 lines
arch/powerpc/sysdev/fsl_rmu.c +0
-0} out:return IRQ_HANDLED ; }
... skip ...
Regards,
Alex.
RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
Quoted 14 lines · On Tue, Oct 25, 2011 at 6:40 AM, Liu Gang-B34182 <[email protected]> wrote:
Quoted 11 lines
... skip ...
arch/powerpc/sysdev/fsl_rmu.c fsl_rio_dbell_handler(int irq, void *dev_instance) · line 350
Quoted 7 lines
arch/powerpc/sysdev/fsl_rmu.c +5
-0+ +DBELL_TID (dmsg), + DBELL_INF(dmsg)); +break ; + } } }Do we need to check for matching
DBELL_TIDand mport destID here and scan only doorbell list attached to the right port? Otherwise thismay
Quoted 2 lines
call service routine associated with doorbell on a wrong port. [Liu Gang-B34182] Do you mean to match
DBELL_TIDand mport DevID?
Quoted 8 lines
=20
Yes.
=20Quoted 3 lines
Usually this is a reliable method, but for the rapidio module of powerpc, will encounter some problem. We set the port's DevID by the register "Base Device ID CSR" defined in Rapidio Specification.
The
Quoted 1 line
rapidio module of powerpc can support two ports but have only one
the
Quoted 4 lines
Quoted 2 lines
Base Device ID CSR. So these two ports will have the same DevID. Although there are two registers "Alternate Device ID CSR" to
separate
Quoted 1 line
deviceIDs for each port, they are specific registers of the
freescale
Quoted 31 lines
Quoted 1 line
rapidio and can't be accessed by getting the extended
feature
Quoted 3 lines
space block offset. For this doobell issue, in order to call a right service routine, perhaps we should ensure that different ports in different "
res->startandres->end" configurations.=20
This gives us an issue that has to be solved at some point. Splitting doorbell resources may be a way in this case but should be considered in context of RIO network with different endpoints and therefore it will be some device-specific quirk.
=20
Probably the best approach in this case is to keep doorbell handler as it is now (for purpose of this patchset) and address doorbell resource assignment during enumeration/discovery. At least this has to be well commented.
[Liu Gang-B34182] I think this is a very complex issue, and could be very difficult to be resolved if we can't separate DevIDs for each port.
Based on the current architecture of the RIO driver, the doorbell resource will be assigned by the application. For example, RIONET will assign the doorbell resource like this:if ((rc =3D rio_request_inb_dbell(rnet->mport, (void *)ndev, RIONET_DOORBELL_JOIN, RIONET_DOORBELL_LEAVE, rionet_dbell_event)) < 0) goto out;The
res->startandres->endwere defined by RIONET toRIONET_DOORBELL_JOIN(0x1000) andRIONET_DOORBELL_LEAVE(0x1001). And RIONET will send a doorbell
package like this:
Quoted 5 lines
rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN);When the destination port of this doorbell package has been assigned the same
res->startandres->end, it can work well. But when we try to address doorbell resource assignment during enumeration/discovery, and give the different doorbell resource to different port, how an
endpoint
Quoted 9 lines
to get the destination port resource it wants to send to a doorbell package?
=20
In fact, I also encountered some other issues due to the two ports sharing one CSR. For example the "Host base device ID lock command and status register" and "Port General control command and status register", these caused some issues when enumeration/discovery, and very difficult to be resolved
based on current RIO architecture.
We need to adjust enumeration/discovery to deal with multi-port endpoints.
As per RIO spec multi-port device has only one Base Device ID CSR but at least offers a way to properly identify such capability. Unfortunately p4080 controller follows older RIO 1.2 spec and does not implement the multiport bit and CSR 0x14. This will force us to have a quirk for devices with specific Device Identity CAR values.
One of possible ways for discovery may be ignoring value in reg.0x60 and use destID set in the routing table of the attached switch (assuming that
endpoint is capable to accept packets with destIDs other than one in reg.0x60). But this alone does not guarantee that destIDs assigned to two different ports will not match. This may force us to consider additional measures of identification (which may be easier to implement if 16-bit destIDs are used).
Anyway, we are not in position to resolve this immediately and probably the best what we can do now is to keep multi-port endpoint specifics in mind for future extensions.=20
I am slowly addressing multiple port support issues in enumeration/discovery prompted by introduction of tsi721 PCIe-to-SRIO bridge
and will keep multi-port endpoints in mind (this is different from multiple
tsi721's on single board).=20
Regards,
=20
Alex.