diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 24 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 1 |
4 files changed, 27 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index c7108050af3a..621dac18ca6c 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -1684,24 +1684,28 @@ static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) | |||
1684 | { | 1684 | { |
1685 | u32 reg; | 1685 | u32 reg; |
1686 | 1686 | ||
1687 | rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®); | 1687 | mutex_lock(&rt2x00dev->csr_mutex); |
1688 | |||
1689 | rt2800_register_read_lock(rt2x00dev, EFUSE_CTRL, ®); | ||
1688 | rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i); | 1690 | rt2x00_set_field32(®, EFUSE_CTRL_ADDRESS_IN, i); |
1689 | rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0); | 1691 | rt2x00_set_field32(®, EFUSE_CTRL_MODE, 0); |
1690 | rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1); | 1692 | rt2x00_set_field32(®, EFUSE_CTRL_KICK, 1); |
1691 | rt2800_register_write(rt2x00dev, EFUSE_CTRL, reg); | 1693 | rt2800_register_write_lock(rt2x00dev, EFUSE_CTRL, reg); |
1692 | 1694 | ||
1693 | /* Wait until the EEPROM has been loaded */ | 1695 | /* Wait until the EEPROM has been loaded */ |
1694 | rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®); | 1696 | rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®); |
1695 | 1697 | ||
1696 | /* Apparently the data is read from end to start */ | 1698 | /* Apparently the data is read from end to start */ |
1697 | rt2800_register_read(rt2x00dev, EFUSE_DATA3, | 1699 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, |
1698 | (u32 *)&rt2x00dev->eeprom[i]); | 1700 | (u32 *)&rt2x00dev->eeprom[i]); |
1699 | rt2800_register_read(rt2x00dev, EFUSE_DATA2, | 1701 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, |
1700 | (u32 *)&rt2x00dev->eeprom[i + 2]); | 1702 | (u32 *)&rt2x00dev->eeprom[i + 2]); |
1701 | rt2800_register_read(rt2x00dev, EFUSE_DATA1, | 1703 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, |
1702 | (u32 *)&rt2x00dev->eeprom[i + 4]); | 1704 | (u32 *)&rt2x00dev->eeprom[i + 4]); |
1703 | rt2800_register_read(rt2x00dev, EFUSE_DATA0, | 1705 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0, |
1704 | (u32 *)&rt2x00dev->eeprom[i + 6]); | 1706 | (u32 *)&rt2x00dev->eeprom[i + 6]); |
1707 | |||
1708 | mutex_unlock(&rt2x00dev->csr_mutex); | ||
1705 | } | 1709 | } |
1706 | 1710 | ||
1707 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | 1711 | void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index 7c790118999b..535ce22f2ac8 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -23,6 +23,8 @@ | |||
23 | struct rt2800_ops { | 23 | struct rt2800_ops { |
24 | void (*register_read)(struct rt2x00_dev *rt2x00dev, | 24 | void (*register_read)(struct rt2x00_dev *rt2x00dev, |
25 | const unsigned int offset, u32 *value); | 25 | const unsigned int offset, u32 *value); |
26 | void (*register_read_lock)(struct rt2x00_dev *rt2x00dev, | ||
27 | const unsigned int offset, u32 *value); | ||
26 | void (*register_write)(struct rt2x00_dev *rt2x00dev, | 28 | void (*register_write)(struct rt2x00_dev *rt2x00dev, |
27 | const unsigned int offset, u32 value); | 29 | const unsigned int offset, u32 value); |
28 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, | 30 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, |
@@ -49,6 +51,15 @@ static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | |||
49 | rt2800ops->register_read(rt2x00dev, offset, value); | 51 | rt2800ops->register_read(rt2x00dev, offset, value); |
50 | } | 52 | } |
51 | 53 | ||
54 | static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev, | ||
55 | const unsigned int offset, | ||
56 | u32 *value) | ||
57 | { | ||
58 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
59 | |||
60 | rt2800ops->register_read_lock(rt2x00dev, offset, value); | ||
61 | } | ||
62 | |||
52 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | 63 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, |
53 | const unsigned int offset, | 64 | const unsigned int offset, |
54 | u32 value) | 65 | u32 value) |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index c7a596f2da39..87a5094ae953 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -1089,6 +1089,7 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1089 | 1089 | ||
1090 | static const struct rt2800_ops rt2800pci_rt2800_ops = { | 1090 | static const struct rt2800_ops rt2800pci_rt2800_ops = { |
1091 | .register_read = rt2x00pci_register_read, | 1091 | .register_read = rt2x00pci_register_read, |
1092 | .register_read_lock = rt2x00pci_register_read, /* same for PCI */ | ||
1092 | .register_write = rt2x00pci_register_write, | 1093 | .register_write = rt2x00pci_register_write, |
1093 | .register_write_lock = rt2x00pci_register_write, /* same for PCI */ | 1094 | .register_write_lock = rt2x00pci_register_write, /* same for PCI */ |
1094 | 1095 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index b57999ba8d93..b1d63935f44d 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -682,6 +682,7 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
682 | 682 | ||
683 | static const struct rt2800_ops rt2800usb_rt2800_ops = { | 683 | static const struct rt2800_ops rt2800usb_rt2800_ops = { |
684 | .register_read = rt2x00usb_register_read, | 684 | .register_read = rt2x00usb_register_read, |
685 | .register_read_lock = rt2x00usb_register_read_lock, | ||
685 | .register_write = rt2x00usb_register_write, | 686 | .register_write = rt2x00usb_register_write, |
686 | .register_write_lock = rt2x00usb_register_write_lock, | 687 | .register_write_lock = rt2x00usb_register_write_lock, |
687 | 688 | ||