Re: [PATCH v2 2/4] clk: renesas: Add r8a7796 CPG Core Clock Definitions

2016-05-31 Thread Magnus Damm
Hi Dirk,

On Tue, May 31, 2016 at 1:36 AM, Dirk Behme  wrote:
> Hi Geert,
>
>
> On 30.05.2016 18:28, Geert Uytterhoeven wrote:
>>
>> Add all R-Car M3-W Clock Pulse Generator Core Clock Outputs, as listed
>> in Table 8.2b ("List of Clocks [R-Car M3-W]") of the R-Car Gen3
>> datasheet (rev. 0.51 + Errata for Rev051 Mar 31 2016).
>>
>> Note that internal CPG clocks (S0, S1, S2, S3, SDSRC, and SSPSRC) are
>> not included, as they are used as internal clock sources only, and never
>> referenced from DT.
>>
>> Signed-off-by: Geert Uytterhoeven 
>> Tested-by: Simon Horman 
>> ---
>> v2:
>>- Add Tested-by.
>> ---
[snip]
>> +#include 
>> +
>> +/* r8a7796 CPG Core Clocks */
>> +#define R8A7796_CLK_Z  0
>> +#define R8A7796_CLK_Z2 1
>
> I think we recently started a discussion to find a more clever way to avoid
> re-defining (copy & paste) all this R-Car3 clocks  (compare [1]) where they
> are the same over the R-Car3 family while still being able to deal with the
> differences.
>
> [1]
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/dt-bindings/clock/r8a7795-cpg-mssr.h

This topic is related to the rather fixed DT ABI for the CPG device.
Please see the interface described in the following upstream commits:

$ git log --oneline
Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt | cat
ca00c38 clk: shmobile: cpg-mssr: Update serial port clock in example
3686d3e clk: shmobile: Add new Renesas CPG/MSSR DT bindings
$

Some years ago we discussed this consolidation topic for R-Car Gen2
and we revisited when doing various iterations for the R-Car Gen3 CPGs
last year. Using a single per-family shared range of clocks was
considered both times, however when comparing the pros and cons it
became evident that best practice with DT tends to be to not speculate
and go with what we know based on existing documentation.

Like you may have experienced, the SoC documentation is slightly
changing over time. Also the number of SoCs in a certain family is
clearly being extended over time. The direction where things are going
is not known during initial design phase. Because of this we make use
of known-to-be-fixed ids such as SoC-specific part numbers instead of
speculating with family DT strings where the meaning tend to change
over time.

If we would go with consolidating the clock indices from per-SoC to
per-family then please note that this does not affect the run time
size of the DTB. In the kernel source code we have some level of
agreed duplication where DT compat strings and such are chosen to be
duplicated per-device instead of trying to make the code more compact.
I believe our build machines are snappy enough to handle a couple of
KiB of strings worst case.

Because of the unchanged DTB size this discussion is purely a matter
of how to maintain the code. So the maintainers need to decide what
level of duplication is needed. Perhaps this topic should be
revisited, and maybe meeting face-to-face would help?

Thanks,

/ magnus


Re: [RFC 0/4] ARM: dts: r8a7790: lager: use demuxer for I2C

2016-05-31 Thread Magnus Damm
Hi Simon,

On Tue, May 31, 2016 at 12:32 PM, Simon Horman
 wrote:
> the intention of this series is to extend use of the demuxer for I2C
> on the lager/r8a7790 to cover all I2C IP blocks.
>
> This is based on work by Wolfram Sang.
>
> I have not included GPIO in the demux configuration. This is in keeping
> with the existing usage for IIC0/I2C0.

Thanks for your efforts! Can you please include GPIO support in next
version? This way we should in the future be able to use
distro-kernels out of the box that may only have GPIO bitbang support
enabled.

Cheers,

/ magnus


[PATCH 2/2] usb: host: xhci: rcar: fix the quirks setting of XHCI_NO_64BIT_SUPPORT

2016-05-31 Thread Yoshihiro Shimoda
Since the commit b1c127ae (usb: host: xhci: plat: make use of new methods
in xhci_plat_priv) changed the setting timing of xhci->quirks to
xhci_rcar_init_quirk(), the quirks was overwritten by xhci_gen_setup().

So, this patch fixes the issue using a "quirks" of struct xhci_plat_priv.

Signed-off-by: Yoshihiro Shimoda 
---
 drivers/usb/host/xhci-plat.c | 12 +++-
 drivers/usb/host/xhci-plat.h |  1 +
 drivers/usb/host/xhci-rcar.c | 21 -
 3 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 676ea45..7f03608 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -57,12 +57,14 @@ static int xhci_priv_init_quirk(struct usb_hcd *hcd)
 
 static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
 {
+   struct xhci_plat_priv *priv = xhci_to_priv(xhci);
+
/*
 * As of now platform drivers don't provide MSI support so we ensure
 * here that the generic code does not try to make a pci_dev from our
 * dev struct in order to setup MSI
 */
-   xhci->quirks |= XHCI_PLAT;
+   xhci->quirks |= XHCI_PLAT | priv->quirks;
 }
 
 /* called during probe() after chip reset completes */
@@ -89,16 +91,24 @@ static const struct xhci_plat_priv xhci_plat_marvell_armada 
= {
.init_quirk = xhci_mvebu_mbus_init_quirk,
 };
 
+/*
+ * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set to 1.
+ * However, these SoCs don't support 64-bit address memory pointers. So, this
+ * driver clears the AC64 bit of xhci->hcc_params to call
+ * dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in xhci_gen_setup().
+ */
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1,
.init_quirk = xhci_rcar_init_quirk,
.plat_start = xhci_rcar_start,
+   .quirks = XHCI_NO_64BIT_SUPPORT,
 };
 
 static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = {
.firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2,
.init_quirk = xhci_rcar_init_quirk,
.plat_start = xhci_rcar_start,
+   .quirks = XHCI_NO_64BIT_SUPPORT,
 };
 
 static const struct of_device_id usb_xhci_of_match[] = {
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index c652f33..15144c9 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -20,5 +20,6 @@ struct xhci_plat_priv {
unsigned int quirks;
 };
 
+#define xhci_to_priv(x) ((struct xhci_plat_priv *)(x)->priv)
 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
 #endif /* _XHCI_PLAT_H */
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 0e4535e..2617cd7 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -87,14 +87,6 @@ static int xhci_rcar_is_gen2(struct device *dev)
of_device_is_compatible(node, "renensas,rcar-gen2-xhci");
 }
 
-static int xhci_rcar_is_gen3(struct device *dev)
-{
-   struct device_node *node = dev->of_node;
-
-   return of_device_is_compatible(node, "renesas,xhci-r8a7795") ||
-   of_device_is_compatible(node, "renesas,rcar-gen3-xhci");
-}
-
 void xhci_rcar_start(struct usb_hcd *hcd)
 {
u32 temp;
@@ -175,22 +167,9 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)
 /* This function needs to initialize a "phy" of usb before */
 int xhci_rcar_init_quirk(struct usb_hcd *hcd)
 {
-   struct xhci_hcd *xhci = hcd_to_xhci(hcd);
-
/* If hcd->regs is NULL, we don't just call the following function */
if (!hcd->regs)
return 0;
 
-   /*
-* On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set
-* to 1. However, these SoCs don't support 64-bit address memory
-* pointers. So, this driver clears the AC64 bit of xhci->hcc_params
-* to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
-* xhci_gen_setup().
-*/
-   if (xhci_rcar_is_gen2(hcd->self.controller) ||
-   xhci_rcar_is_gen3(hcd->self.controller))
-   xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
-
return xhci_rcar_download_firmware(hcd);
 }
-- 
1.9.1



[PATCH 0/2] usb: host: xhci: rcar: fix the quirks setting of XHCI_NO_64BIT_SUPPORT

2016-05-31 Thread Yoshihiro Shimoda
I'm afraid but I found a regression of xhci-rcar in v4.7-rc1.
This regression is caused by the following commit:

commit b1c127ae990bccf0187d741c1695a61e54de1943
Author: Felipe Balbi 
Date:   Fri Apr 22 13:17:16 2016 +0300

usb: host: xhci: plat: make use of new methods in xhci_plat_priv

Now that the code has been refactored enough,
switching over to using ->plat_start() and
->init_quirk() becomes a very simple patch.

After this patch, there are no further uses for
xhci_plat_type_is() which will be removed in a
follow-up patch.

Acked-by: Yoshihiro Shimoda 
Signed-off-by: Felipe Balbi 
Signed-off-by: Mathias Nyman 
Signed-off-by: Greg Kroah-Hartman 

< Overview >
The regression is the quirks flag "XHCI_NO_64BIT_SUPPORT" will be overwritten
by xhci_gen_setup(). Then, the driver will not work correctly.

< Detail >
Since the previous code will do the following, the quirks flag can be set:

xhci_plat_setup()
 -> xhci_gen_setup(hcd, xhci_plat_quirks);
  -> xhci->quirks = quirks;
   -> get_quirks() [This is xhci_plat_quirks]
-> xhci->quirks |= XHCI_NO_64BIT_SUPPORT

However, after we applied the patch above, the quirks will disappear:

xhci_plat_setup()
 -> xhci_priv_init_quirk();
  -> xhci_rcar_init_quirk();
   -> xhci->quirks |= XHCI_NO_64BIT_SUPPORT
  -> xhci_gen_setup(hcd, xhci_plat_quirks);
   -> xhci->quirks = quirks; <- here
-> get_quirks() [This is xhci_plat_quirks]

So, I submitted incremental patches to resolve this issue like the followings:

xhci_plat_setup()
 -> xhci_priv_init_quirk();
  -> xhci_rcar_init_quirk();
  -> xhci_gen_setup(hcd, xhci_plat_quirks);
   -> xhci->quirks = quirks;
-> get_quirks() [This is xhci_plat_quirks]
 -> xhci->quirks |= priv->quirks (XHCI_NO_64BIT_SUPPORT)

Yoshihiro Shimoda (2):
  usb: host: xhci: plat: add ->quirks value for platform-specific
  usb: host: xhci: rcar: fix the quirks setting of XHCI_NO_64BIT_SUPPORT

 drivers/usb/host/xhci-plat.c | 12 +++-
 drivers/usb/host/xhci-plat.h |  2 ++
 drivers/usb/host/xhci-rcar.c | 21 -
 3 files changed, 13 insertions(+), 22 deletions(-)

-- 
1.9.1



[PATCH 1/2] usb: host: xhci: plat: add ->quirks value for platform-specific

2016-05-31 Thread Yoshihiro Shimoda
This patch adds quirks in struct xhci_plat_priv to set xhci->quirks
for platform-specific.

Signed-off-by: Yoshihiro Shimoda 
---
 drivers/usb/host/xhci-plat.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 9af0cb4..c652f33 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -17,6 +17,7 @@ struct xhci_plat_priv {
const char *firmware_name;
void (*plat_start)(struct usb_hcd *);
int (*init_quirk)(struct usb_hcd *);
+   unsigned int quirks;
 };
 
 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
-- 
1.9.1



Re: [PATCH 4/4] drm: rcar-du: Use product register framework

2016-05-31 Thread Magnus Damm
Hi Dirk,

On Fri, May 27, 2016 at 7:18 PM, Dirk Behme  wrote:
> Hi Magnus,
>
>
> On 27.05.2016 11:56, Magnus Damm wrote:
>>
>> Hi Dirk,
>>
>> On Fri, May 27, 2016 at 5:16 PM, Dirk Behme 
>> wrote:
>>>
>>> Hi Magnus,
>>>
>>>
>>> On 27.05.2016 05:40, Magnus Damm wrote:


 Hi Dirk,

 On Wed, May 25, 2016 at 5:58 PM, Dirk Behme 
 wrote:
