Exemple #1
0
static int __devinit sdhci_esdhc_probe(struct platform_device *pdev)
{
	return sdhci_pltfm_register(pdev, &sdhci_esdhc_pdata);
}
Exemple #2
0
static int sdhci_hlwd_probe(struct platform_device *pdev)
{
	return sdhci_pltfm_register(pdev, &sdhci_hlwd_pdata, 0);
}
static int sdhci_zynq_probe(struct platform_device *pdev)
{
	int ret;
	int irq = platform_get_irq(pdev, 0);
	const void *prop;
	struct device_node *np = pdev->dev.of_node;
	struct sdhci_host *host;
	struct sdhci_pltfm_host *pltfm_host;
	struct xsdhcips *xsdhcips;

	xsdhcips = kmalloc(sizeof(*xsdhcips), GFP_KERNEL);
	if (!xsdhcips) {
		dev_err(&pdev->dev, "unable to allocate memory\n");
		return -ENOMEM;
	}

	if (irq == 56)
		xsdhcips->aperclk = clk_get_sys("SDIO0_APER", NULL);
	else
		xsdhcips->aperclk = clk_get_sys("SDIO1_APER", NULL);

	if (IS_ERR(xsdhcips->aperclk)) {
		dev_err(&pdev->dev, "APER clock not found.\n");
		ret = PTR_ERR(xsdhcips->aperclk);
		goto err_free;
	}

	if (irq == 56)
		xsdhcips->devclk = clk_get_sys("SDIO0", NULL);
	else
		xsdhcips->devclk = clk_get_sys("SDIO1", NULL);

	if (IS_ERR(xsdhcips->devclk)) {
		dev_err(&pdev->dev, "Device clock not found.\n");
		ret = PTR_ERR(xsdhcips->devclk);
		goto clk_put_aper;
	}

	ret = clk_prepare_enable(xsdhcips->aperclk);
	if (ret) {
		dev_err(&pdev->dev, "Unable to enable APER clock.\n");
		goto clk_put;
	}

	ret = clk_prepare_enable(xsdhcips->devclk);
	if (ret) {
		dev_err(&pdev->dev, "Unable to enable device clock.\n");
		goto clk_dis_aper;
	}

	xsdhcips->clk_rate_change_nb.notifier_call = xsdhcips_clk_notifier_cb;
	xsdhcips->clk_rate_change_nb.next = NULL;
	if (clk_notifier_register(xsdhcips->devclk,
				&xsdhcips->clk_rate_change_nb))
		dev_warn(&pdev->dev, "Unable to register clock notifier.\n");


	ret = sdhci_pltfm_register(pdev, &sdhci_zynq_pdata);
	if (ret) {
		dev_err(&pdev->dev, "Platform registration failed\n");
		goto clk_notif_unreg;
	}

	host = platform_get_drvdata(pdev);
	pltfm_host = sdhci_priv(host);
	pltfm_host->priv = xsdhcips;

	prop = of_get_property(np, "xlnx,has-cd", NULL);
	if (prop == NULL || (!(u32) be32_to_cpup(prop)))
		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;

	return 0;

clk_notif_unreg:
	clk_notifier_unregister(xsdhcips->devclk,
			&xsdhcips->clk_rate_change_nb);
	clk_disable_unprepare(xsdhcips->devclk);
clk_dis_aper:
	clk_disable_unprepare(xsdhcips->aperclk);
clk_put:
	clk_put(xsdhcips->devclk);
clk_put_aper:
	clk_put(xsdhcips->aperclk);
err_free:
	kfree(xsdhcips);

	return ret;
}