Commit 0eee20fc1bb16f484771d626e1d7bde7d770a01c

Authored by Benoît Thébaudeau
Committed by Scott Wood
1 parent 5d818a2821

spl mxc nand: Remove duplicated code

The ECC_EN and INT_MSK bits of CONFIG1 are not volatile, so it is sufficient to
set them once in nfc_nand_init().

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Scott Wood <scottwood@freescale.com>

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

nand_spl/nand_boot_fsl_nfc.c
... ... @@ -57,7 +57,7 @@
57 57 writew(0x2, &nfc->config);
58 58  
59 59 /* hardware ECC checking and correct */
60   - config1 = readw(&nfc->config1) | NFC_ECC_EN | NFC_FP_INT;
  60 + config1 = readw(&nfc->config1) | NFC_ECC_EN | NFC_INT_MSK | NFC_FP_INT;
61 61 /*
62 62 * if spare size is larger that 16 bytes per 512 byte hunk
63 63 * then use 8 symbol correction instead of 4
... ... @@ -72,7 +72,7 @@
72 72 writew(0x2, &nfc->config);
73 73  
74 74 /* hardware ECC checking and correct */
75   - writew(NFC_ECC_EN, &nfc->config1);
  75 + writew(NFC_ECC_EN | NFC_INT_MSK, &nfc->config1);
76 76 #endif
77 77 }
78 78  
79 79  
... ... @@ -116,13 +116,10 @@
116 116  
117 117 static void nfc_nand_data_output(void)
118 118 {
119   - int config1 = readw(&nfc->config1);
120 119 #ifdef NAND_MXC_2K_MULTI_CYCLE
121 120 int i;
122 121 #endif
123 122  
124   - config1 |= NFC_ECC_EN | NFC_INT_MSK;
125   - writew(config1, &nfc->config1);
126 123 writew(0, &nfc->buf_addr);
127 124 writew(NFC_OUTPUT, &nfc->config2);
128 125 nfc_wait_ready();
... ... @@ -132,9 +129,6 @@
132 129 * for pages larger than 512 bytes.
133 130 */
134 131 for (i = 1; i < CONFIG_SYS_NAND_PAGE_SIZE / 512; i++) {
135   - config1 = readw(&nfc->config1);
136   - config1 |= NFC_ECC_EN | NFC_INT_MSK;
137   - writew(config1, &nfc->config1);
138 132 writew(i, &nfc->buf_addr);
139 133 writew(NFC_OUTPUT, &nfc->config2);
140 134 nfc_wait_ready();