Commit ad0513828e30210450a43526eccbd98bfd232953

Authored by Kever Yang
Committed by Simon Glass
1 parent 824c03332a

rk3399: enable the pwm2/3 pinctrl in board init

There is no interrupt line for each PWM which used by pinctrl to get the
periph_id, so it's not able to enable the default pinctrl setting by pinctrl
framework, let's enable it at board_init().

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 30 additions and 1 deletions Side-by-side Diff

board/rockchip/evb_rk3399/evb-rk3399.c
... ... @@ -4,12 +4,41 @@
4 4 * SPDX-License-Identifier: GPL-2.0+
5 5 */
6 6 #include <common.h>
7   -#include <asm/armv8/mmu.h>
  7 +#include <dm.h>
  8 +#include <dm/pinctrl.h>
  9 +#include <asm/arch/periph.h>
8 10  
9 11 DECLARE_GLOBAL_DATA_PTR;
10 12  
11 13 int board_init(void)
12 14 {
  15 + struct udevice *pinctrl;
  16 + int ret;
  17 +
  18 + /*
  19 + * The PWM do not have decicated interrupt number in dts and can
  20 + * not get periph_id by pinctrl framework, so let's init them here.
  21 + * The PWM2 and PWM3 are for pwm regulater.
  22 + */
  23 + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
  24 + if (ret) {
  25 + debug("%s: Cannot find pinctrl device\n", __func__);
  26 + goto out;
  27 + }
  28 +
  29 + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
  30 + if (ret) {
  31 + debug("%s PWM2 pinctrl init fail!\n", __func__);
  32 + goto out;
  33 + }
  34 +
  35 + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3);
  36 + if (ret) {
  37 + debug("%s PWM3 pinctrl init fail!\n", __func__);
  38 + goto out;
  39 + }
  40 +
  41 +out:
13 42 return 0;
14 43 }
15 44