Skip to contentSkip to conversation

DSPBRIDGE: Cleanup SSI handling - remove IO_ADDRESS

PATCH Superseded Omar Ramirez Luna 2 participants 3 messages Jan 8, 2010

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 DSPBRIDGE: Cleanup SSI handling - remove IO_ADDRESS

This patch cleans SSI clock preparation and also removes the dependency on IO_ADDRESS variants for easier maintenance.

---
 arch/arm/plat-omap/include/dspbridge/drv.h |    7 ++++++
 drivers/dsp/bridge/services/clk.c          |   30 ++++++++++++++-------------
 2 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/plat-omap/include/dspbridge/drv.h +7 -0
index d14613f..59c26fc 100644
@@ -115,6 +115,13 @@
 #define OMAP_DMMU_BASE 0x5D000000
 #define OMAP_DMMU_SIZE 0x1000
 
+#define OMAP_SSI_BASE		0x48058000
+#define OMAP_SSI_SIZE		0x1000
+
+#define SSI_AUTOIDLE			(1 << 0)
+#define SSI_SIDLE_SMARTIDLE	(2 << 3)
+#define SSI_MIDLE_NOIDLE		(1 << 12)
+
 #define OMAP_PRCM_VDD1_DOMAIN 1
 #define OMAP_PRCM_VDD2_DOMAIN 2
 
drivers/dsp/bridge/services/clk.c +16 -14
index d1c68fc..dbe3988 100644
@@ -39,6 +39,7 @@
 #include <dspbridge/std.h>
 #include <dspbridge/dbdefs.h>
 #include <dspbridge/errbase.h>
+#include <dspbridge/drv.h>
 
 /*  ----------------------------------- Trace & Debug */
 #include <dspbridge/dbc.h>
@@ -54,11 +55,6 @@
 
 typedef volatile unsigned long  REG_UWORD32;
 
-#define SSI_Base        0x48058000
-
-#define SSI_BASE                     IO_ADDRESS(SSI_Base)
-
-
 struct SERVICES_Clk_t {
 	struct clk *clk_handle;
 	const char *clk_name;
@@ -354,19 +350,25 @@ s32 CLK_Get_UseCnt(IN enum SERVICES_ClkId clk_id)
 
 void SSI_Clk_Prepare(bool FLAG)
 {
-	u32 ssi_sysconfig;
-	ssi_sysconfig = __raw_readl((SSI_BASE) + 0x10);
+	void __iomem *ssi_base;
+	unsigned int value;
+
+	ssi_base = ioremap(OMAP_SSI_BASE, OMAP_SSI_SIZE);
 
 	if (FLAG) {
-		/* Set Autoidle, SIDLEMode to smart idle, and MIDLEmode to
-		 * no idle
+		/*
+		 * Set Autoidle, SIDLEMode to smart idle, and MIDLEmode to
+		 * no idle.
 		 */
-		ssi_sysconfig = 0x1011;
+		value = SSI_AUTOIDLE | SSI_SIDLE_SMARTIDLE | SSI_MIDLE_NOIDLE;
 	} else {
-		/* Set Autoidle, SIDLEMode to forced idle, and MIDLEmode to
-		 * forced idle
+		/*
+		 * Set Autoidle, SIDLEMode to forced idle, and MIDLEmode to
+		 * forced idle.
 		 */
-		ssi_sysconfig = 0x1;
+		value = SSI_AUTOIDLE;
 	}
-	__raw_writel((u32)ssi_sysconfig, SSI_BASE + 0x10);
+
+	__raw_writel(value, ssi_base + 0x10);
+	iounmap(ssi_base);
 }
Signature · 1 line
1.6.2.4
#1 lore raw
Quoted 2 lines · Omar Ramirez Luna

This patch cleans SSI clock preparation and also removes the dependency on IO_ADDRESS variants for easier maintenance.

So this patch is:
* reorganizing SSI configuration
* doing some code-style cleanups
* using ioremap()

That doesn't look very atomic to me.

Quoted 13 lines
---
 arch/arm/plat-omap/include/dspbridge/drv.h |    7 ++++++
 drivers/dsp/bridge/services/clk.c          |   30 ++++++++++++++-------------
 2 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/plat-omap/include/dspbridge/drv.h +0 -0
index d14613f..59c26fc 100644
@@ -115,6 +115,13 @@
 #define OMAP_DMMU_BASE 0x5D000000
 #define OMAP_DMMU_SIZE 0x1000

arch/arm/plat-omap/include/dspbridge/drv.h line 126

Quoted 10 lines
arch/arm/plat-omap/include/dspbridge/drv.h +7 -0
 
+#define OMAP_SSI_BASE		0x48058000
+#define OMAP_SSI_SIZE		0x1000
+
+#define SSI_AUTOIDLE			(1 << 0)
+#define SSI_SIDLE_SMARTIDLE	(2 << 3)
+#define SSI_MIDLE_NOIDLE		(1 << 12)
+
 #define OMAP_PRCM_VDD1_DOMAIN 1
 #define OMAP_PRCM_VDD2_DOMAIN 2

Isn't this some abuse of arch/arm? In general things in header files are meant to be used in more than one source file, and it doesn't seem anybody would use these other than clk.c.

Signature · 1 line
Felipe Contreras
#2 lore raw
Quoted 8 lines

From: Felipe Contreras [mailto:[email protected]]

Quoted 2 lines · Omar Ramirez Luna

This patch cleans SSI clock preparation and also removes the dependency on IO_ADDRESS variants for easier maintenance.

So this patch is:

Cleaning ssi handling

Quoted 5 lines

* reorganizing SSI configuration
* doing some code-style cleanups
* using ioremap()

That doesn't look very atomic to me.

I'll split this and resend...

Quoted 16 lines

arch/arm/plat-

Quoted 8 lines
---
 arch/arm/plat-omap/include/dspbridge/drv.h |    7 ++++++
 drivers/dsp/bridge/services/clk.c          |   30 ++++++++++++++-------------
 2 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/plat- renamed from arch/arm/plat-omap/include/dspbridge/drv.h +0 -0

omap/include/dspbridge/drv.h

Quoted 7 lines

index d14613f..59c26fc 100644

arch/arm/plat-omap/include/dspbridge/drv.h +0 -0
@@ -115,6 +115,13 @@
 #define OMAP_DMMU_BASE 0x5D000000
 #define OMAP_DMMU_SIZE 0x1000
 
Quoted 13 lines

arch/arm/plat-omap/include/dspbridge/drv.h line 126

Quoted 9 lines
arch/arm/plat-omap/include/dspbridge/drv.h +7 -0
+#define OMAP_SSI_BASE		0x48058000
+#define OMAP_SSI_SIZE		0x1000
+
+#define SSI_AUTOIDLE			(1 << 0)
+#define SSI_SIDLE_SMARTIDLE	(2 << 3)
+#define SSI_MIDLE_NOIDLE		(1 << 12)
+
 #define OMAP_PRCM_VDD1_DOMAIN 1
 #define OMAP_PRCM_VDD2_DOMAIN 2

Isn't this some abuse of arch/arm? In general things in header files are meant to be used in more than one source file, and it doesn't seem anybody would use these other than clk.c.

I kind of agree but I thought it was worse to have registers defined all over the place, like in _tiomap.h (where some of these registers are defined along with MBX...)

That said I'll keep this within clk.c

- omar