You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/17 04:18:56 UTC
[GitHub] [incubator-nuttx] lipan118 opened a new pull request #5523: dp83848c ethernet phy interrupt support
lipan118 opened a new pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523
## Summary
stm32 dp83848c ethernet phy interrupt support
## Impact
## Testing
stm32f407zg+dp83848c phy
interrupt enable
CONFIG_ETH0_PHY_DP83848C=y
CONFIG_STM32_RMII=y
CONFIG_STM32_AUTONEG=y
CONFIG_STM32_PHYADDR=1
CONFIG_STM32_PHYSR=16
CONFIG_STM32_PHYSR_100MBPS=0x0000
CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004
CONFIG_STM32_PHYSR_MODE=0x0004
CONFIG_STM32_PHYSR_SPEED=0x0002
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 edited a comment on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 edited a comment on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1061343686
> CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
>
> I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
>
> 7.2.1.3.1 Power Down and Interrupt The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR (0x11h) will configure the pin as an active low interrupt output.
>
> So this needs more configuration options to deconflict the setting.
7.2.1.3.1.2 Interrupt Mechanisms
The interrupt function is controlled through register access. All interrupt sources are disabled by default.
Setting bit 1 (INTEN) of MICR (0x11h) will enable interrupts to be output, dependent on the interrupt mask
set in the lower byte of the MISR (0x12h). The PWRDOWN_INT pin is asynchronously asserted low when
an interrupt condition occurs. The source of the interrupt can be determined by reading the upper byte of
the MISR. One or more bits in the MISR will be set, denoting all currently pending interrupts. Reading of
the MISR clears ALL pending interrupts.
Example: To generate an interrupt on a change of link status or on a change of energy detect power state,
the steps would be:
• Write 0003h to MICR to set INTEN and INT_OE
• Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
• Monitor PWRDOWN_INT pin
When PWRDOWN_INT pin asserts low, the user would read the MISR register to see if the ED_INT or
LINK_INT bits are set, for example, which source caused the interrupt. After reading the MISR, the
interrupt bits should clear and the PWRDOWN_INT pin will deassert.
1 • Write 0003h to MICR to set INTEN and INT_OE
`#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
`
2 • Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
`
# define MII_INT_REG MII_DP83848C_MISR
# define MII_INT_SETEN MII_DP83848C_LINK_INT_EN
# define MII_INT_CLREN 0
`
`
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
`
3 • Monitor PWRDOWN_INT pin
related to pin connection. if you do not wired to the soc with dp83848c interrupt ,you do not need monitor phy link status, This part of the code will not affect. because
`
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int stm32_phyintenable(struct stm32_ethmac_s *priv)
{
uint16_t phyval;
int ret;
ret = stm32_phyread(CONFIG_STM32_PHYADDR, MII_INT_REG, &phyval);
if (ret == OK)
{
/* Enable link up/down interrupts */
#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
}
return ret;
}
#endif
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 edited a comment on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 edited a comment on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1061343686
> CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
>
> I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
>
> 7.2.1.3.1 Power Down and Interrupt The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR (0x11h) will configure the pin as an active low interrupt output.
>
> So this needs more configuration options to deconflict the setting.
7.2.1.3.1.2 Interrupt Mechanisms
The interrupt function is controlled through register access. All interrupt sources are disabled by default.
Setting bit 1 (INTEN) of MICR (0x11h) will enable interrupts to be output, dependent on the interrupt mask
set in the lower byte of the MISR (0x12h). The PWRDOWN_INT pin is asynchronously asserted low when
an interrupt condition occurs. The source of the interrupt can be determined by reading the upper byte of
the MISR. One or more bits in the MISR will be set, denoting all currently pending interrupts. Reading of
the MISR clears ALL pending interrupts.
Example: To generate an interrupt on a change of link status or on a change of energy detect power state,
the steps would be:
• Write 0003h to MICR to set INTEN and INT_OE
• Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
• Monitor PWRDOWN_INT pin
When PWRDOWN_INT pin asserts low, the user would read the MISR register to see if the ED_INT or
LINK_INT bits are set, for example, which source caused the interrupt. After reading the MISR, the
interrupt bits should clear and the PWRDOWN_INT pin will deassert.
1 • Write 0003h to MICR to set INTEN and INT_OE
```
#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
```
2 • Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
```
# define MII_INT_REG MII_DP83848C_MISR
# define MII_INT_SETEN MII_DP83848C_LINK_INT_EN
# define MII_INT_CLREN 0
```
```
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
```
3 • Monitor PWRDOWN_INT pin
related to pin connection. if you do not wired to the soc with dp83848c interrupt ,you do not need monitor phy link status, This part of the code will not affect. because
```
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int stm32_phyintenable(struct stm32_ethmac_s *priv)
{
uint16_t phyval;
int ret;
ret = stm32_phyread(CONFIG_STM32_PHYADDR, MII_INT_REG, &phyval);
if (ret == OK)
{
/* Enable link up/down interrupts */
#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
}
return ret;
}
#endif
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] pkarashchenko commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1043437977
@lipan118 could you please answer @davids5 's question?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] pkarashchenko merged pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1061343686
> CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
>
> I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
>
> 7.2.1.3.1 Power Down and Interrupt The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR (0x11h) will configure the pin as an active low interrupt output.
>
> So this needs more configuration options to deconflict the setting.
7.2.1.3.1.2 Interrupt Mechanisms
The interrupt function is controlled through register access. All interrupt sources are disabled by default.
Setting bit 1 (INTEN) of MICR (0x11h) will enable interrupts to be output, dependent on the interrupt mask
set in the lower byte of the MISR (0x12h). The PWRDOWN_INT pin is asynchronously asserted low when
an interrupt condition occurs. The source of the interrupt can be determined by reading the upper byte of
the MISR. One or more bits in the MISR will be set, denoting all currently pending interrupts. Reading of
the MISR clears ALL pending interrupts.
Example: To generate an interrupt on a change of link status or on a change of energy detect power state,
the steps would be:
• Write 0003h to MICR to set INTEN and INT_OE
• Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
• Monitor PWRDOWN_INT pin
When PWRDOWN_INT pin asserts low, the user would read the MISR register to see if the ED_INT or
LINK_INT bits are set, for example, which source caused the interrupt. After reading the MISR, the
interrupt bits should clear and the PWRDOWN_INT pin will deassert.
1 • Write 0003h to MICR to set INTEN and INT_OE
`#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
`
2 • Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
`
# define MII_INT_REG MII_DP83848C_MISR
# define MII_INT_SETEN MII_DP83848C_LINK_INT_EN
# define MII_INT_CLREN 0
`
`
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
`
3 • Monitor PWRDOWN_INT pin
related to pin connection. if you do not wired to the soc with dp83848c interrupt ,you do not need monitor phy link status, This part of the code will not affect. because
`
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int stm32_phyintenable(struct stm32_ethmac_s *priv)
{
uint16_t phyval;
int ret;
ret = stm32_phyread(CONFIG_STM32_PHYADDR, MII_INT_REG, &phyval);
if (ret == OK)
{
/* Enable link up/down interrupts */
#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
}
return ret;
}
#endif
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1043020643
Should this be a board level setting based on the wiring?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1058139741
CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
7.2.1.3.1 Power Down and Interrupt
The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin
functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR
(0x11h) will configure the pin as an active low interrupt output.
So this need more configuration options to deconflict the setting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1061932863
@lipan118 - Thank you - While looking at only the diff, I missed the #if.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 edited a comment on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
davids5 edited a comment on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1058139741
CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
7.2.1.3.1 Power Down and Interrupt
The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin
functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR
(0x11h) will configure the pin as an active low interrupt output.
So this needs more configuration options to deconflict the setting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 edited a comment on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 edited a comment on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1062638907
@davids5 my pleasure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1054190173
> Should this be a board level setting based on the wiring?
Not specific to stm32 board based on the wiring. but If you want to use the dp83848 phy to implement netmonitor,you must specify GPIO_EMAC_NINT pin needed in stm32_netinitialize function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 commented on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 commented on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1062638907
@davids5-my pleasure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] lipan118 edited a comment on pull request #5523: dp83848c ethernet phy interrupt support
Posted by GitBox <gi...@apache.org>.
lipan118 edited a comment on pull request #5523:
URL: https://github.com/apache/incubator-nuttx/pull/5523#issuecomment-1061343686
> CONFIG_ETH0_PHY_DP83848C=y now implies the pin is wired to the SoC as an interrupt, whenever the DP83848C PHY is used. This may not be the case, hence the comment about it being a board config related setting.
>
> I would imagine if the PHY interrupt pin is not wired to the SoC it would not be an issue for it to be configured unless this pin can be used for something else and it is:
>
> 7.2.1.3.1 Power Down and Interrupt The Power Down and Interrupt functions are multiplexed on pin 7 of the device. By default, this pin functions as a power-down input and the interrupt function is disabled. Setting bit 0 (INT_OE) of MICR (0x11h) will configure the pin as an active low interrupt output.
>
> So this needs more configuration options to deconflict the setting.
7.2.1.3.1.2 Interrupt Mechanisms
The interrupt function is controlled through register access. All interrupt sources are disabled by default.
Setting bit 1 (INTEN) of MICR (0x11h) will enable interrupts to be output, dependent on the interrupt mask
set in the lower byte of the MISR (0x12h). The PWRDOWN_INT pin is asynchronously asserted low when
an interrupt condition occurs. The source of the interrupt can be determined by reading the upper byte of
the MISR. One or more bits in the MISR will be set, denoting all currently pending interrupts. Reading of
the MISR clears ALL pending interrupts.
Example: To generate an interrupt on a change of link status or on a change of energy detect power state,
the steps would be:
• Write 0003h to MICR to set INTEN and INT_OE
• Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
• Monitor PWRDOWN_INT pin
When PWRDOWN_INT pin asserts low, the user would read the MISR register to see if the ED_INT or
LINK_INT bits are set, for example, which source caused the interrupt. After reading the MISR, the
interrupt bits should clear and the PWRDOWN_INT pin will deassert.
1 • Write 0003h to MICR to set INTEN and INT_OE
`#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
`
2 • Write 0060h to MISR to set ED_INT_EN and LINK_INT_EN
`
# define MII_INT_REG MII_DP83848C_MISR
# define MII_INT_SETEN MII_DP83848C_LINK_INT_EN
# define MII_INT_CLREN 0
`
`
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
`
3 • Monitor PWRDOWN_INT pin
related to pin connection. if you do not wired to the soc with dp83848c interrupt ,you do not need monitor phy link status, This part of the code will not affect. because
`#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
static int stm32_phyintenable(struct stm32_ethmac_s *priv)
{
uint16_t phyval;
int ret;
ret = stm32_phyread(CONFIG_STM32_PHYADDR, MII_INT_REG, &phyval);
if (ret == OK)
{
/* Enable link up/down interrupts */
#ifdef CONFIG_ETH0_PHY_DP83848C
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_DP83848C_MICR,
MII_DP83848C_INT_EN | MII_DP83848C_INT_OEN);
#endif
ret = stm32_phywrite(CONFIG_STM32_PHYADDR, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
}
return ret;
}
#endif`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org