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"
#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>
* 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;
u32 stmmac_flags;
bool handle_reset;
bool set_clk_tx_rate;
+ bool has_pcs;
};
struct renesas_gbeth {
"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;
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);
}
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 */ }
};