[U-Boot] [PATCH v1 08/18] MIPS: pic32: Add driver for Microchip PIC32 flash controller.

Stefan Roese sr at denx.de
Fri Jan 8 15:11:12 CET 2016


On 08.01.2016 14:53, Purna Chandra Mandal wrote:
> On 12/21/2015 08:50 PM, Stefan Roese wrote:
>> On 21.12.2015 15:58, Daniel Schwierzeck wrote:
>>>
>>>
>>> Am 17.12.2015 um 18:30 schrieb Purna Chandra Mandal:
>>>> From: Cristian Birsan <cristi.birsan at microchip.com>
>>>>
>>>> Signed-off-by: Cristian Birsan <cristi.birsan at microchip.com>
>>>> Signed-off-by: Purna Chandra Mandal <purna.mandal at microchip.com>
>>>> ---
>>>>
>>>>    arch/mips/mach-pic32/Makefile |   5 +-
>>>>    arch/mips/mach-pic32/flash.c  | 471 ++++++++++++++++++++++++++++++++++++++++++
>>>>    include/flash.h               |   5 +-
>>>>    3 files changed, 479 insertions(+), 2 deletions(-)
>>>>    create mode 100644 arch/mips/mach-pic32/flash.c
>>>>
>>>
>>> +cc Stefan Roese
>>>
>>> have you tried to use drivers/mtd/cfi_flash.c? You are duplicating some
>>> common code. If you need additional logic for your flash controller,
>>> then you can try to overwrite the weak flash_readX/flash_writeX
>>> accessors. You have to enable CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS to be
>>> able to do this.
>>
>> Yes, this really looks like it could use the common CFI flash driver.
>> You might need to add support for the new flash devices with the
>> commands, if its not already supported. But this should be better
>> than duplicating some of the code already available.
>>
> Thanks Stefan.
>
> Tried to understand and map PIC32 flash driver on cfi_flash.c. It is not straight
> forward and resultant code becomes clumsy, full of if-else.

Ughh. Thats definitely not something that we strive for.

> Please note PIC32 flash is not CFI complaint. Specific operations
> (like erase, and program) on the flash panel are handled by PIC32 nvm controller.
> NVM controller documentation: http://ww1.microchip.com/downloads/en/DeviceDoc/60001193B.pdf
>
> Instead I'll propose to improve current pic32_flash driver and move it to drivers/mtd/
> (like st_smi.c).

Okay. Then please continue with this approach and lets see,
how the resulting code will be structured.

Thanks,
Stefan



More information about the U-Boot mailing list