>
>
> Instead of hard coding the product register in the rcar-du, use
> the framework for it to get the SoC version and the revision needed
> for the enabling the workaround.
>
> Signed-off-by: Dirk Behme 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 13 ++---
>  1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index e10943b..ee639a6 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -13,6 +13,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -30,12 +31,6 @@
>  #include "rcar_du_regs.h"
>  #include "rcar_du_vsp.h"
>
> -#define PRODUCT_REG0xfff00044
> -#define PRODUCT_H3_BIT (0x4f << 8)
> -#define PRODUCT_MASK   (0x7f << 8)
> -#define CUT_ES1(0x00)
> -#define CUT_ES1_MASK   (0x00ff)
> -
>  static u32 rcar_du_crtc_read(struct rcar_du_crtc *rcrtc, u32 reg)
>  {
> struct rcar_du_device *rcdu = rcrtc->group->dev;
> @@ -167,7 +162,6 @@ static void rcar_du_crtc_set_display_timing(struct
> rcar_du_crtc *rcrtc)
> u32 div;
> u32 dpll_reg = 0;
> struct dpll_info *dpll;
> -   void __iomem *product_reg;
> bool h3_es1_workaround = false;
>
> dpll = kzalloc(sizeof(*dpll), GFP_KERNEL);
> @@ -175,11 +169,8 @@ static void rcar_du_crtc_set_display_timing(struct
> rcar_du_crtc *rcrtc)
> return;
>
> /* DU2 DPLL Clock Select bit workaround in R-Car H3(ES1.0) */
> -   product_reg = ioremap(PRODUCT_REG, 0x04);
> -   if (((readl(product_reg) & PRODUCT_MASK) == PRODUCT_H3_BIT)
> -   && ((readl(product_reg) & CUT_ES1_MASK) == CUT_ES1))
> +   if (cpu_is_rcar3_h3() && revision_is_rcar3_es1())
> h3_es1_workaround = true;
> -   iounmap(product_reg);



 Thanks for your efforts!

 I agree that doing ioremap() with a hard coded address and reading out
 an unrelated register looks like a short term workaround. Replacing
 that with something cleaner makes sense. The question in my mind is
 how to make it cleaner.

 I can see that in this series you have introduced some specialized
 functions to be able to check ES version. This may be slightly
 cleaner, but the design comes with some drawbacks. One major drawback
 is that specialized functions makes it difficult to move the code
 between several architectures. So if we should clean up the code then
 we should go all the way and do it in a reusable way.

 Over the years many drivers have been initially written on the SH
 arch, then moved to 32-bit ARM and recently also be used for ARM v8.
 Not sure about the DU driver, it may only be shared between 32-bit ARM
 and 64-bit ARM instead of all 3 architectures. I think the SCIF driver
 has been used on even more architectures like H8. One major reason why
 we have been able to reuse code over several architectures is that
 we've focus on using standard functions and stayed away from
 architecture-specific extensions. In case a short term workaround is
 needed then it should not break the code on other architectures. The
 initial short term code above would work on any of the supported SoCs
 and it would also compile on a whole bunch of other architectures for
 compile testing purpose.
>>>
>>>
>>>
>>>
>>> Please correct me if I'm wrong, but the initial short term code does work
>>> on
>>> all SoCs having a PRODUCT_REG @ 0xfff00044. Correct?
>>>
>>> And my code should work identically, no?
>>>
>>> Or where do you see the difference?
>>>
>>> Going even one step further, running the initial short term code on SoCs
>>> *not* having a PRODUCT_REG @ 0xfff00044 will fail randomly, depending on
>>> the
>>> result read from that address, then.
>>>
>>> Instead, my proposal, will give at least a valid error message (assuming
>>> the
>>> device tree entries are set correctly).
>>
>>
>> Your code is an improvement to the original one for sure, and I think
>> it should work identically but with better error reporting...
>>
>>> Regarding compilation, you are correct. Most probably I should add some
>>> empty stub functions for the 

Re: [PATCH 12/13] ARM: dts: blanche: initial device tree

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:32:35AM +0300, Sergei Shtylyov wrote:
> Add the initial device  tree for the R8A7792 SoC based Blanche board.
> The board has 2 debug serial ports: SCIF0 and SCIF3; include support for
> them,  so that  the serial console  can  work.
> 
> Signed-off-by: Sergei Shtylyov 

At this time I do not have access to documentation or hardware for this
board. So I am relying on you to test this and make sure it complies
with the spec.

What you have looks reasonable to me:

Acked-by: Simon Horman 


Re: [PATCH 10/13] ARM: dts: r8a7792: add IRQC support

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:29:05AM +0300, Sergei Shtylyov wrote:
> Describe the IRQC interrupt controller in the R8A7792 device tree.
> 
> Signed-off-by: Sergei Shtylyov 
> 
> ---
>  arch/arm/boot/dts/r8a7792.dtsi |   13 +
>  1 file changed, 13 insertions(+)
> 
> Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
> ===
> --- renesas.orig/arch/arm/boot/dts/r8a7792.dtsi
> +++ renesas/arch/arm/boot/dts/r8a7792.dtsi
> @@ -62,6 +62,19 @@
> IRQ_TYPE_LEVEL_HIGH)>;
>   };
>  
> + irqc: interrupt-controller@e61c {

Could you consider using irqc0 as the node name for consistency with the
DT of other R-Car Gen2 SoCs?

What follows looks correct to me.

> + compatible = "renesas,irqc-r8a7792", "renesas,irqc";
> + #interrupt-cells = <2>;
> + interrupt-controller;
> + reg = <0 0xe61c 0 0x200>;
> + interrupts = ,
> +  ,
> +  ,
> +  ;
> + clocks = <_clks R8A7792_CLK_IRQC>;
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + };
> +
>   timer {
>   compatible = "arm,armv7-timer";
>   interrupts =  


Re: [PATCH 09/13] ARM: dts: r8a7792: add [H]SCIF support

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:26:56AM +0300, Sergei Shtylyov wrote:
> Describe [H]SCIFs in the R8A7792 device tree.
> 
> Signed-off-by: Sergei Shtylyov 

This looks correct to me.

I am wondering if you have been able to confirm DMA operation of the
devices enabled later on in the series.

> 
> ---
>  arch/arm/boot/dts/r8a7792.dtsi |   90 
> +
>  1 file changed, 90 insertions(+)
> 
> Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
> ===
> --- renesas.orig/arch/arm/boot/dts/r8a7792.dtsi
> +++ renesas/arch/arm/boot/dts/r8a7792.dtsi
> @@ -140,6 +140,96 @@
>   dma-channels = <15>;
>   };
>  
> + scif0: serial@e6e6 {
> + compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
> +  "renesas,scif";
> + reg = <0 0xe6e6 0 64>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_SCIF0>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x29>, < 0x2a>,
> +< 0x29>, < 0x2a>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
> + scif1: serial@e6e68000 {
> + compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
> +  "renesas,scif";
> + reg = <0 0xe6e68000 0 64>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_SCIF1>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x2d>, < 0x2e>,
> +< 0x2d>, < 0x2e>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
> + scif2: serial@e6e58000 {
> + compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
> +  "renesas,scif";
> + reg = <0 0xe6e58000 0 64>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_SCIF2>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x2b>, < 0x2c>,
> +< 0x2b>, < 0x2c>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
> + scif3: serial@e6ea8000 {
> + compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
> +  "renesas,scif";
> + reg = <0 0xe6ea8000 0 64>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_SCIF3>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x2f>, < 0x30>,
> +< 0x2f>, < 0x30>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
> + hscif0: serial@e62c {
> + compatible = "renesas,hscif-r8a7792", "renesas,rcar-gen2-hscif",
> +  "renesas,hscif";
> + reg = <0 0xe62c 0 96>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_HSCIF0>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x39>, < 0x3a>,
> +< 0x39>, < 0x3a>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
> + hscif1: serial@e62c8000 {
> + compatible = "renesas,hscif-r8a7792", "renesas,rcar-gen2-hscif",
> +  "renesas,hscif";
> + reg = <0 0xe62c8000 0 96>;
> + interrupts = ;
> + clocks = <_clks R8A7792_CLK_HSCIF1>, <_clk>,
> +  <_clk>;
> + clock-names = "fck", "brg_int", "scif_clk";
> + dmas = < 0x4d>, < 0x4e>,
> +< 0x4d>, < 0x4e>;
> + dma-names = "tx", "rx", "tx", "rx";
> + power-domains = < R8A7792_PD_ALWAYS_ON>;
> + status = "disabled";
> + };
> +
>   clocks {
>   #address-cells = <2>;
>   #size-cells = <2>;
> 


Re: [PATCH 08/13] ARM: dts: r8a7792: add SYS-DMAC support

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:25:24AM +0300, Sergei Shtylyov wrote:
> Describe SYS-DMAC0/1 in the R8A7792 device tree.
> 
> Signed-off-by: Sergei Shtylyov 

Acked-by: Simon Horman 



Re: [PATCH 07/13] ARM: dts: r8a7792: initial SoC device tree

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:24:21AM +0300, Sergei Shtylyov wrote:
> The initial R8A7792 SoC device tree including 2 CPU cores, GIC, timer, SYSC,
> and the required  clock descriptions.
> 
> Signed-off-by: Sergei Shtylyov 

This is rather large for an initial DTSI. Did you give any consideration
to splitting it up: e.g. only providing what is needed to get to a serial
console?

With regards to SMP. Have you checked to make sure CPU hotplug works
on all CPUs? And that the system behaves sanely on suspend/resume.
If it is not possible to verify this at this stage then I would recommend
only enabling one CPU at this stage.


Re: [PATCH 01/13] ARM: shmobile: r8a7792: add clock index macros

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 01:09:58AM +0300, Sergei Shtylyov wrote:
> Add macros usable by the device tree sources to reference the R8A7792
> clocks  by index.
> 
> Signed-off-by: Sergei Shtylyov 
> 
> ---
>  include/dt-bindings/clock/r8a7792-clock.h |  104 
> ++
>  1 file changed, 104 insertions(+)
> 
> Index: renesas/include/dt-bindings/clock/r8a7792-clock.h
> ===
> --- /dev/null
> +++ renesas/include/dt-bindings/clock/r8a7792-clock.h
> @@ -0,0 +1,104 @@
> +/*
> + * Copyright (C) 2016 Cogent Embedded, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef __DT_BINDINGS_CLOCK_R8A7792_H__
> +#define __DT_BINDINGS_CLOCK_R8A7792_H__
> +
> +/* CPG */
> +#define R8A7792_CLK_MAIN 0
> +#define R8A7792_CLK_PLL0 1
> +#define R8A7792_CLK_PLL1 2
> +#define R8A7792_CLK_PLL3 3
> +#define R8A7792_CLK_LB   4
> +#define R8A7792_CLK_QSPI 5
> +#define R8A7792_CLK_SDH  6
> +#define R8A7792_CLK_SD0  7
> +#define R8A7792_CLK_SD1  8
> +#define R8A7792_CLK_Z9

According to my copy of the documentation (v2.00) SDH, SD0 and SD1 do
not seem to be provided by the r8a7792 CPG.

It does, however, provide RCAN and ADSP which are supported by the CPG
driver. You may wish to add them now for completeness though from my point
of view they could also be added later when they are used.


I reviewed the values below. They appear to be complete and correct.

> +/* MSTP0 */
> +#define R8A7792_CLK_MSIOF0   0
> +
> +/* MSTP1 */
> +#define R8A7792_CLK_TMU1 11
> +#define R8A7792_CLK_TMU3 21
> +#define R8A7792_CLK_TMU2 22
> +#define R8A7792_CLK_CMT0 24
> +#define R8A7792_CLK_TMU0 25
> +#define R8A7792_CLK_VSP1DU1  27
> +#define R8A7792_CLK_VSP1DU0  28
> +#define R8A7792_CLK_VSP1_SY  31
> +/* MSTP2 */
> +#define R8A7792_CLK_MSIOF1   8
> +#define R8A7792_CLK_SYS_DMAC018
> +#define R8A7792_CLK_SYS_DMAC119

> +/* MSTP3 */
> +#define R8A7792_CLK_TPU0 4
> +#define R8A7792_CLK_SDHI014
> +#define R8A7792_CLK_CMT1 29
> +
> +/* MSTP4 */
> +#define R8A7792_CLK_IRQC 7
> +
> +/* MSTP5 */
> +#define R8A7792_CLK_AUDIO_DMAC0  2
> +#define R8A7792_CLK_THERMAL  22
> +#define R8A7792_CLK_PWM  23
> +
> +/* MSTP7 */
> +#define R8A7792_CLK_HSCIF1   16
> +#define R8A7792_CLK_HSCIF0   17
> +#define R8A7792_CLK_SCIF318
> +#define R8A7792_CLK_SCIF219
> +#define R8A7792_CLK_SCIF120
> +#define R8A7792_CLK_SCIF021
> +#define R8A7792_CLK_DU1  23
> +#define R8A7792_CLK_DU0  24
> +
> +/* MSTP8 */
> +#define R8A7792_CLK_VIN5 4
> +#define R8A7792_CLK_VIN4 5
> +#define R8A7792_CLK_VIN3 8
> +#define R8A7792_CLK_VIN2 9
> +#define R8A7792_CLK_VIN1 10
> +#define R8A7792_CLK_VIN0 11
> +#define R8A7792_CLK_ETHERAVB 12
> +
> +/* MSTP9 */
> +#define R8A7792_CLK_GPIO74
> +#define R8A7792_CLK_GPIO65
> +#define R8A7792_CLK_GPIO57
> +#define R8A7792_CLK_GPIO48
> +#define R8A7792_CLK_GPIO39
> +#define R8A7792_CLK_GPIO210
> +#define R8A7792_CLK_GPIO111
> +#define R8A7792_CLK_GPIO012
> +#define R8A7792_CLK_GPIO11   13
> +#define R8A7792_CLK_GPIO10   14
> +#define R8A7792_CLK_CAN1 15
> +#define R8A7792_CLK_CAN0 16
> +#define R8A7792_CLK_QSPI_MOD 17
> +#define R8A7792_CLK_GPIO919
> +#define R8A7792_CLK_GPIO821
> +#define R8A7792_CLK_I2C5 25
> +#define R8A7792_CLK_IICDVFS  26
> +#define R8A7792_CLK_I2C4 27
> +#define R8A7792_CLK_I2C3 28
> +#define R8A7792_CLK_I2C2 29
> +#define R8A7792_CLK_I2C1 30
> +#define R8A7792_CLK_I2C0 31
> +
> +/* MSTP10 */
> +#define R8A7792_CLK_SSI_ALL  5
> +#define R8A7792_CLK_SSI4 11
> +#define R8A7792_CLK_SSI3 12
> +
> +#endif /* __DT_BINDINGS_CLOCK_R8A7792_H__ */
> 


Re: [PATCH 05/13] DT: clock: rcar-gen2-cpg-clocks: document R8A7792 support

2016-05-31 Thread Simon Horman
On Wed, Jun 01, 2016 at 09:25:35AM +0900, Simon Horman wrote:
> [Cc: Geert]
> 
> On Wed, Jun 01, 2016 at 01:20:11AM +0300, Sergei Shtylyov wrote:
> > Renesas R8A7792 SoC is a member of the R-Car gen2 family and so has CPG...
> > 
> > Signed-off-by: Sergei Shtylyov 
> 
> Hi Sergei,
> 
> I think the prefix of this patch should be "clk: shmobile: rcar-gen2: "
> 
> Hi Geert,
> 
> I apologise if I have missed a discussion of this topic or if my analysis
> is wrong for some reason but I am curious to know what the intended way
> is for the rcar-gen2 CPG driver to handle differences in the availability
> of clocks across different SoCs.
> 
> My possibly naïve expectation is that the implementation would use compat
> strings. But as it stands it appears that all clocks supported by the
> driver are available for all SoCs. This does not seem to reflect the
> documentation (v2.00).
> 
> FWIW my quick analysis of clocks supported by the driver present in
> renesas-drivers-2016-05-31-v4.7-rc1 but not present on one or more SoCs
> is as follows:
> 
> Not present on V2H: sdh, sd0
> Not present on V2H or E2: sd1
> Not present on H2, M2-W, M2-N, E2: rcan

Thinking about a little more, which I obviously should have done
before hitting send:

There does not seem to be any conflict in the implementation of individual
clocks between SoCs at least so far as clocks supported by the driver goes.
Its just that some of them aren't present on all SoCs. But in that case
they shouldn't be used in DT: the DT describes the HW. So I think I'm ok
with this patch. Sorry for the noise!

Acked-by: Simon Horman 

> > ---
> >  Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt | 
> >1 +
> >  1 file changed, 1 insertion(+)
> > 
> > Index: 
> > renesas/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
> > ===
> > --- 
> > renesas.orig/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
> > +++ 
> > renesas/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
> > @@ -10,6 +10,7 @@ Required Properties:
> >- compatible: Must be one of
> >  - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG
> >  - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG
> > +- "renesas,r8a7792-cpg-clocks" for the r8a7792 CPG
> >  - "renesas,r8a7793-cpg-clocks" for the r8a7793 CPG
> >  - "renesas,r8a7794-cpg-clocks" for the r8a7794 CPG
> >  and "renesas,rcar-gen2-cpg-clocks" as a fallback.
> > 
> 


[PATCH 13/13] ARM: dts: blanche: add Ethernet support

2016-05-31 Thread Sergei Shtylyov
R8A7792  SoC  doesn't have the EtherMAC core, so SMSC  LAN89218  Ethernet
chip was used instead on the Blanche board; this chip  is compatible with
SMSC LAN9115  for  which there's a (device tree aware) driver. Describe
the  chip in  the  Blanche device tree;  enable DHCP and NFS root in the
kernel command line for the kernel booting.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/r8a7792-blanche.dts |   23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Index: renesas/arch/arm/boot/dts/r8a7792-blanche.dts
===
--- renesas.orig/arch/arm/boot/dts/r8a7792-blanche.dts
+++ renesas/arch/arm/boot/dts/r8a7792-blanche.dts
@@ -21,7 +21,7 @@
};
 
chosen {
-   bootargs = "ignore_loglevel";
+   bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
stdout-path = "serial0:115200n8";
};
 
@@ -29,6 +29,27 @@
device_type = "memory";
reg = <0 0x4000 0 0x4000>;
};
+
+   d3_3v: regulator-3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "D3.3V";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-boot-on;
+   regulator-always-on;
+   };
+
+   ethernet@1800 {
+   compatible = "smsc,lan89218", "smsc,lan9115";
+   reg = <0 0x1800 0 0x100>;
+   phy-mode = "mii";
+   interrupt-parent = <>;
+   interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
+   smsc,irq-push-pull;
+   reg-io-width = <4>;
+   vddvario-supply = <_3v>;
+   vdd33a-supply = <_3v>;
+   };
 };
 
 _clk {



[PATCH 12/13] ARM: dts: blanche: initial device tree

2016-05-31 Thread Sergei Shtylyov
Add the initial device  tree for the R8A7792 SoC based Blanche board.
The board has 2 debug serial ports: SCIF0 and SCIF3; include support for
them,  so that  the serial console  can  work.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/Makefile|1 
 arch/arm/boot/dts/r8a7792-blanche.dts |   44 ++
 2 files changed, 45 insertions(+)

Index: renesas/arch/arm/boot/dts/Makefile
===
--- renesas.orig/arch/arm/boot/dts/Makefile
+++ renesas/arch/arm/boot/dts/Makefile
@@ -638,6 +638,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
r8a7790-lager.dtb \
r8a7791-koelsch.dtb \
r8a7791-porter.dtb \
+   r8a7792-blanche.dtb \
r8a7793-gose.dtb \
r8a7794-alt.dtb \
r8a7794-silk.dtb \
Index: renesas/arch/arm/boot/dts/r8a7792-blanche.dts
===
--- /dev/null
+++ renesas/arch/arm/boot/dts/r8a7792-blanche.dts
@@ -0,0 +1,44 @@
+/*
+ * Device Tree Source for the Blanche board
+ *
+ * Copyright (C) 2016 Cogent Embedded, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/dts-v1/;
+#include "r8a7792.dtsi"
+
+/ {
+   model = "Blanche";
+   compatible = "renesas,blanche", "renesas,r8a7792";
+
+   aliases {
+   serial0 = 
+   serial1 = 
+   };
+
+   chosen {
+   bootargs = "ignore_loglevel";
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@4000 {
+   device_type = "memory";
+   reg = <0 0x4000 0 0x4000>;
+   };
+};
+
+_clk {
+   clock-frequency = <2000>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};



[PATCH 11/13] DT: arm: shmobile: document Blanche board

2016-05-31 Thread Sergei Shtylyov
Document the Blanche device tree bindings, listing it as a supported board.

This allows to use checkpatch.pl to validate .dts files referring to the
Blanche board.

Signed-off-by: Sergei Shtylyov 

---
 Documentation/devicetree/bindings/arm/shmobile.txt |2 ++
 1 file changed, 2 insertions(+)

Index: renesas/Documentation/devicetree/bindings/arm/shmobile.txt
===
--- renesas.orig/Documentation/devicetree/bindings/arm/shmobile.txt
+++ renesas/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -39,6 +39,8 @@ Boards:
 compatible = "renesas,ape6evm", "renesas,r8a73a4"
   - Atmark Techno Armadillo-800 EVA
 compatible = "renesas,armadillo800eva"
+  - Blanche (RTP0RC7792SEB00010S)
+compatible = "renesas,blanche", "renesas,r8a7792"
   - BOCK-W
 compatible = "renesas,bockw", "renesas,r8a7778"
   - Genmai (RTK772100BC0BR)



[PATCH 10/13] ARM: dts: r8a7792: add IRQC support

2016-05-31 Thread Sergei Shtylyov
Describe the IRQC interrupt controller in the R8A7792 device tree.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/r8a7792.dtsi |   13 +
 1 file changed, 13 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
===
--- renesas.orig/arch/arm/boot/dts/r8a7792.dtsi
+++ renesas/arch/arm/boot/dts/r8a7792.dtsi
@@ -62,6 +62,19 @@
  IRQ_TYPE_LEVEL_HIGH)>;
};
 
+   irqc: interrupt-controller@e61c {
+   compatible = "renesas,irqc-r8a7792", "renesas,irqc";
+   #interrupt-cells = <2>;
+   interrupt-controller;
+   reg = <0 0xe61c 0 0x200>;
+   interrupts = ,
+,
+,
+;
+   clocks = <_clks R8A7792_CLK_IRQC>;
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   };
+
timer {
compatible = "arm,armv7-timer";
interrupts = 

[PATCH 09/13] ARM: dts: r8a7792: add [H]SCIF support

2016-05-31 Thread Sergei Shtylyov
Describe [H]SCIFs in the R8A7792 device tree.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/r8a7792.dtsi |   90 +
 1 file changed, 90 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
===
--- renesas.orig/arch/arm/boot/dts/r8a7792.dtsi
+++ renesas/arch/arm/boot/dts/r8a7792.dtsi
@@ -140,6 +140,96 @@
dma-channels = <15>;
};
 
+   scif0: serial@e6e6 {
+   compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
+"renesas,scif";
+   reg = <0 0xe6e6 0 64>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_SCIF0>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x29>, < 0x2a>,
+  < 0x29>, < 0x2a>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif1: serial@e6e68000 {
+   compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
+"renesas,scif";
+   reg = <0 0xe6e68000 0 64>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_SCIF1>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2d>, < 0x2e>,
+  < 0x2d>, < 0x2e>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif2: serial@e6e58000 {
+   compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
+"renesas,scif";
+   reg = <0 0xe6e58000 0 64>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_SCIF2>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2b>, < 0x2c>,
+  < 0x2b>, < 0x2c>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   scif3: serial@e6ea8000 {
+   compatible = "renesas,scif-r8a7792", "renesas,rcar-gen2-scif",
+"renesas,scif";
+   reg = <0 0xe6ea8000 0 64>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_SCIF3>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x2f>, < 0x30>,
+  < 0x2f>, < 0x30>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif0: serial@e62c {
+   compatible = "renesas,hscif-r8a7792", "renesas,rcar-gen2-hscif",
+"renesas,hscif";
+   reg = <0 0xe62c 0 96>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_HSCIF0>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x39>, < 0x3a>,
+  < 0x39>, < 0x3a>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
+   hscif1: serial@e62c8000 {
+   compatible = "renesas,hscif-r8a7792", "renesas,rcar-gen2-hscif",
+"renesas,hscif";
+   reg = <0 0xe62c8000 0 96>;
+   interrupts = ;
+   clocks = <_clks R8A7792_CLK_HSCIF1>, <_clk>,
+<_clk>;
+   clock-names = "fck", "brg_int", "scif_clk";
+   dmas = < 0x4d>, < 0x4e>,
+  < 0x4d>, < 0x4e>;
+   dma-names = "tx", "rx", "tx", "rx";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   status = "disabled";
+   };
+
clocks {
#address-cells = <2>;
#size-cells = <2>;



[PATCH 08/13] ARM: dts: r8a7792: add SYS-DMAC support

2016-05-31 Thread Sergei Shtylyov
Describe SYS-DMAC0/1 in the R8A7792 device tree.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/r8a7792.dtsi |   60 +
 1 file changed, 60 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
===
--- renesas.orig/arch/arm/boot/dts/r8a7792.dtsi
+++ renesas/arch/arm/boot/dts/r8a7792.dtsi
@@ -80,6 +80,66 @@
#power-domain-cells = <1>;
};
 
+   dmac0: dma-controller@e670 {
+   compatible = "renesas,dmac-r8a7792", "renesas,rcar-dmac";
+   reg = <0 0xe670 0 0x2>;
+   interrupts = ;
+   interrupt-names = "error",
+ "ch0", "ch1", "ch2", "ch3", "ch4", "ch5",
+ "ch6", "ch7", "ch8", "ch9", "ch10", "ch11",
+ "ch12", "ch13", "ch14";
+   clocks = <_clks R8A7792_CLK_SYS_DMAC0>;
+   clock-names = "fck";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   #dma-cells = <1>;
+   dma-channels = <15>;
+   };
+
+   dmac1: dma-controller@e672 {
+   compatible = "renesas,dmac-r8a7792", "renesas,rcar-dmac";
+   reg = <0 0xe672 0 0x2>;
+   interrupts = ;
+   interrupt-names = "error",
+ "ch0", "ch1", "ch2", "ch3", "ch4", "ch5",
+ "ch6", "ch7", "ch8", "ch9", "ch10", "ch11",
+ "ch12", "ch13", "ch14";
+   clocks = <_clks R8A7792_CLK_SYS_DMAC1>;
+   clock-names = "fck";
+   power-domains = < R8A7792_PD_ALWAYS_ON>;
+   #dma-cells = <1>;
+   dma-channels = <15>;
+   };
+
clocks {
#address-cells = <2>;
#size-cells = <2>;



[PATCH 07/13] ARM: dts: r8a7792: initial SoC device tree

2016-05-31 Thread Sergei Shtylyov
The initial R8A7792 SoC device tree including 2 CPU cores, GIC, timer, SYSC,
and the required  clock descriptions.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/boot/dts/r8a7792.dtsi |  423 +
 1 file changed, 423 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7792.dtsi
===
--- /dev/null
+++ renesas/arch/arm/boot/dts/r8a7792.dtsi
@@ -0,0 +1,423 @@
+/*
+ * Device Tree Source for the r8a7792 SoC
+ *
+ * Copyright (C) 2016 Cogent Embedded Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "renesas,r8a7792";
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0>;
+   clock-frequency = <10>;
+   clocks = <_clocks R8A7792_CLK_Z>;
+   power-domains = < R8A7792_PD_CA15_CPU0>;
+   next-level-cache = <_CA15>;
+   };
+
+   cpu1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <1>;
+   clock-frequency = <10>;
+   power-domains = < R8A7792_PD_CA15_CPU1>;
+   next-level-cache = <_CA15>;
+   };
+
+   L2_CA15: cache-controller@0 {
+   compatible = "cache";
+   reg = <0>;
+   cache-unified;
+   cache-level = <2>;
+   power-domains = < R8A7792_PD_CA15_SCU>;
+   };
+   };
+
+   gic: interrupt-controller@f1001000 {
+   compatible = "arm,gic-400";
+   #interrupt-cells = <3>;
+   interrupt-controller;
+   reg = <0 0xf1001000 0 0x1000>,
+ <0 0xf1002000 0 0x1000>,
+ <0 0xf1004000 0 0x2000>,
+ <0 0xf1006000 0 0x2000>;
+   interrupts = ;
+   };
+
+   timer {
+   compatible = "arm,armv7-timer";
+   interrupts = ,
+,
+,
+;
+   };
+
+   sysc: system-controller@e618 {
+   compatible = "renesas,r8a7792-sysc";
+   reg = <0 0xe618 0 0x0200>;
+   #power-domain-cells = <1>;
+   };
+
+   clocks {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   /* External root clock */
+   extal_clk: extal {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   /* This value must be overridden by the board. */
+   clock-frequency = <0>;
+   };
+
+   /* External PCIe clock - can be overridden by the board */
+   pcie_bus_clk: pcie_bus {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   /* External SCIF clock */
+   scif_clk: scif {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   /* This value must be overridden by the board. */
+   clock-frequency = <0>;
+   };
+
+   /*
+* The external audio clocks are configured as 0 Hz fixed
+* frequency clocks by default.  Boards that provide audio
+* clocks should override them.
+*/
+   audio_clka: audio_clka {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+   audio_clkb: audio_clkb {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+   audio_clkc: audio_clkc {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <0>;
+   };
+
+   /* Special CPG clocks */
+   cpg_clocks: cpg_clocks@e615 {
+   compatible = "renesas,r8a7792-cpg-clocks",
+

[PATCH 05/13] DT: clock: rcar-gen2-cpg-clocks: document R8A7792 support

2016-05-31 Thread Sergei Shtylyov
Renesas R8A7792 SoC is a member of the R-Car gen2 family and so has CPG...

Signed-off-by: Sergei Shtylyov 

---
 Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt |
1 +
 1 file changed, 1 insertion(+)

Index: 
renesas/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
===
--- 
renesas.orig/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
+++ 
renesas/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
@@ -10,6 +10,7 @@ Required Properties:
   - compatible: Must be one of
 - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG
 - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG
+- "renesas,r8a7792-cpg-clocks" for the r8a7792 CPG
 - "renesas,r8a7793-cpg-clocks" for the r8a7793 CPG
 - "renesas,r8a7794-cpg-clocks" for the r8a7794 CPG
 and "renesas,rcar-gen2-cpg-clocks" as a fallback.



[PATCH 04/13] ARM: shmobile: r8a7792: basic SoC support

2016-05-31 Thread Sergei Shtylyov
Add minimal support for the R-Car V2H (R8A7792) SoC.

Signed-off-by: Sergei Shtylyov 

---
 arch/arm/mach-shmobile/Kconfig |5 
 arch/arm/mach-shmobile/Makefile|1 
 arch/arm/mach-shmobile/setup-r8a7792.c |   34 +
 3 files changed, 40 insertions(+)

Index: renesas/arch/arm/mach-shmobile/Kconfig
===
--- renesas.orig/arch/arm/mach-shmobile/Kconfig
+++ renesas/arch/arm/mach-shmobile/Kconfig
@@ -86,6 +86,11 @@ config ARCH_R8A7791
select ARCH_RCAR_GEN2
select I2C
 
+config ARCH_R8A7792
+   bool "R-Car V2H (R8A77920)"
+   select ARCH_RCAR_GEN2
+   select I2C
+
 config ARCH_R8A7793
bool "R-Car M2-N (R8A7793)"
select ARCH_RCAR_GEN2
Index: renesas/arch/arm/mach-shmobile/Makefile
===
--- renesas.orig/arch/arm/mach-shmobile/Makefile
+++ renesas/arch/arm/mach-shmobile/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_ARCH_R8A7778)+= setup-r8a7
 obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
 obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o
+obj-$(CONFIG_ARCH_R8A7792) += setup-r8a7792.o
 obj-$(CONFIG_ARCH_R8A7793) += setup-r8a7793.o
 obj-$(CONFIG_ARCH_R8A7794) += setup-r8a7794.o
 obj-$(CONFIG_ARCH_EMEV2)   += setup-emev2.o
Index: renesas/arch/arm/mach-shmobile/setup-r8a7792.c
===
--- /dev/null
+++ renesas/arch/arm/mach-shmobile/setup-r8a7792.c
@@ -0,0 +1,34 @@
+/*
+ * r8a7792 processor support
+ *
+ * Copyright (C) 2014  Renesas Electronics Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+
+#include 
+
+#include "common.h"
+#include "rcar-gen2.h"
+
+static const char * const r8a7792_boards_compat_dt[] __initconst = {
+   "renesas,r8a7792",
+   NULL,
+};
+
+DT_MACHINE_START(R8A7792_DT, "Generic R8A7792 (Flattened Device Tree)")
+   .init_early = shmobile_init_delay,
+   .init_late  = shmobile_init_late,
+   .init_time  = rcar_gen2_timer_init,
+   .reserve= rcar_gen2_reserve,
+   .dt_compat  = r8a7792_boards_compat_dt,
+MACHINE_END



[PATCH 03/13] soc: renesas: rcar-sysc: add R8A7792 support

2016-05-31 Thread Sergei Shtylyov
Add support for R-Car V2H (R8A7792) SoC power areas to the SYSC driver.

Signed-off-by: Sergei Shtylyov 

---
 drivers/soc/renesas/Makefile   |1 +
 drivers/soc/renesas/r8a7792-sysc.c |   34 ++
 drivers/soc/renesas/rcar-sysc.c|3 +++
 drivers/soc/renesas/rcar-sysc.h|1 +
 4 files changed, 39 insertions(+)

Index: renesas/drivers/soc/renesas/Makefile
===
--- renesas.orig/drivers/soc/renesas/Makefile
+++ renesas/drivers/soc/renesas/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARCH_R8A7779) += rcar-sysc.o r8a7779-sysc.o
 obj-$(CONFIG_ARCH_R8A7790) += rcar-sysc.o r8a7790-sysc.o
 obj-$(CONFIG_ARCH_R8A7791) += rcar-sysc.o r8a7791-sysc.o
+obj-$(CONFIG_ARCH_R8A7792) += rcar-sysc.o r8a7792-sysc.o
 # R-Car M2-N is identical to R-Car M2-W w.r.t. power domains.
 obj-$(CONFIG_ARCH_R8A7793) += rcar-sysc.o r8a7791-sysc.o
 obj-$(CONFIG_ARCH_R8A7794) += rcar-sysc.o r8a7794-sysc.o
Index: renesas/drivers/soc/renesas/r8a7792-sysc.c
===
--- /dev/null
+++ renesas/drivers/soc/renesas/r8a7792-sysc.c
@@ -0,0 +1,34 @@
+/*
+ * Renesas R-Car V2H (R8A7792) System Controller
+ *
+ * Copyright (C) 2016 Cogent Embedded Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a7792_areas[] __initconst = {
+   { "always-on",  0, 0, R8A7792_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
+   { "ca15-scu",   0x180, 0, R8A7792_PD_CA15_SCU,  R8A7792_PD_ALWAYS_ON,
+ PD_SCU },
+   { "ca15-cpu0",   0x40, 0, R8A7792_PD_CA15_CPU0, R8A7792_PD_CA15_SCU,
+ PD_CPU_NOCR },
+   { "ca15-cpu1",   0x40, 1, R8A7792_PD_CA15_CPU1, R8A7792_PD_CA15_SCU,
+ PD_CPU_NOCR },
+   { "sgx", 0xc0, 0, R8A7792_PD_SGX,   R8A7792_PD_ALWAYS_ON },
+   { "imp",0x140, 0, R8A7792_PD_IMP,   R8A7792_PD_ALWAYS_ON },
+};
+
+const struct rcar_sysc_info r8a7792_sysc_info __initconst = {
+   .areas = r8a7792_areas,
+   .num_areas = ARRAY_SIZE(r8a7792_areas),
+};
Index: renesas/drivers/soc/renesas/rcar-sysc.c
===
--- renesas.orig/drivers/soc/renesas/rcar-sysc.c
+++ renesas/drivers/soc/renesas/rcar-sysc.c
@@ -293,6 +293,9 @@ static const struct of_device_id rcar_sy
 #ifdef CONFIG_ARCH_R8A7791
{ .compatible = "renesas,r8a7791-sysc", .data = _sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A7792
+   { .compatible = "renesas,r8a7792-sysc", .data = _sysc_info },
+#endif
 #ifdef CONFIG_ARCH_R8A7793
/* R-Car M2-N is identical to R-Car M2-W w.r.t. power domains. */
{ .compatible = "renesas,r8a7793-sysc", .data = _sysc_info },
Index: renesas/drivers/soc/renesas/rcar-sysc.h
===
--- renesas.orig/drivers/soc/renesas/rcar-sysc.h
+++ renesas/drivers/soc/renesas/rcar-sysc.h
@@ -53,6 +53,7 @@ struct rcar_sysc_info {
 extern const struct rcar_sysc_info r8a7779_sysc_info;
 extern const struct rcar_sysc_info r8a7790_sysc_info;
 extern const struct rcar_sysc_info r8a7791_sysc_info;
+extern const struct rcar_sysc_info r8a7792_sysc_info;
 extern const struct rcar_sysc_info r8a7794_sysc_info;
 extern const struct rcar_sysc_info r8a7795_sysc_info;
 #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */



[PATCH 02/13] ARM: shmobile: r8a7792: add power domain index macros

2016-05-31 Thread Sergei Shtylyov
Add macros usable by the device tree sources to reference R8A7792 SYSC power
domains by index.

Signed-off-by: Sergei Shtylyov 

---
 include/dt-bindings/power/r8a7792-sysc.h |   26 ++
 1 file changed, 26 insertions(+)

Index: renesas/include/dt-bindings/power/r8a7792-sysc.h
===
--- /dev/null
+++ renesas/include/dt-bindings/power/r8a7792-sysc.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2016 Cogent Embedded Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+#ifndef __DT_BINDINGS_POWER_R8A7792_SYSC_H__
+#define __DT_BINDINGS_POWER_R8A7792_SYSC_H__
+
+/*
+ * These power domain indices match the numbers of the interrupt bits
+ * representing the power areas in the various Interrupt Registers
+ * (e.g. SYSCISR, Interrupt Status Register)
+ */
+
+#define R8A7792_PD_CA15_CPU0   0
+#define R8A7792_PD_CA15_CPU1   1
+#define R8A7792_PD_CA15_SCU12
+#define R8A7792_PD_SGX 20
+#define R8A7792_PD_IMP 24
+
+/* Always-on power area */
+#define R8A7792_PD_ALWAYS_ON   32
+
+#endif /* __DT_BINDINGS_POWER_R8A7792_SYSC_H__ */



[PATCH net-next v2] ravb: Add ESF in RCR for enabling separation filter

2016-05-31 Thread Yoshihiro Kaneko
From: Masaru Nagai 

The H/W manual recommends B'10 or B'11 in a value of the separation
filtering select bits in the receive configuration register (RCR.ESF).
When B'10 is set, frames from non-matching streams are discarded.
When B'11 is set, frames from non-matching streams are processed in
reception queue 0 (best effort).
This patch sets B'11 in ESF.

[ykaneko0...@gmail.com: revised this commit message]
Signed-off-by: Masaru Nagai 
Signed-off-by: Kazuya Mizuguchi 
Signed-off-by: Yoshihiro Kaneko 
Acked-by: Sergei Shtylyov 
---

This patch is based on the master branch of David Miller's next networking
tree.

v2 [Yoshihiro Kaneko]
  - Revised the commit message
  - Added Acked-by

 drivers/net/ethernet/renesas/ravb_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c 
b/drivers/net/ethernet/renesas/ravb_main.c
index 867caf6..1ceadbf 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -402,7 +402,8 @@ static int ravb_dmac_init(struct net_device *ndev)
 #endif
 
/* Set AVB RX */
-   ravb_write(ndev, RCR_EFFS | RCR_ENCF | RCR_ETS0 | 0x1800, RCR);
+   ravb_write(ndev,
+  RCR_EFFS | RCR_ENCF | RCR_ETS0 | RCR_ESF | 0x1800, RCR);
 
/* Set FIFO size */
ravb_write(ndev, TGC_TQP_AVBMODE1 | 0x0000, TGC);
-- 
1.9.1



Re: [PATCH net-next] ravb: Add ESF in RCR for enabling separation filter

2016-05-31 Thread Yoshihiro Kaneko
Hi Sergei,

2016-05-31 6:19 GMT+09:00 Sergei Shtylyov :
> On 05/30/2016 05:30 PM, Sergei Shtylyov wrote:
>
>>> From: Masaru Nagai 
>>>
>>> This patch adds enabling separation filter(ESF) is setting value of B'11.
>>> This setting filter for separating AVB stream frames from non-AVB stream
>>> frames is enabled. Non-matching frames from a stream are processed in
>>> queue 0(best effort). H/W manual recommends B'11 or B'10.
>>> When B'10 is setting, Non-mating frames are discarded.
>>
>>
>>It was somewhat hard for me to parse that...
>
>
>Forgot about s/Non-mating/Non-matching/.

Thanks for your review.
I will revise the commit message.

Thanks,
kaneko

>
>
>>> Signed-off-by: Masaru Nagai 
>>> Signed-off-by: Kazuya Mizuguchi 
>>> Signed-off-by: Yoshihiro Kaneko 
>>
>>
>> Acked-by: Sergei Shtylyov 
>
>
> MBR, Sergei
>


Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()

2016-05-31 Thread Mark Brown
On Tue, May 31, 2016 at 02:08:31AM +, Kuninori Morimoto wrote:

> > There was some recent discussion about a more complete core binding
> > for this based on the work that Dylan Reid had been pushing a while ago
> > - it's not clear that the simple-card binding is great for
> > generalization here.

> Can you show me where can I see it ?
> Anyway, I will keep this related function as static in simple-card,
> not simple-card-utils in v2.

This is the proposal from Dylan I was thinking of:

   http://thread.gmane.org/gmane.linux.alsa.devel/138906


signature.asc
Description: PGP signature


[PATCH] phy: rcar-gen3-usb2: fix unexpected repeat interrupts of VBUS change

2016-05-31 Thread Yoshihiro Shimoda
This patch fixes an issue that the driver is possible to cause
unexpected repeat interrupts if a board condition is wrong
(e.g. even if the ID pin is as function, a board supplies the VBUS.)

The reason why unexpected repeat interrupts happen is:
 1) The driver changed the mode to function if it detected the ID pin
is high and the VBUS is high.
 2) After the driver changed function mode, it disabled the "VBUS control"
feature. Then, the VBUS signal will be low.
 3) Since the VBUS change interruption happened, the driver checked
the ID pin and VBUS.
 4) Since VBUS was low, the driver changed the mode to host and enabled
the "VBUS control" feature. Then the VBUS signal will be high.
 5) Since the VBUS change interruption happened, the driver did 1) above.

So, this patch modified the condition in rcar_gen3_device_recognition()
to check the ID pin only.

Fixes: 1114e2d (phy: rcar-gen3-usb2: change the mode to OTG on the combined 
channel)
Cc:  # v4.5+
Reported-by: Simon Horman 
Signed-off-by: Yoshihiro Shimoda 
---
 drivers/phy/phy-rcar-gen3-usb2.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index 76bb88f..4be3f5d 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan 
*ch)
extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
 }
 
