1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * phycore_am335x_r2.h
4  *
5  * Phytec phyCORE-AM335x R2 (PCL060 / PCM060) boards information header
6  *
7  * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/
8  * Copyright (C) 2013 Lars Poeschel, Lemonage Software GmbH
9  * Copyright (C) 2019 DENX Software Engineering GmbH
10  */
11 
12 #ifndef __CONFIG_PHYCORE_AM335x_R2_H
13 #define __CONFIG_PHYCORE_AM335x_R2_H
14 
15 #include <configs/ti_am335x_common.h>
16 
17 #ifdef CONFIG_MTD_RAW_NAND
18 #define NANDARGS \
19 	"nandargs=setenv bootargs console=${console} " \
20 		"${optargs} " \
21 		"root=${nandroot} " \
22 		"rootfstype=${nandrootfstype}\0" \
23 	"nandroot=ubi0:root ubi.mtd=NAND.UBI\0" \
24 	"nandrootfstype=ubifs rootwait rw fsck.repair=yes\0" \
25 	"nandboot=echo Booting from nand ...; " \
26 		"run nandargs; " \
27 		"ubi part NAND.UBI; " \
28 		"ubi readvol ${fdtaddr} oftree; " \
29 		"ubi readvol ${loadaddr} kernel; " \
30 		"bootz ${loadaddr} - ${fdtaddr}\0"
31 
32 #else
33 #define NANDARGS ""
34 #endif
35 
36 /* set to negative value for no autoboot */
37 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
38 	"bootcmd_" #devtypel #instance "=" \
39 	"setenv mmcdev " #instance "; "\
40 	"setenv bootpart " #instance ":1 ; "\
41 	"setenv rootpart " #instance ":2 ; "\
42 	"run mmcboot\0"
43 
44 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
45 	#devtypel #instance " "
46 
47 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
48 	"bootcmd_" #devtypel #instance "=" \
49 	"run nandboot\0"
50 
51 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
52 	#devtypel #instance " "
53 
54 #define BOOT_TARGET_DEVICES(func) \
55 	func(MMC, mmc, 0) \
56 	func(LEGACY_MMC, legacy_mmc, 0) \
57 	func(MMC, mmc, 1) \
58 	func(LEGACY_MMC, legacy_mmc, 1) \
59 	func(NAND, nand, 0)
60 
61 #include <config_distro_bootcmd.h>
62 #include <env/ti/dfu.h>
63 #include <env/ti/mmc.h>
64 
65 #define CFG_EXTRA_ENV_SETTINGS \
66 	DEFAULT_MMC_TI_ARGS \
67 	DEFAULT_LINUX_BOOT_ENV \
68 	"bootfile=zImage\0" \
69 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
70 	"console=ttyS0,115200\0" \
71 	"optargs=\0" \
72 	"mmcrootfstype=ext2 rootwait\0" \
73 	"finduuid=part uuid mmc ${rootpart} uuid\0" \
74 	"boot_fit=0\0" \
75 	NANDARGS \
76 	BOOTENV
77 
78 /* Clock Macros */
79 #define V_OSCK				25000000  /* Clock output from T2 */
80 #define V_SCLK				V_OSCK
81 
82 #ifdef CONFIG_MTD_RAW_NAND
83 /* NAND: device related configs */
84 /* NAND: driver related configs */
85 #define CFG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
86 					 10, 11, 12, 13, 14, 15, 16, 17, \
87 					 18, 19, 20, 21, 22, 23, 24, 25, \
88 					 26, 27, 28, 29, 30, 31, 32, 33, \
89 					 34, 35, 36, 37, 38, 39, 40, 41, \
90 					 42, 43, 44, 45, 46, 47, 48, 49, \
91 					 50, 51, 52, 53, 54, 55, 56, 57, }
92 
93 #define CFG_SYS_NAND_ECCSIZE		512
94 #define CFG_SYS_NAND_ECCBYTES	14
95 
96 #endif /* !CONFIG_MTD_RAW_NAND */
97 
98 #endif	/* ! __CONFIG_PHYCORE_AM335x_R2_H */
99