mci: implement detect driver callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
95e7982f99
commit
dffbe91e8b
|
@ -1596,6 +1596,24 @@ static int mci_init(void)
|
|||
|
||||
device_initcall(mci_init);
|
||||
|
||||
int mci_detect_card(struct mci_host *host)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = mci_check_if_already_initialized(host->mci);
|
||||
if (rc != 0)
|
||||
return 0;
|
||||
|
||||
return mci_card_probe(host->mci);
|
||||
}
|
||||
|
||||
static int mci_detect(struct device_d *dev)
|
||||
{
|
||||
struct mci *mci = container_of(dev, struct mci, dev);
|
||||
|
||||
return mci_detect_card(mci->host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new mci device (for convenience)
|
||||
* @param host mci_host for this MCI device
|
||||
|
@ -1619,6 +1637,9 @@ int mci_register(struct mci_host *host)
|
|||
|
||||
mci->dev.platform_data = host;
|
||||
mci->dev.parent = host->hw_dev;
|
||||
mci->host = host;
|
||||
host->mci = mci;
|
||||
mci->dev.detect = mci_detect;
|
||||
|
||||
ret = register_device(&mci->dev);
|
||||
if (ret)
|
||||
|
|
|
@ -285,9 +285,12 @@ struct mci_ios {
|
|||
#define MMC_1_8V_SDR_MODE 4
|
||||
};
|
||||
|
||||
struct mci;
|
||||
|
||||
/** host information */
|
||||
struct mci_host {
|
||||
struct device_d *hw_dev; /**< the host MCI hardware device */
|
||||
struct mci *mci;
|
||||
char *devname; /**< the devicename for the card, defaults to disk%d */
|
||||
unsigned voltages;
|
||||
unsigned host_caps; /**< Host's interface capabilities, refer MMC_VDD_* */
|
||||
|
@ -308,8 +311,6 @@ struct mci_host {
|
|||
int (*card_write_protected)(struct mci_host *);
|
||||
};
|
||||
|
||||
struct mci;
|
||||
|
||||
#define MMC_NUM_BOOT_PARTITION 2
|
||||
#define MMC_NUM_GP_PARTITION 4
|
||||
#define MMC_NUM_PHY_PARTITION 6
|
||||
|
@ -362,5 +363,6 @@ struct mci {
|
|||
};
|
||||
|
||||
int mci_register(struct mci_host*);
|
||||
int mci_detect_card(struct mci_host *);
|
||||
|
||||
#endif /* _MCI_H_ */
|
||||
|
|
Loading…
Reference in New Issue