From patchwork Fri Oct 21 13:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amjad Ouled-Ameur X-Patchwork-Id: 13014827 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 EF96DC43217 for ; Fri, 21 Oct 2022 13:32:55 +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:Cc:To:Message-Id:Date:From:MIME-Version :Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ujsUun0aARNjf7NQ/Rzrz6fmPkhRgRUcdhEtdWdA1Kc=; b=bpIxWN5qUm3WrX +cKiXmprkXo+XrzhipjN164ulH4bVZvTmqEMM2MTiEnTAYWGiBT90p6yTnJKwF1m265hf9RzSccVy 6f4XMmWVQqPETWCjnRM4ggbRzwR1+prW00S3zrBkIR8dxeKEgmPJZJk0Sr4qRpsh/rpWoSqGxWu/C RpF+YXkWplxeNNyfzAi+5BorRfsTgjWiwCmhc395OxI/6Fj6MCrTj8tfoYmUedWjySgp0u7K+sblj IOd4q95+8bmKeXCkbU409+XlNGSXLsKjVBsmZASCO4SxYU+yGUX59umob9LgcbCc1l7SUNK+5Ubyy 53MU5CBns0Ll/WldadDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ols7j-007zGi-Oh; Fri, 21 Oct 2022 13:31:44 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ols7e-007z7E-Mx for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2022 13:31:41 +0000 Received: by mail-wr1-x431.google.com with SMTP id w18so4839426wro.7 for ; Fri, 21 Oct 2022 06:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:from:to:cc:subject:date:message-id:reply-to; bh=i1C8rgUAGHf+jLqpE/CuMvEaAQwxa6V5+hxBqPwgUl4=; b=VT5D5asWne9UXufhJlAhGa0EmSt5P0Hw6devsJJzR8+iofV3cA2BWJNKGMuFsN4Fqm IcxrUgNFDdlniCIrLtHcj2X/aWeccarjVBhWGNRF3+ZiX7UCWzjuHQyC02aq8LPYOsjf ZGE5hxa5G71mBHwZUBvVV25OqgTXv3Yl7zKW1SvuSkCQkS8PDUL2OHPIPe0rSDBHGiPW O1dVAsqXIH9brG0AsAHQtaPtvqepSVJIynaIH37rTakT/6U2fYRn8zm/EVqYCqt5dvsy siz+j4NbG8YUcKTzJjdaKZy4VDS/2VZdm7wyi+JVA7TSqXvRln6ioq+sJKYjgN+DqxRi h3bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=i1C8rgUAGHf+jLqpE/CuMvEaAQwxa6V5+hxBqPwgUl4=; b=Km7O47D2f0VyznhLaj4feepAzJPWZ4AtEu+SVwdhDVFyU5wKk+Wy1QmD7T7pS+bcgY RUwfIPE8CPAsVh2vtqhnNGS6dj1dBrp8ELXTVjFkOsjV4Yo2Y+4n+x/9BHG69JgE1I0R XKWzTU71c5pPZQAUdsCC/8rpUtYmJzMIBE2WZ6J19k48NqQ/AVF1ufjJ11anJEebJGuB 54ZoWTeXUCsGXBnyXpw2WAANhA+5tJQlhJFR0L6QngZ+W2erGoS/al9MiXh0gW4Qjibi 8qr42fAlCI7UE+WGERrD6802jlvL8GZ6J7g+Zy/ew9iY9hIKoiCThWrJr6RhIfN+3Hse iTVA== X-Gm-Message-State: ACrzQf0cD2BKJO+ITzX8ccoDrk4qZakbIhn5lcMUgCLoUHI91wy7vfgP 0yKn2RspjKtAh7+ANkvh6IiG7Q== X-Google-Smtp-Source: AMsMyM5qyI1cW3ggb8lP2/pXLZo9ZzZ8Tvd5w+92XYdbvWvWBG5C05J0jgsWEpZL+/L7Tqi/pOTWvA== X-Received: by 2002:a5d:5983:0:b0:22e:bb12:7041 with SMTP id n3-20020a5d5983000000b0022ebb127041mr12385502wri.645.1666359096510; Fri, 21 Oct 2022 06:31:36 -0700 (PDT) Received: from [127.0.1.1] (210.145.15.109.rev.sfr.net. [109.15.145.210]) by smtp.googlemail.com with ESMTPSA id j8-20020a05600c1c0800b003c6b7f5567csm10325280wms.0.2022.10.21.06.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 06:31:35 -0700 (PDT) Subject: [PATCH v4 0/4] spi: amlogic: meson-spicc: Use pinctrl to drive CLK line when idle MIME-Version: 1.0 X-b4-tracking: H4sIACyfUmMC/33NTQrCMBAF4KuUrB1JJrU/rryHuEjSqR2IbUlssJTe3eBS0NXwHrxvNhEpMEVxLj YRKHHkacyhPBTCDWa8E3CXs0CJqKQsYZnBPDz0/II4Mzi0tqa6oUpqkUfWRAIbzOiGPBsX73M5cHxO Yf08SZjP9aeXECRoagy1yqgWTxdrVs820NFND3HLWtL/BZ2Fpu1IYdV3qtJfwr7vb0sgc/P2AAAA From: Amjad Ouled-Ameur Date: Fri, 21 Oct 2022 15:31:24 +0200 Message-Id: <20221004-up-aml-fix-spi-v4-0-0342d8e10c49@baylibre.com> To: Kevin Hilman , Jerome Brunet , Rob Herring , Martin Blumenstingl , Neil Armstrong , Krzysztof Kozlowski , Mark Brown Cc: linux-amlogic@lists.infradead.org, Neil Armstrong , Amjad Ouled-Ameur , Da Xue , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.10.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1666359095; l=1850; i=aouledameur@baylibre.com; s=20220920; h=from:subject:message-id; bh=uh9b1V5lppXzVxalMWZveFXtfZNKXVHWr9osZJQJmd8=; b=0swTXrE+WS10AzArr7fM6CGstAbhVRX7nQSIOVPrQrbIfFk9podLHQ5iJt+C/00Nj7XVBVPwvjaG BSHMkaSkDAQUMKq8yDVgWMXnURoaBsPi/EI1jLcB/9/tmwrPLfas X-Developer-Key: i=aouledameur@baylibre.com; a=ed25519; pk=HgYWawSL4qLGPx+RzJ+Cuu+V8Pi/KQnDDm1wjWPMOFE= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221021_063138_770912_5C32D236 X-CRM114-Status: GOOD ( 13.30 ) 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 Between SPI transactions, all SPI pins are in HiZ state. When using the SS signal from the SPICC controller it's not an issue because when the transaction resumes all pins come back to the right state at the same time as SS. The problem is when we use CS as a GPIO. In fact, between the GPIO CS state change and SPI pins state change from idle, you can have a missing or spurious clock transition. Set a bias on the clock depending on the clock polarity requested before CS goes active, by passing a special "idle-low" and "idle-high" pinctrl state and setting the right state at a start of a message. Signed-off-by: Amjad Ouled-Ameur --- Changes in v4: - Fixed documentation by defining pinctrl-x. - Link to v3: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v3-0-89de126fd163@baylibre.com Changes in v3: - Fixed documentation by removing pinctrl states as they are not mandatory. - Link to v2: https://lore.kernel.org/r/20221004-up-aml-fix-spi-v2-0-3e8ae91a1925@baylibre.com --- Amjad Ouled-Ameur (4): spi: dt-bindings: amlogic, meson-gx-spicc: Add pinctrl names for SPI signal states spi: meson-spicc: Use pinctrl to drive CLK line when idle arm64: dts: meson-gxl: add SPI pinctrl nodes for CLK arm64: dts: meson-gxbb: add SPI pinctrl nodes for CLK .../bindings/spi/amlogic,meson-gx-spicc.yaml | 75 ++++++++++++++-------- arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 14 ++++ arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 14 ++++ drivers/spi/spi-meson-spicc.c | 39 ++++++++++- 4 files changed, 113 insertions(+), 29 deletions(-) --- base-commit: e35184f321518acadb681928a016da21a9a20c13 change-id: 20221004-up-aml-fix-spi-c2bb7e78e603 Best regards,