Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp592399imu; Thu, 13 Dec 2018 00:41:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/V3Oq1nIyMD+i3TWncrMLRkPTgS85qIkCZ4sqs9Hn+WFb8yv5eBzaF1ZG9719VfqjQBsvYs X-Received: by 2002:a63:d818:: with SMTP id b24mr20665221pgh.174.1544690477094; Thu, 13 Dec 2018 00:41:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544690477; cv=none; d=google.com; s=arc-20160816; b=lBHziZndE/SlyExsMZql5c8+UfUBR1ixUH2l4dFeGt0lmqLF4iHxfHsjX5CKiCmnr5 +w0xHjPyhdrVb21ODhHKmn0LJvChA55Q/EwW/otD8aMsqUMtXzv10wIsRPY1C7g5aAeA WFoxu+DORPHlm6iAzXaZA2Sknb/Eea54Yc73QEX9jrWyfFRZ9rqyNyDI66IXUZ6auvi+ ligoHLqMX6cERwM/6LRpzt/TjwSgYJY4tsLOtOnwsaJg33qKNhXnSgshybNEg9jvDrzU /SEzfFzsRrH+SaE1VPgzybDag6BHHAqWZHEX6++tvWSljRWQuNClefHOLkg4+x6mnYrR Rj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=IDNGtvGBE592gdd3GTjhEiPftEDYggNCNxq4uFs4S3w=; b=XQ6y08br14Sw2b7tTU3r1O/4Sxliazub1gjFzf5wlAHlQY97uoLU1Gi5cJDGPcXZRv jiKLzN+pLlpr1RTWWso+Brp9FB/iutgjHRqhpyKl5N14OPDf31kbVyGPepzhhRvntPFw a0xaRYQ4MmJcL2joOfRN8JuMBpfeoRzHRvy2FMIBlAU/MDueT1ECk/Ms/0gTThE/s6BJ B6FtMSfi7kJ3RjnrzW9VIlFYTAzlvGhkLCRV842IZV4fDXtdIuAiSXkn5G2tjaXyfnTe q/dt2hXiVvcWaRyvzOS5e2rlg0PPcX1tgRBMqxiXJfNAaal2lTZV6emrYmJBUCjvxLJa pMBQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si1047127plo.108.2018.12.13.00.41.02; Thu, 13 Dec 2018 00:41:17 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbeLMIjp (ORCPT + 99 others); Thu, 13 Dec 2018 03:39:45 -0500 Received: from mail-sz2.amlogic.com ([211.162.65.114]:52978 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbeLMIjn (ORCPT ); Thu, 13 Dec 2018 03:39:43 -0500 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 CC: Sunny Luo , Yixun Lan , "Neil Armstrong" , Jerome Brunet , Kevin Hilman , Carlo Caione , "Jianxin Pan" , Xingyu Chen , , , , 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 Content-Type: text/plain X-Originating-IP: [10.28.8.16] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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[] = { -- 2.7.4