diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2009-11-08 06:30:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-11 17:09:11 -0500 |
commit | a65986824d2552dd76786d5a0012989a64c45ab7 (patch) | |
tree | 4657fb048baf1c058e77cd19b09f0eaea4540d50 /drivers/net/wireless | |
parent | 748d451028ef037576b57517bc81e62f1fd92250 (diff) |
rt2x00: Add dynamic detection of eFuse EEPROM in rt2800pci.
Instead of assuming that all rt3090 devices will have an eFuse EEPROM,
do as the legacy Ralink driver, and detect at run-time whether an
eFuse EEPROM is present.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.h | 1 |
2 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index bff870799f64..2f284a6f384e 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -145,6 +145,15 @@ static void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | |||
145 | EEPROM_SIZE / sizeof(u16)); | 145 | EEPROM_SIZE / sizeof(u16)); |
146 | } | 146 | } |
147 | 147 | ||
148 | static int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
149 | { | ||
150 | u32 reg; | ||
151 | |||
152 | rt2800_register_read(rt2x00dev, EFUSE_CTRL, ®); | ||
153 | |||
154 | return rt2x00_get_field32(reg, EFUSE_CTRL_PRESENT); | ||
155 | } | ||
156 | |||
148 | static void rt2800pci_efuse_read(struct rt2x00_dev *rt2x00dev, | 157 | static void rt2800pci_efuse_read(struct rt2x00_dev *rt2x00dev, |
149 | unsigned int i) | 158 | unsigned int i) |
150 | { | 159 | { |
@@ -182,6 +191,11 @@ static inline void rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | |||
182 | { | 191 | { |
183 | } | 192 | } |
184 | 193 | ||
194 | static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
195 | { | ||
196 | return 0; | ||
197 | } | ||
198 | |||
185 | static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | 199 | static inline void rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) |
186 | { | 200 | { |
187 | } | 201 | } |
@@ -1091,11 +1105,11 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1091 | case RT3052: | 1105 | case RT3052: |
1092 | rt2800pci_read_eeprom_soc(rt2x00dev); | 1106 | rt2800pci_read_eeprom_soc(rt2x00dev); |
1093 | break; | 1107 | break; |
1094 | case RT3090: | ||
1095 | rt2800pci_read_eeprom_efuse(rt2x00dev); | ||
1096 | break; | ||
1097 | default: | 1108 | default: |
1098 | rt2800pci_read_eeprom_pci(rt2x00dev); | 1109 | if (rt2800pci_efuse_detect(rt2x00dev)) |
1110 | rt2800pci_read_eeprom_efuse(rt2x00dev); | ||
1111 | else | ||
1112 | rt2800pci_read_eeprom_pci(rt2x00dev); | ||
1099 | break; | 1113 | break; |
1100 | } | 1114 | } |
1101 | 1115 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h index 1dbf13270cda..8f944ee8a970 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ b/drivers/net/wireless/rt2x00/rt2800pci.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000) | 62 | #define EFUSE_CTRL_ADDRESS_IN FIELD32(0x03fe0000) |
63 | #define EFUSE_CTRL_MODE FIELD32(0x000000c0) | 63 | #define EFUSE_CTRL_MODE FIELD32(0x000000c0) |
64 | #define EFUSE_CTRL_KICK FIELD32(0x40000000) | 64 | #define EFUSE_CTRL_KICK FIELD32(0x40000000) |
65 | #define EFUSE_CTRL_PRESENT FIELD32(0x80000000) | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * EFUSE_DATA0 | 68 | * EFUSE_DATA0 |