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

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

ARM: mx25: dynamically allocate mxc-ehci devices



According to the reference manual of the i.MX25 the host controller uses an
offset of 0x200 not 0x400 as was specified in the resources for mxc_usbh2.

Needs-Testing: yes
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent e9f0bafb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -5,16 +5,18 @@ comment "MX25 platforms:"
config MACH_MX25_3DS
	bool "Support MX25PDK (3DS) Platform"
	select IMX_HAVE_PLATFORM_IMX_UART
	select IMX_HAVE_PLATFORM_MXC_EHCI
	select IMX_HAVE_PLATFORM_MXC_NAND
	select IMX_HAVE_PLATFORM_ESDHC

config MACH_EUKREA_CPUIMX25
	bool "Support Eukrea CPUIMX25 Platform"
	select IMX_HAVE_PLATFORM_ESDHC
	select IMX_HAVE_PLATFORM_FLEXCAN
	select IMX_HAVE_PLATFORM_IMX_I2C
	select IMX_HAVE_PLATFORM_IMX_UART
	select IMX_HAVE_PLATFORM_MXC_EHCI
	select IMX_HAVE_PLATFORM_MXC_NAND
	select IMX_HAVE_PLATFORM_FLEXCAN
	select IMX_HAVE_PLATFORM_ESDHC
	select MXC_ULPI if USB_ULPI

choice
+7 −0
Original line number Diff line number Diff line
@@ -39,6 +39,13 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
#define imx25_add_imx_uart3(pdata)	imx25_add_imx_uart(3, pdata)
#define imx25_add_imx_uart4(pdata)	imx25_add_imx_uart(4, pdata)

extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst;
#define imx25_add_mxc_ehci_otg(pdata)	\
	imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata)
extern const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst;
#define imx25_add_mxc_ehci_hs(pdata)	\
	imx_add_mxc_ehci(&imx25_mxc_ehci_hs_data, pdata)

extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
#define imx25_add_mxc_nand(pdata)	\
	imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
+4 −40
Original line number Diff line number Diff line
@@ -26,27 +26,16 @@ static u64 otg_dmamask = DMA_BIT_MASK(32);

static struct resource mxc_otg_resources[] = {
	{
		.start = MX25_OTG_BASE_ADDR,
		.end = MX25_OTG_BASE_ADDR + 0x1ff,
		.start = MX25_USB_OTG_BASE_ADDR,
		.end = MX25_USB_OTG_BASE_ADDR + 0x1ff,
		.flags = IORESOURCE_MEM,
	}, {
		.start = 37,
		.end = 37,
		.start = MX25_INT_USB_OTG,
		.end = MX25_INT_USB_OTG,
		.flags = IORESOURCE_IRQ,
	},
};

struct platform_device mxc_otg = {
	.name = "mxc-ehci",
	.id = 0,
	.dev = {
		.coherent_dma_mask = 0xffffffff,
		.dma_mask = &otg_dmamask,
	},
	.resource = mxc_otg_resources,
	.num_resources = ARRAY_SIZE(mxc_otg_resources),
};

/* OTG gadget device */
struct platform_device otg_udc_device = {
	.name = "fsl-usb2-udc",
@@ -59,31 +48,6 @@ struct platform_device otg_udc_device = {
	.num_resources = ARRAY_SIZE(mxc_otg_resources),
};

static u64 usbh2_dmamask = DMA_BIT_MASK(32);

static struct resource mxc_usbh2_resources[] = {
	{
		.start = MX25_OTG_BASE_ADDR + 0x400,
		.end = MX25_OTG_BASE_ADDR + 0x5ff,
		.flags = IORESOURCE_MEM,
	}, {
		.start = 35,
		.end = 35,
		.flags = IORESOURCE_IRQ,
	},
};

struct platform_device mxc_usbh2 = {
	.name = "mxc-ehci",
	.id = 1,
	.dev = {
		.coherent_dma_mask = 0xffffffff,
		.dma_mask = &usbh2_dmamask,
	},
	.resource = mxc_usbh2_resources,
	.num_resources = ARRAY_SIZE(mxc_usbh2_resources),
};

static struct resource mxc_pwm_resources0[] = {
	{
		.start	= 0x53fe0000,
+0 −2
Original line number Diff line number Diff line
extern struct platform_device mxc_otg;
extern struct platform_device otg_udc_device;
extern struct platform_device mxc_usbh2;
extern struct platform_device mxc_pwm_device0;
extern struct platform_device mxc_pwm_device1;
extern struct platform_device mxc_pwm_device2;
+4 −5
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include <mach/mx25.h>
#include <mach/mxc_nand.h>
#include <mach/imxfb.h>
#include <mach/mxc_ehci.h>
#include <mach/iomux-mx25.h>

#include "devices-imx25.h"
@@ -87,12 +86,12 @@ static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
	},
};

static struct mxc_usbh_platform_data otg_pdata = {
static const struct mxc_usbh_platform_data otg_pdata __initconst = {
	.portsc	= MXC_EHCI_MODE_UTMI,
	.flags	= MXC_EHCI_INTERFACE_DIFF_UNI,
};

static struct mxc_usbh_platform_data usbh2_pdata = {
static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
	.portsc	= MXC_EHCI_MODE_SERIAL,
	.flags	= MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
		  MXC_EHCI_IPPUE_DOWN,
@@ -134,11 +133,11 @@ static void __init eukrea_cpuimx25_init(void)
	imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);

	if (otg_mode_host)
		mxc_register_device(&mxc_otg, &otg_pdata);
		imx25_add_mxc_ehci_otg(&otg_pdata);
	else
		mxc_register_device(&otg_udc_device, &otg_device_pdata);

	mxc_register_device(&mxc_usbh2, &usbh2_pdata);
	imx25_add_mxc_ehci_hs(&usbh2_pdata);

#ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
	eukrea_mbimxsd25_baseboard_init();
Loading