Skip to contentSkip to conversation

MSI support on 83xx/85xx/86xx board

PATCH Superseded Jason Jin 3 participants 10 messages May 5, 2008 – May 7, 2008

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Jason Jin

author
#0 lore raw

PATCH v3 1/4 MSI support on 83xx/85xx/86xx board

This MSI driver can be used on 83xx/85xx/86xx board. In this driver, virtual interrupt host and chip were setup. There are 256 MSI interrupts in this host, Every 32 MSI interrupts cascaded to one IPIC/MPIC interrupt. The chip was treated as edge sensitive and some necessary functions were setup for this chip.

Before using the MSI interrupt, PCI/PCIE device need to ask for a MSI interrupt in the 256 MSI interrupts. A 256bit bitmap show which MSI interrupt was used, reserve bit in the bitmap can be used to force the device use some designate MSI interrupt in the 256 MSI interrupts. Sometimes this is useful for testing the all the MSI interrupts. The msi-available-ranges property in the dts file was used for this purpose.

---
V3 version updated per Kumar's suggestions.

 arch/powerpc/sysdev/Makefile  |    3 +-
 arch/powerpc/sysdev/fsl_msi.c |  442 +++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/fsl_msi.h |   31 +++
 arch/powerpc/sysdev/fsl_pci.c |   14 ++
 4 files changed, 489 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/sysdev/fsl_msi.c
 create mode 100644 arch/powerpc/sysdev/fsl_msi.h
arch/powerpc/sysdev/Makefile +2 -1
index 6d386d0..98b6b8e 100644
@@ -4,6 +4,7 @@ endif
 
 mpic-msi-obj-$(CONFIG_PCI_MSI)	+= mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o
 obj-$(CONFIG_MPIC)		+= mpic.o $(mpic-msi-obj-y)
+fsl-msi-obj-$(CONFIG_PCI_MSI)	+= fsl_msi.o
 
 obj-$(CONFIG_PPC_MPC106)	+= grackle.o
 obj-$(CONFIG_PPC_DCR_NATIVE)	+= dcr-low.o
@@ -11,7 +12,7 @@ obj-$(CONFIG_PPC_PMI)		+= pmi.o
 obj-$(CONFIG_U3_DART)		+= dart_iommu.o
 obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
 obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
-obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o
+obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o $(fsl-msi-obj-y)
 obj-$(CONFIG_FSL_LBC)		+= fsl_lbc.o
 obj-$(CONFIG_RAPIDIO)		+= fsl_rio.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
arch/powerpc/sysdev/fsl_msi.c new file +442 -0

442 lines not on this page · raw message

arch/powerpc/sysdev/fsl_msi.h new file +31 -0
new file mode 100644
index 0000000..0449c96
@@ -0,0 +1,31 @@
+#ifndef _POWERPC_SYSDEV_FSL_MSI_H
+#define _POWERPC_SYSDEV_FSL_MSI_H
+
+#define NR_MSI_REG		8
+#define IRQS_PER_MSI_REG	32
+#define NR_MSI_IRQS	(NR_MSI_REG * IRQS_PER_MSI_REG)
+
+#define FSL_PIC_IP_MASK	0x0000000F
+#define FSL_PIC_IP_MPIC	0x00000001
+#define FSL_PIC_IP_IPIC	0x00000002
+
+struct fsl_msi {
+	/* Device node of the MSI interrupt*/
+	struct device_node *of_node;
+
+	struct irq_host *irqhost;
+
+	unsigned long cascade_irq;
+
+	u32 msi_addr_lo;
+	u32 msi_addr_hi;
+	void __iomem *msi_regs;
+	u32 feature;
+
+	unsigned long *fsl_msi_bitmap;
+	spinlock_t bitmap_lock;
+	const char *name;
+};
+
+#endif /* _POWERPC_SYSDEV_FSL_MSI_H */
+
arch/powerpc/sysdev/fsl_pci.c +14 -0
index bf13c21..fede767 100644
@@ -106,6 +106,16 @@ void __init setup_pci_cmd(struct pci_controller *hose)
 	}
 }
 
