Re: [PATCH 18/30] brcmfmac: Cleanup offsetof()

2017-08-31 Thread Ian Molton
On 30/08/17 20:37, Arend van Spriel wrote: > On 22-08-17 13:25, Ian Molton wrote: >> +#define __sd_reg(field) \ >> +(offsetof(struct sdpcmd_regs, field)) > > I really dislike __foo() stuff. Please just stick with uppercase for > macros, so SD_REG(). I am fine wit

Re: [PATCH 13/30] brcmfmac: Clarify if using braces.

2017-08-31 Thread Ian Molton
On 30/08/17 20:11, Arend van Spriel wrote: >> Whilst this if () statement is technically correct, it lacks clarity. > > I don't see the unclarity here. In my opinion people reading the code > should have a good level in C language and a decent level of curiosity > when they come across a function/

Re: [PATCH 03/30] brcmfmac: Split brcmf_sdiod_regrw_helper() up.

2017-08-31 Thread Ian Molton
On 30/08/17 19:59, Arend van Spriel wrote: >> +static int brcmf_sdiod_reg_write(struct brcmf_sdio_dev *sdiodev, u32 >> addr, >> + u8 regsz, void *data) > > Thought I mentioned this before, but the indentation should be aligned > to opening bracket. I checked this locally, and its

Re: [PATCH 01/30] brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()

2017-08-31 Thread Ian Molton
On 30/08/17 19:51, Arend van Spriel wrote: > On 22-08-17 13:25, Ian Molton wrote: >> All the other IO functions are the other way round in this >> driver. Make this one match. > > Sorry for being a nit, but not sure why the commit message starts with a > tab. Not

Re: [PATCH 17/30] brcmfamc: remove unnecessary call to brcmf_sdiod_set_backplane_window()

2017-08-23 Thread Ian Molton
On 23/08/17 13:36, Julian Calaby wrote: > Hi Ian, > > On Wed, Aug 23, 2017 at 10:27 PM, Ian Molton wrote: >> On 23/08/17 11:09, Julian Calaby wrote: >>> I don't think I explained my point well. >>> >>> The description of this patch implies that thi

Re: [PATCH 17/30] brcmfamc: remove unnecessary call to brcmf_sdiod_set_backplane_window()

2017-08-23 Thread Ian Molton
On 23/08/17 11:09, Julian Calaby wrote: > I don't think I explained my point well. > > The description of this patch implies that this method > brcmf_sdiod_ramrw(), now relies on the window being set elsewhere > before it's called. I don't think it does. > I'm asking why we can't move the settin

Re: [PATCH 17/30] brcmfamc: remove unnecessary call to brcmf_sdiod_set_backplane_window()

2017-08-22 Thread Ian Molton
On 22/08/17 20:44, Arend van Spriel wrote: > By the way, the driver prefix in the subject is wrong, ie. brcmfamc > should be brcmfmac. I think it already was wrong in the previous series, > but I forgot to mention it. Drat. well spotted :) -Ian

Re: [PATCH v5] brcmfmac cleanup

2017-08-22 Thread Ian Molton
On 22/08/17 20:41, Arend van Spriel wrote: > On 22-08-17 13:25, Ian Molton wrote: >> Hi folks, >> >> Arend, as requested - a respin to take account of your comments. >> >> Unfortunately, although I've only included the patches you requested >> from v4,

[PATCH 29/30] brcmfmac: Remove array of functions

2017-08-22 Thread Ian Molton
Replace the array of functions with a pair of pointers to the relevant functions. Signed-off-by: Ian Molton Acked-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 115 +++--- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 170

[PATCH 15/30] brcmfmac: Tidy register definitions a little

2017-08-22 Thread Ian Molton
Trivial tidy of register definitions. Signed-off-by: Ian Molton --- .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 ++-- .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 19 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net

[PATCH 27/30] brcmfmac: Replace function index with function pointer

2017-08-22 Thread Ian Molton
In preparation for removing the function array, remove all code that refers to function by index and replace with pointers to the function itself. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

