fusee: sdmmc: clean up and prepare for better SD/MMC/version separations
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "utils.h"
|
||||
#include "gpio.h"
|
||||
|
||||
/* Opaque pointer to the Tegra SDMMC registers */
|
||||
struct tegra_sdmmc;
|
||||
@@ -83,6 +84,44 @@ enum sdmmc_write_permission {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Methods by which we can touch registers accessed via.
|
||||
* CMD_SWITCH_MODE.
|
||||
*/
|
||||
enum sdmmc_switch_access_mode {
|
||||
|
||||
/* Normal commands */
|
||||
MMC_SWITCH_MODE_CMD_SET = 0,
|
||||
MMC_SWITCH_MODE_SET_BITS = 1,
|
||||
MMC_SWITCH_MODE_CLEAR_BITS = 2,
|
||||
MMC_SWITCH_MODE_WRITE_BYTE = 3,
|
||||
|
||||
/* EXTCSD access */
|
||||
MMC_SWITCH_EXTCSD_NORMAL = 1,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Offsets into the SWITCH_MODE argument.
|
||||
*/
|
||||
enum sdmmc_switch_argument_offsets {
|
||||
MMC_SWITCH_VALUE_SHIFT = 0,
|
||||
MMC_SWITCH_FIELD_SHIFT = 16,
|
||||
MMC_SWITCH_ACCESS_MODE_SHIFT = 24,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fields that can be modified by CMD_SWITCH_MODE.
|
||||
*/
|
||||
enum sdmmc_switch_field {
|
||||
/* Fields */
|
||||
MMC_GROUP_ERASE_DEF = 175,
|
||||
MMC_PARTITION_CONFIG = 179,
|
||||
MMC_BUS_WIDTH = 183,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Primary data structure describing a Fusée MMC driver.
|
||||
@@ -92,11 +131,23 @@ struct mmc {
|
||||
|
||||
/* Controller properties */
|
||||
char *name;
|
||||
unsigned int timeout;
|
||||
enum sdmmc_card_type card_type;
|
||||
bool use_dma;
|
||||
unsigned int timeout;
|
||||
enum tegra_named_gpio card_detect_gpio;
|
||||
enum sdmmc_card_type card_type;
|
||||
enum sdmmc_write_permission write_enable;
|
||||
|
||||
/* Per-controller operations. */
|
||||
int (*set_up_clock_and_io)(struct mmc *mmc);
|
||||
int (*enable_supplies)(struct mmc *mmc);
|
||||
bool (*card_present)(struct mmc *mmc);
|
||||
|
||||
/* Per-card-type operations */
|
||||
int (*card_init)(struct mmc *mmc);
|
||||
int (*establish_relative_address)(struct mmc *mmc);
|
||||
int (*switch_mode)(struct mmc *mmc, enum sdmmc_switch_access_mode mode,
|
||||
enum sdmmc_switch_field field, uint16_t value, uint32_t timeout);
|
||||
|
||||
/* Card properties */
|
||||
uint8_t cid[15];
|
||||
uint32_t relative_address;
|
||||
@@ -130,13 +181,12 @@ struct mmc;
|
||||
* Parititions supported by the Switch eMMC.
|
||||
*/
|
||||
enum sdmmc_partition {
|
||||
MMC_PARTITION_USER = 0,
|
||||
MMC_PARTITION_BOOT1 = 1,
|
||||
MMC_PARITTION_BOOT2 = 2,
|
||||
SDMMC_PARTITION_USER = 0,
|
||||
SDMMC_PARTITION_BOOT0 = 1,
|
||||
SDMMC_PARTITION_BOOT1 = 2,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current SDMMC debugging loglevel.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user