Skip to content

Commit

Permalink
sfc: Add support for SFE4003 board and TXC43128 PHY
Browse files Browse the repository at this point in the history
This board never went into production, but some engineering samples
are in use.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Sep 22, 2010
1 parent 8fbca79 commit 7e51b43
Show file tree
Hide file tree
Showing 5 changed files with 656 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/sfc/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \
falcon_xmac.o mcdi_mac.o \
selftest.o ethtool.o qt202x_phy.o mdio_10g.o \
tenxpress.o falcon_boards.o mcdi.o mcdi_phy.o
tenxpress.o txc43128_phy.o falcon_boards.o \
mcdi.o mcdi_phy.o
sfc-$(CONFIG_SFC_MTD) += mtd.o

obj-$(CONFIG_SFC) += sfc.o
3 changes: 3 additions & 0 deletions drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,9 @@ static int falcon_probe_port(struct efx_nic *efx)
case PHY_TYPE_QT2025C:
efx->phy_op = &falcon_qt202x_phy_ops;
break;
case PHY_TYPE_TXC43128:
efx->phy_op = &falcon_txc_phy_ops;
break;
default:
netif_err(efx, probe, efx->net_dev, "Unknown PHY type %d\n",
efx->phy_type);
Expand Down
80 changes: 80 additions & 0 deletions drivers/net/sfc/falcon_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/* Board types */
#define FALCON_BOARD_SFE4001 0x01
#define FALCON_BOARD_SFE4002 0x02
#define FALCON_BOARD_SFE4003 0x03
#define FALCON_BOARD_SFN4112F 0x52

/* Board temperature is about 15°C above ambient when air flow is
Expand Down Expand Up @@ -582,6 +583,75 @@ static int sfn4112f_init(struct efx_nic *efx)
return efx_init_lm87(efx, &sfn4112f_hwmon_info, sfn4112f_lm87_regs);
}

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

static const u8 sfe4003_lm87_regs[] = {
LM87_IN_LIMITS(0, 0x67, 0x7f), /* 2.5V: 1.5V +/- 10% */
LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
LM87_TEMP_INT_LIMITS(0, 70 + FALCON_BOARD_TEMP_BIAS),
0
};

static struct i2c_board_info sfe4003_hwmon_info = {
I2C_BOARD_INFO("lm87", 0x2e),
.platform_data = &sfe4003_lm87_channel,
};

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

static void sfe4003_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
{
struct falcon_board *board = falcon_board(efx);

/* The LEDs were not wired to GPIOs before A3 */
if (board->minor < 3 && board->major == 0)
return;

falcon_txc_set_gpio_val(
efx, SFE4003_RED_LED_GPIO,
(mode == EFX_LED_ON) ? SFE4003_LED_ON : SFE4003_LED_OFF);
}

static void sfe4003_init_phy(struct efx_nic *efx)
{
struct falcon_board *board = falcon_board(efx);

/* The LEDs were not wired to GPIOs before A3 */
if (board->minor < 3 && board->major == 0)
return;

falcon_txc_set_gpio_dir(efx, SFE4003_RED_LED_GPIO, TXC_GPIO_DIR_OUTPUT);
falcon_txc_set_gpio_val(efx, SFE4003_RED_LED_GPIO, SFE4003_LED_OFF);
}

static int sfe4003_check_hw(struct efx_nic *efx)
{
struct falcon_board *board = falcon_board(efx);

/* A0/A1/A2 board rev. 4003s report a temperature fault the whole time
* (bad sensor) so we mask it out. */
unsigned alarm_mask =
(board->major == 0 && board->minor <= 2) ?
~LM87_ALARM_TEMP_EXT1 : ~0;

return efx_check_lm87(efx, alarm_mask);
}

static int sfe4003_init(struct efx_nic *efx)
{
return efx_init_lm87(efx, &sfe4003_hwmon_info, sfe4003_lm87_regs);
}

static const struct falcon_board_type board_types[] = {
{
.id = FALCON_BOARD_SFE4001,
Expand All @@ -603,6 +673,16 @@ static const struct falcon_board_type board_types[] = {
.set_id_led = sfe4002_set_id_led,
.monitor = sfe4002_check_hw,
},
{
.id = FALCON_BOARD_SFE4003,
.ref_model = "SFE4003",
.gen_type = "10GBASE-CX4 adapter",
.init = sfe4003_init,
.init_phy = sfe4003_init_phy,
.fini = efx_fini_lm87,
.set_id_led = sfe4003_set_id_led,
.monitor = sfe4003_check_hw,
},
{
.id = FALCON_BOARD_SFN4112F,
.ref_model = "SFN4112F",
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/sfc/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ extern struct efx_phy_operations falcon_qt202x_phy_ops;

extern void falcon_qt202x_set_led(struct efx_nic *p, int led, int state);

/****************************************************************************
* Transwitch CX4 retimer
*/
extern struct efx_phy_operations falcon_txc_phy_ops;

#define TXC_GPIO_DIR_INPUT 0
#define TXC_GPIO_DIR_OUTPUT 1

extern void falcon_txc_set_gpio_dir(struct efx_nic *efx, int pin, int dir);
extern void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int val);

/****************************************************************************
* Siena managed PHYs
*/
Expand Down
Loading

0 comments on commit 7e51b43

Please sign in to comment.