diff options
author | Sebastian Reichel | 2021-04-23 16:15:07 +0200 |
---|---|---|
committer | Stefano Babic | 2021-05-02 12:46:54 +0200 |
commit | 512bda95ed08dee32853f55983caacf939ae7bd5 (patch) | |
tree | 3ab68bcafec776321eaba18fedae464d743e119c /board/ge/bx50v3/bx50v3.c | |
parent | bd9059c477e5eafbad08ef24923222a191bc98a0 (diff) |
board: ge: bx50v3: fix crystal bit
The DA9063 enables the CRYSTAL bit by default, but there is no
crystal populated on the BA16 system on module. Without explicitly
clearing the CRYSTAL bit the system runs unstable and sometimes
reboots unexpectedly.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'board/ge/bx50v3/bx50v3.c')
-rw-r--r-- | board/ge/bx50v3/bx50v3.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index c11fc40abe5..7fcebba0260 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -31,6 +31,7 @@ #include <asm/arch/sys_proto.h> #include <power/regulator.h> #include <power/da9063_pmic.h> +#include <power/pmic.h> #include <input.h> #include <pwm.h> #include <version.h> @@ -432,6 +433,29 @@ static const struct boot_mode board_boot_modes[] = { }; #endif + +/* + * The SoM used by these boards has XTAL not connected despite datasheet + * suggesting connecting unused XTAL pins to ground. Without explicitly + * clearing the CRYSTAL bit the system runs unstable and sometimes reboots + * unexpectedly. + */ +static void pmic_crystal_fix(void) +{ + struct udevice *pmic; + static const uint EN_32K_CRYSTAL = (1 << 3); + + if (pmic_get("pmic@58", &pmic)) { + puts("failed to get device for PMIC\n"); + return; + } + + if (pmic_clrsetbits(pmic, DA9063_REG_EN_32K, EN_32K_CRYSTAL, 0) < 0) { + puts("failed to clear CRYSTAL bit\n"); + return; + } +} + void pmic_init(void) { struct udevice *reg; @@ -445,6 +469,8 @@ void pmic_init(void) "bperi", }; + pmic_crystal_fix(); + for (i = 0; i < ARRAY_SIZE(bucks); i++) { ret = regulator_get_by_devname(bucks[i], ®); if (reg < 0) { |