ARM: keystone: Pass SPI MTD partition table via kernel command line
authorVignesh R <vigneshr@ti.com>
Wed, 8 Mar 2017 08:28:17 +0000 (13:58 +0530)
committerTom Rini <trini@konsulko.com>
Sat, 8 Apr 2017 13:26:47 +0000 (09:26 -0400)
SPI U-Boot image for K2 boards have now exceeded 512K partition
allocated to it and no longer fit the partitions defined in kernel DTS
file. Therefore, pass an updated MTD partition table from U-Boot as
kernel command line arguments to avoid kernel from accidentally
modifying boot loader image that has overflowed to next user partition.

To do is, introduce a common environment file for declaring SPI
partition so that each individual boards need not repeat the same.
Choose appropriate SPI bus from board config file and pass it as command
line argument to kernel.

Signed-off-by: Vignesh R <vigneshr@ti.com>
include/configs/k2e_evm.h
include/configs/k2g_evm.h
include/configs/k2hk_evm.h
include/configs/k2l_evm.h
include/configs/ti_armv7_keystone2.h
include/environment/ti/spi.h [new file with mode: 0644]

index 777f22540afb915a8e56e7dc05d3611fe2d8fb54..3a7993e8290c9135b73167064490a6e4073ad3c5 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_K2E_EVM_H
 #define __CONFIG_K2E_EVM_H
 
+#include <environment/ti/spi.h>
+
 /* Platform type */
 #define CONFIG_SOC_K2E
 
@@ -30,6 +32,9 @@
 /* SPL SPI Loader Configuration */
 #define CONFIG_SPL_TEXT_BASE           0x0c100000
 
+
+#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
+
 /* NAND Configuration */
 #define CONFIG_SYS_NAND_PAGE_2K
 
index bd252312a20b146748a7bc86469038223a927819..9e5949e3706b5eeab55202311879491703202551 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_K2G_EVM_H
 #define __CONFIG_K2G_EVM_H
 
+#include <environment/ti/spi.h>
+
 /* Platform type */
 #define CONFIG_SOC_K2G
 
@@ -76,4 +78,5 @@
 #define CONFIG_BOUNCE_BUFFER
 #endif
 
+#define SPI_MTD_PARTS  KEYSTONE_SPI1_MTD_PARTS
 #endif /* __CONFIG_K2G_EVM_H */
index 4adb119b3066c3ec814ca2f617422d868b3b126f..202167bdef790e0fc1808a40f0e3aca68bc09c82 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_K2HK_EVM_H
 #define __CONFIG_K2HK_EVM_H
 
+#include <environment/ti/spi.h>
+
 /* Platform type */
 #define CONFIG_SOC_K2HK
 
@@ -30,6 +32,8 @@
 /* SPL SPI Loader Configuration */
 #define CONFIG_SPL_TEXT_BASE           0x0c200000
 
+#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
+
 /* NAND Configuration */
 #define CONFIG_SYS_NAND_PAGE_2K
 
index 9bdd56570be7cc2246695373151a29e7709960fe..a7ccdd117cd2c17e2175bd7eeba89671dae7d893 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_K2L_EVM_H
 #define __CONFIG_K2L_EVM_H
 
+#include <environment/ti/spi.h>
+
 /* Platform type */
 #define CONFIG_SOC_K2L
 
@@ -30,6 +32,8 @@
 /* SPL SPI Loader Configuration */
 #define CONFIG_SPL_TEXT_BASE           0x0c100000
 
+#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
+
 /* NAND Configuration */
 #define CONFIG_SYS_NAND_PAGE_4K
 
index c83cd76b867511292969b9e6ece78be748154e19..5d2a7ab509e320e9f0e6495dd3314abd3be27975 100644 (file)
 /* EDMA3 */
 #define CONFIG_TI_EDMA3
 
+#define KERNEL_MTD_PARTS                                               \
+       "mtdparts="                                                     \
+       SPI_MTD_PARTS
+
 #define DEFAULT_FW_INITRAMFS_BOOT_ENV                                  \
        "name_fw_rd=k2-fw-initrd.cpio.gz\0"                             \
        "set_rd_spec=setenv rd_spec ${rdaddr}:${filesize}\0"            \
                "sf write ${loadaddr} 0 ${filesize}\0"          \
        "burn_uboot_nand=nand erase 0 0x100000; "                       \
                "nand write ${loadaddr} 0 ${filesize}\0"                \
-       "args_all=setenv bootargs console=ttyS0,115200n8 rootwait=1\0"  \
+       "args_all=setenv bootargs console=ttyS0,115200n8 rootwait=1 "   \
+               KERNEL_MTD_PARTS                                        \
        "args_net=setenv bootargs ${bootargs} rootfstype=nfs "          \
                "root=/dev/nfs rw nfsroot=${serverip}:${nfs_root},"     \
                "${nfs_options} ip=dhcp\0"                              \
diff --git a/include/environment/ti/spi.h b/include/environment/ti/spi.h
new file mode 100644 (file)
index 0000000..18c857c
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for SPI on TI boards.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __TI_SPI_H
+#define __TI_SPI_H
+
+#define KEYSTONE_SPI0_MTD_PARTS "spi0.0:1m(u-boot-spl)ro,-(misc);\0"
+#define KEYSTONE_SPI1_MTD_PARTS "spi1.0:1m(u-boot-spl)ro,-(misc);\0"
+
+#endif