Commit 158d93adb482ef6dc1e50fcf9a7c3b21128d4cd9
Committed by
Stefano Babic
1 parent
9f976bac2b
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
imx6, aristainetos2c: add da9063 pmic setup
On the aristainetos2c boards the PMIC needs to be initialized, because the Ethernet PHY uses a different regulator that is not setup per hardware default. This does not influence the other versions as this regulator isn't used there at all. Signed-off-by: Heiko Schocher <hs@denx.de>
Showing 2 changed files with 59 additions and 0 deletions Side-by-side Diff
board/aristainetos/aristainetos.c
... | ... | @@ -30,6 +30,9 @@ |
30 | 30 | #include <miiphy.h> |
31 | 31 | #include <lcd.h> |
32 | 32 | #include <led.h> |
33 | +#include <power/pmic.h> | |
34 | +#include <power/regulator.h> | |
35 | +#include <power/da9063_pmic.h> | |
33 | 36 | #include <splash.h> |
34 | 37 | #include <video_fb.h> |
35 | 38 | |
... | ... | @@ -438,6 +441,56 @@ |
438 | 441 | } |
439 | 442 | } |
440 | 443 | |
444 | +#if defined(CONFIG_DM_PMIC_DA9063) | |
445 | +/* | |
446 | + * On the aristainetos2c boards the PMIC needs to be initialized, | |
447 | + * because the Ethernet PHY uses a different regulator that is not | |
448 | + * setup per hardware default. This does not influence the other versions | |
449 | + * as this regulator isn't used there at all. | |
450 | + * | |
451 | + * Unfortunately we have not yet a interface to setup all | |
452 | + * values we need. | |
453 | + */ | |
454 | +static int setup_pmic_voltages(void) | |
455 | +{ | |
456 | + struct udevice *dev; | |
457 | + int off; | |
458 | + int ret; | |
459 | + | |
460 | + off = fdt_path_offset(gd->fdt_blob, "pmic0"); | |
461 | + if (off < 0) { | |
462 | + printf("%s: No pmic path offset\n", __func__); | |
463 | + return off; | |
464 | + } | |
465 | + | |
466 | + ret = uclass_get_device_by_of_offset(UCLASS_PMIC, off, &dev); | |
467 | + if (ret) { | |
468 | + printf("%s: Could not find PMIC\n", __func__); | |
469 | + return ret; | |
470 | + } | |
471 | + | |
472 | + pmic_reg_write(dev, DA9063_REG_PAGE_CON, 0x01); | |
473 | + pmic_reg_write(dev, DA9063_REG_BPRO_CFG, 0xc1); | |
474 | + ret = pmic_reg_read(dev, DA9063_REG_BUCK_ILIM_B); | |
475 | + if (ret < 0) { | |
476 | + printf("%s: error %d get register\n", __func__, ret); | |
477 | + return ret; | |
478 | + } | |
479 | + ret &= 0xf0; | |
480 | + ret |= 0x09; | |
481 | + pmic_reg_write(dev, DA9063_REG_BUCK_ILIM_B, ret); | |
482 | + pmic_reg_write(dev, DA9063_REG_VBPRO_A, 0x43); | |
483 | + pmic_reg_write(dev, DA9063_REG_VBPRO_B, 0xc3); | |
484 | + | |
485 | + return 0; | |
486 | +} | |
487 | +#else | |
488 | +static int setup_pmic_voltages(void) | |
489 | +{ | |
490 | + return 0; | |
491 | +} | |
492 | +#endif | |
493 | + | |
441 | 494 | int board_late_init(void) |
442 | 495 | { |
443 | 496 | int x, y; |
... | ... | @@ -456,6 +509,9 @@ |
456 | 509 | env_set("board_type", ARI_BT_4); |
457 | 510 | else |
458 | 511 | env_set("board_type", ARI_BT_7); |
512 | + | |
513 | + if (setup_pmic_voltages()) | |
514 | + printf("Error setup PMIC\n"); | |
459 | 515 | |
460 | 516 | return 0; |
461 | 517 | } |
configs/aristainetos2c_defconfig
... | ... | @@ -87,7 +87,10 @@ |
87 | 87 | CONFIG_PINCTRL=y |
88 | 88 | CONFIG_PINCTRL_IMX6=y |
89 | 89 | CONFIG_DM_PMIC=y |
90 | +# CONFIG_SPL_PMIC_CHILDREN is not set | |
91 | +CONFIG_DM_PMIC_DA9063=y | |
90 | 92 | CONFIG_DM_REGULATOR=y |
93 | +CONFIG_DM_REGULATOR_DA9063=y | |
91 | 94 | CONFIG_DM_REGULATOR_FIXED=y |
92 | 95 | CONFIG_DM_PWM=y |
93 | 96 | CONFIG_PWM_IMX=y |