Commit a344b6c
mtd: spi-nor: core: Allow specifying the byte order in DTR mode
Macronix swaps bytes on a 16-bit boundary when configured in Octal DTR.
The byte order of 16-bit words is swapped when read or write written in
8D-8D-8D mode compared to STR modes. Swapping the bytes is a bad design
decision because this may affect the boot sequence if the entire boot
sequence is not handled in either 8D-8D-8D mode or 1-1-1 mode. Allow
operations to specify the byte order in DTR mode, so that controllers can
swap the bytes back at run-time to fix the endianness, if they are capable.
The byte order in 8D-8D-8D mode can be retrieved at run-time by checking
BFPT[DWORD(18)] BIT(31). When set to one, the "Byte order of 16-bit words
is swapped when read in 8D-8D-8D mode compared to 1-1-1 mode.". It doesn't
specify if this applies to both register and data operations. Macronix is
the single user of this byte swap and it doesn't have clear rules, as it
contains register operations that require data swap (RDPASS, WRPASS,
PASSULK, RDSFDP) and register operations that don't require data swap
(WRFBR). All these are not common and can be handled in 1-1-1 mode, so we
can ignore them for now. All the other register operations are done on one
byte length. The read register operations are actually in 8D-8D-8S mode,
as they send the data value twice, on each half of the clock cycle. In case
of a register write of one byte, the memory supports receiving the register
value only on the first byte, thus it discards the value of the byte on the
second half of the clock cycle. Swapping the bytes for one byte register
writes is not required, and for one byte register reads it doesn't matter.
Thus swap the bytes only for read or page program operations.
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
[varshini.rajendran@microchip.com: Ported to 6.1.4 by fixing merge
conflicts]
Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
[varshini.rajendran@microchip.com: Ported to 6.6.9 by fixing merge
conflicts]
Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>1 parent 1b12a0c commit a344b6c
3 files changed
+42
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
453 | 456 | | |
454 | 457 | | |
455 | 458 | | |
456 | | - | |
| 459 | + | |
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
| |||
2691 | 2694 | | |
2692 | 2695 | | |
2693 | 2696 | | |
2694 | | - | |
| 2697 | + | |
2695 | 2698 | | |
2696 | 2699 | | |
2697 | 2700 | | |
| |||
2896 | 2899 | | |
2897 | 2900 | | |
2898 | 2901 | | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
2899 | 2915 | | |
2900 | 2916 | | |
2901 | 2917 | | |
| |||
2929 | 2945 | | |
2930 | 2946 | | |
2931 | 2947 | | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
2932 | 2951 | | |
2933 | 2952 | | |
2934 | 2953 | | |
| |||
3114 | 3133 | | |
3115 | 3134 | | |
3116 | 3135 | | |
3117 | | - | |
3118 | | - | |
| 3136 | + | |
| 3137 | + | |
3119 | 3138 | | |
3120 | 3139 | | |
3121 | 3140 | | |
| |||
3210 | 3229 | | |
3211 | 3230 | | |
3212 | 3231 | | |
3213 | | - | |
| 3232 | + | |
3214 | 3233 | | |
3215 | 3234 | | |
3216 | 3235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
| |||
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
183 | 200 | | |
184 | 201 | | |
185 | 202 | | |
| |||
0 commit comments