Skip to contentSkip to conversation

ARM: OMAP4: Enable AESS IP.

PATCH Superseded Sebastien Guiriec 4 participants 11 messages Jan 9, 2013 – Feb 10, 2013

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: OMAP4: Enable AESS IP.

v2:
- Add missing AESS memory banks.
- Update the serie base on comments related earlier serie:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg69853.html

The location of the callback has been updated in order to fit with AESS. Some call of PM runtime can be done by ASoC core when AESS is in RET so we need to ensure that the additional callback is call on enable also in order to have clock correctly stop.

v1:
ARM: OMAP4: Enable AESS IP.

This patch serie extends the the hwmod HWMOD_EXT_OPT_MAIN_CLK flag for the AESS IP. This IP has additional register for Auto Gatting configuration. As it is used only for Audio the driver is not always loaded. We can reuse the same flag as McPDM to work around the HW problem due to bad reset value of AESS Auto gatting configuration register.

If we try to setup and reset AESS during boot time without this serie the next clocks will still remain enable.

omapconf abe cfg:

|--------------------------------------------------------------|
| ABE        Clock Domain Configuration                        |
|--------------------------------|-----------------------------|
| Clock State Transition control | HW-Auto                     |
| Clock State                    |                             |
|   ABE_24M_FCLK                 | GATED                       |
|   ABE_ALWON_32K_CLK            | GATED                       |
|   ABE_SYSCLK                   | GATED                       |
|   24M_FCLK                     | GATED                       |
|   ABE_ICLK2                    | RUNNING                     |
|   DPLL_ABE_X2_CLK              | RUNNING                     |
|   PAD_CLKS                     | GATED                       |
|   SLIMBUS_CLK                  | GATED                       |
| OPP Divider                    | ABE_CLK = DPLL_ABE_X2_CLK/1 |
|--------------------------------------------------------------|

Paul Walmsley (3):
ARM: OMAP2+: hwmod: add enable_preprogram hook
ASoC: TI AESS: add autogating-enable function, callable from
architecture code
ARM: OMAP4+: AESS: enable internal auto-gating during initial setup

Sebastien Guiriec (2):
OMAP4: hwmod data: Enable AESS hwmod device
OMAP4: hwmod data: Update AESS data with memory bank area

 arch/arm/mach-omap2/Makefile               |    2 +-
 arch/arm/mach-omap2/omap_hwmod.c           |   18 ++++++++++
 arch/arm/mach-omap2/omap_hwmod.h           |    8 +++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   49 +++++++++++++++++++++++--
 arch/arm/mach-omap2/omap_hwmod_reset.c     |   52 +++++++++++++++++++++++++++
 include/sound/aess.h                       |   53 ++++++++++++++++++++++++++++
 6 files changed, 178 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_reset.c
 create mode 100644 include/sound/aess.h
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/5 ARM: OMAP2+: hwmod: add enable_preprogram hook

From: Paul Walmsley <[email protected]>

After setup/enable, some IP blocks need some additional setting to indicate the PRCM that they are inactive until they are configured. Some examples on OMAP4 include the AESS and FSUSB IP blocks.

To fix this cleanly, this patch adds another optional function pointer, setup_preprogram, to the IP block's hwmod data. The function that is pointed to is called by the hwmod code immediately after the IP block is reset.

Cc Beno?t Cousson <[email protected]>
Cc P?ter Ujfalusi <[email protected]>
Cc Felipe Balbi <[email protected]>
---
 arch/arm/mach-omap2/omap_hwmod.c |   18 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod.h |    2 ++
 2 files changed, 20 insertions(+)
arch/arm/mach-omap2/omap_hwmod.c +18 -0
index 4653efb..f37d22c 100644
@@ -2053,6 +2053,23 @@ static int _omap4_get_context_lost(struct omap_hwmod *oh)
 }
 
 /**
+ * _enable_preprogram - Pre-program an IP block during the _enable() process
+ * @oh: struct omap_hwmod *
+ *
+ * Some IP blocks (such as AESS) require some additional programming
+ * after enable before they can enter idle.  If a function pointer to
+ * do so is present in the hwmod data, then call it and pass along the
+ * return value; otherwise, return 0.
+ */
+static int __init _enable_preprogram(struct omap_hwmod *oh)
+{
+	if (!oh->class->enable_preprogram)
+		return 0;
+
+	return oh->class->enable_preprogram(oh);
+}
+
+/**
  * _enable - enable an omap_hwmod
  * @oh: struct omap_hwmod *
  *
@@ -2156,6 +2173,7 @@ static int _enable(struct omap_hwmod *oh)
 				_update_sysc_cache(oh);
 			_enable_sysc(oh);
 		}
+		r = _enable_preprogram(oh);
 	} else {
 		if (soc_ops.disable_module)
 			soc_ops.disable_module(oh);
arch/arm/mach-omap2/omap_hwmod.h +2 -0
index 3ae852a..41066b4 100644
@@ -501,6 +501,7 @@ struct omap_hwmod_omap4_prcm {
  * @rev: revision of the IP class
  * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown
  * @reset: ptr to fn to be executed in place of the standard hwmod reset fn
+ * @enable_preprogram:  ptr to fn to be executed during device enable
  *
  * Represent the class of a OMAP hardware "modules" (e.g. timer,
  * smartreflex, gpio, uart...)
@@ -524,6 +525,7 @@ struct omap_hwmod_class {
 	u32					rev;
 	int					(*pre_shutdown)(struct omap_hwmod *oh);
 	int					(*reset)(struct omap_hwmod *oh);
+	int					(*enable_preprogram)(struct omap_hwmod *oh);
 };
 
 /**
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 1/5 ARM: OMAP2+: hwmod: add enable_preprogram hook

Quoted 8 lines · Sebastien Guiriec

From: Paul Walmsley <[email protected]>

After setup/enable, some IP blocks need some additional setting to indicate the PRCM that they are inactive until they are configured. Some examples on OMAP4 include the AESS and FSUSB IP blocks.

To fix this cleanly, this patch adds another optional function pointer, setup_preprogram, to the IP block's hwmod data. The function

the function pointer is called enable_preprogram.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130109/45c8d6c1/attachment.sig>
#3 lore raw

PATCH v2 2/5 ASoC: TI AESS: add autogating-enable function, callable from architecture code

In reply to Sebastien Guiriec

From: Paul Walmsley <[email protected]>

Add a basic header file for the TI AESS IP block, located in the OMAP4 Audio Back-End subsystem.

Currently, this header file only contains a function to enable the AESS internal clock auto-gating. This will be used by a subsequent patch to ensure that the AESS won't block the entire chip low-power-idle mode. We wish to be able to place the AESS into idle even when no AESS driver has been compiled in.

Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
Cc P?ter Ujfalusi <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 include/sound/aess.h |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 include/sound/aess.h
include/sound/aess.h new file +53 -0
new file mode 100644
index 0000000..cee0d09
@@ -0,0 +1,53 @@
+/*
+ * AESS IP block reset
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef __SOUND_AESS_H__
+#define __SOUND_AESS_H__
+
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+/*
+ * AESS_AUTO_GATING_ENABLE_OFFSET: offset in bytes of the AESS IP
+ *     block's AESS_AUTO_GATING_ENABLE__1 register from the IP block's
+ *     base address
+ */
+#define AESS_AUTO_GATING_ENABLE_OFFSET			0x07c
+
+/* Register bitfields in the AESS_AUTO_GATING_ENABLE__1 register */
+#define AESS_AUTO_GATING_ENABLE_SHIFT			0
+
+/**
+ * aess_enable_autogating - enable AESS internal autogating
+ * @oh: struct omap_hwmod *
+ *
+ * Enable internal autogating on the AESS.  This allows the AESS to
+ * indicate that it is idle to the OMAP PRCM.  Returns 0.
+ */
+static inline void aess_enable_autogating(void __iomem *base)
+{
+	u32 v;
+
+	/* Set AESS_AUTO_GATING_ENABLE__1.ENABLE to allow idle entry */
+	v = 1 << AESS_AUTO_GATING_ENABLE_SHIFT;
+	writel(v, base + AESS_AUTO_GATING_ENABLE_OFFSET);
+}
+
+#endif /* __SOUND_AESS_H__ */
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v2 2/5 ASoC: TI AESS: add autogating-enable function, callable from architecture code

