Skip to contentSkip to conversation

OMAP: MCSPI: Enable mcspi wake-up

PATCH In review Jouni Hogander 4 participants 10 messages Nov 18, 2008 – Nov 26, 2008 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP: MCSPI: Enable mcspi wake-up

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

---
 drivers/spi/omap2_mcspi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/spi/omap2_mcspi.c +9 -2
index 454a271..4bd330c 100644
@@ -59,6 +59,8 @@
 
 /* per-register bitmasks: */
 
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(0x1 << 2)
 #define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	(1 << 0)
 #define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	(1 << 1)
 
@@ -90,6 +92,7 @@
 
 #define OMAP2_MCSPI_CHCTRL_EN		(1 << 0)
 
+#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	(1 << 0)
 
 /* We have 2 DMA channels per CS, one for RX and one for TX */
 struct omap2_mcspi_dma {
@@ -884,8 +887,12 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi)
 	} while (!(tmp & OMAP2_MCSPI_SYSSTATUS_RESETDONE));
 
 	mcspi_write_reg(master, OMAP2_MCSPI_SYSCONFIG,
-			/* (3 << 8) | (2 << 3) | */
-			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE);
+			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE |
+			OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP |
+			OMAP2_MCSPI_SYSCONFIG_SMARTIDLE);
+
+	mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE,
+			OMAP2_MCSPI_WAKEUPENABLE_WKEN);
 
 	omap2_mcspi_set_master_mode(master);
 
Signature · 1 line
1.6.0.1
#1 lore raw
Quoted 13 lines · Jouni Högander

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

---
 drivers/spi/omap2_mcspi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/spi/omap2_mcspi.c +0 -0
index 454a271..4bd330c 100644

drivers/spi/omap2_mcspi.c line 63

Quoted 5 lines
drivers/spi/omap2_mcspi.c +2 -0
@@ -59,6 +59,8 @@
 
 /* per-register bitmasks: */
 
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(0x1 << 2)

could you follow the convention below and use (1 << offset) ??

Quoted 33 lines
drivers/spi/omap2_mcspi.c +7 -2
 #define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	(1 << 0)
 #define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	(1 << 1)
 
@@ -90,6 +92,7 @@
 
 #define OMAP2_MCSPI_CHCTRL_EN		(1 << 0)
 
+#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	(1 << 0)
 
 /* We have 2 DMA channels per CS, one for RX and one for TX */
 struct omap2_mcspi_dma {
@@ -884,8 +887,12 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi)
 	} while (!(tmp & OMAP2_MCSPI_SYSSTATUS_RESETDONE));
 
 	mcspi_write_reg(master, OMAP2_MCSPI_SYSCONFIG,
-			/* (3 << 8) | (2 << 3) | */
-			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE);
+			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE |
+			OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP |
+			OMAP2_MCSPI_SYSCONFIG_SMARTIDLE);
+
+	mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE,
+			OMAP2_MCSPI_WAKEUPENABLE_WKEN);
 
 	omap2_mcspi_set_master_mode(master);
 
Signature · 6 lines
1.6.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 4 lines · Felipe Balbi

drivers/spi/omap2_mcspi.c line 63

Quoted 2 lines
drivers/spi/omap2_mcspi.c +2 -0
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE      (0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP      (0x1 << 2)

could you follow the convention below and use (1 << offset) ??

Or even BIT(offset).

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 7 lines · David Brownell
Quoted 4 lines · Felipe Balbi

drivers/spi/omap2_mcspi.c line 63

Quoted 2 lines
drivers/spi/omap2_mcspi.c +2 -0
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE      (0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP      (0x1 << 2)

could you follow the convention below and use (1 << offset) ??

Or even BIT(offset).

much better :-)

Signature · 5 lines
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to Felipe Balbi
Quoted 15 lines · Felipe Balbi
Quoted 14 lines · Jouni Högander

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

---
 drivers/spi/omap2_mcspi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/spi/omap2_mcspi.c +0 -0
index 454a271..4bd330c 100644
@@ -59,6 +59,8 @@
 
Quoted 6 lines

drivers/spi/omap2_mcspi.c line 63

Quoted 4 lines
drivers/spi/omap2_mcspi.c +2 -0
 /* per-register bitmasks: */
 
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(0x1 << 2)

could you follow the convention below and use (1 << offset) ??

There aren't any convention in this driver, but I can change my patch.

Signature · 6 lines
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH 1/1 OMAP: MCSPI: Enable mcspi wake-up v2.

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

---
 drivers/spi/omap2_mcspi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/spi/omap2_mcspi.c +9 -2
index 454a271..d7e519c 100644
@@ -59,6 +59,8 @@
 
 /* per-register bitmasks: */
 
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(1 << 2)
 #define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	(1 << 0)
 #define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	(1 << 1)
 
@@ -90,6 +92,7 @@
 
 #define OMAP2_MCSPI_CHCTRL_EN		(1 << 0)
 
+#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	(1 << 0)
 
 /* We have 2 DMA channels per CS, one for RX and one for TX */
 struct omap2_mcspi_dma {
@@ -884,8 +887,12 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi)
 	} while (!(tmp & OMAP2_MCSPI_SYSSTATUS_RESETDONE));
 
 	mcspi_write_reg(master, OMAP2_MCSPI_SYSCONFIG,
-			/* (3 << 8) | (2 << 3) | */
-			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE);
+			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE |
+			OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP |
+			OMAP2_MCSPI_SYSCONFIG_SMARTIDLE);
+
+	mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE,
+			OMAP2_MCSPI_WAKEUPENABLE_WKEN);
 
 	omap2_mcspi_set_master_mode(master);
 
