Re: [PATCH] ath9k: introduce endian_check module parameter

2018-04-10 Thread Bas Vermeulen

On 14-03-18 15:34, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
+static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness compatibility");
#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
  int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
ether_addr_copy(common->macaddr, mac);
ah->ah_flags &= ~AH_USE_EEPROM;
-   ah->ah_flags |= AH_NO_EEP_SWAP;
+   if (!ath9k_endian_check)
+   ah->ah_flags |= AH_NO_EEP_SWAP;

A bit annoying to have a module parameter, isn't there any automatic way
to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?

There is an automatic way to detect this, but that is disabled by the
AH_NO_EEP_SWAP flag.

Ah, I didn't check the code at all.


The platform initialisation does not set this flag if the endian_check
member of pdata is set to true, but there is no way to not set this
when using a device tree. I used a module parameter instead of a
device tree variable because I don't know of a way to modify the
device tree my PowerMac boots with.

Ok, makes sense. A module parameter is not an ideal solution I guess
it's ok in this case.


Kalle: Are there any changes you want me to make in order to get this
accepted? I didn't see anything for me to resolve, but I may have
missed something.

I can submit a patch to not set the AH_NO_EEP_SWAP flag by default if
you prefer, as that would fix my problem as well. I am just not sure
that doesn't break things for some platform/device I don't have.

I'm not really sure what to do. Basically this is a choise between bad
for user experience (the module parameter) or risk of regressions
(disable AH_NO_EEP_SWAP by default). As ath9k is used in very exotic
hardware I'm starting to lean towards the module parameter approach
(your patch) but would like to know what others think, especially Felix
(CCed).

Full patch here:

https://patchwork.kernel.org/patch/10241731/


Just another ping. As I understood things, all OpenWRT dts' use 
qca,no-eeprom, and perhaps we could

move ~AH_USE_EEPROM and |= AH_NO_EEP_SWAP in that if block.

This would solve my problem, as I need to have AH_NO_EEP_SWAP removed 
from flags for my card (which is a

little endian eeprom/card used on a big endian machine).

Would you like me to prepare a patch for this? Is there anyone who can 
test this on the various OpenWRT
boards/soc and or other configurations? I don't want to break things for 
other people.


Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-03-14 Thread Bas Vermeulen

On 26-02-18 15:52, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


On 26-02-18 10:54, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
   drivers/net/wireless/ath/ath9k/init.c | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
   +static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness compatibility");
   #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
ether_addr_copy(common->macaddr, mac);
ah->ah_flags &= ~AH_USE_EEPROM;
-   ah->ah_flags |= AH_NO_EEP_SWAP;
+   if (!ath9k_endian_check)
+   ah->ah_flags |= AH_NO_EEP_SWAP;

A bit annoying to have a module parameter, isn't there any automatic way
to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?

There is an automatic way to detect this, but that is disabled by the
AH_NO_EEP_SWAP flag.

Ah, I didn't check the code at all.


The platform initialisation does not set this flag if the endian_check
member of pdata is set to true, but there is no way to not set this
when using a device tree. I used a module parameter instead of a
device tree variable because I don't know of a way to modify the
device tree my PowerMac boots with.

Ok, makes sense. A module parameter is not an ideal solution I guess
it's ok in this case.
Kalle: Are there any changes you want me to make in order to get this 
accepted?

I didn't see anything for me to resolve, but I may have missed something.

I can submit a patch to not set the AH_NO_EEP_SWAP flag by default if 
you prefer, as that
would fix my problem as well. I am just not sure that doesn't break 
things for some

platform/device I don't have.

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()

2018-03-01 Thread Bas Vermeulen

Nevermind. round_up instead of DIV_ROUND_UP.

Bas Vermeulen


On 01-03-18 11:22, Bas Vermeulen wrote:



On 28-02-18 15:26, Lorenzo Bianconi wrote:

Fix the following sparse warning in mt7601u_efuse_physical_size_check:
- drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
   Variable length array is used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianc...@redhat.com>
---
  drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c 
b/drivers/net/wireless/mediatek/mt7601u/eeprom.c

index da6faea092d6..a462064b5c91 100644
--- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
@@ -74,7 +74,7 @@ static int
  mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
  {
  const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
-    u8 data[map_reads * 16];
+    u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
Shouldn't this be u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE,16)*16]; to 
get the

same array size as before?

Bas Vermeulen




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] mt7601u: remove a warning in mt7601u_efuse_physical_size_check()

2018-03-01 Thread Bas Vermeulen



On 28-02-18 15:26, Lorenzo Bianconi wrote:

Fix the following sparse warning in mt7601u_efuse_physical_size_check:
- drivers/net/wireless/mediatek/mt7601u/eeprom.c:77:27: warning:
   Variable length array is used

Signed-off-by: Lorenzo Bianconi <lorenzo.bianc...@redhat.com>
---
  drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/eeprom.c 
b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
index da6faea092d6..a462064b5c91 100644
--- a/drivers/net/wireless/mediatek/mt7601u/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt7601u/eeprom.c
@@ -74,7 +74,7 @@ static int
  mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev)
  {
const int map_reads = DIV_ROUND_UP(MT_EFUSE_USAGE_MAP_SIZE, 16);
-   u8 data[map_reads * 16];
+   u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE, 16)];
Shouldn't this be u8 data[round_up(MT_EFUSE_USAGE_MAP_SIZE,16)*16]; to 
get the

same array size as before?

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen

On 26-2-2018 18:42, Dan Williams wrote:

On Mon, 2018-02-26 at 17:44 +0100, Bas Vermeulen wrote:

On 26-02-18 17:32, Larry Finger wrote:

On 02/26/2018 04:07 AM, Bas Vermeulen wrote:

On 26-02-18 10:54, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on
my
PowerMac G5 without allowing the driver to byte-swap the
eeprom.

Introduce a module parameter endian_check to allow this to
happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
   drivers/net/wireless/ath/ath9k/init.c | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c
b/drivers/net/wireless/ath/ath9k/init.c
index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
+static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int,
0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness
compatibility");
   #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
   int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc
*sc)
   ether_addr_copy(common->macaddr, mac);
   ah->ah_flags &= ~AH_USE_EEPROM;
-ah->ah_flags |= AH_NO_EEP_SWAP;
+if (!ath9k_endian_check)
+ah->ah_flags |= AH_NO_EEP_SWAP;

A bit annoying to have a module parameter, isn't there any
automatic
way
to detect/try this? But on the other hand I guess this isn't a
common
problem as nobody has reported this before?

There is an automatic way to detect this, but that is disabled by
the
AH_NO_EEP_SWAP flag.
The platform initialisation does not set this flag if the
endian_check member of pdata is set
to true, but there is no way to not set this when using a device
tree. I used a module
parameter instead of a device tree variable because I don't know
of a
way to modify the
device tree my PowerMac boots with.

Shouldn't you be able to set ath9k_endian_check inside #ifdef
__BIG_ENDIAN ... #endif in the initialization? I think that would
achieve the same functionality without requiring the user to set a
module parameter.

I could have done that, but didn't want to change the default
behaviour.
This patch keeps the
current behaviour on all platforms if the module parameter is not
set. I
don't have the means
to test mips and other platforms this could be used on. I don't mind
having to set a module
parameter, I mind not being able to change the behaviour

Still, module parameters are an awful user experience because you need
to know that they exist, what they do, and whether you need it or not.
It doesn't just work.

Is there no way to autodetect the endian-ness of the firmware itself,
and if the known machine endian-ness isn't the same then swap?  This
seems like a solvable problem.


The problem is already solved, but the solution is disabled by the 
AH_NO_EEP_SWAP
flag set in both initialization functions. See ath9k/init.c and 
ath9k/eeprom.c.
My patch just disables the flag when a module parameter is set, which 
enables the solution.


I can disable the flag without a problem, but that might have unintended 
side effects
on some platforms. If the consensus is that's the better solution I can 
prepare a patch,

but that would have to come from someone more knowledgeable than me.

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen

On 26-02-18 17:32, Larry Finger wrote:

On 02/26/2018 04:07 AM, Bas Vermeulen wrote:

On 26-02-18 10:54, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
  drivers/net/wireless/ath/ath9k/init.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c

index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
  module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
  MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
+static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness 
compatibility");

  #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
  int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
  ether_addr_copy(common->macaddr, mac);
  ah->ah_flags &= ~AH_USE_EEPROM;
-    ah->ah_flags |= AH_NO_EEP_SWAP;
+    if (!ath9k_endian_check)
+    ah->ah_flags |= AH_NO_EEP_SWAP;
A bit annoying to have a module parameter, isn't there any automatic 
way

to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?
There is an automatic way to detect this, but that is disabled by the 
AH_NO_EEP_SWAP flag.
The platform initialisation does not set this flag if the 
endian_check member of pdata is set
to true, but there is no way to not set this when using a device 
tree. I used a module
parameter instead of a device tree variable because I don't know of a 
way to modify the

device tree my PowerMac boots with.


Shouldn't you be able to set ath9k_endian_check inside #ifdef 
__BIG_ENDIAN ... #endif in the initialization? I think that would 
achieve the same functionality without requiring the user to set a 
module parameter.


I could have done that, but didn't want to change the default behaviour. 
This patch keeps the
current behaviour on all platforms if the module parameter is not set. I 
don't have the means
to test mips and other platforms this could be used on. I don't mind 
having to set a module

parameter, I mind not being able to change the behaviour.

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen

On 26-02-18 12:30, Sebastian Gottschall wrote:

Am 26.02.2018 um 11:07 schrieb Bas Vermeulen:

On 26-02-18 10:54, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
  drivers/net/wireless/ath/ath9k/init.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c

index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
  module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
  MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
  +static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness 
compatibility");

  #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
    int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
  ether_addr_copy(common->macaddr, mac);
    ah->ah_flags &= ~AH_USE_EEPROM;
-    ah->ah_flags |= AH_NO_EEP_SWAP;
+    if (!ath9k_endian_check)
+    ah->ah_flags |= AH_NO_EEP_SWAP;
A bit annoying to have a module parameter, isn't there any automatic 
way

