56
56
#define NFC_V1_V2_WRPROT (host->regs + 0x12)
57
57
#define NFC_V1_UNLOCKSTART_BLKADDR (host->regs + 0x14)
58
58
#define NFC_V1_UNLOCKEND_BLKADDR (host->regs + 0x16)
59
#define NFC_V21_UNLOCKSTART_BLKADDR (host->regs + 0x20)
60
#define NFC_V21_UNLOCKEND_BLKADDR (host->regs + 0x22)
59
#define NFC_V21_UNLOCKSTART_BLKADDR0 (host->regs + 0x20)
60
#define NFC_V21_UNLOCKSTART_BLKADDR1 (host->regs + 0x24)
61
#define NFC_V21_UNLOCKSTART_BLKADDR2 (host->regs + 0x28)
62
#define NFC_V21_UNLOCKSTART_BLKADDR3 (host->regs + 0x2c)
63
#define NFC_V21_UNLOCKEND_BLKADDR0 (host->regs + 0x22)
64
#define NFC_V21_UNLOCKEND_BLKADDR1 (host->regs + 0x26)
65
#define NFC_V21_UNLOCKEND_BLKADDR2 (host->regs + 0x2a)
66
#define NFC_V21_UNLOCKEND_BLKADDR3 (host->regs + 0x2e)
61
67
#define NFC_V1_V2_NF_WRPRST (host->regs + 0x18)
62
68
#define NFC_V1_V2_CONFIG1 (host->regs + 0x1a)
63
69
#define NFC_V1_V2_CONFIG2 (host->regs + 0x1c)
214
#ifdef CONFIG_MTD_PARTITIONS
221
/* OOB description for 4096 byte pages with 128 byte OOB */
222
static struct nand_ecclayout nandv2_hw_eccoob_4k = {
225
7, 8, 9, 10, 11, 12, 13, 14, 15,
226
23, 24, 25, 26, 27, 28, 29, 30, 31,
227
39, 40, 41, 42, 43, 44, 45, 46, 47,
228
55, 56, 57, 58, 59, 60, 61, 62, 63,
229
71, 72, 73, 74, 75, 76, 77, 78, 79,
230
87, 88, 89, 90, 91, 92, 93, 94, 95,
231
103, 104, 105, 106, 107, 108, 109, 110, 111,
232
119, 120, 121, 122, 123, 124, 125, 126, 127,
235
{.offset = 2, .length = 4},
236
{.offset = 16, .length = 7},
237
{.offset = 32, .length = 7},
238
{.offset = 48, .length = 7},
239
{.offset = 64, .length = 7},
240
{.offset = 80, .length = 7},
241
{.offset = 96, .length = 7},
242
{.offset = 112, .length = 7},
215
246
static const char *part_probes[] = { "RedBoot", "cmdlinepart", NULL };
218
248
static irqreturn_t mxc_nfc_irq(int irq, void *dev_id)
723
753
* MXC NANDFC can only perform full page+spare or
724
754
* spare-only read/write. When the upper layers
725
* layers perform a read/write buf operation,
726
* we will used the saved column address to index into
755
* perform a read/write buf operation, the saved column
756
* address is used to index into the full page.
729
758
host->send_addr(host, 0, page_addr == -1);
730
759
if (mtd->writesize > 512)
811
840
/* Blocks to be unlocked */
812
841
if (nfc_is_v21()) {
813
writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR);
814
writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR);
842
writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR0);
843
writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR1);
844
writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR2);
845
writew(0x0, NFC_V21_UNLOCKSTART_BLKADDR3);
846
writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR0);
847
writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR1);
848
writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR2);
849
writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR3);
815
850
} else if (nfc_is_v1()) {
816
851
writew(0x0, NFC_V1_UNLOCKSTART_BLKADDR);
817
852
writew(0x4000, NFC_V1_UNLOCKEND_BLKADDR);
1196
1233
/* Register the partitions */
1197
#ifdef CONFIG_MTD_PARTITIONS
1199
1235
parse_mtd_partitions(mtd, part_probes, &host->parts, 0);
1200
1236
if (nr_parts > 0)
1201
add_mtd_partitions(mtd, host->parts, nr_parts);
1237
mtd_device_register(mtd, host->parts, nr_parts);
1202
1238
else if (pdata->parts)
1203
add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts);
1239
mtd_device_register(mtd, pdata->parts, pdata->nr_parts);
1207
1241
pr_info("Registering %s as whole device\n", mtd->name);
1208
add_mtd_device(mtd);
1242
mtd_device_register(mtd, NULL, 0);
1211
1245
platform_set_drvdata(pdev, host);