Signature · 1 line
1.6.0.1
#4 lore raw
In reply to David Brownell
Quoted 7 lines · ext David Brownell
Quoted 4 lines · Felipe Balbi

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE      (0x2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP      (0x1 << 2)

could you follow the convention below and use (1 << offset) ??

Or even BIT(offset).

I'm usually not too willing to do changes more than what is needed to do the job. Just to reduce amount of patch versions from me:) Average for me is something like 0.2 version/changed line:) Patch below would mean something like 6 versions:

From 721bf914c53feb4fbcc9cd1d5dcc8597067519c9 Mon Sep 17 00:00:00 2001
From: Jouni Hogander <[email protected]>
Date: Wed, 19 Nov 2008 09:41:11 +0200
Subject: [PATCH] OMAP: MCSPI: Convert bit shifted values into BIT format

---
 drivers/spi/omap2_mcspi.c |   50 ++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 25 deletions(-)
drivers/spi/omap2_mcspi.c +25 -25
index d7e519c..aa93e46 100644
@@ -59,40 +59,40 @@
 
 /* per-register bitmasks: */
 
-#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(2 << 3)
-#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(1 << 2)
-#define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	(1 << 0)
-#define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	(1 << 1)
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	BIT(4)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	BIT(2)
+#define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	BIT(0)
+#define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	BIT(1)
 
-#define OMAP2_MCSPI_SYSSTATUS_RESETDONE	(1 << 0)
+#define OMAP2_MCSPI_SYSSTATUS_RESETDONE	BIT(0)
 
-#define OMAP2_MCSPI_MODULCTRL_SINGLE	(1 << 0)
-#define OMAP2_MCSPI_MODULCTRL_MS	(1 << 2)
-#define OMAP2_MCSPI_MODULCTRL_STEST	(1 << 3)
+#define OMAP2_MCSPI_MODULCTRL_SINGLE	BIT(0)
+#define OMAP2_MCSPI_MODULCTRL_MS	BIT(2)
+#define OMAP2_MCSPI_MODULCTRL_STEST	BIT(3)
 
-#define OMAP2_MCSPI_CHCONF_PHA		(1 << 0)
-#define OMAP2_MCSPI_CHCONF_POL		(1 << 1)
+#define OMAP2_MCSPI_CHCONF_PHA		BIT(0)
+#define OMAP2_MCSPI_CHCONF_POL		BIT(1)
 #define OMAP2_MCSPI_CHCONF_CLKD_MASK	(0x0f << 2)
-#define OMAP2_MCSPI_CHCONF_EPOL		(1 << 6)
+#define OMAP2_MCSPI_CHCONF_EPOL		BIT(6)
 #define OMAP2_MCSPI_CHCONF_WL_MASK	(0x1f << 7)
-#define OMAP2_MCSPI_CHCONF_TRM_RX_ONLY	(0x01 << 12)
-#define OMAP2_MCSPI_CHCONF_TRM_TX_ONLY	(0x02 << 12)
+#define OMAP2_MCSPI_CHCONF_TRM_RX_ONLY	BIT(12)
+#define OMAP2_MCSPI_CHCONF_TRM_TX_ONLY	BIT(13)
 #define OMAP2_MCSPI_CHCONF_TRM_MASK	(0x03 << 12)
-#define OMAP2_MCSPI_CHCONF_DMAW		(1 << 14)
-#define OMAP2_MCSPI_CHCONF_DMAR		(1 << 15)
-#define OMAP2_MCSPI_CHCONF_DPE0		(1 << 16)
-#define OMAP2_MCSPI_CHCONF_DPE1		(1 << 17)
-#define OMAP2_MCSPI_CHCONF_IS		(1 << 18)
-#define OMAP2_MCSPI_CHCONF_TURBO	(1 << 19)
-#define OMAP2_MCSPI_CHCONF_FORCE	(1 << 20)
+#define OMAP2_MCSPI_CHCONF_DMAW		BIT(14)
+#define OMAP2_MCSPI_CHCONF_DMAR		BIT(15)
+#define OMAP2_MCSPI_CHCONF_DPE0		BIT(16)
+#define OMAP2_MCSPI_CHCONF_DPE1		BIT(17)
+#define OMAP2_MCSPI_CHCONF_IS		BIT(18)
+#define OMAP2_MCSPI_CHCONF_TURBO	BIT(19)
+#define OMAP2_MCSPI_CHCONF_FORCE	BIT(20)
 
-#define OMAP2_MCSPI_CHSTAT_RXS		(1 << 0)
-#define OMAP2_MCSPI_CHSTAT_TXS		(1 << 1)
-#define OMAP2_MCSPI_CHSTAT_EOT		(1 << 2)
+#define OMAP2_MCSPI_CHSTAT_RXS		BIT(0)
+#define OMAP2_MCSPI_CHSTAT_TXS		BIT(1)
+#define OMAP2_MCSPI_CHSTAT_EOT		BIT(2)
 
-#define OMAP2_MCSPI_CHCTRL_EN		(1 << 0)
+#define OMAP2_MCSPI_CHCTRL_EN		BIT(0)
 
-#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	(1 << 0)
+#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	BIT(0)
 
 /* We have 2 DMA channels per CS, one for RX and one for TX */
 struct omap2_mcspi_dma {
Signature · 8 lines
1.6.0.1

 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

Re: [PATCH] OMAP: MCSPI: Enable mcspi wake-up v2.

In reply to Jouni Hogander
Quoted 2 lines · Jouni Hogander

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

Dave, I assume you're picking these for your SPI queue? Will only apply to l-o if you ack and tell me so.

Tony

Quoted 48 lines
---
 drivers/spi/omap2_mcspi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/spi/omap2_mcspi.c +9 -2
index 454a271..d7e519c 100644
@@ -59,6 +59,8 @@
 
 /* per-register bitmasks: */
 
+#define OMAP2_MCSPI_SYSCONFIG_SMARTIDLE	(2 << 3)
+#define OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP	(1 << 2)
 #define OMAP2_MCSPI_SYSCONFIG_AUTOIDLE	(1 << 0)
 #define OMAP2_MCSPI_SYSCONFIG_SOFTRESET	(1 << 1)
 
@@ -90,6 +92,7 @@
 
 #define OMAP2_MCSPI_CHCTRL_EN		(1 << 0)
 
+#define OMAP2_MCSPI_WAKEUPENABLE_WKEN	(1 << 0)
 
 /* We have 2 DMA channels per CS, one for RX and one for TX */
 struct omap2_mcspi_dma {
@@ -884,8 +887,12 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi)
 	} while (!(tmp & OMAP2_MCSPI_SYSSTATUS_RESETDONE));
 
 	mcspi_write_reg(master, OMAP2_MCSPI_SYSCONFIG,
-			/* (3 << 8) | (2 << 3) | */
-			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE);
+			OMAP2_MCSPI_SYSCONFIG_AUTOIDLE |
+			OMAP2_MCSPI_SYSCONFIG_ENAWAKEUP |
+			OMAP2_MCSPI_SYSCONFIG_SMARTIDLE);
+
+	mcspi_write_reg(master, OMAP2_MCSPI_WAKEUPENABLE,
+			OMAP2_MCSPI_WAKEUPENABLE_WKEN);
 
 	omap2_mcspi_set_master_mode(master);
 
Signature · 6 lines
1.6.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw

Re: [PATCH] OMAP: MCSPI: Enable mcspi wake-up v2.

Quoted 6 lines · Tony Lindgren
Quoted 2 lines · Jouni Hogander

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

Dave, I assume you're picking these for your SPI queue? Will only apply to l-o if you ack and tell me so.

OK... I'm not totally caught up there. Is this needed for a 2.6.28-final merge? I'm guessing not; so it'd be OK to queue for 2.6.29-final and have it in l-o until 29-rc1 gets pulled down.

- Dave

#9 lore raw

Re: [PATCH] OMAP: MCSPI: Enable mcspi wake-up v2.

Quoted 5 lines · David Brownell
Quoted 4 lines · Tony Lindgren
Quoted 2 lines · Jouni Hogander

Currently mcspi wake-ups are not enabled. This might cause case where OMAP is not waking up on mcspi events.

Quoted 7 lines
Quoted 2 lines

Dave, I assume you're picking these for your SPI queue? Will only apply to l-o if you ack and tell me so.

OK... I'm not totally caught up there. Is this needed for a 2.6.28-final merge? I'm guessing not; so it'd be OK to queue for 2.6.29-final and have it in l-o until 29-rc1 gets pulled down.

Yes 2.6.29 timeline sounds fine to me at least. I'll apply these to l-o then.

Tony