-static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
-{
-   return !!(readl(ch->base + USB2_ADPCTRL) &
- USB2_ADPCTRL_OTGSESSVLD);
-}
-
 static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 {
return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
@@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
 
 static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
 {
-   bool is_host = true;
-
-   /* B-device? */
-   if (rcar_gen3_check_id(ch) && rcar_gen3_check_vbus(ch))
-   is_host = false;
-
-   if (is_host)
+   if (!rcar_gen3_check_id(ch))
rcar_gen3_init_for_host(ch);
else
rcar_gen3_init_for_peri(ch);
-- 
1.9.1



DRM/KMS automated tests

2016-05-31 Thread Ulrich Hecht
Hi!

I have cobbled together a bunch of scripts to test the atomic updates
API, based around kms++; see here:

https://github.com/uli/kmsxx/tree/autotest

Instructions on how to set up the environment can be found here:

http://elinux.org/User:Uli/Tests:KMS

Currently, tests try various sensible and nonsensical combinations of
source and destination properties and check if the driver behaves
reasonably.

Test results look like this:

1. Lager:
# bash run_tests.sh
aaa_sanity.py
Testing connector VGA-1
PASS
atomic_flip.py  PASS
atomic_set_plane.py  PASS
atomic_small_dest.py  PASS
atomic_small_fb.py  PASS
fb_large.py  PASS
fb_small.py  PASS
mode_invalid.py  PASS
mode_reset.py  PASS
mode_set_all.py  PASS

10 passed, 0 failed, 0 skipped

2. Salvator-X:
# bash run_tests.sh
aaa_sanity.py
Testing connector VGA-1
PASS
atomic_flip.py  PASS
atomic_set_plane.py  FAIL
atomic_small_dest.py  PASS
atomic_small_fb.py  PASS
fb_large.py  PASS
fb_small.py  PASS
mode_invalid.py  PASS
mode_reset.py  PASS
mode_set_all.py  PASS

9 passed, 1 failed, 0 skipped

I have not yet looked at the FAIL on Salvator-X (might well be that
the test is bogus) because there is a bigger issue there. After
running the tests a couple of times, framebuffer allocation starts to
fail:

[  956.562285] rcar-du feb0.display: failed to allocate buffer
with size 3145728
[  957.130012] rcar-du feb0.display: failed to allocate buffer
with size 3145728
[  957.689012] rcar-du feb0.display: failed to allocate buffer
with size 3194880
[  959.926459] rcar-du feb0.display: failed to allocate buffer
with size 1921024
[...]

This does not happen on Lager, and I use the same 32-bit userspace for
both platforms. I guess there must be a memory leak in the driver
somewhere. Is this a known issue?

CU
Uli


[PATCH V2 26/31] staging: ks7010: remove supported card table with one element

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

There is only this card supported, no need to iterate over the table.
The resulting firmware filename wasn't used anyway, but came from the
config file or hardcoded default.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_sdio.c | 31 ++-
 drivers/staging/ks7010/ks7010_sdio.h |  2 --
 2 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index ed4d579300ad96..8e8476b52cedbc 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -35,19 +35,6 @@ static const struct sdio_device_id if_sdio_ids[] = {
{ /* all zero */ }
 };
 
-struct ks_sdio_model {
-   int model;
-   const char *firmware;
-};
-
-static struct ks_sdio_model ks_sdio_models[] = {
-   {
-   /* ks7010 */
-   .model = 0x10,
-   .firmware = "ks7010sd.rom",
-   },
-};
-
 static int ks7910_sdio_probe(struct sdio_func *function,
 const struct sdio_device_id *device);
 static void ks7910_sdio_remove(struct sdio_func *function);
@@ -996,7 +983,7 @@ static int ks7910_sdio_probe(struct sdio_func *func,
struct ks_sdio_card *card;
struct net_device *netdev;
unsigned char rw_data;
-   int i = 0, ret;
+   int ret;
 
DPRINTK(5, "ks7910_sdio_probe()\n");
 
@@ -1009,22 +996,8 @@ static int ks7910_sdio_probe(struct sdio_func *func,
return -ENOMEM;
 
card->func = func;
-   card->model = 0x10;
spin_lock_init(>lock);
 
-   /* select model */
-   for (i = 0; i < ARRAY_SIZE(ks_sdio_models); i++) {
-   if (card->model == ks_sdio_models[i].model)
-   break;
-   }
-
-   if (i == ARRAY_SIZE(ks_sdio_models)) {
-   DPRINTK(5, "unkown card model 0x%x\n", card->model);
-   goto error;
-   }
-
-   card->firmware = ks_sdio_models[i].firmware;
-
/*** Initialize  SDIO ***/
sdio_claim_host(func);
 
@@ -1172,7 +1145,7 @@ static int ks7910_sdio_probe(struct sdio_func *func,
sdio_release_host(func);
sdio_set_drvdata(func, NULL);
kfree(card);
- error:
+
return -ENODEV;
 }
 
diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index aea3727caf483b..2d7be5dae157c7 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -109,8 +109,6 @@ struct ks_sdio_packet {
 struct ks_sdio_card {
struct sdio_func *func;
struct ks_wlan_private *priv;
-   int model;
-   const char *firmware;
spinlock_t lock;
 };
 
-- 
2.8.1



[PATCH V2 06/31] staging: ks7010: avoid workqueue races

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

My Spectec SDW823 card oopsed when it was already inserted during boot.
When debugging this, I noticed that the card init was done in a seperate
workqueue which was only activated once in probe. After removing the
workqueue and calling the card init directly from probe, the OOPS went
away. It turned out this is the same OOPS which happened when removing
the card, so this seems possible now. Note: There is still a
not-understood card-removed event during boot, but at least it doesn't
crash anymore and the card will be re-probed right away.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/TODO  |  1 -
 drivers/staging/ks7010/ks7010_sdio.c | 28 ++--
 drivers/staging/ks7010/ks7010_sdio.h |  2 --
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/ks7010/TODO b/drivers/staging/ks7010/TODO
index 390e821efc0bcf..5cbb4ca999747e 100644
--- a/drivers/staging/ks7010/TODO
+++ b/drivers/staging/ks7010/TODO
@@ -28,7 +28,6 @@ Now the TODOs:
   should understand the change you submit.
 - drop using a config file and use an upstream technique for configuration
 - fix the 'card removal' event when card is inserted when booting
-- driver crashes when removing the card
 - check what other upstream wireless mechanisms can be used instead of the
   custom ones here
 
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9300658c4aed8d..5b78522fad1ec1 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -817,14 +817,8 @@ static int ks79xx_upload_firmware(ks_wlan_private *priv, 
struct ks_sdio_card *ca
return rc;
 }
 
-static void card_init_task(struct work_struct *work)
+static void ks7010_card_init(struct ks_wlan_private *priv)
 {
-   struct hw_info_t *hw;
-   struct ks_wlan_private *priv;
-
-   hw = container_of(work, struct hw_info_t, init_task);
-   priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw);
-
DPRINTK(5,"\ncard_init_task()\n");
 
/* init_waitqueue_head(>confirm_wait); */
@@ -1052,23 +1046,11 @@ static int ks7910_sdio_probe(struct sdio_func *func, 
const struct sdio_device_id
goto error_free_read_buf;
}
 
-   priv->ks_wlan_hw.ks7010sdio_init = 
create_singlethread_workqueue("ks7010sdio_init");
-   if(!priv->ks_wlan_hw.ks7010sdio_init){
-   DPRINTK(1, "create_workqueue failed !!\n");
-   goto error_free_sdio_wq;
-   }
-
-   INIT_WORK(>ks_wlan_hw.init_task, card_init_task);
INIT_DELAYED_WORK(>ks_wlan_hw.rw_wq, ks7010_rw_function);
-
-   queue_work(priv->ks_wlan_hw.ks7010sdio_init, 
>ks_wlan_hw.init_task);
+   ks7010_card_init(priv);
 
return 0;
 
-error_free_sdio_wq:
-   flush_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
-   destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);
-   priv->ks_wlan_hw.ks7010sdio_wq = NULL;
 error_free_read_buf:
kfree(priv->ks_wlan_hw.read_buf);
priv->ks_wlan_hw.read_buf = NULL;
@@ -1139,12 +1121,6 @@ static void ks7910_sdio_remove(struct sdio_func *func)
}
DPRINTK(1, 
"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);\n");
 
-   if(priv->ks_wlan_hw.ks7010sdio_init){
-   flush_workqueue(priv->ks_wlan_hw.ks7010sdio_init);
-   destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_init);
-   }
-   DPRINTK(1, 
"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_init);\n");
-
hostif_exit(priv);
DPRINTK(1, "hostif_exit\n");
 
diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index 5bf01abbf2ab6c..93823837f19e65 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -96,8 +96,6 @@ struct hw_info_t {
struct ks_sdio_card *sdio_card; 
struct completion ks7010_sdio_wait;
struct workqueue_struct *ks7010sdio_wq;
-   struct workqueue_struct *ks7010sdio_init;
-   struct work_struct init_task;
struct delayed_work rw_wq;
unsigned char   *read_buf;
struct tasklet_struct rx_bh_task;
-- 
2.8.1



[PATCH V2 24/31] staging: ks7010: indent michael_mic.h

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/michael_mic.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/ks7010/michael_mic.h 
b/drivers/staging/ks7010/michael_mic.h
index f14f160ad46549..57ecbe34153202 100644
--- a/drivers/staging/ks7010/michael_mic.h
+++ b/drivers/staging/ks7010/michael_mic.h
@@ -16,14 +16,14 @@
 struct michel_mic_t {
uint32_t K0;// Key 
uint32_t K1;// Key 
-   uint32_t L; // Current state 
-   uint32_t R; // Current state 
-   uint8_t M[4];   // Message accumulator (single word) 
-   int nBytesInM;  // # bytes in M 
-   uint8_t Result[8];
+   uint32_t L; // Current state 
+   uint32_t R; // Current state 
+   uint8_t M[4];   // Message accumulator (single word) 
+   int nBytesInM;  // # bytes in M 
+   uint8_t Result[8];
 };
 
 extern
-void MichaelMICFunction( struct michel_mic_t *Mic, uint8_t *Key, 
-uint8_t *Data, int Len, uint8_t priority, 
-uint8_t *Result );
+void MichaelMICFunction(struct michel_mic_t *Mic, uint8_t * Key,
+   uint8_t * Data, int Len, uint8_t priority,
+   uint8_t * Result);
-- 
2.8.1



[PATCH V2 25/31] staging: ks7010: indent ks7010_sdio.c

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Unlike the previous patches which are plain indent outcomes, this has
some manual fixups to be not overly strict with the 80 char limit.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_sdio.c | 807 ---
 1 file changed, 460 insertions(+), 347 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index fb9f0b533d867e..ed4d579300ad96 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -30,31 +30,32 @@
 static int reg_net = 0;
 
 static const struct sdio_device_id if_sdio_ids[] = {
-   { SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010) },
-   { SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010) },
+   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)},
+   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010)},
{ /* all zero */ }
 };
 
 struct ks_sdio_model {
-int model;
-const char *firmware;
+   int model;
+   const char *firmware;
 };
 
 static struct ks_sdio_model ks_sdio_models[] = {
-{
-/* ks7010 */
-.model = 0x10,
-.firmware = "ks7010sd.rom",
-},
+   {
+   /* ks7010 */
+   .model = 0x10,
+   .firmware = "ks7010sd.rom",
+   },
 };
 
-static int ks7910_sdio_probe(struct sdio_func *function, const struct 
sdio_device_id *device);
+static int ks7910_sdio_probe(struct sdio_func *function,
+const struct sdio_device_id *device);
 static void ks7910_sdio_remove(struct sdio_func *function);
 static void ks7010_rw_function(struct work_struct *work);
-static int ks7010_sdio_read( struct ks_wlan_private *priv, unsigned int 
address,
-unsigned char *buffer, int length );
-static int ks7010_sdio_write( struct ks_wlan_private *priv, unsigned int 
address,
- unsigned char *buffer, int length );
+static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,
+   unsigned char *buffer, int length);
+static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int 
address,
+unsigned char *buffer, int length);
 /* macro */
 
 #define inc_txqhead(priv) \
@@ -79,25 +80,25 @@ void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private 
*priv)
DPRINTK(4, "\n");
 
/* clear request */
-   atomic_set(>sleepstatus.doze_request,0);
+   atomic_set(>sleepstatus.doze_request, 0);
 
