Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2013 Freescale Semiconductor, Inc. |
| 4 | * |
| 5 | * Configuration settings for the phytec PCM-052 SoM. |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __CONFIG_H |
| 9 | #define __CONFIG_H |
| 10 | |
| 11 | #include <asm/arch/imx-regs.h> |
Lukasz Majewski | ec477ec | 2019-02-13 22:46:51 +0100 | [diff] [blame] | 12 | #include <linux/sizes.h> |
Simon Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 13 | #include <linux/stringify.h> |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 14 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 15 | #define CONFIG_SKIP_LOWLEVEL_INIT |
| 16 | |
| 17 | /* Enable passing of ATAGs */ |
| 18 | #define CONFIG_CMDLINE_TAG |
| 19 | |
| 20 | /* Size of malloc() pool */ |
Lukasz Majewski | ec477ec | 2019-02-13 22:46:51 +0100 | [diff] [blame] | 21 | #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M) |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 22 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 23 | /* NAND support */ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 24 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
| 25 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 26 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 27 | |
| 28 | #define CONFIG_LOADADDR 0x82000000 |
| 29 | |
| 30 | /* We boot from the gfxRAM area of the OCRAM. */ |
Stefan Agner | 1faaa3c | 2017-10-17 13:59:19 +0200 | [diff] [blame] | 31 | #define CONFIG_BOARD_SIZE_LIMIT 520192 |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 32 | |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 33 | /* if no target-specific extra environment settings were defined by the |
| 34 | target, define an empty one */ |
| 35 | #ifndef PCM052_EXTRA_ENV_SETTINGS |
| 36 | #define PCM052_EXTRA_ENV_SETTINGS |
| 37 | #endif |
| 38 | |
| 39 | /* if no target-specific boot command was defined by the target, |
| 40 | define an empty one */ |
| 41 | #ifndef PCM052_BOOTCOMMAND |
| 42 | #define PCM052_BOOTCOMMAND |
| 43 | #endif |
| 44 | |
| 45 | /* if no target-specific extra environment settings were defined by the |
| 46 | target, define an empty one */ |
| 47 | #ifndef PCM052_NET_INIT |
| 48 | #define PCM052_NET_INIT |
| 49 | #endif |
| 50 | |
| 51 | /* boot command, including the target-defined one if any */ |
| 52 | #define CONFIG_BOOTCOMMAND PCM052_BOOTCOMMAND "run bootcmd_nand" |
| 53 | |
| 54 | /* Extra env settings (including the target-defined ones if any) */ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 55 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 56 | PCM052_EXTRA_ENV_SETTINGS \ |
| 57 | "autoload=no\0" \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 58 | "fdt_high=0xffffffff\0" \ |
| 59 | "initrd_high=0xffffffff\0" \ |
Albert ARIBAUD \(3ADEV\) | 2e9f494 | 2016-09-26 09:08:06 +0200 | [diff] [blame] | 60 | "blimg_file=u-boot.vyb\0" \ |
| 61 | "blimg_addr=0x81000000\0" \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 62 | "kernel_file=zImage\0" \ |
| 63 | "kernel_addr=0x82000000\0" \ |
Albert ARIBAUD \(3ADEV\) | cb2b567 | 2016-09-26 09:08:04 +0200 | [diff] [blame] | 64 | "fdt_file=zImage.dtb\0" \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 65 | "fdt_addr=0x81000000\0" \ |
| 66 | "ram_file=uRamdisk\0" \ |
| 67 | "ram_addr=0x83000000\0" \ |
| 68 | "filesys=rootfs.ubifs\0" \ |
| 69 | "sys_addr=0x81000000\0" \ |
| 70 | "tftploc=/path/to/tftp/directory/\0" \ |
| 71 | "nfs_root=/path/to/nfs/root\0" \ |
| 72 | "tftptimeout=1000\0" \ |
| 73 | "tftptimeoutcountmax=1000000\0" \ |
Tom Rini | 5ad8e11 | 2017-10-22 17:55:07 -0400 | [diff] [blame] | 74 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
Albert ARIBAUD \(3ADEV\) | 99208d9 | 2016-09-26 09:08:07 +0200 | [diff] [blame] | 75 | "bootargs_base=setenv bootargs rw " \ |
| 76 | " mem=" __stringify(CONFIG_PCM052_DDR_SIZE) "M " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 77 | "console=ttyLP1,115200n8\0" \ |
| 78 | "bootargs_sd=setenv bootargs ${bootargs} " \ |
| 79 | "root=/dev/mmcblk0p2 rootwait\0" \ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 80 | "bootargs_net=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 81 | "nfsroot=${serverip}:${nfs_root},v3,tcp\0" \ |
| 82 | "bootargs_nand=setenv bootargs ${bootargs} " \ |
Albert ARIBAUD \(3ADEV\) | 98585b4 | 2016-09-26 09:08:03 +0200 | [diff] [blame] | 83 | "ubi.mtd=5 rootfstype=ubifs root=ubi0:rootfs\0" \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 84 | "bootargs_ram=setenv bootargs ${bootargs} " \ |
| 85 | "root=/dev/ram rw initrd=${ram_addr}\0" \ |
| 86 | "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \ |
| 87 | "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \ |
| 88 | "fatload mmc 0:1 ${kernel_addr} ${kernel_file}; " \ |
| 89 | "fatload mmc 0:1 ${fdt_addr} ${fdt_file}; " \ |
| 90 | "bootz ${kernel_addr} - ${fdt_addr}\0" \ |
| 91 | "bootcmd_net=run bootargs_base bootargs_net bootargs_mtd; " \ |
| 92 | "tftpboot ${kernel_addr} ${tftpdir}${kernel_file}; " \ |
| 93 | "tftpboot ${fdt_addr} ${tftpdir}${fdt_file}; " \ |
| 94 | "bootz ${kernel_addr} - ${fdt_addr}\0" \ |
| 95 | "bootcmd_nand=run bootargs_base bootargs_nand bootargs_mtd; " \ |
| 96 | "nand read ${fdt_addr} dtb; " \ |
| 97 | "nand read ${kernel_addr} kernel; " \ |
| 98 | "bootz ${kernel_addr} - ${fdt_addr}\0" \ |
| 99 | "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \ |
| 100 | "nand read ${fdt_addr} dtb; " \ |
| 101 | "nand read ${kernel_addr} kernel; " \ |
Albert ARIBAUD \(3ADEV\) | 98585b4 | 2016-09-26 09:08:03 +0200 | [diff] [blame] | 102 | "nand read ${ram_addr} root; " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 103 | "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 104 | "update_bootloader_from_tftp=" PCM052_NET_INIT \ |
| 105 | "if tftp ${blimg_addr} "\ |
Albert ARIBAUD \(3ADEV\) | 2e9f494 | 2016-09-26 09:08:06 +0200 | [diff] [blame] | 106 | "${tftpdir}${blimg_file}; then " \ |
| 107 | "mtdparts default; " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 108 | "nand erase.part bootloader; " \ |
Albert ARIBAUD \(3ADEV\) | 2e9f494 | 2016-09-26 09:08:06 +0200 | [diff] [blame] | 109 | "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 110 | "update_kernel_from_sd=if fatload mmc 0:2 ${kernel_addr} " \ |
| 111 | "${kernel_file}; " \ |
| 112 | "then mtdparts default; " \ |
| 113 | "nand erase.part kernel; " \ |
| 114 | "nand write ${kernel_addr} kernel ${filesize}; " \ |
| 115 | "if fatload mmc 0:2 ${fdt_addr} ${fdt_file}; then " \ |
| 116 | "nand erase.part dtb; " \ |
| 117 | "nand write ${fdt_addr} dtb ${filesize}; fi\0" \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 118 | "update_kernel_from_tftp=" PCM052_NET_INIT \ |
| 119 | "if tftp ${fdt_addr} ${tftpdir}${fdt_file}; " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 120 | "then setenv fdtsize ${filesize}; " \ |
| 121 | "if tftp ${kernel_addr} ${tftpdir}${kernel_file}; then " \ |
| 122 | "mtdparts default; " \ |
| 123 | "nand erase.part dtb; " \ |
| 124 | "nand write ${fdt_addr} dtb ${fdtsize}; " \ |
| 125 | "nand erase.part kernel; " \ |
| 126 | "nand write ${kernel_addr} kernel ${filesize}; fi; fi\0" \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 127 | "update_rootfs_from_tftp=" PCM052_NET_INIT \ |
| 128 | "if tftp ${sys_addr} ${tftpdir}${filesys}; " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 129 | "then mtdparts default; " \ |
| 130 | "nand erase.part root; " \ |
| 131 | "ubi part root; " \ |
| 132 | "ubi create rootfs; " \ |
| 133 | "ubi write ${sys_addr} rootfs ${filesize}; fi\0" \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 134 | "update_ramdisk_from_tftp=" PCM052_NET_INIT \ |
| 135 | "if tftp ${ram_addr} ${tftpdir}${ram_file}; " \ |
Albert ARIBAUD (3ADEV) | a3a095c | 2015-10-11 20:06:39 +0200 | [diff] [blame] | 136 | "then mtdparts default; " \ |
Albert ARIBAUD \(3ADEV\) | 98585b4 | 2016-09-26 09:08:03 +0200 | [diff] [blame] | 137 | "nand erase.part root; " \ |
| 138 | "nand write ${ram_addr} root ${filesize}; fi\0" |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 139 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 140 | /* Miscellaneous configurable options */ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 141 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 142 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
| 143 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 144 | /* Physical memory map */ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 145 | #define PHYS_SDRAM (0x80000000) |
Lukasz Majewski | ec477ec | 2019-02-13 22:46:51 +0100 | [diff] [blame] | 146 | #define PHYS_SDRAM_SIZE (CONFIG_PCM052_DDR_SIZE * SZ_1M) |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 147 | |
| 148 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 149 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 150 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 151 | |
| 152 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 153 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 154 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 155 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 156 | |
Masahiro Yamada | 8cea9b5 | 2017-02-11 22:43:54 +0900 | [diff] [blame] | 157 | /* environment organization */ |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 158 | |
Albert ARIBAUD \(3ADEV\) | 26ffbef | 2015-09-21 22:43:39 +0200 | [diff] [blame] | 159 | #endif |