Commit 067951223e3305fce3df972c1970f6ab1ef15e98
1 parent
ff063ed480
Exists in
master
and in
50 other branches
sf: Add macronix set QEB support
This patch adds set QEB support for macronix flash devices which are trying to program/read quad operations. Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Showing 3 changed files with 35 additions and 0 deletions Side-by-side Diff
drivers/mtd/spi/sf_internal.h
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | /* CFI Manufacture ID's */ |
18 | 18 | #define SPI_FLASH_CFI_MFR_SPANSION 0x01 |
19 | 19 | #define SPI_FLASH_CFI_MFR_STMICRO 0x20 |
20 | +#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 | |
20 | 21 | #define SPI_FLASH_CFI_MFR_WINBOND 0xef |
21 | 22 | |
22 | 23 | /* SECT flags */ |
... | ... | @@ -61,6 +62,7 @@ |
61 | 62 | /* Common status */ |
62 | 63 | #define STATUS_WIP 0x01 |
63 | 64 | #define STATUS_QEB_WINSPAN (1 << 1) |
65 | +#define STATUS_QEB_MXIC (1 << 6) | |
64 | 66 | #define STATUS_PEC 0x80 |
65 | 67 | |
66 | 68 | /* Flash timeout values */ |
... | ... | @@ -101,6 +103,9 @@ |
101 | 103 | |
102 | 104 | /* Program the status register */ |
103 | 105 | int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr); |
106 | + | |
107 | +/* Set quad enbale bit for macronix flashes */ | |
108 | +int spi_flash_set_qeb_mxic(struct spi_flash *flash); | |
104 | 109 | |
105 | 110 | /* Set quad enbale bit for winbond and spansion flashes */ |
106 | 111 | int spi_flash_set_qeb_winspan(struct spi_flash *flash); |
drivers/mtd/spi/sf_ops.c
... | ... | @@ -39,6 +39,32 @@ |
39 | 39 | return 0; |
40 | 40 | } |
41 | 41 | |
42 | +#ifdef CONFIG_SPI_FLASH_MACRONIX | |
43 | +int spi_flash_set_qeb_mxic(struct spi_flash *flash) | |
44 | +{ | |
45 | + u8 qeb_status; | |
46 | + u8 cmd; | |
47 | + int ret; | |
48 | + | |
49 | + cmd = CMD_READ_STATUS; | |
50 | + ret = spi_flash_read_common(flash, &cmd, 1, &qeb_status, 1); | |
51 | + if (ret < 0) { | |
52 | + debug("SF: fail to read status register\n"); | |
53 | + return ret; | |
54 | + } | |
55 | + | |
56 | + if (qeb_status & STATUS_QEB_MXIC) { | |
57 | + debug("SF: Quad enable bit is already set\n"); | |
58 | + } else { | |
59 | + ret = spi_flash_cmd_write_status(flash, STATUS_QEB_MXIC); | |
60 | + if (ret < 0) | |
61 | + return ret; | |
62 | + } | |
63 | + | |
64 | + return ret; | |
65 | +} | |
66 | +#endif | |
67 | + | |
42 | 68 | #if defined(CONFIG_SPI_FLASH_SPANSION) || defined(CONFIG_SPI_FLASH_WINBOND) |
43 | 69 | static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr) |
44 | 70 | { |
drivers/mtd/spi/sf_probe.c
... | ... | @@ -31,6 +31,10 @@ |
31 | 31 | static int spi_flash_set_qeb(struct spi_flash *flash, u8 idcode0) |
32 | 32 | { |
33 | 33 | switch (idcode0) { |
34 | +#ifdef CONFIG_SPI_FLASH_MACRONIX | |
35 | + case SPI_FLASH_CFI_MFR_MACRONIX: | |
36 | + return spi_flash_set_qeb_mxic(flash); | |
37 | +#endif | |
34 | 38 | #if defined(CONFIG_SPI_FLASH_SPANSION) || defined(CONFIG_SPI_FLASH_WINBOND) |
35 | 39 | case SPI_FLASH_CFI_MFR_SPANSION: |
36 | 40 | case SPI_FLASH_CFI_MFR_WINBOND: |