Skip to content

Commit

Permalink
rt2x00: rt2800pci: use separate read_eeprom callback for SoC devices
Browse files Browse the repository at this point in the history
Rename the 'rt2800pci_read_eeprom_soc function' to
'rt2800soc_read_eeprom' and use that directly in the
SoC specific 'rt2800_ops' structure. Also move the
'rt2800pci_eeprom_read' function into an 'ifdef PCI'
section and remove the 'rt2800pci_read_eeprom_soc'
call from that.

Additionally, remove the dummy inline eeprom functions.
Those are not used anymore.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Gabor Juhos authored and John W. Linville committed Oct 18, 2013
1 parent eeea863 commit 68597ea
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions drivers/net/wireless/rt2x00/rt2800pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,6 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
}

#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
{
void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);

if (!base_addr)
return -ENOMEM;

memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);

iounmap(base_addr);
return 0;
}
#else
static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
{
return -ENOMEM;
}
#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */

#ifdef CONFIG_PCI
static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
{
Expand Down Expand Up @@ -184,21 +164,6 @@ static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
{
return rt2800_read_eeprom_efuse(rt2x00dev);
}
#else
static inline int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev)
{
return -EOPNOTSUPP;
}

static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev)
{
return 0;
}

static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev)
{
return -EOPNOTSUPP;
}
#endif /* CONFIG_PCI */

/*
Expand Down Expand Up @@ -339,24 +304,22 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,
return retval;
}

#ifdef CONFIG_PCI
/*
* Device probe functions.
*/
static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev)
{
int retval;

if (rt2x00_is_soc(rt2x00dev))
retval = rt2800pci_read_eeprom_soc(rt2x00dev);
else if (rt2800pci_efuse_detect(rt2x00dev))
if (rt2800pci_efuse_detect(rt2x00dev))
retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
else
retval = rt2800pci_read_eeprom_pci(rt2x00dev);

return retval;
}

#ifdef CONFIG_PCI
static const struct ieee80211_ops rt2800pci_mac80211_ops = {
.tx = rt2x00mac_tx,
.start = rt2x00mac_start,
Expand Down Expand Up @@ -517,6 +480,19 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
MODULE_LICENSE("GPL");

#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev)
{
void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);

if (!base_addr)
return -ENOMEM;

memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);

iounmap(base_addr);
return 0;
}

static const struct ieee80211_ops rt2800soc_mac80211_ops = {
.tx = rt2x00mac_tx,
.start = rt2x00mac_start,
Expand Down Expand Up @@ -552,7 +528,7 @@ static const struct rt2800_ops rt2800soc_rt2800_ops = {
.register_multiread = rt2x00mmio_register_multiread,
.register_multiwrite = rt2x00mmio_register_multiwrite,
.regbusy_read = rt2x00mmio_regbusy_read,
.read_eeprom = rt2800pci_read_eeprom,
.read_eeprom = rt2800soc_read_eeprom,
.hwcrypt_disabled = rt2800pci_hwcrypt_disabled,
.drv_write_firmware = rt2800pci_write_firmware,
.drv_init_registers = rt2800mmio_init_registers,
Expand Down

0 comments on commit 68597ea

Please sign in to comment.