Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick to master: [rom, rom_ext] Enable pull-up on UART_RX #24556

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading