aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon_boards.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-23 11:06:02 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-24 13:58:52 -0500
commite775fb93a880d218ce0b3fd405278dd78f86c405 (patch)
tree5f5c31161f7f11a9611481396de92964e2fdaaae /drivers/net/sfc/falcon_boards.c
parent3759433db2f7340ddec3abd55ebb1178600d014e (diff)
sfc: Move all I2C stuff into struct falcon_board
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/falcon_boards.c')
-rw-r--r--drivers/net/sfc/falcon_boards.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c
index 20aebe07fdf2..cdf7a0d6e386 100644
--- a/drivers/net/sfc/falcon_boards.c
+++ b/drivers/net/sfc/falcon_boards.c
@@ -51,7 +51,8 @@
51static int efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info, 51static int efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info,
52 const u8 *reg_values) 52 const u8 *reg_values)
53{ 53{
54 struct i2c_client *client = i2c_new_device(&efx->i2c_adap, info); 54 struct falcon_board *board = falcon_board(efx);
55 struct i2c_client *client = i2c_new_device(&board->i2c_adap, info);
55 int rc; 56 int rc;
56 57
57 if (!client) 58 if (!client)
@@ -65,7 +66,7 @@ static int efx_init_lm87(struct efx_nic *efx, struct i2c_board_info *info,
65 goto err; 66 goto err;
66 } 67 }
67 68
68 falcon_board(efx)->hwmon_client = client; 69 board->hwmon_client = client;
69 return 0; 70 return 0;
70 71
71err: 72err:
@@ -290,10 +291,11 @@ fail_on:
290 291
291static int sfn4111t_reset(struct efx_nic *efx) 292static int sfn4111t_reset(struct efx_nic *efx)
292{ 293{
294 struct falcon_board *board = falcon_board(efx);
293 efx_oword_t reg; 295 efx_oword_t reg;
294 296
295 /* GPIO 3 and the GPIO register are shared with I2C, so block that */ 297 /* GPIO 3 and the GPIO register are shared with I2C, so block that */
296 i2c_lock_adapter(&efx->i2c_adap); 298 i2c_lock_adapter(&board->i2c_adap);
297 299
298 /* Pull RST_N (GPIO 2) low then let it up again, setting the 300 /* Pull RST_N (GPIO 2) low then let it up again, setting the
299 * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the 301 * FLASH_CFG_1 strap (GPIO 3) appropriately. Only change the
@@ -309,7 +311,7 @@ static int sfn4111t_reset(struct efx_nic *efx)
309 efx_writeo(efx, &reg, FR_AB_GPIO_CTL); 311 efx_writeo(efx, &reg, FR_AB_GPIO_CTL);
310 msleep(1); 312 msleep(1);
311 313
312 i2c_unlock_adapter(&efx->i2c_adap); 314 i2c_unlock_adapter(&board->i2c_adap);
313 315
314 ssleep(1); 316 ssleep(1);
315 return 0; 317 return 0;
@@ -416,10 +418,10 @@ static int sfe4001_init(struct efx_nic *efx)
416 418
417#if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE) 419#if defined(CONFIG_SENSORS_LM90) || defined(CONFIG_SENSORS_LM90_MODULE)
418 board->hwmon_client = 420 board->hwmon_client =
419 i2c_new_device(&efx->i2c_adap, &sfe4001_hwmon_info); 421 i2c_new_device(&board->i2c_adap, &sfe4001_hwmon_info);
420#else 422#else
421 board->hwmon_client = 423 board->hwmon_client =
422 i2c_new_dummy(&efx->i2c_adap, sfe4001_hwmon_info.addr); 424 i2c_new_dummy(&board->i2c_adap, sfe4001_hwmon_info.addr);
423#endif 425#endif
424 if (!board->hwmon_client) 426 if (!board->hwmon_client)
425 return -EIO; 427 return -EIO;
@@ -430,7 +432,7 @@ static int sfe4001_init(struct efx_nic *efx)
430 if (rc) 432 if (rc)
431 goto fail_hwmon; 433 goto fail_hwmon;
432 434
433 board->ioexp_client = i2c_new_dummy(&efx->i2c_adap, PCA9539); 435 board->ioexp_client = i2c_new_dummy(&board->i2c_adap, PCA9539);
434 if (!board->ioexp_client) { 436 if (!board->ioexp_client) {
435 rc = -EIO; 437 rc = -EIO;
436 goto fail_hwmon; 438 goto fail_hwmon;
@@ -522,7 +524,7 @@ static int sfn4111t_init(struct efx_nic *efx)
522 int rc; 524 int rc;
523 525
524 board->hwmon_client = 526 board->hwmon_client =
525 i2c_new_device(&efx->i2c_adap, 527 i2c_new_device(&board->i2c_adap,
526 (board->minor < 5) ? 528 (board->minor < 5) ?
527 &sfn4111t_a0_hwmon_info : 529 &sfn4111t_a0_hwmon_info :
528 &sfn4111t_r5_hwmon_info); 530 &sfn4111t_r5_hwmon_info);