-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boards: stm: arduino_portenta_h7: support onboard ethernet + pf1550 driver #76542
Conversation
Hello @facchinm, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, check your compliance error as well (you can also run them locally ./scripts/ci/check_compliance.py -c ...
, also the commits need al la description and signed-off-by
drivers/charger/charger_pf1550.c
Outdated
enum { | ||
PF1550_CHARGER_OFF_LINEAR_OFF, | ||
PF1550_CHARGER_OFF_LINEAR_ON, | ||
PF1550_CHARGER_ON_LINEAR_ON, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use a define for PF1550_CHARGER_ON_LINEAR_ON
outside of here?
drivers/regulator/Kconfig.pf1550
Outdated
config REGULATOR_NXP_PF1550_INIT_PRIORITY | ||
int "PF1550 regulator driver init priority" | ||
default 87 | ||
help | ||
Init priority for the NXP PF1550 regulator driver. It must be | ||
greater than REGULATOR_NXP_PF1550_COMMON_INIT_PRIORITY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use the same priority value on all devices they should all get sequence correctly thanks to the subpriority value, want to try that? may get rid of few symbols, I would keep the MFD one for all of them
@facchinm, just a helpful tip, quite a few of the indentation and line wrapping issues can be fixed with a |
63caebe
to
35f5779
Compare
35f5779
to
af73bba
Compare
constant-charge-current-max-microamp: | ||
required: true | ||
type: int | ||
|
||
vbus-current-limit-microamp: | ||
type: int | ||
required: true | ||
|
||
constant-charge-voltage-max-microvolt: | ||
type: int | ||
required: true | ||
|
||
system-voltage-min-threshold-microvolt: | ||
type: int | ||
required: true | ||
enum: | ||
- 3500000 | ||
- 3700000 | ||
- 4300000 | ||
description: | | ||
System voltage minimum threshold. | ||
|
||
thermistor-monitoring-mode: | ||
type: string | ||
required: true | ||
enum: | ||
- "disabled" | ||
- "thermistor" | ||
- "JEITA-1" | ||
- "JEITA-2" | ||
description: | | ||
Thermistor monitoring mode. | ||
Refer to ThrmCfg register description and Table 2 for details. | ||
|
||
int-gpios: | ||
type: phandle-array | ||
required: true | ||
description: Interrupt pin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, prefix vendor specific properties, eg nxp,prop-name
.
boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig
Outdated
Show resolved
Hide resolved
boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig
Outdated
Show resolved
Hide resolved
boards/arduino/portenta_h7/arduino_portenta_h7_stm32h747xx_m7_defconfig
Outdated
Show resolved
Hide resolved
config REGULATOR | ||
default y if NETWORKING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks wrong: device driver relying on regulator to be used should select this option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this? If I understand correctly, the proposal would be to move the explicit configuration to a regulator
field for the ethernet phy in the board dts, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Networking does not directly depend on regulators, but some device driver. This driver should be the one selecting regulator enablement. The reality though is that regulator usage is nowadays not great, we have no infrastructure for automatically turning them on/off on a device level. So maybe the defconfig should be linked to the device itself, at least future refactors will be easier to spot what's going on.
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
af73bba
to
ec86154
Compare
@gmarull concerns have been addressed, please revisit your -1. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few minor nits, otherwise lgtm
# Enable charger | ||
CONFIG_CHARGER=y | ||
|
||
# Enable USB Stack | ||
CONFIG_USB_DEVICE_STACK=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boards need to enable the minimum, e.g. to run hello world, is charger/usb stack needed there? If not, drop
@@ -9,6 +9,7 @@ | |||
#include <st/h7/stm32h747xihx-pinctrl.dtsi> | |||
#include "arduino_portenta_h7-common.dtsi" | |||
#include <../boards/common/usb/cdc_acm_serial.dtsi> | |||
#include <dt-bindings/charger/pf1550.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <dt-bindings/charger/pf1550.h> | |
#include <zephyr/dt-bindings/charger/pf1550.h> |
# The following macros are available: | ||
# - LED_ON_IN_CHARGING_FLASH_IN_FAULT | ||
# - LED_FLASH_IN_CHARGING_ON_IN_FAULT | ||
# - LED_MANUAL_OFF | ||
pf1550,led-behaviour: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should likely be a string property, see e.g. how nPM1300 LED behavior is specified. You can later use DT_ENUM_IDX helpers to get a number.
e3b0d2e
4e4ebc0
to
e3b0d2e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just needs the compliance fix to get my +1 again :)
- on_in_charging_flash_in_fault | ||
- flash_in_charging_on_in_fault | ||
- manual_off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need to be indented another level to satisfy the compliance checks and have a valid dt-binding.
Additionally these strings should be in quotes as is done for the pf1550,thermistor-monitoring-mode
string enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads-up, updated (with quotes for good measure 🙂)
e3b0d2e
to
f7e2227
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
@gmarull please revisit your -1, thanks! |
- "on_in_charging_flash_in_fault" | ||
- "flash_in_charging_on_in_fault" | ||
- "manual_off" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "on_in_charging_flash_in_fault" | |
- "flash_in_charging_on_in_fault" | |
- "manual_off" | |
- "on-in-charging-flash-in-fault" | |
- "flash-in-charging-on-in-fault" | |
- "manual-off" |
Add driver for nxp pf1550 PMIC Signed-off-by: Martino Facchin <[email protected]>
Enable PF1550 PMIC for Arduino Portenta H7 Signed-off-by: Martino Facchin <[email protected]>
On older Portenta H7, 1V2 power rail must be enabled to get a functional ethernet phy. Signed-off-by: Martino Facchin <[email protected]>
Selecting the wrong power scheme could potentially destroy the board. Luckily, the bit can only be set once and the default build still uses the Arduino bootloader (which has the correct setting). Signed-off-by: Martino Facchin <[email protected]>
b281743
f7e2227
to
b281743
Compare
This PR adds support for the onboard ethernet phy on Arduino Portenta H7.
To properly provide the 1V2 rail for the PHY, I also implemented a driver for the PF1550 PMIC (nice side effect 🙂 ).
The driver is feature complete for our factory OTP programming on the A0 variant. Other variants are untested (the only difference would be BUCK1/2 voltage ranges)
On the charger side, I'd need some guidance on how to expose the led configuration via device tree (at the moment it's hardcoded in the init function