mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-29 01:26:15 +02:00
dc3d3f1c49
it's basically also provided by ingenic and nativly based on 2.6.27, adjusted to fit into the OpenWrt-environment
148 lines
3.3 KiB
C
148 lines
3.3 KiB
C
/*
|
|
* 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/jzsoc.h>
|
|
|
|
/* OHCI (USB full speed host controller) */
|
|
static struct resource jz_usb_ohci_resources[] = {
|
|
[0] = {
|
|
.start = CPHYSADDR(UHC_BASE), // phys addr for ioremap
|
|
.end = CPHYSADDR(UHC_BASE) + 0x10000 - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.start = IRQ_UHC,
|
|
.end = IRQ_UHC,
|
|
.flags = IORESOURCE_IRQ,
|
|
},
|
|
};
|
|
|
|
/* The dmamask must be set for OHCI to work */
|
|
static u64 ohci_dmamask = ~(u32)0;
|
|
|
|
static struct platform_device jz_usb_ohci_device = {
|
|
.name = "jz-ohci",
|
|
.id = 0,
|
|
.dev = {
|
|
.dma_mask = &ohci_dmamask,
|
|
.coherent_dma_mask = 0xffffffff,
|
|
},
|
|
.num_resources = ARRAY_SIZE(jz_usb_ohci_resources),
|
|
.resource = jz_usb_ohci_resources,
|
|
};
|
|
|
|
/*** LCD controller ***/
|
|
static struct resource jz_lcd_resources[] = {
|
|
[0] = {
|
|
.start = CPHYSADDR(LCD_BASE),
|
|
.end = CPHYSADDR(LCD_BASE) + 0x10000 - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.start = IRQ_LCD,
|
|
.end = IRQ_LCD,
|
|
.flags = IORESOURCE_IRQ,
|
|
}
|
|
};
|
|
|
|
static u64 jz_lcd_dmamask = ~(u32)0;
|
|
|
|
static struct platform_device jz_lcd_device = {
|
|
.name = "jz-lcd",
|
|
.id = 0,
|
|
.dev = {
|
|
.dma_mask = &jz_lcd_dmamask,
|
|
.coherent_dma_mask = 0xffffffff,
|
|
},
|
|
.num_resources = ARRAY_SIZE(jz_lcd_resources),
|
|
.resource = jz_lcd_resources,
|
|
};
|
|
|
|
/* UDC (USB gadget controller) */
|
|
static struct resource jz_usb_gdt_resources[] = {
|
|
[0] = {
|
|
.start = CPHYSADDR(UDC_BASE),
|
|
.end = CPHYSADDR(UDC_BASE) + 0x10000 - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.start = IRQ_UDC,
|
|
.end = IRQ_UDC,
|
|
.flags = IORESOURCE_IRQ,
|
|
},
|
|
};
|
|
|
|
static u64 udc_dmamask = ~(u32)0;
|
|
|
|
static struct platform_device jz_usb_gdt_device = {
|
|
.name = "jz-udc",
|
|
.id = 0,
|
|
.dev = {
|
|
.dma_mask = &udc_dmamask,
|
|
.coherent_dma_mask = 0xffffffff,
|
|
},
|
|
.num_resources = ARRAY_SIZE(jz_usb_gdt_resources),
|
|
.resource = jz_usb_gdt_resources,
|
|
};
|
|
|
|
/** MMC/SD controller **/
|
|
static struct resource jz_mmc_resources[] = {
|
|
[0] = {
|
|
.start = CPHYSADDR(MSC_BASE),
|
|
.end = CPHYSADDR(MSC_BASE) + 0x10000 - 1,
|
|
.flags = IORESOURCE_MEM,
|
|
},
|
|
[1] = {
|
|
.start = IRQ_MSC0,
|
|
.end = IRQ_MSC0,
|
|
.flags = IORESOURCE_IRQ,
|
|
}
|
|
};
|
|
|
|
static u64 jz_mmc_dmamask = ~(u32)0;
|
|
|
|
static struct platform_device jz_mmc_device = {
|
|
.name = "jz-mmc",
|
|
.id = 0,
|
|
.dev = {
|
|
.dma_mask = &jz_mmc_dmamask,
|
|
.coherent_dma_mask = 0xffffffff,
|
|
},
|
|
.num_resources = ARRAY_SIZE(jz_mmc_resources),
|
|
.resource = jz_mmc_resources,
|
|
};
|
|
|
|
struct platform_device jz4750_rtc_device = {
|
|
.name = "jz4750-rtc",
|
|
.id = -1,
|
|
};
|
|
|
|
/* All */
|
|
static struct platform_device *jz_platform_devices[] __initdata = {
|
|
&jz_usb_ohci_device,
|
|
&jz_lcd_device,
|
|
&jz_usb_gdt_device,
|
|
&jz_mmc_device,
|
|
&jz4750_rtc_device,
|
|
};
|
|
|
|
static int __init jz_platform_init(void)
|
|
{
|
|
return platform_add_devices(jz_platform_devices, ARRAY_SIZE(jz_platform_devices));
|
|
}
|
|
|
|
arch_initcall(jz_platform_init);
|