Skip to contentSkip to conversation

omap: mailbox: hwmod support and dependent cleanup patches

PATCH Superseded Omar Ramirez Luna 3 participants 25 messages Nov 6, 2010 – Nov 8, 2010

Subsystems (4)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover omap: mailbox: hwmod support and dependent cleanup patches

hwmod support for omap2 and omap3 chips, plus cleanups.

Tested on 3430 and 3630

** v2 **
- Added omap4 hwmod support.
- Moved "mailbox_ick" from hwmod to hwmod_if (omap 2/3)
- Declared sysc classes for omap 2/3

** v1 **
1. omap: mailbox: initial hwmod support for omap3 Changes were made to:
- Rebase to latest code.
- Detect the hwmod by filling prcm union for omap2, without this it was unable to build the hwmod at runtime.
- Replace magic number for defines.
- Use ioremap again instead of relying on the one made by hwmod, as noted in http://patchwork.kernel.org/patch/101661/

2. omap: mailbox: initial hwmod support for omap2
Was only compiled tested!! Unfortunately I don't have the HW for it.

4. omap: mailbox: fix detection for previously supported chips Original patch was using features framework, but when compiled as a module it was breaking, this patch uses cpu_is_omap34xx macro instead. This is meant as a short term solution until proper cleanup is done, as suggested in:

http://marc.info/?l=linux-arm-kernel&m=128534253231481&w=2

Benoit Cousson (1):
OMAP4: hwmod data: add mailbox data

Felipe Contreras (3):
OMAP3: hwmod data: add mailbox data
omap: mailbox: initial hwmod support
omap: mailbox: add omap_device latency information

Omar Ramirez Luna (3):
OMAP2: hwmod data: add mailbox data
omap: mailbox: fix detection for previously supported chips
omap: mailbox: remove unreachable return

 arch/arm/mach-omap2/devices.c              |  104 +++++++---------------------
 arch/arm/mach-omap2/mailbox.c              |   39 +++++-----
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   67 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   66 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   66 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   63 +++++++++++++++++
 arch/arm/plat-omap/include/plat/mailbox.h  |    6 ++
 7 files changed, 311 insertions(+), 100 deletions(-)
#1 lore raw

PATCH v2 1/7 OMAP2: hwmod data: add mailbox data

hwmod data for omap2430 and 2420.

---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |   67 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |   66 +++++++++++++++++++++++++++
 2 files changed, 133 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +67 -0
index a1a3dd6..76ad991 100644
@@ -557,6 +557,72 @@ static struct omap_hwmod omap2420_i2c2_hwmod = {
 	.flags		= HWMOD_16BIT_REG,
 };
 
+/* mailbox */
+
+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,
+};
+
+static struct omap_hwmod omap2420_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap2420_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP24XX_MAILBOX_BASE,
+		.pa_end		= OMAP24XX_MAILBOX_BASE + SZ_4K - 1,
+		.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,
+	.addr		= omap2420_mailbox_addrs,
+	.clk		= "mailboxes_ick",
+	.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_irq_info omap2420_mailbox_irqs[] = {
+	{ .name = "dsp", .irq = INT_24XX_MAIL_U0_MPU, },
+	{ .name = "iva", .irq = INT_24XX_MAIL_U3_MPU, },
+};
+
+static struct omap_hwmod omap2420_mailbox_hwmod = {
+	.name		= "mailbox",
+	.class		= &omap2420_mailbox_hwmod_class,
+	.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,
+		},
+	},
+	.mpu_irqs	= omap2420_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap2420_mailbox_irqs),
+	.slaves		= omap2420_mailbox_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_mailbox_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
 	&omap2420_l3_main_hwmod,
 	&omap2420_l4_core_hwmod,
@@ -569,6 +635,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
 	&omap2420_uart3_hwmod,
 	&omap2420_i2c1_hwmod,
 	&omap2420_i2c2_hwmod,
+	&omap2420_mailbox_hwmod,
 	NULL,
 };
 
arch/arm/mach-omap2/omap_hwmod_2430_data.c +66 -0

78 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 1/7 OMAP2: hwmod data: add mailbox data

Hi Omar,

Quoted 39 lines · Omar

hwmod data for omap2430 and 2420.

---
  arch/arm/mach-omap2/omap_hwmod_2420_data.c |   67 ++++++++++++++++++++++++++++
  arch/arm/mach-omap2/omap_hwmod_2430_data.c |   66 +++++++++++++++++++++++++++
  2 files changed, 133 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +23 -0
index a1a3dd6..76ad991 100644
@@ -557,6 +557,72 @@ static struct omap_hwmod omap2420_i2c2_hwmod = {
  	.flags		= HWMOD_16BIT_REG,
  };
 
+/* mailbox */
+
+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,
+};
+
+static struct omap_hwmod omap2420_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap2420_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP24XX_MAILBOX_BASE,
+		.pa_end		= OMAP24XX_MAILBOX_BASE + SZ_4K - 1,

arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_i2c2_hwmod = { · line 592

Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +10 -0
+		.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,
+	.addr		= omap2420_mailbox_addrs,
+	.clk		= "mailboxes_ick",

Could you try to be consistent with the omap4 format? it is easier to diff between Soc version: .clk is before .addr.

Quoted 16 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +16 -0
+	.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_irq_info omap2420_mailbox_irqs[] = {
+	{ .name = "dsp", .irq = INT_24XX_MAIL_U0_MPU, },
+	{ .name = "iva", .irq = INT_24XX_MAIL_U3_MPU, },
+};
+
+static struct omap_hwmod omap2420_mailbox_hwmod = {
+	.name		= "mailbox",

arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_i2c2_hwmod = { · line 618

Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +10 -0
+	.class		=&omap2420_mailbox_hwmod_class,
+	.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,
+		},
+	},

Same things with the format, put that after irqs_cnt and before slaves.

Quoted 11 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +7 -0
+	.mpu_irqs	= omap2420_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap2420_mailbox_irqs),
+	.slaves		= omap2420_mailbox_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_mailbox_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
  static __initdata struct omap_hwmod *omap2420_hwmods[] = {
  	&omap2420_l3_main_hwmod,
  	&omap2420_l4_core_hwmod,

arch/arm/mach-omap2/omap_hwmod_2420_data.c static __initdata struct omap_hwmod *omap2420_hwmods[] = { · line 637

Quoted 3 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +0 -0
@@ -569,6 +635,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = {
  	&omap2420_uart3_hwmod,
  	&omap2420_i2c1_hwmod,
  	&omap2420_i2c2_hwmod,

Add a blank line between each class. OK it was not done for i2c, but it should.

All the comments are applicable to the 2430 and 3430 data as well.

Thanks,
Benoit

Quoted 88 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +1 -0
+	&omap2420_mailbox_hwmod,
  	NULL,
  };
 
arch/arm/mach-omap2/omap_hwmod_2430_data.c +66 -0
index 7cf0d3a..991bd5b 100644
@@ -569,6 +569,71 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
  	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
  };
 
+/* mailbox */
+
+static struct omap_hwmod_class_sysconfig omap2430_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 omap2430_mailbox_hwmod_class = {
+	.name = "mailbox",
+	.sysc =&omap2430_mailbox_sysc,
+};
+
+static struct omap_hwmod omap2430_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap2430_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP24XX_MAILBOX_BASE,
+		.pa_end		= OMAP24XX_MAILBOX_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+/* l4_core ->  mailbox */
+static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = {
+	.master		=&omap2430_l4_core_hwmod,
+	.slave		=&omap2430_mailbox_hwmod,
+	.addr		= omap2430_mailbox_addrs,
+	.clk		= "mailboxes_ick",
+	.addr_cnt	= ARRAY_SIZE(omap2430_mailbox_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* mailbox slave ports */
+static struct omap_hwmod_ocp_if *omap2430_mailbox_slaves[] = {
+	&omap2430_l4_core__mailbox,
+};
+
+static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
+	{ .name = "dsp", .irq = INT_24XX_MAIL_U0_MPU, },
+};
+
+static struct omap_hwmod omap2430_mailbox_hwmod = {
+	.name		= "mailbox",
+	.class		=&omap2430_mailbox_hwmod_class,
+	.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,
+		},
+	},
+	.mpu_irqs	= omap2430_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap2430_mailbox_irqs),
+	.slaves		= omap2430_mailbox_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_mailbox_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
  static __initdata struct omap_hwmod *omap2430_hwmods[] = {
  	&omap2430_l3_main_hwmod,
  	&omap2430_l4_core_hwmod,
@@ -581,6 +646,7 @@ static __initdata struct omap_hwmod *omap2430_hwmods[] = {
  	&omap2430_uart3_hwmod,
  	&omap2430_i2c1_hwmod,
  	&omap2430_i2c2_hwmod,
+	&omap2430_mailbox_hwmod,
  	NULL,
  };
 
#3 lore raw

PATCH v2 1/7 OMAP2: hwmod data: add mailbox data

Hi Benoit,

Quoted 9 lines · Benoit

Review

Quoted 6 lines
(quoted diff) +6 -0
+/* l4_core -> ?mailbox */
+static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = {
+ ? ? ? .master ? ? ? ? =&omap2420_l4_core_hwmod,
+ ? ? ? .slave ? ? ? ? ?=&omap2420_mailbox_hwmod,
+ ? ? ? .addr ? ? ? ? ? = omap2420_mailbox_addrs,
+ ? ? ? .clk ? ? ? ? ? ?= "mailboxes_ick",

Could you try to be consistent with the omap4 format? it is easier to diff between Soc version: .clk is before .addr

In all the randomness of how the data files look, I didn't now omap4 was the standard. For this one, I tried to follow the "omap_hwmod_ocp_if" structure definition where 'clk' is the 4th member of that structure.

I'll change it to mimic omap4 looks...

Quoted 13 lines
Quoted 4 lines

+static struct omap_hwmod omap2420_mailbox_hwmod = {
+ ? ? ? .name ? ? ? ? ? = "mailbox",
+ ? ? ? .class ? ? ? ? ?=&omap2420_mailbox_hwmod_class,
+ ? ? ? .prcm ? ? ? ? ? = {

Quoted 8 lines

+ ? ? ? ? ? ? ? .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,
+ ? ? ? ? ? ? ? },
+ ? ? ? },

Quoted 1 line

Same things with the format, put that after irqs_cnt and before slaves.

more or less the same, since 'prcm' was above in the definition order I kept it a bit up of where it is supposed to be.

I'll change it too

Quoted 10 lines

Review static __initdata struct omap_hwmod *omap2420_hwmods[] · line 638

Quoted 5 lines
(quoted diff) +0 -0
@@ -569,6 +635,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[]
 = {
 ? ? ? ?&omap2420_uart3_hwmod,
 ? ? ? ?&omap2420_i2c1_hwmod,
 ? ? ? ?&omap2420_i2c2_hwmod,

Add a blank line between each class. OK it was not done for i2c, but it should.

All the comments are applicable to the 2430 and 3430 data as well.

Will do.

Thanks for your comments,

Omar

#4 lore raw

PATCH v2 2/7 OMAP3: hwmod data: add mailbox data

In reply to Omar Ramirez Luna

From: Felipe Contreras <[email protected]>

hwmod data for omap3 mailbox.

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   66 ++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +66 -0
index ed6bf4a..60d977e 100644
@@ -736,6 +736,71 @@ static struct omap_hwmod omap3xxx_i2c3_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
+/* mailbox */
+
+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_addr_space omap3xxx_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_MAILBOX_BASE,
+		.pa_end		= OMAP34XX_MAILBOX_BASE + SZ_4K - 1,
+		.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,
+	.addr		= omap3xxx_mailbox_addrs,
+	.clk		= "mailboxes_ick",
+	.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_irq_info omap3xxx_mailbox_irqs[] = {
+	{ .name = "dsp", .irq = INT_24XX_MAIL_U0_MPU, },
+};
+
+static struct omap_hwmod omap3xxx_mailbox_hwmod = {
+	.name		= "mailbox",
+	.class		= &omap3xxx_mailbox_hwmod_class,
+	.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,
+		},
+	},
+	.mpu_irqs	= omap3xxx_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_mailbox_irqs),
+	.slaves		= omap3xxx_mailbox_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_mailbox_slaves),
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l3_main_hwmod,
 	&omap3xxx_l4_core_hwmod,
@@ -751,6 +816,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_i2c1_hwmod,
 	&omap3xxx_i2c2_hwmod,
 	&omap3xxx_i2c3_hwmod,
+	&omap3xxx_mailbox_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 3/7 OMAP4: hwmod data: add mailbox data

In reply to Omar Ramirez Luna

From: Benoit Cousson <[email protected]>

hwmod data for omap4 mailbox.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   63 ++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +63 -0
index 0d5c6eb..f7525e3 100644
@@ -1043,6 +1043,66 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
 };
 
+/* mailbox */
+
+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,
+};
+
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP44XX_MAILBOX_BASE,
+		.pa_end		= OMAP44XX_MAILBOX_BASE + SZ_4K - 1,
+		.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_irq_info omap44xx_mailbox_irqs[] = {
+	{ .name = "mbox", .irq = 26 + OMAP44XX_IRQ_GIC_START, },
+};
+
+static struct omap_hwmod omap44xx_mailbox_hwmod = {
+	.name		= "mailbox",
+	.class		= &omap44xx_mailbox_hwmod_class,
+	.prcm		= {
+		.omap4 = {
+			.clkctrl_reg = OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL,
+		},
+	},
+	.mpu_irqs	= omap44xx_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_mailbox_irqs),
+	.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 */
 	&omap44xx_dmm_hwmod,
@@ -1077,6 +1137,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	&omap44xx_uart2_hwmod,
 	&omap44xx_uart3_hwmod,
 	&omap44xx_uart4_hwmod,
+
+	/* mailbox */
+	&omap44xx_mailbox_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.7.1
#6 lore raw

PATCH v2 3/7 OMAP4: hwmod data: add mailbox data

I don't know why, but this patch has nothing to do with my original one.
Can you stick to the original code?
Of course, if you have valid comments or need to add extra data, you can, but in this case, I do not see any needed change.

Quoted 15 lines · Omar

From: Benoit Cousson<[email protected]>

hwmod data for omap4 mailbox.

---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   63 ++++++++++++++++++++++++++++
  1 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -0
index 0d5c6eb..f7525e3 100644

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_uart4_hwmod = { · line 1046

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
@@ -1043,6 +1043,66 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
  	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
  };
 
+/* mailbox */