to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?
There is an automatic way to detect this, but that is disabled by the 
AH_NO_EEP_SWAP flag.
The platform initialisation does not set this flag if the 
endian_check member of pdata is set
to true, but there is no way to not set this when using a device 
tree. I used a module
parameter instead of a device tree variable because I don't know of a 
way to modify the

device tree my PowerMac boots with.
have you tried to compile it without device tree support? since its 
just a pcie card, i dont think that devicetree is required here

it should run fine without it.


The driver will still set AH_NO_EEP_SWAP regardless, and will still not 
swap the eeprom from
little endian to big endian on big endian machines. See 
drivers/net/wireless/ath/ath9k/eeprom.c:188

and drivers/net/wireless/ath/ath9k/init.c (lines 593 and 645).

The reason I'm talking about device trees here is because I could have 
used a device tree parameter

instead of a module parameter.

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen

On 26-02-18 12:28, Sebastian Gottschall wrote:

Am 26.02.2018 um 10:54 schrieb Kalle Valo:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
  drivers/net/wireless/ath/ath9k/init.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c

index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
  module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
  MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
  +static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness 
compatibility");

  #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
    int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
  ether_addr_copy(common->macaddr, mac);
    ah->ah_flags &= ~AH_USE_EEPROM;
-    ah->ah_flags |= AH_NO_EEP_SWAP;
+    if (!ath9k_endian_check)
+    ah->ah_flags |= AH_NO_EEP_SWAP;

A bit annoying to have a module parameter, isn't there any automatic way
to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?

There is a way by simply checking the eeprom magic on this chipset


I am well aware.

The AH_NO_EEP_SWAP flag disables fixing the eeprom by swapping the data 
read from eeprom.

AH_NO_EEP_SWAP is enabled by default in ath9k_of_init() without this patch.
I am happy if the AH_NO_EEP_SWAP flag is not set, that would fix my 
problem, but changes the
current behaviour. I wanted to keep the current behaviour by default, 
and give me and others a
way to make it work on big endian machines with cards with little endian 
eeproms.


Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: [PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen

On 26-02-18 10:54, Kalle Valo wrote:

Bas Vermeulen <bverm...@blackstar.nl> writes:


A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
  drivers/net/wireless/ath/ath9k/init.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
  module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
  MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
  
+static int ath9k_endian_check;

+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness compatibility");
  #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
  
  int ath9k_use_chanctx;

@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
ether_addr_copy(common->macaddr, mac);
  
  	ah->ah_flags &= ~AH_USE_EEPROM;

-   ah->ah_flags |= AH_NO_EEP_SWAP;
+   if (!ath9k_endian_check)
+   ah->ah_flags |= AH_NO_EEP_SWAP;

A bit annoying to have a module parameter, isn't there any automatic way
to detect/try this? But on the other hand I guess this isn't a common
problem as nobody has reported this before?
There is an automatic way to detect this, but that is disabled by the 
AH_NO_EEP_SWAP flag.
The platform initialisation does not set this flag if the endian_check 
member of pdata is set
to true, but there is no way to not set this when using a device tree. I 
used a module
parameter instead of a device tree variable because I don't know of a 
way to modify the

device tree my PowerMac boots with.

Bas Vermeulen

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



[PATCH] ath9k: introduce endian_check module parameter

2018-02-26 Thread Bas Vermeulen
A random (little endian eeprom'd) ar9278 card didn't work on my
PowerMac G5 without allowing the driver to byte-swap the eeprom.

Introduce a module parameter endian_check to allow this to happen,
and the PCIe card to function correctly on BE powerpc.

Signed-off-by: Bas Vermeulen <bverm...@blackstar.nl>
---
 drivers/net/wireless/ath/ath9k/init.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index fa58a32227f5..421039dc060a 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -67,6 +67,9 @@ static int ath9k_ps_enable;
 module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
 MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
 
+static int ath9k_endian_check;
+module_param_named(endian_check, ath9k_endian_check, int, 0444);
+MODULE_PARM_DESC(endian_check, "Check EEPROM for endianness compatibility");
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 
 int ath9k_use_chanctx;
@@ -587,7 +590,8 @@ static int ath9k_of_init(struct ath_softc *sc)
ether_addr_copy(common->macaddr, mac);
 
ah->ah_flags &= ~AH_USE_EEPROM;
-   ah->ah_flags |= AH_NO_EEP_SWAP;
+   if (!ath9k_endian_check)
+   ah->ah_flags |= AH_NO_EEP_SWAP;
 
return 0;
 }
-- 
2.16.2


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



ath9k: AR9287 device with little endian eeprom doesn't work on powerpc

2018-02-22 Thread Bas Vermeulen

Hi all,

I have slotted a 300 Mbps Wireless N PCI Express Adapter into my 
PowerMac G5, and it failed

to initialize the driver with an error complaining about the EEPROM.

I disabled the line reading ah->ah_flags |= AH_NO_EEP_SWAP; in 
ath9k_of_init(), and this made my card show up and start working correctly.


Is there a better way of doing this? If not, what would be the best way 
to allow byte-swapping the eeprom on big endian machines?


Bas Vermeulen


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.