thermosphere: fix uart pinmuxing. As it's now possible to init all uarts at the same time, do it.

Thanks to @CTCaer

See dumped values from HOS: ccaa47ee04/kernel-dts/icosa-platforms/tegra210-icosa-pinmux.dtsi
This commit is contained in:
TuxSH 2020-03-08 17:44:55 +00:00
parent 6790895487
commit 548367453b
2 changed files with 22 additions and 19 deletions

View file

@ -193,15 +193,14 @@ namespace ams::hvisor::drivers::tegra::t210 {
return static_cast<Level>((m_regs->bank[pin.port / portsPerBank].in[pin.port % portsPerBank] >> pin.pos) & 1);
}
void ConfigureUartPins(u32 id)
void ConfigureUartPins()
{
if (id > 3) {
return;
}
constexpr Pin uartPins[] = {uart1Tx, uart2Tx, uart3Tx, uart4Tx};
// Set SFIO to all the 4 contiguous pins (tx, rx, rts, cts)
SetModeContiguous(uartPins[id], 4, Mode::Sfio);
for (Pin pin : uartPins) {
SetModeContiguous(pin, 4, Mode::Sfio);
}
}
};

View file

@ -234,22 +234,26 @@ namespace ams::hvisor::drivers::tegra::t210 {
volatile Registers *m_regs = nullptr;
public:
CONFIGURE_UART_DECL(1)
CONFIGURE_UART_DECL(2)
CONFIGURE_UART_DECL(3)
CONFIGURE_UART_DECL(4)
void ConfigureUart(u32 id)
void ConfigureUartPins() const
{
switch (id) {
case 0: ConfigureUart1(); break;
case 1: ConfigureUart2(); break;
case 2: ConfigureUart3(); break;
case 3: ConfigureUart4(); break;
default: break;
}
m_regs->uart1_tx = 0 | 0 | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart1_rx = INPUT | TRISTATE | PULL_UP | SELECT_FUNCTION0;
m_regs->uart1_rts = 0 | 0 | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart1_cts = INPUT | TRISTATE | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart2_tx = 0 | 0 | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart2_rx = INPUT | TRISTATE | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart2_rts = 0 | 0 | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart2_cts = INPUT | TRISTATE | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart3_tx = 0 | 0 | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart3_rx = INPUT | TRISTATE | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart3_rts = 0 | 0 | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart3_cts = INPUT | TRISTATE | PULL_NONE | SELECT_FUNCTION0;
m_regs->uart4_tx = 0 | 0 | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart4_rx = INPUT | TRISTATE | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart4_cts = 0 | 0 | PULL_DOWN | SELECT_FUNCTION0;
m_regs->uart4_rts = INPUT | TRISTATE | PULL_DOWN | SELECT_FUNCTION0;
}
};
}
#undef CONFIGURE_UART_DECL
#undef CONFIGURE_UART_DECL