Lines Matching +full:port +full:- +full:expander
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2007-2012 Solarflare Communications Inc.
91 struct i2c_client *client = i2c_new_client_device(&board->i2c_adap, info); in ef4_init_lm87()
97 /* Read-to-clear alarm/interrupt status */ in ef4_init_lm87()
108 board->hwmon_client = client; in ef4_init_lm87()
118 i2c_unregister_device(falcon_board(efx)->hwmon_client); in ef4_fini_lm87()
123 struct i2c_client *client = falcon_board(efx)->hwmon_client; in ef4_check_lm87()
129 if (EF4_WORKAROUND_7884(efx) && efx->link_state.up) in ef4_check_lm87()
161 netif_err(efx, hw, efx->net_dev, in ef4_check_lm87()
173 return is_failure ? -ERANGE : 0; in ef4_check_lm87()
197 * The SFE4001 does not power-up fully at reset due to its high power
198 * consumption. We control its power via a PCA9539 I/O expander.
205 * the IO-expander.
211 * Support for I2C IO Expander device on SFE4001
257 struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client; in sfe4001_poweroff()
258 struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client; in sfe4001_poweroff()
265 /* Clear any over-temperature alert */ in sfe4001_poweroff()
271 struct i2c_client *ioexp_client = falcon_board(efx)->ioexp_client; in sfe4001_poweron()
272 struct i2c_client *hwmon_client = falcon_board(efx)->hwmon_client; in sfe4001_poweron()
277 /* Clear any previous over-temperature alert */ in sfe4001_poweron()
282 /* Enable port 0 and port 1 outputs on IO expander */ in sfe4001_poweron()
301 netif_info(efx, hw, efx->net_dev, "power-cycling PHY\n"); in sfe4001_poweron()
313 if (efx->phy_mode & PHY_MODE_SPECIAL) in sfe4001_poweron()
327 netif_info(efx, hw, efx->net_dev, in sfe4001_poweron()
333 if (efx->phy_mode & PHY_MODE_SPECIAL) { in sfe4001_poweron()
350 netif_info(efx, hw, efx->net_dev, "timed out waiting for DSP boot\n"); in sfe4001_poweron()
351 rc = -ETIMEDOUT; in sfe4001_poweron()
361 return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL)); in phy_flash_cfg_show()
373 old_mode = efx->phy_mode; in phy_flash_cfg_store()
380 } else if (efx->state != STATE_READY || netif_running(efx->net_dev)) { in phy_flash_cfg_store()
381 err = -EBUSY; in phy_flash_cfg_store()
385 efx->phy_mode = new_mode; in phy_flash_cfg_store()
405 netif_info(efx, drv, efx->net_dev, "%s\n", __func__); in sfe4001_fini()
407 device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); in sfe4001_fini()
409 i2c_unregister_device(board->ioexp_client); in sfe4001_fini()
410 i2c_unregister_device(board->hwmon_client); in sfe4001_fini()
415 struct falcon_nic_data *nic_data = efx->nic_data; in sfe4001_check_hw()
419 if (EF4_WORKAROUND_7884(efx) && !nic_data->xmac_poll_required) in sfe4001_check_hw()
425 * directly because the later is read-to-clear and would thus in sfe4001_check_hw()
428 * We know we can read from the IO expander because we did in sfe4001_check_hw()
429 * it during power-on. Assume failure now is bad news. */ in sfe4001_check_hw()
430 status = i2c_smbus_read_byte_data(falcon_board(efx)->ioexp_client, P1_IN); in sfe4001_check_hw()
437 efx->phy_mode = PHY_MODE_OFF; in sfe4001_check_hw()
439 return (status < 0) ? -EIO : -ERANGE; in sfe4001_check_hw()
446 /* This board uses an I2C expander to provider power to the PHY, which needs to
456 board->hwmon_client = in sfe4001_init()
457 i2c_new_client_device(&board->i2c_adap, &sfe4001_hwmon_info); in sfe4001_init()
459 board->hwmon_client = in sfe4001_init()
460 i2c_new_dummy_device(&board->i2c_adap, sfe4001_hwmon_info.addr); in sfe4001_init()
462 if (IS_ERR(board->hwmon_client)) in sfe4001_init()
463 return PTR_ERR(board->hwmon_client); in sfe4001_init()
466 rc = i2c_smbus_write_byte_data(board->hwmon_client, in sfe4001_init()
471 board->ioexp_client = i2c_new_dummy_device(&board->i2c_adap, PCA9539); in sfe4001_init()
472 if (IS_ERR(board->ioexp_client)) { in sfe4001_init()
473 rc = PTR_ERR(board->ioexp_client); in sfe4001_init()
477 if (efx->phy_mode & PHY_MODE_SPECIAL) { in sfe4001_init()
486 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_flash_cfg); in sfe4001_init()
490 netif_info(efx, hw, efx->net_dev, "PHY is powered on\n"); in sfe4001_init()
496 i2c_unregister_device(board->ioexp_client); in sfe4001_init()
498 i2c_unregister_device(board->hwmon_client); in sfe4001_init()
509 LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */
510 LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
511 LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
512 LM87_IN_LIMITS(3, 0xac, 0xd4), /* 5V: 5.0V +/- 10% */
513 LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
514 LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
515 LM87_AIN_LIMITS(0, 0x98, 0xbb), /* AIN1: 1.66V +/- 10% */
516 LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */
562 (board->major == 0 && board->minor == 0) ? in sfe4002_check_hw()
580 LM87_IN_LIMITS(0, 0x7c, 0x99), /* 2.5V: 1.8V +/- 10% */
581 LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
582 LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
583 LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
584 LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
585 LM87_AIN_LIMITS(1, 0x8a, 0xa9), /* AIN2: 1.5V +/- 10% */
644 LM87_IN_LIMITS(0, 0x67, 0x7f), /* 2.5V: 1.5V +/- 10% */
645 LM87_IN_LIMITS(1, 0x4c, 0x5e), /* Vccp1: 1.2V +/- 10% */
646 LM87_IN_LIMITS(2, 0xac, 0xd4), /* 3.3V: 3.3V +/- 10% */
647 LM87_IN_LIMITS(4, 0xac, 0xe0), /* 12V: 10.8-14V */
648 LM87_IN_LIMITS(5, 0x3f, 0x4f), /* Vccp2: 1.0V +/- 10% */
658 /* Board-specific LED info. */
668 if (board->minor < 3 && board->major == 0) in sfe4003_set_id_led()
681 if (board->minor < 3 && board->major == 0) in sfe4003_init_phy()
695 (board->major == 0 && board->minor <= 2) ? in sfe4003_check_hw()
747 board->major = FALCON_BOARD_MAJOR(revision_info); in falcon_probe_board()
748 board->minor = FALCON_BOARD_MINOR(revision_info); in falcon_probe_board()
752 board->type = &board_types[i]; in falcon_probe_board()
754 if (board->type) { in falcon_probe_board()
757 netif_err(efx, probe, efx->net_dev, "unknown board type %d\n", in falcon_probe_board()
759 return -ENODEV; in falcon_probe_board()