Lines Matching +full:realtek +full:- +full:smi
1 // SPDX-License-Identifier: GPL-2.0+
2 /* Realtek MDIO interface driver
6 * RTL8366 - The original version, apparently
7 * RTL8369 - Similar enough to have the same datsheet as RTL8366
8 * RTL8366RB - Probably reads out "RTL8366 revision B", has a quite
10 * RTL8366S - Is this "RTL8366 super"?
11 * RTL8367 - Has an OpenWRT driver as well
12 * RTL8368S - Seems to be an alternative name for RTL8366RB
13 * RTL8370 - Also uses SMI
19 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
27 #include "realtek.h"
28 #include "realtek-mdio.h"
47 struct mii_bus *bus = priv->bus; in realtek_mdio_write()
50 mutex_lock(&bus->mdio_lock); in realtek_mdio_write()
52 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_CTRL0_REG, REALTEK_MDIO_ADDR_OP); in realtek_mdio_write()
56 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_ADDRESS_REG, reg); in realtek_mdio_write()
60 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_DATA_WRITE_REG, val); in realtek_mdio_write()
64 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_CTRL1_REG, REALTEK_MDIO_WRITE_OP); in realtek_mdio_write()
67 mutex_unlock(&bus->mdio_lock); in realtek_mdio_write()
75 struct mii_bus *bus = priv->bus; in realtek_mdio_read()
78 mutex_lock(&bus->mdio_lock); in realtek_mdio_read()
80 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_CTRL0_REG, REALTEK_MDIO_ADDR_OP); in realtek_mdio_read()
84 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_ADDRESS_REG, reg); in realtek_mdio_read()
88 ret = bus->write(bus, priv->mdio_addr, REALTEK_MDIO_CTRL1_REG, REALTEK_MDIO_READ_OP); in realtek_mdio_read()
92 ret = bus->read(bus, priv->mdio_addr, REALTEK_MDIO_DATA_READ_REG); in realtek_mdio_read()
99 mutex_unlock(&bus->mdio_lock); in realtek_mdio_read()
110 * realtek_mdio_probe() - Probe a platform device for an MDIO-connected switch
115 * values specific for MDIO-connected devices. Finally, it calls a common
118 * Context: Can sleep. Takes and releases priv->map_lock.
123 struct device *dev = &mdiodev->dev; in realtek_mdio_probe()
131 priv->bus = mdiodev->bus; in realtek_mdio_probe()
132 priv->mdio_addr = mdiodev->addr; in realtek_mdio_probe()
133 priv->write_reg_noack = realtek_mdio_write; in realtek_mdio_probe()
146 * realtek_mdio_remove() - Remove the driver of an MDIO-connected switch
157 struct realtek_priv *priv = dev_get_drvdata(&mdiodev->dev); in realtek_mdio_remove()
169 * realtek_mdio_shutdown() - Shutdown the driver of a MDIO-connected switch
180 struct realtek_priv *priv = dev_get_drvdata(&mdiodev->dev); in realtek_mdio_shutdown()