From mboxrd@z Thu Jan 1 00:00:00 1970 From: petr.cvek@tul.cz (Petr Cvek) Date: Mon, 28 Sep 2015 23:39:33 +0200 Subject: [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC In-Reply-To: References: Message-ID: <5609B395.8040800@tul.cz> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org A PXA27x SoC supports USB device mode, this patch adds support for that. Signed-off-by: Petr Cvek --- arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 490d79f..331dfd1 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -54,6 +54,10 @@ #include +#include +#include +#include + #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); -- 1.7.12.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754397AbbI1Vjg (ORCPT ); Mon, 28 Sep 2015 17:39:36 -0400 Received: from bubo.tul.cz ([147.230.16.1]:46091 "EHLO bubo.tul.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754264AbbI1Vjc (ORCPT ); Mon, 28 Sep 2015 17:39:32 -0400 From: Petr Cvek Subject: [PATCH v4 21/26] ARM: pxa: magician: Add support for PXA27x UDC To: robert.jarzmik@free.fr, philipp.zabel@gmail.com, daniel@zonque.org, haojian.zhuang@gmail.com, linux@arm.linux.org.uk References: Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-ID: <5609B395.8040800@tul.cz> Date: Mon, 28 Sep 2015 23:39:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A PXA27x SoC supports USB device mode, this patch adds support for that. Signed-off-by: Petr Cvek --- arch/arm/mach-pxa/magician.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 490d79f..331dfd1 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -54,6 +54,10 @@ #include +#include +#include +#include + #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); -- 1.7.12.1