From patchwork Sun Jul 22 21:19:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142522 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5357412ljj; Sun, 22 Jul 2018 14:21:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpejVgijlYFp+NXAQYG5x6pl161rcpx2968dKVSuWgSV0MPO9kgJq4Q9ytclNRYyEAp04Itn X-Received: by 2002:a62:d39b:: with SMTP id z27-v6mr10770594pfk.182.1532294491229; Sun, 22 Jul 2018 14:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294491; cv=none; d=google.com; s=arc-20160816; b=j/c6bxsH4KniN/7UgZ1hj8h479rcUJoxfElrXc7O+6jgsfWiSiZ+sVtSJTCMLEyI5g lxBfAN8EWNaeeQpzkcxlqnqFZfoF0QpcP7L9C+PSu++f49GAYe+ciJglLtB3HxleZ9vL Z5rxsqXSyjqz/kiHJbPIRtudFopz7JRy3OcQjsyh+J9rgJhiewVYbBqDobrGvpdYElDq jwM4/Wh0WCFuSyW/uTEWTZpX+HSaTUCUG7LjxR69gLcEiWkONUcbVAweFKL5tZkuIt8r hyZYTVoaS0uzuzP/9YiZyJ9jShXZFp4BDzcurY2zVsZhjP7HyiCxPhZOO5mdVmbYmtRT ZIQQ== 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 :arc-authentication-results; bh=tJ14O8b8lgo5MYUvJyK3DtoSxEypRmZbg65afojcSOk=; b=VH4QpCqDQrFk0hY6ELbyxjnKtmL0t0HfjkaHuVjx1KTSpqrGjZcyNy0ml02gUUXUZ0 K6IGJi1GqIgEtLJBrWPXlAk4lCUK24RHZajl6Tc0JJiiVc7xJujX0LnzbcU0kriJpXzr h4bhdVkebsMWtWS2wawnYjLJMJ1eQmtgYw/Hmw1e4gbvEbaoIbfOXSxwYveEQ+MSlTOE jtratv8Iseb7Ut98c990iku1fi6P2LfZV/4JRXNHy9Qdkl6WetXvXpvHyn5xEwXie811 qrffSScMfO180nMkvgRpTxosYZijYaSHnIvGZrNoTtMjk6I+oaZFglp2i900XGYs/Exi Whfg== 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 j5-v6si6965209plk.406.2018.07.22.14.21.30; Sun, 22 Jul 2018 14:21:31 -0700 (PDT) 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 S1730707AbeGVWSV (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:38694 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730301AbeGVWSV (ORCPT ); Sun, 22 Jul 2018 18:18:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D23ECAFBB; Sun, 22 Jul 2018 21:20:18 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , James Hartley , Rahul Bedarkar , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH 02/15] MIPS: dts: img: pistachio_marduk: Cleanups Date: Sun, 22 Jul 2018 23:19:57 +0200 Message-Id: <20180722212010.3979-3-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add and remove some white lines for consistency. Signed-off-by: Andreas Färber --- arch/mips/boot/dts/img/pistachio_marduk.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/arch/mips/boot/dts/img/pistachio_marduk.dts b/arch/mips/boot/dts/img/pistachio_marduk.dts index f03f4114e645..29358d1f7027 100644 --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts @@ -51,6 +51,7 @@ leds { compatible = "pwm-leds"; + heartbeat { label = "marduk:red:heartbeat"; pwms = <&pwm 3 300000>; @@ -61,11 +62,13 @@ keys { compatible = "gpio-keys"; + button@1 { label = "Button 1"; linux,code = <0x101>; /* BTN_1 */ gpios = <&gpio3 6 GPIO_ACTIVE_LOW>; }; + button@2 { label = "Button 2"; linux,code = <0x102>; /* BTN_2 */ @@ -92,7 +95,6 @@ compatible = "infineon,slb9645tt"; reg = <0x20>; }; - }; &i2c3 { From patchwork Sun Jul 22 21:19:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142510 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356775ljj; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfwsPJLKlbWLblhkfSe8iErsUu4ZGpC2He6WfDqhEqBlufDj7ri553J++G+ISBWu3uWYArR X-Received: by 2002:a63:7d48:: with SMTP id m8-v6mr9920762pgn.0.1532294433133; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294433; cv=none; d=google.com; s=arc-20160816; b=IXuj8B1/d2ti0LKN48OZsYWys0v+vi+I+uczEhQUHXdGf241UX0BSUkHD6PY1InZMn nU7yvoqtvsz9IbJ+hqasQYvBPdfKEc6Z0WGPdwzQ7FxiI3xNkZXIIdP5V4XnT1Op35gK +PyQOSc7YQdeTAQg4kaVUG8GtpvHOq+dCLumsLAVVijDeVeOdkaYBNpDzBfUdX/pqQze kQHs/MHXZWYxjL4uFjofzJ9hhUT5IhAnXClHAE9eKJ+1m8EffqFctF5O6TbmwXDZnfLF wjxsWJkGKnW0w4axqCNY+GrrD3CltC2BKNVzhmsvTdnSkfEcPCJ2WlREqNr6EEaSBaRW gWng== 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 :arc-authentication-results; bh=ksLS4G7dC8F2SbIpbfnK2JYt1RP+rbwgpL3PwvIkUVs=; b=ZRTTpBAQsVTgeghYZKJpIu0L5vkv0xtBFuyP9tz7m6kMIHqv03j0GirxJnZ1n0eKgW t4YflEoc0Qv1/Tx06qFXsl1IalGMW8y3ImnZ/rACidrib4+AfPuZ1Pya0mcwUyFrV4ZF HMR08juDUWzEF3ED2uLvKUmUwMTHF4uikuRquewNnnNMnWQ0UXgHVDryPSQSrOoQyzOQ UJk6Q3UwAR5HG9XAW1tWFtWsc/Dx5HzsnYA98khdifcqhP6ePjifl9LRemU8OliljAkk mED4rPDtUxrsXuLIrfiUSHEcDcjWtxnONmYaqPdQ7oSuJ77i/sP82Eh9LEljAFVlXaTt 3/wQ== 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 k23-v6si7074765pgl.633.2018.07.22.14.20.32; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) 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 S2387725AbeGVWSW (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:38748 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730377AbeGVWSW (ORCPT ); Sun, 22 Jul 2018 18:18:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CE17AAFC9; Sun, 22 Jul 2018 21:20:19 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ian Pozella , =?utf-8?q?Andreas_F=C3=A4rber?= , James Hartley , Rahul Bedarkar , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH 04/15] MIPS: dts: img: pistachio_marduk: Switch mmc to 1 bit mode Date: Sun, 22 Jul 2018 23:19:59 +0200 Message-Id: <20180722212010.3979-5-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Pozella The mmc block in Pistachio allows 1 to 8 data bits to be used. Marduk uses 4 bits allowing the upper 4 bits to be allocated to the Mikrobus ports. However these bits are still connected internally meaning the mmc block recieves signals on all data lines and seems the internal HW CRC checks get corrupted by this erroneous data. We cannot control what data is sent on these lines because they go to external ports. 1 bit mode does not exhibit the issue hence the safe default is to use this. If a user knows that in their use case they will not use the upper bits then they can set to 4 bit mode in order to improve performance. Also make sure that the upper 4 bits don't get allocated to the mmc driver (the default is to assign all 8 pins) so they can be allocated to other drivers. Allocating all 4 despite setting 1 bit mode as this matches what is there in hardware. Signed-off-by: Ian Pozella Signed-off-by: Andreas Färber --- arch/mips/boot/dts/img/pistachio_marduk.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/arch/mips/boot/dts/img/pistachio_marduk.dts b/arch/mips/boot/dts/img/pistachio_marduk.dts index 29358d1f7027..5557a6ad61c3 100644 --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts @@ -120,6 +120,7 @@ &pin_sdhost_data { drive-strength = <2>; + pins = "mfio17", "mfio18", "mfio19", "mfio20"; }; &pwm { @@ -132,7 +133,7 @@ &sdhost { status = "okay"; - bus-width = <4>; + bus-width = <1>; disable-wp; }; From patchwork Sun Jul 22 21:20:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142520 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5357199ljj; Sun, 22 Jul 2018 14:21:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrdoOnP5dmQblBC20kQIKr2NUQlVC6xZYcku3yjm46Ncholx/xoD4MQzk427AX3o9gco9c X-Received: by 2002:a65:4cc5:: with SMTP id n5-v6mr9724504pgt.451.1532294473323; Sun, 22 Jul 2018 14:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294473; cv=none; d=google.com; s=arc-20160816; b=q7AO6wzWIC4BmX3OhTXykmKlvD6iq0SJ29jvw2l31TLNF6N+Q3K0paF30GVxJESfds rbS4K1mt7o8feiWscMBcGXykQNQbWqsutX7QXuWLI1z5MiAEcEwzxL9+v1XQrq1hXiiv uWj1k5PFzNfsNbWVLOhnU9TAzhnQBHi3X02AsLMtz5YnHpFCrGBZ1lw1rKHrpHjsQ/jL tJL4OKmExhCSzlrnds4ZiNz2cP+aZ5KN01BiGV6lomoPbOGQRuCnxAnRGkskzEBFrQc3 VErcH9O1J82FFVudV9vntB3+MmnYclwV5oHIUzgLKQOPGYEakkoEIVG4nEilRgjju43p azdQ== 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 :arc-authentication-results; bh=hO2ZV4OZwi62DLhUT3SAAxZDscDvJFkWgbvappCx0DY=; b=EtgxKFycHUxdJOC2UuL+gW7AGIWyX9dHon5WKi8Fn0E0DiHwYLOjLvaq7LszfhHX38 mkJm05DG7enL7TrJVARjj5kt2vn/TVaSeDsFAv5Uoln/qjD0LyfHEF4ZW7JaUWfRQw0R Tr9VPE/eBZGYUICZCkhR9d/D2Tr6eoH3W8gR4uOzHi0/aNLJv7KkqoP7gCk8sPFDLoes DFQEvaZb1cOGU2Qp5YkzbY7hcVLCYTSD/NnpoCE/guxhmdnxHB3MI9RNmT7ogy+zDUqy MEMjWoNPfNz3gYvuL6BdrGdGdgE+82TJ3aJcgCQxFxyZ8oKfSH4oreNRzm6V1kc6zdwA VGWQ== 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 82-v6si6838303pfo.229.2018.07.22.14.21.13; Sun, 22 Jul 2018 14:21:13 -0700 (PDT) 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 S2387956AbeGVWTM (ORCPT + 31 others); Sun, 22 Jul 2018 18:19:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:38772 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730715AbeGVWSW (ORCPT ); Sun, 22 Jul 2018 18:18:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3347FAFCA; Sun, 22 Jul 2018 21:20:20 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rahul Bedarkar , James Hartley , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH 05/15] MIPS: dts: img: pistachio_marduk: Enable SPIM0 Date: Sun, 22 Jul 2018 23:20:00 +0200 Message-Id: <20180722212010.3979-6-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SPIM0 supplies SPI pins on the mikroBUS and Raspberry Pi B+ connectors. Signed-off-by: Andreas Färber --- arch/mips/boot/dts/img/pistachio_marduk.dts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.16.4 diff --git a/arch/mips/boot/dts/img/pistachio_marduk.dts b/arch/mips/boot/dts/img/pistachio_marduk.dts index 5557a6ad61c3..d723b68084c9 100644 --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts @@ -123,6 +123,14 @@ pins = "mfio17", "mfio18", "mfio19", "mfio20"; }; +&pin_spim0 { + drive-strength = <2>; +}; + +&pin_spim0_clk { + drive-strength = <2>; +}; + &pwm { status = "okay"; @@ -137,6 +145,21 @@ disable-wp; }; +&spfi0 { + status = "okay"; + + pinctrl-0 = <&spim0_pins>, + <&spim0_cs0_alt_pin>, + <&spim0_cs2_alt_pin>, + <&spim0_cs3_alt_pin>, + <&spim0_cs4_alt_pin>; + pinctrl-names = "default"; + cs-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>, <0>, + <&gpio1 12 GPIO_ACTIVE_HIGH>, + <&gpio1 13 GPIO_ACTIVE_HIGH>, + <&gpio1 14 GPIO_ACTIVE_HIGH>; +}; + &spfi1 { status = "okay"; From patchwork Sun Jul 22 21:20:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142521 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5357294ljj; Sun, 22 Jul 2018 14:21:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFh+GW1Rw+TnvnQBYMVlhq4ZxQhmem3ghMAypPVLVhaio23X4CusUvX41VmzfC+GUuerN+ X-Received: by 2002:a63:b00f:: with SMTP id h15-v6mr9904235pgf.442.1532294480353; Sun, 22 Jul 2018 14:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294480; cv=none; d=google.com; s=arc-20160816; b=hSAViwvtSCmzs91l7zIa5z2Vu6lu3iQyyGgWPax7l9VlnNVGBILJxzhjt2IOW+TSL/ OQ5UZVJxC9vzVlGhq6sEbhSgnPzuWk7Ea70UJpr6xvJXq2185iCFom0w24YoV2QfituP kdicS/hJpNf3Ki2qJGulDgxQ7zqqCfj+eW6gCTv/wuF7rzILq6isY89ZvcugiFiHQ/pA 2iiPw2/xtO2LZyPpWp7QFoMhpIdD+EkPGcNY9uY8lWrpOrMaQ1ZtFSgXFXRXSvF50Pj7 o7MmAIfSytjQ9hJyoHjan+7cqeLKpDlXGZsfeLsTyWvc+RCe5M4Xs6fpWO2yM23UuNH1 ezBA== 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 :arc-authentication-results; bh=JBC7ooE1Bn6wX0S5BYU8sXrwXVGSMGCsSzWhkacnqVc=; b=s0xW2FGvUGN8/LdaWjEfItTzZhM3jlK8U3+hirf61uM8B+LmhUgLCj+1y41N9HqJxI vMbNCu+AbuZFvx+OqaKH93wqngMeiRHx6Yv6iOxkoJymgf0a1EsaYXPbWiCJZjTtrtsm xozLodAV41b4lcB5OFyk3NlUEUNzwU2Ihu9pK3PTCsGb7gHXNypQX1wEMxoRI1xp8xaS dxAgpHKT5j4rK7ptk/v3SZwzr9rV55bLF2Qbqxnv4H++iuHPz8mr8avVtVN6z6kj+ND7 ebvOZMiNA+Kgp3LGOJaHN3mFWJpHd2Mpix3DscrTzCLpXpCVjjlnRhm5w4gskSNzK5Rm pSog== 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 f187-v6si6513518pfg.137.2018.07.22.14.21.20; Sun, 22 Jul 2018 14:21:20 -0700 (PDT) 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 S2387977AbeGVWTS (ORCPT + 31 others); Sun, 22 Jul 2018 18:19:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:38774 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730301AbeGVWSW (ORCPT ); Sun, 22 Jul 2018 18:18:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9F08FAFCB; Sun, 22 Jul 2018 21:20:20 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rahul Bedarkar , James Hartley , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH 06/15] MIPS: dts: img: pistachio_marduk: Add 6Lowpan node Date: Sun, 22 Jul 2018 23:20:01 +0200 Message-Id: <20180722212010.3979-7-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CA8210's clock output is needed for the SPI-UART bridge. Signed-off-by: Andreas Färber --- arch/mips/boot/dts/img/pistachio_marduk.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.16.4 diff --git a/arch/mips/boot/dts/img/pistachio_marduk.dts b/arch/mips/boot/dts/img/pistachio_marduk.dts index d723b68084c9..b0b6b534a41f 100644 --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts @@ -158,6 +158,20 @@ <&gpio1 12 GPIO_ACTIVE_HIGH>, <&gpio1 13 GPIO_ACTIVE_HIGH>, <&gpio1 14 GPIO_ACTIVE_HIGH>; + + ca8210: sixlowpan@4 { + compatible = "cascoda,ca8210"; + reg = <4>; + spi-max-frequency = <3000000>; + spi-cpol; + reset-gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; + irq-gpio = <&gpio2 12 GPIO_ACTIVE_HIGH>; + + extclock-enable; + extclock-freq = <16000000>; + extclock-gpio = <2>; /* spiuart_clk */ + #clock-cells = <0>; + }; }; &spfi1 { From patchwork Sun Jul 22 21:20:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142513 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356783ljj; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZADcL/4iIzfmNfycpgh4YZRh8jj9QtFFwSJun6mCeYvrg1rmEugpOIFPVtWHMZ7iigr+R X-Received: by 2002:a63:2c8e:: with SMTP id s136-v6mr9486553pgs.390.1532294433760; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294433; cv=none; d=google.com; s=arc-20160816; b=qH23bKxueAs39Ag8TZBPgeZJSPHnJTwVXTr3CFaeWJWY2/CFD0yWxpjw/uKh19+Vsq as7QIeMSPQh8tPB5/XGjQvrtHYiGs+FdoOYLRK6VM+qoFO7/byjqlMv1UZsBItTODL7A H8DNkiMqoC2mA3lsB1O61fyMRt8tLd6s29W4gNXZ6zGefu2GVrTqzH70hEcUZy0gETRu OYdTaP9dow86+/nI4aysr7ehqZzV5WMVcGka9U4rGxosoB7p27zKcm4p1rDYap4DsPP5 3tLxdkfZqLxaFlSOepfRR03jkq2BrCDKS7HRvOQCX21dNhQAjhpYZt9WAhfgh1dqI9jd 1Yqg== 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 :arc-authentication-results; bh=OTgwXJwaScYdgKT/SVNHjGbEldebQnlBry7gzj2CgCY=; b=mCwyAtAEnSvoTWUAKwuwuWTwnI3cMGUwjmkEeQ81f9NDGc4U7vcrfLmpyltwnHQA4G +hrAe3sm+RpxZAjAMSdzaBBTvfIti1vz48CX46n+0UDeS9OWc5gH2QOStSomMtI4ZneL vE5R2fR+/5S1bzqARqQGhAm5YUrrlaqlBIEH30vY75ddujxP/+zNxRze63omMds4lo4k 2IeFYR3QayAPAb1+OFtlH++TOZzheMPT/BrZRqI7mdsVFV/46hwoDVTPiP35QtzmK/tw t8txrHlhmAyWPK17AtsUnj3P+IMy3yPItaTcMj4kWFDdgRm3g/tyBeWNy11AdzaJjnxT 0iRQ== 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 k23-v6si7074765pgl.633.2018.07.22.14.20.33; Sun, 22 Jul 2018 14:20:33 -0700 (PDT) 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 S2387792AbeGVWSY (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:38804 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730905AbeGVWSX (ORCPT ); Sun, 22 Jul 2018 18:18:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F762AFCD; Sun, 22 Jul 2018 21:20:21 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= , Rahul Bedarkar , James Hartley , Rob Herring , Mark Rutland , devicetree@vger.kernel.org Subject: [PATCH 08/15] MIPS: dts: img: pistachio_marduk: Add user LEDs Date: Sun, 22 Jul 2018 23:20:03 +0200 Message-Id: <20180722212010.3979-9-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the LEDs that are connected to the SPI UART bridge. Signed-off-by: Andreas Färber --- arch/mips/boot/dts/img/pistachio_marduk.dts | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) -- 2.16.4 diff --git a/arch/mips/boot/dts/img/pistachio_marduk.dts b/arch/mips/boot/dts/img/pistachio_marduk.dts index f682d0a5a3d9..6984933b3cdc 100644 --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts @@ -60,6 +60,52 @@ }; }; + gpio-leds { + compatible = "gpio-leds"; + + led0 { + label = "marduk:red:user0"; + gpios = <&sc16is752 0 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led1 { + label = "marduk:red:user1"; + gpios = <&sc16is752 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led2 { + label = "marduk:red:user2"; + gpios = <&sc16is752 2 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led3 { + label = "marduk:red:user3"; + gpios = <&sc16is752 3 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led4 { + label = "marduk:red:user4"; + gpios = <&sc16is752 4 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led5 { + label = "marduk:red:user5"; + gpios = <&sc16is752 5 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led6 { + label = "marduk:red:user6"; + gpios = <&sc16is752 6 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; + keys { compatible = "gpio-keys"; From patchwork Sun Jul 22 21:20:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142518 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356992ljj; Sun, 22 Jul 2018 14:20:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpffHuPeB6UFJhz8CCLRIcQvxhDZCebut0+ANDl3zJGFjxQTAW98shddZBdSU8Ct/YRJcUjf X-Received: by 2002:a62:5ec3:: with SMTP id s186-v6mr10680427pfb.129.1532294454372; Sun, 22 Jul 2018 14:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294454; cv=none; d=google.com; s=arc-20160816; b=MBgvVg5jLfXeTqpq0M0Qs4I88FLgFbXTqGS2n8TpHJzg3hXHChLVPaIcO+nDVgL9B6 0sP/aflthql+F3ya1jfgHvGCKEnLoddjEy4cus3Cx0T2F/3Ud/ZFNFxgS2FWFoVJ5zDW YBKVwsnJCfyIhEVOHqO4qkKFsAcLP2jOt62ZSe9fTJyqMTma6ucQ6xkCJ4cLRsjIOjRP SfFaTCbY8CmNNZeHkgiYJpmFxcq9jJXhznIGQnfKtpvzezmPY8jH5swCXtm4Kes49x6Y I77sQh3X2T00FT1O1GhIsWzykuRg/WHKElQhNPuIVdPmB+EZ9jzWwjMH8bwYFDLLCOr1 GfOw== 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 :arc-authentication-results; bh=l+D7DaE2CqZ26AYpsTQra/AI+RpmCkOh/xNip0yizVM=; b=t3M9bc7vTz3juCNA8lnaGBPt1JCaDYaDnsEF1FVfv/tn65MzNhmHu/p0YeUCxuNgqj DIdViG5pHTtnQTRo6lGPMoTNnk4kcvzpodQ/HW4kUugXgQjxO9SuXXo6iHRl6DAx1LU0 Z0uUrBbybuE9Zo/Cxt7jYjsuU+D6gSy/JfjsFFwEA8zcNYcLRllyItlEeFgNaE/oWhiJ 3n7SYrFB/8ZCb3DMs7mpXUH692lAwDDoWipoovT8pKB2yLL8TgxXfarwe4WOaFeAEl8n qvsTffJ1QmzjwKtHokRfdgU58tegY+mXODz2VAeSUz+m0hLJsHgbaSJ+R1Q7maa2XohU cpvQ== 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 d2-v6si6672675plh.387.2018.07.22.14.20.54; Sun, 22 Jul 2018 14:20:54 -0700 (PDT) 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 S2387817AbeGVWSZ (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:38830 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387732AbeGVWSY (ORCPT ); Sun, 22 Jul 2018 18:18:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2715DAFCE; Sun, 22 Jul 2018 21:20:22 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Damien Horsley , =?utf-8?q?Andreas_F=C3=A4?= =?utf-8?q?rber?= , Vinod Koul , Dan Williams , dmaengine@vger.kernel.org Subject: [PATCH 09/15] dmaengine: img-mdc: Handle early status read Date: Sun, 22 Jul 2018 23:20:04 +0200 Message-Id: <20180722212010.3979-10-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Damien Horsley It is possible that mdc_tx_status may be called before the first node has been read from memory. In this case, the residue value stored in the register is undefined. Return the transfer size instead. Signed-off-by: Damien Horsley Signed-off-by: Andreas Färber --- drivers/dma/img-mdc-dma.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) -- 2.16.4 diff --git a/drivers/dma/img-mdc-dma.c b/drivers/dma/img-mdc-dma.c index 25cec9c243e1..0f2f0f52d83a 100644 --- a/drivers/dma/img-mdc-dma.c +++ b/drivers/dma/img-mdc-dma.c @@ -621,25 +621,33 @@ static enum dma_status mdc_tx_status(struct dma_chan *chan, (MDC_CMDS_PROCESSED_CMDS_DONE_MASK + 1); /* - * If the command loaded event hasn't been processed yet, then - * the difference above includes an extra command. + * If the first node has not yet been read from memory, + * the residue register value is undefined */ - if (!mdesc->cmd_loaded) - cmds--; - else - cmds += mdesc->list_cmds_done; - - bytes = mdesc->list_xfer_size; - ldesc = mdesc->list; - for (i = 0; i < cmds; i++) { - bytes -= ldesc->xfer_size + 1; - ldesc = ldesc->next_desc; - } - if (ldesc) { - if (residue != MDC_TRANSFER_SIZE_MASK) - bytes -= ldesc->xfer_size - residue; + if (!mdesc->cmd_loaded && !cmds) { + bytes = mdesc->list_xfer_size; + } else { + /* + * If the command loaded event hasn't been processed yet, then + * the difference above includes an extra command. + */ + if (!mdesc->cmd_loaded) + cmds--; else + cmds += mdesc->list_cmds_done; + + bytes = mdesc->list_xfer_size; + ldesc = mdesc->list; + for (i = 0; i < cmds; i++) { bytes -= ldesc->xfer_size + 1; + ldesc = ldesc->next_desc; + } + if (ldesc) { + if (residue != MDC_TRANSFER_SIZE_MASK) + bytes -= ldesc->xfer_size - residue; + else + bytes -= ldesc->xfer_size + 1; + } } } spin_unlock_irqrestore(&mchan->vc.lock, flags); From patchwork Sun Jul 22 21:20:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142519 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5357057ljj; Sun, 22 Jul 2018 14:20:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpddkLByPaREcT8mVK+skK7H2oApn5/97ByTZyOeI6//hmjrrDbPTpC0iqQ7ekwvccaFdTD3 X-Received: by 2002:a17:902:bf06:: with SMTP id bi6-v6mr4513529plb.76.1532294459724; Sun, 22 Jul 2018 14:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294459; cv=none; d=google.com; s=arc-20160816; b=vwvVmVJUs38zvQZ0ZGCgKVhcnFdWa1IrQHJpTwvCXIMHdjTq1GMk9vckKMPZmt2liN Dxi+YKBOaXxT9vsw9/Rbt477yJfuaQXV7fOEC/e4/E5g3/1RTSXRk3Ohf0K4Uq/GS+Pf iFT4zwT+EdpnYO+5pHiSsx1MsfOq2tMEIGy8qTDlvqzSjTYBYO+gL3MZvS3962G7Gmw4 CRp458YcTAUvHGkhT8s8g+H78MREtzihCWAQgJwdlB/pMV6N4JHc8DaxurOSS0Hd6JIA 5AUxwQbX0dZDVpj0Z8ktzHA5e60u9vbKYMKKFZMAyYaWrdgA1//A5hjfhRQUvbI+MyUd z7wQ== 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 :arc-authentication-results; bh=WjXCRBjA4ozX3fD/LY68wCvWmfE3S6YiHrW4ppzo59E=; b=DeWkNYxRg7BYwpmSxdajmLvKWXlFdDnq5mrxdIe8Amyr2oKE+r1hNtWHIZzLswHO6q gNCzBXM22ZNeMZrQH1hlq0CEyzrZpG41604qvP86qttBetZPyZQtY7Y3SN3glgblnel7 83q6tK6fBn0OBrcGJnuU82l7o16QB3iy2hPDbjysGZhDTEr6bE4fpmPb5g1TjWuiB79n LFwL0ulX8FGPApKPAwgtSOplSTwhhTSCYNHVpJ83X9HHgCGKvUe7Otd7qc/HIa5pKT3c KTIyAMF501XiAm3wOIerBZqEHzHyZdVyPsE/61+c251EbhjnZdNgToM1RsYPHwni6yIA 1Rhw== 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 i28-v6si7297259pfi.105.2018.07.22.14.20.59; Sun, 22 Jul 2018 14:20:59 -0700 (PDT) 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 S2387939AbeGVWS6 (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:38772 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387759AbeGVWSY (ORCPT ); Sun, 22 Jul 2018 18:18:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C5254AFD4; Sun, 22 Jul 2018 21:20:22 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ionela Voinescu , =?utf-8?q?Andreas_F=C3=A4rber?= , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 11/15] spi: img-spfi: Set device select bits for SPFI port state Date: Sun, 22 Jul 2018 23:20:06 +0200 Message-Id: <20180722212010.3979-12-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ionela Voinescu Even if the chip select line is not controlled by the SPFI hardware, the device select bits need to be set to specify the chip select line in use for the hardware to know what parameters to use for the current transfer. Signed-off-by: Ionela Voinescu Signed-off-by: Andreas Färber --- drivers/spi/spi-img-spfi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.16.4 diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index c845a505bae6..0d73d31a6a2b 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -438,6 +438,9 @@ static int img_spfi_prepare(struct spi_master *master, struct spi_message *msg) u32 val; val = spfi_readl(spfi, SPFI_PORT_STATE); + val &= ~(SPFI_PORT_STATE_DEV_SEL_MASK << + SPFI_PORT_STATE_DEV_SEL_SHIFT); + val |= msg->spi->chip_select << SPFI_PORT_STATE_DEV_SEL_SHIFT; if (msg->spi->mode & SPI_CPHA) val |= SPFI_PORT_STATE_CK_PHASE(msg->spi->chip_select); else From patchwork Sun Jul 22 21:20:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142512 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356788ljj; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpetm163i+1lWpE63AWWhD8GvE4fyOPTNypf0QQwbRSXKPR6CZLlSZ2NqhoPfYi/anNfLE++ X-Received: by 2002:a62:464f:: with SMTP id t76-v6mr10638188pfa.118.1532294434084; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294434; cv=none; d=google.com; s=arc-20160816; b=YlYqfvvtGhOwwbiyOBhjC2kICw6Faph+xVTAsXTn+Si3/cE5oqmgTSBFTU9x1wcadI 9jXTqn1Uh26YJzcRquLiF5cOt6jxWDw4vLZMMK6Adv0mvh+jFPjPCfR/AbceRmksecQ0 5EVyS668xZUsFHbtmnGw4/HNGHMFa09rm269HoIloZIoaYLs+JTP4DMS4VoqVz2uXSkS /+YhPuDwHKpRl2zbs6gN7JAipBJvb9IjNuWrDocL11WYK3W79CV/9b9ES9t4kCoe5+ak drHUkNB6i65AABjVaXEK97Hu8iIA1RPpD/Tk75D3ea+OSPAaMdJTqZg8Rz87PMXHBwvT FNhQ== 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 :arc-authentication-results; bh=/eg8jGcdsZbnJeUp72CWiotqjlDjvLaI5aUx60mWM+E=; b=TonLKiXadAnALBoCfd38lutxE5dLdGW9YRmZM+N64ZRTUpydW4KZKqeF03KsEIALGw FKWwTTNpk+BjF+hE944u3/8fVDub/dUvWRLUFWVBJGJ9HGOkZDBEXjDqnHAj/GhRT2G7 dbhaHe+zKdcz/fhPXVpy2CaB/MKtBNkzTGRNSCP+N8DIuT5xMbagWF55CnwXmQzmJnTP EfHi/FUqRkxVrc3IZhRbk0jP1D9xmR0qOQLViMH+dCesTgqRCnK2FT7wJtr/dRhsFLN3 TtIEH0EhYVSxJHmFqy0fjwYQTnCnFG4b1wj4aKIkSFh/GIhULb7SM15Kqx6IvQDOW3I+ cgSA== 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 k23-v6si7074765pgl.633.2018.07.22.14.20.33; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) 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 S2387841AbeGVWSZ (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:38792 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387772AbeGVWSZ (ORCPT ); Sun, 22 Jul 2018 18:18:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 301FBAFD5; Sun, 22 Jul 2018 21:20:23 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ionela Voinescu , =?utf-8?q?Andreas_F=C3=A4rber?= , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 12/15] spi: img-spfi: Use device 0 configuration for all devices Date: Sun, 22 Jul 2018 23:20:07 +0200 Message-Id: <20180722212010.3979-13-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ionela Voinescu Given that we control the chip select line externally, we can use only one parameter register (device 0 parameter register) and one set of configuration bits (port configuration bits for device 0) for all devices (all chip select lines). Signed-off-by: Ionela Voinescu Signed-off-by: Andreas Färber --- drivers/spi/spi-img-spfi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) -- 2.16.4 diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 0d73d31a6a2b..231b59c1ab60 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -437,18 +437,23 @@ static int img_spfi_prepare(struct spi_master *master, struct spi_message *msg) struct img_spfi *spfi = spi_master_get_devdata(master); u32 val; + /* + * The chip select line is controlled externally so + * we can use the CS0 configuration for all devices + */ val = spfi_readl(spfi, SPFI_PORT_STATE); + + /* 0 for device selection */ val &= ~(SPFI_PORT_STATE_DEV_SEL_MASK << SPFI_PORT_STATE_DEV_SEL_SHIFT); - val |= msg->spi->chip_select << SPFI_PORT_STATE_DEV_SEL_SHIFT; if (msg->spi->mode & SPI_CPHA) - val |= SPFI_PORT_STATE_CK_PHASE(msg->spi->chip_select); + val |= SPFI_PORT_STATE_CK_PHASE(0); else - val &= ~SPFI_PORT_STATE_CK_PHASE(msg->spi->chip_select); + val &= ~SPFI_PORT_STATE_CK_PHASE(0); if (msg->spi->mode & SPI_CPOL) - val |= SPFI_PORT_STATE_CK_POL(msg->spi->chip_select); + val |= SPFI_PORT_STATE_CK_POL(0); else - val &= ~SPFI_PORT_STATE_CK_POL(msg->spi->chip_select); + val &= ~SPFI_PORT_STATE_CK_POL(0); spfi_writel(spfi, val, SPFI_PORT_STATE); return 0; @@ -548,11 +553,15 @@ static void img_spfi_config(struct spi_master *master, struct spi_device *spi, div = DIV_ROUND_UP(clk_get_rate(spfi->spfi_clk), xfer->speed_hz); div = clamp(512 / (1 << get_count_order(div)), 1, 128); - val = spfi_readl(spfi, SPFI_DEVICE_PARAMETER(spi->chip_select)); + /* + * The chip select line is controlled externally so + * we can use the CS0 parameters for all devices + */ + val = spfi_readl(spfi, SPFI_DEVICE_PARAMETER(0)); val &= ~(SPFI_DEVICE_PARAMETER_BITCLK_MASK << SPFI_DEVICE_PARAMETER_BITCLK_SHIFT); val |= div << SPFI_DEVICE_PARAMETER_BITCLK_SHIFT; - spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(spi->chip_select)); + spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(0)); if (!list_is_last(&xfer->transfer_list, &master->cur_msg->transfers) && /* From patchwork Sun Jul 22 21:20:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142514 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356794ljj; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdDo/s47XJCxi7jMRt4tAT5iqFwm5ch1gwRezHWfXdrhdSr2ksuO4bIpPnBGpvbH02KYr4v X-Received: by 2002:a63:1c13:: with SMTP id c19-v6mr9826803pgc.332.1532294434404; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294434; cv=none; d=google.com; s=arc-20160816; b=iCriA1HmbIujKZUwlYceW7jGVVv2vrA5vHFB0Kjm0XwYnkTU5etdFfVvj4GMBBAbzc 6bM6f4m4Kka2DvXH+MWiB1G9SgeFCEWmoToIn/392cmRyyG6dPxza5H2fUFL2OzQWl0c hH6LjA23OUs7nbzrI7PwBYWpp+RW2lLHKnDlXzQIhSWQ6MedpDAxVehvljRFi0hGdwv9 RBsZhppp+Tg8T0x7rqPbkagBsoLbYIOrINfyJeT3Nj+fXOOpYcI9qePb5DwUUzAYQLg/ rzYTQJnTdER0mJ36MIU0GsbfhOrwXAdm9MoLTH+RecYjKnSgjlBiZUCHZy79OWgLE/ZU Vl3w== 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 :arc-authentication-results; bh=lWb+Ji1RVyMn0O+37665Pw9e07fK6MV0NWV2k2KQucI=; b=Yw+oKkg4MhwcmUmq77RllcW3qIhnSblN0BaMNW85+AoUBWrAO3op+P9PEvXv+hLw25 dSxoJW7bYhjVT2Qvv0MWlCKGCKYFRNF6zTQ1GqmOEW6V8RjcDdHbGiz6kFxTJb5FPfX4 Gx1Y9GReIGn7Itq/TRbxml7Pfbc6IMacFbjIGopd/5Zk2KqWRJX6A6EX+R1NnXhAx01i GYpQ/V/sBrtSIOPILzabiBr8pkxtUrkzxjP0lLEd/wU3bhnNCzKRgZkmoCv4DQD4jjTI 3Bo3W6wRe9BfmUCO4nS4gvw3ZVIVyOt0VWM6ogg+bgUhH3XB+MFk1UvXf+nRx3WvjgPA VgCQ== 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 k23-v6si7074765pgl.633.2018.07.22.14.20.34; Sun, 22 Jul 2018 14:20:34 -0700 (PDT) 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 S2387864AbeGVWS0 (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:38804 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387794AbeGVWSZ (ORCPT ); Sun, 22 Jul 2018 18:18:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 91399AFD6; Sun, 22 Jul 2018 21:20:23 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ionela Voinescu , =?utf-8?q?Andreas_F=C3=A4rber?= , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 13/15] spi: img-spfi: RX maximum burst size for DMA is 8 Date: Sun, 22 Jul 2018 23:20:08 +0200 Message-Id: <20180722212010.3979-14-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ionela Voinescu The depth of the FIFOs is 16 bytes. The DMA request line is tied to the half full/empty (depending on the use of the TX or RX FIFO) threshold. For the TX FIFO, if you set a burst size of 8 (equal to half the depth) the first burst goes into FIFO without any issues, but due the latency involved (the time the data leaves the DMA engine to the time it arrives at the FIFO), the DMA might trigger another burst of 8. But given that there is no space for 2 additonal bursts of 8, this would result in a failure. Therefore, we have to keep the burst size for TX to 4 to accomodate for an extra burst. For the read (RX) scenario, the DMA request line goes high when there is at least 8 entries in the FIFO (half full), and we can program the burst size to be 8 because the risk of accidental burst does not exist. The DMA engine will not trigger another read until the read data for all the burst it has sent out has been received. While here, move the burst size setting outside of the if/else branches as they have the same value for both 8 and 32 bit data widths. Signed-off-by: Ionela Voinescu Signed-off-by: Andreas Färber --- drivers/spi/spi-img-spfi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.16.4 diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 231b59c1ab60..8ad6c75d0af5 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -346,12 +346,11 @@ static int img_spfi_start_dma(struct spi_master *master, if (xfer->len % 4 == 0) { rxconf.src_addr = spfi->phys + SPFI_RX_32BIT_VALID_DATA; rxconf.src_addr_width = 4; - rxconf.src_maxburst = 4; } else { rxconf.src_addr = spfi->phys + SPFI_RX_8BIT_VALID_DATA; rxconf.src_addr_width = 1; - rxconf.src_maxburst = 4; } + rxconf.src_maxburst = 8; dmaengine_slave_config(spfi->rx_ch, &rxconf); rxdesc = dmaengine_prep_slave_sg(spfi->rx_ch, xfer->rx_sg.sgl, @@ -370,12 +369,11 @@ static int img_spfi_start_dma(struct spi_master *master, if (xfer->len % 4 == 0) { txconf.dst_addr = spfi->phys + SPFI_TX_32BIT_VALID_DATA; txconf.dst_addr_width = 4; - txconf.dst_maxburst = 4; } else { txconf.dst_addr = spfi->phys + SPFI_TX_8BIT_VALID_DATA; txconf.dst_addr_width = 1; - txconf.dst_maxburst = 4; } + txconf.dst_maxburst = 4; dmaengine_slave_config(spfi->tx_ch, &txconf); txdesc = dmaengine_prep_slave_sg(spfi->tx_ch, xfer->tx_sg.sgl, From patchwork Sun Jul 22 21:20:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142516 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356812ljj; Sun, 22 Jul 2018 14:20:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfeU7Iqvtmnn4het6Wr8B3nqiEhscPOis2/mOvi8JJ5oiXtaXbIYq4WTcalF8FRruNOqMbM X-Received: by 2002:a17:902:bd44:: with SMTP id b4-v6mr10462244plx.144.1532294435664; Sun, 22 Jul 2018 14:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294435; cv=none; d=google.com; s=arc-20160816; b=PKAJRLCVOY5pZc/4kWHhmvUIdwDFmOb/JZyKYwkTpHxEUIid2iemj3Hir+eb0ZkKWL xEeQQTfu+S9MtofckZUkeKHfG3P3SafnC4agDHgp9JKhxrq+xBlHpd9meNNx6TrLJjKB ChSmLnMPIT5MfjlG5fn7Ul3GESy6NkxgGCpki62QxGNWYfMrIlnr/uP/h994c50gX8UV iKEDjEkkEFjyNuJnqM1p0TSf13fxQMPM8+glbwN6q88VBSwVCnUMiWO4zSEKz1SA23Zh vzB6KWXELwaJVgKiwEHvqAnPKkesnLKKyB6LMV4B64A/eYdI7SzOndh6ZoB31uPsRH4o 52ew== 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 :arc-authentication-results; bh=pRNjCloX34FJypPfhznajCFlLsFlSMebc/RSMW2RPMg=; b=Ff99VRy08ybGMJ2LRZSwXAXln6J2MMDS25GwNu3CMDYkuYpg9dsmUYso/FdoqbD6yY Hsbo+DIKqf5Bk/Fz2zebfMJ+FJxFRCIDqGwuYn1Ol4Nr2JVLZL4uv18TcqMzlhbpTF49 mSH43BKnTGrbGspW2n/uXwDOx8nKQqolT95I7B+aYcQpdRU/hrGWppq4/XyaFV5oE70z fVlnRhD7gA/6xWs9X0MpCFO7GYpTRTARhCvA6J87zj4NPePKFv595zyfNFFvmEfhUWnx 1tbkv9LRw5SB9f1KPgGCB+t7tNzMKZr/1jO3SH39+8JrCmRMe/K5pFgikhyj5oOFMBj8 VrTA== 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 k23-v6si7074765pgl.633.2018.07.22.14.20.35; Sun, 22 Jul 2018 14:20:35 -0700 (PDT) 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 S2387920AbeGVWSd (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:38830 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387797AbeGVWS0 (ORCPT ); Sun, 22 Jul 2018 18:18:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 02F20AFE1; Sun, 22 Jul 2018 21:20:24 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Ionela Voinescu , =?utf-8?q?Andreas_F=C3=A4rber?= , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 14/15] spi: img-spfi: Finish every transfer cleanly Date: Sun, 22 Jul 2018 23:20:09 +0200 Message-Id: <20180722212010.3979-15-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ionela Voinescu Before this change, the interrupt status bit that signaled the end of a transfer was cleared in the wait_all_done function. That functionality triggered issues for DMA duplex transactions where the wait function was called twice, in both the TX and RX callbacks. In order to fix the issue, clear all interrupt data bits at the end of a PIO transfer or at the end of both TX and RX duplex transfers, if the transfer is not a pending transfer (command waiting for data). After that, the status register is checked for new incoming data or new data requests to be signaled. If SPFI finished cleanly, no new interrupt data bits should be set. Signed-off-by: Ionela Voinescu Signed-off-by: Andreas Färber --- drivers/spi/spi-img-spfi.c | 49 +++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 14 deletions(-) -- 2.16.4 diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 8ad6c75d0af5..a1244234daa5 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -83,6 +83,14 @@ #define SPFI_INTERRUPT_SDE BIT(1) #define SPFI_INTERRUPT_SDTRIG BIT(0) +#define SPFI_INTERRUPT_DATA_BITS (SPFI_INTERRUPT_SDHF |\ + SPFI_INTERRUPT_SDFUL |\ + SPFI_INTERRUPT_GDEX32BIT |\ + SPFI_INTERRUPT_GDHF |\ + SPFI_INTERRUPT_GDFUL |\ + SPFI_INTERRUPT_ALLDONETRIG |\ + SPFI_INTERRUPT_GDEX8BIT) + /* * There are four parallel FIFOs of 16 bytes each. The word buffer * (*_32BIT_VALID_DATA) accesses all four FIFOs at once, resulting in an @@ -144,6 +152,23 @@ static inline void spfi_reset(struct img_spfi *spfi) spfi_writel(spfi, 0, SPFI_CONTROL); } +static inline void spfi_finish(struct img_spfi *spfi) +{ + if (!(spfi->complete)) + return; + + /* Clear data bits as all transfers(TX and RX) have finished */ + spfi_writel(spfi, SPFI_INTERRUPT_DATA_BITS, SPFI_INTERRUPT_CLEAR); + if (spfi_readl(spfi, SPFI_INTERRUPT_STATUS) & SPFI_INTERRUPT_DATA_BITS) { + dev_err(spfi->dev, "SPFI did not finish transfer cleanly.\n"); + spfi_reset(spfi); + } + /* Disable SPFI for it not to interfere with pending transactions */ + spfi_writel(spfi, + spfi_readl(spfi, SPFI_CONTROL) & ~SPFI_CONTROL_SPFI_EN, + SPFI_CONTROL); +} + static int spfi_wait_all_done(struct img_spfi *spfi) { unsigned long timeout = jiffies + msecs_to_jiffies(50); @@ -152,19 +177,9 @@ static int spfi_wait_all_done(struct img_spfi *spfi) return 0; while (time_before(jiffies, timeout)) { - u32 status = spfi_readl(spfi, SPFI_INTERRUPT_STATUS); - - if (status & SPFI_INTERRUPT_ALLDONETRIG) { - spfi_writel(spfi, SPFI_INTERRUPT_ALLDONETRIG, - SPFI_INTERRUPT_CLEAR); - /* - * Disable SPFI for it not to interfere with - * pending transactions - */ - spfi_writel(spfi, spfi_readl(spfi, SPFI_CONTROL) - & ~SPFI_CONTROL_SPFI_EN, SPFI_CONTROL); + if (spfi_readl(spfi, SPFI_INTERRUPT_STATUS) & + SPFI_INTERRUPT_ALLDONETRIG) return 0; - } cpu_relax(); } @@ -296,6 +311,8 @@ static int img_spfi_start_pio(struct spi_master *master, } ret = spfi_wait_all_done(spfi); + spfi_finish(spfi); + if (ret < 0) return ret; @@ -311,8 +328,10 @@ static void img_spfi_dma_rx_cb(void *data) spin_lock_irqsave(&spfi->lock, flags); spfi->rx_dma_busy = false; - if (!spfi->tx_dma_busy) + if (!spfi->tx_dma_busy) { + spfi_finish(spfi); spi_finalize_current_transfer(spfi->master); + } spin_unlock_irqrestore(&spfi->lock, flags); } @@ -325,8 +344,10 @@ static void img_spfi_dma_tx_cb(void *data) spin_lock_irqsave(&spfi->lock, flags); spfi->tx_dma_busy = false; - if (!spfi->rx_dma_busy) + if (!spfi->rx_dma_busy) { + spfi_finish(spfi); spi_finalize_current_transfer(spfi->master); + } spin_unlock_irqrestore(&spfi->lock, flags); } From patchwork Sun Jul 22 21:20:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 142517 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5356878ljj; Sun, 22 Jul 2018 14:20:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZZZg0ZdM71v06K/Hb4uqySrAjI0mQCPu1p2w5caAohcSHSKZabztdDFBzXtZaUoqr/ECn X-Received: by 2002:a63:b504:: with SMTP id y4-v6mr9921857pge.247.1532294441779; Sun, 22 Jul 2018 14:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532294441; cv=none; d=google.com; s=arc-20160816; b=yG62AH6N91o26yFEvc8BcJsD/wLYa2JJogMA376hsVQ6oZnJEUJYKS7moWa2QK9nz6 QH+LQZoWyCAV7iKz0ZHFy6Tgk1EPnqE+2aJ3ka/E4NkjX40Fid84iBvzEWQPOzKl3b41 7e44tbterTsG/KV7bTocjpH9EBGnuFZlX0/RuMzx5IBw9HjUjKITMrAnuooWrpEv9sT9 ILCfJZ9QUzE7bXVUaxanOA5NvRpH+l3wQNll5Y1p+DD7ev3AZbHyF+VE/QkdGkhsf6th aJTDOAbDyrvkBAIMVeV30UtFEVn/VAKLkUNS6L52kz3K7Xf5w2X9g0YOcSHNEjkQjEs3 UHhw== 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 :arc-authentication-results; bh=5OpyOkKUeeXfR4BVwdSRyBOd9RMKrnbouXvvMBlTbGE=; b=p4Jvxfc3BKybndiTsrraUNAKZmLglv/I+/lG2I2WKiwrCdCgE750ROso682X/lQSDI QEekyUpzXGppCQZ/48yrQIUh2ecKT/OytnpWFn2hP6XSOaNMm23Z2+ZrXrBjfXZ4dfVG OsHSMRpbqNpW440rZx88hTbtTdKEQI7xCZ2esYM2mCNZQmqbd9HkAqqZUHKHmtoj8HsW XbeUooicO658Kml6MuezigfbHmo3bcBOKmLVvCCyvfCgO0es1GaXW6rt6kQQV6LxmHsP r5AOJpSdae1ExjwnC8scsXY3O5BpHyqoPEuCuc+H1hVv13rboT2mTceJe+TFylQVq8x9 gEgA== 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 c10-v6si6624289pla.98.2018.07.22.14.20.41; Sun, 22 Jul 2018 14:20:41 -0700 (PDT) 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 S2387905AbeGVWSd (ORCPT + 31 others); Sun, 22 Jul 2018 18:18:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:38772 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387732AbeGVWS0 (ORCPT ); Sun, 22 Jul 2018 18:18:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8540BADC0; Sun, 22 Jul 2018 21:20:24 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-mips@linux-mips.org Cc: Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org, Govindraj Raja , =?utf-8?q?Andreas_F=C3=A4?= =?utf-8?q?rber?= , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 15/15] clk: pistachio: Fix wrong SDHost card speed Date: Sun, 22 Jul 2018 23:20:10 +0200 Message-Id: <20180722212010.3979-16-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180722212010.3979-1-afaerber@suse.de> References: <20180722212010.3979-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Govindraj Raja The SDHost currently clocks the card 4x slower than it should do, because there is a fixed divide by 4 in the sdhost wrapper that is not present in the clock tree. To model this, add a fixed divide by 4 clock node in the SDHost clock path. This will ensure the right clock frequency is selected when the mmc driver tries to configure frequency on card insert. Signed-off-by: Govindraj Raja Signed-off-by: Andreas Färber --- drivers/clk/pistachio/clk-pistachio.c | 3 ++- include/dt-bindings/clock/pistachio-clk.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/drivers/clk/pistachio/clk-pistachio.c b/drivers/clk/pistachio/clk-pistachio.c index c4ceb5eaf46c..1c968d9a6e17 100644 --- a/drivers/clk/pistachio/clk-pistachio.c +++ b/drivers/clk/pistachio/clk-pistachio.c @@ -44,7 +44,7 @@ static struct pistachio_gate pistachio_gates[] __initdata = { GATE(CLK_AUX_ADC_INTERNAL, "aux_adc_internal", "sys_internal_div", 0x104, 22), GATE(CLK_AUX_ADC, "aux_adc", "aux_adc_div", 0x104, 23), - GATE(CLK_SD_HOST, "sd_host", "sd_host_div", 0x104, 24), + GATE(CLK_SD_HOST, "sd_host", "sd_host_div4", 0x104, 24), GATE(CLK_BT, "bt", "bt_div", 0x104, 25), GATE(CLK_BT_DIV4, "bt_div4", "bt_div4_div", 0x104, 26), GATE(CLK_BT_DIV8, "bt_div8", "bt_div8_div", 0x104, 27), @@ -54,6 +54,7 @@ static struct pistachio_gate pistachio_gates[] __initdata = { static struct pistachio_fixed_factor pistachio_ffs[] __initdata = { FIXED_FACTOR(CLK_WIFI_DIV4, "wifi_div4", "wifi_pll", 4), FIXED_FACTOR(CLK_WIFI_DIV8, "wifi_div8", "wifi_pll", 8), + FIXED_FACTOR(CLK_SDHOST_DIV4, "sd_host_div4", "sd_host_div", 4), }; static struct pistachio_div pistachio_divs[] __initdata = { diff --git a/include/dt-bindings/clock/pistachio-clk.h b/include/dt-bindings/clock/pistachio-clk.h index 039f83facb68..77b92aed241d 100644 --- a/include/dt-bindings/clock/pistachio-clk.h +++ b/include/dt-bindings/clock/pistachio-clk.h @@ -21,6 +21,7 @@ /* Fixed-factor clocks */ #define CLK_WIFI_DIV4 16 #define CLK_WIFI_DIV8 17 +#define CLK_SDHOST_DIV4 18 /* Gate clocks */ #define CLK_MIPS 32