* [PATCH 0/2] spi: atmel: adopt pinctrl support
@ 2014-03-05 1:58 Wenyou Yang
2014-03-05 1:58 ` [PATCH 1/2] " Wenyou Yang
2014-03-05 1:58 ` [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state Wenyou Yang
0 siblings, 2 replies; 5+ messages in thread
From: Wenyou Yang @ 2014-03-05 1:58 UTC (permalink / raw)
To: broonie, nicolas.ferre, plagnioj, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-spi, wenyou.yang
Hi Mark,
This patch is to adopt pinctrl support to optimize energy usage for the pins
both for the suspend/resume cycle.
The patch is based on the branch: for-next
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
Best Regards,
Wenyou Yang
Wenyou Yang (2):
spi: atmel: adopt pinctrl support
ARM: dts: sama5d36ek: add spi pinctrl sleep state
arch/arm/boot/dts/sama5d36ek.dts | 14 ++++++++++++++
drivers/spi/spi-atmel.c | 9 +++++++++
2 files changed, 23 insertions(+)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] spi: atmel: adopt pinctrl support
2014-03-05 1:58 [PATCH 0/2] spi: atmel: adopt pinctrl support Wenyou Yang
@ 2014-03-05 1:58 ` Wenyou Yang
2014-03-05 3:22 ` Mark Brown
2014-03-05 1:58 ` [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state Wenyou Yang
1 sibling, 1 reply; 5+ messages in thread
From: Wenyou Yang @ 2014-03-05 1:58 UTC (permalink / raw)
To: broonie, nicolas.ferre, plagnioj, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-spi, wenyou.yang
Amend the spi atmel pin controller to optionally take a pin control
handle and set the state of the pins to:
- "default" on boot, resume and before performing an spitransfer
- "sleep" on suspend()
This should make it possible to optimize energy usage for the pins
both for the suspend/resume cycle
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
drivers/spi/spi-atmel.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index b0842f7..54b4436 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -26,6 +26,7 @@
#include <linux/io.h>
#include <linux/gpio.h>
+#include <linux/pinctrl/consumer.h>
/* SPI register offsets */
#define SPI_CR 0x0000
@@ -1303,6 +1304,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
struct spi_master *master;
struct atmel_spi *as;
+ /* Select default pin state */
+ pinctrl_pm_select_default_state(&pdev->dev);
+
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs)
return -ENXIO;
@@ -1457,6 +1461,9 @@ static int atmel_spi_suspend(struct device *dev)
struct atmel_spi *as = spi_master_get_devdata(master);
clk_disable_unprepare(as->clk);
+
+ pinctrl_pm_select_sleep_state(dev);
+
return 0;
}
@@ -1465,6 +1472,8 @@ static int atmel_spi_resume(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
+ pinctrl_pm_select_default_state(dev);
+
clk_prepare_enable(as->clk);
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state
2014-03-05 1:58 [PATCH 0/2] spi: atmel: adopt pinctrl support Wenyou Yang
2014-03-05 1:58 ` [PATCH 1/2] " Wenyou Yang
@ 2014-03-05 1:58 ` Wenyou Yang
2014-03-05 9:22 ` Alexandre Belloni
1 sibling, 1 reply; 5+ messages in thread
From: Wenyou Yang @ 2014-03-05 1:58 UTC (permalink / raw)
To: broonie, nicolas.ferre, plagnioj, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-spi, wenyou.yang
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---
arch/arm/boot/dts/sama5d36ek.dts | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/boot/dts/sama5d36ek.dts b/arch/arm/boot/dts/sama5d36ek.dts
index 59576c6..676d121 100644
--- a/arch/arm/boot/dts/sama5d36ek.dts
+++ b/arch/arm/boot/dts/sama5d36ek.dts
@@ -18,6 +18,8 @@
ahb {
apb {
spi0: spi@f0004000 {
+ pinctrl-names = "default", "sleep";
+ pinctrl-1 = <&pinctrl_spi0_sleep>;
status = "okay";
};
@@ -44,6 +46,18 @@
macb1: ethernet@f802c000 {
status = "okay";
};
+
+ pinctrl@fffff200 {
+ spi0 {
+ pinctrl_spi0_sleep: spi0-1 {
+ atmel,pins =
+ <AT91_PIOD 10 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW /* PD10 GPIO Output Low */
+ AT91_PIOD 11 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW /* PD11 GPIO Output Low */
+ AT91_PIOD 12 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW>; /* PD12 GPIO Output Low */
+ };
+ };
+
+ };
};
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] spi: atmel: adopt pinctrl support
2014-03-05 1:58 ` [PATCH 1/2] " Wenyou Yang
@ 2014-03-05 3:22 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-03-05 3:22 UTC (permalink / raw)
To: Wenyou Yang
Cc: nicolas.ferre, plagnioj, robh+dt, pawel.moll, mark.rutland,
ijc+devicetree, galak, linux, linux-arm-kernel, devicetree,
linux-kernel, linux-spi
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
On Wed, Mar 05, 2014 at 09:58:49AM +0800, Wenyou Yang wrote:
> Amend the spi atmel pin controller to optionally take a pin control
> handle and set the state of the pins to:
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state
2014-03-05 1:58 ` [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state Wenyou Yang
@ 2014-03-05 9:22 ` Alexandre Belloni
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2014-03-05 9:22 UTC (permalink / raw)
To: Wenyou Yang
Cc: broonie, nicolas.ferre, plagnioj, robh+dt, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux, devicetree,
linux-kernel, linux-arm-kernel, linux-spi
Hi,
On 05/03/2014 at 09:58:50 +0800, Wenyou Yang wrote :
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> ---
> arch/arm/boot/dts/sama5d36ek.dts | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sama5d36ek.dts b/arch/arm/boot/dts/sama5d36ek.dts
> index 59576c6..676d121 100644
> --- a/arch/arm/boot/dts/sama5d36ek.dts
> +++ b/arch/arm/boot/dts/sama5d36ek.dts
> @@ -18,6 +18,8 @@
> ahb {
> apb {
> spi0: spi@f0004000 {
> + pinctrl-names = "default", "sleep";
> + pinctrl-1 = <&pinctrl_spi0_sleep>;
> status = "okay";
> };
>
> @@ -44,6 +46,18 @@
> macb1: ethernet@f802c000 {
> status = "okay";
> };
> +
> + pinctrl@fffff200 {
> + spi0 {
> + pinctrl_spi0_sleep: spi0-1 {
> + atmel,pins =
> + <AT91_PIOD 10 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW /* PD10 GPIO Output Low */
> + AT91_PIOD 11 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW /* PD11 GPIO Output Low */
> + AT91_PIOD 12 AT91_PERIPH_GPIO AT91_PINCTRL_OUTPUT_LOW>; /* PD12 GPIO Output Low */
I think that one would belong to the dtsi as this is generic enough.
Also, it was suggested by Mark that list entries should be bracketed
separately. But I guess we may not want to mix styles in the same file.
Nicolas, what do you think ?
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-05 9:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-05 1:58 [PATCH 0/2] spi: atmel: adopt pinctrl support Wenyou Yang
2014-03-05 1:58 ` [PATCH 1/2] " Wenyou Yang
2014-03-05 3:22 ` Mark Brown
2014-03-05 1:58 ` [PATCH 2/2] ARM: dts: sama5d36ek: add spi pinctrl sleep state Wenyou Yang
2014-03-05 9:22 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).