[PATCH v3 00/19] am335x, guardian: update board specific changes

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
address the v2 review comments
Hi Gireesh,
On 22/04/21 7:01 pm, Gireesh.Hiremath@in.bosch.com wrote:
From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
add support for updated TI clock driver, backlight, splash screen, swi logic, add ubi fastmap support, update pinmux, code clean up
address the v1 review comments like: split board changes and defconfig changes into separate patches, adding clock support
Overall looks good. Just minor comments:
- For config file changes can you make $subject as configs: am335x_guardian: ...
- Can you rebase on top of latest master?
Thanks and regards, Lokesh
Hi Lokesh,
config file subject changed to configs: am335x_guardian:... rebased to latest master branch
Thanks and regards, Gireesh Hiremath
Gireesh Hiremath (16): configs: am335x_guardian: Enable clock driver configs: am335x_guardian: add ubi fastmap support configs: am335x_guardian: add memtest configs am335x, guardian: add memtest address range am335x, guardian: set environment variable autoload to no am335x, guardian: code cleanup and boot optimization configs: am335x_guardian: set boot delay configs: am335x_guardian: disable spl command am335x, guardian: update swi logic am335x, guardian: Enable backlight configs: am335x_guardian: Enable display config drivers: video: hx8238 fix build bug am335x, guardian: Enable panel driver Himax HX8238D am335x, guardian: software update available status is stored in AM3352 RTC scracth register configs: am335x_guardian: Enable bootcount nvmem support configs: am335x_guardian: add register maps support
Moses Christopher (3): am335x, guardian: mem: Add board dependent mem values am335x, guardian: set tftp_load_addr in environment am335x, guardian: Update pinmux configuration
arch/arm/dts/am335x-guardian-u-boot.dtsi | 11 ++ arch/arm/dts/am335x-guardian.dts | 14 +- .../include/asm/arch-am33xx/mem-guardian.h | 63 ++++++++ arch/arm/mach-omap2/am33xx/Kconfig | 2 + arch/arm/mach-omap2/am33xx/board.c | 4 + arch/arm/mach-omap2/mem-common.c | 4 + board/bosch/guardian/board.c | 151 +++++++++++++++--- board/bosch/guardian/mux.c | 3 +- configs/am335x_guardian_defconfig | 28 +++- drivers/bootcount/Kconfig | 27 +++- drivers/bootcount/Makefile | 1 + drivers/bootcount/bootcount_nvmem.c | 57 +++++++ drivers/video/Makefile | 2 +- drivers/video/hx8238d.c | 4 +- include/configs/am335x_guardian.h | 21 ++- 15 files changed, 350 insertions(+), 42 deletions(-) create mode 100644 arch/arm/include/asm/arch-am33xx/mem-guardian.h create mode 100644 drivers/bootcount/bootcount_nvmem.c

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
Enable TI clock driver support for guardian board
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index d412311cec..791bbba26e 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -69,6 +69,13 @@ CONFIG_VERSION_VARIABLE=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_CLK=y +CONFIG_CLK_CCF=y +CONFIG_CLK_TI_AM3_DPLL=y +CONFIG_CLK_TI_CTRL=y +CONFIG_CLK_TI_DIVIDER=y +CONFIG_CLK_TI_GATE=y +CONFIG_CLK_TI_MUX=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y

