blob: 68931c1358e3b9f50e926bb3c1ecb060b8215e45 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Hannes Petermaierfb003662014-02-07 08:07:36 +01002/*
Hannes Schmelzer20ccb432016-06-22 12:36:13 +02003 * brtpp1.h
Hannes Petermaierfb003662014-02-07 08:07:36 +01004 *
5 * specific parts for B&R T-Series Motherboard
6 *
Hannes Schmelzer7935f032015-05-28 15:41:12 +02007 * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
Hannes Petermaierfb003662014-02-07 08:07:36 +01008 * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
Hannes Petermaierfb003662014-02-07 08:07:36 +01009 */
10
Hannes Schmelzer20ccb432016-06-22 12:36:13 +020011#ifndef __CONFIG_BRPPT1_H__
12#define __CONFIG_BRPPT1_H__
Hannes Petermaierfb003662014-02-07 08:07:36 +010013
Hannes Schmelzer27bf4412016-02-19 12:09:45 +010014#include <configs/bur_cfg_common.h>
Hannes Petermaierfb003662014-02-07 08:07:36 +010015#include <configs/bur_am335x_common.h>
Simon Glassfb64e362020-05-10 11:40:09 -060016#include <linux/stringify.h>
Hannes Petermaierfb003662014-02-07 08:07:36 +010017/* ------------------------------------------------------------------------- */
Hannes Schmelzer27bf4412016-02-19 12:09:45 +010018/* memory */
19#define CONFIG_SYS_MALLOC_LEN (5 * 1024 * 1024)
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +020020#define CONFIG_SYS_BOOTM_LEN SZ_32M
Hannes Schmelzer27bf4412016-02-19 12:09:45 +010021
Hannes Petermaierfb003662014-02-07 08:07:36 +010022/* Clock Defines */
23#define V_OSCK 26000000 /* Clock output from T2 */
24#define V_SCLK (V_OSCK)
25
26#define CONFIG_POWER_TPS65217
27
28/* Support both device trees and ATAGs. */
Hannes Petermaierfb003662014-02-07 08:07:36 +010029#define CONFIG_CMDLINE_TAG
30#define CONFIG_SETUP_MEMORY_TAGS
31#define CONFIG_INITRD_TAG
Hannes Petermaierfb003662014-02-07 08:07:36 +010032/*#define CONFIG_MACH_TYPE 3589*/
33#define CONFIG_MACH_TYPE 0xFFFFFFFF /* TODO: check with kernel*/
34
Hannes Petermaierfb003662014-02-07 08:07:36 +010035/*
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +020036 * When we have NAND flash we expect to be making use of mtdparts,
Hannes Petermaierfb003662014-02-07 08:07:36 +010037 * both for ease of use in U-Boot and for passing information on to
38 * the Linux kernel.
39 */
Adam Fordac44a302018-07-07 22:18:22 -050040
41#ifdef CONFIG_SPL_OS_BOOT
42#define CONFIG_SYS_SPL_ARGS_ADDR 0x80F80000
43
44/* RAW SD card / eMMC */
45#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */
46#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */
47#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */
48
49/* NAND */
Miquel Raynald0935362019-10-03 19:50:03 +020050#ifdef CONFIG_MTD_RAW_NAND
Adam Fordac44a302018-07-07 22:18:22 -050051#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x140000
Miquel Raynald0935362019-10-03 19:50:03 +020052#endif /* CONFIG_MTD_RAW_NAND */
Adam Fordac44a302018-07-07 22:18:22 -050053#endif /* CONFIG_SPL_OS_BOOT */
Hannes Petermaierfb003662014-02-07 08:07:36 +010054
Miquel Raynald0935362019-10-03 19:50:03 +020055#ifdef CONFIG_MTD_RAW_NAND
Hannes Petermaierfb003662014-02-07 08:07:36 +010056#define CONFIG_SPL_NAND_BASE
57#define CONFIG_SPL_NAND_DRIVERS
58#define CONFIG_SPL_NAND_ECC
59#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
60#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
Miquel Raynald0935362019-10-03 19:50:03 +020061#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaierfb003662014-02-07 08:07:36 +010062
Miquel Raynald0935362019-10-03 19:50:03 +020063#ifdef CONFIG_MTD_RAW_NAND
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +020064#define NANDTGTS \
65"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
66"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Hannes Schmelzer70e7c702019-05-16 17:24:19 +020067"cfgscr=mw ${dtbaddr} 0; nand read ${cfgaddr} cfgscr && source ${cfgaddr};" \
68" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0" \
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +020069"nandargs=setenv bootargs console=${console} ${optargs} ${optargs_rot} " \
70 "root=mtd6 rootfstype=jffs2 b_mode=${b_mode}\0" \
71"b_nand=nand read ${loadaddr} kernel; nand read ${dtbaddr} dtb; " \
72 "run nandargs; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
73"b_tgts_std=usb0 nand net\0" \
74"b_tgts_rcy=net usb0 nand\0" \
75"b_tgts_pme=usb0 nand net\0"
Hannes Petermaierfb003662014-02-07 08:07:36 +010076#else
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +020077#define NANDTGTS ""
Miquel Raynald0935362019-10-03 19:50:03 +020078#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaierfb003662014-02-07 08:07:36 +010079
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +020080#define MMCSPI_TGTS \
81"t30args#0=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
82 "b_mode=${b_mode} root=/dev/mmcblk0p2 rootfstype=ext4\0" \
83"b_t30lgcy#0=" \
84 "load ${loaddev}:2 ${loadaddr} /boot/PPTImage.md5 && " \
85 "load ${loaddev}:2 ${loadaddr} /boot/zImage && " \
86 "load ${loaddev}:2 ${dtbaddr} /boot/am335x-ppt30.dtb || " \
87 "load ${loaddev}:1 ${dtbaddr} am335x-ppt30-legacy.dtb; "\
88 "run t30args#0; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
89"t30args#1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
90 "b_mode=${b_mode}\0" \
91"b_t30lgcy#1=" \
92 "load ${loaddev}:1 ${loadaddr} zImage && " \
93 "load ${loaddev}:1 ${dtbaddr} am335x-ppt30.dtb && " \
94 "load ${loaddev}:1 ${ramaddr} rootfsPPT30.uboot && " \
95 "run t30args#1; run cfgscr; bootz ${loadaddr} ${ramaddr} ${dtbaddr}\0" \
96"b_mmc0=load ${loaddev}:1 ${scraddr} bootscr.img && source ${scraddr}\0" \
97"b_mmc1=load ${loaddev}:1 ${scraddr} /boot/bootscr.img && source ${scraddr}\0" \
98"b_tgts_std=mmc0 mmc1 t30lgcy#0 t30lgcy#1 usb0 net\0" \
99"b_tgts_rcy=t30lgcy#1 usb0 net\0" \
100"b_tgts_pme=net usb0 mmc0 mmc1\0" \
101"loaddev=mmc 1\0"
102
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +0200103#ifdef CONFIG_ENV_IS_IN_MMC
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200104#define MMCTGTS \
105MMCSPI_TGTS \
Hannes Schmelzer70e7c702019-05-16 17:24:19 +0200106"cfgscr=mw ${dtbaddr} 0;" \
107" mmc dev 1; mmc read ${cfgaddr} 200 80; source ${cfgaddr};" \
108" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0"
Hannes Petermaierfb003662014-02-07 08:07:36 +0100109#else
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200110#define MMCTGTS ""
Hannes Petermaierfb003662014-02-07 08:07:36 +0100111#endif /* CONFIG_MMC */
112
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200113#ifdef CONFIG_SPI
114#define SPITGTS \
115MMCSPI_TGTS \
Hannes Schmelzer70e7c702019-05-16 17:24:19 +0200116"cfgscr=mw ${dtbaddr} 0;" \
117" sf probe; sf read ${cfgaddr} 0xC0000 10000; source ${cfgaddr};" \
118" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0"
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200119#else
120#define SPITGTS ""
121#endif /* CONFIG_SPI */
122
123#define LOAD_OFFSET(x) 0x8##x
124
Hannes Petermaierfb003662014-02-07 08:07:36 +0100125#ifndef CONFIG_SPL_BUILD
126#define CONFIG_EXTRA_ENV_SETTINGS \
Hannes Petermaier918d97b2015-02-03 13:22:34 +0100127BUR_COMMON_ENV \
Hannes Petermaier3d8394c2015-02-03 13:22:37 +0100128"verify=no\0" \
Hannes Petermaier918d97b2015-02-03 13:22:34 +0100129"autoload=0\0" \
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200130"scraddr=" __stringify(LOAD_OFFSET(0000000)) "\0" \
131"cfgaddr=" __stringify(LOAD_OFFSET(0020000)) "\0" \
132"dtbaddr=" __stringify(LOAD_OFFSET(0040000)) "\0" \
133"loadaddr=" __stringify(LOAD_OFFSET(0100000)) "\0" \
134"ramaddr=" __stringify(LOAD_OFFSET(2000000)) "\0" \
Hannes Petermaier3d8394c2015-02-03 13:22:37 +0100135"console=ttyO0,115200n8\0" \
Hannes Petermaier89767d122015-06-11 12:31:54 +0200136"optargs=consoleblank=0 quiet panic=2\0" \
Hannes Schmelzer9b7c2c12018-07-06 15:41:26 +0200137"b_break=0\0" \
138"b_usb0=usb start && load usb 0 ${scraddr} bootscr.img && source ${scraddr}\0" \
139"b_net=tftp ${scraddr} netscript.img && source ${scraddr}\0" \
140MMCTGTS \
141SPITGTS \
142NANDTGTS \
143"b_deftgts=if test ${b_mode} = 12; then setenv b_tgts ${b_tgts_pme};" \
144" elif test ${b_mode} = 0; then setenv b_tgts ${b_tgts_rcy};" \
145" else setenv b_tgts ${b_tgts_std}; fi\0" \
146"b_default=run b_deftgts; for target in ${b_tgts};"\
147" do echo \"### booting ${target} ###\"; run b_${target};" \
148" if test ${b_break} = 1; then; exit; fi; done\0"
Hannes Petermaierfb003662014-02-07 08:07:36 +0100149#endif /* !CONFIG_SPL_BUILD*/
150
Miquel Raynald0935362019-10-03 19:50:03 +0200151#ifdef CONFIG_MTD_RAW_NAND
Hannes Petermaierfb003662014-02-07 08:07:36 +0100152/*
153 * GPMC block. We support 1 device and the physical address to
154 * access CS0 at is 0x8000000.
155 */
156#define CONFIG_SYS_MAX_NAND_DEVICE 1
157#define CONFIG_SYS_NAND_BASE 0x8000000
Hannes Petermaierfb003662014-02-07 08:07:36 +0100158/* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */
Hannes Petermaierfb003662014-02-07 08:07:36 +0100159#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW
Hannes Petermaierfb003662014-02-07 08:07:36 +0100160#define CONFIG_SYS_NAND_5_ADDR_CYCLE
161#define CONFIG_SYS_NAND_BLOCK_SIZE (128*1024)
162#define CONFIG_SYS_NAND_PAGE_SIZE 2048
163#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
164 CONFIG_SYS_NAND_PAGE_SIZE)
165#define CONFIG_SYS_NAND_OOBSIZE 64
166#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
167#define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9, \
168 10, 11, 12, 13, 14, 15, 16, 17, \
169 18, 19, 20, 21, 22, 23, 24, 25, \
170 26, 27, 28, 29, 30, 31, 32, 33, \
171 34, 35, 36, 37, 38, 39, 40, 41, \
172 42, 43, 44, 45, 46, 47, 48, 49, \
173 50, 51, 52, 53, 54, 55, 56, 57, }
174
175#define CONFIG_SYS_NAND_ECCSIZE 512
176#define CONFIG_SYS_NAND_ECCBYTES 14
177
178#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
Hannes Petermaierfb003662014-02-07 08:07:36 +0100179
Hannes Petermaier763f7f32015-04-08 07:38:34 +0200180#define CONFIG_NAND_OMAP_GPMC_WSCFG 1
Miquel Raynald0935362019-10-03 19:50:03 +0200181#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaierfb003662014-02-07 08:07:36 +0100182
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +0200183#if defined(CONFIG_SPI)
184/* SPI Flash */
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +0200185/* Environment */
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +0200186#elif defined(CONFIG_ENV_IS_IN_MMC)
Hannes Schmelzer6afb92a2017-07-06 08:47:14 +0200187#define CONFIG_SYS_MMC_ENV_DEV 1
Hannes Petermaierfb003662014-02-07 08:07:36 +0100188#define CONFIG_SYS_MMC_ENV_PART 2
Hannes Petermaierfb003662014-02-07 08:07:36 +0100189
Hannes Schmelzer5639eeb2018-07-06 15:41:28 +0200190#elif defined(CONFIG_ENV_IS_IN_NAND)
Tom Rinibff9efa2014-07-18 11:51:33 -0400191/* No NAND env support in SPL */
Hannes Petermaierfb003662014-02-07 08:07:36 +0100192#define CONFIG_SYS_ENV_SECT_SIZE CONFIG_ENV_SIZE
193#else
194#error "no storage for Environment defined!"
195#endif
Hannes Petermaierfb003662014-02-07 08:07:36 +0100196
Hannes Schmelzer20ccb432016-06-22 12:36:13 +0200197#endif /* ! __CONFIG_BRPPT1_H__ */