From patchwork Wed Oct 10 17:09:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B520B16B1 for ; Wed, 10 Oct 2018 17:46:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BE5E2A88F for ; Wed, 10 Oct 2018 17:46:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CECB2A895; Wed, 10 Oct 2018 17:46:46 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 AC7762A88F for ; Wed, 10 Oct 2018 17:46:45 +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=anqWoQcss3LDkOdjfjo1UVPjMJjfsUq0I6PFi0KorB8=; b=E7WlSZY9qlpd8+ 7iZ8ty1/BM5OaUQeAI45SpwvA0im2eVYmZCB2wVuI77qGiSnZmKLtm0fzqCQVRFd6J6ANrV04xrNK zeBhCAv9TxbsorkHT6cw9GXpsBHYaXOVSwrWHpXzH61DmZYdXXSXjr1Y5pz799jpqnl63P0WqnE8q vo6DvfAzP1wKgUEzJFKK8n8Xmn2ww/s6KMTtZsREMnsZbmX4JcDHDsSIESS4khcKkrhHAgOEXKaeh 0ETKWG4c5Coz/YzM/NMoD3fHzvTSQ7sbpM+OG2HmJcJKVA4zBV4ZL4NgqmfNiGDYtpEEuoKJz2AeI 57H+KGcJpCUQh7JazRCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIZ7-0006js-Vl; Wed, 10 Oct 2018 17:46:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXm-0004bR-LD for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 17:45:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8CIcgtbgSjq2ICuDE5dAumAIE7fX3mojkU9FxHhkzkM=; b=Gq/jvlwIZjayIHt65MNh6DXgzF GBvmsmIBv4qWNoFihdtwBFD4kXXsvIVHFIWjbgYyMLYvZDTsWy+wJm/oy6sUqAqKf/l/rhvIw6UsS EhsEAd8cIg0ol6XSoYOgRugj5DOrwnQOQcHd7pP3pk0GZwPfc7JkNM0yMEzvVRUS9xtwLCO0Q78Wf 6N5d22AEkEf/w0YpEbqRZgnmYspA4AiVycFN3/UClUkKeUsw8VNhKzc/xpxyTXjuKMDei7cTt7CjM opxsLXalaair/sfU5bVY2BC5cz4063DgWChcFrr1xmyDulaUqzUpAcK5DPK/WvXx6CT0WW/V7Om0J 3H7ZB6mw==; Received: from shell.v3.sk ([90.176.6.54]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI05-0006Jd-Hn for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:22 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 49883BCF82; Wed, 10 Oct 2018 19:10:04 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2sB7eBjoDblg; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 0F170BCF8F; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8TncUCPCAymy; Wed, 10 Oct 2018 19:09:52 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 6A21EBCF82; Wed, 10 Oct 2018 19:09:51 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH v2 01/11] dt-bindings: spi/spi-pxa2xx: add PXA2xx SSP SPI Controller Date: Wed, 10 Oct 2018 19:09:26 +0200 Message-Id: <20181010170936.316862-2-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_181021_631987_89820ACE X-CRM114-Status: GOOD ( 13.13 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 This is the SPI controller found on Marvel MMP2 and perhaps more platforms. Reviewed-by: Rob Herring Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- Changes since v1: - s/ssp@d4035000/spi@d4035000/ .../devicetree/bindings/spi/spi-pxa2xx.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-pxa2xx.txt diff --git a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt new file mode 100644 index 000000000000..0335a9bd2e8a --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt @@ -0,0 +1,24 @@ +PXA2xx SSP SPI Controller + +Required properties: +- compatible: Must be "marvell,mmp2-ssp". +- reg: Offset and length of the device's register set. +- interrupts: Should be the interrupt number. +- clocks: Should contain a single entry describing the clock input. +- #address-cells: Number of cells required to define a chip select address. +- #size-cells: Should be zero. + +Optional properties: +- cs-gpios: list of GPIO chip selects. See the SPI bus bindings, + Documentation/devicetree/bindings/spi/spi-bus.txt + +Child nodes represent devices on the SPI bus + See ../spi/spi-bus.txt + +Example: + ssp1: spi@d4035000 { + compatible = "marvell,mmp2-ssp"; + reg = <0xd4035000 0x1000>; + clocks = <&soc_clocks MMP2_CLK_SSP0>; + interrupts = <0>; + }; From patchwork Wed Oct 10 17:09:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD2AB933 for ; Wed, 10 Oct 2018 17:46:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A032A895 for ; Wed, 10 Oct 2018 17:46:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C8752A899; Wed, 10 Oct 2018 17:46:10 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 F28B22A895 for ; Wed, 10 Oct 2018 17:46:08 +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=j9/OcEqBVKnjUBJUfEaxlhwwFFjRfQ/V5QEYJbgXGrk=; b=N0MVVCV7UnuuJ2 8vn0LD/jgbbi17KYfcVvqkoBLflX+clS0RIibMwvcfgwYDmCEM9BEE4OW51WbTQM0dsxak2gzSLDt wM3ctRCdvo7oHIi2B+aBqP+JFnDt3g/1d5+7+QkHYjMD9wLddJako74ruxmh6ImFE4Qc/SPOBBw8x v6jY2ConbwctgGQlCOi0H66r/f0MKIntqZmku0iRGxb1+RjdpYEdWlAzXnpQNo2DPbv9a0/7ElpIu iR4oF3hCj4GN3smkITvEIikTKjNBIZ3t19dPXxJ+iTFpc5NmmcC0g1BzaWIAreMHyoDvqxPBsgH24 IPLbMNOMwHef3rP3ecJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIYV-0006S2-KZ; Wed, 10 Oct 2018 17:45:55 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXm-00040f-OZ for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 17:45:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Bcfrp2O4e57UmA/xhvTYPsVz1hQtEyl8lQgqTaUWDis=; b=BN/hDORsODaa9Y1egqb05ynuBO 1BhryVbfvz49E+LWr5W1/7ibDAApNpFcXdQLmVVXILn1jtvFIt+XmYDVeJvhJ2R2SZd37/RmrNkP9 lAf2SgFPbhrmRTVYn4IslRioEVql/OdYNaWX+NDVAGKaRCM2utHtB3POLpmqkB4mqweH3Id1hVN3A 68xmQBI8oiP/UgT0R/WB2BIpDqfqeIQcD9hRmmiVM36wtMwv0LpjNH4KFeYucDmMIdyu7AkHS27rh /Qf9RvwGIrA6OihqoLOTzXj5M0uBQGt0DTbSnhGq4oPPFKinSyAblninizGAZmqSKsBE19VN13Het jbtlBaGg==; Received: from shell.v3.sk ([90.176.6.54]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI05-0006Jm-4C for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:22 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id C397EBCF90; Wed, 10 Oct 2018 19:10:05 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Mo3rb3mAT23g; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id C35ADBCF8D; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9F0XD56TeCDP; Wed, 10 Oct 2018 19:09:52 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id D5AEBBCF83; Wed, 10 Oct 2018 19:09:51 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH v2 02/11] PCI: Provide pci_match_id() with CONFIG_PCI=n Date: Wed, 10 Oct 2018 19:09:27 +0200 Message-Id: <20181010170936.316862-3-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_181021_229176_6597213F X-CRM114-Status: GOOD ( 12.42 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 This spares drivers from #ifdef-ing on CONFIG_PCI if the driver can be optionally built on machines without PCI bus. Consistent with acpi_driver_match_device() and similar. Acked-by: Bjorn Helgaas Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- Changes since v1: - Capitalization in the commit message include/linux/pci.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 6925828f9f25..2c4755032475 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1705,6 +1705,10 @@ static inline int pci_irqd_intx_xlate(struct irq_domain *d, unsigned long *out_hwirq, unsigned int *out_type) { return -EINVAL; } + +static inline const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, + struct pci_dev *dev) +{ return NULL; } #endif /* CONFIG_PCI */ /* Include architecture-dependent settings and functions */ From patchwork Wed Oct 10 17:09:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59A7D3CF1 for ; Wed, 10 Oct 2018 18:47:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B73128578 for ; Wed, 10 Oct 2018 18:47:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E4E02A2BF; Wed, 10 Oct 2018 18: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 B768428578 for ; Wed, 10 Oct 2018 18:47:10 +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=xoBr9qKPhhA8FGnXZBEi2QgY88C6E7f8t4wLny18/Lk=; b=S061+5O/jGwpAw jyc4LtG0eq055VMMU2nX4WdXVi6VX81JBzv1A9HOn7qQ5lryh7hrdFxbryC8P9A7gQ1IhJOVrMXwA JKUmqJsfrORgoKXCsNFUh7AN7ob5d07qJJ1mJ1LCZ4iajuSZrKewKSdWd/gsktv/3rPkYaoTJFDI9 pop+uILT4Wtc3u/5JtQ21chnTFAnrwbYDd+0UfMyga8CsL2BAGcABkieCjAl37q0ebluYgS044P+K v/zNkH5bfydcGiMJwXlNQAn2vU5P+ZvWCaywLymXvF364rhEOpY/S4bKgBgQLtpG6PMHZxNQZC+6n qbDfNZGrhxzHRjHpAdbw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVZ-0006Wl-NB; Wed, 10 Oct 2018 18:46:57 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVW-0006W3-SI for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:46:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+6+oO/gdffPAe4CKaFcHV+LI0OzsWMN8iFuqq8yBic8=; b=sLk6R+//2Wcwxaih2o7GznCbeu 7QgA9viSnczz/YJWXYzpfNb/anq0jDFGZrYmCrfDS5XIwtAL7Hscj+zXg2Y9u+6q1fZczD9HFWyK+ KpGTqYX2r3UJsK/hUspP4rhVTI3ZbY5SphhX96x5vl3+J7PqrFeHgjrWjEd4UscjgULVLvBr2RszF NfAmKkzJQJWfZzXW5BARFu6Zr67WMJB5KxrtxsvJVwjo0/Ted1IdISebDynloz0BP6sPGXRxS8YR1 OfGrYYQcist870uWe9psZz7bfgtpOV2U4FsAerf2heOi88unilwEDBZYaseTZieXKH8HBaqBgXLx0 +FmBlzxg==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI07-0006qu-Lq for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:25 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 90227BCFA8; Wed, 10 Oct 2018 19:10:16 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id heItyk6ZBJIb; Wed, 10 Oct 2018 19:10:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id D4281BCF9B; Wed, 10 Oct 2018 19:09:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TYDpJjB-UXnv; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 51E82BCF87; Wed, 10 Oct 2018 19:09:52 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 03/11] spi: pxa2xx: Use an enum for type Date: Wed, 10 Oct 2018 19:09:28 +0200 Message-Id: <20181010170936.316862-4-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131023_844524_B7AEB5AE X-CRM114-Status: GOOD ( 10.81 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 That seems to be the correct type. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 6 +++--- include/linux/pxa2xx_ssp.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 14f4ea59caff..f674541675bb 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1429,7 +1429,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct resource *res; const struct acpi_device_id *adev_id = NULL; const struct pci_device_id *pcidev_id = NULL; - int type; + enum pxa_ssp_type type; adev = ACPI_COMPANION(&pdev->dev); @@ -1443,9 +1443,9 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return NULL; if (adev_id) - type = (int)adev_id->driver_data; + type = (enum pxa_ssp_type)adev_id->driver_data; else if (pcidev_id) - type = (int)pcidev_id->driver_data; + type = (enum pxa_ssp_type)pcidev_id->driver_data; else return NULL; diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index 13b4244d44c1..262e1f318836 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h @@ -217,7 +217,7 @@ struct ssp_device { const char *label; int port_id; - int type; + enum pxa_ssp_type type; int use_count; int irq; From patchwork Wed Oct 10 17:09:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CECE15E2 for ; Wed, 10 Oct 2018 18:48:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D4802A651 for ; Wed, 10 Oct 2018 18:48:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EA262A66C; Wed, 10 Oct 2018 18:48:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 769C82A651 for ; Wed, 10 Oct 2018 18:48:39 +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=kPW8I1bQ8zNmZ50OQxMcjJKIXswB6VT0nGCFVSCmgZI=; b=MmOuVe/YaQ8ZnR iNDsxN91I7AasjWcp0s6haxGQWWvLXgHsjsezHdByfpSE7aB40wbmD1Mi6UEPu0ndmCCW5AdIbf+e euWJDR9n1XkYOzo95FXVvwF9KN/IoDiZZTf+xdWd+P+UZKtGHz1ID4CGutSnPHFico5FfMDLDq45W mMe61yuZjJSZLLrcmeXkqWKippc1TgMcQHVh/P2gWQQrfLAYSR72IY1cawOyJ/JOlBfhQyjovursW 8uJVwFrfgbPsBxp3nJNA2bSF9zG0lenlIT1vDFAInROB3QawH9uP3M556y4JpF7rXHozNlT2V6346 BZB1y/dg7uclmGRK0a8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJWz-0007FS-IA; Wed, 10 Oct 2018 18:48:25 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVa-0006W3-46 for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:46:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4pdFG8TxcRpBoUNXRDFn8k7bsQByTaj8D7c1QcgaspU=; b=MIgQs9RopLN7tSFThTakuRKPp0 x1gb67Jk/LnJJTXf0loiyu4vytQGDr5DF81+BXppMD+KaLrhhn5d7jvGAK/wS8tpNszGbT+YI5Lky MYWgetZwHwjit03/E0A2R/TTskZU28cBK60V8QEVX6dyFQ/Ud6LnIeQ2Z7wpYeifgEIrGzJFQaml5 qJ4E5U+ajzL+ADZvGia/LdUBk5awb9Ax2XXMY+YrMk56hr4fNBuzf+dDENO8jGboA7UxxDjneALc5 Qb2Tll2Z5H8gudMly5SKhcxsjTE5ZoCjERH6k779CHUTj1gvGr/GgGj2FwyLDezQHT3FKb1pIwLQX qMTmAGFA==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006re-Dj for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:35 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 079AABCFAB; Wed, 10 Oct 2018 19:10:22 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id iPKXEnoiMOUj; Wed, 10 Oct 2018 19:10:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id B906DBCF87; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9ONrfz8IE68r; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id B3824B8064; Wed, 10 Oct 2018 19:09:52 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 04/11] spi: pxa2xx: Add devicetree support Date: Wed, 10 Oct 2018 19:09:29 +0200 Message-Id: <20181010170936.316862-5-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131034_800116_9951E02A X-CRM114-Status: GOOD ( 16.97 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 MMP2 platform, that uses device tree, has this controller. Let's add devicetree alongside platform & PCI. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 73 +++++++++++++++++++++++--------------- include/linux/pxa2xx_ssp.h | 1 + 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index f674541675bb..58554c765a87 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "spi-pxa2xx.h" @@ -1333,9 +1334,6 @@ static void cleanup(struct spi_device *spi) kfree(chip); } -#ifdef CONFIG_PCI -#ifdef CONFIG_ACPI - static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { { "INT33C0", LPSS_LPT_SSP }, { "INT33C1", LPSS_LPT_SSP }, @@ -1347,23 +1345,6 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); -static int pxa2xx_spi_get_port_id(struct acpi_device *adev) -{ - unsigned int devid; - int port_id = -1; - - if (adev && adev->pnp.unique_id && - !kstrtouint(adev->pnp.unique_id, 0, &devid)) - port_id = devid; - return port_id; -} -#else /* !CONFIG_ACPI */ -static int pxa2xx_spi_get_port_id(struct acpi_device *adev) -{ - return -1; -} -#endif - /* * PCI IDs of compound devices that integrate both host controller and private * integrated DMA engine. Please note these are not used in module @@ -1410,6 +1391,37 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { { }, }; +static const struct of_device_id pxa2xx_spi_of_match[] = { + { .compatible = "marvell,mmp2-ssp", .data = (void *)MMP2_SSP }, + {}, +}; +MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); + +#ifdef CONFIG_ACPI + +static int pxa2xx_spi_get_port_id(struct acpi_device *adev) +{ + unsigned int devid; + int port_id = -1; + + if (adev && adev->pnp.unique_id && + !kstrtouint(adev->pnp.unique_id, 0, &devid)) + port_id = devid; + return port_id; +} + +#else /* !CONFIG_ACPI */ + +static int pxa2xx_spi_get_port_id(struct acpi_device *adev) +{ + return -1; +} + +#endif /* CONFIG_ACPI */ + + +#ifdef CONFIG_PCI + static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) { struct device *dev = param; @@ -1420,6 +1432,8 @@ static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param) return true; } +#endif /* CONFIG_PCI */ + static struct pxa2xx_spi_master * pxa2xx_spi_init_pdata(struct platform_device *pdev) { @@ -1429,11 +1443,15 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) struct resource *res; const struct acpi_device_id *adev_id = NULL; const struct pci_device_id *pcidev_id = NULL; + const struct of_device_id *of_id = NULL; enum pxa_ssp_type type; adev = ACPI_COMPANION(&pdev->dev); - if (dev_is_pci(pdev->dev.parent)) + if (pdev->dev.of_node) + of_id = of_match_device(pdev->dev.driver->of_match_table, + &pdev->dev); + else if (dev_is_pci(pdev->dev.parent)) pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, to_pci_dev(pdev->dev.parent)); else if (adev) @@ -1446,6 +1464,8 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) type = (enum pxa_ssp_type)adev_id->driver_data; else if (pcidev_id) type = (enum pxa_ssp_type)pcidev_id->driver_data; + else if (of_id) + type = (enum pxa_ssp_type)of_id->data; else return NULL; @@ -1464,11 +1484,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) if (IS_ERR(ssp->mmio_base)) return NULL; +#ifdef CONFIG_PCI if (pcidev_id) { pdata->tx_param = pdev->dev.parent; pdata->rx_param = pdev->dev.parent; pdata->dma_filter = pxa2xx_spi_idma_filter; } +#endif ssp->clk = devm_clk_get(&pdev->dev, NULL); ssp->irq = platform_get_irq(pdev, 0); @@ -1482,14 +1504,6 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) return pdata; } -#else /* !CONFIG_PCI */ -static inline struct pxa2xx_spi_master * -pxa2xx_spi_init_pdata(struct platform_device *pdev) -{ - return NULL; -} -#endif - static int pxa2xx_spi_fw_translate_cs(struct spi_controller *master, unsigned int cs) { @@ -1848,6 +1862,7 @@ static struct platform_driver driver = { .name = "pxa2xx-spi", .pm = &pxa2xx_spi_pm_ops, .acpi_match_table = ACPI_PTR(pxa2xx_spi_acpi_match), + .of_match_table = of_match_ptr(pxa2xx_spi_of_match), }, .probe = pxa2xx_spi_probe, .remove = pxa2xx_spi_remove, diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index 262e1f318836..979087e021f3 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h @@ -196,6 +196,7 @@ enum pxa_ssp_type { PXA27x_SSP, PXA3xx_SSP, PXA168_SSP, + MMP2_SSP, PXA910_SSP, CE4100_SSP, QUARK_X1000_SSP, From patchwork Wed Oct 10 17:09:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18B3117E1 for ; Wed, 10 Oct 2018 18:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACB7E2AA8B for ; Wed, 10 Oct 2018 18:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A025C2AA80; Wed, 10 Oct 2018 18:50:39 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 3D7542AA77 for ; Wed, 10 Oct 2018 18:50:39 +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=/BsBUBAr60A++GUHZZioIpim3PzFmVWnpr+L6xasfyU=; b=QkyBG9bnD681AX ebMz8jt/nJfnObFsH851k6q4camT1Dv47KP2NxOCspSwCmFhTlQnkXCDTFlDQUijjvW2mtbEc1yYM kNEV6Fyrs+btTvBHNSUnCQFhmKToTm1v0HVyPoC6MJUURvTetIcqD1RApry0hXbaESPkfCTR+bPwJ 9tRRfe0camoqw3zaGLxVq80kFA2PoBzOTPDgMKIKUILqMnNmUsHQqdQee0OJDSN/B7XJ+/leL9cWq P5bW/Mk/AB2MKUZYFgrKBqVXAQGVk9/yx8NlygPjmJTktqGRxsm/VDQEl6Umew/UP8W5F3d6mzEb0 CSYYrU3oBK3rHmBM3ckw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJYx-00012i-RP; Wed, 10 Oct 2018 18:50:27 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVe-0006W3-WE for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:47:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CBGyQPba5SXFJK59H7HsNmndaG6t0NsC66Xk2uj3QcI=; b=qsS6VaQP/65El+dtaM6bykOOC0 BhE/+DXK2bgv8oQattRJHhA1wgEvDygGmJ1c19rTzQx5GHcct1RZeRpPPNIHptX9TH205BX9flWHs LriY1OYD4KLnMq7aVuwEqtsZEJKGb5r64C/Gctjj7o1xtKqed6IIT20DZq1aYkHchs9iqYZt2NvZJ xI1QVTvFjggo+ud/Ls/pLGo6Umx5knWrY1fm6aH6eHfc5ZqdT5FQDs+9CjdYovwJg493GLCu/kmnQ bEbp7DVW4tklmlCZgfVbbSULYEAFUyVHe4gSBnY8M8VOy2b8n2hT7oNjOoFSFHv12UWqmiI7ZTUQI IWClZ6Gw==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI07-0006qP-EA for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:24 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id EE80FBCF8B; Wed, 10 Oct 2018 19:10:09 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id yvSXXn8ql3FJ; Wed, 10 Oct 2018 19:09:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 6B6B7BCF9A; Wed, 10 Oct 2018 19:09:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Y8MzQECFah7X; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 21C93BCF89; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 05/11] DT: marvell,mmp2: Add SSP1 and SSP3 Date: Wed, 10 Oct 2018 19:09:30 +0200 Message-Id: <20181010170936.316862-6-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131023_642402_10E09399 X-CRM114-Status: UNSURE ( 9.02 ) X-CRM114-Notice: Please train this message. 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 There seem to be SSP2, SSP4 and perhaps SSP5 too, but Marvel keeps their base addresses secret. The SSP1 and SSP3 addresses were taken from OLPC 1.75, OpenFirmware and kernel respectively. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- Changes since v1: - Dropped the aliases arch/arm/boot/dts/mmp2.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi index 766bbb8495b6..c16531f4d4c7 100644 --- a/arch/arm/boot/dts/mmp2.dtsi +++ b/arch/arm/boot/dts/mmp2.dtsi @@ -239,6 +239,22 @@ resets = <&soc_clocks MMP2_CLK_RTC>; status = "disabled"; }; + + ssp1: ssp@d4035000 { + compatible = "marvell,mmp2-ssp"; + reg = <0xd4035000 0x1000>; + clocks = <&soc_clocks MMP2_CLK_SSP0>; + interrupts = <0>; + status = "disabled"; + }; + + ssp3: ssp@d4037000 { + compatible = "marvell,mmp2-ssp"; + reg = <0xd4037000 0x1000>; + clocks = <&soc_clocks MMP2_CLK_SSP2>; + interrupts = <20>; + status = "disabled"; + }; }; soc_clocks: clocks{ From patchwork Wed Oct 10 17:09:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10634893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A2973CF1 for ; Wed, 10 Oct 2018 17:12:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD2C228FCB for ; Wed, 10 Oct 2018 17:12:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFC842A6F2; Wed, 10 Oct 2018 17:12:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 2858528FCB for ; Wed, 10 Oct 2018 17:12:14 +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=rSMEWNsXUVp+2j8c+QH3JCcQzSi03XpzhdRG/m3/lhE=; b=VHGtXd6SG586Nr lvilGXZDrfXaHbjUqpIdZIeQFCnwQjyhzlZQZzXaD/0HFquvGL6CGwt1saXAHhA4d4kaxkmLB+U5m 2pIMohVmxSp5BXi1E/t2GAurwtco83gKLfnyy77soa1U44Ak77OQCzvk4p2lgReKEPocnqQfhQDh6 HNvn8XwHIMqT4tVsgufYtI8eqcIrRvLhWz6nm2+PooWc2iN+NGgdjg7nU/6b5RXOCwc5NgYsDmNrI DLAgf8mff16dVrN1x+UR0bAhinT8cnn8ICMbYH35LdnpIPqhMCwimerP0YC1fWrc6kJ754AykvHgI Pul6aIHQPENOCNDAo0EQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI1p-0004hv-Ls; Wed, 10 Oct 2018 17:12:09 +0000 Received: from shell.v3.sk ([90.176.6.54]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0L-0003JT-Qc for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:12:06 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 1A089BCF9B; Wed, 10 Oct 2018 19:10:19 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id EeHfT6BucDjP; Wed, 10 Oct 2018 19:10:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 21290BCF9C; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 61k-AlzjFvfv; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 84502BCF8B; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 06/11] dt-bindings: spi/spi-pxa2xx: Add spi-slave property Date: Wed, 10 Oct 2018 19:09:31 +0200 Message-Id: <20181010170936.316862-7-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_101038_058744_926C80F7 X-CRM114-Status: UNSURE ( 9.09 ) X-CRM114-Notice: Please train this message. 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 This is used to indicate that the chip attached to this controller is a SPI master. Signed-off-by: Lubomir Rintel Reviewed-by: Rob Herring Acked-by: Pavel Machek --- Documentation/devicetree/bindings/spi/spi-pxa2xx.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt index 0335a9bd2e8a..89b2832283e3 100644 --- a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt +++ b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt @@ -11,6 +11,7 @@ Required properties: Optional properties: - cs-gpios: list of GPIO chip selects. See the SPI bus bindings, Documentation/devicetree/bindings/spi/spi-bus.txt +- spi-slave: Empty property indicating the SPI controller is used in slave mode. Child nodes represent devices on the SPI bus See ../spi/spi-bus.txt From patchwork Wed Oct 10 17:09:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBACA112B for ; Wed, 10 Oct 2018 18:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC8162A631 for ; Wed, 10 Oct 2018 18:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF1672A80C; Wed, 10 Oct 2018 18:49:16 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 126BF2A631 for ; Wed, 10 Oct 2018 18:49:16 +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=kARfd70vDq5PnBEy9VeLawQsIre+Gi0NJ5xNmB7/eOw=; b=oocJUdgFhh01K6 jg3G+EuYqjY8nXtToFQOHUGNPN4EF8lTtm874yMaRWbNhHcv2kh782qSpar/GVF41bnqrVr3wECeb jJK4woNxE68BuF8VcMm6vAG602UKc4tRWNzwtCiA0fTkIzR4UlYNmQAzT1iKsqQ3Vbijq7qaO3pgm d/ofTy/V4mZm2DzSL7cusIvp01zUwWkRuEr24vkzlYi818pgA42JJnCGz5VaDDZWxgkN/+hNL5jlQ jIk+bW1DqOJYlwj0ld/66mx6VMC0fcYbiPkUkYOW0PrtGijcLPPdxity8RCTUL6wdYhIg4CTvVbIU awezt1xQ9Qs/2xESdI5Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJXc-0007Zs-L6; Wed, 10 Oct 2018 18:49:04 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVb-0006W3-QJ for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:46:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NIBiMeDXIbe1S025NJHu5sb/ZL54na2GTZQGf8p48NU=; b=3TPWbqGQU6OqcDawNgu3IRZJrE SfsfQzl0gLxGLWpgx0iP6DIU5tkFrs9QgpjQiNH0o1GeVv4X9yKc2LvzwUQPHtc9DSmTKLRJUERsn JfYDabAPsCxZShQGABcW0IHHSYo/knDQH7JQCL/dvE9PAK4pituVdicxuAHouqlvk8AmUHc6SQKkr jVZnqf+jGL4gPS/ltMq+KWDVXP2S9IvbsuL5/IMQoLObcM/g0CKbPs+15mQIl3IGVWAenPTKRFS4d 2+LtMEEC3rw2HqxoYWScty9+thX+YFJ9Gkt1QypPbwzpCiagtolmO8I4zKewX2JjFz6qLkxoEVglD D2S3K6Zw==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006rJ-Dh for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:35 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id AA289BCFAD; Wed, 10 Oct 2018 19:10:19 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id U2d3LQLYW6nf; Wed, 10 Oct 2018 19:10:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 4F841BCF88; Wed, 10 Oct 2018 19:09:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xKwGi4kID01v; Wed, 10 Oct 2018 19:09:55 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id E66EFBCF8E; Wed, 10 Oct 2018 19:09:53 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 07/11] spi: Deal with slaves that return from transfer_one() unfinished Date: Wed, 10 Oct 2018 19:09:32 +0200 Message-Id: <20181010170936.316862-8-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131034_788290_1D9774E4 X-CRM114-Status: GOOD ( 15.24 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 Some drivers, such as spi-pxa2xx return from the transfer_one callback immediately, idicating that the transfer will be finished asynchronously. Normally, spi_transfer_one_message() synchronously waits for the transfer to finish with wait_for_completion_timeout(). For slaves, we don't want the transaction to time out as it can complete in a long time in future. Use wait_for_completion_interruptible() instead. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi.c | 64 +++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9da0bc5a036c..079214a31d2c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -993,6 +993,44 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) return __spi_map_msg(ctlr, msg); } +static int spi_transfer_wait(struct spi_controller *ctlr, + struct spi_message *msg, + struct spi_transfer *xfer) +{ + struct spi_statistics *statm = &ctlr->statistics; + struct spi_statistics *stats = &msg->spi->statistics; + unsigned long long ms = 1; + + if (spi_controller_is_slave(ctlr)) { + if (wait_for_completion_interruptible(&ctlr->xfer_completion)) { + dev_dbg(&msg->spi->dev, "SPI transfer interrupted\n"); + return -EINTR; + } + } else { + ms = 8LL * 1000LL * xfer->len; + do_div(ms, xfer->speed_hz); + ms += ms + 200; /* some tolerance */ + + if (ms > UINT_MAX) + ms = UINT_MAX; + + ms = wait_for_completion_timeout(&ctlr->xfer_completion, + msecs_to_jiffies(ms)); + + if (ms == 0) { + SPI_STATISTICS_INCREMENT_FIELD(statm, + timedout); + SPI_STATISTICS_INCREMENT_FIELD(stats, + timedout); + dev_err(&msg->spi->dev, + "SPI transfer timed out\n"); + msg->status = -ETIMEDOUT; + } + } + + return 0; +} + /* * spi_transfer_one_message - Default implementation of transfer_one_message() * @@ -1006,7 +1044,6 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, struct spi_transfer *xfer; bool keep_cs = false; int ret = 0; - unsigned long long ms = 1; struct spi_statistics *statm = &ctlr->statistics; struct spi_statistics *stats = &msg->spi->statistics; @@ -1035,28 +1072,11 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, goto out; } - if (ret > 0) { - ret = 0; - ms = 8LL * 1000LL * xfer->len; - do_div(ms, xfer->speed_hz); - ms += ms + 200; /* some tolerance */ - - if (ms > UINT_MAX) - ms = UINT_MAX; + if (ret > 0) + ret = spi_transfer_wait(ctlr, msg, xfer); - ms = wait_for_completion_timeout(&ctlr->xfer_completion, - msecs_to_jiffies(ms)); - } - - if (ms == 0) { - SPI_STATISTICS_INCREMENT_FIELD(statm, - timedout); - SPI_STATISTICS_INCREMENT_FIELD(stats, - timedout); - dev_err(&msg->spi->dev, - "SPI transfer timed out\n"); - msg->status = -ETIMEDOUT; - } + if (ret < 0) + return ret; } else { if (xfer->len) dev_err(&msg->spi->dev, From patchwork Wed Oct 10 17:09:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D81C14DB for ; Wed, 10 Oct 2018 18:47:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43F6828578 for ; Wed, 10 Oct 2018 18:47:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35BE22A2BF; Wed, 10 Oct 2018 18:47:46 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 AE43328578 for ; Wed, 10 Oct 2018 18:47:45 +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=aUtD76e1mfAtS59weiLmfvNJXDtCxDVB9NYs3W7EclQ=; b=pTiQS0//spbOmR YV/4ysrH1m9zDymicME3JRIk5nI41R2STcWxnOYx94tjWHTt9ImjUfr9SxfXfk/j06N6BUZcEhvXp XS8gRmUl/6WJQzsibzXUmDcl1Y8A/+eRnhuooDJMUBUwDSMBak9FPCCW2BPXwydCX4jer2T0NkLWv YSCagp0baKGwvBNRt2XGJ23h9PNyH86a9dCQC5YBAfld4PB1QAWRW+fCww0g1Xzum/bFMwLmeQKNS Id+cmZES4qga5c6O1zAgdvSoVwPbdwdg6qZwC7veRuCq0z5a/1sZ9uvTF7kV+yuARuaAAD0HQFFdD Xqkb90Z0EjOp+tEompZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJWA-0006lA-Q5; Wed, 10 Oct 2018 18:47:34 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVY-0006W3-Df for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:46:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UA68shIoK4tr8rT8h/9ThKOabcx2gq8gV0ZbvWmwr5I=; b=HwxS7dscyzGGNXNsKXTVdIZ9Io rSjn6A8lrBjlST/g9NYfWPaTR2ZDFLWiNVB9zUtYogGvsczt9i5ULaT0I6CqB2BLDzB65WQ+HATFz m/QP+49xAoh6FCKLOxBCPhnFypS94Oom5zndsYFD+KIvrRyXRjfUt+6MwZKZ14UIWgL3DpcBkZOul bRiQ+O7o9v1m5ouiETiuoQH3Zaw+flk2r6PWrWsrjgFcHMyLpX+Omk513H2MYRYV+nYnGAIuojs+x jONAZ4eFaxtU/Zus/65Zsoc7YzILfhxbK6LIlZ/ndGuOwQUACBB4wL4VpA5XZJ7AzR5jq3GX2PLvr ZxHyZ+qg==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006sL-Dn for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:35 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 297F3BCFA0; Wed, 10 Oct 2018 19:10:28 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id vFUv6ZUy1WIp; Wed, 10 Oct 2018 19:10:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7D7E7BCF84; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Cea3ZWQ01MnB; Wed, 10 Oct 2018 19:09:55 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 5B103BCF90; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 08/11] spi: pxa2xx: Add slave mode support Date: Wed, 10 Oct 2018 19:09:33 +0200 Message-Id: <20181010170936.316862-9-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131034_783674_F60EAF13 X-CRM114-Status: GOOD ( 15.92 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 Tested on an OLPC XO-1.75 machine, where the Embedded Controller happens to be a SPI master. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 81 +++++++++++++++++++++++++++++++--- include/linux/spi/pxa2xx_spi.h | 1 + 2 files changed, 75 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 58554c765a87..3848842d68fd 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -626,6 +626,11 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) return IRQ_HANDLED; } + if (irq_status & SSSR_TUR) { + int_error_stop(drv_data, "interrupt_transfer: fifo underrun"); + return IRQ_HANDLED; + } + if (irq_status & SSSR_TINT) { pxa2xx_spi_write(drv_data, SSSR, SSSR_TINT); if (drv_data->read(drv_data)) { @@ -1071,6 +1076,11 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, pxa2xx_spi_write(drv_data, SSTO, chip->timeout); } + if (spi_controller_is_slave(master)) { + while (drv_data->write(drv_data)) + ; + } + /* * Release the data by enabling service requests and interrupts, * without changing any mode bits @@ -1080,6 +1090,27 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, return 1; } +static int pxa2xx_spi_slave_abort(struct spi_master *master) +{ + struct driver_data *drv_data = spi_controller_get_devdata(master); + + /* Stop and reset SSP */ + write_SSSR_CS(drv_data, drv_data->clear_sr); + reset_sccr1(drv_data); + if (!pxa25x_ssp_comp(drv_data)) + pxa2xx_spi_write(drv_data, SSTO, 0); + pxa2xx_spi_flush(drv_data); + pxa2xx_spi_write(drv_data, SSCR0, + pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE); + + dev_dbg(&drv_data->pdev->dev, "transfer aborted\n"); + + drv_data->master->cur_msg->status = -EINTR; + spi_finalize_current_transfer(drv_data->master); + + return 0; +} + static void pxa2xx_spi_handle_err(struct spi_controller *master, struct spi_message *msg) { @@ -1207,9 +1238,14 @@ static int setup(struct spi_device *spi) rx_thres = config->rx_threshold; break; default: - tx_thres = TX_THRESH_DFLT; tx_hi_thres = 0; - rx_thres = RX_THRESH_DFLT; + if (spi_controller_is_slave(drv_data->master)) { + tx_thres = 1; + rx_thres = 2; + } else { + tx_thres = TX_THRESH_DFLT; + rx_thres = RX_THRESH_DFLT; + } break; } @@ -1253,6 +1289,12 @@ static int setup(struct spi_device *spi) if (chip_info->enable_loopback) chip->cr1 = SSCR1_LBM; } + if (spi_controller_is_slave(drv_data->master)) { + chip->cr1 |= SSCR1_SCFR; + chip->cr1 |= SSCR1_SCLKDIR; + chip->cr1 |= SSCR1_SFRMDIR; + chip->cr1 |= SSCR1_SPH; + } chip->lpss_rx_threshold = SSIRF_RxThresh(rx_thres); chip->lpss_tx_threshold = SSITF_TxLoThresh(tx_thres) @@ -1492,6 +1534,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) } #endif +#if CONFIG_OF + if (of_id) { + pdata->is_slave = of_property_read_bool(pdev->dev.of_node, + "spi-slave"); + } +#endif + ssp->clk = devm_clk_get(&pdev->dev, NULL); ssp->irq = platform_get_irq(pdev, 0); ssp->type = type; @@ -1557,7 +1606,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) return -ENODEV; } - master = spi_alloc_master(dev, sizeof(struct driver_data)); + if (platform_info->is_slave) + master = spi_alloc_slave(dev, sizeof(struct driver_data)); + else + master = spi_alloc_master(dev, sizeof(struct driver_data)); + if (!master) { dev_err(&pdev->dev, "cannot alloc spi_master\n"); pxa_ssp_free(ssp); @@ -1579,6 +1632,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) master->setup = setup; master->set_cs = pxa2xx_spi_set_cs; master->transfer_one = pxa2xx_spi_transfer_one; + master->slave_abort = pxa2xx_spi_slave_abort; master->handle_err = pxa2xx_spi_handle_err; master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; @@ -1608,7 +1662,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; drv_data->dma_cr1 = DEFAULT_DMA_CR1; drv_data->clear_sr = SSSR_ROR | SSSR_TINT; - drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; + drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS + | SSSR_ROR | SSSR_TUR; } status = request_irq(ssp->irq, ssp_int, IRQF_SHARED, dev_name(dev), @@ -1656,10 +1711,22 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) pxa2xx_spi_write(drv_data, SSCR0, tmp); break; default: - tmp = SSCR1_RxTresh(RX_THRESH_DFLT) | - SSCR1_TxTresh(TX_THRESH_DFLT); + + if (spi_controller_is_slave(master)) { + tmp = SSCR1_SCFR | + SSCR1_SCLKDIR | + SSCR1_SFRMDIR | + SSCR1_RxTresh(2) | + SSCR1_TxTresh(1) | + SSCR1_SPH; + } else { + tmp = SSCR1_RxTresh(RX_THRESH_DFLT) | + SSCR1_TxTresh(TX_THRESH_DFLT); + } pxa2xx_spi_write(drv_data, SSCR1, tmp); - tmp = SSCR0_SCR(2) | SSCR0_Motorola | SSCR0_DataSize(8); + tmp = SSCR0_Motorola | SSCR0_DataSize(8); + if (!spi_controller_is_slave(master)) + tmp |= SSCR0_SCR(2); pxa2xx_spi_write(drv_data, SSCR0, tmp); break; } diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index 9ec4c147abbc..b0674e330ef6 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h @@ -25,6 +25,7 @@ struct dma_chan; struct pxa2xx_spi_master { u16 num_chipselect; u8 enable_dma; + bool is_slave; /* DMA engine specific config */ bool (*dma_filter)(struct dma_chan *chan, void *param); From patchwork Wed Oct 10 17:09:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8EE7A112B for ; Wed, 10 Oct 2018 18:49:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 776542A070 for ; Wed, 10 Oct 2018 18:49:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 694CE2A80C; Wed, 10 Oct 2018 18:49:55 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 F12302A070 for ; Wed, 10 Oct 2018 18:49:54 +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=PneDLJCxVDhqGgxSX/T4mhM93pWyCp7PjoGIgsLB85w=; b=COO3LuBsFZ+DgY NyJLsZvSrHu5IOk+gQwQlLKZFzz77oW/ny5UMJ9eKt1KRO9deJ8DtRKP1tQRS7tlTlvwqYGAtcgsf cW8ejELoNUR+kVfCGgIZgXxBY4uGPTtVmKRDQKgLB9IzvQAjeUVHDUrRYSLePS/CMHyS5159gqxyw DgezxjrHv281EtxX9wSJA/ZMsV6Xvl1zHNDBmkDkc25oIGy/z3aLomrNcnGjqN3cBOHLFAGPdvElZ /BuenzQq5FobOJQYPqFdaXr+ndDJJaD2p60oIzrUKzhR/m6ZriE1YK3CZGNHSUqLRUKXiTTGRnI1J MfKdoM93EM4tTxcR7H9Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJYF-0007vQ-If; Wed, 10 Oct 2018 18:49:43 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAJVd-0006W3-Cs for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 18:47:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kUaPH1/OoRU95SPcEkqVybmXyNFZrNEMgVIGTdLAB9k=; b=OAS19yE7GtK8CK7XXMNtOegvOG n3jGn/wOB1ggap9CGk5CNkHnczzIDaarbkTvn6to2R9fCm5O5MHx1ohgZbRRRoDTFvGbHjB3Fqr0C ZBxu4/QJg3UXiQGG4tUj21PM8UQOYA/WtQjpWwW+nkbzCyfzDPMuT/yHggYu2MKhQKVbMHnZqkDGa ThsfZ4qsg7G0q5Q5ybWCZm2bsb5Q/gk/clEQnBqr5vzmgSJXe9Q3Amd20XiB3gdVz6Cnh74CvEEpt hcfx/p5wU2Kct0A13iBy0OYEKmVtkHi+U/4tFCAep87cSH6/PHu0pfEmcLDn/9ssEX4Yyn5eQBDLW eA67PQiA==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006sE-Dl for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:35 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id CEE84BCF8F; Wed, 10 Oct 2018 19:10:25 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id s3tClKtFfeaQ; Wed, 10 Oct 2018 19:10:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 12426BCF91; Wed, 10 Oct 2018 19:10:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uzCEfFFGFfLT; Wed, 10 Oct 2018 19:09:56 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id C3753BCF82; Wed, 10 Oct 2018 19:09:54 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 09/11] dt-bindings: spi/spi-pxa2xx: Add ready GPIO signal Date: Wed, 10 Oct 2018 19:09:34 +0200 Message-Id: <20181010170936.316862-10-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_131034_640627_0A64A441 X-CRM114-Status: GOOD ( 10.36 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 This this is used to let the SPI master know that our FIFO is filled and we're ready to service a transfer. Only useful in slave mode. A signal like this is used by an embedded controller on a OLPC XO 1.75 machine, that happens to be a SPI master. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- Documentation/devicetree/bindings/spi/spi-pxa2xx.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt index 89b2832283e3..681a82b40e6f 100644 --- a/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt +++ b/Documentation/devicetree/bindings/spi/spi-pxa2xx.txt @@ -12,6 +12,8 @@ Optional properties: - cs-gpios: list of GPIO chip selects. See the SPI bus bindings, Documentation/devicetree/bindings/spi/spi-bus.txt - spi-slave: Empty property indicating the SPI controller is used in slave mode. +- ready-gpio: GPIO used to signal a SPI master that the FIFO is filled + and we're ready to service a transfer. Only useful in slave mode. Child nodes represent devices on the SPI bus See ../spi/spi-bus.txt From patchwork Wed Oct 10 17:09:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FAA513AD for ; Wed, 10 Oct 2018 17:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B9192A675 for ; Wed, 10 Oct 2018 17:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F4CF2A696; Wed, 10 Oct 2018 17:54:37 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 93BB02A675 for ; Wed, 10 Oct 2018 17:54:36 +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=ludji0U7+z5flSW3R3HlDUkUfbEiHRbKBUm+G/mAuEw=; b=A1PlqWX9xhuVU+ 18kH052qEBw4VnvNAK3oQJkGLOPND9SYiEU3hO7YAxz2CL9MQntKPGmSFpEWfR3GVlf5X7g+/tsl1 Euvn3qdg1ETCnNhFbfeUK54SAlLB+KxY5Uw9xOWiNcsvSqms/BAvFvxChUvhgwWBOkJ8gcJKtp7oa 6EfOdM4WKiVnGAJ6l9Tp+S7KQi42hpmm7yMnzLWigxhtZDOmq+1KGxEkZTLJTY5e1aj3W+1Ygo+lh Wy0Hg3gnEpY10qIEGDUdgDjr0yKHd44Sf0Sc+tJTgw05XnYmKon7ojM2DT4+xxI/C+MRL3DVKku+a rENECCDXfUhW28todDTQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIgl-0000fD-Kb; Wed, 10 Oct 2018 17:54:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXi-0003re-2C for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 17:45:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BaZP6uKaOKUcEeWk8sD2zpyrcdnIII++yBfGl5acty8=; b=rBr4ZBDsvg1WG7j4kmHjttC+dj 6mhzC71KQipVkGaxbZT83Tgn/Doupsy/Bd9IK8bs6nN4VmAmrCPDEbE7rViRhu5g67EfvDrGsNcOJ 8rANw8E5ULv7V3cRMDdR8oUG+UjIAmTTMePqmonrzGj/Dvs/HUCDY4Pp7eJwRK/wtsTNeBCobmAgY VdBWm74cwTlYZWbPSYsLEPTUWnZoqWh6dnVUYWJHM1Z+Xr3g2lahpU/XUVp22mo1bIyJ3KoDKfefC xBJ4OM1aG8EpPOf/feXmcOKHBQ0Y3aCBy6tgHu3Wr+PRsVIP3fVmNgwfUNVBXBPiggdh2TvHZ61BS oQNRsThw==; Received: from shell.v3.sk ([90.176.6.54]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006L8-Kg for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:36 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 05FB6BCFB1; Wed, 10 Oct 2018 19:10:23 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id YLhjDiubGH4A; Wed, 10 Oct 2018 19:10:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id DC636BCF8E; Wed, 10 Oct 2018 19:09:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id A03z38LnQTVf; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 374E0BCF83; Wed, 10 Oct 2018 19:09:55 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 10/11] spi: pxa2xx: Add ready signal Date: Wed, 10 Oct 2018 19:09:35 +0200 Message-Id: <20181010170936.316862-11-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_181034_734267_DC23D94C X-CRM114-Status: GOOD ( 14.60 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 Strobe a GPIO line when the slave TX FIFO is filled. This is how the Embedded Controller on an OLPC XO-1.75 machine, that happens to be a SPI master, learns that it can initiate a transaction. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 12 ++++++++++++ drivers/spi/spi-pxa2xx.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 3848842d68fd..a3b4b12c1077 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1079,6 +1079,9 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, if (spi_controller_is_slave(master)) { while (drv_data->write(drv_data)) ; + gpiod_set_value(drv_data->gpiod_ready, 1); + udelay(1); + gpiod_set_value(drv_data->gpiod_ready, 0); } /* @@ -1784,6 +1787,15 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) } } + if (platform_info->is_slave) { + drv_data->gpiod_ready = devm_gpiod_get_optional(dev, + "ready", GPIOD_OUT_LOW); + if (IS_ERR(drv_data->gpiod_ready)) { + status = (int)PTR_ERR(drv_data->gpiod_ready); + goto out_error_clock_enabled; + } + } + pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 513c53aaeab2..4e324da66ef7 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h @@ -64,6 +64,9 @@ struct driver_data { /* GPIOs for chip selects */ struct gpio_desc **cs_gpiods; + + /* Optional slave FIFO ready signal */ + struct gpio_desc *gpiod_ready; }; struct chip_data { From patchwork Wed Oct 10 17:09:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10635037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3462A16B1 for ; Wed, 10 Oct 2018 17:45:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18AA92A898 for ; Wed, 10 Oct 2018 17:45:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C4282A89C; Wed, 10 Oct 2018 17:45:31 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 78FD42A898 for ; Wed, 10 Oct 2018 17:45:30 +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=YXKBPBqNRHz+ejRmy2N9zMByyicAC2BTzKltbF405V0=; b=RwjjcuyJNhevH7 bFBtehNG6PDm/KuJ1x2jV1bHK6V+bOJna4dNVCzoIpcfUe/ZuuOCAb7JxrArIOFhX+NeHyBuhUyy3 7kRWT539Qb0wj9fn1ACaVTfzz/cNzXOPl/m2tNY5nXl24Lns5iH0cpgE8JnnDoqc1PEhqtu4yAdv9 uYzQY7QDUdGO1UmXiZyO+yShKV/O76Qsv+bDkkjUne+vbeQcAulsQK6fg9kimt7NPwW8rCTBhykQV JNbibCDGZ3AFSLEzp0gyYa7ykygGmIpLDM9EQcXtH4FXeJoEH+drT9+EoPnt4hBEAW4llMF+B6tcN 3aJiDIE1jUXFCSxLSXCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXu-0005OT-Hi; Wed, 10 Oct 2018 17:45:18 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAIXh-0004bR-Li for linux-arm-kernel@bombadil.infradead.org; Wed, 10 Oct 2018 17:45:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5tuv+TZ4ymC9HRh5ashNq4qfb4uIPeW+nqpHCsClJzE=; b=Z4MozrTCcb6yQ6bjdu/w9UPoZh YghYN0kFeAj6LSTUaqubr7uKwQRFXsfA0zuEmg0amSzGcl969Ai90XQvemTC94wCAfr4rK9E0YK4W 4NP1dmnR5Hcl3IXELqU2pLxpCnoybaSfUQoHBQPVzFix4j73HXrOVKkuGTwGS5isQVC34KwHryb/l HgPznfbL/IkUcI2KKGcOEK4qcN7ISQHd+KAFF909IikcQprrwoO+Cj5P6x/Utul2so3u/yVQMyBy6 SdPywt9phuyH+/chKSKu9HTuGwF26gqA1OFJOtvoPlST2BJ00ysxk3k9CcKyqbz1dFHBm56RASki4 6NXJRoCA==; Received: from shell.v3.sk ([90.176.6.54]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAI0I-0006Lk-Ke for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2018 17:10:36 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 59D09BCFB4; Wed, 10 Oct 2018 19:10:31 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Ru0PvWjLugRn; Wed, 10 Oct 2018 19:10:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 5E881B8064; Wed, 10 Oct 2018 19:09:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FmnBgW3ay-B2; Wed, 10 Oct 2018 19:09:57 +0200 (CEST) Received: from belphegor.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id A0214BCF91; Wed, 10 Oct 2018 19:09:55 +0200 (CEST) From: Lubomir Rintel To: Mark Brown , Geert Uytterhoeven Subject: [PATCH 11/11] spi: pxa2xx: Deal with the leftover garbage in TXFIFO Date: Wed, 10 Oct 2018 19:09:36 +0200 Message-Id: <20181010170936.316862-12-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181010170936.316862-1-lkundrak@v3.sk> References: <20181010170936.316862-1-lkundrak@v3.sk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181010_181034_728712_E843AE3A X-CRM114-Status: GOOD ( 16.33 ) 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: Mark Rutland , devicetree@vger.kernel.org, Eric Miao , James Cameron , linux-kernel@vger.kernel.org, Haojian Zhuang , linux-spi@vger.kernel.org, Lubomir Rintel , Rob Herring , linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack 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 There doesn't seem to be a way to empty TXFIFO on MMP2. The datasheet is super-secret and the method described in Armada 16x manual won't work: "The TXFIFO and RXFIFO are cleared to 0b0 when the SSPx port is reset or disabled (by writing a 0b0 to the field in the SSP Control Register 0)." # devmem 0xd4037008 # read SSSR 0x0000F204 # devmem 0xd4037000 32 0x80 # SSE off in SSCR0 # devmem 0xd4037000 32 0x87 # SSE on # devmem 0xd4037008 0x0000F204 ^ TXFIFO level is still 2. Sigh. The OLPC 1.75 boot firmware leaves two bytes in the TXFIFO. Those are basically throwaway bytes used in response to the messages from the EC. The OLPC kernel copes with this by power-cycling the hardware. Perhaps the firmware should do this instead. Other than that, there's not much we can do other than complain loudly until the garbage gets drained and discard the actual data... For the OLPC EC this will work just fine and pushing more data to TXFIFO would break further transactions. Signed-off-by: Lubomir Rintel Acked-by: Pavel Machek --- drivers/spi/spi-pxa2xx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index a3b4b12c1077..2662b99d4439 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1076,6 +1076,20 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *master, pxa2xx_spi_write(drv_data, SSTO, chip->timeout); } + if (drv_data->ssp_type == MMP2_SSP) { + u8 tx_level = (pxa2xx_spi_read(drv_data, SSSR) + & SSSR_TFL_MASK) >> 8; + + if (tx_level) { + /* On MMP2, flipping SSE doesn't to empty TXFIFO. */ + dev_warn(&spi->dev, "%d bytes of garbage in TXFIFO!\n", + tx_level); + if (tx_level > transfer->len) + tx_level = transfer->len; + drv_data->tx += tx_level; + } + } + if (spi_controller_is_slave(master)) { while (drv_data->write(drv_data)) ;