On Mon, May 3, 2010 at 9:10 PM, Tony Lindgren <[email protected]> wrote:
> * Felipe Contreras <[email protected]> [100502 16:58]:
>> Makes more sense to register in the mach file, plus it will allow more
>> functionality later on.
>>
>> Also, this probably enables multi-omap for real.
>>
>> Signed-off-by: Felipe Contreras <[email protected]>
>
> <snip>
>
>> --- a/arch/arm/mach-omap2/mailbox.c
>> +++ b/arch/arm/mach-omap2/mailbox.c
>
> You still probably want to optimize kernel size and memory
> consumption for production kernels built for one omap:
>
> #ifdef CONFIG_ARCH_OMAP2

True.

>> +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,
>> +     },
>> +     {
>> +             .start          = INT_24XX_MAIL_U3_MPU,
>> +             .flags          = IORESOURCE_IRQ,
>> +     },
>> +};
>
> #else
> #define omap2_mbox_resources    NULL
> #endif
>
> And then do the same for omap3 and omap4.
>
> BTW, looks like this could all be also set __initdata?

Yeah, I think so.

>> @@ -443,7 +479,46 @@ static struct platform_driver omap2_mbox_driver = {
>>
>>  static int __init omap2_mbox_init(void)
>>  {
>> +     int err;
>> +     struct platform_device *pdev;
>> +     struct resource *res;
>> +     unsigned num;
>> +
>> +     if (cpu_is_omap3430()) {
>> +             res = omap3_mbox_resources;
>> +             num = ARRAY_SIZE(omap3_mbox_resources);
>> +     }
>> +     else if (cpu_is_omap2420()) {
>> +             res = omap2_mbox_resources;
>> +             num = ARRAY_SIZE(omap2_mbox_resources);
>> +     }
>> +     else if (cpu_is_omap44xx()) {
>> +             res = omap4_mbox_resources;
>> +             num = ARRAY_SIZE(omap4_mbox_resources);
>> +     }
>> +     else {
>> +             pr_err("%s: platform not supported\n", __func__);
>> +             return -ENODEV;
>> +     }
>
> Note that these tests will fail when building for one omap only
> unless you have the #else statement for eacch omapX_mbox_resources[].

Indeed. I'll fix that although the current code is already wrong.

Cheers.

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to