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: <20221214102707.60018-1-hhhawa@amazon.com>
Date:   Wed, 14 Dec 2022 10:27:07 +0000
From:   Hanna Hawa <hhhawa@...zon.com>
To:     <jarkko.nikula@...ux.intel.com>,
        <andriy.shevchenko@...ux.intel.com>,
        <mika.westerberg@...ux.intel.com>, <jsd@...ihalf.com>
CC:     <linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <dwmw@...zon.co.uk>, <benh@...zon.com>, <ronenk@...zon.com>,
        <talel@...zon.com>, <jonnyc@...zon.com>, <hanochu@...zon.com>,
        <farbere@...zon.com>, <itamark@...zon.com>, <hhhawa@...zon.com>
Subject: [PATCH 1/1] i2c: designware: add pinctrl for recovery info as an option

The current implementation of designware recovery mechanism fit for
specific device (Intel / Altera Cyclone V SOC) which have two separated
"wired" GPIOs to the i2c bus via the SOC FPGA for the i2c recovery.

This change add ability to get the pinctrl for the i2c recovery in order
to switch between pin configuration (I2C and GPIO functionality) if the
pinctrl exists.

Signed-off-by: Hanna Hawa <hhhawa@...zon.com>
---
 drivers/i2c/busses/i2c-designware-master.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index dc3c5a15a95b..478318b1d35f 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -17,6 +17,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
@@ -832,6 +833,14 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
 	struct i2c_adapter *adap = &dev->adapter;
 	struct gpio_desc *gpio;
 
+	rinfo->pinctrl = devm_pinctrl_get(dev->dev);
+	if (IS_ERR(rinfo->pinctrl)) {
+		if (PTR_ERR(rinfo->pinctrl) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		rinfo->pinctrl = NULL;
+		dev_dbg(dev->dev, "can't get pinctrl for i2c recovery\n");
+	}
+
 	gpio = devm_gpiod_get_optional(dev->dev, "scl", GPIOD_OUT_HIGH);
 	if (IS_ERR_OR_NULL(gpio))
 		return PTR_ERR_OR_ZERO(gpio);
-- 
2.38.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