booting-without-of for Freescale MSI
PATCH v3 1/4 booting-without-of for Freescale MSI
Binding document adding for Freescale MSI support.
---
Change the compatible name in this V3 version.
Documentation/powerpc/booting-without-of.txt | 41 +++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-)
Documentation/powerpc/booting-without-of.txt +40 -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,42 @@ platforms are moved over to use the flattened-device-tree model. reg = <0xe8000000 32>; }; + t) Freescale MSI interrupt controller + + Reguired properities: + - compatible : set as "fsl,mpc8610-msi" for all the cpu which use MPIC, + and set as "fsl,mpc8379-msi" for those use IPIC. + - 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"; + 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 v5 2/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.
---
In the V5 version:
Make the msi-availble-ranges optional, remove the match function from the driver, change the compatible according the change in dts.
arch/powerpc/sysdev/Makefile | 3 +- arch/powerpc/sysdev/fsl_msi.c | 437 +++++++++++++++++++++++++++++++++++++++++ arch/powerpc/sysdev/fsl_msi.h | 42 ++++ arch/powerpc/sysdev/fsl_pci.c | 14 ++ 4 files changed, 495 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 +437 -0
437 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 v3 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.
---
Change the compatible name in dts in V3 version.
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
@@ -128,6 +128,22 @@ big-endian; }; + msi@41600 { + compatible = "fsl,mpc8610-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
@@ -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
PATCH v3 4/4 Enable MSI support for 85xxds board
This patch enabled MSI on 8544ds and 8572ds board. So far only one MSI interrupt can generate on 8544 board.
---
Change the compatible name in dts in this V3 version.
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,mpc8610-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,mpc8610-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
Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board
In reply to Jason JinQuoted 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 6 lines
Signed-off-by Jason Jin <[email protected]>---
In the V5 version:
Make the msi-availble-ranges optional, remove the match function from the driver, change the compatible according the change in dts.
Looks good, MSI bits:
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
RE: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board
Quoted 33 lines
-----Original Message-----
From: Michael Ellerman [mailto:[email protected]]=20
Sent: Monday, May 19, 2008 10:09 AM
To: Jin Zhengxiong
Cc: [email protected]; [email protected];=20 [email protected]
Subject: Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board =20Quoted 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=20for 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 7 lines
msi-available-ranges property in the dts file was used for this=20 purpose.
=20Signed-off-by Jason Jin <[email protected]>---
In the V5 version:
Make the msi-availble-ranges optional, remove the match=20
Quoted 8 lines
function from=20
Quoted 1 line
the driver, change the compatible according the change in dts.
=20
Looks good, MSI bits:
=20Acked-by Michael Ellerman <[email protected]>=20
cheers
Thanks, Michael.
Kumar, Could you please apply the MSI related patches. Thanks
Jason=20
Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board
Quoted 38 lines · Jin Zhengxiong
Quoted 38 lines
-----Original Message-----
From: Michael Ellerman [mailto:[email protected]]
Sent: Monday, May 19, 2008 10:09 AM
To: Jin Zhengxiong
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx boardQuoted 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.
There are
Quoted 1 line
256 MSI interrupts in this host, Every 32 MSI interrupts
cascaded to
Quoted 5 lines
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
Quoted 2 lines
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
Quoted 2 lines
device use some designate MSI interrupt in the 256 MSI interrupts. Sometimes this is useful for testing the all the MSI
interrupts. The
Quoted 7 lines
msi-available-ranges property in the dts file was used for this purpose.
Signed-off-by Jason Jin <[email protected]>---
In the V5 version:
Make the msi-availble-ranges optional, remove the matchfunction from
Quoted 1 line
the driver, change the compatible according the change in dts.
Looks good, MSI bits:
Quoted 7 lines
Quoted 3 lines
Acked-by Michael Ellerman <[email protected]>cheers
Thanks, Michael.
Kumar, Could you please apply the MSI related patches. Thanks
See my comments about the compatible. Once those changes are made I'll apply these patches.
- k
Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board
In reply to Jason JinHi Jason,
Just a couple of comments. All of which you may ignore. :-)
arch/powerpc/sysdev/fsl_msi.c line 125
Quoted 5 lines · On Fri, 16 May 2008 17:50:45 +0800 Jason Jin <[email protected]> wrote:
arch/powerpc/sysdev/fsl_msi.c new file +3
-0+static int fsl_msi_free_dt_hwirqs (struct fsl_msi *msi) +{ +if ((len %0x8 ) !=0 ) {
why not (len % (2 * sizeof(u32))) ?
arch/powerpc/sysdev/fsl_msi.c line 133
Quoted 3 lines
arch/powerpc/sysdev/fsl_msi.c new file +3
-0+/* Format is: (<u32 start> <u32 count>)+ */ + len /=sizeof (u32); + len /=2 ;
len /= 2 * sizeof(u32);
arch/powerpc/sysdev/fsl_msi.c line 134
Quoted 1 line
arch/powerpc/sysdev/fsl_msi.c new file +1
-0+for (i =0 ; i < len; i++, p +=2 )
for (len /= 2 * sizeof(u32); len; len--, p += 2)
These are just style so you can ignore me if you like :-)
Quoted 11 lines
arch/powerpc/sysdev/fsl_msi.c new file +11
-0+static int __devinit fsl_of_msi_probe (struct of_device *dev, +const struct of_device_id *match) +{ +struct fsl_msi *msi; +struct resource res; +int err, i, count; +int rc; +int virt_msir; +const u32 *p; +struct fsl_msi_feature *tmp_data; +
arch/powerpc/sysdev/fsl_msi.c line 326
Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10
-0+printk (KERN_DEBUG "Setting up Freescale MSI support\n" ); + + msi =kzalloc (sizeof (struct fsl_msi ),GFP_KERNEL ); +if (!msi) { +dev_err (&dev->dev,"No memory for MSI structure\n" ); + err = -ENOMEM ; + goto error_out; + } + + msi->of_node = dev->node;
You need to of_node_get dev->node [i.e. msi->of_node = of_node_get(dev->node)] and if you delay this as far as possible, you won't need of_node_put(msi->of_node) in the erro path.
arch/powerpc/sysdev/fsl_msi.c line 328
Quoted 1 line
arch/powerpc/sysdev/fsl_msi.c new file +1
-0+ msi->irqhost = irq_alloc_host(of_node_get(dev->node),
irq_alloc_host should do the of_node_get if it needs to. Which it doesn't (at the moment), so just leave it as you have it and it will be cleaned up when irq_alloc_host is fixed.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
RE: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board
Hi Stephen,
Thanks for the comments, I'd like to clean up some of the codes by patch after some updates(such as irq_alloc_host you mentioned).
Jason=20
Quoted 68 lines
-----Original Message-----
From: Stephen Rothwell [mailto:[email protected]]=20
Sent: Monday, May 19, 2008 11:34 AM
To: Jin Zhengxiong
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 2/4 V5] MSI support on 83xx/85xx/86xx board =20
Hi Jason,
=20
Just a couple of comments. All of which you may ignore. :-) =20Quoted 2 lines · On Fri, 16 May 2008 17:50:45 +0800 Jason Jin=20 <[email protected]> wrote:
+static int
fsl_msi_free_dt_hwirqs(struct fsl_msi *msi){=20
Review
Quoted 1 line
(quoted diff) +1
-0+ if ((len % 0x8) !=3D 0) {=20
why not (len % (2 * sizeof(u32))) ?
=20Review
Quoted 3 lines
(quoted diff) +3
-0+ /* Format is: (<u32 start> <u32 count>)+ */ + len /=3D sizeof(u32); + len /=3D 2;=20
len /=3D 2 * sizeof(u32);
=20Review
Quoted 1 line
(quoted diff) +1
-0+ for (i =3D 0; i < len; i++, p +=3D 2)=20
for (len /=3D 2 * sizeof(u32); len; len--, p +=3D 2) =20
These are just style so you can ignore me if you like :-) =20Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10
-0+static int __devinit fsl_of_msi_probe (struct of_device *dev, +const struct of_device_id *match) { +struct fsl_msi *msi; +struct resource res; +int err, i, count; +int rc; +int virt_msir; +const u32 *p; +struct fsl_msi_feature *tmp_data; +arch/powerpc/sysdev/fsl_msi.c
Quoted 10 lines
arch/powerpc/sysdev/fsl_msi.c new file +10
-0+printk (KERN_DEBUG "Setting up Freescale MSI support\n" ); + + msi =3D kzalloc(sizeof(struct fsl_msi), GFP_KERNEL); +if (!msi) { +dev_err (&dev->dev,"No memory for MSI structure\n" ); + err =3D -ENOMEM ; + goto error_out; + } + + msi->of_node =3D dev->node;=20
You need toof_node_getdev->node[i.e.msi->of_node=3D=20of_node_get(dev->node)] and if you delay this as far as=20 possible, you won't needof_node_put(msi->of_node)in the erro path. =20Review
Quoted 1 line
(quoted diff) +1
-0+ msi->irqhost =3D irq_alloc_host(of_node_get(dev->node),=20
irq_alloc_hostshould do theof_node_getif it needs to.=20 Which it doesn't (at the moment), so just leave it as you=20 have it and it will be cleaned up whenirq_alloc_hostis fixed. =20
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
=20
Quoted 35 lines · Jason Jin
Binding document adding for Freescale MSI support.
Signed-off-by Jason Jin <[email protected]>---
Change the compatible name in this V3 version.
Documentation/powerpc/booting-without-of.txt| 41 +++++++++++++++++
++++++++-1 files changed, 40 insertions(+), 1 deletions(-)Documentation/powerpc/booting-without-of.txt +4
-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,42 @@ platforms are moved over to use the flattened-device-tree model.
reg = <0xe8000000 32>; };Documentation/powerpc/booting-without-of.txt +4
-0+ t) Freescale MSI interrupt controller + + Reguired properities: + - compatible : set as "fsl,mpc8610-msi" for all the cpu which
Quoted 2 lines
use MPIC,
+ and set as "fsl,mpc8379-msi" for those use IPIC.
I'd like to see "fsl,ipic-msi" and "fsl,mpic-msi". If we are going to use "chip" names we should use the first in each family that had the support so it would be:
"fsl,mpc8641-msi", "fsl,mpc8379-msi", and "fsl,mpc8548-msi". However I've never been a big fan of using the "first" in family like this. It becomes difficult later to use this if we have to deal with errata on a given device to distinguish things.
So my preference it that we have:
compatible = "fsl,mpc8610-msi", "fsl,mpic-msi";
for the 8610, and for 8572 we'd have:
compatible = "fsl,mpc8572-msi", "fsl,mpic-msi";
so like DMA its "fsl,CHIP-msi", and either "fsl,mpic-msi" or "fsl,ipic-msi" depending on the parent type.
- k