[PATCH] powerpc/pcm030: add pcm030-audio-fabric to dts

2012-09-24 Thread Eric Millbrandt
Add a node for the pcm030-audio-fabric ASoC driver

Signed-off-by: Eric Millbrandt 
---
 arch/powerpc/boot/dts/pcm030.dts |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 9e35499..96512c0 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -59,7 +59,7 @@
#gpio-cells = <2>;
};
 
-   psc@2000 { /* PSC1 in ac97 mode */
+   audioplatform: psc@2000 { /* PSC1 in ac97 mode */
compatible = 
"mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
cell-index = <0>;
};
@@ -134,4 +134,9 @@
localbus {
status = "disabled";
};
+
+   sound {
+   compatible = "phytec,pcm030-audio-fabric";
+   asoc-platform = <&audioplatform>;
+   };
 };
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/3] ASoC: fsl: pcm030-audio-fabric use snd_soc_register_card

2012-09-20 Thread Eric Millbrandt
Convert pcm030-audio-fabric to use the new snd_soc_register_card api
instead of the older method of registering a separate platform device.
Create the dai_link to the mpc5200_psc_ac97 platform using the device tree.
Convert the pcm030-audio-fabric driver to a platform-driver and add a
remove function.

Signed-off-by: Eric Millbrandt 
---
 sound/soc/fsl/pcm030-audio-fabric.c |   65 +--
 1 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index 1353e8f..893e240 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -28,7 +28,6 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
.stream_name = "AC97 Analog",
.codec_dai_name = "wm9712-hifi",
.cpu_dai_name = "mpc5200-psc-ac97.0",
-   .platform_name = "mpc5200-pcm-audio",
.codec_name = "wm9712-codec",
 },
 {
@@ -36,44 +35,74 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
.stream_name = "AC97 IEC958",
.codec_dai_name = "wm9712-aux",
.cpu_dai_name = "mpc5200-psc-ac97.1",
-   .platform_name = "mpc5200-pcm-audio",
.codec_name = "wm9712-codec",
 },
 };
 
-static struct snd_soc_card card = {
+static struct snd_soc_card pcm030_card = {
.name = "pcm030",
.owner = THIS_MODULE,
.dai_link = pcm030_fabric_dai,
.num_links = ARRAY_SIZE(pcm030_fabric_dai),
 };
 
-static __init int pcm030_fabric_init(void)
+static int __init pcm030_fabric_probe(struct platform_device *op)
 {
-   struct platform_device *pdev;
-   int rc;
+   struct device_node *np = op->dev.of_node;
+   struct device_node *platform_np;
+   struct snd_soc_card *card = &pcm030_card;
+   int ret;
+   int i;
 
if (!of_machine_is_compatible("phytec,pcm030"))
return -ENODEV;
 
-   pdev = platform_device_alloc("soc-audio", 1);
-   if (!pdev) {
-   pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
+   card->dev = &op->dev;
+   platform_set_drvdata(op, card);
+
+   platform_np = of_parse_phandle(np, "asoc-platform", 0);
+   if (!platform_np) {
+   dev_err(&op->dev, "ac97 not registered\n");
return -ENODEV;
}
 
-   platform_set_drvdata(pdev, &card);
+   for (i = 0; i < card->num_links; i++)
+   card->dai_link[i].platform_of_node = platform_np;
 
-   rc = platform_device_add(pdev);
-   if (rc) {
-   pr_err("pcm030_fabric_init: platform_device_add() failed\n");
-   platform_device_put(pdev);
-   return -ENODEV;
-   }
-   return 0;
+   ret = snd_soc_register_card(card);
+   if (ret)
+   dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
+
+   return ret;
 }
 
-module_init(pcm030_fabric_init);
+static int __devexit pcm030_fabric_remove(struct platform_device *op)
+{
+   struct snd_soc_card *card = platform_get_drvdata(op);
+   int ret;
+
+   ret = snd_soc_unregister_card(card);
+
+   return ret;
+}
+
+static struct of_device_id pcm030_audio_match[] = {
+   { .compatible = "phytec,pcm030-audio-fabric", },
+   {}
+};
+MODULE_DEVICE_TABLE(of, pcm030_audio_match);
+
+static struct platform_driver pcm030_fabric_driver = {
+   .probe  = pcm030_fabric_probe,
+   .remove = __devexit_p(pcm030_fabric_remove),
+   .driver = {
+   .name   = DRV_NAME,
+   .owner  = THIS_MODULE,
+   .of_match_table= pcm030_audio_match,
+   },
+};
+
+module_platform_driver(pcm030_fabric_driver);
 
 
 MODULE_AUTHOR("Jon Smirl ");
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 1/3] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC

2012-09-20 Thread Eric Millbrandt
mpc52xx socs do not define FSL_SOC but need SND_POWERPC_SOC defined to build
ASoC drivers.

Signed-off-by: Eric Millbrandt 
---
Changes since v1:
Patch was "powerpc/52xx: define FSL_SOC"
Changed from defining FSL_SOC for PPC_MPC52xx to adding PPC_MPC52xx as a
dependency of SND_POWERPC_SOC as per Anatolij Gustschin's comment.

 sound/soc/fsl/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d701330..4563b28 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
 
 menuconfig SND_POWERPC_SOC
tristate "SoC Audio for Freescale PowerPC CPUs"
-   depends on FSL_SOC
+   depends on FSL_SOC || PPC_MPC52xx
help
  Say Y or M if you want to add support for codecs attached to
  the PowerPC CPUs.
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/3] ASoC: fsl: register the wm9712-codec

2012-09-20 Thread Eric Millbrandt
The mpc5200-psc-ac97 driver does not enumerate attached ac97 devices, so
register the device here.

Signed-off-by: Eric Millbrandt 
---
 sound/soc/fsl/pcm030-audio-fabric.c |   32 +---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index 893e240..4b63ec8 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -22,6 +22,11 @@
 
 #define DRV_NAME "pcm030-audio-fabric"
 
+struct pcm030_audio_data {
+   struct snd_soc_card *card;
+   struct platform_device *codec_device;
+};
+
 static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 {
.name = "AC97",
@@ -51,14 +56,22 @@ static int __init pcm030_fabric_probe(struct 
platform_device *op)
struct device_node *np = op->dev.of_node;
struct device_node *platform_np;
struct snd_soc_card *card = &pcm030_card;
+   struct pcm030_audio_data *pdata;
int ret;
int i;
 
if (!of_machine_is_compatible("phytec,pcm030"))
return -ENODEV;
 
+   pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
+GFP_KERNEL);
+   if (!pdata)
+   return -ENOMEM;
+
card->dev = &op->dev;
-   platform_set_drvdata(op, card);
+   platform_set_drvdata(op, pdata);
+
+   pdata->card = card;
 
platform_np = of_parse_phandle(np, "asoc-platform", 0);
if (!platform_np) {
@@ -69,6 +82,18 @@ static int __init pcm030_fabric_probe(struct platform_device 
*op)
for (i = 0; i < card->num_links; i++)
card->dai_link[i].platform_of_node = platform_np;
 
+   ret = request_module("snd-soc-wm9712");
+   if (ret)
+   dev_err(&op->dev, "request_module returned: %d\n", ret);
+
+   pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
+   if (!pdata->codec_device)
+   dev_err(&op->dev, "platform_device_alloc() failed\n");
+
+   ret = platform_device_add(pdata->codec_device);
+   if (ret)
+   dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
+
ret = snd_soc_register_card(card);
if (ret)
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
@@ -78,10 +103,11 @@ static int __init pcm030_fabric_probe(struct 
platform_device *op)
 
 static int __devexit pcm030_fabric_remove(struct platform_device *op)
 {
-   struct snd_soc_card *card = platform_get_drvdata(op);
+   struct pcm030_audio_data *pdata = platform_get_drvdata(op);
int ret;
 
-   ret = snd_soc_unregister_card(card);
+   ret = snd_soc_unregister_card(pdata->card);
+   platform_device_unregister(pdata->codec_device);
 
return ret;
 }
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH v2 1/7] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC

2012-09-19 Thread Eric Millbrandt
On 2012-09-19 Mark Brown wrote:
> On Wed, Sep 19, 2012 at 10:51:25AM -0400,  wrote:
>> From: Eric Millbrandt 
>>
>> mpc52xx socs need to define SND_POWERPC_SOC to build ASoC drivers.
>>
>> Signed-off-by: Eric Millbrandt  ---
>> Changes since v1: Patch was "powerpc/52xx: define FSL_SOC" Changed from
>> defining FSL_SOC for PPC_MPC52xx to adding PPC_MPC52xx as a dependency
>> of SND_POWERPC_SOC as per Anatolij Gustschin's comment.
>
> Patches 2 to 7 appear to have gone AWOL?
>
No changes to 2 through 7, so I didn't repost the full series.

Eric



-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 1/7] ASoC: fsl: add PPC_MPC52xx dependency to SND_POWERPC_SOC

2012-09-19 Thread &quot;Eric Millbrandt
From: Eric Millbrandt 

mpc52xx socs need to define SND_POWERPC_SOC to build ASoC drivers.

Signed-off-by: Eric Millbrandt 
---
Changes since v1:
Patch was "powerpc/52xx: define FSL_SOC"
Changed from defining FSL_SOC for PPC_MPC52xx to adding PPC_MPC52xx as a
dependency of SND_POWERPC_SOC as per Anatolij Gustschin's comment.

 sound/soc/fsl/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d701330..4563b28 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
 
 menuconfig SND_POWERPC_SOC
tristate "SoC Audio for Freescale PowerPC CPUs"
-   depends on FSL_SOC
+   depends on FSL_SOC || PPC_MPC52xx
help
  Say Y or M if you want to add support for codecs attached to
  the PowerPC CPUs.
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 5/7] ASoC: fsl: convert pcm030-audio-fabric to a platform-driver

2012-09-19 Thread Eric Millbrandt
On 2012-09-18 Mark Brown wrote:
> On Thu, Sep 13, 2012 at 05:43:14PM -0400, Eric Millbrandt wrote:
>
>> +static int __devexit pcm030_fabric_remove(struct platform_device *op)
>> +{ + struct platform_device *pdev = platform_get_drvdata(op); +
>> +platform_device_unregister(pdev); + +   return 0; +}
>
> This seems really confused...  why is a platform device registering
> another platform device?  Do you mean to convert to
> snd_soc_register_card()?
>
That was an artifact of me splitting the changes to pcm030-audio-fabric.c
into multiple patches.  I changed the driver to a platform device in this
patch and converted to snd_soc_register_card() in the next patch.  I can
merge the two patches back together if you think that is cleaner and
easier to understand.

Thanks
Eric


-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/7] powerpc/52xx: define FSL_SOC

2012-09-14 Thread Eric Millbrandt
On 2012-09-14 ag...@denx.de wrote:
> Eric Millbrandt  wrote:
>
...
>
> Better use:
>
> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index
> d701330..4563b28 100644
> --- a/sound/soc/fsl/Kconfig
> +++ b/sound/soc/fsl/Kconfig
> @@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
>
>   menuconfig SND_POWERPC_SOC
>  tristate "SoC Audio for Freescale PowerPC CPUs"
> -   depends on FSL_SOC
> +   depends on FSL_SOC || PPC_MPC52xx
>  help
>Say Y or M if you want to add support for codecs attached to
>the PowerPC CPUs.
> Thanks,
>
> Anatolij
>

Looks good to me, I will do this instead.  Thanks.

Eric


-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 6/7] ASoC: fsl: convert pcm030-audio-fabric to use snd_soc_register_card

2012-09-13 Thread Eric Millbrandt
This patch converts pcm030-audio-fabric to use the new snd_soc_register_card
ASoC api instead of the older method of registering a separate platform
device.  It also creates the dai_link to the mpc5200_psc_ac97 platform using
the device tree.

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index 5c8e2d6..893e240 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -28,7 +28,6 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
.stream_name = "AC97 Analog",
.codec_dai_name = "wm9712-hifi",
.cpu_dai_name = "mpc5200-psc-ac97.0",
-   .platform_name = "mpc5200-pcm-audio",
.codec_name = "wm9712-codec",
 },
 {
@@ -36,12 +35,11 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
.stream_name = "AC97 IEC958",
.codec_dai_name = "wm9712-aux",
.cpu_dai_name = "mpc5200-psc-ac97.1",
-   .platform_name = "mpc5200-pcm-audio",
.codec_name = "wm9712-codec",
 },
 };
 
-static struct snd_soc_card card = {
+static struct snd_soc_card pcm030_card = {
.name = "pcm030",
.owner = THIS_MODULE,
.dai_link = pcm030_fabric_dai,
@@ -50,37 +48,42 @@ static struct snd_soc_card card = {
 
 static int __init pcm030_fabric_probe(struct platform_device *op)
 {
-   struct platform_device *pdev;
-   int rc;
+   struct device_node *np = op->dev.of_node;
+   struct device_node *platform_np;
+   struct snd_soc_card *card = &pcm030_card;
+   int ret;
+   int i;
 
if (!of_machine_is_compatible("phytec,pcm030"))
return -ENODEV;
 
-   pdev = platform_device_alloc("soc-audio", 1);
-   if (!pdev) {
-   pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
+   card->dev = &op->dev;
+   platform_set_drvdata(op, card);
+
+   platform_np = of_parse_phandle(np, "asoc-platform", 0);
+   if (!platform_np) {
+   dev_err(&op->dev, "ac97 not registered\n");
return -ENODEV;
}
 
-   platform_set_drvdata(op, pdev);
-   platform_set_drvdata(pdev, &card);
+   for (i = 0; i < card->num_links; i++)
+   card->dai_link[i].platform_of_node = platform_np;
 
-   rc = platform_device_add(pdev);
-   if (rc) {
-   pr_err("pcm030_fabric_init: platform_device_add() failed\n");
-   platform_device_put(pdev);
-   return -ENODEV;
-   }
-   return 0;
+   ret = snd_soc_register_card(card);
+   if (ret)
+   dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
+
+   return ret;
 }
 
 static int __devexit pcm030_fabric_remove(struct platform_device *op)
 {
-   struct platform_device *pdev = platform_get_drvdata(op);
+   struct snd_soc_card *card = platform_get_drvdata(op);
+   int ret;
 
-   platform_device_unregister(pdev);
+   ret = snd_soc_unregister_card(card);
 
-   return 0;
+   return ret;
 }
 
 static struct of_device_id pcm030_audio_match[] = {
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 5/7] ASoC: fsl: convert pcm030-audio-fabric to a platform-driver

2012-09-13 Thread Eric Millbrandt
This patch converts the pcm030-audio-fabric driver to a platform-driver and
adds a remove function.

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index 1353e8f..5c8e2d6 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -48,7 +48,7 @@ static struct snd_soc_card card = {
.num_links = ARRAY_SIZE(pcm030_fabric_dai),
 };
 
-static __init int pcm030_fabric_init(void)
+static int __init pcm030_fabric_probe(struct platform_device *op)
 {
struct platform_device *pdev;
int rc;
@@ -62,6 +62,7 @@ static __init int pcm030_fabric_init(void)
return -ENODEV;
}
 
+   platform_set_drvdata(op, pdev);
platform_set_drvdata(pdev, &card);
 
rc = platform_device_add(pdev);
@@ -73,7 +74,32 @@ static __init int pcm030_fabric_init(void)
return 0;
 }
 
-module_init(pcm030_fabric_init);
+static int __devexit pcm030_fabric_remove(struct platform_device *op)
+{
+   struct platform_device *pdev = platform_get_drvdata(op);
+
+   platform_device_unregister(pdev);
+
+   return 0;
+}
+
+static struct of_device_id pcm030_audio_match[] = {
+   { .compatible = "phytec,pcm030-audio-fabric", },
+   {}
+};
+MODULE_DEVICE_TABLE(of, pcm030_audio_match);
+
+static struct platform_driver pcm030_fabric_driver = {
+   .probe  = pcm030_fabric_probe,
+   .remove = __devexit_p(pcm030_fabric_remove),
+   .driver = {
+   .name   = DRV_NAME,
+   .owner  = THIS_MODULE,
+   .of_match_table= pcm030_audio_match,
+   },
+};
+
+module_platform_driver(pcm030_fabric_driver);
 
 
 MODULE_AUTHOR("Jon Smirl ");
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 7/7] ASoC: fsl: register the wm9712-codec

2012-09-13 Thread Eric Millbrandt
The mpc5200-psc-ac97 driver does not enumerate attached ac97 devices, so
register the device here.

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index 893e240..4b63ec8 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -22,6 +22,11 @@
 
 #define DRV_NAME "pcm030-audio-fabric"
 
+struct pcm030_audio_data {
+   struct snd_soc_card *card;
+   struct platform_device *codec_device;
+};
+
 static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 {
.name = "AC97",
@@ -51,14 +56,22 @@ static int __init pcm030_fabric_probe(struct 
platform_device *op)
struct device_node *np = op->dev.of_node;
struct device_node *platform_np;
struct snd_soc_card *card = &pcm030_card;
+   struct pcm030_audio_data *pdata;
int ret;
int i;
 
if (!of_machine_is_compatible("phytec,pcm030"))
return -ENODEV;
 
+   pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
+GFP_KERNEL);
+   if (!pdata)
+   return -ENOMEM;
+
card->dev = &op->dev;
-   platform_set_drvdata(op, card);
+   platform_set_drvdata(op, pdata);
+
+   pdata->card = card;
 
platform_np = of_parse_phandle(np, "asoc-platform", 0);
if (!platform_np) {
@@ -69,6 +82,18 @@ static int __init pcm030_fabric_probe(struct platform_device 
*op)
for (i = 0; i < card->num_links; i++)
card->dai_link[i].platform_of_node = platform_np;
 
+   ret = request_module("snd-soc-wm9712");
+   if (ret)
+   dev_err(&op->dev, "request_module returned: %d\n", ret);
+
+   pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
+   if (!pdata->codec_device)
+   dev_err(&op->dev, "platform_device_alloc() failed\n");
+
+   ret = platform_device_add(pdata->codec_device);
+   if (ret)
+   dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
+
ret = snd_soc_register_card(card);
if (ret)
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
@@ -78,10 +103,11 @@ static int __init pcm030_fabric_probe(struct 
platform_device *op)
 
 static int __devexit pcm030_fabric_remove(struct platform_device *op)
 {
-   struct snd_soc_card *card = platform_get_drvdata(op);
+   struct pcm030_audio_data *pdata = platform_get_drvdata(op);
int ret;
 
-   ret = snd_soc_unregister_card(card);
+   ret = snd_soc_unregister_card(pdata->card);
+   platform_device_unregister(pdata->codec_device);
 
return ret;
 }
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/7] ASoC: fsl: mpc5200 combine psc_dma platform data

2012-09-13 Thread Eric Millbrandt
The mpc5200_psc_ac97 and mpc5200_psc_i2s modules rely on shared platform data
with mpc5200_dma.

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 9a3f7c5..9997c03 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -370,7 +370,7 @@ static struct snd_soc_platform_driver 
mpc5200_audio_dma_platform = {
.pcm_free   = &psc_dma_free,
 };
 
-static int mpc5200_hpcd_probe(struct platform_device *op)
+int mpc5200_audio_dma_create(struct platform_device *op)
 {
phys_addr_t fifo;
struct psc_dma *psc_dma;
@@ -487,8 +487,9 @@ out_unmap:
iounmap(regs);
return ret;
 }
+EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create);
 
-static int mpc5200_hpcd_remove(struct platform_device *op)
+int mpc5200_audio_dma_destroy(struct platform_device *op)
 {
struct psc_dma *psc_dma = dev_get_drvdata(&op->dev);
 
@@ -510,24 +511,7 @@ static int mpc5200_hpcd_remove(struct platform_device *op)
 
return 0;
 }
-
-static struct of_device_id mpc5200_hpcd_match[] = {
-   { .compatible = "fsl,mpc5200-pcm", },
-   {}
-};
-MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match);
-
-static struct platform_driver mpc5200_hpcd_of_driver = {
-   .probe  = mpc5200_hpcd_probe,
-   .remove = mpc5200_hpcd_remove,
-   .driver = {
-   .owner  = THIS_MODULE,
-   .name   = "mpc5200-pcm-audio",
-   .of_match_table= mpc5200_hpcd_match,
-   }
-};
-
-module_platform_driver(mpc5200_hpcd_of_driver);
+EXPORT_SYMBOL_GPL(mpc5200_audio_dma_destroy);
 
 MODULE_AUTHOR("Grant Likely ");
 MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver");
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index a3c0cd5..dff253f 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -81,4 +81,7 @@ to_psc_dma_stream(struct snd_pcm_substream *substream, struct 
psc_dma *psc_dma)
return &psc_dma->playback;
 }
 
+int mpc5200_audio_dma_create(struct platform_device *op);
+int mpc5200_audio_dma_destroy(struct platform_device *op);
+
 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index ffa00a2..9a09453 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -278,6 +278,10 @@ static int __devinit psc_ac97_of_probe(struct 
platform_device *op)
struct snd_ac97 ac97;
struct mpc52xx_psc __iomem *regs;
 
+   rc = mpc5200_audio_dma_create(op);
+   if (rc != 0)
+   return rc;
+
rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, 
ARRAY_SIZE(psc_ac97_dai));
if (rc != 0) {
dev_err(&op->dev, "Failed to register DAI\n");
@@ -303,6 +307,7 @@ static int __devinit psc_ac97_of_probe(struct 
platform_device *op)
 
 static int __devexit psc_ac97_of_remove(struct platform_device *op)
 {
+   mpc5200_audio_dma_destroy(op);
snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai));
return 0;
 }
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 7b53032..c0b7a23 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -156,6 +156,10 @@ static int __devinit psc_i2s_of_probe(struct 
platform_device *op)
struct psc_dma *psc_dma;
struct mpc52xx_psc __iomem *regs;
 
+   rc = mpc5200_audio_dma_create(op);
+   if (rc != 0)
+   return rc;
+
rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, 
ARRAY_SIZE(psc_i2s_dai));
if (rc != 0) {
pr_err("Failed to register DAI\n");
@@ -200,6 +204,7 @@ static int __devinit psc_i2s_of_probe(struct 
platform_device *op)
 
 static int __devexit psc_i2s_of_remove(struct platform_device *op)
 {
+   mpc5200_audio_dma_destroy(op);
snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai));
return 0;
 }
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/7] ASoC: fsl: cleanup headers in pcm030-audio-fabric

2012-09-13 Thread Eric Millbrandt
Remove unreferenced header files.

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
index b3af55d..1353e8f 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -12,22 +12,13 @@
 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
 
-#include 
-#include 
-#include 
-#include 
 #include 
 
 #include "mpc5200_dma.h"
-#include "mpc5200_psc_ac97.h"
-#include "../codecs/wm9712.h"
 
 #define DRV_NAME "pcm030-audio-fabric"
 
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC 0/7] mpc5200 ASoC and pcm030 board fixes

2012-09-13 Thread Eric Millbrandt
This series is a respin of "mpc5200 ASoC fixups"

The mpc5200 ASoC and pcm030 board code compiled, but did not run after the
multi-codec patches.  This series add the missing pieces into the mpc5200 ASoC
drivers and updates the pcm030 board to the current api.

Eric Millbrandt (7):
  powerpc/52xx: define FSL_SOC
  ASoC: fsl: mpc5200 combine psc_dma platform data
  ASoC: fsl: mpc5200 add missing information to snd_soc_dai_driver
  ASoC: fsl: cleanup headers in pcm030-audio-fabric
  ASoC: fsl: convert pcm030-audio-fabric to a platform-driver
  ASoC: fsl: convert pcm030-audio-fabric to use snd_soc_register_card
  ASoC: fsl: register the wm9712-codec

 arch/powerpc/platforms/52xx/Kconfig |1 +
 sound/soc/fsl/mpc5200_dma.c |   24 ++---
 sound/soc/fsl/mpc5200_dma.h |3 +
 sound/soc/fsl/mpc5200_psc_ac97.c|   10 
 sound/soc/fsl/mpc5200_psc_i2s.c |8 +++
 sound/soc/fsl/pcm030-audio-fabric.c |  100 +-
 6 files changed, 99 insertions(+), 47 deletions(-)

-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/7] ASoC: fsl: mpc5200 add missing information to snd_soc_dai_driver

2012-09-13 Thread Eric Millbrandt
Add missing dai_driver information to avoid these runtime errors

[   16.433788] asoc: error - multiple DAI f0002c00.i2s registered with no name
[   16.453551] Failed to register DAI
[   16.461222] mpc5200-psc-i2s: probe of f0002c00.i2s failed with error -22
[   16.475242] asoc: error - multiple DAI f0002000.ac97 registered with no name
[   16.488087] mpc5200-psc-ac97 f0002000.ac97: Failed to register DAI
[   16.50] mpc5200-psc-ac97: probe of f0002000.ac97 failed with error -22

