diff mbox

[U-Boot,8/8] net: Probe PCI before looking for ethernet devices

Message ID 1453067522-610-9-git-send-email-sjg@chromium.org
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Commit Message

Simon Glass Jan. 17, 2016, 9:52 p.m. UTC
Some ethernet devices may be on a PCI bus. Probe the first PCI controller to
find these, so that ethernet init will complete correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 net/eth-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Bin Meng Jan. 18, 2016, 4:41 a.m. UTC | #1
Hi Simon,

On Mon, Jan 18, 2016 at 5:52 AM, Simon Glass <sjg@chromium.org> wrote:
> Some ethernet devices may be on a PCI bus. Probe the first PCI controller to
> find these, so that ethernet init will complete correctly.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  net/eth-uclass.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index a356a08..817c6e0 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -383,7 +383,12 @@ int eth_initialize(void)
>  {
>         int num_devices = 0;
>         struct udevice *dev;
> +#ifdef CONFIG_DM_PCI
> +       struct udevice *pci_dev;
>
> +       /* Start PCI since it may have a network interface */
> +       uclass_first_device(UCLASS_PCI, &pci_dev);
> +#endif

Why do we need this? With driver model, the PCI will be automatically
started, see eth_designware.c which supports both PCI and non-PCI
variants.

>         eth_common_init();
>
>         /*
> --

Regards,
Bin
Joe Hershberger Jan. 22, 2016, 10:42 p.m. UTC | #2
On Sun, Jan 17, 2016 at 3:52 PM, Simon Glass <sjg@chromium.org> wrote:
> Some ethernet devices may be on a PCI bus. Probe the first PCI controller to
> find these, so that ethernet init will complete correctly.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  net/eth-uclass.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
> index a356a08..817c6e0 100644
> --- a/net/eth-uclass.c
> +++ b/net/eth-uclass.c
> @@ -383,7 +383,12 @@ int eth_initialize(void)
>  {
>         int num_devices = 0;
>         struct udevice *dev;
> +#ifdef CONFIG_DM_PCI
> +       struct udevice *pci_dev;
>
> +       /* Start PCI since it may have a network interface */
> +       uclass_first_device(UCLASS_PCI, &pci_dev);

I see this is still under discussion, so it probably makes sense to
leave it off of this series.

> +#endif
>         eth_common_init();
>
>         /*
> --
> 2.6.0.rc2.230.g3dd15c0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Joe Hershberger April 26, 2016, 7:32 p.m. UTC | #3
On Fri, Jan 22, 2016 at 4:42 PM, Joe Hershberger
<joe.hershberger@gmail.com> wrote:
> On Sun, Jan 17, 2016 at 3:52 PM, Simon Glass <sjg@chromium.org> wrote:
>> Some ethernet devices may be on a PCI bus. Probe the first PCI controller to
>> find these, so that ethernet init will complete correctly.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  net/eth-uclass.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
>> index a356a08..817c6e0 100644
>> --- a/net/eth-uclass.c
>> +++ b/net/eth-uclass.c
>> @@ -383,7 +383,12 @@ int eth_initialize(void)
>>  {
>>         int num_devices = 0;
>>         struct udevice *dev;
>> +#ifdef CONFIG_DM_PCI
>> +       struct udevice *pci_dev;
>>
>> +       /* Start PCI since it may have a network interface */
>> +       uclass_first_device(UCLASS_PCI, &pci_dev);
>
> I see this is still under discussion, so it probably makes sense to
> leave it off of this series.

Any update on this?

>> +#endif
>>         eth_common_init();
>>
>>         /*
>> --
>> 2.6.0.rc2.230.g3dd15c0
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
Simon Glass May 1, 2016, 7:43 p.m. UTC | #4
Hi,

On 26 April 2016 at 13:32, Joe Hershberger <joe.hershberger@gmail.com> wrote:
> On Fri, Jan 22, 2016 at 4:42 PM, Joe Hershberger
> <joe.hershberger@gmail.com> wrote:
>> On Sun, Jan 17, 2016 at 3:52 PM, Simon Glass <sjg@chromium.org> wrote:
>>> Some ethernet devices may be on a PCI bus. Probe the first PCI controller to
>>> find these, so that ethernet init will complete correctly.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>>  net/eth-uclass.c | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/net/eth-uclass.c b/net/eth-uclass.c
>>> index a356a08..817c6e0 100644
>>> --- a/net/eth-uclass.c
>>> +++ b/net/eth-uclass.c
>>> @@ -383,7 +383,12 @@ int eth_initialize(void)
>>>  {
>>>         int num_devices = 0;
>>>         struct udevice *dev;
>>> +#ifdef CONFIG_DM_PCI
>>> +       struct udevice *pci_dev;
>>>
>>> +       /* Start PCI since it may have a network interface */
>>> +       uclass_first_device(UCLASS_PCI, &pci_dev);
>>
>> I see this is still under discussion, so it probably makes sense to
>> leave it off of this series.
>
> Any update on this?

Not from my side. The PCI network driver will only be probed if it is
mentioned in the device tree. Perhaps this is good practice in an
embedded system. But there may be cases where someone adds a network
card without a device tree node.  In that case we can only find out
about the network card's existence by probing PCI (or USB if it is a
USB Ethernet device, etc.).

So I think we need to figure this out out. I'm OK with the solution I
proposed, or if there is a better and more general method (such as
allowing a board to mark which hot-pluggable buses must be scanned to
find devices) then we could go that way.

Regards,
Simon
diff mbox

Patch

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index a356a08..817c6e0 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -383,7 +383,12 @@  int eth_initialize(void)
 {
 	int num_devices = 0;
 	struct udevice *dev;
+#ifdef CONFIG_DM_PCI
+	struct udevice *pci_dev;
 
+	/* Start PCI since it may have a network interface */
+	uclass_first_device(UCLASS_PCI, &pci_dev);
+#endif
 	eth_common_init();
 
 	/*