Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp765091ybh; Thu, 12 Mar 2020 10:41:15 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuQS5uOwr0PAndm688HuJM5Ldo0kjWopKqRdDTWcwgHk64ZzVSfjqZiKeW9gTHV5rAmPwM3 X-Received: by 2002:a9d:7393:: with SMTP id j19mr6659869otk.254.1584034875825; Thu, 12 Mar 2020 10:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584034875; cv=none; d=google.com; s=arc-20160816; b=qyqKnK3iAQQ2FN/o4ApeJdaM8BYn4ybKoL1ezm0lkhtE1Cx1U7Q80/kV+Wd7YEhfzU rtJL19nPnU8ilyJHXcytvTmQO70qfxNS5vNR+PxDQ2d8j34TaTi51W6e8t9vvP8ffG1o Z3ErCMoEhSWe3jyipkBwPUw4VuNK1Cm+1hGhFFwgwhUwS582lwdT29OyLVLfEiyFWItM VAu2QdtrWtPzEutRL5VdvlTC0usOz6xaHdFCBUYjV68joeO92O6wUcrmtcvYnoRe1EWr qJNI8nRGHMqpIA99kWnjmBEtYoYnd6e8oGBNWmQA7UUsyVVUiuKZfjqmtQk+jGKPMqNL LA6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:subject:cc:to:from :date; bh=AQCvVP6Gjv4mUqZ7ZUXJtFdfkrP6XkCtxADrPjZZz38=; b=irPlFHjywXNXFsjWDwbIbyJbj4nJg3cZcnyBx3qQZsSWfYYbr3t8ZuvQyu3OhGKK8z heZXCiJSw3JPqqwshNqqtlLbr5MLOIJaHHViyWyNkgs0e3bP+jhLs9WpztcJfcBTpJG4 2kq3nMTC/eLwkHsh+2cazA40EDAKCdbkQfWsxxgbokPLbRilTIR3Gd5AjEr3rDjHrwxm 8Uj4NFEny7V9Wv7PheH0NoxWlJrpY49/EBqcPwsRegXnd4LXuf1gfJogUogcIVQF64ud wR6vEXg7ZVNVGsVMy0k2VRWoIPcY4nYfdkjEyWEQy9E/1P3AP1wQ4oS6DscnPE0BNQ9j 0PWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si2979617otn.140.2020.03.12.10.41.03; Thu, 12 Mar 2020 10:41:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgCLRja (ORCPT + 99 others); Thu, 12 Mar 2020 13:39:30 -0400 Received: from foss.arm.com ([217.140.110.172]:38944 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgCLRj3 (ORCPT ); Thu, 12 Mar 2020 13:39:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B4B6C30E; Thu, 12 Mar 2020 10:39:28 -0700 (PDT) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 391C13F6CF; Thu, 12 Mar 2020 10:39:28 -0700 (PDT) Date: Thu, 12 Mar 2020 17:39:26 +0000 From: Mark Brown To: Sunny Luo Cc: broonie@kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown , Neil Armstrong , Yixun Lan Subject: Applied "spi: meson-spicc: enhance output enable feature" to the spi tree In-Reply-To: <20200312133131.26430-3-narmstrong@baylibre.com> Message-Id: X-Patchwork-Hint: ignore Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: meson-spicc: enhance output enable feature has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From a6cda1f905b4a5442eecce94bda1e136f7e1e539 Mon Sep 17 00:00:00 2001 From: Sunny Luo Date: Thu, 12 Mar 2020 14:31:24 +0100 Subject: [PATCH] spi: meson-spicc: enhance output enable feature The SPICC controller in Meson-AXG is capable of driving the CLK/MOSI/SS signal lines through the idle state (between two transmission operation), which avoid the signals floating in unexpected state. Signed-off-by: Neil Armstrong Signed-off-by: Yixun Lan Signed-off-by: Sunny Luo Link: https://lore.kernel.org/r/20200312133131.26430-3-narmstrong@baylibre.com Signed-off-by: Mark Brown --- drivers/spi/spi-meson-spicc.c | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index 8425e5ae1273..ba70ef94a82a 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -9,11 +9,13 @@ #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -113,12 +115,23 @@ #define SPICC_DWADDR 0x24 /* Write Address of DMA */ +#define SPICC_ENH_CTL0 0x38 /* Enhanced Feature */ +#define SPICC_ENH_MOSI_OEN BIT(25) +#define SPICC_ENH_CLK_OEN BIT(26) +#define SPICC_ENH_CS_OEN BIT(27) +#define SPICC_ENH_CLK_CS_DELAY_EN BIT(28) +#define SPICC_ENH_MAIN_CLK_AO BIT(29) + #define writel_bits_relaxed(mask, val, addr) \ writel_relaxed((readl_relaxed(addr) & ~(mask)) | (val), addr) #define SPICC_BURST_MAX 16 #define SPICC_FIFO_HALF 10 +struct meson_spicc_data { + bool has_oen; +}; + struct meson_spicc_device { struct spi_master *master; struct platform_device *pdev; @@ -126,6 +139,7 @@ struct meson_spicc_device { struct clk *core; struct spi_message *message; struct spi_transfer *xfer; + const struct meson_spicc_data *data; u8 *tx_buf; u8 *rx_buf; unsigned int bytes_per_word; @@ -136,6 +150,19 @@ struct meson_spicc_device { bool is_last_burst; }; +static void meson_spicc_oen_enable(struct meson_spicc_device *spicc) +{ + u32 conf; + + if (!spicc->data->has_oen) + return; + + conf = readl_relaxed(spicc->base + SPICC_ENH_CTL0) | + SPICC_ENH_MOSI_OEN | SPICC_ENH_CLK_OEN | SPICC_ENH_CS_OEN; + + writel_relaxed(conf, spicc->base + SPICC_ENH_CTL0); +} + static inline bool meson_spicc_txfull(struct meson_spicc_device *spicc) { return !!FIELD_GET(SPICC_TF, @@ -489,6 +516,13 @@ static int meson_spicc_probe(struct platform_device *pdev) spicc = spi_master_get_devdata(master); spicc->master = master; + spicc->data = of_device_get_match_data(&pdev->dev); + if (!spicc->data) { + dev_err(&pdev->dev, "failed to get match data\n"); + ret = -EINVAL; + goto out_master; + } + spicc->pdev = pdev; platform_set_drvdata(pdev, spicc); @@ -548,6 +582,8 @@ static int meson_spicc_probe(struct platform_device *pdev) else master->max_speed_hz = rate >> 2; + meson_spicc_oen_enable(spicc); + ret = devm_spi_register_master(&pdev->dev, master); if (ret) { dev_err(&pdev->dev, "spi master registration failed\n"); @@ -577,9 +613,22 @@ static int meson_spicc_remove(struct platform_device *pdev) return 0; } +static const struct meson_spicc_data meson_spicc_gx_data = { +}; + +static const struct meson_spicc_data meson_spicc_axg_data = { + .has_oen = true, +}; + static const struct of_device_id meson_spicc_of_match[] = { - { .compatible = "amlogic,meson-gx-spicc", }, - { .compatible = "amlogic,meson-axg-spicc", }, + { + .compatible = "amlogic,meson-gx-spicc", + .data = &meson_spicc_gx_data, + }, + { + .compatible = "amlogic,meson-axg-spicc", + .data = &meson_spicc_axg_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, meson_spicc_of_match); -- 2.20.1