From 8ccb043f6084fbde7064dbff40ca684dc5299969 Mon Sep 17 00:00:00 2001 From: CMY Date: Thu, 13 Mar 2014 11:05:00 +0800 Subject: [PATCH] rk: ion: rk3288/fpga reserve cma memory for ion from dts --- arch/arm/boot/dts/rk3188.dtsi | 2 +- arch/arm/boot/dts/rk3288-fpga.dts | 13 +++++++++++++ arch/arm/boot/dts/rk3288.dtsi | 2 +- arch/arm/mach-rockchip/common.c | 9 +++++++++ arch/arm/mach-rockchip/rk3188.c | 7 ++----- arch/arm/mach-rockchip/rk3288.c | 7 +++++++ include/linux/rockchip/common.h | 1 + 7 files changed, 34 insertions(+), 7 deletions(-) mode change 100644 => 100755 arch/arm/mach-rockchip/common.c mode change 100644 => 100755 arch/arm/mach-rockchip/rk3288.c diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index 95580910032c..70880db67d48 100755 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi @@ -610,7 +610,7 @@ }; }; }; - ion: ion{ + ion{ compatible = "rockchip,ion"; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/boot/dts/rk3288-fpga.dts b/arch/arm/boot/dts/rk3288-fpga.dts index 6a7639f89604..73c5487f2e47 100755 --- a/arch/arm/boot/dts/rk3288-fpga.dts +++ b/arch/arm/boot/dts/rk3288-fpga.dts @@ -87,6 +87,19 @@ pa_enable_time = <1000>; }; + ion { + compatible = "rockchip,ion"; + #address-cells = <1>; + #size-cells = <0>; + rockchip,ion-heap@1 { /* CMA HEAP */ + compatible = "rockchip,ion-reserve"; + reg = <1>; + memory-reservation = <0x00000000 0x04000000>; /* 64MB */ + }; + rockchip,ion-heap@3 { /* SYSTEM HEAP */ + reg = <3>; + }; + }; }; &fb { diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index fa5e0c16543b..974388867b40 100755 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -287,7 +287,7 @@ // pinctrl-0 = <&spdif_tx>; }; - ion: ion { + ion { compatible = "rockchip,ion"; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/mach-rockchip/common.c b/arch/arm/mach-rockchip/common.c old mode 100644 new mode 100755 index 9ab4d186f879..14dfcf710595 --- a/arch/arm/mach-rockchip/common.c +++ b/arch/arm/mach-rockchip/common.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include "cpu_axi.h" @@ -220,3 +221,11 @@ int (*ddr_change_freq)(uint32_t nMHz) = NULL; long (*ddr_round_rate)(uint32_t nMHz) = NULL; void (*ddr_set_auto_self_refresh)(bool en) = NULL; +extern int __init rockchip_ion_find_reserve_mem(unsigned long node, + const char *uname, int depth, void *data); +void __init rockchip_ion_reserve(void) +{ + printk("%s\n", __func__); + of_scan_flat_dt(rockchip_ion_find_reserve_mem, NULL); +} + diff --git a/arch/arm/mach-rockchip/rk3188.c b/arch/arm/mach-rockchip/rk3188.c index 1871cf6dd9ae..ebcb004b7a92 100755 --- a/arch/arm/mach-rockchip/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -263,12 +262,10 @@ static void __init rk3188_dt_init_timer(void) of_dvfs_init(); } -extern int __init rockchip_ion_find_reserve_mem(unsigned long node, - const char *uname, int depth, void *data); static void __init rk3188_reserve(void) { - printk("%s\n", __func__); - of_scan_flat_dt(rockchip_ion_find_reserve_mem, NULL); + /* reserve memory for ION */ + rockchip_ion_reserve(); } static const char * const rk3188_dt_compat[] __initconst = { diff --git a/arch/arm/mach-rockchip/rk3288.c b/arch/arm/mach-rockchip/rk3288.c old mode 100644 new mode 100755 index d1aaeab4559b..c67ad6340980 --- a/arch/arm/mach-rockchip/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288.c @@ -216,6 +216,12 @@ static void __init rk3288_dt_init_timer(void) of_dvfs_init(); } +static void __init rk3288_reserve(void) +{ + /* reserve memory for ION */ + rockchip_ion_reserve(); +} + static const char * const rk3288_dt_compat[] __initconst = { "rockchip,rk3288", NULL, @@ -241,6 +247,7 @@ DT_MACHINE_START(RK3288_DT, "RK30board") .init_time = rk3288_dt_init_timer, .dt_compat = rk3288_dt_compat, .init_late = rockchip_suspend_init, + .reserve = rk3288_reserve, .restart = rk3288_restart, MACHINE_END diff --git a/include/linux/rockchip/common.h b/include/linux/rockchip/common.h index 31b00d6479cb..9dbbe4ef8a2f 100644 --- a/include/linux/rockchip/common.h +++ b/include/linux/rockchip/common.h @@ -35,5 +35,6 @@ extern int rockchip_boot_mode(void); extern void __init rockchip_boot_mode_init(u32 flag, u32 mode); extern void rockchip_restart_get_boot_mode(const char *cmd, u32 *flag, u32 *mode); extern void __init rockchip_suspend_init(void); +extern void __init rockchip_ion_reserve(void); #endif -- 2.34.1