From patchwork Fri Dec 21 14:43:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 1903251 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id 346E840076 for ; Fri, 21 Dec 2012 14:43:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Tm3os-0002lu-K9; Fri, 21 Dec 2012 14:43:26 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Tm3oq-0002lh-26 for spi-devel-general@lists.sourceforge.net; Fri, 21 Dec 2012 14:43:24 +0000 X-ACL-Warn: Received: from mail-out.m-online.net ([212.18.0.9]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1Tm3oh-00078m-SX for spi-devel-general@lists.sourceforge.net; Fri, 21 Dec 2012 14:43:24 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3YSXd86W3zz4KKBP; Fri, 21 Dec 2012 15:43:08 +0100 (CET) X-Auth-Info: i/gnUM9ITflJq8RT7/ICtikJ9aMAnv/azY4F9p9ox2M= Received: from localhost (p4FC464B5.dip.t-dialin.net [79.196.100.181]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3YSXd85GsCzbbj9; Fri, 21 Dec 2012 15:43:08 +0100 (CET) From: Anatolij Gustschin To: spi-devel-general@lists.sourceforge.net Subject: [PATCH] spi: spi-mpc512x-psc: don't use obsolet cell-index property Date: Fri, 21 Dec 2012 15:43:01 +0100 Message-Id: <1356100981-18685-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.18.0.9 listed in list.dnswl.org] X-Headers-End: 1Tm3oh-00078m-SX X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net Use unique PSCx register base offset to obtain the SPI PSC number used for SPI bus id. Signed-off-by: Anatolij Gustschin --- drivers/spi/spi-mpc512x-psc.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 0a1e39e..844d68f 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -523,16 +523,21 @@ static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op) /* get PSC id (0..11, used by port_config) */ if (op->dev.platform_data == NULL) { - const u32 *psc_nump; + u32 reg; + int err; - psc_nump = of_get_property(op->dev.of_node, "cell-index", NULL); - if (!psc_nump || *psc_nump > 11) { - dev_err(&op->dev, "mpc512x_psc_spi: Device node %s " - "has invalid cell-index property\n", + err = of_property_read_u32(op->dev.of_node, "reg", ®); + if (err) { + dev_err(&op->dev, "Can't read reg property: %d\n", err); + return err; + } + + id = (reg & 0xf00) >> 8; + if (id > 11) { + dev_err(&op->dev, "node %s has invalid reg property\n", op->dev.of_node->full_name); return -EINVAL; } - id = *psc_nump; } return mpc512x_psc_spi_do_probe(&op->dev, (u32) regaddr64, (u32) size64,