From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69CFEC433E2 for ; Thu, 3 Sep 2020 04:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4430020758 for ; Thu, 3 Sep 2020 04:49:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=aj.id.au header.i=@aj.id.au header.b="kXlyMg0j"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mqV49qp/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725943AbgICEtw (ORCPT ); Thu, 3 Sep 2020 00:49:52 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:42411 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbgICEtw (ORCPT ); Thu, 3 Sep 2020 00:49:52 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 315275C01AA; Thu, 3 Sep 2020 00:49:51 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Thu, 03 Sep 2020 00:49:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm3; bh=05SWJLotmdvCJDcdh94+gFiA3KVL9br 7SHzW1A/LNHc=; b=kXlyMg0jXkUa1i2ofTbAwVaAj9DFM5AtFXJDQRZXdqfYkvk nvN9D+0p+cgAS3UiJo8COubV/avjqdAokQlbSOYU6MjEZGYFDxsy3f71lG+qrjPc MMSvviZv4tS6atHXRYlQ9ccPyy8ZTTC/7uF3wVTo7G4ZiLIlxI7hSigdYrWFs4MD fJILlrdakPOfz2qpl4qRXAletL3N27PnrUOaUD3wxS7/TJRNQMPfab2AO+AMz3x8 D+KZ9FKCvtRH+XUmKU3rjLKPWMoqGRJpn6oHBJieeyQ6lZA3P0pyZy1XNDM214xy KdchMaPptiyh8ilw1v8cUwOWRv+DUBWE1/hW8Bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=05SWJL otmdvCJDcdh94+gFiA3KVL9br7SHzW1A/LNHc=; b=mqV49qp/V+MD0gF+OoFs4F 0Mcx7VvKlP6VMnxEHcaYUOiMjhh+ZiUibt99oqlBGjTvs/1aySgSN9PQzgjsTHS2 MBR7IWHDIXQTMfvk6nlGrrzWtPx/8coInYi1OP82yaMG4TVFAKlfbHRjSIIJQbch ixrUZ5aipB+E4NiPwlnhbiQJismfASrmdfX9NSdxGHzukDM6ScUG3/UA0pEVGClC 2jV68Bl6UoWY7CzqjCXdJViObwYN/GXQqdD9q9i9LkxixlJETJKyOQ56oJmFuZSU Tl0nCsmfG4hqKL+0V492YY1TQ5CDbbTG+kuWLzLwayeN7qimUMpFMQLXnO5GJpAg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecuggftrf grthhtvghrnhephefhfeekgfekudevheffheeihedujeefjeevjeefudfgfeeutdeuvdeh hfevueffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 45478E00DF; Thu, 3 Sep 2020 00:49:50 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-257-g770afc8-fm-20200903.002-g770afc8a Mime-Version: 1.0 Message-Id: In-Reply-To: <20200728025527.174503-3-joel@jms.id.au> References: <20200728025527.174503-1-joel@jms.id.au> <20200728025527.174503-3-joel@jms.id.au> Date: Thu, 03 Sep 2020 14:19:29 +0930 From: "Andrew Jeffery" To: "Joel Stanley" , linux-fsi@lists.ozlabs.org, "Rob Herring" Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, "Eddie James" Subject: Re: [PATCH 2/5] fsi: aspeed: Support cabled FSI Content-Type: text/plain Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, 28 Jul 2020, at 12:25, Joel Stanley wrote: > 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(+) > > 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); > + } I haven't checked this logic against the hardware but the rest of the patch looks okay. Reviewed-by: Andrew Jeffery