lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210716221744.5445-1-robert.marko@sartura.hr>
Date:   Sat, 17 Jul 2021 00:17:43 +0200
From:   Robert Marko <robert.marko@...tura.hr>
To:     linus.walleij@...aro.org, bgolaszewski@...libre.com,
        robh+dt@...nel.org, linux-gpio@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     luka.perkov@...tura.hr, Robert Marko <robert.marko@...tura.hr>
Subject: [PATCH 1/2] gpio: tn48m: Add support for Delta TN4810M CPLD

Delta TN4810M uses a similar CPLD GPIO expander
like the TN48M, but it has pins for 48 SFP+ ports,
making a total of 192 pins.
It also provides the TX fault pins which the TN48M
does not.

Only TX disable pins like on the TN48M are output
ones.

Thankfully, regmap GPIO allows for the driver to be
easily extended to support the TN4810M.

Note that this patch depends on the following series:
https://patchwork.ozlabs.org/project/linux-gpio/list/?series=247538

Signed-off-by: Robert Marko <robert.marko@...tura.hr>
---
 drivers/gpio/gpio-tn48m.c | 56 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-tn48m.c b/drivers/gpio/gpio-tn48m.c
index b12a6b4bc4b3..e429e7ade941 100644
--- a/drivers/gpio/gpio-tn48m.c
+++ b/drivers/gpio/gpio-tn48m.c
@@ -19,6 +19,10 @@ enum tn48m_gpio_type {
 	TN48M_SFP_TX_DISABLE = 1,
 	TN48M_SFP_PRESENT,
 	TN48M_SFP_LOS,
+	TN4810M_SFP_TX_DISABLE,
+	TN4810M_SFP_TX_FAULT,
+	TN4810M_SFP_PRESENT,
+	TN4810M_SFP_LOS,
 };
 
 static int tn48m_gpio_probe(struct platform_device *pdev)
@@ -46,17 +50,36 @@ static int tn48m_gpio_probe(struct platform_device *pdev)
 
 	config.regmap = regmap;
 	config.parent = &pdev->dev;
-	config.ngpio = 4;
+	config.ngpio_per_reg = 8;
 
 	switch (type) {
 	case TN48M_SFP_TX_DISABLE:
 		config.reg_set_base = base;
+		config.ngpio = 4;
 		break;
 	case TN48M_SFP_PRESENT:
 		config.reg_dat_base = base;
+		config.ngpio = 4;
 		break;
 	case TN48M_SFP_LOS:
 		config.reg_dat_base = base;
+		config.ngpio = 4;
+		break;
+	case TN4810M_SFP_TX_DISABLE:
+		config.reg_set_base = base;
+		config.ngpio = 48;
+		break;
+	case TN4810M_SFP_TX_FAULT:
+		config.reg_dat_base = base;
+		config.ngpio = 48;
+		break;
+	case TN4810M_SFP_PRESENT:
+		config.reg_dat_base = base;
+		config.ngpio = 48;
+		break;
+	case TN4810M_SFP_LOS:
+		config.reg_dat_base = base;
+		config.ngpio = 48;
 		break;
 	default:
 		dev_err(&pdev->dev, "unknown type %d\n", type);
@@ -67,9 +90,34 @@ static int tn48m_gpio_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id tn48m_gpio_of_match[] = {
-	{ .compatible = "delta,tn48m-gpio-sfp-tx-disable", .data = (void *)TN48M_SFP_TX_DISABLE },
-	{ .compatible = "delta,tn48m-gpio-sfp-present", .data = (void *)TN48M_SFP_PRESENT },
-	{ .compatible = "delta,tn48m-gpio-sfp-los", .data = (void *)TN48M_SFP_LOS },
+	{
+		.compatible = "delta,tn48m-gpio-sfp-tx-disable",
+		.data = (void *)TN48M_SFP_TX_DISABLE
+	},
+	{
+		.compatible = "delta,tn48m-gpio-sfp-present",
+		.data = (void *)TN48M_SFP_PRESENT
+	},
+	{
+		.compatible = "delta,tn48m-gpio-sfp-los",
+		.data = (void *)TN48M_SFP_LOS
+	},
+	{
+		.compatible = "delta,tn4810m-gpio-sfp-tx-disable",
+		.data = (void *)TN4810M_SFP_TX_DISABLE
+	},
+	{
+		.compatible = "delta,tn4810m-gpio-sfp-tx-fault",
+		.data = (void *)TN4810M_SFP_TX_FAULT
+	},
+	{
+		.compatible = "delta,tn4810m-gpio-sfp-present",
+		.data = (void *)TN4810M_SFP_PRESENT
+	},
+	{
+		.compatible = "delta,tn4810m-gpio-sfp-los",
+		.data = (void *)TN4810M_SFP_LOS
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, tn48m_gpio_of_match);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