mmc_bus: add execute_command function
For now it just forwards the command to the SDHCI controller. The bus will gain more features and functions as work advances (tracking which card is active, arbitration of DMA transfers, etc). Change-Id: I094eb84f27e7789387a3f8fb65fba1e5fcfa3e8a Reviewed-on: https://review.haiku-os.org/c/haiku/+/3094 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
d4a668083c
commit
62eaf4c0e1
@@ -35,4 +35,13 @@ typedef struct mmc_bus_interface {
|
|||||||
} mmc_bus_interface;
|
} mmc_bus_interface;
|
||||||
|
|
||||||
|
|
||||||
|
// Interface between mmc device driver (mmc_disk, sdio drivers, ...) and mmc_bus
|
||||||
|
typedef struct mmc_device_interface {
|
||||||
|
driver_module_info info;
|
||||||
|
|
||||||
|
status_t (*execute_command)(device_node* node, uint8_t command,
|
||||||
|
uint32_t argument, uint32_t* result);
|
||||||
|
} mmc_device_interface;
|
||||||
|
|
||||||
|
|
||||||
#endif /* _MMC_H */
|
#endif /* _MMC_H */
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ MMCBus::WorkerThread(void* cookie)
|
|||||||
|
|
||||||
device_attr attrs[] = {
|
device_attr attrs[] = {
|
||||||
{ B_DEVICE_BUS, B_STRING_TYPE, {string: "mmc" }},
|
{ B_DEVICE_BUS, B_STRING_TYPE, {string: "mmc" }},
|
||||||
|
{ B_DEVICE_PRETTY_NAME, B_STRING_TYPE, {string: "mmc device" }},
|
||||||
{ B_DEVICE_VENDOR_ID, B_UINT32_TYPE, {ui32: vendor}},
|
{ B_DEVICE_VENDOR_ID, B_UINT32_TYPE, {ui32: vendor}},
|
||||||
{ B_DEVICE_ID, B_STRING_TYPE, {string: name}},
|
{ B_DEVICE_ID, B_STRING_TYPE, {string: name}},
|
||||||
{ B_DEVICE_UNIQUE_ID, B_UINT32_TYPE, {ui32: serial}},
|
{ B_DEVICE_UNIQUE_ID, B_UINT32_TYPE, {ui32: serial}},
|
||||||
|
|||||||
@@ -78,6 +78,27 @@ mmc_bus_added_device(device_node* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
mmc_bus_execute_command(device_node* node, uint8_t command, uint32_t argument,
|
||||||
|
uint32_t* result)
|
||||||
|
{
|
||||||
|
// FIXME store these in the bus cookie or something instead of
|
||||||
|
// getting/putting the parents each time.
|
||||||
|
mmc_bus_interface* sdhci;
|
||||||
|
void* cookie;
|
||||||
|
|
||||||
|
TRACE("In mmc_bus_execute_command\n");
|
||||||
|
device_node* parent = gDeviceManager->get_parent_node(node);
|
||||||
|
device_node* grandparent = gDeviceManager->get_parent_node(parent);
|
||||||
|
gDeviceManager->get_driver(grandparent, (driver_module_info**)&sdhci,
|
||||||
|
&cookie);
|
||||||
|
gDeviceManager->put_node(grandparent);
|
||||||
|
gDeviceManager->put_node(parent);
|
||||||
|
|
||||||
|
return sdhci->execute_command(cookie, command, argument, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
std_ops(int32 op, ...)
|
std_ops(int32 op, ...)
|
||||||
{
|
{
|
||||||
@@ -113,18 +134,21 @@ driver_module_info mmc_bus_device_module = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
driver_module_info mmc_bus_controller_module = {
|
mmc_device_interface mmc_bus_controller_module = {
|
||||||
{
|
{
|
||||||
MMC_BUS_MODULE_NAME,
|
{
|
||||||
0,
|
MMC_BUS_MODULE_NAME,
|
||||||
&std_ops
|
0,
|
||||||
},
|
&std_ops
|
||||||
|
},
|
||||||
|
|
||||||
NULL, // supported devices
|
NULL, // supported devices
|
||||||
mmc_bus_added_device,
|
mmc_bus_added_device,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
|
},
|
||||||
|
mmc_bus_execute_command
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user