Signed-off-by: Eric Millbrandt 

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 9a09453..a313c0a 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -237,15 +237,18 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops 
= {
 
 static struct snd_soc_dai_driver psc_ac97_dai[] = {
 {
+   .name = "mpc5200-psc-ac97.0",
.ac97_control = 1,
.probe  = psc_ac97_probe,
.playback = {
+   .stream_name= "AC97 Playback",
.channels_min   = 1,
.channels_max   = 6,
.rates  = SNDRV_PCM_RATE_8000_48000,
.formats = SNDRV_PCM_FMTBIT_S32_BE,
},
.capture = {
+   .stream_name= "AC97 Capture",
.channels_min   = 1,
.channels_max   = 2,
.rates  = SNDRV_PCM_RATE_8000_48000,
@@ -254,8 +257,10 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
.ops = &psc_ac97_analog_ops,
 },
 {
+   .name = "mpc5200-psc-ac97.1",
.ac97_control = 1,
.playback = {
+   .stream_name= "AC97 SPDIF",
.channels_min   = 1,
.channels_max   = 2,
.rates  = SNDRV_PCM_RATE_32000 | \
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index c0b7a23..ba1f0a6 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -130,13 +130,16 @@ static const struct snd_soc_dai_ops psc_i2s_dai_ops = {
 };
 
 static struct snd_soc_dai_driver psc_i2s_dai[] = {{
+   .name = "mpc5200-psc-i2s.0",
.playback = {
+   .stream_name = "I2S Playback",
.channels_min = 2,
.channels_max = 2,
.rates = PSC_I2S_RATES,
.formats = PSC_I2S_FORMATS,
},
.capture = {
+   .stream_name = "I2S Capture",
.channels_min = 2,
.channels_max = 2,
.rates = PSC_I2S_RATES,
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/7] powerpc/52xx: define FSL_SOC

2012-09-13 Thread Eric Millbrandt
mpc52xx socs need to have FSL_SOC defined to build their drivers (i2c-mpc, ASoC)

Signed-off-by: Eric Millbrandt 

diff --git a/arch/powerpc/platforms/52xx/Kconfig 
b/arch/powerpc/platforms/52xx/Kconfig
index 90f4496..fb35944 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -1,6 +1,7 @@
 config PPC_MPC52xx
bool "52xx-based boards"
depends on 6xx
+   select FSL_SOC
select PPC_CLOCK
select PPC_PCI_CHOICE
 
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [alsa-devel] [PATCH 2/5] ASoC: fsl: mpc5200 combine psc_dma platform data

2012-09-12 Thread Eric Millbrandt
Hi Mark,

On 2012-09-12 Mark Brown wrote:
> On Tue, Sep 11, 2012 at 10:14:46PM -0400, Eric Millbrandt wrote:
>> The mpc5200_psc_ac97 and mpc5200_psc_i2s modules rely on shared
>> platform data with mpc5200_dma.
>
> This looks good but depends on patch 1 so I can't apply it - if you can
> rebase things so this is patch 1 I'll apply it.

After mulling your comments I see now that not being able to define a 
snd_soc_ops for an ASoC machine driver would only work for very few boards.  
I'll think on it some more and respin the series to be pcm030 specific.

Eric

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-



This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 1/5] ASoC: fsl: mpc5200 multi-codec fixups

2012-09-12 Thread Eric Millbrandt
Hi Mark,

On 2012-09-11 Mark Brown wrote:
>> --- a/arch/powerpc/platforms/52xx/Kconfig
>> +++ b/arch/powerpc/platforms/52xx/Kconfig
>> @@ -1,6 +1,7 @@
>>  config PPC_MPC52xx  bool "52xx-based boards"depends on 6xx +
>> select
>>  FSL_SOC select PPC_CLOCKselect PPC_PCI_CHOICE
>
> This doesnt seem to have much to do with the commit message...
>
I'll spit this into another patch.  SND_POWERPC_SOC, which wraps all of the 
Powerpc socs, depends on FSL_SOC.  Would it be better to have SND_POWERPC_SOC 
depend on FSL_SOC or PPC_MPC52xx?

>> -/* ALSA only supports a single AC97 device so static is recommend here
>> */ +/* ALSA only supports a single AC97 bus device so static is
>> recommend +here */
>>  static struct psc_dma *psc_dma;
>
> Or this.
>
I'll also be split this out.  The change was to clarify that now you can have 
multiple ac97 codec, but soc-core can still only have on ac97 bus.

Eric




This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 5/5] ASoC: fsl: mpc5200 remove pcm030 and efika audio fabric

2012-09-12 Thread Eric Millbrandt
Hi Mark,

On 2012-09-11 Mark Brown wrote:
> On Tue, Sep 11, 2012 at 10:14:49PM -0400, Eric Millbrandt wrote:
>> MPC5200 ASoC setup can now be done in the device tree.
>
> I only noticed DT bindings being added for pcm030, not for efika?
>
When I looked I didn't see the Efika (PPC 5200B) DT in-tree.  It only appears 
to exist out-of-tree, http://www.powerdeveloper.org/platforms/efika/devicetree.

Eric

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/5] ASoC: fsl: mpc5200 multi-codec fixups

2012-09-11 Thread Eric Millbrandt
Add platform DAI information that is needed to successfully register the
mpc5200 platform.

Signed-off-by: Eric Millbrandt 
---
 arch/powerpc/platforms/52xx/Kconfig |1 +
 sound/soc/fsl/mpc5200_dma.c |4 ++--
 sound/soc/fsl/mpc5200_psc_ac97.c|8 ++--
 sound/soc/fsl/mpc5200_psc_i2s.c |3 +++
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/Kconfig 
b/arch/powerpc/platforms/52xx/Kconfig
index 90f4496..fb35944 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -1,6 +1,7 @@
 config PPC_MPC52xx
bool "52xx-based boards"
depends on 6xx
+   select FSL_SOC
select PPC_CLOCK
select PPC_PCI_CHOICE
 
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 9a3f7c5..46fb518 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -366,8 +366,8 @@ static void psc_dma_free(struct snd_pcm *pcm)
 
 static struct snd_soc_platform_driver mpc5200_audio_dma_platform = {
.ops= &psc_dma_ops,
-   .pcm_new= &psc_dma_new,
-   .pcm_free   = &psc_dma_free,
+   .pcm_new= psc_dma_new,
+   .pcm_free   = psc_dma_free,
 };
 
 static int mpc5200_hpcd_probe(struct platform_device *op)
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index ffa00a2..2f70729 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -28,7 +28,7 @@
 
 #define DRV_NAME "mpc5200-psc-ac97"
 
-/* ALSA only supports a single AC97 device so static is recommend here */
+/* ALSA only supports a single AC97 bus device so static is recommend here */
 static struct psc_dma *psc_dma;
 
 static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
@@ -237,15 +237,18 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops 
= {
 
 static struct snd_soc_dai_driver psc_ac97_dai[] = {
 {
+   .name = "mpc5200_psc_ac97.0",
.ac97_control = 1,
.probe  = psc_ac97_probe,
.playback = {
+   .stream_name= "AC97 Playback",
.channels_min   = 1,
.channels_max   = 6,
.rates  = SNDRV_PCM_RATE_8000_48000,
.formats = SNDRV_PCM_FMTBIT_S32_BE,
},
.capture = {
+   .stream_name= "AC97 Capture",
.channels_min   = 1,
.channels_max   = 2,
.rates  = SNDRV_PCM_RATE_8000_48000,
@@ -254,8 +257,10 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
.ops = &psc_ac97_analog_ops,
 },
 {
+   .name = "mpc5200_psc_ac97.1",
.ac97_control = 1,
.playback = {
+   .stream_name= "AC97 SPDIF",
.channels_min   = 1,
.channels_max   = 2,
.rates  = SNDRV_PCM_RATE_32000 | \
@@ -330,4 +335,3 @@ module_platform_driver(psc_ac97_driver);
 MODULE_AUTHOR("Jon Smirl ");
 MODULE_DESCRIPTION("mpc5200 AC97 module");
 MODULE_LICENSE("GPL");
-
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 7b53032..3cf21df 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -130,13 +130,16 @@ static const struct snd_soc_dai_ops psc_i2s_dai_ops = {
 };
 
 static struct snd_soc_dai_driver psc_i2s_dai[] = {{
+   .name = "mpc5200_psc_i2s.0",
.playback = {
+   .stream_name = "I2S Playback",
.channels_min = 2,
.channels_max = 2,
.rates = PSC_I2S_RATES,
.formats = PSC_I2S_FORMATS,
},
.capture = {
+   .stream_name = "I2S Capture",
.channels_min = 2,
.channels_max = 2,
.rates = PSC_I2S_RATES,
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/5] ASoC: fsl: mpc5200-soc-audio driver

2012-09-11 Thread Eric Millbrandt
Add a generic mpc5200 driver that allows asoc cards to be defined in the
device tree.

Signed-off-by: Eric Millbrandt 
---
 .../devicetree/bindings/powerpc/fsl/mpc5200.txt|   17 ++
 sound/soc/fsl/Kconfig  |7 +
 sound/soc/fsl/Makefile |1 +
 sound/soc/fsl/mpc5200_soc_audio.c  |  232 
 4 files changed, 257 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/fsl/mpc5200_soc_audio.c

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt 
b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
index 4ccb2cd..399d159 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
@@ -196,3 +196,20 @@ External interrupts:
 fsl,mpc5200-mscan nodes
 ---
 See file can.txt in this directory.
+
+fsl,mpc5200-soc-audio
+-
+The mpc5200 soc-audio driver allows the snd_soc_dai_link to be filled
+in based on the node properties described below.
+
+A sound node is defined for each asoc platform.  A sound node must
+have at least one child DAI node.
+- card-name   - The card name to register in asoc
+- audio-platform  - Contains a phandle to a ac97 or i2s node
+- number-of-dais  - The number of DAIs defined
+
+Multiple DAI nodes may be attached to a sound node
+- stream-name - The asoc name of the platform DAI stream
+- codec-name  - The name of codec to bind to
+- codec-dai-name  - The codec DAI to bind to
+- cpu-dai-name- The cpu DAI to bind to
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d701330..b3eee63 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -63,6 +63,13 @@ config SND_SOC_MPC5200_AC97
help
  Say Y here to support the MPC5200 PSCs in AC97 mode.
 
+config SND_MPC52xx_SOC_AUDIO
+   tristate "SoC Generic Audio support for MPC5200"
+   depends on (SND_SOC_MPC5200_AC97 || SND_SOC_MPC5200_I2S)
+   help
+ Say Y if you want to generic device-tree support for sound on the
+ Freescale MPC5200
+
 config SND_MPC52xx_SOC_PCM030
tristate "SoC AC97 Audio support for Phytec pcm030 and WM9712"
depends on PPC_MPC5200_SIMPLE
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 5f3cf3f..d2e2e68 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
 obj-$(CONFIG_SND_SOC_MPC5200_AC97) += mpc5200_psc_ac97.o
 
 # MPC5200 Machine Support
+obj-$(CONFIG_SND_MPC52xx_SOC_AUDIO) += mpc5200_soc_audio.o
 obj-$(CONFIG_SND_MPC52xx_SOC_PCM030) += pcm030-audio-fabric.o
 obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
 
diff --git a/sound/soc/fsl/mpc5200_soc_audio.c 
b/sound/soc/fsl/mpc5200_soc_audio.c
new file mode 100644
index 000..8004563
--- /dev/null
+++ b/sound/soc/fsl/mpc5200_soc_audio.c
@@ -0,0 +1,232 @@
+/*
+ * Freescale MPC5200 audio bindings
+ *
+ * Copyright 2012 DEKA R&D
+ * Author: Eric Millbrandt 
+ *
+ * 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.
+ */
+#define DEBUG
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mpc5200_dma.h"
+
+#define DRV_NAME "mpc5200-soc-audio"
+struct mpc5200_soc_audio_data {
+   struct snd_soc_card *card;
+   struct platform_device *codec_device[AC97_BUS_MAX_DEVICES];
+};
+
+static void of_register_ac97_devices(struct platform_device *op,
+struct device_node *np,
+struct mpc5200_soc_audio_data *pdata)
+{
+   struct device_node *nc;
+   const u32 *addr;
+   char modalias[PLATFORM_NAME_SIZE];
+   char codec[PLATFORM_NAME_SIZE];
+   int len;
+   int rc;
+   int i = 0;
+
+   if (!np) {
+   dev_err(&op->dev, "No device node found!!!\n");
+   return;
+   }
+
+   for_each_child_of_node(np, nc) {
+
+   if (nc->full_name)
+   dev_dbg(&op->dev, "loading %s\n", nc->full_name);
+
+   /* Select codec */
+   if (of_modalias_node(nc, modalias,
+sizeof(modalias)) < 0) {
+   dev_err(&op->dev, "cannot find modalias for %s\n",
+   nc->full_name);
+   continue;
+   }
+   strlcpy(codec, modalias, sizeof(codec));
+   strlcat(codec, "-codec", sizeof(codec));
+
+   /* Device address */
+   addr = of_get_property(nc, "reg", &len);
+   if (!addr ||

[PATCH 5/5] ASoC: fsl: mpc5200 remove pcm030 and efika audio fabric

2012-09-11 Thread Eric Millbrandt
MPC5200 ASoC setup can now be done in the device tree.

Signed-off-by: Eric Millbrandt 
---
 sound/soc/fsl/Kconfig   |   17 ---
 sound/soc/fsl/Makefile  |2 -
 sound/soc/fsl/efika-audio-fabric.c  |   91 ---
 sound/soc/fsl/pcm030-audio-fabric.c |   91 ---
 4 files changed, 0 insertions(+), 201 deletions(-)
 delete mode 100644 sound/soc/fsl/efika-audio-fabric.c
 delete mode 100644 sound/soc/fsl/pcm030-audio-fabric.c

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index b3eee63..54ba798 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -70,23 +70,6 @@ config SND_MPC52xx_SOC_AUDIO
  Say Y if you want to generic device-tree support for sound on the
  Freescale MPC5200
 
-config SND_MPC52xx_SOC_PCM030
-   tristate "SoC AC97 Audio support for Phytec pcm030 and WM9712"
-   depends on PPC_MPC5200_SIMPLE
-   select SND_SOC_MPC5200_AC97
-   select SND_SOC_WM9712
-   help
- Say Y if you want to add support for sound on the Phytec pcm030
- baseboard.
-
-config SND_MPC52xx_SOC_EFIKA
-   tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
-   depends on PPC_EFIKA
-   select SND_SOC_MPC5200_AC97
-   select SND_SOC_STAC9766
-   help
- Say Y if you want to add support for sound on the Efika.
-
 endif # SND_POWERPC_SOC
 
 menuconfig SND_IMX_SOC
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index d2e2e68..bd5f511 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -21,8 +21,6 @@ obj-$(CONFIG_SND_SOC_MPC5200_AC97) += mpc5200_psc_ac97.o
 
 # MPC5200 Machine Support
 obj-$(CONFIG_SND_MPC52xx_SOC_AUDIO) += mpc5200_soc_audio.o
-obj-$(CONFIG_SND_MPC52xx_SOC_PCM030) += pcm030-audio-fabric.o
-obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
 
 # i.MX Platform Support
 snd-soc-imx-ssi-objs := imx-ssi.o
diff --git a/sound/soc/fsl/efika-audio-fabric.c 
b/sound/soc/fsl/efika-audio-fabric.c
deleted file mode 100644
index b2acd329..000
--- a/sound/soc/fsl/efika-audio-fabric.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Efika driver for the PSC of the Freescale MPC52xx
- * configured as AC97 interface
- *
- * Copyright 2008 Jon Smirl, Digispeaker
- * Author: Jon Smirl 
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "mpc5200_dma.h"
-#include "mpc5200_psc_ac97.h"
-#include "../codecs/stac9766.h"
-
-#define DRV_NAME "efika-audio-fabric"
-
-static struct snd_soc_dai_link efika_fabric_dai[] = {
-{
-   .name = "AC97",
-   .stream_name = "AC97 Analog",
-   .codec_dai_name = "stac9766-hifi-analog",
-   .cpu_dai_name = "mpc5200-psc-ac97.0",
-   .platform_name = "mpc5200-pcm-audio",
-   .codec_name = "stac9766-codec",
-},
-{
-   .name = "AC97",
-   .stream_name = "AC97 IEC958",
-   .codec_dai_name = "stac9766-hifi-IEC958",
-   .cpu_dai_name = "mpc5200-psc-ac97.1",
-   .platform_name = "mpc5200-pcm-audio",
-   .codec_name = "stac9766-codec",
-},
-};
-
-static struct snd_soc_card card = {
-   .name = "Efika",
-   .owner = THIS_MODULE,
-   .dai_link = efika_fabric_dai,
-   .num_links = ARRAY_SIZE(efika_fabric_dai),
-};
-
-static __init int efika_fabric_init(void)
-{
-   struct platform_device *pdev;
-   int rc;
-
-   if (!of_machine_is_compatible("bplan,efika"))
-   return -ENODEV;
-
-   pdev = platform_device_alloc("soc-audio", 1);
-   if (!pdev) {
-   pr_err("efika_fabric_init: platform_device_alloc() failed\n");
-   return -ENODEV;
-   }
-
-   platform_set_drvdata(pdev, &card);
-
-   rc = platform_device_add(pdev);
-   if (rc) {
-   pr_err("efika_fabric_init: platform_device_add() failed\n");
-   platform_device_put(pdev);
-   return -ENODEV;
-   }
-   return 0;
-}
-
-module_init(efika_fabric_init);
-
-
-MODULE_AUTHOR("Jon Smirl ");
-MODULE_DESCRIPTION(DRV_NAME ": mpc5200 Efika fabric driver");
-MODULE_LICENSE("GPL");
-
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
deleted file mode 100644
index b3af55d..000
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Phytec pcm030 driver for the PSC of the Freescale MPC52xx
- * configured as AC97 interface
- *
- * Copyrigh

[PATCH 2/5] ASoC: fsl: mpc5200 combine psc_dma platform data

2012-09-11 Thread Eric Millbrandt
The mpc5200_psc_ac97 and mpc5200_psc_i2s modules rely on shared platform data
with mpc5200_dma.

Signed-off-by: Eric Millbrandt 
---
 sound/soc/fsl/mpc5200_dma.c  |   24 
 sound/soc/fsl/mpc5200_dma.h  |3 +++
 sound/soc/fsl/mpc5200_psc_ac97.c |5 +
 sound/soc/fsl/mpc5200_psc_i2s.c  |5 +
 4 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 46fb518..4fabc85 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -370,7 +370,7 @@ static struct snd_soc_platform_driver 
mpc5200_audio_dma_platform = {
.pcm_free   = psc_dma_free,
 };
 
-static int mpc5200_hpcd_probe(struct platform_device *op)
+int mpc5200_audio_dma_create(struct platform_device *op)
 {
phys_addr_t fifo;
struct psc_dma *psc_dma;
@@ -487,8 +487,9 @@ out_unmap:
iounmap(regs);
return ret;
 }
+EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create);
 
-static int mpc5200_hpcd_remove(struct platform_device *op)
+int mpc5200_audio_dma_destroy(struct platform_device *op)
 {
struct psc_dma *psc_dma = dev_get_drvdata(&op->dev);
 
@@ -510,24 +511,7 @@ static int mpc5200_hpcd_remove(struct platform_device *op)
 
return 0;
 }
-
-static struct of_device_id mpc5200_hpcd_match[] = {
-   { .compatible = "fsl,mpc5200-pcm", },
-   {}
-};
-MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match);
-
-static struct platform_driver mpc5200_hpcd_of_driver = {
-   .probe  = mpc5200_hpcd_probe,
-   .remove = mpc5200_hpcd_remove,
-   .driver = {
-   .owner  = THIS_MODULE,
-   .name   = "mpc5200-pcm-audio",
-   .of_match_table= mpc5200_hpcd_match,
-   }
-};
-
-module_platform_driver(mpc5200_hpcd_of_driver);
+EXPORT_SYMBOL_GPL(mpc5200_audio_dma_destroy);
 
 MODULE_AUTHOR("Grant Likely ");
 MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver");
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index a3c0cd5..dff253f 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -81,4 +81,7 @@ to_psc_dma_stream(struct snd_pcm_substream *substream, struct 
psc_dma *psc_dma)
return &psc_dma->playback;
 }
 
+int mpc5200_audio_dma_create(struct platform_device *op);
+int mpc5200_audio_dma_destroy(struct platform_device *op);
+
 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 2f70729..17b17b8 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -283,6 +283,10 @@ static int __devinit psc_ac97_of_probe(struct 
platform_device *op)
struct snd_ac97 ac97;
struct mpc52xx_psc __iomem *regs;
 
+   rc = mpc5200_audio_dma_create(op);
+   if (rc != 0)
+   return rc;
+
rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, 
ARRAY_SIZE(psc_ac97_dai));
if (rc != 0) {
dev_err(&op->dev, "Failed to register DAI\n");
@@ -308,6 +312,7 @@ static int __devinit psc_ac97_of_probe(struct 
platform_device *op)
 
 static int __devexit psc_ac97_of_remove(struct platform_device *op)
 {
+   mpc5200_audio_dma_destroy(op);
snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai));
return 0;
 }
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 3cf21df..5710dc8 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -159,6 +159,10 @@ static int __devinit psc_i2s_of_probe(struct 
platform_device *op)
struct psc_dma *psc_dma;
struct mpc52xx_psc __iomem *regs;
 
+   rc = mpc5200_audio_dma_create(op);
+   if (rc != 0)
+   return rc;
+
rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, 
ARRAY_SIZE(psc_i2s_dai));
if (rc != 0) {
pr_err("Failed to register DAI\n");
@@ -203,6 +207,7 @@ static int __devinit psc_i2s_of_probe(struct 
platform_device *op)
 
 static int __devexit psc_i2s_of_remove(struct platform_device *op)
 {
+   mpc5200_audio_dma_destroy(op);
snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai));
return 0;
 }
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[RFC PATCH 0/5] mpc5200 asoc fixups

2012-09-11 Thread Eric Millbrandt
The mpc5200 asoc code did not run after the multi-codec patches.  This series
fixes the existing code and adds a generic platform driver that allows the
audio layout to be described in the device tree.

Eric Millbrandt (5):
  ASoC: fsl: mpc5200 multi-codec fixups
  ASoC: fsl: mpc5200 combine psc_dma platform data
  ASoC: fsl: mpc5200-soc-audio driver
  arch/powerpc/boot/dts pcm030 add mpc5200-soc-audio node
  ASoC: fsl: mpc5200 remove pcm030 and efika audio fabric

 .../devicetree/bindings/powerpc/fsl/mpc5200.txt|   17 ++
 arch/powerpc/boot/dts/pcm030.dts   |   23 ++-
 arch/powerpc/platforms/52xx/Kconfig|1 +
 sound/soc/fsl/Kconfig  |   20 +--
 sound/soc/fsl/Makefile |3 +-
 sound/soc/fsl/efika-audio-fabric.c |   91 
 sound/soc/fsl/mpc5200_dma.c|   28 +--
 sound/soc/fsl/mpc5200_dma.h|3 +
 sound/soc/fsl/mpc5200_psc_ac97.c   |   13 +-
 sound/soc/fsl/mpc5200_psc_i2s.c|8 +
 sound/soc/fsl/mpc5200_soc_audio.c  |  232 
 sound/soc/fsl/pcm030-audio-fabric.c|   91 
 12 files changed, 306 insertions(+), 224 deletions(-)
 delete mode 100644 sound/soc/fsl/efika-audio-fabric.c
 create mode 100644 sound/soc/fsl/mpc5200_soc_audio.c
 delete mode 100644 sound/soc/fsl/pcm030-audio-fabric.c

-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/5] arch/powerpc/boot/dts pcm030 add mpc5200-soc-audio node

2012-09-11 Thread Eric Millbrandt
Describe the audio codec on the pcm030 baseboard.

Signed-off-by: Eric Millbrandt 
---
 arch/powerpc/boot/dts/pcm030.dts |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 9e35499..e9475e9 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -59,7 +59,7 @@
#gpio-cells = <2>;
};
 
-   psc@2000 { /* PSC1 in ac97 mode */
+   audio_platform: psc@2000 { /* PSC1 in ac97 mode */
compatible = 
"mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
cell-index = <0>;
};
@@ -134,4 +134,25 @@
localbus {
status = "disabled";
};
+
+   sound {
+   compatible = "fsl,mpc5200b-soc-audio","fsl,mpc5200-soc-audio";
+   card-name = "pcm030";
+   audio-platform = <&audio_platform>;
+   number-of-dais = <2>;
+
+   analog@0 {
+   stream-name = "AC97 Analog";
+   codec-name = "wm9712-codec.0";
+   codec-dai-name = "wm9712-hifi";
+   cpu-dai-name = "mpc5200-psc-ac97.0";
+   };
+
+   digital@1 {
+   stream-name = "AC97 IEC958";
+   codec-name = "wm9712-codec.0";
+   codec-dai-name = "wm9712-aux";
+   cpu-dai-name = "mpc5200-psc-ac97.0";
+   };
+   };
 };
-- 
1.7.2.5

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2] powerpc/5200: tighten up ac97 reset timing

2010-09-03 Thread Eric Millbrandt
Tighten up time timing around the gpio reset functionality.  Add a 200ns
delay before remuxing the pins back to ac97 to comply with the ac97 spec.

Signed-off-by: Eric Millbrandt 
---

Scope shots availible upon request

changes since v1
- amended with comments from Wolfram Sang

 arch/powerpc/platforms/52xx/mpc52xx_common.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 6e90531..41f3a7e 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -325,12 +325,16 @@ int mpc5200_psc_ac97_gpio_reset(int psc_number)
clrbits32(&simple_gpio->simple_dvo, sync | out);
clrbits8(&wkup_gpio->wkup_dvo, reset);

-   /* wait at lease 1 us */
-   udelay(2);
+   /* wait for 1 us */
+   udelay(1);

/* Deassert reset */
setbits8(&wkup_gpio->wkup_dvo, reset);

+   /* wait at least 200ns */
+   /* 7 ~= (200ns * timebase) / ns2sec */
+   __delay(7);
+
/* Restore pin-muxing */
out_be32(&simple_gpio->port_config, mux);

--
1.6.3.1

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH] powerpc/5200: tighten up ac97 reset timing

2010-09-03 Thread Eric Millbrandt
On Fri, 3 Sep 2010 at 12:22:24 Wolfram Sang wrote:
 -   udelay(2);
 +   udelay(1);

 /* Deassert reset */
 setbits8(&wkup_gpio->wkup_dvo, reset);

 +   /* wait at least 200ns */
 +   __delay(7);
>>>
>>> ndelay(200)?
>>  Is ndelay defined for powerpc?  I was under the impression that it was
>> being redefined to udelay in linux/delay.h.
>>
>> #ifndef ndelay
>> static inline void ndelay(unsigned long x)
>> {
>> udelay(DIV_ROUND_UP(x, 1000));
>> }
>> #define ndelay(x) ndelay(x)
>> #endif
>
> Yes, but it is way more readable. Does the extra delay hurt? The value
> of 7 looks a bit magic to me. Are you sure it will do for various
> clock frequencies?
>

The reset is happening in the gpio spinlock, so I am trying to keep busy
waiting to a minimum.  The magic value of 7 calculates to *roughly* 200ns
with a system timebase of 33mhz.  This timebase drives the mpc5200(b) at
its max clock speed of 400mhz, so slower frequencies should just extend the
delay, which is acceptable.  If you strongly object to the use of __delay
I can change it to ndelay.


-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH] powerpc/5200: tighten up ac97 reset timing

2010-09-03 Thread Eric Millbrandt
On Fri, 3 Sep 2010 at 12:02:09 Wolfram Sang wrote:
> On Fri, Sep 03, 2010 at 11:45:22AM -0400, Eric Millbrandt wrote:
>> Tighten up time timing around the gpio reset functionality. Add a 200ns
>> delay before remuxing the pins back to ac97 to comply with the ac97
>> spec. This delay ensures that sync and sdata_out are held low while
>> reset transitions to high.
>>
>> Signed-off-by: Eric Millbrandt 
>> ---
>>
>> Scope shots are availible upon request.
>>
>>  arch/powerpc/platforms/52xx/mpc52xx_common.c |5 -
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>  diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c
>> b/arch/powerpc/platforms/52xx/mpc52xx_common.c index 6e90531..79adfe7
>> 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c +++
>> b/arch/powerpc/platforms/52xx/mpc52xx_common.c @@ -326,11 +326,14 @@
>> int mpc5200_psc_ac97_gpio_reset(int
> psc_number)
>> clrbits8(&wkup_gpio->wkup_dvo, reset);
>>
>> /* wait at lease 1 us */
>
> Maybe you could fix this typo as well while you are here?

Can do.
>
>> -   udelay(2);
>> +   udelay(1);
>>
>> /* Deassert reset */
>> setbits8(&wkup_gpio->wkup_dvo, reset);
>>
>> +   /* wait at least 200ns */
>> +   __delay(7);
>
> ndelay(200)?

Is ndelay defined for powerpc?  I was under the impression that it was
being redefined to udelay in linux/delay.h.

#ifndef ndelay
static inline void ndelay(unsigned long x)
{
udelay(DIV_ROUND_UP(x, 1000));
}
#define ndelay(x) ndelay(x)
#endif

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-




This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc/5200: tighten up ac97 reset timing

2010-09-03 Thread Eric Millbrandt
Tighten up time timing around the gpio reset functionality.  Add a 200ns
delay before remuxing the pins back to ac97 to comply with the ac97 spec.
This delay ensures that sync and sdata_out are held low while reset
transitions to high.

Signed-off-by: Eric Millbrandt 
---

Scope shots are availible upon request.

 arch/powerpc/platforms/52xx/mpc52xx_common.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 6e90531..79adfe7 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -326,11 +326,14 @@ int mpc5200_psc_ac97_gpio_reset(int psc_number)
clrbits8(&wkup_gpio->wkup_dvo, reset);

/* wait at lease 1 us */
-   udelay(2);
+   udelay(1);

/* Deassert reset */
setbits8(&wkup_gpio->wkup_dvo, reset);

+   /* wait at least 200ns */
+   __delay(7);
+
/* Restore pin-muxing */
out_be32(&simple_gpio->port_config, mux);

--
1.6.3.1

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 0/2 v3] mpc5200 ac97 gpio reset

2010-08-05 Thread Eric Millbrandt
> -Original Message-
> From: linuxppc-dev-bounces+emillbrandt=dekaresearch@lists.ozlabs.org
> [mailto:linuxppc-dev-
> bounces+emillbrandt=dekaresearch@lists.ozlabs.org] On Behalf Of Mark
> Brown
> Sent: Tuesday, August 03, 2010 01:52
> To: Grant Likely
> Cc: linuxppc-dev@lists.ozlabs.org; Eric Millbrandt
> Subject: Re: [PATCH 0/2 v3] mpc5200 ac97 gpio reset
>
> On Sat, Jul 31, 2010 at 10:42:15PM -0600, Grant Likely wrote:
> > On Sun, Jun 27, 2010 at 4:01 PM, Mark Brown
>
> > > I'm a little concerned with a collision with multi codec here. It'd
> > > be handy if you could keep it separate in case it needs merging
> > > into both trees (or we could merge via ASoC only).
>
> > Hmmm.  Yeah, probably better to take it via your tree then.  I've
> > currently got patch 1 in linux-next, but I'll drop it before asking
> > benh to pull.  Go ahead and add my acked-by.
>
> Looks like multi-component is slightly too late for .36 and I don't have
> the original patch any more since it looked like you were going to be
> carrying it...  could you restore the patch to your tree please?

 Grant, are you going to pick up this series for .36?

Eric

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2 v4] powerpc/5200: add mpc5200_psc_ac97_gpio_reset

2010-06-15 Thread Eric Millbrandt
Work around a silicon bug in the ac97 reset functionality of the
mpc5200(b).  The implementation of the ac97 "cold" reset is flawed.
If the sync and output lines are high when reset is asserted the
attached ac97 device may go into test mode.  Avoid this by
reconfiguring the psc to gpio mode and generating the reset manually.

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Amended with comments from Mark Brown
- Fall back to the original reset implementation if no gpio pins are defined
  in the device tree

changes since v2
- Refactored to move the port_config manipulation to platform code.
- Remove the gpio pins from the device-tree

changes since v3
- Remove redundant checks around call to mpc5200_psc_ac97_gpio_reset()

changes since v4
- cleanup inverted logic

 arch/powerpc/include/asm/mpc52xx.h   |1 +
 arch/powerpc/include/asm/mpc52xx_psc.h   |1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |  111 ++
 3 files changed, 113 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h 
b/arch/powerpc/include/asm/mpc52xx.h
index b664ce7..1f41382 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -271,6 +271,7 @@ struct mpc52xx_intr {
 /* mpc52xx_common.c */
 extern void mpc5200_setup_xlb_arbiter(void);
 extern void mpc52xx_declare_of_platform_devices(void);
+extern int mpc5200_psc_ac97_gpio_reset(int psc_number);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
 extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h 
b/arch/powerpc/include/asm/mpc52xx_psc.h
index ecc4fc6..2966df6 100644
--- a/arch/powerpc/include/asm/mpc52xx_psc.h
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -131,6 +131,7 @@
 #define MPC52xx_PSC_SICR_SIM_FIR   (0x6 << 24)
 #define MPC52xx_PSC_SICR_SIM_CODEC_24  (0x7 << 24)
 #define MPC52xx_PSC_SICR_SIM_CODEC_32  (0xf << 24)
+#define MPC52xx_PSC_SICR_ACRB  (0x8 << 24)
 #define MPC52xx_PSC_SICR_AWR   (1 << 30)
 #define MPC52xx_PSC_SICR_GENCLK(1 << 23)
 #define MPC52xx_PSC_SICR_I2S   (1 << 22)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index a46bad0..1887872 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -12,9 +12,11 @@

 #undef DEBUG

+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -82,6 +84,14 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }

+/*
+ * This variable is mapped in mpc52xx_map_common_devices and
+ * used in mpc5200_psc_ac97_gpio_reset().
+ */
+static DEFINE_SPINLOCK(gpio_lock);
+struct mpc52xx_gpio __iomem *simple_gpio;
+struct mpc52xx_gpio_wkup __iomem *wkup_gpio;
+
 /**
  * mpc52xx_declare_of_platform_devices: register internal devices and children
  * of the localplus bus to the of_platform
@@ -109,6 +119,19 @@ static struct of_device_id mpc52xx_cdm_ids[] __initdata = {
{ .compatible = "mpc5200-cdm", }, /* old */
{}
 };
+static const struct of_device_id mpc52xx_gpio_simple[] = {
+   {
+   .compatible = "fsl,mpc5200-gpio",
+   },
+   {}
+};
+static const struct of_device_id mpc52xx_gpio_wkup[] = {
+   {
+   .compatible = "fsl,mpc5200-gpio-wkup",
+   },
+   {}
+};
+

 /**
  * mpc52xx_map_common_devices: iomap devices required by common code
@@ -135,6 +158,16 @@ mpc52xx_map_common_devices(void)
np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
mpc52xx_cdm = of_iomap(np, 0);
of_node_put(np);
+
+   /* simple_gpio registers */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
+   simple_gpio = of_iomap(np, 0);
+   of_node_put(np);
+
+   /* wkup_gpio registers */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_wkup);
+   wkup_gpio = of_iomap(np, 0);
+   of_node_put(np);
 }

 /**
@@ -233,3 +266,81 @@ mpc52xx_restart(char *cmd)

while (1);
 }
+
+#define PSC1_RESET 0x1
+#define PSC1_SYNC  0x4
+#define PSC1_SDATA_OUT 0x1
+#define PSC2_RESET 0x2
+#define PSC2_SYNC  (0x4<<4)
+#define PSC2_SDATA_OUT (0x1<<4)
+#define MPC52xx_GPIO_PSC1_MASK 0x7
+#define MPC52xx_GPIO_PSC2_MASK (0x7<<4)
+
+/**
+ * mpc5200_psc_ac97_gpio_

[PATCH 2/2 v4] sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset

2010-06-15 Thread Eric Millbrandt
Call the gpio reset platform function instead of using the flawed
ac97 functionality of the MPC5200(b)

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Amended with comments from Mark Brown
- Fall back to the original reset implementation if no gpio pins are defined
  in the device tree

changes since v2
- Refactored to move the port_config manipulation to platform code.
- Remove the gpio pins from the device-tree

changes since v3
- Remove redundant checks around call to mpc5200_psc_ac97_gpio_reset()

 sound/soc/fsl/mpc5200_psc_ac97.c |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index e2ee220..e7f5d50 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -20,6 +20,7 @@

 #include 
 #include 
+#include 
 #include 

 #include "mpc5200_dma.h"
@@ -100,19 +101,32 @@ static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

+   mutex_lock(&psc_dma->mutex);
+
out_be32(®s->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
udelay(3);
out_be32(®s->sicr, psc_dma->sicr);
+
+   mutex_unlock(&psc_dma->mutex);
 }

 static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 {
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

-   /* Do a cold reset */
-   out_8(®s->op1, MPC52xx_PSC_OP_RES);
-   udelay(10);
-   out_8(®s->op0, MPC52xx_PSC_OP_RES);
+   mutex_lock(&psc_dma->mutex);
+   dev_dbg(psc_dma->dev, "cold reset\n");
+
+   mpc5200_psc_ac97_gpio_reset(psc_dma->id);
+
+   /* Notify the PSC that a reset has occurred */
+   out_be32(®s->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_ACRB);
+
+   /* Re-enable RX and TX */
+   out_8(®s->command, MPC52xx_PSC_TX_ENABLE | MPC52xx_PSC_RX_ENABLE);
+
+   mutex_unlock(&psc_dma->mutex);
+
msleep(1);
psc_ac97_warm_reset(ac97);
 }
--
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

1.6.3.1


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2 v3] powerpc/5200: add mpc5200_psc_ac97_gpio_reset

2010-06-15 Thread Eric Millbrandt
Work around a silicon bug in the ac97 reset functionality of the
mpc5200(b).  The implementation of the ac97 "cold" reset is flawed.
If the sync and output lines are high when reset is asserted the
attached ac97 device may go into test mode.  Avoid this by
reconfiguring the psc to gpio mode and generating the reset manually.

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Refactored to manipulate port_config and gpio pins internally instead of
  exporting an API.

changes since v2
- Factored out gpiolib calls, write to the gpio registers directly

 arch/powerpc/include/asm/mpc52xx.h   |1 +
 arch/powerpc/include/asm/mpc52xx_psc.h   |1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |  113 ++
 3 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h 
b/arch/powerpc/include/asm/mpc52xx.h
index b664ce7..1f41382 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -271,6 +271,7 @@ struct mpc52xx_intr {
 /* mpc52xx_common.c */
 extern void mpc5200_setup_xlb_arbiter(void);
 extern void mpc52xx_declare_of_platform_devices(void);
+extern int mpc5200_psc_ac97_gpio_reset(int psc_number);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
 extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h 
b/arch/powerpc/include/asm/mpc52xx_psc.h
index ecc4fc6..2966df6 100644
--- a/arch/powerpc/include/asm/mpc52xx_psc.h
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -131,6 +131,7 @@
 #define MPC52xx_PSC_SICR_SIM_FIR   (0x6 << 24)
 #define MPC52xx_PSC_SICR_SIM_CODEC_24  (0x7 << 24)
 #define MPC52xx_PSC_SICR_SIM_CODEC_32  (0xf << 24)
+#define MPC52xx_PSC_SICR_ACRB  (0x8 << 24)
 #define MPC52xx_PSC_SICR_AWR   (1 << 30)
 #define MPC52xx_PSC_SICR_GENCLK(1 << 23)
 #define MPC52xx_PSC_SICR_I2S   (1 << 22)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index a46bad0..116d461 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -12,9 +12,11 @@

 #undef DEBUG

+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -82,6 +84,14 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }

+/*
+ * This variable is mapped in mpc52xx_map_common_devices and
+ * used in mpc5200_psc_ac97_gpio_reset().
+ */
+static DEFINE_SPINLOCK(gpio_lock);
+struct mpc52xx_gpio __iomem *simple_gpio;
+struct mpc52xx_gpio_wkup __iomem *wkup_gpio;
+
 /**
  * mpc52xx_declare_of_platform_devices: register internal devices and children
  * of the localplus bus to the of_platform
@@ -109,6 +119,19 @@ static struct of_device_id mpc52xx_cdm_ids[] __initdata = {
{ .compatible = "mpc5200-cdm", }, /* old */
{}
 };
+static const struct of_device_id mpc52xx_gpio_simple[] = {
+   {
+   .compatible = "fsl,mpc5200-gpio",
+   },
+   {}
+};
+static const struct of_device_id mpc52xx_gpio_wkup[] = {
+   {
+   .compatible = "fsl,mpc5200-gpio-wkup",
+   },
+   {}
+};
+

 /**
  * mpc52xx_map_common_devices: iomap devices required by common code
@@ -135,6 +158,16 @@ mpc52xx_map_common_devices(void)
np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
mpc52xx_cdm = of_iomap(np, 0);
of_node_put(np);
+
+   /* simple_gpio registers */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
+   simple_gpio = of_iomap(np, 0);
+   of_node_put(np);
+
+   /* wkup_gpio registers */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_wkup);
+   wkup_gpio = of_iomap(np, 0);
+   of_node_put(np);
 }

 /**
@@ -233,3 +266,83 @@ mpc52xx_restart(char *cmd)

while (1);
 }
+
+#define PSC1_RESET 0x1
+#define PSC1_SYNC  0x4
+#define PSC1_SDATA_OUT 0x1
+#define PSC2_RESET 0x2
+#define PSC2_SYNC  (0x4<<4)
+#define PSC2_SDATA_OUT (0x1<<4)
+#define MPC52xx_GPIO_PSC1_MASK 0x7
+#define MPC52xx_GPIO_PSC2_MASK (0x7<<4)
+
+/**
+ * mpc5200_psc_ac97_gpio_reset: Use gpio pins to reset the ac97 bus
+ *
+ * @psc: psc number to reset (only psc 1 and 2 support ac97)
+ */
+int mpc5200_psc_ac97_gpio_reset(int psc_number)
+{
+   unsigned long flags;
+   u32 gp

[PATCH 0/2 v3] mpc5200 ac97 gpio reset

2010-06-15 Thread Eric Millbrandt
These patches reimplement the reset fuction in the ac97 to use gpio pins
instead of using the mpc5200 ac97 reset functionality in the psc.  This
avoids a problem in which attached ac97 devices go into "test" mode appear
unresponsive.

These patches were tested on a pcm030 baseboard and on custom hardware with
a wm9715 audio codec/touchscreen controller.

Eric Millbrandt

---

changes since v1
- Refactored to manipulate port_config and gpio pins internally instead of
  exporting an API.
- Amended commit message with comments from Mark Brown
- Refactored to move the port_config manipulation to platform code.
- Remove the gpio pins from the device-tree

changes since v2
- Factored out gpiolib calls, write to the gpio registers directly
- Remove redundant checks around call to mpc5200_psc_ac97_gpio_reset()

Eric Millbrandt (2):
powerpc/5200: add mpc5200_psc_ac97_gpio_reset
sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset

 arch/powerpc/include/asm/mpc52xx.h   |1 +
 arch/powerpc/include/asm/mpc52xx_psc.h   |1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |  113 ++
 sound/soc/fsl/mpc5200_psc_ac97.c |   22 -
 4 files changed, 133 insertions(+), 4 deletions(-)

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2 v3] sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset

2010-06-14 Thread Eric Millbrandt
Call the gpio reset platform function instead of using the flawed
ac97 functionality of the MPC5200(b)

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Amended with comments from Mark Brown
- Fall back to the original reset implementation if no gpio pins are defined
  in the device tree

changes since v2
- Refactored to move the port_config manipulation to platform code.
- Remove the gpio pins from the device-tree

 sound/soc/fsl/mpc5200_psc_ac97.c |   33 +
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index e2ee220..380a127 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -20,6 +20,7 @@

 #include 
 #include 
+#include 
 #include 

 #include "mpc5200_dma.h"
@@ -100,19 +101,43 @@ static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

+   mutex_lock(&psc_dma->mutex);
+
out_be32(®s->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
udelay(3);
out_be32(®s->sicr, psc_dma->sicr);
+
+   mutex_unlock(&psc_dma->mutex);
 }

+#define  MPC52xx_PSC_SICR_ACRB (0x8 << 24)
 static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 {
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

-   /* Do a cold reset */
-   out_8(®s->op1, MPC52xx_PSC_OP_RES);
-   udelay(10);
-   out_8(®s->op0, MPC52xx_PSC_OP_RES);
+   mutex_lock(&psc_dma->mutex);
+
+   switch (psc_dma->id) {
+   case 0:
+   case 1:
+   mpc5200_psc_ac97_gpio_reset(psc_dma->id);
+   dev_info(psc_dma->dev, "cold reset\n");
+
+   /* Notify the PSC that a reset has occurred */
+   out_be32(®s->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_ACRB);
+
+   /* Re-enable RX and TX */
+   out_8(®s->command, MPC52xx_PSC_TX_ENABLE | 
MPC52xx_PSC_RX_ENABLE);
+
+   break;
+   default:
+   dev_err(psc_dma->dev,
+   "Unable to determine PSC, no cold-reset will be "
+   "performed\n");
+   }
+
+   mutex_unlock(&psc_dma->mutex);
+
msleep(1);
psc_ac97_warm_reset(ac97);
 }
--
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

1.6.3.1


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2 v2] powerpc/5200: add mpc5200_psc_ac97_gpio_reset

2010-06-14 Thread Eric Millbrandt
Work around a silicon bug in the ac97 reset functionality of the
mpc5200(b).  The implementation of the ac97 "cold" reset is flawed.
If the sync and output lines are high when reset is asserted the
attached ac97 device may go into test mode.  Avoid this by
reconfiguring the psc to gpio mode and generating the reset manually.

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Refactored to manipulate port_config and gpio pins internally instead of
  exporting an API.

 arch/powerpc/include/asm/mpc52xx.h   |1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |  103 ++
 2 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h 
b/arch/powerpc/include/asm/mpc52xx.h
index b664ce7..1f41382 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -271,6 +271,7 @@ struct mpc52xx_intr {
 /* mpc52xx_common.c */
 extern void mpc5200_setup_xlb_arbiter(void);
 extern void mpc52xx_declare_of_platform_devices(void);
+extern int mpc5200_psc_ac97_gpio_reset(int psc_number);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
 extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index a46bad0..a9866fa 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -12,9 +12,11 @@

 #undef DEBUG

+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +39,11 @@ static struct of_device_id mpc52xx_bus_ids[] __initdata = {
{}
 };

+static struct of_device_id mpc52xx_gpio_simple[] = {
+   { .compatible = "fsl,mpc5200-gpio", },
+   {}
+};
+
 /*
  * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
  * Permanent mapping is required because mpc52xx_restart() can be called
@@ -82,6 +89,13 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }

+/*
+ * This variable is mapped in mpc52xx_write_port_config() and
+ * mpc52xx_read_port_config().
+ */
+DEFINE_SPINLOCK(mpc52xx_gpio_lock);
+static u32 __iomem *port_config;
+
 /**
  * mpc52xx_declare_of_platform_devices: register internal devices and children
  * of the localplus bus to the of_platform
@@ -117,6 +131,7 @@ void __init
 mpc52xx_map_common_devices(void)
 {
struct device_node *np;
+   const u32 *regaddr;

/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
 * possibly from a interrupt context. wdt is only implement
@@ -135,6 +150,13 @@ mpc52xx_map_common_devices(void)
np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
mpc52xx_cdm = of_iomap(np, 0);
of_node_put(np);
+
+   /* port_config register */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
+   regaddr = of_get_address(np, 0, NULL, NULL);
+   port_config = ioremap((u32) of_translate_address(np, regaddr), 0x4);
+
+   of_node_put(np);
 }

 /**
@@ -233,3 +255,84 @@ mpc52xx_restart(char *cmd)

while (1);
 }
+
+#define PSC1_RESET 254
+#define PSC1_SYNC  244
+#define PSC1_SDATA_OUT 246
+#define PSC2_RESET 253
+#define PSC2_SYNC  240
+#define PSC2_SDATA_OUT 242
+#define MPC52xx_GPIO_PSC1_MASK 0x7
+#define MPC52xx_GPIO_PSC2_MASK (0x7<<4)
+
+/**
+ * mpc5200_psc_ac97_gpio_reset: Use gpio pins to reset the ac97 bus
+ *
+ * @psc: psc number to reset (only psc 1 and 2 support ac97)
+ */
+int mpc5200_psc_ac97_gpio_reset(int psc_number)
+{
+   unsigned long flags;
+   u32 gpio;
+   u32 mux;
+   int out;
+   int reset;
+   int sync;
+
+   if (!port_config)
+   return -ENODEV;
+
+   switch (psc_number) {
+   case 0:
+   reset   = PSC1_RESET;   /* AC97_1_RES */
+   sync= PSC1_SYNC;/* AC97_1_SYNC */
+   out = PSC1_SDATA_OUT;   /* AC97_1_SDATA_OUT */
+   gpio= MPC52xx_GPIO_PSC1_MASK;
+   break;
+   case 1:
+   reset   = PSC2_RESET;   /* AC97_2_RES */
+   sync= PSC2_SYNC;/* AC97_2_SYNC */
+   out = PSC2_SDATA_OUT;   /* AC97_2_SDATA_OUT */
+   gpio= MPC52xx_GPIO_PSC2_MASK;
+   break;
+   default:
+   printk(KERN_ERR __FILE__ ": "
+ "Unable to determine PSC, no ac97 cold-reset will be "
+   

[PATCH 0/2 v2] mpc5200 ac97 gpio reset

2010-06-14 Thread Eric Millbrandt
These patches reimplement the reset fuction in the ac97 to use gpio pins
instead of using the mpc5200 ac97 reset functionality in the psc.  This
avoids a problem in which attached ac97 devices go into "test" mode appear
unresponsive.

These patches were tested on a pcm030 baseboard and on custom hardware with
a wm9715 audio codec/touchscreen controller.

Eric Millbrandt

---

changes since v1
- Refactored to manipulate port_config and gpio pins internally instead of
  exporting an API.
- Amended commit message with comments from Mark Brown
- Refactored to move the port_config manipulation to platform code.
- Remove the gpio pins from the device-tree

Eric Millbrandt (2):
powerpc/5200: add mpc5200_psc_ac97_gpio_reset
sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset

 arch/powerpc/include/asm/mpc52xx.h   |1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |  103 ++
 sound/soc/fsl/mpc5200_psc_ac97.c |   33 +++-
 3 files changed, 133 insertions(+), 4 deletions(-)

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-



This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2 v2] sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset.

2010-06-09 Thread Eric Millbrandt
The implementation of the ac97 "cold" reset is flawed.  If the sync and
output lines are high when reset is asserted the attached ac97 device
may go into test mode.  Avoid this by reconfiguring the psc to gpio mode
and generating the reset manually.

>From MPC5200B User's Manual:
"Some AC97 devices goes to a test mode, if the Sync line is high
during the Res line is low (reset phase). To avoid this behavior the
Sync line must be also forced to zero during the reset phase. To do
that, the pin muxing should switch to GPIO mode and the GPIO control
register should be used to control the output lines."

Signed-off-by: Eric Millbrandt 
---

changes since v1
- Amended with comments from Mark Brown
- Fall back to the original reset implementation if no gpio pins are defined
  in the device tree

 arch/powerpc/boot/dts/lite5200.dts  |3 +
 arch/powerpc/boot/dts/lite5200b.dts |3 +
 arch/powerpc/boot/dts/pcm030.dts|3 +
 arch/powerpc/boot/dts/pcm032.dts|3 +
 sound/soc/fsl/mpc5200_dma.h |5 ++
 sound/soc/fsl/mpc5200_psc_ac97.c|   98 +--
 6 files changed, 111 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/boot/dts/lite5200.dts 
b/arch/powerpc/boot/dts/lite5200.dts
index 82ff2b1..cb4e49b 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -180,6 +180,9 @@
//  compatible = "fsl,mpc5200-psc-ac97";
//  cell-index = <1>;
//  reg = <0x2200 0x100>;
+   //  gpios = <&gpio 7 0  /* AC97_1_RES */
+   //   &gpio_simple 29 0  /* AC97_1_SYNC */
+   //   &gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
//  interrupts = <2 2 0>;
//};

diff --git a/arch/powerpc/boot/dts/lite5200b.dts 
b/arch/powerpc/boot/dts/lite5200b.dts
index e45a63b..1fb0ac7 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -184,6 +184,9 @@
//  compatible = 
"fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
//  cell-index = <1>;
//  reg = <0x2200 0x100>;
+   //  gpios = <&gpio 7 0  /* AC97_1_RES */
+   //   &gpio_simple 29 0  /* AC97_1_SYNC */
+   //   &gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
//  interrupts = <2 2 0>;
//};

diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 8a4ec30..0085e0f 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -189,6 +189,9 @@
compatible = 
"mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
cell-index = <0>;
reg = <0x2000 0x100>;
+   gpios = <&gpio 7 0  /* AC97_1_RES */
+&gpio_simple 29 0  /* AC97_1_SYNC */
+&gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
interrupts = <2 1 0>;
};

diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
index 85d857a..76f86d3 100644
--- a/arch/powerpc/boot/dts/pcm032.dts
+++ b/arch/powerpc/boot/dts/pcm032.dts
@@ -189,6 +189,9 @@
compatible = 
"fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
cell-index = <0>;
reg = <0x2000 0x100>;
+   gpios = <&gpio 7 0  /* AC97_1_RES */
+&gpio_simple 29 0  /* AC97_1_SYNC */
+&gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
interrupts = <2 1 0>;
};

diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index 22208b3..9fb0248 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -61,6 +61,11 @@ struct psc_dma {
int id;
unsigned int slots;

+   /* gpio pins locations for cold reset */
+   int reset_gpio;
+   int sync_gpio;
+   int out_gpio;
+
/* per-stream data */
struct psc_dma_stream playback;
struct psc_dma_stream capture;
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index e2ee220..08cd51f 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -9,8 +9,10 @@
  * published by the Free Software Foundation.
  */

+#include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -20,12 +22,17 @@

 #include 
 #include 
+#include 
 #include 

 #include "mpc520

RE: [PATCH 0/2] mpc5200 ac97 gpio reset

2010-06-09 Thread Eric Millbrandt
> -Original Message-
> From: Mark Brown [mailto:broo...@opensource.wolfsonmicro.com]
> Sent: Wednesday, June 09, 2010 06:31
> To: Wolfgang Denk
> Cc: Jon Smirl; Eric Millbrandt; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH 0/2] mpc5200 ac97 gpio reset
--snip--
> It might, however, be sensible to make the GPIO based reset be optional
> based on having the OF data for the GPIOs.  That way existing DTs will
> work without changes and systems that can use the reset implementation
> in the controller will be able to do so.

This is a reasonable request.  I will respin the patch to do this.

Eric Millbrandt

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: [PATCH 0/2] mpc5200 ac97 gpio reset

2010-06-09 Thread Eric Millbrandt
> -Original Message-
> From: Jon Smirl [mailto:jonsm...@gmail.com]
> Sent: Wednesday, June 09, 2010 08:22
> To: Wolfgang Denk
> Cc: Eric Millbrandt; Mark Brown; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH 0/2] mpc5200 ac97 gpio reset
>
> On Wed, Jun 9, 2010 at 2:13 AM, Wolfgang Denk  wrote:
> > Dear Jon Smirl,
> >
> > In message  @mail.gmail.com> you wrote:
> >>
> >> Would making a change in uboot be a better solution? Eric, can you
> >> verify if changing uboot also fixes the problem?
> >
> > To me it seems better if the driver itself does what needs to be done
> > instead of relying on specific settings that may or may not be done in
> > U-Boot. Keep in mind that drivers may be loaded as modules, and that
> > we even see cases where the same port serves multiple purposes by
> > loading different driver modules (yes, this is not exactly a clever
> > idea, but hardware designers come up with such solutions).
>
>
> Someone with a scope can verify this, but my understanding of what
> happens is that uboot by default puts the pins into GPIO mode. Linux
> boots and reprograms the pins into AC97 mode. When the pins are
> reprogrammed it generates glitches on the reset line. About half of
> the time these glitches put the attached codec into test mode. Once
> the chip is in test mode it won't respond to normal commands.
>

Most of the pins on the 5200 default to gpio when the chip comes out of reset.  
U-Boot then sets the pin muxing by writing to the port configuration register.  
This value is defined as CONFIG_SYS_GPS_PORT_CONFIG in the U-Boot board header 
file.

The implementation of ac97 gives the codec control of the bus clock.  This 
means that the codec is usually be clocking BITCLK when the 5200 pulls the 
reset line low, which is the cause of the problem.  Freescale should have 
handled this on the silicon by having the ac97 cold reset function pull the 
SYNC and SDATAOUT lines low during cold reset, but instead they just documented 
the problem.

>From the MPC5200B user manual:
"Some AC97 devices goes to a test mode, if the Sync line is high during the Res 
line is low (reset phase). To avoid this behavior the Sync line must be also 
forced to zero during the reset phase. To do that, the pin muxing should switch 
to GPIO mode and the GPIO control register should be used to control the output 
lines."

> Another strategy would be to leave reset as is. If the chip is
> unresponsive send it the commands to get it out of test mode. That
> could be made part of the reset logic in the Linux driver.

This is what we used to do when we were using the out-of-tree ac97 driver from 
Sylvain Munaut.  We would generate a cold reset/warm reset sequence in U-Boot.  
We modified the Linux ac97 driver so that the cold reset functions was a no-op. 
 It did avoid the problem, but it caused other problems.  Sometimes it is 
necessary to cold reset the codec in Linux to resync the ac97 bus.

>
>
> >
> >
> > Best regards,
> >
> > Wolfgang Denk
> >
> > --
> > DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
> > The typical page layout program is nothing more  than  an  electronic
> > light table for cutting and pasting documents.
> >
>
>
>
> --
> Jon Smirl
> jonsm...@gmail.com

Eric Millbrandt

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 0/2] mpc5200 ac97 gpio reset

2010-06-08 Thread Eric Millbrandt
These patches reimplement the reset fuction in the ac97 to use gpio pins
instead of using the mpc5200 ac97 reset functionality in the psc.  This
avoids a problem in which attached ac97 devices go into "test" mode appear
unresponsive.

