]>
Commit | Line | Data |
---|---|---|
eb240234 GKH |
1 | From ce938231bd3b1d7af3cbd8836f084801090470e1 Mon Sep 17 00:00:00 2001 |
2 | From: "Daniel F. Dickinson" <cshored@thecshore.com> | |
3 | Date: Sat, 22 Dec 2018 01:09:13 -0500 | |
4 | Subject: ath9k: Avoid OF no-EEPROM quirks without qca,no-eeprom | |
5 | ||
6 | From: Daniel F. Dickinson <cshored@thecshore.com> | |
7 | ||
8 | commit ce938231bd3b1d7af3cbd8836f084801090470e1 upstream. | |
9 | ||
10 | ath9k_of_init() function[0] was initially written on the assumption that | |
11 | if someone had an explicit ath9k OF node that "there must be something | |
12 | wrong, why would someone add an OF node if everything is fine"[1] | |
13 | (Quoting Martin Blumenstingl <martin.blumenstingl@googlemail.com>) | |
14 | ||
15 | "it turns out it's not that simple. with your requirements I'm now aware | |
16 | of two use-cases where the current code in ath9k_of_init() doesn't work | |
17 | without modifications"[1] | |
18 | ||
19 | The "your requirements" Martin speaks of is the result of the fact that I | |
20 | have a device (PowerCloud Systems CR5000) has some kind of default - not | |
21 | unique mac address - set and requires to set the correct MAC address via | |
22 | mac-address devicetree property, however: | |
23 | ||
24 | "some cards come with a physical EEPROM chip [or OTP] so "qca,no-eeprom" | |
25 | should not be set (your use-case). in this case AH_USE_EEPROM should be | |
26 | set (which is the default when there is no OF node)"[1] | |
27 | ||
28 | The other use case is: | |
29 | ||
30 | the firmware on some PowerMac G5 seems to add a OF node for the ath9k | |
31 | card automatically. depending on the EEPROM on the card AH_NO_EEP_SWAP | |
32 | should be unset (which is the default when there is no OF node). see [3] | |
33 | ||
34 | After this patch to ath9k_of_init() the new behavior will be: | |
35 | ||
36 | if there's no OF node then everything is the same as before | |
37 | if there's an empty OF node then ath9k will use the hardware EEPROM | |
38 | (before ath9k would fail to initialize because no EEPROM data was | |
39 | provided by userspace) | |
40 | if there's an OF node with only a MAC address then ath9k will use | |
41 | the MAC address and the hardware EEPROM (see the case above) | |
42 | with "qca,no-eeprom" EEPROM data from userspace will be requested. | |
43 | the behavior here will not change | |
44 | [1] | |
45 | ||
46 | Martin provides additional background on EEPROM swapping[1]. | |
47 | ||
48 | Thanks to Christian Lamparter <chunkeey@gmail.com> for all his help on | |
49 | troubleshooting this issue and the basis for this patch. | |
50 | ||
51 | [0]https://elixir.bootlin.com/linux/v4.20-rc7/source/drivers/net/wireless/ath/ath9k/init.c#L615 | |
52 | [1]https://github.com/openwrt/openwrt/pull/1645#issuecomment-448027058 | |
53 | [2]https://github.com/openwrt/openwrt/pull/1613 | |
54 | [3]https://patchwork.kernel.org/patch/10241731/ | |
55 | ||
56 | Fixes: 138b41253d9c ("ath9k: parse the device configuration from an OF node") | |
57 | Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> | |
58 | Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> | |
59 | Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com> | |
60 | Signed-off-by: Kalle Valo <kvalo@codeaurora.org> | |
61 | Cc: Christian Lamparter <chunkeey@gmail.com> | |
62 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
63 | ||
64 | --- | |
65 | drivers/net/wireless/ath/ath9k/init.c | 6 +++--- | |
66 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
67 | ||
68 | --- a/drivers/net/wireless/ath/ath9k/init.c | |
69 | +++ b/drivers/net/wireless/ath/ath9k/init.c | |
70 | @@ -636,15 +636,15 @@ static int ath9k_of_init(struct ath_soft | |
71 | ret = ath9k_eeprom_request(sc, eeprom_name); | |
72 | if (ret) | |
73 | return ret; | |
74 | + | |
75 | + ah->ah_flags &= ~AH_USE_EEPROM; | |
76 | + ah->ah_flags |= AH_NO_EEP_SWAP; | |
77 | } | |
78 | ||
79 | mac = of_get_mac_address(np); | |
80 | if (mac) | |
81 | ether_addr_copy(common->macaddr, mac); | |
82 | ||
83 | - ah->ah_flags &= ~AH_USE_EEPROM; | |
84 | - ah->ah_flags |= AH_NO_EEP_SWAP; | |
85 | - | |
86 | return 0; | |
87 | } | |
88 |