From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755975Ab3KVQYA (ORCPT ); Fri, 22 Nov 2013 11:24:00 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:47531 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755951Ab3KVQX5 (ORCPT ); Fri, 22 Nov 2013 11:23:57 -0500 From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, angus.clark@st.com Cc: linus.walleij@linaro.org, Lee Jones Subject: [PATCH 13/23] mtd: st_spi_fsm: Fetch platform specific configurations Date: Fri, 22 Nov 2013 16:22:50 +0000 Message-Id: <1385137380-28968-14-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1385137380-28968-1-git-send-email-lee.jones@linaro.org> References: <1385137380-28968-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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 0b32fef..5bced00 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -273,6 +273,15 @@ 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; + + if (info->sector_size * info->n_sectors > 0xFFFFFF) + info->flags |= FLASH_FLAG_32BITADDR; +} + static int stfsm_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -331,6 +340,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.1.2