[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140513121450.GC3213@kwain>
Date: Tue, 13 May 2014 14:14:50 +0200
From: Antoine Ténart
<antoine.tenart@...e-electrons.com>
To: sebastian.hesselbarth@...il.com, tj@...nel.org, kishon@...com
Cc: Antoine Ténart
<antoine.tenart@...e-electrons.com>,
alexandre.belloni@...e-electrons.com,
thomas.petazzoni@...e-electrons.com, zmxu@...vell.com,
jszhang@...vell.com, linux-arm-kernel@...ts.infradead.org,
linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/6] phy: add a driver for the Berlin SATA PHY
On Mon, May 12, 2014 at 11:16:52AM +0200, Antoine Ténart wrote:
[…]
> +static int phy_berlin_sata_probe(struct platform_device *pdev)
> +{
> + struct phy *phy;
> + struct phy_provider *phy_provider;
> + struct priv *priv;
> + struct resource *res;
> + int i;
> +
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + priv->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> + if (IS_ERR(priv->base))
> + return PTR_ERR(priv->base);
> +
> + phy = devm_phy_create(&pdev->dev, &phy_berlin_sata_ops, NULL);
> + if (IS_ERR(phy))
> + return PTR_ERR(phy);
Not needed.
Antoine
> +
> + dev_set_drvdata(&pdev->dev, priv);
> + spin_lock_init(&priv->lock);
> +
> + for (i = 0; i < BERLIN_SATA_PHY_NB; i++) {
> + struct phy *phy = devm_phy_create(&pdev->dev,
> + &phy_berlin_sata_ops, NULL);
> + if (IS_ERR(phy)) {
> + dev_err(&pdev->dev, "failed to create PHY %d\n", i);
> + return PTR_ERR(phy);
> + }
> +
> + priv->phys[i].phy = phy;
> + priv->phys[i].val = desc[i].val;
> + priv->phys[i].index = i;
> + phy_set_drvdata(phy, &priv->phys[i]);
> +
> + /* Make sure the PHY is off */
> + phy_berlin_sata_power_off(phy);
> + }
> +
> + phy_provider = devm_of_phy_provider_register(&pdev->dev,
> + berlin_sata_phy_xlate);
> + if (IS_ERR(phy_provider))
> + return PTR_ERR(phy_provider);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id phy_berlin_sata_of_match[] = {
> + { .compatible = "marvell,berlin-sata-phy" },
> + { },
> +};
> +
> +static struct platform_driver phy_berlin_sata_driver = {
> + .probe = phy_berlin_sata_probe,
> + .driver = {
> + .name = "phy-berlin-sata",
> + .owner = THIS_MODULE,
> + .of_match_table = phy_berlin_sata_of_match,
> + },
> +};
> +module_platform_driver(phy_berlin_sata_driver);
> +
> +MODULE_DESCRIPTION("Marvell Berlin SATA PHY driver");
> +MODULE_AUTHOR("Antoine Ténart <antoine.tenart@...e-electrons.com>");
> +MODULE_LICENSE("GPL");
> --
> 1.9.1
>
--
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists