summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorLudovic Desroches <ludovic.desroches@microchip.com>2017-07-18 15:22:19 +0200
committerLee Jones <lee.jones@linaro.org>2017-09-05 08:46:01 +0100
commitb0f3ab20e76499db12b0bbadb5737d9870f10418 (patch)
treedb43752273fae309fa329377d71053f248875c55 /drivers/mtd/nand
parentf446363374e4c31fecad2cf95d877b4631de9890 (diff)
downloadop-kernel-dev-b0f3ab20e76499db12b0bbadb5737d9870f10418.zip
op-kernel-dev-b0f3ab20e76499db12b0bbadb5737d9870f10418.tar.gz
mfd: syscon: atmel-smc: Add helper to retrieve register layout
For HSMC controller, the register layout depends on the device i.e. the offset of setup, pulse, cycle, mode and timings registers is not the same. An helper is added to provide the correct register layout. Fixes: fe9d7cb22ef3 ("mfd: syscon: atmel-smc: Add new helpers to ease SMC regs manipulation") Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/atmel/nand-controller.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index ceec21b..1913ce1 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -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) {
OpenPOWER on IntegriCloud