From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Fri, 8 Jan 2016 15:11:12 +0100 Subject: [U-Boot] [PATCH v1 08/18] MIPS: pic32: Add driver for Microchip PIC32 flash controller. In-Reply-To: <568FBF5F.7020100@microchip.com> References: <5672F14B.8070006@microchip.com> <567813A8.3050706@gmail.com> <567818D7.6090602@denx.de> <568FBF5F.7020100@microchip.com> Message-ID: <568FC380.1020609@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >>>> >>>> Signed-off-by: Cristian Birsan >>>> Signed-off-by: Purna Chandra Mandal >>>> --- >>>> >>>> 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