From patchwork Wed Jun 21 11:55:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Caron X-Patchwork-Id: 13287202 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51818EB64D8 for ; Wed, 21 Jun 2023 11:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D68dobPhi2fu6c6pxTtjPt9Z1y/NdGJRHdkdb3l+cAQ=; b=4s9IBzLK4RNY59 PB/PGCHHNf2hNJRjKjp2E+AEMeFimfhcljBdmfuAhee+PeX8U6aK8RvdXA1lfuSSac+VYxdDd/qfs 1xDKPT45M75kOBWP7lIg9PG4iKaxkd14gGrNkALNHdPWQsT+FtrNNbZi2fh62qRNfPsGYa5YTqIia gLBtcdaS/F6BcrwSiCaW4cnlPBq4fW80IxkHRlTWHrwORkyPYnqc5tXSJHEcNnTwnTFmy+AOK1tBb XX1N/OGGLjR31LPErWx4GcPepQRiqD1AQ7U20yshUEXaAx10Wg4n9NIom12mzb4iPyovjXcQGUZ6C dLkaEvFVpZKVLK2eVrCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBwRp-00ESQH-0l; Wed, 21 Jun 2023 11:56:29 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBwRZ-00ESKc-0b for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 11:56:15 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35L9T89i026287; Wed, 21 Jun 2023 13:55:57 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=lQTcJI2yH3aZLIvv+1GOSfF0PqFT/I/N8lRqjd5MfH0=; b=eBTeRDcfs5GmlMiTco4J2o5ZVQhAGJwoxXPFx0xUmUKzuu0CYM8ZSLfB32Fv90y8go1B DK3B9MR7vkxMcO4g/BM2Ud4z7dCQtKP+QURvUPRkyhcKvZOkMcqOVJ6XuGF4oSHVGXXI Uj7MbvLy5lwyZk/PedtUCCY0LGtVC753WhADysZ+qayiEi6pyTutpDtgfsjO2vaInSW4 EmvI9E4hEf2ck4r+Ab0YXQLRMmX6kXEumFXTPH97sYbW7M5jVjfgEgq9lBw56FI0wJ08 kOp0KXBm6eIpIojoBJv1vD3W/Dl5nELY+YxHOr9WbwepyI9qn+uNvIYo+sRPYt/hIDMS /w== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3rbxm3rygm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 13:55:57 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DADA810006A; Wed, 21 Jun 2023 13:55:54 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CE9F6237D9A; Wed, 21 Jun 2023 13:55:54 +0200 (CEST) Received: from localhost (10.201.20.168) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 21 Jun 2023 13:55:54 +0200 From: Valentin Caron To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: Alexandre Torgue , Alain Volmat , , , , , , Valentin Caron Subject: [PATCH 1/2] spi: stm32: disable device mode with st,stm32f4-spi compatible Date: Wed, 21 Jun 2023 13:55:22 +0200 Message-ID: <20230621115523.923176-2-valentin.caron@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230621115523.923176-1-valentin.caron@foss.st.com> References: <20230621115523.923176-1-valentin.caron@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.168] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_07,2023-06-16_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_045613_514932_2DA909A2 X-CRM114-Status: GOOD ( 19.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org STM32 SPI driver is not capable to handle device mode with stm32f4/f7 soc. Stop probing if this case happens. Signed-off-by: Valentin Caron --- drivers/spi/spi-stm32.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index 6d10fa4ab783..f71712af43d4 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -238,6 +238,7 @@ struct stm32_spi; * @baud_rate_div_min: minimum baud rate divisor * @baud_rate_div_max: maximum baud rate divisor * @has_fifo: boolean to know if fifo is used for driver + * @has_device_mode: is this compatible capable to switch on device mode * @flags: compatible specific SPI controller flags used at registration time */ struct stm32_spi_cfg { @@ -259,6 +260,7 @@ struct stm32_spi_cfg { unsigned int baud_rate_div_min; unsigned int baud_rate_div_max; bool has_fifo; + bool has_device_mode; u16 flags; }; @@ -1750,6 +1752,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = { .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN, .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX, .has_fifo = false, + .has_device_mode = false, .flags = SPI_MASTER_MUST_TX, }; @@ -1774,6 +1777,7 @@ static const struct stm32_spi_cfg stm32h7_spi_cfg = { .baud_rate_div_min = STM32H7_SPI_MBR_DIV_MIN, .baud_rate_div_max = STM32H7_SPI_MBR_DIV_MAX, .has_fifo = true, + .has_device_mode = true, }; static const struct of_device_id stm32_spi_of_match[] = { @@ -1798,8 +1802,15 @@ static int stm32_spi_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; bool device_mode; int ret; + const struct of_device_id *of_match = + of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); + const struct stm32_spi_cfg *cfg = (const struct stm32_spi_cfg *)of_match->data; device_mode = of_property_read_bool(np, "spi-slave"); + if (!cfg->has_device_mode && device_mode) { + dev_err(&pdev->dev, "spi-slave not yet supported with %s\n", of_match->compatible); + return -EPERM; + } if (device_mode) ctrl = devm_spi_alloc_slave(&pdev->dev, sizeof(struct stm32_spi)); @@ -1817,9 +1828,7 @@ static int stm32_spi_probe(struct platform_device *pdev) spi->device_mode = device_mode; spin_lock_init(&spi->lock); - spi->cfg = (const struct stm32_spi_cfg *) - of_match_device(pdev->dev.driver->of_match_table, - &pdev->dev)->data; + spi->cfg = cfg; spi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(spi->base)) From patchwork Wed Jun 21 11:55:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Caron X-Patchwork-Id: 13287201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9E29EB64D8 for ; Wed, 21 Jun 2023 11:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DRYvNZve49ZI5+L89OJjr5HwhgEizYQkU/e28K7nQD4=; b=HYyi4zStt8rO5L H0jmCQTxUiH+KYx5AFswTAfIbT/axkdrA1LOYcDc8kWFz/PJ6a/If+7TF6dFZ43YRscYEcVDaJ5og TLC0vIk+Juo5SeLkbVl0pLJEjHKZkQypIvclAp/yWXw8lw9a+Iva4kOxKdE1soxWflBDfG46ysY3C oXjTtXg9KJSd9sQB7kN9t0LHEx+v9XuJFzq6PsFIdUxIOOKJptOfxkkGWRz3T1XfLI0jhvxmIBy/r X5aiGgZvC+BUBWYo2qlJZcvd7fdVH5n86yy7QsurzBsYfJwVy5Ux7bKV5nmjwdk7UZfcaOZ/yd1xj jeZguiJxvGV4ccqlbxJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBwRb-00ESMZ-2o; Wed, 21 Jun 2023 11:56:15 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBwRY-00ESKR-17 for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 11:56:13 +0000 Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35L9Sdb4029657; Wed, 21 Jun 2023 13:55:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=6Y4rx4Xj5s3qtyBRS58Z8cPaCYz9f9KZEBVnJjkIz3k=; b=4VzIOh9uyiQgK/LY3cMVMb8WnOm2daHpGDHP0dD7wjecbSEuwxH07pmdO/18RaqjtwoG 0LHx0mieRzrLdKO3QWoZqp0L9qb/hnkkLREnbGowxACAXwaLM7Wo3q3RX37vuZROlxS9 xIKZrjvqPHUUNCVUysDOavqA/A3c6d0bZMpWRJFzuroumkMVDynh7Q+61fBWL+Dtz/TT jREbpa8165XbqMcB7vSSaxQrU5nM/gMJOeyqYqF3g9vBtyW2zpphIiosDCn3t48192FJ sOEetlIBPzbGsasbHdtBL300yBXcbaBzok9cvZmpA6bC8bBWIm6FQ+SYecIK8ewagMiH Ng== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3rbrtgbmk3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 13:55:56 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D1A6110006B; Wed, 21 Jun 2023 13:55:55 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CB5B7235F39; Wed, 21 Jun 2023 13:55:55 +0200 (CEST) Received: from localhost (10.201.20.168) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 21 Jun 2023 13:55:55 +0200 From: Valentin Caron To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: Alexandre Torgue , Alain Volmat , , , , , , Valentin Caron Subject: [PATCH 2/2] spi: dt-bindings: stm32: do not disable spi-slave property for stm32f4-f7 Date: Wed, 21 Jun 2023 13:55:23 +0200 Message-ID: <20230621115523.923176-3-valentin.caron@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230621115523.923176-1-valentin.caron@foss.st.com> References: <20230621115523.923176-1-valentin.caron@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.168] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_07,2023-06-16_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_045612_864312_E15EB95C X-CRM114-Status: GOOD ( 14.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org STM32F4-F7 are, from hardware point of view, capable to handle device mode. So this property should not be forced at false in dt-bindings. Signed-off-by: Valentin Caron Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/spi/st,stm32-spi.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/st,stm32-spi.yaml b/Documentation/devicetree/bindings/spi/st,stm32-spi.yaml index f1c86e694af1..9ca1a843c820 100644 --- a/Documentation/devicetree/bindings/spi/st,stm32-spi.yaml +++ b/Documentation/devicetree/bindings/spi/st,stm32-spi.yaml @@ -27,7 +27,6 @@ allOf: then: properties: st,spi-midi-ns: false - spi-slave: false properties: compatible: