diff mbox

[net-next] bcm87xx: Add MODULE_DEVICE_TABLE

Message ID 1378071184.25743.52.camel@deadeye.wl.decadent.org.uk
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Ben Hutchings Sept. 1, 2013, 9:33 p.m. UTC
bcm87xx currently isn't auto-loaded if built as a module.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Compile-tested only.

Ben.

 drivers/net/phy/bcm87xx.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

David Daney Sept. 3, 2013, 5:32 p.m. UTC | #1
On 09/01/2013 02:33 PM, Ben Hutchings wrote:
> bcm87xx currently isn't auto-loaded if built as a module.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> Compile-tested only.

Then how do you know that it does anything sensible?

Other than that, it seems plausible.

David Daney

>
> Ben.
>
>   drivers/net/phy/bcm87xx.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
> index 7997895..f5b44ff 100644
> --- a/drivers/net/phy/bcm87xx.c
> +++ b/drivers/net/phy/bcm87xx.c
> @@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
>   }
>   module_exit(bcm87xx_exit);
>
> +static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
> +	{ PHY_ID_BCM8706, 0xffffffff },
> +	{ PHY_ID_BCM8727, 0xffffffff },
> +	{ }
> +};
> +
>   MODULE_LICENSE("GPL");
> +MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings Sept. 3, 2013, 6:53 p.m. UTC | #2
On Tue, Sep 03, 2013 at 10:32:02AM -0700, David Daney wrote:
> On 09/01/2013 02:33 PM, Ben Hutchings wrote:
> >bcm87xx currently isn't auto-loaded if built as a module.
> >
> >Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> >---
> >Compile-tested only.
> 
> Then how do you know that it does anything sensible?

This is generally required in modular PHY drivers.  I was hoping you'd
be able to say whether that it's useful or necessary for this one.

> Other than that, it seems plausible.
> 
> David Daney

Thanks.

Ben.

> >
> >Ben.
> >
> >  drivers/net/phy/bcm87xx.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> >diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
> >index 7997895..f5b44ff 100644
> >--- a/drivers/net/phy/bcm87xx.c
> >+++ b/drivers/net/phy/bcm87xx.c
> >@@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
> >  }
> >  module_exit(bcm87xx_exit);
> >
> >+static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
> >+	{ PHY_ID_BCM8706, 0xffffffff },
> >+	{ PHY_ID_BCM8727, 0xffffffff },
> >+	{ }
> >+};
> >+
> >  MODULE_LICENSE("GPL");
> >+MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
> >
>
David Daney Sept. 3, 2013, 7:13 p.m. UTC | #3
On 09/03/2013 11:53 AM, Ben Hutchings wrote:
> On Tue, Sep 03, 2013 at 10:32:02AM -0700, David Daney wrote:
>> On 09/01/2013 02:33 PM, Ben Hutchings wrote:
>>> bcm87xx currently isn't auto-loaded if built as a module.
>>>
>>> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
>>> ---
>>> Compile-tested only.
>>
>> Then how do you know that it does anything sensible?
>
> This is generally required in modular PHY drivers.  I was hoping you'd
> be able to say whether that it's useful or necessary for this one.


OK. I just tested the patch, and it is not sufficient to get the module 
loaded automatically.

My configuration also successfully uses drivers/net/phy/marvell.ko, so I 
think the modules.alias file is properly generated, and the auto-loading 
is working for some PHY drivers, but bcm87xx isn't detected.

I may take a look later this week, but as the patch stands, I don't 
think it should be merged.

David Daney


>
>> Other than that, it seems plausible.
>>
>> David Daney
>
> Thanks.
>
> Ben.
>
>>>
>>> Ben.
>>>
>>>   drivers/net/phy/bcm87xx.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
>>> index 7997895..f5b44ff 100644
>>> --- a/drivers/net/phy/bcm87xx.c
>>> +++ b/drivers/net/phy/bcm87xx.c
>>> @@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
>>>   }
>>>   module_exit(bcm87xx_exit);
>>>
>>> +static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
>>> +	{ PHY_ID_BCM8706, 0xffffffff },
>>> +	{ PHY_ID_BCM8727, 0xffffffff },
>>> +	{ }
>>> +};
>>> +
>>>   MODULE_LICENSE("GPL");
>>> +MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
>>>
>>
>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Daney Sept. 3, 2013, 7:28 p.m. UTC | #4
On 09/03/2013 12:13 PM, David Daney wrote:
> On 09/03/2013 11:53 AM, Ben Hutchings wrote:
>> On Tue, Sep 03, 2013 at 10:32:02AM -0700, David Daney wrote:
>>> On 09/01/2013 02:33 PM, Ben Hutchings wrote:
>>>> bcm87xx currently isn't auto-loaded if built as a module.
>>>>
>>>> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
>>>> ---
>>>> Compile-tested only.
>>>
>>> Then how do you know that it does anything sensible?
>>
>> This is generally required in modular PHY drivers.  I was hoping you'd
>> be able to say whether that it's useful or necessary for this one.
>
>
> OK. I just tested the patch, and it is not sufficient to get the module
> loaded automatically.
>

The problem is that get_phy_c45_ids() sets the phy_id that is passed to 
request_module() to zero, so it will never match anything.

We need to think about how this should work for  802.3-c45 PHYs.

Most c54 PHYs are conceptually composed of several pieces each with its 
own set of identifiers.  Which of these should be used?  Will something 
break if we start supplying a C22 phy_id for these devices?

David Daney



> My configuration also successfully uses drivers/net/phy/marvell.ko, so I
> think the modules.alias file is properly generated, and the auto-loading
> is working for some PHY drivers, but bcm87xx isn't detected.
>
> I may take a look later this week, but as the patch stands, I don't
> think it should be merged.
>
> David Daney
>
>
>>
>>> Other than that, it seems plausible.
>>>
>>> David Daney
>>
>> Thanks.
>>
>> Ben.
>>
>>>>
>>>> Ben.
>>>>
>>>>   drivers/net/phy/bcm87xx.c | 7 +++++++
>>>>   1 file changed, 7 insertions(+)
>>>>
>>>> diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
>>>> index 7997895..f5b44ff 100644
>>>> --- a/drivers/net/phy/bcm87xx.c
>>>> +++ b/drivers/net/phy/bcm87xx.c
>>>> @@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
>>>>   }
>>>>   module_exit(bcm87xx_exit);
>>>>
>>>> +static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
>>>> +    { PHY_ID_BCM8706, 0xffffffff },
>>>> +    { PHY_ID_BCM8727, 0xffffffff },
>>>> +    { }
>>>> +};
>>>> +
>>>>   MODULE_LICENSE("GPL");
>>>> +MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
>>>>
>>>
>>
>
>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings Sept. 3, 2013, 8:53 p.m. UTC | #5
On Tue, Sep 03, 2013 at 12:28:50PM -0700, David Daney wrote:
> On 09/03/2013 12:13 PM, David Daney wrote:
> >On 09/03/2013 11:53 AM, Ben Hutchings wrote:
> >>On Tue, Sep 03, 2013 at 10:32:02AM -0700, David Daney wrote:
> >>>On 09/01/2013 02:33 PM, Ben Hutchings wrote:
> >>>>bcm87xx currently isn't auto-loaded if built as a module.
> >>>>
> >>>>Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> >>>>---
> >>>>Compile-tested only.
> >>>
> >>>Then how do you know that it does anything sensible?
> >>
> >>This is generally required in modular PHY drivers.  I was hoping you'd
> >>be able to say whether that it's useful or necessary for this one.
> >
> >
> >OK. I just tested the patch, and it is not sufficient to get the module
> >loaded automatically.
> >
> 
> The problem is that get_phy_c45_ids() sets the phy_id that is passed
> to request_module() to zero, so it will never match anything.

Right.  Now I see that phy_driver::phy_id{,_mask} are actually not
used for this driver because phy_driver::match_phy_device overrides
those.

> We need to think about how this should work for  802.3-c45 PHYs.
> 
> Most c54 PHYs are conceptually composed of several pieces each with
> its own set of identifiers.

Yes, I know that but I wasn't sure how libphy deals with them.

> Which of these should be used?  Will
> something break if we start supplying a C22 phy_id for these
> devices?

But which one?  Maybe it would make sense to generate a modalias for
the device with all MMDs listed:

    mdio:<mmd><id>...

where <mmd> is the MMD number converted to a letter (a-z, A-F) and
<id> is the device ID as a bitstring, and they're repeated for all
present MMDs.  A module would then have modaliases that match on
any particular MMD's ID, e.g. this module would have the aliases:

    mdio:*e00000001010000111011110111000001*
    mdio:*e00000001010000111011111111110000*

(I'm assuming that a driver wouldn't need to match on multiple
MMD IDs, which would make the device table structure and
modpost logic more complicated.)

Maybe there's a simpler way to do it, but I don't know what.

Ben.
diff mbox

Patch

diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 7997895..f5b44ff 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -230,4 +230,11 @@  static void __exit bcm87xx_exit(void)
 }
 module_exit(bcm87xx_exit);
 
+static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
+	{ PHY_ID_BCM8706, 0xffffffff },
+	{ PHY_ID_BCM8727, 0xffffffff },
+	{ }
+};
+
 MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);