Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753745AbaAWKcQ (ORCPT ); Thu, 23 Jan 2014 05:32:16 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:59168 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753660AbaAWKcM (ORCPT ); Thu, 23 Jan 2014 05:32:12 -0500 From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com, DCG_UPD_stlinux_kernel@list.st.com, olivier.clergeaud@st.com, Lee Jones Subject: [PATCH RESEND v4 12/37] mtd: st_spi_fsm: Fetch platform specific configurations Date: Thu, 23 Jan 2014 10:31:00 +0000 Message-Id: <1390473085-24626-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> References: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All supported platforms are able to pass specific configurations via the Device Tree on boot. Here we add a function which is to be called during the probing process which will extract them, or make other assumptions based on capabilities provided. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index efd8fdb..1803f94 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -654,6 +654,16 @@ static int stfsm_init(struct stfsm *fsm) return 0; } +static void stfsm_fetch_platform_configs(struct platform_device *pdev) +{ + struct stfsm *fsm = platform_get_drvdata(pdev); + struct flash_info *info = fsm->info; + + /* Use device size to determine address width */ + if (info->sector_size * info->n_sectors > 0xFFFFFF) + info->flags |= FLASH_FLAG_32BIT_ADDR; +} + static int stfsm_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -712,6 +722,8 @@ static int stfsm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, fsm); + stfsm_fetch_platform_configs(pdev); + fsm->mtd.dev.parent = &pdev->dev; fsm->mtd.type = MTD_NORFLASH; fsm->mtd.writesize = 4; -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/