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