mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 19:26:55 -04:00
sdmmc: implement driver suitable for fs + bootloader
* sdmmc: begin skeletoning sdmmc driver * sdmmc: add most of SdHostStandardController * sdmmc: implement most of SdmmcController * sdmmc: Sdmmc2Controller * sdmmc: skeleton implementation of Sdmmc1Controller * sdmmc: complete abstract logic for Sdmmc1 power controller * sdmmc: implement gpio handling for sdmmc1-register-control * sdmmc: implement pinmux handling for sdmmc1-register-control * sdmmc: fix building for arm32 and in stratosphere context * sdmmc: implement voltage enable/set for sdmmc1-register-control * util: move T(V)SNPrintf from kernel to util * sdmmc: implement BaseDeviceAccessor * sdmmc: implement MmcDeviceAccessor * sdmmc: implement clock reset controller for register api * sdmmc: fix bug in WaitWhileCommandInhibit, add mmc accessors * exo: add sdmmc test program * sdmmc: fix speed mode extension, add CheckMmcConnection for debug * sdmmc: add DeviceDetector, gpio: implement client api * gpio: modernize client api instead of doing it the lazy way * sdmmc: SdCardDeviceAccessor impl * sdmmc: update test program to read first two sectors of sd card * sdmmc: fix vref sel * sdmmc: finish outward-facing api (untested) * ams: changes for libvapours including tegra register defs * sdmmc: remove hwinit
This commit is contained in:
parent
ac04e02a08
commit
166318ba77
143 changed files with 13696 additions and 1569 deletions
|
@ -23,15 +23,15 @@ namespace ams::boot {
|
|||
/* Convenience definitions. */
|
||||
constexpr u32 SmcFunctionId_AtmosphereReadWriteRegister = 0xF0000002;
|
||||
|
||||
constexpr u32 PmcPhysStart = 0x7000E400;
|
||||
constexpr u32 PmcPhysEnd = 0x7000EFFF;
|
||||
constexpr dd::PhysicalAddress PmcPhysStart = 0x7000E400;
|
||||
constexpr dd::PhysicalAddress PmcPhysLast = 0x7000EFFF;
|
||||
|
||||
/* Helpers. */
|
||||
bool IsValidPmcAddress(u32 phys_addr) {
|
||||
return (phys_addr & 3) == 0 && PmcPhysStart <= phys_addr && phys_addr <= PmcPhysEnd;
|
||||
bool IsValidPmcAddress(dd::PhysicalAddress phys_addr) {
|
||||
return util::IsAligned(phys_addr, alignof(u32)) && PmcPhysStart <= phys_addr && phys_addr <= PmcPhysLast;
|
||||
}
|
||||
|
||||
inline u32 ReadWriteRegisterImpl(uintptr_t phys_addr, u32 value, u32 mask) {
|
||||
inline u32 ReadWriteRegisterImpl(dd::PhysicalAddress phys_addr, u32 value, u32 mask) {
|
||||
u32 out_value;
|
||||
R_ABORT_UNLESS(spl::smc::ConvertResult(spl::smc::AtmosphereReadWriteRegister(phys_addr, mask, value, &out_value)));
|
||||
return out_value;
|
||||
|
@ -39,12 +39,12 @@ namespace ams::boot {
|
|||
|
||||
}
|
||||
|
||||
u32 ReadPmcRegister(u32 phys_addr) {
|
||||
u32 ReadPmcRegister(dd::PhysicalAddress phys_addr) {
|
||||
AMS_ABORT_UNLESS(IsValidPmcAddress(phys_addr));
|
||||
return ReadWriteRegisterImpl(phys_addr, 0, 0);
|
||||
}
|
||||
|
||||
void WritePmcRegister(u32 phys_addr, u32 value, u32 mask) {
|
||||
void WritePmcRegister(dd::PhysicalAddress phys_addr, u32 value, u32 mask) {
|
||||
AMS_ABORT_UNLESS(IsValidPmcAddress(phys_addr));
|
||||
ReadWriteRegisterImpl(phys_addr, value, mask);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue