From: Matt Porter <matt.porter@linaro.org>
To: Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <rob.herring@calxeda.com>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephen Warren <swarren@nvidia.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Christian Daudt <bcm@fixthebug.org>
Cc: Paul Zimmerman <paulz@synopsys.com>,
Linux USB List <linux-usb@vger.kernel.org>,
Linux ARM Kernel List <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Devicetree List <devicetree@vger.kernel.org>,
Linaro Patches <patches@linaro.org>
Subject: [PATCH 4/5] usb: phy: add Broadcom Kona USB PHY driver
Date: Mon, 7 Oct 2013 06:12:31 -0400 [thread overview]
Message-ID: <1381140752-312-5-git-send-email-matt.porter@linaro.org> (raw)
In-Reply-To: <1381140752-312-1-git-send-email-matt.porter@linaro.org>
Add a USB PHY driver for BCM281xx devices. This driver makes use of the
Broadcom Kona USB control driver to control init/shutdown of the PHY.
Signed-off-by: Matt Porter <matt.porter@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
---
.../devicetree/bindings/usb/bcm-kona-usb-phy.txt | 10 +++
drivers/usb/phy/Kconfig | 7 ++
drivers/usb/phy/Makefile | 1 +
drivers/usb/phy/phy-bcm-kona-usb2.c | 99 ++++++++++++++++++++++
4 files changed, 117 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/bcm-kona-usb-phy.txt
create mode 100644 drivers/usb/phy/phy-bcm-kona-usb2.c
diff --git a/Documentation/devicetree/bindings/usb/bcm-kona-usb-phy.txt b/Documentation/devicetree/bindings/usb/bcm-kona-usb-phy.txt
new file mode 100644
index 0000000..a935fe2
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/bcm-kona-usb-phy.txt
@@ -0,0 +1,10 @@
+BROADCOM KONA USB PHY
+
+Required properties:
+ - compatible: brcm,kona-usb2
+
+Example:
+
+ usbphy: usbphy {
+ compatible = "brcm,kona-usb2";
+ };
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 2b7b4f1..d063204 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -105,6 +105,13 @@ config BCM_KONA_CTRL_USB
help
Enable this to support the Broadcom Kona USB control block
+config BCM_KONA_PHY_USB2
+ tristate "Broadcom Kona USB2 PHY Driver"
+ select USB_PHY
+ select BCM_KONA_CTRL_USB
+ help
+ Enable this to support the Broadcom Kona USB 2.0 PHY.
+
config SAMSUNG_USBPHY
tristate
help
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 98c545e..227fba5 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
obj-$(CONFIG_BCM_KONA_CTRL_USB) += phy-bcm-kona-ctrl.o
+obj-$(CONFIG_BCM_KONA_PHY_USB2) += phy-bcm-kona-usb2.o
obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o
obj-$(CONFIG_OMAP_USB3) += phy-omap-usb3.o
obj-$(CONFIG_SAMSUNG_USBPHY) += phy-samsung-usb.o
diff --git a/drivers/usb/phy/phy-bcm-kona-usb2.c b/drivers/usb/phy/phy-bcm-kona-usb2.c
new file mode 100644
index 0000000..21aee4a
--- /dev/null
+++ b/drivers/usb/phy/phy-bcm-kona-usb2.c
@@ -0,0 +1,99 @@
+/*
+ * phy-bcm-kona-control.c - Broadcom Kona USB2 Phy Driver
+ *
+ * Copyright (C) 2013 Linaro Limited
+ * Matt Porter <matt.porter@linaro.org>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include "bcm-kona-usb.h"
+
+static int bcm_kona_phy_init(struct usb_phy *uphy)
+{
+ struct bcm_kona_usb *phy = dev_get_drvdata(uphy->dev);
+
+ bcm_kona_ctrl_usb_phy_power(phy->ctrl_dev, 1);
+
+ return 0;
+}
+
+static void bcm_kona_phy_shutdown(struct usb_phy *uphy)
+{
+ struct bcm_kona_usb *phy = dev_get_drvdata(uphy->dev);
+
+ bcm_kona_ctrl_usb_phy_power(phy->ctrl_dev, 0);
+}
+
+static int bcm_kona_usb2_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct bcm_kona_usb *phy;
+
+ phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
+ if (!phy)
+ return -ENOMEM;
+
+ phy->ctrl_dev = bcm_kona_get_ctrl_dev();
+ if (IS_ERR(phy->ctrl_dev)) {
+ dev_dbg(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
+ }
+
+ phy->dev = dev;
+ phy->phy.dev = phy->dev;
+ phy->phy.label = "bcm-kona-usb2";
+ phy->phy.init = bcm_kona_phy_init;
+ phy->phy.shutdown = bcm_kona_phy_shutdown;
+ phy->phy.type = USB_PHY_TYPE_USB2;
+
+ platform_set_drvdata(pdev, phy);
+
+ usb_add_phy_dev(&phy->phy);
+
+ return 0;
+}
+
+static int bcm_kona_usb2_remove(struct platform_device *pdev)
+{
+ struct bcm_kona_usb *phy = platform_get_drvdata(pdev);
+
+ usb_remove_phy(&phy->phy);
+
+ return 0;
+}
+
+static const struct of_device_id bcm_kona_usb2_dt_ids[] = {
+ { .compatible = "brcm,kona-usb2" },
+ { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, bcm_kona_usb2_dt_ids);
+
+static struct platform_driver bcm_kona_usb2_driver = {
+ .probe = bcm_kona_usb2_probe,
+ .remove = bcm_kona_usb2_remove,
+ .driver = {
+ .name = "bcm-kona-usb2",
+ .owner = THIS_MODULE,
+ .of_match_table = bcm_kona_usb2_dt_ids,
+ },
+};
+
+module_platform_driver(bcm_kona_usb2_driver);
+
+MODULE_ALIAS("platform:bcm-kona-usb2");
+MODULE_AUTHOR("Matt Porter");
+MODULE_DESCRIPTION("BCM Kona USB 2.0 PHY driver");
+MODULE_LICENSE("GPL v2");
--
1.8.4
next prev parent reply other threads:[~2013-10-07 10:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-07 10:12 [PATCH 0/5] USB Device Controller support for BCM281xx Matt Porter
2013-10-07 10:12 ` [PATCH 1/5] usb: gadget: s3c-hsotg: enable build for other platforms Matt Porter
2013-10-07 10:12 ` [PATCH 2/5] usb: gadget: s3c-hsotg: support configurable UTMI PHY width Matt Porter
2013-10-10 15:29 ` Felipe Balbi
2013-10-10 16:54 ` Matt Porter
2013-10-10 17:46 ` Felipe Balbi
2013-10-10 17:57 ` Paul Zimmerman
2013-10-10 18:07 ` Felipe Balbi
2013-10-10 18:14 ` Paul Zimmerman
2013-10-10 18:57 ` Felipe Balbi
2013-10-10 19:07 ` Matt Porter
[not found] ` <5256FAFA.1020509-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-11 3:21 ` Matt Porter
[not found] ` <52576EBA.9000502-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-11 13:37 ` Felipe Balbi
2013-10-17 12:40 ` Matt Porter
2013-10-07 10:12 ` [PATCH 3/5] usb: phy: add Broadcom Kona USB control driver Matt Porter
[not found] ` <1381140752-312-4-git-send-email-matt.porter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-10 15:31 ` Felipe Balbi
2013-10-11 13:47 ` Matt Porter
2013-10-07 10:12 ` Matt Porter [this message]
[not found] ` <1381140752-312-1-git-send-email-matt.porter-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-07 10:12 ` [PATCH 5/5] ARM: dts: add usb udc support to bcm281xx Matt Porter
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=1381140752-312-5-git-send-email-matt.porter@linaro.org \
--to=matt.porter@linaro.org \
--cc=balbi@ti.com \
--cc=bcm@fixthebug.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=patches@linaro.org \
--cc=paulz@synopsys.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=swarren@nvidia.com \
/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).