Merge tag 'for-linus-20170904' of git://git.infradead.org/linux-mtd
[sfrench/cifs-2.6.git] / drivers / mtd / nand / atmel / nand-controller.c
index 08abd180530ac08a5917c3632dbd3f91398c5e29..f25eca79f4e56d096ed749918752e8aca26ee68d 100644 (file)
@@ -247,6 +247,7 @@ struct atmel_hsmc_nand_controller {
                void __iomem *virt;
                dma_addr_t dma;
        } sram;
+       const struct atmel_hsmc_reg_layout *hsmc_layout;
        struct regmap *io;
        struct atmel_nfc_op op;
        struct completion complete;
@@ -1442,12 +1443,12 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
                                        int csline,
                                        const struct nand_data_interface *conf)
 {
-       struct atmel_nand_controller *nc;
+       struct atmel_hsmc_nand_controller *nc;
        struct atmel_smc_cs_conf smcconf;
        struct atmel_nand_cs *cs;
        int ret;
 
-       nc = to_nand_controller(nand->base.controller);
+       nc = to_hsmc_nand_controller(nand->base.controller);
 
        ret = atmel_smc_nand_prepare_smcconf(nand, conf, &smcconf);
        if (ret)
@@ -1462,7 +1463,8 @@ static int atmel_hsmc_nand_setup_data_interface(struct atmel_nand *nand,
        if (cs->rb.type == ATMEL_NAND_NATIVE_RB)
                cs->smcconf.timings |= ATMEL_HSMC_TIMINGS_RBNSEL(cs->rb.id);
 
-       atmel_hsmc_cs_conf_apply(nc->smc, cs->id, &cs->smcconf);
+       atmel_hsmc_cs_conf_apply(nc->base.smc, nc->hsmc_layout, cs->id,
+                                &cs->smcconf);
 
        return 0;
 }
@@ -2177,6 +2179,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
                return -EINVAL;
        }
 
+       nc->hsmc_layout = atmel_hsmc_get_reg_layout(np);
+
        nc->irq = of_irq_get(np, 0);
        of_node_put(np);
        if (nc->irq <= 0) {