1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 19:26:04 +00:00

boot: fix some silly mistakes

This commit is contained in:
Michael Scire 2019-05-07 01:18:54 -07:00
parent db47a0c041
commit b5e91ff9a4
4 changed files with 17 additions and 9 deletions

View file

@ -30,7 +30,7 @@ class ChargerDriver {
public: public:
ChargerDriver() { ChargerDriver() {
I2cDriver::Initialize(); I2cDriver::Initialize();
I2cDriver::OpenSession(&this->i2c_session, I2cDevice_Max17050); I2cDriver::OpenSession(&this->i2c_session, I2cDevice_Bq24193);
Boot::GpioSetDirection(GpioPadName_Bq24193Charger, GpioDirection_Output); Boot::GpioSetDirection(GpioPadName_Bq24193Charger, GpioDirection_Output);
} }

View file

@ -87,7 +87,7 @@ u32 Boot::GpioSetDirection(u32 gpio_pad_name, GpioDirection dir) {
*(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0x90)) = gpio_oe_val; *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0x90)) = gpio_oe_val;
/* Do a dummy read from GPIO_OE_x register (lower offset) */ /* Do a dummy read from GPIO_OE_x register (lower offset) */
gpio_oe_val = *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset)); gpio_oe_val = *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0x10));
return gpio_oe_val; return gpio_oe_val;
} }
@ -113,7 +113,7 @@ u32 Boot::GpioSetValue(u32 gpio_pad_name, GpioValue val) {
*(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0xA0)) = gpio_out_val; *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0xA0)) = gpio_out_val;
/* Do a dummy read from GPIO_OUT_x register (lower offset) */ /* Do a dummy read from GPIO_OUT_x register (lower offset) */
gpio_out_val = *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset)); gpio_out_val = *(reinterpret_cast<volatile u32 *>(gpio_base_vaddr + gpio_reg_offset + 0x20));
return gpio_out_val; return gpio_out_val;
} }

View file

@ -25,6 +25,7 @@
#include "boot_functions.hpp" #include "boot_functions.hpp"
#include "boot_reboot_manager.hpp" #include "boot_reboot_manager.hpp"
#include "i2c_driver/i2c_api.hpp"
extern "C" { extern "C" {
extern u32 __start__; extern u32 __start__;
@ -120,18 +121,25 @@ int main(int argc, char **argv)
/* Talk to PMIC/RTC, set boot reason with SPL. */ /* Talk to PMIC/RTC, set boot reason with SPL. */
Boot::DetectBootReason(); Boot::DetectBootReason();
const HardwareType hw_type = Boot::GetHardwareType();
if (hw_type != HardwareType_Copper) {
/* Display splash screen for two seconds. */ /* Display splash screen for two seconds. */
Boot::ShowSplashScreen(); Boot::ShowSplashScreen();
/* Check that the battery has enough to boot. */ /* Check that the battery has enough to boot. */
Boot::CheckBatteryCharge(); Boot::CheckBatteryCharge();
}
/* Configure pinmux + drive pads. */ /* Configure pinmux + drive pads. */
Boot::ConfigurePinmux(); Boot::ConfigurePinmux();
/* TODO: SetInitialWakePinConfiguration(); */ /* TODO: SetInitialWakePinConfiguration(); */
if (hw_type != HardwareType_Copper) {
Boot::SetInitialClockConfiguration(); Boot::SetInitialClockConfiguration();
}
Boot::SetFanEnabled();
/* TODO: CheckAndRepairBootImages(); */ /* TODO: CheckAndRepairBootImages(); */

View file

@ -83,7 +83,7 @@ Result Pcv::SetReset(PcvModule module, bool reset) {
if (reset) { if (reset) {
SetRegisterBits(regs.rst_reg, regs.mask); SetRegisterBits(regs.rst_reg, regs.mask);
} else { } else {
ClearRegisterBits(regs.rst_reg, regs.mask); ClearRegisterBits(regs.rst_reg, ~regs.mask);
} }
return ResultSuccess; return ResultSuccess;