* [PATCH 1/3] OMAP2+: control: new APIs to configure boot address and mode
2012-05-03 2:11 [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
@ 2012-05-03 2:11 ` Omar Ramirez Luna
2012-05-03 2:11 ` [PATCH 2/3] OMAP: dsp: interface to control module functions Omar Ramirez Luna
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2012-05-03 2:11 UTC (permalink / raw)
To: linux-arm-kernel
SCM contains boot addr and boot mode registers to control
other processors on different OMAP versions. It controls the
boot address and mode for DSP based subsystems like: IVA 2.1
(OMAP2430), IVA 2.2 (OMAP3) and DSP (OMAP4).
If contained within SCM registers, when a processor is
booting it uses BOOTADDR to start running the code at that
location. BOOTMOD register specifies a different set of
modes for the processor to execute when booting (from direct,
idle, self-loop, user and default).
Since there was no offset associated with OMAP4, this patch
defines it.
Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
---
arch/arm/mach-omap2/control.c | 43 ++++++++++++++++++++
arch/arm/mach-omap2/control.h | 2 +
.../include/mach/ctrl_module_core_44xx.h | 1 +
3 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 08e674b..3223b81 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -241,6 +241,49 @@ void omap3_ctrl_write_boot_mode(u8 bootmode)
#endif
+/**
+ * omap_ctrl_write_dsp_boot_addr - set boot address for a remote processor
+ * @bootaddr: physical address of the boot loader
+ *
+ * Set boot address for the boot loader of a supported processor
+ * when a power ON sequence occurs.
+ */
+void omap_ctrl_write_dsp_boot_addr(u32 bootaddr)
+{
+ u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTADDR :
+ cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTADDR :
+ cpu_is_omap44xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR :
+ 0;
+
+ if (!offset) {
+ pr_err("%s: unsupported omap type\n", __func__);
+ return;
+ }
+
+ omap_ctrl_writel(bootaddr, offset);
+}
+
+/**
+ * omap_ctrl_write_dsp_boot_mode - set boot mode for a remote processor
+ * @bootmode: 8-bit value to pass to some boot code
+ *
+ * Sets boot mode for the boot loader of a supported processor
+ * when a power ON sequence occurs.
+ */
+void omap_ctrl_write_dsp_boot_mode(u8 bootmode)
+{
+ u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTMOD :
+ cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTMOD :
+ 0;
+
+ if (!offset) {
+ pr_err("%s: unsupported omap type\n", __func__);
+ return;
+ }
+
+ omap_ctrl_writel(bootmode, offset);
+}
+
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
/*
* Clears the scratchpad contents in case of cold boot-
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a406fd0..fcc98f8 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -397,6 +397,8 @@ extern u32 omap3_arm_context[128];
extern void omap3_control_save_context(void);
extern void omap3_control_restore_context(void);
extern void omap3_ctrl_write_boot_mode(u8 bootmode);
+extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
+extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
extern void omap3630_ctrl_disable_rta(void);
extern int omap3_ctrl_save_padconf(void);
#else
diff --git a/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h b/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
index 2f7ac70..0197082 100644
--- a/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
+++ b/arch/arm/mach-omap2/include/mach/ctrl_module_core_44xx.h
@@ -42,6 +42,7 @@
#define OMAP4_CTRL_MODULE_CORE_STD_FUSE_OPP_DPLL_1 0x0268
#define OMAP4_CTRL_MODULE_CORE_STATUS 0x02c4
#define OMAP4_CTRL_MODULE_CORE_DEV_CONF 0x0300
+#define OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR 0x0304
#define OMAP4_CTRL_MODULE_CORE_LDOVBB_IVA_VOLTAGE_CTRL 0x0314
#define OMAP4_CTRL_MODULE_CORE_LDOVBB_MPU_VOLTAGE_CTRL 0x0318
#define OMAP4_CTRL_MODULE_CORE_LDOSRAM_IVA_VOLTAGE_CTRL 0x0320
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] OMAP: dsp: interface to control module functions
2012-05-03 2:11 [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
2012-05-03 2:11 ` [PATCH 1/3] OMAP2+: control: new APIs to configure boot address and mode Omar Ramirez Luna
@ 2012-05-03 2:11 ` Omar Ramirez Luna
2012-05-03 2:11 ` [PATCH 3/3] staging: tidspbridge: use scm functions to set boot address and mode Omar Ramirez Luna
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2012-05-03 2:11 UTC (permalink / raw)
To: linux-arm-kernel
Provide an interface for a driver to call SCM functions to
set a boot address and boot mode.
Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
---
arch/arm/mach-omap2/dsp.c | 4 ++++
arch/arm/plat-omap/include/plat/dsp.h | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 74f18f2..6d37d3c 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
+#include "control.h"
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#ifdef CONFIG_BRIDGE_DVFS
@@ -45,6 +46,9 @@ static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
.dsp_cm_read = omap2_cm_read_mod_reg,
.dsp_cm_write = omap2_cm_write_mod_reg,
.dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
+
+ .set_bootaddr = omap_ctrl_write_dsp_boot_addr,
+ .set_bootmode = omap_ctrl_write_dsp_boot_mode,
};
static int __init omap_dsp_init(void)
diff --git a/arch/arm/plat-omap/include/plat/dsp.h b/arch/arm/plat-omap/include/plat/dsp.h
index 9c604b3..5927709 100644
--- a/arch/arm/plat-omap/include/plat/dsp.h
+++ b/arch/arm/plat-omap/include/plat/dsp.h
@@ -18,6 +18,9 @@ struct omap_dsp_platform_data {
u32 (*dsp_cm_read)(s16 , u16);
u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
+ void (*set_bootaddr)(u32);
+ void (*set_bootmode)(u8);
+
phys_addr_t phys_mempool_base;
phys_addr_t phys_mempool_size;
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] staging: tidspbridge: use scm functions to set boot address and mode
2012-05-03 2:11 [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
2012-05-03 2:11 ` [PATCH 1/3] OMAP2+: control: new APIs to configure boot address and mode Omar Ramirez Luna
2012-05-03 2:11 ` [PATCH 2/3] OMAP: dsp: interface to control module functions Omar Ramirez Luna
@ 2012-05-03 2:11 ` Omar Ramirez Luna
2012-05-16 2:20 ` [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
2012-05-18 22:50 ` Paul Walmsley
4 siblings, 0 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2012-05-03 2:11 UTC (permalink / raw)
To: linux-arm-kernel
Instead of ioremapping SCM registers, use the correspondent layer
to write into them.
This allows us to get rid of a layer violation, since the registers
are no longer touched by driver code.
Signed-off-by: Omar Ramirez Luna <omar.luna@linaro.org>
---
drivers/staging/tidspbridge/core/tiomap3430.c | 32 +++++-------------------
1 files changed, 7 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index 9cf29fc..40b35ca 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -70,14 +70,9 @@
#define PAGES_II_LVL_TABLE 512
#define PHYS_TO_PAGE(phys) pfn_to_page((phys) >> PAGE_SHIFT)
-/*
- * This is a totally ugly layer violation, but needed until
- * omap_ctrl_set_dsp_boot*() are provided.
- */
-#define OMAP3_IVA2_BOOTMOD_IDLE 1
-#define OMAP2_CONTROL_GENERAL 0x270
-#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
-#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
+/* IVA Boot modes */
+#define DIRECT 0
+#define IDLE 1
/* Forward Declarations: */
static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt);
@@ -414,27 +409,14 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
/* Assert RST1 i.e only the RST only for DSP megacell */
if (!status) {
- /*
- * XXX: ioremapping MUST be removed once ctrl
- * function is made available.
- */
- void __iomem *ctrl = ioremap(OMAP343X_CTRL_BASE, SZ_4K);
- if (!ctrl)
- return -ENOMEM;
-
(*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK,
OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD,
OMAP2_RM_RSTCTRL);
- /* Mask address with 1K for compatibility */
- __raw_writel(dsp_addr & OMAP3_IVA2_BOOTADDR_MASK,
- ctrl + OMAP343X_CONTROL_IVA2_BOOTADDR);
- /*
- * Set bootmode to self loop if dsp_debug flag is true
- */
- __raw_writel((dsp_debug) ? OMAP3_IVA2_BOOTMOD_IDLE : 0,
- ctrl + OMAP343X_CONTROL_IVA2_BOOTMOD);
- iounmap(ctrl);
+ /* Mask address with 1K for compatibility */
+ pdata->set_bootaddr(dsp_addr &
+ OMAP3_IVA2_BOOTADDR_MASK);
+ pdata->set_bootmode(dsp_debug ? IDLE : DIRECT);
}
}
if (!status) {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs
2012-05-03 2:11 [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
` (2 preceding siblings ...)
2012-05-03 2:11 ` [PATCH 3/3] staging: tidspbridge: use scm functions to set boot address and mode Omar Ramirez Luna
@ 2012-05-16 2:20 ` Omar Ramirez Luna
2012-05-18 22:50 ` Paul Walmsley
4 siblings, 0 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2012-05-16 2:20 UTC (permalink / raw)
To: linux-arm-kernel
On 2 May 2012 21:11, Omar Ramirez Luna <omar.luna@linaro.org> wrote:
> Recently a patch went in for tidspbridge code, to ioremap
> SCM registers and solve a build break[1]. However it has
> been pointed out before that this is a layer violation
> given that control module should handle its own registers, this
> series is an attempt to create APIs for the users of these
> registers.
>
> With some adaptations this patch might also make use of it:
> http://www.mail-archive.com/linux-omap at vger.kernel.org/msg66491.html
>
> Patch: staging: tidspbridge: use scm functions to set boot address and mode,
> will be sent separately to staging tree.
>
> Tested on OMAP3 Beagleboard.
>
> [1] http://www.mail-archive.com/devel at linuxdriverproject.org/msg18762.html
>
> Omar Ramirez Luna (3):
> ?OMAP2+: control: new APIs to configure boot address and mode
> ?OMAP: dsp: interface to control module functions
> ?staging: tidspbridge: use scm functions to set boot address and mode
Ping.
It seems that I unconsciously copied the previous concept, recently I
dug this thread to explain the reasoning of these patches:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg38015.html
These were provided by Paul, one of them acked by Kevin, somehow they
were not included and I forgot about them.
My set also includes OMAP4 check, which I heard recently was tested
with the dsp on pandaboard. If needed I can go back to Paul's version
and re-spin them, with minor changes. Please let me know.
Regards,
Omar
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs
2012-05-03 2:11 [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
` (3 preceding siblings ...)
2012-05-16 2:20 ` [PATCH 0/3] OMAP: control: bootaddr and bootmod APIs Omar Ramirez Luna
@ 2012-05-18 22:50 ` Paul Walmsley
4 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2012-05-18 22:50 UTC (permalink / raw)
To: linux-arm-kernel
Hello Omar,
On Wed, 2 May 2012, Omar Ramirez Luna wrote:
> Recently a patch went in for tidspbridge code, to ioremap
> SCM registers and solve a build break[1]. However it has
> been pointed out before that this is a layer violation
> given that control module should handle its own registers, this
> series is an attempt to create APIs for the users of these
> registers.
>
> With some adaptations this patch might also make use of it:
> http://www.mail-archive.com/linux-omap at vger.kernel.org/msg66491.html
>
> Patch: staging: tidspbridge: use scm functions to set boot address and mode,
> will be sent separately to staging tree.
>
> Tested on OMAP3 Beagleboard.
>
> [1] http://www.mail-archive.com/devel at linuxdriverproject.org/msg18762.html
>
> Omar Ramirez Luna (3):
> OMAP2+: control: new APIs to configure boot address and mode
> OMAP: dsp: interface to control module functions
> staging: tidspbridge: use scm functions to set boot address and mode
Thanks, queued for 3.6.
- Paul
^ permalink raw reply [flat|nested] 6+ messages in thread