From patchwork Mon Nov 6 19:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10044349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 738D460247 for ; Mon, 6 Nov 2017 19:47:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6370823794 for ; Mon, 6 Nov 2017 19:47:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5814A29FBE; Mon, 6 Nov 2017 19:47:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD68623794 for ; Mon, 6 Nov 2017 19:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dAXBZYfNIgf8XXaGFqI0rUKAW43EQLQAHF+JzUAjbBw=; b=U9rNM6yYDdy7L1 OB8CoNX2QIgT3aWCvkJ4qVwOELM/dxG4FOsXqVOHc5x2U24tsbkeKCYyt2r+1zdjmCterumogK3tQ 39EwwdxGDPKqFXkqnDxTz5m1eecxhoZwpNFUXNjIqkxJ6P+F6JwY6IuEdTk+gHiOKEzgusjhFZRkk hS3ckIjS/AP2dU6+L0EzejaL8/R8jy3JBFXRPKVGGXxTZn2IIaUInxfEjA4UNS078NiEcrqskaPJt E7ZGpGRntrcUSxcAbn3we00UwZDI891AFN4tU600g2wPUDuDxCtITbLTOkGH3+qlx3k2vbiiD+q57 xW61vR+Wq0ucEwEhGTdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eBnMV-0000Eu-Ef; Mon, 06 Nov 2017 19:47:11 +0000 Received: from mail-by2nam03on0106.outbound.protection.outlook.com ([104.47.42.106] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eBnMM-0007sT-OX for linux-arm-kernel@lists.infradead.org; Mon, 06 Nov 2017 19:47:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.onmicrosoft.com; s=selector1-impinj-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=m0tCcE9gsZjuqTl6avmTxNs5FSqi4rspflBFktuikGw=; b=EW2io4M5WaTMkIHMBxU2OdrYO+6NQGqRrcdNQ8Ehf6gBKgiMSM6kFQAJKh6ZwITB5zQPecO2sHwRWvWMeUSrEwYNTiMGM+VgTClwAmAc9cbEo2V8Aroco01thnSmOOatwUg9+KUCJ3ZrClpsFJa61YW1k5r4oMVFtyal/wcrWGo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by MWHPR06MB2814.namprd06.prod.outlook.com (10.175.137.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Mon, 6 Nov 2017 19:46:31 +0000 From: Trent Piepho To: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 2/3] spi: imx: Don't require platform data chipselect array Date: Mon, 6 Nov 2017 11:46:17 -0800 Message-Id: <20171106194618.9421-3-tpiepho@impinj.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171106194618.9421-1-tpiepho@impinj.com> References: <20171106194618.9421-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR06CA0001.namprd06.prod.outlook.com (10.174.172.142) To MWHPR06MB2814.namprd06.prod.outlook.com (10.175.137.147) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9eb95e2a-c014-45b6-1193-08d5254f13fb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:MWHPR06MB2814; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2814; 3:v66vMRnCNFmudEVo3OlG8LTVcMSL2FifTVTnSO5VdJZIDkFKzZbKNugIhThr2AdPSywJHBqGiVWss7H5X7VriVdGAkIwhI0PyAb5ZcHg8xdTd9kY4FIJ7Kp53V5g4WLUayYrw+qux5rKNJZ860HoUFz5DO8i7CKH2o6AzJ7JJ+6WIk/8YAW2rTFo5Se5yaGyl8Da+fvRb5mY9+leKkqGzNT3KS8zHpLdji/3UGuqgrU6IeA9QLT2SZvdEd6kv12D; 25:XruZssz/ulahHWX939pn55stcL/GOm+M9rNGbHY1hluMbD45I0MCaR6ZCIi5lbni66mszbzb5kMBwHgkXCNO2qFOGb3jz37+AsbZLMj1XgZLi6zuX1aMGmOlNpOgbnZfzz8ITQhiRYuqfJsV82E/jn5tCBhSGKhQfN01goXZTe5FB8uqKxAEFhjeXhZmMK9ucBzidLVu8KdOsoIAm0Y4k0lxywtrPlxru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stWuaFlC9BNhyPzTDrLn36QWakexZBC/rx7rjmFXXSnrAAAqEDRxrj2ojs+HfSZyVnC3Q8qSzy5lGzL+EIdOdOo9JUsQMZkYvGRCJ4bpWtmSTqrGywaqTB1gQU7dcltRXMOyRcmEcZF/M9GKygh4BfbbMvjSCGX1zVzgvXwv3iPoI6bSR5YLV3/bny9JyMpi X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(3231021)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR06MB2814; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR06MB2814; X-Forefront-PRVS: 048396AFA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(39830400002)(376002)(346002)(199003)(189002)(2906002)(21086003)(50226002)(33646002)(16526018)(4326008)(101416001)(76176999)(50986999)(36756003)(478600001)(66066001)(25786009)(1076002)(16586007)(5003940100001)(105586002)(305945005)(7736002)(316002)(68736007)(3846002)(6116002)(106356001)(6666003)(55016002)(48376002)(47776003)(54906003)(69596002)(86362001)(81156014)(81166006)(189998001)(2950100002)(8936002)(97736004)(5660300001)(50466002)(8656006)(53936002)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR06MB2814; H:impinj.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR06MB2814; 23:saoUN65Ec17JX218eOq1ri4bSmWCym/yi4SPOMKgw?= =?us-ascii?Q?DbOQriTvBHyJbXEGSXaMEE1EfKnk4BLNj5OixDqsjzIzXwRcVkxtx6eevCGw?= =?us-ascii?Q?cA++VKrZvL5thn53Im8S/88ttsWtbAM+l4qvv2aYHRfGL91JZKdjShYGmhhL?= =?us-ascii?Q?abm+2zOIvZU/u0D1CGxTrA+Gu+BYCp+TYSuijYbeILAsNalZjVOG5DX3DlqJ?= =?us-ascii?Q?eOOsQFGwFZi9RJTrbWfSmoX36E6oYPRckGqBhzWUW5P/NTfhJkKU+178LFOC?= =?us-ascii?Q?T+yPwfop5QGGqWFlemNdO0EgRX1KERXfanjuR9f3nPg/bbUxIOkO7bCSAlGf?= =?us-ascii?Q?U26XcPwJXC6KWakEhqzVVIOJ56+OaMbt25PWHFf5MKwZqvNwGx2FaBhiYC39?= =?us-ascii?Q?ZwbnYds80GlOeZX7BKsmzdbcAM74zLKA3Pjmh3r1g8ThWQuXNLQlYdiP2Vel?= =?us-ascii?Q?mYMfkhBkBfuZBgMeYsJuqLv982P33wQjgniWXnfry0SDWS1ETNGFOJ4T0Bo2?= =?us-ascii?Q?spafl2T10HeqMSYex29PgxgB3bjYbRWU5GM0olM4UFW7kB+Z3QDwmHtXuggd?= =?us-ascii?Q?pvPz/vucIriFrmBT7Ztm38XcvfLu91X4MSOMPt0KdHa25V8EMNkG97s+KRGn?= =?us-ascii?Q?WQKrylq+hFPCjNk1AgSu3MWOxPtO0aSkeNKNV7pWWzBYjaIqHTi1PJEBb3/g?= =?us-ascii?Q?mC7zrLSjIa7Ql/W7/fHhl79REhQhENi03xMEmajyjJIdO//Ig8ulJNKPq7GA?= =?us-ascii?Q?HYe7dRsYKs0C03iUvzGug+W8V2QVQSpBoZa/vm40wnMBaSaUsaZD/aGaS54Q?= =?us-ascii?Q?VUdsb2HOc+rM0dXrcGErYCDXO4sfeSnyzTPLK6ENoBAO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EWaudfBW6fD/zNCwcAhzZyyS9dLYUKxjKfVyeHCLBPmJVbJNYGTKNiGTYRHJt+efnNDQAuVcY14JelcYmN/XOn3PskeKBlfTXq3Utp1utXZkBFWmB5no35aQ4PJgdrBgmiHlsfStpw9eKLcrr88Xpke9B2IFa04nKcHOFYML4MFRwpekBqvuGfJVg4Oy+qfcoKiVtcN8V8PxQ+fVhUR252Fht8e3tT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2017 19:46:31.0033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9eb95e2a-c014-45b6-1193-08d5254f13fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR06MB2814 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171106_114703_096980_45B0ABC8 X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , Mark Brown , Shawn Guo , Sascha Hauer , Trent Piepho Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If the array is not present, assume all chip selects are native. This is the standard behavior for SPI masters configured via the device tree and the behavior of this driver as well when it is configured via device tree. This reduces platform data vs DT differences and allows most of the platform data based boards to remove their chip select arrays. CC: Shawn Guo CC: Sascha Hauer CC: Fabio Estevam CC: Mark Brown Signed-off-by: Trent Piepho Reviewed-by: Oleksij Rempel --- drivers/spi/spi-imx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index ad54f8258513..5caa6c9524fa 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1526,13 +1526,15 @@ static int spi_imx_probe(struct platform_device *pdev) /* Get number of chip selects, either platform data or OF */ if (mxc_platform_info) { master->num_chipselect = mxc_platform_info->num_chipselect; - master->cs_gpios = devm_kzalloc(&master->dev, - sizeof(int) * master->num_chipselect, GFP_KERNEL); - if (!master->cs_gpios) - return -ENOMEM; - - for (i = 0; i < master->num_chipselect; i++) - master->cs_gpios[i] = mxc_platform_info->chipselect[i]; + if (mxc_platform_info->chipselect) { + master->cs_gpios = devm_kzalloc(&master->dev, + sizeof(int) * master->num_chipselect, GFP_KERNEL); + if (!master->cs_gpios) + return -ENOMEM; + + for (i = 0; i < master->num_chipselect; i++) + master->cs_gpios[i] = mxc_platform_info->chipselect[i]; + } } else { u32 num_cs;