Re: [alsa-devel] [PATCH v9 08/10] ASoC: Add phycore-ac97-dt driver

2013-07-08 Thread Markus Pargmann
Hi Fabio,

On Sun, Jul 07, 2013 at 10:16:30AM -0300, Fabio Estevam wrote:
> Hi Markus,
> 
> On Sun, Jul 7, 2013 at 4:19 AM, Markus Pargmann  wrote:
> 
> > There are no pinctrl driver for imx27(pca100) or imx35(pcm043). The
> 
> For mx35 pinctrl driver is at drivers/pinctrl/pinctrl-imx35.c
> 

Thank you.

I will create some pinctrl bindings for pcm043. But I am not sure what
to do with pca100 reset functions.

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 1/3] ARM: dts: imx27 phyCARD-S SOM remove wrong i2c sensor

2013-07-07 Thread Markus Pargmann
This sensor was introduced in the original pca100 board file, but
phyCARD-S SOM and RDK do not have a temperature sensor.

Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
index 01ee807..cdff8c7 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
@@ -50,11 +50,6 @@
 &i2c2 {
status = "okay";
 
-   lm75@4a {
-   compatible = "national,lm75";
-   reg = <0x4a>;
-   };
-
at24@52 {
compatible = "at,24c32";
pagesize = <32>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 0/3] ARM: dts: imx27 phyCARD-S I2C devices

2013-07-07 Thread Markus Pargmann
Hi,

here are some I2C device patches for phyCARD-S.

Regards,

Markus


Markus Pargmann (3):
  ARM: dts: imx27 phyCARD-S SOM remove wrong i2c sensor
  ARM: dts: imx27 phyCARD-S, move i2c1 and owire to rdk
  ARM: dts: imx27 phyCARD-S, i2c ADC device node

 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 31 
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 23 --
 2 files changed, 31 insertions(+), 23 deletions(-)

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 3/3] ARM: dts: imx27 phyCARD-S, i2c ADC device node

2013-07-07 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
index 0514b0a..5a31c77 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
@@ -34,6 +34,18 @@
};
};
};
+
+   regulators {
+   compatible = "simple-bus";
+
+   reg_3v3: 3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+   };
+   };
 };
 
 &fb {
@@ -48,6 +60,12 @@
compatible = "nxp,pcf8563";
reg = <0x51>;
};
+
+   adc@64 {
+   compatible = "maxim,max1037";
+   vcc-supply = <®_3v3>;
+   reg = <0x64>;
+   };
 };
 
 &owire {
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 2/3] ARM: dts: imx27 phyCARD-S, move i2c1 and owire to rdk

2013-07-07 Thread Markus Pargmann
Both buses are not used on the phyCARD-S module. This patch moves them
to the rdk file. Remove ioexpander.

Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 13 +
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 18 --
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
index 390d8f2..0514b0a 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
@@ -41,6 +41,19 @@
status = "okay";
 };
 
+&i2c1 {
+   status = "okay";
+
+   rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   };
+};
+
+&owire {
+   status = "okay";
+};
+
 &sdhci2 {
cd-gpios = <&gpio3 29 0>;
status = "okay";
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
index cdff8c7..c8d57d1 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
@@ -33,20 +33,6 @@
status = "okay";
 };
 
-&i2c1 {
-   status = "okay";
-
-   ioexpander@41 {
-   compatible = "nxp,pca9536";
-   reg = <0x41>;
-   };
-
-   rtc@51 {
-   compatible = "nxp,pcf8563";
-   reg = <0x51>;
-   };
-};
-
 &i2c2 {
status = "okay";
 
@@ -56,7 +42,3 @@
reg = <0x52>;
};
 };
-
-&owire {
-   status = "okay";
-};
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH] ARM: dts: imx27 phyCARD-S remove wrong I2C RTC

2013-07-07 Thread Markus Pargmann
On Sun, Jul 07, 2013 at 02:31:41PM +0400, Alexander Shiyan wrote:
> > On Sat, Jul 06, 2013 at 12:51:58PM +0400, Alexander Shiyan wrote:
> > > > Fixup of commit 7874d595b78e431f0f661d2fe47625649308a52e
> > > > "ARM: dts: Add device tree support for phycard pca100".
> > > > 
> > > > Remove wrong I2C RTC node.
> > > > 
> > > > Signed-off-by: Markus Pargmann 
> > > > ---
> > > > 
> > > > Thanks, Alexander, you are right. I2C2 has no RTC.
> > > ...
> > > 
> > > There are a couple of comments on this file.
> > > 
> > > I think that the OWIRE should be moved to the RDK.
> > 
> > I moved OWIRE and i2c1 to RDK. Both are not used on the SOM.
> > 
> > > ioexpander must contain "gpio-controller" at least, and for use it 
> > > further,
> > > it is necessary to define the label for this node.
> > 
> > I checked all I2C devices in the board schematics. There is actually no
> > ioexpander. I don't know why it was added. I will send some I2C patches
> > later.
> 
> Perhaps the chip is mounted on the camera module.
> A similar IC is exist on PCM-970 camera addon device.
> If so, the device should also be moved to RDK.

Yes that's possible. But in that case I think the ioexpander should be
removed from both dts files because the Phytec phyCARD-S RDK does not
include a camera module.

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH] ARM: dts: imx27 phyCARD-S remove wrong I2C RTC

2013-07-07 Thread Markus Pargmann
On Sat, Jul 06, 2013 at 12:51:58PM +0400, Alexander Shiyan wrote:
> > Fixup of commit 7874d595b78e431f0f661d2fe47625649308a52e
> > "ARM: dts: Add device tree support for phycard pca100".
> > 
> > Remove wrong I2C RTC node.
> > 
> > Signed-off-by: Markus Pargmann 
> > ---
> > 
> > Thanks, Alexander, you are right. I2C2 has no RTC.
> ...
> 
> There are a couple of comments on this file.
> 
> I think that the OWIRE should be moved to the RDK.

I moved OWIRE and i2c1 to RDK. Both are not used on the SOM.

> ioexpander must contain "gpio-controller" at least, and for use it further,
> it is necessary to define the label for this node.

I checked all I2C devices in the board schematics. There is actually no
ioexpander. I don't know why it was added. I will send some I2C patches
later.

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v9 08/10] ASoC: Add phycore-ac97-dt driver

2013-07-07 Thread Markus Pargmann
On Wed, Jul 03, 2013 at 05:17:27PM +0100, Mark Brown wrote:
> On Thu, Jun 20, 2013 at 03:20:27PM +0200, Markus Pargmann wrote:
> 
> > Notes:
> > Changes in v9:
> >  - Fix blank line at end of file.
> > 
> 
> Please don't include enormous changelogs like this, they're just noise.
> 
> > +config SND_SOC_PHYCORE_AC97_DT
> > +   bool "SoC Audio support for Phytec phyCORE (and phyCARD) boards 
> > (devicetree only)"
> > +   depends on MACH_PCA100 || MACH_PCM043
> 
> Is there an actual dependency on the machine type?  This seems wrong for
> a DT driver.

No, there is no dependency. Fixed.

> 
> > +static struct snd_soc_ops imx_phycore_hifi_ops = {
> > +};
> > +
> 
> You shouldn't have this if there's nothing in it.

Removed.

> 
> > +static struct platform_device *imx_phycore_snd_device;
> 
> This shouldn't be a global, it should be in driver data.

Moved to driver data.

> 
> > +/*
> > + * Pointer to AC97 reset functions for specific boards
> > + */
> > +#if IS_ENABLED(CONFIG_MACH_PCA100)
> > +extern void pca100_ac97_cold_reset(struct snd_ac97 *ac97);
> > +extern void pca100_ac97_warm_reset(struct snd_ac97 *ac97);
> > +#else
> > +static void pca100_ac97_cold_reset(struct snd_ac97 *ac97) { }
> > +static void pca100_ac97_warm_reset(struct snd_ac97 *ac97) { }
> > +#endif
> 
> > +   if (of_machine_is_compatible("phytec,imx27-pca100")) {
> > +   phycore_ac97_reset = pca100_ac97_cold_reset;
> > +   phycore_ac97_warm_reset = pca100_ac97_warm_reset;
> > +   } else if (of_machine_is_compatible("phytec,imx35-pcm043")) {
> > +   phycore_ac97_reset = pcm043_ac97_cold_reset;
> > +   phycore_ac97_warm_reset = pcm043_ac97_warm_reset;
> > +   } else {
> > +   dev_err(&pdev->dev, "Failed to set AC97 reset functions, 
> > unknown board.\n");
> > +   return -EINVAL;
> > +   }
> 
> These functions have no reason to be anywhere except in the driver and
> really you should just be specifying which pins to use there - ideally
> via pinctrl but I don't think i.MX has adopted that yet.

There are no pinctrl driver for imx27(pca100) or imx35(pcm043). The
iomux/pad configure functions are defined inside mach-imx/ including
their headers. Both reset functions have to configure iomux/pad before
and after using gpio. So I think it's not possible to make the reset
based on the gpio pins without the necessary iomux/pad configuration.

Thanks,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v9 04/10] ASoC: fsl-ssi: Add support for imx-pcm-fiq

2013-07-06 Thread Markus Pargmann
Hi Mark,

On Wed, Jul 03, 2013 at 05:06:37PM +0100, Mark Brown wrote:
> On Thu, Jun 20, 2013 at 03:20:23PM +0200, Markus Pargmann wrote:
> 
> > +   ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
> > +
> 
> This binding should be documented.  I'm not sure it really needs to be
> a binding, though - is it not possible for the driver to just figure out
> that DMA won't work automatically (for example by looking at the CODEC
> in use)?  I'm not sure this is a good name either, it should be saying
> why the FIQ is needed rather than saying that we should use the FIQ.

I think fsl_ssi_startup is the first function in which we know which
codec is connected to fsl-ssi. There we have access to the pcm runtime,
which stores the codec used. But that is too late for the ssi setup.

I could use of_find_compatible_node to search for the wm9712 codec, but
that would assume that there is only one codec attached to the system.

Perhaps "fsl,fiq-filter-codec-stream" is a better name for the binding?

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v9 01/10] ASoC: imx-pcm-dma: DT support

2013-07-05 Thread Markus Pargmann
On Sun, Jun 23, 2013 at 12:49:17PM -0500, Timur Tabi wrote:
> Markus Pargmann wrote:
> > This patch removes the NO_DT flag. The pdev pointer may have a proper
> > of_node with the dmas property, so we can use it to request DMA
> > channels.
> >
> > Signed-off-by: Markus Pargmann
> > Tested-by: Shawn Guo
> > ---
> 
> I won't have access to functioning hardware for another month or two, so I 
> can't test to see if this patchset breaks PowerPC, but at least it does 
> compile.  I'm a little worried that the DMA changes won't actually run on 
> PowerPC, but I can't test that now.

The DMA channels should end up to be NULL on PowerPC within the generic
dmaengine pcm, so it should fall back to NO_DT automatically.

> 
> So for the time being:
> 
> Acked-by: Timur Tabi 
> 
> -- 
> Timur Tabi
> 

Thanks,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH] ARM: dts: imx27 phyCARD-S remove wrong I2C RTC

2013-07-05 Thread Markus Pargmann
Fixup of commit 7874d595b78e431f0f661d2fe47625649308a52e
"ARM: dts: Add device tree support for phycard pca100".

Remove wrong I2C RTC node.

Signed-off-by: Markus Pargmann 
---

Thanks, Alexander, you are right. I2C2 has no RTC.

Regards,

Markus

 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
index ec52b6d..01ee807 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
@@ -55,11 +55,6 @@
reg = <0x4a>;
};
 
-   rtc@51 {
-   compatible = "nxp,pcf8563";
-   reg = <0x51>;
-   };
-
at24@52 {
compatible = "at,24c32";
pagesize = <32>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v3 1/5] ARM: imx27: Use 'AITC' for the interrupt controller name

2013-06-28 Thread Markus Pargmann
From: Fabio Estevam 

On the MX27 Reference Manual the interrupt controller is named AITC:
ARM926EJ-S Interrupt Controller

So use the AITC term instead of AVIC.

Signed-off-by: Fabio Estevam 
Origin: id:1334193132-18944-2-git-send-email-feste...@gmail.com
Signed-off-by: Uwe Kleine-König 
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 0695264..8603886 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -30,8 +30,8 @@
spi2 = &cspi3;
};
 
-   avic: avic-interrupt-controller@e000 {
-   compatible = "fsl,imx27-avic", "fsl,avic";
+   aitc: aitc-interrupt-controller@e000 {
+   compatible = "fsl,imx27-aitc", "fsl,avic";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x1004 0x1000>;
@@ -51,7 +51,7 @@
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
-   interrupt-parent = <&avic>;
+   interrupt-parent = <&aitc>;
ranges;
 
aipi@1000 { /* AIPI1 */
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v3 0/5] ARM: dts: imx27 Phytec phyCARD-S

2013-06-28 Thread Markus Pargmann
Hi,

This series adds some device nodes for imx27 and board files for Phytec
phyCARD-S SOM and RDK. It is based on shawn's branch "imx/dt".

Regards,

Markus

Changes in v3:
 - Removed unnecessary clock-names from owire node
 - Update memory offset

Changes in v2:
 - Removed already accepted clocks patch
   "ARM: mx27: Replace clk_register_clkdev with clock DT lookup"
 - pca100 board file was splitted into two parts SOM and RDK
 - other changes described in patch notes

Fabio Estevam (1):
  ARM: imx27: Use 'AITC' for the interrupt controller name

Markus Pargmann (4):
  ARM: dts: imx27: Add imx framebuffer device
  ARM: dts: imx27: Add 1-wire
  ARM: dts: imx27 cpufreq-cpu0 frequencies
  ARM: dts: Add device tree support for phycard pca100

 arch/arm/boot/dts/Makefile   |  2 +
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 62 
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 72 
 arch/arm/boot/dts/imx27.dtsi | 40 -
 4 files changed, 173 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v3 5/5] ARM: dts: Add device tree support for phycard pca100

2013-06-28 Thread Markus Pargmann
Board files for Phytec phyCARD-S "System on Module" and "Rapid
Development Kit".

Based on patches from:

Steffen Trumtrar :
 - Original patch
 - ARM: dts: Set partition offsets for phycard
 - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
 - ARM: imx27-phytec-phycard-S.dts: resize nand partitions

Jan Luebbe :
 - ARM: dts: Enable bad block table in NAND

Cc: Steffen Trumtrar 
Cc: Jan Luebbe 
Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v3:
 - Fix memory offset

Changes in v2:
 - Remove unnecessary Kconfig nand selection.
 - Style fixes
 - Replace node identifiers with node labels
 - Fix compatibility of cpu node
 - Remove device node for not mainlined dimmer driver
 - Remove nand partition table
 - Remove memory node
 - Splitted board file into "system on module" and "rapid development kit"

 arch/arm/boot/dts/Makefile   |  2 +
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 62 
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 72 
 3 files changed, 136 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b3a8661..707c192 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -105,6 +105,8 @@ dtb-$(CONFIG_ARCH_MXC) += \
imx27-pdk.dtb \
imx27-phytec-phycore-som.dtb \
imx27-phytec-phycore-rdk.dtb \
+   imx27-phytec-phycard-s-som.dtb \
+   imx27-phytec-phycard-s-rdk.dtb \
imx31-bug.dtb \
imx51-apf51.dtb \
imx51-apf51dev.dtb \
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
new file mode 100644
index 000..bf11429
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 Markus Pargmann, Pengutronix
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include "imx27-phytec-phycard-s-som.dts"
+
+/ {
+   model = "Phytec pca100 rapid development kit";
+   compatible = "phytec,imx27-pca100-rdk", "phytec,imx27-pca100", 
"fsl,imx27";
+
+   display: display {
+   model = "Primeview-PD050VL1";
+   native-mode = <&timing0>;
+   bits-per-pixel = <16>;  /* non-standard but required */
+   fsl,pcr = <0xf0c88080>; /* non-standard but required */
+   display-timings {
+   timing0: 640x480 {
+   hactive = <640>;
+   vactive = <480>;
+   hback-porch = <112>;
+   hfront-porch = <36>;
+   hsync-len = <32>;
+   vback-porch = <33>;
+   vfront-porch = <33>;
+   vsync-len = <2>;
+   clock-frequency = <2500>;
+   };
+   };
+   };
+};
+
+&imxfb {
+   display = <&display>;
+   status = "okay";
+};
+
+&sdhci2 {
+   cd-gpios = <&gpio3 29 0>;
+   status = "okay";
+};
+
+&uart1 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
+
+&uart2 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
+
+&uart3 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
new file mode 100644
index 000..ec52b6d
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2012 Sascha Hauer, Uwe Kleine-König, Steffen Trumtrar
+ * and Markus Pargmann, Pengutronix
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+#include "imx27.dtsi"
+
+/ {
+   model = "Phytec pca100";
+   compatible = "phytec,imx27-pca100", "fsl,imx27";
+
+   memory {
+   reg = <0xa000 0x0800>; /* 128MB */
+   };
+};
+
+&cspi1 {
+   fsl,spi-num

[PATCH v3 3/5] ARM: dts: imx27: Add 1-wire

2013-06-28 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v3:
 - Removed clock-names, not necessary for this driver.

Changes in v2:
 - Add fsl,imx27-owire as first entry in the compatibility list.

 arch/arm/boot/dts/imx27.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 10dcbd3..a79f173 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -110,6 +110,13 @@
clock-names = "ipg", "per";
};
 
+   owire: owire@10009000 {
+   compatible = "fsl,imx27-owire", 
"fsl,imx21-owire";
+   reg = <0x10009000 0x1000>;
+   clocks = <&clks 35>;
+   status = "disabled";
+   };
+
uart1: serial@1000a000 {
compatible = "fsl,imx27-uart", "fsl,imx21-uart";
reg = <0x1000a000 0x1000>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v3 4/5] ARM: dts: imx27 cpufreq-cpu0 frequencies

2013-06-28 Thread Markus Pargmann
Set operating-points for imx27. There is no regulator support, so the
voltages are 0. The frequencies should be the same for all imx27 boards,
so it is defined here and can be overwritten if necessary.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v2:
 - Update compatibility list of cpu node
 - Simplify cpu node

 arch/arm/boot/dts/imx27.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index a79f173..9617d6c 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -47,6 +47,24 @@
};
};
 
+   cpus {
+   #size-cells = <0>;
+   #address-cells = <1>;
+
+   cpu {
+   device_type = "cpu";
+   compatible = "arm,arm926ej-s";
+   operating-points = <
+   /* kHz  uV (No regulator support) */
+   133000  0
+   399000  0
+   >;
+   clock-latency = <61036>; /* two CLK32 periods */
+   clocks = <&clks 18>;
+   clock-names = "cpu";
+   };
+   };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v3 2/5] ARM: dts: imx27: Add imx framebuffer device

2013-06-28 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 8603886..10dcbd3 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -342,6 +342,15 @@
reg = <0x1002 0x2>;
ranges;
 
+   imxfb: fb@10021000 {
+   compatible = "fsl,imx27-fb", "fsl,imx21-fb";
+   interrupts = <61>;
+   reg = <0x10021000 0x1000>;
+   clocks = <&clks 36>, <&clks 65>, <&clks 59>;
+   clock-names = "ipg", "ahb", "per";
+   status = "disabled";
+   };
+
coda: coda@10023000 {
compatible = "fsl,imx27-vpu";
reg = <0x10023000 0x0200>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v2 3/5] ARM: dts: imx27: Add 1-wire

2013-06-23 Thread Markus Pargmann
On Sun, Jun 23, 2013 at 12:54:34PM +0400, Alexander Shiyan wrote:
> > Signed-off-by: Markus Pargmann 
> > ---
> ...
> > +   owire: owire@10009000 {
> > +   compatible = "fsl,imx27-owire", 
> > "fsl,imx21-owire";
> > +   reg = <0x10009000 0x1000>;
> > +   clocks = <&clks 35>;
> > +   clock-names = "ipg";
> 
> Clock name can be discarded here.

Thanks, I fixed both, owire and memory offset.

Regards,

Markus

> 
> > +   status = "disabled";
> > +   };
> > +
> 
> 
> ---

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH] ARM: imx27: Fix documentation for SPLL clock

2013-06-23 Thread Markus Pargmann
spll_gate was added with commit b7eed2076183994dbda2c19bc7fba99b65a135e3
"ARM: imx27: add a clock gate to activate SPLL clock".

spll_gate is missing in the devicetree clock documentation for imx27. This
patch adds it to the list of clocks in the documentation.

Signed-off-by: Markus Pargmann 
---
 Documentation/devicetree/bindings/clock/imx27-clock.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/clock/imx27-clock.txt 
b/Documentation/devicetree/bindings/clock/imx27-clock.txt
index ab1a56e..7a20703 100644
--- a/Documentation/devicetree/bindings/clock/imx27-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx27-clock.txt
@@ -98,6 +98,7 @@ clocks and IDs.
fpm  83
mpll_osc_sel 84
mpll_sel 85
+   spll_gate86
 
 Examples:
 
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 1/5] ARM: imx27: Use 'AITC' for the interrupt controller name

2013-06-23 Thread Markus Pargmann
From: Fabio Estevam 

On the MX27 Reference Manual the interrupt controller is named AITC:
ARM926EJ-S Interrupt Controller

So use the AITC term instead of AVIC.

Signed-off-by: Fabio Estevam 
Origin: id:1334193132-18944-2-git-send-email-feste...@gmail.com
Signed-off-by: Uwe Kleine-König 
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 0695264..8603886 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -30,8 +30,8 @@
spi2 = &cspi3;
};
 
-   avic: avic-interrupt-controller@e000 {
-   compatible = "fsl,imx27-avic", "fsl,avic";
+   aitc: aitc-interrupt-controller@e000 {
+   compatible = "fsl,imx27-aitc", "fsl,avic";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x1004 0x1000>;
@@ -51,7 +51,7 @@
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
-   interrupt-parent = <&avic>;
+   interrupt-parent = <&aitc>;
ranges;
 
aipi@1000 { /* AIPI1 */
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 0/5] ARM: dts: imx27 Phytec PhyCARD-S

2013-06-23 Thread Markus Pargmann
Hi,

This series adds some device nodes for imx27 and board files for Phytec
PhyCARD-S SOM and RDK. It is based on shawn's branch "imx/dt".

Regards,

Markus

Changes in v2:
 - Removed already accepted clocks patch
   "ARM: mx27: Replace clk_register_clkdev with clock DT lookup"
 - pca100 board file was splitted into two parts SOM and RDK
 - other changes described in patch notes

Fabio Estevam (1):
  ARM: imx27: Use 'AITC' for the interrupt controller name

Markus Pargmann (4):
  ARM: dts: imx27: Add imx framebuffer device
  ARM: dts: imx27: Add 1-wire
  ARM: dts: imx27 cpufreq-cpu0 frequencies
  ARM: dts: Add device tree support for phycard pca100

 arch/arm/boot/dts/Makefile   |  2 +
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 62 
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 72 
 arch/arm/boot/dts/imx27.dtsi | 41 +-
 4 files changed, 174 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 3/5] ARM: dts: imx27: Add 1-wire

2013-06-23 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v2:
 - Add fsl,imx27-owire as first entry in the compatibility list.

 arch/arm/boot/dts/imx27.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 10dcbd3..c6a78ba 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -110,6 +110,14 @@
clock-names = "ipg", "per";
};
 
