omap: mailbox: hwmod support
Subsystems (4)
v5 cover omap: mailbox: hwmod support
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
Highlights from v5 include the comments received from previous version v4[1].
Benoit Cousson (1):
OMAP4: hwmod data: add mailbox data
Felipe Contreras (2):
OMAP3: hwmod data: add mailbox data
OMAP: mailbox: build device using omap_device/omap_hwmod
Omar Ramirez Luna (1):
OMAP: mailbox: use runtime pm for clk and sysc handling
omar ramirez (1):
OMAP2: hwmod data: add mailbox data
arch/arm/mach-omap2/devices.c | 98 +++++----------------------- arch/arm/mach-omap2/mailbox.c | 67 ++----------------- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 74 +++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 73 +++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 72 ++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 67 +++++++++++++++++++ 6 files changed, 308 insertions(+), 143 deletions(-)
---
[1] http://bit.ly/gfLaIs
PATCH v5 1/5 OMAP2: hwmod data: add mailbox data
From: omar ramirez <[email protected]>
Mailbox hwmod data for omap2430 and 2420.
--- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 74 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 73 +++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +74 -0
@@ -779,6 +779,76 @@ static struct omap_hwmod omap2420_gpio4_hwmod = { .slaves_cnt = ARRAY_SIZE(omap2420_gpio4_slaves), .class = &omap242x_gpio_hwmod_class, .dev_attr = &gpio_dev_attr, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + +/* +* 'mailbox' class +* mailbox module allowing communication between the on-chip processors +* using a queued mailbox-interrupt mechanism. +*/ + +static struct omap_hwmod_class_sysconfig omap2420_mailbox_sysc = { + .rev_offs =0x000 , + .sysc_offs =0x010 , + .syss_offs =0x014 , + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY |SYSC_HAS_SIDLEMODE | +SYSC_HAS_SOFTRESET |SYSC_HAS_AUTOIDLE ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2420_mailbox_hwmod_class = { + .name ="mailbox" , + .sysc = &omap2420_mailbox_sysc, +}; + +/* mailbox */ +static struct omap_hwmod omap2420_mailbox_hwmod; +static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = { + { .name ="dsp" , .irq =26 , }, + { .name ="iva" , .irq =34 , }, +}; + +static struct omap_hwmod_addr_space omap2420_mailbox_addrs[] = { + { + .pa_start =0x48094000 , + .pa_end =0x480941ff , + .flags =ADDR_TYPE_RT , + }, +}; + +/* l4_core -> mailbox */ +static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = { + .master = &omap2420_l4_core_hwmod, + .slave = &omap2420_mailbox_hwmod, + .clk ="mailboxes_ick" , + .addr = omap2420_mailbox_addrs, + .addr_cnt =ARRAY_SIZE (omap2420_mailbox_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* mailbox slave ports */ +static struct omap_hwmod_ocp_if *omap2420_mailbox_slaves[] = { + &omap2420_l4_core__mailbox, +}; + +static struct omap_hwmod omap2420_mailbox_hwmod = { + .name ="mailbox" , + .class = &omap2420_mailbox_hwmod_class, + .mpu_irqs = omap2420_mailbox_irqs, + .mpu_irqs_cnt =ARRAY_SIZE (omap2420_mailbox_irqs), + .prcm = { + .omap2 = { + .prcm_reg_id =1 , + .module_bit =OMAP24XX_EN_MAILBOXES_SHIFT , + .module_offs =CORE_MOD , + .idlest_reg_id =1 , + .idlest_idle_bit =OMAP24XX_ST_MAILBOXES_SHIFT , + }, + }, + .slaves = omap2420_mailbox_slaves, + .slaves_cnt =ARRAY_SIZE (omap2420_mailbox_slaves), .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2420 ), };
@@ -885,6 +955,10 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {/* dma_system class*/ &omap2420_dma_system_hwmod, + +/* mailbox class */ + &omap2420_mailbox_hwmod, + NULL, };
arch/arm/mach-omap2/omap_hwmod_2430_data.c +73 -0
85 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v5 2/5 OMAP3: hwmod data: add mailbox data
In reply to Omar Ramirez LunaFrom: Felipe Contreras <[email protected]>
Mailbox hwmod data for omap3.
--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 72 ++++++++++++++++++++++++++++ 1 files changed, 72 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +72 -0
@@ -1132,6 +1132,74 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = { .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio6_slaves), .class = &omap3xxx_gpio_hwmod_class, .dev_attr = &gpio_dev_attr, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), +}; + +/* +* 'mailbox' class +* mailbox module allowing communication between the on-chip processors +* using a queued mailbox-interrupt mechanism. +*/ + +static struct omap_hwmod_class_sysconfig omap3xxx_mailbox_sysc = { + .rev_offs =0x000 , + .sysc_offs =0x010 , + .syss_offs =0x014 , + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY |SYSC_HAS_SIDLEMODE | +SYSC_HAS_SOFTRESET |SYSC_HAS_AUTOIDLE ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap3xxx_mailbox_hwmod_class = { + .name ="mailbox" , + .sysc = &omap3xxx_mailbox_sysc, +}; + +static struct omap_hwmod omap3xxx_mailbox_hwmod; +static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = { + { .name ="dsp" , .irq =26 , }, +}; + +static struct omap_hwmod_addr_space omap3xxx_mailbox_addrs[] = { + { + .pa_start =0x48094000 , + .pa_end =0x480941ff , + .flags =ADDR_TYPE_RT , + }, +}; + +/* l4_core -> mailbox */ +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mailbox = { + .master = &omap3xxx_l4_core_hwmod, + .slave = &omap3xxx_mailbox_hwmod, + .clk ="mailboxes_ick" , + .addr = omap3xxx_mailbox_addrs, + .addr_cnt =ARRAY_SIZE (omap3xxx_mailbox_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* mailbox slave ports */ +static struct omap_hwmod_ocp_if *omap3xxx_mailbox_slaves[] = { + &omap3xxx_l4_core__mailbox, +}; + +static struct omap_hwmod omap3xxx_mailbox_hwmod = { + .name ="mailbox" , + .class = &omap3xxx_mailbox_hwmod_class, + .mpu_irqs = omap3xxx_mailbox_irqs, + .mpu_irqs_cnt =ARRAY_SIZE (omap3xxx_mailbox_irqs), + .prcm = { + .omap2 = { + .prcm_reg_id =1 , + .module_bit =OMAP3430_EN_MAILBOXES_SHIFT , + .module_offs =CORE_MOD , + .idlest_reg_id =1 , + .idlest_idle_bit =OMAP3430_ST_MAILBOXES_SHIFT , + }, + }, + .slaves = omap3xxx_mailbox_slaves, + .slaves_cnt =ARRAY_SIZE (omap3xxx_mailbox_slaves), .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), };
@@ -1387,6 +1455,10 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {/* dma_system class*/ &omap3xxx_dma_system_hwmod, + +/* mailbox class */ + &omap3xxx_mailbox_hwmod, + NULL, };
Signature · 1 line
1.7.1
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
In reply to Omar Ramirez LunaFrom: Benoit Cousson <[email protected]>
Mailbox hwmod data for omap4.
--- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 67 ++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +67 -0
@@ -2001,6 +2001,70 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* +* 'mailbox' class +* mailbox module allowing communication between the on-chip processors +* using a queued mailbox-interrupt mechanism. +*/ + +static struct omap_hwmod_class_sysconfig omap44xx_mailbox_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .sysc_flags = (SYSC_HAS_RESET_STATUS |SYSC_HAS_SIDLEMODE | +SYSC_HAS_SOFTRESET ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields = &omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap44xx_mailbox_hwmod_class = { + .name ="mailbox" , + .sysc = &omap44xx_mailbox_sysc, +}; + +/* mailbox */ +static struct omap_hwmod omap44xx_mailbox_hwmod; +static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = { + { .name ="mbox" , .irq =26 +OMAP44XX_IRQ_GIC_START , }, +}; + +static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = { + { + .pa_start =0x4a0f4000 , + .pa_end =0x4a0f41ff , + .flags =ADDR_TYPE_RT , + }, +}; + +/* l4_cfg -> mailbox */ +static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = { + .master = &omap44xx_l4_cfg_hwmod, + .slave = &omap44xx_mailbox_hwmod, + .clk ="l4_div_ck" , + .addr = omap44xx_mailbox_addrs, + .addr_cnt =ARRAY_SIZE (omap44xx_mailbox_addrs), + .user =OCP_USER_MPU |OCP_USER_SDMA , +}; + +/* mailbox slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_mailbox_slaves[] = { + &omap44xx_l4_cfg__mailbox, +}; + +static struct omap_hwmod omap44xx_mailbox_hwmod = { + .name ="mailbox" , + .class = &omap44xx_mailbox_hwmod_class, + .mpu_irqs = omap44xx_mailbox_irqs, + .mpu_irqs_cnt =ARRAY_SIZE (omap44xx_mailbox_irqs), + .prcm = { + .omap4 = { + .clkctrl_reg =OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL , + }, + }, + .slaves = omap44xx_mailbox_slaves, + .slaves_cnt =ARRAY_SIZE (omap44xx_mailbox_slaves), + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP4430 ), +}; +static __initdata struct omap_hwmod *omap44xx_hwmods[] = {/* dmm class */
@@ -2068,6 +2132,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { &omap44xx_wd_timer2_hwmod, &omap44xx_wd_timer3_hwmod, +/* mailbox class */ + &omap44xx_mailbox_hwmod, + NULL, };
Signature · 1 line
1.7.1
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Hi Omar,
I found one minor change wrt to the original that I'd like to understand better.
Quoted 32 lines · Omar
From: Benoit Cousson<[email protected]>
Mailbox hwmod data for omap4.
Signed-off-by Benoit Cousson<[email protected]>Signed-off-by Omar Ramirez Luna<[email protected]>--- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 67 ++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-)arch/arm/mach-omap2/omap_hwmod_44xx_data.c +14
-0@@ -2001,6 +2001,70 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), }; +/* +* 'mailbox' class +* mailbox module allowing communication between the on-chip processors +* using a queued mailbox-interrupt mechanism. +*/ + +static struct omap_hwmod_class_sysconfig omap44xx_mailbox_sysc = { + .rev_offs =0x0000 , + .sysc_offs =0x0010 , + .sysc_flags = (SYSC_HAS_RESET_STATUS |SYSC_HAS_SIDLEMODE | +SYSC_HAS_SOFTRESET ), + .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART ), + .sysc_fields =&omap_hwmod_sysc_type2, +};
arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_wd_timer3_hwmod = { · line 2027
Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +10
-0+ +static struct omap_hwmod_class omap44xx_mailbox_hwmod_class = { + .name ="mailbox" , + .sysc =&omap44xx_mailbox_sysc, +}; + +/* mailbox */ +static struct omap_hwmod omap44xx_mailbox_hwmod; +static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = { + { .name ="mbox" , .irq =26 +OMAP44XX_IRQ_GIC_START , },
The original entry was unnamed since it is an unique entry and thus does not need to be differentiate on this platform.
{ .irq = 26 + OMAP44XX_IRQ_GIC_START },Do you really need to have a name here? The strategy being to provide a name only if more than one entry exist.
It is perfectibility doable, I'm just trying to understand your rational.
Thanks,
Benoit
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Hi Benoit,
Quoted 11 lines · Benoit
Quoted 2 lines
+static struct
omap_hwmod_irq_infoomap44xx_mailbox_irqs[] = {
+ ? ? ? { .name = "mbox", .irq = 26 +OMAP44XX_IRQ_GIC_START, },The original entry was unnamed since it is an unique entry and thus does not need to be differentiate on this platform.
? ? ? ?{ .irq = 26 +
OMAP44XX_IRQ_GIC_START},Do you really need to have a name here? The strategy being to provide a name only if more than one entry exist.
It is perfectibility doable, I'm just trying to understand your rational.
It is this way instead of plain platform_get_irq because omap2420 has two interrupt sources to MPU and mailbox driver uses platform_get_irq_byname to get the irq number.
Regards,
Omar
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Hi Omar,
Quoted 11 lines · Omar
Hi Benoit,
Quoted 8 lines · Benoit
arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_wd_timer3_hwmod = { · line 2027
Quoted 2 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2
-0+static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = { + { .name ="mbox" , .irq =26 +OMAP44XX_IRQ_GIC_START , },The original entry was unnamed since it is an unique entry and thus does not need to be differentiate on this platform.
{ .irq = 26 + OMAP44XX_IRQ_GIC_START },
Quoted 7 lines
Quoted 3 lines
Do you really need to have a name here? The strategy being to provide a name only if more than one entry exist.
It is perfectibility doable, I'm just trying to understand your rational.It is this way instead of plain
platform_get_irqbecause omap2420 has two interrupt sources to MPU and mailbox driver usesplatform_get_irq_bynameto get the irq number.
This is what I was thinking, except that on OMAP2420 the names are:
+ { .name = "dsp", .irq = 26, },
+ { .name = "iva", .irq = 34, },
and on OMAP2430 and OMAP3
+ { .name = "dsp", .irq = 26, },
so why is it named "mbox" on OMAP4?
If you have to do several platform_get_irq_byname to get this one, I'd prefer to get rid of that name for OMAP4. It will make mailbox irq consistent with the other hwmods.
Thanks,
Benoit
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Hi,
Quoted 4 lines · Benoit
Quoted 3 lines
It is this way instead of plain
platform_get_irqbecause omap2420 has two interrupt sources to MPU and mailbox driver usesplatform_get_irq_bynameto get the irq number.
Quoted 8 lines
This is what I was thinking, except that on OMAP2420 the names are:
+ ? ? ? { .name = "dsp", .irq = 26, },
+ ? ? ? { .name = "iva", .irq = 34, },and on OMAP2430 and OMAP3
+ ? ? ? { .name = "dsp", .irq = 26, },so why is it named "mbox" on OMAP4?
I'm not very familiar with OMAP4 terminology... but IMHO, I guess naming it dsp, would imply that this is a mailbox for the dsp, when the interrupt can be generated by either the M3, dsp, I think even the IVA can write into it.
Quoted 3 lines
If you have to do several
platform_get_irq_bynameto get this one, I'd prefer to get rid of that name for OMAP4. It will make mailbox irq consistent with the other hwmods.
I was thinking to standardize the names to be mbox0..mboxN across all the platforms, reason being that the mailbox also has capabilities to be used not only by dsp or iva, by using a polling method.
So even if the mailbox in OMAP3 is called "dsp", it has 4 more queues apart from the 2 used for messaging between arm and dsp, that could be used even if tidspbridge wasn't there.
Did I get you correctly?
Regards,
Omar
Tony Lindgren
maintainerPATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Quoted 5 lines · Ramirez Luna, Omar
Quoted 4 lines
If you have to do several
platform_get_irq_bynameto get this one, I'd prefer to get rid of that name for OMAP4. It will make mailbox irq consistent with the other hwmods.
Quoted 7 lines
I was thinking to standardize the names to be mbox0..mboxN across all the platforms, reason being that the mailbox also has capabilities to be used not only by dsp or iva, by using a polling method.
So even if the mailbox in OMAP3 is called "dsp", it has 4 more queues apart from the 2 used for messaging between arm and dsp, that could be used even if tidspbridge wasn't there.
So what's the status of this series? Can the rest of the patches now be applied on top of the current omap-for-linus or do the names still need fixing?
Tony
PATCH v5 3/5 OMAP4: hwmod data: add mailbox data
Hi Tony,
Quoted 10 lines · Tony Lindgren
Quoted 9 lines · Ramirez Luna, Omar
Quoted 4 lines
If you have to do several
platform_get_irq_bynameto get this one, I'd prefer to get rid of that name for OMAP4. It will make mailbox irq consistent with the other hwmods.I was thinking to standardize the names to be mbox0..mboxN across all the platforms, reason being that the mailbox also has capabilities to be used not only by dsp or iva, by using a polling method.
Quoted 7 lines
Quoted 3 lines
So even if the mailbox in OMAP3 is called "dsp", it has 4 more queues apart from the 2 used for messaging between arm and dsp, that could be used even if tidspbridge wasn't there.
So what's the status of this series? Can the rest of the patches now be applied on top of the current omap-for-linus or do the names still need fixing?
I'm going to remove the names for the hwmods with a single irq. And change the interface clock to be the main_clk, so it can be disabled when runtime pm is disabled.
I won't resend the patch for OMAP4 hwmod data, as this was send earlier by Benoit.
Regards,
Omar
PATCH v5 4/5 OMAP: mailbox: build device using omap_device/omap_hwmod
In reply to Omar Ramirez LunaFrom: Felipe Contreras <[email protected]>
Remove static platform_device and resource data within omap mailbox driver; use the one defined in the hwmod database along with omap_device framework for device build and registration.
Add device latency functions to be used, so clock can be enabled and sysconfig is configured.
--- arch/arm/mach-omap2/devices.c | 98 +++++++---------------------------------- 1 files changed, 16 insertions(+), 82 deletions(-)
arch/arm/mach-omap2/devices.c +16 -82
@@ -142,95 +142,29 @@ static inline void omap_init_camera(void)#endif #if defined(CONFIG_OMAP_MBOX_FWK ) || defined(CONFIG_OMAP_MBOX_FWK_MODULE ) - -#define MBOX_REG_SIZE 0x120 - -#ifdef CONFIG_ARCH_OMAP2 -static struct resource omap2_mbox_resources[] = { - { - .start =OMAP24XX_MAILBOX_BASE , - .end =OMAP24XX_MAILBOX_BASE +MBOX_REG_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =INT_24XX_MAIL_U0_MPU , - .flags =IORESOURCE_IRQ , - .name ="dsp" , - }, - { - .start =INT_24XX_MAIL_U3_MPU , - .flags =IORESOURCE_IRQ , - .name ="iva" , - }, -}; -static int omap2_mbox_resources_sz =ARRAY_SIZE (omap2_mbox_resources); -#else -#define omap2_mbox_resources NULL -#define omap2_mbox_resources_sz 0 -#endif - -#ifdef CONFIG_ARCH_OMAP3 -static struct resource omap3_mbox_resources[] = { - { - .start =OMAP34XX_MAILBOX_BASE , - .end =OMAP34XX_MAILBOX_BASE +MBOX_REG_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =INT_24XX_MAIL_U0_MPU , - .flags =IORESOURCE_IRQ , - .name ="dsp" , - }, -}; -static int omap3_mbox_resources_sz =ARRAY_SIZE (omap3_mbox_resources); -#else -#define omap3_mbox_resources NULL -#define omap3_mbox_resources_sz 0 -#endif - -#ifdef CONFIG_ARCH_OMAP4 - -#define OMAP4_MBOX_REG_SIZE 0x130 -static struct resource omap4_mbox_resources[] = { - { - .start =OMAP44XX_MAILBOX_BASE , - .end =OMAP44XX_MAILBOX_BASE + -OMAP4_MBOX_REG_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =OMAP44XX_IRQ_MAIL_U0 , - .flags =IORESOURCE_IRQ , - .name ="mbox" , +static struct omap_device_pm_latency mbox_latencies[] = { + [0 ] = { + .activate_func = omap_device_enable_hwmods, + .deactivate_func = omap_device_idle_hwmods, + .flags =OMAP_DEVICE_LATENCY_AUTO_ADJUST , }, }; -static int omap4_mbox_resources_sz =ARRAY_SIZE (omap4_mbox_resources); -#else -#define omap4_mbox_resources NULL -#define omap4_mbox_resources_sz 0 -#endif - -static struct platform_device mbox_device = { - .name ="omap-mailbox" , - .id =-1 , -};static inline void omap_init_mbox (void ) { -if (cpu_is_omap24xx ()) { - mbox_device.resource = omap2_mbox_resources; - mbox_device.num_resources = omap2_mbox_resources_sz; - }else if (cpu_is_omap34xx ()) { - mbox_device.resource = omap3_mbox_resources; - mbox_device.num_resources = omap3_mbox_resources_sz; - }else if (cpu_is_omap44xx ()) { - mbox_device.resource = omap4_mbox_resources; - mbox_device.num_resources = omap4_mbox_resources_sz; - }else { -pr_err ("%s: platform not supported\n" , __func__); +struct omap_hwmod *oh; +struct omap_device *od; + + oh =omap_hwmod_lookup ("mailbox" ); +if (!oh) { +pr_err ("%s: unable to find hwmod\n" , __func__);return ; } -platform_device_register (&mbox_device); + + od =omap_device_build ("omap-mailbox" ,-1 , oh,NULL ,0 , + mbox_latencies,ARRAY_SIZE (mbox_latencies),0 ); +WARN (IS_ERR (od),"%s: could not build device, err %ld\n" , + __func__,PTR_ERR (od)); }#else static inline void omap_init_mbox (void ) { }
Signature · 1 line
1.7.1
PATCH v5 5/5 OMAP: mailbox: use runtime pm for clk and sysc handling
In reply to Omar Ramirez LunaUse runtime pm APIs to enable/disable mailbox clocks and to configure SYSC register.
Based on the patch sent by Felipe Contreras:
https://patchwork.kernel.org/patch/101662/
--- arch/arm/mach-omap2/mailbox.c | 67 ++++------------------------------------- 1 files changed, 6 insertions(+), 61 deletions(-)
arch/arm/mach-omap2/mailbox.c +5 -60
@@ -14,12 +14,11 @@#include <linux/err.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/pm_runtime.h> #include <plat/mailbox.h> #include <mach/irqs.h> #define MAILBOX_REVISION 0x000 -#define MAILBOX_SYSCONFIG 0x010 -#define MAILBOX_SYSSTATUS 0x014#define MAILBOX_MESSAGE (m) (0x040 + 4 * (m))#define MAILBOX_FIFOSTATUS (m) (0x080 + 4 * (m))#define MAILBOX_MSGSTATUS (m) (0x0c0 + 4 * (m))
@@ -33,17 +32,6 @@#define MAILBOX_IRQ_NEWMSG (m) (1 << (2 * (m)))#define MAILBOX_IRQ_NOTFULL (m) (1 << (2 * (m) + 1)) -/* SYSCONFIG: register bit definition */ -#define AUTOIDLE (1 << 0) -#define SOFTRESET (1 << 1) -#define SMARTIDLE (2 << 3) -#define OMAP4_SOFTRESET (1 << 0) -#define OMAP4_NOIDLE (1 << 2) -#define OMAP4_SMARTIDLE (2 << 2) - -/* SYSSTATUS: register bit definition */ -#define RESETDONE (1 << 0) -#define MBOX_REG_SIZE 0x120#define OMAP4_MBOX_REG_SIZE 0x130
@@ -70,8 +58,6 @@ struct omap_mbox2_priv {unsigned long irqdisable; }; -static struct clk *mbox_ick_handle; -static void omap2_mbox_enable_irq (struct omap_mbox *mbox,omap_mbox_type_t irq);
@@ -89,53 +75,13 @@ static inline void mbox_write_reg(u32 val, size_t ofs)static int omap2_mbox_startup (struct omap_mbox *mbox) {u32 l; -unsigned long timeout; - mbox_ick_handle =clk_get (NULL ,"mailboxes_ick" ); -if (IS_ERR (mbox_ick_handle)) { -printk (KERN_ERR "Could not get mailboxes_ick: %ld\n" , -PTR_ERR (mbox_ick_handle)); -return PTR_ERR (mbox_ick_handle); - } -clk_enable (mbox_ick_handle); - -if (cpu_is_omap44xx ()) { -mbox_write_reg (OMAP4_SOFTRESET ,MAILBOX_SYSCONFIG ); - timeout = jiffies +msecs_to_jiffies (20 ); -do { - l =mbox_read_reg (MAILBOX_SYSCONFIG ); -if (!(l &OMAP4_SOFTRESET )) -break ; - }while (!time_after (jiffies, timeout)); - -if (l &OMAP4_SOFTRESET ) { -pr_err ("Can't take mailbox out of reset\n" ); -return -ENODEV ; - } - }else { -mbox_write_reg (SOFTRESET ,MAILBOX_SYSCONFIG ); - timeout = jiffies +msecs_to_jiffies (20 ); -do { - l =mbox_read_reg (MAILBOX_SYSSTATUS ); -if (l &RESETDONE ) -break ; - }while (!time_after (jiffies, timeout)); - -if (!(l &RESETDONE )) { -pr_err ("Can't take mailbox out of reset\n" ); -return -ENODEV ; - } - } +pm_runtime_enable (mbox->dev->parent); +pm_runtime_get_sync (mbox->dev->parent); l =mbox_read_reg (MAILBOX_REVISION );pr_debug ("omap mailbox rev %d.%d\n" , (l &0xf0 ) >>4 , (l &0x0f )); -if (cpu_is_omap44xx ()) - l =OMAP4_SMARTIDLE ; -else - l =SMARTIDLE |AUTOIDLE ; -mbox_write_reg (l,MAILBOX_SYSCONFIG ); -omap2_mbox_enable_irq (mbox,IRQ_RX );return 0 ;
@@ -143,9 +89,8 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)static void omap2_mbox_shutdown (struct omap_mbox *mbox) { -clk_disable (mbox_ick_handle); -clk_put (mbox_ick_handle); - mbox_ick_handle =NULL ; +pm_runtime_put_sync (mbox->dev->parent); +pm_runtime_disable (mbox->dev->parent); }/* Mailbox FIFO handle functions */
Signature · 1 line
1.7.1
v5 cover omap: mailbox: hwmod support
In reply to Omar Ramirez LunaQuoted 6 lines · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
But still needs sanity testing on OMAP2.
Kevin
Quoted 30 lines
Highlights from v5 include the comments received from previous version v4[1].
Benoit Cousson (1):
OMAP4: hwmod data: add mailbox dataFelipe Contreras (2):
OMAP3: hwmod data: add mailbox data
OMAP: mailbox: build device using omap_device/omap_hwmodOmar Ramirez Luna (1):
OMAP: mailbox: use runtime pm for clk and sysc handlingomar ramirez (1):
OMAP2: hwmod data: add mailbox dataarch/arm/mach-omap2/devices.c | 98 +++++----------------------- arch/arm/mach-omap2/mailbox.c | 67 ++----------------- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 74 +++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 73 +++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 72 ++++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 67 +++++++++++++++++++ 6 files changed, 308 insertions(+), 143 deletions(-)---
[1] http://bit.ly/gfLaIs
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerv5 cover omap: mailbox: hwmod support
In reply to Omar Ramirez LunaQuoted 1 line · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
Hiroshi, any comments on these?
Regards,
Tony
v5 cover omap: mailbox: hwmod support
From: ext Tony Lindgren <[email protected]>
Subject: Re: [PATCH v5 0/5] omap: mailbox: hwmod support
Date: Wed, 9 Feb 2011 10:32:19 -0800
Quoted 4 lines · Omar Ramirez Luna
Quoted 1 line
Mailbox hwmod support for OMAP 2,3,4.
Hiroshi, any comments on these?
Well, I haven't followed hwmod much. If Kevin is ok, ok for me.
v5 cover omap: mailbox: hwmod support
Hi Hiroshi,
Quoted 10 lines · Hiroshi DOYU
From: ext Tony Lindgren <[email protected]>
Subject: Re: [PATCH v5 0/5] omap: mailbox: hwmod support
Date: Wed, 9 Feb 2011 10:32:19 -0800Quoted 4 lines · Omar Ramirez Luna
Quoted 1 line
Mailbox hwmod support for OMAP 2,3,4.
Hiroshi, any comments on these?
Well, I haven't followed hwmod much. If Kevin is ok, ok for me.
Do you have any simple standalone tests for mailbox (e.g. without bridge/syslink) that can be used to so some sanity checking on these driver changes?
Thanks,
Kevin
v5 cover omap: mailbox: hwmod support
In reply to Omar Ramirez LunaQuoted 23 lines · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
Highlights from v5 include the comments received from previous version v4[1].
Benoit Cousson (1):
?OMAP4: hwmod data: add mailbox dataFelipe Contreras (2):
?OMAP3: hwmod data: add mailbox data
?OMAP: mailbox: build device using omap_device/omap_hwmodOmar Ramirez Luna (1):
?OMAP: mailbox: use runtime pm for clk and sysc handlingomar ramirez (1):
?OMAP2: hwmod data: add mailbox data
Quoted 7 lines
?arch/arm/mach-omap2/devices.c ? ? ? ? ? ? ?| ? 98 +++++----------------------- ?arch/arm/mach-omap2/mailbox.c ? ? ? ? ? ? ?| ? 67 ++----------------- ?arch/arm/mach-omap2/omap_hwmod_2420_data.c | ? 74 +++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_2430_data.c | ? 73 +++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | ? 72 ++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_44xx_data.c | ? 67 +++++++++++++++++++?6 files changed, 308 insertions(+), 143 deletions(-)
Boot tested mainline v2.6.38-rc4 along with this 5 patch series on Omap 2420,2430 SDPs.
v5 cover omap: mailbox: hwmod support
Quoted 32 lines · Sourav
Quoted 23 lines · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
Highlights from v5 include the comments received from previous version v4[1].
Benoit Cousson (1):
?OMAP4: hwmod data: add mailbox dataFelipe Contreras (2):
?OMAP3: hwmod data: add mailbox data
?OMAP: mailbox: build device using omap_device/omap_hwmodOmar Ramirez Luna (1):
?OMAP: mailbox: use runtime pm for clk and sysc handlingomar ramirez (1):
?OMAP2: hwmod data: add mailbox dataQuoted 7 lines
?arch/arm/mach-omap2/devices.c ? ? ? ? ? ? ?| ? 98 +++++----------------------- ?arch/arm/mach-omap2/mailbox.c ? ? ? ? ? ? ?| ? 67 ++----------------- ?arch/arm/mach-omap2/omap_hwmod_2420_data.c | ? 74 +++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_2430_data.c | ? 73 +++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | ? 72 ++++++++++++++++++++ ?arch/arm/mach-omap2/omap_hwmod_44xx_data.c | ? 67 +++++++++++++++++++?6 files changed, 308 insertions(+), 143 deletions(-)
Quoted 4 lines
Boot tested mainline v2.6.38-rc4 along with this 5 patch series on Omap 2420,2430 SDPs.
Tested-by Sourav Poddar<[email protected]>
Boot testing is a start, but I'm pretty sure that bootup does not use the mailbox on any of these platforms. This needs to be tested with something that actually uses the mailbox.
Kevin
v5 cover omap: mailbox: hwmod support
In reply to Omar Ramirez LunaQuoted 6 lines · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
To help in testing, I wrote a simple mailbox loopback test module for OMAP2/3/4 that I used to do send and receive messages on the MPU. This can be used to test the mailbox without any DSP software.
I tested it against l-o master branch and found a couple bugs in the mailbox driver (patches posted earlier today.)
With those patches plus my test I can send & receieve a series of messages on the MPU, which is enough to sanity test the basic sending and receiving messages on the MPU.
I've tested the master branch, now it's your turn to use this test module to validate this hmod conversion series.
The test module is available here:
git://gitorious.org/omap-test/mailbox.git
Note that the current mailbox driver has hard-coded settings for the receiver of messages. While this should be configurable at runtime, I'm not an expert on the mailbox IP so my test module includes a kernel patch that changes these hard-coded settings of the first mbox (dsp on OMAP2/3, mailbox-1 on OMAP4) so that my loopback tester will work.
Kevin
v5 cover omap: mailbox: hwmod support
Hi Kevin, Benoit,
Quoted 20 lines · Kevin Hilman
Quoted 6 lines · Omar Ramirez Luna
Mailbox hwmod support for OMAP 2,3,4.
This was tested on OMAP3 (3430, 3630), minor testing was made on OMAP4.
No testing on OMAP2 since I don't have the hardware.
To help in testing, I wrote a simple mailbox loopback test module for OMAP2/3/4 that I used to do send and receive messages on the MPU. ?This can be used to test the mailbox without any DSP software.
I tested it against l-o master branch and found a couple bugs in the mailbox driver (patches posted earlier today.)
With those patches plus my test I can send & receieve a series of messages on the MPU, which is enough to sanity test the basic sending and receiving messages on the MPU.
Quoted 6 lines
I've tested the master branch, now it's your turn to use this test module to validate this hmod conversion series.
The test module is available here:
? ?git://gitorious.org/omap-test/mailbox.git
I rechecked on OMAP3 (zoom2, zoom3) and OMAP4 (blaze), and functionality hasn't changed with the hwmod support + Kevin's mbox test.
On OMAP3, although functionality is ok with this patch set, I noticed that the interface clock is not being disabled with its corresponding pm_runtime_disable call. Previously, the driver enabled/disabled the ick clock on demand, but now the clock stays enabled always (only affected by the smart-idle feature, I presume).
Should this clock be placed in the main_clk field of omap_hwmod struct instead of omap_hwmod_ocp_if, I moved it to ocp_if because of the ick thing, any comment?
Regards,
Omar