diff mbox

[U-Boot] pci: gate print info of reading vender id with CONFIG_DM_PCI

Message ID 1453965300-24844-1-git-send-email-Qianyu.Gong@nxp.com
State Rejected
Headers show

Commit Message

Gong Qianyu Jan. 28, 2016, 7:15 a.m. UTC
From: Mingkai Hu <Mingkai.Hu@freescale.com>

Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.

For legacy PCIe driver, it needs loop to read the vender_id from
devie 0 to devie 255 to check if there is device available.
Reading non-existen device will trigger the "Cannot read bus
configuration: -1" information.

Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
---
 common/cmd_pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Bin Meng Jan. 28, 2016, 7:29 a.m. UTC | #1
On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu <Qianyu.Gong@nxp.com> wrote:
> From: Mingkai Hu <Mingkai.Hu@freescale.com>
>
> Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
>
> For legacy PCIe driver, it needs loop to read the vender_id from
> devie 0 to devie 255 to check if there is device available.
> Reading non-existen device will trigger the "Cannot read bus
> configuration: -1" information.
>
> Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
> Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
> ---

Which pci controller are you testing?

[snip]

Regards,
Bin
Gong Qianyu Jan. 28, 2016, 7:43 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Bin Meng [mailto:bmeng.cn@gmail.com]
> Sent: Thursday, January 28, 2016 3:30 PM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: U-Boot Mailing List <u-boot@lists.denx.de>
> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with
> CONFIG_DM_PCI
> 
> On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu <Qianyu.Gong@nxp.com> wrote:
> > From: Mingkai Hu <Mingkai.Hu@freescale.com>
> >
> > Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
> >
> > For legacy PCIe driver, it needs loop to read the vender_id from devie
> > 0 to devie 255 to check if there is device available.
> > Reading non-existen device will trigger the "Cannot read bus
> > configuration: -1" information.
> >
> > Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
> > Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
> > ---
> 
> Which pci controller are you testing?
> 
> [snip]
> 
> Regards,
> Bin

Designware PCIe controller on LS2085A.


Regards,
Qianyu
Bin Meng Jan. 28, 2016, 8:02 a.m. UTC | #3
On Thu, Jan 28, 2016 at 3:43 PM, Qianyu Gong <qianyu.gong@nxp.com> wrote:
> Hi,
>
>> -----Original Message-----
>> From: Bin Meng [mailto:bmeng.cn@gmail.com]
>> Sent: Thursday, January 28, 2016 3:30 PM
>> To: Qianyu Gong <qianyu.gong@nxp.com>
>> Cc: U-Boot Mailing List <u-boot@lists.denx.de>
>> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with
>> CONFIG_DM_PCI
>>
>> On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu <Qianyu.Gong@nxp.com> wrote:
>> > From: Mingkai Hu <Mingkai.Hu@freescale.com>
>> >
>> > Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
>> >
>> > For legacy PCIe driver, it needs loop to read the vender_id from devie
>> > 0 to devie 255 to check if there is device available.
>> > Reading non-existen device will trigger the "Cannot read bus
>> > configuration: -1" information.
>> >
>> > Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
>> > Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
>> > ---
>>
>> Which pci controller are you testing?
>>
>> [snip]
>>
>> Regards,
>> Bin
>
> Designware PCIe controller on LS2085A.
>

Please check commit 7ba34ff09f1ef105521f914e4ad4e4ac19975bac "pci:
layerscape: Adjust the return value when ls_pcie_addr_valid() fails"
which is already in mainline.

Regards,
Bin
Gong Qianyu Jan. 28, 2016, 8:55 a.m. UTC | #4
> -----Original Message-----
> From: Bin Meng [mailto:bmeng.cn@gmail.com]
> Sent: Thursday, January 28, 2016 4:02 PM
> To: Qianyu Gong <qianyu.gong@nxp.com>
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with
> CONFIG_DM_PCI
> 
> On Thu, Jan 28, 2016 at 3:43 PM, Qianyu Gong <qianyu.gong@nxp.com> wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Bin Meng [mailto:bmeng.cn@gmail.com]
> >> Sent: Thursday, January 28, 2016 3:30 PM
> >> To: Qianyu Gong <qianyu.gong@nxp.com>
> >> Cc: U-Boot Mailing List <u-boot@lists.denx.de>
> >> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender
> >> id with CONFIG_DM_PCI
> >>
> >> On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu <Qianyu.Gong@nxp.com> wrote:
> >> > From: Mingkai Hu <Mingkai.Hu@freescale.com>
> >> >
> >> > Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
> >> >
> >> > For legacy PCIe driver, it needs loop to read the vender_id from
> >> > devie
> >> > 0 to devie 255 to check if there is device available.
> >> > Reading non-existen device will trigger the "Cannot read bus
> >> > configuration: -1" information.
> >> >
> >> > Signed-off-by: Mingkai Hu <Mingkai.Hu@freescale.com>
> >> > Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
> >> > ---
> >>
> >> Which pci controller are you testing?
> >>
> >> [snip]
> >>
> >> Regards,
> >> Bin
> >
> > Designware PCIe controller on LS2085A.
> >
> 
> Please check commit 7ba34ff09f1ef105521f914e4ad4e4ac19975bac "pci:
> layerscape: Adjust the return value when ls_pcie_addr_valid() fails"
> which is already in mainline.
> 
> Regards,
> Bin

Ok. That's nice of you. 
And we also find another commit cab24b3407189a12 "dm: pci: Convert 'pci' 
command to driver model" submitted by Simon has fixed the issue. So no 
need of this patch.
Thanks a lot.

Regards,
Qianyu
diff mbox

Patch

diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index 4e0951f..d94f90d 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -324,7 +324,9 @@  void pciinfo(int bus_num, int short_pci_listing)
 	unsigned char header_type;
 	unsigned short vendor_id;
 	pci_dev_t dev;
+#ifdef CONFIG_DM_PCI
 	int ret;
+#endif
 
 	if (!hose)
 		return;
@@ -348,10 +350,14 @@  void pciinfo(int bus_num, int short_pci_listing)
 			if (pci_skip_dev(hose, dev))
 				continue;
 
+#ifdef CONFIG_DM_PCI
 			ret = pci_read_config_word(dev, PCI_VENDOR_ID,
 						   &vendor_id);
 			if (ret)
 				goto error;
+#else
+			pci_read_config_word(dev, PCI_VENDOR_ID, &vendor_id);
+#endif
 			if ((vendor_id == 0xFFFF) || (vendor_id == 0x0000))
 				continue;
 
@@ -373,8 +379,10 @@  void pciinfo(int bus_num, int short_pci_listing)
 	}
 
 	return;
+#ifdef CONFIG_DM_PCI
 error:
 	printf("Cannot read bus configuration: %d\n", ret);
+#endif
 }
 #endif