1if ARCH_SUNXI
2
3config IDENT_STRING
4	default " Allwinner Technology"
5
6config DRAM_SUN4I
7	bool
8	help
9	  Select this dram controller driver for Sun4/5/7i platforms,
10	  like A10/A13/A20.
11
12config DRAM_SUN6I
13	bool
14	help
15	  Select this dram controller driver for Sun6i platforms,
16	  like A31/A31s.
17
18config DRAM_SUN8I_A23
19	bool
20	help
21	  Select this dram controller driver for Sun8i platforms,
22	  for A23 SOC.
23
24config DRAM_SUN8I_A33
25	bool
26	help
27	  Select this dram controller driver for Sun8i platforms,
28	  for A33 SOC.
29
30config DRAM_SUN8I_A83T
31	bool
32	help
33	  Select this dram controller driver for Sun8i platforms,
34	  for A83T SOC.
35
36config DRAM_SUN9I
37	bool
38	help
39	  Select this dram controller driver for Sun9i platforms,
40	  like A80.
41
42config DRAM_SUN50I_H6
43	bool
44	help
45	  Select this dram controller driver for some sun50i platforms,
46	  like H6.
47
48config DRAM_SUN50I_H616
49	bool
50	help
51	  Select this dram controller driver for some sun50i platforms,
52	  like H616.
53
54config DRAM_SUN50I_A133
55	bool
56	help
57	  Select this dram controller driver for some sun50i platforms,
58	  like A133.
59
60config DRAM_SUN55I_A523
61	bool
62	help
63	  Select this DRAM controller driver for A523/T527 SoCs.
64
65if DRAM_SUN50I_H616 || DRAM_SUN50I_A133 || DRAM_SUN55I_A523
66config DRAM_SUNXI_DX_ODT
67	hex "DRAM DX ODT parameter"
68	help
69	  DX ODT value from vendor DRAM settings.
70
71config DRAM_SUNXI_DX_DRI
72	hex "DRAM DX DRI parameter"
73	help
74	  DX DRI value from vendor DRAM settings.
75
76config DRAM_SUNXI_CA_DRI
77	hex "DRAM CA DRI parameter"
78	help
79	  CA DRI value from vendor DRAM settings.
80
81config DRAM_SUNXI_ODT_EN
82	hex "DRAM ODT EN parameter"
83	default 0x1
84	help
85	  ODT EN value from vendor DRAM settings.
86
87config DRAM_SUNXI_PARA0
88	hex "DRAM PARA0 parameter"
89	depends on DRAM_SUN50I_A133
90	help
91	  PARA0 value from vendor DRAM settings.
92
93config DRAM_SUNXI_MR11
94	hex "DRAM MR11 parameter"
95	depends on DRAM_SUN50I_A133
96	default 0x0
97	help
98	  MR11 value from vendor DRAM settings.
99
100config DRAM_SUNXI_MR12
101	hex "DRAM MR12 parameter"
102	depends on DRAM_SUN50I_A133
103	default 0x0
104	help
105	  MR12 value from vendor DRAM settings.
106
107config DRAM_SUNXI_MR13
108	hex "DRAM MR13 parameter"
109	depends on DRAM_SUN50I_A133
110	default 0x0
111	help
112	  MR13 value from vendor DRAM settings.
113
114config DRAM_SUNXI_MR14
115	hex "DRAM MR14 parameter"
116	depends on DRAM_SUN50I_A133
117	default 0x0
118	help
119	  MR14 value from vendor DRAM settings.
120
121config DRAM_SUNXI_TPR0
122	hex "DRAM TPR0 parameter"
123	default 0x0
124	help
125	  TPR0 value from vendor DRAM settings.
126
127config DRAM_SUNXI_TPR1
128	hex "DRAM TPR1 parameter"
129	default 0x0
130	help
131	  TPR1 value from vendor DRAM settings.
132
133config DRAM_SUNXI_TPR2
134	hex "DRAM TPR2 parameter"
135	default 0x0
136	help
137	  TPR2 value from vendor DRAM settings.
138
139config DRAM_SUNXI_TPR3
140	hex "DRAM TPR3 parameter"
141	default 0x0
142	help
143	  TPR3 value from vendor DRAM settings.
144
145config DRAM_SUNXI_TPR6
146	hex "DRAM TPR6 parameter"
147	default 0x3300c080
148	help
149	  TPR6 value from vendor DRAM settings.
150
151config DRAM_SUNXI_TPR10
152	hex "DRAM TPR10 parameter"
153	help
154	  TPR10 value from vendor DRAM settings. It tells which features
155	  should be configured, like write leveling, read calibration, etc.
156
157config DRAM_SUNXI_TPR11
158	hex "DRAM TPR11 parameter"
159	default 0x0
160	help
161	  TPR11 value from vendor DRAM settings.
162
163config DRAM_SUNXI_TPR12
164	hex "DRAM TPR12 parameter"
165	default 0x0
166	help
167	  TPR12 value from vendor DRAM settings.
168
169config DRAM_SUNXI_TPR13
170	hex "DRAM TPR13 parameter"
171	depends on DRAM_SUN50I_A133
172	default 0x0
173	help
174	  TPR13 value from vendor DRAM settings.
175
176config DRAM_SUNXI_TPR14
177	hex "DRAM TPR14 parameter"
178	depends on DRAM_SUN50I_A133 || MACH_SUN55I_A523
179	default 0x48484848
180	help
181	  TPR14 value from vendor DRAM settings.
182
183choice
184	prompt "DRAM PHY pin mapping selection"
185	default DRAM_SUNXI_PHY_ADDR_MAP_0
186
187config DRAM_SUNXI_PHY_ADDR_MAP_0
188	bool "DRAM PHY address map 0"
189	help
190	  This pin mapping selection should be used by the H313, H616, H618,
191	  and A133, R818 SoCs.
192
193config DRAM_SUNXI_PHY_ADDR_MAP_1
194	bool "DRAM PHY address map 1"
195	help
196	  This pin mapping selection should be used by the H700.
197endchoice
198endif
199
200config SUN6I_PRCM
201	bool
202	help
203	  Support for the PRCM (Power/Reset/Clock Management) unit available
204	  in A31 SoC.
205
206config AXP_PMIC_BUS
207	bool
208	select DM_PMIC if DM_I2C
209	select PMIC_AXP if DM_I2C
210	help
211	  Select this PMIC bus access helpers for Sunxi platform PRCM or other
212	  AXP family PMIC devices.
213
214config SUNXI_SRAM_ADDRESS
215	hex
216	default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5
217	default 0x44000 if MACH_SUN55I_A523
218	default 0x20000 if SUN50I_GEN_H6 || SUNXI_GEN_NCAT2
219	default 0x0
220	---help---
221	Older Allwinner SoCs have their mask boot ROM mapped just below 4GB,
222	with the first SRAM region being located at address 0.
223	Some newer SoCs map the boot ROM at address 0 instead and move the
224	SRAM to a different address.
225
226config SUNXI_RVBAR_ADDRESS
227	hex
228	depends on ARM64
229	default 0x08100040 if MACH_SUN50I_A133
230	default 0x08000040 if MACH_SUN55I_A523
231	default 0x09010040 if SUN50I_GEN_H6
232	default 0x017000a0
233	---help---
234	The read-only RVBAR system register holds the address of the first
235	instruction to execute after a reset. Allwinner cores provide a
236	writable MMIO backing store for this register, to allow to set the
237	entry point when switching to AArch64. This store is on different
238	addresses, depending on the SoC.
239
240config SUNXI_RVBAR_ALTERNATIVE
241	hex
242	depends on ARM64
243	default 0x08100040 if MACH_SUN50I_H616
244	default SUNXI_RVBAR_ADDRESS
245	---help---
246	The H616 die exists in at least two variants, with one having the
247	RVBAR registers at a different address. If the SoC variant ID
248	(stored in SRAM_VER_REG[7:0]) is not 0, we need to use the
249	other address.
250	Set this alternative address to the same as the normal address
251	for all other SoCs, so the content of the SRAM_VER_REG becomes
252	irrelevant there, and we can use the same code.
253
254config SUNXI_BL31_BASE
255	hex
256	default 0x00044000 if MACH_SUN50I || MACH_SUN50I_H5
257	default 0x40000000 if MACH_SUN50I_H616
258	default 0x00104000 if SUN50I_GEN_H6
259	default 0x00054000 if MACH_SUN55I_A523
260	default 0x0
261	help
262	  Address where BL31 (TF-A) is loaded, or zero if BL31 is not used.
263
264config SUNXI_SCP_BASE
265	hex
266	default 0x00050000 if MACH_SUN50I || MACH_SUN50I_H5
267	default 0x00114000 if MACH_SUN50I_H6
268	default 0x0
269	help
270	  Address where SCP firmware is loaded, or zero if it is not used.
271
272config SUNXI_A64_TIMER_ERRATUM
273	bool
274
275# Note only one of these may be selected at a time! But hidden choices are
276# not supported by Kconfig
277config SUNXI_GEN_SUN4I
278	bool
279	---help---
280	Select this for sunxi SoCs which have resets and clocks set up
281	as the original A10 (mach-sun4i).
282
283config SUNXI_GEN_SUN6I
284	bool
285	---help---
286	Select this for sunxi SoCs which have sun6i like periphery, like
287	separate ahb reset control registers, custom pmic bus, new style
288	watchdog, etc.
289
290config SUN50I_GEN_H6
291	bool
292	select FIT
293	select SPL_LOAD_FIT if SPL
294	select MMC_SUNXI_HAS_NEW_MODE
295	select SUPPORT_SPL
296	---help---
297	Select this for sunxi SoCs which have H6 like peripherals, clocks
298	and memory map.
299
300config SUNXI_GEN_NCAT2
301	bool
302	select MMC_SUNXI_HAS_NEW_MODE
303	select SUPPORT_SPL
304	---help---
305	Select this for sunxi SoCs which have D1 like peripherals, clocks
306	and memory map.
307
308config SUNXI_DRAM_DW
309	bool
310	---help---
311	Select this for sunxi SoCs which uses a DRAM controller like the
312	DesignWare controller used in H3, mainly SoCs after H3, which do
313	not have official open-source DRAM initialization code, but can
314	use modified H3 DRAM initialization code.
315
316if SUNXI_DRAM_DW
317config SUNXI_DRAM_DW_16BIT
318	bool
319	---help---
320	Select this for sunxi SoCs with DesignWare DRAM controller and
321	have only 16-bit memory buswidth.
322
323config SUNXI_DRAM_DW_32BIT
324	bool
325	---help---
326	Select this for sunxi SoCs with DesignWare DRAM controller with
327	32-bit memory buswidth.
328endif
329
330config MACH_SUNXI_H3_H5
331	bool
332	select SUNXI_DE2
333	select SUNXI_DRAM_DW
334	select SUNXI_DRAM_DW_32BIT
335	select SUNXI_GEN_SUN6I
336	select SUPPORT_SPL
337
338# TODO: try out A80's 8GiB DRAM space
339config SUNXI_DRAM_MAX_SIZE
340	hex
341	default 0x100000000 if MACH_SUN50I_H616 || MACH_SUN50I_A133 || MACH_SUN55I_A523
342	default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6
343	default 0x80000000
344
345choice
346	prompt "Sunxi SoC Variant"
347	optional
348
349config MACH_SUNIV
350	bool "suniv (Allwinner F1C100s/F1C200s/F1C600/R6)"
351	select CPU_ARM926EJS
352	select SUNXI_GEN_SUN6I
353	select SUPPORT_SPL
354	select SKIP_LOWLEVEL_INIT_ONLY
355	select SPL_SKIP_LOWLEVEL_INIT_ONLY
356	imply OF_UPSTREAM
357
358config MACH_SUN4I
359	bool "sun4i (Allwinner A10)"
360	select CPU_V7A
361	select DRAM_SUN4I
362	select SUNXI_GEN_SUN4I
363	select SUPPORT_SPL
364	imply SPL_SYS_I2C_LEGACY
365	imply SYS_I2C_LEGACY
366	imply OF_UPSTREAM
367
368config MACH_SUN5I
369	bool "sun5i (Allwinner A13)"
370	select CPU_V7A
371	select DRAM_SUN4I
372	select SUNXI_GEN_SUN4I
373	select SUPPORT_SPL
374	imply SPL_SYS_I2C_LEGACY
375	imply SYS_I2C_LEGACY
376	imply OF_UPSTREAM
377
378config MACH_SUN6I
379	bool "sun6i (Allwinner A31)"
380	select CPU_V7A
381	select CPU_V7_HAS_NONSEC
382	select CPU_V7_HAS_VIRT
383	select ARCH_SUPPORT_PSCI
384	select SPL_ARMV7_SET_CORTEX_SMPEN
385	select DRAM_SUN6I
386	select SPL_I2C if SPL
387	select SUN6I_PRCM
388	select SUNXI_GEN_SUN6I
389	select SUPPORT_SPL
390	select SYS_I2C_SUN6I_P2WI
391	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
392
393config MACH_SUN7I
394	bool "sun7i (Allwinner A20)"
395	select CPU_V7A
396	select CPU_V7_HAS_NONSEC
397	select CPU_V7_HAS_VIRT
398	select ARCH_SUPPORT_PSCI
399	select SPL_ARMV7_SET_CORTEX_SMPEN
400	select DRAM_SUN4I
401	select SUNXI_GEN_SUN4I
402	select SUPPORT_SPL
403	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
404	imply SPL_SYS_I2C_LEGACY
405	imply SYS_I2C_LEGACY
406
407config MACH_SUN8I_A23
408	bool "sun8i (Allwinner A23)"
409	select CPU_V7A
410	select CPU_V7_HAS_NONSEC
411	select CPU_V7_HAS_VIRT
412	select ARCH_SUPPORT_PSCI
413	select DRAM_SUN8I_A23
414	select SPL_I2C if SPL
415	select SUNXI_GEN_SUN6I
416	select SUPPORT_SPL
417	select SYS_I2C_SUN8I_RSB
418	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
419
420config MACH_SUN8I_A33
421	bool "sun8i (Allwinner A33)"
422	select CPU_V7A
423	select CPU_V7_HAS_NONSEC
424	select CPU_V7_HAS_VIRT
425	select ARCH_SUPPORT_PSCI
426	select DRAM_SUN8I_A33
427	select SPL_I2C if SPL
428	select SUNXI_GEN_SUN6I
429	select SUPPORT_SPL
430	select SYS_I2C_SUN8I_RSB
431	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
432
433config MACH_SUN8I_A83T
434	bool "sun8i (Allwinner A83T)"
435	select CPU_V7A
436	select DRAM_SUN8I_A83T
437	select SPL_I2C if SPL
438	select SUNXI_GEN_SUN6I
439	select MMC_SUNXI_HAS_NEW_MODE
440	select MMC_SUNXI_HAS_MODE_SWITCH
441	select SUPPORT_SPL
442	select SYS_I2C_SUN8I_RSB
443
444config MACH_SUN8I_H3
445	bool "sun8i (Allwinner H3)"
446	select CPU_V7A
447	select CPU_V7_HAS_NONSEC
448	select CPU_V7_HAS_VIRT
449	select ARCH_SUPPORT_PSCI
450	select MACH_SUNXI_H3_H5
451	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
452
453config MACH_SUN8I_R40
454	bool "sun8i (Allwinner R40)"
455	select CPU_V7A
456	select CPU_V7_HAS_NONSEC
457	select CPU_V7_HAS_VIRT
458	select ARCH_SUPPORT_PSCI
459	select SUNXI_GEN_SUN6I
460	select MMC_SUNXI_HAS_NEW_MODE
461	select SUPPORT_SPL
462	select SUNXI_DRAM_DW
463	select SUNXI_DRAM_DW_32BIT
464	imply SPL_SYS_I2C_LEGACY
465
466config MACH_SUN8I_R528
467	bool "sun8i (Allwinner R528)"
468	select CPU_V7A
469	select CPU_V7_HAS_NONSEC
470	select CPU_V7_HAS_VIRT
471	select ARCH_SUPPORT_PSCI
472	select SPL_ARMV7_SET_CORTEX_SMPEN
473	select SUNXI_GEN_NCAT2
474	select SUNXI_NEW_PINCTRL
475	select MMC_SUNXI_HAS_NEW_MODE
476	select SUPPORT_SPL
477	select DRAM_SUN20I_D1
478
479config MACH_SUN8I_V3S
480	bool "sun8i (Allwinner V3/V3s/S3/S3L)"
481	select CPU_V7A
482	select CPU_V7_HAS_NONSEC
483	select CPU_V7_HAS_VIRT
484	select ARCH_SUPPORT_PSCI
485	select SUNXI_GEN_SUN6I
486	select SUNXI_DRAM_DW
487	select SUNXI_DRAM_DW_16BIT
488	select SUPPORT_SPL
489	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
490	imply OF_UPSTREAM
491
492config MACH_SUN9I
493	bool "sun9i (Allwinner A80)"
494	select CPU_V7A
495	select SPL_ARMV7_SET_CORTEX_SMPEN
496	select DRAM_SUN9I
497	select SPL_I2C if SPL
498	select SUN6I_PRCM
499	select SUNXI_GEN_SUN6I
500	select SUPPORT_SPL
501
502config MACH_SUN50I
503	bool "sun50i (Allwinner A64)"
504	select ARM64
505	select SUN6I_PRCM
506	select SUNXI_DE2
507	select SUNXI_GEN_SUN6I
508	select MMC_SUNXI_HAS_NEW_MODE
509	select SUPPORT_SPL
510	select SUNXI_DRAM_DW
511	select SUNXI_DRAM_DW_32BIT
512	select FIT
513	select SPL_LOAD_FIT if SPL
514	select SUNXI_A64_TIMER_ERRATUM
515
516config MACH_SUN50I_H5
517	bool "sun50i (Allwinner H5)"
518	select ARM64
519	select MACH_SUNXI_H3_H5
520	select MMC_SUNXI_HAS_NEW_MODE
521	select FIT
522	select SPL_LOAD_FIT if SPL
523
524config MACH_SUN50I_H6
525	bool "sun50i (Allwinner H6)"
526	select ARM64
527	select DRAM_SUN50I_H6
528	select SUN50I_GEN_H6
529
530config MACH_SUN50I_H616
531	bool "sun50i (Allwinner H616)"
532	select ARM64
533	select DRAM_SUN50I_H616
534	select SUN50I_GEN_H6
535	imply OF_UPSTREAM
536
537config MACH_SUN50I_A133
538	bool "sun50i (Allwinner A133)"
539	select ARM64
540	select DRAM_SUN50I_A133
541	select SUN50I_GEN_H6
542	imply OF_UPSTREAM
543
544config MACH_SUN55I_A523
545	bool "sun55i (Allwinner A523/A527/T527/H728)"
546	select ARM64
547	select SUNXI_GEN_NCAT2
548	select SUNXI_NEW_PINCTRL
549	select DRAM_SUN55I_A523
550	select FIT
551	select SPL_LOAD_FIT if SPL
552	imply OF_UPSTREAM
553
554endchoice
555
556# The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
557config MACH_SUN8I
558	bool
559	select SPL_ARMV7_SET_CORTEX_SMPEN if !ARM64
560	select SUN6I_PRCM
561	default y if MACH_SUN8I_A23
562	default y if MACH_SUN8I_A33
563	default y if MACH_SUN8I_A83T
564	default y if MACH_SUNXI_H3_H5
565	default y if MACH_SUN8I_R40
566	default y if MACH_SUN8I_V3S
567
568config RESERVE_ALLWINNER_BOOT0_HEADER
569	bool "reserve space for Allwinner boot0 header"
570	select ENABLE_ARM_SOC_BOOT0_HOOK
571	---help---
572	Prepend a 1536 byte (empty) header to the U-Boot image file, to be
573	filled with magic values post build. The Allwinner provided boot0
574	blob relies on this information to load and execute U-Boot.
575	Only needed on 64-bit Allwinner boards so far when using boot0.
576
577config ARM_BOOT_HOOK_RMR
578	bool
579	depends on ARM64
580	default y
581	select ENABLE_ARM_SOC_BOOT0_HOOK
582	---help---
583	Insert some ARM32 code at the very beginning of the U-Boot binary
584	which uses an RMR register write to bring the core into AArch64 mode.
585	The very first instruction acts as a switch, since it's carefully
586	chosen to be a NOP in one mode and a branch in the other, so the
587	code would only be executed if not already in AArch64.
588	This allows both the SPL and the U-Boot proper to be entered in
589	either mode and switch to AArch64 if needed.
590
591if SUNXI_DRAM_DW || DRAM_SUN50I_H6 || DRAM_SUN50I_H616 || DRAM_SUN50I_A133 || DRAM_SUN55I_A523
592config SUNXI_DRAM_DDR3
593	bool
594
595config SUNXI_DRAM_DDR2
596	bool
597
598config SUNXI_DRAM_LPDDR3
599	bool
600
601config SUNXI_DRAM_LPDDR4
602	bool
603
604config SUNXI_DRAM_DDR4
605	bool
606
607choice
608	prompt "DRAM Type and Timing"
609	default SUNXI_DRAM_A523_LPDDR4 if MACH_SUN55I_A523
610	default SUNXI_DRAM_DDR3_1333 if !MACH_SUN8I_V3S
611	default SUNXI_DRAM_DDR2_V3S if MACH_SUN8I_V3S
612
613config SUNXI_DRAM_DDR3_1333
614	bool "DDR3 1333"
615	select SUNXI_DRAM_DDR3
616	depends on !DRAM_SUN50I_A133
617	---help---
618	This option is the original only supported memory type, which suits
619	many H3/H5/A64 boards available now.
620
621config SUNXI_DRAM_LPDDR3_STOCK
622	bool "LPDDR3 with Allwinner stock configuration"
623	select SUNXI_DRAM_LPDDR3
624	depends on !DRAM_SUN50I_A133
625	---help---
626	This option is the LPDDR3 timing used by the stock boot0 by
627	Allwinner.
628
629config SUNXI_DRAM_H6_LPDDR3
630	bool "LPDDR3 DRAM chips on the H6 DRAM controller"
631	select SUNXI_DRAM_LPDDR3
632	depends on DRAM_SUN50I_H6
633	---help---
634	This option is the LPDDR3 timing used by the stock boot0 by
635	Allwinner.
636
637config SUNXI_DRAM_H6_DDR3_1333
638	bool "DDR3-1333 boot0 timings on the H6 DRAM controller"
639	select SUNXI_DRAM_DDR3
640	depends on DRAM_SUN50I_H6
641	---help---
642	This option is the DDR3 timing used by the boot0 on H6 TV boxes
643	which use a DDR3-1333 timing.
644
645config SUNXI_DRAM_H616_LPDDR3
646	bool "LPDDR3 DRAM chips on the H616 DRAM controller"
647	select SUNXI_DRAM_LPDDR3
648	depends on DRAM_SUN50I_H616 || DRAM_SUN50I_A133
649	help
650	  This option is the LPDDR3 timing used by the stock boot0 by
651	  Allwinner.
652
653config SUNXI_DRAM_H616_LPDDR4
654	bool "LPDDR4 DRAM chips on the H616 DRAM controller"
655	select SUNXI_DRAM_LPDDR4
656	depends on DRAM_SUN50I_H616 || DRAM_SUN50I_A133
657	help
658	  This option is the LPDDR4 timing used by the stock boot0 by
659	  Allwinner.
660
661config SUNXI_DRAM_H616_DDR3_1333
662	bool "DDR3-1333 boot0 timings on the H616 DRAM controller"
663	select SUNXI_DRAM_DDR3
664	depends on DRAM_SUN50I_H616 || DRAM_SUN50I_A133
665	help
666	  This option is the DDR3 timing used by the boot0 on H616 TV boxes
667	  which use a DDR3-1333 timing.
668
669config SUNXI_DRAM_A133_DDR4
670	bool "DDR4 boot0 timings on the A133 DRAM controller"
671	select SUNXI_DRAM_DDR4
672	depends on DRAM_SUN50I_A133
673	help
674	  This option is the DDR4 timing used by the boot0 on A133 devices
675	  which use a DDR4 timing.
676
677config SUNXI_DRAM_A133_LPDDR4
678	bool "LPDDR4 boot0 timings on the A133 DRAM controller"
679	select SUNXI_DRAM_LPDDR4
680	depends on DRAM_SUN50I_A133
681	help
682	  This option is the LPDDR4 timing used by the boot0 on A133 devices
683	  which use an LPDDR4 timing.
684
685config SUNXI_DRAM_DDR2_V3S
686	bool "DDR2 found in V3s chip"
687	select SUNXI_DRAM_DDR2
688	depends on MACH_SUN8I_V3S
689	---help---
690	This option is only for the DDR2 memory chip which is co-packaged in
691	Allwinner V3s SoC.
692
693config SUNXI_DRAM_A523_DDR3
694	bool "DDR3 DRAM chips on the A523/T527 DRAM controller"
695	select SUNXI_DRAM_DDR3
696	depends on DRAM_SUN55I_A523
697	help
698	  This option is the DDR3 timing used by the stock boot0 by
699	  Allwinner.
700
701config SUNXI_DRAM_A523_LPDDR4
702	bool "LPDDR4 DRAM chips on the A523/T527 DRAM controller"
703	select SUNXI_DRAM_LPDDR4
704	depends on DRAM_SUN55I_A523
705	help
706	  This option is the LPDDR4 timing used by the stock boot0 by
707	  Allwinner.
708endchoice
709endif
710
711config DRAM_TYPE
712	int "sunxi dram type"
713	depends on MACH_SUN8I_A83T
714	default 3
715	---help---
716	Set the dram type, 3: DDR3, 7: LPDDR3
717
718config DRAM_CLK
719	int "sunxi dram clock speed"
720	default 792 if MACH_SUN9I
721	default 648 if MACH_SUN8I_R40
722	default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || \
723		       MACH_SUN8I_V3S
724	default 312 if MACH_SUN6I || MACH_SUN8I
725	default 672 if MACH_SUN50I
726	default 744 if MACH_SUN50I_H6
727	default 720 if MACH_SUN50I_H616 || MACH_SUN50I_A133
728	default 1200 if MACH_SUN55I_A523
729	---help---
730	Set the dram clock speed, valid range 240 - 480 (prior to sun9i),
731	must be a multiple of 24. For the sun9i (A80), the tested values
732	(for DDR3-1600) are 312 to 792.
733
734if MACH_SUN5I || MACH_SUN7I
735config DRAM_MBUS_CLK
736	int "sunxi mbus clock speed"
737	default 300
738	---help---
739	Set the mbus clock speed. The maximum on sun5i hardware is 300MHz.
740
741endif
742
743config DRAM_ZQ
744	int "sunxi dram zq value"
745	depends on !MACH_SUN50I_H616
746	depends on !MACH_SUN50I_A133
747	depends on !MACH_SUN55I_A523
748	default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || \
749		       MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_A83T
750	default 127 if MACH_SUN7I
751	default 14779 if MACH_SUN8I_V3S
752	default 3881979 if MACH_SUNXI_H3_H5 || MACH_SUN8I_R40 || MACH_SUN50I_H6
753	default 4145117 if MACH_SUN9I
754	default 3881915 if MACH_SUN50I
755	---help---
756	Set the dram zq value.
757
758config DRAM_ODT_EN
759	bool "sunxi dram odt enable"
760	depends on !MACH_SUN50I_H616
761	depends on !MACH_SUN55I_A523
762	default y if MACH_SUN8I_A23
763	default y if MACH_SUNXI_H3_H5
764	default y if MACH_SUN8I_R40
765	default y if MACH_SUN50I
766	default y if MACH_SUN50I_H6
767	---help---
768	Select this to enable dram odt (on die termination).
769
770if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
771config DRAM_EMR1
772	int "sunxi dram emr1 value"
773	default 0 if MACH_SUN4I
774	default 4 if MACH_SUN5I || MACH_SUN7I
775	---help---
776	Set the dram controller emr1 value.
777
778config DRAM_TPR3
779	hex "sunxi dram tpr3 value"
780	default 0x0
781	---help---
782	Set the dram controller tpr3 parameter. This parameter configures
783	the delay on the command lane and also phase shifts, which are
784	applied for sampling incoming read data. The default value 0
785	means that no phase/delay adjustments are necessary. Properly
786	configuring this parameter increases reliability at high DRAM
787	clock speeds.
788
789config DRAM_DQS_GATING_DELAY
790	hex "sunxi dram dqs_gating_delay value"
791	default 0x0
792	---help---
793	Set the dram controller dqs_gating_delay parmeter. Each byte
794	encodes the DQS gating delay for each byte lane. The delay
795	granularity is 1/4 cycle. For example, the value 0x05060606
796	means that the delay is 5 quarter-cycles for one lane (1.25
797	cycles) and 6 quarter-cycles (1.5 cycles) for 3 other lanes.
798	The default value 0 means autodetection. The results of hardware
799	autodetection are not very reliable and depend on the chip
800	temperature (sometimes producing different results on cold start
801	and warm reboot). But the accuracy of hardware autodetection
802	is usually good enough, unless running at really high DRAM
803	clocks speeds (up to 600MHz). If unsure, keep as 0.
804
805choice
806	prompt "sunxi dram timings"
807	default DRAM_TIMINGS_VENDOR_MAGIC
808	---help---
809	Select the timings of the DDR3 chips.
810
811config DRAM_TIMINGS_VENDOR_MAGIC
812	bool "Magic vendor timings from Android"
813	---help---
814	The same DRAM timings as in the Allwinner boot0 bootloader.
815
816config DRAM_TIMINGS_DDR3_1066F_1333H
817	bool "JEDEC DDR3-1333H with down binning to DDR3-1066F"
818	---help---
819	Use the timings of the standard JEDEC DDR3-1066F speed bin for
820	DRAM_CLK <= 533MHz and the timings of the DDR3-1333H speed bin
821	for DRAM_CLK > 533MHz. This covers the majority of DDR3 chips
822	used in Allwinner A10/A13/A20 devices. In the case of DDR3-1333
823	or DDR3-1600 chips, be sure to check the DRAM datasheet to confirm
824	that down binning to DDR3-1066F is supported (because DDR3-1066F
825	uses a bit faster timings than DDR3-1333H).
826
827config DRAM_TIMINGS_DDR3_800E_1066G_1333J
828	bool "JEDEC DDR3-800E / DDR3-1066G / DDR3-1333J"
829	---help---
830	Use the timings of the slowest possible JEDEC speed bin for the
831	selected DRAM_CLK. Depending on the DRAM_CLK value, it may be
832	DDR3-800E, DDR3-1066G or DDR3-1333J.
833
834endchoice
835
836endif
837
838if MACH_SUN8I_A23
839config DRAM_ODT_CORRECTION
840	int "sunxi dram odt correction value"
841	default 0
842	---help---
843	Set the dram odt correction value (range -255 - 255). In allwinner
844	fex files, this option is found in bits 8-15 of the u32 odt_en variable
845	in the [dram] section. When bit 31 of the odt_en variable is set
846	then the correction is negative. Usually the value for this is 0.
847endif
848
849config SYS_CLK_FREQ
850	default 408000000 if MACH_SUNIV
851	default 792000000 if MACH_SUN55I_A523
852	default 816000000 if MACH_SUN50I || MACH_SUN50I_H5
853	default 888000000 if MACH_SUN50I_H6
854	default 912000000 if MACH_SUN7I
855	default 1008000000
856
857config SYS_CONFIG_NAME
858	default "suniv" if MACH_SUNIV
859	default "sun4i" if MACH_SUN4I
860	default "sun5i" if MACH_SUN5I
861	default "sun6i" if MACH_SUN6I
862	default "sun7i" if MACH_SUN7I
863	default "sun8i" if MACH_SUN8I
864	default "sun8i" if MACH_SUN8I_R528
865	default "sun9i" if MACH_SUN9I
866	default "sun50i" if MACH_SUN50I
867	default "sun50i" if MACH_SUN50I_H6
868	default "sun50i" if MACH_SUN50I_H616
869	default "sun50i" if MACH_SUN50I_A133
870	default "sun55i" if MACH_SUN55I_A523
871
872config SYS_BOARD
873	default "sunxi"
874
875config SYS_SOC
876	default "sunxi"
877
878config SUNXI_MINIMUM_DRAM_MB
879	int "minimum DRAM size"
880	default 32 if MACH_SUNIV
881	default 64 if MACH_SUN8I_V3S
882	default 256
883	---help---
884	Minimum DRAM size expected on the board. Traditionally we assumed
885	256 MB, so that U-Boot would load at 160MB. With co-packaged DRAM
886	we have smaller sizes, though, so that U-Boot's own load address and
887	the default payload addresses must be shifted down.
888	This is expected to be fixed by the SoC selection.
889
890config UART0_PORT_F
891	bool "UART0 on MicroSD breakout board"
892	---help---
893	Repurpose the SD card slot for getting access to the UART0 serial
894	console. Primarily useful only for low level u-boot debugging on
895	tablets, where normal UART0 is difficult to access and requires
896	device disassembly and/or soldering. As the SD card can't be used
897	at the same time, the system can be only booted in the FEL mode.
898	Only enable this if you really know what you are doing.
899
900config OLD_SUNXI_KERNEL_COMPAT
901	bool "Enable workarounds for booting old kernels"
902	---help---
903	Set this to enable various workarounds for old kernels, this results in
904	sub-optimal settings for newer kernels, only enable if needed.
905
906config MMC1_PINS_PH
907	bool "Pins for mmc1 are on Port H"
908	depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40
909	---help---
910	Select this option for boards where mmc1 uses the Port H pinmux.
911
912config MMC_SUNXI_SLOT_EXTRA
913	int "mmc extra slot number"
914	default -1
915	---help---
916	sunxi builds always enable mmc0, some boards also have a second sdcard
917	slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
918	support for this.
919
920config I2C0_ENABLE
921	bool "Enable I2C/TWI controller 0"
922	default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_R40
923	default n if MACH_SUN6I || MACH_SUN8I
924	select CMD_I2C
925	---help---
926	This allows enabling I2C/TWI controller 0 by muxing its pins, enabling
927	its clock and setting up the bus. This is especially useful on devices
928	with slaves connected to the bus or with pins exposed through e.g. an
929	expansion port/header.
930
931config I2C1_ENABLE
932	bool "Enable I2C/TWI controller 1"
933	select CMD_I2C
934	---help---
935	See I2C0_ENABLE help text.
936
937if SUNXI_GEN_SUN6I || SUN50I_GEN_H6 || SUNXI_GEN_NCAT2
938config R_I2C_ENABLE
939	bool "Enable the PRCM I2C/TWI controller"
940	# This is used for the pmic on H3
941	default y if SY8106A_POWER
942	select CMD_I2C
943	---help---
944	Set this to y to enable the I2C controller which is part of the PRCM.
945endif
946
947config AXP_GPIO
948	bool "Enable support for gpio-s on axp PMICs"
949	depends on AXP_PMIC_BUS
950	---help---
951	Say Y here to enable support for the gpio pins of the axp PMIC ICs.
952
953config AXP_DISABLE_BOOT_ON_POWERON
954	bool "Disable device boot on power plug-in"
955	depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER
956	---help---
957	  Say Y here to prevent the device from booting up because of a plug-in
958	  event. When set, the device will boot into the SPL briefly to
959	  determine why it was powered on, and if it was determined because of
960	  a plug-in event instead of a button press event it will shut back off.
961
962config VIDEO_SUNXI
963	bool "Enable graphical uboot console on HDMI, LCD or VGA"
964	depends on !MACH_SUN8I_A83T
965	depends on !MACH_SUNXI_H3_H5
966	depends on !MACH_SUN8I_R40
967	depends on !MACH_SUN8I_V3S
968	depends on !MACH_SUN9I
969	depends on !MACH_SUN50I
970	depends on !SUN50I_GEN_H6
971	depends on !SUNXI_GEN_NCAT2
972	select VIDEO
973	select DISPLAY
974	imply VIDEO_DAMAGE
975	imply VIDEO_DT_SIMPLEFB
976	default y
977	---help---
978	Say Y here to add support for using a graphical console on the HDMI,
979	LCD or VGA output found on older sunxi devices. This will also provide
980	a simple_framebuffer device for Linux.
981
982config VIDEO_HDMI
983	bool "HDMI output support"
984	depends on VIDEO_SUNXI && !MACH_SUN8I && !MACH_SUNIV
985	default y
986	---help---
987	Say Y here to add support for outputting video over HDMI.
988
989config VIDEO_VGA
990	bool "VGA output support"
991	depends on VIDEO_SUNXI && (MACH_SUN4I || MACH_SUN7I)
992	---help---
993	Say Y here to add support for outputting video over VGA.
994
995config VIDEO_VGA_VIA_LCD
996	bool "VGA via LCD controller support"
997	depends on VIDEO_SUNXI && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I)
998	---help---
999	Say Y here to add support for external DACs connected to the parallel
1000	LCD interface driving a VGA connector, such as found on the
1001	Olimex A13 boards.
1002
1003config VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH
1004	bool "Force sync active high for VGA via LCD controller support"
1005	depends on VIDEO_VGA_VIA_LCD
1006	---help---
1007	Say Y here if you've a board which uses opendrain drivers for the vga
1008	hsync and vsync signals. Opendrain drivers cannot generate steep enough
1009	positive edges for a stable video output, so on boards with opendrain
1010	drivers the sync signals must always be active high.
1011
1012config VIDEO_VGA_EXTERNAL_DAC_EN
1013	string "LCD panel power enable pin"
1014	depends on VIDEO_VGA_VIA_LCD
1015	default ""
1016	---help---
1017	Set the enable pin for the external VGA DAC. This takes a string in the
1018	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
1019
1020config VIDEO_COMPOSITE
1021	bool "Composite video output support"
1022	depends on VIDEO_SUNXI && (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
1023	---help---
1024	Say Y here to add support for outputting composite video.
1025
1026config VIDEO_LCD_MODE
1027	string "LCD panel timing details"
1028	depends on VIDEO_SUNXI
1029	default ""
1030	---help---
1031	LCD panel timing details string, leave empty if there is no LCD panel.
1032	This is in drivers/video/videomodes.c: video_get_params() format, e.g.
1033	x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:0,vmode:0
1034	Also see: http://linux-sunxi.org/LCD
1035
1036config VIDEO_LCD_DCLK_PHASE
1037	int "LCD panel display clock phase"
1038	depends on VIDEO_SUNXI || VIDEO
1039	default 1
1040	range 0 3
1041	---help---
1042	Select LCD panel display clock phase shift
1043
1044config VIDEO_LCD_POWER
1045	string "LCD panel power enable pin"
1046	depends on VIDEO_SUNXI
1047	default ""
1048	---help---
1049	Set the power enable pin for the LCD panel. This takes a string in the
1050	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
1051
1052config VIDEO_LCD_RESET
1053	string "LCD panel reset pin"
1054	depends on VIDEO_SUNXI
1055	default ""
1056	---help---
1057	Set the reset pin for the LCD panel. This takes a string in the format
1058	understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
1059
1060config VIDEO_LCD_BL_EN
1061	string "LCD panel backlight enable pin"
1062	depends on VIDEO_SUNXI
1063	default ""
1064	---help---
1065	Set the backlight enable pin for the LCD panel. This takes a string in the
1066	the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of
1067	port H.
1068
1069config VIDEO_LCD_BL_PWM
1070	string "LCD panel backlight pwm pin"
1071	depends on VIDEO_SUNXI
1072	default ""
1073	---help---
1074	Set the backlight pwm pin for the LCD panel. This takes a string in the
1075	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
1076
1077config VIDEO_LCD_BL_PWM_ACTIVE_LOW
1078	bool "LCD panel backlight pwm is inverted"
1079	depends on VIDEO_SUNXI
1080	default y
1081	---help---
1082	Set this if the backlight pwm output is active low.
1083
1084config VIDEO_LCD_PANEL_I2C
1085	bool "LCD panel needs to be configured via i2c"
1086	depends on VIDEO_SUNXI
1087	select DM_I2C_GPIO
1088	---help---
1089	Say y here if the LCD panel needs to be configured via i2c. This
1090	will add a bitbang i2c controller using gpios to talk to the LCD.
1091
1092config VIDEO_LCD_PANEL_I2C_NAME
1093	string "LCD panel i2c interface node name"
1094	depends on VIDEO_LCD_PANEL_I2C
1095	default "i2c"
1096	---help---
1097	Set the device tree node name for the LCD i2c interface.
1098
1099# Note only one of these may be selected at a time! But hidden choices are
1100# not supported by Kconfig
1101config VIDEO_LCD_IF_PARALLEL
1102	bool
1103
1104config VIDEO_LCD_IF_LVDS
1105	bool
1106
1107config SUNXI_DE2
1108	bool
1109
1110config VIDEO_DE2
1111	bool "Display Engine 2 video driver"
1112	depends on SUNXI_DE2
1113	select VIDEO
1114	select DISPLAY
1115	select VIDEO_DW_HDMI
1116	imply VIDEO_DT_SIMPLEFB
1117	default y
1118	---help---
1119	Say y here if you want to build DE2 video driver which is present on
1120	newer SoCs. Currently only HDMI output is supported.
1121
1122
1123choice
1124	prompt "LCD panel support"
1125	depends on VIDEO_SUNXI
1126	---help---
1127	Select which type of LCD panel to support.
1128
1129config VIDEO_LCD_PANEL_PARALLEL
1130	bool "Generic parallel interface LCD panel"
1131	select VIDEO_LCD_IF_PARALLEL
1132
1133config VIDEO_LCD_PANEL_LVDS
1134	bool "Generic lvds interface LCD panel"
1135	select VIDEO_LCD_IF_LVDS
1136
1137config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828
1138	bool "MIPI 4-lane, 513Mbps LCD panel via SSD2828 bridge chip"
1139	select VIDEO_LCD_SSD2828
1140	select VIDEO_LCD_IF_PARALLEL
1141	---help---
1142	7.85" 768x1024 LCD panels, such as LG LP079X01 or AUO B079XAN01.0
1143
1144config VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804
1145	bool "eDP 4-lane, 1.62G LCD panel via ANX9804 bridge chip"
1146	select VIDEO_LCD_ANX9804
1147	select VIDEO_LCD_IF_PARALLEL
1148	select VIDEO_LCD_PANEL_I2C
1149	---help---
1150	Select this for eDP LCD panels with 4 lanes running at 1.62G,
1151	connected via an ANX9804 bridge chip.
1152
1153config VIDEO_LCD_PANEL_HITACHI_TX18D42VM
1154	bool "Hitachi tx18d42vm LCD panel"
1155	select VIDEO_LCD_HITACHI_TX18D42VM
1156	select VIDEO_LCD_IF_LVDS
1157	---help---
1158	7.85" 1024x768 Hitachi tx18d42vm LCD panel support
1159
1160config VIDEO_LCD_TL059WV5C0
1161	bool "tl059wv5c0 LCD panel"
1162	select VIDEO_LCD_PANEL_I2C
1163	select VIDEO_LCD_IF_PARALLEL
1164	---help---
1165	6" 480x800 tl059wv5c0 panel support, as used on the Utoo P66 and
1166	Aigo M60/M608/M606 tablets.
1167
1168endchoice
1169
1170config GMAC_TX_DELAY
1171	int "GMAC Transmit Clock Delay Chain"
1172	default 0
1173	---help---
1174	Set the GMAC Transmit Clock Delay Chain value.
1175
1176config SPL_STACK_R_ADDR
1177	default 0x81e00000 if MACH_SUNIV
1178	default 0x4fe00000 if MACH_SUN4I
1179	default 0x4fe00000 if MACH_SUN5I
1180	default 0x4fe00000 if MACH_SUN6I
1181	default 0x4fe00000 if MACH_SUN7I
1182	default 0x4fe00000 if MACH_SUN8I
1183	default 0x2fe00000 if MACH_SUN9I
1184	default 0x4fe00000 if MACH_SUN50I
1185	default 0x4fe00000 if SUN50I_GEN_H6
1186	default 0x4fe00000 if SUNXI_GEN_NCAT2
1187
1188config SPL_SPI_SUNXI
1189	bool "Support for SPI Flash on Allwinner SoCs in SPL"
1190	depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || MACH_SUN8I_V3S || SUN50I_GEN_H6 || MACH_SUNIV || SUNXI_GEN_NCAT2
1191	help
1192	  Enable support for SPI Flash. This option allows SPL to read from
1193	  sunxi SPI Flash. It uses the same method as the boot ROM, so does
1194	  not need any extra configuration.
1195
1196config PINE64_DT_SELECTION
1197	bool "Enable Pine64 device tree selection code"
1198	depends on MACH_SUN50I
1199	help
1200	  The original Pine A64 and Pine A64+ are similar but different
1201	  boards and can be differed by the DRAM size. Pine A64 has
1202	  512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this
1203	  option, the device tree selection code specific to Pine64 which
1204	  utilizes the DRAM size will be enabled.
1205
1206config PINEPHONE_DT_SELECTION
1207	bool "Enable PinePhone device tree selection code"
1208	depends on MACH_SUN50I
1209	help
1210	  Enable this option to automatically select the device tree for the
1211	  correct PinePhone hardware revision during boot.
1212
1213config BLUETOOTH_DT_DEVICE_FIXUP
1214	string "Fixup the Bluetooth controller address"
1215	default ""
1216	help
1217	  This option specifies the DT compatible name of the Bluetooth
1218	  controller for which to set the "local-bd-address" property.
1219	  Set this option if your device ships with the Bluetooth controller
1220	  default address.
1221	  The used address is "bdaddr" if set, and "ethaddr" with the LSB
1222	  flipped elsewise.
1223
1224config CHIP_DIP_SCAN
1225	bool "Enable DIPs detection for CHIP board"
1226	select SUPPORT_EXTENSION_SCAN
1227	select W1
1228	select W1_GPIO
1229	select W1_EEPROM
1230	select W1_EEPROM_DS24XXX
1231	select CMD_EXTENSION
1232
1233source "board/sunxi/Kconfig"
1234
1235endif
1236