summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@avencall.com>2012-07-18 12:08:36 +0200
committerNoe Rubinstein <nrubinstein@avencall.com>2012-07-18 12:08:36 +0200
commita58953c4d31fe5003b0a53d50981ac97b5413019 (patch)
tree4b1aee71cae77c435be0d43dea70222e4488e6ce
parent8aa04251323a6254dcda0c8423a9a5bd43e668b3 (diff)
Read the MAC addresses at 0xfff00000
-rw-r--r--Makefile1
-rw-r--r--e1000_hw.c26
-rw-r--r--e1000_main.c4
3 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 6d5fb97..f425b93 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@
CONFIG_E1000 := m
CONFIG_E1000_EP80579 := y
+ccflags-y += -DXIOH
ccflags-y += -DEXTERNAL_MDIO
ccflags-y += -DCONFIG_E1000_EP80579
ccflags-y += -DCONFIG_E1000_EP80579_PHY0
diff --git a/e1000_hw.c b/e1000_hw.c
index 3fc03fb..966c68b 100644
--- a/e1000_hw.c
+++ b/e1000_hw.c
@@ -4273,6 +4273,21 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
return E1000_SUCCESS;
}
+#ifdef XIOH
+static int devnum(struct e1000_hw *hw)
+{
+ struct e1000_adapter *adapter = hw->back;
+ uint32_t dev_num;
+ dev_num = PCI_SLOT(adapter->pdev->devfn);
+ switch (dev_num) {
+ case ICP_XXXX_MAC_0: return 0;
+ case ICP_XXXX_MAC_1: return 1;
+ case ICP_XXXX_MAC_2: return 2;
+ }
+ return -1;
+}
+#endif
+
/**
* e1000_read_mac_addr - read the adapters MAC from eeprom
* @hw: Struct containing variables accessed by shared code
@@ -4282,6 +4297,16 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
*/
s32 e1000_read_mac_addr(struct e1000_hw *hw)
{
+#ifdef XIOH
+#define MAC_OFFSET_IN_RAM 0xfff00000
+ int num = devnum(hw);
+ int i;
+ u8 *mac;
+ mac = ioremap(MAC_OFFSET_IN_RAM,18);
+ for (i = 0; i < 6; i++)
+ hw->perm_mac_addr[i] = mac[6*num+i];
+
+#else
u16 offset;
u16 eeprom_data, i;
uint16_t ia_base_addr = 0;
@@ -4318,6 +4343,7 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw)
hw->perm_mac_addr[5] ^= 0x01;
break;
}
+#endif
for (i = 0; i < NODE_ADDRESS_SIZE; i++)
hw->mac_addr[i] = hw->perm_mac_addr[i];
diff --git a/e1000_main.c b/e1000_main.c
index 89d3aa7..798dbaa 100644
--- a/e1000_main.c
+++ b/e1000_main.c
@@ -964,6 +964,9 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
e1000_reset_hw(hw);
+#ifdef XIOH
+ e1000_read_mac_addr(hw);
+#else
/* make sure the EEPROM is good */
if (e1000_validate_eeprom_checksum(hw) < 0) {
DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
@@ -982,6 +985,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
if (e1000_read_mac_addr(hw))
DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
}
+#endif
/* don't block initalization here due to bad MAC address */
memcpy(netdev->dev_addr, hw->mac_addr, netdev->addr_len);
memcpy(netdev->perm_addr, hw->mac_addr, netdev->addr_len);