++struct avila_eeprom_header {
++ unsigned char mac0[ETH_ALEN];
++ unsigned char mac1[ETH_ALEN];
++ unsigned char res0[4];
++ unsigned char magic[2];
++ unsigned char config[14];
++ unsigned char model[16];
++};
++
++static int avila_eeprom_notify(struct notifier_block *self,
++ unsigned long event, void *t)
++{
++ struct eeprom_data *ee = t;
++ struct avila_board_info *info = NULL;
++ struct avila_eeprom_header hdr;
++
++ /* The eeprom is at address 0x51 */
++ if (event != EEPROM_REGISTER || ee->client.addr != 0x51)
++ return NOTIFY_DONE;
++
++ ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr,
++ 0, sizeof(hdr));
++
++ if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W')
++ return NOTIFY_DONE;
++
++ memcpy(&avila_plat_eth[0].hwaddr, hdr.mac0, ETH_ALEN);
++ memcpy(&avila_plat_eth[1].hwaddr, hdr.mac1, ETH_ALEN);
++
++ info = avila_find_board_info(hdr.model);
++
++ if (info) {
++ printk(KERN_DEBUG "Running on Gateworks Avila %s\n",
++ info->model);
++ avila_plat_eth[0].phy = info->npeb_phy;
++ avila_plat_eth[1].phy = info->npec_phy;
++ platform_add_devices(avila_eth_devices,
++ info->npes_used);
++ } else {
++ printk(KERN_INFO "Unknown/missing Avila model number"
++ " -- defaults will be used\n");
++ platform_add_devices(avila_eth_devices,
++ ARRAY_SIZE(avila_eth_devices));
++ }
++
++ unregister_eeprom_notifier(self);
++
++ return NOTIFY_OK;
++}
++
++static struct notifier_block avila_eeprom_notifier = {
++ .notifier_call = avila_eeprom_notify