mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
cf93c94581
MODULE_DEVICE_TABLE only expands to something if it's compiled for a module. So when building-in support for the phys, the mdio_device_id tables are unused. Marking them with __maybe_unused fixes the following warnings: drivers/net/phy/bcm63xx.c:134: warning: 'bcm63xx_tbl' defined but not used drivers/net/phy/broadcom.c:933: warning: 'broadcom_tbl' defined but not used drivers/net/phy/cicada.c:162: warning: 'cicada_tbl' defined but not used drivers/net/phy/davicom.c:222: warning: 'davicom_tbl' defined but not used drivers/net/phy/et1011c.c:114: warning: 'et1011c_tbl' defined but not used drivers/net/phy/icplus.c:137: warning: 'icplus_tbl' defined but not used drivers/net/phy/lxt.c:226: warning: 'lxt_tbl' defined but not used drivers/net/phy/marvell.c:724: warning: 'marvell_tbl' defined but not used drivers/net/phy/micrel.c:234: warning: 'micrel_tbl' defined but not used drivers/net/phy/national.c:154: warning: 'ns_tbl' defined but not used drivers/net/phy/qsemi.c:141: warning: 'qs6612_tbl' defined but not used drivers/net/phy/realtek.c:82: warning: 'realtek_tbl' defined but not used drivers/net/phy/smsc.c:257: warning: 'smsc_tbl' defined but not used drivers/net/phy/ste10Xp.c:135: warning: 'ste10Xp_tbl' defined but not used drivers/net/phy/vitesse.c:195: warning: 'vitesse_tbl' defined but not used Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
145 lines
3.5 KiB
C
145 lines
3.5 KiB
C
/*
|
|
* drivers/net/phy/ste10Xp.c
|
|
*
|
|
* Driver for STMicroelectronics STe10Xp PHYs
|
|
*
|
|
* Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
|
|
*
|
|
* Copyright (c) 2008 STMicroelectronics Limited
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/ethtool.h>
|
|
#include <linux/mii.h>
|
|
#include <linux/phy.h>
|
|
|
|
#define MII_XCIIS 0x11 /* Configuration Info IRQ & Status Reg */
|
|
#define MII_XIE 0x12 /* Interrupt Enable Register */
|
|
#define MII_XIE_DEFAULT_MASK 0x0070 /* ANE complete, Remote Fault, Link Down */
|
|
|
|
#define STE101P_PHY_ID 0x00061c50
|
|
#define STE100P_PHY_ID 0x1c040011
|
|
|
|
static int ste10Xp_config_init(struct phy_device *phydev)
|
|
{
|
|
int value, err;
|
|
|
|
/* Software Reset PHY */
|
|
value = phy_read(phydev, MII_BMCR);
|
|
if (value < 0)
|
|
return value;
|
|
|
|
value |= BMCR_RESET;
|
|
err = phy_write(phydev, MII_BMCR, value);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
do {
|
|
value = phy_read(phydev, MII_BMCR);
|
|
} while (value & BMCR_RESET);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int ste10Xp_config_intr(struct phy_device *phydev)
|
|
{
|
|
int err, value;
|
|
|
|
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
|
|
/* Enable all STe101P interrupts (PR12) */
|
|
err = phy_write(phydev, MII_XIE, MII_XIE_DEFAULT_MASK);
|
|
/* clear any pending interrupts */
|
|
if (err == 0) {
|
|
value = phy_read(phydev, MII_XCIIS);
|
|
if (value < 0)
|
|
err = value;
|
|
}
|
|
} else
|
|
err = phy_write(phydev, MII_XIE, 0);
|
|
|
|
return err;
|
|
}
|
|
|
|
static int ste10Xp_ack_interrupt(struct phy_device *phydev)
|
|
{
|
|
int err = phy_read(phydev, MII_XCIIS);
|
|
if (err < 0)
|
|
return err;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct phy_driver ste101p_pdriver = {
|
|
.phy_id = STE101P_PHY_ID,
|
|
.phy_id_mask = 0xfffffff0,
|
|
.name = "STe101p",
|
|
.features = PHY_BASIC_FEATURES | SUPPORTED_Pause,
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
.config_init = ste10Xp_config_init,
|
|
.config_aneg = genphy_config_aneg,
|
|
.read_status = genphy_read_status,
|
|
.ack_interrupt = ste10Xp_ack_interrupt,
|
|
.config_intr = ste10Xp_config_intr,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
.driver = {.owner = THIS_MODULE,}
|
|
};
|
|
|
|
static struct phy_driver ste100p_pdriver = {
|
|
.phy_id = STE100P_PHY_ID,
|
|
.phy_id_mask = 0xffffffff,
|
|
.name = "STe100p",
|
|
.features = PHY_BASIC_FEATURES | SUPPORTED_Pause,
|
|
.flags = PHY_HAS_INTERRUPT,
|
|
.config_init = ste10Xp_config_init,
|
|
.config_aneg = genphy_config_aneg,
|
|
.read_status = genphy_read_status,
|
|
.ack_interrupt = ste10Xp_ack_interrupt,
|
|
.config_intr = ste10Xp_config_intr,
|
|
.suspend = genphy_suspend,
|
|
.resume = genphy_resume,
|
|
.driver = {.owner = THIS_MODULE,}
|
|
};
|
|
|
|
static int __init ste10Xp_init(void)
|
|
{
|
|
int retval;
|
|
|
|
retval = phy_driver_register(&ste100p_pdriver);
|
|
if (retval < 0)
|
|
return retval;
|
|
return phy_driver_register(&ste101p_pdriver);
|
|
}
|
|
|
|
static void __exit ste10Xp_exit(void)
|
|
{
|
|
phy_driver_unregister(&ste100p_pdriver);
|
|
phy_driver_unregister(&ste101p_pdriver);
|
|
}
|
|
|
|
module_init(ste10Xp_init);
|
|
module_exit(ste10Xp_exit);
|
|
|
|
static struct mdio_device_id __maybe_unused ste10Xp_tbl[] = {
|
|
{ STE101P_PHY_ID, 0xfffffff0 },
|
|
{ STE100P_PHY_ID, 0xffffffff },
|
|
{ }
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(mdio, ste10Xp_tbl);
|
|
|
|
MODULE_DESCRIPTION("STMicroelectronics STe10Xp PHY driver");
|
|
MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
|
|
MODULE_LICENSE("GPL");
|