[PATCH v1 2/3] mtd: probe: probe dual die entry from devicetree binding

Bean Huo beanhuo at outlook.com
Fri Feb 23 03:14:57 PST 2018


Below suggested points will be involved in next patch. Thanks Boris.

>>       int addr_unlock1 = 0x555, addr_unlock2 = 0x2AA;
>> +     struct device_node __maybe_unused *np = map->device_node;

>You can drop this variable...

>>
>>       xip_enable(base, map, cfi);
>>  #ifdef DEBUG_CFI
>> @@ -177,6 +179,11 @@ static int __xipram cfi_chip_setup(struct map_info *map,
>>
>>       cfi->sector_erase_cmd = CMD(0x30);
>>
>> +     cfi->device_stack = CFI_DEVICESTACK_1DIE;
>> +#ifdef CONFIG_OF
>> +     if (np && of_property_read_bool(np, "dual-die-stack"))
>> +             cfi->device_stack = CFI_DEVICESTACK_2DIE;
>> +#endif
>and simply do:

>      if (of_property_read_bool(map->device_node, "dual-die-stack"))
>             cfi->device_stack = CFI_DEVICESTACK_2DIE;

>>       /* Read the CFI info structure */
>>       xip_disable_qry(base, map, cfi);
>>       for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
>> diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
>> index 9b57a9b..bda37a4 100644
>> --- a/include/linux/mtd/cfi.h
>> +++ b/include/linux/mtd/cfi.h
>> @@ -277,11 +277,19 @@ struct cfi_bri_query {
>>  #define CFI_MODE_CFI 1
>>  #define CFI_MODE_JEDEC       0
>>
>> +/* These values represent the die count of chip stack.
>> + * So far, there only exists two type of stack device,
>> + * single or dual die.
>> + */
>> +#define CFI_DEVICESTACK_1DIE 1
>> +#define CFI_DEVICESTACK_2DIE 2

>Why are these macros needed?

>> +
>>  struct cfi_private {
>>       uint16_t cmdset;
>>       void *cmdset_priv;
>>       int interleave;
>>       int device_type;
>> +     int device_stack;       /* Device stack type, single die or dual die. */

>Why not simply:

>       int num_dies;

>which would contain the number of dies.

>>       int cfi_mode;           /* Are we a JEDEC device pretending to be CFI? */
>>       int addr_unlock1;
>>       int addr_unlock2;



More information about the linux-mtd mailing list