These patches were tested on a pcm030 baseboard and on custom hardware with
a wm9715 audio codec/touchscreen controller.

Eric Millbrandt

---

Eric Millbrandt (2):
powerpc/5200: Export port-config
sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset.

 arch/powerpc/boot/dts/lite5200.dts   |3 +
 arch/powerpc/boot/dts/lite5200b.dts  |3 +
 arch/powerpc/boot/dts/pcm030.dts |3 +
 arch/powerpc/boot/dts/pcm032.dts |3 +
 arch/powerpc/include/asm/mpc52xx.h   |2 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   61 +++
 sound/soc/fsl/mpc5200_dma.h  |5 ++
 sound/soc/fsl/mpc5200_psc_ac97.c |   83 -
 8 files changed, 159 insertions(+), 4 deletions(-)

-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2] powerpc/5200: Export port-config

2010-06-08 Thread Eric Millbrandt
Allow device drivers to safely modify port-config.  This allows device drivers
access to gpio pins to manually bit-bang slave devices.

Signed-off-by: Eric Millbrandt 
---
 arch/powerpc/include/asm/mpc52xx.h   |2 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |   61 ++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/mpc52xx.h 
b/arch/powerpc/include/asm/mpc52xx.h
index b664ce7..ebc5a3b 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -274,7 +274,9 @@ extern void mpc52xx_declare_of_platform_devices(void);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
 extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
+extern unsigned int mpc52xx_read_port_config(void);
 extern void mpc52xx_restart(char *cmd);
+extern int mpc52xx_write_port_config(u32 mux, int operation);

 /* mpc52xx_gpt.c */
 struct mpc52xx_gpt_priv;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c 
b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index a46bad0..77c685a 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -37,6 +37,11 @@ static struct of_device_id mpc52xx_bus_ids[] __initdata = {
{}
 };

+static struct of_device_id mpc52xx_gpio_simple[] = {
+   { .compatible = "fsl,mpc5200-gpio", },
+   {}
+};
+
 /*
  * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
  * Permanent mapping is required because mpc52xx_restart() can be called
@@ -82,6 +87,15 @@ mpc5200_setup_xlb_arbiter(void)
iounmap(xlb);
 }

+/*
+ * This variable is mapped in mpc52xx_write_port_config() and
+ * mpc52xx_read_port_config().  Permanent mapping is required because
+ * mpc52xx_map_and_lock_port_config() can be called from interrupt context
+ * while node mapping (which calls ioremap()) cannot be used at such point.
+ */
+static DEFINE_SPINLOCK(mpc52xx_port_config_lock);
+static u32 __iomem *port_config;
+
 /**
  * mpc52xx_declare_of_platform_devices: register internal devices and children
  * of the localplus bus to the of_platform
@@ -117,6 +131,7 @@ void __init
 mpc52xx_map_common_devices(void)
 {
struct device_node *np;
+   const u32 *regaddr;

/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
 * possibly from a interrupt context. wdt is only implement
@@ -135,6 +150,13 @@ mpc52xx_map_common_devices(void)
np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
mpc52xx_cdm = of_iomap(np, 0);
of_node_put(np);
+
+   /* port_config register */
+   np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
+   regaddr = of_get_address(np, 0, NULL, NULL);
+   port_config = ioremap((u32) of_translate_address(np, regaddr), 0x4);
+
+   of_node_put(np);
 }

 /**
@@ -233,3 +255,42 @@ mpc52xx_restart(char *cmd)

while (1);
 }
+
+/**
+ * mpc52xx_write_port_config: Allow mutually exclusive access to the
+ * port_config register
+ *
+ * @newmux: value to write to port_config
+ * @operation: set to 0 for | or 1 for &
+ */
+int mpc52xx_write_port_config(u32 newmux, int operation)
+{
+   unsigned long flags;
+   u32 mux;
+
+   if (!port_config)
+   return -ENODEV;
+
+   spin_lock_irqsave(&mpc52xx_port_config_lock, flags);
+   mux = in_be32(port_config);
+   if (operation)
+   out_be32(port_config, mux & newmux);
+   else
+   out_be32(port_config, mux | newmux);
+   spin_unlock_irqrestore(&mpc52xx_port_config_lock, flags);
+
+   return 0;
+}
+EXPORT_SYMBOL(mpc52xx_write_port_config);
+
+/**
+ * mpc52xx_read_port_config: Return the value of port_config
+ */
+unsigned int mpc52xx_read_port_config(void)
+{
+   if (!port_config)
+   return -ENODEV;
+
+   return in_be32(port_config);
+}
+EXPORT_SYMBOL(mpc52xx_read_port_config);
--
1.6.3.1


This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/2] sound/soc: mpc5200_psc_ac97: Use gpio pins for cold reset.

2010-06-08 Thread Eric Millbrandt
The implementation of the ac97 "cold" reset is flawed.  If the sync and
output lines are high when reset is asserted the attached ac97 device
may go into test mode.  Avoid this by reconfiguring the psc to gpio mode
and generating the reset manually.

Signed-off-by: Eric Millbrandt 
---
 arch/powerpc/boot/dts/lite5200.dts  |3 +
 arch/powerpc/boot/dts/lite5200b.dts |3 +
 arch/powerpc/boot/dts/pcm030.dts|3 +
 arch/powerpc/boot/dts/pcm032.dts|3 +
 sound/soc/fsl/mpc5200_dma.h |5 ++
 sound/soc/fsl/mpc5200_psc_ac97.c|   83 +--
 6 files changed, 96 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/boot/dts/lite5200.dts 
b/arch/powerpc/boot/dts/lite5200.dts
index 82ff2b1..cb4e49b 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -180,6 +180,9 @@
//  compatible = "fsl,mpc5200-psc-ac97";
//  cell-index = <1>;
//  reg = <0x2200 0x100>;
+   //  gpios = <&gpio 7 0  /* AC97_1_RES */
+   //   &gpio_simple 29 0  /* AC97_1_SYNC */
+   //   &gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
//  interrupts = <2 2 0>;
//};

diff --git a/arch/powerpc/boot/dts/lite5200b.dts 
b/arch/powerpc/boot/dts/lite5200b.dts
index e45a63b..1fb0ac7 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -184,6 +184,9 @@
//  compatible = 
"fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
//  cell-index = <1>;
//  reg = <0x2200 0x100>;
+   //  gpios = <&gpio 7 0  /* AC97_1_RES */
+   //   &gpio_simple 29 0  /* AC97_1_SYNC */
+   //   &gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
//  interrupts = <2 2 0>;
//};

diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 8a4ec30..0085e0f 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -189,6 +189,9 @@
compatible = 
"mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97";
cell-index = <0>;
reg = <0x2000 0x100>;
+   gpios = <&gpio 7 0  /* AC97_1_RES */
+&gpio_simple 29 0  /* AC97_1_SYNC */
+&gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
interrupts = <2 1 0>;
};

diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
index 85d857a..76f86d3 100644
--- a/arch/powerpc/boot/dts/pcm032.dts
+++ b/arch/powerpc/boot/dts/pcm032.dts
@@ -189,6 +189,9 @@
compatible = 
"fsl,mpc5200b-psc-ac97","fsl,mpc5200-psc-ac97";
cell-index = <0>;
reg = <0x2000 0x100>;
+   gpios = <&gpio 7 0  /* AC97_1_RES */
+&gpio_simple 29 0  /* AC97_1_SYNC */
+&gpio_simple 31 0>;/* AC97_1_SDATA_OUT */
interrupts = <2 1 0>;
};

diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index 22208b3..9fb0248 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -61,6 +61,11 @@ struct psc_dma {
int id;
unsigned int slots;

+   /* gpio pins locations for cold reset */
+   int reset_gpio;
+   int sync_gpio;
+   int out_gpio;
+
/* per-stream data */
struct psc_dma_stream playback;
struct psc_dma_stream capture;
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index e2ee220..bbbf860 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -9,8 +9,10 @@
  * published by the Free Software Foundation.
  */

+#include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -20,12 +22,17 @@

 #include 
 #include 
+#include 
 #include 

 #include "mpc5200_dma.h"
 #include "mpc5200_psc_ac97.h"

 #define DRV_NAME "mpc5200-psc-ac97"
+#define MPC52xx_GPIO_PSC1_MASK 0x7
+#define MPC52xx_GPIO_PSC2_MASK (0x7<<4)
+#define MPC52xx_AC97_PSC1 0x2
+#define MPC52xx_AC97_PSC2 (0x2<<4)

 /* ALSA only supports a single AC97 device so static is recommend here */
 static struct psc_dma *psc_dma;
@@ -100,19 +107,69 @@ static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;

+   mutex_lo

RE: [PATCH] alsa/soc: add locking to mpc5200-psc-ac97 driver

2009-07-02 Thread Eric Millbrandt
-Original Message-
From: linuxppc-dev-bounces+emillbrandt=dekaresearch@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+emillbrandt=dekaresearch@lists.ozlabs.o
rg] On Behalf Of Grant Likely
Sent: Wednesday, July 01, 2009 10:45
To: Wolfram Sang
Cc: linuxppc-...@ozlabs.org; alsa-de...@alsa-project.org;
broo...@sirena.org.uk
Subject: Re: [PATCH] alsa/soc: add locking to mpc5200-psc-ac97 driver

On Wed, Jul 1, 2009 at 7:55 AM, Wolfram Sang
wrote:
>
>> > Sorry, I didn't get it: Shall I test something specific?
>>
>> I don't own a touchscreen.
>>
>> AFAIK no one has ever plugged a touchscreen into the PCM-973 to see
if
>> works since there hasn't been a driver previously.
>> Just do a general
>> test so that you can tell customers that it works.
>
> I am not sure, we have a suitable touchscreen. Also, I am afraid this
is a bit
> too much to do besides my regular day work right now. Sorry.

I've now tested this on a client's board which uses the pcm030 with a
custom base board (based on the development board) which uses the same
codec.  It works there.  I don't have a discrete touchscreen to wire
up to the PCM-973 though.

g.

-- 

There is a header on the phytec PCM-973 base board (X20) that brings out
aux1, aux2, aux3, aux4 (wiper) ADCs from the wm9712.  The ADCs use chip
registers the same way the touchscreen does.  There is even support for
doing this through the wm97xx-core driver (wm97xx_read_aux_adc).  If you
wanted to test it out I would put a pot or some fixed voltage divider on
one of those inputs and give it a try.  I don't know what the internal
ADC ref is, I think its 1.65V so whatever signal you put in should be
less than that.

Eric


_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: mpc5200 fec error

2009-05-20 Thread Eric Millbrandt
-Original Message-
From: Grant Likely [mailto:grant.lik...@secretlab.ca] 
Sent: Wednesday, May 20, 2009 12:49
To: Eric Millbrandt
Cc: Jon Smirl; Wolfram Sang; linuxppc-dev@ozlabs.org
Subject: Re: mpc5200 fec error

On Wed, May 20, 2009 at 10:41 AM, Eric Millbrandt
 wrote:
> It looks like the phy is never getting reset properly after the 
> FEC_IEVENT_RFIFO_ERROR.  I threw some printk's into the fec mdio driver

Yes, that sounds familiar.  Most likely, the value of the MDIO bus
control register got clobbered and not reset when the FEC was reset.
Try adding this line to the beginning of mpc52xx_fec_mdio_transfer():

out_be32(&fec->mii_speed, 0x7e);

It's a dirty ugly hack, but it should help.  If that works, then I can
come up with a better solution.  Part of the problem is that the MDIO
handling in the current code really isn't very good.  I've got changes
queued up in -next which cleans it up quite a bit which should make it
easier to fix properly.

g.

That worked!  I'm still getting the fifo receive errors, but at least now the 
fec recovers.

[  127.761365] net eth0: FEC_IEVENT_RFIFO_ERROR 
[  129.274341] PHY: f0003000:00 - Link is Down
[  130.274266] PHY: f0003000:00 - Link is Up - 100/Full
[  134.955324] net eth0: FEC_IEVENT_RFIFO_ERROR
[  136.273959] PHY: f0003000:00 - Link is Down
[  137.274090] PHY: f0003000:00 - Link is Up - 100/Full
[  140.521462] net eth0: FEC_IEVENT_RFIFO_ERROR
[  142.273955] PHY: f0003000:00 - Link is Down
[  143.273954] PHY: f0003000:00 - Link is Up - 100/Full
[  148.471582] net eth0: FEC_IEVENT_RFIFO_ERROR
[  150.273984] PHY: f0003000:00 - Link is Down
[  151.273901] PHY: f0003000:00 - Link is Up - 100/Full

Thanks Grant.


_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: mpc5200 fec error

