1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-25 18:49:43 +02:00
openwrt-xburst/target/linux/xburst/files-2.6.31/arch/mips/jz4740/platform.c

242 lines
5.3 KiB
C
Raw Normal View History

2009-08-20 12:38:17 +03:00
/*
* Platform device support for Jz4740 SoC.
*
* Copyright 2007, <yliu@ingenic.cn>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/resource.h>
#include <asm/mach-jz4740/platform.h>
#include <asm/mach-jz4740/regs.h>
#include <asm/mach-jz4740/irq.h>
2009-08-20 12:38:17 +03:00
/* OHCI (USB full speed host controller) */
static struct resource jz4740_usb_ohci_resources[] = {
2009-08-20 12:38:17 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(UHC_BASE),
.end = CPHYSADDR(UHC_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
2009-08-20 12:38:17 +03:00
},
[1] = {
2009-09-14 16:07:26 +03:00
.start = JZ_IRQ_UHC,
.end = JZ_IRQ_UHC,
.flags = IORESOURCE_IRQ,
2009-08-20 12:38:17 +03:00
},
};
/* The dmamask must be set for OHCI to work */
static u64 ohci_dmamask = ~(u32)0;
struct platform_device jz4740_usb_ohci_device = {
2009-08-20 12:38:17 +03:00
.name = "jz-ohci",
.id = 0,
.dev = {
.dma_mask = &ohci_dmamask,
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(jz4740_usb_ohci_resources),
.resource = jz4740_usb_ohci_resources,
2009-08-20 12:38:17 +03:00
};
/* UDC (USB gadget controller) */
static struct resource jz4740_usb_gdt_resources[] = {
2009-08-20 12:38:17 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(UDC_BASE),
.end = CPHYSADDR(UDC_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
2009-08-20 12:38:17 +03:00
},
[1] = {
2009-09-14 16:07:26 +03:00
.start = JZ_IRQ_UDC,
.end = JZ_IRQ_UDC,
.flags = IORESOURCE_IRQ,
2009-08-20 12:38:17 +03:00
},
};
static u64 jz4740_udc_dmamask = ~(u32)0;
2009-08-20 12:38:17 +03:00
struct platform_device jz4740_usb_gdt_device = {
2009-08-20 12:38:17 +03:00
.name = "jz-udc",
2009-09-14 16:07:26 +03:00
.id = -1,
2009-08-20 12:38:17 +03:00
.dev = {
.dma_mask = &jz4740_udc_dmamask,
2009-08-20 12:38:17 +03:00
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(jz4740_usb_gdt_resources),
.resource = jz4740_usb_gdt_resources,
2009-08-20 12:38:17 +03:00
};
/** MMC/SD controller **/
static struct resource jz4740_mmc_resources[] = {
2009-08-20 12:38:17 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(MSC_BASE),
.end = CPHYSADDR(MSC_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
2009-08-20 12:38:17 +03:00
},
[1] = {
2009-09-14 16:07:26 +03:00
.start = JZ_IRQ_MSC,
.end = JZ_IRQ_MSC,
.flags = IORESOURCE_IRQ,
2009-08-20 12:38:17 +03:00
}
};
static u64 jz4740_mmc_dmamask = ~(u32)0;
2009-08-20 12:38:17 +03:00
struct platform_device jz4740_mmc_device = {
.name = "jz-mmc",
2009-08-20 12:38:17 +03:00
.id = 0,
.dev = {
.dma_mask = &jz4740_mmc_dmamask,
.coherent_dma_mask = 0xffffffff,
2009-08-20 12:38:17 +03:00
},
.num_resources = ARRAY_SIZE(jz4740_mmc_resources),
.resource = jz4740_mmc_resources,
2009-08-20 12:38:17 +03:00
};
static struct resource jz4740_rtc_resources[] = {
2009-09-20 20:56:40 +03:00
[0] = {
.start = CPHYSADDR(RTC_BASE),
.end = CPHYSADDR(RTC_BASE) + 0x10,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = JZ_IRQ_RTC,
.end = JZ_IRQ_RTC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device jz4740_rtc_device = {
2009-09-20 20:56:40 +03:00
.name = "jz4740-rtc",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_rtc_resources),
.resource = jz4740_rtc_resources,
2009-09-20 20:56:40 +03:00
};
2009-08-20 12:38:17 +03:00
/** I2C controller **/
static struct resource jz4740_i2c_resources[] = {
2009-08-20 12:38:17 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(I2C_BASE),
.end = CPHYSADDR(I2C_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
2009-08-20 12:38:17 +03:00
},
[1] = {
2009-09-14 16:07:26 +03:00
.start = JZ_IRQ_I2C,
.end = JZ_IRQ_I2C,
.flags = IORESOURCE_IRQ,
2009-08-20 12:38:17 +03:00
}
};
static u64 jz4740_i2c_dmamask = ~(u32)0;
2009-08-20 12:38:17 +03:00
struct platform_device jz4740_i2c_device = {
2009-08-20 12:38:17 +03:00
.name = "jz_i2c",
.id = 0,
.dev = {
.dma_mask = &jz4740_i2c_dmamask,
.coherent_dma_mask = 0xffffffff,
2009-08-20 12:38:17 +03:00
},
.num_resources = ARRAY_SIZE(jz4740_i2c_resources),
.resource = jz4740_i2c_resources,
2009-08-20 12:38:17 +03:00
};
static struct resource jz4740_nand_resources[] = {
2009-08-20 12:38:17 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(EMC_BASE),
.end = CPHYSADDR(EMC_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
2009-08-20 12:38:17 +03:00
},
};
struct platform_device jz4740_nand_device = {
2009-08-20 12:38:17 +03:00
.name = "jz4740-nand",
.num_resources = ARRAY_SIZE(jz4740_nand_resources),
.resource = jz4740_nand_resources,
};
static struct resource jz4740_framebuffer_resources[] = {
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(LCD_BASE),
.end = CPHYSADDR(LCD_BASE) + 0x10000 - 1,
.flags = IORESOURCE_MEM,
},
};
static u64 jz4740_fb_dmamask = ~(u32)0;
2009-09-14 16:07:26 +03:00
struct platform_device jz4740_framebuffer_device = {
.name = "jz4740-fb",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
.resource = jz4740_framebuffer_resources,
.dev = {
.dma_mask = &jz4740_fb_dmamask,
2009-09-14 16:07:26 +03:00
.coherent_dma_mask = 0xffffffff,
2009-09-03 12:59:10 +03:00
},
};
static struct resource jz4740_i2s_resources[] = {
2009-09-03 12:59:10 +03:00
[0] = {
2009-09-14 16:07:26 +03:00
.start = CPHYSADDR(AIC_BASE),
.end = CPHYSADDR(AIC_BASE) + 0x38 - 1,
.flags = IORESOURCE_MEM,
2009-09-03 12:59:10 +03:00
},
};
struct platform_device jz4740_i2s_device = {
2009-09-03 12:59:10 +03:00
.name = "jz4740-i2s",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_i2s_resources),
.resource = jz4740_i2s_resources,
2009-09-03 12:59:10 +03:00
};
static struct resource jz4740_codec_resources[] = {
2009-09-14 16:07:26 +03:00
[0] = {
.start = CPHYSADDR(AIC_BASE) + 0x80,
.end = CPHYSADDR(AIC_BASE) + 0x88 - 1,
.flags = IORESOURCE_MEM,
},
};
struct platform_device jz4740_codec_device = {
2009-09-14 16:07:26 +03:00
.name = "jz4740-codec",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_codec_resources),
.resource = jz4740_codec_resources,
2009-09-14 16:07:26 +03:00
};
static struct resource jz4740_adc_resources[] = {
[0] = {
.start = CPHYSADDR(SADC_BASE),
.end = CPHYSADDR(SADC_BASE) + 0x30,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = JZ_IRQ_SADC,
.end = JZ_IRQ_SADC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device jz4740_adc_device = {
.name = "jz4740-adc",
.id = -1,
.num_resources = ARRAY_SIZE(jz4740_adc_resources),
.resource = jz4740_adc_resources,
};
struct platform_device jz4740_battery_device = {
.name = "jz4740-battery",
.id = -1,
.dev = {
.parent = &jz4740_adc_device.dev
2009-10-11 23:26:23 +03:00
},
};