+   owire: owire@10009000 {
+   compatible = "fsl,imx27-owire", 
"fsl,imx21-owire";
+   reg = <0x10009000 0x1000>;
+   clocks = <&clks 35>;
+   clock-names = "ipg";
+   status = "disabled";
+   };
+
uart1: serial@1000a000 {
compatible = "fsl,imx27-uart", "fsl,imx21-uart";
reg = <0x1000a000 0x1000>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 4/5] ARM: dts: imx27 cpufreq-cpu0 frequencies

2013-06-23 Thread Markus Pargmann
Set operating-points for imx27. There is no regulator support, so the
voltages are 0. The frequencies should be the same for all imx27 boards,
so it is defined here and can be overwritten if necessary.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v2:
 - Update compatibility list of cpu node
 - Simplify cpu node

 arch/arm/boot/dts/imx27.dtsi | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index c6a78ba..377b026 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -47,6 +47,24 @@
};
};
 
+   cpus {
+   #size-cells = <0>;
+   #address-cells = <1>;
+
+   cpu {
+   device_type = "cpu";
+   compatible = "arm,arm926ej-s";
+   operating-points = <
+   /* kHz  uV (No regulator support) */
+   133000  0
+   399000  0
+   >;
+   clock-latency = <61036>; /* two CLK32 periods */
+   clocks = <&clks 18>;
+   clock-names = "cpu";
+   };
+   };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 2/5] ARM: dts: imx27: Add imx framebuffer device

2013-06-23 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 8603886..10dcbd3 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -342,6 +342,15 @@
reg = <0x1002 0x2>;
ranges;
 
+   imxfb: fb@10021000 {
+   compatible = "fsl,imx27-fb", "fsl,imx21-fb";
+   interrupts = <61>;
+   reg = <0x10021000 0x1000>;
+   clocks = <&clks 36>, <&clks 65>, <&clks 59>;
+   clock-names = "ipg", "ahb", "per";
+   status = "disabled";
+   };
+
coda: coda@10023000 {
compatible = "fsl,imx27-vpu";
reg = <0x10023000 0x0200>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v2 5/5] ARM: dts: Add device tree support for phycard pca100

2013-06-23 Thread Markus Pargmann
Board files for Phytec PhyCARD-S "System on Module" and "Rapid
Development Kit".

Based on patches from:

Steffen Trumtrar :
 - Original patch
 - ARM: dts: Set partition offsets for phycard
 - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
 - ARM: imx27-phytec-phycard-S.dts: resize nand partitions

Jan Luebbe :
 - ARM: dts: Enable bad block table in NAND

Cc: Steffen Trumtrar 
Cc: Jan Luebbe 
Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v2:
 - Remove unnecessary Kconfig nand selection.
 - Style fixes
 - Replace node identifiers with node labels
 - Fix compatibility of cpu node
 - Remove device node for not mainlined dimmer driver
 - Remove nand partition table
 - Remove memory node
 - Splitted board file into "system on module" and "rapid development kit"

 arch/arm/boot/dts/Makefile   |  2 +
 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 62 
 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts | 72 
 3 files changed, 136 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b3a8661..707c192 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -105,6 +105,8 @@ dtb-$(CONFIG_ARCH_MXC) += \
imx27-pdk.dtb \
imx27-phytec-phycore-som.dtb \
imx27-phytec-phycore-rdk.dtb \
+   imx27-phytec-phycard-s-som.dtb \
+   imx27-phytec-phycard-s-rdk.dtb \
imx31-bug.dtb \
imx51-apf51.dtb \
imx51-apf51dev.dtb \
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
new file mode 100644
index 000..bf11429
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2012 Markus Pargmann, Pengutronix
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include "imx27-phytec-phycard-s-som.dts"
+
+/ {
+   model = "Phytec pca100 rapid development kit";
+   compatible = "phytec,imx27-pca100-rdk", "phytec,imx27-pca100", 
"fsl,imx27";
+
+   display: display {
+   model = "Primeview-PD050VL1";
+   native-mode = <&timing0>;
+   bits-per-pixel = <16>;  /* non-standard but required */
+   fsl,pcr = <0xf0c88080>; /* non-standard but required */
+   display-timings {
+   timing0: 640x480 {
+   hactive = <640>;
+   vactive = <480>;
+   hback-porch = <112>;
+   hfront-porch = <36>;
+   hsync-len = <32>;
+   vback-porch = <33>;
+   vfront-porch = <33>;
+   vsync-len = <2>;
+   clock-frequency = <2500>;
+   };
+   };
+   };
+};
+
+&imxfb {
+   display = <&display>;
+   status = "okay";
+};
+
+&sdhci2 {
+   cd-gpios = <&gpio3 29 0>;
+   status = "okay";
+};
+
+&uart1 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
+
+&uart2 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
+
+&uart3 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
new file mode 100644
index 000..6b2b8ad4
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-s-som.dts
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2012 Sascha Hauer, Uwe Kleine-König, Steffen Trumtrar
+ * and Markus Pargmann, Pengutronix
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+#include "imx27.dtsi"
+
+/ {
+   model = "Phytec pca100";
+   compatible = "phytec,imx27-pca100", "fsl,imx27";
+
+   memory {
+   reg = <0x0 0x0800>; /* 128MB */
+   };
+};
+
+&cspi1 {
+   fsl,spi-num-chipselects = <2>;
+   cs-gpios = <&gpio4 28 0>,
+   

Re: [PATCH 5/6] ARM: dts: imx27 cpufreq-cpu0 frequencies

2013-06-23 Thread Markus Pargmann
On Fri, Jun 21, 2013 at 09:47:40AM +0100, Lorenzo Pieralisi wrote:
> On Fri, Jun 21, 2013 at 06:23:46AM +0100, Shawn Guo wrote:
> > On Fri, Jun 21, 2013 at 08:54:53AM +0400, Alexander Shiyan wrote:
> > > > On Thu, Jun 20, 2013 at 04:50:14PM +0200, Markus Pargmann wrote:
> > > > > + cpus {
> > > > > + #size-cells = <0>;
> > > > > + #address-cells = <1>;
> > > > > +
> > > > > + cpu@0 {
> > > > > + device_type = "cpu";
> > > > > + compatible = "fsl,imx27", "arm,arm926ejs";
> > > > 
> > > > From what Documentation/devicetree/bindings/arm/cpus.txt tells, it
> > > > should be "arm,arm926".  Also, why do you put "fsl,imx27" there?
> > > > "imx27" is a SoC name not cpu core.
> > > 
> > > I think Markus take this ARM property from one of existing DTS.
> > > 
> > > shc@shc /home/git/linux-mx27/arch/arm/boot/dts $ grep arm926 *.dtsi
> > > at91sam9260.dtsi:   compatible = "arm,arm926ejs";
> > > at91sam9263.dtsi:   compatible = "arm,arm926ejs";
> > > at91sam9g45.dtsi:   compatible = "arm,arm926ejs";
> > > at91sam9n12.dtsi:   compatible = "arm,arm926ejs";
> > > at91sam9x5.dtsi:compatible = "arm,arm926ejs";
> > > imx23.dtsi: compatible = "arm,arm926ejs";
> > > imx28.dtsi: compatible = "arm,arm926ejs";
> > > lpc32xx.dtsi:   compatible = "arm,arm926ejs";
> > > s3c2416.dtsi:   compatible = "arm,arm926ejs";
> > > spear3xx.dtsi:  compatible = "arm,arm926ejs";
> > > spear600.dtsi:  compatible = "arm,arm926ejs";
> > > wm8505.dtsi:compatible = "arm,arm926ejs";
> > > 
> > > So, documentation need to be updated or these values should be fixed.
> > > Another solution  is specify compatible string as:
> > > compatible = "arm,arm926ejs", "arm,arm926";
> > > What you think about this?
> > 
> > I assume that the compatible string in the binding doc has been reviewed
> > and agreed by people, so we should fix the existing users before kernel
> > starts using it to for matching something.
> > 
> > Lorenzo, comment?
> 
> I patched them all and changes are queued through arm-soc, according to the
> latest bindings that should get merged this cycle and are available here:
> 
> git://linux-arm.org/linux-2.6-lp.git dt-cpus-bindings
> 
> If you are queuing dts updates please follow rules in there, waiting for
> that document to get merged.
> 
> Lorenzo
> 

Okay, I changed it to "arm,arm926ej-s" and removed "reg" as described in
the dt-cpus-bindings branch documentation.

Thanks,

Markus

> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH 6/6] ARM: dts: Add device tree support for phycard pca100

2013-06-23 Thread Markus Pargmann
On Fri, Jun 21, 2013 at 11:46:05AM +0800, Shawn Guo wrote:
> On Thu, Jun 20, 2013 at 04:50:15PM +0200, Markus Pargmann wrote:
> > Based on patches from:
> > 
> > Steffen Trumtrar :
> >  - Original patch
> >  - ARM: dts: Set partition offsets for phycard
> >  - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
> >  - ARM: imx27-phytec-phycard-S.dts: resize nand partitions
> > 
> > Jan Luebbe :
> >  - ARM: dts: Enable bad block table in NAND
> > 
> > Cc: Steffen Trumtrar 
> > Cc: Jan Luebbe 
> > Signed-off-by: Markus Pargmann 
> > ---
> >  arch/arm/boot/dts/Makefile   |   1 +
> >  arch/arm/boot/dts/imx27-phytec-phycard-S.dts | 195 
> > +++
> >  arch/arm/mach-imx/Kconfig|   1 +
> >  3 files changed, 197 insertions(+)
> >  create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> > 
> > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> > index b3a8661..e8fb0bc 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -105,6 +105,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
> > imx27-pdk.dtb \
> > imx27-phytec-phycore-som.dtb \
> > imx27-phytec-phycore-rdk.dtb \
> > +   imx27-phytec-phycard-S.dtb \
> > imx31-bug.dtb \
> > imx51-apf51.dtb \
> > imx51-apf51dev.dtb \
> > diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-S.dts 
> > b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> > new file mode 100644
> > index 000..dc3a93b
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> > @@ -0,0 +1,195 @@
> > +/*
> > + * Copyright 2012 Sascha Hauer, Uwe Kleine-König and Steffen Trumtrar, 
> > Pengutronix
> > + *
> > + * The code contained herein is licensed under the GNU General Public
> > + * License. You may obtain a copy of the GNU General Public License
> > + * Version 2 or later at the following locations:
> > + *
> > + * http://www.opensource.org/licenses/gpl-license.html
> > + * http://www.gnu.org/copyleft/gpl.html
> > + */
> > +
> > +/dts-v1/;
> > +#include "imx27.dtsi"
> > +
> > +/ {
> > +   model = "Phytec pca100";
> > +   compatible = "phytec,imx27-pca100", "fsl,imx27";
> > +
> > +   memory {
> > +   device_type = "memory";
> 
> It's been covered by skeleton.dtsi.
> 
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> 
> They are only needed if there are child nodes with "reg" property.

Removed

> 
> > +   reg = <0x0 0x0800>;   // 128MB
> > +   };
> > +
> > +   soc {
> > +   aipi@1000 { /* aipi */
> > +   wdog@10002000 {
> > +   status = "okay";
> > +   };
> 
> We now use node label in board dts files to refer to the nodes defined
> in soc dts.

I replaced all node identifiers with their labels.

> 
> > +
> > +   owire@10009000 {
> > +   status = "okay";
> > +   };
> > +
> > +   serial@1000a000 {
> > +   fsl,uart-has-rtscts;
> > +   status = "okay";
> > +   };
> > +
> > +   serial@1000b000 {
> > +   fsl,uart-has-rtscts;
> > +   status = "okay";
> > +   };
> > +
> > +   serial@1000c000 {
> > +   fsl,uart-has-rtscts;
> > +   status = "okay";
> > +   };
> > +
> > +   cspi@1000e000 {
> > +   fsl,spi-num-chipselects = <2>;
> > +   cs-gpios = <&gpio4 28 0>,
> > +   <&gpio4 27 0>;
> > +   status = "okay";
> > +   };
> > +
> > +   i2c@10012000 {
> > +   status = "okay";
> > +   ioexpander@41 {
> > +   compatible = "nxp,pca9536";
> > +   reg = <0x41>;
> > +   };
> 
> Please put b

Re: [PATCH 6/6] ARM: dts: Add device tree support for phycard pca100

2013-06-20 Thread Markus Pargmann
On Thu, Jun 20, 2013 at 07:21:10PM +0400, Alexander Shiyan wrote:
> > Based on patches from:
> > 
> > Steffen Trumtrar :
> >  - Original patch
> >  - ARM: dts: Set partition offsets for phycard
> >  - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
> >  - ARM: imx27-phytec-phycard-S.dts: resize nand partitions
> > 
> > Jan Luebbe :
> >  - ARM: dts: Enable bad block table in NAND
> > 
> > Cc: Steffen Trumtrar 
> > Cc: Jan Luebbe 
> > Signed-off-by: Markus Pargmann 
> ...
> > +   gpio@10015000 {
> > +   status = "okay";
> > +   };
> > +
> > +   gpio@10015100 {
> > +   status = "okay";
> > +   };
> > +
> > +   gpio@10015200 {
> > +   status = "okay";
> > +   };
> > +
> > +   gpio@10015300 {
> > +   status = "okay";
> > +   };
> > +
> > +   gpio@10015400 {
> > +   status = "okay";
> > +   };
> > +
> > +   gpio@10015500 {
> > +   status = "okay";
> > +   };
> 
> No need setup status for devices which not disabled in imx27.dts

Thanks, I removed all unnecessary nodes, gpio and wdog.

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH 4/6] ARM: dts: imx27: Add 1-wire

2013-06-20 Thread Markus Pargmann
On Thu, Jun 20, 2013 at 07:17:34PM +0400, Alexander Shiyan wrote:
> > Signed-off-by: Markus Pargmann 
> > ---
> >  arch/arm/boot/dts/imx27.dtsi | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
> > index 044004a..e883e77 100644
> > --- a/arch/arm/boot/dts/imx27.dtsi
> > +++ b/arch/arm/boot/dts/imx27.dtsi
> > @@ -110,6 +110,14 @@
> > clock-names = "ipg", "per";
> > };
> >  
> > +   owire: owire@10009000 {
> > +   compatible = "fsl,imx21-owire";
> 
> I think you should use "fsl,imx27-owire", "fsl,imx21-owire" here.

Fixed, thank you

Markus

> 
> > +   reg = <0x10009000 0x1000>;
> > +   clocks = <&clks 35>;
> > +   clock-names = "ipg";
> > +   status = "disabled";
> > +   };
> > +
> > uart1: serial@1000a000 {
> > compatible = "fsl,imx27-uart", "fsl,imx21-uart";
> > reg = <0x1000a000 0x1000>;
> > -- 
> 
> 
> ---

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH 1/6] ARM: mx27: Replace clk_register_clkdev with clock DT lookup

2013-06-20 Thread Markus Pargmann
On Thu, Jun 20, 2013 at 12:35:10PM -0300, Fabio Estevam wrote:
> On Thu, Jun 20, 2013 at 12:28 PM, Alexander Shiyan  wrote:
> >> From: Fabio Estevam 
> >>
> >> Similarly as it was done for mx6q, use a DT lookup in order to make 
> >> maintainance
> >> task for the clock devices easier.
> >>
> >> Signed-off-by: Fabio Estevam 
> >> [Markus Pargmann: Add gpio clocks]
> >> Signed-off-by: Markus Pargmann 
> >> ---
> >>  arch/arm/boot/dts/imx27.dtsi | 12 
> >>  1 file changed, 12 insertions(+)
> >>
> >> diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
> >> index 0695264..48c263c 100644
> >> --- a/arch/arm/boot/dts/imx27.dtsi
> >> +++ b/arch/arm/boot/dts/imx27.dtsi
> >> @@ -208,6 +208,8 @@
> >>   #gpio-cells = <2>;
> >>   interrupt-controller;
> >>   #interrupt-cells = <2>;
> >> + clocks = <&clks 47>;
> >> + clock-names = "ipg";
> >
> > Clock is not used in the gpio driver, so I doubt the usefulness of this 
> > patch.
> 
> I think you meant "this hunk", right?
> 
> My original patch did not have this part. It was added by Markus as
> mentioned in the commit log, and I agree we should go with the
> original version that did not add the gpio clock.

I somehow missed that your patch was applied in march. gpio clocks are
not mentioned in the binding documentation, so I drop this one
completely.

Thanks,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH 6/6] ARM: dts: Add device tree support for phycard pca100

2013-06-20 Thread Markus Pargmann
On Thu, Jun 20, 2013 at 04:50:15PM +0200, Markus Pargmann wrote:
> Based on patches from:
> 
> Steffen Trumtrar :
>  - Original patch
>  - ARM: dts: Set partition offsets for phycard
>  - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
>  - ARM: imx27-phytec-phycard-S.dts: resize nand partitions
> 
> Jan Luebbe :
>  - ARM: dts: Enable bad block table in NAND
> 
> Cc: Steffen Trumtrar 
> Cc: Jan Luebbe 
> Signed-off-by: Markus Pargmann 
> ---
>  arch/arm/boot/dts/Makefile   |   1 +
>  arch/arm/boot/dts/imx27-phytec-phycard-S.dts | 195 
> +++
>  arch/arm/mach-imx/Kconfig|   1 +
>  3 files changed, 197 insertions(+)
>  create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index b3a8661..e8fb0bc 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -105,6 +105,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
>   imx27-pdk.dtb \
>   imx27-phytec-phycore-som.dtb \
>   imx27-phytec-phycore-rdk.dtb \
> + imx27-phytec-phycard-S.dtb \
>   imx31-bug.dtb \
>   imx51-apf51.dtb \
>   imx51-apf51dev.dtb \
> diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-S.dts 
> b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> new file mode 100644
> index 000..dc3a93b
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
> @@ -0,0 +1,195 @@
> +/*
> + * Copyright 2012 Sascha Hauer, Uwe Kleine-König and Steffen Trumtrar, 
> Pengutronix
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +/dts-v1/;
> +#include "imx27.dtsi"
> +
> +/ {
> + model = "Phytec pca100";
> + compatible = "phytec,imx27-pca100", "fsl,imx27";
> +
> + memory {
> + device_type = "memory";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0x0 0x0800>;   // 128MB
> + };
> +
> + soc {
> + aipi@1000 { /* aipi */
> + wdog@10002000 {
> + status = "okay";
> + };
> +
> + owire@10009000 {
> + status = "okay";
> + };
> +
> + serial@1000a000 {
> + fsl,uart-has-rtscts;
> + status = "okay";
> + };
> +
> + serial@1000b000 {
> + fsl,uart-has-rtscts;
> + status = "okay";
> + };
> +
> + serial@1000c000 {
> + fsl,uart-has-rtscts;
> + status = "okay";
> + };
> +
> + cspi@1000e000 {
> + fsl,spi-num-chipselects = <2>;
> + cs-gpios = <&gpio4 28 0>,
> + <&gpio4 27 0>;
> + status = "okay";
> + };
> +
> + i2c@10012000 {
> + status = "okay";
> + ioexpander@41 {
> + compatible = "nxp,pca9536";
> + reg = <0x41>;
> + };
> + rtc@51 {
> + compatible = "nxp,pcf8563";
> + reg = <0x51>;
> + };
> + dimmer@60 {
> + compatible = "nxp,pca9530";
> + reg = <0x60>;
> + pwm = <1 1>;
> + psc = <1 1>;
> + leds = <&led0 &led1>;
> + led0: led0 {
> + label = "pba-lcd_brightness";
> + default-state = "off";
> 

[PATCH 6/6] ARM: dts: Add device tree support for phycard pca100

2013-06-20 Thread Markus Pargmann
Based on patches from:

Steffen Trumtrar :
 - Original patch
 - ARM: dts: Set partition offsets for phycard
 - ARM: dts: Use CSPI1 instead of CSPI2 on phycard pca100
 - ARM: imx27-phytec-phycard-S.dts: resize nand partitions

Jan Luebbe :
 - ARM: dts: Enable bad block table in NAND

Cc: Steffen Trumtrar 
Cc: Jan Luebbe 
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/Makefile   |   1 +
 arch/arm/boot/dts/imx27-phytec-phycard-S.dts | 195 +++
 arch/arm/mach-imx/Kconfig|   1 +
 3 files changed, 197 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-S.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index b3a8661..e8fb0bc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -105,6 +105,7 @@ dtb-$(CONFIG_ARCH_MXC) += \
imx27-pdk.dtb \
imx27-phytec-phycore-som.dtb \
imx27-phytec-phycore-rdk.dtb \
+   imx27-phytec-phycard-S.dtb \
imx31-bug.dtb \
imx51-apf51.dtb \
imx51-apf51dev.dtb \
diff --git a/arch/arm/boot/dts/imx27-phytec-phycard-S.dts 
b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
new file mode 100644
index 000..dc3a93b
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycard-S.dts
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2012 Sascha Hauer, Uwe Kleine-König and Steffen Trumtrar, 
Pengutronix
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+#include "imx27.dtsi"
+
+/ {
+   model = "Phytec pca100";
+   compatible = "phytec,imx27-pca100", "fsl,imx27";
+
+   memory {
+   device_type = "memory";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   reg = <0x0 0x0800>;   // 128MB
+   };
+
+   soc {
+   aipi@1000 { /* aipi */
+   wdog@10002000 {
+   status = "okay";
+   };
+
+   owire@10009000 {
+   status = "okay";
+   };
+
+   serial@1000a000 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+   };
+
+   serial@1000b000 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+   };
+
+   serial@1000c000 {
+   fsl,uart-has-rtscts;
+   status = "okay";
+   };
+
+   cspi@1000e000 {
+   fsl,spi-num-chipselects = <2>;
+   cs-gpios = <&gpio4 28 0>,
+   <&gpio4 27 0>;
+   status = "okay";
+   };
+
+   i2c@10012000 {
+   status = "okay";
+   ioexpander@41 {
+   compatible = "nxp,pca9536";
+   reg = <0x41>;
+   };
+   rtc@51 {
+   compatible = "nxp,pcf8563";
+   reg = <0x51>;
+   };
+   dimmer@60 {
+   compatible = "nxp,pca9530";
+   reg = <0x60>;
+   pwm = <1 1>;
+   psc = <1 1>;
+   leds = <&led0 &led1>;
+   led0: led0 {
+   label = "pba-lcd_brightness";
+   default-state = "off";
+   type = "led";
+   };
+   led1: led1 {
+   label = "pba-free_use";
+   default-state = "off";
+   type = "led";
+   };
+   };
+   };
+
+   sdhci@1001

[PATCH 1/6] ARM: mx27: Replace clk_register_clkdev with clock DT lookup

2013-06-20 Thread Markus Pargmann
From: Fabio Estevam 

Similarly as it was done for mx6q, use a DT lookup in order to make maintainance
task for the clock devices easier.

Signed-off-by: Fabio Estevam 
[Markus Pargmann: Add gpio clocks]
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 0695264..48c263c 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -208,6 +208,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
gpio2: gpio@10015100 {
@@ -218,6 +220,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
gpio3: gpio@10015200 {
@@ -228,6 +232,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
gpio4: gpio@10015300 {
@@ -238,6 +244,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
gpio5: gpio@10015400 {
@@ -248,6 +256,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
gpio6: gpio@10015500 {
@@ -258,6 +268,8 @@
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
+   clocks = <&clks 47>;
+   clock-names = "ipg";
};
 
cspi3: cspi@10017000 {
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 4/6] ARM: dts: imx27: Add 1-wire

2013-06-20 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 044004a..e883e77 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -110,6 +110,14 @@
clock-names = "ipg", "per";
};
 
+   owire: owire@10009000 {
+   compatible = "fsl,imx21-owire";
+   reg = <0x10009000 0x1000>;
+   clocks = <&clks 35>;
+   clock-names = "ipg";
+   status = "disabled";
+   };
+
uart1: serial@1000a000 {
compatible = "fsl,imx27-uart", "fsl,imx21-uart";
reg = <0x1000a000 0x1000>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 3/6] ARM: dts: imx27: Add imx framebuffer device

2013-06-20 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 4f76453..044004a 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -354,6 +354,15 @@
reg = <0x1002 0x2>;
ranges;
 
+   imxfb: fb@10021000 {
+   compatible = "fsl,imx27-fb", "fsl,imx21-fb";
+   interrupts = <61>;
+   reg = <0x10021000 0x1000>;
+   clocks = <&clks 36>, <&clks 65>, <&clks 59>;
+   clock-names = "ipg", "ahb", "per";
+   status = "disabled";
+   };
+
coda: coda@10023000 {
compatible = "fsl,imx27-vpu";
reg = <0x10023000 0x0200>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 5/6] ARM: dts: imx27 cpufreq-cpu0 frequencies

2013-06-20 Thread Markus Pargmann
Set operating-points for imx27. There is no regulator support, so the
voltages are 0. The frequencies should be the same for all imx27 boards,
so it is defined here and can be overwritten if necessary.

Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index e883e77..3ebd98a 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -47,6 +47,25 @@
};
};
 
+   cpus {
+   #size-cells = <0>;
+   #address-cells = <1>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "fsl,imx27", "arm,arm926ejs";
+   reg = <0>;
+   operating-points = <
+   /* kHz  uV (No regulator support) */
+   133000  0
+   399000  0
+   >;
+   clock-latency = <61036>; /* two CLK32 periods */
+   clocks = <&clks 18>;
+   clock-names = "cpu";
+   };
+   };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 2/6] ARM: imx27: Use 'AITC' for the interrupt controller name

2013-06-20 Thread Markus Pargmann
From: Fabio Estevam 

On the MX27 Reference Manual the interrupt controller is named AITC:
ARM926EJ-S Interrupt Controller

So use the AITC term instead of AVIC.

Signed-off-by: Fabio Estevam 
Origin: id:1334193132-18944-2-git-send-email-feste...@gmail.com
Signed-off-by: Uwe Kleine-König 
Signed-off-by: Markus Pargmann 
---
 arch/arm/boot/dts/imx27.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 48c263c..4f76453 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -30,8 +30,8 @@
spi2 = &cspi3;
};
 
-   avic: avic-interrupt-controller@e000 {
-   compatible = "fsl,imx27-avic", "fsl,avic";
+   aitc: aitc-interrupt-controller@e000 {
+   compatible = "fsl,imx27-aitc", "fsl,avic";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x1004 0x1000>;
@@ -51,7 +51,7 @@
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
-   interrupt-parent = <&avic>;
+   interrupt-parent = <&aitc>;
ranges;
 
aipi@1000 { /* AIPI1 */
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH 0/6] ARM: dts: imx27 Phytec PhyCARD-S

2013-06-20 Thread Markus Pargmann
Hi,

This series adds some device nodes for imx27 and a board file for Phytec
PhyCARD-S. It is based on shawn's branch "imx/dt".

Regards,

Markus


Fabio Estevam (2):
  ARM: mx27: Replace clk_register_clkdev with clock DT lookup
  ARM: imx27: Use 'AITC' for the interrupt controller name

Markus Pargmann (4):
  ARM: dts: imx27: Add imx framebuffer device
  ARM: dts: imx27: Add 1-wire
  ARM: dts: imx27 cpufreq-cpu0 frequencies
  ARM: dts: Add device tree support for phycard pca100

 arch/arm/boot/dts/Makefile   |   1 +
 arch/arm/boot/dts/imx27-phytec-phycard-S.dts | 195 +++
 arch/arm/boot/dts/imx27.dtsi |  54 +++-
 arch/arm/mach-imx/Kconfig|   1 +
 4 files changed, 248 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boot/dts/imx27-phytec-phycard-S.dts

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 07/10] ARM: imx: Export ac97 reset functions

2013-06-20 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---
 arch/arm/mach-imx/mach-pca100.c | 7 +--
 arch/arm/mach-imx/mach-pcm043.c | 7 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb..68badf8 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -208,7 +209,7 @@ static const struct spi_imx_master pca100_spi0_data 
__initconst = {
.num_chipselect = ARRAY_SIZE(pca100_spi_cs),
 };
 
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
gpio_set_value(GPIO_PORTC + 20, 1);
@@ -217,8 +218,9 @@ static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC20_PF_SSI1_FS);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_warm_reset);
 
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);  /* FS */
gpio_set_value(GPIO_PORTC + 20, 0);
@@ -232,6 +234,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC22_PF_SSI1_TXD);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
.ac97_reset = pca100_ac97_cold_reset,
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 8ed533f..4f318ca 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -217,7 +218,7 @@ static iomux_v3_cfg_t pcm043_pads[] = {
 #define SD1_GPIO_WPIMX_GPIO_NR(2, 23)
 #define SD1_GPIO_CDIMX_GPIO_NR(2, 24)
 
-static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -239,8 +240,9 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
gpio_free(AC97_GPIO_TXFS);
mxc_iomux_v3_setup_pad(txfs);
 }
+EXPORT_SYMBOL(pcm043_ac97_warm_reset);
 
-static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -286,6 +288,7 @@ err1:
printk("%s failed with %d\n", __func__, ret);
mdelay(1);
 }
+EXPORT_SYMBOL(pcm043_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
.ac97_reset = pcm043_ac97_cold_reset,
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 02/10] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-06-20 Thread Markus Pargmann
Cleaner parameter passing for imx-pcm-fiq. Create a seperated fiq-params
struct to pass all arguments.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v9:
 - Remove semicolon in function

Changes in v7:
 - Fix init function signature for !CONFIG_SND_SOC_IMX_PCM_FIQ

Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, the imx_pcm_fiq_params are 
now
   passed as function arguments instead of platform driver data.

Changes in v3:
 - Using snd_dmaengine_dai_dma_data for dma_params after rebasing onto
   dmaengine cleanups.

 sound/soc/fsl/imx-pcm-fiq.c | 18 ++
 sound/soc/fsl/imx-pcm.h | 15 +--
 sound/soc/fsl/imx-ssi.c |  7 ++-
 sound/soc/fsl/imx-ssi.h |  1 +
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 310d902..3b2ba99 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 
 #include "imx-ssi.h"
+#include "imx-pcm.h"
 
 struct imx_pcm_runtime_data {
unsigned int period;
@@ -366,9 +368,9 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq 
= {
.pcm_free   = imx_pcm_fiq_free,
 };
 
-int imx_pcm_fiq_init(struct platform_device *pdev)
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params)
 {
-   struct imx_ssi *ssi = platform_get_drvdata(pdev);
int ret;
 
ret = claim_fiq(&fh);
@@ -377,15 +379,15 @@ int imx_pcm_fiq_init(struct platform_device *pdev)
return ret;
}
 
-   mxc_set_irq_fiq(ssi->irq, 1);
-   ssi_irq = ssi->irq;
+   mxc_set_irq_fiq(params->irq, 1);
+   ssi_irq = params->irq;
 
-   imx_pcm_fiq = ssi->irq;
+   imx_pcm_fiq = params->irq;
 
-   imx_ssi_fiq_base = (unsigned long)ssi->base;
+   imx_ssi_fiq_base = (unsigned long)params->base;
 
-   ssi->dma_params_tx.maxburst = 4;
-   ssi->dma_params_rx.maxburst = 6;
+   params->dma_params_tx->maxburst = 4;
+   params->dma_params_rx->maxburst = 6;
 
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
if (ret)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 67f656c..fd56cad 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -32,6 +32,15 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
dma_data->peripheral_type = IMX_DMATYPE_SSI;
 }
 
