mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 13:52:21 +00:00
Apply sdmmc stage1 changes to stage2
This commit is contained in:
parent
402b69c549
commit
ac9939b7a1
5 changed files with 478 additions and 188 deletions
|
@ -206,7 +206,7 @@ static int rawmmcdev_close(struct _reent *r, void *fd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep this <= the size of the DMA bounce buffer in sdmmc.c */
|
/* Keep this <= the size of the DMA bounce buffer in sdmmc.c */
|
||||||
static __attribute__((aligned(16))) uint8_t g_crypto_buffer[4096 * 4] = {0};
|
static __attribute__((aligned(16))) uint8_t g_crypto_buffer[512] = {0};
|
||||||
|
|
||||||
static ssize_t rawmmcdev_write(struct _reent *r, void *fd, const char *ptr, size_t len) {
|
static ssize_t rawmmcdev_write(struct _reent *r, void *fd, const char *ptr, size_t len) {
|
||||||
rawmmcdev_file_t *f = (rawmmcdev_file_t *)fd;
|
rawmmcdev_file_t *f = (rawmmcdev_file_t *)fd;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -22,6 +22,9 @@ enum sdmmc_bus_width {
|
||||||
MMC_BUS_WIDTH_1BIT = 0,
|
MMC_BUS_WIDTH_1BIT = 0,
|
||||||
MMC_BUS_WIDTH_4BIT = 1,
|
MMC_BUS_WIDTH_4BIT = 1,
|
||||||
MMC_BUS_WIDTH_8BIT = 2,
|
MMC_BUS_WIDTH_8BIT = 2,
|
||||||
|
|
||||||
|
SD_BUS_WIDTH_1BIT = 0,
|
||||||
|
SD_BUS_WIDTH_4BIT = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,8 +61,9 @@ enum sdmmc_spec_version {
|
||||||
MMC_VERSION_4 = 0,
|
MMC_VERSION_4 = 0,
|
||||||
|
|
||||||
/* SD card versions */
|
/* SD card versions */
|
||||||
SD_VERSION_1 = 1,
|
SD_VERSION_1_0 = 0,
|
||||||
SD_VERSION_2 = 2,
|
SD_VERSION_1_1 = 1,
|
||||||
|
SD_VERSION_2_0 = 2,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,6 +144,7 @@ struct mmc {
|
||||||
/* Per-controller operations. */
|
/* Per-controller operations. */
|
||||||
int (*set_up_clock_and_io)(struct mmc *mmc);
|
int (*set_up_clock_and_io)(struct mmc *mmc);
|
||||||
int (*enable_supplies)(struct mmc *mmc);
|
int (*enable_supplies)(struct mmc *mmc);
|
||||||
|
int (*switch_to_low_voltage)(struct mmc *mmc);
|
||||||
bool (*card_present)(struct mmc *mmc);
|
bool (*card_present)(struct mmc *mmc);
|
||||||
|
|
||||||
/* Per-card-type operations */
|
/* Per-card-type operations */
|
||||||
|
@ -147,6 +152,7 @@ struct mmc {
|
||||||
int (*establish_relative_address)(struct mmc *mmc);
|
int (*establish_relative_address)(struct mmc *mmc);
|
||||||
int (*switch_mode)(struct mmc *mmc, enum sdmmc_switch_access_mode mode,
|
int (*switch_mode)(struct mmc *mmc, enum sdmmc_switch_access_mode mode,
|
||||||
enum sdmmc_switch_field field, uint16_t value, uint32_t timeout);
|
enum sdmmc_switch_field field, uint16_t value, uint32_t timeout);
|
||||||
|
int (*switch_bus_width)(struct mmc *mmc, enum sdmmc_bus_width width);
|
||||||
|
|
||||||
/* Card properties */
|
/* Card properties */
|
||||||
uint8_t cid[15];
|
uint8_t cid[15];
|
||||||
|
@ -162,6 +168,7 @@ struct mmc {
|
||||||
uint32_t partition_switch_time;
|
uint32_t partition_switch_time;
|
||||||
|
|
||||||
uint8_t read_block_order;
|
uint8_t read_block_order;
|
||||||
|
uint8_t write_block_order;
|
||||||
bool uses_block_addressing;
|
bool uses_block_addressing;
|
||||||
|
|
||||||
/* Pointers to hardware structures */
|
/* Pointers to hardware structures */
|
||||||
|
|
|
@ -13,12 +13,19 @@
|
||||||
* Enables a given power supply.
|
* Enables a given power supply.
|
||||||
*
|
*
|
||||||
* @param supply The power domain on the Switch that is to be enabled.
|
* @param supply The power domain on the Switch that is to be enabled.
|
||||||
|
* @param use_low_voltage If the supply supports multiple voltages, use the lower one.
|
||||||
|
* Some devices start in a high power mode, but an can be switched to a lower one.
|
||||||
|
* Set this to false unless you know what you're doing.
|
||||||
*/
|
*/
|
||||||
void supply_enable(enum switch_power_supply supply)
|
void supply_enable(enum switch_power_supply supply, bool use_low_voltage)
|
||||||
{
|
{
|
||||||
|
uint32_t voltage = 0;
|
||||||
|
|
||||||
switch(supply) {
|
switch(supply) {
|
||||||
case SUPPLY_MICROSD:
|
case SUPPLY_MICROSD:
|
||||||
max77620_regulator_set_voltage(SUPPLY_MICROSD_REGULATOR, SUPPLY_MICROSD_VOLTAGE);
|
voltage = use_low_voltage ? SUPPLY_MICROSD_LOW_VOLTAGE : SUPPLY_MICROSD_VOLTAGE;
|
||||||
|
|
||||||
|
max77620_regulator_set_voltage(SUPPLY_MICROSD_REGULATOR, voltage);
|
||||||
max77620_regulator_enable(SUPPLY_MICROSD_REGULATOR, true);
|
max77620_regulator_enable(SUPPLY_MICROSD_REGULATOR, true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,19 @@ enum switch_power_constants {
|
||||||
/* MicroSD card */
|
/* MicroSD card */
|
||||||
SUPPLY_MICROSD_REGULATOR = 6,
|
SUPPLY_MICROSD_REGULATOR = 6,
|
||||||
SUPPLY_MICROSD_VOLTAGE = 3300000,
|
SUPPLY_MICROSD_VOLTAGE = 3300000,
|
||||||
|
SUPPLY_MICROSD_LOW_VOLTAGE = 1800000,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables a given power supply.
|
* Enables a given power supply.
|
||||||
*
|
*
|
||||||
* @param supply The power domain on the Switch that is to be enabled.
|
* @param supply The power domain on the Switch that is to be enabled.
|
||||||
|
* @param use_low_voltage If the supply supports multiple voltages, use the lower one.
|
||||||
|
* Some devices start in a high power mode, but an can be switched to a lower one.
|
||||||
|
* Set this to false unless you know what you're doing.
|
||||||
*/
|
*/
|
||||||
void supply_enable(enum switch_power_supply supply);
|
void supply_enable(enum switch_power_supply supply, bool use_low_voltage);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue