mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
boot: split out gpio, pinmux.
This commit is contained in:
parent
6d1d226842
commit
804e5d49bb
29 changed files with 52 additions and 51 deletions
|
@ -33,7 +33,7 @@ endef
|
|||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source source/i2c source/i2c/driver source/i2c/driver/impl source/updater
|
||||
SOURCES := source source/i2c source/i2c/driver source/i2c/driver/impl source/updater source/gpio source/pinmux
|
||||
DATA := data
|
||||
INCLUDES := include ../../common/include
|
||||
EXEFS_SRC := exefs_src
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace sts::boot {
|
|||
return 1;
|
||||
}
|
||||
if (rtc_intr & 0x04) {
|
||||
if (nv_erc != 0x80 && !IsRecoveryBoot()) {
|
||||
if (nv_erc != 0x80 && !spl::IsRecoveryBoot()) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
#include <stratosphere.hpp>
|
||||
|
||||
#include "boot_bq24193_charger.hpp"
|
||||
#include "boot_gpio_utils.hpp"
|
||||
#include "boot_i2c_utils.hpp"
|
||||
|
||||
#include "gpio/gpio_utils.hpp"
|
||||
|
||||
namespace sts::boot {
|
||||
|
||||
class ChargerDriver {
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace sts::boot {
|
|||
void InitializeDisplay() {
|
||||
/* Setup globals. */
|
||||
InitializeRegisterBaseAddresses();
|
||||
g_is_mariko = IsMariko();
|
||||
g_is_mariko = spl::IsMariko();
|
||||
InitializeFrameBuffer();
|
||||
|
||||
/* Turn on DSI/voltage rail. */
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
*/
|
||||
|
||||
#include "boot_fan_enable.hpp"
|
||||
#include "boot_gpio_utils.hpp"
|
||||
#include "boot_spl_utils.hpp"
|
||||
|
||||
#include "gpio/gpio_utils.hpp"
|
||||
|
||||
namespace sts::boot {
|
||||
|
||||
namespace {
|
||||
|
@ -28,7 +29,7 @@ namespace sts::boot {
|
|||
}
|
||||
|
||||
void SetFanEnabled() {
|
||||
if (GetHardwareType() == spl::HardwareType::Copper) {
|
||||
if (spl::GetHardwareType() == spl::HardwareType::Copper) {
|
||||
gpio::Configure(GpioPadName_FanEnable);
|
||||
gpio::SetDirection(GpioPadName_FanEnable, GpioDirection_Output);
|
||||
gpio::SetValue(GpioPadName_FanEnable, GpioValue_High);
|
||||
|
|
|
@ -29,12 +29,13 @@
|
|||
#include "boot_check_clock.hpp"
|
||||
#include "boot_clock_initial_configuration.hpp"
|
||||
#include "boot_fan_enable.hpp"
|
||||
#include "boot_gpio_initial_configuration.hpp"
|
||||
#include "boot_pinmux_initial_configuration.hpp"
|
||||
#include "boot_repair_boot_images.hpp"
|
||||
#include "boot_splash_screen.hpp"
|
||||
#include "boot_wake_pins.hpp"
|
||||
|
||||
#include "gpio/gpio_initial_configuration.hpp"
|
||||
#include "pinmux/pinmux_initial_configuration.hpp"
|
||||
|
||||
#include "boot_power_utils.hpp"
|
||||
#include "boot_spl_utils.hpp"
|
||||
|
||||
|
@ -111,7 +112,7 @@ int main(int argc, char **argv)
|
|||
boot::ChangeGpioVoltageTo1_8v();
|
||||
|
||||
/* Setup GPIO. */
|
||||
boot::gpio::SetInitialConfiguration();
|
||||
gpio::SetInitialConfiguration();
|
||||
|
||||
/* Check USB PLL/UTMIP clock. */
|
||||
boot::CheckClock();
|
||||
|
@ -119,7 +120,7 @@ int main(int argc, char **argv)
|
|||
/* Talk to PMIC/RTC, set boot reason with SPL. */
|
||||
boot::DetectBootReason();
|
||||
|
||||
const auto hw_type = boot::GetHardwareType();
|
||||
const auto hw_type = spl::GetHardwareType();
|
||||
if (hw_type != spl::HardwareType::Copper) {
|
||||
/* Display splash screen for two seconds. */
|
||||
boot::ShowSplashScreen();
|
||||
|
@ -129,7 +130,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Configure pinmux + drive pads. */
|
||||
boot::pinmux::SetInitialConfiguration();
|
||||
pinmux::SetInitialConfiguration();
|
||||
|
||||
/* Configure the PMC wake pin settings. */
|
||||
boot::SetInitialWakePinConfiguration();
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace sts::boot {
|
|||
}
|
||||
|
||||
void CheckAndRepairBootImages() {
|
||||
const auto boot_image_update_type = updater::GetBootImageUpdateType(GetHardwareType());
|
||||
const auto boot_image_update_type = updater::GetBootImageUpdateType(spl::GetHardwareType());
|
||||
|
||||
bool repaired_normal, repaired_safe;
|
||||
if (R_SUCCEEDED(updater::VerifyBootImagesAndRepairIfNeeded(&repaired_normal, &repaired_safe, g_boot_image_work_buffer, sizeof(g_boot_image_work_buffer), boot_image_update_type)) && repaired_normal) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "boot_spl_utils.hpp"
|
||||
|
||||
namespace sts::boot {
|
||||
namespace sts::spl {
|
||||
|
||||
spl::HardwareType GetHardwareType() {
|
||||
u64 out_val = 0;
|
||||
|
|
|
@ -27,13 +27,9 @@ namespace sts::spl {
|
|||
Iowa = 3,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace sts::boot {
|
||||
|
||||
/* SPL Utilities. */
|
||||
spl::HardwareType GetHardwareType();
|
||||
HardwareType GetHardwareType();
|
||||
bool IsRecoveryBoot();
|
||||
bool IsMariko();
|
||||
|
||||
}
|
||||
}
|
|
@ -95,7 +95,7 @@ namespace sts::boot {
|
|||
/* Set wake event levels, wake event enables. */
|
||||
const WakePinConfig *configs;
|
||||
size_t num_configs;
|
||||
if (GetHardwareType() == spl::HardwareType::Copper) {
|
||||
if (spl::GetHardwareType() == spl::HardwareType::Copper) {
|
||||
configs = WakePinConfigsCopper;
|
||||
num_configs = NumWakePinConfigsCopper;
|
||||
} else {
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "boot_gpio_initial_configuration.hpp"
|
||||
#include "boot_gpio_utils.hpp"
|
||||
#include "boot_spl_utils.hpp"
|
||||
#include "gpio_initial_configuration.hpp"
|
||||
#include "gpio_utils.hpp"
|
||||
|
||||
namespace sts::boot::gpio {
|
||||
/* TODO: Better way? */
|
||||
#include "../boot_spl_utils.hpp"
|
||||
|
||||
namespace sts::gpio {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -29,17 +31,17 @@ namespace sts::boot::gpio {
|
|||
};
|
||||
|
||||
/* Include all initial configuration definitions. */
|
||||
#include "boot_gpio_initial_configuration_icosa.inc"
|
||||
#include "boot_gpio_initial_configuration_copper.inc"
|
||||
#include "boot_gpio_initial_configuration_hoag.inc"
|
||||
#include "boot_gpio_initial_configuration_iowa.inc"
|
||||
#include "gpio_initial_configuration_icosa.inc"
|
||||
#include "gpio_initial_configuration_copper.inc"
|
||||
#include "gpio_initial_configuration_hoag.inc"
|
||||
#include "gpio_initial_configuration_iowa.inc"
|
||||
|
||||
}
|
||||
|
||||
void SetInitialConfiguration() {
|
||||
const InitialConfig *configs = nullptr;
|
||||
size_t num_configs = 0;
|
||||
const auto hw_type = GetHardwareType();
|
||||
const auto hw_type = spl::GetHardwareType();
|
||||
const FirmwareVersion fw_ver = GetRuntimeFirmwareVersion();
|
||||
|
||||
/* Choose GPIO map. */
|
|
@ -18,7 +18,7 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace sts::boot::gpio {
|
||||
namespace sts::gpio {
|
||||
|
||||
void SetInitialConfiguration();
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
#include <stratosphere/reg.hpp>
|
||||
|
||||
#include "boot_gpio_utils.hpp"
|
||||
#include "gpio_utils.hpp"
|
||||
|
||||
namespace sts::boot::gpio {
|
||||
namespace sts::gpio {
|
||||
|
||||
namespace {
|
||||
|
||||
/* Pull in GPIO map definitions. */
|
||||
#include "boot_gpio_map.inc"
|
||||
#include "gpio_map.inc"
|
||||
|
||||
constexpr u32 PhysicalBase = 0x6000D000;
|
||||
|
|
@ -18,9 +18,7 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "i2c/driver/i2c_api.hpp"
|
||||
|
||||
namespace sts::boot::gpio {
|
||||
namespace sts::gpio {
|
||||
|
||||
/* GPIO Utilities. */
|
||||
u32 Configure(u32 gpio_pad_name);
|
|
@ -15,11 +15,13 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "boot_pinmux_initial_configuration.hpp"
|
||||
#include "boot_pinmux_utils.hpp"
|
||||
#include "boot_spl_utils.hpp"
|
||||
#include "pinmux_initial_configuration.hpp"
|
||||
#include "pinmux_utils.hpp"
|
||||
|
||||
namespace sts::boot::pinmux {
|
||||
/* TODO: Better way? */
|
||||
#include "../boot_spl_utils.hpp"
|
||||
|
||||
namespace sts::pinmux {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -30,18 +32,18 @@ namespace sts::boot::pinmux {
|
|||
};
|
||||
|
||||
/* Include all initial configuration definitions. */
|
||||
#include "boot_pinmux_initial_configuration_icosa.inc"
|
||||
#include "boot_pinmux_initial_configuration_copper.inc"
|
||||
#include "boot_pinmux_initial_configuration_hoag.inc"
|
||||
#include "boot_pinmux_initial_configuration_iowa.inc"
|
||||
#include "boot_pinmux_initial_drive_pad_configuration.inc"
|
||||
#include "pinmux_initial_configuration_icosa.inc"
|
||||
#include "pinmux_initial_configuration_copper.inc"
|
||||
#include "pinmux_initial_configuration_hoag.inc"
|
||||
#include "pinmux_initial_configuration_iowa.inc"
|
||||
#include "pinmux_initial_drive_pad_configuration.inc"
|
||||
|
||||
|
||||
/* Configuration helpers. */
|
||||
void ConfigureInitialPads() {
|
||||
const InitialConfig *configs = nullptr;
|
||||
size_t num_configs = 0;
|
||||
const auto hw_type = GetHardwareType();
|
||||
const auto hw_type = spl::GetHardwareType();
|
||||
|
||||
switch (hw_type) {
|
||||
case spl::HardwareType::Icosa:
|
|
@ -18,7 +18,7 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace sts::boot::pinmux {
|
||||
namespace sts::pinmux {
|
||||
|
||||
void SetInitialConfiguration();
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
#include <stratosphere/reg.hpp>
|
||||
|
||||
#include "boot_pinmux_utils.hpp"
|
||||
#include "pinmux_utils.hpp"
|
||||
|
||||
namespace sts::boot::pinmux {
|
||||
namespace sts::pinmux {
|
||||
|
||||
namespace {
|
||||
|
||||
/* Pull in Pinmux map definitions. */
|
||||
#include "boot_pinmux_map.inc"
|
||||
#include "pinmux_map.inc"
|
||||
|
||||
constexpr u32 ApbMiscPhysicalBase = 0x70000000;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace sts::boot::pinmux {
|
||||
namespace sts::pinmux {
|
||||
|
||||
/* Pinmux Utilities. */
|
||||
u32 UpdatePark(u32 pinmux_name);
|
Loading…
Reference in a new issue