linux/drivers/net/ethernet/sfc/falcon/falcon_boards.c

// SPDX-License-Identifier: GPL-2.0-only
/****************************************************************************
 * Driver for Solarflare network controllers and boards
 * Copyright 2007-2012 Solarflare Communications Inc.
 */

#include <linux/rtnetlink.h>

#include "net_driver.h"
#include "phy.h"
#include "efx.h"
#include "nic.h"
#include "workarounds.h"

/* Macros for unpacking the board revision */
/* The revision info is in host byte order. */
#define FALCON_BOARD_TYPE(_rev)
#define FALCON_BOARD_MAJOR(_rev)
#define FALCON_BOARD_MINOR(_rev)

/* Board types */
#define FALCON_BOARD_SFE4001
#define FALCON_BOARD_SFE4002
#define FALCON_BOARD_SFE4003
#define FALCON_BOARD_SFN4112F

/* Board temperature is about 15°C above ambient when air flow is
 * limited.  The maximum acceptable ambient temperature varies
 * depending on the PHY specifications but the critical temperature
 * above which we should shut down to avoid damage is 80°C. */
#define FALCON_BOARD_TEMP_BIAS
#define FALCON_BOARD_TEMP_CRIT

/* SFC4000 datasheet says: 'The maximum permitted junction temperature
 * is 125°C; the thermal design of the environment for the SFC4000
 * should aim to keep this well below 100°C.' */
#define FALCON_JUNC_TEMP_MIN
#define FALCON_JUNC_TEMP_MAX
#define FALCON_JUNC_TEMP_CRIT

/*****************************************************************************
 * Support for LM87 sensor chip used on several boards
 */
#define LM87_REG_TEMP_HW_INT_LOCK
#define LM87_REG_TEMP_HW_EXT_LOCK
#define LM87_REG_TEMP_HW_INT
#define LM87_REG_TEMP_HW_EXT
#define LM87_REG_TEMP_EXT1
#define LM87_REG_TEMP_INT
#define LM87_REG_ALARMS1
#define LM87_REG_ALARMS2
#define LM87_IN_LIMITS(nr, _min, _max)
#define LM87_AIN_LIMITS(nr, _min, _max)
#define LM87_TEMP_INT_LIMITS(_min, _max)
#define LM87_TEMP_EXT1_LIMITS(_min, _max)

#define LM87_ALARM_TEMP_INT
#define LM87_ALARM_TEMP_EXT1

#if IS_ENABLED(CONFIG_SENSORS_LM87)

static int ef4_poke_lm87(struct i2c_client *client, const u8 *reg_values)
{}

static const u8 falcon_lm87_common_regs[] =;

static int ef4_init_lm87(struct ef4_nic *efx, const struct i2c_board_info *info,
			 const u8 *reg_values)
{}

static void ef4_fini_lm87(struct ef4_nic *efx)
{}

static int ef4_check_lm87(struct ef4_nic *efx, unsigned mask)
{}

#else /* !CONFIG_SENSORS_LM87 */

static inline int
ef4_init_lm87(struct ef4_nic *efx, const struct i2c_board_info *info,
	      const u8 *reg_values)
{
	return 0;
}
static inline void ef4_fini_lm87(struct ef4_nic *efx)
{
}
static inline int ef4_check_lm87(struct ef4_nic *efx, unsigned mask)
{
	return 0;
}

#endif /* CONFIG_SENSORS_LM87 */

/*****************************************************************************
 * Support for the SFE4001 NIC.
 *
 * The SFE4001 does not power-up fully at reset due to its high power
 * consumption.  We control its power via a PCA9539 I/O expander.
 * It also has a MAX6647 temperature monitor which we expose to
 * the lm90 driver.
 *
 * This also provides minimal support for reflashing the PHY, which is
 * initiated by resetting it with the FLASH_CFG_1 pin pulled down.
 * On SFE4001 rev A2 and later this is connected to the 3V3X output of
 * the IO-expander.
 * We represent reflash mode as PHY_MODE_SPECIAL and make it mutually
 * exclusive with the network device being open.
 */

/**************************************************************************
 * Support for I2C IO Expander device on SFE4001
 */
#define PCA9539

#define P0_IN
#define P0_OUT
#define P0_INVERT
#define P0_CONFIG

