goto err;
}
- efx->board_info.hwmon_client = client;
+ falcon_board(efx)->hwmon_client = client;
return 0;
err:
static void efx_fini_lm87(struct efx_nic *efx)
{
- i2c_unregister_device(efx->board_info.hwmon_client);
+ i2c_unregister_device(falcon_board(efx)->hwmon_client);
}
static int efx_check_lm87(struct efx_nic *efx, unsigned mask)
{
- struct i2c_client *client = efx->board_info.hwmon_client;
+ struct i2c_client *client = falcon_board(efx)->hwmon_client;
s32 alarms1, alarms2;
/* If link is up then do not monitor temperature */
static void sfe4001_poweroff(struct efx_nic *efx)
{
- struct i2c_client *ioexp_client = efx->board_info.ioexp_client;
- struct i2c_client *hwmon_client = efx->board_info.hwmon_client;
+ struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client;
+ struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client;
/* Turn off all power rails and disable outputs */
i2c_smbus_write_byte_data(ioexp_client, P0_OUT, 0xff);
static int sfe4001_poweron(struct efx_nic *efx)
{
- struct i2c_client *hwmon_client = efx->board_info.hwmon_client;
- struct i2c_client *ioexp_client = efx->board_info.ioexp_client;
+ struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client;
+ struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client;
unsigned int i, j;
int rc;
u8 out;
efx->phy_mode = new_mode;
if (new_mode & PHY_MODE_SPECIAL)
efx_stats_disable(efx);
- if (efx->board_info.type == FALCON_BOARD_SFE4001)
+ if (falcon_board(efx)->type == FALCON_BOARD_SFE4001)
err = sfe4001_poweron(efx);
else
err = sfn4111t_reset(efx);
static void sfe4001_fini(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
+
EFX_INFO(efx, "%s\n", __func__);
device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
sfe4001_poweroff(efx);
- i2c_unregister_device(efx->board_info.ioexp_client);
- i2c_unregister_device(efx->board_info.hwmon_client);
+ i2c_unregister_device(board->ioexp_client);
+ i2c_unregister_device(board->hwmon_client);
}
static int sfe4001_check_hw(struct efx_nic *efx)
* the power undesirably.
* We know we can read from the IO expander because we did
* it during power-on. Assume failure now is bad news. */
- status = i2c_smbus_read_byte_data(efx->board_info.ioexp_client, P1_IN);
+ status = i2c_smbus_read_byte_data(falcon_board(efx)->ioexp_client, P1_IN);
if (status >= 0 &&
(status & ((1 << P1_AFE_PWD_LBN) | (1 << P1_DSP_PWD25_LBN))) != 0)
return 0;
*/
static int sfe4001_init(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
int rc;
#if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE)
- efx->board_info.hwmon_client =
+ board->hwmon_client =
i2c_new_device(&efx->i2c_adap, &sfe4001_hwmon_info);
#else
- efx->board_info.hwmon_client =
+ board->hwmon_client =
i2c_new_dummy(&efx->i2c_adap, sfe4001_hwmon_info.addr);
#endif
- if (!efx->board_info.hwmon_client)
+ if (!board->hwmon_client)
return -EIO;
/* Raise board/PHY high limit from 85 to 90 degrees Celsius */
- rc = i2c_smbus_write_byte_data(efx->board_info.hwmon_client,
+ rc = i2c_smbus_write_byte_data(board->hwmon_client,
MAX664X_REG_WLHO, 90);
if (rc)
goto fail_hwmon;
- efx->board_info.ioexp_client = i2c_new_dummy(&efx->i2c_adap, PCA9539);
- if (!efx->board_info.ioexp_client) {
+ board->ioexp_client = i2c_new_dummy(&efx->i2c_adap, PCA9539);
+ if (!board->ioexp_client) {
rc = -EIO;
goto fail_hwmon;
}
/* 10Xpress has fixed-function LED pins, so there is no board-specific
* blink code. */
- efx->board_info.set_id_led = tenxpress_set_id_led;
+ board->set_id_led = tenxpress_set_id_led;
- efx->board_info.monitor = sfe4001_check_hw;
- efx->board_info.fini = sfe4001_fini;
+ board->monitor = sfe4001_check_hw;
+ board->fini = sfe4001_fini;
if (efx->phy_mode & PHY_MODE_SPECIAL) {
/* PHY won't generate a 156.25 MHz clock and MAC stats fetch
fail_on:
sfe4001_poweroff(efx);
fail_ioexp:
- i2c_unregister_device(efx->board_info.ioexp_client);
+ i2c_unregister_device(board->ioexp_client);
fail_hwmon:
- i2c_unregister_device(efx->board_info.hwmon_client);
+ i2c_unregister_device(board->hwmon_client);
return rc;
}
return 0;
/* Test LHIGH, RHIGH, FAULT, EOT and IOT alarms */
- status = i2c_smbus_read_byte_data(efx->board_info.hwmon_client,
+ status = i2c_smbus_read_byte_data(falcon_board(efx)->hwmon_client,
MAX664X_REG_RSL);
if (status < 0)
return -EIO;
EFX_INFO(efx, "%s\n", __func__);
device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
- i2c_unregister_device(efx->board_info.hwmon_client);
+ i2c_unregister_device(falcon_board(efx)->hwmon_client);
}
static struct i2c_board_info sfn4111t_a0_hwmon_info = {
static int sfn4111t_init(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
int rc;
- efx->board_info.hwmon_client =
+ board->hwmon_client =
i2c_new_device(&efx->i2c_adap,
- (efx->board_info.minor < 5) ?
+ (board->minor < 5) ?
&sfn4111t_a0_hwmon_info :
&sfn4111t_r5_hwmon_info);
- if (!efx->board_info.hwmon_client)
+ if (!board->hwmon_client)
return -EIO;
- efx->board_info.init_phy = sfn4111t_init_phy;
- efx->board_info.set_id_led = tenxpress_set_id_led;
- efx->board_info.monitor = sfn4111t_check_hw;
- efx->board_info.fini = sfn4111t_fini;
+ board->init_phy = sfn4111t_init_phy;
+ board->set_id_led = tenxpress_set_id_led;
+ board->monitor = sfn4111t_check_hw;
+ board->fini = sfn4111t_fini;
rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg);
if (rc)
return 0;
fail_hwmon:
- i2c_unregister_device(efx->board_info.hwmon_client);
+ i2c_unregister_device(board->hwmon_client);
return rc;
}
static int sfe4002_check_hw(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
+
/* A0 board rev. 4002s report a temperature fault the whole time
* (bad sensor) so we mask it out. */
unsigned alarm_mask =
- (efx->board_info.major == 0 && efx->board_info.minor == 0) ?
+ (board->major == 0 && board->minor == 0) ?
~LM87_ALARM_TEMP_EXT1 : ~0;
return efx_check_lm87(efx, alarm_mask);
static int sfe4002_init(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
int rc = efx_init_lm87(efx, &sfe4002_hwmon_info, sfe4002_lm87_regs);
if (rc)
return rc;
- efx->board_info.monitor = sfe4002_check_hw;
- efx->board_info.init_phy = sfe4002_init_phy;
- efx->board_info.set_id_led = sfe4002_set_id_led;
- efx->board_info.fini = efx_fini_lm87;
+ board->monitor = sfe4002_check_hw;
+ board->init_phy = sfe4002_init_phy;
+ board->set_id_led = sfe4002_set_id_led;
+ board->fini = efx_fini_lm87;
return 0;
}
static int sfn4112f_init(struct efx_nic *efx)
{
+ struct falcon_board *board = falcon_board(efx);
+
int rc = efx_init_lm87(efx, &sfn4112f_hwmon_info, sfn4112f_lm87_regs);
if (rc)
return rc;
- efx->board_info.monitor = sfn4112f_check_hw;
- efx->board_info.init_phy = sfn4112f_init_phy;
- efx->board_info.set_id_led = sfn4112f_set_id_led;
- efx->board_info.fini = efx_fini_lm87;
+ board->monitor = sfn4112f_check_hw;
+ board->init_phy = sfn4112f_init_phy;
+ board->set_id_led = sfn4112f_set_id_led;
+ board->fini = efx_fini_lm87;
return 0;
}
void falcon_probe_board(struct efx_nic *efx, u16 revision_info)
{
+ struct falcon_board *board = falcon_board(efx);
struct falcon_board_data *data = NULL;
int i;
- efx->board_info.type = FALCON_BOARD_TYPE(revision_info);
- efx->board_info.major = FALCON_BOARD_MAJOR(revision_info);
- efx->board_info.minor = FALCON_BOARD_MINOR(revision_info);
+ board->type = FALCON_BOARD_TYPE(revision_info);
+ board->major = FALCON_BOARD_MAJOR(revision_info);
+ board->minor = FALCON_BOARD_MINOR(revision_info);
for (i = 0; i < ARRAY_SIZE(board_data); i++)
- if (board_data[i].type == efx->board_info.type)
+ if (board_data[i].type == board->type)
data = &board_data[i];
if (data) {
EFX_INFO(efx, "board is %s rev %c%d\n",
(efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
? data->ref_model : data->gen_type,
- 'A' + efx->board_info.major, efx->board_info.minor);
- efx->board_info.init = data->init;
+ 'A' + board->major, board->minor);
+ board->init = data->init;
} else {
- EFX_ERR(efx, "unknown board type %d\n", efx->board_info.type);
+ EFX_ERR(efx, "unknown board type %d\n", board->type);
}
}