From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Joel Stanley" <joel@jms.id.au>,
linux-fsi@lists.ozlabs.org, "Rob Herring" <robh+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
"Eddie James" <eajames@linux.ibm.com>
Subject: Re: [PATCH 2/5] fsi: aspeed: Support cabled FSI
Date: Thu, 03 Sep 2020 14:19:29 +0930 [thread overview]
Message-ID: <d1fb6ecb-6343-40b9-b05c-dfb73e8bb058@www.fastmail.com> (raw)
In-Reply-To: <20200728025527.174503-3-joel@jms.id.au>
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 <joel@jms.id.au>
> ---
> 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 <linux/regmap.h>
> #include <linux/slab.h>
> #include <linux/iopoll.h>
> +#include <linux/gpio/consumer.h>
>
> #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 <andrew@aj.id.au>
next prev parent reply other threads:[~2020-09-03 4:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 2:55 [PATCH 0/5] fsi: Support extra functions on ASPEED master Joel Stanley
2020-07-28 2:55 ` [PATCH 1/5] dt-bindings: fsi: Document gpios Joel Stanley
2020-09-03 4:42 ` Andrew Jeffery
2020-07-28 2:55 ` [PATCH 2/5] fsi: aspeed: Support cabled FSI Joel Stanley
2020-09-03 4:49 ` Andrew Jeffery [this message]
2020-07-28 2:55 ` [PATCH 3/5] fsi: aspeed: Run the bus at maximum speed Joel Stanley
2020-07-28 2:55 ` [PATCH 4/5] fsi: aspeed: Add module param for bus divisor Joel Stanley
2020-07-28 2:55 ` [PATCH 5/5] fsi: aspeed: Support CFAM reset GPIO Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1fb6ecb-6343-40b9-b05c-dfb73e8bb058@www.fastmail.com \
--to=andrew@aj.id.au \
--cc=devicetree@vger.kernel.org \
--cc=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsi@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).