From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] usb: Add OHCI platform driver
Date: Wed, 25 May 2016 21:13:25 +0300 [thread overview]
Message-ID: <1464200006-7963-2-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1464200006-7963-1-git-send-email-shc_work@mail.ru>
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/usb/host/Kconfig | 3 +++
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ohci-platform.c | 57 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
create mode 100644 drivers/usb/host/ohci-platform.c
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 54eaf46..6ff4afc 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -22,6 +22,9 @@ config USB_OHCI_AT91
depends on ARCH_AT91
bool "AT91 OHCI driver"
+config USB_OHCI_PLATFORM
+ bool "Platform OHCI driver"
+
endif
config USB_XHCI
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 0478d34..1b5319d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o
obj-$(CONFIG_USB_EHCI_ATMEL) += ehci-atmel.o
obj-$(CONFIG_USB_OHCI) += ohci-hcd.o
obj-$(CONFIG_USB_OHCI_AT91) += ohci-at91.o
+obj-$(CONFIG_USB_OHCI_PLATFORM) += ohci-platform.o
obj-$(CONFIG_USB_XHCI) += xhci-hcd.o xhci-hub.o
obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
new file mode 100644
index 0000000..4c97330
--- /dev/null
+++ b/drivers/usb/host/ohci-platform.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include <common.h>
+#include <driver.h>
+#include <errno.h>
+#include <init.h>
+#include <io.h>
+#include <linux/clk.h>
+
+struct ohci_platform_data {
+ int (*probe)(struct device_d *, struct resource *);
+};
+
+static struct platform_device_id ohci_platform_ids[] = {
+ { }
+};
+
+static int ohci_platform_probe(struct device_d *dev)
+{
+ struct ohci_platform_data *data;
+ struct resource *res;
+ int ret;
+
+ ret = dev_get_drvdata(dev, (const void **)&data);
+ if (ret)
+ return ret;
+
+ res = dev_get_resource(dev, IORESOURCE_MEM, 0);
+ if (IS_ERR(res))
+ return PTR_ERR(res);
+
+ dev->priv = data;
+
+ if (data->probe) {
+ ret = data->probe(dev, res);
+ if (ret)
+ return ret;
+ }
+
+ add_generic_device_res("ohci", DEVICE_ID_SINGLE, res, 1, NULL);
+
+ return 0;
+}
+
+static struct driver_d ohci_platform_driver = {
+ .name = "ohci-platform",
+ .id_table = ohci_platform_ids,
+ .probe = ohci_platform_probe,
+};
+device_platform_driver(ohci_platform_driver);
--
2.4.9
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-05-25 18:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-25 18:13 [PATCH 1/3] usb: ohci: Clear control register at driver startup Alexander Shiyan
2016-05-25 18:13 ` Alexander Shiyan [this message]
2016-05-26 6:28 ` [PATCH 2/3] usb: Add OHCI platform driver Sascha Hauer
2016-05-25 18:13 ` [PATCH 3/3] usb: Replace AT91 OHCI driver with platform OHCI driver Alexander Shiyan
2016-05-26 6:21 ` [PATCH 1/3] usb: ohci: Clear control register at driver startup Sascha Hauer
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=1464200006-7963-2-git-send-email-shc_work@mail.ru \
--to=shc_work@mail.ru \
--cc=barebox@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