summaryrefslogtreecommitdiff
path: root/target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/dev-dwc_otg.c
blob: 90b63fc72d69224f44fe5ee19cdc42ed8e4fb3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 */

#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/mtd/physmap.h>
#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
#include <linux/etherdevice.h>
#include <linux/reboot.h>
#include <linux/time.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/leds.h>

#include <asm/bootinfo.h>
#include <asm/irq.h>

#include <lantiq_soc.h>
#include <lantiq_irq.h>
#include <lantiq_platform.h>

#define LTQ_USB_IOMEM_BASE 0x1e101000
#define LTQ_USB_IOMEM_SIZE 0x00001000

static struct resource resources[] =
{
	[0] = {
		.name    = "dwc_otg_membase",
		.start   = LTQ_USB_IOMEM_BASE,
		.end	 = LTQ_USB_IOMEM_BASE + LTQ_USB_IOMEM_SIZE - 1,
		.flags	 = IORESOURCE_MEM,
	},
	[1] = {
		.name    = "dwc_otg_irq",
		.start   = LTQ_USB_INT,
		.flags   = IORESOURCE_IRQ,
	},
};

static u64 dwc_dmamask = (u32)0x1fffffff;

static struct platform_device platform_dev = {
	.name = "dwc_otg",
	.dev = {
		.dma_mask      = &dwc_dmamask,
	},
	.resource		= resources,
	.num_resources		= ARRAY_SIZE(resources),
};

int __init
xway_register_dwc(int pin)
{
	struct irq_data d;
	d.irq = resources[1].start;
	ltq_enable_irq(&d);
	platform_dev.dev.platform_data = (void*) pin;
	return platform_device_register(&platform_dev);
}