2009-05-20 Thread Eric Millbrandt
> On Wed, May 20, 2009 at 9:42 AM, Eric Millbrandt
>  wrote:
>>> > I am able to reproduce the error using 2.6.29.2-rt11.  I was able to
>>> > mitigate the problem by raising the priority of the transmit irq.
>>> > However when running an NFS server on the pcm030 under high cpu load I
>>> > now get
>>> >
>>> > [  132.477503] net eth0: FEC_IEVENT_RFIFO_ERROR
>>> > [  132.892329] net eth0: FEC_IEVENT_RFIFO_ERROR
>>> > [  133.884109] net eth0: FEC_IEVENT_RFIFO_ERROR
>>> > [  134.876059] net eth0: FEC_IEVENT_RFIFO_ERROR
>>> >
>>> > Raising the priority of the rx irq does not seem to fix this problem
>>> > though.
>>>
>>> Hi Eric,
>>>
>>> This error has been seen before in non-rt kernels.  I haven't had the
>>> chance to track it down and kill it yet.  I believe there are locking
>>> issues associated with it.
>>
>> Uuuh, I recall this message. Kept me busy for some time :(
>>
>> You might try this patch which helped in our situation.
>>
>> ===
>>
>> Subject: Enable XLB pipelining for MPC5200B
>> From: Wolfram Sang 
>>
>> Enable pipelining as it helps getting rid of FEC problems.
>> Not intended for upstream, this must be dealt differently there.
>>
>> This patch is disabled by default. The bootloader should enable this feature.
>> So, this patch is only intended to be used where the bootloader does it in a
>> wrong manner and can't be replaced.
>>
>> Signed-off-by: Wolfram Sang 
>> Acked-by: Juergen Beisert 
>>
>> ---
>>  arch/powerpc/platforms/52xx/mpc52xx_common.c |7 +++
>>  1 file changed, 7 insertions(+)
>>
>> Index: arch/powerpc/platforms/52xx/mpc52xx_common.c
>> ===
>> --- arch/powerpc/platforms/52xx/mpc52xx_common.c.orig
>> +++ arch/powerpc/platforms/52xx/mpc52xx_common.c
>> @@ -107,6 +107,13 @@ mpc5200_setup_xlb_arbiter(void)
>> */
>>if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
>>out_be32(&xlb->config, in_be32(&xlb->config) | 
>> MPC52xx_XLB_CFG_PLDIS);
>> +#if 0
>> +   /*
>> +* Enable pipelining, fixes FEC problems. The previous workaround is 
>> not
>> +* needed, as we have an MPC5200B (not A).
>> +*/
>> +   out_be32(&xlb->config, in_be32(&xlb->config) & 
>> ~MPC52xx_XLB_CFG_PLDIS);
>> +#endif
>>
>>iounmap(xlb);
>>  }
>>
>> --
>> Pengutronix e.K.   | Wolfram Sang|
>> Industrial Linux Solutions | http://www.pengutronix.de/  |
>>
>> Wolfram,
>>
>> Thanks, but no luck with this patch.  It was already setup correctly by 
>> U-Boot.
>
>
> I don't see where this gets enabled in the u-boot source. Have you
> added it locally?
>
> These are the only two I see:
> cpu/mpc5xxx/cpu_init.c: *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
> cpu/mpc5xxx/cpu_init.c: *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
>
>
> --
> Jon Smirl
> jonsm...@gmail.com
>
> If you look a few more lines down you should see
> # if defined(CFG_XLB_PIPELINING)
>/* Enable piplining */
>*(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~(1 << 31);
> # endif
>
> I obtained the u-boot sources directly from phytec, for my phyCore, so I am 
> not sure if they added it.

It is ok in main u-boot source. I just missed the lower section.

-- 
Jon Smirl
jonsm...@gmail.com

It looks like the phy is never getting reset properly after the 
FEC_IEVENT_RFIFO_ERROR.  I threw some printk's into the fec mdio driver

/drivers/net/fec_mpc52xx_phy.c
  25 static int mpc52xx_fec_mdio_transfer(struct mii_bus *bus, int phy_id,
  26 int reg, u32 value)
  27 {
  28 struct mpc52xx_fec_mdio_priv *priv = bus->priv;
  29 struct mpc52xx_fec __iomem *fec;
  30 int tries = 100;
  31 
  32 value |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK;
  33 value |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK;
  34 
  35 fec = priv->regs;
  36 out_be32(&fec->ievent, FEC_IEVENT_MII);
  37 out_be32(&priv->regs->mii_data, value);
  38 
  39 /* wait for it to finish, this takes about 23 us on lite5200b */
  40 while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries)
  41 udelay(5);
  42 
  43   

RE: mpc5200 fec error

2009-05-20 Thread Eric Millbrandt
-Original Message-
From: Jon Smirl [mailto:jonsm...@gmail.com] 
Sent: Wednesday, May 20, 2009 11:15
To: Eric Millbrandt
Cc: Wolfram Sang; Grant Likely; linuxppc-dev@ozlabs.org
Subject: Re: mpc5200 fec error

On Wed, May 20, 2009 at 9:42 AM, Eric Millbrandt
 wrote:
>> > I am able to reproduce the error using 2.6.29.2-rt11.  I was able to
>> > mitigate the problem by raising the priority of the transmit irq.
>> > However when running an NFS server on the pcm030 under high cpu load I
>> > now get
>> >
>> > [  132.477503] net eth0: FEC_IEVENT_RFIFO_ERROR
>> > [  132.892329] net eth0: FEC_IEVENT_RFIFO_ERROR
>> > [  133.884109] net eth0: FEC_IEVENT_RFIFO_ERROR
>> > [  134.876059] net eth0: FEC_IEVENT_RFIFO_ERROR
>> >
>> > Raising the priority of the rx irq does not seem to fix this problem
>> > though.
>>
>> Hi Eric,
>>
>> This error has been seen before in non-rt kernels.  I haven't had the
>> chance to track it down and kill it yet.  I believe there are locking
>> issues associated with it.
>
> Uuuh, I recall this message. Kept me busy for some time :(
>
> You might try this patch which helped in our situation.
>
> ===
>
> Subject: Enable XLB pipelining for MPC5200B
> From: Wolfram Sang 
>
> Enable pipelining as it helps getting rid of FEC problems.
> Not intended for upstream, this must be dealt differently there.
>
> This patch is disabled by default. The bootloader should enable this feature.
> So, this patch is only intended to be used where the bootloader does it in a
> wrong manner and can't be replaced.
>
> Signed-off-by: Wolfram Sang 
> Acked-by: Juergen Beisert 
>
> ---
>  arch/powerpc/platforms/52xx/mpc52xx_common.c |7 +++
>  1 file changed, 7 insertions(+)
>
> Index: arch/powerpc/platforms/52xx/mpc52xx_common.c
> ===
> --- arch/powerpc/platforms/52xx/mpc52xx_common.c.orig
> +++ arch/powerpc/platforms/52xx/mpc52xx_common.c
> @@ -107,6 +107,13 @@ mpc5200_setup_xlb_arbiter(void)
> */
>if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
>out_be32(&xlb->config, in_be32(&xlb->config) | 
> MPC52xx_XLB_CFG_PLDIS);
> +#if 0
> +   /*
> +* Enable pipelining, fixes FEC problems. The previous workaround is 
> not
> +* needed, as we have an MPC5200B (not A).
> +*/
> +   out_be32(&xlb->config, in_be32(&xlb->config) & 
> ~MPC52xx_XLB_CFG_PLDIS);
> +#endif
>
>iounmap(xlb);
>  }
>
> --
> Pengutronix e.K.   | Wolfram Sang|
> Industrial Linux Solutions | http://www.pengutronix.de/  |
>
> Wolfram,
>
> Thanks, but no luck with this patch.  It was already setup correctly by 
> U-Boot.


I don't see where this gets enabled in the u-boot source. Have you
added it locally?

These are the only two I see:
cpu/mpc5xxx/cpu_init.c: *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
cpu/mpc5xxx/cpu_init.c: *(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);


-- 
Jon Smirl
jonsm...@gmail.com

If you look a few more lines down you should see
# if defined(CFG_XLB_PIPELINING)
/* Enable piplining */
*(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~(1 << 31);
# endif

I obtained the u-boot sources directly from phytec, for my phyCore, so I am not 
sure if they added it.


_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: mpc5200 fec error

2009-05-20 Thread Eric Millbrandt
> > I am able to reproduce the error using 2.6.29.2-rt11.  I was able to
> > mitigate the problem by raising the priority of the transmit irq.
> > However when running an NFS server on the pcm030 under high cpu load I
> > now get
> >
> > [  132.477503] net eth0: FEC_IEVENT_RFIFO_ERROR
> > [  132.892329] net eth0: FEC_IEVENT_RFIFO_ERROR
> > [  133.884109] net eth0: FEC_IEVENT_RFIFO_ERROR
> > [  134.876059] net eth0: FEC_IEVENT_RFIFO_ERROR
> >
> > Raising the priority of the rx irq does not seem to fix this problem
> > though.
> 
> Hi Eric,
> 
> This error has been seen before in non-rt kernels.  I haven't had the
> chance to track it down and kill it yet.  I believe there are locking
> issues associated with it.

Uuuh, I recall this message. Kept me busy for some time :(

You might try this patch which helped in our situation.

===

Subject: Enable XLB pipelining for MPC5200B
From: Wolfram Sang 

Enable pipelining as it helps getting rid of FEC problems.
Not intended for upstream, this must be dealt differently there.

This patch is disabled by default. The bootloader should enable this feature.
So, this patch is only intended to be used where the bootloader does it in a
wrong manner and can't be replaced.

Signed-off-by: Wolfram Sang 
Acked-by: Juergen Beisert 

---
 arch/powerpc/platforms/52xx/mpc52xx_common.c |7 +++
 1 file changed, 7 insertions(+)

Index: arch/powerpc/platforms/52xx/mpc52xx_common.c
===
--- arch/powerpc/platforms/52xx/mpc52xx_common.c.orig
+++ arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -107,6 +107,13 @@ mpc5200_setup_xlb_arbiter(void)
 */
if ((mfspr(SPRN_SVR) & MPC5200_SVR_MASK) == MPC5200_SVR)
out_be32(&xlb->config, in_be32(&xlb->config) | 
MPC52xx_XLB_CFG_PLDIS);
+#if 0
+   /*
+* Enable pipelining, fixes FEC problems. The previous workaround is not
+* needed, as we have an MPC5200B (not A).
+*/
+   out_be32(&xlb->config, in_be32(&xlb->config) & ~MPC52xx_XLB_CFG_PLDIS);
+#endif
 
iounmap(xlb);
 }

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |

Wolfram,

Thanks, but no luck with this patch.  It was already setup correctly by U-Boot.

Eric


_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


RE: mpc5200 fec error

2009-05-19 Thread Eric Millbrandt
-Original Message-
From: Wolfram Sang [mailto:w.s...@pengutronix.de] 
Sent: Tuesday, May 19, 2009 16:57
To: Robert Schwebel
Cc: Eric Millbrandt; linuxppc-dev@ozlabs.org
Subject: Re: mpc5200 fec error

On Tue, May 19, 2009 at 10:36:45PM +0200, Robert Schwebel wrote:
> Wolfram, have you seen this mail? You recently tested -rt on 2.6.29,
> right? Did you only test that on the customer hardware or also on the
> phyCORE-MPC5200B?

So far, I tried only on customer hardware, and that was 2.6.29.2-rt11.
With
that setup, I could work with NFS flawlessly, no real stress-testing
though.
Testing latest .3-rt is on my todo, will check the phyCOREs, too.

Regards,

   Wolfram

-- 
Pengutronix e.K.   | Wolfram Sang
|
Industrial Linux Solutions | http://www.pengutronix.de/
|

I am able to reproduce the error using 2.6.29.2-rt11.  I was able to
mitigate the problem by raising the priority of the transmit irq.
However when running an NFS server on the pcm030 under high cpu load I
now get

[  132.477503] net eth0: FEC_IEVENT_RFIFO_ERROR
[  132.892329] net eth0: FEC_IEVENT_RFIFO_ERROR
[  133.884109] net eth0: FEC_IEVENT_RFIFO_ERROR
[  134.876059] net eth0: FEC_IEVENT_RFIFO_ERROR

Raising the priority of the rx irq does not seem to fix this problem
though.


_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


mpc5200 fec error

2009-05-18 Thread Eric Millbrandt
Hello all,

 

I am testing a 2.6.29.3 (with preempt_rt patches) kernel on a phytec
pcm030 and am getting a kernel hang when testing the fec Ethernet
controller.  The error only occurs when running the preempt-patched
kernel, an unmodified kernel works fine.  Is anyone out there using
preempt_rt on an MPC5200 successfully?

 

Eric

 

r...@rudolph-ui:/root> iperf -c linux-5200bdevl01 -P 2 -i 1 -p 5001 -f k
-t 600



Client connecting to linux-5200bdevl01, TCP port 5001

TCP window size: 36.2 KByte (default)



[  4] local 10.1.4.88 port 37872 connected with 10.1.5.234 port 5001

[  3] local 10.1.4.88 port 37871 connected with 10.1.5.234 port 5001

[ ID] Interval   Transfer Bandwidth

[  3]  0.0- 1.0 sec  3824 KBytes  31326 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  4]  0.0- 1.0 sec  3656 KBytes  29950 Kbits/sec

[SUM]  0.0- 1.0 sec  7480 KBytes  61276 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  4]  1.0- 2.0 sec  3760 KBytes  30802 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  3]  1.0- 2.0 sec  3752 KBytes  30736 Kbits/sec

[SUM]  1.0- 2.0 sec  7512 KBytes  61538 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  4]  2.0- 3.0 sec  3728 KBytes  30540 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  3]  2.0- 3.0 sec  3816 KBytes  31261 Kbits/sec

[SUM]  2.0- 3.0 sec  7544 KBytes  61800 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  3]  3.0- 4.0 sec  3712 KBytes  30409 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  4]  3.0- 4.0 sec  3824 KBytes  31326 Kbits/sec

[SUM]  3.0- 4.0 sec  7536 KBytes  61735 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  3]  4.0- 5.0 sec  3968 KBytes  32506 Kbits/sec

[ ID] Interval   Transfer Bandwidth

[  4]  4.0- 5.0 sec  3624 KBytes  29688 Kbits/sec

[SUM]  4.0- 5.0 sec  7592 KBytes  62194 Kbits/sec

[ 5761.999175] net eth0: transmit queue overrun

[ 5762.003591] net eth0: transmit queue overrun

[ 5762.007948] net eth0: transmit queue overrun

[ 5762.012302] net eth0: transmit queue overrun

[ 5762.016658] net eth0: transmit queue overrun

[ 5762.021013] net eth0: transmit queue overrun

[ 5762.025381] net eth0: transmit queue overrun

[ 5762.029735] net eth0: transmit queue overrun

[ 5762.034090] net eth0: transmit queue overrun

[ 5762.038445] net eth0: transmit queue overrun

[ 5767.000928] net eth0: transmit queue overrun

[ 5767.005278] net eth0: transmit queue overrun

[ 5767.009634] net eth0: transmit queue overrun

[ 5767.013990] net eth0: transmit queue overrun

[ 5767.018345] net eth0: transmit queue overrun

[ 5767.022701] net eth0: transmit queue overrun

...



_

This e-mail and the information, including any attachments, it contains are 
intended to be a confidential communication only to the person or entity to 
whom it is addressed and may contain information that is privileged. If the 
reader of this message is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev