88 */
99
1010#include <linux/clocksource.h>
11- #include <linux/device.h>
12- #include <linux/dma-map-ops.h>
1311#include <linux/io.h>
1412#include <linux/kernel.h>
1513#include <linux/memblock.h>
1614#include <linux/of.h>
1715#include <linux/of_clk.h>
18- #include <linux/of_fdt.h>
1916#include <linux/psci.h>
2017#include <asm/mach/arch.h>
2118#include <asm/secure_cntvoff.h>
2219#include "common.h"
23- #include "rcar-gen2.h"
2420
2521static const struct of_device_id cpg_matches [] __initconst = {
2622 { .compatible = "renesas,r8a7742-cpg-mssr" , .data = "extal" },
@@ -122,76 +118,6 @@ static void __init rcar_gen2_timer_init(void)
122118 timer_probe ();
123119}
124120
125- struct memory_reserve_config {
126- u64 reserved ;
127- u64 base , size ;
128- };
129-
130- static int __init rcar_gen2_scan_mem (unsigned long node , const char * uname ,
131- int depth , void * data )
132- {
133- const char * type = of_get_flat_dt_prop (node , "device_type" , NULL );
134- const __be32 * reg , * endp ;
135- int l ;
136- struct memory_reserve_config * mrc = data ;
137- u64 lpae_start = 1ULL << 32 ;
138-
139- /* We are scanning "memory" nodes only */
140- if (type == NULL || strcmp (type , "memory" ))
141- return 0 ;
142-
143- reg = of_get_flat_dt_prop (node , "linux,usable-memory" , & l );
144- if (reg == NULL )
145- reg = of_get_flat_dt_prop (node , "reg" , & l );
146- if (reg == NULL )
147- return 0 ;
148-
149- endp = reg + (l / sizeof (__be32 ));
150- while ((endp - reg ) >= (dt_root_addr_cells + dt_root_size_cells )) {
151- u64 base , size ;
152-
153- base = dt_mem_next_cell (dt_root_addr_cells , & reg );
154- size = dt_mem_next_cell (dt_root_size_cells , & reg );
155-
156- if (base >= lpae_start )
157- continue ;
158-
159- if ((base + size ) >= lpae_start )
160- size = lpae_start - base ;
161-
162- if (size < mrc -> reserved )
163- continue ;
164-
165- if (base < mrc -> base )
166- continue ;
167-
168- /* keep the area at top near the 32-bit legacy limit */
169- mrc -> base = base + size - mrc -> reserved ;
170- mrc -> size = mrc -> reserved ;
171- }
172-
173- return 0 ;
174- }
175-
176- static void __init rcar_gen2_reserve (void )
177- {
178- struct memory_reserve_config mrc ;
179-
180- /* reserve 256 MiB at the top of the physical legacy 32-bit space */
181- memset (& mrc , 0 , sizeof (mrc ));
182- mrc .reserved = SZ_256M ;
183-
184- of_scan_flat_dt (rcar_gen2_scan_mem , & mrc );
185- #ifdef CONFIG_DMA_CMA
186- if (mrc .size && memblock_is_region_memory (mrc .base , mrc .size )) {
187- static struct cma * rcar_gen2_dma_contiguous ;
188-
189- dma_contiguous_reserve_area (mrc .size , mrc .base , 0 ,
190- & rcar_gen2_dma_contiguous , true);
191- }
192- #endif
193- }
194-
195121static const char * const rcar_gen2_boards_compat_dt [] __initconst = {
196122 "renesas,r8a7790" ,
197123 "renesas,r8a7791" ,
@@ -204,7 +130,6 @@ static const char * const rcar_gen2_boards_compat_dt[] __initconst = {
204130DT_MACHINE_START (RCAR_GEN2_DT , "Generic R-Car Gen2 (Flattened Device Tree)" )
205131 .init_late = shmobile_init_late ,
206132 .init_time = rcar_gen2_timer_init ,
207- .reserve = rcar_gen2_reserve ,
208133 .dt_compat = rcar_gen2_boards_compat_dt ,
209134MACHINE_END
210135
@@ -220,6 +145,5 @@ static const char * const rz_g1_boards_compat_dt[] __initconst = {
220145DT_MACHINE_START (RZ_G1_DT , "Generic RZ/G1 (Flattened Device Tree)" )
221146 .init_late = shmobile_init_late ,
222147 .init_time = rcar_gen2_timer_init ,
223- .reserve = rcar_gen2_reserve ,
224148 .dt_compat = rz_g1_boards_compat_dt ,
225149MACHINE_END
0 commit comments