Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: pxa: lubbock: pass udc irqs as resource

Lubbock is the only machine that has three IRQs for the UDC.
These are currently hardcoded in the driver based on a
machine header file.

Change this to use platform device resources as we use for
the generic IRQ anyway.

Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+32 -26
-2
arch/arm/mach-pxa/include/mach/lubbock.h arch/arm/mach-pxa/lubbock.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * arch/arm/mach-pxa/include/mach/lubbock.h 4 - * 5 3 * Author: Nicolas Pitre 6 4 * Created: Jun 15, 2001 7 5 * Copyright: MontaVista Software Inc.
+11 -1
arch/arm/mach-pxa/lubbock.c
··· 46 46 47 47 #include "pxa25x.h" 48 48 #include <linux/platform_data/asoc-pxa.h> 49 - #include <mach/lubbock.h> 49 + #include "lubbock.h" 50 50 #include "udc.h" 51 51 #include <linux/platform_data/irda-pxaficp.h> 52 52 #include <linux/platform_data/video-pxafb.h> ··· 129 129 static struct pxa2xx_udc_mach_info udc_info __initdata = { 130 130 .udc_is_connected = lubbock_udc_is_connected, 131 131 // no D+ pullup; lubbock can't connect/disconnect in software 132 + }; 133 + 134 + static struct resource lubbock_udc_resources[] = { 135 + DEFINE_RES_MEM(0x40600000, 0x10000), 136 + DEFINE_RES_IRQ(IRQ_USB), 137 + DEFINE_RES_IRQ(LUBBOCK_USB_IRQ), 138 + DEFINE_RES_IRQ(LUBBOCK_USB_DISC_IRQ), 132 139 }; 133 140 134 141 /* GPIOs for SA1111 PCMCIA */ ··· 503 496 lubbock_init_pcmcia(); 504 497 505 498 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); 499 + /* lubbock has two extra IRQs */ 500 + pxa25x_device_udc.resource = lubbock_udc_resources; 501 + pxa25x_device_udc.num_resources = ARRAY_SIZE(lubbock_udc_resources); 506 502 pxa_set_udc_info(&udc_info); 507 503 pxa_set_fb_info(NULL, &sharp_lm8v31); 508 504 pxa_set_mci_info(&lubbock_mci_platform_data);
+19 -18
drivers/usb/gadget/udc/pxa25x_udc.c
··· 44 44 #include <linux/usb/gadget.h> 45 45 #include <linux/usb/otg.h> 46 46 47 - #ifdef CONFIG_ARCH_LUBBOCK 48 - #include <mach/lubbock.h> 49 - #endif 50 - 51 47 #define UDCCR 0x0000 /* UDC Control Register */ 52 48 #define UDC_RES1 0x0004 /* UDC Undocumented - Reserved1 */ 53 49 #define UDC_RES2 0x0008 /* UDC Undocumented - Reserved2 */ ··· 1574 1578 int vbus; 1575 1579 1576 1580 dev->stats.irqs++; 1577 - switch (irq) { 1578 - case LUBBOCK_USB_IRQ: 1581 + if (irq == dev->usb_irq) { 1579 1582 vbus = 1; 1580 - disable_irq(LUBBOCK_USB_IRQ); 1581 - enable_irq(LUBBOCK_USB_DISC_IRQ); 1582 - break; 1583 - case LUBBOCK_USB_DISC_IRQ: 1583 + disable_irq(dev->usb_irq); 1584 + enable_irq(dev->usb_disc_irq); 1585 + } else if (irq == dev->usb_disc_irq) { 1584 1586 vbus = 0; 1585 - disable_irq(LUBBOCK_USB_DISC_IRQ); 1586 - enable_irq(LUBBOCK_USB_IRQ); 1587 - break; 1588 - default: 1587 + disable_irq(dev->usb_disc_irq); 1588 + enable_irq(dev->usb_irq); 1589 + } else { 1589 1590 return IRQ_NONE; 1590 1591 } 1591 1592 ··· 2415 2422 2416 2423 #ifdef CONFIG_ARCH_LUBBOCK 2417 2424 if (machine_is_lubbock()) { 2418 - retval = devm_request_irq(&pdev->dev, LUBBOCK_USB_DISC_IRQ, 2425 + dev->usb_irq = platform_get_irq(pdev, 1); 2426 + if (dev->usb_irq < 0) 2427 + return dev->usb_irq; 2428 + 2429 + dev->usb_disc_irq = platform_get_irq(pdev, 2); 2430 + if (dev->usb_disc_irq < 0) 2431 + return dev->usb_disc_irq; 2432 + 2433 + retval = devm_request_irq(&pdev->dev, dev->usb_disc_irq, 2419 2434 lubbock_vbus_irq, 0, driver_name, 2420 2435 dev); 2421 2436 if (retval != 0) { 2422 2437 pr_err("%s: can't get irq %i, err %d\n", 2423 - driver_name, LUBBOCK_USB_DISC_IRQ, retval); 2438 + driver_name, dev->usb_disc_irq, retval); 2424 2439 goto err; 2425 2440 } 2426 - retval = devm_request_irq(&pdev->dev, LUBBOCK_USB_IRQ, 2441 + retval = devm_request_irq(&pdev->dev, dev->usb_irq, 2427 2442 lubbock_vbus_irq, 0, driver_name, 2428 2443 dev); 2429 2444 if (retval != 0) { 2430 2445 pr_err("%s: can't get irq %i, err %d\n", 2431 - driver_name, LUBBOCK_USB_IRQ, retval); 2446 + driver_name, dev->usb_irq, retval); 2432 2447 goto err; 2433 2448 } 2434 2449 } else
+2 -5
drivers/usb/gadget/udc/pxa25x_udc.h
··· 117 117 u64 dma_mask; 118 118 struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS]; 119 119 void __iomem *regs; 120 + int usb_irq; 121 + int usb_disc_irq; 120 122 }; 121 123 #define to_pxa25x(g) (container_of((g), struct pxa25x_udc, gadget)) 122 124 123 125 /*-------------------------------------------------------------------------*/ 124 - 125 - #ifdef CONFIG_ARCH_LUBBOCK 126 - #include <mach/lubbock.h> 127 - /* lubbock can also report usb connect/disconnect irqs */ 128 - #endif 129 126 130 127 static struct pxa25x_udc *the_controller; 131 128