+#ifdef CONFIG_PCI_MSI
+void __init setup_pci_pcsrbar(struct pci_controller *hose)
+{
+	phys_addr_t immr_base;
+
+	immr_base = get_immrbase();
+	early_write_config_dword(hose, 0, 0, PCI_BASE_ADDRESS_0, immr_base);
+}
+#endif
+
 static int fsl_pcie_bus_fixup;
 
 static void __init quirk_fsl_pcie_header(struct pci_dev *dev)
@@ -211,6 +221,10 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 	/* Setup PEX window registers */
 	setup_pci_atmu(hose, &rsrc);
 
+	/*Setup PEXCSRBAR */
+#ifdef CONFIG_PCI_MSI
+	setup_pci_pcsrbar(hose);
+#endif
 	return 0;
 }
 
Signature · 1 line
1.5.4
author
#1 lore raw

PATCH v2 2/4 Enable MSI support for MPC8610HPCD board

This patch enable the MSI on 8610hpcd board. Through the msi-available-ranges property, All the 256 msi interrupts can be tested on this board.

---
V2 version deleted the PEX2 dts node according the updated git tree

 arch/powerpc/boot/dts/mpc8610_hpcd.dts     |   16 ++++++++++++++++
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c |    6 +++++-
 2 files changed, 21 insertions(+), 1 deletions(-)
arch/powerpc/boot/dts/mpc8610_hpcd.dts +16 -0
index bba234e..266e1b8 100644
@@ -128,6 +128,22 @@
 			big-endian;
 		};
 
+		msi@41600 {
+			compatible = "fsl,MPIC-MSI";
+			reg = <0x41600 0x80>;
+			msi-available-ranges = <0 0x100>;
+			interrupts = <
+				0xb0 0
+				0xb1 0
+				0xb2 0
+				0xb3 0
+				0xb4 0
+				0xb5 0
+				0xb6 0
+				0xb7 0>;
+			interrupt-parent = <&mpic>;
+		};
+
 		global-utilities@e0000 {
 			compatible = "fsl,mpc8610-guts";
 			reg = <0xe0000 0x1000>;
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +5 -1
index 5e1e8cf..59f75f7 100644
@@ -70,9 +70,13 @@ static void __init mpc86xx_hpcd_init_irq(void)
 	/* Alloc mpic structure and per isu has 16 INT entries. */
 	mpic1 = mpic_alloc(np, res.start,
 			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " MPIC     ");
+			64, 256, " MPIC     ");
 	BUG_ON(mpic1 == NULL);
 
+	mpic_assign_isu(mpic1, 0, res.start + 0x10000);
+	mpic_assign_isu(mpic1, 1, res.start + 0x10800);
+	mpic_assign_isu(mpic1, 2, res.start + 0x11600);
+
 	mpic_init(mpic1);
 }
 
Signature · 1 line
1.5.4
author
#2 lore raw

PATCH 3/4 Enable MSI support for 85xxds board.

This patch enabled MSI on 8544ds and 8572ds board. only one MSI interrupt can generate on 8544 board.

---
 arch/powerpc/boot/dts/mpc8544ds.dts      |   16 ++++++++++++++++
 arch/powerpc/boot/dts/mpc8572ds.dts      |   16 ++++++++++++++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |    7 ++++++-
 3 files changed, 38 insertions(+), 1 deletions(-)
arch/powerpc/boot/dts/mpc8544ds.dts +16 -0
index 6a0d8db..1059281 100644
@@ -219,6 +219,22 @@
 			device_type = "open-pic";
 			big-endian;
 		};
+
+		msi@41600 {
+			compatible = "fsl,MPIC-MSI";
+			reg = <0x41600 0x80>;
+			msi-available-ranges = <0 0x100>;
+			interrupts = <
+				0xb0 0
+				0xb1 0
+				0xb2 0
+				0xb3 0
+				0xb4 0
+				0xb5 0
+				0xb6 0
+				0xb7 0>;
+			interrupt-parent = <&mpic>;
+		};
 	};
 
 	pci0: pci@e0008000 {
arch/powerpc/boot/dts/mpc8572ds.dts +16 -0
index 66f27ab..1c5ae9d 100644
@@ -221,6 +221,22 @@
 			fsl,has-rstcr;
 		};
 
+		msi@41600 {
+			compatible = "fsl,MPIC-msi";
+			reg = <0x41600 0x80>;
+			msi-available-ranges = <0 0x100>;
+			interrupts = <
+				0xb0 0
+				0xb1 0
+				0xb2 0
+				0xb3 0
+				0xb4 0
+				0xb5 0
+				0xb6 0
+				0xb7 0>;
+			interrupt-parent = <&mpic>;
+		};
+
 		mpic: pic@40000 {
 			clock-frequency = <0>;
 			interrupt-controller;
arch/powerpc/platforms/85xx/mpc85xx_ds.c +6 -1
index dfd8b4a..2696d2f 100644
@@ -79,9 +79,13 @@ void __init mpc85xx_ds_pic_init(void)
 
 	mpic = mpic_alloc(np, r.start,
 			  MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
+			64, 256, " OpenPIC  ");
 	BUG_ON(mpic == NULL);
 
+	mpic_assign_isu(mpic, 0, r.start + 0x10000);
+	mpic_assign_isu(mpic, 1, r.start + 0x10800);
+	mpic_assign_isu(mpic, 2, r.start + 0x11600);
+
 	mpic_init(mpic);
 
 #ifdef CONFIG_PPC_I8259
@@ -195,6 +199,7 @@ static int __init mpc85xxds_publish_devices(void)
 	return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
 }
 machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
+machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
Signature · 1 line
1.5.4
author
#3 lore raw

PATCH 4/4 booting-without-of for Freescale MSI

Binding document adding for Freescale MSI support.

---
 Documentation/powerpc/booting-without-of.txt |   37 +++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)
Documentation/powerpc/booting-without-of.txt +36 -1
index 1d2a772..9c496f6 100644
@@ -57,7 +57,10 @@ Table of Contents
       n) 4xx/Axon EMAC ethernet nodes
       o) Xilinx IP cores
       p) Freescale Synchronous Serial Interface
-	  q) USB EHCI controllers
+      q) USB EHCI controllers
+      r) Freescale Display Interface Unit
+      s) Freescale on board FPGA
+      t) Freescael MSI interrupt controller
 
   VII - Marvell Discovery mv64[345]6x System Controller chips
     1) The /system-controller node
@@ -2870,6 +2873,38 @@ platforms are moved over to use the flattened-device-tree model.
 		reg = <0xe8000000 32>;
 	};
 
+    t) Freescale MSI interrupt controller
+
+    Reguired properities:
+    - compatible : should be "fsl,MPIC-MSI" for 85xx/86xx cpu,
+      and "fsl,IPIC-MSI" for 83xx cpu.
+    - reg : should contain the address and the length of the shared message
+      interrupt register set.
+    - msi-available-ranges: use <start count> style section to define which
+      msi interrupt can be used in the 256 msi interrupts.
+    - interrupts : should contain the msi interrupts cascade to the host
+      interrupt controller.
+    - interrupt-parent: should be "&mpic" for 85xx/86xx cpu and "&ipic"
+      for 83xx cpu.
+
+    Example (85xx/86xx)
+	msi@41600 {
+		compatible = "fsl,MPIC-MSI";
+		reg = <0x41600 0x80>;
+		msi-available-ranges = <0 0x100>;
+		interrupts = <
+			0xb0 0
+			0xb1 0
+			0xb2 0
+			0xb3 0
+			0xb4 0
+			0xb5 0
+			0xb6 0
+			0xb7 0>;
+		interrupt-parent = <&mpic>;
+	};
+
+
 VII - Marvell Discovery mv64[345]6x System Controller chips
 ===========================================================
 
