[1/2] powerpc/44x: Fix PCI MSI support for APM821xx SoC and Bluestone board

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Mar 6 18:11:32 EST 2012


On Mon, 2012-03-05 at 22:37 -0600, Milton Miller wrote:
> On Mon, 05 Mar 2012 about 17:29:41 -0000, Mai La wrote:
> >  
> > @@ -43,7 +43,12 @@
> >  #define PEIH_FLUSH0	0x30
> >  #define PEIH_FLUSH1	0x38
> >  #define PEIH_CNTRST	0x48
> > +
> > +#ifdef CONFIG_APM821xx
> > +#define NR_MSI_IRQS	8
> > +#else
> >  #define NR_MSI_IRQS	4
> > +#endif
> >  
> 
> does this need to go into the dts binding?

A compile time #define is definitely not acceptable as it would break a
multiplatform kernel.

Ben.

> >  struct ppc4xx_msi {
> >  	u32 msi_addr_lo;
> > @@ -150,12 +155,11 @@ static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
> >  	if (!sdr_addr)
> >  		return -1;
> >  
> > -	SDR0_WRITE(sdr_addr, (u64)res.start >> 32);	 /*HIGH addr */
> > -	SDR0_WRITE(sdr_addr + 1, res.start & 0xFFFFFFFF); /* Low addr */
> > -
> > +	mtdcri(SDR0, *sdr_addr, (u64)res.start >> 32);	/*HIGH addr */
> > +	mtdcri(SDR0, *sdr_addr + 1, res.start & 0xFFFFFFFF);/* Low addr */
> 
> Please use upper_32_bits and lower_32_bits from linux/kernel.h
> 
> >  	msi->msi_dev = of_find_node_by_name(NULL, "ppc4xx-msi");
> > -	if (msi->msi_dev)
> > +	if (!msi->msi_dev)
> >  		return -ENODEV;
> >  
> >  	msi->msi_regs = of_iomap(msi->msi_dev, 0);
> > @@ -167,9 +171,12 @@ static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
> >  		(u32) (msi->msi_regs + PEIH_TERMADH), (u32) (msi->msi_regs));
> >  
> >  	msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys, GFP_KERNEL);
> > -	msi->msi_addr_hi = 0x0;
> > -	msi->msi_addr_lo = (u32) msi_phys;
> > -	dev_dbg(&dev->dev, "PCIE-MSI: msi address 0x%x\n", msi->msi_addr_lo);
> > +	if (!msi_virt)
> > +		return -ENOMEM;
> > +	msi->msi_addr_hi = (u32)(msi_phys >> 32);
> > +	msi->msi_addr_lo = (u32)(msi_phys & 0xffffffff);
> 
> ditto
> 
> 
> milton




More information about the Linuxppc-dev mailing list