Commit 139a6f95be94f75e4038e0eacddbd1f0a365f601

Authored by Peng Fan
1 parent 0b65071afa

MLK-12852 ocotp: mxc: mx6ull: fix GP3/GP4 prog

Bank 7 and Bank 8 only supports 4 words each. 'bank << 3 | word'
is not correct when program bank 8, since ocotp controller actully
use word index.

For example: fuse prog 8 3 1; The word index is (8 << 3 | 3) --> 67.
But actully it should be (7 << 3 | 7) ---> 63.
So fix it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>

Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff

drivers/misc/mxc_ocotp.c
... ... @@ -268,7 +268,13 @@
268 268 #ifdef CONFIG_MX7
269 269 u32 addr = bank;
270 270 #else
271   - u32 addr = bank << 3 | word;
  271 + u32 addr;
  272 + /* Bank 7 and Bank 8 only supports 4 words each */
  273 + if ((is_cpu_type(MXC_CPU_MX6ULL)) && (bank > 7)) {
  274 + bank = bank - 1;
  275 + word += 4;
  276 + }
  277 + addr = bank << 3 | word;
272 278 #endif
273 279  
274 280 set_timing(regs);