#include <bitops.h>
#include <byteorder.h>
#include <debug.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <util.h>
#include <sdmmc/sdmmc.h>
#include "protocol.h"

Go to the source code of this file.
Functions | |
| void | sdmmc_slot_submit_req (struct sdmmc_slot *slot, struct sdmmc_request *req) |
| Submit SD/MMC request to slot. | |
| uint32_t | sdmmc_slot_set_voltage (struct sdmmc_slot *slot, uint32_t ocr) |
| Set possible supported voltage on slot. | |
| void | sdmmc_slot_power_up (struct sdmmc_slot *slot) |
| Enable power to a slot. | |
| void | sdmmc_slot_power_down (struct sdmmc_slot *slot) |
| Disable power to a slot. | |
| void | sdmmc_slot_set_f_max (struct sdmmc_slot *slot, int32_t f_max) |
| Set the maximum MCK rate for a slot. | |
| void | sdmmc_slot_set_bus_width (struct sdmmc_slot *slot, unsigned int bits) |
| Set the bus width of a slot. | |
| void | sdmmc_slot_notify_card_detect (struct sdmmc_slot *slot, int cd_value) |
| Notify slot about change in hw card detect. | |
| void | sdmmc_slot_init (struct sdmmc_slot *slot, struct sdmmc_host *host, int slot_id) |
| Init slot structure. | |
SD/MMC slot driver is an abstraction on top of the host.
Definition in file slot.c.
| void sdmmc_slot_init | ( | struct sdmmc_slot * | slot, | |
| struct sdmmc_host * | host, | |||
| int | slot_id | |||
| ) |
Init slot structure.
| slot | sdmmc_slot to be initialized | |
| host | pointer to sdmmc_host structure | |
| slot_id | slot identificator |
Definition at line 139 of file slot.c.
References sdmmc_slot::f_max, sdmmc_slot::flags, sdmmc_slot::host, sdmmc_slot::id, and sdmmc_slot::notify_card_detect.
Referenced by sdmmc_mcihost_init().
| void sdmmc_slot_notify_card_detect | ( | struct sdmmc_slot * | slot, | |
| int | value | |||
| ) |
Notify slot about change in hw card detect.
Can be called to notify about change in card detection. Ususally called by card detect handler.
| slot | sdmmc_slot | |
| value | Zero for no detection and non-zero for detection |
Definition at line 128 of file slot.c.
References clear_bit(), sdmmc_slot::context, sdmmc_slot::flags, sdmmc_slot::notify_card_detect, SDMMC_SLOT_CARD_DETECT, and set_bit().

| void sdmmc_slot_power_down | ( | struct sdmmc_slot * | slot | ) |
Disable power to a slot.
When this function returns, any card inserted into slot will not be powered, if power switching is supported on the current board/host combination. This function also sets the clock rate to "don't care" so that any other slots sharing the same clock line may be able to run faster.
Definition at line 104 of file slot.c.
References sdmmc_slot::host, sdmmc_host::power_down, and sdmmc_slot_set_f_max().

| void sdmmc_slot_power_up | ( | struct sdmmc_slot * | slot | ) |
Enable power to a slot.
When this function returns, any card inserted into slot will be powered. This function also resets the bus width to 1 bit and clears any high-speed state bits.
Definition at line 96 of file slot.c.
References sdmmc_slot::bus_width, clear_bit(), sdmmc_slot::flags, sdmmc_slot::host, sdmmc_host::power_up, SDMMC_SLOT_HIGH_SPEED, and sdmmc_slot_set_f_max().

| void sdmmc_slot_set_bus_width | ( | struct sdmmc_slot * | slot, | |
| unsigned int | bits | |||
| ) |
Set the bus width of a slot.
| slot | A MMC/SD card slot | |
| bits | The new bus width in bits |
Definition at line 122 of file slot.c.
References sdmmc_slot::bus_width, and sdmmc_slot_update().

| void sdmmc_slot_set_f_max | ( | struct sdmmc_slot * | slot, | |
| int32_t | f_max | |||
| ) |
Set the maximum MCK rate for a slot.
The bus frequency of the MCK line will be set to f_max Hz, rounded down to the nearest supported value, or up to the lowest rate supported by the host.
| slot | A MMC/SD card slot | |
| f_max | The maximum MCK rate in Hz. A negative value means "don't care" (i.e. the slot is inactive). Zero means that the clock should stop completely. |
Definition at line 111 of file slot.c.
References sdmmc_slot::f_max, sdmmc_host::f_min, sdmmc_slot::host, and sdmmc_slot_update().
Referenced by sdmmc_slot_power_down(), and sdmmc_slot_power_up().

| uint32_t sdmmc_slot_set_voltage | ( | struct sdmmc_slot * | slot, | |
| uint32_t | ocr | |||
| ) |
Set possible supported voltage on slot.
| slot | Slot | |
| ocr | Card Operation Condition Register |
Definition at line 59 of file slot.c.
References dbg_verbose, ffs(), sdmmc_slot::host, sdmmc_host::ocr_avail, SDMMC_OCR_LOW_VOLTAGE, and sdmmc_host::set_voltage.

| void sdmmc_slot_submit_req | ( | struct sdmmc_slot * | slot, | |
| struct sdmmc_request * | req | |||
| ) |
Submit SD/MMC request to slot.
| slot | Slot to submit request to | |
| req | Request to submit |
Definition at line 53 of file slot.c.
References sdmmc_slot::host, sdmmc_request::slot, and sdmmc_host::submit_req.
1.5.8