Commit 39b0bbbb23076a7109eeb20b6ae812edcd60ffc2

Authored by Jaiprakash Singh
Committed by York Sun
1 parent e60476a01e

driver/ifc: Add 64KB page support

IFC has two register pages.Till IFC version 1.4 each
register page is 4KB each.But IFC ver 2.0 register page
size is 64KB each.IFC regiters structure is break into
two viz FCM and RUNTIME.FCM(Flash control machine) registers
are defined in PAGE0 and controls IFC generic functionality.
RUNTIME registers are defined in PAGE1 and controls NAND and
GPCM funcinality.

FCM and RUNTIME structures defination is common for IFC
version 1.4 and 2.0.

Signed-off-by: Jaiprakash Singh <b44839@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>

Showing 11 changed files with 126 additions and 71 deletions Side-by-side Diff

arch/arm/cpu/armv7/ls102xa/clock.c
... ... @@ -20,7 +20,7 @@
20 20 {
21 21 struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
22 22 #ifdef CONFIG_FSL_IFC
23   - struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR;
  23 + struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
24 24 u32 ccr;
25 25 #endif
26 26 struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_LS1_CLK_ADDR);
... ... @@ -74,7 +74,7 @@
74 74 }
75 75  
76 76 #if defined(CONFIG_FSL_IFC)
77   - ccr = in_be32(&ifc_regs->ifc_ccr);
  77 + ccr = in_be32(&ifc_regs.gregs->ifc_ccr);
78 78 ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
79 79  
80 80 sys_info->freq_localbus = sys_info->freq_systembus / ccr;
arch/arm/cpu/armv8/fsl-lsch3/speed.c
... ... @@ -26,7 +26,7 @@
26 26 {
27 27 struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
28 28 #ifdef CONFIG_FSL_IFC
29   - struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR;
  29 + struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
30 30 u32 ccr;
31 31 #endif
32 32 struct ccsr_clk_cluster_group __iomem *clk_grp[2] = {
... ... @@ -118,7 +118,7 @@
118 118 }
119 119  
120 120 #if defined(CONFIG_FSL_IFC)
121   - ccr = in_le32(&ifc_regs->ifc_ccr);
  121 + ccr = in_le32(&ifc_regs.gregs->ifc_ccr);
122 122 ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
123 123  
124 124 sys_info->freq_localbus = sys_info->freq_systembus / ccr;
arch/powerpc/cpu/mpc85xx/cpu_init_early.c
... ... @@ -15,7 +15,7 @@
15 15 #ifdef CONFIG_A003399_NOR_WORKAROUND
16 16 void setup_ifc(void)
17 17 {
18   - struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR;
  18 + struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
19 19 u32 _mas0, _mas1, _mas2, _mas3, _mas7;
20 20 phys_addr_t flash_phys = CONFIG_SYS_FLASH_BASE_PHYS;
21 21  
... ... @@ -70,9 +70,9 @@
70 70 #endif
71 71  
72 72 /* Change flash's physical address */
73   - ifc_out32(&(ifc_regs->cspr_cs[0].cspr), CONFIG_SYS_CSPR0);
74   - ifc_out32(&(ifc_regs->csor_cs[0].csor), CONFIG_SYS_CSOR0);
75   - ifc_out32(&(ifc_regs->amask_cs[0].amask), CONFIG_SYS_AMASK0);
  73 + ifc_out32(&(ifc_regs.gregs->cspr_cs[0].cspr), CONFIG_SYS_CSPR0);
  74 + ifc_out32(&(ifc_regs.gregs->csor_cs[0].csor), CONFIG_SYS_CSOR0);
  75 + ifc_out32(&(ifc_regs.gregs->amask_cs[0].amask), CONFIG_SYS_AMASK0);
76 76  
77 77 return ;
78 78 }
arch/powerpc/cpu/mpc85xx/speed.c
... ... @@ -28,7 +28,7 @@
28 28 {
29 29 volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
30 30 #ifdef CONFIG_FSL_IFC
31   - struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR;
  31 + struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
32 32 u32 ccr;
33 33 #endif
34 34 #ifdef CONFIG_FSL_CORENET
... ... @@ -597,7 +597,7 @@
597 597 #endif
598 598  
599 599 #if defined(CONFIG_FSL_IFC)
600   - ccr = ifc_in32(&ifc_regs->ifc_ccr);
  600 + ccr = ifc_in32(&ifc_regs.gregs->ifc_ccr);
601 601 ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
602 602  
603 603 sys_info->freq_localbus = sys_info->freq_systembus / ccr;
board/freescale/bsc9132qds/bsc9132qds.c
... ... @@ -36,9 +36,9 @@
36 36  
37 37 int board_early_init_f(void)
38 38 {
39   - struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
  39 + struct fsl_ifc ifc = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
40 40  
41   - setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
  41 + setbits_be32(&ifc.gregs->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
42 42  
43 43 return 0;
44 44 }
board/freescale/c29xpcie/c29xpcie.c
... ... @@ -38,10 +38,10 @@
38 38  
39 39 int board_early_init_f(void)
40 40 {
41   - struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
  41 + struct fsl_ifc ifc = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
42 42  
43 43 /* Clock configuration to access CPLD using IFC(GPCM) */
44   - setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
  44 + setbits_be32(&ifc.gregs->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
45 45  
46 46 return 0;
47 47 }
board/freescale/p1010rdb/p1010rdb.c
... ... @@ -77,10 +77,9 @@
77 77 int board_early_init_f(void)
78 78 {
79 79 ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
80   - struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
81   -
  80 + struct fsl_ifc ifc = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
82 81 /* Clock configuration to access CPLD using IFC(GPCM) */
83   - setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
  82 + setbits_be32(&ifc.gregs->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
84 83 /*
85 84 * Reset PCIe slots via GPIO4
86 85 */
board/freescale/p1010rdb/spl.c
... ... @@ -23,12 +23,12 @@
23 23 {
24 24 u32 plat_ratio;
25 25 ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
26   - struct fsl_ifc *ifc = (void *)CONFIG_SYS_IFC_ADDR;
  26 + struct fsl_ifc ifc = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
27 27  
28 28 console_init_f();
29 29  
30 30 /* Clock configuration to access CPLD using IFC(GPCM) */
31   - setbits_be32(&ifc->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
  31 + setbits_be32(&ifc.gregs->ifc_gcr, 1 << IFC_GCR_TBCTL_TRN_TIME_SHIFT);
32 32  
33 33 #ifdef CONFIG_P1010RDB_PB
34 34 setbits_be32(&gur->pmuxcr2, MPC85xx_PMUXCR2_GPIO01_DRVVBUS);
drivers/mtd/nand/fsl_ifc_nand.c
... ... @@ -46,7 +46,7 @@
46 46 struct fsl_ifc_mtd *chips[MAX_BANKS];
47 47  
48 48 /* device info */
49   - struct fsl_ifc *regs;
  49 + struct fsl_ifc regs;
50 50 uint8_t __iomem *addr; /* Address of assigned IFC buffer */
51 51 unsigned int cs_nand; /* On which chipsel NAND is connected */
52 52 unsigned int page; /* Last page written to / read from */
... ... @@ -225,7 +225,7 @@
225 225 struct nand_chip *chip = mtd->priv;
226 226 struct fsl_ifc_mtd *priv = chip->priv;
227 227 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
228   - struct fsl_ifc *ifc = ctrl->regs;
  228 + struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
229 229 int buf_num;
230 230  
231 231 ctrl->page = page_addr;
... ... @@ -289,7 +289,7 @@
289 289 struct nand_chip *chip = mtd->priv;
290 290 struct fsl_ifc_mtd *priv = chip->priv;
291 291 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
292   - struct fsl_ifc *ifc = ctrl->regs;
  292 + struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
293 293 u32 timeo = (CONFIG_SYS_HZ * 10) / 1000;
294 294 u32 time_start;
295 295 u32 eccstat[8] = {0};
... ... @@ -369,7 +369,7 @@
369 369 {
370 370 struct fsl_ifc_mtd *priv = chip->priv;
371 371 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
372   - struct fsl_ifc *ifc = ctrl->regs;
  372 + struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
373 373  
374 374 /* Program FIR/IFC_NAND_FCR0 for Small/Large page */
375 375 if (mtd->writesize > 512) {
... ... @@ -407,7 +407,7 @@
407 407 struct nand_chip *chip = mtd->priv;
408 408 struct fsl_ifc_mtd *priv = chip->priv;
409 409 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
410   - struct fsl_ifc *ifc = ctrl->regs;
  410 + struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
411 411  
412 412 /* clear the read buffer */
413 413 ctrl->read_bytes = 0;
... ... @@ -697,7 +697,7 @@
697 697 {
698 698 struct fsl_ifc_mtd *priv = chip->priv;
699 699 struct fsl_ifc_ctrl *ctrl = priv->ctrl;
700   - struct fsl_ifc *ifc = ctrl->regs;
  700 + struct fsl_ifc_runtime *ifc = ctrl->regs.rregs;
701 701 u32 nand_fsr;
702 702  
703 703 if (ctrl->status != IFC_NAND_EVTER_STAT_OPC)
704 704  
705 705  
706 706  
707 707  
708 708  
... ... @@ -754,24 +754,33 @@
754 754  
755 755 static void fsl_ifc_ctrl_init(void)
756 756 {
  757 + uint32_t ver = 0;
757 758 ifc_ctrl = kzalloc(sizeof(*ifc_ctrl), GFP_KERNEL);
758 759 if (!ifc_ctrl)
759 760 return;
760 761  
761   - ifc_ctrl->regs = IFC_BASE_ADDR;
  762 + ifc_ctrl->regs.gregs = IFC_FCM_BASE_ADDR;
762 763  
  764 + ver = ifc_in32(&ifc_ctrl->regs.gregs->ifc_rev);
  765 + if (ver >= FSL_IFC_V2_0_0)
  766 + ifc_ctrl->regs.rregs =
  767 + (void *)CONFIG_SYS_IFC_ADDR + IFC_RREGS_64KOFFSET;
  768 + else
  769 + ifc_ctrl->regs.rregs =
  770 + (void *)CONFIG_SYS_IFC_ADDR + IFC_RREGS_4KOFFSET;
  771 +
763 772 /* clear event registers */
764   - ifc_out32(&ifc_ctrl->regs->ifc_nand.nand_evter_stat, ~0U);
765   - ifc_out32(&ifc_ctrl->regs->ifc_nand.pgrdcmpl_evt_stat, ~0U);
  773 + ifc_out32(&ifc_ctrl->regs.rregs->ifc_nand.nand_evter_stat, ~0U);
  774 + ifc_out32(&ifc_ctrl->regs.rregs->ifc_nand.pgrdcmpl_evt_stat, ~0U);
766 775  
767 776 /* Enable error and event for any detected errors */
768   - ifc_out32(&ifc_ctrl->regs->ifc_nand.nand_evter_en,
  777 + ifc_out32(&ifc_ctrl->regs.rregs->ifc_nand.nand_evter_en,
769 778 IFC_NAND_EVTER_EN_OPC_EN |
770 779 IFC_NAND_EVTER_EN_PGRDCMPL_EN |
771 780 IFC_NAND_EVTER_EN_FTOER_EN |
772 781 IFC_NAND_EVTER_EN_WPER_EN);
773 782  
774   - ifc_out32(&ifc_ctrl->regs->ifc_nand.ncfgr, 0x0);
  783 + ifc_out32(&ifc_ctrl->regs.rregs->ifc_nand.ncfgr, 0x0);
775 784 }
776 785  
777 786 static void fsl_ifc_select_chip(struct mtd_info *mtd, int chip)
... ... @@ -780,7 +789,7 @@
780 789  
781 790 static int fsl_ifc_sram_init(uint32_t ver)
782 791 {
783   - struct fsl_ifc *ifc = ifc_ctrl->regs;
  792 + struct fsl_ifc_runtime *ifc = ifc_ctrl->regs.rregs;
784 793 uint32_t cs = 0, csor = 0, csor_8k = 0, csor_ext = 0;
785 794 uint32_t ncfgr = 0;
786 795 u32 timeo = (CONFIG_SYS_HZ * 10) / 1000;
787 796  
... ... @@ -806,13 +815,13 @@
806 815 cs = ifc_ctrl->cs_nand >> IFC_NAND_CSEL_SHIFT;
807 816  
808 817 /* Save CSOR and CSOR_ext */
809   - csor = ifc_in32(&ifc_ctrl->regs->csor_cs[cs].csor);
810   - csor_ext = ifc_in32(&ifc_ctrl->regs->csor_cs[cs].csor_ext);
  818 + csor = ifc_in32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor);
  819 + csor_ext = ifc_in32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor_ext);
811 820  
812 821 /* chage PageSize 8K and SpareSize 1K*/
813 822 csor_8k = (csor & ~(CSOR_NAND_PGS_MASK)) | 0x0018C000;
814   - ifc_out32(&ifc_ctrl->regs->csor_cs[cs].csor, csor_8k);
815   - ifc_out32(&ifc_ctrl->regs->csor_cs[cs].csor_ext, 0x0000400);
  823 + ifc_out32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor, csor_8k);
  824 + ifc_out32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor_ext, 0x0000400);
816 825  
817 826 /* READID */
818 827 ifc_out32(&ifc->ifc_nand.nand_fir0,
... ... @@ -852,8 +861,8 @@
852 861 ifc_out32(&ifc->ifc_nand.nand_evter_stat, ifc_ctrl->status);
853 862  
854 863 /* Restore CSOR and CSOR_ext */
855   - ifc_out32(&ifc_ctrl->regs->csor_cs[cs].csor, csor);
856   - ifc_out32(&ifc_ctrl->regs->csor_cs[cs].csor_ext, csor_ext);
  864 + ifc_out32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor, csor);
  865 + ifc_out32(&ifc_ctrl->regs.gregs->csor_cs[cs].csor_ext, csor_ext);
857 866  
858 867 return 0;
859 868 }
... ... @@ -864,6 +873,7 @@
864 873 struct nand_chip *nand;
865 874 struct fsl_ifc_mtd *priv;
866 875 struct nand_ecclayout *layout;
  876 + struct fsl_ifc_fcm *gregs = NULL;
867 877 uint32_t cspr = 0, csor = 0, ver = 0;
868 878 int ret = 0;
869 879  
870 880  
... ... @@ -879,14 +889,15 @@
879 889  
880 890 priv->ctrl = ifc_ctrl;
881 891 priv->vbase = addr;
  892 + gregs = ifc_ctrl->regs.gregs;
882 893  
883 894 /* Find which chip select it is connected to.
884 895 */
885 896 for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
886 897 phys_addr_t phys_addr = virt_to_phys(addr);
887 898  
888   - cspr = ifc_in32(&ifc_ctrl->regs->cspr_cs[priv->bank].cspr);
889   - csor = ifc_in32(&ifc_ctrl->regs->csor_cs[priv->bank].csor);
  899 + cspr = ifc_in32(&gregs->cspr_cs[priv->bank].cspr);
  900 + csor = ifc_in32(&gregs->csor_cs[priv->bank].csor);
890 901  
891 902 if ((cspr & CSPR_V) && (cspr & CSPR_MSEL) == CSPR_MSEL_NAND &&
892 903 (cspr & CSPR_BA) == CSPR_PHYS_ADDR(phys_addr)) {
... ... @@ -1005,7 +1016,7 @@
1005 1016 nand->ecc.mode = NAND_ECC_SOFT;
1006 1017 }
1007 1018  
1008   - ver = ifc_in32(&ifc_ctrl->regs->ifc_rev);
  1019 + ver = ifc_in32(&gregs->ifc_rev);
1009 1020 if (ver >= FSL_IFC_V1_1_0)
1010 1021 ret = fsl_ifc_sram_init(ver);
1011 1022 if (ret)
drivers/mtd/nand/fsl_ifc_spl.c
... ... @@ -48,9 +48,23 @@
48 48 return 0;
49 49 }
50 50  
  51 +static inline struct fsl_ifc_runtime *runtime_regs_address(void)
  52 +{
  53 + struct fsl_ifc regs = {(void *)CONFIG_SYS_IFC_ADDR, NULL};
  54 + int ver = 0;
  55 +
  56 + ver = ifc_in32(&regs.gregs->ifc_rev);
  57 + if (ver >= FSL_IFC_V2_0_0)
  58 + regs.rregs = (void *)CONFIG_SYS_IFC_ADDR + IFC_RREGS_64KOFFSET;
  59 + else
  60 + regs.rregs = (void *)CONFIG_SYS_IFC_ADDR + IFC_RREGS_4KOFFSET;
  61 +
  62 + return regs.rregs;
  63 +}
  64 +
51 65 static inline void nand_wait(uchar *buf, int bufnum, int page_size)
52 66 {
53   - struct fsl_ifc *ifc = IFC_BASE_ADDR;
  67 + struct fsl_ifc_runtime *ifc = runtime_regs_address();
54 68 u32 status;
55 69 u32 eccstat[4];
56 70 int bufperpage = page_size / 512;
... ... @@ -90,7 +104,8 @@
90 104  
91 105 int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
92 106 {
93   - struct fsl_ifc *ifc = IFC_BASE_ADDR;
  107 + struct fsl_ifc_fcm *gregs = (void *)CONFIG_SYS_IFC_ADDR;
  108 + struct fsl_ifc_runtime *ifc = NULL;
94 109 uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
95 110 int page_size;
96 111 int port_size;
... ... @@ -107,6 +122,8 @@
107 122 int pg_no;
108 123 uchar *dst = vdst;
109 124  
  125 + ifc = runtime_regs_address();
  126 +
110 127 /* Get NAND Flash configuration */
111 128 csor = CONFIG_SYS_NAND_CSOR;
112 129 cspr = CONFIG_SYS_NAND_CSPR;
... ... @@ -130,7 +147,7 @@
130 147 bad_marker = 5;
131 148 }
132 149  
133   - ver = ifc_in32(&ifc->ifc_rev);
  150 + ver = ifc_in32(&gregs->ifc_rev);
134 151 if (ver >= FSL_IFC_V2_0_0)
135 152 bufnum_mask = (bufnum_mask * 2) + 1;
136 153  
... ... @@ -790,24 +790,36 @@
790 790 extern void init_early_memctl_regs(void);
791 791 void init_final_memctl_regs(void);
792 792  
793   -#define IFC_BASE_ADDR ((struct fsl_ifc *)CONFIG_SYS_IFC_ADDR)
  793 +#define IFC_RREGS_4KOFFSET (4*1024)
  794 +#define IFC_RREGS_64KOFFSET (64*1024)
794 795  
795   -#define get_ifc_cspr_ext(i) (ifc_in32(&(IFC_BASE_ADDR)->cspr_cs[i].cspr_ext))
796   -#define get_ifc_cspr(i) (ifc_in32(&(IFC_BASE_ADDR)->cspr_cs[i].cspr))
797   -#define get_ifc_csor_ext(i) (ifc_in32(&(IFC_BASE_ADDR)->csor_cs[i].csor_ext))
798   -#define get_ifc_csor(i) (ifc_in32(&(IFC_BASE_ADDR)->csor_cs[i].csor))
799   -#define get_ifc_amask(i) (ifc_in32(&(IFC_BASE_ADDR)->amask_cs[i].amask))
800   -#define get_ifc_ftim(i, j) (ifc_in32(&(IFC_BASE_ADDR)->ftim_cs[i].ftim[j]))
  796 +#define IFC_FCM_BASE_ADDR \
  797 + ((struct fsl_ifc_fcm *)CONFIG_SYS_IFC_ADDR)
801 798  
802   -#define set_ifc_cspr_ext(i, v) \
803   - (ifc_out32(&(IFC_BASE_ADDR)->cspr_cs[i].cspr_ext, v))
804   -#define set_ifc_cspr(i, v) (ifc_out32(&(IFC_BASE_ADDR)->cspr_cs[i].cspr, v))
805   -#define set_ifc_csor_ext(i, v) \
806   - (ifc_out32(&(IFC_BASE_ADDR)->csor_cs[i].csor_ext, v))
807   -#define set_ifc_csor(i, v) (ifc_out32(&(IFC_BASE_ADDR)->csor_cs[i].csor, v))
808   -#define set_ifc_amask(i, v) (ifc_out32(&(IFC_BASE_ADDR)->amask_cs[i].amask, v))
809   -#define set_ifc_ftim(i, j, v) \
810   - (ifc_out32(&(IFC_BASE_ADDR)->ftim_cs[i].ftim[j], v))
  799 +#define get_ifc_cspr_ext(i) \
  800 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->cspr_cs[i].cspr_ext))
  801 +#define get_ifc_cspr(i) \
  802 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->cspr_cs[i].cspr))
  803 +#define get_ifc_csor_ext(i) \
  804 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->csor_cs[i].csor_ext))
  805 +#define get_ifc_csor(i) \
  806 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->csor_cs[i].csor))
  807 +#define get_ifc_amask(i) \
  808 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->amask_cs[i].amask))
  809 +#define get_ifc_ftim(i, j) \
  810 + (ifc_in32(&(IFC_FCM_BASE_ADDR)->ftim_cs[i].ftim[j]))
  811 +#define set_ifc_cspr_ext(i, v) \
  812 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->cspr_cs[i].cspr_ext, v))
  813 +#define set_ifc_cspr(i, v) \
  814 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->cspr_cs[i].cspr, v))
  815 +#define set_ifc_csor_ext(i, v) \
  816 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->csor_cs[i].csor_ext, v))
  817 +#define set_ifc_csor(i, v) \
  818 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->csor_cs[i].csor, v))
  819 +#define set_ifc_amask(i, v) \
  820 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->amask_cs[i].amask, v))
  821 +#define set_ifc_ftim(i, j, v) \
  822 + (ifc_out32(&(IFC_FCM_BASE_ADDR)->ftim_cs[i].ftim[j], v))
811 823  
812 824 enum ifc_chip_sel {
813 825 IFC_CS0,
814 826  
815 827  
... ... @@ -869,20 +881,26 @@
869 881 u32 nand_evter_en;
870 882 u32 res17[0x2];
871 883 u32 nand_evter_intr_en;
872   - u32 res18[0x2];
  884 + u32 nand_vol_addr_stat;
  885 + u32 res18;
873 886 u32 nand_erattr0;
874 887 u32 nand_erattr1;
875 888 u32 res19[0x10];
876 889 u32 nand_fsr;
877   - u32 res20;
878   - u32 nand_eccstat[4];
879   - u32 res21[0x20];
  890 + u32 res20[0x3];
  891 + u32 nand_eccstat[6];
  892 + u32 res21[0x1c];
880 893 u32 nanndcr;
881 894 u32 res22[0x2];
882 895 u32 nand_autoboot_trgr;
883 896 u32 res23;
884 897 u32 nand_mdr;
885   - u32 res24[0x5C];
  898 + u32 res24[0x1c];
  899 + u32 nand_dll_lowcfg0;
  900 + u32 nand_dll_lowcfg1;
  901 + u32 res25;
  902 + u32 nand_dll_lowstat;
  903 + u32 res26[0x3C];
886 904 };
887 905  
888 906 /*
... ... @@ -917,7 +935,6 @@
917 935 u32 gpcm_erattr1;
918 936 u32 gpcm_erattr2;
919 937 u32 gpcm_stat;
920   - u32 res4[0x1F3];
921 938 };
922 939  
923 940 #ifdef CONFIG_SYS_FSL_IFC_BANK_COUNT
924 941  
... ... @@ -965,9 +982,11 @@
965 982 };
966 983  
967 984 /*
968   - * IFC Controller Registers
  985 + * IFC Controller Global Registers
  986 + * FCM - Flash control machine
969 987 */
970   -struct fsl_ifc {
  988 +
  989 +struct fsl_ifc_fcm {
971 990 u32 ifc_rev;
972 991 u32 res1[0x2];
973 992 struct fsl_ifc_cspr cspr_cs[CONFIG_SYS_FSL_IFC_BANK_COUNT];
... ... @@ -979,7 +998,8 @@
979 998 struct fsl_ifc_ftim ftim_cs[CONFIG_SYS_FSL_IFC_BANK_COUNT];
980 999 u8 res5[IFC_FTIM_REG_LEN - IFC_FTIM_USED_LEN];
981 1000 u32 rb_stat;
982   - u32 res6[0x2];
  1001 + u32 rb_map;
  1002 + u32 wp_map;
983 1003 u32 ifc_gcr;
984 1004 u32 res7[0x2];
985 1005 u32 cm_evter_stat;
986 1006  
... ... @@ -993,10 +1013,18 @@
993 1013 u32 res11[0x2];
994 1014 u32 ifc_ccr;
995 1015 u32 ifc_csr;
996   - u32 res12[0x2EB];
  1016 + u32 ddr_ccr_low;
  1017 +};
  1018 +
  1019 +struct fsl_ifc_runtime {
997 1020 struct fsl_ifc_nand ifc_nand;
998 1021 struct fsl_ifc_nor ifc_nor;
999 1022 struct fsl_ifc_gpcm ifc_gpcm;
  1023 +};
  1024 +
  1025 +struct fsl_ifc {
  1026 + struct fsl_ifc_fcm *gregs;
  1027 + struct fsl_ifc_runtime *rregs;
1000 1028 };
1001 1029  
1002 1030 #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A002769