mt7603: add mt7603_eeprom.c

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2016-02-22 08:27:32 +01:00
parent 2ebc0053b1
commit 65c0e3dccf
4 changed files with 47 additions and 7 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ mt76x2e-y := \
mt7603e-y := \
mt7603_pci.o mt7603_main.o mt7603_init.o mt7603_mcu.o \
mt7603_core.o mt7603_dma.o mt7603_mac.o
mt7603_core.o mt7603_dma.o mt7603_mac.o mt7603_eeprom.o
+1
View File
@@ -152,6 +152,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance);
int mt7603_register_device(struct mt7603_dev *dev);
void mt7603_unregister_device(struct mt7603_dev *dev);
int mt7603_eeprom_init(struct mt7603_dev *dev);
int mt7603_dma_init(struct mt7603_dev *dev);
void mt7603_dma_cleanup(struct mt7603_dev *dev);
int mt7603_mcu_init(struct mt7603_dev *dev);
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2016 Felix Fietkau <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "mt7603.h"
#include "mt7603_eeprom.h"
static int
mt7603_eeprom_load(struct mt7603_dev *dev)
{
int ret;
ret = mt76_eeprom_init(&dev->mt76, MT7603_EEPROM_SIZE);
if (ret < 0)
return ret;
return 0;
}
int mt7603_eeprom_init(struct mt7603_dev *dev)
{
int ret;
ret = mt7603_eeprom_load(dev);
if (ret < 0)
return ret;
dev->mt76.cap.has_2ghz = true;
memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
ETH_ALEN);
mt76_eeprom_override(&dev->mt76);
return 0;
}
+1 -6
View File
@@ -270,15 +270,10 @@ mt7603_init_hardware(struct mt7603_dev *dev)
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
ret = mt76_eeprom_init(&dev->mt76, MT7603_EEPROM_SIZE);
ret = mt7603_eeprom_init(dev);
if (ret < 0)
return ret;
dev->mt76.cap.has_2ghz = true;
memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
ETH_ALEN);
mt76_eeprom_override(&dev->mt76);
ret = mt7603_dma_init(dev);
if (ret)
return ret;