Should I use this as a starting point for pinctrl?
I didn't even have success with pinctrl; I forgot to check the other GPLs with Econet/Airoha
https://sirherobrine23.com.br/tplink_gpl/tplink-xx530v_v2/src/commit/343249db3372d677fb37a7365a3c2794f303ba51/sdk/an7551/openwrt-21.02/openwrt-21.02.1_dev/linux-5.4.55/arch/arm/boot/dts/en7523.dts#L17-L20
https://sirherobrine23.com.br/tplink_gpl/tplink-xx530v_v2/src/commit/343249db3372d677fb37a7365a3c2794f303ba51/sdk/an7551/openwrt-21.02/openwrt-21.02.1_dev/linux-5.4.55/arch/arm/mach-econet/ecnt_gpio.c#L76-L108
I think I left to many blanks to fill in with regards to the pinctrl.
So first, the current gpio driver needs to be removed from the dts. The pinctrl provide gpio support. There is a register offset between the AN7581 and EN7523, thus the following defines are need and references into them:
My initial idea was to somehow keep it as an external object. But I think we should just go with a patch to the original driver and bloat it and see what they say. I do have a pinctrl driver for EN751221 also.
I think I left to many blanks to fill in with regards to the pinctrl.
So first, the current gpio driver needs to be removed from the dts. The pinctrl provide gpio support. There is a register offset between the AN7581 and EN7523, thus the following defines are need and references into them:
```
/* MUX */
#define EN7523_REG_GPIO_2ND_I2C_MODE 0x0210
#define EN7523_REG_GPIO_SPI_CS1_MODE 0x0214
#define EN7523_REG_GPIO_PON_MODE 0x0218
#define EN7523_REG_NPU_UART_EN 0x0220
#define NPU_UART_MODE_MASK BIT(2)
/* CONF */
/* REG_I2C_SDA_PU */
#define EN7523_SPI_MISO_PU_MASK BIT(13)
#define EN7523_SPI_MOSI_PU_MASK BIT(12)
#define EN7523_SPI_CLK_PU_MASK BIT(11)
#define EN7523_SPI_CS0_PU_MASK BIT(10)
/* REG_I2C_SDA_PD */
#define EN7523_SPI_MISO_PD_MASK BIT(13)
#define EN7523_SPI_MOSI_PD_MASK BIT(12)
#define EN7523_SPI_CLK_PD_MASK BIT(11)
#define EN7523_SPI_CS0_PD_MASK BIT(10)
/* REG_I2C_SDA_E2 */
#define EN7523_SPI_MISO_E2_MASK BIT(13)
#define EN7523_SPI_MOSI_E2_MASK BIT(12)
#define EN7523_SPI_CLK_E2_MASK BIT(11)
#define EN7523_SPI_CS0_E2_MASK BIT(10)
/* REG_I2C_SDA_E4 */
#define EN7523_SPI_MISO_E4_MASK BIT(13)
#define EN7523_SPI_MOSI_E4_MASK BIT(12)
#define EN7523_SPI_CLK_E4_MASK BIT(11)
#define EN7523_SPI_CS0_E4_MASK BIT(10)
/* LED MAP */
#define EN7523_REG_LAN_LED0_MAPPING 0x0278
#define EN7523_REG_LAN_LED1_MAPPING 0x027c
```
My initial idea was to somehow keep it as an external object. But I think we should just go with a patch to the original driver and bloat it and see what they say. I do have a pinctrl driver for EN751221 also.
Are you still getting crashes with the pinctrl driver? If so it could be related to the interrupt handling.
So I have to restart the device three times before it stabilizes, after which it works normally
The shape of the code looks really good. Do you want to send a RFC to the mediatek linux mailing list ?
It's not ready yet, but apart from en7523, the rest is okay
> Are you still getting crashes with the pinctrl driver? If so it could be related to the interrupt handling.
So I have to restart the device three times before it stabilizes, after which it works normally
> The shape of the code looks really good. Do you want to send a RFC to the mediatek linux mailing list ?
It's not ready yet, but apart from en7523, the rest is okay
Are you still getting crashes with the pinctrl driver? If so it could be related to the interrupt handling.
So I have to restart the device three times before it stabilizes, after which it works normally
I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
The shape of the code looks really good. Do you want to send a RFC to the mediatek linux mailing list ?
It's not ready yet, but apart from en7523, the rest is okay
ok, anyway I really liked how it turned out, it should be easy for kernel devs to review and come with concrete opinions on how the final form should look like.
In theory I think you should be able to ifdef the includes so you can select the platforms you want and get rid of some tables if you want to slim down the driver.
> > Are you still getting crashes with the pinctrl driver? If so it could be related to the interrupt handling.
>
> So I have to restart the device three times before it stabilizes, after which it works normally
I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
>
> > The shape of the code looks really good. Do you want to send a RFC to the mediatek linux mailing list ?
>
> It's not ready yet, but apart from en7523, the rest is okay
ok, anyway I really liked how it turned out, it should be easy for kernel devs to review and come with concrete opinions on how the final form should look like.
In theory I think you should be able to ifdef the includes so you can select the platforms you want and get rid of some tables if you want to slim down the driver.
I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
I disabled the NPU and pinctrl is working fine. Now I need to see what is causing this. It always happens when the NPU configures the CPU cores
> I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
I disabled the NPU and pinctrl is working fine. Now I need to see what is causing this. It always happens when the NPU configures the CPU cores
I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
I disabled the NPU and pinctrl is working fine. Now I need to see what is causing this. It always happens when the NPU configures the CPU cores
So the SDK npu binaries have pcie and wifi card specifics in them so I'm not that hopeful that it ever will be possible to use them for wifi acceleration, one might need the same pcie and wifi driver. The WOE looks like a much better target. The NPUs should be possible to use for VXLAN and GRE acceleration though as that is NPU internal and might end up in the AN7581 npu code.
> > I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
>
> I disabled the NPU and pinctrl is working fine. Now I need to see what is causing this. It always happens when the NPU configures the CPU cores
So the SDK npu binaries have pcie and wifi card specifics in them so I'm not that hopeful that it ever will be possible to use them for wifi acceleration, one might need the same pcie and wifi driver. The WOE looks like a much better target. The NPUs should be possible to use for VXLAN and GRE acceleration though as that is NPU internal and might end up in the AN7581 npu code.
Sirherobrine23
locked and limited conversation to collaborators 2026-05-16 14:37:41 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
We need a pinctrl driver. In the attached file we have the definitions.
airoha-en7523-pinctrl.patch
This is a patch that I think you sent at some point for one people
The question is how it should be integrated. We need the code and logic from the existing (pinctrl-airoha.c) driver.
The old driver code is not as complete as the new kernel code. The new code has gpio and gpio interrupts.
Should I use this as a starting point for pinctrl?
I didn't even have success with pinctrl; I forgot to check the other GPLs with Econet/Airoha
I think I left to many blanks to fill in with regards to the pinctrl.
So first, the current gpio driver needs to be removed from the dts. The pinctrl provide gpio support. There is a register offset between the AN7581 and EN7523, thus the following defines are need and references into them:
My initial idea was to somehow keep it as an external object. But I think we should just go with a patch to the original driver and bloat it and see what they say. I do have a pinctrl driver for EN751221 also.
I'm having trouble with pinctrl, my router is rebooting every time it tries to change the LED state
Are you still getting crashes with the pinctrl driver? If so it could be related to the interrupt handling.
The shape of the code looks really good. Do you want to send a RFC to the mediatek linux mailing list ?
So I have to restart the device three times before it stabilizes, after which it works normally
It's not ready yet, but apart from en7523, the rest is okay
I am not 100% sure the pinctrl driver is to blame. It could be npu driver. I am quite sure you need to follow the SDK memory reservation for the npu and not an7581 mainline. The npus have access to the memory also and might mess with it. We've had npu issues before and had to memset the npu memory to make sure things worked.
ok, anyway I really liked how it turned out, it should be easy for kernel devs to review and come with concrete opinions on how the final form should look like.
In theory I think you should be able to ifdef the includes so you can select the platforms you want and get rid of some tables if you want to slim down the driver.
I disabled the NPU and pinctrl is working fine. Now I need to see what is causing this. It always happens when the NPU configures the CPU cores
So the SDK npu binaries have pcie and wifi card specifics in them so I'm not that hopeful that it ever will be possible to use them for wifi acceleration, one might need the same pcie and wifi driver. The WOE looks like a much better target. The NPUs should be possible to use for VXLAN and GRE acceleration though as that is NPU internal and might end up in the AN7581 npu code.