[PATCH v2 4/6] reset: hi6220: Add support for AO reset controller

2019-04-20 Thread Peter Griffin
This is required to bring Mali450 gpu out of reset. Also
we now use CLK_OF_DECLARE_DRIVER to probe in both the
clock and reset drivers. The clock and reset parts have
been done as one atomic commit to avoid a bisection hole.

Signed-off-by: Peter Griffin 
Cc: Stephen Boyd 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi |  1 +
 drivers/clk/hisilicon/clk-hi6220.c|  3 +-
 drivers/reset/hisilicon/hi6220_reset.c| 65 ++-
 3 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 2defc19..66a3746 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -260,6 +260,7 @@
compatible = "hisilicon,hi6220-aoctrl", "syscon";
reg = <0x0 0xf780 0x0 0x2000>;
#clock-cells = <1>;
+   #reset-cells = <1>;
};
 
sys_ctrl: sys_ctrl@f703 {
diff --git a/drivers/clk/hisilicon/clk-hi6220.c 
b/drivers/clk/hisilicon/clk-hi6220.c
index a87809d..3dde9d3 100644
--- a/drivers/clk/hisilicon/clk-hi6220.c
+++ b/drivers/clk/hisilicon/clk-hi6220.c
@@ -89,8 +89,9 @@ static void __init hi6220_clk_ao_init(struct device_node *np)
hisi_clk_register_gate_sep(hi6220_separated_gate_clks_ao,
ARRAY_SIZE(hi6220_separated_gate_clks_ao), 
clk_data_ao);
 }
-CLK_OF_DECLARE(hi6220_clk_ao, "hisilicon,hi6220-aoctrl", hi6220_clk_ao_init);
 
+/* reset driver also probes and uses these registers */
+CLK_OF_DECLARE_DRIVER(hi6220_clk_ao, "hisilicon,hi6220-aoctrl", 
hi6220_clk_ao_init);
 
 /* clocks in sysctrl */
 static const char *mmc0_mux0_p[] __initdata = { "pll_ddr_gate", "syspll", };
diff --git a/drivers/reset/hisilicon/hi6220_reset.c 
b/drivers/reset/hisilicon/hi6220_reset.c
index d5e5229..ccd5e0a 100644
--- a/drivers/reset/hisilicon/hi6220_reset.c
+++ b/drivers/reset/hisilicon/hi6220_reset.c
@@ -36,6 +36,7 @@
 enum hi6220_reset_ctrl_type {
PERIPHERAL,
MEDIA,
+   AO,
 };
 
 struct hi6220_reset_data {
@@ -95,6 +96,61 @@ static const struct reset_control_ops hi6220_media_reset_ops 
= {
.deassert = hi6220_media_deassert,
 };
 
+#define AO_SCTRL_SC_PW_CLKEN0 0x800
+#define AO_SCTRL_SC_PW_CLKDIS00x804
+
+#define AO_SCTRL_SC_PW_RSTEN0 0x810
+#define AO_SCTRL_SC_PW_RSTDIS00x814
+
+#define AO_SCTRL_SC_PW_ISOEN0 0x820
+#define AO_SCTRL_SC_PW_ISODIS00x824
+#define AO_MAX_INDEX  12
+
+static int hi6220_ao_assert(struct reset_controller_dev *rc_dev,
+  unsigned long idx)
+{
+   struct hi6220_reset_data *data = to_reset_data(rc_dev);
+   struct regmap *regmap = data->regmap;
+   int ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTEN0, BIT(idx));
+   if (ret)
+   return ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_ISOEN0, BIT(idx));
+   if (ret)
+   return ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_CLKDIS0, BIT(idx));
+   if (ret)
+   return ret;
+}
+
+static int hi6220_ao_deassert(struct reset_controller_dev *rc_dev,
+unsigned long idx)
+{
+   struct hi6220_reset_data *data = to_reset_data(rc_dev);
+   struct regmap *regmap = data->regmap;
+   int ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTDIS0, BIT(idx));
+   if (ret)
+   return ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_ISODIS0, BIT(idx));
+   if (ret)
+   return ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_CLKEN0, BIT(idx));
+   if (ret)
+   return ret;
+}
+
+static const struct reset_control_ops hi6220_ao_reset_ops = {
+   .assert = hi6220_ao_assert,
+   .deassert = hi6220_ao_deassert,
+};
+
 static int hi6220_reset_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
@@ -120,9 +176,12 @@ static int hi6220_reset_probe(struct platform_device *pdev)
if (type == MEDIA) {
data->rc_dev.ops = _media_reset_ops;
data->rc_dev.nr_resets = MEDIA_MAX_INDEX;
-   } else {
+   } else if (type == PERIPHERAL) {
data->rc_dev.ops = _peripheral_reset_ops;
data->rc_dev.nr_resets = PERIPH_MAX_INDEX;
+   } else {
+   data->rc_dev.ops = _ao_reset_ops;
+   data->rc_dev.nr_resets = AO_MAX_INDEX;
}
 
return reset_controller_register(>rc_dev);
@@ -137,6 +196,10 @@ static const struct of_device_id hi6220_reset_match[] = {
.compatible = "hisilicon,hi6220-mediactrl",
.data = (void *)MEDIA,
},
+   {
+   .compatible = "hi

[PATCH v2 5/6] dt-bindings: reset: hisilicon: Add ao reset controller

2019-04-20 Thread Peter Griffin
This is required to bring Mali450 gpu out of reset.

Signed-off-by: Peter Griffin 
Reviewed-by: Rob Herring 
---
 include/dt-bindings/reset/hisi,hi6220-resets.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/dt-bindings/reset/hisi,hi6220-resets.h 
b/include/dt-bindings/reset/hisi,hi6220-resets.h
index e7c362a8..63aff7d 100644
--- a/include/dt-bindings/reset/hisi,hi6220-resets.h
+++ b/include/dt-bindings/reset/hisi,hi6220-resets.h
@@ -73,4 +73,11 @@
 #define MEDIA_MMU   6
 #define MEDIA_XG2RAM1   7
 
+#define AO_G3D  1
+#define AO_CODECISP 2
+#define AO_MCPU 4
+#define AO_BBPHARQMEM   5
+#define AO_HIFI 8
+#define AO_ACPUSCUL2C   12
+
 #endif /*_DT_BINDINGS_RESET_CONTROLLER_HI6220*/
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 0/6] Add HiKey / HI6220 SoC Mali-450 support

2019-04-20 Thread Peter Griffin
Hi folks,

This series adds support for the Mali450 MP4 GPU found on the
hi6220 SoC from HiSilicon. It has been tested with the
lima drm/mesa driver hosted on freedesktop.org gitlab,
and validated using Weston and kmscube.

As lima drm driver has now been merged this v2 series includes
one extra patch to avoid Oops when all Mali ip blocks share the
same irq.

regards,

Peter.

Changes since v1:
* Additional drm/lima patch to avoid Oops in shared irq case (Peter Griffin)
* Squash clock and reset driver parts to avoid bisection hole (Stephen Boyd)
* Add comment as to what other driver is probing same dt node (Stephen Boyd)
* Check regmap_write error code and return individually (Philipp Zabel)
* Add Rob Herring Reviewed by tags

Peter Griffin (6):
  dt-bindings: gpu: mali-utgard: add hisilicon,hi6220-mali compatible
  dt-bindings: reset: hisilicon: Update compatible documentation
  arm64: dts: hisilicon: Add Mali-450 MP4 GPU DT entry
  reset: hi6220: Add support for AO reset controller
  dt-bindings: reset: hisilicon: Add ao reset controller
  drm/lima: handle shared irq case for lima_pp_bcast_irq_handler

 .../devicetree/bindings/gpu/arm,mali-utgard.txt|  5 ++
 .../bindings/reset/hisilicon,hi6220-reset.txt  |  1 +
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi  | 38 +
 drivers/clk/hisilicon/clk-hi6220.c |  3 +-
 drivers/gpu/drm/lima/lima_pp.c |  8 ++-
 drivers/reset/hisilicon/hi6220_reset.c | 65 +-
 include/dt-bindings/reset/hisi,hi6220-resets.h |  7 +++
 7 files changed, 124 insertions(+), 3 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 6/6] drm/lima: handle shared irq case for lima_pp_bcast_irq_handler

2019-04-20 Thread Peter Griffin
On Hikey board all lima ip blocks are shared with one irq.
This patch avoids a NULL ptr deref crash on this platform
on startup. Tested with Weston and kmscube.

Signed-off-by: Peter Griffin 
Cc: Rob Herring 
Cc: Daniel Vetter 
Cc: Qiang Yu 
---
 drivers/gpu/drm/lima/lima_pp.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_pp.c
index d29721e..8fef224 100644
--- a/drivers/gpu/drm/lima/lima_pp.c
+++ b/drivers/gpu/drm/lima/lima_pp.c
@@ -64,7 +64,13 @@ static irqreturn_t lima_pp_bcast_irq_handler(int irq, void 
*data)
struct lima_ip *pp_bcast = data;
struct lima_device *dev = pp_bcast->dev;
struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp;
-   struct drm_lima_m450_pp_frame *frame = pipe->current_task->frame;
+   struct drm_lima_m450_pp_frame *frame;
+
+   /* for shared irq case */
+   if (!pipe->current_task)
+   return IRQ_NONE;
+
+   frame = pipe->current_task->frame;
 
for (i = 0; i < frame->num_pp; i++) {
struct lima_ip *ip = pipe->processor[i];
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 2/6] dt-bindings: reset: hisilicon: Update compatible documentation

2019-04-20 Thread Peter Griffin
The reset driver now supports the ao reset controller, so update the
documentation to match.

Signed-off-by: Peter Griffin 
Reviewed-by: Rob Herring 
---
 Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt 
b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
index c25da39..ea0a6a9 100644
--- a/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
+++ b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
@@ -11,6 +11,7 @@ Required properties:
 - compatible: should be one of the following:
   - "hisilicon,hi6220-sysctrl", "syscon" : For peripheral reset controller.
   - "hisilicon,hi6220-mediactrl", "syscon" : For media reset controller.
+  - "hisilicon,hi6220-aoctrl", "syscon" : For ao reset controller.
 - reg: should be register base and length as documented in the
   datasheet
 - #reset-cells: 1, see below
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 3/6] arm64: dts: hisilicon: Add Mali-450 MP4 GPU DT entry

2019-04-20 Thread Peter Griffin
hi6220 has a Mali450 MP4 so lets add it into the DT.

Signed-off-by: Peter Griffin 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 37 +++
 1 file changed, 37 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index aec9e37..2defc19 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -1019,6 +1019,43 @@
clock-names = "apb_pclk";
cpu = <>;
};
+
+   mali: gpu@f408 {
+   compatible = "hisilicon,hi6220-mali", "arm,mali-450";
+   reg = <0x0 0xf408 0x0 0x0004>;
+   interrupt-parent = <>;
+   interrupts =,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ;
+
+   interrupt-names = "gp",
+ "gpmmu",
+ "pp",
+ "pp0",
+ "ppmmu0",
+ "pp1",
+ "ppmmu1",
+ "pp2",
+ "ppmmu2",
+ "pp3",
+ "ppmmu3";
+   clocks = <_ctrl HI6220_G3D_CLK>,
+<_ctrl HI6220_G3D_PCLK>;
+   clock-names = "core", "bus";
+   assigned-clocks = <_ctrl HI6220_G3D_CLK>,
+ <_ctrl HI6220_G3D_PCLK>;
+   assigned-clock-rates = <5>, <14400>;
+   reset-names = "ao_g3d", "media_g3d";
+   resets = <_ctrl AO_G3D>, <_ctrl MEDIA_G3D>;
+   };
};
 };
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 1/6] dt-bindings: gpu: mali-utgard: add hisilicon, hi6220-mali compatible

2019-04-20 Thread Peter Griffin
The Hisilicon hi6220 uses a Mali-450MP4 with 4 PPs, so add
a compatible for it.

Signed-off-by: Peter Griffin 
Reviewed-by: Rob Herring 
---
 Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt 
b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
index 3f128e4..2a16b0c 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
@@ -21,6 +21,7 @@ Required properties:
   + rockchip,rk3228-mali
   + rockchip,rk3328-mali
   + stericsson,db8500-mali
+  + hisilicon,hi6220-mali
 
   - reg: Physical base address and length of the GPU registers
 
@@ -91,6 +92,10 @@ to specify one more vendor-specific compatible, among:
   * interrupt-names and interrupts:
 + combined: combined interrupt of all of the above lines
 
+  - hisilicon,hi6220-mali
+Required properties:
+  * resets: phandles to the reset lines for the GPU
+
 Example:
 
 mali: gpu@1c4 {
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 4/6] reset: hi6220: Add support for AO reset controller

2019-03-19 Thread Peter Griffin
This is required to bring Mali450 gpu out of reset.

Signed-off-by: Peter Griffin 
---
 drivers/reset/hisilicon/hi6220_reset.c | 51 +-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/reset/hisilicon/hi6220_reset.c 
b/drivers/reset/hisilicon/hi6220_reset.c
index d5e5229..0cd5f92 100644
--- a/drivers/reset/hisilicon/hi6220_reset.c
+++ b/drivers/reset/hisilicon/hi6220_reset.c
@@ -36,6 +36,7 @@
 enum hi6220_reset_ctrl_type {
PERIPHERAL,
MEDIA,
+   AO,
 };
 
 struct hi6220_reset_data {
@@ -95,6 +96,47 @@ static const struct reset_control_ops hi6220_media_reset_ops 
= {
.deassert = hi6220_media_deassert,
 };
 
+#define AO_SCTRL_SC_PW_CLKEN0 0x800
+#define AO_SCTRL_SC_PW_CLKDIS00x804
+
+#define AO_SCTRL_SC_PW_RSTEN0 0x810
+#define AO_SCTRL_SC_PW_RSTDIS00x814
+
+#define AO_SCTRL_SC_PW_ISOEN0 0x820
+#define AO_SCTRL_SC_PW_ISODIS00x824
+#define AO_MAX_INDEX  12
+
+static int hi6220_ao_assert(struct reset_controller_dev *rc_dev,
+  unsigned long idx)
+{
+   struct hi6220_reset_data *data = to_reset_data(rc_dev);
+   struct regmap *regmap = data->regmap;
+   int ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTEN0, BIT(idx));
+   ret |= regmap_write(regmap, AO_SCTRL_SC_PW_ISOEN0, BIT(idx));
+   ret |= regmap_write(regmap, AO_SCTRL_SC_PW_CLKDIS0, BIT(idx));
+   return ret;
+}
+
+static int hi6220_ao_deassert(struct reset_controller_dev *rc_dev,
+unsigned long idx)
+{
+   struct hi6220_reset_data *data = to_reset_data(rc_dev);
+   struct regmap *regmap = data->regmap;
+   int ret;
+
+   ret = regmap_write(regmap, AO_SCTRL_SC_PW_RSTDIS0, BIT(idx));
+   ret |= regmap_write(regmap, AO_SCTRL_SC_PW_ISODIS0, BIT(idx));
+   ret |= regmap_write(regmap, AO_SCTRL_SC_PW_CLKEN0, BIT(idx));
+   return ret;
+}
+
+static const struct reset_control_ops hi6220_ao_reset_ops = {
+   .assert = hi6220_ao_assert,
+   .deassert = hi6220_ao_deassert,
+};
+
 static int hi6220_reset_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
@@ -120,9 +162,12 @@ static int hi6220_reset_probe(struct platform_device *pdev)
if (type == MEDIA) {
data->rc_dev.ops = _media_reset_ops;
data->rc_dev.nr_resets = MEDIA_MAX_INDEX;
-   } else {
+   } else if (type == PERIPHERAL) {
data->rc_dev.ops = _peripheral_reset_ops;
data->rc_dev.nr_resets = PERIPH_MAX_INDEX;
+   } else {
+   data->rc_dev.ops = _ao_reset_ops;
+   data->rc_dev.nr_resets = AO_MAX_INDEX;
}
 
return reset_controller_register(>rc_dev);
@@ -137,6 +182,10 @@ static const struct of_device_id hi6220_reset_match[] = {
.compatible = "hisilicon,hi6220-mediactrl",
.data = (void *)MEDIA,
},
+   {
+   .compatible = "hisilicon,hi6220-aoctrl",
+   .data = (void *)AO,
+   },
{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, hi6220_reset_match);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 6/6] clk: hi6220: use CLK_OF_DECLARE_DRIVER

2019-03-19 Thread Peter Griffin
As now we also need to probe in the reset driver as well.

Signed-off-by: Peter Griffin 
---
 drivers/clk/hisilicon/clk-hi6220.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/hisilicon/clk-hi6220.c 
b/drivers/clk/hisilicon/clk-hi6220.c
index a87809d..952ffe2 100644
--- a/drivers/clk/hisilicon/clk-hi6220.c
+++ b/drivers/clk/hisilicon/clk-hi6220.c
@@ -89,7 +89,7 @@ static void __init hi6220_clk_ao_init(struct device_node *np)
hisi_clk_register_gate_sep(hi6220_separated_gate_clks_ao,
ARRAY_SIZE(hi6220_separated_gate_clks_ao), 
clk_data_ao);
 }
-CLK_OF_DECLARE(hi6220_clk_ao, "hisilicon,hi6220-aoctrl", hi6220_clk_ao_init);
+CLK_OF_DECLARE_DRIVER(hi6220_clk_ao, "hisilicon,hi6220-aoctrl", 
hi6220_clk_ao_init);
 
 
 /* clocks in sysctrl */
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 5/6] dt-bindings: reset: hisilicon: Add ao reset controller

2019-03-19 Thread Peter Griffin
This is required to bring Mali450 gpu out of reset.

Signed-off-by: Peter Griffin 
---
 include/dt-bindings/reset/hisi,hi6220-resets.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/dt-bindings/reset/hisi,hi6220-resets.h 
b/include/dt-bindings/reset/hisi,hi6220-resets.h
index e7c362a8..63aff7d 100644
--- a/include/dt-bindings/reset/hisi,hi6220-resets.h
+++ b/include/dt-bindings/reset/hisi,hi6220-resets.h
@@ -73,4 +73,11 @@
 #define MEDIA_MMU   6
 #define MEDIA_XG2RAM1   7
 
+#define AO_G3D  1
+#define AO_CODECISP 2
+#define AO_MCPU 4
+#define AO_BBPHARQMEM   5
+#define AO_HIFI 8
+#define AO_ACPUSCUL2C   12
+
 #endif /*_DT_BINDINGS_RESET_CONTROLLER_HI6220*/
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 2/6] dt-bindings: reset: hisilicon: Update compatible documentation

2019-03-19 Thread Peter Griffin
The reset driver now supports the ao reset controller, so update the
documentation to match.

Signed-off-by: Peter Griffin 
---
 Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt 
b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
index c25da39..ea0a6a9 100644
--- a/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
+++ b/Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
@@ -11,6 +11,7 @@ Required properties:
 - compatible: should be one of the following:
   - "hisilicon,hi6220-sysctrl", "syscon" : For peripheral reset controller.
   - "hisilicon,hi6220-mediactrl", "syscon" : For media reset controller.
+  - "hisilicon,hi6220-aoctrl", "syscon" : For ao reset controller.
 - reg: should be register base and length as documented in the
   datasheet
 - #reset-cells: 1, see below
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 1/6] dt-bindings: gpu: mali-utgard: add hisilicon, hi6220-mali compatible

2019-03-19 Thread Peter Griffin
The Hisilicon hi6220 uses a Mali-450MP4 with 4 PPs, so add
a compatible for it.

Signed-off-by: Peter Griffin 
---
 Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt 
b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
index ae63f09..936a20a 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
@@ -23,6 +23,7 @@ Required properties:
   + rockchip,rk3228-mali
   + rockchip,rk3328-mali
   + stericsson,db8500-mali
+  + hisilicon,hi6220-mali
 
   - reg: Physical base address and length of the GPU registers
 
@@ -97,6 +98,10 @@ to specify one more vendor-specific compatible, among:
   * interrupt-names and interrupts:
 + combined: combined interrupt of all of the above lines
 
+  - hisilicon,hi6220-mali
+Required properties:
+  * resets: phandles to the reset lines for the GPU
+
 Example:
 
 mali: gpu@1c4 {
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v1 3/6] arm64: dts: hisilicon: Add Mali-450 MP4 GPU DT entry

2019-03-19 Thread Peter Griffin
hi6220 has a Mali450 MP4 so lets add it into the DT.

Signed-off-by: Peter Griffin 
---
 arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 38 +++
 1 file changed, 38 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
index 108e2a4..2072b63 100644
--- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
@@ -260,6 +260,7 @@
compatible = "hisilicon,hi6220-aoctrl", "syscon";
reg = <0x0 0xf780 0x0 0x2000>;
#clock-cells = <1>;
+   #reset-cells = <1>;
};
 
sys_ctrl: sys_ctrl@f703 {
@@ -1021,6 +1022,43 @@
clock-names = "apb_pclk";
cpu = <>;
};
+
+   mali: gpu@f408 {
+   compatible = "hisilicon,hi6220-mali", "arm,mali-450";
+   reg = <0x0 0xf408 0x0 0x0004>;
+   interrupt-parent = <>;
+   interrupts =,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ;
+
+   interrupt-names = "gp",
+ "gpmmu",
+ "pp",
+ "pp0",
+ "ppmmu0",
+ "pp1",
+ "ppmmu1",
+ "pp2",
+ "ppmmu2",
+ "pp3",
+ "ppmmu3";
+   clocks = <_ctrl HI6220_G3D_CLK>,
+<_ctrl HI6220_G3D_PCLK>;
+   clock-names = "core", "bus";
+   assigned-clocks = <_ctrl HI6220_G3D_CLK>,
+ <_ctrl HI6220_G3D_PCLK>;
+   assigned-clock-rates = <5>, <14400>;
+   reset-names = "ao_g3d", "media_g3d";
+   resets = <_ctrl AO_G3D>, <_ctrl MEDIA_G3D>;
+   };
};
 };
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-10-24 Thread Peter Griffin
Hi Xinliang,

On 28 August 2017 at 10:27, Xinliang Liu <xinliang@linaro.org> wrote:

> Hi Daniel,
>
> On 28 August 2017 at 16:51, Daniel Vetter <dan...@ffwll.ch> wrote:
> > On Mon, Aug 28, 2017 at 04:44:30PM +0800, Xinliang Liu wrote:
> >> Hi,
> >>
> >> On 15 August 2017 at 22:14, Peter Griffin <peter.grif...@linaro.org>
> wrote:
> >>
> >> > This patch fixes the following soft lockup:
> >> >   BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]
> >> >
> >> > On weston idle-timeout the IP is powered down and reset
> >> > asserted. On weston resume we get a massive vblank
> >> > IRQ storm due to the LDI registers having lost some state.
> >> >
> >> > This state loss is caused by ade_crtc_atomic_begin() not
> >> > calling ade_ldi_set_mode(). With this patch applied
> >> > resuming from Weston idle-timeout works well.
> >> >
> >> > Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
> >> > Tested-by: John Stultz <john.stu...@linaro.org>
> >> >
> >>
> >> Thanks Peter,
> >> This patch looks good to me.
> >> Reviewed-by: Xinliang Liu <xinliang@linaro.org>
> >>
> >> @Sean, could you please help to apply to drm-misc if others has no more
> >> comments, thanks.
> >
> > hisilicon isn't maintained in drm-misc, and you're the maintainer. This
> is
> > not how it works. So either
> > a) pick up the patch and send out a pull request to Dave Airlie
> > b) move hisilicon over to drm-misc and become a drm-misc maintainer
> > yourself. This needs a MAINTAINERS update to point the git tree at
> > drm-misc.
> >
> > drm-misc maintainers don't maintain everyone else's driver as a service,
> > that simply doesn't scale.
>
> Sorry for my misunderstanding and thanks for pointing out that how
> drm-misc works.
> So I will pick up the patch and send a pull request.
>

Did you send the pull request?

I still can't see this patch in the latest kernel RC.

Peter.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-08-15 Thread Peter Griffin
This patch fixes the following soft lockup:
  BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]

On weston idle-timeout the IP is powered down and reset
asserted. On weston resume we get a massive vblank
IRQ storm due to the LDI registers having lost some state.

This state loss is caused by ade_crtc_atomic_begin() not
calling ade_ldi_set_mode(). With this patch applied
resuming from Weston idle-timeout works well.

Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
Tested-by: John Stultz <john.stu...@linaro.org>
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index c96c228..72c6357 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -519,9 +519,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
 {
struct ade_crtc *acrtc = to_ade_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx;
+   struct drm_display_mode *mode = >state->mode;
+   struct drm_display_mode *adj_mode = >state->adjusted_mode;
 
if (!ctx->power_on)
(void)ade_power_up(ctx);
+   ade_ldi_set_mode(acrtc, mode, adj_mode);
 }
 
 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RESEND PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-06-29 Thread Peter Griffin
This patch fixes the following soft lockup:
  BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]

On weston idle-timeout the IP is powered down and reset
asserted. On weston resume we get a massive vblank
IRQ storm due to the LDI registers having lost some state.

This state loss is caused by ade_crtc_atomic_begin() not
calling ade_ldi_set_mode(). With this patch applied
resuming from Weston idle-timeout works well.

Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index c96c228..72c6357 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -519,9 +519,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
 {
struct ade_crtc *acrtc = to_ade_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx;
+   struct drm_display_mode *mode = >state->mode;
+   struct drm_display_mode *adj_mode = >state->adjusted_mode;
 
if (!ctx->power_on)
(void)ade_power_up(ctx);
+   ade_ldi_set_mode(acrtc, mode, adj_mode);
 }
 
 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/hisilicon: Ensure LDI regs are properly configured.

2017-05-11 Thread Peter Griffin
This patch fixes the following soft lockup:
  BUG: soft lockup - CPU#0 stuck for 23s! [weston:307]

On weston idle-timeout the IP is powered down and reset
asserted. On weston resume we get a massive vblank
IRQ storm due to the LDI registers having lost some state.

This state loss is caused by ade_crtc_atomic_begin() not
calling ade_ldi_set_mode(). With this patch applied
resuming from Weston idle-timeout works well.

Signed-off-by: Peter Griffin <peter.grif...@linaro.org>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index 9a0678a..c09600c 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -521,9 +521,12 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
 {
struct ade_crtc *acrtc = to_ade_crtc(crtc);
struct ade_hw_ctx *ctx = acrtc->ctx;
+   struct drm_display_mode *mode = >state->mode;
+   struct drm_display_mode *adj_mode = >state->adjusted_mode;
 
if (!ctx->power_on)
(void)ade_power_up(ctx);
+   ade_ldi_set_mode(acrtc, mode, adj_mode);
 }
 
 static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/virtio: kconfig: Fixup white space.

2016-10-08 Thread Peter Griffin
Use tabs instead of spaces.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 drivers/gpu/drm/virtio/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index e1afc3d..81d1807 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,10 +1,10 @@
 config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
depends on DRM && VIRTIO
-select DRM_KMS_HELPER
-select DRM_TTM
+   select DRM_KMS_HELPER
+   select DRM_TTM
help
   This is the virtual GPU driver for virtio.  It can be used with
-   QEMU based VMMs (like KVM or Xen).
+  QEMU based VMMs (like KVM or Xen).

   If unsure say M.
-- 
1.9.1



[PATCH v9 17/19] drm/virtio: kconfig: Fix recursive dependency issue.

2016-10-07 Thread Peter Griffin
Hi Emil,

On Thu, 06 Oct 2016, Emil Velikov wrote:

> On 6 October 2016 at 10:37, Peter Griffin  wrote:
> 
> > In fact the help text for VIRTIO even states this option should be selected
> > by any driver which implements virtio.
> >
> Almost but not quite. It says:
> 
> "This option is selected by any driver which implements the virtio _bus_"
> 

Ah I thought DRM_VIRTIO_GPU was implementing a virtio bus, bus it seems that it 
uses pci. Which does raise the question of why it is depending on VIRTIO at all
and not VIRTIO_PCI.

> REMOTEPROC obviously does that while the ST SLIM driver does not. Thus
> the latter should _not_ select, be that explicitly or implicitly via
> REMOTEPROC, the symbol.

Yep OK.

> 
> >>
> >> People tend to abuse select because it's "convenient". If you depend,
> >> but some of your dependencies aren't met, you're in for some digging
> >> through Kconfig to find the missing deps. Just to make the option you
> >> want visible in menuconfig. If you instead select something with
> >> dependencies, it'll be right most of the time, and it's "convenient",
> >> until it breaks. (And hey, it usually breaks for someone else with some
> >> other config, so it's still convenient for you.)
> >
> > I'm sure they do but in this case it is actually the use of 'depends on'
> > which has caused the breakage and inconvenience for somebody else and sadly 
> > this
> > inconvienice is still on-going due to this patch not being applied or 
> > getting an
> > acked-by from the appropriate maintainers.
> >
> Surely you're not saying that pre-existing driver following the
> documentation, is 'causing breakage' for a new driver {ab,mis}using a
> feature ?

Your right I wasn't saying that :)

My point was that this patch wasn't 'wrong' when referring to the Kconfig
documentation Jani referenced as VIRTIO has no dependencies.

Also I thought DRM_VIRTIO_GPU driver implemented a VIRTIO bus which re-enforced
the view that it should be selecting VIRTIO. 

> 
> This reminds me an old saying: "If the shoe doesn’t fit, it doesn’t
> mean there is anything wrong with your feet."

If the shoe doesn't fit, chop off the leg :)

> You seem to be suggesting the opposite ?
> 
> >>
> >> Perhaps kconfig should complain about selecting visible symbols and
> >> symbols with dependencies.
> >
> > That sounds like it would be a useful addition.
> >
> > Is it possible to get this patch applied or an acked-by to avoid further 
> > delay
> > to the fdma series?
> >
> Please don't apply duct tape, especially where it's _not_ needed.
> 
> $ sed -i s/select REMOTEPROC/depends on REMOTEPROC/ drivers/remoteproc/Kconfig
> 
> ... will resolve things in the right place. The alternative will lead
> to random issues in other subsystems.
> 

If Bjorn is OK with it, then it is fine with me.

I will update remoteproc Kconfig setup in fdma v10, this will drop the
requirement for this patch in drm subsystem.

I can then send the whitespace cleanup patch separately to DRM ML.

regards,

Peter.


[PATCH v9 17/19] drm/virtio: kconfig: Fix recursive dependency issue.

2016-10-06 Thread Peter Griffin
Hi Emil,

On Wed, 21 Sep 2016, Emil Velikov wrote:

> On 20 September 2016 at 09:32, Peter Griffin  
> wrote:
> > Hi Emil,
> >
> > On Tue, 20 Sep 2016, Emil Velikov wrote:
> >
> >> On 5 September 2016 at 14:16, Peter Griffin  
> >> wrote:
> >> > ST_SLIM_REMOTEPROC must select REMOTEPROC, which exposes the following
> >> > recursive dependency.
> >
> >
> >> >
> >> From a humble skim through remoteproc, drm and a few other subsystems
> >> I think the above is wrong. All the drivers (outside of remoteproc),
> >> that I've seen, depend on the core component, they don't select it.
> >
> > I will let Bjorn comment on the remoteproc subsystem Kconfig design, and
> > why it is like it is.
> >
> > For this particular SLIM_RPROC I have added it to Kconfig in keeping with 
> > all
> > the other drivers in the remoteproc subsystem which has exposed this 
> > recursive
> > dependency issue.
> >
> > For this particular kconfig symbol a quick grep reveals more drivers in
> > the kernel using 'select', than 'depend on'
> >
> > git grep "select VIRTIO" | wc -l
> > 14
> >
> > git grep "depends on VIRTIO" | wc -l
> > 10
> >
> Might be worth taking a closer look into these at some point.

VIRTIO has no dependencies, and is a non visible symbol. Its Kconfig help also
mentions that drivers should select it.

> 
> >
> >> Furthermore most places explicitly hide the drivers from the menu if
> >> the core component isn't enabled.
> >
> > Remoteproc subsystem takes a different approach, the core code is only 
> > enabled
> > if a driver which relies on it is enabled. This IMHO makes sense, as
> > remoteproc is not widely used (only a few particular ARM SoC's).
> >
> > It is true that for subsystems which rely on the core component being
> > explicitly enabled, they often tend to hide drivers which depend on it
> > from the menu unless it is. This also makes sense.
> >
> >>
> >> Is there something that requires such a different/unusual behaviour in
> >> remoteproc ?
> >>
> >
> > I'm not sure it is that unusual...looking at config USB, it selects 
> > USB_COMMON in
> > mfd subsystem, client drivers select MFD_CORE.
> >
> On the USB case I'm not sure what the reasoning behind the USB vs
> USB_COMMON split. In seems that one could just fold them, but that's
> another topic. On the MFD side... it follows the select {,mis,ab}use.
> With one (the only one?) MFD driver not using/selecting MFD_CORE doing
> it's own version of mfd_add_devices... which could be reworked,
> possibly.

Much like selecting VIRTIO in this patch, MFD_CORE is a non visible symbol
with no dependencies so it matches the documentation Jani referenced.

I personally think the approach taken makes sense, as why would you want to have
a CONFIG_MFD_CORE=y symbol being enabled unless you actually have a MFD device
which uses it also enabled in your kernel?

It seems to me a good solution to make the client drivers select the core
component so that it only gets enabled if at least one driver requires it.
This avoids having useless core code which will never be used compiled into the
kernel and in the end a smaller kernel size for a given kernel configuration 
(better
cache use etc etc).

> > I've added Arnd to this thread, as I've seen lots of Kconfig patches from 
> > him
> > recently, maybe he has some thoughts on whether this is the correct fix or 
> > not?
> >
> Ack. Fwiw, I believe that the reasoning put by Jani is perfeclty
> reasonable, but it'll be great to hear others as well.

Yes me to. However I don't think anything in this patch is at odds with the
documentation Jani has referenced. 

regards,

Peter.


[PATCH v9 17/19] drm/virtio: kconfig: Fix recursive dependency issue.

2016-10-06 Thread Peter Griffin
Hi Jani,

Sorry for the delay, I've been travelling last week.

On Tue, 20 Sep 2016, Jani Nikula wrote:

> On Tue, 20 Sep 2016, Peter Griffin  wrote:
> > Hi Emil,
> >
> > On Tue, 20 Sep 2016, Emil Velikov wrote:
> >
> >> On 5 September 2016 at 14:16, Peter Griffin  
> >> wrote:
> >> > ST_SLIM_REMOTEPROC must select REMOTEPROC, which exposes the following
> >> > recursive dependency.
> >
> >
> >> >
> >> From a humble skim through remoteproc, drm and a few other subsystems
> >> I think the above is wrong. All the drivers (outside of remoteproc),
> >> that I've seen, depend on the core component, they don't select it.
> >
> > I will let Bjorn comment on the remoteproc subsystem Kconfig design, and
> > why it is like it is.
> >
> > For this particular SLIM_RPROC I have added it to Kconfig in keeping with 
> > all
> > the other drivers in the remoteproc subsystem which has exposed this 
> > recursive
> > dependency issue.
> >
> > For this particular kconfig symbol a quick grep reveals more drivers in
> > the kernel using 'select', than 'depend on'
> >
> > git grep "select VIRTIO" | wc -l
> > 14
> >
> > git grep "depends on VIRTIO" | wc -l
> > 10
> >
> >
> >> Furthermore most places explicitly hide the drivers from the menu if
> >> the core component isn't enabled.
> >
> > Remoteproc subsystem takes a different approach, the core code is only 
> > enabled
> > if a driver which relies on it is enabled. This IMHO makes sense, as
> > remoteproc is not widely used (only a few particular ARM SoC's).
> >
> > It is true that for subsystems which rely on the core component being
> > explicitly enabled, they often tend to hide drivers which depend on it
> > from the menu unless it is. This also makes sense.
> >
> >> 
> >> Is there something that requires such a different/unusual behaviour in
> >> remoteproc ?
> >> 
> >
> > I'm not sure it is that unusual...looking at config USB, it selects 
> > USB_COMMON in
> > mfd subsystem, client drivers select MFD_CORE.
> >
> > I've added Arnd to this thread, as I've seen lots of Kconfig patches from 
> > him
> > recently, maybe he has some thoughts on whether this is the correct fix or 
> > not?
> 
> 
> Documentation/kbuild/kconfig-language.txt:
> 
>   Note:
>   select should be used with care. select will force
>   a symbol to a value without visiting the dependencies.
>   By abusing select you are able to select a symbol FOO even
>   if FOO depends on BAR that is not set.
>   In general use select only for non-visible symbols
>   (no prompts anywhere) and for symbols with no dependencies.
>   That will limit the usefulness but on the other hand avoid
>   the illegal configurations all over.

Thanks for the documentation link. I believe this proves this patch is an
appropriate fix as VIRTIO is a non-visible symbol, and has no dependencies.

In fact the help text for VIRTIO even states this option should be selected
by any driver which implements virtio.

> 
> People tend to abuse select because it's "convenient". If you depend,
> but some of your dependencies aren't met, you're in for some digging
> through Kconfig to find the missing deps. Just to make the option you
> want visible in menuconfig. If you instead select something with
> dependencies, it'll be right most of the time, and it's "convenient",
> until it breaks. (And hey, it usually breaks for someone else with some
> other config, so it's still convenient for you.)

I'm sure they do but in this case it is actually the use of 'depends on'
which has caused the breakage and inconvenience for somebody else and sadly this
inconvienice is still on-going due to this patch not being applied or getting an
acked-by from the appropriate maintainers.

> 
> Perhaps kconfig should complain about selecting visible symbols and
> symbols with dependencies.

That sounds like it would be a useful addition.

Is it possible to get this patch applied or an acked-by to avoid further delay
to the fdma series?

regards,

Peter.


[STLinux Kernel] [PATCH v2] drm/sti: remove stih415-416 platform support

2016-09-20 Thread Peter Griffin
Hi Vincent,

On Tue, 20 Sep 2016, Vincent Abriou wrote:

> stih415 and stih416 platform are obsolete and no more supported.
> Only stih407 and stih410 platform are maintained.
> 
> Signed-off-by: Vincent Abriou 

Subject should have a v2, but apart from that: -

Acked-by: Peter Griffin 

Peter.


[PATCH v9 17/19] drm/virtio: kconfig: Fix recursive dependency issue.

2016-09-20 Thread Peter Griffin
Hi Emil,

On Tue, 20 Sep 2016, Emil Velikov wrote:

> On 5 September 2016 at 14:16, Peter Griffin  
> wrote:
> > ST_SLIM_REMOTEPROC must select REMOTEPROC, which exposes the following
> > recursive dependency.


> >
> From a humble skim through remoteproc, drm and a few other subsystems
> I think the above is wrong. All the drivers (outside of remoteproc),
> that I've seen, depend on the core component, they don't select it.

I will let Bjorn comment on the remoteproc subsystem Kconfig design, and
why it is like it is.

For this particular SLIM_RPROC I have added it to Kconfig in keeping with all
the other drivers in the remoteproc subsystem which has exposed this recursive
dependency issue.

For this particular kconfig symbol a quick grep reveals more drivers in
the kernel using 'select', than 'depend on'

git grep "select VIRTIO" | wc -l
14

git grep "depends on VIRTIO" | wc -l
10


> Furthermore most places explicitly hide the drivers from the menu if
> the core component isn't enabled.

Remoteproc subsystem takes a different approach, the core code is only enabled
if a driver which relies on it is enabled. This IMHO makes sense, as
remoteproc is not widely used (only a few particular ARM SoC's).

It is true that for subsystems which rely on the core component being
explicitly enabled, they often tend to hide drivers which depend on it
from the menu unless it is. This also makes sense.

> 
> Is there something that requires such a different/unusual behaviour in
> remoteproc ?
> 

I'm not sure it is that unusual...looking at config USB, it selects USB_COMMON 
in
mfd subsystem, client drivers select MFD_CORE.

I've added Arnd to this thread, as I've seen lots of Kconfig patches from him
recently, maybe he has some thoughts on whether this is the correct fix or not?

regards,

Peter.


[PATCH 2/2] drm/virtio: kconfig: Fixup white space.

2016-09-19 Thread Peter Griffin
Use tabs instead of spaces.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 drivers/gpu/drm/virtio/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index 90357d9..2d83932 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -2,10 +2,10 @@ config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
depends on DRM
select VIRTIO
-select DRM_KMS_HELPER
-select DRM_TTM
+   select DRM_KMS_HELPER
+   select DRM_TTM
help
   This is the virtual GPU driver for virtio.  It can be used with
-   QEMU based VMMs (like KVM or Xen).
+  QEMU based VMMs (like KVM or Xen).

   If unsure say M.
-- 
1.9.1



[PATCH 1/2] drm/virtio: kconfig: Fix recursive dependency issue.

2016-09-19 Thread Peter Griffin
ST_SLIM_REMOTEPROC must select REMOTEPROC, which exposes the following
recursive dependency.

[..]
drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER depends on 
DRM_KMS_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:36: symbol DRM_KMS_HELPER is selected by 
DRM_VIRTIO_GPU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on VIRTIO
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by 
ST_SLIM_REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:103: symbol ST_SLIM_REMOTEPROC is selected by ST_FDMA
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:440:symbol ST_FDMA depends on DMADEVICES
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:5:  symbol DMADEVICES is selected by SND_SOC_SH4_SIU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:29:symbol SND_SOC_SH4_SIU is selected by 
SND_SIU_MIGOR
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:64:symbol SND_SIU_MIGOR depends on I2C
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:63: symbol FB_DDC is selected by FB_CYBER2000_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:378:symbol FB_CYBER2000_DDC depends on 
FB_CYBER2000
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:366:symbol FB_CYBER2000 depends on FB

which is due to drivers/gpu/drm/virtio/Kconfig depending on VIRTIO.

Fix by dropping depend and switching to select VIRTIO.

Signed-off-by: Peter Griffin 
---
 drivers/gpu/drm/virtio/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index e1afc3d..90357d9 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,6 +1,7 @@
 config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
-   depends on DRM && VIRTIO
+   depends on DRM
+   select VIRTIO
 select DRM_KMS_HELPER
 select DRM_TTM
help
-- 
1.9.1



[PATCH 0/2] Fix recursive Kconfig depedency issue

2016-09-19 Thread Peter Griffin
Hi,

This series fixes a Kconfig recurssive depedency issue and also some
trivial white space. This was found when developing the fdma dmaegine
series [1], which has now been applied by Vinod.

These patchs were originally included as part of the fdma series [1],
but I've now sent it separately as requested by Vinod [2], and also
privately by Emil. 

FYI not having this patch applied causes kbuild error emails [3].

[1] https://lkml.org/lkml/2016/9/13/191

[2] https://lkml.org/lkml/2016/9/15/562

[3] https://lkml.org/lkml/2016/9/15/850

Peter Griffin (2):
  drm/virtio: kconfig: Fix recursive dependency issue.
  drm/virtio: kconfig: Fixup white space.

 drivers/gpu/drm/virtio/Kconfig | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
1.9.1



[PATCH v9 00/19] Add support for FDMA DMA controller and slim core rproc found on STi chipsets

2016-09-13 Thread Peter Griffin
Hi Vinod & Bjorn,

[..]

On Mon, 05 Sep 2016, Peter Griffin wrote:

> v8 actions some review feedback from Bjorn to the slim rproc driver, and also 
> includes
> a patch which fixes a recursive Kconfig error which is triggered when st_fdma 
> selects
> slim_rproc driver. The series has also been rebased on v4.8-rc3.
> 
> v9 actions some review feedback from Bjorn, Lee and Vinod. See below. 
> Importantly a bug
> was found during testing now that the platform boots without 
> clk_ignore_unused parameter
> whereby the clocks would not be enabled properly before firmware loading was 
> attempted.
> 
> regards,
> 
> Peter.
> 
> Changes since v8:
>  - Add MODULE_ALIAS (Vinod)
>  - devm_kzalloc to devm_kcalloc (Vinod)
>  - quisce tasklet initialised by vchan_init() (Vinod)
>  - Don't make SLIM rproc user selectable (Bjorn)
>  - slim_rproc: Ensure clocks enabled before firmware load (Peter)
>  - Various code style nits / commit message change (Lee)
>  - Separate patch for '\n' kconfig removal (Vinod)

I hate to send a ping, but do you think we can merge this fdma series? It has 
gone
through quite a few review rounds now.

regards,

Peter.


[PATCH v9 19/19] dmaengine: kconfig: Remove superfluous '\n'

2016-09-05 Thread Peter Griffin
Remove the extra '\n' between kconfig entries.

Signed-off-by: Peter Griffin 
---
 drivers/dma/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 7c5d946..5b5a341 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -462,7 +462,6 @@ config STM32_DMA
  If you have a board based on such a MCU and wish to use DMA say Y or M
  here.

-
 config S3C24XX_DMAC
bool "Samsung S3C24XX DMA support"
depends on ARCH_S3C24XX
-- 
1.9.1



[PATCH v9 18/19] drm/virtio: kconfig: Fixup white space.

2016-09-05 Thread Peter Griffin
Use tabs instead of spaces.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 drivers/gpu/drm/virtio/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index 90357d9..2d83932 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -2,10 +2,10 @@ config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
depends on DRM
select VIRTIO
-select DRM_KMS_HELPER
-select DRM_TTM
+   select DRM_KMS_HELPER
+   select DRM_TTM
help
   This is the virtual GPU driver for virtio.  It can be used with
-   QEMU based VMMs (like KVM or Xen).
+  QEMU based VMMs (like KVM or Xen).

   If unsure say M.
-- 
1.9.1



[PATCH v9 17/19] drm/virtio: kconfig: Fix recursive dependency issue.

2016-09-05 Thread Peter Griffin
ST_SLIM_REMOTEPROC must select REMOTEPROC, which exposes the following
recursive dependency.

[..]
drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER depends on 
DRM_KMS_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:36: symbol DRM_KMS_HELPER is selected by 
DRM_VIRTIO_GPU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on VIRTIO
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by 
ST_SLIM_REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:103: symbol ST_SLIM_REMOTEPROC is selected by ST_FDMA
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:440:symbol ST_FDMA depends on DMADEVICES
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:5:  symbol DMADEVICES is selected by SND_SOC_SH4_SIU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:29:symbol SND_SOC_SH4_SIU is selected by 
SND_SIU_MIGOR
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:64:symbol SND_SIU_MIGOR depends on I2C
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:63: symbol FB_DDC is selected by FB_CYBER2000_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:378:symbol FB_CYBER2000_DDC depends on 
FB_CYBER2000
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:366:symbol FB_CYBER2000 depends on FB

which is due to drivers/gpu/drm/virtio/Kconfig depending on VIRTIO.

Fix by dropping depend and switching to select VIRTIO.

Signed-off-by: Peter Griffin 
---
 drivers/gpu/drm/virtio/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index e1afc3d..90357d9 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,6 +1,7 @@
 config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
-   depends on DRM && VIRTIO
+   depends on DRM
+   select VIRTIO
 select DRM_KMS_HELPER
 select DRM_TTM
help
-- 
1.9.1



[PATCH v9 16/19] ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card

2016-09-05 Thread Peter Griffin
This patch enables the uniperif players 2 & 3 for b2120 boards
and also adds the "simple-audio-card" device node to interconnect
the SoC sound device and the codec.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stihxxx-b2120.dtsi | 45 
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi 
b/arch/arm/boot/dts/stihxxx-b2120.dtsi
index 722c63f..4939501 100644
--- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
+++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
@@ -131,5 +131,50 @@
dvb-card= ;
};
};
+
+   sti_uni_player2: sti-uni-player at 8d82000 {
+   status = "okay";
+   };
+
+   sti_uni_player3: sti-uni-player at 8d85000 {
+   status = "okay";
+   };
+
+   sti_sasg_codec: sti-sasg-codec {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_spdif_out>;
+   };
+
+   sound {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "sti audio card";
+   status = "okay";
+
+   simple-audio-card,dai-link at 0 {
+   /* DAC */
+   format = "i2s";
+   mclk-fs = <256>;
+   cpu {
+   sound-dai = <_uni_player2>;
+   };
+
+   codec {
+   sound-dai = <_sasg_codec 1>;
+   };
+   };
+   simple-audio-card,dai-link at 1 {
+   /* SPDIF */
+   format = "left_j";
+   mclk-fs = <128>;
+   cpu {
+   sound-dai = <_uni_player3>;
+   };
+
+   codec {
+   sound-dai = <_sasg_codec 0>;
+   };
+   };
+   };
};
 };
-- 
1.9.1



[PATCH v9 15/19] ARM: STi: DT: STiH407: Add uniperif reader dt nodes

2016-09-05 Thread Peter Griffin
This patch adds the DT node for the uniperif reader
IP block found on STiH407 family silicon.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 28 
 1 file changed, 28 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index 1edc36c..883019a 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -960,5 +960,33 @@

status = "disabled";
};
+
+   sti_uni_reader0: sti-uni-reader at 8d83000 {
+   compatible = "st,sti-uni-reader";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   reg = <0x8d83000 0x158>;
+   interrupts = ;
+   dmas = < 5 0 1>;
+   dma-names = "rx";
+   dai-name = "Uni Reader #0 (PCM IN)";
+   st,version = <3>;
+
+   status = "disabled";
+   };
+
+   sti_uni_reader1: sti-uni-reader at 8d84000 {
+   compatible = "st,sti-uni-reader";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   reg = <0x8d84000 0x158>;
+   interrupts = ;
+   dmas = < 6 0 1>;
+   dma-names = "rx";
+   dai-name = "Uni Reader #1 (HDMI RX)";
+   st,version = <3>;
+
+   status = "disabled";
+   };
};
 };
-- 
1.9.1



[PATCH v9 14/19] ARM: STi: DT: STiH407: Add uniperif player dt nodes

2016-09-05 Thread Peter Griffin
This patch adds the DT nodes for the uniperif player
IP blocks found on STiH407 family silicon.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 80 +++
 1 file changed, 80 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d1258d5..1edc36c 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -880,5 +880,85 @@
status = "disabled";
st,syscfg = <_core>;
};
+
+   sti_uni_player0: sti-uni-player at 8d8 {
+   compatible = "st,sti-uni-player";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_0>;
+   assigned-clocks = <_s_d0_quadfs 0>, 
<_s_d0_flexgen CLK_PCM_0>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 0>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8d8 0x158>;
+   interrupts = ;
+   dmas = < 2 0 1>;
+   dai-name = "Uni Player #0 (HDMI)";
+   dma-names = "tx";
+   st,uniperiph-id = <0>;
+   st,version = <5>;
+   st,mode = "HDMI";
+
+   status  = "disabled";
+   };
+
+   sti_uni_player1: sti-uni-player at 8d81000 {
+   compatible = "st,sti-uni-player";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_1>;
+   assigned-clocks = <_s_d0_quadfs 1>, 
<_s_d0_flexgen CLK_PCM_1>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 1>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8d81000 0x158>;
+   interrupts = ;
+   dmas = < 3 0 1>;
+   dai-name = "Uni Player #1 (PIO)";
+   dma-names = "tx";
+   st,uniperiph-id = <1>;
+   st,version = <5>;
+   st,mode = "PCM";
+
+   status = "disabled";
+   };
+
+   sti_uni_player2: sti-uni-player at 8d82000 {
+   compatible = "st,sti-uni-player";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clocks = <_s_d0_quadfs 2>, 
<_s_d0_flexgen CLK_PCM_2>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 2>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8d82000 0x158>;
+   interrupts = ;
+   dmas = < 4 0 1>;
+   dai-name = "Uni Player #1 (DAC)";
+   dma-names = "tx";
+   st,uniperiph-id = <2>;
+   st,version = <5>;
+   st,mode = "PCM";
+
+   status = "disabled";
+   };
+
+   sti_uni_player3: sti-uni-player at 8d85000 {
+   compatible = "st,sti-uni-player";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_SPDIFF>;
+   assigned-clocks = <_s_d0_quadfs 3>, 
<_s_d0_flexgen CLK_SPDIFF>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 3>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8d85000 0x158>;
+   interrupts = ;
+   dmas = < 7 0 1>;
+   dma-names = "tx";
+   dai-name = "Uni Player #1 (PIO)";
+   st,uniperiph-id = <3>;
+   st,version = <5>;
+   st,mode = "SPDIF";
+
+   status = "disabled";
+   };
};
 };
-- 
1.9.1



[PATCH v9 13/19] ARM: STi: DT: STiH407: Add sti-sasg-codec dt node

2016-09-05 Thread Peter Griffin
This patch adds the dt node for the internal audio
codec IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index 45cab30..d1258d5 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -873,5 +873,12 @@
<_s_c0_flexgen CLK_TX_ICN_DISP_0>,
<_s_c0_flexgen CLK_EXT2F_A9>;
};
+
+   sti_sasg_codec: sti-sasg-codec {
+   compatible = "st,stih407-sas-codec";
+   #sound-dai-cells = <1>;
+   status = "disabled";
+   st,syscfg = <_core>;
+   };
};
 };
-- 
1.9.1



[PATCH v9 12/19] ARM: DT: STiH407: Add spdif_out pinctrl config

2016-09-05 Thread Peter Griffin
This patch adds the pinctrl config for the spidf out
pins used by the sasg codec IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index 537db7e..598dbab 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1114,6 +1114,14 @@
};
};

+   spdif_out {
+   pinctrl_spdif_out: spdif_out{
+   st,pins {
+   spdif_out = < 7 ALT1 OUT>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v9 11/19] ARM: DT: STiH407: Add i2s_in pinctrl configuration

2016-09-05 Thread Peter Griffin
This patch adds the pinctrl config for the i2s_in pins
used by the uniperif reader IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index 0fb5c8a..537db7e 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1090,6 +1090,30 @@
};
};

+   i2s_in {
+   pinctrl_i2s_8ch_in: i2s_8ch_in{
+   st,pins {
+   mclk = < 5 ALT1 IN>;
+   lrclk = < 7 ALT1 IN>;
+   sclk = < 6 ALT1 IN>;
+   data0 = < 4 ALT1 IN>;
+   data1 = < 0 ALT1 IN>;
+   data2 = < 1 ALT1 IN>;
+   data3 = < 2 ALT1 IN>;
+   data4 = < 3 ALT1 IN>;
+   };
+   };
+
+   pinctrl_i2s_2ch_in: i2s_2ch_in{
+   st,pins {
+   mclk = < 5 ALT1 IN>;
+   lrclk = < 7 ALT1 IN>;
+   sclk = < 6 ALT1 IN>;
+   data0 = < 4 ALT1 IN>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v9 10/19] ARM: DT: STiH407: Add i2s_out pinctrl configuration

2016-09-05 Thread Peter Griffin
This patch adds the pinctrl config for the i2s_out pins
used by the uniperif player IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index a538ae5..0fb5c8a 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1067,6 +1067,29 @@
};
};

+   i2s_out {
+   pinctrl_i2s_8ch_out: i2s_8ch_out{
+   st,pins {
+   mclk = < 5 ALT1 OUT>;
+   lrclk = < 7 ALT1 OUT>;
+   sclk = < 6 ALT1 OUT>;
+   data0 = < 4 ALT1 OUT>;
+   data1 = < 0 ALT1 OUT>;
+   data2 = < 1 ALT1 OUT>;
+   data3 = < 2 ALT1 OUT>;
+   };
+   };
+
+   pinctrl_i2s_2ch_out: i2s_2ch_out{
+   st,pins {
+   mclk = < 5 ALT1 OUT>;
+   lrclk = < 7 ALT1 OUT>;
+   sclk = < 6 ALT1 OUT>;
+   data0 = < 4 ALT1 OUT>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v9 09/19] ARM: multi_v7_defconfig: Enable STi and simple-card drivers.

2016-09-05 Thread Peter Griffin
This patch enables the STi ALSA drivers found on STi platforms
as well as the simple-card driver which is a dependency to have
working sound.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
Cc: arnaud.pouliquen at st.com
Cc: broonie at kernel.org
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index 998578a..51a38b1 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -644,6 +644,9 @@ CONFIG_SND_SOC_AK4642=m
 CONFIG_SND_SOC_SGTL5000=m
 CONFIG_SND_SOC_SPDIF=m
 CONFIG_SND_SOC_WM8978=m
+CONFIG_SND_SOC_STI=m
+CONFIG_SND_SOC_STI_SAS=m
+CONFIG_SND_SIMPLE_CARD=m
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_MVEBU=y
-- 
1.9.1



[PATCH v9 08/19] ARM: multi_v7_defconfig: Enable STi FDMA driver

2016-09-05 Thread Peter Griffin
This DMA controller is found on all STi chipsets.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index ea23250..998578a 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -784,6 +784,7 @@ CONFIG_DMA_OMAP=y
 CONFIG_QCOM_BAM_DMA=y
 CONFIG_XILINX_VDMA=y
 CONFIG_DMA_SUN6I=y
+CONFIG_ST_FDMA=m
 CONFIG_STAGING=y
 CONFIG_SENSORS_ISL29018=y
 CONFIG_SENSORS_ISL29028=y
-- 
1.9.1



[PATCH v9 07/19] MAINTAINERS: Add FDMA driver files to STi section.

2016-09-05 Thread Peter Griffin
This patch adds the FDMA driver files to the STi
section of the maintainers file.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5dd3b24..d21a7b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1739,6 +1739,7 @@ F:drivers/char/hw_random/st-rng.c
 F: drivers/clocksource/arm_global_timer.c
 F: drivers/clocksource/clksrc_st_lpc.c
 F: drivers/cpufreq/sti-cpufreq.c
+F: drivers/dma/st_fdma*
 F: drivers/i2c/busses/i2c-st.c
 F: drivers/media/rc/st_rc.c
 F: drivers/media/platform/sti/c8sectpfe/
-- 
1.9.1



[PATCH v9 06/19] ARM: STi: DT: STiH407: Add FDMA driver dt nodes.

2016-09-05 Thread Peter Griffin
These nodes are required to get the fdma driver working
on STiH407 based silicon.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/boot/dts/stih407-family.dtsi | 52 +++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d294e82..45cab30 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -821,5 +821,57 @@
clock-frequency = <6>;
st,syscfg   = <_core 0x224>;
};
+
+   /* fdma audio */
+   fdma0: dma-controller at 8e2 {
+   compatible = "st,stih407-fdma-mpe31-11", 
"st,slim-rproc";
+   reg = <0x8e2 0x8000>,
+ <0x8e3 0x3000>,
+ <0x8e37000 0x1000>,
+ <0x8e38000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>;
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+   /* fdma app */
+   fdma1: dma-controller at 8e4 {
+   compatible = "st,stih407-fdma-mpe31-12", 
"st,slim-rproc";
+   reg = <0x8e4 0x8000>,
+ <0x8e5 0x3000>,
+ <0x8e57000 0x1000>,
+ <0x8e58000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+   <_s_c0_flexgen CLK_TX_ICN_DMU>,
+   <_s_c0_flexgen CLK_TX_ICN_DMU>,
+   <_s_c0_flexgen CLK_EXT2F_A9>;
+
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+   /* fdma free running */
+   fdma2: dma-controller at 8e6 {
+   compatible = "st,stih407-fdma-mpe31-13", 
"st,slim-rproc";
+   reg = <0x8e6 0x8000>,
+ <0x8e7 0x3000>,
+ <0x8e77000 0x1000>,
+ <0x8e78000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+   <_s_c0_flexgen CLK_EXT2F_A9>,
+   <_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+   <_s_c0_flexgen CLK_EXT2F_A9>;
+   };
};
 };
-- 
1.9.1



[PATCH v9 05/19] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

2016-09-05 Thread Peter Griffin
This patch adds support for the Flexible Direct Memory Access (FDMA) core
driver. The FDMA is a slim core CPU with a dedicated firmware.
It is a general purpose DMA controller capable of supporting 16
independent DMA channels. Data moves maybe from memory to memory
or between memory and paced latency critical real time targets and it
is found on al STi based chipsets.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
---
 drivers/dma/Kconfig   |  15 +-
 drivers/dma/Makefile  |   1 +
 drivers/dma/st_fdma.c | 899 ++
 3 files changed, 914 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma/st_fdma.c

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 739f797..7c5d946 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -437,6 +437,19 @@ config STE_DMA40
help
  Support for ST-Ericsson DMA40 controller

+config ST_FDMA
+   tristate "ST FDMA dmaengine support"
+   depends on ARCH_STI
+   select ST_SLIM_REMOTEPROC
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+   help
+ Enable support for ST FDMA controller.
+ It supports 16 independent DMA channels, accepts up to 32 DMA requests
+
+ Say Y here if you have such a chipset.
+ If unsure, say N.
+
 config STM32_DMA
bool "STMicroelectronics STM32 DMA support"
depends on ARCH_STM32
@@ -449,6 +462,7 @@ config STM32_DMA
  If you have a board based on such a MCU and wish to use DMA say Y or M
  here.

+
 config S3C24XX_DMAC
bool "Samsung S3C24XX DMA support"
depends on ARCH_S3C24XX
@@ -567,7 +581,6 @@ config ZX_DMA
help
  Support the DMA engine for ZTE ZX296702 platform devices.

-
 # driver files
 source "drivers/dma/bestcomm/Kconfig"

diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index e4dc9ca..a4fa336 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
 obj-$(CONFIG_TI_EDMA) += edma.o
 obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
 obj-$(CONFIG_ZX_DMA) += zx296702_dma.o
+obj-$(CONFIG_ST_FDMA) += st_fdma.o

 obj-y += qcom/
 obj-y += xilinx/
diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c
new file mode 100644
index 000..515e1d4
--- /dev/null
+++ b/drivers/dma/st_fdma.c
@@ -0,0 +1,899 @@
+/*
+ * DMA driver for STMicroelectronics STi FDMA controller
+ *
+ * Copyright (C) 2014 STMicroelectronics
+ *
+ * Author: Ludovic Barre 
+ *Peter Griffin 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "st_fdma.h"
+
+static inline struct st_fdma_chan *to_st_fdma_chan(struct dma_chan *c)
+{
+   return container_of(c, struct st_fdma_chan, vchan.chan);
+}
+
+static struct st_fdma_desc *to_st_fdma_desc(struct virt_dma_desc *vd)
+{
+   return container_of(vd, struct st_fdma_desc, vdesc);
+}
+
+static int st_fdma_dreq_get(struct st_fdma_chan *fchan)
+{
+   struct st_fdma_dev *fdev = fchan->fdev;
+   u32 req_line_cfg = fchan->cfg.req_line;
+   u32 dreq_line;
+   int try = 0;
+
+   /*
+* dreq_mask is shared for n channels of fdma, so all accesses must be
+* atomic. if the dreq_mask is changed between ffz and set_bit,
+* we retry
+*/
+   do {
+   if (fdev->dreq_mask == ~0L) {
+   dev_err(fdev->dev, "No req lines available\n");
+   return -EINVAL;
+   }
+
+   if (try || req_line_cfg >= ST_FDMA_NR_DREQS) {
+   dev_err(fdev->dev, "Invalid or used req line\n");
+   return -EINVAL;
+   } else {
+   dreq_line = req_line_cfg;
+   }
+
+   try++;
+   } while (test_and_set_bit(dreq_line, >dreq_mask));
+
+   dev_dbg(fdev->dev, "get dreq_line:%d mask:%#lx\n",
+   dreq_line, fdev->dreq_mask);
+
+   return dreq_line;
+}
+
+static void st_fdma_dreq_put(struct st_fdma_chan *fchan)
+{
+   struct st_fdma_dev *fdev = fchan->fdev;
+
+   dev_dbg(fdev->dev, "put dreq_line:%#x\n", fchan->dreq_line);
+   clear_bit(fchan->dreq_line, >dreq_mask);
+}
+
+static void st_fdma_xfer_desc(struct st_fdma_chan *fchan)
+{
+   struct virt_dma_desc *vdesc;
+   unsigned long nbytes, ch_cmd, cmd;
+
+   vdesc = vchan_next_desc(>vchan);
+   if (!vdesc)
+   return;
+
+   fchan->fdesc = to_st_fdma_desc(vdesc);
+   nbytes = fchan->fdesc->node[0].desc->nbytes

[PATCH v9 04/19] dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file

2016-09-05 Thread Peter Griffin
This header file will also be used by the dma xbar driver in the
future.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
---
 drivers/dma/st_fdma.h | 249 ++
 1 file changed, 249 insertions(+)
 create mode 100644 drivers/dma/st_fdma.h

diff --git a/drivers/dma/st_fdma.h b/drivers/dma/st_fdma.h
new file mode 100644
index 000..c58e00d
--- /dev/null
+++ b/drivers/dma/st_fdma.h
@@ -0,0 +1,249 @@
+/*
+ * DMA driver header for STMicroelectronics STi FDMA controller
+ *
+ * Copyright (C) 2014 STMicroelectronics
+ *
+ * Author: Ludovic Barre 
+ *
+ * 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 __DMA_ST_FDMA_H
+#define __DMA_ST_FDMA_H
+
+#include 
+#include 
+#include 
+#include 
+#include "virt-dma.h"
+
+#define ST_FDMA_NR_DREQS 32
+#define FW_NAME_SIZE 30
+#define DRIVER_NAME "st-fdma"
+
+/**
+ * struct st_fdma_generic_node - Free running/paced generic node
+ *
+ * @length: Length in bytes of a line in a 2D mem to mem
+ * @sstride: Stride, in bytes, between source lines in a 2D data move
+ * @dstride: Stride, in bytes, between destination lines in a 2D data move
+ */
+struct st_fdma_generic_node {
+   u32 length;
+   u32 sstride;
+   u32 dstride;
+};
+
+/**
+ * struct st_fdma_hw_node - Node structure used by fdma hw
+ *
+ * @next: Pointer to next node
+ * @control: Transfer Control Parameters
+ * @nbytes: Number of Bytes to read
+ * @saddr: Source address
+ * @daddr: Destination address
+ *
+ * @generic: generic node for free running/paced transfert type
+ * 2 others transfert type are possible, but not yet implemented
+ *
+ * The NODE structures must be aligned to a 32 byte boundary
+ */
+struct st_fdma_hw_node {
+   u32 next;
+   u32 control;
+   u32 nbytes;
+   u32 saddr;
+   u32 daddr;
+   union {
+   struct st_fdma_generic_node generic;
+   };
+} __aligned(32);
+
+/*
+ * node control parameters
+ */
+#define FDMA_NODE_CTRL_REQ_MAP_MASKGENMASK(4, 0)
+#define FDMA_NODE_CTRL_REQ_MAP_FREE_RUN0x0
+#define FDMA_NODE_CTRL_REQ_MAP_DREQ(n) ((n)_NODE_CTRL_REQ_MAP_MASK)
+#define FDMA_NODE_CTRL_REQ_MAP_EXT FDMA_NODE_CTRL_REQ_MAP_MASK
+#define FDMA_NODE_CTRL_SRC_MASKGENMASK(6, 5)
+#define FDMA_NODE_CTRL_SRC_STATIC  BIT(5)
+#define FDMA_NODE_CTRL_SRC_INCRBIT(6)
+#define FDMA_NODE_CTRL_DST_MASKGENMASK(8, 7)
+#define FDMA_NODE_CTRL_DST_STATIC  BIT(7)
+#define FDMA_NODE_CTRL_DST_INCRBIT(8)
+#define FDMA_NODE_CTRL_SECURE  BIT(15)
+#define FDMA_NODE_CTRL_PAUSE_EON   BIT(30)
+#define FDMA_NODE_CTRL_INT_EON BIT(31)
+
+/**
+ * struct st_fdma_sw_node - descriptor structure for link list
+ *
+ * @pdesc: Physical address of desc
+ * @node: link used for putting this into a channel queue
+ */
+struct st_fdma_sw_node {
+   dma_addr_t pdesc;
+   struct st_fdma_hw_node *desc;
+};
+
+#define NAME_SZ 10
+
+struct st_fdma_driverdata {
+   u32 id;
+   char name[NAME_SZ];
+};
+
+struct st_fdma_desc {
+   struct virt_dma_desc vdesc;
+   struct st_fdma_chan *fchan;
+   bool iscyclic;
+   unsigned int n_nodes;
+   struct st_fdma_sw_node node[];
+};
+
+enum st_fdma_type {
+   ST_FDMA_TYPE_FREE_RUN,
+   ST_FDMA_TYPE_PACED,
+};
+
+struct st_fdma_cfg {
+   struct device_node *of_node;
+   enum st_fdma_type type;
+   dma_addr_t dev_addr;
+   enum dma_transfer_direction dir;
+   int req_line; /* request line */
+   long req_ctrl; /* Request control */
+};
+
+struct st_fdma_chan {
+   struct st_fdma_dev *fdev;
+   struct dma_pool *node_pool;
+   struct dma_slave_config scfg;
+   struct st_fdma_cfg cfg;
+
+   int dreq_line;
+
+   struct virt_dma_chan vchan;
+   struct st_fdma_desc *fdesc;
+   enum dma_status status;
+};
+
+struct st_fdma_dev {
+   struct device *dev;
+   const struct st_fdma_driverdata *drvdata;
+   struct dma_device dma_device;
+
+   struct st_slim_rproc *slim_rproc;
+
+   int irq;
+
+   struct st_fdma_chan *chans;
+
+   spinlock_t dreq_lock;
+   unsigned long dreq_mask;
+
+   u32 nr_channels;
+   char fw_name[FW_NAME_SIZE];
+};
+
+/* Peripheral Registers*/
+
+#define FDMA_CMD_STA_OFST  0xFC0
+#define FDMA_CMD_SET_OFST  0xFC4
+#define FDMA_CMD_CLR_OFST  0xFC8
+#define FDMA_CMD_MASK_OFST 0xFCC
+#define FDMA_CMD_START(ch) (0x1 << (ch << 1))
+#define FDMA_CMD_PAUSE(ch) (0x2 << (ch << 1))
+#define FDMA_CMD_FLUSH(ch) (0x3 << (ch << 1))
+
+#define FDMA_INT_STA_OFST  0xFD0
+#define FDMA_INT_STA_CH0x1
+#define FDMA_IN

[PATCH v9 03/19] dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding documentation

2016-09-05 Thread Peter Griffin
This patch adds the DT binding documentation for the FDMA constroller
found on STi based chipsets from STMicroelectronics.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/dma/st_fdma.txt | 87 +++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt

diff --git a/Documentation/devicetree/bindings/dma/st_fdma.txt 
b/Documentation/devicetree/bindings/dma/st_fdma.txt
new file mode 100644
index 000..495d853
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/st_fdma.txt
@@ -0,0 +1,87 @@
+* STMicroelectronics Flexible Direct Memory Access Device Tree bindings
+
+The FDMA is a general-purpose direct memory access controller capable of
+supporting 16 independent DMA channels. It accepts up to 32 DMA requests.
+The FDMA is based on a Slim processor which requires a firmware.
+
+* FDMA Controller
+
+Required properties:
+- compatible   : Should be one of
+- st,stih407-fdma-mpe31-11, "st,slim-rproc";
+- st,stih407-fdma-mpe31-12, "st,slim-rproc";
+- st,stih407-fdma-mpe31-13, "st,slim-rproc";
+- reg  : Should contain an entry for each name in reg-names
+- reg-names: Must contain "slimcore", "dmem", "peripherals", "imem" entries
+- interrupts   : Should contain one interrupt shared by all channels
+- dma-channels : Number of channels supported by the controller
+- #dma-cells   : Must be <3>. See DMA client section below
+- clocks   : Must contain an entry for each clock
+See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+
+Example:
+
+   fdma0: dma-controller at 8e2 {
+   compatible = "st,stih407-fdma-mpe31-11", "st,slim-rproc";
+   reg = <0x8e2 0x8000>,
+ <0x8e3 0x3000>,
+ <0x8e37000 0x1000>,
+ <0x8e38000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>;
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+* DMA client
+
+Required properties:
+- dmas: Comma separated list of dma channel requests
+- dma-names: Names of the aforementioned requested channels
+
+Each dmas request consists of 4 cells:
+1. A phandle pointing to the FDMA controller
+2. The request line number
+3. A 32bit mask specifying (see include/linux/platform_data/dma-st-fdma.h)
+ -bit 2-0: Holdoff value, dreq will be masked for
+   0x0: 0-0.5us
+   0x1: 0.5-1us
+   0x2: 1-1.5us
+ -bit 17: data swap
+   0x0: disabled
+   0x1: enabled
+ -bit 21: Increment Address
+   0x0: no address increment between transfers
+   0x1: increment address between transfers
+ -bit 22: 2 STBus Initiator Coprocessor interface
+   0x0: high priority port
+   0x1: low priority port
+4. transfers type
+ 0 free running
+ 1 paced
+
+Example:
+
+   sti_uni_player2: sti-uni-player at 2 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clock-parents = <_s_d0_quadfs 2>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D82000 0x158>;
+   interrupts = ;
+   dmas = < 4 0 1>;
+   dai-name = "Uni Player #1 (DAC)";
+   dma-names = "tx";
+   st,uniperiph-id = <2>;
+   st,version = <5>;
+   st,mode = "PCM";
+   };
-- 
1.9.1



[PATCH v9 02/19] MAINTAINERS: Add st slim core rproc driver to STi section.

2016-09-05 Thread Peter Griffin
This patch adds the slim core rproc driver to the STi section
of the MAINTAINERS file.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0bbe4b1..5dd3b24 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1749,6 +1749,7 @@ F:drivers/phy/phy-stih407-usb.c
 F: drivers/phy/phy-stih41x-usb.c
 F: drivers/pinctrl/pinctrl-st.c
 F: drivers/remoteproc/st_remoteproc.c
+F: drivers/remoteproc/st_slim_rproc.c
 F: drivers/reset/sti/
 F: drivers/rtc/rtc-st-lpc.c
 F: drivers/tty/serial/st-asc.c
@@ -1757,6 +1758,7 @@ F:drivers/usb/host/ehci-st.c
 F: drivers/usb/host/ohci-st.c
 F: drivers/watchdog/st_lpc_wdt.c
 F: drivers/ata/ahci_st.c
+F: include/linux/remoteproc/st_slim_rproc.h

 ARM/STM32 ARCHITECTURE
 M: Maxime Coquelin 
-- 
1.9.1



[PATCH v9 01/19] remoteproc: st_slim_rproc: add a slimcore rproc driver

2016-09-05 Thread Peter Griffin
slim core is used as a basis for many IPs in the STi
chipsets such as fdma and demux. To avoid duplicating
the elf loading code in each device driver a slim
rproc driver has been created.

This driver is designed to be used by other device drivers
such as fdma, or demux whose IP is based around a slim core.
The device driver can call slim_rproc_alloc() to allocate
a slim rproc and slim_rproc_put() when finished.

This driver takes care of ioremapping the slim
registers (dmem, imem, slimcore, peripherals), whose offsets
and sizes can change between IP's. It also obtains and enables
any clocks used by the device. This approach avoids having
a double mapping of the registers as slim_rproc does not register
its own platform device. It also maps well to device tree
abstraction as it allows us to have one dt node for the whole
device.

All of the generic rproc elf loading code can be reused, and
we provide start() stop() hooks to start and stop the slim
core once the firmware has been loaded. This has been tested
successfully with fdma driver.

Signed-off-by: Peter Griffin 
---
 drivers/remoteproc/Kconfig   |   4 +
 drivers/remoteproc/Makefile  |   1 +
 drivers/remoteproc/st_slim_rproc.c   | 364 +++
 include/linux/remoteproc/st_slim_rproc.h |  58 +
 4 files changed, 427 insertions(+)
 create mode 100644 drivers/remoteproc/st_slim_rproc.c
 create mode 100644 include/linux/remoteproc/st_slim_rproc.h

diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 1a8bf76a..a7bedc6 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -100,4 +100,8 @@ config ST_REMOTEPROC
  processor framework.
  This can be either built-in or a loadable module.

+config ST_SLIM_REMOTEPROC
+   tristate
+   select REMOTEPROC
+
 endmenu
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index 92d3758..db1dae7 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_DA8XX_REMOTEPROC)+= 
da8xx_remoteproc.o
 obj-$(CONFIG_QCOM_MDT_LOADER)  += qcom_mdt_loader.o
 obj-$(CONFIG_QCOM_Q6V5_PIL)+= qcom_q6v5_pil.o
 obj-$(CONFIG_ST_REMOTEPROC)+= st_remoteproc.o
