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: 5678551 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 353549F333 for ; Wed, 21 Jan 2015 15:54:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AFEA204B5 for ; Wed, 21 Jan 2015 15:54:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8244A204AB for ; Wed, 21 Jan 2015 15:53:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754702AbbAUPx5 (ORCPT ); Wed, 21 Jan 2015 10:53:57 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:44266 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753404AbbAUPxQ (ORCPT ); Wed, 21 Jan 2015 10:53:16 -0500 Received: by mail-lb0-f175.google.com with SMTP id z11so40094045lbi.6; 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 Cc: Ricardo Ribalda Delgado 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> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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;