[PATCH 10/30] brcmfmac: Rename bcmerror to err

2017-08-22 Thread Ian Molton
Trivial cleanup of nasty variable name Signed-off-by: Ian Molton Acked-by: Arend van Spriel --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c

[PATCH 30/30] brcmfmac: Reduce the noise from repeatedly dereferencing common pointers

2017-08-22 Thread Ian Molton
a few inconsistently named pointers whilst we are at it ie. sdiod -> sdiodev Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 140 +++ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 406 +++-- 2 files cha

[PATCH 22/30] brcmfmac: Rename buscore->core for consistency

2017-08-22 Thread Ian Molton
Avoid confusion with unrelated _buscore labels. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless

[PATCH 26/30] brcmfmac: More efficient and slightly easier to read fixup for 4339 chips

2017-08-22 Thread Ian Molton
Its more efficient to test the register we're interested in first, potentially avoiding two more comparisons, and therefore always avoiding one comparison per call on all other chips. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 9 ++--- 1

[PATCH 19/30] brcmfmac: Remove unused macro.

2017-08-22 Thread Ian Molton
This macro is used exactly nowhere in the code. Delete it. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom

[PATCH 13/30] brcmfmac: Clarify if using braces.

2017-08-22 Thread Ian Molton
Whilst this if () statement is technically correct, it lacks clarity. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b

[PATCH 14/30] brcmfmac: Rename / replace old IO functions with simpler ones.

2017-08-22 Thread Ian Molton
code. We also convert those that map directly to sdio_{read,write}*() to macros. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 166 +++ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 182

[PATCH 28/30] brcmfmac: Clean up interrupt macros

2017-08-22 Thread Ian Molton
Make it more obvious that this code acually enables interrupts, and provide nice definitions for the bits in the register. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 ++- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 8 +--- 2

[PATCH 12/30] brcmfmac: Whitespace fixes.

2017-08-22 Thread Ian Molton
Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 916f75e5e7a1

[PATCH 23/30] brcmfmac: stabilise the value of ->sbwad in use for some xfer routines.

2017-08-22 Thread Ian Molton
The IO functions operate within the Chipcommon IO window. Explicitly set this, rather than relying on the last initialisation IO access to leave it set to the right value by chance. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 drivers/net

[PATCH 25/30] brcmfmac: Remove func0 from function array

2017-08-22 Thread Ian Molton
Linux doesnt pass you func0 as a function when probing - instead providing specific access functions to read/write it. This prepares for a patch to remove the actual array entry itself. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

[PATCH 21/30] brcmfmac: Remove {r,w}_sdreg32

2017-08-22 Thread Ian Molton
Remove yet another IO function from the code and replace with one that already exists. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 91 +++--- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/drivers/net/wireless/broadcom

[PATCH 18/30] brcmfmac: Cleanup offsetof()

2017-08-22 Thread Ian Molton
Create a macro to make the code a bit more readable, whilst we're stuck with using struct element offsets as register offsets. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 35 +- 1 file changed, 14 insertions(+), 21 deletions(-)

[PATCH 20/30] brcmfmac: Remove repeated calls to brcmf_chip_get_core()

2017-08-22 Thread Ian Molton
will allow for easier refcounting in future. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 25 +- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net

[PATCH 11/30] brcmfmac: Split brcmf_sdiod_buffrw function up.

2017-08-22 Thread Ian Molton
This function needs to be split up into separate read / write variants for clarity. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 67 +++--- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a

[PATCH 17/30] brcmfamc: remove unnecessary call to brcmf_sdiod_set_backplane_window()

2017-08-22 Thread Ian Molton
All functions that might require the window address changing call brcmf_sdiod_set_backplane_window() prior to access. Thus resetting the window is not required. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 - 1 file changed, 5 deletions

[PATCH 16/30] brcmfmac: Remove brcmf_sdiod_addrprep()

2017-08-22 Thread Ian Molton
This function has become trivial enough that it may as well be pushed into its callers, which has the side-benefit of clarifying what's going on. Remove it, and rename brcmf_sdiod_set_sbaddr_window() to brcmf_sdiod_set_backplane_window() as it's easier to understand. Signed-off-by:

[PATCH 24/30] brcmfmac: Correctly handle accesses to SDIO func0

2017-08-22 Thread Ian Molton
Rather than workaround the restrictions on func0 addressing in the driver, set MMC_QUIRK_LENIENT_FN0 Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 ++-- 2 files changed, 6

[PATCH 04/30] brcmfmac: Clean up brcmf_sdiod_set_sbaddr_window()

2017-08-22 Thread Ian Molton
This function sets the address of the IO window used for SDIO accesses onto the backplane of the chip. It currently uses 3 separate masks despite the full mask being defined in the code already. Remove the separate masks and clean up. Signed-off-by: Ian Molton Reviewed-by: Arend van

[PATCH 06/30] brcmfmac: Remove bandaid for SleepCSR

2017-08-22 Thread Ian Molton
Register access code is not the place for band-aid fixes like this. If this is a genuine problem, it should be fixed further up in the driver stack. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 28 +- 1

[PATCH 07/30] brcmfmac: Remove brcmf_sdiod_request_data()

2017-08-22 Thread Ian Molton
This function is obfuscating how IO works on this chip. Remove it and push its logic into brcmf_sdiod_reg_{read,write}(). Handling of -ENOMEDIUM is altered, but as that's pretty much broken anyway we can ignore that. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wir

[PATCH 09/30] brcmfmac: Remove noisy debugging.

2017-08-22 Thread Ian Molton
If you need debugging this low level, you're doing something wrong. Remove these noisy debug statements so the code is more readable. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/driver

[PATCH 08/30] brcmfmac: Fix asymmetric IO functions.

2017-08-22 Thread Ian Molton
Unlikely to be a problem, but brcmf_sdiod_regrb() is not symmetric with brcmf_sdiod_regrl(). Fix. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH 05/30] brcmfmac: Remove dead IO code

2017-08-22 Thread Ian Molton
The value passed to brcmf_sdiod_addrprep() is *always* 4 remove this parameter and the unused code to handle it. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 18 -- 1 file changed, 8 insertions

[PATCH 03/30] brcmfmac: Split brcmf_sdiod_regrw_helper() up.

2017-08-22 Thread Ian Molton
This large function is concealing a LOT of obscure logic about how the hardware functions. Time to split it up. This first patch splits the function into two pieces - read and write, doing away with the rw flag in the process. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel

[PATCH v5] brcmfmac cleanup

2017-08-22 Thread Ian Molton
Hi folks, Arend, as requested - a respin to take account of your comments. Unfortunately, although I've only included the patches you requested from v4, breaking out some of the simpler changes (whitespace, macos, etc.) has grown the set back up to 30 patches. I hope this is OK. I've tried to in

[PATCH 01/30] brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()

2017-08-22 Thread Ian Molton
All the other IO functions are the other way round in this driver. Make this one match. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom

[PATCH 02/30] brcmfmac: Register sizes on hardware are not dependent on compiler types

2017-08-22 Thread Ian Molton
The 4 IO functions in this patch are incorrect as they use compiler types to determine how many bytes to send to the hardware. Signed-off-by: Ian Molton Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 22 +++--- 1 file changed, 11

Re: [PATCH 12/34] brcmfmac: Replace old IO functions with simpler ones.

2017-08-19 Thread Ian Molton
On 07/08/17 18:55, Ian Molton wrote: > On 07/08/17 12:26, Arend van Spriel wrote: >> On 7/26/2017 10:25 PM, Ian Molton wrote: >>> Primarily this patch removes: >>> >>> brcmf_sdiod_f0_writeb() >>> brcmf_sdiod_reg_write() >>> brcmf_sdiod_reg_

Re: [PATCH 11/34] brcmfmac: Split brcmf_sdiod_buffrw function up.

2017-08-19 Thread Ian Molton
On 07/08/17 12:26, Arend van Spriel wrote: >> +err = brcmf_sdiod_buff_write(sdiodev, SDIO_FUNC_2, addr, mypkt); >> >> brcmu_pkt_buf_free_skb(mypkt); >> + > > You are keen on sprinkling whitespace here and there. Could you please > use separate patches for that as much as possible. N

Re: [PATCH 08/34] brcmfmac: Fix uninitialised variable

2017-08-19 Thread Ian Molton
On 07/08/17 12:26, Arend van Spriel wrote: > On 7/26/2017 10:25 PM, Ian Molton wrote: >> Unlikely to be a problem, but brcmf_sdiod_regrb() is >> not symmetric with brcmf_sdiod_regrl() in this regard. > > You are pretty keen on symmetry, but you could also remove th

Re: [PATCH 06/34] brcmfmac: Remove bandaid for SleepCSR

2017-08-19 Thread Ian Molton
On 07/08/17 12:25, Arend van Spriel wrote: > On 26-07-17 22:25, Ian Molton wrote: >> Register access code is not the place for band-aid fixes like this. >> If this is a genuine problem, it should be fixed further up in the driver >> stack. > > So lets make it a SDIO deb

Re: [PATCH 34/34] brcmfmac: Reduce the noise from repeatedly dereferencing common pointers

