summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/physmap_of.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: physmap_of: add a hook for Versatile write protectionLinus Walleij2016-04-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support device tree probing of Versatile NOR flash chips, there must be a way to add the VPP (write protection) enable/disable callback. The register in question is in the system controllers of these machines. Apart from this quirk, the ARM flash chips are standard CFI flash chips from various vendors. Additionally, the Integrator/AP require you to set up the external bus interface (EBI) to allow writes to the chip select where the flash memory is connected. Solve this by looking for the arm,versatile-flash compatible string in the flash device tree node. In the driver, add a special hook to check for the various Versatile syscons and register a callback for .set_vpp() if this compatible is present. Provide a special Kconfig entry for the addon hook so it will not be compiled in if the Versatile boards are not supported. Stubs in the header file make sure the impact will be zero on other platforms. (Compilers optimze this out.) With this patch, a large slew of ARM board file code can be removed. Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* mtd: physmap_of: assign parent for the concatenated MTDBrian Norris2015-11-111-0/+1
| | | | | | | | | | | If there is more than one map region for this device, then the concatenated MTD will not have a parent device assigned to it -- only the sub-devices (which are not actually registered with the framework) will have their parents assigned. Let's assign the concatenated device correctly. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: drop unnecessary partition parser dataBrian Norris2015-11-111-3/+2Star
| | | | | | | | | | | | | We should assign the MTD dev.of_node instead of the parser data field. This gets us the equivalent partition parser behavior with fewer special fields and parameter passing. Also convert several of these to mtd_device_register(), since we don't need the 2nd and 3rd parameters anymore. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
* mtd: maps: physmap_of: drop owner assignmentFrans Klaver2015-10-131-1/+0Star
| | | | | | | Owner is automatically set by mtdcore. Make use of that. Signed-off-by: Frans Klaver <fransklaver@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: physmap_of: fix null pointer deference when kzalloc returns nullColin Ian King2015-08-191-0/+6
| | | | | | | | | | | | | static analysis by smatch caught the following error: drivers/mtd/maps/physmap_of.c:135 of_get_probes() error: potential null dereference 'res'. (kzalloc returns null) Check for failed kzalloc and return -ENOMEM in of_flash_probe if this occurs. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: constify of_device_id arrayFabian Frederick2015-05-071-2/+2
| | | | | | | | of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: physmap_of: Add read-only fallbackJoe Schultz2015-01-101-0/+10
| | | | | | | | | | | | | | Previously, when probing a CFI chip which was write-protected at the hardware level, the probe would fail due to the fact it could not put the chip into QUERY mode. This would result in no MTD devices being created. Add a fallback to probe using the map_rom driver if the user-selected probe fails. Signed-off-by: Joe Schultz <jschultz@xes-inc.com> Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* Merge tag 'for-linus-20141215' of git://git.infradead.org/linux-mtdLinus Torvalds2014-12-171-5/+3Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull MTD updates from Brian Norris: "Summary: - Add device tree support for DoC3 - SPI NOR: Refactoring, for better layering between spi-nor.c and its driver users (e.g., m25p80.c) New flash device support Support 6-byte ID strings - NAND: New NAND driver for Allwinner SoC's (sunxi) GPMI NAND: add support for raw (no ECC) access, for testing purposes Add ATO manufacturer ID A few odd driver fixes - MTD tests: Allow testers to compensate for OOB bitflips in oobtest Fix a torturetest regression - nandsim: Support longer ID byte strings And more" * tag 'for-linus-20141215' of git://git.infradead.org/linux-mtd: (63 commits) mtd: tests: abort torturetest on erase errors mtd: physmap_of: fix potential NULL dereference mtd: spi-nor: allow NULL as chip name and try to auto detect it mtd: nand: gpmi: add raw oob access functions mtd: nand: gpmi: add proper raw access support mtd: nand: gpmi: add gpmi_copy_bits function mtd: spi-nor: factor out write_enable() for erase commands mtd: spi-nor: add support for s25fl128s mtd: spi-nor: remove the jedec_id/ext_id mtd: spi-nor: add id/id_len for flash_info{} mtd: nand: correct the comment of function nand_block_isreserved() jffs2: Drop bogus if in comment mtd: atmel_nand: replace memcpy32_toio/memcpy32_fromio with memcpy mtd: cafe_nand: drop duplicate .write_page implementation mtd: m25p80: Add support for serial flash Spansion S25FL132K MTD: m25p80: fix inconsistency in m25p_ids compared to spi_nor_ids mtd: spi-nor: improve wait-till-ready timeout loop mtd: delete unnecessary checks before two function calls mtd: nand: omap: Fix NAND enumeration on 3430 LDP mtd: nand: add ATO manufacturer info ...
| * mtd: physmap_of: fix potential NULL dereferenceArd Biesheuvel2014-12-131-5/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On device remove, when testing the cmtd field of an of_flash struct to decide whether it is a concatenated device or not, we get a false positive on cmtd == NULL, and dereference it subsequently. This may occur if of_flash_remove() is called from the cleanup path of of_flash_probe(). Instead, test for NULL first, and only then perform the test for a concatenated device. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* | mtd: maps: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0Star
|/ | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* mtd: physmap_of: Add non-obsolete map_rom probeAaron Sierra2014-09-221-0/+4
| | | | | | | | | | | | Previously, the only way to map a NOR device as a simple ROM was to use the obsolete "direct-mapped" compatible binding (which further requires device_type = "nor" and probe-type = "NOR" properties). This patch adds an "mtd-rom" compatible binding to the "map_rom" probe type. Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: physmap_of: Fix ROM support via OFAaron Sierra2014-09-221-1/+1
| | | | | | | | | The "ROM" and unknown probe types within the obsolete "direct-mapped" probe function used the nonexistent "mtd_rom" probe instead of the intended "map_rom". Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: delete non-required instances of include <linux/init.h>Paul Gortmaker2014-03-111-1/+0Star
| | | | | | | | | | | | | | None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: David Woodhouse <dwmw2@infradead.org> Cc: Brian Norris <computersforpeace@gmail.com> Cc: linux-mtd@lists.infradead.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> [Brian: dropped one incorrect hunk] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* mtd: physmap_of: add const qualifiersArtem Bityutskiy2013-04-051-7/+9
| | | | | | | Be a bit stricter and add few more 'const' qualifiers. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* Merge tag 'for-linus-20130301' of git://git.infradead.org/linux-mtdLinus Torvalds2013-03-031-5/+4Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull MTD update from David Woodhouse: "Fairly unexciting MTD merge for 3.9: - misc clean-ups in the MTD command-line partitioning parser (cmdlinepart) - add flash locking support for STmicro chips serial flash chips, as well as for CFI command set 2 chips. - new driver for the ELM error correction HW module found in various TI chips, enable the OMAP NAND driver to use the ELM HW error correction - added number of new serial flash IDs - various fixes and improvements in the gpmi NAND driver - bcm47xx NAND driver improvements - make the mtdpart module actually removable" * tag 'for-linus-20130301' of git://git.infradead.org/linux-mtd: (45 commits) mtd: map: BUG() in non handled cases mtd: bcm47xxnflash: use pr_fmt for module prefix in messages mtd: davinci_nand: Use managed resources mtd: mtd_torturetest can cause stack overflows mtd: physmap_of: Convert device allocation to managed devm_kzalloc() mtd: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement. mtd: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional. mtd: atmel_nand: avoid to report an error when lookup table offset is 0. mtd: bcm47xxsflash: adjust names of bus-specific functions mtd: bcm47xxpart: improve probing of nvram partition mtd: bcm47xxpart: add support for other erase sizes mtd: bcm47xxnflash: register this as normal driver mtd: bcm47xxnflash: fix message mtd: bcm47xxsflash: register this as normal driver mtd: bcm47xxsflash: write number of written bytes mtd: gpmi: add sanity check for the ECC mtd: gpmi: set the Golois Field bit for mx6q's BCH mtd: devices: elm: Removes <xx> literals in elm DT node mtd: gpmi: fix a dereferencing freed memory error mtd: fix the wrong timeo for panic_nand_wait() ...
| * mtd: physmap_of: Convert device allocation to managed devm_kzalloc()Ezequiel Garcia2013-02-121-5/+3Star
| | | | | | | | | | Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| * mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) lockingStefan Roese2013-02-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently cfi_cmdset_0002.c does not support PPB locking of sectors. This patch adds support for this locking/unlocking mechanism. It is needed on some platforms, since newer U-Boot versions do support this PPB locking and protect for example their environment sector(s) this way. This PPB locking/unlocking will be enabled for all devices supported by cfi_cmdset_0002 reporting 8 in the CFI word 0x49 (Sector Protect/Unprotect scheme). Please note that PPB locking does support sector-by-sector locking. But the whole chip can only be unlocked together. So unlocking one sector will automatically unlock all sectors of this device. Because of this chip limitation, the PPB unlocking function saves the current locking status of all sectors before unlocking the whole device. After unlocking the saved locking status is re-configured. This way only the addressed sectors will be unlocked. To selectively enable this advanced sector protection mechanism, the device-tree property "use-advanced-sector-protection" has been created. To enable support for this locking this property needs to be present in the flash DT node. E.g.: nor_flash@0,0 { compatible = "amd,s29gl256n", "cfi-flash"; bank-width = <2>; use-advanced-sector-protection; ... Tested with Spansion S29GL512S10THI and Micron JS28F512M29EWx flash devices. Signed-off-by: Stefan Roese <sr@denx.de> Tested-by: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* | Merge tag 'for-linus-20130204' of git://git.infradead.org/linux-mtdLinus Torvalds2013-02-041-1/+1
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull MTD fixes from David Woodhouse: "A small set of simple regression and build fixes for 3.8: - Fix a warning introduced in ONFI NAND probe - Fix commandline partition parsing - Require BITREVERSE for DiskOnChip G3 driver - Fix build failure for davinci_nand as module - Bump NFLASH_READY_RETRIES for bcm47xxnflash" * tag 'for-linus-20130204' of git://git.infradead.org/linux-mtd: mtd: nand: onfi don't WARN if we are in 16 bits mode mtd: physmap_of: fix cmdline partition method w/o linux, mtd-name mtd: docg3 fix missing bitreverse lib mtd: davinci_nand: fix modular build with CONFIG_OF=y mtd: bcm47xxnflash: increase NFLASH_READY_RETRIES
| * mtd: physmap_of: fix cmdline partition method w/o linux, mtd-nameBaruch Siach2013-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Commit d68cbdd4fb (mtd: physmap_of: allow to specify the mtd name for retro compatiblity) broke cmdline partitioning using dev_name() in the kernel command line. of_property_read_string() does not touch mtd_name when linux,mtd-name is not present in the device tree, which causes map.name to be set to a random value. Fix this by initializing mtd_name to NULL. Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* | Drivers: mtd: remove __dev* attributes.Greg Kroah-Hartman2013-01-041-1/+1
|/ | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mtd: physmap_of: error checking to prevent a NULL pointer dereferenceAnton Prins2012-12-101-2/+4
| | | | | | | | | | | | | | | This patch solves a NULL pointer dereference, this may occur if the tuple is not mappable (jumps to continue in the for-loop). Out of the loop possible results are: - info->list_size == 0 if no of the tuples is mappable - info->list_size == 1 - info->list_size > 1 If no one of the supplied tuples is mappable (info->list_size == 0) and info->cmtd will not be set. But it is used in mtd_device_parse_register, OOPS! actually it should generate an error in this case! Signed-off-by: Anton Prins <anton.prins@nl.bosch.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* mtd: remove use of __devinitBill Pemberton2012-11-221-4/+4
| | | | | | | | CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* mtd: physmap_of: allow to specify the mtd name for retro compatiblityJean-Christophe PLAGNIOL-VILLARD2012-11-161-1/+4
| | | | | | | | | linux,mtd-name allow to specify the mtd name for retro capability with physmap-flash drivers as boot loader pass the mtd partition via the old device name physmap-flash. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
* mtd: physmap_of: Add "no-unaligned-direct-access" DT propertyStefan Roese2012-09-291-0/+14
| | | | | | | | | | | | On some platforms (e.g. MPC5200) a direct 1:1 mapping may cause problems with JFFS2 usage, as the local bus (LPB) doesn't support unaligned accesses as implemented in the JFFS2 code via memcpy(). By defining "no-unaligned-direct-access", the flash will not be exposed directly to the MTD users (e.g. JFFS2) any more. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: convert drivers/mtd/* to use module_platform_driver()Axel Lin2012-01-091-12/+1Star
| | | | | | | | | | | | This patch converts the drivers in drivers/mtd/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked by: Haojian Zhuang <haojian.zhuang@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: physmap_of.c: use mtd_device_parse_registerDmitry Eremin-Solenikov2011-09-111-15/+3Star
| | | | | | | | | Replace custom invocations of parse_mtd_partitions and mtd_device_register with common mtd_device_parse_register call. This would bring: standard handling of all errors, fallback to default partitions, etc. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
* mtd: physmap_of: move parse_obsolete_partitions to become separate parserDmitry Eremin-Solenikov2011-09-111-52/+1Star
| | | | | | | | Move parse_obsolete_partitions() to ofpart.c and register it as an ofoldpart partitions parser. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
* mtd: physmap_of: use ofpart through generic parsingDmitry Eremin-Solenikov2011-09-111-8/+5Star
| | | | | | | | Convert the driver to use ofpart partitions parsing through the generic parse_mtd_partitions(). Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
* mtd: physmap: convert to mtd_device_register()Jamie Iles2011-05-251-26/+4Star
| | | | | | | | | Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS preprocessor conditionals as partitioning is always available. Signed-off-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* drivercore: revert addition of of_match to struct deviceGrant Likely2011-05-181-2/+5
| | | | | | | | | | | | | | | Commit b826291c, "drivercore/dt: add a match table pointer to struct device" added an of_match pointer to struct device to cache the of_match_table entry discovered at driver match time. This was unsafe because matching is not an atomic operation with probing a driver. If two or more drivers are attempted to be matched to a driver at the same time, then the cached matching entry pointer could get overwritten. This patch reverts the of_match cache pointer and reworks all users to call of_match_device() directly instead. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* Merge branch 'master' of ↵Artem Bityutskiy2011-03-251-6/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus-1 * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6: (9356 commits) [media] rc: update for bitop name changes fs: simplify iget & friends fs: pull inode->i_lock up out of writeback_single_inode fs: rename inode_lock to inode_hash_lock fs: move i_wb_list out from under inode_lock fs: move i_sb_list out from under inode_lock fs: remove inode_lock from iput_final and prune_icache fs: Lock the inode LRU list separately fs: factor inode disposal fs: protect inode->i_state with inode->i_lock lib, arch: add filter argument to show_mem and fix private implementations SLUB: Write to per cpu data when allocating it slub: Fix debugobjects with lockless fastpath autofs4: Do not potentially dereference NULL pointer returned by fget() in autofs_dev_ioctl_setpipefd() autofs4 - remove autofs4_lock autofs4 - fix d_manage() return on rcu-walk autofs4 - fix autofs4_expire_indirect() traversal autofs4 - fix dentry leak in autofs4_expire_direct() autofs4 - reinstate last used update on access vfs - check non-mountpoint dentry might block in __follow_mount_rcu() ... NOTE! This merge commit was created to fix compilation error. The block tree was merged upstream and removed the 'elv_queue_empty()' function which the new 'mtdswap' driver is using. So a simple merge of the mtd tree with upstream does not compile. And the mtd tree has already be published, so re-basing it is not an option. To fix this unfortunate situation, I had to merge upstream into the mtd-2.6.git tree without committing, put the fixup patch on top of this, and then commit this. The result is that we do not have commits which do not compile. In other words, this merge commit "merges" 3 things: the MTD tree, the upstream tree, and the fixup patch.
| * dt: Eliminate of_platform_{,un}register_driverGrant Likely2011-02-281-6/+9
| | | | | | | | | | | | | | | | | | Final step to eliminate of_platform_bus_type. They're all just platform drivers now. v2: fix type in pasemi_nand.c (thanks to Stephen Rothwell) Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* | mtd: drop CONFIG_MTD_CONCAT ifdefsDmitry Eremin-Solenikov2011-03-111-8/+0Star
|/ | | | | | | | | | As MTD_CONCAT is becoming a part of mtd core, it's now meaningless to to check for it in ifdefs. Drop such references from MTD code. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Acked-by: Stefan Roese <sr@denx.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: maps: Use printf extension %pR for struct resourceJoe Perches2010-12-031-3/+1Star
| | | | | | | | Using %pR standardizes the struct resource output. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: physmap_of: Loop through all "reg" tuples for mappingStefan Roese2010-10-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the loop over the "reg" tuples to not exit directly upon of_address_to_resource() failure but to continue with the next "reg" tuple instead. This failure could be due to size = 0, which might be passed via the device-tree. This is needed for boards, where a "reg" tuple might have size 0 (of_address_to_resource() returns with EINVAL when size = 0). Example: Fully equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00400000>; Partially equipped board: reg = <0 0x00000000 0x00400000 0 0x00400000 0x00000000>; This could be the case on boards with runtime detection of multiple NOR flash configurations where the detected flash size is inserted into the dtb in U-Boot. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: Fix endianness issues from device treeIan Munsie2010-10-251-7/+7
| | | | | | | | | | This patch adds the appropriate conversions to correct the endianness issues in the MTD driver whenever it accesses the device tree (which is always big endian). Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* of: fix missing headers for of_address_to_resource() in MTD and SysACE driversGraeme Smecher2010-08-171-0/+1
| | | | | | | | | The drivers for Xilinx' SystemACE and physically mapped MTDs were missing prototypes for of_address_to_resource(). This patch adds the necessary headers. Signed-off-by: Graeme Smecher <graeme.smecher@mail.mcgill.ca> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds2010-08-121-4/+4
|\ | | | | | | | | | | | | * 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: mmc_spi: Fix unterminated of_match_table of/sparc: fix build regression from of_device changes of/device: Replace struct of_device with struct platform_device
| * of/device: Replace struct of_device with struct platform_deviceGrant Likely2010-08-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_device is just an alias for platform_device, so remove it entirely. Also replace to_of_device() with to_platform_device() and update comment blocks. This patch was initially generated from the following semantic patch, and then edited by hand to pick up the bits that coccinelle didn't catch. @@ @@ -struct of_device +struct platform_device Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Reviewed-by: David S. Miller <davem@davemloft.net>
* | Merge git://git.infradead.org/mtd-2.6Linus Torvalds2010-08-101-3/+3
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.infradead.org/mtd-2.6: (79 commits) mtd: Remove obsolete <mtd/compatmac.h> include mtd: Update copyright notices jffs2: Update copyright notices mtd-physmap: add support users can assign the probe type in board files mtd: remove redwood map driver mxc_nand: Add v3 (i.MX51) Support mxc_nand: support 8bit ecc mxc_nand: fix correct_data function mxc_nand: add V1_V2 namespace to registers mxc_nand: factor out a check_int function mxc_nand: make some internally used functions overwriteable mxc_nand: rework get_dev_status mxc_nand: remove 0xe00 offset from registers mtd: denali: Add multi connected NAND support mtd: denali: Remove set_ecc_config function mtd: denali: Remove unuseful code in get_xx_nand_para functions mtd: denali: Remove device_info_tag structure mtd: m25p80: add support for the Winbond W25Q32 SPI flash chip mtd: m25p80: add support for the Intel/Numonyx {16,32,64}0S33B SPI flash chips mtd: m25p80: add support for the EON EN25P{32, 64} SPI flash chips ... Fix up trivial conflicts in drivers/mtd/maps/{Kconfig,redwood.c} due to redwood driver removal.
| * drivers/mtd/maps: introduce missing kfreeJulia Lawall2010-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...); ... if (x == NULL) S <... when != x when != if (...) { <+...x...+> } ( x->f1 = E | (x->f1 == NULL || ...) | f(...,x->f1,...) ) ...> ( return \(0\|<+...x...+>\|ptr\); | return@p2 ...; ) @script:python@ p1 << r.p1; p2 << r.p2; @@ print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* | Merge remote branch 'origin' into secretlab/next-devicetreeGrant Likely2010-05-221-6/+49
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
| * mtd: extend physmap_of to let the device tree specify the parition probeJason Gunthorpe2010-05-141-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | This is to support custom partitioning schemes for embedded PPC. To use define your own mtd_part_parser and then add something like: linux,part-probe = "my_probe", "cmdlinepart"; To the board's dts file. If linux,part-probe is not specified then this behaves the same as before. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| * Merge branch 'master' of ↵David Woodhouse2010-05-101-0/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: drivers/mtd/mtdcore.c Pull in the bdi fixes and ARM platform changes that other outstanding patches depend on.
| * | mtd: physmap_of: Correct the size argument to kzallocJulia Lawall2010-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtd_list has type struct mtd_info **, not struct mtd_info *, so the elements of the array should have pointer type, not structure type. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @disable sizeof_type_expr@ type T; T **x; @@ x = <+...sizeof( - T + *x )...+> // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* | | of: Remove duplicate fields from of_platform_driverGrant Likely2010-05-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .name, .match_table and .owner are duplicated in both of_platform_driver and device_driver. This patch is a removes the extra copies from struct of_platform_driver and converts all users to the device_driver members. This patch is a pretty mechanical change. The usage model doesn't change and if any drivers have been missed, or if anything has been fixed up incorrectly, then it will fail with a compile time error, and the fixup will be trivial. This patch looks big and scary because it touches so many files, but it should be pretty safe. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Sean MacLennan <smaclennan@pikatech.com>
* | | of: Always use 'struct device.of_node' to get device node pointer.Grant Likely2010-05-191-3/+3
| |/ |/| | | | | | | | | | | | | | | | | | | | | The following structure elements duplicate the information in 'struct device.of_node' and so are being eliminated. This patch makes all readers of these elements use device.of_node instead. (struct of_device *)->node (struct dev_archdata *)->prom_node (sparc) (struct dev_archdata *)->of_node (powerpc & microblaze) Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* | include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* mtd: maps: add mtd-ram support to physmap_ofWolfram Sang2009-09-191-0/+4
| | | | | | | | | | | | | | | | | Use physmap_of to access RAMs as mtd and add documenation for it. This approach is a lot less intrusive as adding an of-wrapper around plat-ram.c. As most extensions of plat-ram.c (e.g. custom map-functions) can't be mapped to the device tree anyhow, extending physmap_of seems to be the cleanest approach. Tested with a phyCORE-MPC5121e. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Vitaly Wool <vwool@ru.mvista.com> Cc: Artem Bityutskiy <dedekind@infradead.org> Cc: Ken MacLeod <ken@bitsko.slc.ut.us> Cc: Albrecht Dreß <albrecht.dress@arcor.de> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: physmap_of: fix incorrect checkvimal singh2009-09-041-6/+7
| | | | | | | | | | | | | | | This patch fixes a spelling error that has resulted from copy and pasting. The location of the error was found using a semantic patch but the semantic patch was not trying to find these errors. After looking things over it seemed logical that this change was needed. The patch also makes sure mtd_list is not being freed if it has not been allocated Signed-off-by: Stoyan Gaydarov <sgayda2@uiuc.edu> Signed-off-by: Vimal Singh <vimalsingh@ti.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>