From: <Parthiban.Veerasooran@microchip.com>
To: <andrew@lunn.ch>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <horms@kernel.org>, <saeedm@nvidia.com>,
<anthony.l.nguyen@intel.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <corbet@lwn.net>,
<linux-doc@vger.kernel.org>, <robh+dt@kernel.org>,
<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
<devicetree@vger.kernel.org>, <Horatiu.Vultur@microchip.com>,
<ruanjinjie@huawei.com>, <Steen.Hegelund@microchip.com>,
<vladimir.oltean@nxp.com>, <UNGLinuxDriver@microchip.com>,
<Thorsten.Kummermehr@microchip.com>, <Pier.Beruto@onsemi.com>,
<Selvamani.Rajagopal@onsemi.com>, <Nicolas.Ferre@microchip.com>,
<benjamin.bigler@bernformulastudent.ch>
Subject: Re: [PATCH net-next v3 06/12] net: ethernet: oa_tc6: implement internal PHY initialization
Date: Fri, 8 Mar 2024 12:05:57 +0000 [thread overview]
Message-ID: <e9bc573e-61f0-484a-b1fb-b5100eb9ee0a@microchip.com> (raw)
In-Reply-To: <7ddbe599-187e-401f-b508-4dc62bca8374@lunn.ch>
Hi Andrew,
On 07/03/24 10:06 pm, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>>>> +static int oa_tc6_mdiobus_register(struct oa_tc6 *tc6)
>>>> +{
>>>> + int ret;
>>>> +
>>>> + tc6->mdiobus = mdiobus_alloc();
>>>> + if (!tc6->mdiobus) {
>>>> + netdev_err(tc6->netdev, "MDIO bus alloc failed\n");
>>>> + return -ENODEV;
>>>> + }
>>>> +
>>>> + tc6->mdiobus->priv = tc6;
>>>> + tc6->mdiobus->read = oa_tc6_mdiobus_direct_read;
>>>> + tc6->mdiobus->write = oa_tc6_mdiobus_direct_write;
>>>
>>> This might get answered in later patches. PLCA registers are in C45
>>> address space, VEND1 if i remember correctly. You don't provide any
>>> C45 access methods here. Does TC6 specify that C45 over C22 must be
>>> implemented?
>> No the spec doesn't say anything like this. But, as C22 registers are
>> mapped in the MMS 0, registers 0xD and 0xE can be used to access C45
>> registers indirectly. That's why the driver implemented the above
>> functions. I agree that indirect access is slower and requires more
>> control commands than direct access. So implementing the direct access
>> of C45 registers will overcome this issue.
>
> It is not just about performance. It is about compliance to the
> standard. The standard does not say anything about C45 over C22. So
> there is no reason to expect a PHY device to implement it. It might,
> but its optional.
Yes, understood.
>
>>> The standard does say:
>>>
>>> Vendor specific registers may be mapped into MMS 10 though MMS
>>> 15. When directly mapped, PHY vendor specific registers in MMD 30 or
>>> MMD 31 would be mapped into the vendor specific MMS 10 through MMS 15.
>>>
>>> So i'm thinking you might need to provide C45 access, at least MMD 30,
>>> via MMS 10-15?
>> Thanks for this detailed comment. If understand you correctly by
>> consolidating all your above explanations, the driver should provide C45
>> access to the PHY vendor specific and PLCA registers (MMD 31). As per
>> the specification, Table 6 describes the Register Memory Map Selector
>> (MMS) Assignment. In this, MMS 4 maps the PHY vendor specific and PLCA
>> registers. They are in the MMD 31 address space as per spec. They can be
>> directly accessed using read_c45 and write_c45 functions in the mdio bus.
>
> Yes. I think this is required to conform to the standard.
Ok then let's implement like below.
>
>> In Microchip's MAC-PHY (LAN8650), PHY – Vendor Specific and PLCA
>> Registers (MMD 31) mapped in the MMS 4 as per the table 6 in the spec.
>> There is no other PHY vendor specific registers are mapped in the MMS 10
>> through 15. No idea whether any other vendor's MAC-PHY uses MMS 10
>> through 15 to map PHY – Vendor Specific and PLCA Registers (MMD 31).
>>
>> I have given the code below for the C45 access methods. Kindly check is
>> this something you expected?
>
> The code got mangled by your mail client :-(
Oh sorry.
>
>> --- Code starts ---
>>
>> /* PHY – Vendor Specific and PLCA Registers (MMD 31) */
>>
>> #define OA_TC6_PHY_VS_PLCA_REG_ADDR_BASE 0x40000
>> ,,,
>>
>> static int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int
>> devnum, int regnum)
>> {
>>
>> struct oa_tc6 *tc6 = bus->priv;
>>
>> u32 regval;
>>
>> bool ret;
>>
>>
>>
>> ret = oa_tc6_read_register(tc6,
>> OA_TC6_PHY_VS_PLCA_REG_ADDR_BASE | regnum, ®val);
>
> You appear to ignore devnum. I don't think you can do that. The core
> phylib code might try to access other MMDs, e.g. it might try to see
> if EEE is supported, by reading MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE.
Ok, as per the table 6 in the spec, PHY C45 registers are mapped in the
MMS like below,
PHY – PCS Registers (MMD 3) ---> MMS 2
PHY – PMA/PMD Registers (MMD 1) ---> MMS 3
PHY – Vendor Specific and PLCA Registers (MMD 31) ---> MMS 4
PHY – Auto-Negotiation Registers (MMD 7) ---> MMS 5
PHY – Power Unit (MMD 13) ---> MMS 6
MMD 13 for PHY - Power Unit is not defined in the mdio.h. So in the
below code I have defined it locally (MDIO_MMD_POWER_UNIT). May be
needed to do this in the mdio.h file when coming to this patch.
https://elixir.bootlin.com/linux/v6.8-rc7/source/include/uapi/linux/mdio.h
Hope you are expecting like below? I believe this time the code will not
get mangled. If happens then sorry for that.
--- Code starts here ---
/* PHY – Clause 45 registers memory map selector (MMS) as per table 6 in
the OPEN Alliance specification.
*/
#define OA_TC6_PHY_PCS_MMS2 2 /* MMD 3 */
#define OA_TC6_PHY_PMA_PMD_MMS3 3 /* MMD 1 */
#define OA_TC6_PHY_VS_PLCA_MMS4 4 /* MMD 31 */
#define OA_TC6_PHY_AUTO_NEG_MMS5 5 /* MMD 7 */
#define OA_TC6_PHY_POWER_UNIT_MMS6 6 /* MMD 13 */
/* MDIO Manageable Device (MMD) for PHY Power Unit */
#define MDIO_MMD_POWER_UNIT 13 /* PHY Power Unit */
static int oa_tc6_mdiobus_read_c45(struct mii_bus *bus, int addr, int
devnum, int regnum)
{
struct oa_tc6 *tc6 = bus->priv;
u32 regval;
bool ret;
u32 mms;
if (devnum == MDIO_MMD_PCS)
mms = OA_TC6_PHY_PCS_MMS2;
else if (devnum == MDIO_MMD_PMAPMD)
mms = OA_TC6_PHY_PMA_PMD_MMS3;
else if (devnum == MDIO_MMD_VEND2)
mms = OA_TC6_PHY_VS_PLCA_MMS4;
else if (devnum == MDIO_MMD_AN)
mms = OA_TC6_PHY_AUTO_NEG_MMS5;
else if (devnum == MDIO_MMD_POWER_UNIT)
mms = OA_TC6_PHY_POWER_UNIT_MMS6;
else
return -ENOTSUPP;
ret = oa_tc6_read_register(tc6, (mms << 16) | regnum, ®val);
if (ret)
return -ENODEV;
return regval;
}
static int oa_tc6_mdiobus_write_c45(struct mii_bus *bus, int addr, int
devnum, int regnum, u16 val)
{
struct oa_tc6 *tc6 = bus->priv;
u32 mms;
if (devnum == MDIO_MMD_PCS)
mms = OA_TC6_PHY_PCS_MMS2;
else if (devnum == MDIO_MMD_PMAPMD)
mms = OA_TC6_PHY_PMA_PMD_MMS3;
else if (devnum == MDIO_MMD_VEND2)
mms = OA_TC6_PHY_VS_PLCA_MMS4;
else if (devnum == MDIO_MMD_AN)
mms = OA_TC6_PHY_AUTO_NEG_MMS5;
else if (devnum == MDIO_MMD_POWER_UNIT)
mms = OA_TC6_PHY_POWER_UNIT_MMS6;
else
return -ENOTSUPP;
return oa_tc6_write_register(tc6, (mms << 16) | regnum, val);
}
--- Code ends here ---
Best regards,
Parthiban V
>
> Andrew
>
next prev parent reply other threads:[~2024-03-08 12:06 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 8:50 [PATCH net-next v3 00/12] Add support for OPEN Alliance 10BASE-T1x MACPHY Serial Interface Parthiban Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 01/12] Documentation: networking: add OPEN Alliance 10BASE-T1x MAC-PHY serial interface Parthiban Veerasooran
2024-03-06 13:23 ` Andrew Lunn
2024-03-07 6:29 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 02/12] net: ethernet: oa_tc6: implement register write operation Parthiban Veerasooran
2024-03-06 13:40 ` Andrew Lunn
2024-03-07 6:46 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 03/12] net: ethernet: oa_tc6: implement register read operation Parthiban Veerasooran
2024-03-07 0:19 ` Andrew Lunn
2024-03-07 7:04 ` Parthiban.Veerasooran
2024-03-07 13:22 ` Andrew Lunn
2024-03-08 7:12 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 04/12] net: ethernet: oa_tc6: implement software reset Parthiban Veerasooran
2024-03-07 0:35 ` Andrew Lunn
2024-03-07 7:39 ` Parthiban.Veerasooran
2024-03-07 13:24 ` Andrew Lunn
2024-03-08 8:25 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 05/12] net: ethernet: oa_tc6: implement error interrupts unmasking Parthiban Veerasooran
2024-03-07 0:43 ` Andrew Lunn
2024-03-07 8:28 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 06/12] net: ethernet: oa_tc6: implement internal PHY initialization Parthiban Veerasooran
2024-03-07 1:13 ` Andrew Lunn
2024-03-07 14:41 ` Parthiban.Veerasooran
2024-03-07 16:36 ` Andrew Lunn
2024-03-08 12:05 ` Parthiban.Veerasooran [this message]
2024-03-08 13:33 ` Andrew Lunn
2024-03-18 11:01 ` Parthiban.Veerasooran
2024-04-12 10:43 ` Parthiban.Veerasooran
2024-04-15 13:15 ` Andrew Lunn
2024-04-16 11:02 ` Parthiban.Veerasooran
2024-04-16 18:18 ` Andrew Lunn
2024-04-17 8:55 ` Parthiban.Veerasooran
2024-03-21 18:49 ` Selvamani Rajagopal
2024-03-22 5:50 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 07/12] net: ethernet: oa_tc6: enable open alliance tc6 data communication Parthiban Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 08/12] net: ethernet: oa_tc6: implement transmit path to transfer tx ethernet frames Parthiban Veerasooran
2024-03-07 17:08 ` Andrew Lunn
2024-03-19 12:54 ` Parthiban.Veerasooran
2024-03-19 13:19 ` Andrew Lunn
2024-03-20 10:43 ` Parthiban.Veerasooran
2024-03-21 19:04 ` Selvamani Rajagopal
2024-03-21 19:42 ` Andrew Lunn
2024-03-22 18:31 ` Selvamani Rajagopal
2024-03-06 8:50 ` [PATCH net-next v3 09/12] net: ethernet: oa_tc6: implement receive path to receive rx " Parthiban Veerasooran
2024-03-08 0:14 ` Andrew Lunn
2024-03-19 12:54 ` Parthiban.Veerasooran
2024-03-19 13:20 ` Andrew Lunn
2024-03-20 5:55 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 10/12] net: ethernet: oa_tc6: implement mac-phy interrupt Parthiban Veerasooran
2024-03-06 23:42 ` Woojung.Huh
2024-03-07 10:16 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 11/12] microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY Parthiban Veerasooran
2024-03-06 23:44 ` Woojung.Huh
2024-03-07 9:13 ` Parthiban.Veerasooran
2024-03-06 8:50 ` [PATCH net-next v3 12/12] dt-bindings: net: add Microchip's LAN865X 10BASE-T1S MACPHY Parthiban Veerasooran
2024-03-06 18:16 ` Conor Dooley
2024-03-06 18:48 ` Andrew Lunn
2024-03-06 19:01 ` Conor Dooley
2024-03-20 8:40 ` Parthiban.Veerasooran
2024-03-20 9:53 ` Krzysztof Kozlowski
2024-03-21 8:38 ` Parthiban.Veerasooran
2024-03-21 8:40 ` Krzysztof Kozlowski
2024-03-21 12:00 ` Parthiban.Veerasooran
2024-03-21 15:34 ` Conor Dooley
2024-03-22 6:25 ` Parthiban.Veerasooran
2024-03-22 7:03 ` Krzysztof Kozlowski
2024-03-22 8:28 ` Parthiban.Veerasooran
2024-03-23 10:24 ` Krzysztof Kozlowski
2024-03-25 7:10 ` Parthiban.Veerasooran
2024-03-25 7:10 ` Parthiban.Veerasooran
2024-03-22 18:08 ` Conor Dooley
2024-03-25 7:12 ` Parthiban.Veerasooran
2024-03-20 8:40 ` Parthiban.Veerasooran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9bc573e-61f0-484a-b1fb-b5100eb9ee0a@microchip.com \
--to=parthiban.veerasooran@microchip.com \
--cc=Horatiu.Vultur@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=Pier.Beruto@onsemi.com \
--cc=Selvamani.Rajagopal@onsemi.com \
--cc=Steen.Hegelund@microchip.com \
--cc=Thorsten.Kummermehr@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=benjamin.bigler@bernformulastudent.ch \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=saeedm@nvidia.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).