Tacoma FSI GPIOs
Subsystems (3)
Joel Stanley
maintainercover Tacoma FSI GPIOs
This series adds support for configuring the GPIOs for enabling FSI on Tacoma.
Joel Stanley (2):
fsi: aspeed: Configure optional GPIOs
ARM: dts: aspeed: tacoma: Add FSI mux and enable GPIOs
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 3 +++ drivers/fsi/fsi-master-aspeed.c | 30 +++++++++++++++++++++ 2 files changed, 33 insertions(+)
Signature · 1 line
2.23.0
Joel Stanley
maintainerPATCH 1/2 fsi: aspeed: Configure optional GPIOs
On Tacoma the enable and mux GPIOs allow the BMC to enable FSI and control if the clock and data should come from the BMC, or from the debug connector.
Configure these as optional GPIOs which will fail without error for systems that do not have these GPIOs in their device tree.
--- drivers/fsi/fsi-master-aspeed.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/fsi/fsi-master-aspeed.c +30 -0
@@ -14,6 +14,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/iopoll.h> +#include <linux/gpio/consumer.h> #include "fsi-master.h"
@@ -85,6 +86,9 @@ struct fsi_master_aspeed {void __iomem *base;struct clk *clk; +struct gpio_desc *gpio_enable; +struct gpio_desc *gpio_mux; +struct dentry *debugfs_dir;struct fsi_master_aspeed_debugfs_entry debugfs[FSI_NUM_DEBUGFS_ENTRIES ]; };
@@ -471,6 +475,30 @@ DEFINE_DEBUGFS_ATTRIBUTE(fsi_master_aspeed_debugfs_ops, fsi_master_aspeed_debugfs_get, fsi_master_aspeed_debugfs_set, "0x%08llx\n"); +static int aspeed_master_gpio_init (struct fsi_master_aspeed *master) +{ +struct device *dev = master->dev; +struct gpio_desc *gpio; + + gpio =devm_gpiod_get_optional (dev,"fsi-enable" ,0 ); +if (IS_ERR (gpio)) { +dev_err (dev,"failed to get fsi enable gpio\n" ); +return PTR_ERR (gpio); + } + master->gpio_enable = gpio; +gpiod_direction_output (master->gpio_enable,1 ); + + gpio =devm_gpiod_get_optional (dev,"fsi-mux" ,0 ); +if (IS_ERR (gpio)) { +dev_err (dev,"failed to get fsi mux gpio\n" ); +return PTR_ERR (gpio); + } + master->gpio_mux = gpio; +gpiod_direction_output (master->gpio_mux,1 ); + +return 0 ; +} +static int fsi_master_aspeed_probe (struct platform_device *pdev) {struct fsi_master_aspeed *aspeed;
@@ -540,6 +568,8 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, aspeed); +aspeed_master_gpio_init (aspeed); +aspeed_master_init (aspeed); aspeed->debugfs_dir =debugfs_create_dir ("fsi-master-aspeed" ,NULL );
Signature · 1 line
2.23.0
Re: [PATCH linux dev-5.3 1/2] fsi: aspeed: Configure optional GPIOs
Quoted 35 lines · Joel Stanley
On Tacoma the enable and mux GPIOs allow the BMC to enable FSI and control if the clock and data should come from the BMC, or from the debug connector.
Configure these as optional GPIOs which will fail without error for systems that do not have these GPIOs in their device tree.
Signed-off-by Joel Stanley <[email protected]>--- drivers/fsi/fsi-master-aspeed.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/fsi/fsi-master-aspeed.c +4
-0@@ -14,6 +14,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/iopoll.h> +#include <linux/gpio/consumer.h> #include "fsi-master.h" @@ -85,6 +86,9 @@ struct fsi_master_aspeed {void __iomem *base;struct clk *clk; +struct gpio_desc *gpio_enable; +struct gpio_desc *gpio_mux; +struct dentry *debugfs_dir;struct fsi_master_aspeed_debugfs_entry debugfs[FSI_NUM_DEBUGFS_ENTRIES ]; };
drivers/fsi/fsi-master-aspeed.c DEFINE_DEBUGFS_ATTRIBUTE(fsi_master_aspeed_debugfs_ops, · line 484
Quoted 10 lines
drivers/fsi/fsi-master-aspeed.c +7
-0@@ -471,6 +475,30 @@ DEFINE_DEBUGFS_ATTRIBUTE(fsi_master_aspeed_debugfs_ops, fsi_master_aspeed_debugfs_get, fsi_master_aspeed_debugfs_set, "0x%08llx\n"); +static int aspeed_master_gpio_init (struct fsi_master_aspeed *master) +{ +struct device *dev = master->dev; +struct gpio_desc *gpio; + + gpio =devm_gpiod_get_optional (dev,"fsi-enable" ,0 ); +if (IS_ERR (gpio)) {
devm_gpiod_get_option() returns NULL if the GPIO isn't defined, and interfaces like gpiod_direction_output(...) return 0 if the descriptor is NULL. The design point of the _optional() interfaces is that it makes the error handling unnecessary because we know the GPIO might be absent.
The pattern is also wrong in fsi-master-ast-cf and probably fsi-master-gpio.
Re: [PATCH linux dev-5.3 1/2] fsi: aspeed: Configure optional GPIOs
Quoted 54 lines · Andrew Jeffery
Quoted 35 lines · Joel Stanley
On Tacoma the enable and mux GPIOs allow the BMC to enable FSI and control if the clock and data should come from the BMC, or from the debug connector.
Configure these as optional GPIOs which will fail without error for systems that do not have these GPIOs in their device tree.
Signed-off-by Joel Stanley <[email protected]>--- drivers/fsi/fsi-master-aspeed.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/fsi/fsi-master-aspeed.c +4
-0@@ -14,6 +14,7 @@#include <linux/regmap.h> #include <linux/slab.h> #include <linux/iopoll.h> +#include <linux/gpio/consumer.h> #include "fsi-master.h" @@ -85,6 +86,9 @@ struct fsi_master_aspeed {void __iomem *base;struct clk *clk; +struct gpio_desc *gpio_enable; +struct gpio_desc *gpio_mux; +struct dentry *debugfs_dir;struct fsi_master_aspeed_debugfs_entry debugfs[FSI_NUM_DEBUGFS_ENTRIES ]; };drivers/fsi/fsi-master-aspeed.c DEFINE_DEBUGFS_ATTRIBUTE(fsi_master_aspeed_debugfs_ops, · line 484
Quoted 10 lines
drivers/fsi/fsi-master-aspeed.c +7
-0@@ -471,6 +475,30 @@ DEFINE_DEBUGFS_ATTRIBUTE(fsi_master_aspeed_debugfs_ops, fsi_master_aspeed_debugfs_get, fsi_master_aspeed_debugfs_set, "0x%08llx\n"); +static int aspeed_master_gpio_init (struct fsi_master_aspeed *master) +{ +struct device *dev = master->dev; +struct gpio_desc *gpio; + + gpio =devm_gpiod_get_optional (dev,"fsi-enable" ,0 ); +if (IS_ERR (gpio)) {
devm_gpiod_get_option()returns NULL if the GPIO isn't defined, and interfaces likegpiod_direction_output(...)return 0 if the descriptor is NULL. The design point of the_optional()interfaces is that it makes the error handling unnecessary because we know the GPIO might be absent.
Quoted 1 line
The pattern is also wrong in fsi-master-ast-cf and probably fsi-master-gpio.
Actually, disregard that, NULL is only returned for -ENOENT but there may be other errors. Sorry for the noise.
Joel Stanley
maintainerPATCH 2/2 ARM: dts: aspeed: tacoma: Add FSI mux and enable GPIOs
In reply to Joel StanleyOn Tacoma the enable and mux GPIOs allow the BMC to enable FSI and control if the clock and data should come from the BMC, or from the debug connector.
--- arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts +3 -0
@@ -142,6 +142,9 @@ &fsim0 { status = "okay"; + + fsi-mux-gpios = <&gpio0 ASPEED_GPIO(B, 0) GPIO_ACTIVE_HIGH>; // FSI_JMFG0_PRSNT_N + fsi-enable-gpios = <&gpio0 ASPEED_GPIO(B, 1) GPIO_ACTIVE_HIGH>; // BMC_FSI_IN_ENA }; &i2c0 {
Signature · 1 line
2.23.0
Re: [PATCH linux dev-5.3 2/2] ARM: dts: aspeed: tacoma: Add FSI mux and enable GPIOs
Quoted 5 lines · Joel Stanley
On Tacoma the enable and mux GPIOs allow the BMC to enable FSI and control if the clock and data should come from the BMC, or from the debug connector.
Signed-off-by Joel Stanley <[email protected]>