Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0830004 authored by Uwe Kleine-König's avatar Uwe Kleine-König
Browse files

ARM: imx: dynamically allocate imx_udc device



This is only available for mx1 machines with no in-tree user.

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 300f86da
Loading
Loading
Loading
Loading
+0 −43
Original line number Diff line number Diff line
@@ -70,49 +70,6 @@ struct platform_device imx1_camera_device = {
	.num_resources  = ARRAY_SIZE(imx1_camera_resources),
};

static struct resource imx_usb_resources[] = {
	{
		.start	= 0x00212000,
		.end	= 0x00212148,
		.flags	= IORESOURCE_MEM,
	}, {
		.start	= MX1_USBD_INT0,
		.end	= MX1_USBD_INT0,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT1,
		.end	= MX1_USBD_INT1,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT2,
		.end	= MX1_USBD_INT2,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT3,
		.end	= MX1_USBD_INT3,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT4,
		.end	= MX1_USBD_INT4,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT5,
		.end	= MX1_USBD_INT5,
		.flags	= IORESOURCE_IRQ,
	}, {
		.start	= MX1_USBD_INT6,
		.end	= MX1_USBD_INT6,
		.flags	= IORESOURCE_IRQ,
	},
};

struct platform_device imx_usb_device = {
	.name		= "imx_udc",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(imx_usb_resources),
	.resource	= imx_usb_resources,
};

/* GPIO port description */
static struct mxc_gpio_port imx_gpio_ports[] = {
	{
+0 −1
Original line number Diff line number Diff line
#ifdef CONFIG_ARCH_MX1
extern struct platform_device imx1_camera_device;
extern struct platform_device imx_usb_device;
#endif

#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ config IMX_HAVE_PLATFORM_IMX_SSI
config IMX_HAVE_PLATFORM_IMX_UART
	bool

config IMX_HAVE_PLATFORM_IMX_UDC
	bool

config IMX_HAVE_PLATFORM_MXC_NAND
	bool

+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ obj-y += platform-imx-dma.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) +=  platform-spi_imx.o
+75 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 Pengutronix
 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 2 as published by the
 * Free Software Foundation.
 */
#include <mach/hardware.h>
#include <mach/devices-common.h>

#define imx_imx_udc_data_entry_single(soc, _size)			\
	{								\
		.iobase = soc ## _USBD_BASE_ADDR,			\
		.iosize = _size,					\
		.irq0 = soc ## _INT_USBD0,				\
		.irq1 = soc ## _INT_USBD1,				\
		.irq2 = soc ## _INT_USBD2,				\
		.irq3 = soc ## _INT_USBD3,				\
		.irq4 = soc ## _INT_USBD4,				\
		.irq5 = soc ## _INT_USBD5,				\
		.irq6 = soc ## _INT_USBD6,				\
	}

#define imx_imx_udc_data_entry(soc, _size)				\
	[_id] = imx_imx_udc_data_entry_single(soc, _size)

#ifdef CONFIG_SOC_IMX1
const struct imx_imx_udc_data imx1_imx_udc_data __initconst =
	imx_imx_udc_data_entry_single(MX1, SZ_4K);
#endif /* ifdef CONFIG_SOC_IMX1 */

struct platform_device *__init imx_add_imx_udc(
		const struct imx_imx_udc_data *data,
		const struct imxusb_platform_data *pdata)
{
	struct resource res[] = {
		{
			.start = data->iobase,
			.end = data->iobase + data->iosize - 1,
			.flags = IORESOURCE_MEM,
		}, {
			.start = data->irq0,
			.end = data->irq0,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq1,
			.end = data->irq1,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq2,
			.end = data->irq2,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq3,
			.end = data->irq3,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq4,
			.end = data->irq4,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq5,
			.end = data->irq5,
			.flags = IORESOURCE_IRQ,
		}, {
			.start = data->irq6,
			.end = data->irq6,
			.flags = IORESOURCE_IRQ,
		},
	};

	return imx_add_platform_device("imx_udc", 0,
			res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
}
Loading