// SPDX-License-Identifier: GPL-2.0+ #include <linux/module.h> #include <linux/regmap.h> #include <linux/of_mdio.h> #include "realtek.h" #include "rtl83xx.h" /** * rtl83xx_lock() - Locks the mutex used by regmaps * @ctx: realtek_priv pointer * * This function is passed to regmap to be used as the lock function. * It is also used externally to block regmap before executing multiple * operations that must happen in sequence (which will use * realtek_priv.map_nolock instead). * * Context: Can sleep. Holds priv->map_lock lock. * Return: nothing */ void rtl83xx_lock(void *ctx) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_unlock() - Unlocks the mutex used by regmaps * @ctx: realtek_priv pointer * * This function unlocks the lock acquired by rtl83xx_lock. * * Context: Releases priv->map_lock lock. * Return: nothing */ void rtl83xx_unlock(void *ctx) { … } EXPORT_SYMBOL_NS_GPL(…); static int rtl83xx_user_mdio_read(struct mii_bus *bus, int addr, int regnum) { … } static int rtl83xx_user_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) { … } /** * rtl83xx_setup_user_mdio() - register the user mii bus driver * @ds: DSA switch associated with this user_mii_bus * * Registers the MDIO bus for built-in Ethernet PHYs, and associates it with * the mandatory 'mdio' child OF node of the switch. * * Context: Can sleep. * Return: 0 on success, negative value for failure. */ int rtl83xx_setup_user_mdio(struct dsa_switch *ds) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_probe() - probe a Realtek switch * @dev: the device being probed * @interface_info: specific management interface info. * * This function initializes realtek_priv and reads data from the device tree * node. The switch is hard resetted if a method is provided. * * Context: Can sleep. * Return: Pointer to the realtek_priv or ERR_PTR() in case of failure. * * The realtek_priv pointer does not need to be freed as it is controlled by * devres. */ struct realtek_priv * rtl83xx_probe(struct device *dev, const struct realtek_interface_info *interface_info) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_register_switch() - detects and register a switch * @priv: realtek_priv pointer * * This function first checks the switch chip ID and register a DSA * switch. * * Context: Can sleep. Takes and releases priv->map_lock. * Return: 0 on success, negative value for failure. */ int rtl83xx_register_switch(struct realtek_priv *priv) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_unregister_switch() - unregister a switch * @priv: realtek_priv pointer * * This function unregister a DSA switch. * * Context: Can sleep. * Return: Nothing. */ void rtl83xx_unregister_switch(struct realtek_priv *priv) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_shutdown() - shutdown a switch * @priv: realtek_priv pointer * * This function shuts down the DSA switch and cleans the platform driver data, * to prevent realtek_{smi,mdio}_remove() from running afterwards, which is * possible if the parent bus implements its own .shutdown() as .remove(). * * Context: Can sleep. * Return: Nothing. */ void rtl83xx_shutdown(struct realtek_priv *priv) { … } EXPORT_SYMBOL_NS_GPL(…); /** * rtl83xx_remove() - Cleanup a realtek switch driver * @priv: realtek_priv pointer * * Placehold for common cleanup procedures. * * Context: Any * Return: nothing */ void rtl83xx_remove(struct realtek_priv *priv) { … } EXPORT_SYMBOL_NS_GPL(…); void rtl83xx_reset_assert(struct realtek_priv *priv) { … } void rtl83xx_reset_deassert(struct realtek_priv *priv) { … } MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;