Re: [PATCH v5 7/8] OMAP: adapt hsmmc to hwmod framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tony,

On Sat, Feb 26, 2011 at 2:27 AM, Tony Lindgren <tony@xxxxxxxxxxx> wrote:
> * Tony Lindgren <tony@xxxxxxxxxxx> [110225 12:42]:
>> * Kishore Kadiyala <kishore.kadiyala@xxxxxx> [110225 09:00]:
>> > +static int omap_mmc_init(struct omap_hwmod *oh, void *hsmmcinfo)
>> ...
>>
>> > +   static int mmc_num;
>> > +
>> > +   c += mmc_num;
>>
>> This does not look right..

omap2_hsmmc_info is filled in respective board files and will have a call to
omap2_hsmmc_init [hsmm.c].
In omap2_hsmmc_init, it will call omap_hwmod_for_each_by_class which
takes 3 arguments out of which 2nd one is a callback and 3rd one is void
pointer to be passed to call back if necessary.
With this the callback "omap_mmc_init" will be called multiple times based on
the class entry in hwmod data file for each controller.
Say you have 3 controllers as in OMAP3, then "omap_mmc_init" will be
called thrice.
Here the argument "hsmmcinfo" needs to be  incremented for each call, so having
a static mmc_num and incrementing it on each call.

>
> So since mmc_num is static, it gets initialized to 0, then increased
> for each call.. What if you want to intialize controller 1 and 3 but
> not 2?

The current implementation for initialization of MMC controllers will work
with any of the below  order of devices:
1) MMC1, MMC2, MMC3
2) MMC1, MMC3
3) MMC2, MMC1
4) MMC3, MMC2, MMC1
5) MMC3
....

>
> Also, why do you pass void *hsmmcinfo to the function and then cast
> it to struct omap2_hsmmc_inf *? Why not pass struct omap2_hsmmc_info *
> to start with?

Its because the 3rd argument in omap_hwmod_for_each_by_class is void * .

>
> Regards,
>
> Tony
>

Regards,
Kishore
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux