diff mbox

[v3,21/26] ARM: pxa: magician: Add support for PXA27x UDC

Message ID 55FB66B0.6070405@tul.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Petr Cvek Sept. 18, 2015, 1:19 a.m. UTC
A PXA27x SoC supports USB device mode, this patch adds support for that.

Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
---
 arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Robert Jarzmik Sept. 26, 2015, 3:04 p.m. UTC | #1
Petr Cvek <petr.cvek@tul.cz> writes:

> A PXA27x SoC supports USB device mode, this patch adds support for that.
>
> Signed-off-by: Petr Cvek <petr.cvek@tul.cz>
Waiting for a week for Philipp's ack and queuing it after.

Cheers.

--
Robert
diff mbox

Patch

diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 490d79f..76f8399 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -54,6 +54,10 @@ 
 
 #include <linux/regulator/max1586.h>
 
+#include <linux/platform_data/pxa2xx_udc.h>
+#include <mach/udc.h>
+#include <mach/pxa27x-udc.h>
+
 #include "devices.h"
 #include "generic.h"
 
@@ -582,6 +586,23 @@  static struct platform_device pasic3 = {
  * PXA UDC
  */
 
+static void magician_udc_command(int cmd)
+{
+	if (cmd == PXA2XX_UDC_CMD_CONNECT)
+		UP2OCR |= UP2OCR_DPPUE | UP2OCR_DPPUBE;
+	else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+		UP2OCR &= ~(UP2OCR_DPPUE | UP2OCR_DPPUBE);
+}
+
+static struct pxa2xx_udc_mach_info magician_udc_info __initdata = {
+	.udc_command		= magician_udc_command,
+	.gpio_pullup		= GPIO27_MAGICIAN_USBC_PUEN,
+};
+
+/*
+ * USB device VUSB detection
+ */
+
 static struct resource gpio_vbus_resource = {
 	.flags	= IORESOURCE_IRQ,
 	.start	= IRQ_MAGICIAN_VBUS,
@@ -1120,6 +1141,7 @@  static void __init magician_init(void)
 
 	pxa_set_mci_info(&magician_mci_info);
 	pxa_set_ohci_info(&magician_ohci_info);
+	pxa_set_udc_info(&magician_udc_info);
 
 	/* Check LCD type we have */
 	cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);