Root/target/linux/lantiq/files/arch/mips/lantiq/xway/dev-dwc_otg.c

1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
8 */
9
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/types.h>
13#include <linux/string.h>
14#include <linux/mtd/physmap.h>
15#include <linux/kernel.h>
16#include <linux/reboot.h>
17#include <linux/platform_device.h>
18#include <linux/leds.h>
19#include <linux/etherdevice.h>
20#include <linux/reboot.h>
21#include <linux/time.h>
22#include <linux/io.h>
23#include <linux/gpio.h>
24#include <linux/leds.h>
25
26#include <asm/bootinfo.h>
27#include <asm/irq.h>
28
29#include <lantiq_soc.h>
30#include <lantiq_irq.h>
31#include <lantiq_platform.h>
32
33#define LTQ_USB_IOMEM_BASE 0x1e101000
34#define LTQ_USB_IOMEM_SIZE 0x00001000
35
36static struct resource resources[] =
37{
38    [0] = {
39        .name = "dwc_otg_membase",
40        .start = LTQ_USB_IOMEM_BASE,
41        .end = LTQ_USB_IOMEM_BASE + LTQ_USB_IOMEM_SIZE - 1,
42        .flags = IORESOURCE_MEM,
43    },
44    [1] = {
45        .name = "dwc_otg_irq",
46        .flags = IORESOURCE_IRQ,
47    },
48};
49
50static u64 dwc_dmamask = (u32)0x1fffffff;
51
52static struct platform_device platform_dev = {
53    .name = "dwc_otg",
54    .dev = {
55        .dma_mask = &dwc_dmamask,
56    },
57    .resource = resources,
58    .num_resources = ARRAY_SIZE(resources),
59};
60
61int __init
62xway_register_dwc(int pin)
63{
64    struct irq_data d;
65    d.irq = resources[1].start;
66    ltq_enable_irq(&d);
67    resources[1].start = ltq_is_ase() ? LTQ_USB_ASE_INT : LTQ_USB_INT;
68    platform_dev.dev.platform_data = (void*) pin;
69    return platform_device_register(&platform_dev);
70}
71

Archive Download this file



interactive