mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
net: stmmac: dwmac-renesas-gbeth: Add support for RZ/T2H SoC
Extend the Renesas GBETH stmmac glue driver to support the RZ/T2H SoC, where the GMAC is connected through a MIIC PCS. Introduce a new `has_pcs` flag in `struct renesas_gbeth_of_data` to indicate when PCS handling is required. When enabled, the driver parses the `pcs-handle` phandle, creates a PCS instance with `miic_create()`, and wires it into phylink. Proper cleanup is done with `miic_destroy()`. New init/exit/select hooks are added to `plat_stmmacenet_data` for PCS integration. Update Kconfig to select `PCS_RZN1_MIIC` when building the Renesas GBETH driver so the PCS support is always available. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Link: https://patch.msgid.link/20250908105901.3198975-4-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
264c26934f
commit
57e9e4d702
|
|
@ -133,15 +133,17 @@ config DWMAC_QCOM_ETHQOS
|
|||
stmmac device driver.
|
||||
|
||||
config DWMAC_RENESAS_GBETH
|
||||
tristate "Renesas RZ/V2H(P) GBETH support"
|
||||
tristate "Renesas RZ/V2H(P) GBETH and RZ/T2H, RZ/N2H GMAC support"
|
||||
default ARCH_RENESAS
|
||||
depends on OF && (ARCH_RENESAS || COMPILE_TEST)
|
||||
select PCS_RZN1_MIIC
|
||||
help
|
||||
Support for Gigabit Ethernet Interface (GBETH) on Renesas
|
||||
RZ/V2H(P) SoCs.
|
||||
Support for Gigabit Ethernet Interface (GBETH)/ Ethernet MAC (GMAC)
|
||||
on Renesas SoCs.
|
||||
|
||||
This selects the Renesas RZ/V2H(P) Soc specific glue layer support
|
||||
for the stmmac device driver.
|
||||
This selects Renesas SoC glue layer support for the stmmac device
|
||||
driver. This driver is used for the RZ/V2H(P) family, RZ/T2H and
|
||||
RZ/N2H SoCs.
|
||||
|
||||
config DWMAC_ROCKCHIP
|
||||
tristate "Rockchip dwmac support"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/pcs-rzn1-miic.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/types.h>
|
||||
|
|
@ -33,6 +34,7 @@
|
|||
* handled by the glue driver or core driver.
|
||||
* @set_clk_tx_rate: Flag to indicate if Tx clock is fixed or
|
||||
* set_clk_tx_rate is needed.
|
||||
* @has_pcs: Flag to indicate if the MAC has a PCS
|
||||
*/
|
||||
struct renesas_gbeth_of_data {
|
||||
const char * const *clks;
|
||||
|
|
@ -40,6 +42,7 @@ struct renesas_gbeth_of_data {
|
|||
u32 stmmac_flags;
|
||||
bool handle_reset;
|
||||
bool set_clk_tx_rate;
|
||||
bool has_pcs;
|
||||
};
|
||||
|
||||
struct renesas_gbeth {
|
||||
|
|
@ -53,6 +56,41 @@ static const char *const renesas_gbeth_clks[] = {
|
|||
"tx", "tx-180", "rx", "rx-180",
|
||||
};
|
||||
|
||||
static const char *const renesas_gmac_clks[] = {
|
||||
"tx",
|
||||
};
|
||||
|
||||
static int renesas_gmac_pcs_init(struct stmmac_priv *priv)
|
||||
{
|
||||
struct device_node *np = priv->device->of_node;
|
||||
struct device_node *pcs_node;
|
||||
struct phylink_pcs *pcs;
|
||||
|
||||
pcs_node = of_parse_phandle(np, "pcs-handle", 0);
|
||||
if (pcs_node) {
|
||||
pcs = miic_create(priv->device, pcs_node);
|
||||
of_node_put(pcs_node);
|
||||
if (IS_ERR(pcs))
|
||||
return PTR_ERR(pcs);
|
||||
|
||||
priv->hw->phylink_pcs = pcs;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void renesas_gmac_pcs_exit(struct stmmac_priv *priv)
|
||||
{
|
||||
if (priv->hw->phylink_pcs)
|
||||
miic_destroy(priv->hw->phylink_pcs);
|
||||
}
|
||||
|
||||
static struct phylink_pcs *renesas_gmac_select_pcs(struct stmmac_priv *priv,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
return priv->hw->phylink_pcs;
|
||||
}
|
||||
|
||||
static int renesas_gbeth_init(struct platform_device *pdev, void *priv)
|
||||
{
|
||||
struct plat_stmmacenet_data *plat_dat;
|
||||
|
|
@ -150,6 +188,11 @@ static int renesas_gbeth_probe(struct platform_device *pdev)
|
|||
plat_dat->exit = renesas_gbeth_exit;
|
||||
plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP |
|
||||
gbeth->of_data->stmmac_flags;
|
||||
if (of_data->has_pcs) {
|
||||
plat_dat->pcs_init = renesas_gmac_pcs_init;
|
||||
plat_dat->pcs_exit = renesas_gmac_pcs_exit;
|
||||
plat_dat->select_pcs = renesas_gmac_select_pcs;
|
||||
}
|
||||
|
||||
return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
|
||||
}
|
||||
|
|
@ -163,7 +206,15 @@ static const struct renesas_gbeth_of_data renesas_gbeth_of_data = {
|
|||
STMMAC_FLAG_SPH_DISABLE,
|
||||
};
|
||||
|
||||
static const struct renesas_gbeth_of_data renesas_gmac_of_data = {
|
||||
.clks = renesas_gmac_clks,
|
||||
.num_clks = ARRAY_SIZE(renesas_gmac_clks),
|
||||
.stmmac_flags = STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY,
|
||||
.has_pcs = true,
|
||||
};
|
||||
|
||||
static const struct of_device_id renesas_gbeth_match[] = {
|
||||
{ .compatible = "renesas,r9a09g077-gbeth", .data = &renesas_gmac_of_data },
|
||||
{ .compatible = "renesas,rzv2h-gbeth", .data = &renesas_gbeth_of_data },
|
||||
{ /* Sentinel */ }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user