From patchwork Wed Jan 21 15:53:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 5678581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7403C058D for ; Wed, 21 Jan 2015 15:55:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFD5B204B5 for ; Wed, 21 Jan 2015 15:55:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1581D204CF for ; Wed, 21 Jan 2015 15:55:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDxbR-0003Le-Fw; Wed, 21 Jan 2015 15:53:57 +0000 Received: from mail-la0-x231.google.com ([2a00:1450:4010:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YDxb7-00036T-5q for linux-arm-kernel@lists.infradead.org; Wed, 21 Jan 2015 15:53:37 +0000 Received: by mail-la0-f49.google.com with SMTP id hs14so41031020lab.8 for ; Wed, 21 Jan 2015 07:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AvDTGSErZw94iK7fNIR2UKoAUIQlt4M2wCZ9H2FSw6M=; b=IrWQkicxOD1HciqVM47DXgvXf77jfRx4obXc49rAA1pX1m/mRiHgfiklJA7h9eTgl1 rnGzP549DKd6bWZssdcdnx8b/KpTD9X6yS55oB8CzRUzyr010aVDoDmcnWi0h/GVNVwq 8Y5/LDJKhQ9CJsv0QrIbuKO4oIcefua7YCG7o8FwS/RugqdbuoyZWyzTcOI+Gz4c1m9e CzCoUZ+ZHsbH0Kv8QbCF2PT4VPjX1xBNdnEXvWFiFzxB0EPt2lqxGU2SS7LnJ8SNqRzV y6zO+MNSHHa6sa/4Uhrfg/g6AHUvQunpaWm/VebmAFoG6wmfnsRsKS8dsXYIiCrEidYf tWdw== X-Received: by 10.112.44.171 with SMTP id f11mr44695805lbm.65.1421855594787; Wed, 21 Jan 2015 07:53:14 -0800 (PST) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by mx.google.com with ESMTPSA id sj2sm3035146lac.0.2015.01.21.07.53.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jan 2015 07:53:13 -0800 (PST) From: Ricardo Ribalda Delgado To: Mark Brown , Michal Simek , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] spi/xilinx: Use automatic bus number on device tree Date: Wed, 21 Jan 2015 16:53:08 +0100 Message-Id: <1421855590-9210-2-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421855590-9210-1-git-send-email-ricardo.ribalda@gmail.com> References: <1421855590-9210-1-git-send-email-ricardo.ribalda@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150121_075337_441900_8BB6F899 X-CRM114-Status: GOOD ( 11.36 ) X-Spam-Score: -0.8 (/) Cc: Ricardo Ribalda Delgado X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY 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 If there is more than one spi device on a device tree, the second one will fail to probe due to a duplicated bus_num. This patch uses automatic bus number if the device is deined on a device tree. Signed-off-by: Ricardo Ribalda Delgado --- drivers/spi/spi-xilinx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 79bd84f..2ea4ca5 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -332,14 +332,17 @@ static int xilinx_spi_probe(struct platform_device *pdev) struct spi_master *master; u32 tmp; u8 i; + s16 bus_num; pdata = dev_get_platdata(&pdev->dev); if (pdata) { num_cs = pdata->num_chipselect; bits_per_word = pdata->bits_per_word; + bus_num = pdev->id; } else { of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits", &num_cs); + bus_num = -1; } if (!num_cs) { @@ -369,7 +372,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) goto put_master; } - master->bus_num = pdev->id; + master->bus_num = bus_num; master->num_chipselect = num_cs; master->dev.of_node = pdev->dev.of_node;