From 5b0a4830d4b7472fbb6d5b17990bfbe0473f95ff Mon Sep 17 00:00:00 2001 From: Alula Date: Tue, 17 Mar 2026 12:16:23 +0100 Subject: [PATCH] pinmux: add a build time option to configure JC rail uart --- .../nintendo/nx/pinmux_board_driver_api.cpp | 26 +++++++++++++++++++ .../board/nintendo/nx/pinmux_build_config.hpp | 20 ++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_build_config.hpp diff --git a/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_board_driver_api.cpp b/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_board_driver_api.cpp index 84ff19938..827a02c1c 100644 --- a/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_board_driver_api.cpp +++ b/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_board_driver_api.cpp @@ -17,6 +17,7 @@ #include "pinmux_pad_index.hpp" #include "pinmux_board_driver_api.hpp" #include "pinmux_platform_pads.hpp" +#include "pinmux_build_config.hpp" namespace ams::pinmux::driver::board::nintendo::nx { @@ -99,6 +100,31 @@ namespace ams::pinmux::driver::board::nintendo::nx { UpdateSinglePinmuxPad({ PinmuxPadIndex_Sdmmc2Dat6, 0x2000, 0x2000 }); UpdateSinglePinmuxPad({ PinmuxPadIndex_Sdmmc2Dat7, 0x2000, 0x2000 }); } + + #if defined(AMS_PINMUX_CONFIG_RIGHT_RAIL_AS_UART) + UpdateSinglePinmuxPad({ + .index = PinmuxPadIndex_Uart2Tx, + .option = 0, /* PinmuxPadPm_Pm0 | PinmuxOpt_NoPupd | PinmuxOpt_Output */ + .option_mask = (0x7|0x18|0x60), /* PinmuxOptBitMask_Pm | PinmuxOptBitMask_Pupd | PinmuxOptBitMask_Dir */ + }); + UpdateSinglePinmuxPad({ + .index = PinmuxPadIndex_Uart2Cts, + .option = 0x20, /* PinmuxPadPm_Pm0 | PinmuxOpt_NoPupd | PinmuxOpt_Input */ + .option_mask = (0x7|0x18|0x60), /* PinmuxOptBitMask_Pm | PinmuxOptBitMask_Pupd | PinmuxOptBitMask_Dir */ + }); + #endif + #if defined(AMS_PINMUX_CONFIG_LEFT_RAIL_AS_UART) + UpdateSinglePinmuxPad({ + .index = PinmuxPadIndex_Uart3Tx, + .option = 0, /* PinmuxPadPm_Pm0 | PinmuxOpt_NoPupd | PinmuxOpt_Output */ + .option_mask = (0x7|0x18|0x60), /* PinmuxOptBitMask_Pm | PinmuxOptBitMask_Pupd | PinmuxOptBitMask_Dir */ + }); + UpdateSinglePinmuxPad({ + .index = PinmuxPadIndex_Uart3Cts, + .option = 0x20, /* PinmuxPadPm_Pm0 | PinmuxOpt_NoPupd | PinmuxOpt_Input */ + .option_mask = (0x7|0x18|0x60), /* PinmuxOptBitMask_Pm | PinmuxOptBitMask_Pupd | PinmuxOptBitMask_Dir */ + }); + #endif } void SetInitialDrivePadConfig() { diff --git a/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_build_config.hpp b/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_build_config.hpp new file mode 100644 index 000000000..530af4325 --- /dev/null +++ b/libraries/libstratosphere/source/pinmux/driver/board/nintendo/nx/pinmux_build_config.hpp @@ -0,0 +1,20 @@ +/* + * Copyright (c) Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include + +// #define AMS_PINMUX_CONFIG_RIGHT_RAIL_AS_UART +// #define AMS_PINMUX_CONFIG_LEFT_RAIL_AS_UART \ No newline at end of file