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 - http://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 #define CONFIG_MACH_TYPE		MACH_TYPE_SBC_PHYCORE_AM335X
18 
19 #ifdef CONFIG_MTD_RAW_NAND
20 #define NANDARGS \
21 	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
22 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
23 	"nandargs=setenv bootargs console=${console} " \
24 		"${optargs} " \
25 		"root=${nandroot} " \
26 		"rootfstype=${nandrootfstype}\0" \
27 	"nandroot=ubi0:root ubi.mtd=NAND.UBI\0" \
28 	"nandrootfstype=ubifs rootwait rw fsck.repair=yes\0" \
29 	"nandboot=echo Booting from nand ...; " \
30 		"run nandargs; " \
31 		"ubi part NAND.UBI; " \
32 		"ubi readvol ${fdtaddr} oftree; " \
33 		"ubi readvol ${loadaddr} kernel; " \
34 		"bootz ${loadaddr} - ${fdtaddr}\0"
35 
36 #else
37 #define NANDARGS ""
38 #endif
39 
40 /* set to negative value for no autoboot */
41 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
42 	"bootcmd_" #devtypel #instance "=" \
43 	"setenv mmcdev " #instance "; "\
44 	"setenv bootpart " #instance ":1 ; "\
45 	"setenv rootpart " #instance ":2 ; "\
46 	"run mmcboot\0"
47 
48 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
49 	#devtypel #instance " "
50 
51 #define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
52 	"bootcmd_" #devtypel #instance "=" \
53 	"run nandboot\0"
54 
55 #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \
56 	#devtypel #instance " "
57 
58 #define BOOT_TARGET_DEVICES(func) \
59 	func(MMC, mmc, 0) \
60 	func(LEGACY_MMC, legacy_mmc, 0) \
61 	func(MMC, mmc, 1) \
62 	func(LEGACY_MMC, legacy_mmc, 1) \
63 	func(NAND, nand, 0)
64 
65 #include <config_distro_bootcmd.h>
66 #include <environment/ti/dfu.h>
67 #include <environment/ti/mmc.h>
68 
69 #define CONFIG_EXTRA_ENV_SETTINGS \
70 	DEFAULT_MMC_TI_ARGS \
71 	DEFAULT_LINUX_BOOT_ENV \
72 	"bootfile=zImage\0" \
73 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
74 	"console=ttyS0,115200\0" \
75 	"optargs=\0" \
76 	"mmcrootfstype=ext2 rootwait\0" \
77 	"finduuid=part uuid mmc ${rootpart} uuid\0" \
78 	"boot_fit=0\0" \
79 	NANDARGS \
80 	BOOTENV
81 
82 /* Clock Macros */
83 #define V_OSCK				25000000  /* Clock output from T2 */
84 #define V_SCLK				V_OSCK
85 
86 #define CONFIG_POWER_TPS65910
87 
88 #ifdef CONFIG_MTD_RAW_NAND
89 /* NAND: device related configs */
90 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
91 #define CONFIG_SYS_NAND_PAGE_COUNT	(CONFIG_SYS_NAND_BLOCK_SIZE / \
92 					 CONFIG_SYS_NAND_PAGE_SIZE)
93 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
94 #define CONFIG_SYS_NAND_OOBSIZE		64
95 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
96 /* NAND: driver related configs */
97 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	NAND_LARGE_BADBLOCK_POS
98 #define CONFIG_SYS_NAND_ECCPOS		{ 2, 3, 4, 5, 6, 7, 8, 9, \
99 					 10, 11, 12, 13, 14, 15, 16, 17, \
100 					 18, 19, 20, 21, 22, 23, 24, 25, \
101 					 26, 27, 28, 29, 30, 31, 32, 33, \
102 					 34, 35, 36, 37, 38, 39, 40, 41, \
103 					 42, 43, 44, 45, 46, 47, 48, 49, \
104 					 50, 51, 52, 53, 54, 55, 56, 57, }
105 
106 #define CONFIG_SYS_NAND_ECCSIZE		512
107 #define CONFIG_SYS_NAND_ECCBYTES	14
108 #define CONFIG_SYS_NAND_ONFI_DETECTION
109 #define CONFIG_NAND_OMAP_ECCSCHEME	OMAP_ECC_BCH8_CODE_HW
110 
111 /* NAND: SPL related configs */
112 #ifdef CONFIG_SPL_OS_BOOT
113 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	0x00200000 /* kernel offset */
114 #endif
115 #endif /* !CONFIG_MTD_RAW_NAND */
116 
117 /* CPU */
118 
119 #ifdef CONFIG_SPI_BOOT
120 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x40000
121 #elif defined(CONFIG_ENV_IS_IN_NAND)
122 #define CONFIG_SYS_ENV_SECT_SIZE	CONFIG_SYS_NAND_BLOCK_SIZE
123 #endif
124 
125 #endif	/* ! __CONFIG_PHYCORE_AM335x_R2_H */
126