summaryrefslogtreecommitdiffstats
path: root/drivers/nor
Commit message (Collapse)AuthorAgeFilesLines
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-032-8/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-172-8/+0
| | | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd'Sascha Hauer2012-10-034-8/+78
|\ \
| * | drivers/nor/cfi_flash: use IS_ENABLED instead of an ifdefJan Luebbe2012-09-162-7/+3
| | | | | | | | | | | | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | drivers/nor/m25p80: add MTD supportJan Luebbe2012-09-162-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | This has been tested by using UBI with a N25Q128 connected to a TI McSPI controller. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | drivers/nor/m25p80: add JEDEC ID for Micron/Numonyx SPI NOR flashJan Luebbe2012-09-061-0/+3
| |/ | | | | | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | cfi-flash: Add devicetree probe supportSascha Hauer2012-09-231-6/+23
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | SPI: Put SPI devices on their own busSascha Hauer2012-09-141-1/+1
|/ | | | | | | | | This patch adds a SPI bus on which the SPI devices and drivers register. This makes it cleaner as SPI devices won't accidently end up probed by a platform_device driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* m25p80: wait for flash before returning after eraseEric Bénard2012-08-291-1/+3
| | | | | | | | | else when we do "erase /dev/m25p0.rootfs; reset", the board will never reboot as the flash is busy to finish the erase command. Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: implement fast readSascha Hauer2012-07-312-13/+9
| | | | | | | The fast read command is needed for spi speeds > 25MHz, so use it for higher speeds. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: optimize eraseSascha Hauer2012-07-312-17/+44
| | | | | | | | The driver currently erases blocks in 4kb chunks if 4kb support is available. This patch uses bigger blocks for suitable areas to speed up erasing areas. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: align start and end to erase blocksSascha Hauer2012-07-311-2/+3
| | | | | | | The erase command normally makes sure that the selected area is erased, therefore align the parameters to eraseblock boundaries. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: refactor chip eraseSascha Hauer2012-07-311-13/+12
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: remove unused variablesSascha Hauer2012-07-311-6/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor m25p80: remove progression barSascha Hauer2012-07-311-8/+0
| | | | | | Drivers should not print a progression bar. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* use loff_t for file offsetsSascha Hauer2012-06-302-10/+14
| | | | | | | This is a first step for 64bit file support: Make the file sizes/offsets 64bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Change byte order detection mechanism to kernel styleSascha Hauer2012-06-281-4/+6
| | | | | | | | | | | | | | | The Linux Kernel defines only one of __LITTLE_ENDIAN and __BIG_ENDIAN. Endianess can then be tested with #ifdef __xx_ENDIAN. Userspace always defined both __LITTLE_ENDIAN and __BIG_ENDIAN and byteorder can then be tested with #if __BYTE_ORDER == __xx_ENDIAN. As we tend to use a lot of Kernel code in barebox we switch to use the kernel way of determing the byte order. As this always causes a lot of confusion add a check to include/common.h to make sure only one of __LITTLE_ENDIAN and __BIG_ENDIAN is defined. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: progressbar tweakJohannes Stezenbach2012-06-071-2/+2
| | | | | | | | Show progressbar even when erasing just a single sector, otherwise it looks as if erase didn't do anything. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: allow erase to be interruptedJohannes Stezenbach2012-06-071-0/+2
| | | | | | | Check for Ctrl-C before erasing each sector. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: prevent endless loop in eraseJohannes Stezenbach2012-06-071-0/+2
| | | | | | | | | "erase /dev/myflash0 0+1" erased the whole flash, similar for other value of count if you guessed the erae block size wrong. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* NOR flash: reduce size of cfiword_t if not using 64-bit bus.Krzysztof Halasa2012-05-131-0/+10
| | | | | | | This is done to reduce the binary size a bit. Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi flash: Fix alignment problemSascha Hauer2012-04-051-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | The intel cfi buffer write has a problem with writing when the alignment of the buffer in memory is smaller than the flash bus width. This patch fixes a alignment problem which may show during this scenario: - 32 or 64 attached NOR flash - flashing an image directly from network to the nor flash The involved network driver is "smc9111.c". The data that comes from the network stack and should be written into the flash isn't 32 bit aligned (at least with this network driver). This is probably due to the 48 bit wide ethernet addresses. However the "cfi_flash.c" driver doesn't handle this situation, and accesses the not-aligned address with a 32 bit pointer. This patch fixes the problem by reducing the access width if an aligment problem between source and destination is found. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi flash: Fix loop count calculationSascha Hauer2012-04-051-1/+1
| | | | | | | | 'reduce the number of loops by the width of the port' means a simple len / width. Do not try to be clever by shifting and doing it wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove unused Kconfig variable HAS_CFISascha Hauer2011-12-071-3/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* m25p80: set the correct erasesize when we use OPCODE_BE_4KMichael Grzeschik2011-11-251-2/+4
| | | | | Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi flash: fix flash_make_cmd for big endian accessSascha Hauer2011-09-231-19/+5
| | | | | | | | | | | | | | This is broken on big endian systems since: 943b271 cfi_flash: support of u32 cmd I looked over it and I *think* that the function was correct for both big and little endian systems before this patch. To support u32 cmd we only have to change the data type of the command from u8 to u32. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Teresa Gámez <t.gamez@phytec.de>
* cfi flash: use cpu native accessorsSascha Hauer2011-09-231-6/+6
| | | | | | So that the driver can work on big endian systems again Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce io.hSascha Hauer2011-09-222-2/+2
| | | | | | | To allow for some generic io accessors introduce io.h and use this instead of asm/io.h throughout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi_flash: support of u32 cmdTeresa Gámez2011-08-264-18/+38
| | | | | | | | | | | | Some NOR flash chips have commands with length greater than the maximum value size of uchar. Based on an U-Boot Patch by Vasiliy Leoenenko <vasiliy.leonenko@mail.ru> Only tested with little endian on an intel cfi_flash. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nor: Add SPI flash driverFranck Jullien2011-08-244-5/+945
| | | | | | | | | This patch adds the m25p80 driver. It has been ported from Linux. MTD code has been removed. It has been tested with a m25p40 chip and the Altera SPI master driver. Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi_flash: convert missing map_baseJean-Christophe PLAGNIOL-VILLARD2011-07-301-1/+1
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi: convert to struct resourceSascha Hauer2011-07-191-19/+17
| | | | | | | This is the non invasive approach. All this type casting shows this driver should be really cleaned up (or retired) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'master' into nextSascha Hauer2011-01-171-10/+8
|\
| * CFI NOR flash: fix write timeout units.Krzysztof Halasa2011-01-171-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write timeouts are expressed in microseconds. Milliseconds are 1000 times longer than microseconds, not 1000 times shorter. Before (Intel 28F128J3D75): CFI conformant FLASH (16 x 16) Size: 16 MB in 128 Sectors Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x18 Erase timeout: 4096 ms, write timeout: 256000 ms Buffer write timeout: 1024000 ms, buffer size: 32 bytes After: ... Erase timeout: 4096 ms, write timeout: 256 us Buffer write timeout: 1024 us, buffer size: 32 bytes Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Fix error handling with malloc, memalign etc. Introduce xmemalign().Krzysztof Halasa2011-01-071-3/+3
|/ | | | | | | | | | | | | | The idea is to panic() when there is no memory available for normal operation. Exception: code which can consume arbitrary amount of RAM (example: files allocated in ramfs) must report error instead of panic(). This patch also fixes code which didn't check for NULL from malloc() etc. Usage: malloc(), memalign() return NULL when out of RAM. xmalloc(), xmemalign() always return non-NULL or panic(). Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix NOR CFI flash driver to work on big endian systems.Krzysztof Halasa2010-12-212-90/+62
| | | | | | | | | | | Fix NOR CFI flash driver to work on big endian systems. Basically this transforms the u8/u16/u32/u64 union into a single u64 value. Not tested on LE platform. Apply with caution. Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Cosmetic fixes, including format attributes for printf() and friends.Krzysztof Halasa2010-12-211-4/+4
| | | | | Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Flash CFI: removed unused 'size' variable.Krzysztof Halasa2010-12-211-2/+1
| | | | | Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi flash driver: check for ctrl-c during eraseSascha Hauer2010-12-201-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cfi_flash_amd: Add manufacturer-specific fixupsJean-Christophe PLAGNIOL-VILLARD2010-12-031-1/+38
| | | | | | | | | | | | | | | | Run fixups based on the JEDEC manufacturer ID independent of the command set ID. This changes current behaviour: Previously, geometry reversal for AMD chips were done based on the command set ID, while they are now done based on the JEDEC manufacturer and device ID. Also add fixup for top-boot Atmel chips. based on U-Boot Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: introduce flash cmdset fixupJean-Christophe PLAGNIOL-VILLARD2010-12-034-39/+52
| | | | | | | | | | | | Move fixing up like geometry reversal into separate functions. The geometry reversal fixup is now performed by altering the qry structure directly, which makes the sector init code slightly cleaner. based on U-Boot Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: move reset command assigment to specific chipset init functionJean-Christophe PLAGNIOL-VILLARD2010-12-033-6/+6
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: do not reset flash when probe failsJean-Christophe PLAGNIOL-VILLARD2010-12-031-1/+1
| | | | | | | | | | | | | | | | | The CFI flash driver starts at flash_init() which calls down into flash_get_size(). This starts by calling flash_detect_cfi(). If said function fails, flash_get_size() finishes by attempting to reset the flash. Unfortunately, it does this with an info->portwidth set to 0x10 which filters down into flash_make_cmd() and that happily smashes the stack by sticking info->portwidth bytes into a cfiword_t variable that lives on the stack. On a 64bit system you probably won't notice, but killing the last 8 bytes on a 32bit system usually leads to a corrupt return address. Which is what happens on a Blackfin system. based on U-Boot Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: Read whole QRY structure in one goJean-Christophe PLAGNIOL-VILLARD2010-12-032-85/+97
| | | | | | | | | | | Read out the whole CFI Standard Query structure after successful cfi identification. This allows subsequent code to access this information directly without having to go through flash_read_uchar() and friends. based on U-Boot Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: Introduce read and write accessorsJean-Christophe PLAGNIOL-VILLARD2010-12-034-79/+130
| | | | | | | | | | | | Introduce flash_read{8,16,32,64) and flash_write{8,16,32,64} and use them to access the flash memory. This makes it clearer when the flash is actually being accessed; merely dereferencing a volatile pointer looks just like any other kind of access. based on U-Boot Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: update manufacturer id flash supportJean-Christophe PLAGNIOL-VILLARD2010-12-034-4/+25
| | | | | | | | several first banks can contain 0x7f instead of actual ID support as done in linux Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: synchronize command offsets with Linux CFI driverJean-Christophe PLAGNIOL-VILLARD2010-12-032-11/+28
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: use amd and standard reset flash command at probingJean-Christophe PLAGNIOL-VILLARD2010-12-031-1/+2
| | | | | | as we do not known which flash we have yet Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* cfi_flash: move flash_read_uchar from inline to noinlineJean-Christophe PLAGNIOL-VILLARD2010-12-032-14/+16
| | | | | | | | it will reduce the binary size of 28 bytes and fix some issue observerd during the porting of the at91rm9200ek when reading the device_id and manufacturor_id Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>