Skip to content

Commit

Permalink
[rom, rom_ext] Enable pull-up on UART_RX
Browse files Browse the repository at this point in the history
Fixes: #24551

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit 6ca7587)
  • Loading branch information
cfrantz authored and moidx committed Oct 29, 2024
1 parent c76fcea commit 87b6880
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions sw/device/silicon_creator/lib/drivers/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ void pinmux_init(void) {
configure_input(kInputSwStrap2);
}

// Pull the UART_RX line high (idle state for UART). This prevents a
// floating UART_RX from incorrectly triggering serial break.
enable_pull(kInputUart0.pad, /*enable=*/true, /*up=*/true);
configure_input(kInputUart0);
configure_output(kOutputUart0);
}
Expand Down
14 changes: 10 additions & 4 deletions sw/device/silicon_creator/lib/drivers/pinmux_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ TEST_F(InitTest, WithBootstrap) {
kTopEarlgreyPinmuxInselIoc1)
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInGpioGpio24),
kTopEarlgreyPinmuxInselIoc2)

// UART configuration: RX line pulled up, RX is IOC3, TX is IOC4.
EXPECT_ABS_WRITE32(RegPadAttr(kTopEarlgreyMuxedPadsIoc3),
{{PINMUX_MIO_PAD_ATTR_0_PULL_EN_0_BIT, 1},
{PINMUX_MIO_PAD_ATTR_0_PULL_SELECT_0_BIT, 1}});
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInUart0Rx),
kTopEarlgreyPinmuxInselIoc3);

// The outputs that will be configured.
EXPECT_ABS_WRITE32(RegOutSel(kTopEarlgreyPinmuxMioOutIoc4),
kTopEarlgreyPinmuxOutselUart0Tx);

Expand All @@ -115,10 +118,13 @@ TEST_F(InitTest, WithoutBootstrap) {
EXPECT_CALL(otp_,
read32(OTP_CTRL_PARAM_OWNER_SW_CFG_ROM_BOOTSTRAP_DIS_OFFSET))
.WillOnce(Return(kHardenedBoolTrue));

// UART configuration: RX line pulled up, RX is IOC3, TX is IOC4.
EXPECT_ABS_WRITE32(RegPadAttr(kTopEarlgreyMuxedPadsIoc3),
{{PINMUX_MIO_PAD_ATTR_0_PULL_EN_0_BIT, 1},
{PINMUX_MIO_PAD_ATTR_0_PULL_SELECT_0_BIT, 1}});
EXPECT_ABS_WRITE32(RegInSel(kTopEarlgreyPinmuxPeripheralInUart0Rx),
kTopEarlgreyPinmuxInselIoc3);

// The outputs that will be configured.
EXPECT_ABS_WRITE32(RegOutSel(kTopEarlgreyPinmuxMioOutIoc4),
kTopEarlgreyPinmuxOutselUart0Tx);

Expand Down

0 comments on commit 87b6880

Please sign in to comment.