Skip to content

Commit 46550cf

Browse files
author
Graham Moore
committed
FogBugz #190315: QSPI broken in 3.10-ltsi
The m25p80.c file had some incorrect code due to merge conflicts. The code is now fixed. Signed-off-by: Graham Moore <[email protected]>
1 parent fe7c7b7 commit 46550cf

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

drivers/mtd/devices/m25p80.c

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,7 @@ static int read_fsr(struct m25p *flash)
172172
*/
173173
static int read_sr(struct m25p *flash)
174174
{
175-
ssize_t retval;
176-
u8 code = OPCODE_RFSR;
177-
u8 val;
178-
179-
retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
180-
181-
if (retval < 0) {
182-
dev_err(&flash->spi->dev, "error %d reading SR\n",
183-
(int) retval);
184-
return retval;
185-
}
186-
187-
return val;
175+
return read_spi_reg(flash, OPCODE_RDSR, "SR");
188176
}
189177

190178
/*
@@ -327,7 +315,7 @@ static int write_ear(struct m25p *flash, u32 addr)
327315
int ret;
328316

329317
/* Wait until finished previous write command. */
330-
if (_wait_till_ready(flash))
318+
if (flash->wait_till_ready(flash))
331319
return 1;
332320

333321
if (flash->mtd.size <= (0x1000000) << flash->shift)
@@ -646,6 +634,7 @@ static int m25p80_read_ext(struct mtd_info *mtd, loff_t from, size_t len,
646634
*retlen = read_count;
647635

648636
mutex_unlock(&flash->lock);
637+
649638
return 0;
650639
}
651640

@@ -676,10 +665,8 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
676665
spi_message_add_tail(&t[1], &m);
677666

678667
/* Wait until finished previous write command. */
679-
if (flash->wait_till_ready(flash)) {
680-
mutex_unlock(&flash->lock);
668+
if (flash->wait_till_ready(flash))
681669
return 1;
682-
}
683670

684671
write_enable(flash);
685672

@@ -732,8 +719,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
732719

733720
flash->wait_till_ready(flash);
734721

735-
mutex_unlock(&flash->lock);
736-
737722
return 0;
738723
}
739724

@@ -996,11 +981,11 @@ struct flash_info {
996981
#define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */
997982
#define M25P_NO_ERASE 0x02 /* No erase command needed */
998983
#define SST_WRITE 0x04 /* use SST byte programming */
999-
#define SECT_32K 0x10 /* OPCODE_BE_32K */
1000984
#define M25P_NO_FR 0x08 /* Can't do fastread */
1001-
#define SECT_4K_PMC 0x10 /* OPCODE_BE_4K_PMC works uniformly */
1002-
#define USE_FSR 0x20 /* use flag status register */
1003-
#define SHUTDOWN_3BYTE 0x40 /* set 3-byte mode on shutdown */
985+
#define SECT_32K 0x10 /* OPCODE_BE_32K */
986+
#define SECT_4K_PMC 0x20 /* OPCODE_BE_4K_PMC works uniformly */
987+
#define USE_FSR 0x40 /* use flag status register */
988+
#define SHUTDOWN_3BYTE 0x80 /* set 3-byte mode on shutdown */
1004989
};
1005990

1006991
#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \

0 commit comments

Comments
 (0)