From: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com
- Add mem-guardian.h derived from am33xx/mem.h
* Add GPMC config values optimized for Bosch Guardian Board * NAND Chip used by Bosch Guardian Board is Micron MT29F4G08ABBFA
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- .../include/asm/arch-am33xx/mem-guardian.h | 63 +++++++++++++++++++ arch/arm/mach-omap2/am33xx/board.c | 4 ++ arch/arm/mach-omap2/mem-common.c | 4 ++ board/bosch/guardian/board.c | 2 +- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-am33xx/mem-guardian.h
diff --git a/arch/arm/include/asm/arch-am33xx/mem-guardian.h b/arch/arm/include/asm/arch-am33xx/mem-guardian.h new file mode 100644 index 0000000000..e864a0fd36 --- /dev/null +++ b/arch/arm/include/asm/arch-am33xx/mem-guardian.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2006-2008 + * Texas Instruments, <www.ti.com> + * + * (C) Copyright 2020 + * Robert Bosch Power Tools GmbH + * + * Author + * Moses Christopher BollavarapuMoses.Christopher@in.bosch.com + * + * Copied from: + * arch/arm/include/asm/arch-am33xx/mem.h + * + * Initial Code from: + * Mansoor Ahamed mansoor.ahamed@ti.com + * Richard Woodruff r-woodruff2@ti.com + */ + +#ifndef _MEM_GUARDIAN_H_ +#define _MEM_GUARDIAN_H_ + +/* + * GPMC settings - + * Definitions is as per the following format + * #define <PART>_GPMC_CONFIG<x> <value> + * Where: + * PART is the part name e.g. M_NAND - Micron Nand Flash + * x is GPMC config registers from 1 to 7 (there will be 7 macros) + * Value is corresponding value + * + * For every valid PRCM configuration there should be only one definition of + * the same. + * + * The following values are optimized for improving the NAND Read speed + * They are applicable and tested for Bosch Guardian Board. + * Read Speeds rose from 1.5MiBs to over 7.6MiBs + * + * Currently valid part Names are (PART): + * M_NAND - Micron NAND + */ +#define GPMC_SIZE_256M 0x0 +#define GPMC_SIZE_128M 0x8 +#define GPMC_SIZE_64M 0xC +#define GPMC_SIZE_32M 0xE +#define GPMC_SIZE_16M 0xF + +#define M_NAND_GPMC_CONFIG1 0x00000800 +#define M_NAND_GPMC_CONFIG2 0x00030300 +#define M_NAND_GPMC_CONFIG3 0x00030300 +#define M_NAND_GPMC_CONFIG4 0x02000201 +#define M_NAND_GPMC_CONFIG5 0x00030303 +#define M_NAND_GPMC_CONFIG6 0x000000C0 +#define M_NAND_GPMC_CONFIG7 0x00000008 + +/* max number of GPMC Chip Selects */ +#define GPMC_MAX_CS 8 +/* max number of GPMC regs */ +#define GPMC_MAX_REG 7 + +#define DBG_MPDB 6 + +#endif /* endif _MEM_GUARDIAN_H_ */ diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c index 62178f1e70..4bf0535e3c 100644 --- a/arch/arm/mach-omap2/am33xx/board.c +++ b/arch/arm/mach-omap2/am33xx/board.c @@ -23,7 +23,11 @@ #include <asm/arch/clock.h> #include <asm/arch/gpio.h> #include <asm/arch/i2c.h> +#if IS_ENABLED(CONFIG_TARGET_AM335X_GUARDIAN) +#include <asm/arch/mem-guardian.h> +#else #include <asm/arch/mem.h> +#endif #include <asm/arch/mmc_host_def.h> #include <asm/arch/sys_proto.h> #include <asm/global_data.h> diff --git a/arch/arm/mach-omap2/mem-common.c b/arch/arm/mach-omap2/mem-common.c index 50d5f3e9eb..2dcf0cf9c3 100644 --- a/arch/arm/mach-omap2/mem-common.c +++ b/arch/arm/mach-omap2/mem-common.c @@ -15,7 +15,11 @@ #include <common.h> #include <asm/io.h> #include <asm/arch/cpu.h> +#if IS_ENABLED(CONFIG_TARGET_AM335X_GUARDIAN) +#include <asm/arch/mem-guardian.h> +#else #include <asm/arch/mem.h> +#endif #include <asm/arch/sys_proto.h> #include <command.h> #include <linux/mtd/omap_gpmc.h> diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 113838f8b7..9429454a74 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -29,7 +29,7 @@ #include <asm/arch/ddr_defs.h> #include <asm/arch/gpio.h> #include <asm/arch/hardware.h> -#include <asm/arch/mem.h> +#include <asm/arch/mem-guardian.h> #include <asm/arch/mmc_host_def.h> #include <asm/arch/omap.h> #include <asm/arch/sys_proto.h>

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- Trigger fastmap automatically
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 791bbba26e..a96cdf734c 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -87,6 +87,7 @@ CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y CONFIG_SYS_NAND_U_BOOT_OFFS=0x100000 CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND=0x200000 CONFIG_MTD_UBI_FASTMAP=y +CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT=1 CONFIG_PHYLIB=y CONFIG_DM_ETH=y CONFIG_PHY=y

From: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com
Set tftp_load_addr to 0x82000000 in MEM_LAYOUT_ENV_SETTINGS
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- include/configs/am335x_guardian.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index c34c07a493..fe36e34c7d 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -29,6 +29,7 @@ #define MEM_LAYOUT_ENV_SETTINGS \ "scriptaddr=0x80000000\0" \ "pxefile_addr_r=0x80100000\0" \ + "tftp_load_addr=0x82000000\0" \ "kernel_addr_r=0x82000000\0" \ "fdt_addr_r=0x88000000\0" \ "ramdisk_addr_r=0x88080000\0" \

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- Add mtest, meminfo commands
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index a96cdf734c..2ae7507eff 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -43,6 +43,8 @@ CONFIG_CMD_SPL=y CONFIG_CMD_SPL_NAND_OFS=0x0 CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEMTEST=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- Add default mem start address as 0x80000000 - Add defauly mem end address as 0x81000000 - Implies default test runs for first 16MiB of DRAM
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- include/configs/am335x_guardian.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index fe36e34c7d..acf4d4ab65 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -22,6 +22,10 @@ #define V_OSCK 24000000 /* Clock output from T2 */ #define V_SCLK (V_OSCK)
+/* mem test config for first 16MiB */ +#define CONFIG_SYS_MEMTEST_START 0x80000000 +#define CONFIG_SYS_MEMTEST_END 0x81000000 + #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
#ifndef CONFIG_SPL_BUILD

From: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com
pinmux update for guardian board - control ASP Board Power: GPIO, on/off ASP Board Power - control Coincell Voltage Measurement: GPIO, enable/disable ADC measurements - powerOff Device GPIO-PowerOff, cut the PMIC supply
Signed-off-by: Moses Christopher BollavarapuMoses.Christopher@in.bosch.com --- arch/arm/dts/am335x-guardian.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts index 7e70a96d25..207246b4e0 100644 --- a/arch/arm/dts/am335x-guardian.dts +++ b/arch/arm/dts/am335x-guardian.dts @@ -401,12 +401,12 @@
guardian_interface_pins: pinmux_guardian_interface_pins { pinctrl-single,pins = < - AM33XX_IOPAD(0x928, PIN_OUTPUT | MUX_MODE7) - AM33XX_IOPAD(0x990, PIN_OUTPUT | MUX_MODE7) + AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLUP | MUX_MODE7) AM33XX_IOPAD(0x9ac, PIN_OUTPUT_PULLDOWN | MUX_MODE7) + AM33XX_IOPAD(0x914, PIN_OUTPUT_PULLDOWN | MUX_MODE7) AM33XX_IOPAD(0x980, PIN_INPUT | MUX_MODE7) AM33XX_IOPAD(0x984, PIN_INPUT | MUX_MODE7) - AM33XX_IOPAD(0x928, PIN_OUTPUT_PULLUP | MUX_MODE7) + AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE7) AM33XX_IOPAD(0x90c, PIN_OUTPUT_PULLDOWN | MUX_MODE7) AM33XX_IOPAD(0x944, PIN_OUTPUT_PULLDOWN | MUX_MODE7) AM33XX_IOPAD(0x91c, PIN_INPUT | MUX_MODE7)

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
autoload: if set to "no" then rarpb, bootp or dhcp commands will just perform a configuration lookup from the BOOTP / DHCP server, but not try to load any image using TFTP
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- include/configs/am335x_guardian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index acf4d4ab65..fa6e02d09b 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -62,9 +62,9 @@ MEM_LAYOUT_ENV_SETTINGS \ BOOTENV \ GUARDIAN_DEFAULT_PROD_ENV \ + "autoload=no\0" \ "bootubivol=rootfs\0" \ "distro_bootcmd=" \ - "setenv autoload no; " \ "setenv rootflags "bulk_read,chk_data_crc"; " \ "setenv ethact usb_ether; " \ "if test "${swi_status}" -eq 1; then " \

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- remove redundant headers and boot modes from board file
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- board/bosch/guardian/board.c | 21 --------------------- 1 file changed, 21 deletions(-)
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 9429454a74..12d047b74b 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -9,19 +9,14 @@ */
#include <common.h> -#include <cpsw.h> #include <dm.h> -#include <env.h> #include <env_internal.h> #include <errno.h> #include <i2c.h> -#include <init.h> #include <led.h> -#include <miiphy.h> #include <panel.h> #include <asm/global_data.h> #include <power/tps65217.h> -#include <power/tps65910.h> #include <spl.h> #include <watchdog.h> #include <asm/arch/clock.h> @@ -193,27 +188,11 @@ int board_init(void) #ifdef CONFIG_BOARD_LATE_INIT static void set_bootmode_env(void) { - char *boot_device_name = NULL; char *boot_mode_gpio = "gpio@44e07000_14"; int ret; - int value;
struct gpio_desc boot_mode_desc;
- switch (gd->arch.omap_boot_device) { - case BOOT_DEVICE_NAND: - boot_device_name = "nand"; - break; - case BOOT_DEVICE_USBETH: - boot_device_name = "usbeth"; - break; - default: - break; - } - - if (boot_device_name) - env_set("boot_device", boot_device_name); - ret = dm_gpio_lookup_name(boot_mode_gpio, &boot_mode_desc); if (ret) { printf("%s is not found\n", boot_mode_gpio);

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- set boot delay to zero, to increase boot speed
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 2ae7507eff..e47c6aad74 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -17,6 +17,7 @@ CONFIG_ENV_OFFSET_REDUND=0x540000 CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian" CONFIG_DISTRO_DEFAULTS=y +CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_DELAY_STR="d"

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- disable support for spl command
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index e47c6aad74..4620c2b6aa 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -40,7 +40,7 @@ CONFIG_SPL_NET_VCI_STRING="Guardian U-Boot SPL" CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_USB_GADGET=y CONFIG_SPL_USB_ETHER=y -CONFIG_CMD_SPL=y +# CONFIG_CMD_SPL is not set CONFIG_CMD_SPL_NAND_OFS=0x0 CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
read boot mode gpio and set the swi status
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- board/bosch/guardian/board.c | 15 +++++++++++++-- include/configs/am335x_guardian.h | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 12d047b74b..8704806047 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -205,8 +205,19 @@ static void set_bootmode_env(void) goto err; }
- value = dm_gpio_get_value(&boot_mode_desc); - value ? env_set("swi_status", "0") : env_set("swi_status", "1"); + dm_gpio_set_dir_flags(&boot_mode_desc, GPIOD_IS_IN); + udelay(10); + + ret = dm_gpio_get_value(&boot_mode_desc); + if (ret == 0) { + env_set("swi_status", "1"); + } else if (ret == 1) { + env_set("swi_status", "0"); + } else { + printf("swi status gpio error\n"); + goto err; + } + return;
err: diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index fa6e02d09b..b966df08c6 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -68,13 +68,13 @@ "setenv rootflags "bulk_read,chk_data_crc"; " \ "setenv ethact usb_ether; " \ "if test "${swi_status}" -eq 1; then " \ - "setenv extrabootargs "swi_attached"; " \ "if dhcp; then " \ "sleep 1; " \ "if tftp "${tftp_load_addr}" "bootscript.scr"; then " \ "source "${tftp_load_addr}"; " \ "fi; " \ "fi; " \ + "setenv extrabootargs $extrabootargs "swi_attached"; " \ "fi;" \ "run bootcmd_ubifs0;\0" \ "altbootcmd=" \

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
Enable backlight, set brightness value and dimming frequency
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- board/bosch/guardian/board.c | 26 ++++++++++++++++++++++++++ include/configs/am335x_guardian.h | 1 + 2 files changed, 27 insertions(+)
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 8704806047..6e6221ca60 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -224,12 +224,38 @@ err: env_set("swi_status", "err"); }
+void lcdbacklight_en(void) +{ + unsigned long brightness = env_get_ulong("backlight_brightness", 10, 50); + + if (brightness > 99 || brightness == 0) + brightness = 99; + + /* + * Brightness range: + * WLEDCTRL2 DUTY[6:0] + * + * 000 0000b = 1% + * 000 0001b = 2% + * ... + * 110 0010b = 99% + * 110 0011b = 100% + * + */ + + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL2, + brightness, 0xFF); + tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_WLEDCTRL1, + brightness != 0 ? 0x0A : 0x02, 0xFF); +} + int board_late_init(void) { #ifdef CONFIG_LED_GPIO led_default_state(); #endif set_bootmode_env(); + lcdbacklight_en(); return 0; } #endif /* CONFIG_BOARD_LATE_INIT */ diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index b966df08c6..08a9ac950c 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -63,6 +63,7 @@ BOOTENV \ GUARDIAN_DEFAULT_PROD_ENV \ "autoload=no\0" \ + "backlight_brightness=50\0" \ "bootubivol=rootfs\0" \ "distro_bootcmd=" \ "setenv rootflags "bulk_read,chk_data_crc"; " \

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
-Enable configuration for display driver -Disable support for SPL GPIO, CMD LED & SPL GPIO
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 4620c2b6aa..6056b78991 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -1,7 +1,7 @@ CONFIG_ARM=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_OMAP2PLUS=y -CONFIG_SPL_GPIO_SUPPORT=y +# CONFIG_SPL_GPIO_SUPPORT is not set CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_ENV_SIZE=0x40000 @@ -53,8 +53,7 @@ CONFIG_CMD_MTD=y CONFIG_CMD_NAND=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set -CONFIG_BOOTP_DNS2=y -# CONFIG_CMD_LED is not set +CONFIG_CMD_BMP=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),1m(u-boot-2),1m(u-boot-2.backup1),256k(u-boot-env),256k(u-boot-env.backup1),256k(splash-screen),-(UBI)" @@ -97,6 +96,9 @@ CONFIG_PHY=y CONFIG_NOP_PHY=y CONFIG_PINCTRL=y CONFIG_PINCTRL_SINGLE=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_OMAP3_SPI=y CONFIG_USB=y CONFIG_DM_USB_GADGET=y CONFIG_SPL_DM_USB_GADGET=y @@ -109,6 +111,11 @@ CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments" CONFIG_USB_GADGET_VENDOR_NUM=0x0451 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022 CONFIG_USB_ETHER=y +CONFIG_DM_VIDEO=y +CONFIG_DM_PANEL_HX8238D=y +CONFIG_VIDEO_BPP16=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_AM335X_LCD=y CONFIG_SPL_WDT=y # CONFIG_SPL_USE_TINY_PRINTF is not set CONFIG_SPL_OF_LIBFDT=y

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
update panel driver hx8238 fix build bug
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- drivers/video/Makefile | 2 +- drivers/video/hx8238d.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 933f06e9d8..1c534a6f9a 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -15,7 +15,7 @@ obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi-host-uclass.o obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o obj-$(CONFIG_DM_VIDEO) += video_bmp.o obj-$(CONFIG_PANEL) += panel-uclass.o -obj-$(CONFIG_PANEL_HX8238D) += hx8238d.o +obj-$(CONFIG_DM_PANEL_HX8238D) += hx8238d.o obj-$(CONFIG_SIMPLE_PANEL) += simple_panel.o endif
diff --git a/drivers/video/hx8238d.c b/drivers/video/hx8238d.c index f7e7753a53..6ee97cb4ff 100644 --- a/drivers/video/hx8238d.c +++ b/drivers/video/hx8238d.c @@ -191,7 +191,7 @@ U_BOOT_DRIVER(hx8238d) = { .name = "hx8238d", .id = UCLASS_PANEL, .of_match = hx8238d_ids, - .ofdata_to_platdata = hx8238d_ofdata_to_platdata, + .of_to_plat = hx8238d_ofdata_to_platdata, .probe = hx8238d_probe, - .priv_auto_alloc_size = sizeof(struct hx8238d_priv), + .priv_auto = sizeof(struct hx8238d_priv), };

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
- Enable lcd controller - Display splash screen
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- arch/arm/dts/am335x-guardian-u-boot.dtsi | 11 +++ arch/arm/dts/am335x-guardian.dts | 8 ++- arch/arm/mach-omap2/am33xx/Kconfig | 2 + board/bosch/guardian/board.c | 87 +++++++++++++++++++++++- board/bosch/guardian/mux.c | 3 +- include/configs/am335x_guardian.h | 11 +++ 6 files changed, 119 insertions(+), 3 deletions(-)
diff --git a/arch/arm/dts/am335x-guardian-u-boot.dtsi b/arch/arm/dts/am335x-guardian-u-boot.dtsi index 986f58e664..a1a7913de8 100644 --- a/arch/arm/dts/am335x-guardian-u-boot.dtsi +++ b/arch/arm/dts/am335x-guardian-u-boot.dtsi @@ -42,6 +42,17 @@ u-boot,dm-pre-reloc; };
+&spi0 { + lcd0: display@0 { + compatible = "himax,hx8238d"; + pinctrl-names = "default"; + pinctrl-0 = <&lcd0_pins>; + reg = <0>; + label = "lcd"; + spi-max-frequency = <100000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts index 207246b4e0..69bee45848 100644 --- a/arch/arm/dts/am335x-guardian.dts +++ b/arch/arm/dts/am335x-guardian.dts @@ -87,7 +87,7 @@ ac-bias = <255>; ac-bias-intrpt = <0>; dma-burst-sz = <16>; - bpp = <24>; + bpp = <16>; bus-width = <16>; fdd = <0x80>; sync-edge = <0>; @@ -247,6 +247,12 @@ &lcdc { blue-and-red-wiring = "crossed"; status = "okay"; + + port { + lcdc_0: endpoint@0 { + remote-endpoint = <0>; + }; + }; };
&mmc1 { diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig index 11e54cd293..65f43944fe 100644 --- a/arch/arm/mach-omap2/am33xx/Kconfig +++ b/arch/arm/mach-omap2/am33xx/Kconfig @@ -95,6 +95,8 @@ config TARGET_AM335X_GUARDIAN select DM_SERIAL select DM_GPIO select DM_USB + select DM_VIDEO + select DM_PANEL_HX8238D
config TARGET_AM335X_SL50 bool "Support am335x_sl50" diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 6e6221ca60..03740c08b9 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -25,12 +25,16 @@ #include <asm/arch/gpio.h> #include <asm/arch/hardware.h> #include <asm/arch/mem-guardian.h> -#include <asm/arch/mmc_host_def.h> #include <asm/arch/omap.h> #include <asm/arch/sys_proto.h> #include <asm/emif.h> #include <asm/gpio.h> #include <asm/io.h> +#include <jffs2/load_kernel.h> +#include <mtd.h> +#include <nand.h> +#include <video.h> +#include <video_console.h> #include "board.h"
DECLARE_GLOBAL_DATA_PTR; @@ -249,13 +253,94 @@ void lcdbacklight_en(void) brightness != 0 ? 0x0A : 0x02, 0xFF); }
+#if IS_ENABLED(CONFIG_AM335X_LCD) +static void splash_screen(void) +{ + struct udevice *video_dev; + struct udevice *console_dev; + struct video_priv *vid_priv; + struct mtd_info *mtd; + size_t len; + int ret; + + struct mtd_device *mtd_dev; + struct part_info *part; + u8 pnum; + + ret = uclass_get_device(UCLASS_VIDEO, 0, &video_dev); + if (ret != 0) { + debug("video device not found\n"); + goto exit; + } + + vid_priv = dev_get_uclass_priv(video_dev); + mtdparts_init(); + + if (find_dev_and_part(SPLASH_SCREEN_NAND_PART, &mtd_dev, &pnum, &part)) { + debug("Could not find nand partition\n"); + goto splash_screen_text; + } + + mtd = get_nand_dev_by_index(mtd_dev->id->num); + if (!mtd) { + debug("MTD partition is not valid\n"); + goto splash_screen_text; + } + + len = SPLASH_SCREEN_BMP_FILE_SIZE; + ret = nand_read_skip_bad(mtd, part->offset, &len, NULL, + SPLASH_SCREEN_BMP_FILE_SIZE, + (u_char *)SPLASH_SCREEN_BMP_LOAD_ADDR); + if (ret != 0) { + debug("Reading NAND partition failed\n"); + goto splash_screen_text; + } + + ret = video_bmp_display(video_dev, SPLASH_SCREEN_BMP_LOAD_ADDR, 0, 0, false); + if (ret != 0) { + debug("No valid bmp image found!!\n"); + goto splash_screen_text; + } else { + goto exit; + } + +splash_screen_text: + vid_priv->colour_fg = CONSOLE_COLOR_RED; + vid_priv->colour_bg = CONSOLE_COLOR_BLACK; + + if (!uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &console_dev)) { + debug("Found console\n"); + vidconsole_position_cursor(console_dev, 17, 7); + vidconsole_put_string(console_dev, SPLASH_SCREEN_TEXT); + } else { + debug("No console device found\n"); + } + +exit: + return; +} +#endif /* CONFIG_AM335X_LCD */ + int board_late_init(void) { + int ret; + struct udevice *cdev; + #ifdef CONFIG_LED_GPIO led_default_state(); #endif set_bootmode_env(); + + ret = uclass_get_device(UCLASS_PANEL, 0, &cdev); + if (ret) { + debug("video panel not found: %d\n", ret); + return ret; + } + lcdbacklight_en(); + if (IS_ENABLED(CONFIG_AM335X_LCD)) + splash_screen(); + return 0; } #endif /* CONFIG_BOARD_LATE_INIT */ diff --git a/board/bosch/guardian/mux.c b/board/bosch/guardian/mux.c index 9c81f29f9f..12c3eb666f 100644 --- a/board/bosch/guardian/mux.c +++ b/board/bosch/guardian/mux.c @@ -28,8 +28,9 @@ static struct module_pin_mux i2c0_pin_mux[] = {
static struct module_pin_mux guardian_interfaces_pin_mux[] = { {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLDOWN_EN)}, + {OFFSET(mii1_txen), (MODE(7) | PULLDOWN_EN)}, {OFFSET(mcasp0_aclkx), (MODE(7) | PULLUP_EN)}, - {OFFSET(mii1_txd0), (MODE(7) | PULLUP_EN)}, + {OFFSET(mdio_clk), (MODE(7) | PULLUP_EN)}, {OFFSET(uart1_rxd), (MODE(7) | RXACTIVE | PULLUDDIS)}, {OFFSET(uart1_txd), (MODE(7) | PULLUDDIS)}, {OFFSET(mii1_crs), (MODE(7) | PULLDOWN_EN)}, diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 08a9ac950c..ef73446466 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -86,6 +86,17 @@
#endif /* ! CONFIG_SPL_BUILD */
+#define CONFIG_BMP_16BPP +#define SPLASH_SCREEN_NAND_PART "nand0,10" +#define SPLASH_SCREEN_BMP_FILE_SIZE 0x26000 +#define SPLASH_SCREEN_BMP_LOAD_ADDR 0x82000000 +#define SPLASH_SCREEN_TEXT "U-Boot" + +/* BGR 16Bit Color Definitions */ +#define CONSOLE_COLOR_BLACK 0x0000 +#define CONSOLE_COLOR_WHITE 0xFFFF +#define CONSOLE_COLOR_RED 0x001F + /* NS16550 Configuration */ #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */ #define CONFIG_SYS_NS16550_COM2 0x48022000 /* UART1 */

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
RTC second scratch register[32-bit]: -zero byte hold boot count value -first byte hold update available state -second byte hold version -third byte hold magic number
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
Gbp-Pq: Topic apertis/guardian Gbp-Pq: Name am335x-guardian-software-update-available-status-is-store.patch --- drivers/bootcount/Kconfig | 27 ++++++++++++-- drivers/bootcount/Makefile | 1 + drivers/bootcount/bootcount_nvmem.c | 57 +++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 drivers/bootcount/bootcount_nvmem.c
diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig index b5ccea0d9c..d543061233 100644 --- a/drivers/bootcount/Kconfig +++ b/drivers/bootcount/Kconfig @@ -42,6 +42,25 @@ config BOOTCOUNT_AM33XX This requires the RTC clocks, etc, to be enabled prior to use and not all boards with this IP block on it will have the RTC in use.
+config BOOTCOUNT_AM33XX_NVMEM + bool "Boot counter in AM33XX RTC IP block with upgrade_available flag" + depends on AM33XX + select SPL_AM33XX_ENABLE_RTC32K_OSC if AM33XX + help + Add support for maintaining bootcount,upgrade_available, + version and BOOTMAGIC in a AM33xx RTC IP block + scratch register2. + + A bootcount driver for the RTC IP block found on many TI platforms. + This requires the RTC clocks, etc, to be enabled prior to use and + not all boards with this IP block on it will have the RTC in use. + + If there is upgrade in software then "upgrade_available" is 1, + "bootcount" is incremented otherwise "upgrade_available" and + "bootcount" is always 0. So the Userspace Application must set + the "upgrade_available" and "bootcount" variable to 0, if a boot + was successfully. + config BOOTCOUNT_ENV bool "Boot counter in environment" help @@ -177,16 +196,18 @@ config SYS_BOOTCOUNT_EXT_NAME
config SYS_BOOTCOUNT_ADDR hex "RAM address used for reading and writing the boot counter" - default 0x44E3E000 if BOOTCOUNT_AM33XX + default 0x44E3E000 if BOOTCOUNT_AM33XX || BOOTCOUNT_AM33XX_NVMEM default 0xE0115FF8 if ARCH_LS1043A || ARCH_LS1021A depends on BOOTCOUNT_AM33XX || BOOTCOUNT_GENERIC || BOOTCOUNT_EXT || \ - BOOTCOUNT_I2C + BOOTCOUNT_I2C || BOOTCOUNT_AM33XX_NVMEM help Set the address used for reading and writing the boot counter.
config SYS_BOOTCOUNT_MAGIC hex "Magic value for the boot counter" - default 0xB001C041 + default 0xB001C041 if BOOTCOUNT_AM33XX + default 0xB0 if BOOTCOUNT_AM33XX_NVMEM + depends on BOOTCOUNT_AM33XX || BOOTCOUNT_AM33XX_NVMEM help Set the magic value used for the boot counter.
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile index 51d860b00e..12658ffdce 100644 --- a/drivers/bootcount/Makefile +++ b/drivers/bootcount/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o obj-$(CONFIG_BOOTCOUNT_ENV) += bootcount_env.o obj-$(CONFIG_BOOTCOUNT_I2C) += bootcount_i2c.o obj-$(CONFIG_BOOTCOUNT_EXT) += bootcount_ext.o +obj-$(CONFIG_BOOTCOUNT_AM33XX_NVMEM) += bootcount_nvmem.o
obj-$(CONFIG_DM_BOOTCOUNT) += bootcount-uclass.o obj-$(CONFIG_DM_BOOTCOUNT_RTC) += rtc.o diff --git a/drivers/bootcount/bootcount_nvmem.c b/drivers/bootcount/bootcount_nvmem.c new file mode 100644 index 0000000000..5f266d5ec8 --- /dev/null +++ b/drivers/bootcount/bootcount_nvmem.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2011 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * (C) Copyright 2018 Robert Bosch Power Tools GmbH. + * + * A bootcount driver for the RTC IP block found on many TI platforms. + * This requires the RTC clocks, etc, to be enabled prior to use and + * not all boards with this IP block on it will have the RTC in use. + */ + +#include <bootcount.h> +#include <asm/davinci_rtc.h> + +#define BC_VERSION 2 + +void bootcount_store(ulong bootcount) +{ + u8 upgrade_available = 0; + ulong val = 0; + struct davinci_rtc *reg = + (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR; + + val = raw_bootcount_load(®->scratch2); + upgrade_available = (val >> 8) & 0x000000ff; + + /* Only update bootcount during upgrade process */ + if (!upgrade_available) + bootcount = 0; + + val = (bootcount & 0x000000ff) | + (upgrade_available << 8) | + (BC_VERSION << 16) | + (CONFIG_SYS_BOOTCOUNT_MAGIC << 24); + + /* + * write RTC kick registers to enable write + * for RTC Scratch registers. Scratch register 2 is + * used for bootcount value. + */ + writel(RTC_KICK0R_WE, ®->kick0r); + writel(RTC_KICK1R_WE, ®->kick1r); + raw_bootcount_store(®->scratch2, val); +} + +ulong bootcount_load(void) +{ + unsigned long val = 0; + struct davinci_rtc *reg = + (struct davinci_rtc *)CONFIG_SYS_BOOTCOUNT_ADDR; + + val = raw_bootcount_load(®->scratch2); + if ((val >> 24) != CONFIG_SYS_BOOTCOUNT_MAGIC) + return 0; + else + return val & 0x000000ff; +}

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
include bootcount nvmem support
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 6056b78991..65a3c23e9c 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -71,6 +71,7 @@ CONFIG_VERSION_VARIABLE=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_BOOTCOUNT_AM33XX_NVMEM=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_TI_AM3_DPLL=y

From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
add support to direct memory access of hardware peripherals registers
Signed-off-by: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com --- configs/am335x_guardian_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig index 65a3c23e9c..3e291b32e2 100644 --- a/configs/am335x_guardian_defconfig +++ b/configs/am335x_guardian_defconfig @@ -70,6 +70,7 @@ CONFIG_SPL_ENV_IS_NOWHERE=y CONFIG_VERSION_VARIABLE=y CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_SPL_DM=y +CONFIG_REGMAP=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_AM33XX_NVMEM=y CONFIG_CLK=y

On 28/05/21 3:00 pm, Gireesh.Hiremath@in.bosch.com wrote:
From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
address the v2 review comments
Hi Gireesh,
On 22/04/21 7:01 pm, Gireesh.Hiremath@in.bosch.com wrote:
From: Gireesh Hiremath Gireesh.Hiremath@in.bosch.com
add support for updated TI clock driver, backlight, splash screen, swi logic, add ubi fastmap support, update pinmux, code clean up
address the v1 review comments like: split board changes and defconfig changes into separate patches, adding clock support
There are some build errors with this series, can you take a look?: https://source.denx.de/u-boot/custodians/u-boot-ti/-/jobs/275470
Thanks and regards, Lokesh
Overall looks good. Just minor comments:
- For config file changes can you make $subject as configs: am335x_guardian: ...
- Can you rebase on top of latest master?
Thanks and regards, Lokesh
Hi Lokesh,
config file subject changed to configs: am335x_guardian:... rebased to latest master branch
Thanks and regards, Gireesh Hiremath
Gireesh Hiremath (16): configs: am335x_guardian: Enable clock driver configs: am335x_guardian: add ubi fastmap support configs: am335x_guardian: add memtest configs am335x, guardian: add memtest address range am335x, guardian: set environment variable autoload to no am335x, guardian: code cleanup and boot optimization configs: am335x_guardian: set boot delay configs: am335x_guardian: disable spl command am335x, guardian: update swi logic am335x, guardian: Enable backlight configs: am335x_guardian: Enable display config drivers: video: hx8238 fix build bug am335x, guardian: Enable panel driver Himax HX8238D am335x, guardian: software update available status is stored in AM3352 RTC scracth register configs: am335x_guardian: Enable bootcount nvmem support configs: am335x_guardian: add register maps support
Moses Christopher (3): am335x, guardian: mem: Add board dependent mem values am335x, guardian: set tftp_load_addr in environment am335x, guardian: Update pinmux configuration
arch/arm/dts/am335x-guardian-u-boot.dtsi | 11 ++ arch/arm/dts/am335x-guardian.dts | 14 +- .../include/asm/arch-am33xx/mem-guardian.h | 63 ++++++++ arch/arm/mach-omap2/am33xx/Kconfig | 2 + arch/arm/mach-omap2/am33xx/board.c | 4 + arch/arm/mach-omap2/mem-common.c | 4 + board/bosch/guardian/board.c | 151 +++++++++++++++--- board/bosch/guardian/mux.c | 3 +- configs/am335x_guardian_defconfig | 28 +++- drivers/bootcount/Kconfig | 27 +++- drivers/bootcount/Makefile | 1 + drivers/bootcount/bootcount_nvmem.c | 57 +++++++ drivers/video/Makefile | 2 +- drivers/video/hx8238d.c | 4 +- include/configs/am335x_guardian.h | 21 ++- 15 files changed, 350 insertions(+), 42 deletions(-) create mode 100644 arch/arm/include/asm/arch-am33xx/mem-guardian.h create mode 100644 drivers/bootcount/bootcount_nvmem.c
participants (2)
-
Gireesh.Hiremath@in.bosch.com
-
Lokesh Vutla