linux/drivers/net/mdio/mdio-bcm-unimac.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Broadcom UniMAC MDIO bus controller driver
 *
 * Copyright (C) 2014-2017 Broadcom
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/of_platform.h>
#include <linux/phy.h>
#include <linux/platform_data/mdio-bcm-unimac.h>
#include <linux/platform_device.h>
#include <linux/sched.h>

#define MDIO_CMD
#define MDIO_START_BUSY
#define MDIO_READ_FAIL
#define MDIO_RD
#define MDIO_WR
#define MDIO_PMD_SHIFT
#define MDIO_PMD_MASK
#define MDIO_REG_SHIFT
#define MDIO_REG_MASK

#define MDIO_CFG
#define MDIO_C22
#define MDIO_C45
#define MDIO_CLK_DIV_SHIFT
#define MDIO_CLK_DIV_MASK
#define MDIO_SUPP_PREAMBLE

struct unimac_mdio_priv {};

static inline u32 unimac_mdio_readl(struct unimac_mdio_priv *priv, u32 offset)
{}

static inline void unimac_mdio_writel(struct unimac_mdio_priv *priv, u32 val,
				      u32 offset)
{}

static inline void unimac_mdio_start(struct unimac_mdio_priv *priv)
{}

static int unimac_mdio_poll(void *wait_func_data)
{}

static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
{}

static int unimac_mdio_write(struct mii_bus *bus, int phy_id,
			     int reg, u16 val)
{}

/* Workaround for integrated BCM7xxx Gigabit PHYs which have a problem with
 * their internal MDIO management controller making them fail to successfully
 * be read from or written to for the first transaction.  We insert a dummy
 * BMSR read here to make sure that phy_get_device() and get_phy_id() can
 * correctly read the PHY MII_PHYSID1/2 registers and successfully register a
 * PHY device for this peripheral.
 *
 * Once the PHY driver is registered, we can workaround subsequent reads from
 * there (e.g: during system-wide power management).
 *
 * bus->reset is invoked before mdiobus_scan during mdiobus_register and is
 * therefore the right location to stick that workaround. Since we do not want
 * to read from non-existing PHYs, we either use bus->phy_mask or do a manual
 * Device Tree scan to limit the search area.
 */
static int unimac_mdio_reset(struct mii_bus *bus)
{}

static int unimac_mdio_clk_set(struct unimac_mdio_priv *priv)
{}

static int unimac_mdio_probe(struct platform_device *pdev)
{}

static void unimac_mdio_remove(struct platform_device *pdev)
{}

static int __maybe_unused unimac_mdio_resume(struct device *d)
{}

static SIMPLE_DEV_PM_OPS(unimac_mdio_pm_ops,
			 NULL, unimac_mdio_resume);

static const struct of_device_id unimac_mdio_ids[] =;
MODULE_DEVICE_TABLE(of, unimac_mdio_ids);

static struct platform_driver unimac_mdio_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS();