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: 9567833 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 D00F460572 for ; Sat, 11 Feb 2017 03:55:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB9E285B6 for ; Sat, 11 Feb 2017 03:55:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF456285E5; Sat, 11 Feb 2017 03:55:32 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 47B35285B6 for ; Sat, 11 Feb 2017 03:55:31 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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:In-Reply-To: References:List-Owner; bh=uYLqOxcBb5xx54Beq+WR1OkBVgC0T2nzgSA3mJFmZyo=; b=ugY pvim445A6Auf2lHcxUb7XyK+YC3uT5umGzuFVlw8zB6gG5gTktkJkqeaAwlfQ5ujmy/yYWi0QONxA asiRrxwBReXKIE/hsg3ygQ2CHajsEi+ebW+xkM/27i1e+/3mgYQ9o54j7sTUu0eFFH7D37k/Otq96 i7udPL+K2n4k43AWtDGgPipOgP1+sKyRLkTuK+2NiRc8mMzTlsOYNEH0H3dk9IW2IpqOs3E4a1Zfc vfLuKZexbxE1oFfAps/bLtJ0vbBT7wxCQnov3w47mYVr4l5t+q9VNAGNREp4nHq/P/DQa25lxd/TY aLyBRAgoyyqxbsJQoPzi9LrVU3IURFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ccOmW-0004Os-Go; Sat, 11 Feb 2017 03:55:28 +0000 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ccOmR-0003Cp-4k for linux-arm-kernel@lists.infradead.org; Sat, 11 Feb 2017 03:55:26 +0000 Received: by mail-qt0-x242.google.com with SMTP id w20so6700475qtb.1 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=XcZtmXPzvbwd93i3MINERqC37uL1RrHUCx9JzRGWTkQ/bpBRVxJkuZyBnOPBiEtkXA g/1AlhwZEZu8137MCy6sMrhXAgDS+t+PXYrztjiCZ/1eywd0hqQMtTklACnjroZpVYcW 6qIfN6RR0MpbXbVu4GH0hEfmFwN+U7SijtmkxPHs1EoRfQRrFW2zQG9UdhebkVgoMTYU qJXIj71f9F4dAA+joKK6MEYDB04eABhIbGNtjAO/KNxn/VC9RJKByZ8Z/rILGycoUolS TpgLKH9KlW3ylbZC4MHgLzDr2FCTgVWo++umTgtLj1cF3+GCjraY1hqfU/uR1+MGSZrl Po7Q== X-Gm-Message-State: AMke39kYlJ3mKqma+Rc2nd1JKUilD9MvaqgahVZdGomRAJLDKONsdo8KLWrH9bVYimDj2Q== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170210_195523_294076_9E48D307 X-CRM114-Status: UNSURE ( 9.86 ) X-CRM114-Notice: Please train this message. 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: siarhei.siamashka@gmail.com, Vinicius Maciel , linux-spi@vger.kernel.org, wens@csie.org, broonie@kernel.org, maxime.ripard@free-electrons.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 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;