From patchwork Tue Jun 28 04:42:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12897641 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F10BCCA47E for ; Tue, 28 Jun 2022 04:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244320AbiF1Eos (ORCPT ); Tue, 28 Jun 2022 00:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244298AbiF1Eom (ORCPT ); Tue, 28 Jun 2022 00:44:42 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D60A65A2 for ; Mon, 27 Jun 2022 21:44:39 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220628044434epoutp0368e1209d6176909b2c8bda74d3192e68~8r0UYEDyE1338413384epoutp03r for ; Tue, 28 Jun 2022 04:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220628044434epoutp0368e1209d6176909b2c8bda74d3192e68~8r0UYEDyE1338413384epoutp03r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1656391474; bh=dcRRY121HxQELI/G/iJS58nUkk5oUSZCKSDNdRBjJKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ojpoPuKzHji9B5d5TUWj2gmyW+AKrGPQ7B519pasHk+G/P/c5ONp9iwiOaWeRw1i0 AHgx6RUWQJh9Q56p5BGgMRnnmVGA6+WbLE9eEzeF87e4L9thz2Ld43DjW13KdkEIhJ cRIfN0k9pq5wkcC0ogxrI4t4AECg7wwBTZbhP8pA= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20220628044433epcas2p21ef7d4017e99dec638adaf14921f4b78~8r0Tzf6_r0060600606epcas2p2S; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.90]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4LXBp91lSFz4x9QB; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id DA.D6.09666.1378AB26; Tue, 28 Jun 2022 13:44:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epcas2p2116480d15be87cb723855b7a39ced6dc~8r0S80Et20047300473epcas2p2O; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220628044432epsmtrp17233c4708f4314e1d46d75949becec61~8r0S4CmhY2149721497epsmtrp16; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) X-AuditID: b6c32a45-45bff700000025c2-88-62ba87315f55 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E4.70.08905.0378AB26; Tue, 28 Jun 2022 13:44:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epsmtip17aed2d3d4ebf3a8d035ebbb4d93f689f~8r0Sp_eIV2861828618epsmtip1i; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Alim Akhtar , devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chanho Park Subject: [PATCH v2 1/4] spi: s3c64xx: support loopback mode Date: Tue, 28 Jun 2022 13:42:19 +0900 Message-Id: <20220628044222.152794-2-chanho61.park@samsung.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628044222.152794-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJsWRmVeSWpSXmKPExsWy7bCmha5h+64kg78fuCwezNvGZrH4x3Mm i6kPn7BZXN6vbTH/yDlWi74XD5kt9r7eym6x6fE1VosZ5/cxWTR+vMlu0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWlW2TkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pm YKhraGlhrqSQl5ibaqvk4hOg65aZA3SdkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKbUg JafAvECvODG3uDQvXS8vtcTK0MDAyBSoMCE748nfl2wFC4Qqvl+/w9jA2MnfxcjJISFgIvHz 1gT2LkYuDiGBHYwSHyb/YIVwPjFK7L/zihHC+cYocfH1ciaYli9/JrNAJPYyStyadJkZwvnI KDH7yT+wKjYBXYktzyHaRQRuMkpMP9vHBOIwC9xglNg7Yz0jSJWwgLXEu7+v2UBsFgFViaa2 dcwgNq+AvcSfta0sEPvkJTbM7wWLcwo4SCy4vZ0RokZQ4uTMJ2A1zEA1zVtng50hITCRQ+L4 nlnsEM0uEl+e32GGsIUlXh3fAhWXknjZ3wZlF0ssnfWJCaK5gVHi8rZfbBAJY4lZz9qBtnEA bdCUWL9LH8SUEFCWOHILai+fRMfhv+wQYV6JjjYhiEZ1iQPbp0OdLyvRPeczK4TtIdH28Dg4 gIQEJjNKvLtpNYFRYRaSb2Yh+WYWwt4F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ZVH/QO MTJxMB5ilOBgVhLhXXhmZ5IQb0piZVVqUX58UWlOavEhRmkOFiVx3gtdJ+OFBNITS1KzU1ML UotgskwcnFINTHF2zbPz3mzzzWL5fyf905mAm65s0ouvTPqn96L+vnkl4wfW1Ufn+S9yaLRP 97Cd379n5k4+dZsDKqbLmTklnyQd23jfsf7129X3cw4lx3n7mP3MeTv3y6v8My8Yyx9IhGk8 dp082Urz9G2FE6unOO8QeNv8QYBTZZnMNJHfCV8vvmjWKzt3L2v5c8nVLw7cMmbqWr/ic+rp Iv4JmxpC7k0LdU6YNknoEcsZwZVTf/spZW2b17zfsXuFZtwZYYb6JTynHV4fWVkV7JicKhay JrO+/dz3ru2K6S4ap2yyci59sAgz3VllLx4rd8yE4WFcgVk2w++Fz95KHTdPiez3/Lns37X3 MxrtHm/82H9aca4SS3FGoqEWc1FxIgB5xk3C8gIAAA== X-CMS-MailID: 20220628044432epcas2p2116480d15be87cb723855b7a39ced6dc X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220628044432epcas2p2116480d15be87cb723855b7a39ced6dc References: <20220628044222.152794-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Modern exynos SoCs can support self loopback mode via setting BIT(3) of MODE_CFG register. Previous SoCs don't have the bit so we need to add has_loopback field in the s3c64xx_spi_port_config. Exynos Auto v9 SoC has the bit and it will define the field to "true". When it is set, SPI_LOOP mode will be marked. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Chanho Park Reviewed-by: Andi Shyti --- drivers/spi/spi-s3c64xx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 7f0faf0d75d9..b3c50c7665fc 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -59,6 +59,7 @@ #define S3C64XX_SPI_MODE_BUS_TSZ_HALFWORD (1<<17) #define S3C64XX_SPI_MODE_BUS_TSZ_WORD (2<<17) #define S3C64XX_SPI_MODE_BUS_TSZ_MASK (3<<17) +#define S3C64XX_SPI_MODE_SELF_LOOPBACK (1<<3) #define S3C64XX_SPI_MODE_RXDMA_ON (1<<2) #define S3C64XX_SPI_MODE_TXDMA_ON (1<<1) #define S3C64XX_SPI_MODE_4BURST (1<<0) @@ -135,6 +136,7 @@ struct s3c64xx_spi_dma_data { * @clk_from_cmu: True, if the controller does not include a clock mux and * prescaler unit. * @clk_ioclk: True if clock is present on this device + * @has_loopback: True if loopback mode can be supported * * The Samsung s3c64xx SPI controller are used on various Samsung SoC's but * differ in some aspects such as the size of the fifo and spi bus clock @@ -149,6 +151,7 @@ struct s3c64xx_spi_port_config { bool high_speed; bool clk_from_cmu; bool clk_ioclk; + bool has_loopback; }; /** @@ -659,6 +662,9 @@ static int s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) break; } + if ((sdd->cur_mode & SPI_LOOP) && sdd->port_conf->has_loopback) + val |= S3C64XX_SPI_MODE_SELF_LOOPBACK; + writel(val, regs + S3C64XX_SPI_MODE_CFG); if (sdd->port_conf->clk_from_cmu) { @@ -1148,6 +1154,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) SPI_BPW_MASK(8); /* the spi->mode bits understood by this driver: */ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; + if (sdd->port_conf->has_loopback) + master->mode_bits |= SPI_LOOP; master->auto_runtime_pm = true; if (!is_polling(sdd)) master->can_dma = s3c64xx_spi_can_dma; From patchwork Tue Jun 28 04:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12897642 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3F76C43334 for ; Tue, 28 Jun 2022 04:44:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244298AbiF1Eot (ORCPT ); Tue, 28 Jun 2022 00:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244329AbiF1Eop (ORCPT ); Tue, 28 Jun 2022 00:44:45 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E549958B for ; Mon, 27 Jun 2022 21:44:39 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220628044434epoutp03ed9406c2eae28ccb264944f28da116b3~8r0UfHLKV1261812618epoutp03- for ; Tue, 28 Jun 2022 04:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220628044434epoutp03ed9406c2eae28ccb264944f28da116b3~8r0UfHLKV1261812618epoutp03- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1656391474; bh=J5mUbOnlge67Kp3ch61lExaYuS3HiESE8Qq3FyYrjjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJzvd26VB8cwAfM/1aLPuVO2I2vLlqRcLDW+ybp3GpZC5T6DIKVRalScWP+WEGGVX tFkp/Xz1LVycWUBW9qTxLxQwOcV+c/O7AmS8NaApxwQl/yhfMTrR5f7ddT730XEnQ0 GCGW/5KjLetj0xiQ4SbFvUx70qH6cGysr7yF6fiY= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220628044433epcas2p30ccf54c11ea8cd1ea6085f1d9c5b0a6a~8r0TzojP71830818308epcas2p39; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.90]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4LXBp91p9fz4x9Pw; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id FA.D6.09666.1378AB26; Tue, 28 Jun 2022 13:44:33 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epcas2p11e6f927321c30cf5557dbd41d749ef28~8r0TANA1p1424614246epcas2p1l; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220628044432epsmtrp2e1a72a51fe0de0497151a6a437be01e5~8r0S_iJrx2084220842epsmtrp23; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) X-AuditID: b6c32a45-471ff700000025c2-89-62ba87319e7d Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A5.70.08905.0378AB26; Tue, 28 Jun 2022 13:44:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epsmtip1f70fcd8482e010ed119cdb03a9eef5af~8r0SvnclO2875028750epsmtip1d; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Alim Akhtar , devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chanho Park Subject: [PATCH v2 2/4] spi: s3c64xx: support custom value of internal clock divider Date: Tue, 28 Jun 2022 13:42:20 +0900 Message-Id: <20220628044222.152794-3-chanho61.park@samsung.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628044222.152794-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJsWRmVeSWpSXmKPExsWy7bCmha5h+64kgw1zeSwezNvGZrH4x3Mm i6kPn7BZXN6vbTH/yDlWi74XD5kt9r7eym6x6fE1VosZ5/cxWTR+vMlu0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWlW2TkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pm YKhraGlhrqSQl5ibaqvk4hOg65aZA3SdkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKbUg JafAvECvODG3uDQvXS8vtcTK0MDAyBSoMCE7Y8mzDpaCRToVj551szYwrlHuYuTkkBAwkWjY uouxi5GLQ0hgB6PE1ds7mSCcT4wSt06sYYNwvjFKXLuxiRmm5cL5p8wQib2MEu++LYZq+cgo Mf9eIyNIFZuArsSW56/ABosI3GSUmH62D6yKWeAGo8TeGeuBMhwcwgJhEpNfuII0sAioSqzo +skOYvMK2EscutIKtU5eYsP8XjCbU8BBYsHt7YwQNYISJ2c+YQGxmYFqmrfOBjtJQqCXQ2LO +f1QzS4Sffd6WCFsYYlXx7ewQ9hSEp/f7WWDsIslls76xATR3MAocXnbL6iEscSsZ+1ghzIL aEqs36UPYkoIKEscuQW1l0+i4/Bfdogwr0RHmxBEo7rEge3TWSBsWYnuOZ+hLvCQmHJ8Bwsk sCYzSvSvm8k8gVFhFpJ3ZiF5ZxbC4gWMzKsYxVILinPTU4uNCgzhcZycn7uJEZxetVx3ME5+ +0HvECMTB+MhRgkOZiUR3oVndiYJ8aYkVlalFuXHF5XmpBYfYjQFBvZEZinR5Hxggs8riTc0 sTQwMTMzNDcyNTBXEuf1StmQKCSQnliSmp2aWpBaBNPHxMEp1cBkyiZ83e/wNMVVE5x8zvVW m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QLrjP9++HguVHanrvaS 1SrrlE/6avnx+U5n9c/2eeKT8S/h8MzT4nOfbZoe4GE1z2tnoYjS8f9P+HM9XOvOvPvlEx5f uF01VUl5xm4xG5P3O/evnJjwkv170uJT7+8kRoWdbb0wfdqklIQz2227PlWdbS0vDn4dtmib kWFIr0Tt97M71tiq+23fs2dR6H5Hrzelj77tlnPjlHM54PmHW27ys4P3Z2YarNo0keet1zL+ a5unCpq6q1xYrMRSnJFoqMVcVJwIAHbzTMzzAgAA X-CMS-MailID: 20220628044432epcas2p11e6f927321c30cf5557dbd41d749ef28 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220628044432epcas2p11e6f927321c30cf5557dbd41d749ef28 References: <20220628044222.152794-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Modern exynos SoCs such as Exynos Auto v9 has different internal clock divider, for example "4". To support this internal value, this adds clk_div of the s3c64xx_spi_port_config and assign "2" as the default value to existing s3c64xx_spi_port_config. Signed-off-by: Chanho Park --- drivers/spi/spi-s3c64xx.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b3c50c7665fc..51a0e830441b 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -131,6 +131,7 @@ struct s3c64xx_spi_dma_data { * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter. + * @clk_div: Internal clock divider, if not specified, use 2 as the default. * @quirks: Bitmask of known quirks * @high_speed: True, if the controller supports HIGH_SPEED_EN bit. * @clk_from_cmu: True, if the controller does not include a clock mux and @@ -148,6 +149,7 @@ struct s3c64xx_spi_port_config { int rx_lvl_offset; int tx_st_done; int quirks; + int clk_div; bool high_speed; bool clk_from_cmu; bool clk_ioclk; @@ -620,6 +622,7 @@ static int s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) void __iomem *regs = sdd->regs; int ret; u32 val; + u32 div = sdd->port_conf->clk_div; /* Disable Clock */ if (!sdd->port_conf->clk_from_cmu) { @@ -668,16 +671,15 @@ static int s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) writel(val, regs + S3C64XX_SPI_MODE_CFG); if (sdd->port_conf->clk_from_cmu) { - /* The src_clk clock is divided internally by 2 */ - ret = clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); + ret = clk_set_rate(sdd->src_clk, sdd->cur_speed * div); if (ret) return ret; - sdd->cur_speed = clk_get_rate(sdd->src_clk) / 2; + sdd->cur_speed = clk_get_rate(sdd->src_clk) / div; } else { /* Configure Clock */ val = readl(regs + S3C64XX_SPI_CLK_CFG); val &= ~S3C64XX_SPI_PSR_MASK; - val |= ((clk_get_rate(sdd->src_clk) / sdd->cur_speed / 2 - 1) + val |= ((clk_get_rate(sdd->src_clk) / sdd->cur_speed / div - 1) & S3C64XX_SPI_PSR_MASK); writel(val, regs + S3C64XX_SPI_CLK_CFG); @@ -871,6 +873,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi) struct s3c64xx_spi_csinfo *cs = spi->controller_data; struct s3c64xx_spi_driver_data *sdd; int err; + u32 div = 2; sdd = spi_master_get_devdata(spi->master); if (spi->dev.of_node) { @@ -889,22 +892,24 @@ static int s3c64xx_spi_setup(struct spi_device *spi) pm_runtime_get_sync(&sdd->pdev->dev); + div = sdd->port_conf->clk_div; + /* Check if we can provide the requested rate */ if (!sdd->port_conf->clk_from_cmu) { u32 psr, speed; /* Max possible */ - speed = clk_get_rate(sdd->src_clk) / 2 / (0 + 1); + speed = clk_get_rate(sdd->src_clk) / div / (0 + 1); if (spi->max_speed_hz > speed) spi->max_speed_hz = speed; - psr = clk_get_rate(sdd->src_clk) / 2 / spi->max_speed_hz - 1; + psr = clk_get_rate(sdd->src_clk) / div / spi->max_speed_hz - 1; psr &= S3C64XX_SPI_PSR_MASK; if (psr == S3C64XX_SPI_PSR_MASK) psr--; - speed = clk_get_rate(sdd->src_clk) / 2 / (psr + 1); + speed = clk_get_rate(sdd->src_clk) / div / (psr + 1); if (spi->max_speed_hz < speed) { if (psr+1 < S3C64XX_SPI_PSR_MASK) { psr++; @@ -914,7 +919,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi) } } - speed = clk_get_rate(sdd->src_clk) / 2 / (psr + 1); + speed = clk_get_rate(sdd->src_clk) / div / (psr + 1); if (spi->max_speed_hz >= speed) { spi->max_speed_hz = speed; } else { @@ -1396,6 +1401,7 @@ static const struct s3c64xx_spi_port_config s3c2443_spi_port_config = { .fifo_lvl_mask = { 0x7f }, .rx_lvl_offset = 13, .tx_st_done = 21, + .clk_div = 2, .high_speed = true, }; @@ -1403,12 +1409,14 @@ static const struct s3c64xx_spi_port_config s3c6410_spi_port_config = { .fifo_lvl_mask = { 0x7f, 0x7F }, .rx_lvl_offset = 13, .tx_st_done = 21, + .clk_div = 2, }; static const struct s3c64xx_spi_port_config s5pv210_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F }, .rx_lvl_offset = 15, .tx_st_done = 25, + .clk_div = 2, .high_speed = true, }; @@ -1416,6 +1424,7 @@ static const struct s3c64xx_spi_port_config exynos4_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F }, .rx_lvl_offset = 15, .tx_st_done = 25, + .clk_div = 2, .high_speed = true, .clk_from_cmu = true, .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, @@ -1425,6 +1434,7 @@ static const struct s3c64xx_spi_port_config exynos7_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F, 0x7F, 0x7F, 0x1ff}, .rx_lvl_offset = 15, .tx_st_done = 25, + .clk_div = 2, .high_speed = true, .clk_from_cmu = true, .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, @@ -1434,6 +1444,7 @@ static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { .fifo_lvl_mask = { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff}, .rx_lvl_offset = 15, .tx_st_done = 25, + .clk_div = 2, .high_speed = true, .clk_from_cmu = true, .clk_ioclk = true, @@ -1444,6 +1455,7 @@ static struct s3c64xx_spi_port_config fsd_spi_port_config = { .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, .rx_lvl_offset = 15, .tx_st_done = 25, + .clk_div = 2, .high_speed = true, .clk_from_cmu = true, .clk_ioclk = false, From patchwork Tue Jun 28 04:42:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12897640 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9F99CCA481 for ; Tue, 28 Jun 2022 04:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229922AbiF1Eor (ORCPT ); Tue, 28 Jun 2022 00:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244320AbiF1Eon (ORCPT ); Tue, 28 Jun 2022 00:44:43 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D83F65DE for ; Mon, 27 Jun 2022 21:44:39 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220628044434epoutp03591b136fce11a24a7eeedf73dc715af6~8r0URY-_t1276412764epoutp03- for ; Tue, 28 Jun 2022 04:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220628044434epoutp03591b136fce11a24a7eeedf73dc715af6~8r0URY-_t1276412764epoutp03- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1656391474; bh=pg1DKFGFeJP5gxc9XEzGTEP/OW75qIBRA0MM9cRt76c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VruVEAfoTWtX768coIhRrjw34FDsJY0grsoHzRspFzNRV10OMXCnUQ4CuEI5EPBZ7 BLtbxzoZ5y/J4E9AbG4g+IG/6PW2vkzKFwPXl9AHPEiKiwtwrkPnIp+oD9c1R3F6J7 kuHsqBQvb0TFJ3khvrtLuphrHnBx6ZjKWEQ6sI+s= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220628044433epcas2p1304d17972c3230df4d443a4f416cdec0~8r0Ty0tQH1424614246epcas2p1p; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.89]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LXBp91vN4z4x9QP; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 79.79.09650.1378AB26; Tue, 28 Jun 2022 13:44:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epcas2p3781648b3cade1dcac6b8e0f3899d7299~8r0TCr-SC1828318283epcas2p3A; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220628044432epsmtrp1eed3b2aefe2c2d2f867134caf623435e~8r0TB6cwg2149721497epsmtrp17; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) X-AuditID: b6c32a46-0a3ff700000025b2-ab-62ba8731902c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 66.70.08905.0378AB26; Tue, 28 Jun 2022 13:44:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epsmtip1579e51ade53adfd5cfd996c440a255c8~8r0S1G5bG2861828618epsmtip1j; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Alim Akhtar , devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chanho Park Subject: [PATCH v2 3/4] dt-bindings: samsung,spi: define exynosautov9 compatible Date: Tue, 28 Jun 2022 13:42:21 +0900 Message-Id: <20220628044222.152794-4-chanho61.park@samsung.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628044222.152794-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmha5h+64kg0vveSwezNvGZrH4x3Mm i6kPn7BZXN6vbTH/yDlWi74XD5kt9r7eym6x6fE1VosZ5/cxWTR+vMlu0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWlW2TkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pm YKhraGlhrqSQl5ibaqvk4hOg65aZA3SdkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKbUg JafAvECvODG3uDQvXS8vtcTK0MDAyBSoMCE7Y8rOJraCNZwV85q2MjUwtrN3MXJ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0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJUxZWcTW8Eazop5TVuZ Ghjb2bsYOTkkBEwkNl7vYuti5OIQEtjNKLGppYERIiEr8ezdDqgiYYn7LUdYQWwhgfeMEk82 iYLYbAK6Eluev2IEaRYRuM0o8bdxG9gkZoE7jBKPlu9h6mLk4BAWCJB438sM0sAioCpxY9sd NhCbV8Be4vqjVSwQC+QlNsyHqOEUcJBYcHs7I8Qye4n1O9eyQtQLSpyc+QSsnhmovnnrbOYJ jAKzkKRmIUktYGRaxSiZWlCcm55bbFhgmJdarlecmFtcmpeul5yfu4kRHAVamjsYt6/6oHeI kYmD8RCjBAezkgjvwjM7k4R4UxIrq1KL8uOLSnNSiw8xSnOwKInzXug6GS8kkJ5YkpqdmlqQ WgSTZeLglGpg8g2+WXhSLP9Zhb20nDD//06Lk/P65/6fLvzq2+nyGSLsXgZ+xRMOvln//E+J b9BUrk1dB6wlfB3eGJ7U3qYT8kaw8fzJN6Knll/xic2c+ENJc+/WhWk5Ngnh3gtq+7c/bGKb dGmK9q7M3L0+V8wkSxfI3j717/vL9Cxv4bMfI264p/Ee3Dlt95fZysU+74/O7jy+T8yjJe9l 3ac5d3LfGzC+M+LPPriuY/M7finO4LZzmndkQzj3FzlP4GZNS2APnbtOxyzoOo+Kc+K005un zNRace5ak9HqxtqJT2d4Pspk+Csa2vX4Y8a5ZRtC3+c49jk+mceYu9r31rllH+boqhbYKN2s nLnr792g/R17xJRYijMSDbWYi4oTAZTy4F7xAgAA X-CMS-MailID: 20220628044432epcas2p3781648b3cade1dcac6b8e0f3899d7299 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220628044432epcas2p3781648b3cade1dcac6b8e0f3899d7299 References: <20220628044222.152794-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Define "samsung,exynosautov9-spi" for Exynos Auto v9's spi. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Chanho Park Reviewed-by: Andi Shyti --- Documentation/devicetree/bindings/spi/samsung,spi.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/samsung,spi.yaml b/Documentation/devicetree/bindings/spi/samsung,spi.yaml index a50f24f9359d..d51ee3e6d604 100644 --- a/Documentation/devicetree/bindings/spi/samsung,spi.yaml +++ b/Documentation/devicetree/bindings/spi/samsung,spi.yaml @@ -21,6 +21,7 @@ properties: - samsung,s3c6410-spi - samsung,s5pv210-spi # for S5PV210 and S5PC110 - samsung,exynos5433-spi + - samsung,exynosautov9-spi - tesla,fsd-spi - const: samsung,exynos7-spi deprecated: true @@ -85,7 +86,9 @@ allOf: properties: compatible: contains: - const: samsung,exynos5433-spi + enum: + - samsung,exynos5433-spi + - samsung,exynosautov9-spi then: properties: clocks: From patchwork Tue Jun 28 04:42:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 12897643 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DCABCCA479 for ; Tue, 28 Jun 2022 04:44:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244321AbiF1Eot (ORCPT ); Tue, 28 Jun 2022 00:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244334AbiF1Eop (ORCPT ); Tue, 28 Jun 2022 00:44:45 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 330719FC8 for ; Mon, 27 Jun 2022 21:44:44 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220628044434epoutp0302ae5a3cb5efeeea3326b2d9ae923aa6~8r0Uvm6aG1311513115epoutp03j for ; Tue, 28 Jun 2022 04:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220628044434epoutp0302ae5a3cb5efeeea3326b2d9ae923aa6~8r0Uvm6aG1311513115epoutp03j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1656391474; bh=WdzNcCBUUsRhvuN8WI9tNEWHB08Feb81bArEwJFsRw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHy6WIqcKYpVqhh6xwfxBhC7moi7+dFviDBmpF+feEln8LGl/sTGyAf6DTwiqFAqK eNPmMlcGmO51ydCZRKFrz8oO4/9ae48NSXJfA6Y7PM3w48ji2PmMiVngRxWYJzPU7z ilPNhPRUxzQLSHfAQdPGVoXFh0YFK2zsbN4/KoTE= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220628044433epcas2p347141f45fa7e761965ad99e82ff15d03~8r0UFRGun1827118271epcas2p3e; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.91]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4LXBp94SJzz4x9Q7; Tue, 28 Jun 2022 04:44:33 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 6C.D6.09666.1378AB26; Tue, 28 Jun 2022 13:44:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epcas2p2e2b4c0d52f11c0bf543c537e819224bc~8r0TLfgjV0047300473epcas2p2P; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220628044432epsmtrp139f0304b5aca10b4e6ce04e43c2d3544~8r0TKqKE02149721497epsmtrp18; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) X-AuditID: b6c32a45-45bff700000025c2-8a-62ba8731fb31 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 37.70.08905.0378AB26; Tue, 28 Jun 2022 13:44:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.229.9.51]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220628044432epsmtip18800ee082a259ae04efbd064ce9e58d9~8r0S8wBq_2875128751epsmtip1a; Tue, 28 Jun 2022 04:44:32 +0000 (GMT) From: Chanho Park To: Krzysztof Kozlowski , Andi Shyti , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Alim Akhtar , devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chanho Park Subject: [PATCH v2 4/4] spi: s3c64xx: add spi port configuration for Exynos Auto v9 SoC Date: Tue, 28 Jun 2022 13:42:22 +0900 Message-Id: <20220628044222.152794-5-chanho61.park@samsung.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628044222.152794-1-chanho61.park@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCJsWRmVeSWpSXmKPExsWy7bCmha5h+64kgytzRSwezNvGZrH4x3Mm i6kPn7BZXN6vbTH/yDlWi74XD5kt9r7eym6x6fE1VosZ5/cxWTR+vMlu0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWlW2TkZqYklq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NkosxRmJhlrMRcWJ AIal9Nk3BAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsWy7bCSnK5B+64kgwUrTCwezNvGZrH4x3Mm i6kPn7BZXN6vbTH/yDlWi74XD5kt9r7eym6x6fE1VosZ5/cxWTR+vMlu0br3CLsDt8f1JZ+Y PTat6mTzuHNtD5vH5iX1Hn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJVx9mYHe8FDvoofd08w NTBO4eli5OSQEDCR2HvyHVMXIxeHkMBuRonfV76xQyRkJZ692wFlC0vcbznCClH0nlHi3eEm VpAEm4CuxJbnrxhBEiICtxkl/jZuYwNxmAXuMEo8Wr6HCaRKWCBcYtajhWCjWARUJZb3rmcD sXkF7CUu3j3GArFCXmLD/F5mEJtTwEFiwe3tjCC2EFDN+p1rWSHqBSVOznwCVs8MVN+8dTbz BEaBWUhSs5CkFjAyrWKUTC0ozk3PLTYsMMxLLdcrTswtLs1L10vOz93ECI4ELc0djNtXfdA7 xMjEwXiIUYKDWUmEd+GZnUlCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeS90nYwXEkhPLEnNTk0t SC2CyTJxcEo1MF14bvR0f630Vf0z63b6/P6dlFu1+5vikm3HjgfemP/qpkHU+43tO5dlM+ke ay64dmzbzDlPaq2V/2x6eD04+X3C0yWfNRxP3XB/5fH26PU4weVPCnp2qSoLNXldV//J9mPS rontQUIxoSuP9X0Uf7Htg5/o/cmLv+SbaTj2M/7YwXk/tUmLvVj24Efp2Yl12YbSV583eYgU fNhYdOTdL7e1Jmsn786bot6WndV2o/9j69SeWcsjPCT4mC8fvP9pUmWgFcNal9cHfd+o2juz 5Bjee3hn1x8BlaIFU6NqX9kXezvezDh6cgXbE+k9Z1hua1neb3eu++B89ltuxfWG2hd6VzYt Fmqs6gueorQ+/OskJZbijERDLeai4kQARnCwRfMCAAA= X-CMS-MailID: 20220628044432epcas2p2e2b4c0d52f11c0bf543c537e819224bc X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220628044432epcas2p2e2b4c0d52f11c0bf543c537e819224bc References: <20220628044222.152794-1-chanho61.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add exynosautov9 spi port configuration. It supports up to 12 spis so MAX_SPI_PORTS should be increased from 6 to 12. It has DIV_4 as the default internal clock divider and an internal loopback mode to run a loopback test. Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Reviewed-by: Andi Shyti --- drivers/spi/spi-s3c64xx.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 51a0e830441b..0c9e19889809 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -18,7 +18,7 @@ #include -#define MAX_SPI_PORTS 6 +#define MAX_SPI_PORTS 12 #define S3C64XX_SPI_QUIRK_POLL (1 << 0) #define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1) #define AUTOSUSPEND_TIMEOUT 2000 @@ -1451,6 +1451,19 @@ static const struct s3c64xx_spi_port_config exynos5433_spi_port_config = { .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, }; +static const struct s3c64xx_spi_port_config exynosautov9_spi_port_config = { + .fifo_lvl_mask = { 0x1ff, 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff, 0x7f, + 0x7f, 0x7f, 0x7f, 0x7f}, + .rx_lvl_offset = 15, + .tx_st_done = 25, + .clk_div = 4, + .high_speed = true, + .clk_from_cmu = true, + .clk_ioclk = true, + .has_loopback = true, + .quirks = S3C64XX_SPI_QUIRK_CS_AUTO, +}; + static struct s3c64xx_spi_port_config fsd_spi_port_config = { .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, .rx_lvl_offset = 15, @@ -1492,6 +1505,9 @@ static const struct of_device_id s3c64xx_spi_dt_match[] = { { .compatible = "samsung,exynos5433-spi", .data = (void *)&exynos5433_spi_port_config, }, + { .compatible = "samsung,exynosautov9-spi", + .data = (void *)&exynosautov9_spi_port_config, + }, { .compatible = "tesla,fsd-spi", .data = (void *)&fsd_spi_port_config, },