Subject: Re: [PATCH v2 3/4] powerpc/fsl_pci: Add MPC83xx PCI-E controller RCmode support

From: Anton Vorontsov <[email-masked]>
Date: Mon, 5 Jan 2009 19:30:29 +0300

On Mon, Jan 05, 2009 at 04:18:26PM +0800, Liu Dave wrote:
> > +static void __iomem *mpc83xx_pcie_remap_cfg(struct pci_bus *bus,
> > +				    unsigned int devfn, int offset)
> > +{
> > +	struct pci_controller *hose = bus->sysdata;
> > +	struct mpc83xx_pcie *pcie = hose->dn->data;
> > +	u8 bus_no = bus->number - hose->first_busno;
> > +	u32 dev_base = bus_no << 20 | devfn << 12;
> 
> Hello Anton,
> 
> There is one bug for the bus/device number shift according to the latest
> 83xx UM. The shift should be
> 
> dev_base = (bus_no << 24) | (devfn << 16);
> 
> You can download the latest MPC8315 UM as reference from
> http://www.freescale.com.

Ah! Thanks a lot, that explains a lot.

I was quite puzzled why FSL u-boots are using "wrong" shifts, so I
"corrected" them. And indeed, I was looking at the old reference
manual: MPC8315ERM   Rev. 0   09/2007. The new manual (MPC8315ERM
Rev. 1   2/2008) specifies other bits, the same as used in the FSL
U-Boot, i.e. 31:24 for bus no, 23:19 and 18:16 for device and func.

> AFAIK, you will work on the u-boot for 83xx PEX, Any question forward
> to Jerry Huang (in cc). I think he should have some update for PEX.

Much thanks for the information,

-- 
Anton Vorontsov
email: [email-masked]
irc://irc.freenode.net/bd2