forked from immortalwrt/immortalwrt
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
realtek: Add pinctrl support for RTL8231
Add pending patches to add RTL8231 support as a MDIO-bus attached multi-functional device. This includes subdrivers for the pincontrol and GPIO features, as well as the LED matrix support. Leave the drivers disabled until required by a device. Signed-off-by: Sander Vanheule <[email protected]>
- Loading branch information
Showing
9 changed files
with
1,335 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
target/linux/realtek/patches-6.6/800-gpio-regmap-Bypass-cache-for-shadowed-outputs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From b3f79468c90d8770f007d628a1e32b2d5d44a5c2 Mon Sep 17 00:00:00 2001 | ||
From: Sander Vanheule <[email protected]> | ||
Date: Sat, 15 May 2021 11:57:32 +0200 | ||
Subject: [PATCH] gpio: regmap: Bypass cache for shadowed outputs | ||
|
||
Some chips have the read-only input and write-only output data registers | ||
aliased to the same offset, but do not perform direction multiplexing on | ||
writes. Upon writing the register, this then always updates the output | ||
value, even when the pin is configured as input. As a result it is not | ||
safe to perform read-modify-writes on output pins, when other pins are | ||
still configured as input. | ||
|
||
For example, on a bit-banged I2C bus, where the lines are switched | ||
between out-low and in (with external pull-up) | ||
|
||
OUT(L) IN OUT(H) | ||
SCK ....../''''''|'''''' | ||
|
||
SDA '''''''''\.......... | ||
^ ^- SCK switches to direction to OUT, but now has a high | ||
| value, breaking the clock. | ||
| | ||
\- Perform RMW to update SDA. This reads the current input | ||
value for SCK, updates the SDA value and writes back a 1 | ||
for SCK as well. | ||
|
||
If a register is used for both the data input and data output (and is | ||
not marked as volatile) the driver should ensure the cache is not | ||
updated on register reads. This ensures proper functioning of writing | ||
the output register with regmap_update_bits(), which will then use and | ||
update the cache only on register writes. | ||
|
||
Signed-off-by: Sander Vanheule <[email protected]> | ||
--- | ||
drivers/gpio/gpio-regmap.c | 10 +++++++++- | ||
1 file changed, 9 insertions(+), 1 deletion(-) | ||
|
||
--- a/drivers/gpio/gpio-regmap.c | ||
+++ b/drivers/gpio/gpio-regmap.c | ||
@@ -74,7 +74,15 @@ static int gpio_regmap_get(struct gpio_c | ||
if (ret) | ||
return ret; | ||
|
||
- ret = regmap_read(gpio->regmap, reg, &val); | ||
+ /* | ||
+ * Ensure we don't spoil the register cache with pin input values and | ||
+ * perform a bypassed read. This way the cache (if any) is only used and | ||
+ * updated on register writes. | ||
+ */ | ||
+ if (gpio->reg_dat_base == gpio->reg_set_base) | ||
+ ret = regmap_read_bypassed(gpio->regmap, reg, &val); | ||
+ else | ||
+ ret = regmap_read(gpio->regmap, reg, &val); | ||
if (ret) | ||
return ret; | ||
|
26 changes: 26 additions & 0 deletions
26
target/linux/realtek/patches-6.6/801-gpio-regmap-Use-generic-request-free-ops.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From f21b15dfe254b51f80c552750eb20b1dc752507a Mon Sep 17 00:00:00 2001 | ||
From: Sander Vanheule <[email protected]> | ||
Date: Mon, 30 Dec 2024 17:59:24 +0100 | ||
Subject: [PATCH] gpio: regmap: Use generic request/free ops | ||
|
||
Set the gpiochip request and free ops to the generic implementations. | ||
This way a user can provide a gpio-ranges property defined for a pinmux, | ||
allowing pins to automatically be muxed to their GPIO function when | ||
requested. | ||
|
||
Signed-off-by: Sander Vanheule <[email protected]> | ||
--- | ||
drivers/gpio/gpio-regmap.c | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
--- a/drivers/gpio/gpio-regmap.c | ||
+++ b/drivers/gpio/gpio-regmap.c | ||
@@ -270,6 +270,8 @@ struct gpio_regmap *gpio_regmap_register | ||
chip->label = config->label ?: dev_name(config->parent); | ||
chip->can_sleep = regmap_might_sleep(config->regmap); | ||
|
||
+ chip->request = gpiochip_generic_request; | ||
+ chip->free = gpiochip_generic_free; | ||
chip->get = gpio_regmap_get; | ||
if (gpio->reg_set_base && gpio->reg_clr_base) | ||
chip->set = gpio_regmap_set_with_clear; |
Oops, something went wrong.