|
10 | 10 | #include <zephyr/device.h> |
11 | 11 |
|
12 | 12 | #include <zephyr/drivers/clock_control/lpc11u6x_clock_control.h> |
13 | | -#include <zephyr/drivers/pinmux.h> |
14 | 13 |
|
15 | 14 | #include "clock_control_lpc11u6x.h" |
16 | 15 |
|
@@ -74,43 +73,6 @@ static void syscon_ahb_clock_enable(struct lpc11u6x_syscon_regs *syscon, |
74 | 73 | } |
75 | 74 | } |
76 | 75 |
|
77 | | -#if defined(CONFIG_CLOCK_CONTROL_LPC11U6X_PLL_SRC_SYSOSC) \ |
78 | | - && DT_INST_NODE_HAS_PROP(0, pinmuxs) |
79 | | -/** |
80 | | - * @brief: configure system oscillator pins. |
81 | | - * |
82 | | - * This system oscillator pins and their configurations are retrieved from the |
83 | | - * "pinmuxs" property of the DT clock controller node. |
84 | | - */ |
85 | | -static void pinmux_enable_sysosc(void) |
86 | | -{ |
87 | | - const struct device *pinmux_dev; |
88 | | - uint32_t pin, func; |
89 | | - |
90 | | - pinmux_dev = device_get_binding( |
91 | | - DT_LABEL(DT_INST_PHANDLE_BY_NAME(0, pinmuxs, xtalin))); |
92 | | - if (!pinmux_dev) { |
93 | | - return; |
94 | | - } |
95 | | - pin = DT_INST_PHA_BY_NAME(0, pinmuxs, xtalin, pin); |
96 | | - func = DT_INST_PHA_BY_NAME(0, pinmuxs, xtalin, function); |
97 | | - |
98 | | - pinmux_pin_set(pinmux_dev, pin, func); |
99 | | - |
100 | | - pinmux_dev = device_get_binding( |
101 | | - DT_LABEL(DT_INST_PHANDLE_BY_NAME(0, pinmuxs, xtalout))); |
102 | | - if (!pinmux_dev) { |
103 | | - return; |
104 | | - } |
105 | | - pin = DT_INST_PHA_BY_NAME(0, pinmuxs, xtalout, pin); |
106 | | - func = DT_INST_PHA_BY_NAME(0, pinmuxs, xtalout, function); |
107 | | - |
108 | | - pinmux_pin_set(pinmux_dev, pin, func); |
109 | | -} |
110 | | -#else |
111 | | -#define pinmux_enable_sysosc() do { } while (0) |
112 | | -#endif |
113 | | - |
114 | 76 | static void syscon_peripheral_reset(struct lpc11u6x_syscon_regs *syscon, |
115 | 77 | uint32_t mask, bool reset) |
116 | 78 | { |
@@ -347,7 +309,7 @@ static int lpc11u6x_syscon_init(const struct device *dev) |
347 | 309 | /* Configure PLL input */ |
348 | 310 | syscon_set_pll_src(cfg->syscon, LPC11U6X_SYS_PLL_CLK_SEL_SYSOSC); |
349 | 311 |
|
350 | | - pinmux_enable_sysosc(); |
| 312 | + pinctrl_apply_state(cfg->pincfg, PINCTRL_STATE_DEFAULT); |
351 | 313 |
|
352 | 314 | #elif defined(CONFIG_CLOCK_CONTROL_LPC11U6X_PLL_SRC_IRC) |
353 | 315 | syscon_power_up(cfg->syscon, LPC11U6X_PDRUNCFG_IRC_PD, true); |
@@ -381,8 +343,12 @@ static const struct clock_control_driver_api lpc11u6x_clock_control_api = { |
381 | 343 | .get_rate = lpc11u6x_clock_control_get_rate, |
382 | 344 | }; |
383 | 345 |
|
| 346 | + |
| 347 | +PINCTRL_DT_INST_DEFINE(0); |
| 348 | + |
384 | 349 | static const struct lpc11u6x_syscon_config syscon_config = { |
385 | 350 | .syscon = (struct lpc11u6x_syscon_regs *) DT_INST_REG_ADDR(0), |
| 351 | + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), |
386 | 352 | }; |
387 | 353 |
|
388 | 354 | static struct lpc11u6x_syscon_data syscon_data; |
|
0 commit comments