static int __devinit omap_elm_probe(struct platform_device *pdev) { struct resource *res = NULL, *irq = NULL; int ret_status = 0; static struct clk *elm_clk; irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (irq == NULL) { ret_status = -EBUSY; goto err_resource; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { ret_status = -EBUSY; goto err_resource; } if (!request_mem_region(res->start, resource_size(res), dev_name(&pdev->dev))) { ret_status = -EBUSY; goto err_resource; } elm_base = ioremap(res->start, resource_size(res)); if (!elm_base) { dev_dbg(&pdev->dev, "can't ioremap ELM\n"); ret_status = -ENOMEM; goto err_remap; } elm_clk = clk_get(&pdev->dev, "elm_fck"); if (IS_ERR(elm_clk)) { printk(KERN_ERR "Could not get ELM clock %s\n", "elm_fck"); ret_status = -ENOMEM; goto err_clk; } ret_status = request_irq(irq->start, elm_isr, 0, pdev->name, &pdev->dev); if (ret_status) { printk(KERN_ERR "failure requesting irq %i\n", irq->start); goto err_put_clock; } clk_enable(elm_clk); elm_reset(); elm_config(1); init_completion(&elm_completion); return ret_status; err_put_clock: clk_put(elm_clk); err_clk: iounmap(elm_base); err_remap: release_mem_region(res->start, resource_size(res)); err_resource: return ret_status; }
static int __devinit omap_elm_probe(struct platform_device *pdev) { struct resource *res = NULL, *irq = NULL; int ret_status = 0; static struct clk *elm_clk; struct omap_elm_platform_data *platform_data = pdev->dev.platform_data; irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (irq == NULL) { ret_status = -EBUSY; goto err_resource; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { ret_status = -EBUSY; goto err_resource; } if (!request_mem_region(res->start, resource_size(res), dev_name(&pdev->dev))) { ret_status = -EBUSY; goto err_resource; } elm_base = ioremap(res->start, resource_size(res)); if (!elm_base) { dev_dbg(&pdev->dev, "can't ioremap ELM\n"); ret_status = -ENOMEM; goto err_remap; } elm_clk = clk_get(&pdev->dev, "elm_fck"); if (IS_ERR(elm_clk)) { printk(KERN_ERR "Could not get ELM clock %s\n", "elm_fck"); ret_status = -ENOMEM; goto err_clk; } ret_status = request_irq(irq->start, elm_isr, 0, pdev->name, &pdev->dev); if (ret_status) { printk(KERN_ERR "failure requesting irq %i\n", irq->start); goto err_put_clock; } clk_enable(elm_clk); elm_reset(); /* configure ELM module for handling various BCHx ECC schemes */ if (platform_data == NULL) { printk(KERN_NOTICE "%s: Error: missing platform data" "cannot initialize ELM", DRIVER_NAME); return -EINVAL; } if (platform_data->ecc_opt == OMAP_ECC_BCH16_CODE_HW) elm_config(ECC_TYPE_BCH16); else if (platform_data->ecc_opt == OMAP_ECC_BCH8_CODE_HW) elm_config(ECC_TYPE_BCH8); else elm_config(ECC_TYPE_BCH4); init_completion(&elm_completion); return ret_status; err_put_clock: clk_put(elm_clk); err_clk: iounmap(elm_base); err_remap: release_mem_region(res->start, resource_size(res)); err_resource: return ret_status; }