From patchwork Sat Feb 11 03:54:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: viniciusfre@gmail.com X-Patchwork-Id: 9567831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7D4560572 for ; Sat, 11 Feb 2017 03:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C72AB285C9 for ; Sat, 11 Feb 2017 03:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B863C285E5; Sat, 11 Feb 2017 03:55:03 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6ED57285C9 for ; Sat, 11 Feb 2017 03:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359AbdBKDzC (ORCPT ); Fri, 10 Feb 2017 22:55:02 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:33613 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbdBKDzB (ORCPT ); Fri, 10 Feb 2017 22:55:01 -0500 Received: by mail-qt0-f194.google.com with SMTP id n13so6765396qtc.0 for ; Fri, 10 Feb 2017 19:55:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bWScUh92VSfws13X/5RtaAbJzOL3tui5RdEfkz2XDsk=; b=is46VXqh0963E3Hz57vODUaNy0FsJSJYYRO2om9jyJXnxN9+HWk+KtBQM7biwpaFLu KOh/pUAGoeGW1AGszh5/L7BXPsTW/A7SEGiRfUdWA3TtwBjKq36XIDDQfEyobzpMVc8B QnOCmUl56B4ficsGN+TNScX6Ny6dp2niuAxyQaqzmurIIEte5zmSdiFFsJSjGvffQeKi vkK5k6XYk+LJTbAnAz5q8u8L5fq3NpAopjViCeqD1pZlmBcYXuVBFe/50oG481nykvlF lQXY9IChoBdfZa5Uc9lrB77SsY/Nkz6rBpr0BCcuJAMfFGJgYGzCp9o9X7GcUjmQlDRi I21Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bWScUh92VSfws13X/5RtaAbJzOL3tui5RdEfkz2XDsk=; b=jNbdM9nHaC2b7JQACqJGl5Wmrh52MW8hvPKADj8G1gNSt9+9lM+yMvm0KM7R34se8A l4fDQQEKqjlg09qLoEeSSqbG/1JvOQ9WnuZSssrCXrMSZx5BVE1z3wrTE1ADnGwmBh3Y 9EgmUk3nx9zyMh81NRwqZhoPWap+kKIMna3mweLbBu9oxG/Dn3A1tVlsQLGRT7lx6YPv 8nH4llu7CMSE+RwqmFf57DPiuFywOqwdlJY7CC5CI0/S68R3DzdBjYsk6UQNkemKB/Zg XH/h3EM5avihuxMfRLIT+C8whyHWqJGyrp1AZXWErI5jeiWVg78pSAl2dBhwMJSNNSRn AwNA== X-Gm-Message-State: AMke39nZOm99/k+nFjMCgL7M4/e4wzI9Zn0R/ot/71esN5kUAnGzKu3+/bJ3tHw4NNb7mw== X-Received: by 10.200.54.182 with SMTP id a51mr12156610qtc.221.1486785300799; Fri, 10 Feb 2017 19:55:00 -0800 (PST) Received: from debianpc.localdomain (177.206.175.250.dynamic.adsl.gvt.net.br. [177.206.175.250]) by smtp.googlemail.com with ESMTPSA id w138sm3008904qka.27.2017.02.10.19.54.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 19:55:00 -0800 (PST) From: Vinicius Maciel To: linux-sunxi@googlegroups.com Cc: broonie@kernel.org, maxime.ripard@free-electrons.com, wens@csie.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, siarhei.siamashka@gmail.com, Vinicius Maciel Subject: [PATCH v2] ARM: spi/sun7i: Add Master Sample Data Mode for SPI Date: Sat, 11 Feb 2017 00:54:47 -0300 Message-Id: <20170211035447.3819-1-viniciusfre@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to work appropriately, the max11043 ADC chip and probably others, needs SPI master samples the data at the correct edge. From max11043 datasheet: "The data at DIN is latched on the rising edge of SCLK". Same to DOUT. This patch add Master Sample Data Mode bit in normal sample mode. It will affect only A20. Signed-off-by: Vinicius Maciel Reviewed-by: Siarhei Siamashka Acked-by: Maxime Ripard --- drivers/spi/spi-sun4i.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index c5cd635c28f3..6325be2ce8d9 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -44,6 +44,7 @@ #define SUN4I_CTL_CS_MANUAL BIT(16) #define SUN4I_CTL_CS_LEVEL BIT(17) #define SUN4I_CTL_TP BIT(18) +#define SUN4I_CTL_SDM BIT(20) #define SUN4I_INT_CTL_REG 0x0c #define SUN4I_INT_CTL_RF_F34 BIT(4) @@ -407,7 +408,8 @@ static int sun4i_spi_runtime_resume(struct device *dev) } sun4i_spi_write(sspi, SUN4I_CTL_REG, - SUN4I_CTL_ENABLE | SUN4I_CTL_MASTER | SUN4I_CTL_TP); + SUN4I_CTL_ENABLE | SUN4I_CTL_MASTER | SUN4I_CTL_TP | + SUN4I_CTL_SDM); return 0;