Hello All,
I would like to introduce myself as Nagaraju Lakkaraju (Raju), is working in Microsemi Communications India Pvt. Ltd (Formerly known as Vitesse Semiconductors Limited) - Hyderabad as Sr. Staff Engineer.
I do work on Microsemi PHY drivers development.
Microsemi is developing the new Physical Layer (PHY) chips for Internet Of Things (IoT) products with 1 Gbps link speed.
As part of the development, Microsemi would like to contribute the new PHYs (i.e. VSC 8531 / VSC 8541) chip drivers in Linux Kernel Open source.
VSC 8531 / 8541 PHYs will have the following features a part of the basic features like Auto-neg, Speed, Duplex etc.
1. Wake on LAN
2. Auto MDIX/MDI
3. Link Speed Down shift
4. Fast Link Failure-2
5. Loopbacks (FAR-END, NEAR-END and Connector)
6. Ethernet Packet Generator (EPG)
7. Serial Management Interface (SMI) Interrupt
8. Clock Squelch configuration (SyncE)
9. Jumbo Frame Support
10. In-line Power On Ethernet (PoE) status
11. Acti PHY power Management
12. Energy Efficiency Ethenet (EEE)
13. VeriPHY (Cable Diagnostics)
14. LED configuration
15. Ring Resiliency
16. Start Of Frame Detection (SOF)
17. COMA mode
As part of Initial submission of the Linux Kernel Open source drivers,
I developed the VSC 8531 driver basic features and built the Linux Kernel image for Beaglebone Black hardware.
Also developed Ethtool enhancement for VSC 8531 register access functionality to test the VSC 8531
Test Setup:
-------------
Hardware Details: Beaglebone Black with VSC 8531 PHY
Software Linux Kernel version: 4.6.4
Microsemi VSC 8531 chip is mount on Beaglebone Black hardware (replaced the Microchip PHY) and tested the following features.
1. Auto negotiation
2. Speed change ( 10 Mbps, 100 Mbps and 1 Gbps)
3. Full/Half Duplex
4. Ping
5. Line rate traffic with Test center
I would like you to review my code and provide me the valuable comments.
Please find the attached git code diff patch.
Thanks and regards,
Raju
(Nagaraju Lakkaraju)
Sr. Staff Engg.
Microsemi Communications India Pvt Ltd.
Ph: +91 040 6686 0132
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-07-26 11:55:58
On Tue, Jul 26, 2016 at 09:49:53AM +0000, Raju Lakkaraju wrote:
Hello All,
I would like to introduce myself as Nagaraju Lakkaraju (Raju), is working in Microsemi Communications India Pvt. Ltd (Formerly known as Vitesse Semiconductors Limited) - Hyderabad as Sr. Staff Engineer.
I do work on Microsemi PHY drivers development.
Microsemi is developing the new Physical Layer (PHY) chips for Internet Of Things (IoT) products with 1 Gbps link speed.
As part of the development, Microsemi would like to contribute the new PHYs (i.e. VSC 8531 / VSC 8541) chip drivers in Linux Kernel Open source.
VSC 8531 / 8541 PHYs will have the following features a part of the basic features like Auto-neg, Speed, Duplex etc.
1. Wake on LAN
2. Auto MDIX/MDI
3. Link Speed Down shift
4. Fast Link Failure-2
5. Loopbacks (FAR-END, NEAR-END and Connector)
6. Ethernet Packet Generator (EPG)
7. Serial Management Interface (SMI) Interrupt
8. Clock Squelch configuration (SyncE)
9. Jumbo Frame Support
10. In-line Power On Ethernet (PoE) status
11. Acti PHY power Management
12. Energy Efficiency Ethenet (EEE)
13. VeriPHY (Cable Diagnostics)
14. LED configuration
15. Ring Resiliency
16. Start Of Frame Detection (SOF)
17. COMA mode
Some interesting features. Is the datasheet publicly available?
As part of Initial submission of the Linux Kernel Open source drivers,
I developed the VSC 8531 driver basic features and built the Linux Kernel image for Beaglebone Black hardware.
Also developed Ethtool enhancement for VSC 8531 register access functionality to test the VSC 8531
Test Setup:
-------------
Hardware Details: Beaglebone Black with VSC 8531 PHY
Software Linux Kernel version: 4.6.4
Microsemi VSC 8531 chip is mount on Beaglebone Black hardware (replaced the Microchip PHY) and tested the following features.
1. Auto negotiation
2. Speed change ( 10 Mbps, 100 Mbps and 1 Gbps)
3. Full/Half Duplex
4. Ping
5. Line rate traffic with Test center
I would like you to review my code and provide me the valuable comments.
Please find the attached git code diff patch.
I would like to review your code, but please read the SubmittingPathes
document and in particularly, the bit about attachments.
Andrew
Hello Andrew,
VSC 8531 / 8541 is not yet release to Public. Now It's in draft version.
After commit the VSC 8531 PHY drivers in Linux Kernel Open source, Microsemi will release the VSC 8531/8541 data sheet to Public.
My apologies. I missed instructions about attachments in SubmittingPathes document.
VSC 8531/8541 PHY Driver code patch inline.
From d75dce082d229595211e8e7106a19c967e5ce07f Mon Sep 17 00:00:00 2001
--
2.7.3
Thanks and regards,
Raju
(Nagaraju Lakkaraju)
Sr. Staff Engg.
Microsemi Communications India Pvt Ltd.
Ph: +91 040 6686 0132
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, July 26, 2016 5:26 PM
To: Raju Lakkaraju
Cc: netdev@vger.kernel.org; f.fainelli@gmail.com; Allan Nielsen
Subject: Re: Microsemi VSC 8531/41 PHY Driver
EXTERNAL EMAIL
On Tue, Jul 26, 2016 at 09:49:53AM +0000, Raju Lakkaraju wrote:
> Hello All,
>
> I would like to introduce myself as Nagaraju Lakkaraju (Raju), is working in Microsemi Communications India Pvt. Ltd (Formerly known as Vitesse Semiconductors Limited) - Hyderabad as Sr. Staff Engineer.
> I do work on Microsemi PHY drivers development.
> Microsemi is developing the new Physical Layer (PHY) chips for Internet Of Things (IoT) products with 1 Gbps link speed.
> As part of the development, Microsemi would like to contribute the new PHYs (i.e. VSC 8531 / VSC 8541) chip drivers in Linux Kernel Open source.
> VSC 8531 / 8541 PHYs will have the following features a part of the basic features like Auto-neg, Speed, Duplex etc.
> 1. Wake on LAN
> 2. Auto MDIX/MDI
> 3. Link Speed Down shift
> 4. Fast Link Failure-2
> 5. Loopbacks (FAR-END, NEAR-END and Connector) 6. Ethernet Packet
> Generator (EPG) 7. Serial Management Interface (SMI) Interrupt 8.
> Clock Squelch configuration (SyncE) 9. Jumbo Frame Support 10. In-line
> Power On Ethernet (PoE) status 11. Acti PHY power Management 12.
> Energy Efficiency Ethenet (EEE) 13. VeriPHY (Cable Diagnostics) 14.
> LED configuration 15. Ring Resiliency 16. Start Of Frame Detection
> (SOF) 17. COMA mode
Some interesting features. Is the datasheet publicly available?
> As part of Initial submission of the Linux Kernel Open source drivers,
> I developed the VSC 8531 driver basic features and built the Linux Kernel image for Beaglebone Black hardware.
> Also developed Ethtool enhancement for VSC 8531 register access
> functionality to test the VSC 8531
>
> Test Setup:
> -------------
> Hardware Details: Beaglebone Black with VSC 8531 PHY Software Linux
> Kernel version: 4.6.4
>
> Microsemi VSC 8531 chip is mount on Beaglebone Black hardware (replaced the Microchip PHY) and tested the following features.
> 1. Auto negotiation
> 2. Speed change ( 10 Mbps, 100 Mbps and 1 Gbps) 3. Full/Half Duplex 4.
> Ping 5. Line rate traffic with Test center
>
> I would like you to review my code and provide me the valuable comments.
> Please find the attached git code diff patch.
I would like to review your code, but please read the SubmittingPathes document and in particularly, the bit about attachments.
Andrew
And the purpose of this read is? I assume it clears an outstanding
interrupt? If so, shouldn't you do it after disabling interrupts, not
before? Otherwise you have a race condition.
Hello Andrew,
Thank you for given valuable comments.
Please see the my responses inline.
Thanks,
Raju
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, July 26, 2016 6:14 PM
To: Raju Lakkaraju
Cc: netdev@vger.kernel.org; f.fainelli@gmail.com; Allan Nielsen
Subject: Re: Microsemi VSC 8531/41 PHY Driver
EXTERNAL EMAIL
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
Why are you setting all these? This is not normal, if you look at other drivers.
Raju: I would like to update the default values in software data structure (phydev).
Our PHY is 1G speed support device and RGMII supported device.
+
+ mutex_lock(&phydev->lock);
What are you locking against?
Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
first set the page number then read/write the register address. Default page should be Page 0.
When I want to access not default page register, I have to lock phy device access and change
the page number and register access as atomic operation.
Why do you overwrite the error code vsc85xx_phy_page_set gives you?
Raju: initially I would like to create new type of Error code. Then, I decided to use existing one.
I accept your comment. I will remove the code.
And the purpose of this read is? I assume it clears an outstanding interrupt? If so, shouldn't you do it after disabling interrupts, not before? Otherwise you have a race condition.
Raju: The Interrupt status register is read on clean. When, PHY_INTERRUPT_DISABLE case,
I should make sure that status should be clear. If I read the Interrupt status registers, it clears all preexisting interrupts.
Hello Andrew,
Thank you for given valuable comments.
Please see the my responses inline.
Thanks,
Raju
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, July 26, 2016 6:14 PM
To: Raju Lakkaraju
Cc: netdev@vger.kernel.org; f.fainelli@gmail.com; Allan Nielsen
Subject: Re: Microsemi VSC 8531/41 PHY Driver
EXTERNAL EMAIL
quoted
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
That is true, until the next design with a PHY that does not need this
value and then, it will have to be adjusted.
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
You can either introduce a Device Tree property to allow boards to
specify what the correct delay(s) should be, or if the platform does not
use Device Tree, using phy_register_fixup_for_id would be acceptable for
that.
This is not necessary, your driver should advertise what the PHY is
capable of in phy_driver::features. The Ethernet MAC driver later should
be adjusting phydev->supported with what it actually support, there are
cases where you connect a 10/100Mbits MAC to a 1Gbits PHY, and you want
to properly restrict unsupported speeds.
Why are you setting all these? This is not normal, if you look at other drivers.
Raju: I would like to update the default values in software data structure (phydev).
Our PHY is 1G speed support device and RGMII supported device.
Whether RGMII is used as an interface/connection type between the MAC
and PHY is something that is within the consumer of the PHYLIB API
(typically Ethernet MAC/Switch driver), your PHY cannot enforce
anything, but the driver can check that the connection interface is sensble.
All of these default values that you are setting here will need to be
potentially changed by the state machine (link, duplex, pause) upon
reaction to link state changes, this change needs to be dropped.
quoted
+
+ mutex_lock(&phydev->lock);
What are you locking against?
Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
first set the page number then read/write the register address. Default page should be Page 0.
When I want to access not default page register, I have to lock phy device access and change
the page number and register access as atomic operation.
Based on the execution context of this function, acquiring the mutex is
not necessary, the state machine has not started yet, so there cannot be
a conflicting PHY read which would end up changing the page selection.
[snip]
And the purpose of this read is? I assume it clears an outstanding interrupt? If so, shouldn't you do it after disabling interrupts, not before? Otherwise you have a race condition.
Raju: The Interrupt status register is read on clean. When, PHY_INTERRUPT_DISABLE case,
I should make sure that status should be clear. If I read the Interrupt status registers, it clears all preexisting interrupts.
Should not you clear the interrupt status irrespective of whether PHY
interrupts will be enabled or not as a first operation? Then later on,
if the PHY needs to enable interrupt or not, this can be based on
PHY_INTERRUPT_ENABLED.
--
Florian
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-07-29 08:04:06
On Thu, Jul 28, 2016 at 06:44:37AM +0000, Raju Lakkaraju wrote:
Hello Andrew,
Thank you for given valuable comments.
Please see the my responses inline.
Thanks,
Raju
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, July 26, 2016 6:14 PM
To: Raju Lakkaraju
Cc: netdev@vger.kernel.org; f.fainelli@gmail.com; Allan Nielsen
Subject: Re: Microsemi VSC 8531/41 PHY Driver
EXTERNAL EMAIL
quoted
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
Hi Raju
Please can you use standard email quoting, just like everybody else does.
Andrew
From: Andrew Lunn <andrew@lunn.ch> Date: 2016-07-29 08:17:37
quoted
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
Please either do it properly now or hard code it as the default, and
then later replace it with device tree, etc. We don't like to see half
finished features.
What are you locking against?
Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
first set the page number then read/write the register address. Default page should be Page 0.
When I want to access not default page register, I have to lock phy device access and change
the page number and register access as atomic operation.
I understand all that, which is why i asked, "what are you locking
against?", not "why are you locking?" What are the other call paths? I
don't see you taking this lock anywhere else? Should you be? I would
just like to see a comment which suggests you understand when this
lock is needed, and when not.
Andrew
On Thu, Jul 28, 2016 at 10:35:05AM -0700, Florian Fainelli wrote:
EXTERNAL EMAIL
On 07/27/2016 11:44 PM, Raju Lakkaraju wrote:
quoted
Hello Andrew,
Thank you for given valuable comments.
Please see the my responses inline.
Thanks,
Raju
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, July 26, 2016 6:14 PM
To: Raju Lakkaraju
Cc: netdev@vger.kernel.org; f.fainelli@gmail.com; Allan Nielsen
Subject: Re: Microsemi VSC 8531/41 PHY Driver
EXTERNAL EMAIL
quoted
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
That is true, until the next design with a PHY that does not need this
value and then, it will have to be adjusted.
I accepted your review comment. I do hard code it as the default value.
quoted
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
You can either introduce a Device Tree property to allow boards to
specify what the correct delay(s) should be, or if the platform does not
use Device Tree, using phy_register_fixup_for_id would be acceptable for
that.
This is not necessary, your driver should advertise what the PHY is
capable of in phy_driver::features. The Ethernet MAC driver later should
be adjusting phydev->supported with what it actually support, there are
cases where you connect a 10/100Mbits MAC to a 1Gbits PHY, and you want
to properly restrict unsupported speeds.
I accepted your reveiw comment. I delete initialization.
Why are you setting all these? This is not normal, if you look at other drivers.
Raju: I would like to update the default values in software data structure (phydev).
Our PHY is 1G speed support device and RGMII supported device.
Whether RGMII is used as an interface/connection type between the MAC
and PHY is something that is within the consumer of the PHYLIB API
(typically Ethernet MAC/Switch driver), your PHY cannot enforce
anything, but the driver can check that the connection interface is sensble.
All of these default values that you are setting here will need to be
potentially changed by the state machine (link, duplex, pause) upon
reaction to link state changes, this change needs to be dropped.
I accepted your reveiw comment. I delete initialization.
quoted
quoted
+
+ mutex_lock(&phydev->lock);
What are you locking against?
Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
first set the page number then read/write the register address. Default page should be Page 0.
When I want to access not default page register, I have to lock phy device access and change
the page number and register access as atomic operation.
Based on the execution context of this function, acquiring the mutex is
not necessary, the state machine has not started yet, so there cannot be
a conflicting PHY read which would end up changing the page selection.
[snip]
This is Read Modify Write (RMW) operation on register MSCC_PHY_RGMII_CNTL. This register in different page i.e. EXTENDED-2. I would like to execute all these operations in atomic operation.
And the purpose of this read is? I assume it clears an outstanding interrupt? If so, shouldn't you do it after disabling interrupts, not before? Otherwise you have a race condition.
Raju: The Interrupt status register is read on clean. When, PHY_INTERRUPT_DISABLE case,
I should make sure that status should be clear. If I read the Interrupt status registers, it clears all preexisting interrupts.
Should not you clear the interrupt status irrespective of whether PHY
interrupts will be enabled or not as a first operation? Then later on,
if the PHY needs to enable interrupt or not, this can be based on
PHY_INTERRUPT_ENABLED.
In PHY_INTERRUPT_DISABLE case, after disable the interrupts, I would like to clear the interrupt status.
On Fri, Jul 29, 2016 at 10:17:36AM +0200, Andrew Lunn wrote:
EXTERNAL EMAIL
quoted
quoted
+/* RGMII Rx Clock delay value change with board lay-out */ static u8
+rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
We tested on Beaglebone Black with VSC 8531 PHY.
We would like to provide new function to configure correct/require value based on PHY layouts
alone with other RGMII configuration parameters as part of our next implementation.
Please either do it properly now or hard code it as the default, and
then later replace it with device tree, etc. We don't like to see half
finished features.
I accepted your review comment. I do hard code it as the default values.
quoted
What are you locking against?
Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
first set the page number then read/write the register address. Default page should be Page 0.
When I want to access not default page register, I have to lock phy device access and change
the page number and register access as atomic operation.
I understand all that, which is why i asked, "what are you locking
against?", not "why are you locking?" What are the other call paths? I
don't see you taking this lock anywhere else? Should you be? I would
just like to see a comment which suggests you understand when this
lock is needed, and when not.
This is Read Modify Write (RMW) operation on register MSCC_PHY_RGMII_CNTL. This register in different page i.e. EXTENDED-2. I would like to execute all these operations in atomic.
I also use the mutex in different functions. But not in this patch.
--
2.1.0
--
Thanks,
Raju
On Fri, Jul 29, 2016 at 10:17:36AM +0200, Andrew Lunn wrote:
> EXTERNAL EMAIL
>
>
> > > +/* RGMII Rx Clock delay value change with board lay-out */ static u8
> > > +rgmii_rx_clk_delay = RGMII_RX_CLK_DELAY_1_1_NS;
> >
> > Doesn't this stop you from having a board with two PHYs with different layouts? You should be getting this value from the device tree.
> >
> > Raju: As of now, RGMII Rx clock delay value should be 1.1 nsec as optimized/recommended value.
> > We tested on Beaglebone Black with VSC 8531 PHY.
> > We would like to provide new function to configure correct/require value based on PHY layouts
> > alone with other RGMII configuration parameters as part of our next implementation.
>
> Please either do it properly now or hard code it as the default, and
> then later replace it with device tree, etc. We don't like to see half
> finished features.
>
> > What are you locking against?
> >
> > Raju: VSC 8531 has different PAGEs. Whenever MDC/MDIO access the PHY control registers,
> > first set the page number then read/write the register address. Default page should be Page 0.
> > When I want to access not default page register, I have to lock phy device access and change
> > the page number and register access as atomic operation.
>
> I understand all that, which is why i asked, "what are you locking
> against?", not "why are you locking?" What are the other call paths? I
> don't see you taking this lock anywhere else? Should you be? I would
> just like to see a comment which suggests you understand when this
> lock is needed, and when not.
>
> Andrew
Please use git send-email to send patches.
All comments which should not be committed to the change log should
appear after the ---. It is normal to briefly list changes between
this version and the previous version.
From: Raju Lakkaraju <redacted>
The existing VSC85xx PHY driver did not follow the coding style and caused "checkpatch" to complain. This commit fixes this.
Signed-off-by: Raju Lakkaraju <redacted>