Commit a2a4d604 authored by Shengjiu Wang's avatar Shengjiu Wang Committed by Mark Brown

ASoC: fsl_esai: spba clock is needed by esai device

ESAI need to enable the spba clock, when sdma is using share peripheral
script. In this case, there is two spba master port is used, if don't
enable the clock, the spba bus will have arbitration issue, which may
cause read/write wrong data from/to ESAI registers.
Signed-off-by: default avatarShengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8005c49d
...@@ -27,6 +27,11 @@ Required properties: ...@@ -27,6 +27,11 @@ Required properties:
derive HCK, SCK and FS. derive HCK, SCK and FS.
"fsys" The system clock derived from ahb clock used to "fsys" The system clock derived from ahb clock used to
derive HCK, SCK and FS. derive HCK, SCK and FS.
"spba" The spba clock is required when ESAI is placed as a
bus slave of the Shared Peripheral Bus and when two
or more bus masters (CPU, DMA or DSP) try to access
it. This property is optional depending on the SoC
design.
- fsl,fifo-depth : The number of elements in the transmit and receive - fsl,fifo-depth : The number of elements in the transmit and receive
FIFOs. This number is the maximum allowed value for FIFOs. This number is the maximum allowed value for
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
* @coreclk: clock source to access register * @coreclk: clock source to access register
* @extalclk: esai clock source to derive HCK, SCK and FS * @extalclk: esai clock source to derive HCK, SCK and FS
* @fsysclk: system clock source to derive HCK, SCK and FS * @fsysclk: system clock source to derive HCK, SCK and FS
* @spbaclk: SPBA clock (optional, depending on SoC design)
* @fifo_depth: depth of tx/rx FIFO * @fifo_depth: depth of tx/rx FIFO
* @slot_width: width of each DAI slot * @slot_width: width of each DAI slot
* @slots: number of slots * @slots: number of slots
...@@ -54,6 +55,7 @@ struct fsl_esai { ...@@ -54,6 +55,7 @@ struct fsl_esai {
struct clk *coreclk; struct clk *coreclk;
struct clk *extalclk; struct clk *extalclk;
struct clk *fsysclk; struct clk *fsysclk;
struct clk *spbaclk;
u32 fifo_depth; u32 fifo_depth;
u32 slot_width; u32 slot_width;
u32 slots; u32 slots;
...@@ -469,6 +471,11 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, ...@@ -469,6 +471,11 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
ret = clk_prepare_enable(esai_priv->coreclk); ret = clk_prepare_enable(esai_priv->coreclk);
if (ret) if (ret)
return ret; return ret;
if (!IS_ERR(esai_priv->spbaclk)) {
ret = clk_prepare_enable(esai_priv->spbaclk);
if (ret)
goto err_spbaclk;
}
if (!IS_ERR(esai_priv->extalclk)) { if (!IS_ERR(esai_priv->extalclk)) {
ret = clk_prepare_enable(esai_priv->extalclk); ret = clk_prepare_enable(esai_priv->extalclk);
if (ret) if (ret)
...@@ -499,6 +506,9 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, ...@@ -499,6 +506,9 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
if (!IS_ERR(esai_priv->extalclk)) if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk); clk_disable_unprepare(esai_priv->extalclk);
err_extalck: err_extalck:
if (!IS_ERR(esai_priv->spbaclk))
clk_disable_unprepare(esai_priv->spbaclk);
err_spbaclk:
clk_disable_unprepare(esai_priv->coreclk); clk_disable_unprepare(esai_priv->coreclk);
return ret; return ret;
...@@ -564,6 +574,8 @@ static void fsl_esai_shutdown(struct snd_pcm_substream *substream, ...@@ -564,6 +574,8 @@ static void fsl_esai_shutdown(struct snd_pcm_substream *substream,
clk_disable_unprepare(esai_priv->fsysclk); clk_disable_unprepare(esai_priv->fsysclk);
if (!IS_ERR(esai_priv->extalclk)) if (!IS_ERR(esai_priv->extalclk))
clk_disable_unprepare(esai_priv->extalclk); clk_disable_unprepare(esai_priv->extalclk);
if (!IS_ERR(esai_priv->spbaclk))
clk_disable_unprepare(esai_priv->spbaclk);
clk_disable_unprepare(esai_priv->coreclk); clk_disable_unprepare(esai_priv->coreclk);
} }
...@@ -819,6 +831,11 @@ static int fsl_esai_probe(struct platform_device *pdev) ...@@ -819,6 +831,11 @@ static int fsl_esai_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n", dev_warn(&pdev->dev, "failed to get fsys clock: %ld\n",
PTR_ERR(esai_priv->fsysclk)); PTR_ERR(esai_priv->fsysclk));
esai_priv->spbaclk = devm_clk_get(&pdev->dev, "spba");
if (IS_ERR(esai_priv->spbaclk))
dev_warn(&pdev->dev, "failed to get spba clock: %ld\n",
PTR_ERR(esai_priv->spbaclk));
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); dev_err(&pdev->dev, "no irq for node %s\n", pdev->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment