mt7530.c (d1b803f4ca4f25d6f171219d039f9410a10b29ee) mt7530.c (0650bf52b31ff35dc6430fc2e37969c36baba724)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Mediatek MT7530 DSA Switch driver
4 * Copyright (C) 2017 Sean Wang <sean.wang@mediatek.com>
5 */
6#include <linux/etherdevice.h>
7#include <linux/if_bridge.h>
8#include <linux/iopoll.h>

--- 3272 unchanged lines hidden (view full) ---

3281}
3282
3283static void
3284mt7530_remove(struct mdio_device *mdiodev)
3285{
3286 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
3287 int ret = 0;
3288
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Mediatek MT7530 DSA Switch driver
4 * Copyright (C) 2017 Sean Wang <sean.wang@mediatek.com>
5 */
6#include <linux/etherdevice.h>
7#include <linux/if_bridge.h>
8#include <linux/iopoll.h>

--- 3272 unchanged lines hidden (view full) ---

3281}
3282
3283static void
3284mt7530_remove(struct mdio_device *mdiodev)
3285{
3286 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
3287 int ret = 0;
3288
3289 if (!priv)
3290 return;
3291
3289 ret = regulator_disable(priv->core_pwr);
3290 if (ret < 0)
3291 dev_err(priv->dev,
3292 "Failed to disable core power: %d\n", ret);
3293
3294 ret = regulator_disable(priv->io_pwr);
3295 if (ret < 0)
3296 dev_err(priv->dev, "Failed to disable io pwr: %d\n",
3297 ret);
3298
3299 if (priv->irq)
3300 mt7530_free_irq(priv);
3301
3302 dsa_unregister_switch(priv->ds);
3303 mutex_destroy(&priv->reg_mutex);
3292 ret = regulator_disable(priv->core_pwr);
3293 if (ret < 0)
3294 dev_err(priv->dev,
3295 "Failed to disable core power: %d\n", ret);
3296
3297 ret = regulator_disable(priv->io_pwr);
3298 if (ret < 0)
3299 dev_err(priv->dev, "Failed to disable io pwr: %d\n",
3300 ret);
3301
3302 if (priv->irq)
3303 mt7530_free_irq(priv);
3304
3305 dsa_unregister_switch(priv->ds);
3306 mutex_destroy(&priv->reg_mutex);
3307
3308 dev_set_drvdata(&mdiodev->dev, NULL);
3304}
3305
3309}
3310
3311static void mt7530_shutdown(struct mdio_device *mdiodev)
3312{
3313 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
3314
3315 if (!priv)
3316 return;
3317
3318 dsa_switch_shutdown(priv->ds);
3319
3320 dev_set_drvdata(&mdiodev->dev, NULL);
3321}
3322
3306static struct mdio_driver mt7530_mdio_driver = {
3307 .probe = mt7530_probe,
3308 .remove = mt7530_remove,
3323static struct mdio_driver mt7530_mdio_driver = {
3324 .probe = mt7530_probe,
3325 .remove = mt7530_remove,
3326 .shutdown = mt7530_shutdown,
3309 .mdiodrv.driver = {
3310 .name = "mt7530",
3311 .of_match_table = mt7530_of_match,
3312 },
3313};
3314
3315mdio_module_driver(mt7530_mdio_driver);
3316
3317MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
3318MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch");
3319MODULE_LICENSE("GPL");
3327 .mdiodrv.driver = {
3328 .name = "mt7530",
3329 .of_match_table = mt7530_of_match,
3330 },
3331};
3332
3333mdio_module_driver(mt7530_mdio_driver);
3334
3335MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
3336MODULE_DESCRIPTION("Driver for Mediatek MT7530 Switch");
3337MODULE_LICENSE("GPL");