From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/9] usb: chipidea: add Berlin USB support
Date: Fri, 06 Jun 2014 12:55:54 +0200 [thread overview]
Message-ID: <53919E3A.7070008@gmail.com> (raw)
In-Reply-To: <1401983326-19205-7-git-send-email-antoine.tenart@free-electrons.com>
On 06/05/2014 05:48 PM, Antoine T?nart wrote:
> The Marvell Berlin USB controllers are compatible with ChipIdea. Add a
> driver using the ChipIdea common functions to support them.
>
> Signed-off-by: Antoine T?nart <antoine.tenart@free-electrons.com>
> ---
> drivers/usb/chipidea/Makefile | 1 +
> drivers/usb/chipidea/ci_hdrc_berlin.c | 108 ++++++++++++++++++++++++++++++++++
> 2 files changed, 109 insertions(+)
> create mode 100644 drivers/usb/chipidea/ci_hdrc_berlin.c
>
> diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> index 480bd4d5710a..b3a1b0b3b7a9 100644
> --- a/drivers/usb/chipidea/Makefile
> +++ b/drivers/usb/chipidea/Makefile
> @@ -19,4 +19,5 @@ endif
>
> ifneq ($(CONFIG_OF),)
> obj-$(CONFIG_USB_CHIPIDEA) += usbmisc_imx.o ci_hdrc_imx.o
> + obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_berlin.o
> endif
> diff --git a/drivers/usb/chipidea/ci_hdrc_berlin.c b/drivers/usb/chipidea/ci_hdrc_berlin.c
> new file mode 100644
> index 000000000000..567d83039e3e
> --- /dev/null
> +++ b/drivers/usb/chipidea/ci_hdrc_berlin.c
> @@ -0,0 +1,108 @@
> +/*
> + * Copyright (C) 2014 Marvell Technology Group Ltd.
> + *
> + * Antoine T?nart <antoine.tenart@free-electrons.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2. This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/usb/chipidea.h>
> +#include <linux/usb/hcd.h>
> +#include <linux/usb/ulpi.h>
> +
> +#include "ci.h"
> +
> +struct ci_hdrc_berlin_priv {
> + struct platform_device *ci_pdev;
> + struct clk *clk;
> +};
> +
> +static int ci_hdrc_berlin_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct ci_hdrc_berlin_priv *priv;
> + struct ci_hdrc_platform_data ci_pdata = {
> + .name = "ci_hdrc_berlin",
> + .capoffset = DEF_CAPOFFSET,
> + .flags = CI_HDRC_REQUIRE_TRANSCEIVER |
> + CI_HDRC_DISABLE_STREAMING,
> + };
> + int ret;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(priv->clk)) {
> + dev_err(dev, "failed to get clock: %ld\n", PTR_ERR(priv->clk));
> + return PTR_ERR(priv->clk);
> + }
> +
> + ret = clk_prepare_enable(priv->clk);
> + if (ret)
> + return ret;
> +
> + ci_pdata.phy = devm_usb_get_phy_by_phandle(dev, "marvell,usbphy", 0);
> + if (IS_ERR(ci_pdata.phy)) {
> + ret = PTR_ERR(ci_pdata.phy);
> + goto clk_err;
> + }
> +
> + priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,
> + pdev->num_resources, &ci_pdata);
> + if (IS_ERR(priv->ci_pdev)) {
> + ret = PTR_ERR(priv->ci_pdev);
> + dev_err(dev,
> + "failed to register ci_hdrc platform device: %d\n",
> + ret);
> + goto clk_err;
> + }
> +
> + platform_set_drvdata(pdev, priv);
> +
> + pm_runtime_no_callbacks(dev);
> + pm_runtime_enable(dev);
> +
> + return 0;
> +
> +clk_err:
> + clk_disable_unprepare(priv->clk);
> + return ret;
> +}
> +
> +static int ci_hdrc_berlin_remove(struct platform_device *pdev)
> +{
> + struct ci_hdrc_berlin_priv *priv = platform_get_drvdata(pdev);
> +
> + pm_runtime_disable(&pdev->dev);
> + ci_hdrc_remove_device(priv->ci_pdev);
> + clk_disable_unprepare(priv->clk);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id ci_hdrc_berlin_of_match[] = {
> + { .compatible = "marvell,berlin-usb" },
Looking at the driver, I can see no Berlin-specific code at all. Maybe
we just take the chance and have a generic chipidea boiler plate driver
now?
Sebastian
> + { }
> +};
> +
> +static struct platform_driver ci_hdrc_berlin_driver = {
> + .probe = ci_hdrc_berlin_probe,
> + .remove = ci_hdrc_berlin_remove,
> + .driver = {
> + .name = "berlin-usb",
> + .owner = THIS_MODULE,
> + .of_match_table = ci_hdrc_berlin_of_match,
> + },
> +};
> +module_platform_driver(ci_hdrc_berlin_driver);
> +
> +MODULE_DESCRIPTION("ChipIdea HDRC Berlin USB binding");
> +MODULE_AUTHOR("Antoine T?nart <antoine.tenart@free-electrons.com>");
> +MODULE_LICENSE("GPL");
>
next prev parent reply other threads:[~2014-06-06 10:55 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 15:48 [PATCH 0/9] ARM: Berlin: USB support Antoine Ténart
2014-06-05 15:48 ` [PATCH 1/9] reset: add the Berlin reset controller driver Antoine Ténart
2014-06-05 16:36 ` Philipp Zabel
2014-06-05 16:56 ` Antoine Ténart
2014-06-06 10:44 ` Sebastian Hesselbarth
2014-06-09 10:32 ` Sebastian Hesselbarth
2014-06-09 11:23 ` Philipp Zabel
2014-06-05 15:48 ` [PATCH 2/9] ARM: Berlin: select the reset controller Antoine Ténart
2014-06-05 15:48 ` [PATCH 3/9] ARM: dts: berlin: add a required reset property in the chip controller node Antoine Ténart
2014-06-05 16:39 ` Philipp Zabel
2014-06-05 16:44 ` Antoine Ténart
2014-06-05 15:48 ` [PATCH 4/9] usb: phy: add the Berlin USB PHY driver Antoine Ténart
2014-06-06 6:39 ` Vivek Gautam
2014-06-06 7:11 ` Antoine Ténart
2014-06-06 11:02 ` Vivek Gautam
2014-06-19 13:45 ` Felipe Balbi
2014-06-06 10:54 ` Sebastian Hesselbarth
2014-06-06 11:59 ` Antoine Ténart
2014-06-09 8:26 ` Jisheng Zhang
2014-06-09 10:11 ` Sebastian Hesselbarth
2014-06-09 10:52 ` Alexandre Belloni
2014-06-05 15:48 ` [PATCH 5/9] Documentation: bindings: add doc for the Berlin USB PHY Antoine Ténart
2014-06-05 15:48 ` [PATCH 6/9] usb: chipidea: add Berlin USB support Antoine Ténart
2014-06-06 10:55 ` Sebastian Hesselbarth [this message]
2014-06-06 12:01 ` Antoine Ténart
2014-06-05 15:48 ` [PATCH 7/9] Documentation: bindings: add doc for the Berlin ChipIdea USB driver Antoine Ténart
2014-06-05 15:48 ` [PATCH 8/9] ARM: dts: berlin: add BG2Q nodes for USB support Antoine Ténart
2014-06-05 15:48 ` [PATCH 9/9] ARM: dts: Berlin: enable USB on the BG2Q DMP Antoine Ténart
2014-06-09 4:30 ` [PATCH 0/9] ARM: Berlin: USB support Peter Chen
2014-06-09 10:14 ` Sebastian Hesselbarth
2014-06-10 1:16 ` Peter Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53919E3A.7070008@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).