sd/mmc: Cleanup and improve reliability
Store the bus cookie in the mmc_disk driver and pass it to the bus manager when executing commands. This avoids calling into the device manager at each read and write operation. The code to get the cookie from mmc_disk isn't so nice since it needs to access the grandparent device (the mmc bus root), it would be simpler if this cookie would be available directly from mmc bus devices. We can get card removal and card insertion interrupt at the same time due to insufficient hardware debouncing (the SDHCI spec says we shouldn't, but it happens on Ricoh controllers. Can't blame them, they don't advertise themselves as compliant with the spec). So, check the card status from the interrupt handler and ignore the incorrect interrupts. Fix unreliable card initialization: power must be turned on before starting up the SD clock. Remove a now unneeded delay that was added in an attempt to avoid initial instability. Change-Id: Ibd8d051da1a1d859f3924ee535f4a05d9b6398d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3639 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
34552f8e66
commit
5ec64c5cdd
@@ -93,13 +93,13 @@ typedef struct mmc_bus_interface {
|
||||
// type of card.
|
||||
typedef struct mmc_device_interface {
|
||||
driver_module_info info;
|
||||
status_t (*execute_command)(device_node* node, uint16_t rca,
|
||||
status_t (*execute_command)(device_node* node, void* cookie, uint16_t rca,
|
||||
uint8_t command, uint32_t argument, uint32_t* result);
|
||||
// Execute a command with no I/O phase
|
||||
status_t (*do_io)(device_node* controller, uint16_t rca,
|
||||
status_t (*do_io)(device_node* controller, void* cookie, uint16_t rca,
|
||||
uint8_t command, IOOperation* operation, bool offsetAsSectors);
|
||||
// Execute a command that involves a data transfer.
|
||||
void (*set_bus_width)(device_node* controller, int width);
|
||||
void (*set_bus_width)(device_node* controller, void* cookie, int width);
|
||||
// Set the data bus width to 1, 4 or 8 bit mode.
|
||||
} mmc_device_interface;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user