From patchwork Thu Jan 23 10:31:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23583 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C01C9218BD for ; Thu, 23 Jan 2014 10:32:13 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id p5sf2685840vbn.6 for ; Thu, 23 Jan 2014 02:32:13 -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=dHPdaPeKVYi/qY6pDhiEdR0P1i47s8buBYO7FDNl//lt5ZF6klQekRsqAHTHr/FjIa 2u+R8I/Z87HqU38B4MU2Cg/XUHTm3ggWcjeKwqfPOu+PS6dQVpR8/1N9k5vKPmz1CCJW WHtxJZmf/iseHBnPITDVzLzQA1pE2DO506cTHdQi3C67i3HYUgu0fntek7UJR2TAo9eW eE3478YUK5ySIXBAH+R4NOSCBX1eFo/rFtGF+6s3HjKY0Z97NVS8rI73RRKiO7LY/bT7 M0fUKg09NDb4Qt2aqGGHnOxMjQMjIW5VopXNvmGnZ67uBaK1cJf2VoQk+hCVk6RxtFPk rw+g== X-Gm-Message-State: ALoCoQm4IoS4/MAKO8MpvwuOhG3jQnmnGlNB6oHvPS+xw46TrE1ogOekqDOpaG7sLhrYLWg1ZwCv X-Received: by 10.58.43.161 with SMTP id x1mr2552816vel.18.1390473132931; Thu, 23 Jan 2014 02:32:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.129 with SMTP id h1ls292634qez.15.gmail; Thu, 23 Jan 2014 02:32:12 -0800 (PST) X-Received: by 10.220.225.71 with SMTP id ir7mr48726vcb.50.1390473132840; Thu, 23 Jan 2014 02:32:12 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id a2si6429293vea.29.2014.01.23.02.32.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id jz11so973015veb.36 for ; Thu, 23 Jan 2014 02:32:12 -0800 (PST) X-Received: by 10.58.219.1 with SMTP id pk1mr28748vec.49.1390473132769; Thu, 23 Jan 2014 02:32:12 -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.220.174.196 with SMTP id u4csp15939vcz; Thu, 23 Jan 2014 02:32:12 -0800 (PST) X-Received: by 10.180.205.162 with SMTP id lh2mr7099767wic.57.1390473131373; Thu, 23 Jan 2014 02:32:11 -0800 (PST) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by mx.google.com with ESMTPS id fc7si8774410wjc.108.2014.01.23.02.32.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:11 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.46 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.46; Received: by mail-wg0-f46.google.com with SMTP id x12so1251437wgg.13 for ; Thu, 23 Jan 2014 02:32:11 -0800 (PST) X-Received: by 10.180.9.71 with SMTP id x7mr7078662wia.55.1390473130937; Thu, 23 Jan 2014 02:32:10 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.32.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:32:10 -0800 (PST) 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> 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.128.177 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;