+obj-$(CONFIG_ST_SLIM_REMOTEPROC)   += st_slim_rproc.o
diff --git a/drivers/remoteproc/st_slim_rproc.c 
b/drivers/remoteproc/st_slim_rproc.c
new file mode 100644
index 000..1484e97
--- /dev/null
+++ b/drivers/remoteproc/st_slim_rproc.c
@@ -0,0 +1,364 @@
+/*
+ * SLIM core rproc driver
+ *
+ * Copyright (C) 2016 STMicroelectronics
+ *
+ * Author: Peter Griffin 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "remoteproc_internal.h"
+
+/* SLIM core registers */
+#define SLIM_ID_OFST   0x0
+#define SLIM_VER_OFST  0x4
+
+#define SLIM_EN_OFST   0x8
+#define SLIM_EN_RUNBIT(0)
+
+#define SLIM_CLK_GATE_OFST 0xC
+#define SLIM_CLK_GATE_DIS  BIT(0)
+#define SLIM_CLK_GATE_RESETBIT(2)
+
+#define SLIM_SLIM_PC_OFST  0x20
+
+/* DMEM registers */
+#define SLIM_REV_ID_OFST   0x0
+#define SLIM_REV_ID_MIN_MASK   GENMASK(15, 8)
+#define SLIM_REV_ID_MIN(id)((id & SLIM_REV_ID_MIN_MASK) >> 8)
+#define SLIM_REV_ID_MAJ_MASK   GENMASK(23, 16)
+#define SLIM_REV_ID_MAJ(id)((id & SLIM_REV_ID_MAJ_MASK) >> 16)
+
+
+/* peripherals registers */
+#define SLIM_STBUS_SYNC_OFST   0xF88
+#define SLIM_STBUS_SYNC_DISBIT(0)
+
+#define SLIM_INT_SET_OFST  0xFD4
+#define SLIM_INT_CLR_OFST  0xFD8
+#define SLIM_INT_MASK_OFST 0xFDC
+
+#define SLIM_CMD_CLR_OFST  0xFC8
+#define SLIM_CMD_MASK_OFST 0xFCC
+
+static const char *mem_names[ST_SLIM_MEM_MAX] = {
+   [ST_SLIM_DMEM]  = "dmem",
+   [ST_SLIM_IMEM]  = "imem",
+};
+
+static int slim_clk_get(struct st_slim_rproc *slim_rproc, struct device *dev)
+{
+   int clk, err;
+
+   for (clk = 0; clk < ST_SLIM_MAX_CLK; clk++) {
+   slim_rproc->clks[clk] = of_clk_get(dev->of_node, clk);
+   if (IS_ERR(slim_rproc->clks[clk])) {
+   err = PTR_ERR(slim_rproc->clks[clk]);
+   if (err == -EPROBE_DEFER)
+   goto err_put_clks;
+   slim_rproc->clks[clk] = NULL;
+   break;
+   }
+   }
+
+   return 0;
+
+err_put_clks:
+   while (--clk >= 0)
+   clk_put(slim_rproc->clks[clk]);
+
+   return err;
+}
+
+static void slim_clk_disable(struct 

[PATCH v9 00/19] Add support for FDMA DMA controller and slim core rproc found on STi chipsets

2016-09-05 Thread Peter Griffin
ble (Bjorn)
 - -EPROBE_DEFER if rproc_boot fails when allocating DMA channel (Arnaud / 
Peter)
 - Drop some unnecessary headers (Vinod / Bjorn)
 - Change to writel now we have several mappings (Bjorn)
 - Remove io_res, rproc, and some unused structure fields / #define (Bjorn)
 - put clks in error path, also put clks before rproc_put() (Bjorn)
 - Make enum less generic (Bjorn)
 - Make slim_rproc_alloc() return a st_slim_rproc reference (Bjorn)
 - Alphabetical naming in Kconfig & Makefile (Vinod)
 - Add FDMA prefix to REQ_CTRL* (Vinod)
 - Print ret on some error paths (Vinod)
 - Add some acked-by (Peter)

Changes since v3:
 - Remove elf loading code from fdma driver (Vinod)
 - Remove fdma_ prefix for clock names (Arnd)
 - Make _xlate use dma_get_any_channel rather than request_channel (Arnd)
 - Make a common function for _prep_ routines (Vinod)
 - Make driver depend on COMPILE_TEST (Arnd)
 - Remove unnecessary st_fdma_filter_fn (Arnd)
 - Enable FDMA as a module (Arnd)
 - Drop fdma_ clock prefix (Arnd)
 - Fix description as well as example for st, prefix (Arnd)
 - Remove string concatenation from fdma register macros to ease grep'ability 
(Arnd)
 - Add a XP70 rproc driver for ELF firmware loading and start/stop control 
(Peter)
 - Add myself as a author of the driver (Peter)

Changes since v2:
 - Change to dma-controller (Arnd)
 - Remove platform data header file and simplifiy code (Arnd)
 - Remove FW_LOADER_USER_HELPER_FALLBACK and rework firmware loading to device 
config (Vinod)
 - Use SET_RUNTIME_PM_OPS helpers (Vinod)
 - Remove fdma-id dt prop and use compatibles to generate different fdma 
firmware names (Arnd / Lee)
 - Add sti-asoc-card DT nodes and pinmux config for uniperif player & reader 
(Peter)
 - Update sti-asoc-card DT binding documentation (Peter)
 - Enable STi audio drivers in multi_v7_defconfig (Peter)

Changes since v1:
 - split into smaller patches for easier / faster review (Vinod)
 - new fill_hw_mode() with common code (Vinod)
 - new config_reqctrl() called from *_prep() instead of device_config cb (Vinod)
 - fdma-xbar support removed (Peter)
 - rework firmware name mechanism so fwname isn't in DT (Peter / Lee)
 - st_fdma_seg_to_mem can be static (Paul)
 - EXPORT_SYMBOL st_fdma_filter_fn not required (Paul)
 - s/channel/channels (vinod)
 - better describe "Must be <3>" (vinod)
 - sizeof(*ehdr) (vinod)
 - print values on error debug (vinod)
 - empty line (Vinod)
 - Update to -EIO (Vinod)
 - Make st_fdma tristate (Paul)
 - Remove __exit tag from .remove (Maxime)
 - Update MAINTAINERS rule to fdma* (Lee)
 - Unit address should match reg property (Lee)

Peter Griffin (19):
  remoteproc: st_slim_rproc: add a slimcore rproc driver
  MAINTAINERS: Add st slim core rproc driver to STi section.
  dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding
documentation
  dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file
  dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
  ARM: STi: DT: STiH407: Add FDMA driver dt nodes.
  MAINTAINERS: Add FDMA driver files to STi section.
  ARM: multi_v7_defconfig: Enable STi FDMA driver
  ARM: multi_v7_defconfig: Enable STi and simple-card drivers.
  ARM: DT: STiH407: Add i2s_out pinctrl configuration
  ARM: DT: STiH407: Add i2s_in pinctrl configuration
  ARM: DT: STiH407: Add spdif_out pinctrl config
  ARM: STi: DT: STiH407: Add sti-sasg-codec dt node
  ARM: STi: DT: STiH407: Add uniperif player dt nodes
  ARM: STi: DT: STiH407: Add uniperif reader dt nodes
  ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card
  drm/virtio: kconfig: Fix recursive dependency issue.
  drm/virtio: kconfig: Fixup white space.
  dmaengine: kconfig: Remove superfluous '\n'

 Documentation/devicetree/bindings/dma/st_fdma.txt |  87 +++
 MAINTAINERS   |   3 +
 arch/arm/boot/dts/stih407-family.dtsi | 167 
 arch/arm/boot/dts/stih407-pinctrl.dtsi|  55 ++
 arch/arm/boot/dts/stihxxx-b2120.dtsi  |  45 ++
 arch/arm/configs/multi_v7_defconfig   |   4 +
 drivers/dma/Kconfig   |  14 +-
 drivers/dma/Makefile  |   1 +
 drivers/dma/st_fdma.c | 899 ++
 drivers/dma/st_fdma.h | 249 ++
 drivers/gpu/drm/virtio/Kconfig|   9 +-
 drivers/remoteproc/Kconfig|   4 +
 drivers/remoteproc/Makefile   |   1 +
 drivers/remoteproc/st_slim_rproc.c| 364 +
 include/linux/remoteproc/st_slim_rproc.h  |  58 ++
 15 files changed, 1955 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt
 create mode 100644 drivers/dma/st_fdma.c
 create mode 100644 drivers/dma/st_fdma.h
 create mode 100644 drivers/remoteproc/st_slim_rproc.c
 create mode 100644 include/linux/remoteproc/st_slim_rproc.h

-- 
1.9.1



[PATCH v8 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

2016-09-01 Thread Peter Griffin
Hi Vinod,

Thanks for reviewing.

On Tue, 30 Aug 2016, Vinod Koul wrote:

> On Fri, Aug 26, 2016 at 03:56:40PM +0100, Peter Griffin wrote:
> 
> >  config STM32_DMA
> > bool "STMicroelectronics STM32 DMA support"
> > depends on ARCH_STM32
> > @@ -567,7 +580,6 @@ config ZX_DMA
> > help
> >   Support the DMA engine for ZTE ZX296702 platform devices.
> >  
> > -
> 
> unrelated change?

OK will remove and send a separate patch.
> 
> > +   fdev->chans = devm_kzalloc(>dev,
> > +  fdev->nr_channels
> > +  * sizeof(struct st_fdma_chan), GFP_KERNEL);
> 
> devm_kcalloc()

Will fix in next version.

> 
> > +   if (!fdev->chans)
> > +   return -ENOMEM;
> > +
> > +   fdev->dev = >dev;
> > +   fdev->drvdata = drvdata;
> > +   platform_set_drvdata(pdev, fdev);
> > +
> > +   fdev->irq = platform_get_irq(pdev, 0);
> > +   if (fdev->irq < 0) {
> > +   dev_err(>dev, "Failed to get irq resource\n");
> > +   return -EINVAL;
> > +   }
> > +
> > +   ret = devm_request_irq(>dev, fdev->irq, st_fdma_irq_handler, 0,
> > +  dev_name(>dev), fdev);
> > +   if (ret) {
> > +   dev_err(>dev, "Failed to request irq (%d)\n", ret);
> > +   goto err;
> > +   }
> > +
> > +   fdev->slim_rproc = st_slim_rproc_alloc(pdev, fdev->fw_name);
> > +   if (!fdev->slim_rproc) {
> > +   ret = PTR_ERR(fdev->slim_rproc);
> > +   dev_err(>dev, "slim_rproc_alloc failed (%d)\n", ret);
> > +   goto err;
> > +   }
> > +
> > +   /* Initialise list of FDMA channels */
> > +   INIT_LIST_HEAD(>dma_device.channels);
> > +   for (i = 0; i < fdev->nr_channels; i++) {
> > +   struct st_fdma_chan *fchan = >chans[i];
> > +
> > +   fchan->fdev = fdev;
> > +   fchan->vchan.desc_free = st_fdma_free_desc;
> > +   vchan_init(>vchan, >dma_device);
> 
> this initialized a tasklet
> 
> > +static int st_fdma_remove(struct platform_device *pdev)
> > +{
> > +   struct st_fdma_dev *fdev = platform_get_drvdata(pdev);
> > +
> > +   devm_free_irq(>dev, fdev->irq, fdev);
> > +   st_slim_rproc_put(fdev->slim_rproc);
> > +   of_dma_controller_free(pdev->dev.of_node);
> > +   dma_async_device_unregister(>dma_device);
> 
> and that vchan tasklet is not quisced here :(

Eeek, good spot. Will fix in next version.

> 
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_DESCRIPTION("STMicroelectronics FDMA engine driver");
> > +MODULE_AUTHOR("Ludovic.barre ");
> > +MODULE_AUTHOR("Peter Griffin ");
> 
> No MODULE_ALIAS?

Will add in next version.

regards,

Peter. 


[PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver

2016-08-31 Thread Peter Griffin
Hi Bjorn,

On Tue, 30 Aug 2016, Bjorn Andersson wrote:

> On Tue 30 Aug 05:34 PDT 2016, Lee Jones wrote:
> 
> Thanks for your review Lee.
> 
> > On Fri, 26 Aug 2016, Peter Griffin wrote:
> [..]
> > > diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> > > index 1a8bf76a..06765e0 100644
> > > --- a/drivers/remoteproc/Kconfig
> > > +++ b/drivers/remoteproc/Kconfig
> > > @@ -100,4 +100,12 @@ config ST_REMOTEPROC
> > > processor framework.
> > > This can be either built-in or a loadable module.
> > >  
> > > +config ST_SLIM_REMOTEPROC
> > > + tristate "ST Slim remoteproc support"
> > > + select REMOTEPROC
> > > + help
> > > +   Say y here to support firmware loading on IP based around
> > > +   the Slim core.
> > > +   If unsure say N.
> 
> Saw one more thing when browsing through...
> 
> As this piece of code doesn't do anything on its own and is going to be
> selected by the "function driver" I don't think this should be
> user-selectable.

Applogies, I believe you pointed this out in a previous review, but it seems to
have slipped through the net. Will fix in the next version.

Regards,

Peter.


[PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver

2016-08-30 Thread Peter Griffin
Hi Lee,

Thanks for reviewing.

On Tue, 30 Aug 2016, Lee Jones wrote:

> On Fri, 26 Aug 2016, Peter Griffin wrote:
> 
> > slim core is used as a basis for many IPs in the STi
> > chipsets such as fdma and demux. To avoid duplicating
> > the elf loading code in each device driver a slim
> > rproc driver has been created.
> > 
> > This driver is designed to be used by other device drivers
> > such as fdma, or demux whose IP is based around a slim core.
> > The device driver can call slim_rproc_alloc() to allocate
> > a slim rproc and slim_rproc_put() when finished.
> > 
> > This driver takes care of ioremapping the slim
> > registers (dmem, imem, slimcore, peripherals), whose offsets
> > and sizes can change between IP's. It also obtains and enables
> > any clocks used by the device. This approach avoids having
> > a double mapping of the registers as slim_rproc does not register
> > its own platform device. It also maps well to device tree
> > abstraction as it allows us to have one dt node for the whole
> > device.
> > 
> > All of the generic rproc elf loading code can be reused, and
> > we provide start() stop() hooks to start and stop the slim
> > core once the firmware has been loaded. This has been tested
> > successfully with fdma driver.
> 
> Nit.  It would be good to use a constant line-wrap.
> 
> 'M-x post-mode' will help with this.

Can you provide the magic which makes this happen for GIT commit messages?

> 
> > Signed-off-by: Peter Griffin 
> > ---
> >  drivers/remoteproc/Kconfig   |   8 +
> >  drivers/remoteproc/Makefile  |   1 +
> >  drivers/remoteproc/st_slim_rproc.c   | 364 
> > +++
> >  include/linux/remoteproc/st_slim_rproc.h |  53 +
> >  4 files changed, 426 insertions(+)
> >  create mode 100644 drivers/remoteproc/st_slim_rproc.c
> >  create mode 100644 include/linux/remoteproc/st_slim_rproc.h
> > 
> > diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> > index 1a8bf76a..06765e0 100644
> > --- a/drivers/remoteproc/Kconfig
> > +++ b/drivers/remoteproc/Kconfig
> > @@ -100,4 +100,12 @@ config ST_REMOTEPROC
> >   processor framework.
> >   This can be either built-in or a loadable module.
> >  
> > +config ST_SLIM_REMOTEPROC
> > +   tristate "ST Slim remoteproc support"
> > +   select REMOTEPROC
> > +   help
> > + Say y here to support firmware loading on IP based around
> > + the Slim core.
> > + If unsure say N.
> > +
> >  endmenu
> > diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> > index 92d3758..db1dae7 100644
> > --- a/drivers/remoteproc/Makefile
> > +++ b/drivers/remoteproc/Makefile
> > @@ -14,3 +14,4 @@ obj-$(CONFIG_DA8XX_REMOTEPROC)+= 
> > da8xx_remoteproc.o
> >  obj-$(CONFIG_QCOM_MDT_LOADER)  += qcom_mdt_loader.o
> >  obj-$(CONFIG_QCOM_Q6V5_PIL)+= qcom_q6v5_pil.o
> >  obj-$(CONFIG_ST_REMOTEPROC)+= st_remoteproc.o
> > +obj-$(CONFIG_ST_SLIM_REMOTEPROC)   += st_slim_rproc.o
> > diff --git a/drivers/remoteproc/st_slim_rproc.c 
> > b/drivers/remoteproc/st_slim_rproc.c
> > new file mode 100644
> > index 000..f4bf2d7
> > --- /dev/null
> > +++ b/drivers/remoteproc/st_slim_rproc.c
> > @@ -0,0 +1,364 @@
> > +/*
> > + * st_slim_rproc.c
> 
> These serve no purpose and have a habit of becoming out-of-date.
> Please remove it and replace with a nice succinct description
> instead.

OK will fix.
> 
> > + * Copyright (C) 2016 STMicroelectronics
> 
> Nit: '\n' here.

Will fix. 
> 
> > + * Author: Peter Griffin 
> 
> Nit: '\n' here.

Will fix.

> 
> > + * License terms:  GNU General Public License (GPL), version 2
> 
> Are you sure ST are okay with the shortened version of the GPL?

Do you mean the banner should be like this?

 * 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.

As I'm not aware of a shortened version of the GPV v2 license.

> 
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include "remoteproc_internal.h"
> > +
> > +/* slimcore registers */
> 
> What's it called? slimcore, slim core, ST 

[PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes

2016-08-30 Thread Peter Griffin
Hi Lee,

Thanks for reviewing and your very valuable feedback.

On Tue, 30 Aug 2016, Lee Jones wrote:

> On Fri, 26 Aug 2016, Peter Griffin wrote:
> 
> > This patch adds the DT node for the uniperif reader
> > IP block found on STiH407 family silicon.
> > 
> > Signed-off-by: Arnaud Pouliquen 
> > Signed-off-by: Peter Griffin 
> > ---
> >  arch/arm/boot/dts/stih407-family.dtsi | 26 ++
> >  1 file changed, 26 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
> > b/arch/arm/boot/dts/stih407-family.dtsi
> > index d263c96..bdddf2c 100644
> > --- a/arch/arm/boot/dts/stih407-family.dtsi
> > +++ b/arch/arm/boot/dts/stih407-family.dtsi
> > @@ -956,5 +956,31 @@
> > st,version = <5>;
> > st,mode = "SPDIF";
> > };
> > +
> > +   sti_uni_reader0: sti-uni-reader at 0 {
> > +   compatible = "st,sti-uni-reader";
> > +   status = "disabled";
> 
> I find it's normally nicer to place the status of the node at the
> bottom, separated by a '\n'.

Ok I'll add a superflous '\n' in the next version.

>  There isn't a functional difference
> admittedly, but it would be my preference, since it's not describing
> the device per se.

Will change to your preference in the next version.

> 
> > +   #sound-dai-cells = <0>;
> > +   st,syscfg = <_core>;
> > +   reg = <0x8D83000 0x158>;
> 
> We usually use lower-case for the address.

Will fix.

> 
> Since this has a 'reg' property, the '0' in the node name does not
> look appropriate.

Will fix.
> 
> > +   interrupts = ;
> > +   dmas = < 5 0 1>;
> > +   dma-names = "rx";
> > +   dai-name = "Uni Reader #0 (PCM IN)";
> 
> Oooo, not seen something like this before.
> 
> If it does not already have one, it would require a DT Ack.

No idea, the driver got merged 1 year ago.

Arnaud did you get a DT ack when you merged this driver & binding?
> 
> > +   st,version = <3>;
> 
> This will likely need a DT Ack too.  We usually encode this sort of
> information in the compatible string.

See 05c1b4480e86a871b18030d6f3d532dc0ecdf38c
> 
> > +   };
> > +
> > +   sti_uni_reader1: sti-uni-reader at 1 {
> > +   compatible = "st,sti-uni-reader";
> > +   status = "disabled";
> > +   #sound-dai-cells = <0>;
> > +   st,syscfg = <_core>;
> > +   reg = <0x8D84000 0x158>;
> > +   interrupts = ;
> > +   dmas = < 6 0 1>;
> > +   dma-names = "rx";
> > +   dai-name = "Uni Reader #1 (HDMI RX)";
> > +   st,version = <3>;
> > +   };
> 
> All as above.
> 
> > };
> >  };
> 

Regards,

Peter.


[PATCH v8 18/18] drm/virtio: kconfig: Fixup white space.

2016-08-26 Thread Peter Griffin
Use tabs instead of spaces.

Signed-off-by: Peter Griffin 
---
 drivers/gpu/drm/virtio/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index 90357d9..2d83932 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -2,10 +2,10 @@ config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
depends on DRM
select VIRTIO
-select DRM_KMS_HELPER
-select DRM_TTM
+   select DRM_KMS_HELPER
+   select DRM_TTM
help
   This is the virtual GPU driver for virtio.  It can be used with
-   QEMU based VMMs (like KVM or Xen).
+  QEMU based VMMs (like KVM or Xen).

   If unsure say M.
-- 
1.9.1



[PATCH v8 17/18] drm/virtio: kconfig: Fix recursive dependency.

2016-08-26 Thread Peter Griffin
[..]
drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER depends on 
DRM_KMS_HELPER
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/Kconfig:36: symbol DRM_KMS_HELPER is selected by 
DRM_VIRTIO_GPU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on VIRTIO
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by 
ST_SLIM_REMOTEPROC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/remoteproc/Kconfig:103: symbol ST_SLIM_REMOTEPROC is selected by ST_FDMA
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:440:symbol ST_FDMA depends on DMADEVICES
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/dma/Kconfig:5:  symbol DMADEVICES is selected by SND_SOC_SH4_SIU
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:29:symbol SND_SOC_SH4_SIU is selected by 
SND_SIU_MIGOR
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
sound/soc/sh/Kconfig:64:symbol SND_SIU_MIGOR depends on I2C
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:63: symbol FB_DDC is selected by FB_CYBER2000_DDC
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:378:symbol FB_CYBER2000_DDC depends on 
FB_CYBER2000
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
drivers/video/fbdev/Kconfig:366:symbol FB_CYBER2000 depends on FB

Signed-off-by: Peter Griffin 
---
 drivers/gpu/drm/virtio/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index e1afc3d..90357d9 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -1,6 +1,7 @@
 config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
-   depends on DRM && VIRTIO
+   depends on DRM
+   select VIRTIO
 select DRM_KMS_HELPER
 select DRM_TTM
help
-- 
1.9.1



[PATCH v8 16/18] ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card

2016-08-26 Thread Peter Griffin
This patch enables the uniperif players 2 & 3 for b2120 boards
and also adds the "simple-audio-card" device node to interconnect
the SoC sound device and the codec.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stihxxx-b2120.dtsi | 45 
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi 
b/arch/arm/boot/dts/stihxxx-b2120.dtsi
index 722c63f..1f64bb6 100644
--- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
+++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
@@ -131,5 +131,50 @@
dvb-card= ;
};
};
+
+   sti_uni_player2: sti-uni-player at 2 {
+   status = "okay";
+   };
+
+   sti_uni_player3: sti-uni-player at 3 {
+   status = "okay";
+   };
+
+   sti_sasg_codec: sti-sasg-codec {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_spdif_out>;
+   };
+
+   sound {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "sti audio card";
+   status = "okay";
+
+   simple-audio-card,dai-link at 0 {
+   /* DAC */
+   format = "i2s";
+   mclk-fs = <256>;
+   cpu {
+   sound-dai = <_uni_player2>;
+   };
+
+   codec {
+   sound-dai = <_sasg_codec 1>;
+   };
+   };
+   simple-audio-card,dai-link at 1 {
+   /* SPDIF */
+   format = "left_j";
+   mclk-fs = <128>;
+   cpu {
+   sound-dai = <_uni_player3>;
+   };
+
+   codec {
+   sound-dai = <_sasg_codec 0>;
+   };
+   };
+   };
};
 };
-- 
1.9.1



[PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes

2016-08-26 Thread Peter Griffin
This patch adds the DT node for the uniperif reader
IP block found on STiH407 family silicon.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d263c96..bdddf2c 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -956,5 +956,31 @@
st,version = <5>;
st,mode = "SPDIF";
};
+
+   sti_uni_reader0: sti-uni-reader at 0 {
+   compatible = "st,sti-uni-reader";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   reg = <0x8D83000 0x158>;
+   interrupts = ;
+   dmas = < 5 0 1>;
+   dma-names = "rx";
+   dai-name = "Uni Reader #0 (PCM IN)";
+   st,version = <3>;
+   };
+
+   sti_uni_reader1: sti-uni-reader at 1 {
+   compatible = "st,sti-uni-reader";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   reg = <0x8D84000 0x158>;
+   interrupts = ;
+   dmas = < 6 0 1>;
+   dma-names = "rx";
+   dai-name = "Uni Reader #1 (HDMI RX)";
+   st,version = <3>;
+   };
};
 };
-- 
1.9.1



[PATCH v8 14/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes

2016-08-26 Thread Peter Griffin
This patch adds the DT nodes for the uniperif player
IP blocks found on STiH407 family silicon.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 76 +++
 1 file changed, 76 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d1258d5..d263c96 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -880,5 +880,81 @@
status = "disabled";
st,syscfg = <_core>;
};
+
+   sti_uni_player0: sti-uni-player at 0 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_0>;
+   assigned-clocks = <_s_d0_quadfs 0>, 
<_s_d0_flexgen CLK_PCM_0>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 0>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D8 0x158>;
+   interrupts = ;
+   dmas = < 2 0 1>;
+   dai-name = "Uni Player #0 (HDMI)";
+   dma-names = "tx";
+   st,uniperiph-id = <0>;
+   st,version = <5>;
+   st,mode = "HDMI";
+   };
+
+   sti_uni_player1: sti-uni-player at 1 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_1>;
+   assigned-clocks = <_s_d0_quadfs 1>, 
<_s_d0_flexgen CLK_PCM_1>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 1>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D81000 0x158>;
+   interrupts = ;
+   dmas = < 3 0 1>;
+   dai-name = "Uni Player #1 (PIO)";
+   dma-names = "tx";
+   st,uniperiph-id = <1>;
+   st,version = <5>;
+   st,mode = "PCM";
+   };
+
+   sti_uni_player2: sti-uni-player at 2 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clocks = <_s_d0_quadfs 2>, 
<_s_d0_flexgen CLK_PCM_2>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 2>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D82000 0x158>;
+   interrupts = ;
+   dmas = < 4 0 1>;
+   dai-name = "Uni Player #1 (DAC)";
+   dma-names = "tx";
+   st,uniperiph-id = <2>;
+   st,version = <5>;
+   st,mode = "PCM";
+   };
+
+   sti_uni_player3: sti-uni-player at 3 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_SPDIFF>;
+   assigned-clocks = <_s_d0_quadfs 3>, 
<_s_d0_flexgen CLK_SPDIFF>;
+   assigned-clock-parents = <0>, <_s_d0_quadfs 3>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D85000 0x158>;
+   interrupts = ;
+   dmas = < 7 0 1>;
+   dma-names = "tx";
+   dai-name = "Uni Player #1 (PIO)";
+   st,uniperiph-id = <3>;
+   st,version = <5>;
+   st,mode = "SPDIF";
+   };
};
 };
-- 
1.9.1



[PATCH v8 13/18] ARM: STi: DT: STiH407: Add sti-sasg-codec dt node

2016-08-26 Thread Peter Griffin
This patch adds the dt node for the internal audio
codec IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index 45cab30..d1258d5 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -873,5 +873,12 @@
<_s_c0_flexgen CLK_TX_ICN_DISP_0>,
<_s_c0_flexgen CLK_EXT2F_A9>;
};
+
+   sti_sasg_codec: sti-sasg-codec {
+   compatible = "st,stih407-sas-codec";
+   #sound-dai-cells = <1>;
+   status = "disabled";
+   st,syscfg = <_core>;
+   };
};
 };
-- 
1.9.1



[PATCH v8 12/18] ARM: DT: STiH407: Add spdif_out pinctrl config

2016-08-26 Thread Peter Griffin
This patch adds the pinctrl config for the spidf out
pins used by the sasg codec IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index 537db7e..598dbab 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1114,6 +1114,14 @@
};
};

+   spdif_out {
+   pinctrl_spdif_out: spdif_out{
+   st,pins {
+   spdif_out = < 7 ALT1 OUT>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v8 11/18] ARM: DT: STiH407: Add i2s_in pinctrl configuration

2016-08-26 Thread Peter Griffin
This patch adds the pinctrl config for the i2s_in pins
used by the uniperif reader IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index 0fb5c8a..537db7e 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1090,6 +1090,30 @@
};
};

+   i2s_in {
+   pinctrl_i2s_8ch_in: i2s_8ch_in{
+   st,pins {
+   mclk = < 5 ALT1 IN>;
+   lrclk = < 7 ALT1 IN>;
+   sclk = < 6 ALT1 IN>;
+   data0 = < 4 ALT1 IN>;
+   data1 = < 0 ALT1 IN>;
+   data2 = < 1 ALT1 IN>;
+   data3 = < 2 ALT1 IN>;
+   data4 = < 3 ALT1 IN>;
+   };
+   };
+
+   pinctrl_i2s_2ch_in: i2s_2ch_in{
+   st,pins {
+   mclk = < 5 ALT1 IN>;
+   lrclk = < 7 ALT1 IN>;
+   sclk = < 6 ALT1 IN>;
+   data0 = < 4 ALT1 IN>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v8 10/18] ARM: DT: STiH407: Add i2s_out pinctrl configuration

2016-08-26 Thread Peter Griffin
This patch adds the pinctrl config for the i2s_out pins
used by the uniperif player IP.

Signed-off-by: Arnaud Pouliquen 
Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-pinctrl.dtsi | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi 
b/arch/arm/boot/dts/stih407-pinctrl.dtsi
index a538ae5..0fb5c8a 100644
--- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
+++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
@@ -1067,6 +1067,29 @@
};
};

