mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-25 16:57:31 +02:00
141 lines
3.2 KiB
C
141 lines
3.2 KiB
C
|
/*
|
||
|
* Platform device support for Jz4730 SoC.
|
||
|
*
|
||
|
* Copyright 2007, Peter <jlwei@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_MSC,
|
||
|
.end = IRQ_MSC,
|
||
|
.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,
|
||
|
};
|
||
|
|
||
|
/* All */
|
||
|
static struct platform_device *jz_platform_devices[] __initdata = {
|
||
|
&jz_usb_ohci_device,
|
||
|
&jz_lcd_device,
|
||
|
&jz_usb_gdt_device,
|
||
|
&jz_mmc_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);
|