From patchwork Fri Mar 14 09:35:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Zhiqiang X-Patchwork-Id: 3831881 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89ABCBF540 for ; Fri, 14 Mar 2014 09:37:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81C612034C for ; Fri, 14 Mar 2014 09:37:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B23A32034B for ; Fri, 14 Mar 2014 09:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755823AbaCNJhu (ORCPT ); Fri, 14 Mar 2014 05:37:50 -0400 Received: from am1ehsobe002.messaging.microsoft.com ([213.199.154.205]:27824 "EHLO am1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755755AbaCNJhs (ORCPT ); Fri, 14 Mar 2014 05:37:48 -0400 Received: from mail54-am1-R.bigfish.com (10.3.201.242) by AM1EHSOBE003.bigfish.com (10.3.204.23) with Microsoft SMTP Server id 14.1.225.22; Fri, 14 Mar 2014 09:37:47 +0000 Received: from mail54-am1 (localhost [127.0.0.1]) by mail54-am1-R.bigfish.com (Postfix) with ESMTP id 29966120734; Fri, 14 Mar 2014 09:37:47 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 9 X-BigFish: VS9(z616jzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah21bch1fc6hzz1de098h8275bh1de097h8bddoz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h24afh2327h2336h2438h2461h2487h24d7h2516h2545h255eh25cch25f6h2605h1155h) Received: from mail54-am1 (localhost.localdomain [127.0.0.1]) by mail54-am1 (MessageSwitch) id 1394789865658556_27049; Fri, 14 Mar 2014 09:37:45 +0000 (UTC) Received: from AM1EHSMHS002.bigfish.com (unknown [10.3.201.226]) by mail54-am1.bigfish.com (Postfix) with ESMTP id 9B1FA34006D; Fri, 14 Mar 2014 09:37:45 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS002.bigfish.com (10.3.207.102) with Microsoft SMTP Server (TLS) id 14.16.227.3; Fri, 14 Mar 2014 09:37:43 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.3.158.2; Fri, 14 Mar 2014 09:37:42 +0000 Received: from titan.am.freescale.net (b45104-01-010192208233.ap.freescale.net [10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s2E9bXqY011438; Fri, 14 Mar 2014 02:37:38 -0700 From: Hou Zhiqiang To: , CC: , , , , , , , , , Hou Zhiqiang Subject: [PATCH 2/2] spi/fsl-lib: Get the SPI controller bus number from DTS Date: Fri, 14 Mar 2014 17:35:57 +0800 Message-ID: <1394789757-40732-2-git-send-email-B48286@freescale.com> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1394789757-40732-1-git-send-email-B48286@freescale.com> References: <1394789757-40732-1-git-send-email-B48286@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-FOPE-CONNECTOR: Id%0$Dn%FREESCALE.MAIL.ONMICROSOFT.COM$RO%1$TLS%0$FQDN%$TlsDn% Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, UNRESOLVED_TEMPLATE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Get the spi_master's bus_num from DTS to make the spi_master's name static. So "mtdparts=spi.bus_num.chip_select:..." in cmdline can be used to asign mtd partions of spi flash. Signed-off-by: Hou Zhiqiang --- drivers/spi/spi-fsl-lib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 0b75f26..f5f0307b 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c @@ -198,7 +198,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) struct mpc8xxx_spi_probe_info *pinfo; struct fsl_spi_platform_data *pdata; const void *prop; - int ret = -ENOMEM; + int ret = -ENOMEM, bus_num; pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL); if (!pinfo) @@ -207,8 +207,12 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) pdata = &pinfo->pdata; dev->platform_data = pdata; - /* Allocate bus num dynamically. */ - pdata->bus_num = -1; + ret = of_property_read_u32(np, "bus-num", &bus_num); + if (ret < 0) { + /* Allocate bus num dynamically. */ + bus_num = -1; + } + pdata->bus_num = bus_num; #ifdef CONFIG_FSL_SOC /* SPI controller is either clocked from QE or SoC clock. */