Signature · 1 line
1.5.4
#8 lore raw
In reply to Jason Jin
Quoted 15 lines · Jason Jin

This MSI driver can be used on 83xx/85xx/86xx board. In this driver, virtual interrupt host and chip were setup. There are 256 MSI interrupts in this host, Every 32 MSI interrupts cascaded to one IPIC/MPIC interrupt. The chip was treated as edge sensitive and some necessary functions were setup for this chip.

Before using the MSI interrupt, PCI/PCIE device need to ask for a MSI interrupt in the 256 MSI interrupts. A 256bit bitmap show which MSI interrupt was used, reserve bit in the bitmap can be used to force the device use some designate MSI interrupt in the 256 MSI interrupts. Sometimes this is useful for testing the all the MSI interrupts. The msi-available-ranges property in the dts file was used for this purpose.

Quoted 1 line

Hi Jason,

Just a couple of comments below:

Quoted 26 lines
arch/powerpc/sysdev/fsl_msi.c new file +20 -0
new file mode 100644
index 0000000..c53f716
@@ -0,0 +1,442 @@
+/*
+ * Copyright (C) 2007-2008 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Tony Li <[email protected]>
+ *	   Jason Jin <[email protected]>
+ *
+ * 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; version 2 of the
+ * License.
+ *
+ */
+#include <linux/irq.h>
+#include <linux/bootmem.h>
+#include <linux/bitmap.h>
+#include <linux/msi.h>
+#include <linux/pci.h>
+#include <linux/of_platform.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/prom.h>

arch/powerpc/sysdev/fsl_msi.c line 30

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10 -0
+#include <asm/hw_irq.h>
+#include <asm/ppc-pci.h>
+#include "fsl_msi.h"
+
+struct fsl_msi_feature {
+	u32 fsl_pic_ip;
+	u32 msiir_offset;
+};
+
+/* A bit ugly, can we get this from the pci_dev somehow? */

This comment is old (from my code) and should go.

Quoted 23 lines
arch/powerpc/sysdev/fsl_msi.c new file +23 -0
+static struct fsl_msi *fsl_msi;
+
+static inline u32 fsl_msi_read(u32 __iomem *base, unsigned int reg)
+{
+	return in_be32(base + (reg >> 2));
+}
+
+static inline void fsl_msi_write(u32 __iomem *base,
+				unsigned int reg, u32 value)
+{
+	out_be32(base + (reg >> 2), value);
+}
+
+/*
+ * We do not need this actually. The MSIR register has been read once
+ * in the cascade interrupt. So, this MSI interrupt has been acked
+*/
+static void fsl_msi_end_irq(unsigned int virq)
+{
+}
+
+static struct irq_chip fsl_msi_chip = {
+	.mask		= mask_msi_irq,

arch/powerpc/sysdev/fsl_msi.c line 63

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10 -0
+	.unmask		= unmask_msi_irq,
+	.ack		= fsl_msi_end_irq,
+	.typename	= " FSL-MSI  ",
+};
+
+static int fsl_msi_host_match(struct irq_host *h, struct device_node *node)
+{
+	/* Exact match, unless node is NULL */
+	return h->of_node == NULL || h->of_node == node;
+}

Are you sure you want this as your match routine? It looks wrong to me. You won't ever create a fsl_msi in your probe routine unless you have a device node, so AFAICT the of_node == NULL is only ever going to match some _other_ irqhost.

arch/powerpc/sysdev/fsl_msi.h line 2

Quoted 8 lines
arch/powerpc/sysdev/fsl_msi.h new file +2 -0
new file mode 100644
index 0000000..0449c96
@@ -0,0 +1,31 @@
+#ifndef _POWERPC_SYSDEV_FSL_MSI_H
+#define _POWERPC_SYSDEV_FSL_MSI_H

This should have a copyright header.

Quoted 14 lines
arch/powerpc/sysdev/fsl_msi.h new file +14 -0
+#define NR_MSI_REG		8
+#define IRQS_PER_MSI_REG	32
+#define NR_MSI_IRQS	(NR_MSI_REG * IRQS_PER_MSI_REG)
+
+#define FSL_PIC_IP_MASK	0x0000000F
+#define FSL_PIC_IP_MPIC	0x00000001
+#define FSL_PIC_IP_IPIC	0x00000002
+
+struct fsl_msi {
+	/* Device node of the MSI interrupt*/
+	struct device_node *of_node;
+
+	struct irq_host *irqhost;
+

arch/powerpc/sysdev/fsl_msi.h line 27

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.h new file +10 -0
+	unsigned long cascade_irq;
+
+	u32 msi_addr_lo;
+	u32 msi_addr_hi;
+	void __iomem *msi_regs;
+	u32 feature;
+
+	unsigned long *fsl_msi_bitmap;
+	spinlock_t bitmap_lock;
+	const char *name;

I don't see where this is used?

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#4 lore raw

Re: [PATCH 4/4] booting-without-of for Freescale MSI

In reply to Jason Jin

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

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+    - compatible : should be "fsl,MPIC-MSI" for 85xx/86xx cpu,
+      and "fsl,IPIC-MSI" for 83xx cpu.

Please use a more specific name, "fsl,8599-msi" or similar?

Quoted 3 lines

+ - interrupts : should contain the msi interrupts cascade to the
host
+ interrupt controller.

You should describe that it is one "interrupts" entry per 32 MSIs; also, it would be nice to say they need "0" as the sense.

Quoted 3 lines

+ - interrupt-parent: should be "&mpic" for 85xx/86xx cpu and
"&ipic"
+ for 83xx cpu.

&Xpic are labels, so something local to specific DTS files; instead, say that the interrupts are routed to the MPIC/IPIC (it doesn't have to be via "interrupt-parent", either).

Segher

p.s. On a meta-note, please put the binding doc first in the series, it makes things easier to review in-order.

#5 lore raw

RE: [PATCH 4/4] booting-without-of for Freescale MSI

=20

Quoted 6 lines

=20

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

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+    - compatible : should be "fsl,MPIC-MSI" for 85xx/86xx cpu,
+      and "fsl,IPIC-MSI" for 83xx cpu.

=20
Please use a more specific name, "fsl,8599-msi" or similar?

Thanks for your input. I think the name "fsl,MPIC-MSI" and "fsl,IPIC-MSI"
is somethind specific. Actually, from the hardware point, MSI is just part
of MPIC of IPIC for Freescale CPU. the name "fsl,MPIC-MSI" can describe the MSI is based on the MPIC controller.
=20

Quoted 7 lines
Quoted 3 lines

+ - interrupts : should contain the msi interrupts cascade to the
host
+ interrupt controller.

=20
You should describe that it is one "interrupts" entry per 32=20 MSIs; also, it would be nice to say they need "0" as the sense. =20

Quoted 8 lines
Quoted 3 lines

+ - interrupt-parent: should be "&mpic" for 85xx/86xx cpu and
"&ipic"
+ for 83xx cpu.

=20
&Xpic are labels, so something local to specific DTS files;=20 instead, say that the interrupts are routed to the MPIC/IPIC=20 (it doesn't have to be via "interrupt-parent", either). =20

Thank you, I'll rewrite these description.=20

Quoted 4 lines

Segher
=20
p.s. On a meta-note, please put the binding doc first in the=20 series, it makes things easier to review in-order.

Ok, I'll put it first next time.

Jason

#9 lore raw
In reply to Michael Ellerman

Hi Micheal,

Thank you for your comments.
I'll send the new version according to feedback.

Jason

Quoted 167 lines

-----Original Message-----
From: Michael Ellerman [mailto:[email protected]]=20
Sent: Monday, May 05, 2008 7:24 PM
To: Jin Zhengxiong
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/4 V3] MSI support on 83xx/85xx/86xx board =20

Quoted 2 lines · Jason Jin

This MSI driver can be used on 83xx/85xx/86xx board. In this driver, virtual interrupt host and chip were setup.=20

There are=20

Quoted 1 line

256 MSI interrupts in this host, Every 32 MSI interrupts=20

cascaded to=20

Quoted 5 lines

one IPIC/MPIC interrupt.
The chip was treated as edge sensitive and some necessary functions=20 were setup for this chip.
=20
Before using the MSI interrupt, PCI/PCIE device need to ask=20

for a MSI=20

Quoted 2 lines

interrupt in the 256 MSI interrupts. A 256bit bitmap show which MSI=20 interrupt was used, reserve bit in the bitmap can be used=20

to force the=20

Quoted 2 lines

device use some designate MSI interrupt in the 256 MSI interrupts.=20 Sometimes this is useful for testing the all the MSI=20

interrupts. The=20

Quoted 4 lines

msi-available-ranges property in the dts file was used for this=20 purpose.
=20

=20
=20
Hi Jason,
=20
Just a couple of comments below:
=20

arch/powerpc/sysdev/fsl_msi.c line 2

Quoted 8 lines
(quoted diff) +0 -0

b/arch/powerpc/sysdev/fsl_msi.c new file mode 100644 index=20 0000000..c53f716

arch/powerpc/sysdev/fsl_msi.c new file +2 -0
@@ -0,0 +1,442 @@
+/*
+ * Copyright (C) 2007-2008 Freescale Semiconductor, Inc.=20

All rights reserved.

Quoted 18 lines
arch/powerpc/sysdev/fsl_msi.c new file +18 -0
+ *
+ * Author: Tony Li <[email protected]>
+ *	   Jason Jin <[email protected]>
+ *
+ * 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; version 2 of the
+ * License.
+ *
+ */
+#include <linux/irq.h>
+#include <linux/bootmem.h>
+#include <linux/bitmap.h>
+#include <linux/msi.h>
+#include <linux/pci.h>
+#include <linux/of_platform.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/prom.h>

arch/powerpc/sysdev/fsl_msi.c line 30

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10 -0
+#include <asm/hw_irq.h>
+#include <asm/ppc-pci.h>
+#include "fsl_msi.h"
+
+struct fsl_msi_feature {
+	u32 fsl_pic_ip;
+	u32 msiir_offset;
+};
+
+/* A bit ugly, can we get this from the pci_dev somehow? */

=20
This comment is old (from my code) and should go.
=20

arch/powerpc/sysdev/fsl_msi.c

Quoted 3 lines
arch/powerpc/sysdev/fsl_msi.c new file +3 -0
+static struct fsl_msi *fsl_msi;
+
+static inline u32 fsl_msi_read(u32 __iomem *base, unsigned=20

int reg) {

arch/powerpc/sysdev/fsl_msi.c

Quoted 11 lines
arch/powerpc/sysdev/fsl_msi.c new file +11 -0
+	return in_be32(base + (reg >> 2));
+}
+
+static inline void fsl_msi_write(u32 __iomem *base,
+				unsigned int reg, u32 value)
+{
+	out_be32(base + (reg >> 2), value);
+}
+
+/*
+ * We do not need this actually. The MSIR register has=20

been read once

arch/powerpc/sysdev/fsl_msi.c line 45

Quoted 1 line
arch/powerpc/sysdev/fsl_msi.c new file +1 -0
+ * in the cascade interrupt. So, this MSI interrupt has=20

been acked */=20

arch/powerpc/sysdev/fsl_msi.c line 55

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10 -0
+static void fsl_msi_end_irq(unsigned int virq) { }
+
+static struct irq_chip fsl_msi_chip =3D {
+	.mask		=3D mask_msi_irq,
+	.unmask		=3D unmask_msi_irq,
+	.ack		=3D fsl_msi_end_irq,
+	.typename	=3D " FSL-MSI  ",
+};
+
+static int fsl_msi_host_match(struct irq_host *h, struct=20

device_node=20

arch/powerpc/sysdev/fsl_msi.c line 58

Quoted 3 lines
arch/powerpc/sysdev/fsl_msi.c new file +3 -0
+*node) {
+	/* Exact match, unless node is NULL */
+	return h->of_node =3D=3D NULL || h->of_node =3D=3D node; }

=20
Are you sure you want this as your match routine? It looks=20 wrong to me.
You won't ever create a fsl_msi in your probe routine unless=20 you have a device node, so AFAICT the of_node =3D=3D NULL is only=20 ever going to match some _other_ irqhost.
=20
=20

arch/powerpc/sysdev/fsl_msi.h line 2

Quoted 8 lines
(quoted diff) +0 -0

b/arch/powerpc/sysdev/fsl_msi.h new file mode 100644 index=20 0000000..0449c96

arch/powerpc/sysdev/fsl_msi.h new file +2 -0
@@ -0,0 +1,31 @@
+#ifndef _POWERPC_SYSDEV_FSL_MSI_H
+#define _POWERPC_SYSDEV_FSL_MSI_H

=20
=20
This should have a copyright header.
=20

Quoted 14 lines
arch/powerpc/sysdev/fsl_msi.h new file +14 -0
+#define NR_MSI_REG		8
+#define IRQS_PER_MSI_REG	32
+#define NR_MSI_IRQS	(NR_MSI_REG * IRQS_PER_MSI_REG)
+
+#define FSL_PIC_IP_MASK	0x0000000F
+#define FSL_PIC_IP_MPIC	0x00000001
+#define FSL_PIC_IP_IPIC	0x00000002
+
+struct fsl_msi {
+	/* Device node of the MSI interrupt*/
+	struct device_node *of_node;
+
+	struct irq_host *irqhost;
+

arch/powerpc/sysdev/fsl_msi.h line 27

Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.h new file +10 -0
+	unsigned long cascade_irq;
+
+	u32 msi_addr_lo;
+	u32 msi_addr_hi;
+	void __iomem *msi_regs;
+	u32 feature;
+
+	unsigned long *fsl_msi_bitmap;
+	spinlock_t bitmap_lock;
+	const char *name;

=20
I don't see where this is used?
=20
=20
cheers
=20
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
=20
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
=20
We do not inherit the earth from our ancestors, we borrow it=20 from our children. - S.M.A.R.T Person
=20

#6 lore raw

Re: [PATCH 4/4] booting-without-of for Freescale MSI

In reply to Jin Zhengxiong
Quoted 9 lines
Quoted 5 lines

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

Quoted 2 lines
Documentation/powerpc/booting-without-of.txt +2 -0
+    - compatible : should be "fsl,MPIC-MSI" for 85xx/86xx cpu,
+      and "fsl,IPIC-MSI" for 83xx cpu.

Please use a more specific name, "fsl,8599-msi" or similar?

Thanks for your input. I think the name "fsl,MPIC-MSI" and "fsl,IPIC-MSI"
is somethind specific.

This is the third MSI-on-MPIC I've seen, and I doubt it will be the last. It is likely FSL will make some different one in the future, as well.

Please don't use generic names for specific devices.

Segher

#7 lore raw

RE: [PATCH 4/4] booting-without-of for Freescale MSI

Quoted 9 lines
Quoted 4 lines

Thanks for your input. I think the name "fsl,MPIC-MSI" and=20 "fsl,IPIC-MSI"
is somethind specific.

=20
This is the third MSI-on-MPIC I've seen, and I doubt it will=20 be the last. It is likely FSL will make some different one=20 in the future, as well.
=20

This is the first patch for the FSL MSI support, I wish it can be used for most of the freescale board if the PIC is still MPIC or IPIC.

Quoted 2 lines

Please don't use generic names for specific devices. =20

How about using "fsl,85xx-MSI" for 85xx board, "fsl,86xx-MSI" for 86xx board and so on.

Jason