From patchwork Wed Jan 8 13:46:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22948 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF8A0202E2 for ; Wed, 8 Jan 2014 13:48:44 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id bj1sf4482958pad.11 for ; Wed, 08 Jan 2014 05:48:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uj8Km7Uvy4Ch5W+bgolZI2dahLr/1gho6U2JXY+kxdU=; b=dEGuB+wIH8/VVQlLxxHNAHa/L2D62q1m4Qqcm7vHQH2/ww8mc5PlvFHWEZX/J1JMkZ Kg9fi9g5i10nW09F93ruaF4tw6FhEIV4z5gzCDcjuHnTLMk1DHDtZMXcSfc3vH1kQiGa MBORkzIlRtYWlwsCdrbypohrv1k3MiqtdqyLlQeEBUkKNIy5RithfuMXXBTCnOmyiqM4 wWj4e2YwXzKLxb2jbHa6C5A3lybq7GoZ04YtM1PrKGkKKGE8ri1TlG28S8YyXxDPxqTi rY+FWEAxdqDPqbv4DgPgVROVK9vsc9F8NATo4cG5XEMudvNFxS7dSYbc0ypm6Mrg6sk/ BQFw== X-Gm-Message-State: ALoCoQn1ssmyPO7dN9KIawd/MVkRxIYk7sSIyGNQpAkKRXyfg4LwrIvkUX+3QXKHSImOCajEUpIY X-Received: by 10.66.193.104 with SMTP id hn8mr778981pac.46.1389188924087; Wed, 08 Jan 2014 05:48:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.229 with SMTP id d5ls597949qey.64.gmail; Wed, 08 Jan 2014 05:48:44 -0800 (PST) X-Received: by 10.58.37.67 with SMTP id w3mr9846987vej.22.1389188923985; Wed, 08 Jan 2014 05:48:43 -0800 (PST) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id sc7si598790vdc.95.2014.01.08.05.48.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id p5so1134972vbn.25 for ; Wed, 08 Jan 2014 05:48:43 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr2727009vdc.53.1389188923734; Wed, 08 Jan 2014 05:48:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp226610ved; Wed, 8 Jan 2014 05:48:43 -0800 (PST) X-Received: by 10.194.170.133 with SMTP id am5mr56456526wjc.42.1389188922723; Wed, 08 Jan 2014 05:48:42 -0800 (PST) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id vs5si2232816wjc.132.2014.01.08.05.48.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:42 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.50; Received: by mail-wg0-f50.google.com with SMTP id l18so551374wgh.29 for ; Wed, 08 Jan 2014 05:48:42 -0800 (PST) X-Received: by 10.180.212.98 with SMTP id nj2mr21577994wic.52.1389188922222; Wed, 08 Jan 2014 05:48:42 -0800 (PST) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginm.net. [92.233.57.238]) by mx.google.com with ESMTPSA id j9sm48125217wjx.18.2014.01.08.05.48.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:41 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, angus.clark@st.com, Lee Jones Subject: [PATCH v4 12/37] mtd: st_spi_fsm: Fetch platform specific configurations Date: Wed, 8 Jan 2014 13:46:55 +0000 Message-Id: <1389188840-14306-13-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> References: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;