2014-08-11 09:27:22 +00:00
|
|
|
/*
|
|
|
|
* SD/MMC Greybus driver.
|
|
|
|
*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Released under the GPLv2 only.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/mmc/host.h>
|
|
|
|
#include "greybus.h"
|
|
|
|
|
2014-08-30 23:20:22 +00:00
|
|
|
struct gb_sdio_host {
|
2014-08-11 09:27:22 +00:00
|
|
|
struct mmc_host *mmc;
|
|
|
|
struct mmc_request *mrq;
|
|
|
|
// FIXME - some lock?
|
|
|
|
};
|
|
|
|
|
2014-09-01 20:31:31 +00:00
|
|
|
static const struct greybus_module_id id_table[] = {
|
2014-08-11 09:27:22 +00:00
|
|
|
{ GREYBUS_DEVICE(0x43, 0x43) }, /* make shit up */
|
|
|
|
{ }, /* terminating NULL entry */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void gb_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
|
|
|
|
{
|
|
|
|
// FIXME - do something here...
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gb_sd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|
|
|
{
|
|
|
|
// FIXME - do something here...
|
|
|
|
}
|
|
|
|
|
|
|
|
static int gb_sd_get_ro(struct mmc_host *mmc)
|
|
|
|
{
|
|
|
|
// FIXME - do something here...
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct mmc_host_ops gb_sd_ops = {
|
|
|
|
.request = gb_sd_request,
|
|
|
|
.set_ios = gb_sd_set_ios,
|
|
|
|
.get_ro = gb_sd_get_ro,
|
|
|
|
};
|
|
|
|
|
2014-08-30 23:47:26 +00:00
|
|
|
int gb_sdio_probe(struct greybus_device *gdev,
|
2014-09-01 20:31:31 +00:00
|
|
|
const struct greybus_module_id *id)
|
2014-08-11 09:27:22 +00:00
|
|
|
{
|
|
|
|
struct mmc_host *mmc;
|
2014-08-30 23:20:22 +00:00
|
|
|
struct gb_sdio_host *host;
|
2014-08-11 09:27:22 +00:00
|
|
|
|
2014-08-30 23:20:22 +00:00
|
|
|
mmc = mmc_alloc_host(sizeof(struct gb_sdio_host), &gdev->dev);
|
2014-08-11 09:27:22 +00:00
|
|
|
if (!mmc)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
host = mmc_priv(mmc);
|
|
|
|
host->mmc = mmc;
|
|
|
|
|
|
|
|
mmc->ops = &gb_sd_ops;
|
|
|
|
// FIXME - set up size limits we can handle.
|
|
|
|
|
2014-08-30 23:52:18 +00:00
|
|
|
gdev->gb_sdio_host = host;
|
2014-08-11 09:27:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-08-30 23:47:26 +00:00
|
|
|
void gb_sdio_disconnect(struct greybus_device *gdev)
|
2014-08-11 09:27:22 +00:00
|
|
|
{
|
|
|
|
struct mmc_host *mmc;
|
2014-08-30 23:20:22 +00:00
|
|
|
struct gb_sdio_host *host;
|
2014-08-11 09:27:22 +00:00
|
|
|
|
2014-08-30 23:52:18 +00:00
|
|
|
host = gdev->gb_sdio_host;
|
2014-08-11 09:27:22 +00:00
|
|
|
mmc = host->mmc;
|
|
|
|
|
|
|
|
mmc_remove_host(mmc);
|
|
|
|
mmc_free_host(mmc);
|
|
|
|
}
|
|
|
|
|
2014-08-30 23:47:26 +00:00
|
|
|
#if 0
|
2014-08-11 09:27:22 +00:00
|
|
|
static struct greybus_driver sd_gb_driver = {
|
2014-08-30 23:47:26 +00:00
|
|
|
.probe = gb_sdio_probe,
|
|
|
|
.disconnect = gb_sdio_disconnect,
|
2014-08-11 09:27:22 +00:00
|
|
|
.id_table = id_table,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_greybus_driver(sd_gb_driver);
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_DESCRIPTION("Greybus SD/MMC Host driver");
|
|
|
|
MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org>");
|
2014-08-30 23:47:26 +00:00
|
|
|
#endif
|