2015-11-20 02:21:39

by Leilk Liu

[permalink] [raw]
Subject: [PATCH 1/4] spi: mediatek: update document devicetree bindings to fix syntax error

This patch updates document devicetree bindings
to fix syntax error.

Signed-off-by: Leilk Liu <[email protected]>
---
.../devicetree/bindings/spi/spi-mt65xx.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
index ce363c923f..fba8334 100644
--- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
@@ -32,7 +32,7 @@ Optional properties:
-cs-gpios: see spi-bus.txt, only required for MT8173.

- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
- controller used. This is a array, the element value should be 0~3,
+ controller used. This is an array, the element value should be 0~3,
only required for MT8173.
0: specify GPIO69,70,71,72 for spi pins.
1: specify GPIO102,103,104,105 for spi pins.
--
1.7.9.5


2015-11-20 02:22:15

by Leilk Liu

[permalink] [raw]
Subject: [PATCH 2/4] spi: mediatek: remove unrequired description

cs-gpios isn't required with patch "spi: mediatek: single
device does not require cs_gpios", so modify the description.

Signed-off-by: Leilk Liu <[email protected]>
---
.../devicetree/bindings/spi/spi-mt65xx.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
index fba8334..60a183c 100644
--- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
@@ -29,7 +29,7 @@ Required properties:
muxes clock, and "spi-clk" for the clock gate.

Optional properties:
--cs-gpios: see spi-bus.txt, only required for MT8173.
+-cs-gpios: see spi-bus.txt.

- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
controller used. This is an array, the element value should be 0~3,
--
1.7.9.5

2015-11-20 02:22:17

by Leilk Liu

[permalink] [raw]
Subject: [PATCH 3/4] spi: mediatek: remove needless pair of writel()/readl()

It's not need to re-read and re-write SPI_CMD_REG, so remove it.

Signed-off-by: Leilk Liu <[email protected]>
---
drivers/spi/spi-mt65xx.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 7840067..6c1a96e 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -154,9 +154,6 @@ static int mtk_spi_prepare_message(struct spi_master *master,
reg_val |= SPI_CMD_CPOL;
else
reg_val &= ~SPI_CMD_CPOL;
- writel(reg_val, mdata->base + SPI_CMD_REG);
-
- reg_val = readl(mdata->base + SPI_CMD_REG);

/* set the mlsbx and mlsbtx */
if (chip_config->tx_mlsb)
--
1.7.9.5

2015-11-20 02:21:56

by Leilk Liu

[permalink] [raw]
Subject: [PATCH 4/4] spi: mediatek: revise mtk_spi_probe() failure flow

This patch revises failure flow while pm_runtime_enable().

Signed-off-by: Leilk Liu <[email protected]>
---
drivers/spi/spi-mt65xx.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 6c1a96e..00a36da 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -607,7 +607,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
if (ret < 0) {
dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);
- goto err_disable_clk;
+ clk_disable_unprepare(mdata->spi_clk);
+ goto err_put_master;
}

clk_disable_unprepare(mdata->spi_clk);
@@ -617,7 +618,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
ret = devm_spi_register_master(&pdev->dev, master);
if (ret) {
dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
- goto err_put_master;
+ goto err_disable_runtime_pm;
}

if (mdata->dev_comp->need_pad_sel) {
@@ -626,14 +627,14 @@ static int mtk_spi_probe(struct platform_device *pdev)
"pad_num does not match num_chipselect(%d != %d)\n",
mdata->pad_num, master->num_chipselect);
ret = -EINVAL;
- goto err_put_master;
+ goto err_disable_runtime_pm;
}

if (!master->cs_gpios && master->num_chipselect > 1) {
dev_err(&pdev->dev,
"cs_gpios not specified and num_chipselect > 1\n");
ret = -EINVAL;
- goto err_put_master;
+ goto err_disable_runtime_pm;
}

if (master->cs_gpios) {
@@ -644,7 +645,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"can't get CS GPIO %i\n", i);
- goto err_put_master;
+ goto err_disable_runtime_pm;
}
}
}
@@ -652,8 +653,8 @@ static int mtk_spi_probe(struct platform_device *pdev)

return 0;

-err_disable_clk:
- clk_disable_unprepare(mdata->spi_clk);
+err_disable_runtime_pm:
+ pm_runtime_disable(&pdev->dev);
err_put_master:
spi_master_put(master);

--
1.7.9.5

2015-11-20 14:17:32

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/4] spi: mediatek: update document devicetree bindings to fix syntax error

On Fri, Nov 20, 2015 at 10:21:16AM +0800, Leilk Liu wrote:
> This patch updates document devicetree bindings
> to fix syntax error.
>
> Signed-off-by: Leilk Liu <[email protected]>

Acked-by: Rob Herring <[email protected]>

> ---
> .../devicetree/bindings/spi/spi-mt65xx.txt | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> index ce363c923f..fba8334 100644
> --- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> @@ -32,7 +32,7 @@ Optional properties:
> -cs-gpios: see spi-bus.txt, only required for MT8173.
>
> - mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
> - controller used. This is a array, the element value should be 0~3,
> + controller used. This is an array, the element value should be 0~3,
> only required for MT8173.
> 0: specify GPIO69,70,71,72 for spi pins.
> 1: specify GPIO102,103,104,105 for spi pins.
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-11-20 14:20:20

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/4] spi: mediatek: remove unrequired description

On Fri, Nov 20, 2015 at 10:21:17AM +0800, Leilk Liu wrote:
> cs-gpios isn't required with patch "spi: mediatek: single
> device does not require cs_gpios", so modify the description.
>
> Signed-off-by: Leilk Liu <[email protected]>

This could use a better subject. Try to make subjects specific enough
they would only ever apply to the change.

Acked-by: Rob Herring <[email protected]>

> ---
> .../devicetree/bindings/spi/spi-mt65xx.txt | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> index fba8334..60a183c 100644
> --- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
> @@ -29,7 +29,7 @@ Required properties:
> muxes clock, and "spi-clk" for the clock gate.
>
> Optional properties:
> --cs-gpios: see spi-bus.txt, only required for MT8173.
> +-cs-gpios: see spi-bus.txt.
>
> - mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
> controller used. This is an array, the element value should be 0~3,
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2015-11-20 16:56:34

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH 3/4] spi: mediatek: remove needless pair of writel()/readl()



On 20/11/15 03:21, Leilk Liu wrote:
> It's not need to re-read and re-write SPI_CMD_REG, so remove it.
>
> Signed-off-by: Leilk Liu <[email protected]>
> ---
> drivers/spi/spi-mt65xx.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
> index 7840067..6c1a96e 100644
> --- a/drivers/spi/spi-mt65xx.c
> +++ b/drivers/spi/spi-mt65xx.c
> @@ -154,9 +154,6 @@ static int mtk_spi_prepare_message(struct spi_master *master,
> reg_val |= SPI_CMD_CPOL;
> else
> reg_val &= ~SPI_CMD_CPOL;
> - writel(reg_val, mdata->base + SPI_CMD_REG);
> -
> - reg_val = readl(mdata->base + SPI_CMD_REG);
>
> /* set the mlsbx and mlsbtx */
> if (chip_config->tx_mlsb)
>

Reviewed-by: Matthias Brugger <[email protected]>

2015-11-21 13:40:23

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 4/4] spi: mediatek: revise mtk_spi_probe() failure flow

On Fri, Nov 20, 2015 at 10:21:19AM +0800, Leilk Liu wrote:
> This patch revises failure flow while pm_runtime_enable().

Why? This also doesn't apply against current code, please check and
resend.

>
> Signed-off-by: Leilk Liu <[email protected]>
> ---
> drivers/spi/spi-mt65xx.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
> index 6c1a96e..00a36da 100644
> --- a/drivers/spi/spi-mt65xx.c
> +++ b/drivers/spi/spi-mt65xx.c
> @@ -607,7 +607,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
> ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
> if (ret < 0) {
> dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);
> - goto err_disable_clk;
> + clk_disable_unprepare(mdata->spi_clk);
> + goto err_put_master;
> }
>
> clk_disable_unprepare(mdata->spi_clk);
> @@ -617,7 +618,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
> ret = devm_spi_register_master(&pdev->dev, master);
> if (ret) {
> dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
> - goto err_put_master;
> + goto err_disable_runtime_pm;
> }
>
> if (mdata->dev_comp->need_pad_sel) {
> @@ -626,14 +627,14 @@ static int mtk_spi_probe(struct platform_device *pdev)
> "pad_num does not match num_chipselect(%d != %d)\n",
> mdata->pad_num, master->num_chipselect);
> ret = -EINVAL;
> - goto err_put_master;
> + goto err_disable_runtime_pm;
> }
>
> if (!master->cs_gpios && master->num_chipselect > 1) {
> dev_err(&pdev->dev,
> "cs_gpios not specified and num_chipselect > 1\n");
> ret = -EINVAL;
> - goto err_put_master;
> + goto err_disable_runtime_pm;
> }
>
> if (master->cs_gpios) {
> @@ -644,7 +645,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
> if (ret) {
> dev_err(&pdev->dev,
> "can't get CS GPIO %i\n", i);
> - goto err_put_master;
> + goto err_disable_runtime_pm;
> }
> }
> }
> @@ -652,8 +653,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
>
> return 0;
>
> -err_disable_clk:
> - clk_disable_unprepare(mdata->spi_clk);
> +err_disable_runtime_pm:
> + pm_runtime_disable(&pdev->dev);
> err_put_master:
> spi_master_put(master);
>
> --
> 1.7.9.5
>
>


Attachments:
(No filename) (2.27 kB)
signature.asc (473.00 B)
Download all attachments

2015-11-24 02:33:38

by Leilk Liu

[permalink] [raw]
Subject: Re: [PATCH 4/4] spi: mediatek: revise mtk_spi_probe() failure flow

On Sat, 2015-11-21 at 13:39 +0000, Mark Brown wrote:
> On Fri, Nov 20, 2015 at 10:21:19AM +0800, Leilk Liu wrote:
> > This patch revises failure flow while pm_runtime_enable().
>
> Why? This also doesn't apply against current code, please check and
> resend.

I don't know. I can git am this patch to spi/for-next. I will resend it,
please help to apply it again, thanks.

> >
> > Signed-off-by: Leilk Liu <[email protected]>
> > ---
> > drivers/spi/spi-mt65xx.c | 15 ++++++++-------
> > 1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
> > index 6c1a96e..00a36da 100644
> > --- a/drivers/spi/spi-mt65xx.c
> > +++ b/drivers/spi/spi-mt65xx.c
> > @@ -607,7 +607,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
> > ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
> > if (ret < 0) {
> > dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);
> > - goto err_disable_clk;
> > + clk_disable_unprepare(mdata->spi_clk);
> > + goto err_put_master;
> > }
> >
> > clk_disable_unprepare(mdata->spi_clk);
> > @@ -617,7 +618,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
> > ret = devm_spi_register_master(&pdev->dev, master);
> > if (ret) {
> > dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
> > - goto err_put_master;
> > + goto err_disable_runtime_pm;
> > }
> >
> > if (mdata->dev_comp->need_pad_sel) {
> > @@ -626,14 +627,14 @@ static int mtk_spi_probe(struct platform_device *pdev)
> > "pad_num does not match num_chipselect(%d != %d)\n",
> > mdata->pad_num, master->num_chipselect);
> > ret = -EINVAL;
> > - goto err_put_master;
> > + goto err_disable_runtime_pm;
> > }
> >
> > if (!master->cs_gpios && master->num_chipselect > 1) {
> > dev_err(&pdev->dev,
> > "cs_gpios not specified and num_chipselect > 1\n");
> > ret = -EINVAL;
> > - goto err_put_master;
> > + goto err_disable_runtime_pm;
> > }
> >
> > if (master->cs_gpios) {
> > @@ -644,7 +645,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
> > if (ret) {
> > dev_err(&pdev->dev,
> > "can't get CS GPIO %i\n", i);
> > - goto err_put_master;
> > + goto err_disable_runtime_pm;
> > }
> > }
> > }
> > @@ -652,8 +653,8 @@ static int mtk_spi_probe(struct platform_device *pdev)
> >
> > return 0;
> >
> > -err_disable_clk:
> > - clk_disable_unprepare(mdata->spi_clk);
> > +err_disable_runtime_pm:
> > + pm_runtime_disable(&pdev->dev);
> > err_put_master:
> > spi_master_put(master);
> >
> > --
> > 1.7.9.5
> >
> >

2015-11-24 13:04:52

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 4/4] spi: mediatek: revise mtk_spi_probe() failure flow

On Tue, Nov 24, 2015 at 10:33:24AM +0800, lei liu wrote:
> On Sat, 2015-11-21 at 13:39 +0000, Mark Brown wrote:
> > On Fri, Nov 20, 2015 at 10:21:19AM +0800, Leilk Liu wrote:

> > > This patch revises failure flow while pm_runtime_enable().

> > Why? This also doesn't apply against current code, please check and
> > resend.

> I don't know. I can git am this patch to spi/for-next. I will resend it,
> please help to apply it again, thanks.

If you don't know why we should make this change then we may as well
just not make it?


Attachments:
(No filename) (532.00 B)
signature.asc (473.00 B)
Download all attachments

2015-11-25 09:18:04

by Leilk Liu

[permalink] [raw]
Subject: Re: [PATCH 4/4] spi: mediatek: revise mtk_spi_probe() failure flow

On Tue, 2015-11-24 at 13:04 +0000, Mark Brown wrote:
> On Tue, Nov 24, 2015 at 10:33:24AM +0800, lei liu wrote:
> > On Sat, 2015-11-21 at 13:39 +0000, Mark Brown wrote:
> > > On Fri, Nov 20, 2015 at 10:21:19AM +0800, Leilk Liu wrote:
>
> > > > This patch revises failure flow while pm_runtime_enable().
>
> > > Why? This also doesn't apply against current code, please check and
> > > resend.
>
> > I don't know. I can git am this patch to spi/for-next. I will resend it,
> > please help to apply it again, thanks.
>
> If you don't know why we should make this change then we may as well
> just not make it?

OK. I will write a proper commit message to explain what this patch
does. Thanks.

> _________________
> ______________________________
> Linux-mediatek mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-mediatek