blob: 4c56a8a59b0787873dd3c3734483ab0d8db53a1b [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Hannes Petermaier893c04e2014-02-07 08:07:36 +01002/*
Hannes Schmelzer2290fe02016-06-22 12:36:13 +02003 * brtpp1.h
Hannes Petermaier893c04e2014-02-07 08:07:36 +01004 *
5 * specific parts for B&R T-Series Motherboard
6 *
Hannes Schmelzer4c302b92015-05-28 15:41:12 +02007 * Copyright (C) 2013 Hannes Schmelzer <oe5hpm@oevsv.at> -
Hannes Petermaier893c04e2014-02-07 08:07:36 +01008 * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
Hannes Petermaier893c04e2014-02-07 08:07:36 +01009 */
10
Hannes Schmelzer2290fe02016-06-22 12:36:13 +020011#ifndef __CONFIG_BRPPT1_H__
12#define __CONFIG_BRPPT1_H__
Hannes Petermaier893c04e2014-02-07 08:07:36 +010013
Hannes Schmelzer3b804d92016-02-19 12:09:45 +010014#include <configs/bur_cfg_common.h>
Hannes Petermaier893c04e2014-02-07 08:07:36 +010015#include <configs/bur_am335x_common.h>
Simon Glass1af3c7f2020-05-10 11:40:09 -060016#include <linux/stringify.h>
Hannes Petermaier893c04e2014-02-07 08:07:36 +010017/* ------------------------------------------------------------------------- */
Hannes Schmelzer3b804d92016-02-19 12:09:45 +010018/* memory */
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020019#define CONFIG_SYS_BOOTM_LEN SZ_32M
Hannes Schmelzer3b804d92016-02-19 12:09:45 +010020
Hannes Petermaier893c04e2014-02-07 08:07:36 +010021/* Clock Defines */
22#define V_OSCK 26000000 /* Clock output from T2 */
23#define V_SCLK (V_OSCK)
24
25#define CONFIG_POWER_TPS65217
26
Hannes Petermaier893c04e2014-02-07 08:07:36 +010027/*
Hannes Schmelzerfbc7c7d2018-07-06 15:41:28 +020028 * When we have NAND flash we expect to be making use of mtdparts,
Hannes Petermaier893c04e2014-02-07 08:07:36 +010029 * both for ease of use in U-Boot and for passing information on to
30 * the Linux kernel.
31 */
Adam Ford9c5b0092018-07-07 22:18:22 -050032
33#ifdef CONFIG_SPL_OS_BOOT
34#define CONFIG_SYS_SPL_ARGS_ADDR 0x80F80000
35
36/* RAW SD card / eMMC */
37#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */
38#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */
39#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */
40
41/* NAND */
Miquel Raynal88718be2019-10-03 19:50:03 +020042#ifdef CONFIG_MTD_RAW_NAND
Adam Ford9c5b0092018-07-07 22:18:22 -050043#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x140000
Miquel Raynal88718be2019-10-03 19:50:03 +020044#endif /* CONFIG_MTD_RAW_NAND */
Adam Ford9c5b0092018-07-07 22:18:22 -050045#endif /* CONFIG_SPL_OS_BOOT */
Hannes Petermaier893c04e2014-02-07 08:07:36 +010046
Miquel Raynal88718be2019-10-03 19:50:03 +020047#ifdef CONFIG_MTD_RAW_NAND
Hannes Petermaier893c04e2014-02-07 08:07:36 +010048#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
Miquel Raynal88718be2019-10-03 19:50:03 +020049#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaier893c04e2014-02-07 08:07:36 +010050
Miquel Raynal88718be2019-10-03 19:50:03 +020051#ifdef CONFIG_MTD_RAW_NAND
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020052#define NANDTGTS \
53"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
54"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
Hannes Schmelzer0ea4fc42019-05-16 17:24:19 +020055"cfgscr=mw ${dtbaddr} 0; nand read ${cfgaddr} cfgscr && source ${cfgaddr};" \
56" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0" \
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020057"nandargs=setenv bootargs console=${console} ${optargs} ${optargs_rot} " \
58 "root=mtd6 rootfstype=jffs2 b_mode=${b_mode}\0" \
59"b_nand=nand read ${loadaddr} kernel; nand read ${dtbaddr} dtb; " \
60 "run nandargs; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
61"b_tgts_std=usb0 nand net\0" \
62"b_tgts_rcy=net usb0 nand\0" \
63"b_tgts_pme=usb0 nand net\0"
Hannes Petermaier893c04e2014-02-07 08:07:36 +010064#else
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020065#define NANDTGTS ""
Miquel Raynal88718be2019-10-03 19:50:03 +020066#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaier893c04e2014-02-07 08:07:36 +010067
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020068#define MMCSPI_TGTS \
69"t30args#0=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
70 "b_mode=${b_mode} root=/dev/mmcblk0p2 rootfstype=ext4\0" \
71"b_t30lgcy#0=" \
72 "load ${loaddev}:2 ${loadaddr} /boot/PPTImage.md5 && " \
73 "load ${loaddev}:2 ${loadaddr} /boot/zImage && " \
74 "load ${loaddev}:2 ${dtbaddr} /boot/am335x-ppt30.dtb || " \
75 "load ${loaddev}:1 ${dtbaddr} am335x-ppt30-legacy.dtb; "\
76 "run t30args#0; run cfgscr; bootz ${loadaddr} - ${dtbaddr}\0" \
77"t30args#1=setenv bootargs ${optargs_rot} ${optargs} console=${console} " \
78 "b_mode=${b_mode}\0" \
79"b_t30lgcy#1=" \
80 "load ${loaddev}:1 ${loadaddr} zImage && " \
81 "load ${loaddev}:1 ${dtbaddr} am335x-ppt30.dtb && " \
82 "load ${loaddev}:1 ${ramaddr} rootfsPPT30.uboot && " \
83 "run t30args#1; run cfgscr; bootz ${loadaddr} ${ramaddr} ${dtbaddr}\0" \
84"b_mmc0=load ${loaddev}:1 ${scraddr} bootscr.img && source ${scraddr}\0" \
85"b_mmc1=load ${loaddev}:1 ${scraddr} /boot/bootscr.img && source ${scraddr}\0" \
86"b_tgts_std=mmc0 mmc1 t30lgcy#0 t30lgcy#1 usb0 net\0" \
87"b_tgts_rcy=t30lgcy#1 usb0 net\0" \
88"b_tgts_pme=net usb0 mmc0 mmc1\0" \
89"loaddev=mmc 1\0"
90
Hannes Schmelzerfbc7c7d2018-07-06 15:41:28 +020091#ifdef CONFIG_ENV_IS_IN_MMC
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020092#define MMCTGTS \
93MMCSPI_TGTS \
Hannes Schmelzer0ea4fc42019-05-16 17:24:19 +020094"cfgscr=mw ${dtbaddr} 0;" \
95" mmc dev 1; mmc read ${cfgaddr} 200 80; source ${cfgaddr};" \
96" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0"
Hannes Petermaier893c04e2014-02-07 08:07:36 +010097#else
Hannes Schmelzer73e9db22018-07-06 15:41:26 +020098#define MMCTGTS ""
Hannes Petermaier893c04e2014-02-07 08:07:36 +010099#endif /* CONFIG_MMC */
100
Hannes Schmelzer73e9db22018-07-06 15:41:26 +0200101#ifdef CONFIG_SPI
102#define SPITGTS \
103MMCSPI_TGTS \
Hannes Schmelzer0ea4fc42019-05-16 17:24:19 +0200104"cfgscr=mw ${dtbaddr} 0;" \
105" sf probe; sf read ${cfgaddr} 0xC0000 10000; source ${cfgaddr};" \
106" fdt addr ${dtbaddr} || cp ${fdtcontroladdr} ${dtbaddr} 4000\0"
Hannes Schmelzer73e9db22018-07-06 15:41:26 +0200107#else
108#define SPITGTS ""
109#endif /* CONFIG_SPI */
110
111#define LOAD_OFFSET(x) 0x8##x
112
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100113#ifndef CONFIG_SPL_BUILD
114#define CONFIG_EXTRA_ENV_SETTINGS \
Hannes Petermaier7ae47f62015-02-03 13:22:34 +0100115BUR_COMMON_ENV \
Hannes Petermaier662a4762015-02-03 13:22:37 +0100116"verify=no\0" \
Hannes Petermaier7ae47f62015-02-03 13:22:34 +0100117"autoload=0\0" \
Hannes Schmelzer73e9db22018-07-06 15:41:26 +0200118"scraddr=" __stringify(LOAD_OFFSET(0000000)) "\0" \
119"cfgaddr=" __stringify(LOAD_OFFSET(0020000)) "\0" \
120"dtbaddr=" __stringify(LOAD_OFFSET(0040000)) "\0" \
121"loadaddr=" __stringify(LOAD_OFFSET(0100000)) "\0" \
122"ramaddr=" __stringify(LOAD_OFFSET(2000000)) "\0" \
Hannes Petermaier662a4762015-02-03 13:22:37 +0100123"console=ttyO0,115200n8\0" \
Hannes Petermaier14ec12f2015-06-11 12:31:54 +0200124"optargs=consoleblank=0 quiet panic=2\0" \
Hannes Schmelzer73e9db22018-07-06 15:41:26 +0200125"b_break=0\0" \
126"b_usb0=usb start && load usb 0 ${scraddr} bootscr.img && source ${scraddr}\0" \
127"b_net=tftp ${scraddr} netscript.img && source ${scraddr}\0" \
128MMCTGTS \
129SPITGTS \
130NANDTGTS \
131"b_deftgts=if test ${b_mode} = 12; then setenv b_tgts ${b_tgts_pme};" \
132" elif test ${b_mode} = 0; then setenv b_tgts ${b_tgts_rcy};" \
133" else setenv b_tgts ${b_tgts_std}; fi\0" \
134"b_default=run b_deftgts; for target in ${b_tgts};"\
135" do echo \"### booting ${target} ###\"; run b_${target};" \
136" if test ${b_break} = 1; then; exit; fi; done\0"
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100137#endif /* !CONFIG_SPL_BUILD*/
138
Miquel Raynal88718be2019-10-03 19:50:03 +0200139#ifdef CONFIG_MTD_RAW_NAND
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100140/*
141 * GPMC block. We support 1 device and the physical address to
142 * access CS0 at is 0x8000000.
143 */
144#define CONFIG_SYS_MAX_NAND_DEVICE 1
145#define CONFIG_SYS_NAND_BASE 0x8000000
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100146/* don't change OMAP_ELM, ECCSCHEME. ROM code only supports this */
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100147#define CONFIG_SYS_NAND_ECCPOS {2, 3, 4, 5, 6, 7, 8, 9, \
148 10, 11, 12, 13, 14, 15, 16, 17, \
149 18, 19, 20, 21, 22, 23, 24, 25, \
150 26, 27, 28, 29, 30, 31, 32, 33, \
151 34, 35, 36, 37, 38, 39, 40, 41, \
152 42, 43, 44, 45, 46, 47, 48, 49, \
153 50, 51, 52, 53, 54, 55, 56, 57, }
154
155#define CONFIG_SYS_NAND_ECCSIZE 512
156#define CONFIG_SYS_NAND_ECCBYTES 14
157
158#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100159
Hannes Petermaierd79c1382015-04-08 07:38:34 +0200160#define CONFIG_NAND_OMAP_GPMC_WSCFG 1
Miquel Raynal88718be2019-10-03 19:50:03 +0200161#endif /* CONFIG_MTD_RAW_NAND */
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100162
Tom Rini7d080772020-07-24 17:14:47 -0400163#if defined(CONFIG_ENV_IS_IN_NAND)
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100164#define CONFIG_SYS_ENV_SECT_SIZE CONFIG_ENV_SIZE
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100165#endif
Hannes Petermaier893c04e2014-02-07 08:07:36 +0100166
Hannes Schmelzer2290fe02016-06-22 12:36:13 +0200167#endif /* ! __CONFIG_BRPPT1_H__ */