Netdev List
 help / color / mirror / Atom feed
From: Javen <javen_xu@realsil.com.cn>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	顾晓军 <freddy_gu@realsil.com.cn>, "nb@tipi-net.de" <nb@tipi-net.de>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"daniel@makrotopia.org" <daniel@makrotopia.org>,
	"vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com>,
	"nic_swsd@realtek.com" <nic_swsd@realtek.com>
Subject: RE: [PATCH net-next v7 4/4] net: phy: realtek: load firmware for RTL8261C_CG
Date: Wed, 1 Jul 2026 03:12:34 +0000	[thread overview]
Message-ID: <00ed7993f38d4597a8c20f71bc7da58e@realsil.com.cn> (raw)
In-Reply-To: <1ac195f7-29c2-45a3-84a9-cfc5366aee6f@lunn.ch>

>
>On Mon, Jun 29, 2026 at 02:47:18PM +0800, javen wrote:
>> From: Javen Xu <javen_xu@realsil.com.cn>
>>
>> This patch adds support for loading firmware. Download some parameters
>> for RTL8261C_CG.
>>
>> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>
>> ---
>> Changes in v2:
>>  - remove __pack, struct rtl8261x_fw_header and rtl8261x_fw_entry will
>> not pad
>>  - reverse xmas tree for some definition
>>  - add explanation on rtl_phy_write_mmd_bits()
>>
>> Changes in v3:
>>  - add struct rtl8261x_priv
>>
>> Changes in v4:
>>  - add struct device *dev
>>
>> Changes in v5:
>>  - no changes
>>
>> Changes in v6:
>>  - replace rtl_phy_write_mmd_bits with phy_modify_mmd, keep mdio lock
>>  - check msb and lsb at the beginning of rtl8261x_fw_execute_entry()
>>  - add comments on rtl8261x_config_init()
>>
>> Changes in v7:
>>  - no changes
>> ---
>>  drivers/net/phy/realtek/realtek_main.c | 220
>> +++++++++++++++++++++++++
>>  1 file changed, 220 insertions(+)
>>
>> diff --git a/drivers/net/phy/realtek/realtek_main.c
>> b/drivers/net/phy/realtek/realtek_main.c
>> index ef3700894ebf..bf7bc19fb44c 100644
>> --- a/drivers/net/phy/realtek/realtek_main.c
>> +++ b/drivers/net/phy/realtek/realtek_main.c
>> @@ -8,7 +8,9 @@
>>   * Copyright (c) 2004 Freescale Semiconductor, Inc.
>>   */
>>  #include <linux/bitops.h>
>> +#include <linux/crc32.h>
>>  #include <linux/ethtool_netlink.h>
>> +#include <linux/firmware.h>
>>  #include <linux/of.h>
>>  #include <linux/phy.h>
>>  #include <linux/pm_wakeirq.h>
>> @@ -281,6 +283,42 @@
>>                                        RTL8261X_INT_ALDPS_CHG | \
>>                                        RTL8261X_INT_JABBER)
>>
>> +#define FW_MAIN_MAGIC                        0x52544C38
>> +#define FW_SUB_MAGIC_8261C           0x32363143
>> +#define RTL8261X_POLL_TIMEOUT_MS     100
>> +
>> +#define RTL8261C_CE_FW_NAME  "rtl_nic/rtl8261c.bin"
>> +MODULE_FIRMWARE(RTL8261C_CE_FW_NAME);
>> +
>> +enum rtl8261x_fw_op {
>> +     OP_WRITE = 0x00,        /* Write */
>> +     OP_POLL  = 0x02,        /* Polling */
>> +};
>> +
>> +struct rtl8261x_fw_header {
>> +     __le32 main_magic;      /* Main magic number 0x52544C38 ("RTL8") */
>> +     __le32 sub_magic;       /* Sub magic number */
>> +     __le16 version_major;   /* Major version */
>> +     __le16 version_minor;   /* Minor version */
>> +     __le16 num_entries;     /* Number of entries */
>> +     __le16 reserved;        /* Reserved */
>> +     __le32 crc32;           /* CRC32 checksum */
>> +};
>> +
>> +struct rtl8261x_fw_entry {
>> +     __u8  type;             /* Operation type (OP_*) */
>> +     __u8  dev;              /* MMD device */
>> +     __le16 addr;            /* Register address */
>> +     __u8  msb;              /* MSB bit position */
>> +     __u8  lsb;              /* LSB bit position */
>> +     __le16 value;           /* Value to write/compare */
>> +     __le16 timeout_ms;      /* Poll timeout in milliseconds */
>> +     __u8  poll_set;         /* Poll for set (1) or clear (0) */
>> +     __u8  reserved;         /* Reserved */
>> +};
>
>Are there other devices which need firmware download? Do they use the
>same header? I'm just wondering if this will be reused by other devices?
>
Hi Andrew,

Currently, RTL8261C is the only device which needs this firmware download flow.

Future Realtek PHY ICs which require firmware download are expected to use the same firmware format, so
the current header/entry definition is intended to be reusable.

BRs,
Javen

>        Andrew

  reply	other threads:[~2026-07-01  3:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  6:47 [PATCH net-next v7 0/4] Add support for RTL8261C_CG javen
2026-06-29  6:47 ` [PATCH net-next v7 1/4] net: phy: c45: add genphy_c45_soft_reset() javen
2026-06-29  6:47 ` [PATCH net-next v7 2/4] net: phy: c45: add setup and read master/slave helpers javen
2026-06-30 22:03   ` Andrew Lunn
2026-06-29  6:47 ` [PATCH net-next v7 3/4] net: phy: realtek: add support for RTL8261C_CG javen
2026-06-30 22:05   ` Andrew Lunn
2026-06-29  6:47 ` [PATCH net-next v7 4/4] net: phy: realtek: load firmware " javen
2026-06-30 22:09   ` Andrew Lunn
2026-07-01  3:12     ` Javen [this message]
2026-07-01 12:52       ` Andrew Lunn
2026-07-01 13:00   ` Andrew Lunn

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=00ed7993f38d4597a8c20f71bc7da58e@realsil.com.cn \
    --to=javen_xu@realsil.com.cn \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=freddy_gu@realsil.com.cn \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.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