+struct imx_pcm_fiq_params {
+   int irq;
+   void __iomem *base;
+
+   /* Pointer to original ssi driver to setup tx rx sizes */
+   struct snd_dmaengine_dai_dma_data *dma_params_rx;
+   struct snd_dmaengine_dai_dma_data *dma_params_tx;
+};
+
 #ifdef CONFIG_SND_SOC_IMX_PCM_DMA
 int imx_pcm_dma_init(struct platform_device *pdev);
 void imx_pcm_dma_exit(struct platform_device *pdev);
@@ -47,10 +56,12 @@ static inline void imx_pcm_dma_exit(struct platform_device 
*pdev)
 #endif
 
 #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
-int imx_pcm_fiq_init(struct platform_device *pdev);
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 void imx_pcm_fiq_exit(struct platform_device *pdev);
 #else
-static inline int imx_pcm_fiq_init(struct platform_device *pdev)
+static inline int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params)
 {
return -ENODEV;
 }
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index a8362be..16ae16d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -590,7 +590,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
 
-   ret = imx_pcm_fiq_init(pdev);
+   ssi->fiq_params.irq = ssi->irq;
+   ssi->fiq_params.base = ssi->base;
+   ssi->fiq_params.dma_params_rx = &ssi->dma_params_rx;
+   ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
+
+   ret = imx_pcm_fiq_init(pdev, &ssi->fiq_params);
if (ret)
goto failed_pcm_fiq;
 
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index d5003ce..fb1616b 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -209,6 +209,7 @@ struct imx_ssi {
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
int enabled;
 };
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 10/10] ASoC: fsl: Update fsl-ssi binding doc

2013-06-20 Thread Markus Pargmann
Update the fsl-ssi bindings. DMA is no required property anymore and
uses the generic DMA bindings. imx-fiq is a new alternative to DMA

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v9:
 - Remove space before tab

Changes in v4:
 - Add a comment about hardware bugs for imx-pcm-fiq

Changes in v3:
 - In previous versions, I removed fsl,playback-dma and capture-dma. But 
they
   are still in use by fsl_dma.c, so I added them again.

 Documentation/devicetree/bindings/sound/fsl,ssi.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
index 5ff76c9..cae80d2 100644
--- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
@@ -43,10 +43,20 @@ Required properties:
 together.  This would still allow different sample sizes,
 but not different sample rates.
 
+Note that either dmas, dma-names or fsl,imx-fiq are required.
+
 Optional properties:
 - codec-handle: Phandle to a 'codec' node that defines an audio
 codec connected to this SSI.  This node is typically
 a child of an I2C or other control node.
+- dmas:Generic dma devicetree binding as described in
+   Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names:   Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
+   is not defined.
+- fsl,imx-fiq: Bool property. Use imx-pcm-fiq instead of imx-pcm-dma.
+   Only necessary for some boards with incompatible
+   codec. imx-pcm-fiq will manually filter some data from
+   the codec. It is a workaround for a hardware bug.
 
 Child 'codec' node required properties:
 - compatible:   Compatible list, contains the name of the codec
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 01/10] ASoC: imx-pcm-dma: DT support

2013-06-20 Thread Markus Pargmann
This patch removes the NO_DT flag. The pdev pointer may have a proper
of_node with the dmas property, so we can use it to request DMA
channels.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, this patch just consists of
   removing the NO_DT flag.

Changes in v5:
 - Use dev.parent pointer to get the of_node.

 sound/soc/fsl/imx-pcm-dma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index fde4d2e..f323ce0 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -64,7 +64,6 @@ int imx_pcm_dma_init(struct platform_device *pdev)
 {
return snd_dmaengine_pcm_register(&pdev->dev, &imx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-   SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT);
 }
 EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 04/10] ASoC: fsl-ssi: Add support for imx-pcm-fiq

2013-06-20 Thread Markus Pargmann
Add support for non-dma pcm for imx platforms with imx-pcm-fiq support.
Instead of imx-pcm-audio, in this case imx-pcm-fiq-audio device is added
and the SIER flags are set differently.

We need imx-pcm-fiq for some boards that use an incompatible codec.
imx-pcm-fiq handles those codecs differently and allows to operate with
them. DMA is not possible because some data sent by the codecs, e.g.
wm9712, is not in the datastream. Also some data is mixed up in the
fifos, so that we need to sort them out manually.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v4:
 - Add a comment about the reason why we add a imx-pcm-fiq device.
 - Change commit message to include information about the usage of 
imx-pcm-fiq

Changes in v3:
 - Rename bool "dma" to "use_dma"

 sound/soc/fsl/fsl_ssi.c | 77 +
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index db55499..2fe4dbd 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -8,6 +8,26 @@
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
  * kind, whether express or implied.
+ *
+ *
+ * Some notes why imx-pcm-fiq is used instead of DMA on some boards:
+ *
+ * The i.MX SSI core has some nasty limitations in AC97 mode. While most
+ * sane processor vendors have a FIFO per AC97 slot, the i.MX has only
+ * one FIFO which combines all valid receive slots. We cannot even select
+ * which slots we want to receive. The WM9712 with which this driver
+ * was developed with always sends GPIO status data in slot 12 which
+ * we receive in our (PCM-) data stream. The only chance we have is to
+ * manually skip this data in the FIQ handler. With sampling rates different
+ * from 48000Hz not every frame has valid receive data, so the ratio
+ * between pcm data and GPIO status data changes. Our FIQ handler is not
+ * able to handle this, hence this driver only works with 48000Hz sampling
+ * rate.
+ * Reading and writing AC97 registers is another challenge. The core
+ * provides us status bits when the read register is updated with *another*
+ * value. When we read the same register two times (and the register still
+ * contains the same value) these status bits are not set. We work
+ * around this by not polling these bits but only wait a fixed delay.
  */
 
 #include 
