From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkJKr-0001mP-Es for barebox@lists.infradead.org; Thu, 08 Oct 2015 22:06:52 +0000 Received: by wicfx3 with SMTP id fx3so43541938wic.0 for ; Thu, 08 Oct 2015 15:06:30 -0700 (PDT) From: Sebastian Hesselbarth Date: Fri, 9 Oct 2015 00:06:13 +0200 Message-Id: <1444341979-19157-12-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1444341979-19157-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1444341979-19157-1-git-send-email-sebastian.hesselbarth@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 11/17] mtd: nand_mrvl_nfc: Add hwflags to distinguish different HW versions To: Sebastian Hesselbarth Cc: Thomas Petazzoni , barebox@lists.infradead.org, Ezequiel Garcia Marvell PXA3xx NAND flash controller IP has been reused in later SoCs with additional HW features. Add HW BCH ECC as the first known HW difference. Signed-off-by: Sebastian Hesselbarth --- Cc: Robert Jarzmik Cc: Thomas Petazzoni Cc: Ezequiel Garcia Cc: barebox@lists.infradead.org --- drivers/mtd/nand/nand_mrvl_nfc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/nand/nand_mrvl_nfc.c b/drivers/mtd/nand/nand_mrvl_nfc.c index 5ff5ed72ff49..8a05fc88824b 100644 --- a/drivers/mtd/nand/nand_mrvl_nfc.c +++ b/drivers/mtd/nand/nand_mrvl_nfc.c @@ -142,6 +142,8 @@ struct mrvl_nand_host { size_t read_id_bytes; void __iomem *mmio_base; + unsigned int hwflags; +#define HWFLAGS_ECC_BCH BIT(0) unsigned int buf_start; unsigned int buf_count; @@ -234,9 +236,12 @@ static struct nand_ecclayout ecc_layout_2KB_hwecc = { #define mtd_info_to_host(mtd) ((struct mrvl_nand_host *) \ (((struct nand_chip *)((mtd)->priv))->priv)) +const unsigned int pxa3xx_hwflags; + static struct of_device_id mrvl_nand_dt_ids[] = { { .compatible = "marvell,pxa3xx-nand", + .data = &pxa3xx_hwflags, }, {} }; @@ -1004,6 +1009,8 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev) static int mrvl_nand_probe_dt(struct mrvl_nand_host *host) { struct device_node *np = host->dev->device_node; + const struct of_device_id *match = + of_match_node(mrvl_nand_dt_ids, np); of_property_read_u32(np, "num-cs", &host->num_cs); if (of_get_nand_on_flash_bbt(np)) @@ -1017,6 +1024,8 @@ static int mrvl_nand_probe_dt(struct mrvl_nand_host *host) if (host->ecc_step < 0) host->ecc_step = 0; + host->hwflags = ((unsigned int *)match->data)[0]; + return 0; } -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox