From 47023bf8d0726a5a2551ee1d245fad0cb3ac16d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 9 Nov 2010 20:29:12 +0800 Subject: [PATCH] rk29sdk: add pmem devices --- arch/arm/configs/rk29_sdk_defconfig | 11 ++-- arch/arm/mach-rk29/board-rk29sdk.c | 84 ++++++++++++++++++++++++++--- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/arch/arm/configs/rk29_sdk_defconfig b/arch/arm/configs/rk29_sdk_defconfig index b6b6d5269af6..c34b9aafcc78 100644 --- a/arch/arm/configs/rk29_sdk_defconfig +++ b/arch/arm/configs/rk29_sdk_defconfig @@ -196,6 +196,11 @@ CONFIG_MMU=y CONFIG_ARCH_RK29=y CONFIG_MACH_RK29SDK=y +# +# RK29 VPU (Video Processing Unit) support +# +# CONFIG_RK29_VPU is not set + # # Processor Type # @@ -217,7 +222,7 @@ CONFIG_CPU_CP15_MMU=y # Processor Features # CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set +CONFIG_ARM_THUMBEE=y # CONFIG_CPU_ICACHE_DISABLE is not set # CONFIG_CPU_DCACHE_DISABLE is not set # CONFIG_CPU_BPREDICT_DISABLE is not set @@ -513,7 +518,7 @@ CONFIG_BLK_DEV_LOOP=y # CONFIG_ATA_OVER_ETH is not set # CONFIG_MG_DISK is not set CONFIG_MISC_DEVICES=y -# CONFIG_ANDROID_PMEM is not set +CONFIG_ANDROID_PMEM=y # CONFIG_ENCLOSURE_SERVICES is not set # CONFIG_KERNEL_DEBUGGER_CORE is not set # CONFIG_UID_STAT is not set @@ -1038,7 +1043,7 @@ CONFIG_DEBUG_ERRORS=y # # CONFIG_KEYS is not set # CONFIG_SECURITY is not set -CONFIG_SECURITYFS=y +# CONFIG_SECURITYFS is not set # CONFIG_SECURITY_FILE_CAPABILITIES is not set CONFIG_CRYPTO=y diff --git a/arch/arm/mach-rk29/board-rk29sdk.c b/arch/arm/mach-rk29/board-rk29sdk.c index afabec683d58..518313984201 100755 --- a/arch/arm/mach-rk29/board-rk29sdk.c +++ b/arch/arm/mach-rk29/board-rk29sdk.c @@ -22,8 +22,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -43,6 +45,17 @@ #include "devices.h" +/* Set memory size of pmem */ +#define SDRAM_SIZE SZ_128M +#define PMEM_GPU_SIZE (12 * SZ_1M) +#define PMEM_UI_SIZE SZ_16M +#define PMEM_VPU_SIZE SZ_32M + +#define PMEM_GPU_BASE (RK29_SDRAM_PHYS + SDRAM_SIZE - PMEM_GPU_SIZE) +#define PMEM_UI_BASE (PMEM_GPU_BASE - PMEM_UI_SIZE) +#define PMEM_VPU_BASE (PMEM_UI_BASE - PMEM_VPU_SIZE) +#define LINUX_SIZE (PMEM_VPU_BASE - RK29_SDRAM_PHYS) + extern struct sys_timer rk29_timer; int rk29_nand_io_init(void) @@ -287,6 +300,53 @@ struct rk29fb_info rk29_fb_info = { .io_init = rk29_fb_io_init, }; +static struct android_pmem_platform_data android_pmem_pdata = { + .name = "pmem", + .start = PMEM_UI_BASE, + .size = PMEM_UI_SIZE, + .no_allocator = 0, + .cached = 1, +}; + +static struct platform_device android_pmem_device = { + .name = "android_pmem", + .id = 0, + .dev = { + .platform_data = &android_pmem_pdata, + }, +}; + +static struct android_pmem_platform_data android_pmem_gpu_pdata = { + .name = "pmem_gpu", + .start = PMEM_GPU_BASE, + .size = PMEM_GPU_SIZE, + .no_allocator = 0, + .cached = 0, +}; + +static struct platform_device android_pmem_gpu_device = { + .name = "android_pmem", + .id = 1, + .dev = { + .platform_data = &android_pmem_gpu_pdata, + }, +}; + +static struct android_pmem_platform_data android_pmem_vpu_pdata = { + .name = "pmem_vpu", + .start = PMEM_VPU_BASE, + .size = PMEM_VPU_SIZE, + .no_allocator = 0, + .cached = 1, +}; + +static struct platform_device android_pmem_vpu_device = { + .name = "android_pmem", + .id = 2, + .dev = { + .platform_data = &android_pmem_vpu_pdata, + }, +}; /***************************************************************************************** * SDMMC devices @@ -347,6 +407,7 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { #endif }; #endif + static void __init rk29_board_iomux_init(void) { #ifdef CONFIG_UART0_RK29 @@ -380,7 +441,7 @@ static void __init rk29_board_iomux_init(void) } static struct platform_device *devices[] __initdata = { -#ifdef CONFIG_UART1_RK29 +#ifdef CONFIG_UART1_RK29 &rk29_device_uart1, #endif #ifdef CONFIG_SDMMC0_RK29 @@ -394,13 +455,14 @@ static struct platform_device *devices[] __initdata = { #endif #ifdef CONFIG_FB_RK29 - &rk29_device_fb, + &rk29_device_fb, #endif - #ifdef CONFIG_VIVANTE &rk29_device_gpu, #endif - + &android_pmem_device, + &android_pmem_gpu_device, + &android_pmem_vpu_device, }; static void __init rk29_gic_init_irq(void) @@ -415,12 +477,22 @@ static void __init machine_rk29_init_irq(void) rk29_gpio_init(rk29_gpiobankinit, MAX_BANK); rk29_gpio_irq_setup(); } + static void __init machine_rk29_board_init(void) { platform_add_devices(devices, ARRAY_SIZE(devices)); rk29_board_iomux_init(); } +static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags, + char **cmdline, struct meminfo *mi) +{ + mi->nr_banks = 1; + mi->bank[0].start = RK29_SDRAM_PHYS; + mi->bank[0].node = PHYS_TO_NID(RK29_SDRAM_PHYS); + mi->bank[0].size = LINUX_SIZE; +} + static void __init machine_rk29_mapio(void) { rk29_map_common_io(); @@ -429,11 +501,11 @@ static void __init machine_rk29_mapio(void) } MACHINE_START(RK29, "RK29board") - -/* UART for LL DEBUG */ + /* UART for LL DEBUG */ .phys_io = RK29_UART1_PHYS, .io_pg_offst = ((RK29_UART1_BASE) >> 18) & 0xfffc, .boot_params = RK29_SDRAM_PHYS + 0x88000, + .fixup = machine_rk29_fixup, .map_io = machine_rk29_mapio, .init_irq = machine_rk29_init_irq, .init_machine = machine_rk29_board_init, -- 2.34.1