Skip to content

Commit 9eaa46d

Browse files
committed
[rom, rom_ext] Enable pull-up on UART_RX
Fixes: #24551 Signed-off-by: Chris Frantz <[email protected]> (cherry picked from commit 6ca7587)
1 parent b1faaca commit 9eaa46d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

sw/device/silicon_creator/lib/drivers/pinmux.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ void pinmux_init(void) {
189189
configure_input(kInputSwStrap2);
190190
}
191191

192+
// Pull the UART_RX line high (idle state for UART). This prevents a
193+
// floating UART_RX from incorrectly triggering serial break.
194+
enable_pull(kInputUart0.pad, /*enable=*/true, /*up=*/true);
192195
configure_input(kInputUart0);
193196
configure_output(kOutputUart0);
194197
}

sw/device/silicon_creator/lib/drivers/pinmux_unittest.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ TEST_F(InitTest, WithBootstrap) {
100100
kTopEarlgreyPinmuxInselIoc1)
101101
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInGpioGpio24),
102102
kTopEarlgreyPinmuxInselIoc2)
103+
104+
// UART configuration: RX line pulled up, RX is IOC3, TX is IOC4.
105+
EXPECT_ABS_WRITE32(RegPadAttr(kTopEarlgreyMuxedPadsIoc3),
106+
{{PINMUX_MIO_PAD_ATTR_0_PULL_EN_0_BIT, 1},
107+
{PINMUX_MIO_PAD_ATTR_0_PULL_SELECT_0_BIT, 1}});
103108
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInUart0Rx),
104109
kTopEarlgreyPinmuxInselIoc3);
105-
106-
// The outputs that will be configured.
107110
EXPECT_ABS_WRITE32(RegOutSel(kTopEarlgreyPinmuxMioOutIoc4),
108111
kTopEarlgreyPinmuxOutselUart0Tx);
109112

@@ -115,10 +118,13 @@ TEST_F(InitTest, WithoutBootstrap) {
115118
EXPECT_CALL(otp_,
116119
read32(OTP_CTRL_PARAM_OWNER_SW_CFG_ROM_BOOTSTRAP_DIS_OFFSET))
117120
.WillOnce(Return(kHardenedBoolTrue));
121+
122+
// UART configuration: RX line pulled up, RX is IOC3, TX is IOC4.
123+
EXPECT_ABS_WRITE32(RegPadAttr(kTopEarlgreyMuxedPadsIoc3),
124+
{{PINMUX_MIO_PAD_ATTR_0_PULL_EN_0_BIT, 1},
125+
{PINMUX_MIO_PAD_ATTR_0_PULL_SELECT_0_BIT, 1}});
118126
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInUart0Rx),
119127
kTopEarlgreyPinmuxInselIoc3);
120-
121-
// The outputs that will be configured.
122128
EXPECT_ABS_WRITE32(RegOutSel(kTopEarlgreyPinmuxMioOutIoc4),
123129
kTopEarlgreyPinmuxOutselUart0Tx);
124130

0 commit comments

Comments
 (0)