Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp362644imu; Fri, 25 Jan 2019 03:45:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN4WAJDQT3/Sl+EYUssWxkAK99ch8dt78rIYPfzJPA+Gv9Xn6Ktw4/OE1qUBXpU+00f89xCv X-Received: by 2002:a17:902:47aa:: with SMTP id r39mr10531389pld.219.1548416704612; Fri, 25 Jan 2019 03:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548416704; cv=none; d=google.com; s=arc-20160816; b=a86CiIuIisSipCg4u9X1/+wJrYlVUetWBDZMT0wJXayuk0mzFft+ijbpJtbmw8QqTe Oq5RvSvmXG4xfpWG271ERJKOpmsb6V24Gq+dK1/+QKCxL/K57j+GIERcdnGm7ADq0/Xa /mqmIz9sCCOcAW3khpMBvJ+jXvxsV/KypCQkCG93UvIe202xPleE9atg0pmAgw2DoWdY ymAn4oWy/+bwU3egqp0jrkGkF/x4tz6hIJ2EnVkco7LZwDxdOi4EpxH25jtbm06pGcpV w0mrywVqBHKgD5a7pNwZRjUqmy7XO7vmROhpV1hVRL/AECHYyuDGlVsJ7uq2RapEi7rC p2lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Uu+GXREpN4UO7hWlKWeYJkb2H2GuTbzfegM7LkbZ/S8=; b=tOJDCWShtpVtbhlGhGOtW6Dm2QqO51U9YuAq2346eLJDQZlnFaxY8gWO/e/L80lWSC t5W+pjZhVuiIs3cpWjgSwce8mknBdhaAFKYws6n3inaGG2D2HjoJOBJkT8DFpoOwpd8k YQcskN756v1lqxoBywvvAWnMNT3fG6NHxa6HdBetB/vAirHYwv963qAz58U8NgLnB0Qi s2NbY5Q6qvUO7yF75Aupqtt5DiMhuTm13dpKn7EY7zCLjbBx4hnusQ3l1BRsTRfIikWR un14Sv7jlVgX0r39OslhahXNsc/PhrUrpmhjBfXXC01CSBz9hMe3++lqnQTDizvimEZJ HIjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=GEUhvkW0; 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 h31si24451084pgl.482.2019.01.25.03.44.49; Fri, 25 Jan 2019 03:45:04 -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; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b=GEUhvkW0; 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 S1728255AbfAYLok (ORCPT + 99 others); Fri, 25 Jan 2019 06:44:40 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38095 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727959AbfAYLoh (ORCPT ); Fri, 25 Jan 2019 06:44:37 -0500 Received: by mail-lj1-f196.google.com with SMTP id c19-v6so8114427lja.5 for ; Fri, 25 Jan 2019 03:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=norrbonn-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uu+GXREpN4UO7hWlKWeYJkb2H2GuTbzfegM7LkbZ/S8=; b=GEUhvkW0Aw6GHc3vSCXnmV8GTX+YAf3myHFSu3fzEAnbXvX5jP4hXHpfVi7RFjWnja elrrK7YvfIRcN9CgC/dZF3gn1rPhSfenaHc44zUrV1dK5Gl2X73Qp2C4YRSEWiyrJXYl ZErLRdaCPITbBF5zegxKL9TEv1aW3ySw7OiCPhQKLLJPLuw3ncrhK3VapBNZABn2IFKZ VEWtlB1mF61toNnCH8oEtzitthO/MpcHWX5gIyJyfqcLOEZpkLTVqrrrgL4rjQe962m8 /VKS6rDm++8Wdg1694dCdU/BOaExp+AHisTiVIFzbC8BBmVLmh0fD8k/4qNxrb2NNgeQ 3RIw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uu+GXREpN4UO7hWlKWeYJkb2H2GuTbzfegM7LkbZ/S8=; b=I3k8eBWspx6N3pEviwboi4uyqj1OCB879+v50OwETz1YCRgVu44pjaT+10eSEc5XvL XmQ3gXJ/RFMYhuNE59AnVBC/U7gS3M7gmdMb4kBlK6hK5qZqeDHvMK5h3WtBOrL6IaPR 6/fg32Gfhzb6ktw6Y8WhSdbIwnc2RNtnuGoEnkzFagRi2Wxr/03xLGIkyvHQ0MURSaxx Tt4ZBs9MNOKQwpHVXZ6o3SE3KCVLL0763GEBhKiSpgJZGtt3lSwPPyBpsvQo4FG3wgNm MP/KN5z1qCVc7l881XVyQboLkAMjvx+WreCdBbF64Q/ztCJEVy3q4Cnw7e7t5HKQ1XMU ARUQ== X-Gm-Message-State: AJcUukfzVSCqLVU9OsSmPjAwn2WHhR6DSBf2knTj8AzvM2nxGFqc4u8u EkkCgSqdJxJquXe+nR0UKUL0m1ClKNk= X-Received: by 2002:a2e:4a19:: with SMTP id x25-v6mr7678933lja.19.1548416674512; Fri, 25 Jan 2019 03:44:34 -0800 (PST) Received: from mimer.lan (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id l3-v6sm1490962ljg.21.2019.01.25.03.44.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jan 2019 03:44:34 -0800 (PST) From: Jonas Bonn To: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Jonas Bonn , Nicolas Ferre , Mark Brown , Alexandre Belloni , Ludovic Desroches , linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] spi-atmel: support inter-word delay Date: Fri, 25 Jan 2019 12:44:29 +0100 Message-Id: <20190125114429.20066-3-jonas@norrbonn.se> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190125114429.20066-1-jonas@norrbonn.se> References: <20190125114429.20066-1-jonas@norrbonn.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the SPI slave requires an inter-word delay, configure the DLYBCT register accordingly. Tested on a SAMA5D2 board (derived from SAMA5D2-Xplained reference board). Signed-off-by: Jonas Bonn CC: Nicolas Ferre CC: Mark Brown CC: Alexandre Belloni CC: Ludovic Desroches CC: linux-spi@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org --- drivers/spi/spi-atmel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 74fddcd3282b..88ff3fef56e9 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1209,13 +1209,14 @@ static int atmel_spi_setup(struct spi_device *spi) csr |= SPI_BIT(CSAAT); /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs. - * - * DLYBCT would add delays between words, slowing down transfers. - * It could potentially be useful to cope with DMA bottlenecks, but - * in those cases it's probably best to just use a lower bitrate. */ csr |= SPI_BF(DLYBS, 0); - csr |= SPI_BF(DLYBCT, 0); + + /* DLYBCT adds delays between words. This is useful for slow devices + * that need a bit of time to setup the next transfer. + */ + csr |= SPI_BF(DLYBCT, + clamp_t(u8, (as->spi_clk/1000000*spi->word_delay)>>5, 1, 255)); /* chipselect must have been muxed as GPIO (e.g. in board setup) */ npcs_pin = (unsigned long)spi->controller_data; -- 2.19.1