1*16216333SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 293db446aSBoris Brezillon /* 393db446aSBoris Brezillon * Freescale GPMI NAND Flash Driver 493db446aSBoris Brezillon * 593db446aSBoris Brezillon * Copyright 2008-2011 Freescale Semiconductor, Inc. 693db446aSBoris Brezillon * Copyright 2008 Embedded Alley Solutions, Inc. 793db446aSBoris Brezillon */ 893db446aSBoris Brezillon #ifndef __GPMI_NAND_BCH_REGS_H 993db446aSBoris Brezillon #define __GPMI_NAND_BCH_REGS_H 1093db446aSBoris Brezillon 1193db446aSBoris Brezillon #define HW_BCH_CTRL 0x00000000 1293db446aSBoris Brezillon #define HW_BCH_CTRL_SET 0x00000004 1393db446aSBoris Brezillon #define HW_BCH_CTRL_CLR 0x00000008 1493db446aSBoris Brezillon #define HW_BCH_CTRL_TOG 0x0000000c 1593db446aSBoris Brezillon 1693db446aSBoris Brezillon #define BM_BCH_CTRL_COMPLETE_IRQ_EN (1 << 8) 1793db446aSBoris Brezillon #define BM_BCH_CTRL_COMPLETE_IRQ (1 << 0) 1893db446aSBoris Brezillon 1993db446aSBoris Brezillon #define HW_BCH_STATUS0 0x00000010 2093db446aSBoris Brezillon #define HW_BCH_MODE 0x00000020 2193db446aSBoris Brezillon #define HW_BCH_ENCODEPTR 0x00000030 2293db446aSBoris Brezillon #define HW_BCH_DATAPTR 0x00000040 2393db446aSBoris Brezillon #define HW_BCH_METAPTR 0x00000050 2493db446aSBoris Brezillon #define HW_BCH_LAYOUTSELECT 0x00000070 2593db446aSBoris Brezillon 2693db446aSBoris Brezillon #define HW_BCH_FLASH0LAYOUT0 0x00000080 2793db446aSBoris Brezillon 2893db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT0_NBLOCKS 24 2993db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT0_NBLOCKS (0xff << BP_BCH_FLASH0LAYOUT0_NBLOCKS) 3093db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT0_NBLOCKS(v) \ 3193db446aSBoris Brezillon (((v) << BP_BCH_FLASH0LAYOUT0_NBLOCKS) & BM_BCH_FLASH0LAYOUT0_NBLOCKS) 3293db446aSBoris Brezillon 3393db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT0_META_SIZE 16 3493db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT0_META_SIZE (0xff << BP_BCH_FLASH0LAYOUT0_META_SIZE) 3593db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT0_META_SIZE(v) \ 3693db446aSBoris Brezillon (((v) << BP_BCH_FLASH0LAYOUT0_META_SIZE)\ 3793db446aSBoris Brezillon & BM_BCH_FLASH0LAYOUT0_META_SIZE) 3893db446aSBoris Brezillon 3993db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT0_ECC0 12 4093db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT0_ECC0 (0xf << BP_BCH_FLASH0LAYOUT0_ECC0) 4193db446aSBoris Brezillon #define MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0 11 4293db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0 (0x1f << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0) 4393db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT0_ECC0(v, x) \ 4493db446aSBoris Brezillon (GPMI_IS_MX6(x) \ 4593db446aSBoris Brezillon ? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT0_ECC0) \ 4693db446aSBoris Brezillon & MX6Q_BM_BCH_FLASH0LAYOUT0_ECC0) \ 4793db446aSBoris Brezillon : (((v) << BP_BCH_FLASH0LAYOUT0_ECC0) \ 4893db446aSBoris Brezillon & BM_BCH_FLASH0LAYOUT0_ECC0) \ 4993db446aSBoris Brezillon ) 5093db446aSBoris Brezillon 5193db446aSBoris Brezillon #define MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14 10 5293db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT0_GF_13_14 \ 5393db446aSBoris Brezillon (0x1 << MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14) 5493db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT0_GF(v, x) \ 5593db446aSBoris Brezillon ((GPMI_IS_MX6(x) && ((v) == 14)) \ 5693db446aSBoris Brezillon ? (((1) << MX6Q_BP_BCH_FLASH0LAYOUT0_GF_13_14) \ 5793db446aSBoris Brezillon & MX6Q_BM_BCH_FLASH0LAYOUT0_GF_13_14) \ 5893db446aSBoris Brezillon : 0 \ 5993db446aSBoris Brezillon ) 6093db446aSBoris Brezillon 6193db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT0_DATA0_SIZE 0 6293db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT0_DATA0_SIZE \ 6393db446aSBoris Brezillon (0xfff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE) 6493db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE \ 6593db446aSBoris Brezillon (0x3ff << BP_BCH_FLASH0LAYOUT0_DATA0_SIZE) 6693db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT0_DATA0_SIZE(v, x) \ 6793db446aSBoris Brezillon (GPMI_IS_MX6(x) \ 6893db446aSBoris Brezillon ? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT0_DATA0_SIZE) \ 6993db446aSBoris Brezillon : ((v) & BM_BCH_FLASH0LAYOUT0_DATA0_SIZE) \ 7093db446aSBoris Brezillon ) 7193db446aSBoris Brezillon 7293db446aSBoris Brezillon #define HW_BCH_FLASH0LAYOUT1 0x00000090 7393db446aSBoris Brezillon 7493db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT1_PAGE_SIZE 16 7593db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT1_PAGE_SIZE \ 7693db446aSBoris Brezillon (0xffff << BP_BCH_FLASH0LAYOUT1_PAGE_SIZE) 7793db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT1_PAGE_SIZE(v) \ 7893db446aSBoris Brezillon (((v) << BP_BCH_FLASH0LAYOUT1_PAGE_SIZE) \ 7993db446aSBoris Brezillon & BM_BCH_FLASH0LAYOUT1_PAGE_SIZE) 8093db446aSBoris Brezillon 8193db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT1_ECCN 12 8293db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT1_ECCN (0xf << BP_BCH_FLASH0LAYOUT1_ECCN) 8393db446aSBoris Brezillon #define MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN 11 8493db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN (0x1f << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN) 8593db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT1_ECCN(v, x) \ 8693db446aSBoris Brezillon (GPMI_IS_MX6(x) \ 8793db446aSBoris Brezillon ? (((v) << MX6Q_BP_BCH_FLASH0LAYOUT1_ECCN) \ 8893db446aSBoris Brezillon & MX6Q_BM_BCH_FLASH0LAYOUT1_ECCN) \ 8993db446aSBoris Brezillon : (((v) << BP_BCH_FLASH0LAYOUT1_ECCN) \ 9093db446aSBoris Brezillon & BM_BCH_FLASH0LAYOUT1_ECCN) \ 9193db446aSBoris Brezillon ) 9293db446aSBoris Brezillon 9393db446aSBoris Brezillon #define MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14 10 9493db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT1_GF_13_14 \ 9593db446aSBoris Brezillon (0x1 << MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14) 9693db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT1_GF(v, x) \ 9793db446aSBoris Brezillon ((GPMI_IS_MX6(x) && ((v) == 14)) \ 9893db446aSBoris Brezillon ? (((1) << MX6Q_BP_BCH_FLASH0LAYOUT1_GF_13_14) \ 9993db446aSBoris Brezillon & MX6Q_BM_BCH_FLASH0LAYOUT1_GF_13_14) \ 10093db446aSBoris Brezillon : 0 \ 10193db446aSBoris Brezillon ) 10293db446aSBoris Brezillon 10393db446aSBoris Brezillon #define BP_BCH_FLASH0LAYOUT1_DATAN_SIZE 0 10493db446aSBoris Brezillon #define BM_BCH_FLASH0LAYOUT1_DATAN_SIZE \ 10593db446aSBoris Brezillon (0xfff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE) 10693db446aSBoris Brezillon #define MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE \ 10793db446aSBoris Brezillon (0x3ff << BP_BCH_FLASH0LAYOUT1_DATAN_SIZE) 10893db446aSBoris Brezillon #define BF_BCH_FLASH0LAYOUT1_DATAN_SIZE(v, x) \ 10993db446aSBoris Brezillon (GPMI_IS_MX6(x) \ 11093db446aSBoris Brezillon ? (((v) >> 2) & MX6Q_BM_BCH_FLASH0LAYOUT1_DATAN_SIZE) \ 11193db446aSBoris Brezillon : ((v) & BM_BCH_FLASH0LAYOUT1_DATAN_SIZE) \ 11293db446aSBoris Brezillon ) 11393db446aSBoris Brezillon 11493db446aSBoris Brezillon #define HW_BCH_VERSION 0x00000160 11593db446aSBoris Brezillon #endif 116