mirror of https://github.com/ipxe/ipxe.git
Forward-port reset-related changes from 5.4 tree.
parent
968501e323
commit
50ab8c0e5b
|
@ -495,22 +495,31 @@ struct efab_mentormac_parameters {
|
||||||
* Reset Mentor MAC
|
* Reset Mentor MAC
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void mentormac_reset ( struct efab_nic *efab, int reset ) {
|
static void mentormac_reset ( struct efab_nic *efab ) {
|
||||||
efab_dword_t reg;
|
efab_dword_t reg;
|
||||||
|
int save_port;
|
||||||
|
|
||||||
EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, reset );
|
/* Take into reset */
|
||||||
|
EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 1 );
|
||||||
efab->op->mac_writel ( efab, ®, GM_CFG1_REG_MAC );
|
efab->op->mac_writel ( efab, ®, GM_CFG1_REG_MAC );
|
||||||
udelay ( 1000 );
|
udelay ( 1000 );
|
||||||
|
|
||||||
if ( ( ! reset ) && ( efab->port == 0 ) ) {
|
/* Take out of reset */
|
||||||
/* Configure GMII interface so PHY is accessible.
|
EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 0 );
|
||||||
* Note that GMII interface is connected only to port
|
efab->op->mac_writel ( efab, ®, GM_CFG1_REG_MAC );
|
||||||
* 0
|
udelay ( 1000 );
|
||||||
|
|
||||||
|
/* Mentor MAC connects both PHYs to MAC 0 */
|
||||||
|
save_port = efab->port;
|
||||||
|
efab->port = 0;
|
||||||
|
/* Configure GMII interface so PHY is accessible. Note that
|
||||||
|
* GMII interface is connected only to port 0, and that on
|
||||||
|
* Falcon this is a no-op.
|
||||||
*/
|
*/
|
||||||
EFAB_POPULATE_DWORD_1 ( reg, GM_MGMT_CLK_SEL, 0x4 );
|
EFAB_POPULATE_DWORD_1 ( reg, GM_MGMT_CLK_SEL, 0x4 );
|
||||||
efab->op->mac_writel ( efab, ®, GM_MII_MGMT_CFG_REG_MAC );
|
efab->op->mac_writel ( efab, ®, GM_MII_MGMT_CFG_REG_MAC );
|
||||||
udelay ( 10 );
|
udelay ( 10 );
|
||||||
}
|
efab->port = save_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1038,7 +1047,7 @@ static int ef1002_reset ( struct efab_nic *efab ) {
|
||||||
pci_read_config_dword ( pci_dev, efab_pci_reg_addr[i], &tmp );
|
pci_read_config_dword ( pci_dev, efab_pci_reg_addr[i], &tmp );
|
||||||
if ( tmp != pci_reg.reg[i] ) {
|
if ( tmp != pci_reg.reg[i] ) {
|
||||||
printf ( "PCI restore failed on register %02x "
|
printf ( "PCI restore failed on register %02x "
|
||||||
"(is %08x, should be %08x); reboot\n",
|
"(is %08lx, should be %08lx); reboot\n",
|
||||||
i, tmp, pci_reg.reg[i] );
|
i, tmp, pci_reg.reg[i] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1069,6 @@ static int ef1002_reset ( struct efab_nic *efab ) {
|
||||||
*/
|
*/
|
||||||
static int ef1002_init_nic ( struct efab_nic *efab ) {
|
static int ef1002_init_nic ( struct efab_nic *efab ) {
|
||||||
efab_dword_t reg;
|
efab_dword_t reg;
|
||||||
int save_port;
|
|
||||||
|
|
||||||
/* No idea what CAM is, but the 'datasheet' says that we have
|
/* No idea what CAM is, but the 'datasheet' says that we have
|
||||||
* to write these values in at start of day
|
* to write these values in at start of day
|
||||||
|
@ -1110,31 +1118,8 @@ static int ef1002_init_nic ( struct efab_nic *efab ) {
|
||||||
wmb();
|
wmb();
|
||||||
udelay ( 10000 );
|
udelay ( 10000 );
|
||||||
|
|
||||||
/* Reset both MACs */
|
/* Reset MAC */
|
||||||
save_port = efab->port;
|
mentormac_reset ( efab );
|
||||||
efab->port = 0;
|
|
||||||
mentormac_reset ( efab, 1 );
|
|
||||||
efab->port = 1;
|
|
||||||
mentormac_reset ( efab, 1 );
|
|
||||||
|
|
||||||
/* Reset both PHYs */
|
|
||||||
ef1002_readl ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
|
||||||
EFAB_SET_DWORD_FIELD ( reg, EF1_MAC_RESET, 1 );
|
|
||||||
ef1002_writel ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
|
||||||
udelay ( 10000 );
|
|
||||||
EFAB_SET_DWORD_FIELD ( reg, EF1_MAC_RESET, 0 );
|
|
||||||
ef1002_writel ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
|
||||||
udelay ( 10000 );
|
|
||||||
|
|
||||||
/* Take MACs out of reset */
|
|
||||||
efab->port = 0;
|
|
||||||
mentormac_reset ( efab, 0 );
|
|
||||||
efab->port = 1;
|
|
||||||
mentormac_reset ( efab, 0 );
|
|
||||||
efab->port = save_port;
|
|
||||||
|
|
||||||
/* Give PHY time to wake up. It takes a while. */
|
|
||||||
sleep ( 2 );
|
|
||||||
|
|
||||||
/* Attach I2C bus */
|
/* Attach I2C bus */
|
||||||
ef1002_init_eeprom ( efab );
|
ef1002_init_eeprom ( efab );
|
||||||
|
@ -1254,7 +1239,8 @@ static int ef1002_fetch_event ( struct efab_nic *efab,
|
||||||
event->rx_len = ETH_FRAME_LEN;
|
event->rx_len = ETH_FRAME_LEN;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf ( "Unknown event type %d\n", ev_code );
|
printf ( "Unknown event type %d data %08lx\n", ev_code,
|
||||||
|
EFAB_DWORD_FIELD ( reg, EFAB_DWORD_0 ) );
|
||||||
event->type = EFAB_EV_NONE;
|
event->type = EFAB_EV_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2026,9 +2012,7 @@ static int falcon_init_nic ( struct efab_nic *efab ) {
|
||||||
udelay ( 1000 );
|
udelay ( 1000 );
|
||||||
|
|
||||||
/* Reset the MAC */
|
/* Reset the MAC */
|
||||||
mentormac_reset ( efab, 1 );
|
mentormac_reset ( efab );
|
||||||
/* Take MAC out of reset */
|
|
||||||
mentormac_reset ( efab, 0 );
|
|
||||||
|
|
||||||
/* Set up event queue */
|
/* Set up event queue */
|
||||||
falcon_create_special_buffer ( efab, efab->eventq, FALCON_EVQ_ID );
|
falcon_create_special_buffer ( efab, efab->eventq, FALCON_EVQ_ID );
|
||||||
|
@ -2629,10 +2613,6 @@ static int efab_init_mac ( struct efab_nic *efab ) {
|
||||||
static int efab_init_nic ( struct efab_nic *efab ) {
|
static int efab_init_nic ( struct efab_nic *efab ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Reset NIC */
|
|
||||||
if ( ! efab->op->reset ( efab ) )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Initialise NIC */
|
/* Initialise NIC */
|
||||||
if ( ! efab->op->init_nic ( efab ) )
|
if ( ! efab->op->init_nic ( efab ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue