[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

Subsystems: spi subsystem, the rest

STALE5060d

11 messages, 6 authors, 2012-09-25 · open the first message on its own page

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Dirk Behme <hidden>
Date: 2012-08-31 08:55:11

From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
---

Question: Are there real world examples for a need of an individual setting of
clock polarity/inactive state?

 drivers/spi/spi-imx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e834ff8..d64655b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
 #define MX51_ECSPI_CONFIG_SCLKPOL(cs)	(1 << ((cs) +  4))
 #define MX51_ECSPI_CONFIG_SBBCTRL(cs)	(1 << ((cs) +  8))
 #define MX51_ECSPI_CONFIG_SSBPOL(cs)	(1 << ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)	(1 << ((cs) + 20))
 
 #define MX51_ECSPI_INT		0x10
 #define MX51_ECSPI_INT_TEEN		(1 <<  0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
 	if (config->mode & SPI_CPHA)
 		cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
 
-	if (config->mode & SPI_CPOL)
+	if (config->mode & SPI_CPOL) {
 		cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+		cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+	}
 	if (config->mode & SPI_CS_HIGH)
 		cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
 
-- 
1.7.0.4

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Shawn Guo <hidden>
Date: 2012-08-31 02:35:20

Copy Uwe ...

On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
---

Question: Are there real world examples for a need of an individual setting of
clock polarity/inactive state?
I'm less concerned about that.  We can always patch the driver when
the real world example occurs?

Regards,
Shawn
quoted hunk
 drivers/spi/spi-imx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e834ff8..d64655b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
 #define MX51_ECSPI_CONFIG_SCLKPOL(cs)	(1 << ((cs) +  4))
 #define MX51_ECSPI_CONFIG_SBBCTRL(cs)	(1 << ((cs) +  8))
 #define MX51_ECSPI_CONFIG_SSBPOL(cs)	(1 << ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)	(1 << ((cs) + 20))
 
 #define MX51_ECSPI_INT		0x10
 #define MX51_ECSPI_INT_TEEN		(1 <<  0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
 	if (config->mode & SPI_CPHA)
 		cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
 
-	if (config->mode & SPI_CPOL)
+	if (config->mode & SPI_CPOL) {
 		cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+		cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+	}
 	if (config->mode & SPI_CS_HIGH)
 		cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
 
-- 
1.7.0.4

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Dirk Behme <hidden>
Date: 2012-09-21 07:36:51

On 31.08.2012 04:35, Shawn Guo wrote:
Copy Uwe ...
Ping ;)

Any opinions on this?

Thanks

Dirk
On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
quoted
From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
---

Question: Are there real world examples for a need of an individual setting of
clock polarity/inactive state?
I'm less concerned about that.  We can always patch the driver when
the real world example occurs?

Regards,
Shawn
quoted
 drivers/spi/spi-imx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e834ff8..d64655b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
 #define MX51_ECSPI_CONFIG_SCLKPOL(cs)	(1 << ((cs) +  4))
 #define MX51_ECSPI_CONFIG_SBBCTRL(cs)	(1 << ((cs) +  8))
 #define MX51_ECSPI_CONFIG_SSBPOL(cs)	(1 << ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)	(1 << ((cs) + 20))
 
 #define MX51_ECSPI_INT		0x10
 #define MX51_ECSPI_INT_TEEN		(1 <<  0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
 	if (config->mode & SPI_CPHA)
 		cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
 
-	if (config->mode & SPI_CPOL)
+	if (config->mode & SPI_CPOL) {
 		cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+		cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+	}
 	if (config->mode & SPI_CS_HIGH)
 		cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
 
-- 
1.7.0.4

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Uwe Kleine-König <hidden>
Date: 2012-09-21 07:54:31

On Fri, Sep 21, 2012 at 09:36:51AM +0200, Dirk Behme wrote:
On 31.08.2012 04:35, Shawn Guo wrote:
quoted
Copy Uwe ...
Copy our kernel mailing list ...
Ping ;)

Any opinions on this?
Assuming it fixes access to a device I'm ok with your patch, but I don't
really feel responsible for the driver (i.e. me not acking shouldn't
have a negative influence on getting the patch in).
quoted
On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
quoted
From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
If you forward a patch you must add your S-o-b.
quoted
quoted
---

Question: Are there real world examples for a need of an individual setting of
clock polarity/inactive state?
I'm less concerned about that.  We can always patch the driver when
the real world example occurs?
yes.

Thanks
Uwe
quoted
quoted
drivers/spi/spi-imx.c |    6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e834ff8..d64655b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
#define MX51_ECSPI_CONFIG_SCLKPOL(cs)	(1 << ((cs) +  4))
#define MX51_ECSPI_CONFIG_SBBCTRL(cs)	(1 << ((cs) +  8))
#define MX51_ECSPI_CONFIG_SSBPOL(cs)	(1 << ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)	(1 << ((cs) + 20))
#define MX51_ECSPI_INT		0x10
#define MX51_ECSPI_INT_TEEN		(1 <<  0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
	if (config->mode & SPI_CPHA)
		cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
-	if (config->mode & SPI_CPOL)
+	if (config->mode & SPI_CPOL) {
		cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+		cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+	}
	if (config->mode & SPI_CS_HIGH)
		cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
-- 
1.7.0.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Dirk Behme <hidden>
Date: 2012-09-22 06:10:48

On 21.09.2012 09:54, Uwe Kleine-K?nig wrote:
On Fri, Sep 21, 2012 at 09:36:51AM +0200, Dirk Behme wrote:
quoted
On 31.08.2012 04:35, Shawn Guo wrote:
quoted
Copy Uwe ...
Copy our kernel mailing list ...
quoted
Ping ;)

Any opinions on this?
Assuming it fixes access to a device I'm ok with your patch, but I don't
really feel responsible for the driver (i.e. me not acking shouldn't
have a negative influence on getting the patch in).
Ok, thanks.

I'm not so familiar with the SPI world: Who would be the best person 
to ack this, and in case it's ok finally apply it, then?

Thanks

Dirk
quoted
quoted
On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
quoted
From: Knut Wohlrab<redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab<redacted>
If you forward a patch you must add your S-o-b.
quoted
quoted
quoted
---

Question: Are there real world examples for a need of an individual setting of
clock polarity/inactive state?
I'm less concerned about that.  We can always patch the driver when
the real world example occurs?
yes.

Thanks
Uwe
quoted
quoted
quoted
drivers/spi/spi-imx.c |    6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e834ff8..d64655b 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -197,6 +197,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin,
#define MX51_ECSPI_CONFIG_SCLKPOL(cs)	(1<<  ((cs) +  4))
#define MX51_ECSPI_CONFIG_SBBCTRL(cs)	(1<<  ((cs) +  8))
#define MX51_ECSPI_CONFIG_SSBPOL(cs)	(1<<  ((cs) + 12))
+#define MX51_ECSPI_CONFIG_SCLKCTL(cs)	(1<<  ((cs) + 20))
#define MX51_ECSPI_INT		0x10
#define MX51_ECSPI_INT_TEEN		(1<<   0)
@@ -287,9 +288,10 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
	if (config->mode&  SPI_CPHA)
		cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
-	if (config->mode&  SPI_CPOL)
+	if (config->mode&  SPI_CPOL) {
		cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
-
+		cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
+	}
	if (config->mode&  SPI_CS_HIGH)
		cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
--
1.7.0.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: festevam@gmail.com (Fabio Estevam)
Date: 2012-09-22 13:44:55

Hi Dirk,

On Sat, Sep 22, 2012 at 3:10 AM, Dirk Behme [off-list ref] wrote:
I'm not so familiar with the SPI world: Who would be the best person to ack
this, and in case it's ok finally apply it, then?
Mark Brown has been taking care of spi patches recently.

Regards,

Fabio Estevam

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Shawn Guo <hidden>
Date: 2012-09-24 05:06:58

On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
Acked-by: Shawn Guo <redacted>

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Dirk Behme <hidden>
Date: 2012-09-24 06:34:27

Hi Mark,

On 24.09.2012 07:06, Shawn Guo wrote:
On Fri, Aug 31, 2012 at 10:55:11AM +0200, Dirk Behme wrote:
quoted
From: Knut Wohlrab <redacted>

There are SPI devices which need a SPI clock with active low polarity and
high inactive state.

Add the setting of the inactive state ECSPIx_CONFIGREG:SCLK CTL
according to the clock polarity ECSPIx_CONFIGREG:SCLK POL:

DT without "spi-cpol" = 0 = clock active high polarity = inactive state low
DT with    "spi-cpol" = 1 = clock active low  polarity = inactive state high

Signed-off-by: Knut Wohlrab <redacted>
Signed-off-by: Dirk Behme <redacted>
Acked-by: Shawn Guo <redacted>
Being not so familiar with the flow of SPI patches, I was told that you 
are taking care of spi patches recently?

Do you like to have a look to this patch?

Many thanks and best regards

Dirk

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Mark Brown <hidden>
Date: 2012-09-24 10:02:26

On Mon, Sep 24, 2012 at 08:34:27AM +0200, Dirk Behme wrote:
Being not so familiar with the flow of SPI patches, I was told that you  
are taking care of spi patches recently?
Do you like to have a look to this patch?
Well, nobody appears to have sent me a copy of it...

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Dirk Behme <hidden>
Date: 2012-09-24 11:31:22

On 24.09.2012 12:02, Mark Brown wrote:
On Mon, Sep 24, 2012 at 08:34:27AM +0200, Dirk Behme wrote:
quoted
Being not so familiar with the flow of SPI patches, I was told that you  
are taking care of spi patches recently?
quoted
Do you like to have a look to this patch?
Well, nobody appears to have sent me a copy of it...
We are talking about

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/116783.html

which should be at spi-devel-general at lists.sourceforge.net and 
linux-arm-kernel at lists.infradead.org .

I just learned that you might take care of spi patches recently, so 
sorry for not adding you to the CC, initially.

Let me know if you can find above thread on one of the both mailing 
lists. If not, I would be happy to resend it again.

Many thanks for your help!

Dirk

[PATCH] spi/imx: set the inactive state of the clock according to the clock polarity

From: Mark Brown <hidden>
Date: 2012-09-25 11:08:32

On Mon, Sep 24, 2012 at 01:31:22PM +0200, Dirk Behme wrote:
Let me know if you can find above thread on one of the both mailing
lists. If not, I would be happy to resend it again.
Yes, of course - it's hard to apply patches from web archives.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help