@@ -121,11 +141,13 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
struct {
unsigned int rfrc;
@@ -355,7 +377,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream 
*substream,
 */
 
/* Enable the interrupts and DMA requests */
-   write_ssi(SIER_FLAGS, &ssi->sier);
+   if (ssi_private->use_dma)
+   write_ssi(SIER_FLAGS, &ssi->sier);
+   else
+   write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
+   CCSR_SSI_SIER_RIE |
+   CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
 
/*
 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -549,7 +576,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 {
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
 
-   if (ssi_private->ssi_on_imx) {
+   if (ssi_private->ssi_on_imx && ssi_private->use_dma) {
dai->playback_dma_data = &ssi_private->dma_params_tx;
dai->capture_dma_data = &ssi_private->dma_params_rx;
}
@@ -702,6 +729,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
   sizeof(fsl_ssi_dai_template));
ssi_private->cpu_dai_drv.name = ssi_private->name;
 
+   ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
+
/* Get the addresses and IRQ */
ret = of_address_to_resource(np, 0, &res);
if (ret) {
@@ -723,12 +752,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
goto error_iomap;
}
 
-   /* The 'name' should not have any slashes in it. */
-   ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
- ssi_private);
-   if (ret < 0) {
-   dev_err(&pdev->dev, "could not claim irq %u\n", 
ssi_private->irq);
-   goto error_irqmap;
+

[PATCH v9 05/10] ASoC: fsl-ssi: Use generic DMA bindings if possible

2013-06-20 Thread Markus Pargmann
There may be some platforms using fsl-ssi that do not have a DMA driver
with generic DMA bindings. So this patch adds support for the generic
DMA bindings, while still accepting the old "fsl,dma-events" property if
"dmas" is not found.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v5:
 - Not passing of_node now, instead setting the parent device

Changes in v4:
 - Change TODO comment to a FIXME, to remove the old dma-events property as 
soon
   as all dma drivers support the generic DMA bindings.

 sound/soc/fsl/fsl_ssi.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2fe4dbd..ed1fbbb 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -803,15 +803,19 @@ static int fsl_ssi_probe(struct platform_device *pdev)
&ssi_private->filter_data_tx;
ssi_private->dma_params_rx.filter_data =
&ssi_private->filter_data_rx;
-   /*
-* TODO: This is a temporary solution and should be changed
-* to use generic DMA binding later when the helplers get in.
-*/
-   ret = of_property_read_u32_array(pdev->dev.of_node,
+   if (!of_property_read_bool(pdev->dev.of_node, "dmas") &&
+   ssi_private->use_dma) {
+   /*
+* FIXME: This is a temporary solution until all
+* necessary dma drivers support the generic dma
+* bindings.
+*/
+   ret = of_property_read_u32_array(pdev->dev.of_node,
"fsl,ssi-dma-events", dma_events, 2);
-   if (ret && !ssi_private->use_dma) {
-   dev_err(&pdev->dev, "could not get dma events\n");
-   goto error_clk;
+   if (ret && ssi_private->use_dma) {
+   dev_err(&pdev->dev, "could not get dma events 
but fsl-ssi is configured to use DMA\n");
+   goto error_clk;
+   }
}
 
shared = of_device_is_compatible(of_get_parent(np),
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 08/10] ASoC: Add phycore-ac97-dt driver

2013-06-20 Thread Markus Pargmann
Add devicetree support for phycore-ac97 driver in a seperated driver for
DT loading. The seperation reduces the confusion with the old style
initialization of this driver via late_initcall. Also this driver is
using fsl-ssi instead of imx-ssi.

platform_of_node and cpu_of_node are set according to the fsl,audmux
phandle.

This patch adds handling of ac97 reset functions according to fsl ac97
support. They are setup from here to avoid board specific code in the
generic fsl-ssi driver.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v9:
 - Fix blank line at end of file.

Changes in v8:
 - Seperate DT capable driver from old phycore-ac97. This eliminates a lot 
of
   build issues and makes the driver easier to read.
 - fsl_ssi may not be built as module if used with ac97 because it defines
   the soc_ac97_ops symbol which is used by the soc ac97 core and codec 
drivers.
   So phycore-ac97-dt actually does not support building as module anymore. 
The
   same issue was existing with imx-ssi and phycore-ac97, which is also 
fixed
   now in this patch.

Changes in v7:
 - Declare empty ac97 reset functions static.
 - Replace complicated machine compatible comparison with
   of_machine_is_compatible
 - Missing snd_soc_unregister_card in imx_phycore_ac97_remove
 - Rename driver

Changes in v6:
 - phycore-ac97 now manages the ac97 reset functions of the boards using
   this combination of ssi-codec.
 - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
   non-DT only and pca100 DT only.

Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

 .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
 sound/soc/fsl/Kconfig  |  16 +-
 sound/soc/fsl/Makefile |   2 +
 sound/soc/fsl/phycore-ac97-dt.c| 242 +
 sound/soc/fsl/phycore-ac97.c   |  13 +-
 5 files changed, 273 insertions(+), 14 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
 create mode 100644 sound/soc/fsl/phycore-ac97-dt.c

diff --git a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
new file mode 100644
index 000..41201ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
@@ -0,0 +1,14 @@
+Phytec phycore AC97
+
+Required properties:
+- compatible: "phytec,phycore-ac97"
+- phytec,ssi: A phandle to the ssi device that is connected to ac97.
+- phytec,audmux: A phandle to the audmux device.
+
+Example:
+
+sound {
+   compatible = "phytec,phycore-ac97";
+   phytec,ssi = <&ssi1>;
+   phytec,audmux = <&audmux>;
+};
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 74ef96e..dafffd1 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -143,8 +143,8 @@ config SND_SOC_MX27VIS_AIC32X4
  board with TLV320AIC32X4 codec.
 
 config SND_SOC_PHYCORE_AC97
-   tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
-   depends on MACH_PCM043 || MACH_PCA100
+   bool "SoC Audio support for Phytec phyCORE boards"
+   depends on MACH_PCM043
select SND_SOC_AC97_BUS
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
@@ -154,6 +154,18 @@ config SND_SOC_PHYCORE_AC97
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
 
+config SND_SOC_PHYCORE_AC97_DT
+   bool "SoC Audio support for Phytec phyCORE (and phyCARD) boards 
(devicetree only)"
+   depends on MACH_PCA100 || MACH_PCM043
+   select SND_SOC_AC97_BUS
+   select SND_SOC_WM9712
+   select SND_SOC_IMX_PCM_FIQ
+   select SND_SOC_IMX_AUDMUX
+   select SND_SOC_FSL_SSI
+   help
+ Say Y if you want to add support for SoC audio on Phytec phyCORE
+ and phyCARD boards in AC97 mode when using devicetree.
+
 config SND_SOC_EUKREA_TLV320
trist

ASoC: fsl-ssi: ac97-slave support

2013-06-20 Thread Markus Pargmann
Hi,

This series adds DT support for phycore-ac97. Beside ac97 support, the series
adds imx-pcm-fiq and generic DMA bindings to fsl-ssi.

Version 9 contains some style fixes.

Regards,

Markus

Changes in v9:
 - Style and compile fixes.
 - Removed "ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97". This patch is
   not necessary with the seperated phycore-ac97-dt driver.

Changes in v8:
 - Fix build issues in phycore-ac97.

Changes in v7:
 - Only one soc_ac97_ops struct for both ssi drivers (fsl-ssi and imx-ssi) to
   make it possible to compile a kernel with both drivers.
 - Other small bug/style fixes described in the changelogs of the patches.

Changes in v6:
 - Rebased onto 3.10-rc3 with Shawn's pcm cleanup patches
 - Setup of reset functions moved to phycore-ac97.c

Changes in v5:
 - Pass of_node via parent device to imx-pcm-dma.

Changes in v4:
 - phycore-ac97 uses the iomux functions based on audmux phandle now.
 - fsl-ssi imx-pcm-fiq got some new comments about problems with imx-ssi and
   incompatible codecs

Changes in v3:
 - Rebased onto pcm dma cleanup patches
 - A lot of cleanups for the fsl-ssi ac97 integration
 - Some small changes which are listed in the notes of the patches.

Markus Pargmann (10):
  ASoC: imx-pcm-dma: DT support
  ASoC: imx-pcm-fiq: Introduce pcm-fiq-params
  ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi
  ASoC: fsl-ssi: Add support for imx-pcm-fiq
  ASoC: fsl-ssi: Use generic DMA bindings if possible
  ASoC: fsl-ssi: imx ac97 support
  ARM: imx: Export ac97 reset functions
  ASoC: Add phycore-ac97-dt driver
  ASoC: fsl: Move fsl-ssi binding doc to sound/
  ASoC: fsl: Update fsl-ssi binding doc

 .../{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt} |  10 +
 .../bindings/sound/phytec,phycore-ac97.txt |  14 +
 arch/arm/mach-imx/mach-pca100.c|   7 +-
 arch/arm/mach-imx/mach-pcm043.c|   7 +-
 sound/soc/fsl/Kconfig  |  17 +-
 sound/soc/fsl/Makefile |   2 +
 sound/soc/fsl/fsl_ssi.c| 451 +
 sound/soc/fsl/fsl_ssi.h|   7 +
 sound/soc/fsl/imx-pcm-dma.c|   1 -
 sound/soc/fsl/imx-pcm-fiq.c|  18 +-
 sound/soc/fsl/imx-pcm.h|  15 +-
 sound/soc/fsl/imx-ssi.c|  14 +-
 sound/soc/fsl/imx-ssi.h|   1 +
 sound/soc/fsl/phycore-ac97-dt.c| 242 +++
 sound/soc/fsl/phycore-ac97.c   |  13 +-
 15 files changed, 704 insertions(+), 115 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (88%)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
 create mode 100644 sound/soc/fsl/phycore-ac97-dt.c

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 06/10] ASoC: fsl-ssi: imx ac97 support

2013-06-20 Thread Markus Pargmann
This patch copies some parts from imx-ssi to support AC97 on
imx27-pca100 and imx35-pcm043. This is a implementation of the
ac97-slave mode.

For ac97, the registers have to be setup earlier than for other ssi
modes because there is some communication with the external device
before actual streaming. So this patch introduces a fsl_ssi_setup
function to setup the registers at different times.

To seperate board specific ac97 reset functions, ac97 read/write
functions are exported. The reset functions are set by other drivers.

This patch was tested with imx27-pca100.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---

Notes:
Changes in v9:
 - Minor style fixes.

Changes in v7:
 - ac97 ops are now assigned to soc_ac97_ops to allow enabled imx-ssi and
   fsl-ssi at the same time.

Changes in v6:
 - ac97 reset functions are not provided by fsl-ssi code anymore. They were
   moved to board specific code like phycore-ac97. Therefore ac97 read/write
   functions are exported and a helper function to set the soc_ac97_ops 
reset
   functions was created.

Changes in v3:
 - Cleanup ac97 code by adding a fsl_ssi_setup function for initial register
   setup. For ac97 the registers have to be setup earlier than in normal
   mode.

 sound/soc/fsl/fsl_ssi.c | 364 ++--
 sound/soc/fsl/fsl_ssi.h |   7 +
 2 files changed, 299 insertions(+), 72 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index ed1fbbb..34cc1c8 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -141,6 +141,7 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool imx_ac97;
bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -320,6 +321,124 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
return ret;
 }
 
+static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
+{
+   struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+   u8 i2s_mode;
+   u8 wm;
+   int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
+
+   if (ssi_private->imx_ac97)
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+   else
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+
+   /*
+* Section 16.5 of the MPC8610 reference manual says that the SSI needs
+* to be disabled before updating the registers we set here.
+*/
+   write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
+
+   /*
+* Program the SSI into I2S Slave Non-Network Synchronous mode. Also
+* enable the transmit and receive FIFO.
+*
+* FIXME: Little-endian samples require a different shift dir
+*/
+   write_ssi_mask(&ssi->scr,
+   CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
+   CCSR_SSI_SCR_TFR_CLK_DIS |
+   i2s_mode |
+   (synchronous ? CCSR_SSI_SCR_SYN : 0));
+
+   write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
+CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
+CCSR_SSI_STCR_TSCKP, &ssi->stcr);
+
+   write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
+CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
+CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
+   /*
+* The DC and PM bits are only used if the SSI is the clock master.
+*/
+
+   /*
+* Set the watermark for transmit FIFI 0 and receive FIFO 0. We don't
+* use FIFO 1. We program the transmit water to signal a DMA transfer
+* if there are only two (or fewer) elements left in the FIFO. Two
+* elements equals one frame (left channel, right channel). This value,
+* however, depends on the depth of the transmit buffer.
+*
+* We set the watermark on the same level as the DMA burstsize.  For
+* fiq it is probably better to use the biggest possible watermark
+* size.
+*/
+   if (ssi_private->use_dma)
+   wm = ssi_private->fifo_depth - 2;
+   else
+   wm = ssi_private->fifo_depth;
+
+   write_ssi(CCSR_SSI_SFCSR_TFWM0(wm) | CCSR_SSI_SFCSR_RFWM0(wm) |
+   CCSR_SSI_SFCSR_TFWM1(wm) | CCSR_SSI_SFCSR_RFWM1(wm),
+   &ssi->sfcsr);
+
+   /*
+* For non-ac97 setups, we keep the SSI disabled because if we enable
+* it, then the DMA controller will start. It's not supposed to start
+* until the SCR.TE (or SCR.RE) bit is set, but it does anyway. The DMA
+* controller will transfer one "BWC" of data (i.e. the amount of data
+* that the MR.BWC bits are set to). The reason this is bad is because
+* at this point, the PCM driver has not finished initializing the DMA
+* controller.
+*/
+

[PATCH v9 03/10] ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi

2013-06-20 Thread Markus Pargmann
fsl_ssi and imx-ssi can be both enabled at the same time. To be able to
add AC97 support to fsl_ssi, soc_ac97_ops have to be available to both
drivers.

fsl_ssi has DT support and should be the only driver at some point in
the future. This patch moves the definition of soc_ac97_ops to fsl_ssi.
imx-ssi copies its own ac97 ops struct into soc_ac97_ops when used in
AC97 mode.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---
 sound/soc/fsl/Kconfig   | 1 +
 sound/soc/fsl/fsl_ssi.c | 8 
 sound/soc/fsl/imx-ssi.c | 7 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 7860cc2..74ef96e 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -107,6 +107,7 @@ if SND_IMX_SOC
 
 config SND_SOC_IMX_SSI
tristate
+   select SND_SOC_FSL_SSI
 
 config SND_SOC_IMX_PCM_FIQ
bool
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2f2d837..db55499 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -587,6 +587,14 @@ static const struct snd_soc_component_driver 
fsl_ssi_component = {
.name   = "fsl-ssi",
 };
 
+/*
+ * FIXME: As soon as all boards using imx-ssi AC97 mode are able to use
+ * fsl-ssi, soc_ac97_ops can be used exclusively in this driver without copying
+ * the struct. AC97 support can then be removed from imx-ssi.
+ */
+struct snd_ac97_bus_ops soc_ac97_ops;
+EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
 /* Show the statistics of a flag only if its interrupt is enabled.  The
  * compiler will optimze this code to a no-op if the interrupt is not
  * enabled.
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 16ae16d..3760220 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -501,13 +501,14 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
imx_ssi_ac97_read(ac97, 0);
 }
 
-struct snd_ac97_bus_ops soc_ac97_ops = {
+static struct snd_ac97_bus_ops imx_ssi_soc_ac97_ops = {
.read   = imx_ssi_ac97_read,
.write  = imx_ssi_ac97_write,
.reset  = imx_ssi_ac97_reset,
.warm_reset = imx_ssi_ac97_warm_reset
 };
-EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
+extern struct snd_ac97_bus_ops soc_ac97_ops;
 
 static int imx_ssi_probe(struct platform_device *pdev)
 {
@@ -547,6 +548,8 @@ static int imx_ssi_probe(struct platform_device *pdev)
}
 
if (ssi->flags & IMX_SSI_USE_AC97) {
+   memcpy(&soc_ac97_ops, &imx_ssi_soc_ac97_ops,
+   sizeof(soc_ac97_ops));
if (ac97_ssi) {
dev_err(&pdev->dev, "AC'97 SSI already registered\n");
ret = -EBUSY;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v9 09/10] ASoC: fsl: Move fsl-ssi binding doc to sound/

2013-06-20 Thread Markus Pargmann
fsl-ssi was located in powerpc/fsl/ssi.txt. This is no powerpc specific
device, so it should be moved to sound/ as it connects to differen audio
codecs.

Signed-off-by: Markus Pargmann 
Tested-by: Shawn Guo 
---
 .../devicetree/bindings/{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt}| 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (100%)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
similarity index 100%
rename from Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
rename to Documentation/devicetree/bindings/sound/fsl,ssi.txt
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v8 00/11] ASoC: fsl-ssi: ac97-slave support

2013-06-20 Thread Markus Pargmann
On Mon, Jun 17, 2013 at 10:36:57AM +0800, Shawn Guo wrote:
> On Sun, Jun 16, 2013 at 03:25:06PM +0200, Markus Pargmann wrote:
> > Markus Pargmann (11):
> >   ASoC: imx-pcm-dma: DT support
> >   ASoC: imx-pcm-fiq: Introduce pcm-fiq-params
> >   ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi
> >   ASoC: fsl-ssi: Add support for imx-pcm-fiq
> >   ASoC: fsl-ssi: Use generic DMA bindings if possible
> >   ASoC: fsl-ssi: imx ac97 support
> >   ARM: imx: Export ac97 reset functions
> >   ASoC: Add phycore-ac97-dt driver
> >   ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97
> >   ASoC: fsl: Move fsl-ssi binding doc to sound/
> >   ASoC: fsl: Update fsl-ssi binding doc
> 
> Tested-by: Shawn Guo 
> 
> 

Thank you for testing.

Regards,

Markus
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v8 00/11] ASoC: fsl-ssi: ac97-slave support

2013-06-20 Thread Markus Pargmann
On Sun, Jun 16, 2013 at 11:05:53PM -0500, Timur Tabi wrote:
> Markus Pargmann wrote:
> > Hi,
> >
> > This series adds DT support for phycore-ac97. Beside ac97 support, the 
> > series
> > adds imx-pcm-fiq and generic DMA bindings to fsl-ssi.
> >
> > In version 8 I fixed the build issues by seperating the DT capable ac97 
> > phycore
> > driver from the old driver.
> 
> FYI, I get some warnings applying this patchset:
> 
> Applying: ASoC: Add phycore-ac97-dt driver
> /home/b04825/git/linux.alsa2/.git/rebase-apply/patch:375: new blank line 
> at EOF.
> +
> warning: 1 line adds whitespace errors.
> Applying: ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97
> Applying: ASoC: fsl: Move fsl-ssi binding doc to sound/
> Applying: ASoC: fsl: Update fsl-ssi binding doc
> /home/b04825/git/linux.alsa2/.git/rebase-apply/patch:33: space before tab 
> in indent.
>   Only necessary for some boards with incompatible
> warning: 1 line adds whitespace errors.

Thanks, I fixed all whitespace errors and the compile error.

Regards,

Markus

> 
> -- 
> Timur Tabi
> 
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 08/11] ASoC: Add phycore-ac97-dt driver

2013-06-16 Thread Markus Pargmann
Add devicetree support for phycore-ac97 driver in a seperated driver for
DT loading. The seperation reduces the confusion with the old style
initialization of this driver via late_initcall. Also this driver is
using fsl-ssi instead of imx-ssi.

platform_of_node and cpu_of_node are set according to the fsl,audmux
phandle.

This patch adds handling of ac97 reset functions according to fsl ac97
support. They are setup from here to avoid board specific code in the
generic fsl-ssi driver.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v8:
 - Seperate DT capable driver from old phycore-ac97. This eliminates a lot 
of
   build issues and makes the driver easier to read.
 - fsl_ssi may not be built as module if used with ac97 because it defines
   the soc_ac97_ops symbol which is used by the soc ac97 core and codec 
drivers.
   So phycore-ac97-dt actually does not support building as module anymore. 
The
   same issue was existing with imx-ssi and phycore-ac97, which is also 
fixed
   now in this patch.

Changes in v7:
 - Declare empty ac97 reset functions static.
 - Replace complicated machine compatible comparison with
   of_machine_is_compatible
 - Missing snd_soc_unregister_card in imx_phycore_ac97_remove
 - Rename driver

Changes in v6:
 - phycore-ac97 now manages the ac97 reset functions of the boards using
   this combination of ssi-codec.
 - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
   non-DT only and pca100 DT only.

Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

 .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
 sound/soc/fsl/Kconfig  |  16 +-
 sound/soc/fsl/Makefile |   2 +
 sound/soc/fsl/phycore-ac97-dt.c| 243 +
 sound/soc/fsl/phycore-ac97.c   |  13 +-
 5 files changed, 274 insertions(+), 14 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
 create mode 100644 sound/soc/fsl/phycore-ac97-dt.c

diff --git a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
new file mode 100644
index 000..41201ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
@@ -0,0 +1,14 @@
+Phytec phycore AC97
+
+Required properties:
+- compatible: "phytec,phycore-ac97"
+- phytec,ssi: A phandle to the ssi device that is connected to ac97.
+- phytec,audmux: A phandle to the audmux device.
+
+Example:
+
+sound {
+   compatible = "phytec,phycore-ac97";
+   phytec,ssi = <&ssi1>;
+   phytec,audmux = <&audmux>;
+};
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 74ef96e..dafffd1 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -143,8 +143,8 @@ config SND_SOC_MX27VIS_AIC32X4
  board with TLV320AIC32X4 codec.
 
 config SND_SOC_PHYCORE_AC97
-   tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
-   depends on MACH_PCM043 || MACH_PCA100
+   bool "SoC Audio support for Phytec phyCORE boards"
+   depends on MACH_PCM043
select SND_SOC_AC97_BUS
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
@@ -154,6 +154,18 @@ config SND_SOC_PHYCORE_AC97
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
 
+config SND_SOC_PHYCORE_AC97_DT
+   bool "SoC Audio support for Phytec phyCORE (and phyCARD) boards 
(devicetree only)"
+   depends on MACH_PCA100 || MACH_PCM043
+   select SND_SOC_AC97_BUS
+   select SND_SOC_WM9712
+   select SND_SOC_IMX_PCM_FIQ
+   select SND_SOC_IMX_AUDMUX
+   select SND_SOC_FSL_SSI
+   help
+ Say Y if you want to add support for SoC audio on Phytec phyCORE
+ and phyCARD boards in AC97 mode when using devicetree.
+
 config SND_SOC_EUKREA_TLV320
tristate "Eukrea TLV320"
depends on MACH_EUKREA_MBIMX27_BASEBOARD \
diff 

[PATCH v8 11/11] ASoC: fsl: Update fsl-ssi binding doc

2013-06-16 Thread Markus Pargmann
Update the fsl-ssi bindings. DMA is no required property anymore and
uses the generic DMA bindings. imx-fiq is a new alternative to DMA

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about hardware bugs for imx-pcm-fiq

Changes in v3:
 - In previous versions, I removed fsl,playback-dma and capture-dma. But 
they
   are still in use by fsl_dma.c, so I added them again.

 Documentation/devicetree/bindings/sound/fsl,ssi.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
index 5ff76c9..0375ee0 100644
--- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
@@ -43,10 +43,20 @@ Required properties:
 together.  This would still allow different sample sizes,
 but not different sample rates.
 
+Note that either dmas, dma-names or fsl,imx-fiq are required.
+
 Optional properties:
 - codec-handle: Phandle to a 'codec' node that defines an audio
 codec connected to this SSI.  This node is typically
 a child of an I2C or other control node.
+- dmas:Generic dma devicetree binding as described in
+   Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names:   Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
+   is not defined.
+- fsl,imx-fiq: Bool property. Use imx-pcm-fiq instead of imx-pcm-dma.
+   Only necessary for some boards with incompatible
+   codec. imx-pcm-fiq will manually filter some data from
+   the codec. It is a workaround for a hardware bug.
 
 Child 'codec' node required properties:
 - compatible:   Compatible list, contains the name of the codec
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 04/11] ASoC: fsl-ssi: Add support for imx-pcm-fiq

2013-06-16 Thread Markus Pargmann
Add support for non-dma pcm for imx platforms with imx-pcm-fiq support.
Instead of imx-pcm-audio, in this case imx-pcm-fiq-audio device is added
and the SIER flags are set differently.

We need imx-pcm-fiq for some boards that use an incompatible codec.
imx-pcm-fiq handles those codecs differently and allows to operate with
them. DMA is not possible because some data sent by the codecs, e.g.
wm9712, is not in the datastream. Also some data is mixed up in the
fifos, so that we need to sort them out manually.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about the reason why we add a imx-pcm-fiq device.
 - Change commit message to include information about the usage of 
imx-pcm-fiq

Changes in v3:
 - Rename bool "dma" to "use_dma"

 sound/soc/fsl/fsl_ssi.c | 77 +
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index db55499..2fe4dbd 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -8,6 +8,26 @@
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
  * kind, whether express or implied.
+ *
+ *
+ * Some notes why imx-pcm-fiq is used instead of DMA on some boards:
+ *
+ * The i.MX SSI core has some nasty limitations in AC97 mode. While most
+ * sane processor vendors have a FIFO per AC97 slot, the i.MX has only
+ * one FIFO which combines all valid receive slots. We cannot even select
+ * which slots we want to receive. The WM9712 with which this driver
+ * was developed with always sends GPIO status data in slot 12 which
+ * we receive in our (PCM-) data stream. The only chance we have is to
+ * manually skip this data in the FIQ handler. With sampling rates different
+ * from 48000Hz not every frame has valid receive data, so the ratio
+ * between pcm data and GPIO status data changes. Our FIQ handler is not
+ * able to handle this, hence this driver only works with 48000Hz sampling
+ * rate.
+ * Reading and writing AC97 registers is another challenge. The core
+ * provides us status bits when the read register is updated with *another*
+ * value. When we read the same register two times (and the register still
+ * contains the same value) these status bits are not set. We work
+ * around this by not polling these bits but only wait a fixed delay.
  */
 
 #include 
@@ -121,11 +141,13 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
struct {
unsigned int rfrc;
@@ -355,7 +377,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream 
*substream,
 */
 
/* Enable the interrupts and DMA requests */
-   write_ssi(SIER_FLAGS, &ssi->sier);
+   if (ssi_private->use_dma)
+   write_ssi(SIER_FLAGS, &ssi->sier);
+   else
+   write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
+   CCSR_SSI_SIER_RIE |
+   CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
 
/*
 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -549,7 +576,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 {
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
 
-   if (ssi_private->ssi_on_imx) {
+   if (ssi_private->ssi_on_imx && ssi_private->use_dma) {
dai->playback_dma_data = &ssi_private->dma_params_tx;
dai->capture_dma_data = &ssi_private->dma_params_rx;
}
@@ -702,6 +729,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
   sizeof(fsl_ssi_dai_template));
ssi_private->cpu_dai_drv.name = ssi_private->name;
 
+   ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
+
/* Get the addresses and IRQ */
ret = of_address_to_resource(np, 0, &res);
if (ret) {
@@ -723,12 +752,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
goto error_iomap;
}
 
-   /* The 'name' should not have any slashes in it. */
-   ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
- ssi_private);
-   if (ret < 0) {
-   dev_err(&pdev->dev, "could not claim irq %u\n", 
ssi_private->irq);
-   goto error_irqmap;
+   if (ssi_p

[PATCH v8 03/11] ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi

2013-06-16 Thread Markus Pargmann
fsl_ssi and imx-ssi can be both enabled at the same time. To be able to
add AC97 support to fsl_ssi, soc_ac97_ops have to be available to both
drivers.

fsl_ssi has DT support and should be the only driver at some point in
the future. This patch moves the definition of soc_ac97_ops to fsl_ssi.
imx-ssi copies its own ac97 ops struct into soc_ac97_ops when used in
AC97 mode.

Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig   | 1 +
 sound/soc/fsl/fsl_ssi.c | 8 
 sound/soc/fsl/imx-ssi.c | 7 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 7860cc2..74ef96e 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -107,6 +107,7 @@ if SND_IMX_SOC
 
 config SND_SOC_IMX_SSI
tristate
+   select SND_SOC_FSL_SSI
 
 config SND_SOC_IMX_PCM_FIQ
bool
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2f2d837..db55499 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -587,6 +587,14 @@ static const struct snd_soc_component_driver 
fsl_ssi_component = {
.name   = "fsl-ssi",
 };
 
+/*
+ * FIXME: As soon as all boards using imx-ssi AC97 mode are able to use
+ * fsl-ssi, soc_ac97_ops can be used exclusively in this driver without copying
+ * the struct. AC97 support can then be removed from imx-ssi.
+ */
+struct snd_ac97_bus_ops soc_ac97_ops;
+EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
 /* Show the statistics of a flag only if its interrupt is enabled.  The
  * compiler will optimze this code to a no-op if the interrupt is not
  * enabled.
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 16ae16d..3760220 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -501,13 +501,14 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
imx_ssi_ac97_read(ac97, 0);
 }
 
-struct snd_ac97_bus_ops soc_ac97_ops = {
+static struct snd_ac97_bus_ops imx_ssi_soc_ac97_ops = {
.read   = imx_ssi_ac97_read,
.write  = imx_ssi_ac97_write,
.reset  = imx_ssi_ac97_reset,
.warm_reset = imx_ssi_ac97_warm_reset
 };
-EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
+extern struct snd_ac97_bus_ops soc_ac97_ops;
 
 static int imx_ssi_probe(struct platform_device *pdev)
 {
@@ -547,6 +548,8 @@ static int imx_ssi_probe(struct platform_device *pdev)
}
 
if (ssi->flags & IMX_SSI_USE_AC97) {
+   memcpy(&soc_ac97_ops, &imx_ssi_soc_ac97_ops,
+   sizeof(soc_ac97_ops));
if (ac97_ssi) {
dev_err(&pdev->dev, "AC'97 SSI already registered\n");
ret = -EBUSY;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 05/11] ASoC: fsl-ssi: Use generic DMA bindings if possible

2013-06-16 Thread Markus Pargmann
There may be some platforms using fsl-ssi that do not have a DMA driver
with generic DMA bindings. So this patch adds support for the generic
DMA bindings, while still accepting the old "fsl,dma-events" property if
"dmas" is not found.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v5:
 - Not passing of_node now, instead setting the parent device

Changes in v4:
 - Change TODO comment to a FIXME, to remove the old dma-events property as 
soon
   as all dma drivers support the generic DMA bindings.

 sound/soc/fsl/fsl_ssi.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2fe4dbd..ed1fbbb 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -803,15 +803,19 @@ static int fsl_ssi_probe(struct platform_device *pdev)
&ssi_private->filter_data_tx;
ssi_private->dma_params_rx.filter_data =
&ssi_private->filter_data_rx;
-   /*
-* TODO: This is a temporary solution and should be changed
-* to use generic DMA binding later when the helplers get in.
-*/
-   ret = of_property_read_u32_array(pdev->dev.of_node,
+   if (!of_property_read_bool(pdev->dev.of_node, "dmas") &&
+   ssi_private->use_dma) {
+   /*
+* FIXME: This is a temporary solution until all
+* necessary dma drivers support the generic dma
+* bindings.
+*/
+   ret = of_property_read_u32_array(pdev->dev.of_node,
"fsl,ssi-dma-events", dma_events, 2);
-   if (ret && !ssi_private->use_dma) {
-   dev_err(&pdev->dev, "could not get dma events\n");
-   goto error_clk;
+   if (ret && ssi_private->use_dma) {
+   dev_err(&pdev->dev, "could not get dma events 
but fsl-ssi is configured to use DMA\n");
+   goto error_clk;
+   }
}
 
shared = of_device_is_compatible(of_get_parent(np),
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 00/11] ASoC: fsl-ssi: ac97-slave support

2013-06-16 Thread Markus Pargmann
Hi,

This series adds DT support for phycore-ac97. Beside ac97 support, the series
adds imx-pcm-fiq and generic DMA bindings to fsl-ssi.

In version 8 I fixed the build issues by seperating the DT capable ac97 phycore
driver from the old driver.

Regards,

Markus

Changes in v8:
 - Fix build issues in phycore-ac97.

Changes in v7:
 - Only one soc_ac97_ops struct for both ssi drivers (fsl-ssi and imx-ssi) to
   make it possible to compile a kernel with both drivers.
 - Other small bug/style fixes described in the changelogs of the patches.

Changes in v6:
 - Rebased onto 3.10-rc3 with Shawn's pcm cleanup patches
 - Setup of reset functions moved to phycore-ac97.c

Changes in v5:
 - Pass of_node via parent device to imx-pcm-dma.

Changes in v4:
 - phycore-ac97 uses the iomux functions based on audmux phandle now.
 - fsl-ssi imx-pcm-fiq got some new comments about problems with imx-ssi and
   incompatible codecs

Changes in v3:
 - Rebased onto pcm dma cleanup patches
 - A lot of cleanups for the fsl-ssi ac97 integration
 - Some small changes which are listed in the notes of the patches.

Markus Pargmann (11):
  ASoC: imx-pcm-dma: DT support
  ASoC: imx-pcm-fiq: Introduce pcm-fiq-params
  ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi
  ASoC: fsl-ssi: Add support for imx-pcm-fiq
  ASoC: fsl-ssi: Use generic DMA bindings if possible
  ASoC: fsl-ssi: imx ac97 support
  ARM: imx: Export ac97 reset functions
  ASoC: Add phycore-ac97-dt driver
  ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97
  ASoC: fsl: Move fsl-ssi binding doc to sound/
  ASoC: fsl: Update fsl-ssi binding doc

 .../{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt} |  10 +
 .../bindings/sound/phytec,phycore-ac97.txt |  14 +
 arch/arm/mach-imx/mach-pca100.c|   7 +-
 arch/arm/mach-imx/mach-pcm043.c|   7 +-
 sound/soc/fsl/Kconfig  |  20 +-
 sound/soc/fsl/Makefile |   2 +
 sound/soc/fsl/fsl_ssi.c| 450 +
 sound/soc/fsl/fsl_ssi.h|   7 +
 sound/soc/fsl/imx-pcm-dma.c|   1 -
 sound/soc/fsl/imx-pcm-fiq.c|  18 +-
 sound/soc/fsl/imx-pcm.h|  15 +-
 sound/soc/fsl/imx-ssi.c|  14 +-
 sound/soc/fsl/imx-ssi.h|   1 +
 sound/soc/fsl/phycore-ac97-dt.c| 243 +++
 sound/soc/fsl/phycore-ac97.c   |  13 +-
 15 files changed, 706 insertions(+), 116 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (88%)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
 create mode 100644 sound/soc/fsl/phycore-ac97-dt.c

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 02/11] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-06-16 Thread Markus Pargmann
Cleaner parameter passing for imx-pcm-fiq. Create a seperated fiq-params
struct to pass all arguments.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v7:
 - Fix init function signature for !CONFIG_SND_SOC_IMX_PCM_FIQ

Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, the imx_pcm_fiq_params are 
now
   passed as function arguments instead of platform driver data.

Changes in v3:
 - Using snd_dmaengine_dai_dma_data for dma_params after rebasing onto
   dmaengine cleanups.

 sound/soc/fsl/imx-pcm-fiq.c | 18 ++
 sound/soc/fsl/imx-pcm.h | 15 +--
 sound/soc/fsl/imx-ssi.c |  7 ++-
 sound/soc/fsl/imx-ssi.h |  1 +
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 310d902..3b2ba99 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 
 #include "imx-ssi.h"
+#include "imx-pcm.h"
 
 struct imx_pcm_runtime_data {
unsigned int period;
@@ -366,9 +368,9 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq 
= {
.pcm_free   = imx_pcm_fiq_free,
 };
 
-int imx_pcm_fiq_init(struct platform_device *pdev)
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params)
 {
-   struct imx_ssi *ssi = platform_get_drvdata(pdev);
int ret;
 
ret = claim_fiq(&fh);
@@ -377,15 +379,15 @@ int imx_pcm_fiq_init(struct platform_device *pdev)
return ret;
}
 
-   mxc_set_irq_fiq(ssi->irq, 1);
-   ssi_irq = ssi->irq;
+   mxc_set_irq_fiq(params->irq, 1);
+   ssi_irq = params->irq;
 
-   imx_pcm_fiq = ssi->irq;
+   imx_pcm_fiq = params->irq;
 
-   imx_ssi_fiq_base = (unsigned long)ssi->base;
+   imx_ssi_fiq_base = (unsigned long)params->base;
 
-   ssi->dma_params_tx.maxburst = 4;
-   ssi->dma_params_rx.maxburst = 6;
+   params->dma_params_tx->maxburst = 4;
+   params->dma_params_rx->maxburst = 6;
 
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
if (ret)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 67f656c..cd8a796 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -32,6 +32,15 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
dma_data->peripheral_type = IMX_DMATYPE_SSI;
 }
 
+struct imx_pcm_fiq_params {
+   int irq;
+   void __iomem *base;
+
+   /* Pointer to original ssi driver to setup tx rx sizes */
+   struct snd_dmaengine_dai_dma_data *dma_params_rx;
+   struct snd_dmaengine_dai_dma_data *dma_params_tx;
+};
+
 #ifdef CONFIG_SND_SOC_IMX_PCM_DMA
 int imx_pcm_dma_init(struct platform_device *pdev);
 void imx_pcm_dma_exit(struct platform_device *pdev);
@@ -47,10 +56,12 @@ static inline void imx_pcm_dma_exit(struct platform_device 
*pdev)
 #endif
 
 #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
-int imx_pcm_fiq_init(struct platform_device *pdev);
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 void imx_pcm_fiq_exit(struct platform_device *pdev);
 #else
-static inline int imx_pcm_fiq_init(struct platform_device *pdev)
+static inline int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 {
return -ENODEV;
 }
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index a8362be..16ae16d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -590,7 +590,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
 
-   ret = imx_pcm_fiq_init(pdev);
+   ssi->fiq_params.irq = ssi->irq;
+   ssi->fiq_params.base = ssi->base;
+   ssi->fiq_params.dma_params_rx = &ssi->dma_params_rx;
+   ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
+
+   ret = imx_pcm_fiq_init(pdev, &ssi->fiq_params);
if (ret)
goto failed_pcm_fiq;
 
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index d5003ce..fb1616b 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -209,6 +209,7 @@ struct imx_ssi {
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
int enabled;
 };
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 01/11] ASoC: imx-pcm-dma: DT support

2013-06-16 Thread Markus Pargmann
This patch removes the NO_DT flag. The pdev pointer may have a proper
of_node with the dmas property, so we can use it to request DMA
channels.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, this patch just consists of
   removing the NO_DT flag.

Changes in v5:
 - Use dev.parent pointer to get the of_node.

 sound/soc/fsl/imx-pcm-dma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index fde4d2e..f323ce0 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -64,7 +64,6 @@ int imx_pcm_dma_init(struct platform_device *pdev)
 {
return snd_dmaengine_pcm_register(&pdev->dev, &imx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-   SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT);
 }
 EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 09/11] ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97

2013-06-16 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index dafffd1..368686e 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -149,7 +149,8 @@ config SND_SOC_PHYCORE_AC97
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
select SND_SOC_IMX_AUDMUX
-   select SND_SOC_IMX_SSI
+   select SND_SOC_FSL_SSI if MACH_PCA100
+   select SND_SOC_IMX_SSI if MACH_PCM043
help
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 10/11] ASoC: fsl: Move fsl-ssi binding doc to sound/

2013-06-16 Thread Markus Pargmann
fsl-ssi was located in powerpc/fsl/ssi.txt. This is no powerpc specific
device, so it should be moved to sound/ as it connects to differen audio
codecs.

Signed-off-by: Markus Pargmann 
---
 .../devicetree/bindings/{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt}| 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (100%)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
similarity index 100%
rename from Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
rename to Documentation/devicetree/bindings/sound/fsl,ssi.txt
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v8 06/11] ASoC: fsl-ssi: imx ac97 support

2013-06-16 Thread Markus Pargmann
This patch copies some parts from imx-ssi to support AC97 on
imx27-pca100 and imx35-pcm043. This is a implementation of the
ac97-slave mode.

For ac97, the registers have to be setup earlier than for other ssi
modes because there is some communication with the external device
before actual streaming. So this patch introduces a fsl_ssi_setup
function to setup the registers at different times.

To seperate board specific ac97 reset functions, ac97 read/write
functions are exported. The reset functions are set by other drivers.

This patch was tested with imx27-pca100.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v7:
 - ac97 ops are now assigned to soc_ac97_ops to allow enabled imx-ssi and
   fsl-ssi at the same time.

Changes in v6:
 - ac97 reset functions are not provided by fsl-ssi code anymore. They were
   moved to board specific code like phycore-ac97. Therefore ac97 read/write
   functions are exported and a helper function to set the soc_ac97_ops 
reset
   functions was created.

Changes in v3:
 - Cleanup ac97 code by adding a fsl_ssi_setup function for initial register
   setup. For ac97 the registers have to be setup earlier than in normal
   mode.

 sound/soc/fsl/fsl_ssi.c | 363 ++--
 sound/soc/fsl/fsl_ssi.h |   7 +
 2 files changed, 298 insertions(+), 72 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index ed1fbbb..7c20bd7 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -141,6 +141,7 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool imx_ac97;
bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -320,6 +321,124 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
return ret;
 }
 
