From patchwork Fri Feb 10 22:02: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: 9567547 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 2B36860572 for ; Fri, 10 Feb 2017 22:02:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1855E285DB for ; Fri, 10 Feb 2017 22:02:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CF2F285DF; Fri, 10 Feb 2017 22:02:58 +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 AEFA7285DB for ; Fri, 10 Feb 2017 22:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751734AbdBJWC5 (ORCPT ); Fri, 10 Feb 2017 17:02:57 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:33303 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751326AbdBJWC4 (ORCPT ); Fri, 10 Feb 2017 17:02:56 -0500 Received: by mail-qk0-f195.google.com with SMTP id 11so6852689qkl.0 for ; Fri, 10 Feb 2017 14:02:56 -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=C/qqcSrgs9jMnmc9AntWmLX9gHHZb5mOhAKjMEz/vkk=; b=N1Y6zIPo/0DVZNczQI9uId0yHBivFPMYjsrKFenEATcApwDL80u90VDIdCx21R7n82 dJEbCZq5H4SrXlgE+NvYFuG7FGQTqRopUNIsT3FeJ584iNj1eP+7kZpGlh4IYjFNU+4O 9J55t3CI70S5W4BUUJ7KeBkqe5PtVv8ACYlWHwnrgDomEcd33OecUFVwR+hXyii2d7dp uI5BlLI/mtp0TCOGUnG1hWejovqIex+PMhfwauIFTUGDOL8KIDOw5vKLuvtgyiahSc3X PipHJ2q11hX8uXMo5/+86uQwhTL8YERdgG20VfXW9Opghjjl3b8cka8AwXN4quRn9mvN LoXQ== 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=C/qqcSrgs9jMnmc9AntWmLX9gHHZb5mOhAKjMEz/vkk=; b=nxsTmMC71t03eZFO3K3cw4oL9L2EZwcJ7fPm5p7T5cPOnarbYKAp1+kQHrikOMmkIU ev72RK1pHJPFOB0fjcjCQBFW2r1aKrlNUMvmLWS+hqvnosu20Nx05V3y+O3AWejLS/7B urogx0kMbOJHNxKzh4+OwFD0KWQIjP79ChHiGyBEV5bznsKiwvSaUTsyVts0oovApCN+ eos2tm9UWDfzg/c23aw+uusaEVGXihCerF7ukNBs4O8aIU4arpx6ZJxu7KtxkKOpx2h2 ThiXr8vjnPA8rrDK+IjHhjSdafAKdcNjuRT18PoFGIBSlFuoNx+SLG4ynk+sXBra9DCC ZgUg== X-Gm-Message-State: AMke39mrL1IH38me1O3iAZ+dtwQHPvH9pEATZ8nV9Px49P6mR++qj9n1OCOK505GbOE32g== X-Received: by 10.55.138.196 with SMTP id m187mr10729955qkd.214.1486764175578; Fri, 10 Feb 2017 14:02:55 -0800 (PST) Received: from debianpc.localdomain ([177.19.87.68]) by smtp.googlemail.com with ESMTPSA id h124sm2469241qke.40.2017.02.10.14.02.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 14:02:55 -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, Vinicius Maciel Subject: [PATCH] Add Master Sample Data Mode for SPI Date: Fri, 10 Feb 2017 19:02:47 -0300 Message-Id: <20170210220247.8478-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. Signed-off-by: Vinicius Maciel Reviewed-by: Siarhei Siamashka --- 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;