|
@@ -495,22 +495,31 @@ struct efab_mentormac_parameters {
|
495
|
495
|
* Reset Mentor MAC
|
496
|
496
|
*
|
497
|
497
|
*/
|
498
|
|
-static void mentormac_reset ( struct efab_nic *efab, int reset ) {
|
|
498
|
+static void mentormac_reset ( struct efab_nic *efab ) {
|
499
|
499
|
efab_dword_t reg;
|
|
500
|
+ int save_port;
|
500
|
501
|
|
501
|
|
- EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, reset );
|
|
502
|
+ /* Take into reset */
|
|
503
|
+ EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 1 );
|
502
|
504
|
efab->op->mac_writel ( efab, ®, GM_CFG1_REG_MAC );
|
503
|
505
|
udelay ( 1000 );
|
504
|
506
|
|
505
|
|
- if ( ( ! reset ) && ( efab->port == 0 ) ) {
|
506
|
|
- /* Configure GMII interface so PHY is accessible.
|
507
|
|
- * Note that GMII interface is connected only to port
|
508
|
|
- * 0
|
509
|
|
- */
|
510
|
|
- EFAB_POPULATE_DWORD_1 ( reg, GM_MGMT_CLK_SEL, 0x4 );
|
511
|
|
- efab->op->mac_writel ( efab, ®, GM_MII_MGMT_CFG_REG_MAC );
|
512
|
|
- udelay ( 10 );
|
513
|
|
- }
|
|
507
|
+ /* Take out of reset */
|
|
508
|
+ EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 0 );
|
|
509
|
+ efab->op->mac_writel ( efab, ®, GM_CFG1_REG_MAC );
|
|
510
|
+ udelay ( 1000 );
|
|
511
|
+
|
|
512
|
+ /* Mentor MAC connects both PHYs to MAC 0 */
|
|
513
|
+ save_port = efab->port;
|
|
514
|
+ efab->port = 0;
|
|
515
|
+ /* Configure GMII interface so PHY is accessible. Note that
|
|
516
|
+ * GMII interface is connected only to port 0, and that on
|
|
517
|
+ * Falcon this is a no-op.
|
|
518
|
+ */
|
|
519
|
+ EFAB_POPULATE_DWORD_1 ( reg, GM_MGMT_CLK_SEL, 0x4 );
|
|
520
|
+ efab->op->mac_writel ( efab, ®, GM_MII_MGMT_CFG_REG_MAC );
|
|
521
|
+ udelay ( 10 );
|
|
522
|
+ efab->port = save_port;
|
514
|
523
|
}
|
515
|
524
|
|
516
|
525
|
/**
|
|
@@ -1038,7 +1047,7 @@ static int ef1002_reset ( struct efab_nic *efab ) {
|
1038
|
1047
|
pci_read_config_dword ( pci_dev, efab_pci_reg_addr[i], &tmp );
|
1039
|
1048
|
if ( tmp != pci_reg.reg[i] ) {
|
1040
|
1049
|
printf ( "PCI restore failed on register %02x "
|
1041
|
|
- "(is %08x, should be %08x); reboot\n",
|
|
1050
|
+ "(is %08lx, should be %08lx); reboot\n",
|
1042
|
1051
|
i, tmp, pci_reg.reg[i] );
|
1043
|
1052
|
return 0;
|
1044
|
1053
|
}
|
|
@@ -1060,7 +1069,6 @@ static int ef1002_reset ( struct efab_nic *efab ) {
|
1060
|
1069
|
*/
|
1061
|
1070
|
static int ef1002_init_nic ( struct efab_nic *efab ) {
|
1062
|
1071
|
efab_dword_t reg;
|
1063
|
|
- int save_port;
|
1064
|
1072
|
|
1065
|
1073
|
/* No idea what CAM is, but the 'datasheet' says that we have
|
1066
|
1074
|
* to write these values in at start of day
|
|
@@ -1110,31 +1118,8 @@ static int ef1002_init_nic ( struct efab_nic *efab ) {
|
1110
|
1118
|
wmb();
|
1111
|
1119
|
udelay ( 10000 );
|
1112
|
1120
|
|
1113
|
|
- /* Reset both MACs */
|
1114
|
|
- save_port = efab->port;
|
1115
|
|
- efab->port = 0;
|
1116
|
|
- mentormac_reset ( efab, 1 );
|
1117
|
|
- efab->port = 1;
|
1118
|
|
- mentormac_reset ( efab, 1 );
|
1119
|
|
-
|
1120
|
|
- /* Reset both PHYs */
|
1121
|
|
- ef1002_readl ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
1122
|
|
- EFAB_SET_DWORD_FIELD ( reg, EF1_MAC_RESET, 1 );
|
1123
|
|
- ef1002_writel ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
1124
|
|
- udelay ( 10000 );
|
1125
|
|
- EFAB_SET_DWORD_FIELD ( reg, EF1_MAC_RESET, 0 );
|
1126
|
|
- ef1002_writel ( efab, ®, EF1_CTR_GEN_STATUS0_REG );
|
1127
|
|
- udelay ( 10000 );
|
1128
|
|
-
|
1129
|
|
- /* Take MACs out of reset */
|
1130
|
|
- efab->port = 0;
|
1131
|
|
- mentormac_reset ( efab, 0 );
|
1132
|
|
- efab->port = 1;
|
1133
|
|
- mentormac_reset ( efab, 0 );
|
1134
|
|
- efab->port = save_port;
|
1135
|
|
-
|
1136
|
|
- /* Give PHY time to wake up. It takes a while. */
|
1137
|
|
- sleep ( 2 );
|
|
1121
|
+ /* Reset MAC */
|
|
1122
|
+ mentormac_reset ( efab );
|
1138
|
1123
|
|
1139
|
1124
|
/* Attach I2C bus */
|
1140
|
1125
|
ef1002_init_eeprom ( efab );
|
|
@@ -1254,7 +1239,8 @@ static int ef1002_fetch_event ( struct efab_nic *efab,
|
1254
|
1239
|
event->rx_len = ETH_FRAME_LEN;
|
1255
|
1240
|
break;
|
1256
|
1241
|
default:
|
1257
|
|
- printf ( "Unknown event type %d\n", ev_code );
|
|
1242
|
+ printf ( "Unknown event type %d data %08lx\n", ev_code,
|
|
1243
|
+ EFAB_DWORD_FIELD ( reg, EFAB_DWORD_0 ) );
|
1258
|
1244
|
event->type = EFAB_EV_NONE;
|
1259
|
1245
|
}
|
1260
|
1246
|
|
|
@@ -2026,9 +2012,7 @@ static int falcon_init_nic ( struct efab_nic *efab ) {
|
2026
|
2012
|
udelay ( 1000 );
|
2027
|
2013
|
|
2028
|
2014
|
/* Reset the MAC */
|
2029
|
|
- mentormac_reset ( efab, 1 );
|
2030
|
|
- /* Take MAC out of reset */
|
2031
|
|
- mentormac_reset ( efab, 0 );
|
|
2015
|
+ mentormac_reset ( efab );
|
2032
|
2016
|
|
2033
|
2017
|
/* Set up event queue */
|
2034
|
2018
|
falcon_create_special_buffer ( efab, efab->eventq, FALCON_EVQ_ID );
|
|
@@ -2629,10 +2613,6 @@ static int efab_init_mac ( struct efab_nic *efab ) {
|
2629
|
2613
|
static int efab_init_nic ( struct efab_nic *efab ) {
|
2630
|
2614
|
int i;
|
2631
|
2615
|
|
2632
|
|
- /* Reset NIC */
|
2633
|
|
- if ( ! efab->op->reset ( efab ) )
|
2634
|
|
- return 0;
|
2635
|
|
-
|
2636
|
2616
|
/* Initialise NIC */
|
2637
|
2617
|
if ( ! efab->op->init_nic ( efab ) )
|
2638
|
2618
|
return 0;
|