int mmc_bus_test(struct mmc_card *card, u8 bus_width) { int err, width; #if defined(CONFIG_AMBARELLA_IPC) && defined(CONFIG_MMC_AMBARELLA) && !defined(CONFIG_NOT_SHARE_SD_CONTROLLER_WITH_UITRON) struct ipc_sdinfo *sdinfo = ambarella_sd_get_sdinfo(card->host); if (sdinfo->is_init) { u32 bus = (sdinfo->bus_width == 8) ? MMC_BUS_WIDTH_8: (sdinfo->bus_width == 4) ? MMC_BUS_WIDTH_4: MMC_BUS_WIDTH_1; int rval = (bus_width == bus) ? 0: -EINVAL; return rval; } #endif if (bus_width == MMC_BUS_WIDTH_8) width = 8; else if (bus_width == MMC_BUS_WIDTH_4) width = 4; else if (bus_width == MMC_BUS_WIDTH_1) return 0; /* no need for test */ else return -EINVAL; /* * Ignore errors from BUS_TEST_W. BUS_TEST_R will fail if there * is a problem. This improves chances that the test will work. */ mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width); err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); return err; }
int mmc_bus_test(struct mmc_card *card, u8 bus_width) { int err, width; if (bus_width == MMC_BUS_WIDTH_8) width = 8; else if (bus_width == MMC_BUS_WIDTH_4) width = 4; else if (bus_width == MMC_BUS_WIDTH_1) return 0; else return -EINVAL; mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width); err = mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); return err; }
int mmc_bus_test(struct mmc_card *card, u8 bus_width) { int width; if (bus_width == MMC_BUS_WIDTH_8) width = 8; else if (bus_width == MMC_BUS_WIDTH_4) width = 4; else if (bus_width == MMC_BUS_WIDTH_1) return 0; /* no need for test */ else return -EINVAL; /* * Ignore errors from BUS_TEST_W. BUS_TEST_R will fail if there * is a problem. This improves chances that the test will work. */ mmc_send_bus_test(card, card->host, MMC_BUS_TEST_W, width); return mmc_send_bus_test(card, card->host, MMC_BUS_TEST_R, width); }