+static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
+{
+   struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+   u8 i2s_mode;
+   u8 wm;
+   int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
+
+   if (ssi_private->imx_ac97)
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+   else
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+
+   /*
+* Section 16.5 of the MPC8610 reference manual says that the SSI needs
+* to be disabled before updating the registers we set here.
+*/
+   write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
+
+   /*
+* Program the SSI into I2S Slave Non-Network Synchronous mode. Also
+* enable the transmit and receive FIFO.
+*
+* FIXME: Little-endian samples require a different shift dir
+*/
+   write_ssi_mask(&ssi->scr,
+   CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
+   CCSR_SSI_SCR_TFR_CLK_DIS |
+   i2s_mode |
+   (synchronous ? CCSR_SSI_SCR_SYN : 0));
+
+   write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
+CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
+CCSR_SSI_STCR_TSCKP, &ssi->stcr);
+
+   write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
+CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
+CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
+   /*
+* The DC and PM bits are only used if the SSI is the clock master.
+*/
+
+   /*
+* Set the watermark for transmit FIFI 0 and receive FIFO 0. We don't
+* use FIFO 1. We program the transmit water to signal a DMA transfer
+* if there are only two (or fewer) elements left in the FIFO. Two
+* elements equals one frame (left channel, right channel). This value,
+* however, depends on the depth of the transmit buffer.
+*
+* We set the watermark on the same level as the DMA burstsize.  For
+* fiq it is probably better to use the biggest possible watermark
+* size.
+*/
+   if (ssi_private->use_dma)
+   wm = ssi_private->fifo_depth - 2;
+   else
+   wm = ssi_private->fifo_depth;
+
+   write_ssi(CCSR_SSI_SFCSR_TFWM0(wm) | CCSR_SSI_SFCSR_RFWM0(wm) |
+   CCSR_SSI_SFCSR_TFWM1(wm) | CCSR_SSI_SFCSR_RFWM1(wm),
+   &ssi->sfcsr);
+
+   /*
+* For non-ac97 setups, we keep the SSI disabled because if we enable
+* it, then the DMA controller will start. It's not supposed to start
+* until the SCR.TE (or SCR.RE) bit is set, but it does anyway. The DMA
+* controller will transfer one "BWC" of data (i.e. the amount of data
+* that the MR.BWC bits are set to). The reason this is bad is because
+* at this point, the PCM driver has not finished initializing the DMA
+* controller.
+*/
+
+
+   /*
+* For ac97 interrupts are enabled with the startup

[PATCH v8 07/11] ARM: imx: Export ac97 reset functions

2013-06-16 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/mach-imx/mach-pca100.c | 7 +--
 arch/arm/mach-imx/mach-pcm043.c | 7 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb..68badf8 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -208,7 +209,7 @@ static const struct spi_imx_master pca100_spi0_data 
__initconst = {
.num_chipselect = ARRAY_SIZE(pca100_spi_cs),
 };
 
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
gpio_set_value(GPIO_PORTC + 20, 1);
@@ -217,8 +218,9 @@ static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC20_PF_SSI1_FS);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_warm_reset);
 
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);  /* FS */
gpio_set_value(GPIO_PORTC + 20, 0);
@@ -232,6 +234,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC22_PF_SSI1_TXD);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
.ac97_reset = pca100_ac97_cold_reset,
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 8ed533f..4f318ca 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -217,7 +218,7 @@ static iomux_v3_cfg_t pcm043_pads[] = {
 #define SD1_GPIO_WPIMX_GPIO_NR(2, 23)
 #define SD1_GPIO_CDIMX_GPIO_NR(2, 24)
 
-static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -239,8 +240,9 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
gpio_free(AC97_GPIO_TXFS);
mxc_iomux_v3_setup_pad(txfs);
 }
+EXPORT_SYMBOL(pcm043_ac97_warm_reset);
 
-static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -286,6 +288,7 @@ err1:
printk("%s failed with %d\n", __func__, ret);
mdelay(1);
 }
+EXPORT_SYMBOL(pcm043_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
.ac97_reset = pcm043_ac97_cold_reset,
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 02/11] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-05-30 Thread Markus Pargmann
Cleaner parameter passing for imx-pcm-fiq. Create a seperated fiq-params
struct to pass all arguments.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v7:
 - Fix init function signature for !CONFIG_SND_SOC_IMX_PCM_FIQ

Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, the imx_pcm_fiq_params are 
now
   passed as function arguments instead of platform driver data.

Changes in v3:
 - Using snd_dmaengine_dai_dma_data for dma_params after rebasing onto
   dmaengine cleanups.

 sound/soc/fsl/imx-pcm-fiq.c | 18 ++
 sound/soc/fsl/imx-pcm.h | 15 +--
 sound/soc/fsl/imx-ssi.c |  7 ++-
 sound/soc/fsl/imx-ssi.h |  1 +
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 310d902..3b2ba99 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 
 #include "imx-ssi.h"
+#include "imx-pcm.h"
 
 struct imx_pcm_runtime_data {
unsigned int period;
@@ -366,9 +368,9 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq 
= {
.pcm_free   = imx_pcm_fiq_free,
 };
 
-int imx_pcm_fiq_init(struct platform_device *pdev)
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params)
 {
-   struct imx_ssi *ssi = platform_get_drvdata(pdev);
int ret;
 
ret = claim_fiq(&fh);
@@ -377,15 +379,15 @@ int imx_pcm_fiq_init(struct platform_device *pdev)
return ret;
}
 
-   mxc_set_irq_fiq(ssi->irq, 1);
-   ssi_irq = ssi->irq;
+   mxc_set_irq_fiq(params->irq, 1);
+   ssi_irq = params->irq;
 
-   imx_pcm_fiq = ssi->irq;
+   imx_pcm_fiq = params->irq;
 
-   imx_ssi_fiq_base = (unsigned long)ssi->base;
+   imx_ssi_fiq_base = (unsigned long)params->base;
 
-   ssi->dma_params_tx.maxburst = 4;
-   ssi->dma_params_rx.maxburst = 6;
+   params->dma_params_tx->maxburst = 4;
+   params->dma_params_rx->maxburst = 6;
 
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
if (ret)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 67f656c..cd8a796 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -32,6 +32,15 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
dma_data->peripheral_type = IMX_DMATYPE_SSI;
 }
 
+struct imx_pcm_fiq_params {
+   int irq;
+   void __iomem *base;
+
+   /* Pointer to original ssi driver to setup tx rx sizes */
+   struct snd_dmaengine_dai_dma_data *dma_params_rx;
+   struct snd_dmaengine_dai_dma_data *dma_params_tx;
+};
+
 #ifdef CONFIG_SND_SOC_IMX_PCM_DMA
 int imx_pcm_dma_init(struct platform_device *pdev);
 void imx_pcm_dma_exit(struct platform_device *pdev);
@@ -47,10 +56,12 @@ static inline void imx_pcm_dma_exit(struct platform_device 
*pdev)
 #endif
 
 #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
-int imx_pcm_fiq_init(struct platform_device *pdev);
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 void imx_pcm_fiq_exit(struct platform_device *pdev);
 #else
-static inline int imx_pcm_fiq_init(struct platform_device *pdev)
+static inline int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 {
return -ENODEV;
 }
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index a8362be..16ae16d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -590,7 +590,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
 
-   ret = imx_pcm_fiq_init(pdev);
+   ssi->fiq_params.irq = ssi->irq;
+   ssi->fiq_params.base = ssi->base;
+   ssi->fiq_params.dma_params_rx = &ssi->dma_params_rx;
+   ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
+
+   ret = imx_pcm_fiq_init(pdev, &ssi->fiq_params);
if (ret)
goto failed_pcm_fiq;
 
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index d5003ce..fb1616b 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -209,6 +209,7 @@ struct imx_ssi {
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
int enabled;
 };
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 00/11] ASoC: fsl-ssi: ac97-slave support

2013-05-30 Thread Markus Pargmann
Hi,

This series adds DT support for phycore-ac97. Beside ac97 support, the series
adds imx-pcm-fiq and generic DMA bindings to fsl-ssi.

Regards,

Markus

Changes in v7:
 - Only one soc_ac97_ops struct for both ssi drivers (fsl-ssi and imx-ssi) to
   make it possible to compile a kernel with both drivers.
 - Other small bug/style fixes described in the changelogs of the patches.

Changes in v6:
 - Rebased onto 3.10-rc3 with Shawn's pcm cleanup patches
 - Setup of reset functions moved to phycore-ac97.c

Changes in v5:
 - Pass of_node via parent device to imx-pcm-dma.

Changes in v4:
 - phycore-ac97 uses the iomux functions based on audmux phandle now.
 - fsl-ssi imx-pcm-fiq got some new comments about problems with imx-ssi and
   incompatible codecs

Changes in v3:
 - Rebased onto pcm dma cleanup patches
 - A lot of cleanups for the fsl-ssi ac97 integration
 - Some small changes which are listed in the notes of the patches.

Markus Pargmann (11):
  ASoC: imx-pcm-dma: DT support
  ASoC: imx-pcm-fiq: Introduce pcm-fiq-params
  ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi
  ASoC: fsl-ssi: Add support for imx-pcm-fiq
  ASoC: fsl-ssi: Use generic DMA bindings if possible
  ASoC: fsl-ssi: imx ac97 support
  ARM: imx: Export ac97 reset functions
  ASoC: phycore-ac97: Add DT support
  ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97
  ASoC: fsl: Move fsl-ssi binding doc to sound/
  ASoC: fsl: Update fsl-ssi binding doc

 .../{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt} |  10 +
 .../bindings/sound/phytec,phycore-ac97.txt |  14 +
 arch/arm/mach-imx/mach-pca100.c|   7 +-
 arch/arm/mach-imx/mach-pcm043.c|   7 +-
 sound/soc/fsl/Kconfig  |   4 +-
 sound/soc/fsl/fsl_ssi.c| 450 +
 sound/soc/fsl/fsl_ssi.h|   7 +
 sound/soc/fsl/imx-pcm-dma.c|   1 -
 sound/soc/fsl/imx-pcm-fiq.c|  18 +-
 sound/soc/fsl/imx-pcm.h|  15 +-
 sound/soc/fsl/imx-ssi.c|  14 +-
 sound/soc/fsl/imx-ssi.h|   1 +
 sound/soc/fsl/phycore-ac97.c   | 236 +--
 13 files changed, 656 insertions(+), 128 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (88%)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 03/11] ASoC: fsl: Move soc_ac97_ops from imx-ssi to fsl_ssi

2013-05-30 Thread Markus Pargmann
fsl_ssi and imx-ssi can be both enabled at the same time. To be able to
add AC97 support to fsl_ssi, soc_ac97_ops have to be available to both
drivers.

fsl_ssi has DT support and should be the only driver at some point in
the future. This patch moves the definition of soc_ac97_ops to fsl_ssi.
imx-ssi copies its own ac97 ops struct into soc_ac97_ops when used in
AC97 mode.

Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig   | 1 +
 sound/soc/fsl/fsl_ssi.c | 8 
 sound/soc/fsl/imx-ssi.c | 7 +--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 7860cc2..74ef96e 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -107,6 +107,7 @@ if SND_IMX_SOC
 
 config SND_SOC_IMX_SSI
tristate
+   select SND_SOC_FSL_SSI
 
 config SND_SOC_IMX_PCM_FIQ
bool
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2f2d837..db55499 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -587,6 +587,14 @@ static const struct snd_soc_component_driver 
fsl_ssi_component = {
.name   = "fsl-ssi",
 };
 
+/*
+ * FIXME: As soon as all boards using imx-ssi AC97 mode are able to use
+ * fsl-ssi, soc_ac97_ops can be used exclusively in this driver without copying
+ * the struct. AC97 support can then be removed from imx-ssi.
+ */
+struct snd_ac97_bus_ops soc_ac97_ops;
+EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
 /* Show the statistics of a flag only if its interrupt is enabled.  The
  * compiler will optimze this code to a no-op if the interrupt is not
  * enabled.
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 16ae16d..3760220 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -501,13 +501,14 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
imx_ssi_ac97_read(ac97, 0);
 }
 
-struct snd_ac97_bus_ops soc_ac97_ops = {
+static struct snd_ac97_bus_ops imx_ssi_soc_ac97_ops = {
.read   = imx_ssi_ac97_read,
.write  = imx_ssi_ac97_write,
.reset  = imx_ssi_ac97_reset,
.warm_reset = imx_ssi_ac97_warm_reset
 };
-EXPORT_SYMBOL_GPL(soc_ac97_ops);
+
+extern struct snd_ac97_bus_ops soc_ac97_ops;
 
 static int imx_ssi_probe(struct platform_device *pdev)
 {
@@ -547,6 +548,8 @@ static int imx_ssi_probe(struct platform_device *pdev)
}
 
if (ssi->flags & IMX_SSI_USE_AC97) {
+   memcpy(&soc_ac97_ops, &imx_ssi_soc_ac97_ops,
+   sizeof(soc_ac97_ops));
if (ac97_ssi) {
dev_err(&pdev->dev, "AC'97 SSI already registered\n");
ret = -EBUSY;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 01/11] ASoC: imx-pcm-dma: DT support

2013-05-30 Thread Markus Pargmann
This patch removes the NO_DT flag. The pdev pointer may have a proper
of_node with the dmas property, so we can use it to request DMA
channels.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, this patch just consists of
   removing the NO_DT flag.

Changes in v5:
 - Use dev.parent pointer to get the of_node.

 sound/soc/fsl/imx-pcm-dma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index fde4d2e..f323ce0 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -64,7 +64,6 @@ int imx_pcm_dma_init(struct platform_device *pdev)
 {
return snd_dmaengine_pcm_register(&pdev->dev, &imx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-   SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT);
 }
 EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 07/11] ARM: imx: Export ac97 reset functions

2013-05-30 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/mach-imx/mach-pca100.c | 7 +--
 arch/arm/mach-imx/mach-pcm043.c | 7 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb..68badf8 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -208,7 +209,7 @@ static const struct spi_imx_master pca100_spi0_data 
__initconst = {
.num_chipselect = ARRAY_SIZE(pca100_spi_cs),
 };
 
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
gpio_set_value(GPIO_PORTC + 20, 1);
@@ -217,8 +218,9 @@ static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC20_PF_SSI1_FS);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_warm_reset);
 
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);  /* FS */
gpio_set_value(GPIO_PORTC + 20, 0);
@@ -232,6 +234,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC22_PF_SSI1_TXD);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
.ac97_reset = pca100_ac97_cold_reset,
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 8ed533f..4f318ca 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -217,7 +218,7 @@ static iomux_v3_cfg_t pcm043_pads[] = {
 #define SD1_GPIO_WPIMX_GPIO_NR(2, 23)
 #define SD1_GPIO_CDIMX_GPIO_NR(2, 24)
 
-static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -239,8 +240,9 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
gpio_free(AC97_GPIO_TXFS);
mxc_iomux_v3_setup_pad(txfs);
 }
+EXPORT_SYMBOL(pcm043_ac97_warm_reset);
 
-static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -286,6 +288,7 @@ err1:
printk("%s failed with %d\n", __func__, ret);
mdelay(1);
 }
+EXPORT_SYMBOL(pcm043_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
.ac97_reset = pcm043_ac97_cold_reset,
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 04/11] ASoC: fsl-ssi: Add support for imx-pcm-fiq

2013-05-30 Thread Markus Pargmann
Add support for non-dma pcm for imx platforms with imx-pcm-fiq support.
Instead of imx-pcm-audio, in this case imx-pcm-fiq-audio device is added
and the SIER flags are set differently.

We need imx-pcm-fiq for some boards that use an incompatible codec.
imx-pcm-fiq handles those codecs differently and allows to operate with
them. DMA is not possible because some data sent by the codecs, e.g.
wm9712, is not in the datastream. Also some data is mixed up in the
fifos, so that we need to sort them out manually.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about the reason why we add a imx-pcm-fiq device.
 - Change commit message to include information about the usage of 
imx-pcm-fiq

Changes in v3:
 - Rename bool "dma" to "use_dma"

 sound/soc/fsl/fsl_ssi.c | 77 +
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index db55499..2fe4dbd 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -8,6 +8,26 @@
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
  * kind, whether express or implied.
+ *
+ *
+ * Some notes why imx-pcm-fiq is used instead of DMA on some boards:
+ *
+ * The i.MX SSI core has some nasty limitations in AC97 mode. While most
+ * sane processor vendors have a FIFO per AC97 slot, the i.MX has only
+ * one FIFO which combines all valid receive slots. We cannot even select
+ * which slots we want to receive. The WM9712 with which this driver
+ * was developed with always sends GPIO status data in slot 12 which
+ * we receive in our (PCM-) data stream. The only chance we have is to
+ * manually skip this data in the FIQ handler. With sampling rates different
+ * from 48000Hz not every frame has valid receive data, so the ratio
+ * between pcm data and GPIO status data changes. Our FIQ handler is not
+ * able to handle this, hence this driver only works with 48000Hz sampling
+ * rate.
+ * Reading and writing AC97 registers is another challenge. The core
+ * provides us status bits when the read register is updated with *another*
+ * value. When we read the same register two times (and the register still
+ * contains the same value) these status bits are not set. We work
+ * around this by not polling these bits but only wait a fixed delay.
  */
 
 #include 
@@ -121,11 +141,13 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
struct {
unsigned int rfrc;
@@ -355,7 +377,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream 
*substream,
 */
 
/* Enable the interrupts and DMA requests */
-   write_ssi(SIER_FLAGS, &ssi->sier);
+   if (ssi_private->use_dma)
+   write_ssi(SIER_FLAGS, &ssi->sier);
+   else
+   write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
+   CCSR_SSI_SIER_RIE |
+   CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
 
/*
 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -549,7 +576,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 {
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
 
-   if (ssi_private->ssi_on_imx) {
+   if (ssi_private->ssi_on_imx && ssi_private->use_dma) {
dai->playback_dma_data = &ssi_private->dma_params_tx;
dai->capture_dma_data = &ssi_private->dma_params_rx;
}
@@ -702,6 +729,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
   sizeof(fsl_ssi_dai_template));
ssi_private->cpu_dai_drv.name = ssi_private->name;
 
+   ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
+
/* Get the addresses and IRQ */
ret = of_address_to_resource(np, 0, &res);
if (ret) {
@@ -723,12 +752,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
goto error_iomap;
}
 
-   /* The 'name' should not have any slashes in it. */
-   ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
- ssi_private);
-   if (ret < 0) {
-   dev_err(&pdev->dev, "could not claim irq %u\n", 
ssi_private->irq);
-   goto error_irqmap;
+   if (ssi_p

[PATCH v7 06/11] ASoC: fsl-ssi: imx ac97 support

2013-05-30 Thread Markus Pargmann
This patch copies some parts from imx-ssi to support AC97 on
imx27-pca100 and imx35-pcm043. This is a implementation of the
ac97-slave mode.

For ac97, the registers have to be setup earlier than for other ssi
modes because there is some communication with the external device
before actual streaming. So this patch introduces a fsl_ssi_setup
function to setup the registers at different times.

To seperate board specific ac97 reset functions, ac97 read/write
functions are exported. The reset functions are set by other drivers.

This patch was tested with imx27-pca100.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v7:
 - ac97 ops are now assigned to soc_ac97_ops to allow enabled imx-ssi and
   fsl-ssi at the same time.

Changes in v6:
 - ac97 reset functions are not provided by fsl-ssi code anymore. They were
   moved to board specific code like phycore-ac97. Therefore ac97 read/write
   functions are exported and a helper function to set the soc_ac97_ops 
reset
   functions was created.

Changes in v3:
 - Cleanup ac97 code by adding a fsl_ssi_setup function for initial register
   setup. For ac97 the registers have to be setup earlier than in normal
   mode.

 sound/soc/fsl/fsl_ssi.c | 363 ++--
 sound/soc/fsl/fsl_ssi.h |   7 +
 2 files changed, 298 insertions(+), 72 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index ed1fbbb..7c20bd7 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -141,6 +141,7 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool imx_ac97;
bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -320,6 +321,124 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
return ret;
 }
 
+static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
+{
+   struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+   u8 i2s_mode;
+   u8 wm;
+   int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
+
+   if (ssi_private->imx_ac97)
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+   else
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+
+   /*
+* Section 16.5 of the MPC8610 reference manual says that the SSI needs
+* to be disabled before updating the registers we set here.
+*/
+   write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
+
+   /*
+* Program the SSI into I2S Slave Non-Network Synchronous mode. Also
+* enable the transmit and receive FIFO.
+*
+* FIXME: Little-endian samples require a different shift dir
+*/
+   write_ssi_mask(&ssi->scr,
+   CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
+   CCSR_SSI_SCR_TFR_CLK_DIS |
+   i2s_mode |
+   (synchronous ? CCSR_SSI_SCR_SYN : 0));
+
+   write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
+CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
+CCSR_SSI_STCR_TSCKP, &ssi->stcr);
+
+   write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
+CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
+CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
+   /*
+* The DC and PM bits are only used if the SSI is the clock master.
+*/
+
+   /*
+* Set the watermark for transmit FIFI 0 and receive FIFO 0. We don't
+* use FIFO 1. We program the transmit water to signal a DMA transfer
+* if there are only two (or fewer) elements left in the FIFO. Two
+* elements equals one frame (left channel, right channel). This value,
+* however, depends on the depth of the transmit buffer.
+*
+* We set the watermark on the same level as the DMA burstsize.  For
+* fiq it is probably better to use the biggest possible watermark
+* size.
+*/
+   if (ssi_private->use_dma)
+   wm = ssi_private->fifo_depth - 2;
+   else
+   wm = ssi_private->fifo_depth;
+
+   write_ssi(CCSR_SSI_SFCSR_TFWM0(wm) | CCSR_SSI_SFCSR_RFWM0(wm) |
+   CCSR_SSI_SFCSR_TFWM1(wm) | CCSR_SSI_SFCSR_RFWM1(wm),
+   &ssi->sfcsr);
+
+   /*
+* For non-ac97 setups, we keep the SSI disabled because if we enable
+* it, then the DMA controller will start. It's not supposed to start
+* until the SCR.TE (or SCR.RE) bit is set, but it does anyway. The DMA
+* controller will transfer one "BWC" of data (i.e. the amount of data
+* that the MR.BWC bits are set to). The reason this is bad is because
+* at this point, the PCM driver has not finished initializing the DMA
+* controller.
+*/
+
+
+   /*
+* For ac97 interrupts are enabled with the startup

[PATCH v7 09/11] ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97

2013-05-30 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 74ef96e..71284c0 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -149,7 +149,8 @@ config SND_SOC_PHYCORE_AC97
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
select SND_SOC_IMX_AUDMUX
-   select SND_SOC_IMX_SSI
+   select SND_SOC_FSL_SSI if MACH_PCA100
+   select SND_SOC_IMX_SSI if MACH_PCM043
help
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 11/11] ASoC: fsl: Update fsl-ssi binding doc

2013-05-30 Thread Markus Pargmann
Update the fsl-ssi bindings. DMA is no required property anymore and
uses the generic DMA bindings. imx-fiq is a new alternative to DMA

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about hardware bugs for imx-pcm-fiq

Changes in v3:
 - In previous versions, I removed fsl,playback-dma and capture-dma. But 
they
   are still in use by fsl_dma.c, so I added them again.

 Documentation/devicetree/bindings/sound/fsl,ssi.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
index 5ff76c9..0375ee0 100644
--- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
@@ -43,10 +43,20 @@ Required properties:
 together.  This would still allow different sample sizes,
 but not different sample rates.
 
+Note that either dmas, dma-names or fsl,imx-fiq are required.
+
 Optional properties:
 - codec-handle: Phandle to a 'codec' node that defines an audio
 codec connected to this SSI.  This node is typically
 a child of an I2C or other control node.
+- dmas:Generic dma devicetree binding as described in
+   Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names:   Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
+   is not defined.
+- fsl,imx-fiq: Bool property. Use imx-pcm-fiq instead of imx-pcm-dma.
+   Only necessary for some boards with incompatible
+   codec. imx-pcm-fiq will manually filter some data from
+   the codec. It is a workaround for a hardware bug.
 
 Child 'codec' node required properties:
 - compatible:   Compatible list, contains the name of the codec
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 08/11] ASoC: phycore-ac97: Add DT support

2013-05-30 Thread Markus Pargmann
Add devicetree support for phycore-ac97 driver.

platform_of_node and cpu_of_node are set according to the fsl,audmux
phandle.

This patch adds handling of ac97 reset functions according to fsl ac97
support. They are setup from here to avoid board specific code in the
generic fsl-ssi driver.

This patch changes the handling of pca100 boards from non-DT to DT only.
pcm043 is still handled without DT.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v7:
 - Declare empty ac97 reset functions static.
 - Replace complicated machine compatible comparison with
   of_machine_is_compatible
 - Missing snd_soc_unregister_card in imx_phycore_ac97_remove
 - Rename driver

Changes in v6:
 - phycore-ac97 now manages the ac97 reset functions of the boards using
   this combination of ssi-codec.
 - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
   non-DT only and pca100 DT only.

Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to imx27-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

Changes in v7:
 - Declare empty ac97 reset functions static.
 - Replace complicated machine compatible comparison with
   of_machine_is_compatible
 - Missing snd_soc_unregister_card in imx_phycore_ac97_remove

Changes in v6:
 - phycore-ac97 now manages the ac97 reset functions of the boards using
   this combination of ssi-codec.
 - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
   non-DT only and pca100 DT only.

Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to imx27-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

 .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
 sound/soc/fsl/phycore-ac97.c   | 236 ++---
 2 files changed, 224 insertions(+), 26 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt

diff --git a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
new file mode 100644
index 000..41201ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
@@ -0,0 +1,14 @@
+Phytec phycore AC97
+
+Required prope

[PATCH v7 05/11] ASoC: fsl-ssi: Use generic DMA bindings if possible

2013-05-30 Thread Markus Pargmann
There may be some platforms using fsl-ssi that do not have a DMA driver
with generic DMA bindings. So this patch adds support for the generic
DMA bindings, while still accepting the old "fsl,dma-events" property if
"dmas" is not found.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v5:
 - Not passing of_node now, instead setting the parent device

Changes in v4:
 - Change TODO comment to a FIXME, to remove the old dma-events property as 
soon
   as all dma drivers support the generic DMA bindings.

 sound/soc/fsl/fsl_ssi.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2fe4dbd..ed1fbbb 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -803,15 +803,19 @@ static int fsl_ssi_probe(struct platform_device *pdev)
&ssi_private->filter_data_tx;
ssi_private->dma_params_rx.filter_data =
&ssi_private->filter_data_rx;
-   /*
-* TODO: This is a temporary solution and should be changed
-* to use generic DMA binding later when the helplers get in.
-*/
-   ret = of_property_read_u32_array(pdev->dev.of_node,
+   if (!of_property_read_bool(pdev->dev.of_node, "dmas") &&
+   ssi_private->use_dma) {
+   /*
+* FIXME: This is a temporary solution until all
+* necessary dma drivers support the generic dma
+* bindings.
+*/
+   ret = of_property_read_u32_array(pdev->dev.of_node,
"fsl,ssi-dma-events", dma_events, 2);
-   if (ret && !ssi_private->use_dma) {
-   dev_err(&pdev->dev, "could not get dma events\n");
-   goto error_clk;
+   if (ret && ssi_private->use_dma) {
+   dev_err(&pdev->dev, "could not get dma events 
but fsl-ssi is configured to use DMA\n");
+   goto error_clk;
+   }
}
 
shared = of_device_is_compatible(of_get_parent(np),
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 10/11] ASoC: fsl: Move fsl-ssi binding doc to sound/

2013-05-30 Thread Markus Pargmann
fsl-ssi was located in powerpc/fsl/ssi.txt. This is no powerpc specific
device, so it should be moved to sound/ as it connects to differen audio
codecs.

Signed-off-by: Markus Pargmann 
---
 .../devicetree/bindings/{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt}| 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (100%)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
similarity index 100%
rename from Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
rename to Documentation/devicetree/bindings/sound/fsl,ssi.txt
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v6 03/10] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-05-30 Thread Markus Pargmann
On Wed, May 29, 2013 at 10:26:50PM +0800, Shawn Guo wrote:
> On Tue, May 28, 2013 at 04:47:51PM +0200, Markus Pargmann wrote:
> > @@ -47,7 +56,8 @@ static inline void imx_pcm_dma_exit(struct 
> > platform_device *pdev)
> >  #endif
> >  
> >  #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
> > -int imx_pcm_fiq_init(struct platform_device *pdev);
> > +int imx_pcm_fiq_init(struct platform_device *pdev,
> > +   struct imx_pcm_fiq_params *params);
> >  void imx_pcm_fiq_exit(struct platform_device *pdev);
> >  #else
> >  static inline int imx_pcm_fiq_init(struct platform_device *pdev)
> 
> This one also needs update with a new parameter.

Fixed, thanks,

Markus

> 
> Shawn
> 
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v6 01/10] ASoC: phycore-ac97: Add DT support

2013-05-30 Thread Markus Pargmann
On Tue, May 28, 2013 at 03:56:03PM +0100, Mark Brown wrote:
> On Tue, May 28, 2013 at 04:47:49PM +0200, Markus Pargmann wrote:
> > Add devicetree support for this audio soc fabric driver.
> 
> What is an "audio soc fabric driver"?
> 

I changed both, driver name and commit message.

Thanks,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v6 01/10] ASoC: phycore-ac97: Add DT support

2013-05-30 Thread Markus Pargmann
On Wed, May 29, 2013 at 10:41:58AM -0500, Timur Tabi wrote:
> On Wed, May 29, 2013 at 8:53 AM, Shawn Guo  wrote:
> >
> >
> > This function is unavailable until patch #7, right?
> 
> 
> May I suggest that Markus run this script:
> 
> for i in 1 2 3 4 5 6 7 8 9
> do
>   git checkout HEAD^
>   make
> done
> 
> It's important that each commit in a patchset be compilable, otherwise
> git-bisect will break.
> 

I will reorder the patches in the series so that the kernel is
compilable after each patch.

Thanks,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v6 01/10] ASoC: phycore-ac97: Add DT support

2013-05-30 Thread Markus Pargmann
On Wed, May 29, 2013 at 09:53:45PM +0800, Shawn Guo wrote:
> On Tue, May 28, 2013 at 04:47:49PM +0200, Markus Pargmann wrote:
> > Add devicetree support for this audio soc fabric driver.
> > 
> > platform_of_node and cpu_of_node are set according to the fsl,audmux
> > phandle.
> > 
> > This patch adds handling of ac97 reset functions according to fsl ac97
> > support. They are setup from here to avoid board specific code in the
> > generic fsl-ssi driver.
> > 
> > This patch changes the handling of pca100 boards from non-DT to DT only.
> > pcm043 is still handled without DT.
> > 
> > Signed-off-by: Markus Pargmann 
> > ---
> > 
> > Notes:
> > Changes in v6:
> >  - phycore-ac97 now manages the ac97 reset functions of the boards using
> >this combination of ssi-codec.
> >  - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
> >non-DT only and pca100 DT only.
> > 
> > Changes in v4:
> >  - New property phytec,audmux to check which audmux setup should be
> >executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.
> > 
> > Changes in v3:
> >  - Add some more information in the commit message.
> > 
> > Changes in v2:
> >  - Simplify the driver, by combining audmux port configurations. The
> >audmux driver actually knows on which platform he is running and
> >will return the appropriate error code if we use functions for
> >another platform. So we don't need to have the knowledge about it
> >in phycore-ac97 and can try both functions. This removes the need
> >of different compatibilities and renames it to phycore-ac97.
> >  - Use a phandle for the cpu_dai link.
> >  - Add devicetree binding documentation.
> >  - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi
> > 
> > Changes in v2:
> >  - Simplify the driver, by combining audmux port configurations. The
> >audmux driver actually knows on which platform he is running and
> >will return the appropriate error code if we use functions for
> >another platform. So we don't need to have the knowledge about it
> >in phycore-ac97 and can try both functions. This removes the need
> >of different compatibilities and renames it to imx27-ac97.
> >  - Use a phandle for the cpu_dai link.
> >  - Add devicetree binding documentation.
> >  - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi
> > 
> >  .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
> >  sound/soc/fsl/phycore-ac97.c   | 241 
> > ++---
> >  2 files changed, 229 insertions(+), 26 deletions(-)
> >  create mode 100644 
> > Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
> > b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
> > new file mode 100644
> > index 000..41201ff
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
> > @@ -0,0 +1,14 @@
> > +Phytec phycore AC97
> > +
> > +Required properties:
> > +- compatible: "phytec,phycore-ac97"
> > +- phytec,ssi: A phandle to the ssi device that is connected to ac97.
> > +- phytec,audmux: A phandle to the audmux device.
> > +
> > +Example:
> > +
> > +sound {
> > +   compatible = "phytec,phycore-ac97";
> > +   phytec,ssi = <&ssi1>;
> > +   phytec,audmux = <&audmux>;
> > +};
> > diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
> > index ae403c2..bf2c600 100644
> > --- a/sound/soc/fsl/phycore-ac97.c
> > +++ b/sound/soc/fsl/phycore-ac97.c
> > @@ -20,8 +20,14 @@
> >  #include 
> >  
> >  #include "imx-audmux.h"
> > +#include "fsl_ssi.h"
> > +
> > +#define DRV_NAME "phycore-audio-fabric"
> >  
> >  static struct snd_soc_card imx_phycore;
> > +static struct device_node *phycore_dai_cpu_node;
> > +static void (*phycore_ac97_reset) (struct snd_ac97 *ac97);
> > +static void (*phycore_ac97_warm_reset)(struct snd_ac97 *ac97);
> >  
> >  static struct snd_soc_ops imx_phycore_hifi_ops = {
> >  };
> > @@ -32,12 +38,12 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = 
> > {
> > .stream_name= "HiFi",
&

[PATCH v6 06/10] ARM: imx: Export ac97 reset functions

2013-05-28 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 arch/arm/mach-imx/mach-pca100.c | 7 +--
 arch/arm/mach-imx/mach-pcm043.c | 7 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb..68badf8 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -208,7 +209,7 @@ static const struct spi_imx_master pca100_spi0_data 
__initconst = {
.num_chipselect = ARRAY_SIZE(pca100_spi_cs),
 };
 
-static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
+void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);
gpio_set_value(GPIO_PORTC + 20, 1);
@@ -217,8 +218,9 @@ static void pca100_ac97_warm_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC20_PF_SSI1_FS);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_warm_reset);
 
-static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
+void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
 {
mxc_gpio_mode(GPIO_PORTC | 20 | GPIO_GPIO | GPIO_OUT);  /* FS */
gpio_set_value(GPIO_PORTC + 20, 0);
@@ -232,6 +234,7 @@ static void pca100_ac97_cold_reset(struct snd_ac97 *ac97)
mxc_gpio_mode(PC22_PF_SSI1_TXD);
msleep(2);
 }
+EXPORT_SYMBOL(pca100_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pca100_ssi_pdata __initconst = {
.ac97_reset = pca100_ac97_cold_reset,
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 8ed533f..4f318ca 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -217,7 +218,7 @@ static iomux_v3_cfg_t pcm043_pads[] = {
 #define SD1_GPIO_WPIMX_GPIO_NR(2, 23)
 #define SD1_GPIO_CDIMX_GPIO_NR(2, 24)
 
-static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -239,8 +240,9 @@ static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
gpio_free(AC97_GPIO_TXFS);
mxc_iomux_v3_setup_pad(txfs);
 }
+EXPORT_SYMBOL(pcm043_ac97_warm_reset);
 
-static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
+void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
 {
iomux_v3_cfg_t txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
@@ -286,6 +288,7 @@ err1:
printk("%s failed with %d\n", __func__, ret);
mdelay(1);
 }
+EXPORT_SYMBOL(pcm043_ac97_cold_reset);
 
 static const struct imx_ssi_platform_data pcm043_ssi_pdata __initconst = {
.ac97_reset = pcm043_ac97_cold_reset,
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 04/10] ASoC: fsl-ssi: Add support for imx-pcm-fiq

2013-05-28 Thread Markus Pargmann
Add support for non-dma pcm for imx platforms with imx-pcm-fiq support.
Instead of imx-pcm-audio, in this case imx-pcm-fiq-audio device is added
and the SIER flags are set differently.

We need imx-pcm-fiq for some boards that use an incompatible codec.
imx-pcm-fiq handles those codecs differently and allows to operate with
them. DMA is not possible because some data sent by the codecs, e.g.
wm9712, is not in the datastream. Also some data is mixed up in the
fifos, so that we need to sort them out manually.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about the reason why we add a imx-pcm-fiq device.
 - Change commit message to include information about the usage of 
imx-pcm-fiq

Changes in v3:
 - Rename bool "dma" to "use_dma"

 sound/soc/fsl/fsl_ssi.c | 77 +
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2f2d837..cf20d6d 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -8,6 +8,26 @@
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
  * kind, whether express or implied.
+ *
+ *
+ * Some notes why imx-pcm-fiq is used instead of DMA on some boards:
+ *
+ * The i.MX SSI core has some nasty limitations in AC97 mode. While most
+ * sane processor vendors have a FIFO per AC97 slot, the i.MX has only
+ * one FIFO which combines all valid receive slots. We cannot even select
+ * which slots we want to receive. The WM9712 with which this driver
+ * was developed with always sends GPIO status data in slot 12 which
+ * we receive in our (PCM-) data stream. The only chance we have is to
+ * manually skip this data in the FIQ handler. With sampling rates different
+ * from 48000Hz not every frame has valid receive data, so the ratio
+ * between pcm data and GPIO status data changes. Our FIQ handler is not
+ * able to handle this, hence this driver only works with 48000Hz sampling
+ * rate.
+ * Reading and writing AC97 registers is another challenge. The core
+ * provides us status bits when the read register is updated with *another*
+ * value. When we read the same register two times (and the register still
+ * contains the same value) these status bits are not set. We work
+ * around this by not polling these bits but only wait a fixed delay.
  */
 
 #include 
@@ -121,11 +141,13 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
struct {
unsigned int rfrc;
@@ -355,7 +377,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream 
*substream,
 */
 
/* Enable the interrupts and DMA requests */
-   write_ssi(SIER_FLAGS, &ssi->sier);
+   if (ssi_private->use_dma)
+   write_ssi(SIER_FLAGS, &ssi->sier);
+   else
+   write_ssi(CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TFE0_EN |
+   CCSR_SSI_SIER_RIE |
+   CCSR_SSI_SIER_RFF0_EN, &ssi->sier);
 
/*
 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -549,7 +576,7 @@ static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
 {
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
 
-   if (ssi_private->ssi_on_imx) {
+   if (ssi_private->ssi_on_imx && ssi_private->use_dma) {
dai->playback_dma_data = &ssi_private->dma_params_tx;
dai->capture_dma_data = &ssi_private->dma_params_rx;
}
@@ -694,6 +721,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
   sizeof(fsl_ssi_dai_template));
ssi_private->cpu_dai_drv.name = ssi_private->name;
 
+   ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
+
/* Get the addresses and IRQ */
ret = of_address_to_resource(np, 0, &res);
if (ret) {
@@ -715,12 +744,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
goto error_iomap;
}
 
-   /* The 'name' should not have any slashes in it. */
-   ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
- ssi_private);
-   if (ret < 0) {
-   dev_err(&pdev->dev, "could not claim irq %u\n", 
ssi_private->irq);
-   goto error_irqmap;
+   if (ssi_p

[PATCH v6 08/10] ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97

2013-05-28 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 7860cc2..8528466 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -148,7 +148,7 @@ config SND_SOC_PHYCORE_AC97
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
select SND_SOC_IMX_AUDMUX
-   select SND_SOC_IMX_SSI
+   select SND_SOC_FSL_SSI
help
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 01/10] ASoC: phycore-ac97: Add DT support

2013-05-28 Thread Markus Pargmann
Add devicetree support for this audio soc fabric driver.

platform_of_node and cpu_of_node are set according to the fsl,audmux
phandle.

This patch adds handling of ac97 reset functions according to fsl ac97
support. They are setup from here to avoid board specific code in the
generic fsl-ssi driver.

This patch changes the handling of pca100 boards from non-DT to DT only.
pcm043 is still handled without DT.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - phycore-ac97 now manages the ac97 reset functions of the boards using
   this combination of ssi-codec.
 - Removed preprocessor ifs for DT, non-DT distinction. pcm043 is now
   non-DT only and pca100 DT only.

Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to imx27-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

 .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
 sound/soc/fsl/phycore-ac97.c   | 241 ++---
 2 files changed, 229 insertions(+), 26 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt

diff --git a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
new file mode 100644
index 000..41201ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
@@ -0,0 +1,14 @@
+Phytec phycore AC97
+
+Required properties:
+- compatible: "phytec,phycore-ac97"
+- phytec,ssi: A phandle to the ssi device that is connected to ac97.
+- phytec,audmux: A phandle to the audmux device.
+
+Example:
+
+sound {
+   compatible = "phytec,phycore-ac97";
+   phytec,ssi = <&ssi1>;
+   phytec,audmux = <&audmux>;
+};
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
index ae403c2..bf2c600 100644
--- a/sound/soc/fsl/phycore-ac97.c
+++ b/sound/soc/fsl/phycore-ac97.c
@@ -20,8 +20,14 @@
 #include 
 
 #include "imx-audmux.h"
+#include "fsl_ssi.h"
+
+#define DRV_NAME "phycore-audio-fabric"
 
 static struct snd_soc_card imx_phycore;
+static struct device_node *phycore_dai_cpu_node;
+static void (*phycore_ac97_reset) (struct snd_ac97 *ac97);
+static void (*phycore_ac97_warm_reset)(struct snd_ac97 *ac97);
 
 static struct snd_soc_ops imx_phycore_hifi_ops = {
 };
@@ -32,12 +38,12 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
.stream_name= "HiFi",
.codec_dai_name = "wm9712-hifi",
.codec_name = "wm9712-codec",
-   .cpu_dai_name   = "imx-ssi.0",
-   .platform_name  = "imx-ssi.0",
.ops= &imx_phycore_hifi_ops,
},
 };
 
+static const char phycore_ac97_plat_name[] = "imx-ssi.0";
+
 static struct snd_soc_card imx_phycore = {
.name   = "PhyCORE-ac97-audio",
.owner  = THIS_MODULE,
@@ -45,40 +51,52 @@ static struct snd_soc_card imx_phycore = {
.num_links  = ARRAY_SIZE(imx_phycore_dai_ac97),
 };
 
-static struct platform_device *imx_phycore_snd_ac97_device;
+static void phycore_ac97_imx21_audmux(void)
+{
+   imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
+   IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
+   IMX_AUDMUX_V1_PCR_TFCSEL(3) |
+   IMX_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
+   IMX_AUDMUX_V1_PCR_RXDSEL(3));
+   imx_audmux_v1_configure_port(3,
+   IMX_AUDMUX_V1_PCR_SYN | /* 4wire m

[PATCH v6 03/10] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-05-28 Thread Markus Pargmann
Cleaner parameter passing for imx-pcm-fiq. Create a seperated fiq-params
struct to pass all arguments.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, the imx_pcm_fiq_params are 
now
   passed as function arguments instead of platform driver data.

Changes in v3:
 - Using snd_dmaengine_dai_dma_data for dma_params after rebasing onto
   dmaengine cleanups.

 sound/soc/fsl/imx-pcm-fiq.c | 18 ++
 sound/soc/fsl/imx-pcm.h | 12 +++-
 sound/soc/fsl/imx-ssi.c |  7 ++-
 sound/soc/fsl/imx-ssi.h |  1 +
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 310d902..3b2ba99 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 
 #include "imx-ssi.h"
+#include "imx-pcm.h"
 
 struct imx_pcm_runtime_data {
unsigned int period;
@@ -366,9 +368,9 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq 
= {
.pcm_free   = imx_pcm_fiq_free,
 };
 
-int imx_pcm_fiq_init(struct platform_device *pdev)
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params)
 {
-   struct imx_ssi *ssi = platform_get_drvdata(pdev);
int ret;
 
ret = claim_fiq(&fh);
@@ -377,15 +379,15 @@ int imx_pcm_fiq_init(struct platform_device *pdev)
return ret;
}
 
-   mxc_set_irq_fiq(ssi->irq, 1);
-   ssi_irq = ssi->irq;
+   mxc_set_irq_fiq(params->irq, 1);
+   ssi_irq = params->irq;
 
-   imx_pcm_fiq = ssi->irq;
+   imx_pcm_fiq = params->irq;
 
-   imx_ssi_fiq_base = (unsigned long)ssi->base;
+   imx_ssi_fiq_base = (unsigned long)params->base;
 
-   ssi->dma_params_tx.maxburst = 4;
-   ssi->dma_params_rx.maxburst = 6;
+   params->dma_params_tx->maxburst = 4;
+   params->dma_params_rx->maxburst = 6;
 
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
if (ret)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index 67f656c..9695ed0 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -32,6 +32,15 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
dma_data->peripheral_type = IMX_DMATYPE_SSI;
 }
 
+struct imx_pcm_fiq_params {
+   int irq;
+   void __iomem *base;
+
+   /* Pointer to original ssi driver to setup tx rx sizes */
+   struct snd_dmaengine_dai_dma_data *dma_params_rx;
+   struct snd_dmaengine_dai_dma_data *dma_params_tx;
+};
+
 #ifdef CONFIG_SND_SOC_IMX_PCM_DMA
 int imx_pcm_dma_init(struct platform_device *pdev);
 void imx_pcm_dma_exit(struct platform_device *pdev);
@@ -47,7 +56,8 @@ static inline void imx_pcm_dma_exit(struct platform_device 
*pdev)
 #endif
 
 #ifdef CONFIG_SND_SOC_IMX_PCM_FIQ
-int imx_pcm_fiq_init(struct platform_device *pdev);
+int imx_pcm_fiq_init(struct platform_device *pdev,
+   struct imx_pcm_fiq_params *params);
 void imx_pcm_fiq_exit(struct platform_device *pdev);
 #else
 static inline int imx_pcm_fiq_init(struct platform_device *pdev)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index a8362be..16ae16d 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -590,7 +590,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_register;
}
 
-   ret = imx_pcm_fiq_init(pdev);
+   ssi->fiq_params.irq = ssi->irq;
+   ssi->fiq_params.base = ssi->base;
+   ssi->fiq_params.dma_params_rx = &ssi->dma_params_rx;
+   ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
+
+   ret = imx_pcm_fiq_init(pdev, &ssi->fiq_params);
if (ret)
goto failed_pcm_fiq;
 
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index d5003ce..fb1616b 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -209,6 +209,7 @@ struct imx_ssi {
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
int enabled;
 };
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 09/10] ASoC: fsl: Move fsl-ssi binding doc to sound/

2013-05-28 Thread Markus Pargmann
fsl-ssi was located in powerpc/fsl/ssi.txt. This is no powerpc specific
device, so it should be moved to sound/ as it connects to differen audio
codecs.

Signed-off-by: Markus Pargmann 
---
 .../devicetree/bindings/powerpc/fsl/ssi.txt| 73 --
 .../devicetree/bindings/sound/fsl,ssi.txt  | 73 ++
 2 files changed, 73 insertions(+), 73 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
 create mode 100644 Documentation/devicetree/bindings/sound/fsl,ssi.txt

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
deleted file mode 100644
index 5ff76c9..000
--- a/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-Freescale Synchronous Serial Interface
-
-The SSI is a serial device that communicates with audio codecs.  It can
-be programmed in AC97, I2S, left-justified, or right-justified modes.
-
-Required properties:
-- compatible:   Compatible list, contains "fsl,ssi".
-- cell-index:   The SSI, <0> = SSI1, <1> = SSI2, and so on.
-- reg:  Offset and length of the register set for the device.
-- interrupts:where a is the interrupt number and b is a
-field that represents an encoding of the sense and
-level information for the interrupt.  This should be
-encoded based on the information in section 2)
-depending on the type of interrupt controller you
-have.
-- interrupt-parent: The phandle for the interrupt controller that
-services interrupts for this device.
-- fsl,mode: The operating mode for the SSI interface.
-"i2s-slave" - I2S mode, SSI is clock slave
-"i2s-master" - I2S mode, SSI is clock master
-"lj-slave" - left-justified mode, SSI is clock slave
-"lj-master" - l.j. mode, SSI is clock master
-"rj-slave" - right-justified mode, SSI is clock slave
-"rj-master" - r.j., SSI is clock master
-"ac97-slave" - AC97 mode, SSI is clock slave
-"ac97-master" - AC97 mode, SSI is clock master
-- fsl,playback-dma: Phandle to a node for the DMA channel to use for
-playback of audio.  This is typically dictated by SOC
-design.  See the notes below.
-- fsl,capture-dma:  Phandle to a node for the DMA channel to use for
-capture (recording) of audio.  This is typically dictated
-by SOC design.  See the notes below.
-- fsl,fifo-depth:   The number of elements in the transmit and receive FIFOs.
-This number is the maximum allowed value for SFCSR[TFWM0].
-- fsl,ssi-asynchronous:
-If specified, the SSI is to be programmed in asynchronous
-mode.  In this mode, pins SRCK, STCK, SRFS, and STFS must
-all be connected to valid signals.  In synchronous mode,
-SRCK and SRFS are ignored.  Asynchronous mode allows
-playback and capture to use different sample sizes and
-sample rates.  Some drivers may require that SRCK and STCK
-be connected together, and SRFS and STFS be connected
-together.  This would still allow different sample sizes,
-but not different sample rates.
-
-Optional properties:
-- codec-handle: Phandle to a 'codec' node that defines an audio
-codec connected to this SSI.  This node is typically
-a child of an I2C or other control node.
-
-Child 'codec' node required properties:
-- compatible:   Compatible list, contains the name of the codec
-
-Child 'codec' node optional properties:
-- clock-frequency:  The frequency of the input clock, which typically comes
-from an on-board dedicated oscillator.
-
-Notes on fsl,playback-dma and fsl,capture-dma:
-
-On SOCs that have an SSI, specific DMA channels are hard-wired for playback
-and capture.  On the MPC8610, for example, SSI1 must use DMA channel 0 for
-playback and DMA channel 1 for capture.  SSI2 must use DMA channel 2 for
-playback and DMA channel 3 for capture.  The developer can choose which
-DMA controller to use, but the channels themselves are hard-wired.  The
-purpose of these two properties is to represent this hardware design.
-
-The device tree nodes for the DMA channels that are referenced by
-"fsl,playback-dma" and "fsl,capture-dma" must be marked as compatible with
-"fsl,ssi-dma-channel".  The SOC-specific compatible string (e.g.
-"fsl,mpc8610-dm

[PATCH v6 02/10] ASoC: imx-pcm-dma: DT support

2013-05-28 Thread Markus Pargmann
This patch removes the NO_DT flag. The pdev pointer may have a proper
of_node with the dmas property, so we can use it to request DMA
channels.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - After rebasing onto Shawn's imx-pcm cleanups, this patch just consists of
   removing the NO_DT flag.

Changes in v5:
 - Use dev.parent pointer to get the of_node.

 sound/soc/fsl/imx-pcm-dma.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index fde4d2e..f323ce0 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -64,7 +64,6 @@ int imx_pcm_dma_init(struct platform_device *pdev)
 {
return snd_dmaengine_pcm_register(&pdev->dev, &imx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-   SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT);
 }
 EXPORT_SYMBOL_GPL(imx_pcm_dma_init);
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 05/10] ASoC: fsl-ssi: Use generic DMA bindings if possible

2013-05-28 Thread Markus Pargmann
There may be some platforms using fsl-ssi that do not have a DMA driver
with generic DMA bindings. So this patch adds support for the generic
DMA bindings, while still accepting the old "fsl,dma-events" property if
"dmas" is not found.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v5:
 - Not passing of_node now, instead setting the parent device

Changes in v4:
 - Change TODO comment to a FIXME, to remove the old dma-events property as 
soon
   as all dma drivers support the generic DMA bindings.

 sound/soc/fsl/fsl_ssi.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index cf20d6d..be2a98b 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -795,15 +795,19 @@ static int fsl_ssi_probe(struct platform_device *pdev)
&ssi_private->filter_data_tx;
ssi_private->dma_params_rx.filter_data =
&ssi_private->filter_data_rx;
-   /*
-* TODO: This is a temporary solution and should be changed
-* to use generic DMA binding later when the helplers get in.
-*/
-   ret = of_property_read_u32_array(pdev->dev.of_node,
+   if (!of_property_read_bool(pdev->dev.of_node, "dmas") &&
+   ssi_private->use_dma) {
+   /*
+* FIXME: This is a temporary solution until all
+* necessary dma drivers support the generic dma
+* bindings.
+*/
+   ret = of_property_read_u32_array(pdev->dev.of_node,
"fsl,ssi-dma-events", dma_events, 2);
-   if (ret && !ssi_private->use_dma) {
-   dev_err(&pdev->dev, "could not get dma events\n");
-   goto error_clk;
+   if (ret && ssi_private->use_dma) {
+   dev_err(&pdev->dev, "could not get dma events 
but fsl-ssi is configured to use DMA\n");
+   goto error_clk;
+   }
}
 
shared = of_device_is_compatible(of_get_parent(np),
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 07/10] ASoC: fsl-ssi: imx ac97 support

2013-05-28 Thread Markus Pargmann
This patch copies some parts from imx-ssi to support AC97 on
imx27-pca100 and imx35-pcm043. This is a implementation of the
ac97-slave mode.

For ac97, the registers have to be setup earlier than for other ssi
modes because there is some communication with the external device
before actual streaming. So this patch introduces a fsl_ssi_setup
function to setup the registers at different times.

To seperate board specific ac97 reset functions, ac97 read/write
functions are exported. The reset functions are set by other drivers.

This patch was tested with imx27-pca100.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v6:
 - ac97 reset functions are not provided by fsl-ssi code anymore. They were
   moved to board specific code like phycore-ac97. Therefore ac97 read/write
   functions are exported and a helper function to set the soc_ac97_ops 
reset
   functions was created.

Changes in v3:
 - Cleanup ac97 code by adding a fsl_ssi_setup function for initial register
   setup. For ac97 the registers have to be setup earlier than in normal
   mode.

 sound/soc/fsl/fsl_ssi.c | 362 ++--
 sound/soc/fsl/fsl_ssi.h |   7 +
 2 files changed, 297 insertions(+), 72 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index be2a98b..8c58e0e 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -141,6 +141,7 @@ struct fsl_ssi_private {
 
bool new_binding;
bool ssi_on_imx;
+   bool imx_ac97;
bool use_dma;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -320,6 +321,124 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
return ret;
 }
 
+static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
+{
+   struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+   u8 i2s_mode;
+   u8 wm;
+   int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
+
+   if (ssi_private->imx_ac97)
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+   else
+   i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+
+   /*
+* Section 16.5 of the MPC8610 reference manual says that the SSI needs
+* to be disabled before updating the registers we set here.
+*/
+   write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
+
+   /*
+* Program the SSI into I2S Slave Non-Network Synchronous mode. Also
+* enable the transmit and receive FIFO.
+*
+* FIXME: Little-endian samples require a different shift dir
+*/
+   write_ssi_mask(&ssi->scr,
+   CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
+   CCSR_SSI_SCR_TFR_CLK_DIS |
+   i2s_mode |
+   (synchronous ? CCSR_SSI_SCR_SYN : 0));
+
+   write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
+CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
+CCSR_SSI_STCR_TSCKP, &ssi->stcr);
+
+   write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
+CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
+CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
+   /*
+* The DC and PM bits are only used if the SSI is the clock master.
+*/
+
+   /*
+* Set the watermark for transmit FIFI 0 and receive FIFO 0. We don't
+* use FIFO 1. We program the transmit water to signal a DMA transfer
+* if there are only two (or fewer) elements left in the FIFO. Two
+* elements equals one frame (left channel, right channel). This value,
+* however, depends on the depth of the transmit buffer.
+*
+* We set the watermark on the same level as the DMA burstsize.  For
+* fiq it is probably better to use the biggest possible watermark
+* size.
+*/
+   if (ssi_private->use_dma)
+   wm = ssi_private->fifo_depth - 2;
+   else
+   wm = ssi_private->fifo_depth;
+
+   write_ssi(CCSR_SSI_SFCSR_TFWM0(wm) | CCSR_SSI_SFCSR_RFWM0(wm) |
+   CCSR_SSI_SFCSR_TFWM1(wm) | CCSR_SSI_SFCSR_RFWM1(wm),
+   &ssi->sfcsr);
+
+   /*
+* For non-ac97 setups, we keep the SSI disabled because if we enable
+* it, then the DMA controller will start. It's not supposed to start
+* until the SCR.TE (or SCR.RE) bit is set, but it does anyway. The DMA
+* controller will transfer one "BWC" of data (i.e. the amount of data
+* that the MR.BWC bits are set to). The reason this is bad is because
+* at this point, the PCM driver has not finished initializing the DMA
+* controller.
+*/
+
+
+   /*
+* For ac97 interrupts are enabled with the startup of the substream
+* because it is also running without an active substream. Normally SSI
+* is only enabled 

[PATCH v6 10/10] ASoC: fsl: Update fsl-ssi binding doc

2013-05-28 Thread Markus Pargmann
Update the fsl-ssi bindings. DMA is no required property anymore and
uses the generic DMA bindings. imx-fiq is a new alternative to DMA

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - Add a comment about hardware bugs for imx-pcm-fiq

Changes in v3:
 - In previous versions, I removed fsl,playback-dma and capture-dma. But 
they
   are still in use by fsl_dma.c, so I added them again.

 Documentation/devicetree/bindings/sound/fsl,ssi.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
index 5ff76c9..0375ee0 100644
--- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
+++ b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
@@ -43,10 +43,20 @@ Required properties:
 together.  This would still allow different sample sizes,
 but not different sample rates.
 
+Note that either dmas, dma-names or fsl,imx-fiq are required.
+
 Optional properties:
 - codec-handle: Phandle to a 'codec' node that defines an audio
 codec connected to this SSI.  This node is typically
 a child of an I2C or other control node.
+- dmas:Generic dma devicetree binding as described in
+   Documentation/devicetree/bindings/dma/dma.txt.
+- dma-names:   Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
+   is not defined.
+- fsl,imx-fiq: Bool property. Use imx-pcm-fiq instead of imx-pcm-dma.
+   Only necessary for some boards with incompatible
+   codec. imx-pcm-fiq will manually filter some data from
+   the codec. It is a workaround for a hardware bug.
 
 Child 'codec' node required properties:
 - compatible:   Compatible list, contains the name of the codec
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6 00/10] ASoC: fsl-ssi: ac97-slave support

2013-05-28 Thread Markus Pargmann
Hi,

This series adds DT support for phycore-ac97. Beside ac97 support, the series
adds imx-pcm-fiq and generic DMA bindings to fsl-ssi.

Regards,

Markus

Changes in v6:
 - Rebased onto 3.10-rc3 with Shawn's pcm cleanup patches
 - Setup of reset functions moved to phycore-ac97.c

Changes in v5:
 - Pass of_node via parent device to imx-pcm-dma.

Changes in v4:
 - phycore-ac97 uses the iomux functions based on audmux phandle now.
 - fsl-ssi imx-pcm-fiq got some new comments about problems with imx-ssi and
   incompatible codecs

Changes in v3:
 - Rebased onto pcm dma cleanup patches
 - A lot of cleanups for the fsl-ssi ac97 integration
 - Some small changes which are listed in the notes of the patches.

Markus Pargmann (10):
  ASoC: phycore-ac97: Add DT support
  ASoC: imx-pcm-dma: DT support
  ASoC: imx-pcm-fiq: Introduce pcm-fiq-params
  ASoC: fsl-ssi: Add support for imx-pcm-fiq
  ASoC: fsl-ssi: Use generic DMA bindings if possible
  ARM: imx: Export ac97 reset functions
  ASoC: fsl-ssi: imx ac97 support
  ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97
  ASoC: fsl: Move fsl-ssi binding doc to sound/
  ASoC: fsl: Update fsl-ssi binding doc

 .../{powerpc/fsl/ssi.txt => sound/fsl,ssi.txt} |  10 +
 .../bindings/sound/phytec,phycore-ac97.txt |  14 +
 arch/arm/mach-imx/mach-pca100.c|   7 +-
 arch/arm/mach-imx/mach-pcm043.c|   7 +-
 sound/soc/fsl/Kconfig  |   2 +-
 sound/soc/fsl/fsl_ssi.c| 441 +
 sound/soc/fsl/fsl_ssi.h|   7 +
 sound/soc/fsl/imx-pcm-dma.c|   1 -
 sound/soc/fsl/imx-pcm-fiq.c|  18 +-
 sound/soc/fsl/imx-pcm.h|  12 +-
 sound/soc/fsl/imx-ssi.c|   7 +-
 sound/soc/fsl/imx-ssi.h|   1 +
 sound/soc/fsl/phycore-ac97.c   | 241 +--
 13 files changed, 643 insertions(+), 125 deletions(-)
 rename Documentation/devicetree/bindings/{powerpc/fsl/ssi.txt => 
sound/fsl,ssi.txt} (88%)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt


___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v6] video: imxfb: Add DT support

2013-05-26 Thread Markus Pargmann
Add devicetree support for imx framebuffer driver. It uses the generic
display bindings and helper functions.

Signed-off-by: Markus Pargmann 
Cc: Fabio Estevam 
Cc: Mark Rutland 
Acked-by: Jean-Christophe PLAGNIOL-VILLARD 
---

Notes:
Changed in v6:
- Rebased onto v3.10-rc2
- Dropped alpha support patch in this series

Changed in v5:
- Fix compatible property of the example
- Rename property fsl,bpp to bits-per-pixel
- Add selects for FB_MODE_HELPERS and VIDEOMODE_HELPERS to Kconfig FB_IMX

Changes in v4:
- Remove eukrea specific dmacr property.
- Add optional dmacr property. If not present, the dmacr reset value is not
  changed.

Changes in v3:
- Fix returncodes of of_read_mode function and print error messages
- Introduce a lower bound check for bits per pixel
- Calculate correct bytes per pixel value before using it for the 
calculation of
memory size
- Change DT property names

Changes in v2:
- Removed pwmr register property
- Cleanup of devicetree binding documentation
- Use default values for pwmr and lscr1

 .../devicetree/bindings/video/fsl,imx-fb.txt   |  51 ++
 drivers/video/Kconfig  |   2 +
 drivers/video/imxfb.c  | 194 +
 3 files changed, 212 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/fsl,imx-fb.txt

diff --git a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt 
b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
new file mode 100644
index 000..46da08d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
@@ -0,0 +1,51 @@
+Freescale imx21 Framebuffer
+
+This framebuffer driver supports devices imx1, imx21, imx25, and imx27.
+
+Required properties:
+- compatible : "fsl,-fb", chip should be imx1 or imx21
+- reg : Should contain 1 register ranges(address and length)
+- interrupts : One interrupt of the fb dev
+
+Required nodes:
+- display: Phandle to a display node as described in
+   Documentation/devicetree/bindings/video/display-timing.txt
+   Additional, the display node has to define properties:
+   - bits-per-pixel: Bits per pixel
+   - fsl,pcr: LCDC PCR value
+
+Optional properties:
+- fsl,dmacr: DMA Control Register value. This is optional. By default, the
+   register is not modified as recommended by the datasheet.
+- fsl,lscr1: LCDC Sharp Configuration Register value.
+
+Example:
+
+   imxfb: fb@10021000 {
+   compatible = "fsl,imx21-fb";
+   interrupts = <61>;
+   reg = <0x10021000 0x1000>;
+   display = <&display0>;
+   };
+
+   ...
+
+   display0: display0 {
+   model = "Primeview-PD050VL1";
+   native-mode = <&timing_disp0>;
+   bits-per-pixel = <16>;
+   fsl,pcr = <0xf0c88080>; /* non-standard but required */
+   display-timings {
+   timing_disp0: 640x480 {
+   hactive = <640>;
+   vactive = <480>;
+   hback-porch = <112>;
+   hfront-porch = <36>;
+   hsync-len = <32>;
+   vback-porch = <33>;
+   vfront-porch = <33>;
+   vsync-len = <2>;
+   clock-frequency = <2500>;
+   };
+   };
+   };
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d71d60f..588af1d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -367,6 +367,8 @@ config FB_IMX
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
+   select FB_MODE_HELPERS
+   select VIDEOMODE_HELPERS
 
 config FB_CYBER2000
tristate "CyberPro 2000/2010/5000 support"
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 0abf2bf..a2ed71d 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -31,6 +31,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
 
 #include 
 
@@ -112,10 +118,11 @@
 #define LCDISR_EOF (1<<1)
 #define LCDISR_BOF (1<<0)
 
+#define IMXFB_LSCR1_DEFAULT 0x00120300
+
 /* Used fb-mode. Can be set on kernel command line, therefore file-static. */
 static const char *fb_mode;
 
-
 /*
  * These are the bitfields for each
  * display depth that we support.
@@ -187,6 +194,19 @@ static struct platform_device_id imxfb_devtype[] = {
 };
 MODULE_DEVICE_TABLE(platform, imxfb_devtype);
 
+static struct of_device_id imxfb_of_dev_id[] = {
+   {
+   .compatible = "fsl,imx1-fb&qu

[PATCH v7 0/2] dma: imx-dma: OFTree support

2013-05-26 Thread Markus Pargmann
Hi,

this series adds support for the generic DMA DT bindings for imx-dma.

Regards,

Markus


Changes in v7:
 - rebased onto v3.10-rc2

Markus Pargmann (2):
  dma: imx-dma: Add oftree support
  DMA: imx-dma: imxdma->dev used uninitialized

 .../devicetree/bindings/dma/fsl-imx-dma.txt| 48 ++
 drivers/dma/imx-dma.c  | 77 +-
 include/linux/platform_data/dma-imx.h  |  6 +-
 3 files changed, 126 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 2/2] DMA: imx-dma: imxdma->dev used uninitialized

2013-05-26 Thread Markus Pargmann
imxdma->dev is used for dev_warn before it was set.

Signed-off-by: Markus Pargmann 
Reviewed-by: Shawn Guo 
---
 drivers/dma/imx-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 34c54cf..ff2aab9 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -1067,6 +1067,7 @@ static int __init imxdma_probe(struct platform_device 
*pdev)
if (!imxdma)
return -ENOMEM;
 
+   imxdma->dev = &pdev->dev;
imxdma->devtype = pdev->id_entry->driver_data;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1171,7 +1172,6 @@ static int __init imxdma_probe(struct platform_device 
*pdev)
  &imxdma->dma_device.channels);
}
 
-   imxdma->dev = &pdev->dev;
imxdma->dma_device.dev = &pdev->dev;
 
imxdma->dma_device.device_alloc_chan_resources = 
imxdma_alloc_chan_resources;
-- 
1.8.2.1

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v7 1/2] dma: imx-dma: Add oftree support

2013-05-26 Thread Markus Pargmann
Adding devicetree support for imx-dma driver. Use driver name for
function 'imx_dma_is_general_purpose' because the devicename for
devicetree initialized devices is different.

Signed-off-by: Markus Pargmann 
Reviewed-by: Arnd Bergmann 
Reviewed-by: Shawn Guo 
---

Notes:
Changes in V6:
- Style fixes in imxdma_xlate function, moved request assignment and removed
  unnecessary cast.

Changes in V5:
- Style fix
- Documentation reference

Changes in V4:
- Directly use "imxdma_channel" as proposed by Arnd. This removes the
allocation of imx_dma_data.
- Simplify function imx_dma_is_general_purpose using driver names.

Changes in V3:
- Create a imxdma translate function to pass the device object into the
filter function.

Changes in V2:
- Change the driver to use generic DMA DT bindings.
- Add a imx-dma filter function that sets the dma request line in
  private data.

 .../devicetree/bindings/dma/fsl-imx-dma.txt| 48 ++
 drivers/dma/imx-dma.c  | 75 ++
 include/linux/platform_data/dma-imx.h  |  6 +-
 3 files changed, 125 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-dma.txt

diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt 
b/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
new file mode 100644
index 000..2717ecb
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/fsl-imx-dma.txt
@@ -0,0 +1,48 @@
+* Freescale Direct Memory Access (DMA) Controller for i.MX
+
+This document will only describe differences to the generic DMA Controller and
+DMA request bindings as described in dma/dma.txt .
+
+* DMA controller
+
+Required properties:
+- compatible : Should be "fsl,-dma". chip can be imx1, imx21 or imx27
+- reg : Should contain DMA registers location and length
+- interrupts : First item should be DMA interrupt, second one is optional and
+should contain DMA Error interrupt
+- #dma-cells : Has to be 1. imx-dma does not support anything else.
+
+Optional properties:
+- #dma-channels : Number of DMA channels supported. Should be 16.
+- #dma-requests : Number of DMA requests supported.
+
+Example:
+
+   dma: dma@10001000 {
+   compatible = "fsl,imx27-dma";
+   reg = <0x10001000 0x1000>;
+   interrupts = <32 33>;
+   #dma-cells = <1>;
+   #dma-channels = <16>;
+   };
+
+
+* DMA client
+
+Clients have to specify the DMA requests with phandles in a list.
+
+Required properties:
+- dmas: List of one or more DMA request specifiers. One DMA request specifier
+consists of a phandle to the DMA controller followed by the integer
+specifiying the request line.
+- dma-names: List of string identifiers for the DMA requests. For the correct
+names, have a look at the specific client driver.
+
+Example:
+
+   sdhci1: sdhci@10013000 {
+   ...
+   dmas = <&dma 7>;
+   dma-names = "rx-tx";
+   ...
+   };
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index f285833..34c54cf 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -186,6 +188,11 @@ struct imxdma_engine {
enum imx_dma_type   devtype;
 };
 
+struct imxdma_filter_data {
+   struct imxdma_engine*imxdma;
+   int  request;
+};
+
 static struct platform_device_id imx_dma_devtype[] = {
{
.name = "imx1-dma",
@@ -202,6 +209,22 @@ static struct platform_device_id imx_dma_devtype[] = {
 };
 MODULE_DEVICE_TABLE(platform, imx_dma_devtype);
 
+static const struct of_device_id imx_dma_of_dev_id[] = {
+   {
+   .compatible = "fsl,imx1-dma",
+   .data = &imx_dma_devtype[IMX1_DMA],
+   }, {
+   .compatible = "fsl,imx21-dma",
+   .data = &imx_dma_devtype[IMX21_DMA],
+   }, {
+   .compatible = "fsl,imx27-dma",
+   .data = &imx_dma_devtype[IMX27_DMA],
+   }, {
+   /* sentinel */
+   }
+};
+MODULE_DEVICE_TABLE(of, imx_dma_of_dev_id);
+
 static inline int is_imx1_dma(struct imxdma_engine *imxdma)
 {
return imxdma->devtype == IMX1_DMA;
@@ -996,13 +1019,50 @@ static void imxdma_issue_pending(struct dma_chan *chan)
spin_unlock_irqrestore(&imxdma->lock, flags);
 }
 
