From patchwork Fri Oct 13 19:54:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10005847 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 2EB4F60325 for ; Fri, 13 Oct 2017 20:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2010A29157 for ; Fri, 13 Oct 2017 20:08:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 150DE29164; Fri, 13 Oct 2017 20:08:25 +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=unavailable 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 5014529157 for ; Fri, 13 Oct 2017 20:08:24 +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=CFqO/qh4TJsygInb6pLV1hJqtC+DLJ+eQVRyQ5z0kck=; b=cmvay9Vfyfh7Wm jJ48XnFhUbvo00F0CxJlUWx9vPT9GtgbqFfy0tcVsYZ5Jibb6J2CusJClgQxSUaAUq2un/G2JyEpb 0kigmqLgqE1mohsG7vo83p39TLuC43u4HuL5IVjgy2Phf7daI33yxEWMFbrneC+XF8UbnP4kK5zhB xBOzofs9bpFDpV4bs32Y7ugfMZ5tFbYuZIn4Kh+k5qw1SJsLW/kCQCI2tgL+SCo5nC0cfvO3yqU2P tG6Yz3UTQkOAEIT2gNL+b+4u593xZNjCifIH7bngd1TsgmU9TlbA2HieoVl2BPnTnkglqFALV1Dm7 6GaXOKrh0gX3NvTEh9wA==; 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 1e36Fq-0002An-Hh; Fri, 13 Oct 2017 20:08:22 +0000 Received: from mail-by2nam03on0136.outbound.protection.outlook.com ([104.47.42.136] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e3635-0003E7-9R for linux-arm-kernel@lists.infradead.org; Fri, 13 Oct 2017 19:55:22 +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=dR3UU9AuiMtNqm55OE4phAmrF4NiTFyvbpFqnFaNUpM=; b=KfOek2eWiBLHYN5eq2jPlzvx154RIzUcUU/p7qyoyT0asF1f9eDGIJ8m0Q0IdEwoxSizUEVVmShJgv6h4Cyvr2pKGQ6MeAOBg4DK++WgOz/gEoEv28hFMamYunmX+LX4uHedDhaYftswJc3ebB4KDCPM4oF91ECbYxNKhrVByGs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct 2017 19:54:43 +0000 From: Trent Piepho To: linux-spi , linux-arm-kernel Subject: [PATCH 4/4] ARM: imx: Update spi_imx platform data to reflect current state Date: Fri, 13 Oct 2017 12:54:10 -0700 Message-Id: <20171013195410.30767-4-tpiepho@impinj.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171013195410.30767-1-tpiepho@impinj.com> References: <20171013195410.30767-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: MWHPR21CA0064.namprd21.prod.outlook.com (10.172.93.154) To BN6PR06MB2803.namprd06.prod.outlook.com (10.175.127.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bbd423bf-1bf9-43fc-a0ba-08d512744041 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR06MB2803; X-Microsoft-Exchange-Diagnostics: 1; BN6PR06MB2803; 3:MXYqARtWOD1sXZabGhVMnV3eooQvo/hNZ2nzjbr/CzRhOg4lZZ08gIc4hg3K7JG9zkcRH7A1Iaz7XKYN6ca4Ps7NtfWR4UEB33ONfGs66MEkRxIUMy/O/GgbA7Kc2wZaT/svk5byRGusHfuDYRqPs00L0dpUBHrKVlJp8o6jsYN7bLmScJrZAOPwEFcEJq1h8sDk6PzwcmTL01otp+5E0lmxF22gSY8Rl3SOwtW+fm5uprhBUjuXmiw/ik3KeBTL; 25:vi0BDMVyBtvtyOg3Dj5WcWHF5fwiObMIGYrKxrDCfkOjM8MnHuhsyPJbD8/gw82Dkbcb1W1ayBUG01jTXZTNo6sB7nXE3fGAynnJA5ouwYGPi8XlALvsFV5OeIKwcEVRliN35/UdrIJxmRUQUbVuuW6+Sa+4MBhUpIHfMJKc/oMwQHbRSrtjei0gfFDZeNLAExue7foETygpm9JvmO5WkF9kAb8zZSbUzRX+GFIVgTf9WpspI5raGgsOdV824IlIOb7rVvztFDGRij4rys0o9nRcAThW/kmiSB0BhWAoDF1PQd8hYk94ulIJ0HaK0N+iF3cK0N53AN1xU5L1q5oTqg==; 31:KK472CuMYNRvGooVyN2rvyD753gv8aLeNsxo1GD9kkOCg2FYmjk9e6i4+ybSTc27sApnFWp5UD+nAp7FApipzZNRCJJBvFmGinNQDC651+GRl4Avr/NLn4HJ4pM+fAimunfsNlfl0520z3wuFUiViJe0wT4QBnUL4vJFHEXSFdGy9MTitKGkyk8XKd5kNkqbkkjWpcYSpJbZom/h78Nb19UWHkgRkDTvM8rF7cMKjvA= X-MS-TrafficTypeDiagnostic: BN6PR06MB2803: X-Microsoft-Exchange-Diagnostics: 1; BN6PR06MB2803; 20:EV35jpJQqbINjzdM0wXGvk6wxMi2sCrpcjOv5hAq27GiooJpC4U1G6xXZlVjk2Agg1RWZqEkqdOMpSlemA3hWRCoVyOiV1Z8ePA2j527Fiy0NfFDZGUkauT3AMIt5JKQrZD0aDP6SnkGq4kKIvBOwEcYuR7LgYB4tYtqx0504x/17qCpvIhYYjTNj9BJyzWng/cvUHrdqAJinWo3CQtiUNw3QaoF56xErgHDBNXYbn4VVY6/G6r+guMphK+aTwwQFUX1gaNcKq3NV6oG6H7KbjTspCpjKjwc0a7S21nLH6apP1f5wvO/26unXE4EltfbCCFtyjH/MyRU1Ml+pTb1P8aVcORHt61l0wuNkuWKd0T6dS9Sm4qRrl+5Z2Dr0lRwTQhtycMq7XU8FQeiu8enZp+5uChqCm2rHGAoQUdPnpSz2sUtZGqok4WhTFopuTWGy7vL2FypPSnudspjqaXqastDXKZxDWvQULT3Th1OvgI0BuMlgD8KHagXT4SqCvrV; 4:al3BBsa3NA9hkmyvA28soJiEMhOg4d/AEKA/djo6sQS8vQ3DVjTrFG9uG/lwnNXdW3T8tWjGQZFBVT1sHQ1P42aynmbUfK0jbc4pjl5LeohK9BBEKY14zda/Zw/UH/bFWnBeekCblNvZXB+/wlGwxANkymRWsbUf13HpV50bSTMk4/VkMWFib3ARQKAi2sr2PIYJUKcFCPI+6d18hpdHviZpQtIKLaT5GoA1UDZsOtrMdeSwoUlXYQoQFL1gN7sptJFprPHAloDbO80MD3/UPgkQfdSXbcVx7Pd5a92d7Jk= 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)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR06MB2803; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR06MB2803; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(346002)(39830400002)(376002)(199003)(189002)(47776003)(6666003)(107886003)(8656003)(4326008)(53936002)(21086003)(68736007)(66066001)(2906002)(5003940100001)(2950100002)(3846002)(1076002)(69596002)(33646002)(6116002)(8676002)(105586002)(55016002)(189998001)(106356001)(48376002)(478600001)(50466002)(110136005)(50986999)(97736004)(76176999)(5660300001)(54906003)(50226002)(16586007)(81166006)(8936002)(316002)(305945005)(16526018)(86362001)(7736002)(25786009)(101416001)(36756003)(81156014)(15650500001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR06MB2803; 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; BN6PR06MB2803; 23:2LKsd5cnQUnmR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y+aBDwivp++ao8PVL/yOfhQ0Jgz9ba5CR+I1YIlz+bal+cX57q2LvFQR+cFQFdt3ubRaB1Wd1g63Qk2OmQhDvOXQaOM1KyvlatsZ1JdxGgyXxiOSefJHw97WjvMKW5ySKGKemaSDcW2oS+JJ/LXEk+r9fsiWTz+c4mVV0CFRgAxvSQgbxa7aKa2SQPS9CCBApT+dTX1bN6esozG7LuP+gS8q0a8vu/g13gem3f5Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 19:54:43.9467 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2803 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171013_125511_788923_4C2705F9 X-CRM114-Status: GOOD ( 15.96 ) 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 , Shawn Guo , Greg Ungerer , 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 The docs for the spi_imx platform data still refer to a -32 offset used to specify a native chip select. This was removed in commit 602c8f4485cd ("spi: imx: fix use of native chip-selects with devicetree") and no longer works as documented. Update documentation. The macro MXC_SPI_CS() is no longer is needed. If a board uses all native chip selects, then it's not necessary to specify a chip select array at all, as all native is the default (this is how device-tree configured SPI masters work too). Most of the spi-imx platform data users have their chip select arrays removed by this patch. This patch also fixes a bug in mx31moboard introduced in the '602 commit. When that board was updated in commit 901f26bce64a ("ARM: imx: set correct chip_select in platform setup") to reflect the SPI change, only SPI bus 2 was updated and SPI bus 1 was left with non-sequential chip selects. The mc13783 spi device on bus 1 had its chip select updated as if it were on bus 2. CC: Greg Ungerer CC: Shawn Guo CC: Sascha Hauer CC: Fabio Estevam Signed-off-by: Trent Piepho Acked-by: Greg Ungerer --- arch/arm/mach-imx/mach-mx31_3ds.c | 18 ++---------------- arch/arm/mach-imx/mach-mx31lilly.c | 12 ++---------- arch/arm/mach-imx/mach-mx31lite.c | 16 ++-------------- arch/arm/mach-imx/mach-mx31moboard.c | 17 +++-------------- arch/arm/mach-imx/mach-pcm037_eet.c | 5 +---- include/linux/platform_data/spi-imx.h | 29 +++++++++++++++++------------ 6 files changed, 27 insertions(+), 70 deletions(-) diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c index 68c3f0799d5b..9d87f1dcf7bb 100644 --- a/arch/arm/mach-imx/mach-mx31_3ds.c +++ b/arch/arm/mach-imx/mach-mx31_3ds.c @@ -374,26 +374,12 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = { }; /* SPI */ -static int spi0_internal_chipselect[] = { - MXC_SPI_CS(0), - MXC_SPI_CS(1), - MXC_SPI_CS(2), -}; - static const struct spi_imx_master spi0_pdata __initconst = { - .chipselect = spi0_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect), -}; - -static int spi1_internal_chipselect[] = { - MXC_SPI_CS(0), - MXC_SPI_CS(1), - MXC_SPI_CS(2), + .num_chipselect = 3, }; static const struct spi_imx_master spi1_pdata __initconst = { - .chipselect = spi1_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), + .num_chipselect = 3, }; static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c index 6fd463642954..8bf52819d4d9 100644 --- a/arch/arm/mach-imx/mach-mx31lilly.c +++ b/arch/arm/mach-imx/mach-mx31lilly.c @@ -226,20 +226,12 @@ static void __init lilly1131_usb_init(void) /* SPI */ -static int spi_internal_chipselect[] = { - MXC_SPI_CS(0), - MXC_SPI_CS(1), - MXC_SPI_CS(2), -}; - static const struct spi_imx_master spi0_pdata __initconst = { - .chipselect = spi_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), + .num_chipselect = 3, }; static const struct spi_imx_master spi1_pdata __initconst = { - .chipselect = spi_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), + .num_chipselect = 3, }; static struct mc13xxx_platform_data mc13783_pdata __initdata = { diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c index f033a57d5694..fcbaf0070ccf 100644 --- a/arch/arm/mach-imx/mach-mx31lite.c +++ b/arch/arm/mach-imx/mach-mx31lite.c @@ -83,15 +83,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { }; /* SPI */ -static int spi0_internal_chipselect[] = { - MXC_SPI_CS(0), - MXC_SPI_CS(1), - MXC_SPI_CS(2), -}; - static const struct spi_imx_master spi0_pdata __initconst = { - .chipselect = spi0_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect), + .num_chipselect = 3, }; static const struct mxc_nand_platform_data @@ -133,13 +126,8 @@ static struct platform_device smsc911x_device = { * The MC13783 is the only hard-wired SPI device on the module. */ -static int spi1_internal_chipselect[] = { - MXC_SPI_CS(0), -}; - static const struct spi_imx_master spi1_pdata __initconst = { - .chipselect = spi1_internal_chipselect, - .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), + .num_chipselect = 1, }; static struct mc13xxx_platform_data mc13783_pdata __initdata = { diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index 7716f83aecdd..643a3d749703 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c @@ -152,14 +152,8 @@ static const struct imxi2c_platform_data moboard_i2c1_data __initconst = { .bitrate = 100000, }; -static int moboard_spi1_cs[] = { - MXC_SPI_CS(0), - MXC_SPI_CS(2), -}; - static const struct spi_imx_master moboard_spi1_pdata __initconst = { - .chipselect = moboard_spi1_cs, - .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), + .num_chipselect = 3, }; static struct regulator_consumer_supply sdhc_consumers[] = { @@ -296,19 +290,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = { /* irq number is run-time assigned */ .max_speed_hz = 300000, .bus_num = 1, - .chip_select = 1, + .chip_select = 0, .platform_data = &moboard_pmic, .mode = SPI_CS_HIGH, }, }; -static int moboard_spi2_cs[] = { - MXC_SPI_CS(0), MXC_SPI_CS(1), -}; - static const struct spi_imx_master moboard_spi2_pdata __initconst = { - .chipselect = moboard_spi2_cs, - .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), + .num_chipselect = 2, }; #define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c index 95bd97710494..15bc956d466b 100644 --- a/arch/arm/mach-imx/mach-pcm037_eet.c +++ b/arch/arm/mach-imx/mach-pcm037_eet.c @@ -56,11 +56,8 @@ static struct spi_board_info pcm037_spi_dev[] = { }; /* Platform Data for MXC CSPI */ -static int pcm037_spi1_cs[] = { MXC_SPI_CS(0), MXC_SPI_CS(1), }; - static const struct spi_imx_master pcm037_spi1_pdata __initconst = { - .chipselect = pcm037_spi1_cs, - .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs), + .num_chipselect = 2, }; /* GPIO-keys input device */ diff --git a/include/linux/platform_data/spi-imx.h b/include/linux/platform_data/spi-imx.h index 08be445e8eb8..9b2ed66ef7a2 100644 --- a/include/linux/platform_data/spi-imx.h +++ b/include/linux/platform_data/spi-imx.h @@ -4,24 +4,29 @@ /* * struct spi_imx_master - device.platform_data for SPI controller devices. - * @chipselect: Array of chipselects for this master. Numbers >= 0 mean gpio - * pins, numbers < 0 mean internal CSPI chipselects according - * to MXC_SPI_CS(). Normally you want to use gpio based chip - * selects as the CSPI module tries to be intelligent about - * when to assert the chipselect: The CSPI module deasserts the - * chipselect once it runs out of input data. The other problem - * is that it is not possible to mix between high active and low - * active chipselects on one single bus using the internal - * chipselects. Unfortunately Freescale decided to put some + * @chipselect: Array of chipselects for this master or NULL. Numbers >= 0 + * mean GPIO pins, -ENOENT means internal CSPI chipselect + * matching the position in the array. E.g., if chipselect[1] = + * -ENOENT then a SPI slave using chip select 1 will use the + * native SS1 line of the CSPI. Omitting the array will use + * all native chip selects. + + * Normally you want to use gpio based chip selects as the CSPI + * module tries to be intelligent about when to assert the + * chipselect: The CSPI module deasserts the chipselect once it + * runs out of input data. The other problem is that it is not + * possible to mix between high active and low active chipselects + * on one single bus using the internal chipselects. + * Unfortunately, on some SoCs, Freescale decided to put some * chipselects on dedicated pins which are not usable as gpios, * so we have to support the internal chipselects. - * @num_chipselect: ARRAY_SIZE(chipselect) + * + * @num_chipselect: If @chipselect is specified, ARRAY_SIZE(chipselect), + * otherwise the number of native chip selects. */ struct spi_imx_master { int *chipselect; int num_chipselect; }; -#define MXC_SPI_CS(no) ((no) - 32) - #endif /* __MACH_SPI_H_*/