2017-08-19 Thread Ian Molton
On 08/08/17 13:29, Arend van Spriel wrote: >> int brcmf_sdio_sleep(struct brcmf_sdio *bus, bool sleep) >> { >> +struct brcmf_sdio_dev *sdiodev = bus->sdiodev; >> +struct sdio_func *func1 = sdiodev->func1; > > Actually only wanted to explicitly mention this one. Probably the > compiler is

Re: [PATCH 31/34] brcmfmac: Remove func0 from function array

2017-08-19 Thread Ian Molton
On 08/08/17 12:19, Arend van Spriel wrote: >> -sdio_f0_readb((sdiodev)->func[0], (addr), (r)) >> +sdio_f0_readb((sdiodev)->func[1], (addr), (r)) > > There is no reason to keep these any longer as these do not provide any > functionality over the core sdio function unless you consider the >

Re: [PATCH 29/34] brcmfmac: stabilise the value of ->sbwad in use for some xfer routines.

2017-08-19 Thread Ian Molton
On 07/08/17 13:32, Arend van Spriel wrote: > > We actually just need the chipcommon base address so why not have that > here, ie.: > +u32 cc_base; I see no advantage to that - the u32 is the same size as (or not much bigger than the pointer to the struct brcmf_core, and my approach makes it c

Re: [PATCH 14/34] brcmfmac: Remove brcmf_sdiod_addrprep()

2017-08-19 Thread Ian Molton
On 07/08/17 12:27, Arend van Spriel wrote: > On 7/26/2017 10:25 PM, Ian Molton wrote: >> This function has become trivial enough that it may as well be pushed >> into >> its callers, which has the side-benefit of clarifying what's going on. >> >> Remove it, an

Re: [PATCH 09/34] brcmfmac: Remove noisy debugging.

2017-08-19 Thread Ian Molton
On 07/08/17 12:26, Arend van Spriel wrote: > > Needing this debugging does not necessarily means you are doing > something wrong. You may be dealing with hardware that is doing > something wrong and when that happens this debug can be useful. I > frankly hardly ever enable SDIO debug level unless

Re: [PATCH 07/34] brcmfmac: Remove brcmf_sdiod_request_data()

2017-08-19 Thread Ian Molton
On 07/08/17 18:51, Ian Molton wrote: > On 07/08/17 12:25, Arend van Spriel wrote: >>> Handling of -ENOMEDIUM is altered, but as that's pretty much broken >>> anyway >>> we can ignore that. >> >> Please explain why you think it is broken. > >

Re: [PATCH 01/34] brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()

2017-08-19 Thread Ian Molton
On 07/08/17 12:25, Arend van Spriel wrote: >> All the other IO functions are the other way round in this >> driver. Make this one match. > > Core SDIO functions are indeed the other way around, but the IO > functions in this file use (addr, data) pattern. So should we aim to get > it all consi

Re: [PATCH 31/34] brcmfmac: Remove func0 from function array

2017-08-08 Thread Ian Molton
On 08/08/17 12:19, Arend van Spriel wrote: >> #define brcmf_sdiod_func0_rb(sdiodev, addr, r) \ >> -sdio_f0_readb((sdiodev)->func[0], (addr), (r)) >> +sdio_f0_readb((sdiodev)->func[1], (addr), (r)) > > There is no reason to keep these any longer as these do not provide any > functionality

Re: [PATCH 12/34] brcmfmac: Replace old IO functions with simpler ones.

2017-08-07 Thread Ian Molton
On 07/08/17 12:26, Arend van Spriel wrote: > On 7/26/2017 10:25 PM, Ian Molton wrote: >> Primarily this patch removes: >> >> brcmf_sdiod_f0_writeb() >> brcmf_sdiod_reg_write() >> brcmf_sdiod_reg_read() > > Having [patch 30/34] "brcmfmac: Correctly

Re: [PATCH 07/34] brcmfmac: Remove brcmf_sdiod_request_data()

2017-08-07 Thread Ian Molton
On 07/08/17 12:25, Arend van Spriel wrote: >> Handling of -ENOMEDIUM is altered, but as that's pretty much broken >> anyway >> we can ignore that. > > Please explain why you think it is broken. Not got the code to hand right now, but from memory, theres a trapdoor case where the state can wind up

Re: [PATCH 03/34] brcmfmac: Split brcmf_sdiod_regrw_helper() up.

2017-08-07 Thread Ian Molton
On 07/08/17 12:25, Arend van Spriel wrote: > On 26-07-17 22:25, Ian Molton wrote: >> This large function is concealing a LOT of obscure logic about >> how the hardware functions. Time to split it up. >> >> This first patch splits the function into two pieces - re

Re: Patch v4: Clean up brcmfmac driver

2017-07-27 Thread Ian Molton
On 27/07/17 11:09, Arend van Spriel wrote: >> >> Hi Arend, >> >> Noted for future series. I take it I shouldn't re-spin if you're going >> through them already? > > My "guess" is a v5 is likely ;-) No prob. I've spotted a gem in it myself (FIXME comment that crept through). I'll split it into two

Re: Patch v4: Clean up brcmfmac driver

2017-07-27 Thread Ian Molton
On 27/07/17 10:52, Arend van Spriel wrote: >> >> How many patches would you like at once? > > Hi Ian, > > ~10-15 patches should be fine although I am simply ploughing through the > lot right now. Hi Arend, Noted for future series. I take it I shouldn't re-spin if you're going through them alrea

Re: Patch v4: Clean up brcmfmac driver

2017-07-27 Thread Ian Molton
On 27/07/17 07:17, Kalle Valo wrote: >> Here's a v4 of the cleanup patchset - checkpatch clean(er - I have purposely >> left some warnings unaddressed). >> >> I also dropped an accidental adjustment of a debug macro from v3. > Like I said already last time, please split the patchset into reasonable

[PATCH 13/34] brcmfmac: Tidy register definitions a little

2017-07-26 Thread Ian Molton
Trivial tidy of register definitions. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h b/drivers/net/wireless/broadcom

[PATCH 31/34] brcmfmac: Remove func0 from function array

2017-07-26 Thread Ian Molton
Linux doesnt pass you func0 as a function when probing - instead providing specific access functions to read/write it. This prepares for a patch to remove the actual array entry itself. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 + drivers

[PATCH 24/34] brcmfmac: Rename chip.ctx -> chip.bus_priv

2017-07-26 Thread Ian Molton
This driver uses the label ctx like its going out of fashion. Lets rename this usage of it so that its easier to see whats going on. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/chip.c| 24 +++--- .../wireless/broadcom/brcm80211/brcmfmac/chip.h

[PATCH 12/34] brcmfmac: Replace old IO functions with simpler ones.

2017-07-26 Thread Ian Molton
code. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 166 +++ .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 182 ++--- .../wireless/broadcom/brcm80211/brcmfmac/sdio.h| 28 +++- 3 files changed, 132 insertions(+), 244

[PATCH 10/34] brcmfmac: Rename bcmerror to err

2017-07-26 Thread Ian Molton
Trivial cleanup of nasty variable name Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless

[PATCH 22/34] brcmfmac: Rename axi functions for clarity.

2017-07-26 Thread Ian Molton
These functions are poorly named. for the sake of one character, correct this. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211

[PATCH 25/34] brcmfmac: Remove repeated calls to brcmf_chip_get_core()

2017-07-26 Thread Ian Molton
will allow for easier refcounting in future. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 25 +- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net

[PATCH 11/34] brcmfmac: Split brcmf_sdiod_buffrw function up.

2017-07-26 Thread Ian Molton
This function needs to be split up into separate read / write variants for clarity. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 69 +++--- 1 file changed, 47

[PATCH 14/34] brcmfmac: Remove brcmf_sdiod_addrprep()

2017-07-26 Thread Ian Molton
This function has become trivial enough that it may as well be pushed into its callers, which has the side-benefit of clarifying what's going on. Remove it, and rename brcmf_sdiod_set_sbaddr_window() to brcmf_sdiod_set_backplane_window() as it's easier to understand. Signed-off-by:

[PATCH 28/34] brcmfmac: Rename buscore->core for consistency

2017-07-26 Thread Ian Molton
Avoid confusion with unrelated _buscore labels. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless

[PATCH 17/34] brcmfmac: Remove unused macro.

2017-07-26 Thread Ian Molton
This macro is used exactly nowhere in the code. Delete it. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom

[PATCH 27/34] brcmfmac: Remove {r,w}_sdreg32

2017-07-26 Thread Ian Molton
Remove yet another IO function from the code and replace with one that already exists. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 91 +++--- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/drivers/net/wireless/broadcom

[PATCH 32/34] brcmfmac: Replace function index with function pointer

2017-07-26 Thread Ian Molton
In preparation for removing the function array, remove all code that refers to function by index and replace with pointers to the function itself. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c --- .../wireless/broadcom/brcm80211

[PATCH 30/34] brcmfmac: Correctly handle accesses to SDIO func0

2017-07-26 Thread Ian Molton
Rather than workaround the restrictions on func0 addressing in the driver, set MMC_QUIRK_LENIENT_FN0 Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 ++-- 2 files changed, 6

[PATCH 15/34] brcmfamc: remove unnecessary call to brcmf_sdiod_set_backplane_window()

2017-07-26 Thread Ian Molton
All functions that might require the window address changing call brcmf_sdiod_set_backplane_window() prior to access. Thus resetting the window is not required. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 - 1 file changed, 5 deletions

[PATCH 19/34] brcmfmac: Get rid of chip_priv and core_priv structs

2017-07-26 Thread Ian Molton
There is zero need to keep these structures separate, they are *always* allocated together. All they do is obfuscate the code, whilst offering zero real gain. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/chip.c| 383 + .../wireless/broadcom

[PATCH 18/34] brcmfmac: Rename SOC_AI to SOC_AXI

2017-07-26 Thread Ian Molton
This #define is poorly named. Correct it. At the same time, convert the if..elseif...else it is used in to a switch for clarity. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a

[PATCH 16/34] brcmfmac: Cleanup offsetof()

2017-07-26 Thread Ian Molton
Create a macro to make the code a bit more readable, whilst we're stuck with using struct element offsets as register offsets. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 35 +- 1 file changed, 14 insertions(+), 21 deletions(-)

[PATCH 21/34] brcmfmac: Simplify chip probe routine

2017-07-26 Thread Ian Molton
* Renamed routine in line with kernel convention. * Improved handling of chips that cannot autoprobe Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/chip.c| 132 + 1 file changed, 84 insertions(+), 48 deletions(-) diff --git a/drivers/net/wireless

[PATCH 29/34] brcmfmac: stabilise the value of ->sbwad in use for some xfer routines.

2017-07-26 Thread Ian Molton
The IO functions operate within the Chipcommon IO window. Explicitly set this, rather than relying on the last initialisation IO access to leave it set to the right value by chance. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 drivers/net

[PATCH 34/34] brcmfmac: Reduce the noise from repeatedly dereferencing common pointers

2017-07-26 Thread Ian Molton
a few inconsistently named pointers whilst we are at it ie. sdiod -> sdiodev Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c # drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c --- .../wireless/broadcom/brcm80211/brcmfmac

[PATCH 33/34] brcmfmac: Remove array of functions

2017-07-26 Thread Ian Molton
Replace the array of functions with a pair of pointers to the relevant functions. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c # drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c --- .../wireless/broadcom/brcm80211

[PATCH 26/34] brcmfmac: General cleaning up. whitespace and comments fix.

2017-07-26 Thread Ian Molton
Tidy code, fix whitespace, remove useless debug code. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 24 ++ 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers

[PATCH 23/34] brcmfmac: HUGE cleanup of IO access functions.

2017-07-26 Thread Ian Molton
Most of the core IO functions are called via a long train of pointers. Introduce brcmf_readl(), brcmf_writel(), brcmf_writelp(), brcmf_clear_bits(), and brcmf_set_bits_post() in an attempt to deal with this. These brcmf_writelp() and brcmf_set_bits_post() issue posted writes. Signed-off-by: Ian

[PATCH 20/34] brcmfmac: Whitespace patch

2017-07-26 Thread Ian Molton
Improve legibility / conform to kernel coding style. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/chip.c| 47 ++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c b/drivers/net/wireless

[PATCH 06/34] brcmfmac: Remove bandaid for SleepCSR

2017-07-26 Thread Ian Molton
Register access code is not the place for band-aid fixes like this. If this is a genuine problem, it should be fixed further up in the driver stack. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c --- .../wireless/broadcom/brcm80211

[PATCH 04/34] brcmfmac: Clean up brcmf_sdiod_set_sbaddr_window()

2017-07-26 Thread Ian Molton
This function sets the address of the IO window used for SDIO accesses onto the backplane of the chip. It currently uses 3 separate masks despite the full mask being defined in the code already. Remove the separate masks and clean up. Signed-off-by: Ian Molton # Conflicts

[PATCH 03/34] brcmfmac: Split brcmf_sdiod_regrw_helper() up.

2017-07-26 Thread Ian Molton
This large function is concealing a LOT of obscure logic about how the hardware functions. Time to split it up. This first patch splits the function into two pieces - read and write, doing away with the rw flag in the process. Signed-off-by: Ian Molton --- .../wireless/broadcom

[PATCH 07/34] brcmfmac: Remove brcmf_sdiod_request_data()

2017-07-26 Thread Ian Molton
This function is obfuscating how IO works on this chip. Remove it and push its logic into brcmf_sdiod_reg_{read,write}(). Handling of -ENOMEDIUM is altered, but as that's pretty much broken anyway we can ignore that. Signed-off-by: Ian Molton # Conflicts: # drivers/net/wireless/bro

[PATCH 08/34] brcmfmac: Fix uninitialised variable

2017-07-26 Thread Ian Molton
Unlikely to be a problem, but brcmf_sdiod_regrb() is not symmetric with brcmf_sdiod_regrl() in this regard. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless

[PATCH 01/34] brcmfmac: Fix parameter order in brcmf_sdiod_f0_writeb()

2017-07-26 Thread Ian Molton
All the other IO functions are the other way round in this driver. Make this one match. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom

[PATCH 05/34] brcmfmac: Remove dead IO code

2017-07-26 Thread Ian Molton
The value passed to brcmf_sdiod_addrprep() is *always* 4 remove this parameter and the unused code to handle it. Signed-off-by: Ian Molton --- .../net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a

[PATCH 09/34] brcmfmac: Remove noisy debugging.

2017-07-26 Thread Ian Molton
If you need debugging this low level, you're doing something wrong. Remove these noisy debug statements so the code is more readable. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --

[PATCH 02/34] brcmfmac: Register sizes on hardware are not dependent on compiler types

2017-07-26 Thread Ian Molton
The 4 IO functions in this patch are incorrect as they use compiler types to determine how many bytes to send to the hardware. Signed-off-by: Ian Molton --- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff

Patch v4: Clean up brcmfmac driver

2017-07-26 Thread Ian Molton
Hi folks, Here's a v4 of the cleanup patchset - checkpatch clean(er - I have purposely left some warnings unaddressed). I also dropped an accidental adjustment of a debug macro from v3. -Ian

Re: PATCH v3 brcmfmac driver cleanup

2017-07-26 Thread Ian Molton
On 24/07/17 20:47, Arend van Spriel wrote: > On 19-07-17 21:07, Ian Molton wrote: >> Hi all, >> >> Please find the 3rd revision of my cleanup patchset for brcmfmac. >> >> I've done some further cleanup and it now handles SDIO the ay the MMC >> subsyst

Re: brcm43430 sdio wifi regression with 4.13-rc1

2017-07-22 Thread Ian Molton
On 22/07/17 20:18, Ian Molton wrote: > On 22/07/17 19:43, Hans de Goede wrote: >> Hi, >> >> When upgrading my devel environment to 4.13-rc1+ I noticed that >> the brcm43430 sdio wifi on a Chuwi Hi8 plus stopped working: > > There is a fix for this: > > htt

Re: brcm43430 sdio wifi regression with 4.13-rc1

2017-07-22 Thread Ian Molton
On 22/07/17 19:43, Hans de Goede wrote: > Hi, > > When upgrading my devel environment to 4.13-rc1+ I noticed that > the brcm43430 sdio wifi on a Chuwi Hi8 plus stopped working: There is a fix for this: https://patchwork.kernel.org/patch/9836383/ IIRC -Ian

Re: [PATCH 28/29] brcmfmac: Rename buscore->core for consistency

2017-07-20 Thread Ian Molton
> https://github.com/0day-ci/linux/commits/Ian-Molton/brcmfmac-Fix-parameter-order-in-brcmf_sdiod_f0_writeb/20170718-123057 > base: > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git > master > config: x86_64-randconfig-a0-07201347 (attached as .co

Re: brcmfmac bus level addressing issues.

2017-07-19 Thread Ian Molton
On 19/07/17 12:47, Arend van Spriel wrote: > On 19-07-17 00:45, Ian Molton wrote: >> (as it stands, back to back wpasuplpicant runs make it keel over, as >> does module unload and reload). > > It is good to get such feedback. We should get in details about this. I'll r

[PATCH 31/34] brcmfmac: Remove func0 from function array

2017-07-19 Thread Ian Molton
Linux doesnt pass you func0 as a function when probing - instead providing specific access functions to read/write it. This prepares for a patch to remove the actual array entry itself. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 5 + drivers

[PATCH 28/34] brcmfmac: Rename buscore->core for consistency

2017-07-19 Thread Ian Molton
Avoid confusion with unrelated _buscore labels. Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless

[PATCH 30/34] brcmfmac: Correctly handle accesses to SDIO func0

2017-07-19 Thread Ian Molton
Rather than workaround the restrictions on func0 addressing in the driver, set MMC_QUIRK_LENIENT_FN0 Signed-off-by: Ian Molton --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h | 4 ++-- 2 files changed, 6

  1   2   3   >