diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 17 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 8 |
2 files changed, 18 insertions, 7 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 26b14f9fcac6..6bc9618af094 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -168,12 +168,25 @@ static inline int write_disable(struct m25p *flash) | |||
168 | */ | 168 | */ |
169 | static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) | 169 | static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) |
170 | { | 170 | { |
171 | int status; | ||
172 | bool need_wren = false; | ||
173 | |||
171 | switch (JEDEC_MFR(jedec_id)) { | 174 | switch (JEDEC_MFR(jedec_id)) { |
172 | case CFI_MFR_MACRONIX: | ||
173 | case CFI_MFR_ST: /* Micron, actually */ | 175 | case CFI_MFR_ST: /* Micron, actually */ |
176 | /* Some Micron need WREN command; all will accept it */ | ||
177 | need_wren = true; | ||
178 | case CFI_MFR_MACRONIX: | ||
174 | case 0xEF /* winbond */: | 179 | case 0xEF /* winbond */: |
180 | if (need_wren) | ||
181 | write_enable(flash); | ||
182 | |||
175 | flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; | 183 | flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; |
176 | return spi_write(flash->spi, flash->command, 1); | 184 | status = spi_write(flash->spi, flash->command, 1); |
185 | |||
186 | if (need_wren) | ||
187 | write_disable(flash); | ||
188 | |||
189 | return status; | ||
177 | default: | 190 | default: |
178 | /* Spansion style */ | 191 | /* Spansion style */ |
179 | flash->command[0] = OPCODE_BRWR; | 192 | flash->command[0] = OPCODE_BRWR; |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7ed4841327f2..d340b2f198c6 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, | |||
2869 | 2869 | ||
2870 | len = le16_to_cpu(p->ext_param_page_length) * 16; | 2870 | len = le16_to_cpu(p->ext_param_page_length) * 16; |
2871 | ep = kmalloc(len, GFP_KERNEL); | 2871 | ep = kmalloc(len, GFP_KERNEL); |
2872 | if (!ep) { | 2872 | if (!ep) |
2873 | ret = -ENOMEM; | 2873 | return -ENOMEM; |
2874 | goto ext_out; | ||
2875 | } | ||
2876 | 2874 | ||
2877 | /* Send our own NAND_CMD_PARAM. */ | 2875 | /* Send our own NAND_CMD_PARAM. */ |
2878 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); | 2876 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); |
@@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, | |||
2920 | } | 2918 | } |
2921 | 2919 | ||
2922 | pr_info("ONFI extended param page detected.\n"); | 2920 | pr_info("ONFI extended param page detected.\n"); |
2923 | return 0; | 2921 | ret = 0; |
2924 | 2922 | ||
2925 | ext_out: | 2923 | ext_out: |
2926 | kfree(ep); | 2924 | kfree(ep); |