-   if( atomic_read(>sleepstatus.status) == 0){
+   if (atomic_read(>sleepstatus.status) == 0) {
rw_data = GCR_B_DOZE;
-   retval = ks7010_sdio_write(priv, GCR_B, _data, 
sizeof(rw_data));
-   if(retval){
+   retval =
+   ks7010_sdio_write(priv, GCR_B, _data, sizeof(rw_data));
+   if (retval) {
DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
goto out;
}
DPRINTK(4, "PMG SET!! : GCR_B=%02X\n", rw_data);
-   DPRINTK(3,"sleep_mode=SLP_SLEEP\n");
+   DPRINTK(3, "sleep_mode=SLP_SLEEP\n");
atomic_set(>sleepstatus.status, 1);
-   priv->last_doze = jiffies;
-   }
-   else{
-   DPRINTK(1,"sleep_mode=%d\n",priv->sleep_mode);
+   priv->last_doze = jiffies;
+   } else {
+   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
}
 
-out:
+ out:
priv->sleep_mode = atomic_read(>sleepstatus.status);
return;
 }
@@ -110,110 +111,126 @@ void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
DPRINTK(4, "\n");
 
/* clear request */
-   atomic_set(>sleepstatus.wakeup_request,0);
+   atomic_set(>sleepstatus.wakeup_request, 0);
 
-   if( atomic_read(>sleepstatus.status) == 1){
+   if (atomic_read(>sleepstatus.status) == 1) {
rw_data = WAKEUP_REQ;
-   retval = ks7010_sdio_write(priv, WAKEUP, _data, 
sizeof(rw_data));
-   if(retval){
+   retval =
+   ks7010_sdio_write(priv, WAKEUP, _data, sizeof(rw_data));
+   if (retval) {
DPRINTK(1, " error : WAKEUP=%02X\n", rw_data);
goto out;
}
DPRINTK(4, "wake up : WAKEUP=%02X\n", rw_data);
atomic_set(>sleepstatus.status, 0);
-   priv->last_wakeup = jiffies;
+   priv->last_wakeup = jiffies;
++priv->wakeup_count;
-   }
-   else{
-   DPRINTK(1,"sleep_mode=%d\n",priv->sleep_mode);
+   } else {
+   DPRINTK(1, "sleep_mode=%d\n", priv->sleep_mode);
}
 
-out:
+ out:
  

[PATCH V2 05/31] staging: ks7010: remove code for old kernel versions

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

No need to be backwards compatible.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_hostif.c   |  9 -
 drivers/staging/ks7010/ks_wlan.h | 28 +---
 drivers/staging/ks7010/ks_wlan_net.c |  3 ---
 3 files changed, 1 insertion(+), 39 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 6bea699655eec4..146a1357909b39 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -2103,11 +2103,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
 
 struct net_device *dev = priv->net_dev;
int mc_count;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
struct netdev_hw_addr *ha;
-#else
-   struct dev_mc_list *mclist;
-#endif
charset_address[NIC_MAX_MCAST_LIST*ETH_ALEN];
unsigned long filter_type;
int i;
@@ -2131,14 +2127,9 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
else {
if (priv->sme_i.sme_flag & SME_MULTICAST){
mc_count = netdev_mc_count(dev);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
netdev_for_each_mc_addr(ha, dev) {
memcpy(_address[i*ETH_ALEN], ha->addr, 
ETH_ALEN);
}
-#else
-   for (i = 0, mclist = dev->mc_list; mclist && i < 
mc_count; i++, mclist = mclist->next)
-   memcpy(_address[i*ETH_ALEN], 
mclist->dmi_addr, ETH_ALEN);
-#endif
priv->sme_i.sme_flag &= ~SME_MULTICAST;
hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
   (ETH_ALEN*mc_count), 
MIB_VALUE_TYPE_OSTRING, _address[0]);
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 329a062419fe4a..6bd016414a4f1d 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -18,9 +18,6 @@
 #define WPS
 
 #include 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) 
-#include 
-#endif
 #include 
 #include 
 #include 
@@ -35,32 +32,9 @@
 #include/* struct timer_list */
 #include 
 #include/* struct completion */
-
-#include 
-
-/* Workqueue / task queue backwards compatibility stuff */
-#if ((LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)) || (defined _MVL31_) || 
(defined _CELF3_))
 #include 
-#else
-#include 
-#define work_struct tq_struct
-#define INIT_WORK INIT_TQUEUE
-#define schedule_work schedule_task
-#endif
 
-/* Interrupt handler backwards compatibility stuff */
-/*
-#ifndef IRQ_NONE
-#define IRQ_NONE
-#define IRQ_HANDLED
-typedef void irqreturn_t;
-#endif
-*/
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
-#define free_netdev(x) kfree(x) 
-#define pci_name(x) x->slot_name 
-#endif
+#include 
 
 #include "ks7010_sdio.h"
 
diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 185630cb423d5e..776a544031495f 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -13,9 +13,6 @@
  */
 
 #include 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
-#include 
-#endif
 #include 
 #include 
 #include 
-- 
2.8.1



[PATCH V2 10/31] staging: ks7010: really iterate over multicast addresses

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

The loop variable was defined but not really used. Fix this.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_hostif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 367d487cef1ba8..b0a0a53d3a00bf 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -2105,7 +2105,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
struct netdev_hw_addr *ha;
charset_address[NIC_MAX_MCAST_LIST*ETH_ALEN];
unsigned long filter_type;
-   int i;
+   int i = 0;
 
DPRINTK(3,"\n");
 
@@ -2128,6 +2128,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)
mc_count = netdev_mc_count(dev);
netdev_for_each_mc_addr(ha, dev) {
memcpy(_address[i*ETH_ALEN], ha->addr, 
ETH_ALEN);
+   i++;
}
priv->sme_i.sme_flag &= ~SME_MULTICAST;
hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
-- 
2.8.1



[PATCH V2 15/31] staging: ks7010: indent eap_packet.h

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/eap_packet.h | 49 ++---
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/ks7010/eap_packet.h 
b/drivers/staging/ks7010/eap_packet.h
index b664bdd8c961db..88384fb19d9580 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -14,13 +14,13 @@
 #endif
 
 struct ether_hdr {
-   unsigned char   h_dest[ETH_ALEN];   /* destination eth addr */
-   unsigned char   h_source[ETH_ALEN]; /* source ether addr*/
-   unsigned char   h_dest_snap;
-   unsigned char   h_source_snap;
-   unsigned char   h_command;
-   unsigned char   h_vendor_id[3];
-   unsigned short  h_proto;/* packet type ID field */
+   unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+   unsigned char h_source[ETH_ALEN];   /* source ether addr*/
+   unsigned char h_dest_snap;
+   unsigned char h_source_snap;
+   unsigned char h_command;
+   unsigned char h_vendor_id[3];
+   unsigned short h_proto; /* packet type ID field */
 #define ETHER_PROTOCOL_TYPE_EAP0x888e
 #define ETHER_PROTOCOL_TYPE_IP 0x0800
 #define ETHER_PROTOCOL_TYPE_ARP0x0806
@@ -37,15 +37,15 @@ struct ieee802_1x_hdr {
 #define EAPOL_VERSION 2
 
 enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
-   IEEE802_1X_TYPE_EAPOL_START = 1,
-   IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
-   IEEE802_1X_TYPE_EAPOL_KEY = 3,
-   IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
+   IEEE802_1X_TYPE_EAPOL_START = 1,
+   IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
+   IEEE802_1X_TYPE_EAPOL_KEY = 3,
+   IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
 };
 
 enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
-   EAPOL_KEY_TYPE_WPA = 254 };
-
+   EAPOL_KEY_TYPE_WPA = 254
+};
 
 #define IEEE8021X_REPLAY_COUNTER_LEN 8
 #define IEEE8021X_KEY_SIGN_LEN 16
@@ -60,11 +60,11 @@ struct ieee802_1x_eapol_key {
/* does not repeat within the life of the keying material used to
 * encrypt the Key field; 64-bit NTP timestamp MAY be used here */
unsigned char replay_counter[IEEE8021X_REPLAY_COUNTER_LEN];
-   unsigned char key_iv[IEEE8021X_KEY_IV_LEN]; /* cryptographically random 
number */
-   unsigned char key_index; /* key flag in the most significant bit:
-  * 0 = broadcast (default key),
-  * 1 = unicast (key mapping key); key index is in the
-  * 7 least significant bits */
+   unsigned char key_iv[IEEE8021X_KEY_IV_LEN]; /* cryptographically 
random number */
+   unsigned char key_index;/* key flag in the most significant bit:
+* 0 = broadcast (default key),
+* 1 = unicast (key mapping key); key 
index is in the
+* 7 least significant bits */
/* HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as
 * the key */
unsigned char key_signature[IEEE8021X_KEY_SIGN_LEN];
@@ -77,19 +77,18 @@ struct ieee802_1x_eapol_key {
 * RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */
 } __attribute__ ((packed));
 
-
 #define WPA_NONCE_LEN 32
 #define WPA_REPLAY_COUNTER_LEN 8
 
 struct wpa_eapol_key {
unsigned char type;
-   unsigned short key_info;
+   unsigned short key_info;
unsigned short key_length;
unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN];
unsigned char key_nonce[WPA_NONCE_LEN];
unsigned char key_iv[16];
unsigned char key_rsc[8];
-   unsigned char key_id[8]; /* Reserved in IEEE 802.11i/RSN */
+   unsigned char key_id[8];/* Reserved in IEEE 802.11i/RSN */
unsigned char key_mic[16];
unsigned short key_data_length;
/* followed by key_data_length bytes of key_data */
@@ -98,18 +97,18 @@ struct wpa_eapol_key {
 #define WPA_KEY_INFO_TYPE_MASK (WBIT(0) | WBIT(1) | WBIT(2))
 #define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 WBIT(0)
 #define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES WBIT(1)
-#define WPA_KEY_INFO_KEY_TYPE WBIT(3) /* 1 = Pairwise, 0 = Group key */
+#define WPA_KEY_INFO_KEY_TYPE WBIT(3)  /* 1 = Pairwise, 0 = Group key */
 /* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */
 #define WPA_KEY_INFO_KEY_INDEX_MASK (WBIT(4) | WBIT(5))
 #define WPA_KEY_INFO_KEY_INDEX_SHIFT 4
-#define WPA_KEY_INFO_INSTALL WBIT(6) /* pairwise */
-#define WPA_KEY_INFO_TXRX WBIT(6) /* group */
+#define WPA_KEY_INFO_INSTALL WBIT(6)   /* pairwise */
+#define WPA_KEY_INFO_TXRX WBIT(6)  /* group */
 #define WPA_KEY_INFO_ACK WBIT(7)
 #define WPA_KEY_INFO_MIC WBIT(8)
 #define WPA_KEY_INFO_SECURE WBIT(9)
 #define WPA_KEY_INFO_ERROR WBIT(10)
 #define WPA_KEY_INFO_REQUEST WBIT(11)

[PATCH V2 07/31] staging: ks7010: use long preamble as default

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

I had a problem connecting to a network with a short preamble, so let's
make the safer option the default.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 7d33070b3428e7..abe99a52ae1ad8 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -193,7 +193,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
{8,"WepIndex","1"}, /* 13 */
{7,"WepType","STRING"}, /* 14 */
{3,"Wep","OFF"},/* 15 */
-   {13,"PREAMBLE_TYPE","SHORT"},   /* 16 */
+   {13,"PREAMBLE_TYPE","LONG"},/* 16 */
{8,"ScanType","ACTIVE_SCAN"},   /* 17 */
{8,"ROM_FILE", ROM_FILE},   /* 18 */
{7,"PhyType", "BG_MODE"},   /* 19 */
@@ -216,7 +216,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
priv->reg.ssid.body[0] = '\0';  /* SSID */
priv->reg.ssid.size = 0;/* SSID size */
priv->reg.tx_rate = TX_RATE_AUTO;   /* TxRate Fully Auto */
-   priv->reg.preamble = SHORT_PREAMBLE;/* Preamble = SHORT */
+   priv->reg.preamble = LONG_PREAMBLE; /* Preamble = LONG */
priv->reg.powermgt = POWMGT_ACTIVE_MODE;/* POWMGT_ACTIVE_MODE */
priv->reg.scan_type = ACTIVE_SCAN;  /* Active */
priv->reg.beacon_lost_count = 20;   /* Beacon Lost Count */
-- 
2.8.1



[PATCH V2 17/31] staging: ks7010: indent ks7010_sdio.h

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_sdio.h | 64 +---
 1 file changed, 30 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index 1d16673e5dae02..aea3727caf483b 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -21,7 +21,7 @@
 #define DEVICE_ALIGNMENT 32
 
 /*  SDIO KeyStream vendor and device */
-#define SDIO_VENDOR_ID_KS_CODE_A   0x005b 
+#define SDIO_VENDOR_ID_KS_CODE_A   0x005b
 #define SDIO_VENDOR_ID_KS_CODE_B   0x0023
 #define SDIO_DEVICE_ID_KS_7010 0x7910
 
@@ -48,8 +48,8 @@
  * for network packet (less than 2048 bytes data)
  */
 #define WSTATUS_RSIZE  0x14
-#define WSTATUS_MASK   0x80 /* Write Status Register value */
-#define RSIZE_MASK 0x7F /* Read Data Size Register value [10:4] */
+#define WSTATUS_MASK   0x80/* Write Status Register value */
+#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] 
*/
 
 /* ARM to SD interrupt Enable */
 #define INT_ENABLE 0x20
@@ -88,52 +88,48 @@
 
 #define KS7010_IRAM_ADDRESS0x0600
 
-
 /* 
  * struct define
  */
 struct hw_info_t {
-   struct ks_sdio_card *sdio_card; 
+   struct ks_sdio_card *sdio_card;
struct completion ks7010_sdio_wait;
struct workqueue_struct *ks7010sdio_wq;
struct delayed_work rw_wq;
-   unsigned char   *read_buf;
+   unsigned char *read_buf;
struct tasklet_struct rx_bh_task;
 };
 
 struct ks_sdio_packet {
-struct ks_sdio_packet   *next;
-u16 nb;
-u8  buffer[0] __attribute__((aligned(4)));
+   struct ks_sdio_packet *next;
+   u16 nb;
+   u8 buffer[0] __attribute__ ((aligned(4)));
 };
 
-
 struct ks_sdio_card {
-   struct sdio_func*func;
+   struct sdio_func *func;
struct ks_wlan_private *priv;
-   int model;
-   const char  *firmware;
-spinlock_t  lock;
+   int model;
+   const char *firmware;
+   spinlock_t lock;
 };
 
-
-
 /* Tx Device struct */
-#defineTX_DEVICE_BUFF_SIZE 1024 
+#defineTX_DEVICE_BUFF_SIZE 1024
 
 struct tx_device_buffer {
-unsigned char *sendp;  /* pointer of send req data */
-unsigned int  size;
-   void(*complete_handler)(void *arg1, void *arg2);
-   void*arg1;
-   void*arg2;
+   unsigned char *sendp;   /* pointer of send req data */
+   unsigned int size;
+   void (*complete_handler) (void *arg1, void *arg2);
+   void *arg1;
+   void *arg2;
 };
 
-struct tx_device{
-struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
-unsigned int   qhead; /* tx buffer queue first pointer */
-unsigned int   qtail; /* tx buffer queue last pointer */
-spinlock_t  tx_dev_lock;
+struct tx_device {
+   struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
+   unsigned int qhead; /* tx buffer queue first pointer */
+   unsigned int qtail; /* tx buffer queue last pointer */
+   spinlock_t tx_dev_lock;
 };
 
 /* Rx Device struct */
@@ -141,15 +137,15 @@ struct tx_device{
 #defineRX_DEVICE_BUFF_SIZE 32
 
 struct rx_device_buffer {
-   unsigned char   data[RX_DATA_SIZE];
-   unsigned intsize;
+   unsigned char data[RX_DATA_SIZE];
+   unsigned int size;
 };
 
-struct rx_device{
-struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
-unsigned int   qhead; /* rx buffer queue first pointer */
-   unsigned intqtail; /* rx buffer queue last pointer */
-   spinlock_t  rx_dev_lock;
+struct rx_device {
+   struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
+   unsigned int qhead; /* rx buffer queue first pointer */
+   unsigned int qtail; /* rx buffer queue last pointer */
+   spinlock_t rx_dev_lock;
 };
 #defineROM_FILE "ks7010sd.rom"
 #defineCFG_FILE "ks79xx.cfg"
-- 
2.8.1



[PATCH V2 20/31] staging: ks7010: indent ks_wlan.h

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_wlan.h | 246 +++
 1 file changed, 121 insertions(+), 125 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 58e3a5a6b44472..f0f9f8ef7d6185 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -22,16 +22,16 @@
 #include 
 #include 
 
-#include /* spinlock_t   
*/
-#include/* wait_queue_head_t
*/
-#include/* pid_t
*/
-#include/* struct net_device_stats,  struct sk_buff 
*/
+#include /* spinlock_t   
*/
+#include/* wait_queue_head_t
*/
+#include/* pid_t
*/
+#include/* struct net_device_stats,  struct sk_buff 
*/
 #include 
 #include 
-#include /* struct atmic_t   
*/
+#include /* struct atmic_t   
*/
 #include/* struct timer_list */
 #include 
-#include/* struct completion */
+#include   /* struct completion */
 #include 
 
 #include 
@@ -46,37 +46,37 @@
 #endif
 
 struct ks_wlan_parameter {
-   uint8_t operation_mode;/* Operation Mode */
-   uint8_t channel;   /*  Channel */
-   uint8_t tx_rate;   /*  Transmit Rate */
+   uint8_t operation_mode; /* Operation Mode */
+   uint8_t channel;/*  Channel */
+   uint8_t tx_rate;/*  Transmit Rate */
struct {
uint8_t size;
uint8_t body[16];
} rate_set;
-   uint8_t bssid[ETH_ALEN];/* BSSID */
+   uint8_t bssid[ETH_ALEN];/* BSSID */
struct {
uint8_t size;
-   uint8_t body[32+1];
-   } ssid;/*  SSID */
-   uint8_t preamble;  /*  Preamble */
-   uint8_t powermgt;  /*  PowerManagementMode */
-   uint32_tscan_type; /*  AP List Scan Type */
+   uint8_t body[32 + 1];
+   } ssid; /*  SSID */
+   uint8_t preamble;   /*  Preamble */
+   uint8_t powermgt;   /*  PowerManagementMode */
+   uint32_t scan_type; /*  AP List Scan Type */
 #define BEACON_LOST_COUNT_MIN 0
 #define BEACON_LOST_COUNT_MAX 65535
-   uint32_tbeacon_lost_count; /*  Beacon Lost Count */
-   uint32_trts;   /*  RTS Threashold */
-   uint32_tfragment;  /*  Fragmentation Threashold */
-   uint32_tprivacy_invoked;
-   uint32_twep_index;
+   uint32_t beacon_lost_count; /*  Beacon Lost Count */
+   uint32_t rts;   /*  RTS Threashold */
+   uint32_t fragment;  /*  Fragmentation Threashold */
+   uint32_t privacy_invoked;
+   uint32_t wep_index;
struct {
uint8_t size;
-   uint8_t val[13*2+1];
+   uint8_t val[13 * 2 + 1];
} wep_key[4];
-   uint16_tauthenticate_type;  
-   uint16_tphy_type; /* 11b/11g/11bg mode type*/
-   uint16_tcts_mode; /* for 11g/11bg mode cts mode */
-   uint16_tphy_info_timer; /* phy information timer */
-   charrom_file[256];
+   uint16_t authenticate_type;
+   uint16_t phy_type;  /* 11b/11g/11bg mode type */
+   uint16_t cts_mode;  /* for 11g/11bg mode cts mode */
+   uint16_t phy_info_timer;/* phy information timer */
+   char rom_file[256];
 };
 
 enum {
@@ -157,7 +157,6 @@ enum {
SME_START_REQUEST,
SME_GET_EEPROM_CKSUM,
 
-
SME_MIC_FAILURE_CONFIRM,
SME_START_CONFIRM,
 
@@ -187,7 +186,7 @@ enum {
SME_WEP_SET_CONFIRM,
SME_TERMINATE,
 
-   SME_EVENT_SIZE/* end */
+   SME_EVENT_SIZE  /* end */
 };
 
 /* SME Status */
@@ -200,58 +199,58 @@ enum {
 
 #defineSME_EVENT_BUFF_SIZE 128
 
-struct sme_info{
-   int sme_status;
-   int event_buff[SME_EVENT_BUFF_SIZE];
-   unsigned intqhead;
-   unsigned intqtail;
+struct sme_info {
+   int sme_status;
+   int event_buff[SME_EVENT_BUFF_SIZE];
+   unsigned int qhead;
+   unsigned int qtail;
 #ifdef KS_WLAN_DEBUG
-  /* for debug */
+   /* for debug */
unsigned int max_event_count;
 #endif
-   spinlock_tsme_spin;
+   spinlock_t sme_spin;
unsigned long sme_flag;
 };
 
-struct hostt_t{
-   int buff[SME_EVENT_BUFF_SIZE];
-   unsigned intqhead;
-   unsigned intqtail;
+struct hostt_t {
+   int buff[SME_EVENT_BUFF_SIZE];
+   unsigned int qhead;
+   unsigned int qtail;
 };
 
 #define 

[PATCH V2 30/31] staging: ks7010: drop counting sd errors

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

They were counted but never really used anywhere. Also change the printk
to a debug print, since it mostly shows on the expected -ENOMEDIUM on
card removal.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_sdio.c | 20 ++--
 drivers/staging/ks7010/ks_wlan.h |  2 --
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index a8a14f928d421b..c166022b652e3a 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -234,8 +234,8 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv)
 static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,
unsigned char *buffer, int length)
 {
-   int rc = -1;
struct ks_sdio_card *card;
+   int rc;
 
card = priv->ks_wlan_hw.sdio_card;
 
@@ -244,12 +244,8 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, 
unsigned int address,
else/* CMD53 multi-block transfer */
rc = sdio_memcpy_fromio(card->func, buffer, address, length);
 
-   if (rc != 0) {
-   printk("sdio error erorr=%d size=%d\n", rc, length);
-   ++priv->sdio_error_count;
-   } else {
-   priv->sdio_error_count = 0;
-   }
+   if (rc != 0)
+   DPRINTK(1, "sdio error=%d size=%d\n", rc, length);
 
return rc;
 }
@@ -257,8 +253,8 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, 
unsigned int address,
 static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int 
address,
 unsigned char *buffer, int length)
 {
-   int rc = -1;
struct ks_sdio_card *card;
+   int rc;
 
card = priv->ks_wlan_hw.sdio_card;
 
@@ -268,12 +264,8 @@ static int ks7010_sdio_write(struct ks_wlan_private *priv, 
unsigned int address,
rc = sdio_memcpy_toio(card->func, (unsigned int)address, buffer,
  length);
 
-   if (rc != 0) {
-   printk("sdio error erorr=%d size=%d\n", rc, length);
-   ++priv->sdio_error_count;
-   } else {
-   priv->sdio_error_count = 0;
-   }
+   if (rc != 0)
+   DPRINTK(1, "sdio error=%d size=%d\n", rc, length);
 
return rc;
 }
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index f0f9f8ef7d6185..a2126c2e728d2d 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -500,9 +500,7 @@ struct ks_wlan_private {
unsigned long last_doze;
unsigned long last_wakeup;
 
-   uint sdio_error_count;  /* SDIO error */
uint wakeup_count;  /* for detect wakeup loop */
-
 };
 
 #endif /* _KS_WLAN_H */
-- 
2.8.1



[PATCH V2 09/31] staging: ks7010: delete seperate debug header

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Move the one debug macro to the generic wlan header.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c |  1 -
 drivers/staging/ks7010/ks7010_sdio.c   |  1 -
 drivers/staging/ks7010/ks_debug.h  | 28 
 drivers/staging/ks7010/ks_hostif.c |  1 -
 drivers/staging/ks7010/ks_wlan.h   |  7 +++
 drivers/staging/ks7010/ks_wlan_net.c   |  1 -
 6 files changed, 7 insertions(+), 32 deletions(-)
 delete mode 100644 drivers/staging/ks7010/ks_debug.h

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index abe99a52ae1ad8..7f273dafaf3583 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -4,7 +4,6 @@
 #include "ks_wlan.h"
 #include "ks_hostif.h"
 #include "ks_wlan_ioctl.h"
-#include "ks_debug.h"
 
 static int wep_on_off;
 #defineWEP_OFF 0
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 1a1a43ff306aae..3fb432c9dd314d 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -19,7 +19,6 @@
 
 #include "ks_wlan.h"
 #include "ks_wlan_ioctl.h"
-#include "ks_debug.h"
 #include "ks_hostif.h"
 
 #include "ks7010_sdio.h"
diff --git a/drivers/staging/ks7010/ks_debug.h 
b/drivers/staging/ks7010/ks_debug.h
deleted file mode 100644
index adad5f927dfda9..00
--- a/drivers/staging/ks7010/ks_debug.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *   Driver for KeyStream 11b/g wireless LAN cards.
- *   
- *   ks_debug.h
- *   $Id: ks_debug.h 991 2009-09-14 01:38:58Z sekine $
- *
- *   Copyright (C) 2005-2008 KeyStream Corp.
- *   Copyright (C) 2009 Renesas Technology Corp.
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
- */
-
-#ifndef _KS_DEBUG_H
-#define _KS_DEBUG_H
-
-#include 
-
-
-#ifdef KS_WLAN_DEBUG
-#define DPRINTK(n, fmt, args...) \
- if (KS_WLAN_DEBUG>(n)) printk(KERN_NOTICE "%s: "fmt, 
__FUNCTION__, ## args)
-#else
-#define DPRINTK(n, fmt, args...)
-#endif
-
-#endif /* _KS_DEBUG_H */
diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 146a1357909b39..367d487cef1ba8 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -13,7 +13,6 @@
  */
 
 #include "ks_wlan.h"
-#include "ks_debug.h"
 #include "ks_hostif.h"
 #include "eap_packet.h"
 #include "michael_mic.h"
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 6bd016414a4f1d..c460741c6606ee 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -38,6 +38,13 @@
 
 #include "ks7010_sdio.h"
 
+#ifdef KS_WLAN_DEBUG
+#define DPRINTK(n, fmt, args...) \
+ if (KS_WLAN_DEBUG>(n)) printk(KERN_NOTICE "%s: "fmt, 
__FUNCTION__, ## args)
+#else
+#define DPRINTK(n, fmt, args...)
+#endif
+
 struct ks_wlan_parameter {
uint8_t operation_mode;/* Operation Mode */
uint8_t channel;   /*  Channel */
diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 776a544031495f..1da2768ea9f31b 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -40,7 +40,6 @@ static int wep_on_off;
 #include "ks_wlan.h"
 #include "ks_hostif.h"
 #include "ks_wlan_ioctl.h"
-#include "ks_debug.h"
 
 /* Include Wireless Extension definition and check version */
 #include 
-- 
2.8.1



[PATCH V2 11/31] staging: ks7010: make loading config file optional

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

We have sane defaults, so we don't need to bail out if there is no
config file. Note that the config file should go away completely in
favour of configuration mechanisms already upstream.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 7f273dafaf3583..06ff8852e17f33 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -203,7 +203,6 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
 
const struct firmware *fw_entry;
struct device *dev = NULL;
-   int retval;
char cfg_file[]=CFG_FILE;
char *cur_p, *end_p;
char wk_buff[256], *wk_p;
@@ -254,10 +253,9 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
priv->reg.rate_set.size = 12;
 
dev = >ks_wlan_hw.sdio_card->func->dev;
-   if((retval = request_firmware(_entry, cfg_file, dev)) !=0 ){
-   DPRINTK(1, "error request_firmware() file=%s ret=%d\n", 
cfg_file, retval);
-   return 1;
-   }
+   /* If no cfg file, stay with the defaults */
+   if (request_firmware_direct(_entry, cfg_file, dev))
+   return 0;
 
DPRINTK(4, "success request_firmware() file=%s size=%d\n", cfg_file, 
fw_entry->size);
cur_p = fw_entry->data;
-- 
2.8.1



[PATCH V2 04/31] staging: ks7010: remove checks for WIRELESS_EXT version

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

We are by far newer than that anyhow.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_hostif.c   | 23 ---
 drivers/staging/ks7010/ks_wlan_net.c | 14 --
 2 files changed, 37 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 0295bb4921fa20..6bea699655eec4 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -22,12 +22,7 @@
 #include 
 
 /* Include Wireless Extension definition and check version */
-#ifndef WIRELESS_EXT
-#include 
-#endif /* WIRELESS_EXT */
-#if WIRELESS_EXT > 12
 #include /* New driver API */
-#endif /* WIRELESS_EXT > 12 */
 
 extern int ks_wlan_hw_tx(ks_wlan_private *priv, void *p, unsigned long size,
 void (*complete_handler)(void *arg1, void *arg2),
@@ -121,10 +116,8 @@ static
 int get_current_ap(ks_wlan_private *priv, struct link_ap_info_t *ap_info)
 {
struct local_ap_t *ap;
-#if WIRELESS_EXT > 13
union iwreq_data wrqu;
struct net_device *netdev=priv->net_dev;
-#endif /* WIRELESS_EXT > 13 */
int rc=0;
 
DPRINTK(3,"\n");
@@ -190,7 +183,6 @@ int get_current_ap(ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
ap->wpa_ie.size = 0;
}
 
-#if WIRELESS_EXT > 13
wrqu.data.length = 0;
wrqu.data.flags = 0;
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -203,7 +195,6 @@ int get_current_ap(ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
(unsigned char)wrqu.ap_addr.sa_data[4],(unsigned 
char)wrqu.ap_addr.sa_data[5]);
wireless_send_event(netdev, SIOCGIWAP, , NULL);
}
-#endif
DPRINTK(4,"\nLink AP\n");
DPRINTK(4,"bssid=%02X:%02X:%02X:%02X:%02X:%02X\n \
essid=%s\nrate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n
channel=%d\n \
@@ -338,9 +329,7 @@ void hostif_data_indication(ks_wlan_private *priv)
struct ieee802_1x_hdr *aa1x_hdr;
struct wpa_eapol_key *eap_key;
struct michel_mic_t michel_mic;
-#if WIRELESS_EXT > 14
union iwreq_data wrqu;
-#endif /* WIRELESS_EXT > 14 */
 
DPRINTK(3,"\n");
 
@@ -412,7 +401,6 @@ void hostif_data_indication(ks_wlan_private *priv)
mic_failure->counter = 
1;
}
priv->wpa.mic_failure.last_failure_time 
= now;
-#if WIRELESS_EXT > 14
/*  needed parameters: count, keyid, 
key type, TSC */
sprintf(buf, 
"MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr="

"%02x:%02x:%02x:%02x:%02x:%02x)",
@@ -424,7 +412,6 @@ void hostif_data_indication(ks_wlan_private *priv)
wrqu.data.length = strlen(buf);

DPRINTK(4,"IWEVENT:MICHAELMICFAILURE\n");
wireless_send_event(priv->net_dev, 
IWEVCUSTOM, , buf);
-#endif /* WIRELESS_EXT > 14 */
return;
}
}
@@ -754,9 +741,7 @@ void hostif_connect_indication(ks_wlan_private *priv)
unsigned int tmp=0;
unsigned int old_status=priv->connect_status;
struct net_device *netdev=priv->net_dev;
-#if WIRELESS_EXT > 13
union iwreq_data wrqu0;
-#endif /* WIRELESS_EXT > 13 */
connect_code = get_WORD(priv);
 
switch(connect_code){
@@ -791,7 +776,6 @@ void hostif_connect_indication(ks_wlan_private *priv)
}
ks_wlan_do_power_save(priv);
 
-#if WIRELESS_EXT > 13
wrqu0.data.length = 0;
wrqu0.data.flags = 0;
wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
@@ -802,7 +786,6 @@ void hostif_connect_indication(ks_wlan_private *priv)
DPRINTK(3,"disconnect :: 
scan_ind_count=%d\n",priv->scan_ind_count);
wireless_send_event(netdev, SIOCGIWAP, , NULL);
}
-#endif /* WIRELESS_EXT > 13 */
priv->scan_ind_count=0;
 }
 
@@ -904,7 +887,6 @@ void hostif_adhoc_set_confirm(ks_wlan_private *priv)
 static
 void hostif_associate_indication(ks_wlan_private *priv)
 {
-#if WIRELESS_EXT > 14
struct association_request_t *assoc_req;
struct association_response_t *assoc_resp;
unsigned char *pb;
@@ -944,29 +926,24 @@ void hostif_associate_indication(ks_wlan_private *priv)
 
DPRINTK(3,"IWEVENT:ASSOCINFO\n");
wireless_send_event(priv->net_dev, IWEVCUSTOM, , buf);
-#endif /* WIRELESS_EXT > 14 */
 }
 
 static
 void hostif_bss_scan_confirm(ks_wlan_private *priv)
 {
unsigned int result_code;
-#if WIRELESS_EXT > 13
struct net_device *dev = priv->net_dev;
union iwreq_data wrqu;

[PATCH V2 13/31] staging: ks7010: add example cfg file as a reference

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

We want to remove it, but to do so properly, it is good to have a
working example. Needs to be copied to /lib/firmware in order to be
used.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks79xx.cfg | 116 ++
 1 file changed, 116 insertions(+)
 create mode 100644 drivers/staging/ks7010/ks79xx.cfg

diff --git a/drivers/staging/ks7010/ks79xx.cfg 
b/drivers/staging/ks7010/ks79xx.cfg
new file mode 100644
index 00..0f2d24d4e66a89
--- /dev/null
+++ b/drivers/staging/ks7010/ks79xx.cfg
@@ -0,0 +1,116 @@
+#ks79xx.cfg
+#KS79xx configuration file
+#
+
+#
+#BeaconLostCount   default 20
+BeaconLostCount=20
+#
+
+#
+#Ap List Scan Type default ACTIVE_SCAN ACTIVE_SCAN or PASSIVE_SCAN
+ScanType=ACTIVE_SCAN
+#
+
+#
+#Channel   default 10  min 1   max 14
+Channel=10
+#
+
+#
+#FragmentThreshold default 2346min 256 max 2346
+FragmentThreshold=2346
+#
+
+#
+#OperationMode default Infrastructure  Pseudo-Ad-Hoc or 802.11-Ad-Hoc 
or Infrastructure
+OperationMode=Infrastructure
+#
+
+#
+#PowerManagementMode   default ACTIVE ACTIVE or SAVE1 or SAVE2
+PowerManagementMode=ACTIVE
+#
+
+#
+#RTSThreshold  default 2347min 0   max 2347
+RTSThreshold=2347
+#
+
+#
+#SSID  default ""  max 32 character
+SSID="default"
+#
+
+#
+#TxRatedefault Auto1, 2, 5.5, 11   ex. 
TxRate=1,2 TxRate=11 TxRate=Auto ...
+TxRate=Auto
+#
+
+#
+#Wep   default OFF OFF or 64bit or 128bit
+Wep=OFF
+#
+
+#
+#WepType   default STRING  STRING or HEX
+WepType=STRING
+#
+
+#
+#WepIndex=1
+#
+
+#
+#WepKeyValue1
+#  character_wep_key:64bit key_length = 5;  128bit key_length = 13
+#hex_wep_key:64bit key_length = 10; 128bit key_length = 26
+#
+
+#
+#WepKeyValue2
+#  character_wep_key:64bit key_length = 5;  128bit key_length = 13
+#hex_wep_key:64bit key_length = 10; 128bit key_length = 26
+#
+
+#
+#WepKeyValue3
+#  character_wep_key:64bit key_length = 5;  128bit key_length = 13
+#hex_wep_key:64bit key_length = 10; 128bit key_length = 26
+#
+
+#
+#WepKeyValue4
+#  character_wep_key:64bit key_length = 5;  128bit key_length = 13
+#hex_wep_key:64bit key_length = 10; 128bit key_length = 26
+#
+
+#
+#AuthenticationAlgorithm default OPEN_SYSTEM   OPEN_SYSTEM or  SHARED_KEY
+AuthenticationAlgorithm=OPEN_SYSTEM
+#
+
+#
+#PREAMBLE_TYPE default LONGLONG or  SHORT
+PREAMBLE_TYPE=SHORT
+#
+
+#
+# PhyType default BG_MODE  B_MODE, G_MODE or BG_MODE
+PhyType=BG_MODE
+#
+
+#
+# CtsMode defalut FALSETURE or FALSE
+CtsMode=FALSE
+#
+
+#
+# PhyInformationTimer defalut 0  uint 100msec 
+PhyInformationTimer=0
+#
+
+#
+#ROM_FILE default "ks7010sd.rom"
+ROM_FILE="ks7010sd.rom"
+#
-- 
2.8.1



[PATCH V2 27/31] staging: ks7010: fix module annotations

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

List all authors, beautify description, match license to what is stated
in file headers, add firmware information.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_sdio.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 8e8476b52cedbc..8c0d1bb58dcd9c 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1261,9 +1261,7 @@ static void __exit ks7010_sdio_exit(void)
 module_init(ks7010_sdio_init);
 module_exit(ks7010_sdio_exit);
 
-MODULE_AUTHOR("Qi-Hardware based on KeyStream driver");
-MODULE_DESCRIPTION("Driver for KeyStream, KS7010 based SDIO cards. ");
-#ifdef MODULE_LICENSE
-MODULE_LICENSE("GPL");
-#endif
-MODULE_SUPPORTED_DEVICE("KS7910");
+MODULE_AUTHOR("Sang Engineering, Qi-Hardware, KeyStream");
+MODULE_DESCRIPTION("Driver for KeyStream KS7010 based SDIO cards");
+MODULE_LICENSE("GPL v2");
+MODULE_FIRMWARE(ROM_FILE);
-- 
2.8.1



[PATCH V2 28/31] staging: ks7010: adapt to new trans_start handling

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

trans_start is gone from netdevice, so use the new helper function to
set the mark.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_wlan_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index 3e282833372305..ac3354bf6f8c8a 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -3398,7 +3398,7 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
netif_stop_queue(dev);
 
rc = hostif_data_request(priv, skb);
-   dev->trans_start = jiffies;
+   netif_trans_update(dev);
 
DPRINTK(4, "rc=%d\n", rc);
if (rc) {
-- 
2.8.1



[PATCH V2 03/31] staging: ks7010: remove custom firmware loader

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

FW_LOADER works fine, no need for a open coded fallback.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/Kconfig |  1 +
 drivers/staging/ks7010/ks7010_config.c | 62 --
 drivers/staging/ks7010/ks7010_sdio.c   | 56 --
 drivers/staging/ks7010/ks7010_sdio.h   |  5 ---
 4 files changed, 1 insertion(+), 123 deletions(-)

diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig
index dfd4eed539bebc..0b9217674d5b54 100644
--- a/drivers/staging/ks7010/Kconfig
+++ b/drivers/staging/ks7010/Kconfig
@@ -3,6 +3,7 @@ config KS7010
depends on MMC && WIRELESS
select WIRELESS_EXT
select WEXT_PRIV
+   select FW_LOADER
help
  This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is
  found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index e8a42077a4b381..7d33070b3428e7 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -169,11 +169,7 @@ int rate_set_configuration(ks_wlan_private *priv, char 
*value)
return rc;
 }
 
-#ifndef NO_FIRMWARE_CLASS
 #include 
-#else
-#define MAX_CONFIG_FILE_SIZE (1024*10)
-#endif
 int ks_wlan_read_config_file(ks_wlan_private *priv)
 {
struct {
@@ -206,18 +202,9 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
{0,"",""},
};
 
-#ifndef NO_FIRMWARE_CLASS
const struct firmware *fw_entry;
struct device *dev = NULL;
int retval;
-#else
-   struct file *srcf;
-   int nr_read ;
-   int retval;
-   char *cfg_buf=NULL;
-   int orgfsuid, orgfsgid;
-   mm_segment_t orgfs;
-#endif
char cfg_file[]=CFG_FILE;
char *cur_p, *end_p;
char wk_buff[256], *wk_p;
@@ -267,7 +254,6 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
priv->reg.tx_rate = TX_RATE_FULL_AUTO;
priv->reg.rate_set.size = 12;
 
-#ifndef NO_FIRMWARE_CLASS
dev = >ks_wlan_hw.sdio_card->func->dev;
if((retval = request_firmware(_entry, cfg_file, dev)) !=0 ){
DPRINTK(1, "error request_firmware() file=%s ret=%d\n", 
cfg_file, retval);
@@ -277,46 +263,6 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
DPRINTK(4, "success request_firmware() file=%s size=%d\n", cfg_file, 
fw_entry->size);
cur_p = fw_entry->data;
end_p = cur_p + fw_entry->size;
-#else
-   orgfsuid=current->fsuid;
-   orgfsgid=current->fsgid;
-   orgfs=get_fs();
-   set_fs(KERNEL_DS);
-
-   srcf = filp_open(cfg_file, O_RDONLY, 0);
-   if (IS_ERR(srcf)) {
-   printk(KERN_ERR "error %ld opening %s\n", 
-PTR_ERR(srcf),cfg_file);
-   goto no_config_file;
-   }
-
-   if (!(srcf->f_op && srcf->f_op->read)) {
-   printk(KERN_ERR "%s does not have a read 
method\n", cfg_file);
-   goto no_config_file;
-   }
-
-   cfg_buf = (char *)kzalloc(MAX_CONFIG_FILE_SIZE, GFP_ATOMIC);
-   if (!cfg_buf) {
-   printk(KERN_ERR "%s does not read : out of 
memory \n", cfg_file);
-   goto no_config_file;
-   }
-
-   nr_read = srcf->f_op->read(srcf, (unsigned char *)cfg_buf, 
MAX_CONFIG_FILE_SIZE, >f_pos);
-
-   DPRINTK(1, "read retval=%d  file=%s\n", nr_read, priv->reg.cfg_file);
-   retval=filp_close(srcf ,NULL);
-   if (retval)
-   DPRINTK(1, "error %d closing %s\n", -retval,priv->reg.cfg_file);
-
-   if (nr_read < 1) {
-   printk(KERN_ERR "%s does not read : file is 
empty  num=%d\n", cfg_file, nr_read);
-   goto no_config_file;
-   }else if(nr_read > MAX_CONFIG_FILE_SIZE){
-   printk(KERN_ERR "%s does not read : file is too 
big \n", cfg_file);
-   goto no_config_file;
-   }
-   cur_p = cfg_buf;
-   end_p = cur_p + nr_read;
-#endif
*end_p = '\0';
 
while (cur_p < end_p) {
@@ -524,15 +470,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
}
 
}
-#ifndef NO_FIRMWARE_CLASS
release_firmware(fw_entry);
-#else
-no_config_file:
-   kfree(cfg_buf);
-   set_fs(orgfs);
-   current->fsuid=orgfsuid;
-   current->fsgid=orgfsgid;
-#endif
 
DPRINTK(3,"\noperation_mode = %d\nchannel = %d\nssid = %s\n 
   tx_rate = %d\n \
preamble = %d\npowermgt = %d\nscan_type = %d\nbeacon_lost_count 
= %d\nrts = %d\n \
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 7cc49a4ccac549..9300658c4aed8d 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ 

[PATCH V2 14/31] staging: ks7010: remove unecessary typedef

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Let's simply specify the struct to keep in sync with kernel coding
style.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c |   4 +-
 drivers/staging/ks7010/ks7010_sdio.c   |  44 -
 drivers/staging/ks7010/ks7010_sdio.h   |   2 +-
 drivers/staging/ks7010/ks_hostif.c | 114 +++---
 drivers/staging/ks7010/ks_hostif.h |  10 +-
 drivers/staging/ks7010/ks_wlan.h   |   4 +-
 drivers/staging/ks7010/ks_wlan_ioctl.h |   4 +-
 drivers/staging/ks7010/ks_wlan_net.c   | 168 -
 8 files changed, 175 insertions(+), 175 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 4b00d25cd8f575..48809bcc779739 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -87,7 +87,7 @@ void analyze_hex_wep_key(struct ks_wlan_parameter *param, int 
wep_key_index, cha
 }
 
 static
-int rate_set_configuration(ks_wlan_private *priv, char *value)
+int rate_set_configuration(struct ks_wlan_private *priv, char *value)
 {
int rc=0;
 
@@ -169,7 +169,7 @@ int rate_set_configuration(ks_wlan_private *priv, char 
*value)
 }
 
 #include 
-int ks_wlan_read_config_file(ks_wlan_private *priv)
+int ks_wlan_read_config_file(struct ks_wlan_private *priv)
 {
struct {
const int key_len;
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 50364909449aec..fb9f0b533d867e 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -51,9 +51,9 @@ static struct ks_sdio_model ks_sdio_models[] = {
 static int ks7910_sdio_probe(struct sdio_func *function, const struct 
sdio_device_id *device);
 static void ks7910_sdio_remove(struct sdio_func *function);
 static void ks7010_rw_function(struct work_struct *work);
-static int ks7010_sdio_read( ks_wlan_private *priv, unsigned int address,
+static int ks7010_sdio_read( struct ks_wlan_private *priv, unsigned int 
address,
 unsigned char *buffer, int length );
-static int ks7010_sdio_write( ks_wlan_private *priv, unsigned int address,
+static int ks7010_sdio_write( struct ks_wlan_private *priv, unsigned int 
address,
  unsigned char *buffer, int length );
 /* macro */
 
@@ -71,7 +71,7 @@ static int ks7010_sdio_write( ks_wlan_private *priv, unsigned 
int address,
 #define cnt_rxqbody(priv) \
 (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % 
RX_DEVICE_BUFF_SIZE )
 
-void ks_wlan_hw_sleep_doze_request(ks_wlan_private *priv)
+void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
 {
unsigned char rw_data;
int retval;
@@ -102,7 +102,7 @@ out:
return;
 }
 
-void ks_wlan_hw_sleep_wakeup_request(ks_wlan_private *priv)
+void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
 {
unsigned char rw_data;
int retval;
@@ -134,7 +134,7 @@ out:
 }
 
 
-void ks_wlan_hw_wakeup_request(ks_wlan_private *priv)
+void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
 {
unsigned char rw_data;
int retval;
@@ -155,7 +155,7 @@ void ks_wlan_hw_wakeup_request(ks_wlan_private *priv)
}
 }
 
-int _ks_wlan_hw_power_save(ks_wlan_private *priv)
+int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
 {
int rc=0;
unsigned char rw_data;
@@ -220,13 +220,13 @@ int _ks_wlan_hw_power_save(ks_wlan_private *priv)
return rc;
 }
 
-int ks_wlan_hw_power_save(ks_wlan_private *priv)
+int ks_wlan_hw_power_save(struct ks_wlan_private *priv)
 {

queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,>ks_wlan_hw.rw_wq, 1);
return 0;
 }
 
-static int ks7010_sdio_read(ks_wlan_private *priv, unsigned int address,
+static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,
unsigned char *buffer, int length)
 {
int rc = -1;
@@ -249,7 +249,7 @@ static int ks7010_sdio_read(ks_wlan_private *priv, unsigned 
int address,
return rc;
 }
 
-static int ks7010_sdio_write(ks_wlan_private *priv, unsigned int address,
+static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int 
address,
 unsigned char *buffer, int length)
 {
int rc = -1;
@@ -272,7 +272,7 @@ static int ks7010_sdio_write(ks_wlan_private *priv, 
unsigned int address,
return rc;
 }
 
-static int enqueue_txdev(ks_wlan_private *priv, unsigned char *p, unsigned 
long size,
+static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, 
unsigned long size,
  void (*complete_handler)(void *arg1, void *arg2),
  void *arg1, void *arg2 )
 {
@@ -306,7 +306,7 @@ static int enqueue_txdev(ks_wlan_private *priv, unsigned 
char *p, unsigned long
 }
 
 /* write data */
-static int 

[PATCH V2 19/31] staging: ks7010: indent ks_hostif.h

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks_hostif.h | 525 ++---
 1 file changed, 262 insertions(+), 263 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h 
b/drivers/staging/ks7010/ks_hostif.h
index c333ce1a4baa6e..01de478d45ea60 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -62,141 +62,140 @@
  */
 
 struct hostif_hdr {
-   uint16_tsize;
-   uint16_tevent;
-} __attribute__((packed));
+   uint16_t size;
+   uint16_t event;
+} __attribute__ ((packed));
 
 struct hostif_data_request_t {
struct hostif_hdr header;
-   uint16_tauth_type;
+   uint16_t auth_type;
 #define TYPE_DATA 0x
 #define TYPE_AUTH 0x0001
-   uint16_treserved;
-   uint8_t data[0];
-} __attribute__((packed));
+   uint16_t reserved;
+   uint8_t data[0];
+} __attribute__ ((packed));
 
 struct hostif_data_indication_t {
struct hostif_hdr header;
-   uint16_tauth_type;
+   uint16_t auth_type;
 /* #define TYPE_DATA 0x */
 #define TYPE_PMK1 0x0001
 #define TYPE_GMK1 0x0002
 #define TYPE_GMK2 0x0003
-   uint16_treserved;
-   uint8_t data[0];
-} __attribute__((packed));
+   uint16_t reserved;
+   uint8_t data[0];
+} __attribute__ ((packed));
 
 #define CHANNEL_LIST_MAX_SIZE 14
 struct channel_list_t {
-   uint8_t size;
-   uint8_t body[CHANNEL_LIST_MAX_SIZE];
-   uint8_t pad;
-} __attribute__((packed));
+   uint8_t size;
+   uint8_t body[CHANNEL_LIST_MAX_SIZE];
+   uint8_t pad;
+} __attribute__ ((packed));
 
 /* MIB Attribute */
-#define DOT11_MAC_ADDRESS 0x21010100 /* MAC Address (R) */
-#define DOT11_PRODUCT_VERSION 0x31024100 /* FirmWare Version (R)*/
-#define DOT11_RTS_THRESHOLD   0x21020100 /* RTS Threshold (R/W) */
-#define DOT11_FRAGMENTATION_THRESHOLD 0x21050100 /* Fragment Threshold 
(R/W) */
-#define DOT11_PRIVACY_INVOKED 0x15010100 /* WEP ON/OFF (W) */
-#define DOT11_WEP_DEFAULT_KEY_ID  0x15020100 /* WEP Index (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE1  0x13020101 /* WEP Key#1(TKIP AES: 
PairwiseTemporalKey) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE2  0x13020102 /* WEP Key#2(TKIP AES: 
GroupKey1) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE3  0x13020103 /* WEP Key#3(TKIP AES: 
GroupKey2) (W) */
-#define DOT11_WEP_DEFAULT_KEY_VALUE4  0x13020104 /* WEP Key#4 (W) */
-#define DOT11_WEP_LIST0x13020100 /* WEP LIST */
-#defineDOT11_DESIRED_SSID0x11090100 /* SSID */
-#defineDOT11_CURRENT_CHANNEL 0x45010100 /* channel set */
-#defineDOT11_OPERATION_RATE_SET  0x0100 /* rate set */
-
-#define LOCAL_AP_SEARCH_INTEAVAL  0xF1010100 /* AP search interval 
(R/W) */
-#define LOCAL_CURRENTADDRESS  0xF1050100 /* MAC Adress change (W) 
*/
-#define LOCAL_MULTICAST_ADDRESS   0xF1060100 /* Multicast Adress (W) */
-#define LOCAL_MULTICAST_FILTER0xF1060200 /* Multicast Adress 
Filter enable/disable (W) */
-#define LOCAL_SEARCHED_AP_LIST0xF1030100 /* AP list (R) */
-#define LOCAL_LINK_AP_STATUS  0xF1040100 /* Link AP status (R) */
-#defineLOCAL_PACKET_STATISTICS   0xF1020100 /* tx,rx packets 
statistics */
-#define LOCAL_AP_SCAN_LIST_TYPE_SET  0xF1030200 /* AP_SCAN_LIST_TYPE */
-
-#define DOT11_RSN_ENABLED 0x15070100 /* WPA enable/disable (W) 
*/
-#define LOCAL_RSN_MODE0x56010100 /* RSN mode WPA/WPA2 (W) 
*/
-#define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100 /* GroupKeyCipherSuite 
(W) */
-#define DOT11_RSN_CONFIG_UNICAST_CIPHER   0x52020100 /* PairwiseKeyCipherSuite 
(W) */
-#define DOT11_RSN_CONFIG_AUTH_SUITE   0x53020100 /* 
AuthenticationKeyManagementSuite (W) */
-#define DOT11_RSN_CONFIG_VERSION  0x51020100 /* RSN version (W) */
-#define LOCAL_RSN_CONFIG_ALL  0x5F010100 /* RSN CONFIG ALL (W) */
-#define DOT11_PMK_TSC 0x55010100 /* PMK_TSC (W) */
-#define DOT11_GMK1_TSC0x55010101 /* GMK1_TSC (W) */
-#define DOT11_GMK2_TSC0x55010102 /* GMK2_TSC (W) */
-#define DOT11_GMK3_TSC   0x55010103 /* GMK3_TSC */
-#define LOCAL_PMK 0x58010100 /* Pairwise Master Key 
cache (W) */
-
-#define LOCAL_REGION  0xF10A0100 /* Region setting */
+#define DOT11_MAC_ADDRESS 0x21010100   /* MAC Address (R) */
+#define DOT11_PRODUCT_VERSION 0x31024100   /* FirmWare Version (R) 
*/
+#define DOT11_RTS_THRESHOLD   0x21020100   /* RTS Threshold (R/W) 
*/
+#define DOT11_FRAGMENTATION_THRESHOLD 0x21050100   /* Fragment Threshold 
(R/W) */
+#define 

[PATCH V2 31/31] staging: ks7010: cleanup file headers

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Remove svn-ids and fix typos in the licence declaration. Add my
copyright to the sdio code which I worked on mainly.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/eap_packet.h| 6 --
 drivers/staging/ks7010/ks7010_sdio.c   | 8 +++-
 drivers/staging/ks7010/ks7010_sdio.h   | 8 ++--
 drivers/staging/ks7010/ks_hostif.c | 7 ++-
 drivers/staging/ks7010/ks_hostif.h | 7 ++-
 drivers/staging/ks7010/ks_wlan.h   | 7 ++-
 drivers/staging/ks7010/ks_wlan_ioctl.h | 7 ++-
 drivers/staging/ks7010/ks_wlan_net.c   | 7 ++-
 drivers/staging/ks7010/michael_mic.c   | 7 ++-
 drivers/staging/ks7010/michael_mic.h   | 7 ++-
 10 files changed, 19 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/ks7010/eap_packet.h 
b/drivers/staging/ks7010/eap_packet.h
index 88384fb19d9580..16a392abdaec3b 100644
--- a/drivers/staging/ks7010/eap_packet.h
+++ b/drivers/staging/ks7010/eap_packet.h
@@ -1,9 +1,3 @@
-/*
- *
- *   eap_packet.h 
- *   $Id: eap_packet.h 991 2009-09-14 01:38:58Z sekine $
- *
- */
 #ifndef EAP_PACKET_H
 #define EAP_PACKET_H
 
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index c166022b652e3a..c340254cc895a0 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1,15 +1,13 @@
 /*
  *   Driver for KeyStream, KS7010 based SDIO cards.
  *
- *   ks7010_sdio.c
- *   $Id: ks7010_sdio.c 996 2009-09-14 02:54:21Z sekine $
- *
  *   Copyright (C) 2006-2008 KeyStream Corp.
  *   Copyright (C) 2009 Renesas Technology Corp.
+ *   Copyright (C) 2016 Sang Engineering, Wolfram Sang
  *
  *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
+ *   it under the terms of the GNU General Public License version 2 as
+ *   published by the Free Software Foundation.
  */
 
 #include 
diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index 2d7be5dae157c7..987cfa724b9757 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -1,16 +1,12 @@
 /*
- *
  *   Driver for KeyStream, KS7010 based SDIO cards. 
- *   
- *   ks7010_sdio.h
- *   $Id: ks7010_sdio.h 1019 2009-09-28 05:41:07Z sekine $
  *
  *   Copyright (C) 2006-2008 KeyStream Corp.
  *   Copyright (C) 2009 Renesas Technology Corp.
  *
  *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
+ *   it under the terms of the GNU General Public License version 2 as
+ *   published by the Free Software Foundation.
  */
 #ifndef _KS7010_SDIO_H
 #define _KS7010_SDIO_H
diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index f2a65c0ae630a2..a8822fe2bd6029 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -1,15 +1,12 @@
 /*
  *   Driver for KeyStream wireless LAN cards.
  *
- *   ks_hostif.c
- *   $Id: ks_hostif.c 996 2009-09-14 02:54:21Z sekine $
- *
  *   Copyright (C) 2005-2008 KeyStream Corp.
  *   Copyright (C) 2009 Renesas Technology Corp.
  *
  *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
+ *   it under the terms of the GNU General Public License version 2 as
+ *   published by the Free Software Foundation.
  */
 
 #include "ks_wlan.h"
diff --git a/drivers/staging/ks7010/ks_hostif.h 
b/drivers/staging/ks7010/ks_hostif.h
index 01de478d45ea60..dc806b5b47be8b 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -1,15 +1,12 @@
 /*
  *   Driver for KeyStream wireless LAN
  *   
- *   ks_hostif.h
- *   $Id: ks_hostif.h 994 2009-09-14 01:51:16Z sekine $
- *
  *   Copyright (c) 2005-2008 KeyStream Corp.
  *   Copyright (C) 2009 Renesas Technology Corp.
  *
  *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
+ *   it under the terms of the GNU General Public License version 2 as
+ *   published by the Free Software Foundation.
  */
 
 #ifndef _KS_HOSTIF_H_
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index a2126c2e728d2d..c42d99c6bc1fb2 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -1,15 +1,12 @@
 /*
  *   Driver for KeyStream IEEE802.11 b/g wireless LAN cards.
- *   
- *   ks_wlan.h
- *   $Id: ks_wlan.h 994 2009-09-14 01:51:16Z sekine $
  *
  *   Copyright (C) 2006-2008 KeyStream Corp.
  *   Copyright (C) 2009 Renesas Technology Corp.
  

[PATCH V2 12/31] staging: ks7010: fix printk format warnings

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Use proper type for size_t.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c | 2 +-
 drivers/staging/ks7010/ks7010_sdio.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 06ff8852e17f33..4b00d25cd8f575 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -257,7 +257,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
if (request_firmware_direct(_entry, cfg_file, dev))
return 0;
 
-   DPRINTK(4, "success request_firmware() file=%s size=%d\n", cfg_file, 
fw_entry->size);
+   DPRINTK(4, "success request_firmware() file=%s size=%zu\n", cfg_file, 
fw_entry->size);
cur_p = fw_entry->data;
end_p = cur_p + fw_entry->size;
*end_p = '\0';
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 3fb432c9dd314d..50364909449aec 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -750,7 +750,7 @@ static int ks79xx_upload_firmware(ks_wlan_private *priv, 
struct ks_sdio_card *ca
DPRINTK(1,"error request_firmware() file=%s\n", 
priv->reg.rom_file);
return 1;
}
-   DPRINTK(4,"success request_firmware() file=%s size=%d\n", 
priv->reg.rom_file, fw_entry->size);
+   DPRINTK(4,"success request_firmware() file=%s size=%zu\n", 
priv->reg.rom_file, fw_entry->size);
length = fw_entry->size;
 
/* Load Program */
-- 
2.8.1



[PATCH V2 16/31] staging: ks7010: indent ks7010_config.c

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/ks7010_config.c | 353 +
 1 file changed, 184 insertions(+), 169 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 48809bcc779739..4b495cbef48165 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -15,7 +15,8 @@ static int wep_type;
 #defineWEP_KEY_HEX   1
 
 static
-void analyze_character_wep_key(struct ks_wlan_parameter *param, int 
wep_key_index, char *value)
+void analyze_character_wep_key(struct ks_wlan_parameter *param,
+  int wep_key_index, char *value)
 {
int i;
unsigned char wep_key[26], key_length;
@@ -23,64 +24,69 @@ void analyze_character_wep_key(struct ks_wlan_parameter 
*param, int wep_key_inde
key_length = (wep_on_off == WEP_ON_64BIT) ? 5 : 13;
/* 64bit key_length = 5; 128bit key_length = 13; */
 
-   for (i=0; i 3)
+   if (wep_key_index < 0 || wep_key_index > 3)
return;
 
param->wep_key[wep_key_index].size = key_length;
-   for (i=0; i<(param->wep_key[wep_key_index].size); i++) {
+   for (i = 0; i < (param->wep_key[wep_key_index].size); i++) {
param->wep_key[wep_key_index].val[i] = wep_key[i];
}
 }
 
 static
-void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index, 
char *value)
+void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index,
+char *value)
 {
unsigned char wep_end[26], i, j, key_length;
 
key_length = (wep_on_off == WEP_ON_64BIT) ? 10 : 26;
/* 64bit key_length = 10; 128bit key_length = 26; */
 
-   for (i=0; i 3)
+   return;
 
-   param->wep_key[wep_key_index].size = key_length/2;
-   for (i=0; i<(param->wep_key[wep_key_index].size); i++) {
+   param->wep_key[wep_key_index].size = key_length / 2;
+   for (i = 0; i < (param->wep_key[wep_key_index].size); i++) {
param->wep_key[wep_key_index].val[i] = wep_end[i];
}
 
@@ -89,62 +95,57 @@ void analyze_hex_wep_key(struct ks_wlan_parameter *param, 
int wep_key_index, cha
 static
 int rate_set_configuration(struct ks_wlan_private *priv, char *value)
 {
-   int rc=0;
+   int rc = 0;
 
priv->reg.tx_rate = TX_RATE_FIXED;
priv->reg.rate_set.size = 1;
 
-   switch(*value){
-   

[PATCH V2 08/31] staging: ks7010: use kernel helper to print buffer

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

No need for an open coded one.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/Makefile  |  2 +-
 drivers/staging/ks7010/ks7010_sdio.c |  9 +
 drivers/staging/ks7010/ks_debug.c| 30 --
 drivers/staging/ks7010/ks_debug.h|  2 --
 4 files changed, 6 insertions(+), 37 deletions(-)
 delete mode 100644 drivers/staging/ks7010/ks_debug.c

diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile
index 32b0efc7bd00e8..f6a2cc8fd0276d 100644
--- a/drivers/staging/ks7010/Makefile
+++ b/drivers/staging/ks7010/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_KS7010) += ks7010.o
 
 ccflags-y   += -DKS_WLAN_DEBUG=0
-ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o ks_debug.o \
+ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o \
ks7010_sdio.o ks7010_config.o
diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 5b78522fad1ec1..1a1a43ff306aae 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -441,10 +441,11 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
 
/* length check */
if(size > 2046 || size == 0){
-
-   DPRINTK(5,"-INVAILED DATA dump\n");
-   print_buffer(_buffer->data[0],32);
-
+#ifdef KS_WLAN_DEBUG
+   if (KS_WLAN_DEBUG > 5)
+   print_hex_dump_bytes("INVALID DATA dump: ", 
DUMP_PREFIX_OFFSET,
+rx_buffer->data, 32);
+#endif
/* rx_status update */
read_status = READ_STATUS_IDLE;
retval = ks7010_sdio_write(priv, READ_STATUS, _status, 
sizeof(read_status));
diff --git a/drivers/staging/ks7010/ks_debug.c 
b/drivers/staging/ks7010/ks_debug.c
deleted file mode 100644
index 009f5f6df8f4e6..00
--- a/drivers/staging/ks7010/ks_debug.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *   Driver for KeyStream 11b/g wireless LAN cards.
- *   
- *   ks_debug.c
- *   $Id: ks_debug.c 991 2009-09-14 01:38:58Z sekine $
- *
- *   Copyright (C) 2005-2008 KeyStream Corp.
- *   Copyright (C) 2009 Renesas Technology Corp.
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it undr the terms of the GNU General Public License version 2 as
- *   published by the Free Sotware Foundation.
- */
-#include "ks_wlan.h"
-#include "ks_debug.h"
-
-void print_buffer(unsigned char *p, int length)
-{
-#ifdef KS_WLAN_DEBUG
-int i;
-#define HEX_OFFSET "\
-   +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F"
-printk(HEX_OFFSET);
-for (i=0; i

[PATCH V2 02/31] staging: ks7010: remove non-SDIO code and #ifdefs

2016-05-31 Thread Wolfram Sang
From: Wolfram Sang 

I couldn't find any trace of code or even products using ks7010 with
something else than SDIO. So, remove the conditionals.

Signed-off-by: Wolfram Sang 
---
 drivers/staging/ks7010/Makefile|  2 +-
 drivers/staging/ks7010/ks7010_config.c |  6 ---
 drivers/staging/ks7010/ks_hostif.c | 70 --
 drivers/staging/ks7010/ks_wlan.h   | 10 -
 4 files changed, 1 insertion(+), 87 deletions(-)

diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile
index 68b7ebf57bebd6..32b0efc7bd00e8 100644
--- a/drivers/staging/ks7010/Makefile
+++ b/drivers/staging/ks7010/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_KS7010) += ks7010.o
 
-ccflags-y   += -D_SDIO_ -DKS_WLAN_DEBUG=0
+ccflags-y   += -DKS_WLAN_DEBUG=0
 ks7010-y:= michael_mic.o ks_hostif.o ks_wlan_net.o ks_debug.o \
ks7010_sdio.o ks7010_config.o
diff --git a/drivers/staging/ks7010/ks7010_config.c 
b/drivers/staging/ks7010/ks7010_config.c
index 4a8098452cdd28..e8a42077a4b381 100644
--- a/drivers/staging/ks7010/ks7010_config.c
+++ b/drivers/staging/ks7010/ks7010_config.c
@@ -268,13 +268,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)
priv->reg.rate_set.size = 12;
 
 #ifndef NO_FIRMWARE_CLASS
-#if (defined _PCMCIA_)
-   dev = >ks_wlan_hw.pcmcia_dev->dev;
-#elif (defined _PCI_)
-   dev = >ks_wlan_hw.pci_dev->dev;
-#elif (defined _SDIO_)
dev = >ks_wlan_hw.sdio_card->func->dev;
-#endif
if((retval = request_firmware(_entry, cfg_file, dev)) !=0 ){
DPRINTK(1, "error request_firmware() file=%s ret=%d\n", 
cfg_file, retval);
return 1;
diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 402ddba400ffdd..0295bb4921fa20 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -108,51 +108,12 @@ int ks_wlan_do_power_save(ks_wlan_private *priv)
 
DPRINTK(4,"psstatus.status=%d\n",atomic_read(>psstatus.status));
 
-#ifdef _SDIO_
if((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS){
hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
}
else{
priv->dev_state = DEVICE_STATE_READY;
}
-#else
-   if((priv->connect_status & CONNECT_STATUS_MASK) == CONNECT_STATUS){
-   switch(atomic_read(>psstatus.status)){
-   case PS_ACTIVE_SET:
-   case PS_WAKEUP:
-   case PS_SAVE_SET:
-   case PS_SNOOZE:
-   break;
-   case PS_CONF_WAIT:
-   atomic_set(>psstatus.confirm_wait,0);
-   break;
-   case PS_NONE:
-   default:
-   hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-   break;
-   }
-
-   }
-   else{
-   switch(atomic_read(>psstatus.status)){
-   case PS_ACTIVE_SET:
-   case PS_WAKEUP:
-   case PS_SAVE_SET:
-   break;
-   case PS_CONF_WAIT:
-   atomic_set(>psstatus.confirm_wait,0);
-   atomic_set(>psstatus.status, PS_WAKEUP);
-   break;
-   case PS_SNOOZE:
-   ks_wlan_hw_power_save(priv);
-   break;
-   case PS_NONE:
-   default:
-   hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-   break;
-   }
-   }
-#endif
return rc;
 }
 
@@ -750,17 +711,11 @@ void hostif_power_mngmt_confirm(ks_wlan_private *priv)
 
if(priv->reg.powermgt > POWMGT_ACTIVE_MODE &&
   priv->reg.operation_mode == MODE_INFRASTRUCTURE){
-#if !defined(_SDIO_)
-   atomic_set(>psstatus.status,PS_SAVE_SET);
-#endif
atomic_set(>psstatus.confirm_wait, 0);
priv->dev_state = DEVICE_STATE_SLEEP;
ks_wlan_hw_power_save(priv);
}else{
priv->dev_state = DEVICE_STATE_READY;
-#if !defined(_SDIO_)
-   atomic_set(>psstatus.status,PS_ACTIVE_SET);
-#endif
}
 
 }
@@ -833,9 +788,6 @@ void hostif_connect_indication(ks_wlan_private *priv)
/* for power save */
atomic_set(>psstatus.snooze_guard, 0);
atomic_set(>psstatus.confirm_wait,0);
-#if !defined(_SDIO_)
-   atomic_set(>psstatus.status, PS_NONE);
-#endif
}
ks_wlan_do_power_save(priv);
 
@@ -894,10 +846,8 @@ void hostif_stop_confirm(ks_wlan_private *priv)
union iwreq_data wrqu0;
 
DPRINTK(3,"\n");
-#ifdef _SDIO_
if(priv->dev_state == DEVICE_STATE_SLEEP)
priv->dev_state = DEVICE_STATE_READY;
-#endif
 
/* disconnect indication */
  

renesas-drivers-2016-05-31-v4.7-rc1

2016-05-31 Thread Geert Uytterhoeven
I have pushed renesas-drivers-2016-05-31-v4.7-rc1 to
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git

This tree is meant to ease development of platform support and drivers
for Renesas ARM SoCs. It is created by merging (a) the for-next branches
of various subsystem trees and (b) branches with driver code submitted
or planned for submission to maintainers into the development branch of
Simon Horman's renesas.git tree.

Today's version is based on renesas-devel-20160530-v4.7-rc1.

Included branches with driver code:
  - topic/rcar-dmac-residue-v1
  - topic/rcar-dmac-hamza-v3
  - topic/ipmmu-multi-arch-v2
  - topic/ipmmu-CONFIG_IOMMU_DMA-update-v1
  - topic/r8a7795-ipmmu-v1
  - topic/salvator-x-ipmmu-rfc-v3-rebased4
  - topic/r8a7796-clk-v2
  - topic/r8a7796-sysc-v2
  - topic/scif-hwflow-v2
  - topic/scif-fifo-v1
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git#topic/r8a7796-v3
  - topic/r8a7796-sysc-dt-v1
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git#topic/sdr104-v3
  - git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git#staging/ks7010
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git#renesas/topic/pretimeout
  - https://git.ragnatech.se/linux#rcar-vin-for-renesas-drivers
  - git://linuxtv.org/pinchartl/media.git#for/renesas-drivers
  - git://linuxtv.org/pinchartl/media.git#vsp1/functions
  - topic/fcpf-v1

Included subsystem trees:
  - git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git#linux-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git#clk-next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git#for-next
  - git://git.infradead.org/users/dedekind/l2-mtd-2.6.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git#tty-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git#i2c/for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git#usb-next
  - git://people.freedesktop.org/~airlied/linux#drm-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git#next
  - git://linuxtv.org/mchehab/media-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git#mmc-next
  - git://git.linaro.org/people/ulf.hansson/mmc.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git#for-next
  - git://git.linaro.org/people/daniel.lezcano/linux.git#clockevents/next
  - git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git#testing/next
  - git://git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine.git#next
  - git://git.infradead.org/users/vkoul/slave-dma.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git#staging-next
  - 
git://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-arm.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git#next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git#for-next
  - git://git.infradead.org/users/jcooper/linux.git#irqchip/for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git#for-next
  - git://git.infradead.org/battery-2.6.git#master
  - git://www.linux-watchdog.org/linux-watchdog-next.git#master
  - git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git#for-next
  - git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git#for-next/core
  - git://anongit.freedesktop.org/drm-intel#topic/drm-misc
  - git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git#next
  - git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git#next
  - 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git#next

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH v3 3/4] mmc: sh_mobile_sdhi: Add tuning support

2016-05-31 Thread Geert Uytterhoeven
Hi Simon,

On Tue, May 24, 2016 at 4:43 AM, Simon Horman
 wrote:
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c

> @@ -403,6 +580,30 @@ static int sh_mobile_sdhi_probe(struct platform_device 
> *pdev)
> if (ret < 0)
> goto efree;
>
> +   if (host->mmc->caps & MMC_CAP_UHS_SDR104)
> +   host->mmc->caps |= MMC_CAP_HW_RESET;
> +
> +   if (of_id && of_id->data) {
> +   const struct sh_mobile_sdhi_of_data *of_data = of_id->data;
> +   const struct sh_mobile_sdhi_scc *taps = of_data->taps;
> +   bool hit = false;
> +
> +   for (i = 0; i < of_data->taps_num; i++) {
> +   if (taps[i].clk_rate == 0 ||
> +   taps[i].clk_rate == host->mmc->f_max) {
> +   host->scc_tappos = taps->tap;
> +   hit = true;
> +   break;
> +   }
> +   }
> +
> +   if (!hit)
> +   dev_warn(>pdev->dev, "Unknown clock rate for 
> SDR104 and HS200\n");

This warning triggers on sh7a0/kzm9g, r8a73a4/ape6evm, and
r8a7740/armadillo.

Perhaps the tap code should check if MMC_CAP_UHS_SDR104 is
enabled?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 31/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 3aef7b7..16279d3 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -227,10 +227,11 @@ static int rsrc_card_parse_links(struct device_node *np,
priv->codec_conf.of_node = dai_link->codec_of_node;
priv->codec_conf.name_prefix = of_data->prefix;
} else {
-   snd_soc_of_parse_audio_prefix(>snd_card,
- >codec_conf,
- dai_link->codec_of_node,
- "audio-prefix");
+   ret = 
asoc_simple_card_parse_card_prefix(>snd_card,
+   dai_link, >codec_conf,
+   "audio-");
+   if (ret < 0)
+   return ret;
}
}
 
-- 
1.9.1



[PATCH 32/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_tdm()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 16279d3..da3f219 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -161,15 +161,6 @@ static int rsrc_card_parse_links(struct device_node *np,
int is_single_links = 0;
int ret;
 
-   /* Parse TDM slot */
-   ret = snd_soc_of_parse_tdm_slot(np,
-   _props->tx_slot_mask,
-   _props->rx_slot_mask,
-   _props->slots,
-   _props->slot_width);
-   if (ret)
-   return ret;
-
if (is_fe) {
/* BE is dummy */
dai_link->codec_of_node = NULL;
@@ -235,6 +226,10 @@ static int rsrc_card_parse_links(struct device_node *np,
}
}
 
+   ret = asoc_simple_card_parse_tdm(np, dai_props);
+   if (ret < 0)
+   return ret;
+
ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
if (ret < 0)
return ret;
-- 
1.9.1



[PATCH 30/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 87b9d87..3aef7b7 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -334,9 +334,6 @@ static int rsrc_card_parse_of(struct device_node *node,
   "audio-routing");
}
 
-   /* Parse the card name from DT */
-   snd_soc_of_parse_card_name(>snd_card, "card-name");
-
/* sampling rate convert */
of_property_read_u32(node, "convert-rate", >convert_rate);
 
@@ -352,8 +349,9 @@ static int rsrc_card_parse_of(struct device_node *node,
if (ret < 0)
return ret;
 
-   if (!priv->snd_card.name)
-   priv->snd_card.name = priv->snd_card.dai_link->name;
+   ret = asoc_simple_card_parse_card_name(>snd_card, "card-");
+   if (ret < 0)
+   return ret;
 
return 0;
 }
-- 
1.9.1



Re: [PATCH 0/4] RCar r8a7795 FCPF support

2016-05-31 Thread Geert Uytterhoeven
Hi Kieran,

On Fri, May 27, 2016 at 7:19 PM, Kieran Bingham  wrote:
> An RCar FCP driver is available with support for the FCPV module for VSP.
> This series updates that driver to support the FCPF and then provide the
> relevant nodes in the r8a7795 device tree.
>
> Checkpatch generates a warning on these DT references but they are
> documented under Documentation/devicetree/bindings/media/renesas,fcp.txt
>
> These patches are based on Geert's renesas-drivers tree, and are pushed
> to a branch at g...@github.com:kbingham/linux.git renesas/fcpf for
> convenience.

As this is based on previous renesas-drivers release, which included the
Salvator-X HDMI prototype, I created a topic branch topic/fcpf-v1 just
containing your changes.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 29/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 27 +++
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index c326562..87b9d87 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -62,6 +62,9 @@ struct rsrc_card_priv {
 #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
 #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
+#define DAI"sound-dai"
+#define CELL   "#sound-dai-cells"
+
 static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -155,18 +158,9 @@ static int rsrc_card_parse_links(struct device_node *np,
struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-   struct of_phandle_args args;
+   int is_single_links = 0;
int ret;
 
-   /*
-* Get node via "sound-dai = < port>"
-* it will be used as xxx_of_node on soc_bind_dai_link()
-*/
-   ret = of_parse_phandle_with_args(np, "sound-dai",
-"#sound-dai-cells", 0, );
-   if (ret)
-   return ret;
-
/* Parse TDM slot */
ret = snd_soc_of_parse_tdm_slot(np,
_props->tx_slot_mask,
@@ -185,9 +179,10 @@ static int rsrc_card_parse_links(struct device_node *np,
/* FE settings */
dai_link->dynamic   = 1;
dai_link->dpcm_merged_format= 1;
-   dai_link->cpu_of_node   = args.np;
-   ret = snd_soc_of_get_dai_name(np, _link->cpu_dai_name);
-   if (ret < 0)
+
+   ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
+_single_links);
+   if (ret)
return ret;
 
ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
@@ -203,7 +198,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 *  fmt_single_name()
 *  fmt_multiple_name()
 */
-   if (!args.args_count)
+   if (is_single_links)
dai_link->cpu_dai_name = NULL;
} else {
const struct rsrc_card_of_data *of_data;
@@ -218,8 +213,8 @@ static int rsrc_card_parse_links(struct device_node *np,
/* BE settings */
dai_link->no_pcm= 1;
dai_link->be_hw_params_fixup= rsrc_card_be_hw_params_fixup;
-   dai_link->codec_of_node = args.np;
-   ret = snd_soc_of_get_dai_name(np, _link->codec_dai_name);
+
+   ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
if (ret < 0)
return ret;
 
-- 
1.9.1



[PATCH 28/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_clk()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 68 +++
 1 file changed, 10 insertions(+), 58 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e28c9c0..c326562 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -190,6 +190,10 @@ static int rsrc_card_parse_links(struct device_node *np,
if (ret < 0)
return ret;
 
+   ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
+   if (ret < 0)
+   return ret;
+
/*
 * In soc_bind_dai_link() will check cpu name after
 * of_node matching if dai_link has cpu_dai_name.
@@ -219,6 +223,10 @@ static int rsrc_card_parse_links(struct device_node *np,
if (ret < 0)
return ret;
 
+   ret = asoc_simple_card_parse_clk_codec(np, dai_link, dai_props);
+   if (ret < 0)
+   return ret;
+
/* additional name prefix */
if (of_data) {
priv->codec_conf.of_node = dai_link->codec_of_node;
@@ -242,68 +250,12 @@ static int rsrc_card_parse_links(struct device_node *np,
dai_link->ops   = _card_ops;
dai_link->init  = rsrc_card_dai_init;
 
-   return 0;
-}
-
-static int rsrc_card_parse_clk(struct device_node *np,
-  struct rsrc_card_priv *priv,
-  int idx, bool is_fe)
-{
-   struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-   struct clk *clk;
-   struct device_node *of_np = is_fe ? dai_link->cpu_of_node :
-   dai_link->codec_of_node;
-   u32 val;
-
-   /*
-* Parse dai->sysclk come from "clocks = <>"
-* (if system has common clock)
-*  or "system-clock-frequency = "
-*  or device's module clock.
-*/
-   if (of_property_read_bool(np, "clocks")) {
-   clk = of_clk_get(np, 0);
-   if (IS_ERR(clk))
-   return PTR_ERR(clk);
-
-   dai_props->sysclk = clk_get_rate(clk);
-   dai_props->clk = clk;
-   } else if (!of_property_read_u32(np, "system-clock-frequency", )) {
-   dai_props->sysclk = val;
-   } else {
-   clk = of_clk_get(of_np, 0);
-   if (!IS_ERR(clk))
-   dai_props->sysclk = clk_get_rate(clk);
-   }
-
-   return 0;
-}
-
-static int rsrc_card_dai_sub_link_of(struct device_node *node,
-struct device_node *np,
-struct rsrc_card_priv *priv,
-int idx, bool is_fe)
-{
-   struct device *dev = rsrc_priv_to_dev(priv);
-   struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-   int ret;
-
-   ret = rsrc_card_parse_links(np, priv, idx, is_fe);
-   if (ret < 0)
-   return ret;
-
-   ret = rsrc_card_parse_clk(np, priv, idx, is_fe);
-   if (ret < 0)
-   return ret;
-
dev_dbg(dev, "\t%s / %04x / %d\n",
dai_link->name,
dai_link->dai_fmt,
dai_props->sysclk);
 
-   return ret;
+   return 0;
 }
 
 static int rsrc_card_dai_link_of(struct device_node *node,
@@ -340,7 +292,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
if (strcmp(np->name, "cpu") == 0)
is_fe = true;
 
-   ret = rsrc_card_dai_sub_link_of(node, np, priv, i, is_fe);
+   ret = rsrc_card_parse_links(np, priv, i, is_fe);
if (ret < 0)
return ret;
i++;
-- 
1.9.1



[PATCH 25/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/Kconfig  |  1 +
 sound/soc/sh/rcar/rsrc-card.c | 38 --
 2 files changed, 5 insertions(+), 34 deletions(-)

diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index c9902a6..9311f11 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -44,6 +44,7 @@ config SND_SOC_RCAR
 
 config SND_SOC_RSRC_CARD
tristate "Renesas Sampling Rate Convert Sound Card"
+   select SND_SIMPLE_CARD_UTILS
help
  This option enables simple sound if you need sampling rate convert
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index b85b5ee..c065a6d 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct rsrc_card_of_data {
const char *prefix;
@@ -158,38 +159,6 @@ static int rsrc_card_be_hw_params_fixup(struct 
snd_soc_pcm_runtime *rtd,
return 0;
 }
 
-static int rsrc_card_parse_daifmt(struct device_node *node,
- struct device_node *codec,
- struct rsrc_card_priv *priv,
- struct snd_soc_dai_link *dai_link,
- unsigned int *retfmt)
-{
-   struct device_node *bitclkmaster = NULL;
-   struct device_node *framemaster = NULL;
-   unsigned int daifmt;
-
-   daifmt = snd_soc_of_parse_daifmt(node, NULL,
-, );
-   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-   if (!bitclkmaster && !framemaster)
-   return -EINVAL;
-
-   if (codec == bitclkmaster)
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-   else
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-   of_node_put(bitclkmaster);
-   of_node_put(framemaster);
-
-   *retfmt = daifmt;
-
-   return 0;
-}
-
 static int rsrc_card_parse_links(struct device_node *np,
 struct rsrc_card_priv *priv,
 int idx, bool is_fe)
@@ -357,6 +326,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node 
*node,
 static int rsrc_card_dai_link_of(struct device_node *node,
 struct rsrc_card_priv *priv)
 {
+   struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link;
struct device_node *np;
unsigned int daifmt = 0;
@@ -369,8 +339,8 @@ static int rsrc_card_dai_link_of(struct device_node *node,
dai_link = rsrc_priv_to_link(priv, i);
 
if (strcmp(np->name, "codec") == 0) {
-   ret = rsrc_card_parse_daifmt(node, np, priv,
-dai_link, );
+   ret = asoc_simple_card_parse_daifmt(dev, node, np,
+   NULL, );
if (ret < 0)
return ret;
break;
-- 
1.9.1



[PATCH 27/39 v2] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index aad8f8c..e28c9c0 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -47,22 +47,12 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-struct rsrc_card_dai {
-   unsigned int sysclk;
-   unsigned int tx_slot_mask;
-   unsigned int rx_slot_mask;
-   int slots;
-   int slot_width;
-   struct clk *clk;
-   const char *name;
-};
-
 #define IDX_CPU0
 #define IDX_CODEC  1
 struct rsrc_card_priv {
struct snd_soc_card snd_card;
struct snd_soc_codec_conf codec_conf;
-   struct rsrc_card_dai *dai_props;
+   struct asoc_simple_dai *dai_props;
struct snd_soc_dai_link *dai_link;
u32 convert_rate;
u32 convert_channels;
@@ -76,7 +66,7 @@ static int rsrc_card_startup(struct snd_pcm_substream 
*substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct rsrc_card_priv *priv =   snd_soc_card_get_drvdata(rtd->card);
-   struct rsrc_card_dai *dai_props =
+   struct asoc_simple_dai *dai_props =
rsrc_priv_to_props(priv, rtd->num);
 
return clk_prepare_enable(dai_props->clk);
@@ -86,7 +76,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream 
*substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct rsrc_card_priv *priv =   snd_soc_card_get_drvdata(rtd->card);
-   struct rsrc_card_dai *dai_props =
+   struct asoc_simple_dai *dai_props =
rsrc_priv_to_props(priv, rtd->num);
 
clk_disable_unprepare(dai_props->clk);
@@ -102,7 +92,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime 
*rtd)
struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai;
struct snd_soc_dai_link *dai_link;
-   struct rsrc_card_dai *dai_props;
+   struct asoc_simple_dai *dai_props;
int num = rtd->num;
int ret;
 
@@ -164,7 +154,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 {
struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct of_phandle_args args;
int ret;
 
@@ -260,7 +250,7 @@ static int rsrc_card_parse_clk(struct device_node *np,
   int idx, bool is_fe)
 {
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct clk *clk;
struct device_node *of_np = is_fe ? dai_link->cpu_of_node :
dai_link->codec_of_node;
@@ -297,7 +287,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node 
*node,
 {
struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-   struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+   struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
int ret;
 
ret = rsrc_card_parse_links(np, priv, idx, is_fe);
@@ -364,7 +354,7 @@ static int rsrc_card_parse_of(struct device_node *node,
  struct device *dev)
 {
const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev);
-   struct rsrc_card_dai *props;
+   struct asoc_simple_dai *props;
struct snd_soc_dai_link *links;
int ret;
int num;
-- 
1.9.1



[PATCH 26/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/rsrc-card.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index c065a6d..aad8f8c 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -47,7 +47,6 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-#define DAI_NAME_NUM   32
 struct rsrc_card_dai {
unsigned int sysclk;
unsigned int tx_slot_mask;
@@ -55,7 +54,7 @@ struct rsrc_card_dai {
int slots;
int slot_width;
struct clk *clk;
-   char dai_name[DAI_NAME_NUM];
+   const char *name;
 };
 
 #define IDX_CPU0
@@ -163,6 +162,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 struct rsrc_card_priv *priv,
 int idx, bool is_fe)
 {
+   struct device *dev = rsrc_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
struct of_phandle_args args;
@@ -200,10 +200,6 @@ static int rsrc_card_parse_links(struct device_node *np,
if (ret < 0)
return ret;
 
-   /* set dai_name */
-   snprintf(dai_props->dai_name, DAI_NAME_NUM, "fe.%s",
-dai_link->cpu_dai_name);
-
/*
 * In soc_bind_dai_link() will check cpu name after
 * of_node matching if dai_link has cpu_dai_name.
@@ -216,7 +212,6 @@ static int rsrc_card_parse_links(struct device_node *np,
if (!args.args_count)
dai_link->cpu_dai_name = NULL;
} else {
-   struct device *dev = rsrc_priv_to_dev(priv);
const struct rsrc_card_of_data *of_data;
 
of_data = of_device_get_match_data(dev);
@@ -244,18 +239,16 @@ static int rsrc_card_parse_links(struct device_node *np,
  dai_link->codec_of_node,
  "audio-prefix");
}
-
-   /* set dai_name */
-   snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-dai_link->codec_dai_name);
}
 
+   ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+   if (ret < 0)
+   return ret;
+
/* Simple Card assumes platform == cpu */
dai_link->platform_of_node  = dai_link->cpu_of_node;
dai_link->dpcm_playback = 1;
dai_link->dpcm_capture  = 1;
-   dai_link->name  = dai_props->dai_name;
-   dai_link->stream_name   = dai_props->dai_name;
dai_link->ops   = _card_ops;
dai_link->init  = rsrc_card_dai_init;
 
@@ -316,7 +309,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node 
*node,
return ret;
 
dev_dbg(dev, "\t%s / %04x / %d\n",
-   dai_props->dai_name,
+   dai_link->name,
dai_link->dai_fmt,
dai_props->sysclk);
 
-- 
1.9.1



[PATCH 1/2] arm64: dts: r8a7796: Add SYSC PM Domains

2016-05-31 Thread Geert Uytterhoeven
Add a device node for the System Controller.
Hook up the Cortex-A57 CPU core and L2 cache/SCU to their respective PM
Domains.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 178debf68318fde4..85f0843ddd874378 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -10,6 +10,7 @@
 
 #include 
 #include 
+#include 
 
 / {
compatible = "renesas,r8a7796";
@@ -30,6 +31,7 @@
compatible = "arm,cortex-a57", "arm,armv8";
reg = <0x0>;
device_type = "cpu";
+   power-domains = < R8A7796_PD_CA57_CPU0>;
next-level-cache = <_CA57>;
enable-method = "psci";
};
@@ -37,6 +39,7 @@
L2_CA57: cache-controller@0 {
compatible = "cache";
reg = <0>;
+   power-domains = < R8A7796_PD_CA57_SCU>;
cache-unified;
cache-level = <2>;
};
@@ -104,6 +107,12 @@
#power-domain-cells = <0>;
};
 
+   sysc: system-controller@e618 {
+   compatible = "renesas,r8a7796-sysc";
+   reg = <0 0xe618 0 0x0400>;
+   #power-domain-cells = <1>;
+   };
+
scif2: serial@e6e88000 {
compatible = "renesas,scif-r8a7796",
 "renesas,rcar-gen3-scif", "renesas,scif";
-- 
1.9.1



[PATCH 24/39 v2] ASoC: simple-card: use asoc_simple_card_clean_reference()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 19 ++-
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c9178af..02fab53 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -371,21 +371,6 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int asoc_simple_card_unref(struct snd_soc_card *card)
-{
-   struct snd_soc_dai_link *dai_link;
-   int num_links;
-
-   for (num_links = 0, dai_link = card->dai_link;
-num_links < card->num_links;
-num_links++, dai_link++) {
-   of_node_put(dai_link->cpu_of_node);
-   of_node_put(dai_link->codec_of_node);
-   }
-   return 0;
-}
-
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
struct simple_card_data *priv;
@@ -471,7 +456,7 @@ static int asoc_simple_card_probe(struct platform_device 
*pdev)
return ret;
 
 err:
-   asoc_simple_card_unref(>snd_card);
+   asoc_simple_card_clean_reference(>snd_card);
return ret;
 }
 
@@ -483,7 +468,7 @@ static int asoc_simple_card_remove(struct platform_device 
*pdev)
asoc_simple_card_remove_jack(>hp_jack);
asoc_simple_card_remove_jack(>mic_jack);
 
-   return asoc_simple_card_unref(card);
+   return asoc_simple_card_clean_reference(card);
 }
 
 static const struct of_device_id asoc_simple_of_match[] = {
-- 
1.9.1



[PATCH 23/39 v2] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 11fd7de..c9178af 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -300,17 +300,9 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
dai_link->codec_dai_name,
dai_props->codec_dai.sysclk);
 
-   /*
-* In soc_bind_dai_link() will check cpu name after
-* of_node matching if dai_link has cpu_dai_name.
-* but, it will never match if name was created by
-* fmt_single_name() remove cpu_dai_name if cpu_args
-* was 0. See:
-*  fmt_single_name()
-*  fmt_multiple_name()
-*/
-   if (single_cpu)
-   dai_link->cpu_dai_name = NULL;
+   ret = asoc_simple_card_canonicalize_cpu(dai_link, single_cpu);
+   if (ret < 0)
+   goto dai_link_of_err;
 
 dai_link_of_err:
of_node_put(cpu);
-- 
1.9.1



[PATCH 0/2] arm64: dts: r8a7796: Add SYSC PM Domains

2016-05-31 Thread Geert Uytterhoeven
Hi Simon, Magnus,

This patch series adds support for the power areas exposed by the System
Controller on the Renesas R-Car M3-W SoC to the DTS.

This series is against Simon's "[PATCH v3 0/3] arm64: Add Renesas
R8A7796 SoC support".  It has a build and runtime dependency on my series
"[PATCH v2 0/3] soc: renesas: rcar-sysc: Add support for R-Car M3-W power
areas".

For your convenience, I've pushed this series to the
topic/r8a7796-sysc-dt-v1 branch of
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git.
This has been tested on r8a7796/salvator-x.

Thanks!

Geert Uytterhoeven (2):
  arm64: dts: r8a7796: Add SYSC PM Domains
  arm64: dts: r8a7796: Use SYSC "always-on" PM Domain

 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


[PATCH 2/2] arm64: dts: r8a7796: Use SYSC "always-on" PM Domain

2016-05-31 Thread Geert Uytterhoeven
Hook up all devices that are part of the CPG/MSSR Clock Domain to the
SYSC "always-on" PM Domain, for a more consistent device-power-area
description in DT.

Signed-off-by: Geert Uytterhoeven 
---
 arch/arm64/boot/dts/renesas/r8a7796.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi 
b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
index 85f0843ddd874378..fab61eddede3818c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi
@@ -122,7 +122,7 @@
 < CPG_CORE R8A7796_CLK_S3D1>,
 <_clk>;
clock-names = "fck", "brg_int", "scif_clk";
-   power-domains = <>;
+   power-domains = < R8A7796_PD_ALWAYS_ON>;
status = "disabled";
};
};
-- 
1.9.1



[PATCH 22/39 v2] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 09ccbb0..11fd7de 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -280,14 +280,9 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
if (ret < 0)
goto dai_link_of_err;
 
-   if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-   ret = -EINVAL;
+   ret = asoc_simple_card_canonicalize_dailink(dai_link);
+   if (ret < 0)
goto dai_link_of_err;
-   }
-
-   /* Assumes platform == cpu */
-   if (!dai_link->platform_of_node)
-   dai_link->platform_of_node = dai_link->cpu_of_node;
 
ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
if (ret < 0)
-- 
1.9.1



[PATCH 21/39 v2] ASoC: simple-card: use asoc_simple_card_init_dai()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 38 +++---
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 8d2ce0a..09ccbb0 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -179,51 +179,19 @@ static struct snd_soc_ops asoc_simple_card_ops = {
.hw_params = asoc_simple_card_hw_params,
 };
 
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
-  struct asoc_simple_dai *set)
-{
-   int ret;
-
-   if (set->sysclk) {
-   ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-   if (ret && ret != -ENOTSUPP) {
-   dev_err(dai->dev, "simple-card: set_sysclk error\n");
-   goto err;
-   }
-   }
-
-   if (set->slots) {
-   ret = snd_soc_dai_set_tdm_slot(dai,
-  set->tx_slot_mask,
-  set->rx_slot_mask,
-   set->slots,
-   set->slot_width);
-   if (ret && ret != -ENOTSUPP) {
-   dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
-   goto err;
-   }
-   }
-
-   ret = 0;
-
-err:
-   return ret;
-}
-
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *codec = rtd->codec_dai;
struct snd_soc_dai *cpu = rtd->cpu_dai;
-   struct simple_dai_props *dai_props;
+   struct simple_dai_props *dai_props = >dai_props[rtd->num];
int ret;
 
-   dai_props = >dai_props[rtd->num];
-   ret = __asoc_simple_card_dai_init(codec, _props->codec_dai);
+   ret = asoc_simple_card_init_dai(codec, _props->codec_dai);
if (ret < 0)
return ret;
 
-   ret = __asoc_simple_card_dai_init(cpu, _props->cpu_dai);
+   ret = asoc_simple_card_init_dai(cpu, _props->cpu_dai);
if (ret < 0)
return ret;
 
-- 
1.9.1



[PATCH 20/39 v2] ASoC: simple-card: use asoc_simple_card_parse_dailink_name()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 35ec012c..8d2ce0a 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -251,7 +251,6 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
struct device_node *cpu = NULL;
struct device_node *plat = NULL;
struct device_node *codec = NULL;
-   char *name;
char prop[128];
char *prefix = "";
int ret, single_cpu;
@@ -322,19 +321,10 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
if (!dai_link->platform_of_node)
dai_link->platform_of_node = dai_link->cpu_of_node;
 
-   /* DAI link name is created from CPU/CODEC dai name */
-   name = devm_kzalloc(dev,
-   strlen(dai_link->cpu_dai_name)   +
-   strlen(dai_link->codec_dai_name) + 2,
-   GFP_KERNEL);
-   if (!name) {
-   ret = -ENOMEM;
+   ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+   if (ret < 0)
goto dai_link_of_err;
-   }
 
-   sprintf(name, "%s-%s", dai_link->cpu_dai_name,
-   dai_link->codec_dai_name);
-   dai_link->name = dai_link->stream_name = name;
dai_link->ops = _simple_card_ops;
dai_link->init = asoc_simple_card_dai_init;
 
-- 
1.9.1



[PATCH 19/39 v2] ASoC: simple-card: use asoc_simple_card_parse_card_name()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2aa21a4..35ec012c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -376,9 +376,6 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (!node)
return -EINVAL;
 
-   /* Parse the card name from DT */
-   snd_soc_of_parse_card_name(>snd_card, PREFIX "name");
-
/* The off-codec widgets */
if (of_property_read_bool(node, PREFIX "widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(>snd_card,
@@ -400,9 +397,6 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
if (ret == 0)
priv->mclk_fs = val;
 
-   dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
-   priv->snd_card.name : "");
-
/* Single/Muti DAI link(s) & New style of DT node */
if (of_get_child_by_name(node, PREFIX "dai-link")) {
struct device_node *np = NULL;
@@ -425,8 +419,9 @@ static int asoc_simple_card_parse_of(struct device_node 
*node,
return ret;
}
 
-   if (!priv->snd_card.name)
-   priv->snd_card.name = priv->snd_card.dai_link->name;
+   ret = asoc_simple_card_parse_card_name(>snd_card, PREFIX);
+   if (ret)
+   return ret;
 
return 0;
 }
-- 
1.9.1



[PATCH 18/39 v2] ASoC: simple-card: use asoc_simple_card_parse_tdm()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 40 ++--
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f0f45bf..2aa21a4 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -238,31 +238,6 @@ static int asoc_simple_card_dai_init(struct 
snd_soc_pcm_runtime *rtd)
return 0;
 }
 
-static int
-asoc_simple_card_sub_parse_of(struct device_node *np,
- struct asoc_simple_dai *dai,
- struct device_node **p_node,
- const char **name,
- int *args_count)
-{
-   int ret;
-
-   if (!np)
-   return 0;
-
-   if (!dai)
-   return 0;
-
-   /* Parse TDM slot */
-   ret = snd_soc_of_parse_tdm_slot(np, >tx_slot_mask,
-   >rx_slot_mask,
-   >slots, >slot_width);
-   if (ret)
-   return ret;
-
-   return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
struct simple_card_data *priv,
int idx,
@@ -322,22 +297,11 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
if (ret < 0)
goto dai_link_of_err;
 
-   ret = asoc_simple_card_sub_parse_of(cpu, _props->cpu_dai,
-   _link->cpu_of_node,
-   _link->cpu_dai_name,
-   _cpu);
-   if (ret < 0)
-   goto dai_link_of_err;
-
-   ret = asoc_simple_card_sub_parse_of(codec, _props->codec_dai,
-   _link->codec_of_node,
-   _link->codec_dai_name, NULL);
+   ret = asoc_simple_card_parse_tdm(cpu, cpu_dai);
if (ret < 0)
goto dai_link_of_err;
 
-   ret = asoc_simple_card_sub_parse_of(plat, NULL,
-   _link->platform_of_node,
-   NULL, NULL);
+   ret = asoc_simple_card_parse_tdm(codec, codec_dai);
if (ret < 0)
goto dai_link_of_err;
 
-- 
1.9.1



[PATCH 17/39 v2] ASoC: simple-card: use asoc_simple_card_parse_endpoint()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 43 +
 1 file changed, 18 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 6a4d1d4..f0f45bf 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -44,6 +44,8 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define DAI"sound-dai"
+#define CELL   "#sound-dai-cells"
 #define PREFIX "simple-audio-card,"
 
 #define asoc_simple_card_init_hp(card, sjack, prefix)\
@@ -243,33 +245,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
  const char **name,
  int *args_count)
 {
-   struct of_phandle_args args;
int ret;
 
if (!np)
return 0;
 
-   /*
-* Get node via "sound-dai = < port>"
-* it will be used as xxx_of_node on soc_bind_dai_link()
-*/
-   ret = of_parse_phandle_with_args(np, "sound-dai",
-"#sound-dai-cells", 0, );
-   if (ret)
-   return ret;
-
-   *p_node = args.np;
-
-   if (args_count)
-   *args_count = args.args_count;
-
-   /* Get dai->name */
-   if (name) {
-   ret = snd_soc_of_get_dai_name(np, name);
-   if (ret < 0)
-   return ret;
-   }
-
if (!dai)
return 0;
 
@@ -299,7 +279,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
char *name;
char prop[128];
char *prefix = "";
-   int ret, cpu_args;
+   int ret, single_cpu;
u32 val;
 
/* For single DAI link & old style of DT node */
@@ -329,10 +309,23 @@ static int asoc_simple_card_dai_link_of(struct 
device_node *node,
if (!of_property_read_u32(node, "mclk-fs", ))
dai_props->mclk_fs = val;
 
+   ret = asoc_simple_card_parse_cpu(cpu, dai_link,
+DAI, CELL, _cpu);
+   if (ret < 0)
+   goto dai_link_of_err;
+
+   ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL);
+   if (ret < 0)
+   goto dai_link_of_err;
+
+   ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL);
+   if (ret < 0)
+   goto dai_link_of_err;
+
ret = asoc_simple_card_sub_parse_of(cpu, _props->cpu_dai,
_link->cpu_of_node,
_link->cpu_dai_name,
-   _args);
+   _cpu);
if (ret < 0)
goto dai_link_of_err;
 
@@ -399,7 +392,7 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
 *  fmt_single_name()
 *  fmt_multiple_name()
 */
-   if (!cpu_args)
+   if (single_cpu)
dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-- 
1.9.1



[PATCH 15/39 v2] ASoC: simple-card: use asoc_simple_card_parse_daifmt()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card.h | 11 +-
 sound/soc/generic/Kconfig   |  1 +
 sound/soc/generic/simple-card.c | 46 ++---
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 0399352..a6a2e15 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -13,16 +13,7 @@
 #define __SIMPLE_CARD_H
 
 #include 
-
-struct asoc_simple_dai {
-   const char *name;
-   unsigned int sysclk;
-   int slots;
-   int slot_width;
-   unsigned int tx_slot_mask;
-   unsigned int rx_slot_mask;
-   struct clk *clk;
-};
+#include 
 
 struct asoc_simple_card_info {
const char *name;
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 26c2fe6..c01c5dd 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_UTILS
 
 config SND_SIMPLE_CARD
tristate "ASoC Simple sound card support"
+   select SND_SIMPLE_CARD_UTILS
help
  This option enables generic simple sound card support
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 8d0311c..e3a32d3 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -308,48 +308,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
return 0;
 }
 
-static int asoc_simple_card_parse_daifmt(struct device_node *node,
-struct simple_card_data *priv,
-struct device_node *codec,
-char *prefix, int idx)
-{
-   struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
-   struct device *dev = simple_priv_to_dev(priv);
-   struct device_node *bitclkmaster = NULL;
-   struct device_node *framemaster = NULL;
-   unsigned int daifmt;
-
-   daifmt = snd_soc_of_parse_daifmt(node, prefix,
-, );
-   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-   if (strlen(prefix) && !bitclkmaster && !framemaster) {
-   /*
-* No dai-link level and master setting was not found from
-* sound node level, revert back to legacy DT parsing and
-* take the settings from codec node.
-*/
-   dev_dbg(dev, "Revert to legacy daifmt parsing\n");
-
-   daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
-   (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
-   } else {
-   if (codec == bitclkmaster)
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-   else
-   daifmt |= (codec == framemaster) ?
-   SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-   }
-
-   dai_link->dai_fmt = daifmt;
-
-   of_node_put(bitclkmaster);
-   of_node_put(framemaster);
-
-   return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
struct simple_card_data *priv,
int idx,
@@ -386,8 +344,8 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
goto dai_link_of_err;
}
 
-   ret = asoc_simple_card_parse_daifmt(node, priv,
-   codec, prefix, idx);
+   ret = asoc_simple_card_parse_daifmt(dev, node, codec,
+   prefix, _link->dai_fmt);
if (ret < 0)
goto dai_link_of_err;
 
-- 
1.9.1



[PATCH 16/39 v2] ASoC: simple-card: use asoc_simple_card_parse_clk()

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 35 ++-
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index e3a32d3..6a4d1d4 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
  int *args_count)
 {
struct of_phandle_args args;
-   struct clk *clk;
-   u32 val;
int ret;
 
if (!np)
@@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
if (ret)
return ret;
 
-   /*
-* Parse dai->sysclk come from "clocks = <>"
-* (if system has common clock)
-*  or "system-clock-frequency = "
-*  or device's module clock.
-*/
-   if (of_property_read_bool(np, "clocks")) {
-   clk = of_clk_get(np, 0);
-   if (IS_ERR(clk)) {
-   ret = PTR_ERR(clk);
-   return ret;
-   }
-
-   dai->sysclk = clk_get_rate(clk);
-   dai->clk = clk;
-   } else if (!of_property_read_u32(np, "system-clock-frequency", )) {
-   dai->sysclk = val;
-   } else {
-   clk = of_clk_get(args.np, 0);
-   if (!IS_ERR(clk))
-   dai->sysclk = clk_get_rate(clk);
-   }
-
return 0;
 }
 
@@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+   struct asoc_simple_dai *cpu_dai = _props->cpu_dai;
+   struct asoc_simple_dai *codec_dai = _props->codec_dai;
struct device_node *cpu = NULL;
struct device_node *plat = NULL;
struct device_node *codec = NULL;
@@ -371,6 +348,14 @@ static int asoc_simple_card_dai_link_of(struct device_node 
*node,
if (ret < 0)
goto dai_link_of_err;
 
+   ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+   if (ret < 0)
+   goto dai_link_of_err;
+
+   ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+   if (ret < 0)
+   goto dai_link_of_err;
+
if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
ret = -EINVAL;
goto dai_link_of_err;
-- 
1.9.1



[PATCH 13/39 v2] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

simple-card needs remove dai_link->cpu_dai_name if it CPU was
single DAI.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  2 ++
 sound/soc/generic/simple-card-utils.c | 19 +++
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index d5d88bb..7846467 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -69,5 +69,7 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
  struct asoc_simple_dai *simple_dai);
 
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+ int is_single_links);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 2524f21..b8977ca 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -252,3 +252,22 @@ int asoc_simple_card_canonicalize_dailink(struct 
snd_soc_dai_link *dai_link)
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
+
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+ int is_single_links)
+{
+   /*
+* In soc_bind_dai_link() will check cpu name after
+* of_node matching if dai_link has cpu_dai_name.
+* but, it will never match if name was created by
+* fmt_single_name() remove cpu_dai_name if cpu_args
+* was 0. See:
+*  fmt_single_name()
+*  fmt_multiple_name()
+*/
+   if (is_single_links)
+   dai_link->cpu_dai_name = NULL;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
-- 
1.9.1



[PATCH 14/39 v2] ASoC: simple-card-utils: add asoc_simple_card_clean_reference()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

simple-card needs to decrease the reference count of the device nodes.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  2 ++
 sound/soc/generic/simple-card-utils.c | 15 +++
 2 files changed, 17 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 7846467..7dbb349 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -72,4 +72,6 @@ int asoc_simple_card_canonicalize_dailink(struct 
snd_soc_dai_link *dai_link);
 int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
  int is_single_links);
 
+int asoc_simple_card_clean_reference(struct snd_soc_card *card);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index b8977ca..8bd4c83 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -271,3 +271,18 @@ int asoc_simple_card_canonicalize_cpu(struct 
snd_soc_dai_link *dai_link,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
+
+int asoc_simple_card_clean_reference(struct snd_soc_card *card)
+{
+   struct snd_soc_dai_link *dai_link;
+   int num_links;
+
+   for (num_links = 0, dai_link = card->dai_link;
+num_links < card->num_links;
+num_links++, dai_link++) {
+   of_node_put(dai_link->cpu_of_node);
+   of_node_put(dai_link->codec_of_node);
+   }
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);
-- 
1.9.1



[PATCH 11/39 v2] ASoC: simple-card-utils: add asoc_simple_card_init_dai()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

simple-card is supporting clock/tdm slot initialization.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  2 ++
 sound/soc/generic/simple-card-utils.c | 29 +
 2 files changed, 31 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 1a77d72..289e61d 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -65,4 +65,6 @@ int asoc_simple_card_parse_endpoint(struct device_node 
*port_np,
  const char *cells_name,
  int *is_single_links);
 
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+ struct asoc_simple_dai *simple_dai);
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index a3d917d..4f434c4 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -210,3 +210,32 @@ int asoc_simple_card_parse_endpoint(struct device_node 
*port_np,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
+
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+ struct asoc_simple_dai *simple_dai)
+{
+   int ret;
+
+   if (simple_dai->sysclk) {
+   ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0);
+   if (ret && ret != -ENOTSUPP) {
+   dev_err(dai->dev, "simple-card: set_sysclk error\n");
+   return ret;
+   }
+   }
+
+   if (simple_dai->slots) {
+   ret = snd_soc_dai_set_tdm_slot(dai,
+  simple_dai->tx_slot_mask,
+  simple_dai->rx_slot_mask,
+  simple_dai->slots,
+  simple_dai->slot_width);
+   if (ret && ret != -ENOTSUPP) {
+   dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+   return ret;
+   }
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
-- 
1.9.1



[PATCH 12/39 v2] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

simple-card is assuming that sometimes platform and cpu are same.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  3 +++
 sound/soc/generic/simple-card-utils.c | 13 +
 2 files changed, 16 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 289e61d..d5d88bb 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -67,4 +67,7 @@ int asoc_simple_card_parse_endpoint(struct device_node 
*port_np,
 
 int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
  struct asoc_simple_dai *simple_dai);
+
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 4f434c4..2524f21 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -239,3 +239,16 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
+
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
+{
+   if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
+   return -EINVAL;
+
+   /* Assumes platform == cpu */
+   if (!dai_link->platform_of_node)
+   dai_link->platform_of_node = dai_link->cpu_of_node;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
-- 
1.9.1



[PATCH 08/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

DPCM might need audio prefix for route matching.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  4 
 sound/soc/generic/simple-card-utils.c | 17 +
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 2f991da..89172aa 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -33,5 +33,9 @@ int asoc_simple_card_parse_dailink_name(struct device *dev,
struct snd_soc_dai_link *dai_link);
 int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 char *prefix);
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+  struct snd_soc_dai_link *dai_link,
+  struct snd_soc_codec_conf *codec_conf,
+  char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index c782b3a..439fc01 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -125,3 +125,20 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card 
*card,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
+
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+  struct snd_soc_dai_link *dai_link,
+  struct snd_soc_codec_conf *codec_conf,
+  char *prefix)
+{
+   char prop[128];
+
+   snprintf(prop, sizeof(prop), "%sprefix", prefix);
+
+   snd_soc_of_parse_audio_prefix(card, codec_conf,
+ dai_link->codec_of_node,
+ prop);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
-- 
1.9.1



[PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Current simple-card can get clock via DT clocks or
"system-clock-frequency" property.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  8 
 sound/soc/generic/simple-card-utils.c | 30 ++
 2 files changed, 38 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 89172aa..b8a8649 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -38,4 +38,12 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card 
*card,
   struct snd_soc_codec_conf *codec_conf,
   char *prefix);
 
+#define asoc_simple_card_parse_clk_cpu(port_np, dai_link, simple_dai)\
+   asoc_simple_card_parse_clk(port_np, dai_link->cpu_of_node, simple_dai)
+#define asoc_simple_card_parse_clk_codec(port_np, dai_link, simple_dai)  \
+   asoc_simple_card_parse_clk(port_np, dai_link->codec_of_node, simple_dai)
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+  struct device_node *endpoint_np,
+  struct asoc_simple_dai *simple_dai);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 439fc01..dbf4b00 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -7,6 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include 
 #include 
 #include 
 
@@ -142,3 +143,32 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card 
*card,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
+
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+  struct device_node *endpoint_np,
+  struct asoc_simple_dai *simple_dai)
+{
+   struct clk *clk;
+   u32 val;
+
+   /*
+* Parse dai->sysclk come from "clocks = <>"
+* (if system has common clock)
+*  or "system-clock-frequency = "
+*  or device's module clock.
+*/
+   clk = of_clk_get(port_np, 0);
+   if (!IS_ERR(clk)) {
+   simple_dai->sysclk = clk_get_rate(clk);
+   simple_dai->clk = clk;
+   } else if (!of_property_read_u32(port_np, "system-clock-frequency", 
)) {
+   simple_dai->sysclk = val;
+   } else {
+   clk = of_clk_get(endpoint_np, 0);
+   if (!IS_ERR(clk))
+   simple_dai->sysclk = clk_get_rate(clk);
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
-- 
1.9.1



[PATCH 06/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name.
It can be "fe.CPU" or "be.Codec" if it was DPCM.
This patch adds simple card common function for it.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h |  2 ++
 sound/soc/generic/simple-card-utils.c | 42 +++
 2 files changed, 44 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 6bb2c5f..41e567b 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -29,5 +29,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
  unsigned int *retfmt);
 int asoc_simple_card_parse_tdm(struct device_node *port_np,
   struct asoc_simple_dai *simple_dai);
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+   struct snd_soc_dai_link *dai_link);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 86fb2cf..9b49b5a 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -63,3 +63,45 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np,
 _dai->slot_width);
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
+
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+   struct snd_soc_dai_link *dai_link)
+{
+   char *name = NULL;
+   int ret = -ENOMEM;
+
+   if (dai_link->dynamic && dai_link->cpu_dai_name) {
+   name = devm_kzalloc(dev,
+   strlen(dai_link->cpu_dai_name) + 4,
+   GFP_KERNEL);
+   if (name)
+   sprintf(name, "fe.%s", dai_link->cpu_dai_name);
+
+   } else if (dai_link->no_pcm && dai_link->codec_dai_name) {
+   name = devm_kzalloc(dev,
+   strlen(dai_link->codec_dai_name) + 4,
+   GFP_KERNEL);
+   if (name)
+   sprintf(name, "be.%s", dai_link->codec_dai_name);
+   } else if (dai_link->cpu_dai_name && dai_link->codec_dai_name) {
+   name = devm_kzalloc(dev,
+   strlen(dai_link->cpu_dai_name)   +
+   strlen(dai_link->codec_dai_name) + 2,
+   GFP_KERNEL);
+   if (name) {
+   sprintf(name, "%s-%s",
+   dai_link->cpu_dai_name,
+   dai_link->codec_dai_name);
+   }
+   }
+
+   if (name) {
+   ret = 0;
+
+   dai_link->name =
+   dai_link->stream_name = name;
+   }
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);
-- 
1.9.1



[PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()

2016-05-31 Thread Kuninori Morimoto
From: Kuninori Morimoto 

simple-card is supporting TDM.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h | 12 
 sound/soc/generic/simple-card-utils.c | 11 +++
 2 files changed, 23 insertions(+)

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
index 7acc798..6bb2c5f 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -12,10 +12,22 @@
 
 #include 
 
+struct asoc_simple_dai {
+   const char *name;
+   unsigned int sysclk;
+   int slots;
+   int slot_width;
+   unsigned int tx_slot_mask;
+   unsigned int rx_slot_mask;
+   struct clk *clk;
+};
+
 int asoc_simple_card_parse_daifmt(struct device *dev,
  struct device_node *node,
  struct device_node *codec,
  char *prefix,
  unsigned int *retfmt);
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+  struct asoc_simple_dai *simple_dai);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
index 3f6b725..86fb2cf 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -52,3 +52,14 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
+
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+  struct asoc_simple_dai *simple_dai)
+{
+   return snd_soc_of_parse_tdm_slot(port_np,
+_dai->tx_slot_mask,
+_dai->rx_slot_mask,
+_dai->slots,
+_dai->slot_width);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
-- 
1.9.1



[PATCH 04/39 v2] ASoC: add new simple-card-utils.c

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because it will be very difficult to keep compatibility.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch creates simple-card
helper utils, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto 
---
 include/sound/simple_card_utils.h | 21 ++
 sound/soc/generic/Kconfig |  3 ++
 sound/soc/generic/Makefile|  2 ++
 sound/soc/generic/simple-card-utils.c | 54 +++
 4 files changed, 80 insertions(+)
 create mode 100644 include/sound/simple_card_utils.h
 create mode 100644 sound/soc/generic/simple-card-utils.c

diff --git a/include/sound/simple_card_utils.h 
b/include/sound/simple_card_utils.h
new file mode 100644
index 000..7acc798
--- /dev/null
+++ b/include/sound/simple_card_utils.h
@@ -0,0 +1,21 @@
+/*
+ * simple_card_core.h
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __SIMPLE_CARD_CORE_H
+#define __SIMPLE_CARD_CORE_H
+
+#include 
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+ struct device_node *node,
+ struct device_node *codec,
+ char *prefix,
+ unsigned int *retfmt);
+
+#endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 610f612..26c2fe6 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -1,3 +1,6 @@
+config SND_SIMPLE_CARD_UTILS
+   tristate
+
 config SND_SIMPLE_CARD
tristate "ASoC Simple sound card support"
help
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index 9c3b246..45602ca 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,3 +1,5 @@
+obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o
+
 snd-soc-simple-card-objs   := simple-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)  += snd-soc-simple-card.o
diff --git a/sound/soc/generic/simple-card-utils.c 
b/sound/soc/generic/simple-card-utils.c
new file mode 100644
index 000..3f6b725
--- /dev/null
+++ b/sound/soc/generic/simple-card-utils.c
@@ -0,0 +1,54 @@
+/*
+ * simple-card-core.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+#include 
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+ struct device_node *node,
+ struct device_node *codec,
+ char *prefix,
+ unsigned int *retfmt)
+{
+   struct device_node *bitclkmaster = NULL;
+   struct device_node *framemaster = NULL;
+   int prefix_len = prefix ? strlen(prefix) : 0;
+   unsigned int daifmt;
+
+   daifmt = snd_soc_of_parse_daifmt(node, prefix,
+, );
+   daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
+
+   if (prefix_len && !bitclkmaster && !framemaster) {
+   /*
+* No dai-link level and master setting was not found from
+* sound node level, revert back to legacy DT parsing and
+* take the settings from codec node.
+*/
+   dev_dbg(dev, "Revert to legacy daifmt parsing\n");
+
+   daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
+   (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
+   } else {
+   if (codec == bitclkmaster)
+   daifmt |= (codec == framemaster) ?
+   SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
+   else
+   daifmt |= (codec == framemaster) ?
+   SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
+   }
+
+   of_node_put(bitclkmaster);
+   of_node_put(framemaster);
+
+   *retfmt = daifmt;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
-- 
1.9.1



[PATCH 03/39 v2] ASoC: simple-card: add new asoc_simple_jack and use it

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Current simple-card supports snd_soc_jack/pin/gpio.
These code are very similar, but driver has verbosity code.
So, this patch adds new snd_soc_jack and cleanups code

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/generic/simple-card.c | 153 
 1 file changed, 78 insertions(+), 75 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index b6e6d9a..8d0311c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -21,6 +21,12 @@
 #include 
 #include 
 
+struct asoc_simple_jack {
+   struct snd_soc_jack jack;
+   struct snd_soc_jack_pin pin;
+   struct snd_soc_jack_gpio gpio;
+};
+
 struct simple_card_data {
struct snd_soc_card snd_card;
struct simple_dai_props {
@@ -29,10 +35,8 @@ struct simple_card_data {
unsigned int mclk_fs;
} *dai_props;
unsigned int mclk_fs;
-   int gpio_hp_det;
-   int gpio_hp_det_invert;
-   int gpio_mic_det;
-   int gpio_mic_det_invert;
+   struct asoc_simple_jack hp_jack;
+   struct asoc_simple_jack mic_jack;
struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
 };
 
@@ -42,6 +46,67 @@ struct simple_card_data {
 
 #define PREFIX "simple-audio-card,"
 
+#define asoc_simple_card_init_hp(card, sjack, prefix)\
+   asoc_simple_card_init_jack(card, sjack, 1, prefix)
+#define asoc_simple_card_init_mic(card, sjack, prefix)\
+   asoc_simple_card_init_jack(card, sjack, 0, prefix)
+static int asoc_simple_card_init_jack(struct snd_soc_card *card,
+ struct asoc_simple_jack *sjack,
+ int is_hp, char *prefix)
+{
+   struct device *dev = card->dev;
+   enum of_gpio_flags flags;
+   char prop[128];
+   char *pin_name;
+   char *gpio_name;
+   int mask;
+   int det;
+
+   sjack->gpio.gpio = -ENOENT;
+
+   if (is_hp) {
+   snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix);
+   pin_name= "Headphones";
+   gpio_name   = "Headphone detection";
+   mask= SND_JACK_HEADPHONE;
+   } else {
+   snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix);
+   pin_name= "Mic Jack";
+   gpio_name   = "Mic detection";
+   mask= SND_JACK_MICROPHONE;
+   }
+
+   det = of_get_named_gpio_flags(dev->of_node, prop, 0, );
+   if (det == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+
+   if (gpio_is_valid(det)) {
+   sjack->pin.pin  = pin_name;
+   sjack->pin.mask = mask;
+
+   sjack->gpio.name= gpio_name;
+   sjack->gpio.report  = mask;
+   sjack->gpio.gpio= det;
+   sjack->gpio.invert  = !!(flags & OF_GPIO_ACTIVE_LOW);
+   sjack->gpio.debounce_time = 150;
+
+   snd_soc_card_jack_new(card, pin_name, mask,
+ >jack,
+ >pin, 1);
+
+   snd_soc_jack_add_gpios(>jack, 1,
+  >gpio);
+   }
+
+   return 0;
+}
+
+static void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
+{
+   if (gpio_is_valid(sjack->gpio.gpio))
+   snd_soc_jack_free_gpios(>jack, 1, >gpio);
+}
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -112,32 +177,6 @@ static struct snd_soc_ops asoc_simple_card_ops = {
.hw_params = asoc_simple_card_hw_params,
 };
 
-static struct snd_soc_jack simple_card_hp_jack;
-static struct snd_soc_jack_pin simple_card_hp_jack_pins[] = {
-   {
-   .pin = "Headphones",
-   .mask = SND_JACK_HEADPHONE,
-   },
-};
-static struct snd_soc_jack_gpio simple_card_hp_jack_gpio = {
-   .name = "Headphone detection",
-   .report = SND_JACK_HEADPHONE,
-   .debounce_time = 150,
-};
-
-static struct snd_soc_jack simple_card_mic_jack;
-static struct snd_soc_jack_pin simple_card_mic_jack_pins[] = {
-   {
-   .pin = "Mic Jack",
-   .mask = SND_JACK_MICROPHONE,
-   },
-};
-static struct snd_soc_jack_gpio simple_card_mic_jack_gpio = {
-   .name = "Mic detection",
-   .report = SND_JACK_MICROPHONE,
-   .debounce_time = 150,
-};
-
 static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
   struct asoc_simple_dai *set)
 {
@@ -186,30 +225,14 @@ static int asoc_simple_card_dai_init(struct 
snd_soc_pcm_runtime *rtd)
if (ret < 0)
return ret;
 
-   if (gpio_is_valid(priv->gpio_hp_det)) {
-   

[PATCH 01/39 v2] ASoC: rsrc-card: remove unused dai_num

2016-05-31 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Signed-off-by: Kuninori Morimoto 
Signed-off-by: Mark Brown 
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecf..b85b5ee 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -64,7 +64,6 @@ struct rsrc_card_priv {
struct snd_soc_codec_conf codec_conf;
struct rsrc_card_dai *dai_props;
struct snd_soc_dai_link *dai_link;
-   int dai_num;
u32 convert_rate;
u32 convert_channels;
 };
@@ -418,7 +417,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
priv->dai_props = props;
priv->dai_link  = links;
-   priv->dai_num   = num;
 
/* Init snd_soc_card */
priv->snd_card.owner= THIS_MODULE;
-- 
1.9.1



[PATCH 00/39 v2] ASoC: add simple-card-core and standardize "simple" card

2016-05-31 Thread Kuninori Morimoto
Hi Mark

These are v2 of simple-card cleanup patches.

Main purpose of these patches are
 - cleanup simple-card
 - rename rsrc-card to simple-dpcm-card

Main diff v1 <-> v2 are
 - remove duplicate header patch
 - rename simple-card-core.c -> simple-card-utils.c
 - remove dpcm function from simple-card-utils.
 - remove jack/pin/gpio/ function from simple-card-utils.
 - remove widgets/route function from simple-card-utils.

I removed widgets/routing related function. it was very thin cosmetic functions.
About jack/pin/gpio on simple-card, it is still have same method,
but keeping it as static function.
dpcm related function too, it is keeping static.

 1) -  3) cleaup patch as prepare
 4) - 14) simple-card-utils
15) - 24) simple-card
25) - 36) rsrc-card
37) - 39) rsrc-card -> simple-dpcm-card

Kuninori Morimoto (39):
   1) ASoC: rsrc-card: remove unused dai_num
   2) ASoC: simple-card: use common PREFIX for each DT property
   3) ASoC: simple-card: add new asoc_simple_jack and use it
   4) ASoC: add new simple-card-utils.c
   5) ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()
   6) ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()
   7) ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
   8) ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()
   9) ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
  10) ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint()
  11) ASoC: simple-card-utils: add asoc_simple_card_init_dai()
  12) ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
  13) ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()
  14) ASoC: simple-card-utils: add asoc_simple_card_clean_reference()
  15) ASoC: simple-card: use asoc_simple_card_parse_daifmt()
  16) ASoC: simple-card: use asoc_simple_card_parse_clk()
  17) ASoC: simple-card: use asoc_simple_card_parse_endpoint()
  18) ASoC: simple-card: use asoc_simple_card_parse_tdm()
  19) ASoC: simple-card: use asoc_simple_card_parse_card_name()
  20) ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
  21) ASoC: simple-card: use asoc_simple_card_init_dai()
  22) ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
  23) ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
  24) ASoC: simple-card: use asoc_simple_card_clean_reference()
  25) ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
  26) ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
  27) ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
  28) ASoC: rsrc-card: use asoc_simple_card_parse_clk()
  29) ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
  30) ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
  31) ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
  32) ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
  33) ASoC: rsrc-card: use asoc_simple_card_init_dai()
  34) ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
  35) ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
  36) ASoC: rsrc-card: use asoc_simple_card_clean_reference()
  37) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
  38) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
  39) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3

 Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt |  75 
