aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:48:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-18 14:48:03 -0400
commit511c41d9e6665a07aca94eb00983cf6d77dd87ff (patch)
treef9933c61d0bc902c49832bcfc24d65cfe0b34529 /drivers/mtd/maps
parent88ed806abb981cc8ec61ee7fab93ecfe63521ebf (diff)
parent8b3d58e554453ab858bbb169d93b7321bdc628d4 (diff)
Merge tag 'for-linus-20141015' of git://git.infradead.org/linux-mtd
Pull MTD update from Brian Norris: "Sorry for delaying this a bit later than usual. There's one mild regression from 3.16 that was noticed during the 3.17 cycle, and I meant to send a fix for it along with this pull request. I'll probably try to queue it up for a later pull request once I've had a better look at it, hopefully by -rc2 at the latest. Summary for this pull: NAND - Cleanup for Denali driver - Atmel: add support for new page sizes - Atmel: fix up 'raw' mode support - Atmel: miscellaneous cleanups - New timing mode helpers for non-ONFI NAND - OMAP: allow driver to be (properly) built as a module - bcm47xx: RESET support and other cleanups SPI NOR - Miscellaneous cleanups, to prepare framework for wider use (some further work still pending) - Compile-time configuration to select 4K vs. 64K support for flash that support both (necessary for using UBIFS on some SPI NOR) A few scattered code quality fixes, detected by Coverity See the changesets for more" * tag 'for-linus-20141015' of git://git.infradead.org/linux-mtd: (59 commits) mtd: nand: omap: Correct CONFIG_MTD_NAND_OMAP_BCH help message mtd: nand: Force omap_elm to be built as a module if omap2_nand is a module mtd: move support for struct flash_platform_data into m25p80 mtd: spi-nor: add Kconfig option to disable 4K sectors mtd: nand: Move ELM driver and rename as omap_elm nand: omap2: Replace pr_err with dev_err nand: omap2: Remove horrible ifdefs to fix module probe mtd: nand: add Hynix's H27UCG8T2ATR-BC to nand_ids table mtd: nand: support ONFI timing mode retrieval for non-ONFI NANDs mtd: physmap_of: Add non-obsolete map_rom probe mtd: physmap_of: Fix ROM support via OF MAINTAINERS: add l2-mtd.git, 'next' tree for MTD mtd: denali: fix indents and other trivial things mtd: denali: remove unnecessary parentheses mtd: denali: remove another set-but-unused variable mtd: denali: fix include guard and license block of denali.h mtd: nand: don't break long print messages mtd: bcm47xxnflash: replace some magic numbers mtd: bcm47xxnflash: NAND_CMD_RESET support mtd: bcm47xxnflash: add cmd_ctrl handler ...
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig2
-rw-r--r--drivers/mtd/maps/gpio-addr-flash.c42
-rw-r--r--drivers/mtd/maps/pcmciamtd.c2
-rw-r--r--drivers/mtd/maps/physmap_of.c6
4 files changed, 35 insertions, 17 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 21b2874a303b..ba801d2c6dcc 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -249,7 +249,7 @@ config MTD_CFI_FLAGADM
249 249
250config MTD_SOLUTIONENGINE 250config MTD_SOLUTIONENGINE
251 tristate "CFI Flash device mapped on Hitachi SolutionEngine" 251 tristate "CFI Flash device mapped on Hitachi SolutionEngine"
252 depends on SUPERH && SOLUTION_ENGINE && MTD_CFI && MTD_REDBOOT_PARTS 252 depends on SOLUTION_ENGINE && MTD_CFI && MTD_REDBOOT_PARTS
253 help 253 help
254 This enables access to the flash chips on the Hitachi SolutionEngine and 254 This enables access to the flash chips on the Hitachi SolutionEngine and
255 similar boards. Say 'Y' if you are building a kernel for such a board. 255 similar boards. Say 'Y' if you are building a kernel for such a board.
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
index a4c477b9fdd6..2fb346091af2 100644
--- a/drivers/mtd/maps/gpio-addr-flash.c
+++ b/drivers/mtd/maps/gpio-addr-flash.c
@@ -99,22 +99,28 @@ static map_word gf_read(struct map_info *map, unsigned long ofs)
99 * @from: flash offset to copy from 99 * @from: flash offset to copy from
100 * @len: how much to copy 100 * @len: how much to copy
101 * 101 *
102 * We rely on the MTD layer to chunk up copies such that a single request here 102 * The "from" region may straddle more than one window, so toggle the GPIOs for
103 * will not cross a window size. This allows us to only wiggle the GPIOs once 103 * each window region before reading its data.
104 * before falling back to a normal memcpy. Reading the higher layer code shows
105 * that this is indeed the case, but add a BUG_ON() to future proof.
106 */ 104 */
107static void gf_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) 105static void gf_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
108{ 106{
109 struct async_state *state = gf_map_info_to_state(map); 107 struct async_state *state = gf_map_info_to_state(map);
110 108
111 gf_set_gpios(state, from); 109 int this_len;
112 110
113 /* BUG if operation crosses the win_size */ 111 while (len) {
114 BUG_ON(!((from + len) % state->win_size <= (from + len))); 112 if ((from % state->win_size) + len > state->win_size)
113 this_len = state->win_size - (from % state->win_size);
114 else
115 this_len = len;
115 116
116 /* operation does not cross the win_size, so one shot it */ 117 gf_set_gpios(state, from);
117 memcpy_fromio(to, map->virt + (from % state->win_size), len); 118 memcpy_fromio(to, map->virt + (from % state->win_size),
119 this_len);
120 len -= this_len;
121 from += this_len;
122 to += this_len;
123 }
118} 124}
119 125
120/** 126/**
@@ -147,13 +153,21 @@ static void gf_copy_to(struct map_info *map, unsigned long to,
147{ 153{
148 struct async_state *state = gf_map_info_to_state(map); 154 struct async_state *state = gf_map_info_to_state(map);
149 155
150 gf_set_gpios(state, to); 156 int this_len;
157
158 while (len) {
159 if ((to % state->win_size) + len > state->win_size)
160 this_len = state->win_size - (to % state->win_size);
161 else
162 this_len = len;
151 163
152 /* BUG if operation crosses the win_size */ 164 gf_set_gpios(state, to);
153 BUG_ON(!((to + len) % state->win_size <= (to + len))); 165 memcpy_toio(map->virt + (to % state->win_size), from, len);
154 166
155 /* operation does not cross the win_size, so one shot it */ 167 len -= this_len;
156 memcpy_toio(map->virt + (to % state->win_size), from, len); 168 to += this_len;
169 from += this_len;
170 }
157} 171}
158 172
159static const char * const part_probe_types[] = { 173static const char * const part_probe_types[] = {
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index a3cfad392ed6..af747af5eee9 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -89,7 +89,7 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
89 89
90 if (!pcmcia_dev_present(dev->p_dev)) { 90 if (!pcmcia_dev_present(dev->p_dev)) {
91 pr_debug("device removed\n"); 91 pr_debug("device removed\n");
92 return 0; 92 return NULL;
93 } 93 }
94 94
95 offset = to & ~(dev->win_size-1); 95 offset = to & ~(dev->win_size-1);
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 217c25d7381b..c1d21cb501ca 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -103,7 +103,7 @@ static struct mtd_info *obsolete_probe(struct platform_device *dev,
103 if (strcmp(of_probe, "ROM") != 0) 103 if (strcmp(of_probe, "ROM") != 0)
104 dev_warn(&dev->dev, "obsolete_probe: don't know probe " 104 dev_warn(&dev->dev, "obsolete_probe: don't know probe "
105 "type '%s', mapping as rom\n", of_probe); 105 "type '%s', mapping as rom\n", of_probe);
106 return do_map_probe("mtd_rom", map); 106 return do_map_probe("map_rom", map);
107 } 107 }
108} 108}
109 109
@@ -340,6 +340,10 @@ static struct of_device_id of_flash_match[] = {
340 .data = (void *)"map_ram", 340 .data = (void *)"map_ram",
341 }, 341 },
342 { 342 {
343 .compatible = "mtd-rom",
344 .data = (void *)"map_rom",
345 },
346 {
343 .type = "rom", 347 .type = "rom",
344 .compatible = "direct-mapped" 348 .compatible = "direct-mapped"
345 }, 349 },