在线时间4067 小时
UID3441752
注册时间2017-11-21
NXP金币759444
TA的每日心情 | 开心 2024-3-26 15:16 |
---|
签到天数: 266 天 [LV.8]以坛为家I
管理员
- 积分
- 32017
- 最后登录
- 2024-4-9
|
发表于 2022-4-22 14:16:31
|
显示全部楼层
参照lx2160的步骤 做参考:
The usage of external IRQ is same as other IP's irq, normally you need:
1) enable IRQ pin function in RCW, bit 402:410
2) Add interrupt related description in dts node
3) map hwirq to Linux irq
4) request irq in device driver.
For LX2ARDB, you can take 10G (DPMAC3) copper PHY interrupt as an example, the PHY of 10G Copper port (DPMAC3) connected with External IRQ3,
1) RCW
IRQ3 is enabled by default in RCW from LSDK
2) dts.
&emdio1 {
aquantia_phy1: ethernet-phy@4 {
interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
reg = <0x4>;
};
Please be aware that the irq in dts is calculated as : irq = hwirq - 32. For this example, the PHY of 10G Copper port (DPMAC3) connected with External IRQ3,
According to chapter <interrupt assignment > of LX2RM, the hwirq num of IRQ3 is 34, so in dts file it should be 34 - 32 = 2.
3) map hwirq to Linux IRQ
You can reference the following code to map hwirq to a Linux IRQ num : xgmac_mdio_probe->of_mdiobus_register->of_mdiobus_register_phy->fwnode_mdiobus_phy_device_register->fwnode_irq_get->of_irq_get
4) request irq in driver
void phy_request_interrupt(struct phy_device *phydev)
{
int err;
err = request_threaded_irq(phydev->irq, NULL, phy_interrupt,
IRQF_ONESHOT | IRQF_SHARED,
phydev_name(phydev), phydev);
...
}
5) testing log
# cat /porc/interrupt
...
122: 6 0 0 0 GICv3 34 Level 0x0000000008b96000:04
123: 6 0 0 0 GICv3 35 Level 0x0000000008b96000:05
|
|