Пример #1
0
/**
 * Setup the bus width and IO speed
 * @param mci_pdata MCI platform data
 * @param mci_dev MCI device instance
 * @param bus_width New bus width value (1, 4 or 8)
 * @param clock New clock in Hz (can be '0' to disable the clock)
 *
 * Drivers currently realized values are stored in MCI's platformdata
 */
static void mxs_mci_set_ios(struct mci_host *host, struct mci_ios *ios)
{
    struct mxs_mci_host *mxs_mci = to_mxs_mci(host);

    switch (ios->bus_width) {
    case MMC_BUS_WIDTH_8:
        mxs_mci->bus_width = 2;
        host->bus_width = 8;	/* 8 bit is possible */
        break;
    case MMC_BUS_WIDTH_4:
        mxs_mci->bus_width = 1;
        host->bus_width = 4;	/* 4 bit is possible */
        break;
    case MMC_BUS_WIDTH_1:
        mxs_mci->bus_width = 0;
        host->bus_width = 1;	/* 1 bit is possible */
        break;
    default:
        return;
    }

    mxs_mci->clock = mxs_mci_setup_clock_speed(mxs_mci, ios->clock);
    pr_debug("IO settings: bus width=%d, frequency=%u Hz\n", host->bus_width,
             mxs_mci->clock);
}
Пример #2
0
/**
 * Setup the bus width and IO speed
 * @param mci_pdata MCI platform data
 * @param mci_dev MCI device instance
 * @param bus_width New bus width value (1, 4 or 8)
 * @param clock New clock in Hz (can be '0' to disable the clock)
 *
 * Drivers currently realized values are stored in MCI's platformdata
 */
static void mxs_mci_set_ios(struct mci_host *host, struct mci_ios *ios)
{
	struct mxs_mci_host *mxs_mci = to_mxs_mci(host);

	switch (ios->bus_width) {
	case MMC_BUS_WIDTH_8:
		mxs_mci->bus_width = 2;
		pr_debug("IO settings: changing bus width to 8 bits\n");
		break;
	case MMC_BUS_WIDTH_4:
		mxs_mci->bus_width = 1;
		pr_debug("IO settings: changing bus width to 4 bits\n");
		break;
	case MMC_BUS_WIDTH_1:
		mxs_mci->bus_width = 0;
		pr_debug("IO settings: changing bus width to 1 bit\n");
		break;
	default:
		pr_debug("IO settings: unsupported bus width!\n");
		return;
	}

	mxs_mci->clock = mxs_mci_setup_clock_speed(mxs_mci, ios->clock);

	dev_dbg(host->hw_dev, "IO settings: frequency=%u Hz\n", mxs_mci->clock);
}