Quoted 4 lines · Sebastien Guiriec

From: Paul Walmsley <[email protected]>

Add a basic header file for the TI AESS IP block, located in the OMAP4 Audio Back-End subsystem.

Acked-by: Mark Brown <broonie'opensource.wolfsonmicro.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130109/d881fa8d/attachment-0001.sig>

#5 lore raw

PATCH v2 3/5 ARM: OMAP4+: AESS: enable internal auto-gating during initial setup

In reply to Sebastien Guiriec

From: Paul Walmsley <[email protected]>

Enable the AESS auto-gating control bit during AESS hwmod setup. This fixes the following boot warning on OMAP4:

omap_hwmod: aess: _wait_target_disable failed

Without this patch, the AESS IP block does not indicate to the PRCM that it is idle after it is reset. This prevents some types of SoC power management until something sets the auto-gating control bit.

Cc Beno?t Cousson <[email protected]>
Cc P?ter Ujfalusi <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/Makefile               |    2 +-
 arch/arm/mach-omap2/omap_hwmod.h           |    6 ++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    1 +
 arch/arm/mach-omap2/omap_hwmod_reset.c     |   52 ++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_reset.c
arch/arm/mach-omap2/Makefile +1 -1
index 947cafe..d88788f 100644
@@ -8,7 +8,7 @@ obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
 	 omap_device.o sram.o
 
 omap-2-3-common				= irq.o
-hwmod-common				= omap_hwmod.o \
+hwmod-common				= omap_hwmod.o omap_hwmod_reset.o \
 					  omap_hwmod_common_data.o
 clock-common				= clock.o clock_common_data.o \
 					  clkt_dpll.o clkt_clksel.o
arch/arm/mach-omap2/omap_hwmod.h +6 -0
index 41066b4..6ec73cb 100644
@@ -673,6 +673,12 @@ extern void __init omap_hwmod_init(void);
 const char *omap_hwmod_get_main_clk(struct omap_hwmod *oh);
 
 /*
+ *
+ */
+
+extern int omap_hwmod_aess_preprogram(struct omap_hwmod *oh);
+
+/*
  * Chip variant-specific hwmod init routines - XXX should be converted
  * to use initcalls once the initial boot ordering is straightened out
  */
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
index 584acf9..13e397f 100644
@@ -322,6 +322,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_aess_sysc = {
 static struct omap_hwmod_class omap44xx_aess_hwmod_class = {
 	.name	= "aess",
 	.sysc	= &omap44xx_aess_sysc,
+	.enable_preprogram = omap_hwmod_aess_preprogram,
 };
 
 /* aess */
arch/arm/mach-omap2/omap_hwmod_reset.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#6 lore raw

PATCH v2 4/5 OMAP4: hwmod data: Enable AESS hwmod device

In reply to Sebastien Guiriec

Enable AESS data in hwmod in order to be able to probe audio driver.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -3
index 13e397f..6d22fd0 100644
@@ -6279,7 +6279,7 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
 	&omap44xx_l3_main_1__l3_main_3,
 	&omap44xx_l3_main_2__l3_main_3,
 	&omap44xx_l4_cfg__l3_main_3,
-	/* &omap44xx_aess__l4_abe, */
+	&omap44xx_aess__l4_abe,
 	&omap44xx_dsp__l4_abe,
 	&omap44xx_l3_main_1__l4_abe,
 	&omap44xx_mpu__l4_abe,
@@ -6288,8 +6288,8 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
 	&omap44xx_l4_cfg__l4_wkup,
 	&omap44xx_mpu__mpu_private,
 	&omap44xx_l4_cfg__ocp_wp_noc,
-	/* &omap44xx_l4_abe__aess, */
-	/* &omap44xx_l4_abe__aess_dma, */
+	&omap44xx_l4_abe__aess,
+	&omap44xx_l4_abe__aess_dma,
 	&omap44xx_l3_main_2__c2c,
 	&omap44xx_l4_wkup__counter_32k,
 	&omap44xx_l4_cfg__ctrl_module_core,
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH v2 5/5 OMAP4: hwmod data: Update AESS data with memory bank area

In reply to Sebastien Guiriec

Add AESS memory bank data in hwmod in order to provide memory address information to the driver.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   42 ++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +42 -0
index 6d22fd0..631611c 100644
@@ -4246,6 +4246,27 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp_wp_noc = {
 
 static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
 	{
+		.name		= "dmem",
+		.pa_start	= 0x40180000,
+		.pa_end		= 0x4018ffff
+	},
+	{
+		.name		= "cmem",
+		.pa_start	= 0x401a0000,
+		.pa_end		= 0x401a1fff
+	},
+	{
+		.name		= "smem",
+		.pa_start	= 0x401c0000,
+		.pa_end		= 0x401c5fff
+	},
+	{
+		.name		= "pmem",
+		.pa_start	= 0x401e0000,
+		.pa_end		= 0x401e1fff
+	},
+	{
+		.name		= "mpu",
 		.pa_start	= 0x401f1000,
 		.pa_end		= 0x401f13ff,
 		.flags		= ADDR_TYPE_RT
@@ -4264,6 +4285,27 @@ static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess = {
 
 static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
 	{
+		.name		= "dmem_dma",
+		.pa_start	= 0x49080000,
+		.pa_end		= 0x4908ffff
+	},
+	{
+		.name		= "cmem_dma",
+		.pa_start	= 0x490a0000,
+		.pa_end		= 0x490a1fff
+	},
+	{
+		.name		= "smem_dma",
+		.pa_start	= 0x490c0000,
+		.pa_end		= 0x490c5fff
+	},
+	{
+		.name		= "pmem_dma",
+		.pa_start	= 0x490e0000,
+		.pa_end		= 0x490e1fff
+	},
+	{
+		.name		= "dma",
 		.pa_start	= 0x490f1000,
 		.pa_end		= 0x490f13ff,
 		.flags		= ADDR_TYPE_RT
Signature · 1 line
1.7.10.4
maintainer
#8 lore raw

PATCH v2 5/5 OMAP4: hwmod data: Update AESS data with memory bank area

Hi

Quoted 4 lines · Sebastien Guiriec

Add AESS memory bank data in hwmod in order to provide memory address information to the driver.

Due to the cleanup of the CLKCTRL leaf clocks, this one has been updated to change the AESS main clock to be aess_fclk, and it's also been moved to precede the patch that enables the AESS hwmod.

- Paul

From: Sebastien Guiriec <[email protected]>
Date: Sun, 10 Feb 2013 11:22:24 -0700
Subject: [PATCH] ARM: OMAP4: hwmod data: Update AESS data with memory bank
area

Add AESS memory bank data in hwmod in order to provide memory address information to the driver.

This version also changes the AESS main clock to use a non-CLKCTRL-based functional clock. These are being removed from the clock data, since they should be handled by the IP block integration code. Without this change, the kernel crashes during boot. Thanks to Tony Lindgren for reporting this during a test merge.

[paul at pwsan.com: updated to change the AESS main_clk]
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   44 +++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +43 -1
index c9c251e..a30c113 100644
@@ -349,7 +349,7 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
 	.clkdm_name	= "abe_clkdm",
 	.mpu_irqs	= omap44xx_aess_irqs,
 	.sdma_reqs	= omap44xx_aess_sdma_reqs,
-	.main_clk	= "aess_fck",
+	.main_clk	= "aess_fclk",
 	.prcm = {
 		.omap4 = {
 			.clkctrl_offs = OMAP4_CM1_ABE_AESS_CLKCTRL_OFFSET,
@@ -4250,6 +4250,27 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp_wp_noc = {
 
 static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
 	{
+		.name		= "dmem",
+		.pa_start	= 0x40180000,
+		.pa_end		= 0x4018ffff
+	},
+	{
+		.name		= "cmem",
+		.pa_start	= 0x401a0000,
+		.pa_end		= 0x401a1fff
+	},
+	{
+		.name		= "smem",
+		.pa_start	= 0x401c0000,
+		.pa_end		= 0x401c5fff
+	},
+	{
+		.name		= "pmem",
+		.pa_start	= 0x401e0000,
+		.pa_end		= 0x401e1fff
+	},
+	{
+		.name		= "mpu",
 		.pa_start	= 0x401f1000,
 		.pa_end		= 0x401f13ff,
 		.flags		= ADDR_TYPE_RT
@@ -4268,6 +4289,27 @@ static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_abe__aess = {
 
 static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
 	{
+		.name		= "dmem_dma",
+		.pa_start	= 0x49080000,
+		.pa_end		= 0x4908ffff
+	},
+	{
+		.name		= "cmem_dma",
+		.pa_start	= 0x490a0000,
+		.pa_end		= 0x490a1fff
+	},
+	{
+		.name		= "smem_dma",
+		.pa_start	= 0x490c0000,
+		.pa_end		= 0x490c5fff
+	},
+	{
+		.name		= "pmem_dma",
+		.pa_start	= 0x490e0000,
+		.pa_end		= 0x490e1fff
+	},
+	{
+		.name		= "dma",
 		.pa_start	= 0x490f1000,
 		.pa_end		= 0x490f13ff,
 		.flags		= ADDR_TYPE_RT
Signature · 1 line
1.7.10.4
#9 lore raw

v2 cover ARM: OMAP4: Enable AESS IP.

In reply to Sebastien Guiriec

Paul, Benoit,

Any comments before I resend the serie with the minor comment for Felipe?

Sebastien

Quoted 59 lines · Sebastien Guiriec

v2:
- Add missing AESS memory banks.
- Update the serie base on comments related earlier serie:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg69853.html

The location of the callback has been updated in order to fit with AESS. Some call of PM runtime can be done by ASoC core when AESS is in RET so we need to ensure that the additional callback is call on enable also in order to have clock correctly stop.

v1:
ARM: OMAP4: Enable AESS IP.

This patch serie extends the the hwmod HWMOD_EXT_OPT_MAIN_CLK flag for the AESS IP. This IP has additional register for Auto Gatting configuration. As it is used only for Audio the driver is not always loaded. We can reuse the same flag as McPDM to work around the HW problem due to bad reset value of AESS Auto gatting configuration register.

If we try to setup and reset AESS during boot time without this serie the next clocks will still remain enable.

omapconf abe cfg:

|--------------------------------------------------------------|
| ABE        Clock Domain Configuration                        |
|--------------------------------|-----------------------------|
| Clock State Transition control | HW-Auto                     |
| Clock State                    |                             |
|   ABE_24M_FCLK                 | GATED                       |
|   ABE_ALWON_32K_CLK            | GATED                       |
|   ABE_SYSCLK                   | GATED                       |
|   24M_FCLK                     | GATED                       |
|   ABE_ICLK2                    | RUNNING                     |
|   DPLL_ABE_X2_CLK              | RUNNING                     |
|   PAD_CLKS                     | GATED                       |
|   SLIMBUS_CLK                  | GATED                       |
| OPP Divider                    | ABE_CLK = DPLL_ABE_X2_CLK/1 |
|--------------------------------------------------------------|

Paul Walmsley (3):
ARM: OMAP2+: hwmod: add enable_preprogram hook
ASoC: TI AESS: add autogating-enable function, callable from
architecture code
ARM: OMAP4+: AESS: enable internal auto-gating during initial setup

Sebastien Guiriec (2):
OMAP4: hwmod data: Enable AESS hwmod device
OMAP4: hwmod data: Update AESS data with memory bank area

  arch/arm/mach-omap2/Makefile               |    2 +-
  arch/arm/mach-omap2/omap_hwmod.c           |   18 ++++++++++
  arch/arm/mach-omap2/omap_hwmod.h           |    8 +++++
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   49 +++++++++++++++++++++++--
  arch/arm/mach-omap2/omap_hwmod_reset.c     |   52 +++++++++++++++++++++++++++
  include/sound/aess.h                       |   53 ++++++++++++++++++++++++++++
  6 files changed, 178 insertions(+), 4 deletions(-)

create mode 100644 arch/arm/mach-omap2/omap_hwmod_reset.c create mode 100644 include/sound/aess.h

maintainer
#10 lore raw

v2 cover ARM: OMAP4: Enable AESS IP.

Quoted 3 lines · Sebastien Guiriec

Paul, Benoit,

Any comments before I resend the serie with the minor comment for Felipe?

Not from me. The series has been queued for 3.9 with Felipe's comment fix; thanks Felipe.

- Paul

From: Paul Walmsley <[email protected]>
Date: Sun, 20 Jan 2013 18:52:09 -0700
Subject: [PATCH] ARM: OMAP2+: hwmod: add enable_preprogram hook

After setup/enable, some IP blocks need some additional setting to indicate the PRCM that they are inactive until they are configured. Some examples on OMAP4 include the AESS and FSUSB IP blocks.

To fix this cleanly, this patch adds another optional function pointer, enable_preprogram, to the IP block's hwmod data. The function that is pointed to is called by the hwmod code immediately after the IP block is reset.

This version of the patch includes a patch description fix from Felipe.

Cc Beno?t Cousson <[email protected]>
Cc P?ter Ujfalusi <[email protected]>
Cc Felipe Balbi <[email protected]>
---
 arch/arm/mach-omap2/omap_hwmod.c |   18 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod.h |    2 ++
 2 files changed, 20 insertions(+)
arch/arm/mach-omap2/omap_hwmod.c +18 -0
index 4653efb..f37d22c 100644
@@ -2053,6 +2053,23 @@ static int _omap4_get_context_lost(struct omap_hwmod *oh)
 }
 
 /**
+ * _enable_preprogram - Pre-program an IP block during the _enable() process
+ * @oh: struct omap_hwmod *
+ *
+ * Some IP blocks (such as AESS) require some additional programming
+ * after enable before they can enter idle.  If a function pointer to
+ * do so is present in the hwmod data, then call it and pass along the
+ * return value; otherwise, return 0.
+ */
+static int __init _enable_preprogram(struct omap_hwmod *oh)
+{
+	if (!oh->class->enable_preprogram)
+		return 0;
+
+	return oh->class->enable_preprogram(oh);
+}
+
+/**
  * _enable - enable an omap_hwmod
  * @oh: struct omap_hwmod *
  *
@@ -2156,6 +2173,7 @@ static int _enable(struct omap_hwmod *oh)
 				_update_sysc_cache(oh);
 			_enable_sysc(oh);
 		}
+		r = _enable_preprogram(oh);
 	} else {
 		if (soc_ops.disable_module)
 			soc_ops.disable_module(oh);
arch/arm/mach-omap2/omap_hwmod.h +2 -0
index 3ae852a..41066b4 100644
@@ -501,6 +501,7 @@ struct omap_hwmod_omap4_prcm {
  * @rev: revision of the IP class
  * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown
  * @reset: ptr to fn to be executed in place of the standard hwmod reset fn
+ * @enable_preprogram:  ptr to fn to be executed during device enable
  *
  * Represent the class of a OMAP hardware "modules" (e.g. timer,
  * smartreflex, gpio, uart...)
@@ -524,6 +525,7 @@ struct omap_hwmod_class {
 	u32					rev;
 	int					(*pre_shutdown)(struct omap_hwmod *oh);
 	int					(*reset)(struct omap_hwmod *oh);
+	int					(*enable_preprogram)(struct omap_hwmod *oh);
 };
 
 /**
Signature · 1 line
1.7.10.4