The original comment is missing.

Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +10 -0
+
+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_uart4_hwmod = { · line 1066

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,
+};
+
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+	{
+		.pa_start	= OMAP44XX_MAILBOX_BASE,

If that physical address is not used elsewhere, and it should be the case, there is no need to create a define for it. That's why the physical address was directly used here. There is no added value to create a define for that.

Quoted 24 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +24 -0
+		.pa_end		= OMAP44XX_MAILBOX_BASE + SZ_4K - 1,
+		.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_irq_info omap44xx_mailbox_irqs[] = {
+	{ .name = "mbox", .irq = 26 + OMAP44XX_IRQ_GIC_START, },
+};
+

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_uart4_hwmod = { · line 1100

Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +10 -0
+static struct omap_hwmod omap44xx_mailbox_hwmod = {
+	.name		= "mailbox",
+	.class		=&omap44xx_mailbox_hwmod_class,
+	.prcm		= {
+		.omap4 = {
+			.clkctrl_reg = OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL,
+		},
+	},
+	.mpu_irqs	= omap44xx_mailbox_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_mailbox_irqs),

The order is different than the previous one.

Benoit

Quoted 18 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +8 -0
+	.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 */
  	&omap44xx_dmm_hwmod,
@@ -1077,6 +1137,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
  	&omap44xx_uart2_hwmod,
  	&omap44xx_uart3_hwmod,
  	&omap44xx_uart4_hwmod,
+
+	/* mailbox */
+	&omap44xx_mailbox_hwmod,
  	NULL,
  };
 
#7 lore raw

PATCH v2 3/7 OMAP4: hwmod data: add mailbox data

Quoted 2 lines · Benoit

I don't know why, but this patch has nothing to do with my original one. Can you stick to the original code?

no, apart from the ordering of structure members, that I will change, since keeping the order of the original structure doesn't fly, I don't see anything that needs to be changed.

- The magic numbers replaced for the defines, afaik it gives more clarity.
- mailbox irq has a name.
- overall defining block was improved:

class
ocp_if
slave ports
hwmod

If you see, each dependent reference is right before the structure that is using it, which at least to me establishes some order, as of today this ordering doesn't exists.

e.g. you are defining some hwmod and some how you are populating all the members, if you are looking at your omap_hwmod struct and want to see the irqs defined you need to scroll beyond the supposed first reference in omap_hwmod (right now above ocp_if)

Quoted 5 lines · Omar
Quoted 1 line

+/* mailbox */

The original comment is missing.

<quote>
/*
* 'mailbox' class
* mailbox module allowing communication between the on-chip processors
* useusing a queued mailbox-interrupt mechanism.
*/
</quote>

I don't think it adds anything to the patch, should we start commenting on the functionality of the drivers for each hwmod?

Quoted 11 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_uart4_hwmod = {

Quoted 6 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +6 -0
+
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .pa_start ? ? ? = OMAP44XX_MAILBOX_BASE,

If that physical address is not used elsewhere, and it should be the case, there is no need to create a define for it. That's why the physical address was directly used here.
There is no added value to create a define for that.

yes there is, apart from readability where '0x4a0f4000' doesn't say much

for me at least, if reviewing I need to open the TRM check if that is the address and move on, with the define you know that someone have checked the address before (when creating the define)

besides the define was already there

Quoted 11 lines
Quoted 10 lines

+static struct omap_hwmod omap44xx_mailbox_hwmod = {
+ ? ? ? .name ? ? ? ? ? = "mailbox",
+ ? ? ? .class ? ? ? ? ?=&omap44xx_mailbox_hwmod_class,
+ ? ? ? .prcm ? ? ? ? ? = {
+ ? ? ? ? ? ? ? .omap4 = {
+ ? ? ? ? ? ? ? ? ? ? ? .clkctrl_reg = OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL,
+ ? ? ? ? ? ? ? },
+ ? ? ? },
+ ? ? ? .mpu_irqs ? ? ? = omap44xx_mailbox_irqs,
+ ? ? ? .mpu_irqs_cnt ? = ARRAY_SIZE(omap44xx_mailbox_irqs),

Quoted 1 line

The order is different than the previous one.

as the order is given by omap4 data, and not the definition of the structure, I'll keep the consistency with omap4 then.

Regards,

Omar

#8 lore raw

PATCH v2 3/7 OMAP4: hwmod data: add mailbox data

Hi Omar,

Quoted 5 lines · Omar
Quoted 2 lines · Benoit

I don't know why, but this patch has nothing to do with my original one. Can you stick to the original code?

no, apart from the ordering of structure members, that I will change,

If you do want to change a patch already submitted to loml, the least you can do is to comment on the mailing list, and afaik, you didn't provide any comment on this code. So do not change it without any explanation or any rational.
That's the most basic rule of the patch submission / review process in Linux.

Quoted 4 lines

since keeping the order of the original structure doesn't fly, I don't see anything that needs to be changed.

- The magic numbers replaced for the defines, afaik it gives more clarity.

No, since these are not magic numbers but physical address or dma number or irq channel.
That does not give any more clarity to add a define, and in fact it adds an extra level of indirection for nothing.
The hwmod file is "the" unique HW definition files. So all the information that used to be scattered all over various header files will have to be there. You should considered this file as a global SoC HW definition file.

Quoted 1 line

- mailbox irq has a name.

Which is in the structure anyway, so again no need to add a define.
All the structure that are populated hrer are all unique to every IP, so having that kind of assignment does not seems very useful to me.

omap44xx_mailbox_irq = OMAP44XX_MAILBOX_IRQ;

whereas that:
omap44xx_mailbox_irq = 20;

Give you a little be more information, because you do not have have to read the TRM or another header file to get the real number.

FYI, that was discussed at least 6 months ago during the submission of the early hwmod series.

Quoted 7 lines

- overall defining block was improved:

class
ocp_if
slave ports
hwmod

Quoted 8 lines

If you see, each dependent reference is right before the structure that is using it, which at least to me establishes some order, as of today this ordering doesn't exists.

e.g. you are defining some hwmod and some how you are populating all the members, if you are looking at your omap_hwmod struct and want to see the irqs defined you need to scroll beyond the supposed first reference in omap_hwmod (right now above ocp_if)

So what? If you have any issue with the original order, please feel free to comment on the original patch.
In case you didn't notice, all the OMAP4 data are following the same pattern. So any change to the structure should be applied everywhere.

I do not have any issue to improve the overall readability if that make sense for everybody, but again, please comment first.

Quoted 14 lines
Quoted 5 lines · Omar
Quoted 1 line

+/* mailbox */

The original comment is missing.

<quote>
/*
* 'mailbox' class
* mailbox module allowing communication between the on-chip processors
* useusing a queued mailbox-interrupt mechanism.
*/
</quote>

Quoted 2 lines

I don't think it adds anything to the patch, should we start commenting on the functionality of the drivers for each hwmod?

In that case, it does not hurt since this file is the C file version of the TRM. You might not care because you know what that module is doing, but most people don't.

Quoted 13 lines
Quoted 12 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_uart4_hwmod = { · line 1066

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +6 -0
+
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+       {
+               .pa_start       = OMAP44XX_MAILBOX_BASE,

If that physical address is not used elsewhere, and it should be the case, there is no need to create a define for it. That's why the physical address was directly used here.
There is no added value to create a define for that.

Quoted 1 line

yes there is, apart from readability where '0x4a0f4000' doesn't say much

It says everything... when you use a debugger, what kind of information OMAP44XX_MAILBOX_BASE will give you? Nothing, you will have to check again the TRM or the define to get the real useful information.

Quoted 3 lines

for me at least, if reviewing I need to open the TRM check if that is the address and move on, with the define you know that someone have checked the address before (when creating the define)

And what if the define is wrong??? You have as well to check the TRM... FYI, that file is automatically generated from the HW data, so it has a much lower probably to contain wrong data. Especially compared to a manually written header file done from a buggy TRM.

Regards,
Benoit

#9 lore raw

PATCH v2 3/7 OMAP4: hwmod data: add mailbox data

Hi Benoit,

Quoted 8 lines · Benoit
Quoted 1 line

no, apart from the ordering of structure members, that I will change,

If you do want to change a patch already submitted to loml, the least you can do is to comment on the mailing list, and afaik, you didn't provide any comment on this code.
So do not change it without any explanation or any rational. That's the most basic rule of the patch submission / review process in Linux.

I'm submitting my changes to review, I accept that I should have put loudly an clear the reasons why the ordering was changing. I guess you are the maintainer of the code, right? so if you say the ordering standard is omap4 then I'm fine with such triviality.

Quoted 5 lines
Quoted 4 lines

since keeping the order of the original structure doesn't fly, I don't see anything that needs to be changed.

- The magic numbers replaced for the defines, afaik it gives more clarity.

Quoted 8 lines

No, since these are not magic numbers but physical address or dma number or irq channel.
That does not give any more clarity to add a define, and in fact it adds an extra level of indirection for nothing.
The hwmod file is "the" unique HW definition files. So all the information that used to be scattered all over various header files will have to be there.
You should considered this file as a global SoC HW definition file.

Ok, I don't mind changing this too, I'm glad you clarify/review this before more hwmods make it to the tree, following the same style I'm using which is the one already there.

Quoted 3 lines
Quoted 1 line

- mailbox irq has a name.

Which is in the structure anyway, so again no need to add a define.

I didn't add a define for the irq name, I put the irq name because it wasn't there.

Quoted 30 lines

All the structure that are populated hrer are all unique to every IP, so having that kind of assignment does not seems very useful to me.

omap44xx_mailbox_irq = OMAP44XX_MAILBOX_IRQ;

whereas that:
omap44xx_mailbox_irq = 20;

Give you a little be more information, because you do not have have to read the TRM or another header file to get the real number.

FYI, that was discussed at least 6 months ago during the submission of the early hwmod series.

Quoted 7 lines

- overall defining block was improved:

? ? ? ? class
? ? ? ? ocp_if
? ? ? ? slave ports
? ? ? ? hwmod

Quoted 8 lines

If you see, each dependent reference is right before the structure that is using it, which at least to me establishes some order, as of today this ordering doesn't exists.

e.g. you are defining some hwmod and some how you are populating all the members, if you are looking at your omap_hwmod struct and want to see the irqs defined you need to scroll beyond the supposed first reference in omap_hwmod (right now above ocp_if)

Quoted 7 lines

So what? If you have any issue with the original order, please feel free to comment on the original patch.
In case you didn't notice, all the OMAP4 data are following the same pattern. So any change to the structure should be applied everywhere.

I do not have any issue to improve the overall readability if that make sense for everybody, but again, please comment first.

Again, I should have sent an RFC explaining such changes. will do.

I feel commenting in the original patch is useless because this code is already in-tree, it might have already changed.

Quoted 8 lines
Quoted 8 lines

<quote>
/*
?* 'mailbox' class
?* mailbox module allowing communication between the on-chip processors ?* useusing a queued mailbox-interrupt mechanism.
?*/
</quote>

Quoted 6 lines
Quoted 2 lines

I don't think it adds anything to the patch, should we start commenting on the functionality of the drivers for each hwmod?

In that case, it does not hurt since this file is the C file version of the TRM. You might not care because you know what that module is doing, but most people don't.

Ok, then.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_uart4_hwmod = {

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +5 -0
+static struct omap_hwmod omap44xx_mailbox_hwmod;
+
+static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
+ ? ? ? {
+ ? ? ? ? ? ? ? .pa_start ? ? ? = OMAP44XX_MAILBOX_BASE,

If that physical address is not used elsewhere, and it should be the case,
there is no need to create a define for it. That's why the physical address
was directly used here.
There is no added value to create a define for that.

Quoted 5 lines
Quoted 1 line

yes there is, apart from readability where '0x4a0f4000' doesn't say much

It says everything... when you use a debugger, what kind of information OMAP44XX_MAILBOX_BASE will give you? Nothing, you will have to check again the TRM or the define to get the real useful information.

Why is that? if you use a debugger you will see the address, if you use an objdump you can easily traverse to the definition (with cscope, ctags...). Again, I don't mind placing the hex number there, now that there is an explanation for doing so.

Overall, I feel the lack of information made the code look as it is right now for the existing LO hwmods, given that it is also a matter of ordering stuff it should be pretty straight forward. I'll give you my proposal offline, if you think it makes sense we can send it to LO and avoid traffic of non-technical stuff.

Regards,

Omar

#10 lore raw

PATCH v2 4/7 omap: mailbox: initial hwmod support

In reply to Omar Ramirez Luna

From: Felipe Contreras <[email protected]>

hwmod support for omap mailbox module.

---
 arch/arm/mach-omap2/devices.c |  100 ++++++----------------------------------
 1 files changed, 15 insertions(+), 85 deletions(-)
arch/arm/mach-omap2/devices.c +15 -85
index eaf3799..d977572 100644
@@ -141,95 +141,25 @@ 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 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;
+	}
+
+	od = omap_device_build("omap-mailbox", -1, oh,
+			NULL, 0,
+			NULL, 0,
+			0);
+	if (!od) {
+		pr_err("%s: could not build device\n", __func__);
 		return;
 	}
-	platform_device_register(&mbox_device);
 }
 #else
 static inline void omap_init_mbox(void) { }
Signature · 1 line
1.7.1
#11 lore raw

PATCH v2 4/7 omap: mailbox: initial hwmod support

Hi Felipe,

Quoted 104 lines · Omar

From: Felipe Contreras<[email protected]>

hwmod support for omap mailbox module.

---
  arch/arm/mach-omap2/devices.c |  100 ++++++----------------------------------
  1 files changed, 15 insertions(+), 85 deletions(-)
arch/arm/mach-omap2/devices.c +0 -84
index eaf3799..d977572 100644
@@ -141,95 +141,25 @@ 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 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__);

arch/arm/mach-omap2/devices.c static inline void omap_init_camera(void) · line 155

Quoted 10 lines
arch/arm/mach-omap2/devices.c +10 -0
+	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;
+	}
+
+	od = omap_device_build("omap-mailbox", -1, oh,

If possible, it will be better to use the "omap_" prefix in order to start having some consitency in the omap devices name.

Today, we have a little bit of a mess:

i2c_omap.1
omap2_mcspi.1
omap-mcbsp.1
mmci-omap-hs.0
musb_hdrc
omap-aes
omap-sham
omap_hdq.0
omap_rng
omap_wdt
omapdss

Thanks,
Benoit

Quoted 11 lines
arch/arm/mach-omap2/devices.c +5 -1
+			NULL, 0,
+			NULL, 0,
+			0);
+	if (!od) {
+		pr_err("%s: could not build device\n", __func__);
  		return;
  	}
-	platform_device_register(&mbox_device);
  }
  #else
  static inline void omap_init_mbox(void) { }
#12 lore raw

PATCH v2 5/7 omap: mailbox: add omap_device latency information

In reply to Omar Ramirez Luna

From: Felipe Contreras <[email protected]>

So that we can enable the main clock.

---
 arch/arm/mach-omap2/devices.c             |   18 ++++++++++++++++--
 arch/arm/mach-omap2/mailbox.c             |   21 +++++++++------------
 arch/arm/plat-omap/include/plat/mailbox.h |    6 ++++++
 3 files changed, 31 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/devices.c +16 -2
index d977572..dafc23a 100644
@@ -29,6 +29,7 @@
 #include <plat/dma.h>
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
+#include <plat/mailbox.h>
 
 #include "mux.h"
 #include "control.h"
@@ -141,10 +142,19 @@ static inline void omap_init_camera(void)
 #endif
 
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+static struct omap_device_pm_latency mbox_latencies[] = {
+	[0] = {
+		.activate_func = omap_device_enable_clocks,
+		.deactivate_func = omap_device_enable_clocks,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
 static inline void omap_init_mbox(void)
 {
 	struct omap_hwmod *oh;
 	struct omap_device *od;
+	struct omap_mbox_platform_data pdata;
 
 	oh = omap_hwmod_lookup("mailbox");
 	if (!oh) {
@@ -152,10 +162,14 @@ static inline void omap_init_mbox(void)
 		return;
 	}
 
+	pdata.device_enable = omap_device_enable;
+	pdata.device_disable = omap_device_idle;
+
 	od = omap_device_build("omap-mailbox", -1, oh,
-			NULL, 0,
-			NULL, 0,
+			&pdata, sizeof(pdata),
+			mbox_latencies, ARRAY_SIZE(mbox_latencies),
 			0);
+
 	if (!od) {
 		pr_err("%s: could not build device\n", __func__);
 		return;
arch/arm/mach-omap2/mailbox.c +9 -12
index 40ddeca..bf598a3 100644
@@ -52,6 +52,7 @@
 #define OMAP4_MBOX_NR_REGS		(OMAP4_MBOX_REG_SIZE / sizeof(u32))
 
 static void __iomem *mbox_base;
+static struct platform_device *mbox_pdev;
 
 struct omap_mbox2_fifo {
 	unsigned long msg;
@@ -70,8 +71,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);
 
@@ -90,14 +89,10 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
 {
 	u32 l;
 	unsigned long timeout;
+	struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data;
 
-	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 (pdata->device_enable)
+		pdata->device_enable(mbox_pdev);
 
 	if (cpu_is_omap44xx()) {
 		mbox_write_reg(OMAP4_SOFTRESET, MAILBOX_SYSCONFIG);
@@ -143,9 +138,9 @@ 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;
+	struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data;
+	if (pdata->device_disable)
+		pdata->device_disable(mbox_pdev);
 }
 
 /* Mailbox FIFO handle functions */
@@ -427,6 +422,8 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 	if (!mbox_base)
 		return -ENOMEM;
 
+	mbox_pdev = pdev;
+
 	ret = omap_mbox_register(&pdev->dev, list);
 	if (ret) {
 		iounmap(mbox_base);
arch/arm/plat-omap/include/plat/mailbox.h +6 -0
index 9976565..59443b1 100644
@@ -11,6 +11,7 @@
 
 typedef u32 mbox_msg_t;
 struct omap_mbox;
+struct platform_device;
 
 typedef int __bitwise omap_mbox_irq_t;
 #define IRQ_TX ((__force omap_mbox_irq_t) 1)
@@ -59,6 +60,11 @@ struct omap_mbox {
 	void			*priv;
 };
 
+struct omap_mbox_platform_data {
+	int (*device_enable)(struct platform_device *pdev);
+	int (*device_disable)(struct platform_device *pdev);
+};
+
 int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
 void omap_mbox_init_seq(struct omap_mbox *);
 
Signature · 1 line
1.7.1
#13 lore raw

PATCH v2 5/7 omap: mailbox: add omap_device latency information

Quoted 3 lines · Omar

From: Felipe Contreras<[email protected]>

So that we can enable the main clock.

Why not going directly to the runtime PM interface? It will save you some effort, because most of this code is useless with runtime PM.

Moreover, even without runtime PM, you should not need at all the SYSCONFIG stuff you still have in this driver.

36 /* SYSCONFIG: register bit definition */

  37 #define AUTOIDLE        (1 << 0)
  38 #define SOFTRESET       (1 << 1)
  39 #define SMARTIDLE       (2 << 3)

40 #define OMAP4_SOFTRESET (1 << 0)
41 #define OMAP4_NOIDLE (1 << 2)
42 #define OMAP4_SMARTIDLE (2 << 2)

That patch seems to me the perfect place to get rid of that.

Thanks,
Benoit

Quoted 143 lines
---
  arch/arm/mach-omap2/devices.c             |   18 ++++++++++++++++--
  arch/arm/mach-omap2/mailbox.c             |   21 +++++++++------------
  arch/arm/plat-omap/include/plat/mailbox.h |    6 ++++++
  3 files changed, 31 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/devices.c +16 -2
index d977572..dafc23a 100644
@@ -29,6 +29,7 @@
  #include<plat/dma.h>
  #include<plat/omap_hwmod.h>
  #include<plat/omap_device.h>
+#include<plat/mailbox.h>
 
  #include "mux.h"
  #include "control.h"
@@ -141,10 +142,19 @@ static inline void omap_init_camera(void)
  #endif
 
  #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
+static struct omap_device_pm_latency mbox_latencies[] = {
+	[0] = {
+		.activate_func = omap_device_enable_clocks,
+		.deactivate_func = omap_device_enable_clocks,
+		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
  static inline void omap_init_mbox(void)
  {
  	struct omap_hwmod *oh;
  	struct omap_device *od;
+	struct omap_mbox_platform_data pdata;
 
  	oh = omap_hwmod_lookup("mailbox");
  	if (!oh) {
@@ -152,10 +162,14 @@ static inline void omap_init_mbox(void)
  		return;
  	}
 
+	pdata.device_enable = omap_device_enable;
+	pdata.device_disable = omap_device_idle;
+
  	od = omap_device_build("omap-mailbox", -1, oh,
-			NULL, 0,
-			NULL, 0,
+			&pdata, sizeof(pdata),
+			mbox_latencies, ARRAY_SIZE(mbox_latencies),
  			0);
+
  	if (!od) {
  		pr_err("%s: could not build device\n", __func__);
  		return;
arch/arm/mach-omap2/mailbox.c +9 -12
index 40ddeca..bf598a3 100644
@@ -52,6 +52,7 @@
  #define OMAP4_MBOX_NR_REGS		(OMAP4_MBOX_REG_SIZE / sizeof(u32))
 
  static void __iomem *mbox_base;
+static struct platform_device *mbox_pdev;
 
  struct omap_mbox2_fifo {
  	unsigned long msg;
@@ -70,8 +71,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);
 
@@ -90,14 +89,10 @@ static int omap2_mbox_startup(struct omap_mbox *mbox)
  {
  	u32 l;
  	unsigned long timeout;
+	struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data;
 
-	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 (pdata->device_enable)
+		pdata->device_enable(mbox_pdev);
 
  	if (cpu_is_omap44xx()) {
  		mbox_write_reg(OMAP4_SOFTRESET, MAILBOX_SYSCONFIG);
@@ -143,9 +138,9 @@ 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;
+	struct omap_mbox_platform_data *pdata = mbox_pdev->dev.platform_data;
+	if (pdata->device_disable)
+		pdata->device_disable(mbox_pdev);
  }
 
  /* Mailbox FIFO handle functions */
@@ -427,6 +422,8 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
  	if (!mbox_base)
  		return -ENOMEM;
 
+	mbox_pdev = pdev;
+
  	ret = omap_mbox_register(&pdev->dev, list);
  	if (ret) {
  		iounmap(mbox_base);
arch/arm/plat-omap/include/plat/mailbox.h +6 -0
index 9976565..59443b1 100644
@@ -11,6 +11,7 @@
 
  typedef u32 mbox_msg_t;
  struct omap_mbox;
+struct platform_device;
 
  typedef int __bitwise omap_mbox_irq_t;
  #define IRQ_TX ((__force omap_mbox_irq_t) 1)
@@ -59,6 +60,11 @@ struct omap_mbox {
  	void			*priv;
  };
 
+struct omap_mbox_platform_data {
+	int (*device_enable)(struct platform_device *pdev);
+	int (*device_disable)(struct platform_device *pdev);
+};
+
  int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
  void omap_mbox_init_seq(struct omap_mbox *);
 
#14 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

In reply to Omar Ramirez Luna

Fix the mailbox detection for OMAP3630 and 2430, also minor cleanup on conditional ifdef's that could affect it.

Given that 2430 has an iva too include it, as the same steps for omap3 apply.

---
 arch/arm/mach-omap2/mailbox.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/mailbox.c +10 -6
index bf598a3..5e9ea0f 100644
@@ -276,7 +276,7 @@ static struct omap_mbox_ops omap2_mbox_ops = {
 
 /* FIXME: the following structs should be filled automatically by the user id */
 
-#if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420)
+#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP2)
 /* DSP */
 static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
 	.tx_fifo = {
@@ -301,7 +301,7 @@ struct omap_mbox mbox_dsp_info = {
 };
 #endif
 
-#if defined(CONFIG_ARCH_OMAP3430)
+#if defined(CONFIG_ARCH_OMAP3)
 struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
 #endif
 
@@ -389,15 +389,19 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 
 	if (false)
 		;
-#if defined(CONFIG_ARCH_OMAP3430)
-	else if (cpu_is_omap3430()) {
+#if defined(CONFIG_ARCH_OMAP3)
+	else if (cpu_is_omap34xx()) {
 		list = omap3_mboxes;
 
 		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
 	}
 #endif
-#if defined(CONFIG_ARCH_OMAP2420)
-	else if (cpu_is_omap2420()) {
+#if defined(CONFIG_ARCH_OMAP2)
+	else if (cpu_is_omap2430()) {
+		list = omap2_mboxes;
+
+		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
+	} else if (cpu_is_omap2420()) {
 		list = omap2_mboxes;
 
 		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
Signature · 1 line
1.7.1
#15 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

Quoted 25 lines · Omar

Fix the mailbox detection for OMAP3630 and 2430, also minor cleanup on conditional ifdef's that could affect it.

Given that 2430 has an iva too include it, as the same steps for omap3 apply.

---
  arch/arm/mach-omap2/mailbox.c |   16 ++++++++++------
  1 files changed, 10 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/mailbox.c +1 -1
index bf598a3..5e9ea0f 100644
@@ -276,7 +276,7 @@ static struct omap_mbox_ops omap2_mbox_ops = {
 
  /* FIXME: the following structs should be filled automatically by the user id */
 
-#if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420)
+#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP2)
  /* DSP */
  static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
  	.tx_fifo = {

arch/arm/mach-omap2/mailbox.c struct omap_mbox mbox_dsp_info = { · line 304

Quoted 5 lines
arch/arm/mach-omap2/mailbox.c +1 -1
@@ -301,7 +301,7 @@ struct omap_mbox mbox_dsp_info = {
  };
  #endif
 
-#if defined(CONFIG_ARCH_OMAP3430)
+#if defined(CONFIG_ARCH_OMAP3)

Ideally you should get rid of all the CONFIG_ARCH_OMAPXXX or cpu_is_omap in that code. This is a driver, it should be generic. If you have to handle differences between OMAP version, please do that in the devices, not in the driver.

This patch just contains a few of them, but the original mailbox.c file is full of that kind of test.
I know that you are not the original writer of this code, but since the clean it, it will be good to remove all the legacy code.

Thanks,
Benoit

Quoted 27 lines
arch/arm/mach-omap2/mailbox.c +8 -4
  struct omap_mbox *omap3_mboxes[] = {&mbox_dsp_info, NULL };
  #endif
 
@@ -389,15 +389,19 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 
  	if (false)
  		;
-#if defined(CONFIG_ARCH_OMAP3430)
-	else if (cpu_is_omap3430()) {
+#if defined(CONFIG_ARCH_OMAP3)
+	else if (cpu_is_omap34xx()) {
  		list = omap3_mboxes;
 
  		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
  	}
  #endif
-#if defined(CONFIG_ARCH_OMAP2420)
-	else if (cpu_is_omap2420()) {
+#if defined(CONFIG_ARCH_OMAP2)
+	else if (cpu_is_omap2430()) {
+		list = omap2_mboxes;
+
+		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
+	} else if (cpu_is_omap2420()) {
  		list = omap2_mboxes;
 
  		list[0]->irq = platform_get_irq_byname(pdev, "dsp");
#16 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

Quoted 8 lines · Benoit

Review

Quoted 2 lines
(quoted diff) +1 -1
-#if defined(CONFIG_ARCH_OMAP3430)
+#if defined(CONFIG_ARCH_OMAP3)

Ideally you should get rid of all the CONFIG_ARCH_OMAPXXX or cpu_is_omap in that code. This is a driver, it should be generic.
If you have to handle differences between OMAP version, please do that in the devices, not in the driver.

Quoted 4 lines

This patch just contains a few of them, but the original mailbox.c file is full of that kind of test.
I know that you are not the original writer of this code, but since the clean it, it will be good to remove all the legacy code.

I mentioned it in the cover-letter, I should have put it here too, my bad.

<quote>
This is meant as a short term solution until proper cleanup is done, as suggested in:

http://marc.info/?l=linux-arm-kernel&m=128534253231481&w=2
</quote>

Does nobody care that the driver is not working right now for some chips (since it was working before!!) and are willing to wait for more time until the proper cleanup is done?

For me it is a hassle, because if I need to do something on 3630 I have to merge this patch, then apply what I'm working into, then remove the patch, apply everything again to see no dependencies are there, then send.

Regards,

Omar

#17 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

Quoted 23 lines · Omar
Quoted 8 lines · Benoit

Review

Quoted 2 lines
(quoted diff) +1 -1
-#if defined(CONFIG_ARCH_OMAP3430)
+#if defined(CONFIG_ARCH_OMAP3)

Ideally you should get rid of all the CONFIG_ARCH_OMAPXXX or cpu_is_omap in that code. This is a driver, it should be generic.
If you have to handle differences between OMAP version, please do that in the devices, not in the driver.

Quoted 4 lines

This patch just contains a few of them, but the original mailbox.c file is full of that kind of test.
I know that you are not the original writer of this code, but since the clean it, it will be good to remove all the legacy code.

I mentioned it in the cover-letter, I should have put it here too, my bad.

<quote>
This is meant as a short term solution until proper cleanup is done, as suggested in:

http://marc.info/?l=linux-arm-kernel&m=128534253231481&w=2
</quote>

Quoted 8 lines

Does nobody care that the driver is not working right now for some chips (since it was working before!!) and are willing to wait for more time until the proper cleanup is done?

For me it is a hassle, because if I need to do something on 3630 I have to merge this patch, then apply what I'm working into, then remove the patch, apply everything again to see no dependencies are there, then send.

Huh? The mailbox is working for me on tidspbridge on 2.6.37-rc1.

Signature · 1 line
Felipe Contreras
#18 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

Quoted 1 line · Felipe Contreras

Huh? The mailbox is working for me on tidspbridge on 2.6.37-rc1.

Are you using an omap based board with a 3630 chip?

Regards,

Omar

#19 lore raw

PATCH v2 6/7 omap: mailbox: fix detection for previously supported chips

In reply to Ramirez Luna, Omar
Quoted 14 lines · Omar
Quoted 8 lines · Benoit

Review

Quoted 2 lines
(quoted diff) +1 -1
-#if defined(CONFIG_ARCH_OMAP3430)
+#if defined(CONFIG_ARCH_OMAP3)

Ideally you should get rid of all the CONFIG_ARCH_OMAPXXX or cpu_is_omap in that code. This is a driver, it should be generic.
If you have to handle differences between OMAP version, please do that in the devices, not in the driver.

Quoted 4 lines

This patch just contains a few of them, but the original mailbox.c file is full of that kind of test.
I know that you are not the original writer of this code, but since the clean it, it will be good to remove all the legacy code.

Quoted 8 lines

I mentioned it in the cover-letter, I should have put it here too, my bad.

<quote>
This is meant as a short term solution until proper cleanup is done, as suggested in:

http://marc.info/?l=linux-arm-kernel&m=128534253231481&w=2
</quote>

OK, sorry I didn't realized that this email thread was about the mailbox. I'm glad to see that both Paul and Nishant are aligned with me.

Quoted 3 lines

Does nobody care that the driver is not working right now for some chips (since it was working before!!) and are willing to wait for more time until the proper cleanup is done?

Sorry again, but removing these tests didn't not seems to be a huge task for my point of view. Anyway, if you want to do another phase and if everybody agree on that, that's OK for me as well.

Quoted 4 lines

For me it is a hassle, because if I need to do something on 3630 I have to merge this patch, then apply what I'm working into, then remove the patch, apply everything again to see no dependencies are there, then send.

Yeah, sometime life really sucks :-)

Benoit

#20 lore raw

PATCH v2 7/7 omap: mailbox: remove unreachable return

In reply to Omar Ramirez Luna

Remove unreachable return statement.

---
 arch/arm/mach-omap2/mailbox.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/mailbox.c +0 -2
index 5e9ea0f..335eb2b 100644
@@ -434,8 +434,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
 		return ret;
 	}
 	return 0;
-
-	return ret;
 }
 
 static int __devexit omap2_mbox_remove(struct platform_device *pdev)
Signature · 1 line
1.7.1
#21 lore raw

PATCH v2 7/7 omap: mailbox: remove unreachable return

Quoted 12 lines · Omar

Remove unreachable return statement.

---
  arch/arm/mach-omap2/mailbox.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/mailbox.c +0 -0
index 5e9ea0f..335eb2b 100644

arch/arm/mach-omap2/mailbox.c static int __devinit omap2_mbox_probe(struct platform_device *pdev) · line 435

Quoted 2 lines
arch/arm/mach-omap2/mailbox.c +0 -0
@@ -434,8 +434,6 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
  		return ret;
  	}

Please add a blank line here.

Otherwise you can add: Acked-by: Benoit Cousson <[email protected]>

Thanks,
Benoit

Quoted 6 lines
arch/arm/mach-omap2/mailbox.c +0 -2
  	return 0;
-
-	return ret;
  }
 
  static int __devexit omap2_mbox_remove(struct platform_device *pdev)
#22 lore raw

PATCH v2 7/7 omap: mailbox: remove unreachable return

Quoted 9 lines · Benoit
Quoted 8 lines · Omar

Remove unreachable return statement.

---
?arch/arm/mach-omap2/mailbox.c | ? ?2 --
?1 files changed, 0 insertions(+), 2 deletions(-)

Quoted 10 lines

arch/arm/mach-omap2/mailbox.c static int __devinit omap2_mbox_probe(struct · line 436

Quoted 8 lines
arch/arm/mach-omap2/mailbox.c +0 -0
index 5e9ea0f..335eb2b 100644
@@ -434,8 +434,6 @@ static int __devinit omap2_mbox_probe(struct
 platform_device *pdev)
 ? ? ? ? ? ? ? ?return ret;
 ? ? ? ?}

Please add a blank line here.

ok...

Quoted 2 lines

Otherwise you can add: Acked-by: Benoit Cousson <[email protected]>

Regards,

Omar

#23 lore raw

v2 cover omap: mailbox: hwmod support and dependent cleanup patches

In reply to Omar Ramirez Luna
Quoted 29 lines · Omar

hwmod support for omap2 and omap3 chips, plus cleanups.

Tested on 3430 and 3630

** v2 **
- Added omap4 hwmod support.
- Moved "mailbox_ick" from hwmod to hwmod_if (omap 2/3)
- Declared sysc classes for omap 2/3

** v1 **
1. omap: mailbox: initial hwmod support for omap3 Changes were made to:
- Rebase to latest code.
- Detect the hwmod by filling prcm union for omap2, without this it was unable to build the hwmod at runtime.
- Replace magic number for defines.
- Use ioremap again instead of relying on the one made by hwmod, as noted in http://patchwork.kernel.org/patch/101661/

2. omap: mailbox: initial hwmod support for omap2
Was only compiled tested!! Unfortunately I don't have the HW for it.

4. omap: mailbox: fix detection for previously supported chips Original patch was using features framework, but when compiled as a module it was breaking, this patch uses cpu_is_omap34xx macro instead. This is meant as a short term solution until proper cleanup is done, as suggested in:

http://marc.info/?l=linux-arm-kernel&m=128534253231481&w=2

Quoted 7 lines

Benoit Cousson (1):
OMAP4: hwmod data: add mailbox data

Felipe Contreras (3):
OMAP3: hwmod data: add mailbox data
omap: mailbox: initial hwmod support
omap: mailbox: add omap_device latency information

Could you please try to use a consistent naming in the subject? You use OMAP3, OMAP4, OMAP2 so it should be OMAP and not omap.

Thanks,
Benoit

Quoted 15 lines

Omar Ramirez Luna (3):
OMAP2: hwmod data: add mailbox data
omap: mailbox: fix detection for previously supported chips
omap: mailbox: remove unreachable return

  arch/arm/mach-omap2/devices.c              |  104 +++++++---------------------
  arch/arm/mach-omap2/mailbox.c              |   39 +++++-----
  arch/arm/mach-omap2/omap_hwmod_2420_data.c |   67 ++++++++++++++++++
  arch/arm/mach-omap2/omap_hwmod_2430_data.c |   66 ++++++++++++++++++
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |   66 ++++++++++++++++++
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   63 +++++++++++++++++
  arch/arm/plat-omap/include/plat/mailbox.h  |    6 ++
  7 files changed, 311 insertions(+), 100 deletions(-)
#24 lore raw

v2 cover omap: mailbox: hwmod support and dependent cleanup patches

Quoted 3 lines · Benoit

On 11/5/2010 9:17 PM, Ramirez Luna, Omar wrote:
Could you please try to use a consistent naming in the subject? You use OMAP3, OMAP4, OMAP2 so it should be OMAP and not omap.

Yes, I'll change it.

Regards,

Omar