linux/drivers/net/phy/nxp-tja11xx.c

// SPDX-License-Identifier: GPL-2.0
/* NXP TJA1100 BroadRReach PHY driver
 *
 * Copyright (C) 2018 Marek Vasut <[email protected]>
 */
#include <linux/delay.h>
#include <linux/ethtool.h>
#include <linux/ethtool_netlink.h>
#include <linux/kernel.h>
#include <linux/mdio.h>
#include <linux/mii.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/phy.h>
#include <linux/hwmon.h>
#include <linux/bitfield.h>
#include <linux/of_mdio.h>
#include <linux/of_irq.h>

#define PHY_ID_MASK
#define PHY_ID_TJA1100
#define PHY_ID_TJA1101
#define PHY_ID_TJA1102

#define MII_ECTRL
#define MII_ECTRL_LINK_CONTROL
#define MII_ECTRL_POWER_MODE_MASK
#define MII_ECTRL_POWER_MODE_NO_CHANGE
#define MII_ECTRL_POWER_MODE_NORMAL
#define MII_ECTRL_POWER_MODE_STANDBY
#define MII_ECTRL_CABLE_TEST
#define MII_ECTRL_CONFIG_EN
#define MII_ECTRL_WAKE_REQUEST

#define MII_CFG1
#define MII_CFG1_MASTER_SLAVE
#define MII_CFG1_AUTO_OP
#define MII_CFG1_INTERFACE_MODE_MASK
#define MII_CFG1_MII_MODE
#define MII_CFG1_RMII_MODE_REFCLK_IN
#define MII_CFG1_RMII_MODE_REFCLK_OUT
#define MII_CFG1_REVMII_MODE
#define MII_CFG1_SLEEP_CONFIRM
#define MII_CFG1_LED_MODE_MASK
#define MII_CFG1_LED_MODE_LINKUP
#define MII_CFG1_LED_ENABLE

#define MII_CFG2
#define MII_CFG2_SLEEP_REQUEST_TO
#define MII_CFG2_SLEEP_REQUEST_TO_16MS

#define MII_INTSRC
#define MII_INTSRC_LINK_FAIL
#define MII_INTSRC_LINK_UP
#define MII_INTSRC_MASK
#define MII_INTSRC_UV_ERR
#define MII_INTSRC_TEMP_ERR

#define MII_INTEN
#define MII_INTEN_LINK_FAIL
#define MII_INTEN_LINK_UP
#define MII_INTEN_UV_ERR
#define MII_INTEN_TEMP_ERR

#define MII_COMMSTAT
#define MII_COMMSTAT_LINK_UP
#define MII_COMMSTAT_SQI_STATE
#define MII_COMMSTAT_SQI_MAX

#define MII_GENSTAT
#define MII_GENSTAT_PLL_LOCKED

#define MII_EXTSTAT
#define MII_EXTSTAT_SHORT_DETECT
#define MII_EXTSTAT_OPEN_DETECT
#define MII_EXTSTAT_POLARITY_DETECT

#define MII_COMMCFG
#define MII_COMMCFG_AUTO_OP

/* Configure REF_CLK as input in RMII mode */
#define TJA110X_RMII_MODE_REFCLK_IN

struct tja11xx_priv {};

struct tja11xx_phy_stats {};

static struct tja11xx_phy_stats tja11xx_hw_stats[] =;

static int tja11xx_check(struct phy_device *phydev, u8 reg, u16 mask, u16 set)
{}

static int phy_modify_check(struct phy_device *phydev, u8 reg,
			    u16 mask, u16 set)
{}

static int tja11xx_enable_reg_write(struct phy_device *phydev)
{}

static int tja11xx_enable_link_control(struct phy_device *phydev)
{}

static int tja11xx_disable_link_control(struct phy_device *phydev)
{}

static int tja11xx_wakeup(struct phy_device *phydev)
{}

static int tja11xx_soft_reset(struct phy_device *phydev)
{}

static int tja11xx_config_aneg_cable_test(struct phy_device *phydev)
{}

static int tja11xx_config_aneg(struct phy_device *phydev)
{}

static int tja11xx_get_interface_mode(struct phy_device *phydev)
{}

static int tja11xx_config_init(struct phy_device *phydev)
{}

static int tja11xx_read_status(struct phy_device *phydev)
{}

static int tja11xx_get_sqi(struct phy_device *phydev)
{}

static int tja11xx_get_sqi_max(struct phy_device *phydev)
{}

static int tja11xx_get_sset_count(struct phy_device *phydev)
{}

static void tja11xx_get_strings(struct phy_device *phydev, u8 *data)
{}

static void tja11xx_get_stats(struct phy_device *phydev,
			      struct ethtool_stats *stats, u64 *data)
{}

static int tja11xx_hwmon_read(struct device *dev,
			      enum hwmon_sensor_types type,
			      u32 attr, int channel, long *value)
{}

static umode_t tja11xx_hwmon_is_visible(const void *data,
					enum hwmon_sensor_types type,
					u32 attr, int channel)
{}

static const struct hwmon_channel_info * const tja11xx_hwmon_info[] =;

static const struct hwmon_ops tja11xx_hwmon_hwmon_ops =;

static const struct hwmon_chip_info tja11xx_hwmon_chip_info =;

static int tja11xx_hwmon_register(struct phy_device *phydev,
				  struct tja11xx_priv *priv)
{}

static int tja11xx_parse_dt(struct phy_device *phydev)
{}

static int tja11xx_probe(struct phy_device *phydev)
{}

static void tja1102_p1_register(struct work_struct *work)
{}

static int tja1102_p0_probe(struct phy_device *phydev)
{}

static int tja1102_match_phy_device(struct phy_device *phydev, bool port0)
{}

static int tja1102_p0_match_phy_device(struct phy_device *phydev)
{}

static int tja1102_p1_match_phy_device(struct phy_device *phydev)
{}

static int tja11xx_ack_interrupt(struct phy_device *phydev)
{}

static int tja11xx_config_intr(struct phy_device *phydev)
{}

static irqreturn_t tja11xx_handle_interrupt(struct phy_device *phydev)
{}

static int tja11xx_cable_test_start(struct phy_device *phydev)
{}

/*
 * | BI_DA+           | BI_DA-                 | Result
 * | open             | open                   | open
 * | + short to -     | - short to +           | short
 * | short to Vdd     | open                   | open
 * | open             | shot to Vdd            | open
 * | short to Vdd     | short to Vdd           | short
 * | shot to GND      | open                   | open
 * | open             | shot to GND            | open
 * | short to GND     | shot to GND            | short
 * | connected to active link partner (master) | shot and open
 */
static int tja11xx_cable_test_report_trans(u32 result)
{}

static int tja11xx_cable_test_report(struct phy_device *phydev)
{}

static int tja11xx_cable_test_get_status(struct phy_device *phydev,
					 bool *finished)
{}

static struct phy_driver tja11xx_driver[] =;

module_phy_driver(tja11xx_driver);

static struct mdio_device_id __maybe_unused tja11xx_tbl[] =;

MODULE_DEVICE_TABLE(mdio, tja11xx_tbl);

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