|
@@ -473,3 +473,71 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
|
|
|
struct omap_hwmod *ohs[1];
|
|
|
struct omap_device *od;
|
|
|
struct platform_device *pdev;
|
|
|
+ char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
|
|
|
+ struct omap_mmc_platform_data *mmc_data;
|
|
|
+ struct omap_mmc_dev_attr *mmc_dev_attr;
|
|
|
+ char *name;
|
|
|
+ int res;
|
|
|
+
|
|
|
+ mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
|
|
|
+ if (!mmc_data) {
|
|
|
+ pr_err("Cannot allocate memory for mmc device!\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ res = omap_hsmmc_pdata_init(hsmmcinfo, mmc_data);
|
|
|
+ if (res < 0)
|
|
|
+ goto free_mmc;
|
|
|
+
|
|
|
+ omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
|
|
|
+
|
|
|
+ name = "omap_hsmmc";
|
|
|
+ res = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
|
|
|
+ "mmc%d", ctrl_nr);
|
|
|
+ WARN(res >= MAX_OMAP_MMC_HWMOD_NAME_LEN,
|
|
|
+ "String buffer overflow in MMC%d device setup\n", ctrl_nr);
|
|
|
+
|
|
|
+ oh = omap_hwmod_lookup(oh_name);
|
|
|
+ if (!oh) {
|
|
|
+ pr_err("Could not look up %s\n", oh_name);
|
|
|
+ goto free_name;
|
|
|
+ }
|
|
|
+ ohs[0] = oh;
|
|
|
+ if (oh->dev_attr != NULL) {
|
|
|
+ mmc_dev_attr = oh->dev_attr;
|
|
|
+ mmc_data->controller_flags = mmc_dev_attr->flags;
|
|
|
+ /*
|
|
|
+ * erratum 2.1.1.128 doesn't apply if board has
|
|
|
+ * a transceiver is attached
|
|
|
+ */
|
|
|
+ if (hsmmcinfo->transceiver)
|
|
|
+ mmc_data->controller_flags &=
|
|
|
+ ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
|
|
|
+ }
|
|
|
+
|
|
|
+ pdev = platform_device_alloc(name, ctrl_nr - 1);
|
|
|
+ if (!pdev) {
|
|
|
+ pr_err("Could not allocate pdev for %s\n", name);
|
|
|
+ goto free_name;
|
|
|
+ }
|
|
|
+ dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
|
|
|
+
|
|
|
+ od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
|
|
|
+ if (IS_ERR(od)) {
|
|
|
+ pr_err("Could not allocate od for %s\n", name);
|
|
|
+ goto put_pdev;
|
|
|
+ }
|
|
|
+
|
|
|
+ res = platform_device_add_data(pdev, mmc_data,
|
|
|
+ sizeof(struct omap_mmc_platform_data));
|
|
|
+ if (res) {
|
|
|
+ pr_err("Could not add pdata for %s\n", name);
|
|
|
+ goto put_pdev;
|
|
|
+ }
|
|
|
+
|
|
|
+ hsmmcinfo->pdev = pdev;
|
|
|
+
|
|
|
+ if (hsmmcinfo->deferred)
|
|
|
+ goto free_mmc;
|
|
|
+
|
|
|
+ res = omap_device_register(pdev);
|