From patchwork Thu Dec 13 08:39:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunny Luo X-Patchwork-Id: 10728197 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 D83506C5 for ; Thu, 13 Dec 2018 08:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C63AE2BADC for ; Thu, 13 Dec 2018 08:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA6582BB07; Thu, 13 Dec 2018 08:42:41 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 6AC912BAF9 for ; Thu, 13 Dec 2018 08:42:41 +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=j1Fe7y2Ip0TV6RfUew5EGasiQfs1wpXZ7gRObbJZtds=; b=Zaza6k1qTNSwpc NZu2NwE5J1DYbiG6f9ZGTGjzILOCeYT4LrPXa7wbzk0cxoSFqfklyWVA0RvzrhQzTYo7utIWIxzYG Na0OHdmPYs832w/8URU2vIa2Xdj461e3WGPHdNyRaZHo0xu4x46yR9sGiLLrTqC3DFIhFZihI58L/ t+5OWdU8YiADNUI0iEkCCvmybEApRUd7uG18dTOtQjWPIWavzUfyQqn+7ErCofcz783C/DWw/66M4 XK8HMHS65dF11YH5DWwVv3VSbfDGWhql8vV3W1C396TSHbDMDLTmTFfuTMXH5AOFTkOsB9qOdXEF4 g1iIEekLukkQkWaX68eA==; 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 1gXMZr-0006aS-Fv; Thu, 13 Dec 2018 08:42:39 +0000 Received: from mail-sz2.amlogic.com ([211.162.65.114]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXMXo-0004Zj-HB; Thu, 13 Dec 2018 08:41:08 +0000 Received: from localhost.localdomain (10.28.8.16) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server id 15.0.1320.4; Thu, 13 Dec 2018 16:40:02 +0800 From: Sunny Luo To: Mark Brown Subject: [PATCH v2 2/3] spi: meson-axg: enhance output enable feature Date: Thu, 13 Dec 2018 16:39:13 +0800 Message-ID: <1544690354-16409-3-git-send-email-sunny.luo@amlogic.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544690354-16409-1-git-send-email-sunny.luo@amlogic.com> References: <1544690354-16409-1-git-send-email-sunny.luo@amlogic.com> MIME-Version: 1.0 X-Originating-IP: [10.28.8.16] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181213_004033_203269_E32C2783 X-CRM114-Status: GOOD ( 11.04 ) 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: Jianxin Pan , Neil Armstrong , Kevin Hilman , Yixun Lan , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Carlo Caione , linux-amlogic@lists.infradead.org, Sunny Luo , Xingyu Chen , Jerome Brunet 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 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: Sunny Luo Signed-off-by: Yixun Lan Reviewed-by: Neil Armstrong --- drivers/spi/spi-meson-spicc.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index b56249d..0384c28 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -115,6 +115,13 @@ #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) @@ -123,6 +130,7 @@ struct meson_spicc_data { unsigned int max_speed_hz; + bool has_oen; }; struct meson_spicc_device { @@ -145,6 +153,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, @@ -453,6 +474,8 @@ static int meson_spicc_prepare_message(struct spi_master *master, writel_bits_relaxed(BIT(24), BIT(24), spicc->base + SPICC_TESTREG); + meson_spicc_oen_enable(spicc); + return 0; } @@ -610,11 +633,12 @@ static int meson_spicc_remove(struct platform_device *pdev) } static const struct meson_spicc_data meson_spicc_gx_data = { - .max_speed_hz = 30000000, + .max_speed_hz = 30000000, }; static const struct meson_spicc_data meson_spicc_axg_data = { - .max_speed_hz = 80000000, + .max_speed_hz = 80000000, + .has_oen = true, }; static const struct of_device_id meson_spicc_of_match[] = {