1. 02 Sep, 2015 6 commits
    • Brian Norris's avatar
      mtd: spi-nor: fix NULL dereference when no match found in spi_nor_ids[] · 2ff46e6f
      Brian Norris authored
      Commit 06bb6f5a ("mtd: spi-nor: stop (ab)using struct
      spi_device_id") converted an array into a pointer, which means that
      we should be checking if the pointer goes anywhere, not whether the C
      string is empty. To do the latter means we dereference a NULL pointer
      when we reach the terminating entry, for which 'name' is now NULL
      instead of an array { 0, 0, ... }.
      
      Sample crash:
      
      [    1.101371] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [    1.109457] pgd = c0004000
      [    1.112157] [00000000] *pgd=00000000
      [    1.115736] Internal error: Oops: 5 [#1] SMP ARM
      [    1.120345] Modules linked in:
      [    1.123405] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.2.0-next-20150902+ #61
      [    1.130611] Hardware name: Rockchip (Device Tree)
      [    1.135306] task: ee0b8d40 ti: ee0ba000 task.ti: ee0ba000
      [    1.140697] PC is at spi_nor_scan+0x90/0x8c4
      [    1.144958] LR is at spi_nor_scan+0xa4/0x8c4
      ...
      [    1.504112] [<c03cc2e0>] (spi_nor_scan) from [<c03cb188>] (m25p_probe+0xc8/0x11c)
      [    1.511583] [<c03cb188>] (m25p_probe) from [<c03cd9d8>] (spi_drv_probe+0x60/0x7c)
      [    1.519055] [<c03cd9d8>] (spi_drv_probe) from [<c037faa0>] (driver_probe_device+0x1a0/0x444)
      [    1.527478] [<c037faa0>] (driver_probe_device) from [<c037fec8>] (__device_attach_driver+0x94/0xa0)
      [    1.536507] [<c037fec8>] (__device_attach_driver) from [<c037db3c>] (bus_for_each_drv+0x94/0xa4)
      [    1.545277] [<c037db3c>] (bus_for_each_drv) from [<c037f7e4>] (__device_attach+0xa4/0x144)
      [    1.553526] [<c037f7e4>] (__device_attach) from [<c0380058>] (device_initial_probe+0x1c/0x20)
      [    1.562035] [<c0380058>] (device_initial_probe) from [<c037ec88>] (bus_probe_device+0x38/0x94)
      [    1.570631] [<c037ec88>] (bus_probe_device) from [<c037ccf4>] (device_add+0x430/0x558)
      [    1.578534] [<c037ccf4>] (device_add) from [<c03d0240>] (spi_add_device+0xe4/0x174)
      [    1.586178] [<c03d0240>] (spi_add_device) from [<c03d0a24>] (spi_register_master+0x698/0x7d4)
      [    1.594688] [<c03d0a24>] (spi_register_master) from [<c03d0ba0>] (devm_spi_register_master+0x40/0x7c)
      [    1.603892] [<c03d0ba0>] (devm_spi_register_master) from [<c03d2fb4>] (rockchip_spi_probe+0x360/0x3f4)
      [    1.613182] [<c03d2fb4>] (rockchip_spi_probe) from [<c0381e34>] (platform_drv_probe+0x58/0xa8)
      [    1.621779] [<c0381e34>] (platform_drv_probe) from [<c037faa0>] (driver_probe_device+0x1a0/0x444)
      [    1.630635] [<c037faa0>] (driver_probe_device) from [<c037fdc4>] (__driver_attach+0x80/0xa4)
      [    1.639058] [<c037fdc4>] (__driver_attach) from [<c037e850>] (bus_for_each_dev+0x98/0xac)
      [    1.647221] [<c037e850>] (bus_for_each_dev) from [<c037f448>] (driver_attach+0x28/0x30)
      [    1.655210] [<c037f448>] (driver_attach) from [<c037ef74>] (bus_add_driver+0x128/0x250)
      [    1.663200] [<c037ef74>] (bus_add_driver) from [<c0380c40>] (driver_register+0xac/0xf0)
      [    1.671191] [<c0380c40>] (driver_register) from [<c0381d50>] (__platform_driver_register+0x58/0x6c)
      [    1.680221] [<c0381d50>] (__platform_driver_register) from [<c0a467c8>] (rockchip_spi_driver_init+0x18/0x20)
      [    1.690033] [<c0a467c8>] (rockchip_spi_driver_init) from [<c00098a4>] (do_one_initcall+0x124/0x1dc)
      [    1.699063] [<c00098a4>] (do_one_initcall) from [<c0a19f84>] (kernel_init_freeable+0x218/0x2ec)
      [    1.707748] [<c0a19f84>] (kernel_init_freeable) from [<c0719ed8>] (kernel_init+0x1c/0xf4)
      [    1.715912] [<c0719ed8>] (kernel_init) from [<c000fe50>] (ret_from_fork+0x14/0x24)
      [    1.723460] Code: e3510000 159f67c0 0a00000c e5961000 (e5d13000)
      [    1.729564] ---[ end trace 95baa6b3b861ce25 ]---
      
      Fixes: 06bb6f5a ("mtd: spi-nor: stop (ab)using struct spi_device_id")
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Cc: Rafał Miłecki <zajec5@gmail.com>
      2ff46e6f
    • Joachim Eastwood's avatar
      mtd: spi-nor: s25sl064p supports both dual and quad I/O · 0f12a27b
      Joachim Eastwood authored
      This chip can be found on Hitex LPC4350 Evaluation Board.
      Signed-off-by: default avatarJoachim Eastwood <manabian@gmail.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      0f12a27b
    • Jonas Gorski's avatar
      mtd: spi-nor: allow dual/quad reads on S25FL129P · c1752086
      Jonas Gorski authored
      According to the datasheet[1], both S25FL129P0 (256kB sectors) and
      S25FL129P1 (64kB sectors) support dual read, quad read, dual i/o read
      and quad i/o read.
      
      I have verified dual read to be working for S25FL129P1 on a dual
      capable spi controller. Quad as well as S25FL129P0 is untested, lacking
      hardware to verify.
      
      [1] http://www.spansion.com/Support/Datasheets/S25FL129P_00.pdfSigned-off-by: default avatarJonas Gorski <jogo@openwrt.org>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      c1752086
    • Roger Quadros's avatar
      mtd: nand: omap2: Rename shippable module to omap2_nand · 092f05c3
      Roger Quadros authored
      As both omap2 onenand and omap2 nand driver modules are
      named the same i.e. "omap2.ko", only one of them gets shipped
      during MODPOST if both are configured as loadable modules.
      
      To avoid this ambiguity let's ship the omap2 nand
      driver as "omap2_nand.ko"
      
      Reported by Pierre Neyron via github
      https://github.com/beagleboard/linux/issues/40
      
      Cc: Robert Nelson <robertcnelson@gmail.com>
      Signed-off-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      092f05c3
    • Alexis Ballier's avatar
      mtd: spi-nor: Add support for sst25wf020a · a1d97ef9
      Alexis Ballier authored
      It is a 256KiB flash with 4 KiB erase sectors
      and 64KiB overlay blocks.
      
      This is the one available on Hardkernel's Odroid U3 shield.
      Signed-off-by: default avatarAlexis Ballier <aballier@gentoo.org>
      [Brian: seems like this does NOT require the usual SST_WRITE hacks]
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      a1d97ef9
    • Mika Westerberg's avatar
      mtd: spi-nor: Add support for Micron n25q064a serial flash · 2a06c7b1
      Mika Westerberg authored
      Add Micron (n25q064a) 8MB flash to the list of supported chips.
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: default avatarJagan Teki <jteki@openedev.com>
      [Brian: fixup context]
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      2a06c7b1
  2. 27 Aug, 2015 1 commit
  3. 25 Aug, 2015 3 commits
  4. 22 Aug, 2015 1 commit
  5. 19 Aug, 2015 11 commits
  6. 14 Aug, 2015 5 commits
  7. 07 Aug, 2015 1 commit
  8. 06 Aug, 2015 10 commits
  9. 21 Jul, 2015 1 commit
    • Brian Norris's avatar
      mtd: m25p80: allow arbitrary OF matching for "jedec,spi-nor" · 43163022
      Brian Norris authored
      When we added the "jedec,spi-nor" compatible string for use in this
      driver, we added it as a modalias option. The modalias can be derived in
      different ways for platform devices vs. device tree (of_*) matching. But
      for device tree matching (the primary target of this identifier string),
      the modalias is determined from the first entry in the 'compatible'
      property. IOW, the following properties would bind to this driver:
      
      	// Option (a), modalias = "spi-nor"
      	compatible = "jedec,spi-nor";
      
      	// Option (b), modalias = "spi-nor"
      	compatible = "idontknowwhatimdoing,spi-nor";
      
      But the following would not:
      
      	// Option (c), modalias = "shinynewdevice"
      	compatible = "myvendor,shinynewdevice", "jedec,spi-nor";
      
      So, we'd like to match (a) and (c) (even when we don't have an explicit
      entry for "shinynewdevice"), and we'd rather not allow (b).
      
      To do this, we
        (1) always (for devices without specific platform data) pass the
            modalias to the spi-nor library;
        (2) rework the spi-nor library to not reject "bad" names, and
            instead just fall back to autodetection; and
        (3) add the .of_match_table to properly catch all "jedec,spi-nor".
      
      This allows (a) and (c) without warnings, and rejects (b).
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      43163022
  10. 20 Jul, 2015 1 commit