+   i2s_out {
+   pinctrl_i2s_8ch_out: i2s_8ch_out{
+   st,pins {
+   mclk = < 5 ALT1 OUT>;
+   lrclk = < 7 ALT1 OUT>;
+   sclk = < 6 ALT1 OUT>;
+   data0 = < 4 ALT1 OUT>;
+   data1 = < 0 ALT1 OUT>;
+   data2 = < 1 ALT1 OUT>;
+   data3 = < 2 ALT1 OUT>;
+   };
+   };
+
+   pinctrl_i2s_2ch_out: i2s_2ch_out{
+   st,pins {
+   mclk = < 5 ALT1 OUT>;
+   lrclk = < 7 ALT1 OUT>;
+   sclk = < 6 ALT1 OUT>;
+   data0 = < 4 ALT1 OUT>;
+   };
+   };
+   };
+
serial3 {
pinctrl_serial3: serial3-0 {
st,pins {
-- 
1.9.1



[PATCH v8 09/18] ARM: multi_v7_defconfig: Enable STi and simple-card drivers.

2016-08-26 Thread Peter Griffin
This patch enables the STi ALSA drivers found on STi platforms
as well as the simple-card driver which is a dependency to have
working sound.

Signed-off-by: Peter Griffin 
Cc: arnaud.pouliquen at st.com
Cc: broonie at kernel.org
---
 arch/arm/configs/multi_v7_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index 998578a..51a38b1 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -644,6 +644,9 @@ CONFIG_SND_SOC_AK4642=m
 CONFIG_SND_SOC_SGTL5000=m
 CONFIG_SND_SOC_SPDIF=m
 CONFIG_SND_SOC_WM8978=m
+CONFIG_SND_SOC_STI=m
+CONFIG_SND_SOC_STI_SAS=m
+CONFIG_SND_SIMPLE_CARD=m
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_MVEBU=y
-- 
1.9.1



[PATCH v8 08/18] ARM: multi_v7_defconfig: Enable STi FDMA driver

2016-08-26 Thread Peter Griffin
This DMA controller is found on all STi chipsets.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index ea23250..998578a 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -784,6 +784,7 @@ CONFIG_DMA_OMAP=y
 CONFIG_QCOM_BAM_DMA=y
 CONFIG_XILINX_VDMA=y
 CONFIG_DMA_SUN6I=y
+CONFIG_ST_FDMA=m
 CONFIG_STAGING=y
 CONFIG_SENSORS_ISL29018=y
 CONFIG_SENSORS_ISL29028=y
-- 
1.9.1



[PATCH v8 07/18] MAINTAINERS: Add FDMA driver files to STi section.

2016-08-26 Thread Peter Griffin
This patch adds the FDMA driver files to the STi
section of the maintainers file.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5dd3b24..d21a7b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1739,6 +1739,7 @@ F:drivers/char/hw_random/st-rng.c
 F: drivers/clocksource/arm_global_timer.c
 F: drivers/clocksource/clksrc_st_lpc.c
 F: drivers/cpufreq/sti-cpufreq.c
+F: drivers/dma/st_fdma*
 F: drivers/i2c/busses/i2c-st.c
 F: drivers/media/rc/st_rc.c
 F: drivers/media/platform/sti/c8sectpfe/
-- 
1.9.1



[PATCH v8 06/18] ARM: STi: DT: STiH407: Add FDMA driver dt nodes.

2016-08-26 Thread Peter Griffin
These nodes are required to get the fdma driver working
on STiH407 based silicon.

Signed-off-by: Peter Griffin 
---
 arch/arm/boot/dts/stih407-family.dtsi | 52 +++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d294e82..45cab30 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -821,5 +821,57 @@
clock-frequency = <6>;
st,syscfg   = <_core 0x224>;
};
+
+   /* fdma audio */
+   fdma0: dma-controller at 8e2 {
+   compatible = "st,stih407-fdma-mpe31-11", 
"st,slim-rproc";
+   reg = <0x8e2 0x8000>,
+ <0x8e3 0x3000>,
+ <0x8e37000 0x1000>,
+ <0x8e38000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>;
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+   /* fdma app */
+   fdma1: dma-controller at 8e4 {
+   compatible = "st,stih407-fdma-mpe31-12", 
"st,slim-rproc";
+   reg = <0x8e4 0x8000>,
+ <0x8e5 0x3000>,
+ <0x8e57000 0x1000>,
+ <0x8e58000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+   <_s_c0_flexgen CLK_TX_ICN_DMU>,
+   <_s_c0_flexgen CLK_TX_ICN_DMU>,
+   <_s_c0_flexgen CLK_EXT2F_A9>;
+
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+   /* fdma free running */
+   fdma2: dma-controller at 8e6 {
+   compatible = "st,stih407-fdma-mpe31-13", 
"st,slim-rproc";
+   reg = <0x8e6 0x8000>,
+ <0x8e7 0x3000>,
+ <0x8e77000 0x1000>,
+ <0x8e78000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+   <_s_c0_flexgen CLK_EXT2F_A9>,
+   <_s_c0_flexgen CLK_TX_ICN_DISP_0>,
+   <_s_c0_flexgen CLK_EXT2F_A9>;
+   };
};
 };
-- 
1.9.1



[PATCH v8 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

2016-08-26 Thread Peter Griffin
This patch adds support for the Flexible Direct Memory Access (FDMA) core
driver. The FDMA is a slim core CPU with a dedicated firmware.
It is a general purpose DMA controller capable of supporting 16
independent DMA channels. Data moves maybe from memory to memory
or between memory and paced latency critical real time targets and it
is found on al STi based chipsets.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
---
 drivers/dma/Kconfig   |  14 +-
 drivers/dma/Makefile  |   1 +
 drivers/dma/st_fdma.c | 880 ++
 3 files changed, 894 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma/st_fdma.c

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 739f797..5b5a341 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -437,6 +437,19 @@ config STE_DMA40
help
  Support for ST-Ericsson DMA40 controller

+config ST_FDMA
+   tristate "ST FDMA dmaengine support"
+   depends on ARCH_STI
+   select ST_SLIM_REMOTEPROC
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+   help
+ Enable support for ST FDMA controller.
+ It supports 16 independent DMA channels, accepts up to 32 DMA requests
+
+ Say Y here if you have such a chipset.
+ If unsure, say N.
+
 config STM32_DMA
bool "STMicroelectronics STM32 DMA support"
depends on ARCH_STM32
@@ -567,7 +580,6 @@ config ZX_DMA
help
  Support the DMA engine for ZTE ZX296702 platform devices.

-
 # driver files
 source "drivers/dma/bestcomm/Kconfig"

diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index e4dc9ca..a4fa336 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -67,6 +67,7 @@ obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
 obj-$(CONFIG_TI_EDMA) += edma.o
 obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
 obj-$(CONFIG_ZX_DMA) += zx296702_dma.o
+obj-$(CONFIG_ST_FDMA) += st_fdma.o

 obj-y += qcom/
 obj-y += xilinx/
diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c
new file mode 100644
index 000..bb8d8a7
--- /dev/null
+++ b/drivers/dma/st_fdma.c
@@ -0,0 +1,880 @@
+/*
+ * st_fdma.c
+ *
+ * Copyright (C) 2014 STMicroelectronics
+ * Author: Ludovic Barre 
+ *Peter Griffin 
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "st_fdma.h"
+
+static inline struct st_fdma_chan *to_st_fdma_chan(struct dma_chan *c)
+{
+   return container_of(c, struct st_fdma_chan, vchan.chan);
+}
+
+static struct st_fdma_desc *to_st_fdma_desc(struct virt_dma_desc *vd)
+{
+   return container_of(vd, struct st_fdma_desc, vdesc);
+}
+
+static int st_fdma_dreq_get(struct st_fdma_chan *fchan)
+{
+   struct st_fdma_dev *fdev = fchan->fdev;
+   u32 req_line_cfg = fchan->cfg.req_line;
+   u32 dreq_line;
+   int try = 0;
+
+   /*
+* dreq_mask is shared for n channels of fdma, so all accesses must be
+* atomic. if the dreq_mask is changed between ffz and set_bit,
+* we retry
+*/
+   do {
+   if (fdev->dreq_mask == ~0L) {
+   dev_err(fdev->dev, "No req lines available\n");
+   return -EINVAL;
+   }
+
+   if (try || req_line_cfg >= ST_FDMA_NR_DREQS) {
+   dev_err(fdev->dev, "Invalid or used req line\n");
+   return -EINVAL;
+   } else {
+   dreq_line = req_line_cfg;
+   }
+
+   try++;
+   } while (test_and_set_bit(dreq_line, >dreq_mask));
+
+   dev_dbg(fdev->dev, "get dreq_line:%d mask:%#lx\n",
+   dreq_line, fdev->dreq_mask);
+
+   return dreq_line;
+}
+
+static void st_fdma_dreq_put(struct st_fdma_chan *fchan)
+{
+   struct st_fdma_dev *fdev = fchan->fdev;
+
+   dev_dbg(fdev->dev, "put dreq_line:%#x\n", fchan->dreq_line);
+   clear_bit(fchan->dreq_line, >dreq_mask);
+}
+
+static void st_fdma_xfer_desc(struct st_fdma_chan *fchan)
+{
+   struct virt_dma_desc *vdesc;
+   unsigned long nbytes, ch_cmd, cmd;
+
+   vdesc = vchan_next_desc(>vchan);
+   if (!vdesc)
+   return;
+
+   fchan->fdesc = to_st_fdma_desc(vdesc);
+   nbytes = fchan->fdesc->node[0].desc->nbytes;
+   cmd = FDMA_CMD_START(fchan->vchan.chan.chan_id);
+   ch_cmd = fchan->fdesc->node[0].pdesc | FDMA_CH_CMD_STA_START;
+
+   /* start the channel for the descriptor */
+   fnode_write(fchan, nbytes, FDMA_CNTN_OFST);
+   fchan_write(fchan, ch_cmd, FDMA_CH_CMD_OFST);
+   writel(cmd,
+   fchan->fdev->slim_rproc->peri + FDMA_CMD_SET_OFST);
+
+   dev_dbg(fchan->fdev->dev, "start chan:%d\n", fchan->vchan.chan.

[PATCH v8 04/18] dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file

2016-08-26 Thread Peter Griffin
This header file will also be used by the dma xbar driver in the
future.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
---
 drivers/dma/st_fdma.h | 244 ++
 1 file changed, 244 insertions(+)
 create mode 100644 drivers/dma/st_fdma.h

diff --git a/drivers/dma/st_fdma.h b/drivers/dma/st_fdma.h
new file mode 100644
index 000..16fa6f5
--- /dev/null
+++ b/drivers/dma/st_fdma.h
@@ -0,0 +1,244 @@
+/*
+ * st_fdma.h
+ *
+ * Copyright (C) 2014 STMicroelectronics
+ * Author: Ludovic Barre 
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+#ifndef __DMA_ST_FDMA_H
+#define __DMA_ST_FDMA_H
+
+#include 
+#include 
+#include 
+#include 
+#include "virt-dma.h"
+
+#define ST_FDMA_NR_DREQS 32
+
+#define FW_NAME_SIZE 30
+
+/**
+ * struct st_fdma_generic_node - Free running/paced generic node
+ *
+ * @length: Length in bytes of a line in a 2D mem to mem
+ * @sstride: Stride, in bytes, between source lines in a 2D data move
+ * @dstride: Stride, in bytes, between destination lines in a 2D data move
+ */
+struct st_fdma_generic_node {
+   u32 length;
+   u32 sstride;
+   u32 dstride;
+};
+
+/**
+ * struct st_fdma_hw_node - Node structure used by fdma hw
+ *
+ * @next: Pointer to next node
+ * @control: Transfer Control Parameters
+ * @nbytes: Number of Bytes to read
+ * @saddr: Source address
+ * @daddr: Destination address
+ *
+ * @generic: generic node for free running/paced transfert type
+ * 2 others transfert type are possible, but not yet implemented
+ *
+ * The NODE structures must be aligned to a 32 byte boundary
+ */
+struct st_fdma_hw_node {
+   u32 next;
+   u32 control;
+   u32 nbytes;
+   u32 saddr;
+   u32 daddr;
+   union {
+   struct st_fdma_generic_node generic;
+   };
+} __aligned(32);
+
+/*
+ * node control parameters
+ */
+#define FDMA_NODE_CTRL_REQ_MAP_MASKGENMASK(4, 0)
+#define FDMA_NODE_CTRL_REQ_MAP_FREE_RUN0x0
+#define FDMA_NODE_CTRL_REQ_MAP_DREQ(n) ((n)_NODE_CTRL_REQ_MAP_MASK)
+#define FDMA_NODE_CTRL_REQ_MAP_EXT FDMA_NODE_CTRL_REQ_MAP_MASK
+#define FDMA_NODE_CTRL_SRC_MASKGENMASK(6, 5)
+#define FDMA_NODE_CTRL_SRC_STATIC  BIT(5)
+#define FDMA_NODE_CTRL_SRC_INCRBIT(6)
+#define FDMA_NODE_CTRL_DST_MASKGENMASK(8, 7)
+#define FDMA_NODE_CTRL_DST_STATIC  BIT(7)
+#define FDMA_NODE_CTRL_DST_INCRBIT(8)
+#define FDMA_NODE_CTRL_SECURE  BIT(15)
+#define FDMA_NODE_CTRL_PAUSE_EON   BIT(30)
+#define FDMA_NODE_CTRL_INT_EON BIT(31)
+
+/**
+ * struct st_fdma_sw_node - descriptor structure for link list
+ *
+ * @pdesc: Physical address of desc
+ * @node: link used for putting this into a channel queue
+ */
+struct st_fdma_sw_node {
+   dma_addr_t pdesc;
+   struct st_fdma_hw_node *desc;
+};
+
+#define NAME_SZ 10
+
+struct st_fdma_driverdata {
+   u32 id;
+   char name[NAME_SZ];
+};
+
+struct st_fdma_desc {
+   struct virt_dma_desc vdesc;
+   struct st_fdma_chan *fchan;
+   bool iscyclic;
+   unsigned int n_nodes;
+   struct st_fdma_sw_node node[];
+};
+
+enum st_fdma_type {
+   ST_FDMA_TYPE_FREE_RUN,
+   ST_FDMA_TYPE_PACED,
+};
+
+struct st_fdma_cfg {
+   struct device_node *of_node;
+   enum st_fdma_type type;
+   dma_addr_t dev_addr;
+   enum dma_transfer_direction dir;
+   int req_line; /* request line */
+   long req_ctrl; /* Request control */
+};
+
+struct st_fdma_chan {
+   struct st_fdma_dev *fdev;
+   struct dma_pool *node_pool;
+   struct dma_slave_config scfg;
+   struct st_fdma_cfg cfg;
+
+   int dreq_line;
+
+   struct virt_dma_chan vchan;
+   struct st_fdma_desc *fdesc;
+   enum dma_status status;
+};
+
+struct st_fdma_dev {
+   struct device *dev;
+   const struct st_fdma_driverdata *drvdata;
+   struct dma_device dma_device;
+
+   struct st_slim_rproc *slim_rproc;
+
+   int irq;
+
+   struct st_fdma_chan *chans;
+
+   spinlock_t dreq_lock;
+   unsigned long dreq_mask;
+
+   u32 nr_channels;
+   char fw_name[FW_NAME_SIZE];
+};
+
+/* Peripheral Registers*/
+
+#define FDMA_CMD_STA_OFST  0xFC0
+#define FDMA_CMD_SET_OFST  0xFC4
+#define FDMA_CMD_CLR_OFST  0xFC8
+#define FDMA_CMD_MASK_OFST 0xFCC
+#define FDMA_CMD_START(ch) (0x1 << (ch << 1))
+#define FDMA_CMD_PAUSE(ch) (0x2 << (ch << 1))
+#define FDMA_CMD_FLUSH(ch) (0x3 << (ch << 1))
+
+#define FDMA_INT_STA_OFST  0xFD0
+#define FDMA_INT_STA_CH0x1
+#define FDMA_INT_STA_ERR   0x2
+
+#define FDMA_INT_SET_OFST  0xFD4
+#define FDMA_INT_CLR_OFST  0xFD8
+#define FDMA_INT_MASK_OFST 0xFDC
+
+#define fdma_read(fdev, name) \
+   readl((fdev)->slim_rproc->peri + name)
+
+#define fdma_write(fdev, val, name) \
+   writel((val), (f

[PATCH v8 03/18] dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding documentation

2016-08-26 Thread Peter Griffin
This patch adds the DT binding documentation for the FDMA constroller
found on STi based chipsets from STMicroelectronics.

Signed-off-by: Ludovic Barre 
Signed-off-by: Peter Griffin 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/dma/st_fdma.txt | 87 +++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt

diff --git a/Documentation/devicetree/bindings/dma/st_fdma.txt 
b/Documentation/devicetree/bindings/dma/st_fdma.txt
new file mode 100644
index 000..495d853
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/st_fdma.txt
@@ -0,0 +1,87 @@
+* STMicroelectronics Flexible Direct Memory Access Device Tree bindings
+
+The FDMA is a general-purpose direct memory access controller capable of
+supporting 16 independent DMA channels. It accepts up to 32 DMA requests.
+The FDMA is based on a Slim processor which requires a firmware.
+
+* FDMA Controller
+
+Required properties:
+- compatible   : Should be one of
+- st,stih407-fdma-mpe31-11, "st,slim-rproc";
+- st,stih407-fdma-mpe31-12, "st,slim-rproc";
+- st,stih407-fdma-mpe31-13, "st,slim-rproc";
+- reg  : Should contain an entry for each name in reg-names
+- reg-names: Must contain "slimcore", "dmem", "peripherals", "imem" entries
+- interrupts   : Should contain one interrupt shared by all channels
+- dma-channels : Number of channels supported by the controller
+- #dma-cells   : Must be <3>. See DMA client section below
+- clocks   : Must contain an entry for each clock
+See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+
+Example:
+
+   fdma0: dma-controller at 8e2 {
+   compatible = "st,stih407-fdma-mpe31-11", "st,slim-rproc";
+   reg = <0x8e2 0x8000>,
+ <0x8e3 0x3000>,
+ <0x8e37000 0x1000>,
+ <0x8e38000 0x8000>;
+   reg-names = "slimcore", "dmem", "peripherals", "imem";
+   clocks = <_s_c0_flexgen CLK_FDMA>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>,
+<_s_c0_flexgen CLK_EXT2F_A9>;
+   interrupts = ;
+   dma-channels = <16>;
+   #dma-cells = <3>;
+   };
+
+* DMA client
+
+Required properties:
+- dmas: Comma separated list of dma channel requests
+- dma-names: Names of the aforementioned requested channels
+
+Each dmas request consists of 4 cells:
+1. A phandle pointing to the FDMA controller
+2. The request line number
+3. A 32bit mask specifying (see include/linux/platform_data/dma-st-fdma.h)
+ -bit 2-0: Holdoff value, dreq will be masked for
+   0x0: 0-0.5us
+   0x1: 0.5-1us
+   0x2: 1-1.5us
+ -bit 17: data swap
+   0x0: disabled
+   0x1: enabled
+ -bit 21: Increment Address
+   0x0: no address increment between transfers
+   0x1: increment address between transfers
+ -bit 22: 2 STBus Initiator Coprocessor interface
+   0x0: high priority port
+   0x1: low priority port
+4. transfers type
+ 0 free running
+ 1 paced
+
+Example:
+
+   sti_uni_player2: sti-uni-player at 2 {
+   compatible = "st,sti-uni-player";
+   status = "disabled";
+   #sound-dai-cells = <0>;
+   st,syscfg = <_core>;
+   clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clocks = <_s_d0_flexgen CLK_PCM_2>;
+   assigned-clock-parents = <_s_d0_quadfs 2>;
+   assigned-clock-rates = <5000>;
+   reg = <0x8D82000 0x158>;
+   interrupts = ;
+   dmas = < 4 0 1>;
+   dai-name = "Uni Player #1 (DAC)";
+   dma-names = "tx";
+   st,uniperiph-id = <2>;
+   st,version = <5>;
+   st,mode = "PCM";
+   };
-- 
1.9.1



[PATCH v8 02/18] MAINTAINERS: Add st slim core rproc driver to STi section.

2016-08-26 Thread Peter Griffin
This patch adds the slim core rproc driver to the STi section
of the MAINTAINERS file.

Signed-off-by: Peter Griffin 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0bbe4b1..5dd3b24 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1749,6 +1749,7 @@ F:drivers/phy/phy-stih407-usb.c
 F: drivers/phy/phy-stih41x-usb.c
 F: drivers/pinctrl/pinctrl-st.c
 F: drivers/remoteproc/st_remoteproc.c
+F: drivers/remoteproc/st_slim_rproc.c
 F: drivers/reset/sti/
 F: drivers/rtc/rtc-st-lpc.c
 F: drivers/tty/serial/st-asc.c
@@ -1757,6 +1758,7 @@ F:drivers/usb/host/ehci-st.c
 F: drivers/usb/host/ohci-st.c
 F: drivers/watchdog/st_lpc_wdt.c
 F: drivers/ata/ahci_st.c
+F: include/linux/remoteproc/st_slim_rproc.h

 ARM/STM32 ARCHITECTURE
 M: Maxime Coquelin 
-- 
1.9.1



[PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver

2016-08-26 Thread Peter Griffin
slim core is used as a basis for many IPs in the STi
chipsets such as fdma and demux. To avoid duplicating
the elf loading code in each device driver a slim
rproc driver has been created.

This driver is designed to be used by other device drivers
such as fdma, or demux whose IP is based around a slim core.
The device driver can call slim_rproc_alloc() to allocate
a slim rproc and slim_rproc_put() when finished.

This driver takes care of ioremapping the slim
registers (dmem, imem, slimcore, peripherals), whose offsets
and sizes can change between IP's. It also obtains and enables
any clocks used by the device. This approach avoids having
a double mapping of the registers as slim_rproc does not register
its own platform device. It also maps well to device tree
abstraction as it allows us to have one dt node for the whole
device.

All of the generic rproc elf loading code can be reused, and
we provide start() stop() hooks to start and stop the slim
core once the firmware has been loaded. This has been tested
successfully with fdma driver.

Signed-off-by: Peter Griffin 
---
 drivers/remoteproc/Kconfig   |   8 +
 drivers/remoteproc/Makefile  |   1 +
 drivers/remoteproc/st_slim_rproc.c   | 364 +++
 include/linux/remoteproc/st_slim_rproc.h |  53 +
 4 files changed, 426 insertions(+)
 create mode 100644 drivers/remoteproc/st_slim_rproc.c
 create mode 100644 include/linux/remoteproc/st_slim_rproc.h

diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 1a8bf76a..06765e0 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -100,4 +100,12 @@ config ST_REMOTEPROC
  processor framework.
  This can be either built-in or a loadable module.

+config ST_SLIM_REMOTEPROC
+   tristate "ST Slim remoteproc support"
+   select REMOTEPROC
+   help
+ Say y here to support firmware loading on IP based around
+ the Slim core.
+ If unsure say N.
+
 endmenu
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index 92d3758..db1dae7 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_DA8XX_REMOTEPROC)+= 
da8xx_remoteproc.o
 obj-$(CONFIG_QCOM_MDT_LOADER)  += qcom_mdt_loader.o
 obj-$(CONFIG_QCOM_Q6V5_PIL)+= qcom_q6v5_pil.o
 obj-$(CONFIG_ST_REMOTEPROC)+= st_remoteproc.o
+obj-$(CONFIG_ST_SLIM_REMOTEPROC)   += st_slim_rproc.o
diff --git a/drivers/remoteproc/st_slim_rproc.c 
b/drivers/remoteproc/st_slim_rproc.c
new file mode 100644
index 000..f4bf2d7
--- /dev/null
+++ b/drivers/remoteproc/st_slim_rproc.c
@@ -0,0 +1,364 @@
+/*
+ * st_slim_rproc.c
+ *
+ * Copyright (C) 2016 STMicroelectronics
+ * Author: Peter Griffin 
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "remoteproc_internal.h"
+
+/* slimcore registers */
+#define SLIM_ID_OFST   0x0
+#define SLIM_VER_OFST  0x4
+
+#define SLIM_EN_OFST   0x8
+#define SLIM_EN_RUNBIT(0)
+
+#define SLIM_CLK_GATE_OFST 0xC
+#define SLIM_CLK_GATE_DIS  BIT(0)
+#define SLIM_CLK_GATE_RESETBIT(2)
+
+#define SLIM_SLIM_PC_OFST  0x20
+
+/* dmem registers */
+#define SLIM_REV_ID_OFST   0x0
+#define SLIM_REV_ID_MIN_MASK   GENMASK(15, 8)
+#define SLIM_REV_ID_MIN(id)((id & SLIM_REV_ID_MIN_MASK) >> 8)
+#define SLIM_REV_ID_MAJ_MASK   GENMASK(23, 16)
+#define SLIM_REV_ID_MAJ(id)((id & SLIM_REV_ID_MAJ_MASK) >> 16)
+
+
+/* peripherals registers */
+#define SLIM_STBUS_SYNC_OFST   0xF88
+#define SLIM_STBUS_SYNC_DISBIT(0)
+
+#define SLIM_INT_SET_OFST  0xFD4
+#define SLIM_INT_CLR_OFST  0xFD8
+#define SLIM_INT_MASK_OFST 0xFDC
+
+#define SLIM_CMD_CLR_OFST  0xFC8
+#define SLIM_CMD_MASK_OFST 0xFCC
+
+static const char *mem_names[ST_SLIM_MEM_MAX] = {
+   [ST_SLIM_DMEM]  = "dmem",
+   [ST_SLIM_IMEM]  = "imem",
+};
+
+static int slim_clk_get(struct st_slim_rproc *slim_rproc, struct device *dev)
+{
+   int clk, err;
+
+   for (clk = 0; clk < ST_SLIM_MAX_CLK; clk++) {
+   slim_rproc->clks[clk] = of_clk_get(dev->of_node, clk);
+   if (IS_ERR(slim_rproc->clks[clk])) {
+   err = PTR_ERR(slim_rproc->clks[clk]);
+   if (err == -EPROBE_DEFER)
+   goto err_put_clks;
+   slim_rproc->clks[clk] = NULL;
+   break;
+   }
+   }
+
+   return 0;
+
+err_put_clks:
+   while (--clk >= 0)
+   clk_put(slim_rproc->clks[clk]);
+
+   return err;
+}
+
+static void slim_clk_disable(struct st_slim_rproc *slim_rproc)
+{
+   

[PATCH v8 00/18] Add support for FDMA DMA controller and slim core rproc found on STi chipsets

2016-08-26 Thread Peter Griffin
 Remove elf loading code from fdma driver (Vinod)
 - Remove fdma_ prefix for clock names (Arnd)
 - Make _xlate use dma_get_any_channel rather than request_channel (Arnd)
 - Make a common function for _prep_ routines (Vinod)
 - Make driver depend on COMPILE_TEST (Arnd)
 - Remove unnecessary st_fdma_filter_fn (Arnd)
 - Enable FDMA as a module (Arnd)
 - Drop fdma_ clock prefix (Arnd)
 - Fix description as well as example for st, prefix (Arnd)
 - Remove string concatenation from fdma register macros to ease grep'ability 
(Arnd)
 - Add a XP70 rproc driver for ELF firmware loading and start/stop control 
(Peter)
 - Add myself as a author of the driver (Peter)

Changes since v2:
 - Change to dma-controller (Arnd)
 - Remove platform data header file and simplifiy code (Arnd)
 - Remove FW_LOADER_USER_HELPER_FALLBACK and rework firmware loading to device 
config (Vinod)
 - Use SET_RUNTIME_PM_OPS helpers (Vinod)
 - Remove fdma-id dt prop and use compatibles to generate different fdma 
firmware names (Arnd / Lee)
 - Add sti-asoc-card DT nodes and pinmux config for uniperif player & reader 
(Peter)
 - Update sti-asoc-card DT binding documentation (Peter)
 - Enable STi audio drivers in multi_v7_defconfig (Peter)

Changes since v1:
 - split into smaller patches for easier / faster review (Vinod)
 - new fill_hw_mode() with common code (Vinod)
 - new config_reqctrl() called from *_prep() instead of device_config cb (Vinod)
 - fdma-xbar support removed (Peter)
 - rework firmware name mechanism so fwname isn't in DT (Peter / Lee)
 - st_fdma_seg_to_mem can be static (Paul)
 - EXPORT_SYMBOL st_fdma_filter_fn not required (Paul)
 - s/channel/channels (vinod)
 - better describe "Must be <3>" (vinod)
 - sizeof(*ehdr) (vinod)
 - print values on error debug (vinod)
 - empty line (Vinod)
 - Update to -EIO (Vinod)
 - Make st_fdma tristate (Paul)
 - Remove __exit tag from .remove (Maxime)
 - Update MAINTAINERS rule to fdma* (Lee)
 - Unit address should match reg property (Lee)

Peter Griffin (18):
  remoteproc: st_slim_rproc: add a slimcore rproc driver
  MAINTAINERS: Add st slim core rproc driver to STi section.
  dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding
documentation
  dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file
  dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
  ARM: STi: DT: STiH407: Add FDMA driver dt nodes.
  MAINTAINERS: Add FDMA driver files to STi section.
  ARM: multi_v7_defconfig: Enable STi FDMA driver
  ARM: multi_v7_defconfig: Enable STi and simple-card drivers.
  ARM: DT: STiH407: Add i2s_out pinctrl configuration
  ARM: DT: STiH407: Add i2s_in pinctrl configuration
  ARM: DT: STiH407: Add spdif_out pinctrl config
  ARM: STi: DT: STiH407: Add sti-sasg-codec dt node
  ARM: STi: DT: STiH407: Add uniperif player dt nodes
  ARM: STi: DT: STiH407: Add uniperif reader dt nodes
  ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card
  drm/virtio: kconfig: Fix recursive dependency.
  drm/virtio: kconfig: Fixup white space.

 Documentation/devicetree/bindings/dma/st_fdma.txt |  87 +++
 MAINTAINERS   |   3 +
 arch/arm/boot/dts/stih407-family.dtsi | 161 
 arch/arm/boot/dts/stih407-pinctrl.dtsi|  55 ++
 arch/arm/boot/dts/stihxxx-b2120.dtsi  |  45 ++
 arch/arm/configs/multi_v7_defconfig   |   4 +
 drivers/dma/Kconfig   |  14 +-
 drivers/dma/Makefile  |   1 +
 drivers/dma/st_fdma.c | 880 ++
 drivers/dma/st_fdma.h | 244 ++
 drivers/gpu/drm/virtio/Kconfig|   9 +-
 drivers/remoteproc/Kconfig|   8 +
 drivers/remoteproc/Makefile   |   1 +
 drivers/remoteproc/st_slim_rproc.c| 364 +
 include/linux/remoteproc/st_slim_rproc.h  |  53 ++
 15 files changed, 1924 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt
 create mode 100644 drivers/dma/st_fdma.c
 create mode 100644 drivers/dma/st_fdma.h
 create mode 100644 drivers/remoteproc/st_slim_rproc.c
 create mode 100644 include/linux/remoteproc/st_slim_rproc.h

-- 
1.9.1



[STLinux Kernel] [PATCH 1/1] drm/sti: use new Reset API

2016-07-25 Thread Peter Griffin
Hi Lee,

On Mon, 25 Jul 2016, Lee Jones wrote:

> Since 0b52297f228 ("reset: Add support for shared reset controls") the
> new Reset API now demands consumers choose either an *_exclusive or a
> *_shared line when requesting reset lines.
> 
> This issue was found when running a kernel containing the aforementioned
> patch  which includes an informitive WARN().  It implies that one or
> more used reset lines are in fact shared.  This is why we're using the
> *_shared variant.
> 
> Signed-off-by: Lee Jones 
> ---
>  drivers/gpu/drm/sti/sti_compositor.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Your missing a changelog on the v2 version.

Apart from that:
 Acked-by: Peter Griffin 

regards,

Peter.


[PATCH 2/2] drm/msm: storage class should be before const qualifier

2014-06-05 Thread Peter Griffin
The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Peter Griffin 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Cc: linux-kernel at vger.kernel.org
---
 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f9de156..407975d 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -159,7 +159,7 @@ static int msm_unload(struct drm_device *dev)
 static int get_mdp_ver(struct platform_device *pdev)
 {
 #ifdef CONFIG_OF
-   const static struct of_device_id match_types[] = { {
+   static const struct of_device_id match_types[] = { {
.compatible = "qcom,mdss_mdp",
.data   = (void *)5,
}, {
-- 
1.9.1



[PATCH 1/2] drm/plane-helper: storage class should be before const qualifier

2014-06-05 Thread Peter Griffin
The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Peter Griffin 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Cc: linux-kernel at vger.kernel.org
---
 drivers/gpu/drm/drm_plane_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index d2b1c03..88a6c49 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -36,7 +36,7 @@
  * creating the primary plane.  However drivers that still call
  * drm_plane_init() will use this minimal format list as the default.
  */
-const static uint32_t safe_modeset_formats[] = {
+static const uint32_t safe_modeset_formats[] = {
DRM_FORMAT_XRGB,
DRM_FORMAT_ARGB,
 };
-- 
1.9.1