Commit 28d9a458 authored by Peter Wang's avatar Peter Wang Committed by Alberto Escolar
Browse files

boards: frdm_mcxa166, frdm_mcxa276: add lpcmp support



1. enable sensor/nxp,lpcmp support
2. verified samples/sensor/mcux_lpcmp
3. update the mcux_lpcmp to support different port

Signed-off-by: default avatarPeter Wang <chaoyi.wang@nxp.com>
parent cc08d96d
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -200,6 +200,24 @@ void board_early_init_hook(void)
	CLOCK_EnableClock(kCLOCK_GateADC1);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP0);
	CLOCK_SetClockDiv(kCLOCK_DivCMP0_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp1))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP1);
	CLOCK_SetClockDiv(kCLOCK_DivCMP1_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp1 | kSPC_controlCmp1Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp2))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP2);
	CLOCK_SetClockDiv(kCLOCK_DivCMP2_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp2 | kSPC_controlCmp2Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0))
	CLOCK_SetClockDiv(kCLOCK_DivLPI2C0, 1u);
	CLOCK_AttachClk(kFRO_LF_DIV_to_LPI2C0);
+8 −1
Original line number Diff line number Diff line
@@ -34,7 +34,14 @@
			drive-strength = "low";
		};
	};

	pinmux_lpcmp0: pinmux_lpcmp0 {
		group0 {
			pinmux = <CMP0_IN1_P1_3>;
			drive-strength = "low";
			slew-rate = "fast";
			bias-pull-up;
		};
	};
	pinmux_lpi2c1: pinmux_lpi2c1 {
		group0 {
			pinmux = <LPI2C1_SDA_P1_0>,
+5 −0
Original line number Diff line number Diff line
@@ -127,6 +127,11 @@
	pinctrl-names = "default";
};

&lpcmp0 {
	pinctrl-0 = <&pinmux_lpcmp0>;
	pinctrl-names = "default";
};

&lpi2c1 {
	status = "okay";
	pinctrl-0 = <&pinmux_lpi2c1>;
+18 −0
Original line number Diff line number Diff line
@@ -205,6 +205,24 @@ void board_early_init_hook(void)
	CLOCK_EnableClock(kCLOCK_GateADC1);
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp0))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP0);
	CLOCK_SetClockDiv(kCLOCK_DivCMP0_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp1))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP1);
	CLOCK_SetClockDiv(kCLOCK_DivCMP1_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp1 | kSPC_controlCmp1Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpcmp2))
	CLOCK_AttachClk(kFRO_LF_DIV_to_CMP2);
	CLOCK_SetClockDiv(kCLOCK_DivCMP2_FUNC, 1U);
	SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp2 | kSPC_controlCmp2Dac));
#endif

#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpi2c0))
	CLOCK_SetClockDiv(kCLOCK_DivLPI2C0, 1u);
	CLOCK_AttachClk(kFRO_LF_DIV_to_LPI2C0);
+8 −1
Original line number Diff line number Diff line
@@ -50,7 +50,14 @@
			drive-strength = "low";
		};
	};

	pinmux_lpcmp0: pinmux_lpcmp0 {
		group0 {
			pinmux = <CMP0_IN1_P1_3>;
			drive-strength = "low";
			slew-rate = "fast";
			bias-pull-up;
		};
	};
	pinmux_lpi2c1: pinmux_lpi2c1 {
		group0 {
			pinmux = <LPI2C1_SDA_P1_0>,
Loading