+static bool imxdma_filter_fn(struct dma_chan *chan, void *param)
+{
+   struct imxdma_filter_data *fdata = param;
+   struct imxdma_channel *imxdma_chan = to_imxdma_chan(chan);
+
+   if (chan->device->dev != fdata->imxdma->dev)
+   return false;
+
+   imxdma_chan-&

Re: [PATCH v5 07/10] ASoC: fsl-ssi: imx ac97 support

2013-04-25 Thread Markus Pargmann
On Thu, Apr 25, 2013 at 11:50:30AM +0800, Shawn Guo wrote:
> On Wed, Apr 24, 2013 at 04:36:36PM +0200, Markus Pargmann wrote:
> > +/*
> > + * Pointer to AC97 reset functions for specific boards
> > + */
> > +#if IS_ENABLED(CONFIG_MACH_PCA100)
> > +extern void pca100_ac97_cold_reset(struct snd_ac97 *ac97);
> > +extern void pca100_ac97_warm_reset(struct snd_ac97 *ac97);
> > +#else
> > +void pca100_ac97_cold_reset(struct snd_ac97 *ac97) { }
> > +void pca100_ac97_warm_reset(struct snd_ac97 *ac97) { }
> > +#endif
> > +
> > +#if IS_ENABLED(CONFIG_MACH_PCM043)
> > +extern void pcm043_ac97_cold_reset(struct snd_ac97 *ac97);
> > +extern void pcm043_ac97_warm_reset(struct snd_ac97 *ac97);
> > +#else
> > +void pcm043_ac97_cold_reset(struct snd_ac97 *ac97) { }
> > +void pcm043_ac97_warm_reset(struct snd_ac97 *ac97) { }
> > +#endif
> ...
> > @@ -717,13 +956,39 @@ static int fsl_ssi_probe(struct platform_device *pdev)
> >  
> > strcpy(ssi_private->name, p);
> >  
> > -   /* Initialize this copy of the CPU DAI driver structure */
> > -   memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template,
> > -  sizeof(fsl_ssi_dai_template));
> > -   ssi_private->cpu_dai_drv.name = ssi_private->name;
> > -
> > ssi_private->use_dma = !of_property_read_bool(np, "fsl,imx-fiq");
> >  
> > +   if (ac97) {
> > +   sprop = of_get_property(of_find_node_by_path("/"), "compatible",
> > +   NULL);
> > +   p = strrchr(sprop, ',');
> > +   if (p)
> > +   sprop = p + 1;
> > +
> > +   if (!strcmp(sprop, "imx27-pca100")) {
> > +   ssi_private->ac97_reset = pca100_ac97_cold_reset;
> > +   ssi_private->ac97_warm_reset = pca100_ac97_warm_reset;
> > +   } else if (!strcmp(sprop, "imx27-pcm043")) {
> > +   ssi_private->ac97_reset = pcm043_ac97_cold_reset;
> > +   ssi_private->ac97_warm_reset = pcm043_ac97_warm_reset;
> > +   } else {
> > +   dev_err(&pdev->dev, "Failed to enable ssi AC97 mode, 
> > unknown board.\n");
> > +   ret = -EINVAL;
> > +   goto error_kmalloc;
> > +   }
> 
> I do not like these board specific hooks show up in an IP driver
> in such way.  Can we work it out in other ways, notification or even
> platform_data with auxdata?

soc_ac97_ops is a global symbol, so we could setup soc_ac97_ops.reset
and warm_reset in board specific ac97 drivers. For this patch I would
move the assignment of reset functions to phycore-ac97.c which already
is specifically for this codec-ssi combination on the two boards.

Regards,

Markus

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v5 01/10] ASoC: phycore-ac97: Add DT support

2013-04-25 Thread Markus Pargmann
On Thu, Apr 25, 2013 at 11:35:20AM +0800, Shawn Guo wrote:
> On Wed, Apr 24, 2013 at 09:45:40PM +0200, Sascha Hauer wrote:
> > Hi Markus,
> > 
> > On Wed, Apr 24, 2013 at 04:36:30PM +0200, Markus Pargmann wrote:
> > > Add devicetree support for this audio soc fabric driver.
> > > 
> > > @@ -32,8 +35,12 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] 
> > > = {
> > >   .stream_name= "HiFi",
> > >   .codec_dai_name = "wm9712-hifi",
> > >   .codec_name = "wm9712-codec",
> > > +#ifdef CONFIG_MACH_IMX27_DT
> > > + .platform_name  = "imx-fiq-pcm-audio",
> > > +#else
> > >   .cpu_dai_name   = "imx-ssi.0",
> > >   .platform_name  = "imx-fiq-pcm-audio.0",
> > > +#endif
> > 
> > This doesn't work properly. Compiling the kernel with IMX27_DT enabled
> > does not necessarily mean that it also started with dt support.
> > 
> Right, we should run-time check pdev->dev.of_node to see if it's a DT
> boot and set .platform_of_node rather than .platform_name if it is.  But
> it's only possible with the cleanup series "ASoC: fsl: imx-pcm driver
> cleanup" I just sent being the base.  I hope you can rebase your series
> on that :)

The current version of phycore-ac97.c is not a driver, it is just a late
init call. So run-time check is not possible unless I modify the old
part to be a driver and add a device to all board init functions using
ac97. (I would prefer dropping the non-DT part in this case ;) )

Yes I rebased this series onto your cleanups, looks good so far and
platform_of_node works finally.

Thanks,

Markus

> 
> Shawn
> 
> > Personally I am fine with removing platform based support for this
> > driver if it's too much effort to fix it properly, but we shouldn't
> > start working with ifdefs here.
> > 
> > Sascha
> > 
> > 
> > -- 
> > Pengutronix e.K.   | |
> > Industrial Linux Solutions | http://www.pengutronix.de/  |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
> > Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
> 
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v5 03/10] ASoC: imx-pcm-fiq: Introduce pcm-fiq-params

2013-04-24 Thread Markus Pargmann
Cleaner parameter passing for imx-pcm-fiq. Create a seperated fiq-params
struct to pass all arguments.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v3:
 - Using snd_dmaengine_dai_dma_data for dma_params after rebasing onto
   dmaengine cleanups.

 sound/soc/fsl/imx-pcm-fiq.c | 16 +---
 sound/soc/fsl/imx-pcm.h |  9 +
 sound/soc/fsl/imx-ssi.c |  7 ++-
 sound/soc/fsl/imx-ssi.h |  1 +
 4 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 670b96b..c3fdb2f 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +33,7 @@
 #include 
 
 #include "imx-ssi.h"
+#include "imx-pcm.h"
 
 struct imx_pcm_runtime_data {
unsigned int period;
@@ -283,7 +285,7 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq 
= {
 
 int imx_pcm_fiq_init(struct platform_device *pdev)
 {
-   struct imx_ssi *ssi = platform_get_drvdata(pdev);
+   struct imx_pcm_fiq_params *params = platform_get_drvdata(pdev);
int ret;
 
ret = claim_fiq(&fh);
@@ -292,15 +294,15 @@ int imx_pcm_fiq_init(struct platform_device *pdev)
return ret;
}
 
-   mxc_set_irq_fiq(ssi->irq, 1);
-   ssi_irq = ssi->irq;
+   mxc_set_irq_fiq(params->irq, 1);
+   ssi_irq = params->irq;
 
-   imx_pcm_fiq = ssi->irq;
+   imx_pcm_fiq = params->irq;
 
-   imx_ssi_fiq_base = (unsigned long)ssi->base;
+   imx_ssi_fiq_base = (unsigned long)params->base;
 
-   ssi->dma_params_tx.maxburst = 4;
-   ssi->dma_params_rx.maxburst = 6;
+   params->dma_params_tx->maxburst = 4;
+   params->dma_params_rx->maxburst = 6;
 
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
if (ret)
diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
index b7fa0d7..f592f23 100644
--- a/sound/soc/fsl/imx-pcm.h
+++ b/sound/soc/fsl/imx-pcm.h
@@ -32,6 +32,15 @@ imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
dma_data->peripheral_type = IMX_DMATYPE_SSI;
 }
 
+struct imx_pcm_fiq_params {
+   int irq;
+   void __iomem *base;
+
+   /* Pointer to original ssi driver to setup tx rx sizes */
+   struct snd_dmaengine_dai_dma_data *dma_params_rx;
+   struct snd_dmaengine_dai_dma_data *dma_params_tx;
+};
+
 int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
 struct vm_area_struct *vma);
 int imx_pcm_new(struct snd_soc_pcm_runtime *rtd);
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 902fab0..f80f4c7 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -601,7 +601,12 @@ static int imx_ssi_probe(struct platform_device *pdev)
goto failed_pdev_fiq_alloc;
}
 
-   platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
+   ssi->fiq_params.irq = ssi->irq;
+   ssi->fiq_params.base = ssi->base;
+   ssi->fiq_params.dma_params_rx = &ssi->dma_params_rx;
+   ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx;
+
+   platform_set_drvdata(ssi->soc_platform_pdev_fiq, &ssi->fiq_params);
ret = platform_device_add(ssi->soc_platform_pdev_fiq);
if (ret) {
dev_err(&pdev->dev, "failed to add platform device\n");
diff --git a/sound/soc/fsl/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
index bb6b3db..20ce7ca 100644
--- a/sound/soc/fsl/imx-ssi.h
+++ b/sound/soc/fsl/imx-ssi.h
@@ -209,6 +209,7 @@ struct imx_ssi {
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct imx_dma_data filter_data_tx;
struct imx_dma_data filter_data_rx;
+   struct imx_pcm_fiq_params fiq_params;
 
int enabled;
 
-- 
1.8.1.5

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v5 01/10] ASoC: phycore-ac97: Add DT support

2013-04-24 Thread Markus Pargmann
Add devicetree support for this audio soc fabric driver.

DT initialized drivers do not have real device ids, so
imx-pcm-fiq-audio.0 is used without '.0'.

This patch also simplifies the way audmux ports are configured. Before
there was knowledge about the used board. As the audmux driver knows the
used board, we know use the returned errorcodes to correctly set the
audmux port. So this driver does not have to know which board it is
running on.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v4:
 - New property phytec,audmux to check which audmux setup should be
   executed. Checking for fsl,imx21-audmux and fsl,imx31-audmux.

Changes in v3:
 - Add some more information in the commit message.

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to phycore-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

Changes in v2:
 - Simplify the driver, by combining audmux port configurations. The
   audmux driver actually knows on which platform he is running and
   will return the appropriate error code if we use functions for
   another platform. So we don't need to have the knowledge about it
   in phycore-ac97 and can try both functions. This removes the need
   of different compatibilities and renames it to imx27-ac97.
 - Use a phandle for the cpu_dai link.
 - Add devicetree binding documentation.
 - Rename binding to phytec,phycore-ac97 and fsl,ssi to phytec,ssi

 .../bindings/sound/phytec,phycore-ac97.txt |  14 ++
 sound/soc/fsl/phycore-ac97.c   | 166 ++---
 2 files changed, 158 insertions(+), 22 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt

diff --git a/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt 
b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
new file mode 100644
index 000..41201ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/phytec,phycore-ac97.txt
@@ -0,0 +1,14 @@
+Phytec phycore AC97
+
+Required properties:
+- compatible: "phytec,phycore-ac97"
+- phytec,ssi: A phandle to the ssi device that is connected to ac97.
+- phytec,audmux: A phandle to the audmux device.
+
+Example:
+
+sound {
+   compatible = "phytec,phycore-ac97";
+   phytec,ssi = <&ssi1>;
+   phytec,audmux = <&audmux>;
+};
diff --git a/sound/soc/fsl/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
index f8da6dd..d9f3ac7 100644
--- a/sound/soc/fsl/phycore-ac97.c
+++ b/sound/soc/fsl/phycore-ac97.c
@@ -21,7 +21,10 @@
 
 #include "imx-audmux.h"
 
+#define DRV_NAME "phycore-audio-fabric"
+
 static struct snd_soc_card imx_phycore;
+static struct device_node *phycore_dai_cpu_node;
 
 static struct snd_soc_ops imx_phycore_hifi_ops = {
 };
@@ -32,8 +35,12 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
.stream_name= "HiFi",
.codec_dai_name = "wm9712-hifi",
.codec_name = "wm9712-codec",
+#ifdef CONFIG_MACH_IMX27_DT
+   .platform_name  = "imx-fiq-pcm-audio",
+#else
.cpu_dai_name   = "imx-ssi.0",
.platform_name  = "imx-fiq-pcm-audio.0",
+#endif
.ops= &imx_phycore_hifi_ops,
},
 };
@@ -45,35 +52,48 @@ static struct snd_soc_card imx_phycore = {
.num_links  = ARRAY_SIZE(imx_phycore_dai_ac97),
 };
 
-static struct platform_device *imx_phycore_snd_ac97_device;
+static void phycore_ac97_imx21_audmux(void)
+{
+   imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
+   IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
+   IMX_AUDMUX_V1_PCR_TFCSEL(3) |
+   IMX_AUDMUX_V1_PCR_TCLKDIR | /* clock is output */
+   IMX_AUDMUX_V1_PCR_RXDSEL(3));
+   imx_audmux_v1_configure_port(3,
+   IMX_AUDMUX_V1_PCR_SYN | /* 4wire mode */
+   IMX_AUDMUX_V1_PCR_TFCSEL(0) |
+   IMX_AUDMUX_V1_PCR_TFSDIR |
+   IMX_AUDMUX_V1_PCR_RXDSEL(0));
+}
+
+static void phycore_ac97_imx31_audmux(void)
+{
+   imx_audmux_v2_configure_port(3,
+   IMX_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
+   IMX_AUDMUX_V2_PTCR_TFSEL(0) |
+   IMX_AUDMUX_V2_PTCR_TFSDIR,
+   IMX_AUDMUX_V2_PDCR_RXDSEL(0));
+   imx_audmux_v2_configure_port(0,
+ 

[PATCH v5 02/10] ASoC: imx-pcm-dma: DT support

2013-04-24 Thread Markus Pargmann
This patch adds the possibility to pass a of_node as platform_data which
is used by generic-pcm-dma to request a DMA slave channel.

Signed-off-by: Markus Pargmann 
---

Notes:
Changes in v5:
 - Use dev.parent pointer to get the of_node.

 sound/soc/fsl/imx-pcm-dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index c246fb5..f9577e1 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -62,9 +62,11 @@ static const struct snd_dmaengine_pcm_config 
imx_dmaengine_pcm_config = {
 
 int imx_pcm_dma_init(struct platform_device *pdev)
 {
+   if (pdev->dev.parent)
+   pdev->dev.of_node = pdev->dev.parent->of_node;
+
return snd_dmaengine_pcm_register(&pdev->dev, &imx_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
-   SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT);
 }
 
-- 
1.8.1.5

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH v5 08/10] ASoC: fsl: Kconfig: Use fsl-ssi for phycore-ac97

2013-04-24 Thread Markus Pargmann
Signed-off-by: Markus Pargmann 
---
 sound/soc/fsl/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 3843a18..28af843 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -153,7 +153,7 @@ config SND_SOC_PHYCORE_AC97
select SND_SOC_WM9712
select SND_SOC_IMX_PCM_FIQ
select SND_SOC_IMX_AUDMUX
-   select SND_SOC_IMX_SSI
+   select SND_SOC_FSL_SSI
help
  Say Y if you want to add support for SoC audio on Phytec phyCORE
  and phyCARD boards in AC97 mode
-- 
1.8.1.5

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


  1   2   3   >