#define P0_EN_1V0X_LBN
#define P0_EN_1V0X_WIDTH
#define P0_EN_1V2_LBN
#define P0_EN_1V2_WIDTH
#define P0_EN_2V5_LBN
#define P0_EN_2V5_WIDTH
#define P0_EN_3V3X_LBN
#define P0_EN_3V3X_WIDTH
#define P0_EN_5V_LBN
#define P0_EN_5V_WIDTH
#define P0_SHORTEN_JTAG_LBN
#define P0_SHORTEN_JTAG_WIDTH
#define P0_X_TRST_LBN
#define P0_X_TRST_WIDTH
#define P0_DSP_RESET_LBN
#define P0_DSP_RESET_WIDTH

#define P1_IN
#define P1_OUT
#define P1_INVERT
#define P1_CONFIG

#define P1_AFE_PWD_LBN
#define P1_AFE_PWD_WIDTH
#define P1_DSP_PWD25_LBN
#define P1_DSP_PWD25_WIDTH
#define P1_RESERVED_LBN
#define P1_RESERVED_WIDTH
#define P1_SPARE_LBN
#define P1_SPARE_WIDTH

/* Temperature Sensor */
#define MAX664X_REG_RSL
#define MAX664X_REG_WLHO

static void sfe4001_poweroff(struct ef4_nic *efx)
{}

static int sfe4001_poweron(struct ef4_nic *efx)
{}

static ssize_t phy_flash_cfg_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{}

static ssize_t phy_flash_cfg_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{}

static DEVICE_ATTR_RW(phy_flash_cfg);

static void sfe4001_fini(struct ef4_nic *efx)
{}

static int sfe4001_check_hw(struct ef4_nic *efx)
{}

static const struct i2c_board_info sfe4001_hwmon_info =;

/* This board uses an I2C expander to provider power to the PHY, which needs to
 * be turned on before the PHY can be used.
 * Context: Process context, rtnl lock held
 */
static int sfe4001_init(struct ef4_nic *efx)
{}

/*****************************************************************************
 * Support for the SFE4002
 *
 */
static u8 sfe4002_lm87_channel =; /* use AIN not FAN inputs */

static const u8 sfe4002_lm87_regs[] =;

static const struct i2c_board_info sfe4002_hwmon_info =;

/****************************************************************************/
/* LED allocations. Note that on rev A0 boards the schematic and the reality
 * differ: red and green are swapped. Below is the fixed (A1) layout (there
 * are only 3 A0 boards in existence, so no real reason to make this
 * conditional).
 */
#define SFE4002_FAULT_LED
#define SFE4002_RX_LED
#define SFE4002_TX_LED

static void sfe4002_init_phy(struct ef4_nic *efx)
{}

static void sfe4002_set_id_led(struct ef4_nic *efx, enum ef4_led_mode mode)
{}

static int sfe4002_check_hw(struct ef4_nic *efx)
{}

static int sfe4002_init(struct ef4_nic *efx)
{}

/*****************************************************************************
 * Support for the SFN4112F
 *
 */
static u8 sfn4112f_lm87_channel =; /* use AIN not FAN inputs */

static const u8 sfn4112f_lm87_regs[] =;

static const struct i2c_board_info sfn4112f_hwmon_info =;

#define SFN4112F_ACT_LED
#define SFN4112F_LINK_LED

static void sfn4112f_init_phy(struct ef4_nic *efx)
{}

static void sfn4112f_set_id_led(struct ef4_nic *efx, enum ef4_led_mode mode)
{}

static int sfn4112f_check_hw(struct ef4_nic *efx)
{}

static int sfn4112f_init(struct ef4_nic *efx)
{}

/*****************************************************************************
 * Support for the SFE4003
 *
 */
static u8 sfe4003_lm87_channel =; /* use AIN not FAN inputs */

static const u8 sfe4003_lm87_regs[] =;

static const struct i2c_board_info sfe4003_hwmon_info =;

/* Board-specific LED info. */
#define SFE4003_RED_LED_GPIO
#define SFE4003_LED_ON
#define SFE4003_LED_OFF

static void sfe4003_set_id_led(struct ef4_nic *efx, enum ef4_led_mode mode)
{}

static void sfe4003_init_phy(struct ef4_nic *efx)
{}

static int sfe4003_check_hw(struct ef4_nic *efx)
{}

static int sfe4003_init(struct ef4_nic *efx)
{}

static const struct falcon_board_type board_types[] =;

int falcon_probe_board(struct ef4_nic *efx, u16 revision_info)
{}