[U-Boot] [PATCH V2 1/2] mmc: change magic number to macro define

Lei Wen adrian.wenl at gmail.com
Sat Oct 8 15:45:14 CEST 2011


On Fri, Oct 7, 2011 at 4:36 PM, Prafulla Wadaskar <prafulla at marvell.com> wrote:
>
>
>> -----Original Message-----
>> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de]
>> On Behalf Of Lei Wen
>> Sent: Thursday, October 06, 2011 8:41 PM
>> To: Marek Vasut
>> Cc: Lei Wen; u-boot at lists.denx.de; Andy Fleming
>> Subject: Re: [U-Boot] [PATCH V2 1/2] mmc: change magic number to macro
>> define
>>
>> Hi Marek,
>>
>> On Tue, Oct 4, 2011 at 8:07 PM, Marek Vasut <marek.vasut at gmail.com>
>> wrote:
>> > On Tuesday, October 04, 2011 08:35:10 AM Lei Wen wrote:
>> >> Previous magic number is hard to parse its meaning, change it to
>> >> respective macro definition
>> >>
>> >> Signed-off-by: Lei Wen <leiwen at marvell.com>
>> >
>> > [..]
>> >
>> >> --- a/include/mmc.h
>> >> +++ b/include/mmc.h
>> >> @@ -145,13 +145,15 @@
>> >>  /*
>> >>   * EXT_CSD fields
>> >>   */
>> >> -
>> >> -#define EXT_CSD_PART_CONF    179     /* R/W */
>> >> -#define EXT_CSD_BUS_WIDTH    183     /* R/W */
>> >> -#define EXT_CSD_HS_TIMING    185     /* R/W */
>> >> -#define EXT_CSD_CARD_TYPE    196     /* RO */
>> >> -#define EXT_CSD_REV          192     /* RO */
>> >> -#define EXT_CSD_SEC_CNT              212     /* RO, 4 bytes */
>> >> +#define EXT_CSD_PARTITIONING_SUPPORT 160     /* RO */
>> >> +#define EXT_CSD_ERASE_GROUP_DEF              175     /* R/W */
>> >> +#define EXT_CSD_PART_CONF            179     /* R/W */
>> >> +#define EXT_CSD_BUS_WIDTH            183     /* R/W */
>> >> +#define EXT_CSD_HS_TIMING            185     /* R/W */
>> >> +#define EXT_CSD_REV                  192     /* RO */
>> >> +#define EXT_CSD_CARD_TYPE            196     /* RO */
>> >> +#define EXT_CSD_SEC_CNT                      212     /* RO, 4 bytes
>> */
>> >> +#define EXT_CSD_HC_ERASE_GRP_SIZE    224     /* RO */
>> >>
>> >>  /*
>> >>   * EXT_CSD field definitions
>> >
>> > Hi Lei,
>> > this is better, but what about structure-based access ?
>> >
>> > struct somrthing {
>> >  u8 a1;
>> >  u8 a2;
>> > ...
>> > };
>> >
>> > Like this.
>> >
>> > Also, CC Andy.
>> >
>>
>> The ext_csd current usage in mmc.c is not too much, here I mean only few
>> of
>> the fields of the ext_csd is used, also fully definition of ext_csd
>> member would seems so huge a structure at its appearence...
>>
>> So macro may looks more concise and could parse from its meaning easily
>> enough.
>>
>> Anyway, more comments on this welcomes. :)
>
> Dear Lei
> Using c-struct is our strategy, may be full definition is huge, you may skip them inserting padding in the c-struct.
>
> Regards..
> Prafulla . .
>

Ok... Got that.
I would send patch soon using the c style.

Thanks,
Lei


More information about the U-Boot mailing list