linux/drivers/net/phy/qcom/qca807x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2023 Sartura Ltd.
 *
 * Author: Robert Marko <[email protected]>
 *         Christian Marangi <[email protected]>
 *
 * Qualcomm QCA8072 and QCA8075 PHY driver
 */

#include <linux/module.h>
#include <linux/of.h>
#include <linux/phy.h>
#include <linux/bitfield.h>
#include <linux/gpio/driver.h>
#include <linux/sfp.h>

#include "qcom.h"

#define QCA807X_CHIP_CONFIGURATION
#define QCA807X_BT_BX_REG_SEL
#define QCA807X_BT_BX_REG_SEL_FIBER
#define QCA807X_BT_BX_REG_SEL_COPPER
#define QCA807X_CHIP_CONFIGURATION_MODE_CFG_MASK
#define QCA807X_CHIP_CONFIGURATION_MODE_QSGMII_SGMII
#define QCA807X_CHIP_CONFIGURATION_MODE_PSGMII_FIBER
#define QCA807X_CHIP_CONFIGURATION_MODE_PSGMII_ALL_COPPER

#define QCA807X_MEDIA_SELECT_STATUS
#define QCA807X_MEDIA_DETECTED_COPPER
#define QCA807X_MEDIA_DETECTED_1000_BASE_X
#define QCA807X_MEDIA_DETECTED_100_BASE_FX

#define QCA807X_MMD7_FIBER_MODE_AUTO_DETECTION
#define QCA807X_MMD7_FIBER_MODE_AUTO_DETECTION_EN

#define QCA807X_MMD7_1000BASE_T_POWER_SAVE_PER_CABLE_LENGTH
#define QCA807X_CONTROL_DAC_MASK
/* List of tweaks enabled by this bit:
 * - With both FULL amplitude and FULL bias current: bias current
 *   is set to half.
 * - With only DSP amplitude: bias current is set to half and
 *   is set to 1/4 with cable < 10m.
 * - With DSP bias current (included both DSP amplitude and
 *   DSP bias current): bias current is half the detected current
 *   with cable < 10m.
 */
#define QCA807X_CONTROL_DAC_BIAS_CURRENT_TWEAK
#define QCA807X_CONTROL_DAC_DSP_BIAS_CURRENT
#define QCA807X_CONTROL_DAC_DSP_AMPLITUDE

#define QCA807X_MMD7_LED_100N_1
#define QCA807X_MMD7_LED_100N_2
#define QCA807X_MMD7_LED_1000N_1
#define QCA807X_MMD7_LED_1000N_2

#define QCA807X_MMD7_LED_CTRL(x)
#define QCA807X_MMD7_LED_FORCE_CTRL(x)

/* LED hw control pattern for fiber port */
#define QCA807X_LED_FIBER_PATTERN_MASK
#define QCA807X_LED_FIBER_TXACT_BLK_EN
#define QCA807X_LED_FIBER_RXACT_BLK_EN
#define QCA807X_LED_FIBER_FDX_ON_EN
#define QCA807X_LED_FIBER_HDX_ON_EN
#define QCA807X_LED_FIBER_1000BX_ON_EN
#define QCA807X_LED_FIBER_100FX_ON_EN

/* Some device repurpose the LED as GPIO out */
#define QCA807X_GPIO_FORCE_EN
#define QCA807X_GPIO_FORCE_MODE_MASK

#define QCA807X_FUNCTION_CONTROL
#define QCA807X_FC_MDI_CROSSOVER_MODE_MASK
#define QCA807X_FC_MDI_CROSSOVER_AUTO
#define QCA807X_FC_MDI_CROSSOVER_MANUAL_MDIX
#define QCA807X_FC_MDI_CROSSOVER_MANUAL_MDI

/* PQSGMII Analog PHY specific */
#define PQSGMII_CTRL_REG
#define PQSGMII_ANALOG_SW_RESET
#define PQSGMII_DRIVE_CONTROL_1
#define PQSGMII_TX_DRIVER_MASK
#define PQSGMII_TX_DRIVER_140MV
#define PQSGMII_TX_DRIVER_160MV
#define PQSGMII_TX_DRIVER_180MV
#define PQSGMII_TX_DRIVER_200MV
#define PQSGMII_TX_DRIVER_220MV
#define PQSGMII_TX_DRIVER_240MV
#define PQSGMII_TX_DRIVER_260MV
#define PQSGMII_TX_DRIVER_280MV
#define PQSGMII_TX_DRIVER_300MV
#define PQSGMII_TX_DRIVER_320MV
#define PQSGMII_TX_DRIVER_400MV
#define PQSGMII_TX_DRIVER_500MV
#define PQSGMII_TX_DRIVER_600MV
#define PQSGMII_MODE_CTRL
#define PQSGMII_MODE_CTRL_AZ_WORKAROUND_MASK
#define PQSGMII_MMD3_SERDES_CONTROL

#define PHY_ID_QCA8072
#define PHY_ID_QCA8075

#define QCA807X_COMBO_ADDR_OFFSET
#define QCA807X_PQSGMII_ADDR_OFFSET
#define SERDES_RESET_SLEEP

enum qca807x_global_phy {};

struct qca807x_shared_priv {};

struct qca807x_gpio_priv {};

struct qca807x_priv {};

static int qca807x_cable_test_start(struct phy_device *phydev)
{}

static int qca807x_led_parse_netdev(struct phy_device *phydev, unsigned long rules,
				    u16 *offload_trigger)
{}

static int qca807x_led_hw_control_enable(struct phy_device *phydev, u8 index)
{}

static int qca807x_led_hw_is_supported(struct phy_device *phydev, u8 index,
				       unsigned long rules)
{}

static int qca807x_led_hw_control_set(struct phy_device *phydev, u8 index,
				      unsigned long rules)
{}

static bool qca807x_led_hw_control_status(struct phy_device *phydev, u8 index)
{}

static int qca807x_led_hw_control_get(struct phy_device *phydev, u8 index,
				      unsigned long *rules)
{}

static int qca807x_led_hw_control_reset(struct phy_device *phydev, u8 index)
{}

static int qca807x_led_brightness_set(struct phy_device *phydev,
				      u8 index, enum led_brightness value)
{}

static int qca807x_led_blink_set(struct phy_device *phydev, u8 index,
				 unsigned long *delay_on,
				 unsigned long *delay_off)
{}

#ifdef CONFIG_GPIOLIB
static int qca807x_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
{}

static int qca807x_gpio_get(struct gpio_chip *gc, unsigned int offset)
{}

static void qca807x_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{}

static int qca807x_gpio_dir_out(struct gpio_chip *gc, unsigned int offset, int value)
{}

static int qca807x_gpio(struct phy_device *phydev)
{}
#endif

static int qca807x_read_fiber_status(struct phy_device *phydev)
{}

static int qca807x_read_status(struct phy_device *phydev)
{}

static int qca807x_phy_package_probe_once(struct phy_device *phydev)
{}

static int qca807x_phy_package_config_init_once(struct phy_device *phydev)
{}

static int qca807x_sfp_insert(void *upstream, const struct sfp_eeprom_id *id)
{}

static void qca807x_sfp_remove(void *upstream)
{}

static const struct sfp_upstream_ops qca807x_sfp_ops =;

static int qca807x_probe(struct phy_device *phydev)
{}

static int qca807x_config_init(struct phy_device *phydev)
{}

static struct phy_driver qca807x_drivers[] =;
module_phy_driver(qca807x_drivers);

static struct mdio_device_id __maybe_unused qca807x_tbl[] =;

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_DEVICE_TABLE(mdio, qca807x_tbl);
MODULE_LICENSE();