--
 Documentation/devicetree/bindings/sound/simple-dpcm-card.txt  |  79 
+++
 include/sound/simple_card.h   |  11 +--
 include/sound/simple_card_utils.h |  77 
+++
 sound/soc/generic/Kconfig |  10 ++
 sound/soc/generic/Makefile|   4 +
 sound/soc/generic/simple-card-utils.c | 288 
+
 sound/soc/generic/simple-card.c   | 424 
--
 sound/soc/generic/simple-dpcm-card.c  | 351 
+
 sound/soc/sh/Kconfig  |   5 -
 sound/soc/sh/rcar/Makefile|   3 -
 sound/soc/sh/rcar/rsrc-card.c | 529 
--
 12 files changed, 937 insertions(+), 919 deletions(-)


Re: [RFC 00/21] Renesas r8a7795/Salvator-X HDMI output prototype

2016-05-31 Thread Ulrich Hecht
On Mon, May 30, 2016 at 5:59 PM, Ulrich Hecht
 wrote:
> Hi!
>
> This is a prototype of HDMI output support for the Renesas r8a7795 SoC and
> Salvator-X board.  It is based on the renesas-devel-20160516-v4.6 tree and

Actually, it is based on renesas-drivers-2016-05-17-
v4.6, sorry for the confusion.

CU
Uli