From patchwork Tue Jul 28 02:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 247202 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp150723ilg; Mon, 27 Jul 2020 19:55:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxILIOZedWaBXNMXxroH/ycCC3ViRS4bf9BmnfImolZzF/lkD82n+pivn/A6+8aj7h/2jqn X-Received: by 2002:a17:906:7c86:: with SMTP id w6mr13203440ejo.178.1595904941609; Mon, 27 Jul 2020 19:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595904941; cv=none; d=google.com; s=arc-20160816; b=FwdHImQmsitp30s30cJdDDhD9fBmxAFNB6lAPpQYKrWY6IWQxlPJjHTmuBbwIw1WFB dt+K8mrJ+yjNWZWWJyJcup21HwaWIRehTI1KdLaGVyMY+GfDPmwvo4F3XSfj+n6dV4Uf 90PHAXNlkMnSinl2FViSf1dodEwTpEe3Vf+DvH24AW1K3rgKkHYEmHjWmzYuxxHoDPvZ s64qgUaiYwQ44yCUNfGuCp8+pgFCNsgpPfFsgUI8XMKCwZR4W3N0fpBjAgaCenh++GY2 VW+p/isRLybbvWMyDUagXBBzUZ2SA+CVeW/HKHphqrznckNOvCx0jCLNFIkvD8dZ6zmo yoKw== 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=vj4PvrUowPqtbuJaQ0O2q3BF0NyACCC69JsA6UDc3eI=; b=X3kVfydJ2/b0/0nZrC6Fxc4LmO19vX2wJvr04HuTKNG60njLxbMf/5VFmH5kvHprXn KjMZtyppoDKfQ8F9TdHzw/ZD2iYg9fUc/Q02zQbFlBX6trRCZ6beq6s+K+KCrEJT4DuP zD5zux82bhinwO2OOvi1w46Emce8EP43e1Swy+ymNomGjEGJ1ObpAGjDzl6PTxpxqWpK lmrsFwk+29/kyxI/mF5e6vQA4iksNpCG17IDqePW4GMPkmIUE+RH+r5ZGp3knE23leiq aysWgHb1C0c7FVW4O8BNKrpMp3zxg6BJVQPfwYDfpqluvoPK92tL1M3QpSwBbfvOCrs4 MpPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WwZw+pP+; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si6714678edy.599.2020.07.27.19.55.41; Mon, 27 Jul 2020 19:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WwZw+pP+; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgG1Czl (ORCPT + 6 others); Mon, 27 Jul 2020 22:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgG1Czk (ORCPT ); Mon, 27 Jul 2020 22:55:40 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1F7BC061794 for ; Mon, 27 Jul 2020 19:55:40 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ha11so3367809pjb.1 for ; Mon, 27 Jul 2020 19:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vj4PvrUowPqtbuJaQ0O2q3BF0NyACCC69JsA6UDc3eI=; b=WwZw+pP+nfELKn3wI03HThV4YaBFoLIXqlFNgKBZrNnS80bc1dFNTFkfT6igDZKcWx 2fHNyDXG4ort0eu9UmmN5X3yJxwADl5nnjGPmWH2sLS1ueMvDNrlJQNXLyC4vMQO22UX zvY1I3ilK1mcvGkbW//ckjGAsI1o4eFsDNmTadBtgKvPJi4GKJj/9tlTyZuugIIzi0um 2Ly2kdCtVMM2GVYGWaki2mOMXBk4lXJCTZZ6W2JmiFjV93N7rMuN8M3bUVdxi0nvjT1p 3u0SsE6yQwMHidDq+IhnWzF/9sJavbAbzvdZg7LvsAhyUvtasixdMeEUVTqI4N3eds7U X6rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vj4PvrUowPqtbuJaQ0O2q3BF0NyACCC69JsA6UDc3eI=; b=mxN6tmBVTqHz5ItpQtOGLtUSfz5DdKl5f7XvD7gg1L/3XFekrg4gF199y4aOyo8XCW hUHctF04cJ9qWiWIfGWmFWflOCl7I1rkdg8iJFuhAFvrkkLexQFqxFD+HAKI/ZPdZpxI w4Y6YBrvVAqbkRyM631YclYrteJ85f+j6sRgTVKSAz9fcNhAPKnrn8pBKgsQeHtxyLrN 1mK1DVGv+GttvBRBsrGNQnzUivHRacfbbWlJGT+qzlmGtvSgUVs/C/ukf2crLWyrU/il 0stXEiNyvvWbDCEIgJbEOzwAUUVL1ReHFWCzXG5oCBNgc0VlSmmH5qFfQapDZOxwiLGa ZI1A== X-Gm-Message-State: AOAM5334zQC9TpdLXrck62DpPCMaMWA6p1q59IdleR3RuswLgJLXNZNg MbonvoaW/f5n4vTXb25by31cYw3FVLY= X-Received: by 2002:a17:902:7484:: with SMTP id h4mr7136949pll.139.1595904940300; Mon, 27 Jul 2020 19:55:40 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id w9sm15147407pfq.178.2020.07.27.19.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 19:55:38 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org, Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Andrew Jeffery , Eddie James Subject: [PATCH 1/5] dt-bindings: fsi: Document gpios Date: Tue, 28 Jul 2020 12:25:23 +0930 Message-Id: <20200728025527.174503-2-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728025527.174503-1-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The FSI master has some associated GPIOs that may be present on some hardware configurations. Signed-off-by: Joel Stanley --- .../devicetree/bindings/fsi/fsi-master-aspeed.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.27.0 Reviewed-by: Andrew Jeffery diff --git a/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt b/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt index b758f91914f7..a513e65ec0c9 100644 --- a/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt +++ b/Documentation/devicetree/bindings/fsi/fsi-master-aspeed.txt @@ -12,6 +12,13 @@ Required properties: - pinctrl-0: phandle to pinctrl node - pinctrl-names: pinctrl state +Optional properties: + - cfam-reset-gpios: GPIO for CFAM reset + + - fsi-routing-gpios: GPIO for setting the FSI mux (internal or cabled) + - fsi-mux-gpios: GPIO for detecting the desired FSI mux state + + Examples: fsi-master { @@ -21,4 +28,9 @@ Examples: pinctrl-names = "default"; pinctrl-0 = <&pinctrl_fsi1_default>; clocks = <&syscon ASPEED_CLK_GATE_FSICLK>; + + fsi-routing-gpios = <&gpio0 ASPEED_GPIO(Q, 7) GPIO_ACTIVE_HIGH>; + fsi-mux-gpios = <&gpio0 ASPEED_GPIO(B, 0) GPIO_ACTIVE_HIGH>; + + cfam-reset-gpios = <&gpio0 ASPEED_GPIO(Q, 0) GPIO_ACTIVE_LOW>; }; From patchwork Tue Jul 28 02:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 247203 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp150742ilg; Mon, 27 Jul 2020 19:55:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAgnJMEpMa1M76CZqSuG5nRXGiViLXaBLHHH+r/hTh/ykluFhImubw2fP6pvIx5jjXmLto X-Received: by 2002:a17:906:3b01:: with SMTP id g1mr24657109ejf.353.1595904945844; Mon, 27 Jul 2020 19:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595904945; cv=none; d=google.com; s=arc-20160816; b=tRpqAUNb6lI8TSGvKYgg2OscvpwzBia/a5Jm7I6mf00XVluCbA79SSM0bkanOCdazE B2Ii1xTHe++fiEOxYSwiz+0HRfIHFVh67kH8/XbngCtFRm1LYcV5rig5jkxqkRxMlyRu PkoA1/aEql9Kg4Yo4p4FWwAiUK8DgsPIh3JdViEdKXSynttCYzhb6emwg4nYFs/JsBzE HdIrTQzqeqEJpFTvm5mh2X/vtqb56KCawzvVPjWLbERCPUHdRwSCATLSeifWkDGr/MFR vriqOfk0vM4uO4BMTPBAUUCSTfAwJbigB38HABXawdwZ733xrCtQvSzQ52GJ6NfIYUXs 8KJw== 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=6Ckk/6ewdW9qSUoP0eBZAL2Xbg3NR5wTYMI4LU5aFt4=; b=PzK/r18ztGJOCmlgD6CWUaDLDOhx09d8Q+kS9o2uni1/WVhDh+dUOcMmC+7bTd/XPe dJZuZwfD8WtQCZEasPqE3Yb0hpbJw6l4+aiIKksoWAN5qAuaaLz2B7eKKeVvVgbNe672 PdcOndDbRyyDSzFGJb26yBQ96ccxaOq1aBqZtw0ij+fvRJPoW4dQxBBslQSwZwwKpqo6 o8rdEgqhL5MusvGX/UZPmBlQ3zbEBcqxQpFNZMFbX4nOJ0OineuPok5ipOHr9X2WswyM nwP8tLBN0d3+auWhJRqH3zlZ7TMP0nJfomZVINdZd0APO8WuoLGRi/V5rtQz/6j4nU4c +U1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qwm4vltx; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si6714678edy.599.2020.07.27.19.55.45; Mon, 27 Jul 2020 19:55:45 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qwm4vltx; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgG1Czp (ORCPT + 6 others); Mon, 27 Jul 2020 22:55:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgG1Czo (ORCPT ); Mon, 27 Jul 2020 22:55:44 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D643AC061794 for ; Mon, 27 Jul 2020 19:55:44 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id il6so4878856pjb.0 for ; Mon, 27 Jul 2020 19:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6Ckk/6ewdW9qSUoP0eBZAL2Xbg3NR5wTYMI4LU5aFt4=; b=qwm4vltxppZrjcwHre2u8XPw/2x/A/ajhqryA4wKKE4Jxxl4xtOYU/PcilF6+6a1KS kQCe3XGO262TWK2MeJaZdKb5NupNdxV9cG+MHUl0Zv948QCe0yd1AK2rk5zrr0AVz39D NYNrXYrLZhzhlDzIscWny3RogwmmAmYeinlHjxO5sPpeLHq1FW/ZmzUo7BuJsfj/w2dP fKO9cFbVZ3RtnJT85YiHMjnTTBJd+WJ/tdS07odx6JEbtNeU7X0xCTw+j8uuxtJQuORy Tiirqcw3lmPkOtES+yzq1Wpo5mLmiJ+cV23g2agFR+BT+lr6B1llmXpcJNrzGO+yTWSp mfLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6Ckk/6ewdW9qSUoP0eBZAL2Xbg3NR5wTYMI4LU5aFt4=; b=njN3piICTUdKoaoIqcnhaho1CMlswLB+I2nI0OxiRjaLSOeO4qGZAYgEM//uoTbWX+ bkCA8fm6y0JZRCmx4Ff/FXfAXQebiDZ8l7jMRAO50ax3aPqhVr5E9rBW1RfIgbbKsD+y F1V0l9mKawxe8S1xfe9chUvmjJlYavHYNNcUCmrtMshsarKxuEaSTZDdFVnt40QOMQE4 gKUMhXpwoh7qn6N12fp3frP/atPcvnR5FePwf+4FCkwPtQZ/YOm0JWKG4nc8/+Ev3IvN sT+j/8bIZiIwivhMV9LedRPhxguRHXW+i+Ro19jbMkVW7IeoV65natrCD34+MmpfkimK 0mLQ== X-Gm-Message-State: AOAM531QcDl9xp5Bk+c9FJMmCY6TnfBYmFxoaxriYk3yJRpIbZny3Ptl RDS0B41Otz3jSJ1lukqZvkI= X-Received: by 2002:a17:902:6b0c:: with SMTP id o12mr21979221plk.321.1595904944347; Mon, 27 Jul 2020 19:55:44 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id w9sm15147407pfq.178.2020.07.27.19.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 19:55:43 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org, Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Andrew Jeffery , Eddie James Subject: [PATCH 2/5] fsi: aspeed: Support cabled FSI Date: Tue, 28 Jul 2020 12:25:24 +0930 Message-Id: <20200728025527.174503-3-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728025527.174503-1-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some FSI capable systems have internal FSI signals, and some have external cabled FSI. Software can detect which machine this is by reading a jumper GPIO, and also control which pins the signals are routed to through a mux GPIO. This attempts to find the GPIOs at probe time. If they are not present in the device tree the driver will not error and continue as before. The mux GPIO is owned by the FSI driver to ensure it is not modified at runtime. The routing jumper obtained as non-exclusive to allow other software to inspect it's state. Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-aspeed.c | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) -- 2.27.0 Reviewed-by: Andrew Jeffery diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 2b8ca72baeb5..c282de76e6e7 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "fsi-master.h" @@ -417,6 +418,45 @@ static int aspeed_master_init(struct fsi_master_aspeed *aspeed) return 0; } +static int tacoma_cabled_fsi_fixup(struct device *dev) +{ + struct gpio_desc *routing_gpio, *mux_gpio; + int gpio; + + /* + * The routing GPIO is a jumper indicating we should mux for the + * externally connected FSI cable. + */ + routing_gpio = devm_gpiod_get_optional(dev, "fsi-routing", + GPIOD_IN | GPIOD_FLAGS_BIT_NONEXCLUSIVE); + if (IS_ERR(routing_gpio)) + return PTR_ERR(routing_gpio); + if (!routing_gpio) + return 0; + + mux_gpio = devm_gpiod_get_optional(dev, "fsi-mux", GPIOD_ASIS); + if (IS_ERR(mux_gpio)) + return PTR_ERR(mux_gpio); + if (!mux_gpio) + return 0; + + gpio = gpiod_get_value(routing_gpio); + if (gpio < 0) + return gpio; + + /* If the routing GPIO is high we should set the mux to low. */ + if (gpio) { + gpiod_direction_output(mux_gpio, 0); + dev_info(dev, "FSI configured for external cable\n"); + } else { + gpiod_direction_output(mux_gpio, 1); + } + + devm_gpiod_put(dev, routing_gpio); + + return 0; +} + static int fsi_master_aspeed_probe(struct platform_device *pdev) { struct fsi_master_aspeed *aspeed; @@ -424,6 +464,12 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) int rc, links, reg; __be32 raw; + rc = tacoma_cabled_fsi_fixup(&pdev->dev); + if (rc) { + dev_err(&pdev->dev, "Tacoma FSI cable fixup failed\n"); + return rc; + } + aspeed = devm_kzalloc(&pdev->dev, sizeof(*aspeed), GFP_KERNEL); if (!aspeed) return -ENOMEM; From patchwork Tue Jul 28 02:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 247204 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp150763ilg; Mon, 27 Jul 2020 19:55:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbtvpoFwaAud5jgkQBcIb6iaLECbIPptT8zEKjA9LUcw/OAm2SE+9IaRNUpVc21GvcB2ay X-Received: by 2002:a17:906:c56:: with SMTP id t22mr24983121ejf.50.1595904949551; Mon, 27 Jul 2020 19:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595904949; cv=none; d=google.com; s=arc-20160816; b=WT0oBFtKL7AowgXite7D04R+KHR0ZNkdxkfGgAfW6E3c2yig8ACntDypAqFCe6ySkw B6aW7fpk/0PGKr8pa3bAQuzHe6aHidgfNPcLjgqgSzdzVjMJr9DnPZhuF7w0LRDzTkhg aDxn7KA12lmKFi68A8xYExOsXGzLw7wJ3ExkUTpnVtZOnjtfCoCRP8DHHIy7KgRGPDHW IqDvNwt1x8Q5S96OXbgHH1r835ufN01QC64Mpf+lD4hrfZPVKWMwhcLbfge/vPXpjUrK soxOCkS1F8P4WhduN1Kld0NkaSea8cY0O6R0VPUC4+ombox3aTUfdg7Mi6HMzqASdEi/ 0FGg== 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=etR2ncs18vgJbAdIWyCeb1uJq/TbjsZdQrwX72WYY3o=; b=TLW77AEmODZR2l6/c+v6l5/7RyXdppFyGx+cnvQyU2Lvt+23mn5OA3Zdw5Aoi091Kx eJBiiG8O6PgWXTL/OIMaotdV6aqrsL5fSR/vrIwVeO047e9TMSoazXvIweUI9BP/32bV vVm4Se/I6TwTGZc5AyFRY/SNc3d5BwUz/7QfsYU521iE5F0bLWKXPVwhbUQXJ011otsd e5tlQXIbnfcENlFu7Pq5rexgfzm5ptwKriN7DZeK0paxoWIZ1NJ1FupDl8jsYHPEcZNs FmQlPYh2EIIxNS4A5inlGysBYshaL3Bf/Kf2GovjyCGWJaGxVZqT0uQp178tCiU71zxR vEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KvkF5Wb4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si6714678edy.599.2020.07.27.19.55.49; Mon, 27 Jul 2020 19:55:49 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=KvkF5Wb4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgG1Czt (ORCPT + 6 others); Mon, 27 Jul 2020 22:55:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgG1Czs (ORCPT ); Mon, 27 Jul 2020 22:55:48 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC06C061794 for ; Mon, 27 Jul 2020 19:55:48 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id o13so11091722pgf.0 for ; Mon, 27 Jul 2020 19:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=etR2ncs18vgJbAdIWyCeb1uJq/TbjsZdQrwX72WYY3o=; b=KvkF5Wb4msJY05g+xyOomJxBfCmyXBjzZukMrcyHF3XWtg3jnGJuhFwC6qBmUquXiP QP4Fcx7xO7KtRj8f5akD29mJU4+M6DF/XJUE4CTVbpGe6p9VySOroq+AErRO/baRx5FW yNqnJlDMT8RaP9+7ci1OU1IHk/Yi+5kMOVxSzA8Cz7/O+zdUHTv/tZE71tE/2zoZ6e3S CMZ7rsG5Xuq9QUp75Ompge6vanhjHbE4+pb30tvJqGrKzBnHbcvz+mwKAUc02APecPbk pYsMM5L3fI5ujcccmgTzF8RvdJwXuD666JjFKHHbo5t7aqlURwXFi3tgPtvpfYuhkBKc weXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=etR2ncs18vgJbAdIWyCeb1uJq/TbjsZdQrwX72WYY3o=; b=DeWsR0xTb208t1MfdZ7eMaydcvlLMcVUZINmdbB6hh76N7lMkZEyjjH9EbgEoTReh7 W5c9cF05WT8izq6CUtYWRaKIrWdTR6HywcWdOjf1gQPm6ShYficl4zMdIwiaZF7w2Y8u 34ORWhFa56jBxvSg2QC5BZeCrhPR0r+wI5++IlLfKA3gUAPW5rm9Lju0XqlKKPAZqB2V 6g0+fai5hOf34tXHnMmbemy7mS230i9xSnsmf8iGW7Zx3vLy0bY4x/3CNZxaGkWM5t/G Aqb4Z0zMWQ5LYllWAf51FZ/bqFc1LDZZWP3zEu84FU1GH/VOK+TdAuscXh3ClBWjZWPq FprA== X-Gm-Message-State: AOAM532gPCKT6faaYC75wKzZhJZU84MPN27PmCJAnngT1bA0tScYah/0 hSu2ryzCZFiavDBzkzPi7HkHnpRH83A= X-Received: by 2002:a65:4549:: with SMTP id x9mr21970729pgr.415.1595904948210; Mon, 27 Jul 2020 19:55:48 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id w9sm15147407pfq.178.2020.07.27.19.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 19:55:47 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org, Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Andrew Jeffery , Eddie James Subject: [PATCH 3/5] fsi: aspeed: Run the bus at maximum speed Date: Tue, 28 Jul 2020 12:25:25 +0930 Message-Id: <20200728025527.174503-4-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728025527.174503-1-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Testing of Tacoma has shown that the ASPEED master can be run at maximum speed. The exception is when wired externally with a cable, in which case we use a divisor of two to ensure reliable operation. Reviewed-by: Eddie James Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-aspeed.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) -- 2.27.0 diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index c282de76e6e7..f503f64ab32b 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -83,7 +83,11 @@ static const u32 fsi_base = 0xa0000000; #define FSI_LINK_ENABLE_SETUP_TIME 10 /* in mS */ -#define DEFAULT_DIVISOR 14 +/* Run the bus at maximum speed by default */ +#define FSI_DIVISOR_DEFAULT 1 +#define FSI_DIVISOR_CABLED 2 +static u16 aspeed_fsi_divisor = FSI_DIVISOR_DEFAULT; + #define OPB_POLL_TIMEOUT 10000 static int __opb_write(struct fsi_master_aspeed *aspeed, u32 addr, @@ -385,9 +389,11 @@ static int aspeed_master_init(struct fsi_master_aspeed *aspeed) opb_writel(aspeed, ctrl_base + FSI_MECTRL, reg); reg = cpu_to_be32(FSI_MMODE_ECRC | FSI_MMODE_EPC | FSI_MMODE_RELA - | fsi_mmode_crs0(DEFAULT_DIVISOR) - | fsi_mmode_crs1(DEFAULT_DIVISOR) + | fsi_mmode_crs0(aspeed_fsi_divisor) + | fsi_mmode_crs1(aspeed_fsi_divisor) | FSI_MMODE_P8_TO_LSB); + dev_info(aspeed->dev, "mmode set to %08x (divisor %d)\n", + be32_to_cpu(reg), aspeed_fsi_divisor); opb_writel(aspeed, ctrl_base + FSI_MMODE, reg); reg = cpu_to_be32(0xffff0000); @@ -446,6 +452,11 @@ static int tacoma_cabled_fsi_fixup(struct device *dev) /* If the routing GPIO is high we should set the mux to low. */ if (gpio) { + /* + * Cable signal integrity means we should run the bus + * slightly slower + */ + aspeed_fsi_divisor = FSI_DIVISOR_CABLED; gpiod_direction_output(mux_gpio, 0); dev_info(dev, "FSI configured for external cable\n"); } else { From patchwork Tue Jul 28 02:55:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 247205 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp150783ilg; Mon, 27 Jul 2020 19:55:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhzHRkILzC5DvooM0Y631Lz6llLSYSt0aZUvD3+BGEloKbHi9jnKL8aptTyLwfhTen2g7e X-Received: by 2002:a50:d8c2:: with SMTP id y2mr23899196edj.114.1595904953753; Mon, 27 Jul 2020 19:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595904953; cv=none; d=google.com; s=arc-20160816; b=KaFqa2dpHtSLC6G3+/4lS8cjREW38+a5zIMDcfZA33FmpRBFUR2ed7eC/RSN1SIiRP 2HDe3nnIZK6MFwOFcXoACl9Q8OIYhx9/s1/UxlRVgcYLbPkoTshaknRaD68zBovR/BnM vrR10MKJI25YLxvmqm8+cDF5kB4V44Hh/YWBaBxkWNSqRc1Ag76ZWqxLQPqIbsaGjESH kjuK9e9K00RdZ5QSUzZUGVxrnnZiMvnZV+mGqJHJFwqbdOmK/AfFjwSO0E1tmusnXzPo XL8X5wWY7J8FCrT0hxH1iprjvz4sU7nxqudwvl1XiLvWrFEL5JAeRkAZhUgpi4pTRnNr ujZQ== 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=LSKd0G5Txp3QCoH0wblOaMdjCRcT0SQZyQIDSr/GeGM=; b=paeyooyw1horkJFjbaWnp4pdqgt5LfkL7rehe8i9kW8JN/6mLlk/minbhwLU4KtK/7 6KC1Lcv2K747rv/S9vcUB3ABaiqIEwjZF1ztSP/2kRmJWrfLnEoUQIwqgxi9LDn4KLYW Jw5064D4IwGUC+txYd2hXnlqWUgpQ3fhI2cOh4Weh9t8aeh8JCal8kws2BKP0UdDsnFu woifXpaZGIT9faNxd491LbXjYZROmEeUMu+3U/kbjykyfYgXKY1YF6+A8yr0enhAGVdE ZYKDfQhrPR7z8Tg5Ax9jJbmcN9wvRKbJvMXE5iQ1sGi2HB0cpsYfZ6r1sFg184O4yJiN 3kdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ozzO8Eqz; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si6714678edy.599.2020.07.27.19.55.53; Mon, 27 Jul 2020 19:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ozzO8Eqz; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbgG1Czx (ORCPT + 6 others); Mon, 27 Jul 2020 22:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgG1Czw (ORCPT ); Mon, 27 Jul 2020 22:55:52 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1AF3C061794 for ; Mon, 27 Jul 2020 19:55:52 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id f185so5209909pfg.10 for ; Mon, 27 Jul 2020 19:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LSKd0G5Txp3QCoH0wblOaMdjCRcT0SQZyQIDSr/GeGM=; b=ozzO8EqzqybbL7ON31QioltDqBbDlQAkv8dbA2uiGm7Z7h8yLUFqMHddmxSsQuoUIn twUEUjYyNeesMrtzbv/MqY5JKwjrwl3+zT3pPyHxH0lXBPMPG30ZxrqZA00Op3EapAST /H8gkAZhQKHzXg1uZSTC8cbadi/94tGJ3nMzpfXJMOSL59OHoBPU1RMLCUJk+uBQVDEu uBrkJyjBnn7kw3VCf/3qoh9kmEu9EOOc9lIzabEIdBeEO0Tpau2Zd5g3y2QikOgRzGID gqlnX9fKazhPZK28L+dPlLYEvm8wp4irfELCrzBXQhW/E+S2PFAoI0blh0617tUiPcha LhqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LSKd0G5Txp3QCoH0wblOaMdjCRcT0SQZyQIDSr/GeGM=; b=bsYpBApdZ/xrZFM6OBvzM25oFMqgXTWyiXK4HI5BHzQ4M+mwGsm50pMO5rkExsuy9P uEF4HIY4aco5xbhE2v2XUpSaZs0OTFDEXT4Y3MDVk0U4PRxbgwA+8BRyd/zV4iYSm6cl i/yUv+bTXIc6azHJnRaIciqkFwg9Y8nZwz+HXlJIl7/LNlvmVWUEQxSFlzeZt3WsQhdc MXldEmNoajNxn2Vj4gnkyvh7yZg1MSifxE3SCGxDjabBj5QeZwYsU/+pWmdzx3673s51 Ewi275CXFwBYx2pzw2PnDK5jZ5DwG5fuOwgdfcchf1rzV1aC1F+N1ZB3r1w7XDzbbfWC 3B2A== X-Gm-Message-State: AOAM530xs7WUaqNQdvBtgahKj3lYeSiQLUkiTcnwy0mXnyKqkZX/dhPZ uZaJCw75mT5pwJ6UETt30VA= X-Received: by 2002:a63:7cd:: with SMTP id 196mr22043450pgh.230.1595904952308; Mon, 27 Jul 2020 19:55:52 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id w9sm15147407pfq.178.2020.07.27.19.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 19:55:51 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org, Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Andrew Jeffery , Eddie James Subject: [PATCH 4/5] fsi: aspeed: Add module param for bus divisor Date: Tue, 28 Jul 2020 12:25:26 +0930 Message-Id: <20200728025527.174503-5-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728025527.174503-1-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org For testing and hardware debugging a user may wish to override the divisor at runtime. By setting fsi_master_aspeed.bus_div=N, the divisor will be set to N, if 0 < N <= 0x3ff. This is a module parameter and not a device tree option as it will only need to be set when testing or debugging. Reviewed-by: Eddie James Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-aspeed.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.27.0 diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index f503f64ab32b..2531e826ba8b 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -87,6 +87,7 @@ static const u32 fsi_base = 0xa0000000; #define FSI_DIVISOR_DEFAULT 1 #define FSI_DIVISOR_CABLED 2 static u16 aspeed_fsi_divisor = FSI_DIVISOR_DEFAULT; +module_param_named(bus_div,aspeed_fsi_divisor, ushort, 0); #define OPB_POLL_TIMEOUT 10000 @@ -454,9 +455,12 @@ static int tacoma_cabled_fsi_fixup(struct device *dev) if (gpio) { /* * Cable signal integrity means we should run the bus - * slightly slower + * slightly slower. Do not override if a kernel param + * has already overridden. */ - aspeed_fsi_divisor = FSI_DIVISOR_CABLED; + if (aspeed_fsi_divisor == FSI_DIVISOR_DEFAULT) + aspeed_fsi_divisor = FSI_DIVISOR_CABLED; + gpiod_direction_output(mux_gpio, 0); dev_info(dev, "FSI configured for external cable\n"); } else { From patchwork Tue Jul 28 02:55:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 247206 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp150810ilg; Mon, 27 Jul 2020 19:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx5b7CHJaPyHwcbpbuHJdIhZQC0iTJSiKh0EN/TJJL4tGLk6OF7JPVZR0uQFjA15+Q89h2 X-Received: by 2002:a50:cf43:: with SMTP id d3mr25178261edk.40.1595904957818; Mon, 27 Jul 2020 19:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595904957; cv=none; d=google.com; s=arc-20160816; b=Q3EB7ohxYj8vEubuWVoykEqcLgRcXPRRPne2/1jNSaWOvSrChCCQi2fZU/I/EBpJeg 54L1QIwQBew8IZn283Kkgsb0PL0Qrg7yHoL50e2pTk8Wp+iFcwQJKF4XFvmLV32zCZP5 8lXRvrRouFStSDSowFdZIgAn4/LLI/Y1qJ7zO789SIzvauREdmeSbyR6Sg/OpjrFXAR1 EDL5sZmWE2u7ipTRjuaaiGnAm5+SiDVrcYZdDP2l90dKlAf+Uqd1bZqthbTTKL7t/yvm sDV68ICnifeI47ciDiet7cd+pEdZBo9ePwRsfz4AajRp3ixHF2PEWryoo7x8/Q5lBte9 B20Q== 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=xHSue0CpQdznRDxP9HpcUml2ldWS2kI8QAiHMjwZsXk=; b=hEZQ7XSY4eKCZeggTTZeuBdewsvK7usp3VAgV/MAIlYRaJl0tLlI7eqNJ4V+wh/TPe i69m3lrZkp6jUwQdb7+dFcDP8zbdeHRLjzhuhI0ENJX+LiBo4W90iJ2FNuCAYpBDqBk3 REZxIoTvhtj6P3YCqaB2Hl/r76cjditp941nzcgUDK2ohB4XM1jjy7nc4bDCOMJvotT4 3V1VPbeI1YSevyUjKmL20VndT3CVlgJ7BGh4kbp76VPtrRaCFD4ET4YMJCL1/DwYEpog eOgFc5O0C+594G5t1ZKKC6FxywqEzFb12v0aPddlqbs4qGX54Ozifo5yue0RYXxZBRnq Qo+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IUASXs1v; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si6714678edy.599.2020.07.27.19.55.57; Mon, 27 Jul 2020 19:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IUASXs1v; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726916AbgG1Cz5 (ORCPT + 6 others); Mon, 27 Jul 2020 22:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgG1Cz4 (ORCPT ); Mon, 27 Jul 2020 22:55:56 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A2AC061794 for ; Mon, 27 Jul 2020 19:55:56 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id 72so9155058ple.0 for ; Mon, 27 Jul 2020 19:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xHSue0CpQdznRDxP9HpcUml2ldWS2kI8QAiHMjwZsXk=; b=IUASXs1vJ1qA+xjSALYyZt+BdzR4rFVXPkh++rAUOBtW4OALDpHw7FcO3xHVgYiCZi /YC0T0Q0QLAJEIuYlDEdC1B/0lHyq08IcxsTpffEYRgOHUp9eokDwJOdobX6OdNzBHWC gGcYXpgJsy8sknso3kDuoeJs6DXH8C14Ig2m2/U9A0WirUen7R0UEmzCcRSwFy9C3O6y uT1Psxj5VOB05ySDtvIJD0K7WY0C16kRQvrosHcpWR9tO52rvSAp66ctAIUgqGXmj6ld TjtuqaiXR2CRNGWf58N1Bkqc8KG77MsTq5894zZ+AanQ/gD0JZ1MuBQZexHCIGFfiDy9 xipQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xHSue0CpQdznRDxP9HpcUml2ldWS2kI8QAiHMjwZsXk=; b=Oujazh1Np2KovBz4en5Vy5N456r0Y4VDOJOjcNUxv0fkqU5LsOUu3uapj/60EKLotj r85fStYDuooqs80oiDCuxKgS1t/aAS++J43P6mQjfzsiWbksd1AiyobDKuC28EQ2qW66 guWei+1vt/9jNK1eBTphg4IsFXwWqxlw+/ietBbc2jicoVOxjJ6l+5jPTqNivbTrAinq Zm9CIMXhMVP4WAijdkjMdv98F4QobwppUi7sPvkQajEErY7H8UOgs3L7/xox6CKNde+1 8qhfdsuRZCAxM3Ius9BlJ5nWpw7zMXifWZ7mCkTHoZO1B/T36MAtv4unk2SXZqJNoXBt oqcQ== X-Gm-Message-State: AOAM531BD+nZnkmd6um5VOKD8ZA7ldbt6CsvWOI8BADn6lNbTP42EWIm 5ETKn2lRiCrSPdds9IzxiHI= X-Received: by 2002:a17:902:d704:: with SMTP id w4mr21994938ply.278.1595904956348; Mon, 27 Jul 2020 19:55:56 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id w9sm15147407pfq.178.2020.07.27.19.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 19:55:55 -0700 (PDT) From: Joel Stanley To: linux-fsi@lists.ozlabs.org, Rob Herring Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Andrew Jeffery , Eddie James Subject: [PATCH 5/5] fsi: aspeed: Support CFAM reset GPIO Date: Tue, 28 Jul 2020 12:25:27 +0930 Message-Id: <20200728025527.174503-6-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728025527.174503-1-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Systems have a line for restting the remote CFAM. This is not part of the FSI master, but is associated with it, so it makes sense to include it in the master driver. This exposes a sysfs interface to reset the cfam, abstracting away the direction and polarity of the GPIO, as well as the timing of the reset pulse. Userspace will be blocked until the reset pulse is finished. The reset is hard coded to be in the range of (900, 1000) us. It was observed with a scope to regularly be just over 1ms. If the device tree property is not preset the driver will silently continue. Reviewed-by: Andrew Jeffery Signed-off-by: Joel Stanley --- drivers/fsi/fsi-master-aspeed.c | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) -- 2.27.0 diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 2531e826ba8b..c006ec008a1a 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -22,6 +22,7 @@ struct fsi_master_aspeed { struct device *dev; void __iomem *base; struct clk *clk; + struct gpio_desc *cfam_reset_gpio; }; #define to_fsi_master_aspeed(m) \ @@ -425,6 +426,43 @@ static int aspeed_master_init(struct fsi_master_aspeed *aspeed) return 0; } +static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct fsi_master_aspeed *aspeed = dev_get_drvdata(dev); + + gpiod_set_value(aspeed->cfam_reset_gpio, 1); + usleep_range(900, 1000); + gpiod_set_value(aspeed->cfam_reset_gpio, 0); + + return count; +} + +static DEVICE_ATTR(cfam_reset, 0200, NULL, cfam_reset_store); + +static int setup_cfam_reset(struct fsi_master_aspeed *aspeed) +{ + struct device *dev = aspeed->dev; + struct gpio_desc *gpio; + int rc; + + gpio = devm_gpiod_get_optional(dev, "cfam-reset", GPIOD_OUT_LOW); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + if (!gpio) + return 0; + + aspeed->cfam_reset_gpio = gpio; + + rc = device_create_file(dev, &dev_attr_cfam_reset); + if (rc) { + devm_gpiod_put(dev, gpio); + return rc; + } + + return 0; +} + static int tacoma_cabled_fsi_fixup(struct device *dev) { struct gpio_desc *routing_gpio, *mux_gpio; @@ -507,6 +545,11 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) return rc; } + rc = setup_cfam_reset(aspeed); + if (rc) { + dev_err(&pdev->dev, "CFAM reset GPIO setup failed\n"); + } + writel(0x1, aspeed->base + OPB_CLK_SYNC); writel(OPB1_XFER_ACK_EN | OPB0_XFER_ACK_EN, aspeed->base + OPB_IRQ_MASK);