booting-without-of for Freescale MSI
PATCH v4 1/4 booting-without-of for Freescale MSI
Binding document adding for Freescale MSI support.
---
In the V4 version, per Kumar's suggestion,
Change the compatile name like "fsl,CHIP-msi", "fsl,mpic-msi"/"fsl,ipic-msi".
Documentation/powerpc/booting-without-of.txt | 43 +++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-)
Documentation/powerpc/booting-without-of.txt +42 -1
@@ -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,44 @@ platforms are moved over to use the flattened-device-tree model. reg = <0xe8000000 32>; }; + t) Freescale MSI interrupt controller + + Reguired properities: + - compatible : compatible list, contains 2 entries, + first is "fsl,CHIP-msi", where CHIP is the processor(mpc8610, mpc8572, + etc.) and the second is "fsl,mpic-msi" or "fsl,ipic-msi" depending on + the parent type. + - 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. This property is + optional, without this, all the 256 MSI interrupts can be used. + - interrupts : each one of the interrupts here is one entry per 32 MSIs, + and routed to the host interrupt controller. the interrupts should + be set as edge sensitive. + - interrupt-parent: the phandle for the interrupt controller + that services interrupts for this device. for 83xx cpu, the interrupts + are routed to IPIC, and for 85xx/86xx cpu the interrupts are routed + to MPIC. + + Example + msi@41600 { + compatible = "fsl,mpc8610-msi", "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
PATCH v4 4/4 Enable MSI support for 85xxds board
In reply to Jason JinThis patch enabled MSI on 8544ds and 8572ds board. So far only one MSI interrupt can generate on 8544 board.
---
In the V4 version,
Change the compatible name in dts file.
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
@@ -219,6 +219,22 @@ device_type = "open-pic"; big-endian; }; + + msi@41600 { + compatible = "fsl,mpc8544-msi", "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
@@ -221,6 +221,22 @@ fsl,has-rstcr; }; + msi@41600 { + compatible = "fsl,mpc8572-msi", "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
@@ -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
PATCH v6 2/4 MSI support on 83xx/85xx/86xx board
In reply to Jason JinThis 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.
---
In this V6 version,
change the compatible according to the change in dts
arch/powerpc/sysdev/Makefile | 3 +- arch/powerpc/sysdev/fsl_msi.c | 436 +++++++++++++++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_msi.h | 42 ++++ arch/powerpc/sysdev/fsl_pci.c | 14 ++ 4 files changed, 494 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
@@ -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 +436 -0
436 lines not on this page · raw message
arch/powerpc/sysdev/fsl_msi.h new file +42 -0
42 lines not on this page · raw message
arch/powerpc/sysdev/fsl_pci.c +14 -0
@@ -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
PATCH v4 3/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.
---
In the V4 version,
Change the compatible name in dts.
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
@@ -182,6 +182,22 @@ big-endian; }; + msi@41600 { + compatible = "fsl,mpc8610-msi", "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
@@ -71,9 +71,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
Re: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board
Quoted 6 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0@@ -71,9 +71,13 @@ static void __init mpc86xx_hpcd_init_irq(void)/* Alloc mpic structure and per isu has 16 INT entries. */
arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 80
Quoted 10 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +5
-1mpic1 =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 ); +
I don't understand why you are breaking the interrupts up like this.
If you leave as it was, the MSIs would start at hw irq 176
- k
RE: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board
=20
Quoted 21 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]=20
Sent: Tuesday, May 20, 2008 9:24 PM
To: Jin Zhengxiong
Cc: [email protected]
Subject: Re: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board =20arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 73
Quoted 9 lines
arch/=20 renamed from arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0
powerpc/platforms/86xx/mpc8610_hpcd.c
index dea1320..290d717 100644arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0@@ -71,9 +71,13 @@ static void __init mpc86xx_hpcd_init_irq(void)/* Alloc mpic structure and per isu has 16 INT entries. */ mpic1 =3D mpic_alloc(np, res.start, MPIC_PRIMARY | MPIC_WANTS_RESET |=20
MPIC_BIG_ENDIAN,Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +1
-1- 0, 256, " MPIC "); + 64, 256, " MPIC "); BUG_ON(mpic1 =3D=3D NULL);
Quoted 8 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 80
Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +4
-0+mpic_assign_isu (mpic1,0 , res.start +0x10000 ); +mpic_assign_isu (mpic1,1 , res.start +0x10800 ); +mpic_assign_isu (mpic1,2 , res.start +0x11600 ); +=20
I don't understand why you are breaking the interrupts up like this. =20
If you leave as it was, the MSIs would start at hw irq 176
If the ISU size is 0, mpic will only initialize the interrupt source num reading from
Feature Reporting Register(FRR), For 8610 it's 104, for 8572 it is 108, As the address
space of the interrupt source configuration register is not continuous(between 0xa00-0x1600),
with ISU=3D0, actually only the 16 externel interrupts and 64 internal
interrupts were initialized.
the Messaging interrupts and MSI interrupts were not intialized.=20
With the original code. the Messaging interrupts would start at hwirq 176 and the MSIs would=20
start at hwirq 224.=20
By setting the ISU=3D64, the Messaging interrupts would start at 128 and the MSIs start at 176.=20
And all the interrupt sources will be initialized.
Jason =20
Re: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board
Quoted 42 lines · Jin Zhengxiong
Quoted 23 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]
Sent: Tuesday, May 20, 2008 9:24 PM
To: Jin Zhengxiong
Cc: [email protected]
Subject: Re: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD boardarch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 73
Quoted 9 lines
arch/ renamed from arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0
powerpc/platforms/86xx/mpc8610_hpcd.c
index dea1320..290d717 100644arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0@@ -71,9 +71,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,Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +1
-1- 0, 256, " MPIC "); + 64, 256, " MPIC ");BUG_ON (mpic1 ==NULL );Quoted 8 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 80
Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +4
-0+mpic_assign_isu (mpic1,0 , res.start +0x10000 ); +mpic_assign_isu (mpic1,1 , res.start +0x10800 ); +mpic_assign_isu (mpic1,2 , res.start +0x11600 ); +I don't understand why you are breaking the interrupts up like this.
If you leave as it was, the MSIs would start at hw irq 176
If the ISU size is 0, mpic will only initialize the interrupt source num reading from
Feature Reporting Register(FRR), For 8610 it's 104, for 8572 it is 108, As the address
space of the interrupt source configuration register is not continuous(between 0xa00-0x1600),
with ISU=0, actually only the 16 externel interrupts and 64 internal interrupts were initialized.
the Messaging interrupts and MSI interrupts were not intialized.
Quoted 6 lines
With the original code. the Messaging interrupts would start at hwirq 176 and the MSIs would
start at hwirq 224.
By setting the ISU=64, the Messaging interrupts would start at 128 and the MSIs start at 176.
And all the interrupt sources will be initialized.
Yeah, I remember this now. What about something like:
arch/powerpc/sysdev/mpic.c +2 -0
@@ -1251,6 +1251,8 @@ void __init mpic_init(struct mpic *mpic)if (mpic->irq_count ==0 ) mpic->irq_count = mpic->num_sources; + mpic->num_sources =max (mpic->num_sources, mpic->irq_count); +/* Do the HT PIC fixups on U3 broken mpic */ DBG ("MPIC flags: %x\n" , mpic->flags); if ((mpic->flags & MPIC_U3_HT_IRQS) && (mpic->flags &
MPIC_PRIMARY)) {
- k
RE: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board
=20
Quoted 79 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]=20
Sent: Wednesday, May 21, 2008 11:39 AM
To: Jin Zhengxiong
Cc: [email protected]
Subject: Re: [PATCH 3/4 V4] Enable MSI support for MPC8610HPCD board =20
=20
On May 20, 2008, at 10:29 PM, Jin Zhengxiong wrote:
=20Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]
Sent: Tuesday, May 20, 2008 9:24 PM
To: Jin Zhengxiong
Cc: [email protected]
Subject: Re: [PATCH 3/4 V4] Enable MSI support for=20MPC8610HPCD board
Quoted 15 lines
Quoted 15 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 73
Quoted 10 lines
arch/=20 renamed from arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0
powerpc/platforms/86xx/mpc8610_hpcd.c
index dea1320..290d717 100644arch/powerpc/platforms/86xx/mpc8610_hpcd.c +0
-0@@ -71,9 +71,13 @@ static void __init mpc86xx_hpcd_init_irq(void)/* Alloc mpic structure and per isu has 16 INT entries. */ mpic1 =3D mpic_alloc(np, res.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN,Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +1
-1- 0, 256, " MPIC "); + 64, 256, " MPIC "); BUG_ON(mpic1 =3D=3D NULL);Quoted 6 lines
Quoted 6 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c static void __init mpc86xx_hpcd_init_irq(void) · line 80
Quoted 4 lines
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +4
-0+mpic_assign_isu (mpic1,0 , res.start +0x10000 ); +mpic_assign_isu (mpic1,1 , res.start +0x10800 ); +mpic_assign_isu (mpic1,2 , res.start +0x11600 ); +I don't understand why you are breaking the interrupts up=20
like this.
Quoted 4 lines
Quoted 2 lines
If you leave as it was, the MSIs would start at hw irq 176
If the ISU size is 0, mpic will only initialize the=20
interrupt source=20
Quoted 1 line
num reading from Feature Reporting Register(FRR), For 8610=20
it's 104,=20
Quoted 2 lines
for 8572 it is 108, As the address space of the interrupt source=20 configuration register is not continuous(between=20
0xa00-0x1600), with=20
Quoted 5 lines
ISU=3D0, actually only the 16 externel interrupts and 64 internal=20 interrupts were initialized.
the Messaging interrupts and MSI interrupts were not intialized.With the original code. the Messaging interrupts would=20
start at hwirq
Quoted 3 lines
176 and the MSIs would
start at hwirq 224.
By setting the ISU=3D64, the Messaging interrupts would start=20at 128 and=20
Quoted 2 lines
the MSIs start at 176.
And all the interrupt sources will be initialized.=20
Yeah, I remember this now. What about something like:
=20(quoted diff) +0
-0
b/arch/powerpc/sysdev/mpic.cindex 8619f2a..90de869 100644arch/powerpc/sysdev/mpic.c +0
-0@@ -1251,6 +1251,8 @@ void __init mpic_init(struct mpic *mpic) if (mpic->irq_count =3D=3D 0) mpic->irq_count =3D mpic->num_sources;=20
arch/powerpc/sysdev/mpic.c +2
-0+ mpic->num_sources =3D max(mpic->num_sources, mpic->irq_count); +/* Do the HT PIC fixups on U3 broken mpic */ DBG ("MPIC flags: %x\n" , mpic->flags); if ((mpic->flags & MPIC_U3_HT_IRQS) && (mpic->flags &
Quoted 2 lines
MPIC_PRIMARY)) {
=20
Moving this code earlier to mpic_alloc like following patch, can make mpic
initialize all the "irq_count" interrupt sources, although a little difficult to understand
for those did not know the background.=20
On the other side, IF the reserved space was somewhat enlarged in the source
configuration register, We need to enlarge the irq-count for those unexist interrupts.
Jason
arch/powerpc/sysdev/mpic.c +0 -0
@@ -1143,11 +1143,14 @@ struct mpic * __init mpic_alloc(struct
device_node *node,
greg_feature =3D mpic_read(mpic->gregs,
MPIC_INFO(GREG_FEATURE_0));
mpic->num_cpus =3D ((greg_feature &
MPIC_GREG_FEATURE_LAST_CPU_MASK)
>> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1;
- if (isu_size =3D=3D 0)
+ if (isu_size =3D=3D 0) {
mpic->num_sources =3D
((greg_feature &
MPIC_GREG_FEATURE_LAST_SRC_MASK)
>> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1;=20
+ mpic->num_sources =3D max(mpic->num_sources,mpic->irq_count);
+ }
+
/* Map the per-CPU registers */
for (i =3D 0; i < mpic->num_cpus; i++) {
mpic_map(mpic, paddr, &mpic->cpuregs[i],