linux-imx: Add P3H2840 GPIO controller support for SE051 NFC mode#1
Open
bperseghetti wants to merge 3 commits intolf-6.12.20-2.0.0-walnascar-navq95from
Open
linux-imx: Add P3H2840 GPIO controller support for SE051 NFC mode#1bperseghetti wants to merge 3 commits intolf-6.12.20-2.0.0-walnascar-navq95from
bperseghetti wants to merge 3 commits intolf-6.12.20-2.0.0-walnascar-navq95from
Conversation
Add kernel patches to enable GPIO control of SE051C2 secure element power for NFC energy harvesting mode on NavQ95. Changes: - 0007: Add gpio_chip support to P3H2840 I3C hub driver - Exposes target port SCL/SDA pins as GPIO lines - GPIO 0-7 = SCL (TP0-TP7), GPIO 8-15 = SDA (TP0-TP7) - 0008: Configure TP0 as GPIO mode in imx95-navqb device tree - SE_ENABLE signal connected to TP0 SDA (GPIO 8) - Pull low to enable NFC energy harvesting mode Usage: gpioset p3h2x4x-gpio 8=0 # Enable NFC mode gpioset p3h2x4x-gpio 8=1 # Enable I2C mode Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
343b15f to
a5bc6a2
Compare
Add kernel patch to enable I2C bus recovery for the P3H2840 I3C hub. This implements the standard 9-SCL-pulse bus clear procedure as documented in the P3H2840 datasheet section 8.2.4. The SE051C2 secure element can leave SDA stuck LOW when switching between NFC and I2C modes during active NFC communication. This recovery mechanism allows userspace to clear the stuck bus via sysfs. Changes: - 0009: Add bus recovery functions and sysfs interface - p3h2x4x_tp_check_bus_stuck(): Check SCL/SDA status - p3h2x4x_tp_bus_recover(): Perform 9-SCL-pulse recovery - /sys/devices/.../bus_status_tpN: Read bus status - /sys/devices/.../bus_recover_tpN: Trigger recovery Usage: cat /sys/devices/.../bus_status_tp5 echo 1 > /sys/devices/.../bus_recover_tp5 Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
The 0008 patch incorrectly changed TP0 from smbus to gpio mode, assuming SE_ENABLE was on GPIO 8 (TP0 SDA). However, SE_ENABLE is actually connected to GPIO line 2 (TP2 SCL), and TP2 was already configured as GPIO mode in the upstream DTS. This patch was unnecessary and may have caused interference with devices that were using TP0 for SMBus communication. Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
| + * | ||
| + * Return: 1 if SDA is stuck LOW, 0 if bus is OK, negative on error | ||
| + */ | ||
| +int p3h2x4x_tp_check_bus_stuck(struct p3h2x4x_i3c_hub_dev *hub, int tp) |
Member
There was a problem hiding this comment.
@bperseghetti could you use the Linux build-in recovery api instead?
https://github.com/torvalds/linux/blob/fcb70a56f4d81450114034b2c61f48ce7444a0e2/include/linux/i2c.h#L655
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add kernel patches to enable GPIO control of SE051C2 secure element power for NFC energy harvesting mode on NavQ95.
Changes:
Usage:
gpioset p3h2x4x-gpio 8=0 # Enable NFC mode
gpioset p3h2x4x-gpio 8=1 # Enable I2C mode