2023-09-13 00:13:22

by Parthiban Veerasooran

[permalink] [raw]
Subject: Re: [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface

Hi Andrew,

On 09/09/23 7:03 pm, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Fri, Sep 08, 2023 at 07:59:14PM +0530, Parthiban Veerasooran wrote:
>> Implement register read/write interface according to the control
>> communication specified in the OPEN Alliance 10BASE-T1x MACPHY Serial
>> Interface document. Control transactions consist of one or more control
>> commands. Control commands are used by the SPI host to read and write
>> registers within the MAC-PHY. Each control commands are composed of a
>> 32-bit control command header followed by register data.
>>
>> Control write commands can write either a single register or multiple
>> consecutive registers. When multiple consecutive registers are written,
>> the address is automatically post-incremented by the MAC-PHY. The write
>> command and data is also echoed from the MAC-PHY back to the SPI host to
>> enable the SPI host to identify which register write failed in the case
>> of any bus errors.
>>
>> Control read commands can read either a single register or multiple
>> consecutive registers. When multiple consecutive registers are read, the
>> address is automatically post-incremented by the MAC-PHY.
>>
>> The register data being read or written can be protected against simple
>> bit errors. When enabled by setting the Protection Enable (PROTE) bit in
>> the CONFIG0 register, protection is accomplished by duplication of each
>> 32-bit word containing register data with its ones’ complement. Errors
>> are detected at the receiver by performing a simple exclusive-OR (XOR) of
>> each received 32-bit word containing register data with its received
>> complement and detecting if there are any zeros in the result.
>>
>> Signed-off-by: Parthiban Veerasooran <[email protected]>
>> ---
>> Documentation/networking/oa-tc6-framework.rst | 231 ++++++++++++++++++
>> MAINTAINERS | 8 +
>> drivers/net/ethernet/oa_tc6.c | 222 +++++++++++++++++
>> include/linux/oa_tc6.h | 31 +++
>
> I'm surprised there is no kconfig and Makefile changes here. I would
> expect this is compiled as a module, which the vendor code can then
> make use of.
Ok, actually this framework is used by vendor specific driver
(lan865x.c) later with the Makefile update like below in the directory
drivers/net/ethernet/microchip/,

obj-$(CONFIG_LAN865X) += lan865x_t1s.o

lan865x_t1s-objs := lan865x.o ../oa_tc6.o

If I understand you correctly, this framework has to include the module
initialization as well using the below APIs and has to be compiled as a
loadable module so that other vendors module can make use of this, isn't it?

module_init(oa_tc6_init);
module_exit(oa_tc6_exit);

Best Regards,
Parthiban V
>
> Andrew
>


2023-09-13 05:35:49

by Andrew Lunn

[permalink] [raw]
Subject: Re: [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface

> If I understand you correctly, this framework has to include the module
> initialization as well using the below APIs and has to be compiled as a
> loadable module so that other vendors module can make use of this, isn't it?
>
> module_init(oa_tc6_init);
> module_exit(oa_tc6_exit);

You should not need these, unless there is actions which need to be
taken when the module is loaded. If there are no actions, it is purely
a library, don't have them. The module dependency tracking code will
see that the MAC driver modules has dependencies on symbols in this
library module, and will load it first. The MAC driver is then loaded,
and the kernel linker will resolve the missing symbols in the MAC
driver to those in the library. It also means that there is only ever
one copy of the library in the kernel, even if there is multiple MAC
drivers using it.

Andrew

2023-09-21 21:19:51

by Parthiban Veerasooran

[permalink] [raw]
Subject: Re: [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface

Hi Andrew,

On 13/09/23 7:02 am, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>> If I understand you correctly, this framework has to include the module
>> initialization as well using the below APIs and has to be compiled as a
>> loadable module so that other vendors module can make use of this, isn't it?
>>
>> module_init(oa_tc6_init);
>> module_exit(oa_tc6_exit);
>
> You should not need these, unless there is actions which need to be
> taken when the module is loaded. If there are no actions, it is purely
> a library, don't have them. The module dependency tracking code will
> see that the MAC driver modules has dependencies on symbols in this
> library module, and will load it first. The MAC driver is then loaded,
> and the kernel linker will resolve the missing symbols in the MAC
> driver to those in the library. It also means that there is only ever
> one copy of the library in the kernel, even if there is multiple MAC
> drivers using it.
Ah ok. Actually I missed including this library in the Kconfig and Makefile.

So drivers/net/ethernet/Kconfig file should contain the below,

config OA_TC6
tristate "OPEN Alliance TC6 10BASE-T1x MAC-PHY support"
depends on SPI
select PHYLIB

help
This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY
Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.

The drivers/net/ethernet/Makefile file should contain the below,

obj-$(CONFIG_OA_TC6) += oa_tc6.o

Is this you expected right?

Best Regards,
Parthiban V
>
> Andrew
>

2023-09-21 23:49:15

by Andrew Lunn

[permalink] [raw]
Subject: Re: [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface

> So drivers/net/ethernet/Kconfig file should contain the below,
>
> config OA_TC6
> tristate "OPEN Alliance TC6 10BASE-T1x MAC-PHY support"
> depends on SPI
> select PHYLIB
>
> help
> This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY
> Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.
>
> The drivers/net/ethernet/Makefile file should contain the below,
>
> obj-$(CONFIG_OA_TC6) += oa_tc6.o

That looks about right, but i'm not a kconfig expert.

I would expect drivers using this to then have a

depends on OA_TC6

Andrew

2023-09-22 12:01:32

by Parthiban Veerasooran

[permalink] [raw]
Subject: Re: [RFC PATCH net-next 1/6] net: ethernet: implement OPEN Alliance control transaction interface

Hi Andrew,

On 22/09/23 12:46 am, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>> So drivers/net/ethernet/Kconfig file should contain the below,
>>
>> config OA_TC6
>> tristate "OPEN Alliance TC6 10BASE-T1x MAC-PHY support"
>> depends on SPI
>> select PHYLIB
>>
>> help
>> This library implements OPEN Alliance TC6 10BASE-T1x MAC-PHY
>> Serial Interface protocol for supporting 10BASE-T1x MAC-PHYs.
>>
>> The drivers/net/ethernet/Makefile file should contain the below,
>>
>> obj-$(CONFIG_OA_TC6) += oa_tc6.o
>
> That looks about right, but i'm not a kconfig expert.
>
> I would expect drivers using this to then have a
>
> depends on OA_TC6
Yes, that's for sure. The MAC driver (Ex: lan865x.c) Kconfig file will
contain the above "depends on OA_TC6" if it supports OPEN Alliance TC6.

Best Regards,
Parthiban V
>
> Andrew