[PATCH] am335x, guardian: update the maintainer list

2020-09-07 Thread Moses Christopher
I am leaving Bosch, so replacing myself with Gireesh

Signed-off-by: Moses Christopher 
---
 board/bosch/guardian/MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/bosch/guardian/MAINTAINERS b/board/bosch/guardian/MAINTAINERS
index 2f674d7f83..fd216a96ca 100644
--- a/board/bosch/guardian/MAINTAINERS
+++ b/board/bosch/guardian/MAINTAINERS
@@ -1,7 +1,7 @@
 Guardian BOARD
 M: Sjoerd Simons 
 M: Govindaraji Sivanantham 
-M: Moses Christopher Bollavarapu 

+M: Hiremath Gireesh 
 S: Maintained
 F: board/bosch/guardian/
 F: include/configs/am335x_guardian.h
-- 
2.20.1



[PATCH] drivers: video: Add Support for Himax HX8238D Panel

2020-04-29 Thread Moses Christopher
* SPI based initialization for HX8238D
* Resolution: 320x240
* Available Color-Modes:  RGB/BGR

Example for DT-Binding in *-u-boot.dtsi

&spi0 {
lcd0: display@0 {
compatible = "himax,hx8238d";
pinctrl-names = "default";
pinctrl-0 = <&lcd0_pins>;
reg = <0>;
label = "lcd";
spi-max-frequency = <10>;
};
};

* Derived from the work done by Sjoerd Simons
  https://gitlab.apertis.org/packaging/u-boot/-/blob\
  /5f259720e3e64965d50da89a841ad6eb256a47df/debian/patches\
  /apertis/powertools/0005-video-Add-Himax-HX8238-D-driver.patch

* Tested on Bosch Guardian Board

Cc: Sjoerd Simons 
Signed-off-by: Moses Christopher 
---
 drivers/video/Kconfig   |  10 ++
 drivers/video/Makefile  |   1 +
 drivers/video/hx8238d.c | 196 
 3 files changed, 207 insertions(+)
 create mode 100644 drivers/video/hx8238d.c

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7c5012a67f..90b2fb0ec2 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -113,6 +113,16 @@ config CONSOLE_TRUETYPE
  With this option you can adjust the text size and use a variety of
  fonts. Note that this is noticeably slower than with normal console.
 
+config DM_PANEL_HX8238D
+bool "Enable Himax HX-8238D LCD driver"
+depends on DM_VIDEO
+help
+  Support for HX-8238D LCD Panel Initialization using SPI.
+  The HX8238-D is a single chip controller and driver LSI that
+  integrates the power circuit.
+  It can drive a maximum 960x240 dot graphics on a-TFT panel
+  displays in 16M colors with dithering.
+
 config CONSOLE_TRUETYPE_SIZE
int "TrueType font size"
depends on CONSOLE_TRUETYPE
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index df7119d62a..2b5f2c9cbc 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_DISPLAY) += display-uclass.o
 obj-$(CONFIG_DM_VIDEO) += backlight-uclass.o
 obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi-host-uclass.o
 obj-$(CONFIG_DM_VIDEO) += panel-uclass.o simple_panel.o
+obj-$(CONFIG_DM_PANEL_HX8238D) += hx8238d.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video_bmp.o
 endif
diff --git a/drivers/video/hx8238d.c b/drivers/video/hx8238d.c
new file mode 100644
index 00..9197826360
--- /dev/null
+++ b/drivers/video/hx8238d.c
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copied from simple-panel
+ * Copyright (c) 2016 Google, Inc
+ * Written by Simon Glass 
+ * Copyright (c) 2018 Sjoerd Simons 
+ * Modified by Moses Christopher 
+ *
+ * Panel Initialization for HX8238D panel from Himax
+ * Resolution: 320x240
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Register Address */
+#define HX8238D_OUTPUT_CTRL_ADDR0x01
+#define HX8238D_LCD_AC_CTRL_ADDR0x02
+#define HX8238D_POWER_CTRL_1_ADDR   0x03
+#define HX8238D_DATA_CLR_CTRL_ADDR  0X04
+#define HX8238D_FUNCTION_CTRL_ADDR  0x05
+#define HX8238D_LED_CTRL_ADDR   0x08
+#define HX8238D_CONT_BRIGHT_CTRL_ADDR   0x0A
+#define HX8238D_FRAME_CYCLE_CTRL_ADDR   0x0B
+#define HX8238D_POWER_CTRL_2_ADDR   0x0D
+#define HX8238D_POWER_CTRL_3_ADDR   0x0E
+#define HX8238D_GATE_SCAN_POS_ADDR  0x0F
+#define HX8238D_HORIZONTAL_PORCH_ADDR   0x16
+#define HX8238D_VERTICAL_PORCH_ADDR 0x17
+#define HX8238D_POWER_CTRL_4_ADDR   0x1E
+#define HX8238D_GAMMA_CTRL_1_ADDR   0x30
+#define HX8238D_GAMMA_CTRL_2_ADDR   0x31
+#define HX8238D_GAMMA_CTRL_3_ADDR   0x32
+#define HX8238D_GAMMA_CTRL_4_ADDR   0x33
+#define HX8238D_GAMMA_CTRL_5_ADDR   0x34
+#define HX8238D_GAMMA_CTRL_6_ADDR   0x35
+#define HX8238D_GAMMA_CTRL_7_ADDR   0x36
+#define HX8238D_GAMMA_CTRL_8_ADDR   0x37
+#define HX8238D_GAMMA_CTRL_9_ADDR   0x3A
+#define HX8238D_GAMMA_CTRL_10_ADDR  0x3B
+
+/* Register Data */
+#define HX8238D_OUTPUT_CTRL 0x6300
+#define HX8238D_LCD_AC_CTRL 0x0200
+#define HX8238D_POWER_CTRL_10x6564
+#define HX8238D_DATA_CLR_CTRL   0x04C7
+#define HX8238D_FUNCTION_CTRL   0xA884
+#define HX8238D_LED_CTRL0x00CE
+#define HX8238D_CONT_BRIGHT_CTRL0x4008
+#define HX8238D_FRAME_CYCLE_CTRL0xD400
+#define HX8238D_POWER_CTRL_20x3229
+#define HX8238D_POWER_CTRL_30x1200
+#define HX8238D_GATE_SCAN_POS   0x
+#define HX8238D_HORIZONTAL_PORCH0x9F80
+#define HX8238D_VERTICAL_PORCH  0x3F02
+#define HX8238D_POWER_CTRL_40x005C
+
+/* Gamma Control */
+#define HX8238D_GAMMA_CTRL_10x0103
+#define HX8238D_GAMMA_CTRL_20x0407
+#define HX8238D_GAMMA_CTRL_30x0705
+

[PATCH 5/5] am335x, guardian: update boot mechanism

2020-03-25 Thread Moses Christopher
  - Add a boot logic in the distro boot command
  - Add fallback mechanism in alternate boot command
  - Keep single boot target -> ubifs0

Signed-off-by: Moses Christopher 
---
 include/configs/am335x_guardian.h | 24 +++-
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/include/configs/am335x_guardian.h 
b/include/configs/am335x_guardian.h
index 1ac5e2e240..c34c07a493 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -34,9 +34,7 @@
"ramdisk_addr_r=0x8808\0" \
 
 #define BOOT_TARGET_DEVICES(func) \
-   func(UBIFS, ubifs, 0) \
-   func(PXE, pxe, na) \
-   func(DHCP, dhcp, na)
+   func(UBIFS, ubifs, 0)
 
 #define AM335XX_BOARD_FDTFILE "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"
 
@@ -60,9 +58,25 @@
BOOTENV \
GUARDIAN_DEFAULT_PROD_ENV \
"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 " \
+ "setenv extrabootargs \"swi_attached\"; " \
+ "if dhcp; then " \
+   "sleep 1; " \
+   "if tftp \"${tftp_load_addr}\" \"bootscript.scr\"; then " \
+ "source \"${tftp_load_addr}\"; " \
+   "fi; " \
+ "fi; " \
+   "fi;" \
+   "run bootcmd_ubifs0;\0" \
"altbootcmd=" \
-   "setenv boot_config \"extlinux-rollback.conf\"; " \
-   "run distro_bootcmd\0"
+   "setenv boot_syslinux_conf \"extlinux/extlinux-rollback.conf\"; 
" \
+   "run distro_bootcmd; " \
+   "setenv boot_syslinux_conf \"extlinux/extlinux.conf\"; " \
+   "run bootcmd_ubifs0;\0"
 
 #endif /* ! CONFIG_SPL_BUILD */
 
-- 
2.20.1



[PATCH 4/5] am335x, guardian: load env from NAND

2020-03-25 Thread Moses Christopher
  - As there is a requirement to store certain data, we need a persistent
storage in u-boot. Hence, we need to save env in NAND

  - Add default Guardian environment variables

  - Update partition table:
- Reserve some space for experimentation, this ensures proper
  backwards compatibility

  - Update defconfig accordingly

Signed-off-by: Moses Christopher 
---
 arch/arm/dts/am335x-guardian.dts  | 27 ++-
 configs/am335x_guardian_defconfig |  9 +++--
 include/configs/am335x_guardian.h | 13 +
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts
index b554be97a3..7e70a96d25 100644
--- a/arch/arm/dts/am335x-guardian.dts
+++ b/arch/arm/dts/am335x-guardian.dts
@@ -202,8 +202,33 @@
};
 
partition@6 {
+   label = "u-boot-2";
+   reg = <0x30 0x10>;
+   };
+
+   partition@7 {
+   label = "u-boot-2.backup1";
+   reg = <0x40 0x10>;
+   };
+
+   partition@8 {
+   label = "u-boot-env";
+   reg = <0x50 0x4>;
+   };
+
+   partition@9 {
+   label = "u-boot-env.backup1";
+   reg = <0x54 0x4>;
+   };
+
+   partition@10 {
+   label = "splash-screen";
+   reg = <0x58 0x4>;
+   };
+
+   partition@11 {
label = "UBI";
-   reg = <0x30 0x1fd0>;
+   reg = <0x5c 0x1fa4>;
};
};
 };
diff --git a/configs/am335x_guardian_defconfig 
b/configs/am335x_guardian_defconfig
index 6bd5f0a9e5..b0033810b9 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -5,6 +5,7 @@ CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ENV_SIZE=0x4
+CONFIG_ENV_OFFSET=0x50
 CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_GUARDIAN=y
 CONFIG_SPL_SERIAL_SUPPORT=y
@@ -22,6 +23,11 @@ CONFIG_ARCH_MISC_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SEPARATE_BSS=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
+CONFIG_ENV_IS_IN_NAND=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_OFFSET_REDUND=0x54
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SPL_ENV_IS_NOWHERE=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_ETH_SUPPORT=y
 CONFIG_SPL_I2C_SUPPORT=y
@@ -49,7 +55,7 @@ CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 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),-(UBI)"
+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)"
 CONFIG_CMD_UBI=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_ISO_PARTITION is not set
@@ -57,7 +63,6 @@ CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 # CONFIG_SPL_OF_CONTROL is not set
 CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian"
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_AM33XX=y
diff --git a/include/configs/am335x_guardian.h 
b/include/configs/am335x_guardian.h
index 3c6147a266..1ac5e2e240 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -42,10 +42,23 @@
 
 #include 
 
+#define GUARDIAN_DEFAULT_PROD_ENV \
+   "factory_assembly_status=0\0" \
+   "main_pcba_part_number=0\0" \
+   "main_pcba_supplier=0\0" \
+   "main_pcba_timestamp=0\0" \
+   "main_pcba_hardware_version=0\0" \
+   "main_pcba_id=0\0" \
+   "main_pcba_aux_1=0\0" \
+   "main_pcba_aux_2=0\0" \
+   "main_pcba_aux_3=0\0" \
+   "main_pcba_aux_4=0\0" \
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
AM335XX_BOARD_FDTFILE \
MEM_LAYOUT_ENV_SETTINGS \
BOOTENV \
+   GUARDIAN_DEFAULT_PROD_ENV \
"bootubivol=rootfs\0" \
"altbootcmd=" \
"setenv boot_config \"extlinux-rollback.conf\"; " \
-- 
2.20.1



[PATCH 2/5] am335x, guardian: boot stage feedback in headless mode

2020-03-25 Thread Moses Christopher
  This patch enables the guardian board to provide feedback
  about the boot stage in headless mode. The on-board led
  would behave in the following pattern

* U-boot -> GLOW LED
* Linux  -> BLINK LED [HEART-BEAT PATTERN]

Signed-off-by: Moses Christopher 
---
 arch/arm/dts/am335x-guardian.dts  | 2 +-
 board/bosch/guardian/board.c  | 4 
 configs/am335x_guardian_defconfig | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts
index 5ed2133e78..b554be97a3 100644
--- a/arch/arm/dts/am335x-guardian.dts
+++ b/arch/arm/dts/am335x-guardian.dts
@@ -58,7 +58,7 @@
label = "guardian:life-led";
gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
-   default-state = "off";
+   default-state = "on";
};
};
 
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index 32ebaf4231..03ba9e8c5e 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -232,6 +233,9 @@ err:
 
 int board_late_init(void)
 {
+#ifdef CONFIG_LED_GPIO
+   led_default_state();
+#endif
set_bootmode_env();
return 0;
 }
diff --git a/configs/am335x_guardian_defconfig 
b/configs/am335x_guardian_defconfig
index eb2d221f4c..942530d76e 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -37,6 +37,7 @@ CONFIG_CMD_SPL=y
 CONFIG_CMD_SPL_NAND_OFS=0x0
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_LED is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
@@ -58,6 +59,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
 CONFIG_MISC=y
 # CONFIG_MMC is not set
 CONFIG_MTD=y
-- 
2.20.1



Update and Add features to Bosch Guardian Board

2020-03-25 Thread Moses Christopher
The following patches ensure that the Bosch Guardian Board is updated with
the latest feature additions and improvements made in the recent past

On High Level, the following are achieved:
  * Proper handling of USB-ETH Boot in SPL stage
  * Provide Boot stage feedback
  * Store Bootcount in RTC Scratch Registers
  * Save ENV in NAND
  * Handle Linux Boot




[PATCH 1/5] am335x, guardian: fix spl usb-eth boot

2020-03-25 Thread Moses Christopher
 - On Guardian board, usb-eth boot in SPL stage fails due to certain
   misconfiguration. Hence, add the same to fix the issue.

 - configs are set based on the conditional statement present in
   arch/arm/mach-omap2/am33xx/board.c

 - disable tiny printf in SPL stage:
As the library is optimized, the ability to deal with ethaddr is lost.
The following message would be printed on the console,

Error: flags type check failure for "ethaddr" <= "80a81144M" (type: m)
Error inserting "ethaddr" variable, errno=1

Signed-off-by: Moses Christopher 
---
 configs/am335x_guardian_defconfig | 4 +++-
 include/configs/am335x_guardian.h | 5 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configs/am335x_guardian_defconfig 
b/configs/am335x_guardian_defconfig
index 13974f7c0f..eb2d221f4c 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -52,7 +52,7 @@ CONFIG_CMD_UBI=y
 # CONFIG_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_CONTROL=y
-CONFIG_SPL_OF_CONTROL=y
+# CONFIG_SPL_OF_CONTROL is not set
 CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM=y
@@ -87,3 +87,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
 CONFIG_USB_ETHER=y
 CONFIG_SPL_WDT=y
 CONFIG_FAT_WRITE=y
+CONFIG_SPL_OF_LIBFDT=y
+# CONFIG_SPL_USE_TINY_PRINTF is not set
diff --git a/include/configs/am335x_guardian.h 
b/include/configs/am335x_guardian.h
index 0e20d6c728..6b9b6a28e9 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -109,4 +109,9 @@
 
 #endif /* CONFIG_MTD_RAW_NAND */
 
+#define CONFIG_AM335X_USB0
+#define CONFIG_AM335X_USB0_MODE MUSB_PERIPHERAL
+#define CONFIG_AM335X_USB1
+#define CONFIG_AM335X_USB1_MODE MUSB_HOST
+
 #endif /* ! __CONFIG_AM335X_GUARDIAN_H */
-- 
2.20.1



[PATCH 3/5] am335x, guardian: boot count is stored in AM3352 RTC block

2020-03-25 Thread Moses Christopher
  - Move bootlimit to defconfig
  - Store bootcount in RTC block

Signed-off-by: Moses Christopher 
---
 configs/am335x_guardian_defconfig | 4 +++-
 include/configs/am335x_guardian.h | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configs/am335x_guardian_defconfig 
b/configs/am335x_guardian_defconfig
index 942530d76e..6bd5f0a9e5 100644
--- a/configs/am335x_guardian_defconfig
+++ b/configs/am335x_guardian_defconfig
@@ -9,6 +9,8 @@ CONFIG_AM33XX=y
 CONFIG_TARGET_AM335X_GUARDIAN=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+CONFIG_SYS_BOOTCOUNT_ADDR=0x44E3E000
 CONFIG_SPL=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SPL_LIBDISK_SUPPORT=y
@@ -58,7 +60,7 @@ CONFIG_DEFAULT_DEVICE_TREE="am335x-guardian"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
-CONFIG_BOOTCOUNT_ENV=y
+CONFIG_BOOTCOUNT_AM33XX=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_MISC=y
diff --git a/include/configs/am335x_guardian.h 
b/include/configs/am335x_guardian.h
index 6b9b6a28e9..3c6147a266 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -46,7 +46,6 @@
AM335XX_BOARD_FDTFILE \
MEM_LAYOUT_ENV_SETTINGS \
BOOTENV \
-   "bootlimit=3\0" \
"bootubivol=rootfs\0" \
"altbootcmd=" \
"setenv boot_config \"extlinux-rollback.conf\"; " \
-- 
2.20.1



[PATCH] tiny-printf: revert patch to fix spl eth boot

2020-02-25 Thread Moses Christopher
From: Moses Christopher Bollavarapu 

  - Revert commit 831c16111959 ("tiny-printf: Reorder code to support %p")

The mentioned commit does not handle the ethaddr properly.
Hence, I tried to disable SPL_TINY_PRINTF, but then it was suggested
to keep using the tiny-printf library in SPL and revert the patch
that caused the issue.

  - The issue is observed in both Beaglebone Black and Guardian Board,
while trying to boot the board using USB-ETH in SPL stage.

Signed-off-by: Moses Christopher Bollavarapu 
---
 lib/tiny-printf.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 1138c7012a..8ee0ffb9ca 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -268,20 +268,10 @@ static int _vprintf(struct printf_info *info, const char 
*fmt, va_list va)
}
break;
case 'p':
-#ifdef DEBUG
pointer(info, fmt, va_arg(va, void *));
-   /*
-* Skip this because it pulls in _ctype which is
-* 256 bytes, and we don't generally implement
-* pointer anyway
-*/
while (isalnum(fmt[0]))
fmt++;
break;
-#else
-   islong = true;
-   /* no break */
-#endif
case 'x':
if (islong) {
num = va_arg(va, unsigned long);
-- 
2.20.1



Re: [U-Boot] Issue in u-boot; TFTP error: trying to overwrite reserved memory...

2019-09-11 Thread Moses Christopher
On Wed, 11 Sep, 2019, 9:12 PM Simon Goldschmidt, <
simon.k.r.goldschm...@gmail.com> wrote:

>
>
> On 11.09.19 20:59, Moses Christopher wrote:
> >
> > On Wed, 11 Sep, 2019, 4:43 PM Simon Goldschmidt,
> >  > <mailto:simon.k.r.goldschm...@gmail.com>> wrote:
> >
> > On Wed, Sep 11, 2019 at 11:44 AM Moses Christopher
> > mailto:moseschristoph...@gmail.com>>
> > wrote:
> >  >
> >  >
> >  >
> >  > On Wed, 11 Sep, 2019, 10:32 AM Simon Goldschmidt,
> >  > <mailto:simon.k.r.goldschm...@gmail.com>> wrote:
> >  >>
> >  >> On Mon, Sep 9, 2019 at 11:29 AM Moses Christopher
> >  >>  > <mailto:moseschristoph...@gmail.com>> wrote:
> >  >> >
> >  >> > Hi Simon,
> >  >> >
> >  >> >
> >  >> > Thanks for the prompt reply.
> >  >> >
> >  >> > On Fri, 6 Sep, 2019, 8:13 AM Simon Goldschmidt,
> >  > <mailto:simon.k.r.goldschm...@gmail.com>> wrote:
> >  >> >
> >  >> > Hi,
> >  >> >
> >  >> > On Thu, Sep 5, 2019 at 4:14 PM Moses Christopher
> >  >> >  > <mailto:moseschristoph...@gmail.com>> wrote:
> >  >> > > Hello together,
> >  >> > >
> >  >> > > I was trying to build u-boot and spl for the arm target and
> > tried to boot via usb-ethernet.
> >  >> > > I found an issue with one of the commit made in the early
> 2019,
> >  >> > > http://patchwork.ozlabs.org/patch/1024795/
> >  >> > >
> >  >> > > When using this CONFIG_LMB the max_size or the
> > lmb_get_free_size(&lmb, load_addr); returns 0, no matter what.
> >  >> > > And it triggers the following error,
> >  >> > > TFTP error: trying to overwrite reserved memory...
> >  >> > > I did a quick fix by adding #undef CONFIG_LMB in the file,
> > net/tftp.c
> >  >> > > So, I would like to know why this doesn’t work as it was
> > working before applying this patch ?
> >  >> >
> >  >> > Can you add "#define DEBUG" as the first line in 'lib/lmb.c'?
> That
> >  >> > should give you debug
> >  >> > output when lmb is used.
> >  >> >
> >  >> >
> >  >> > I did add DEBUG macro to lmb.c but the function having the
> > debug messages isn't getting called. I suppose it was from fs/fs.c
> >  >>
> >  >> Right, tftp.c is missing the call to that funcftion. Could you
> > add the
> >  >> call to 'lmb_dump_all(&lmb);'
> >  >> right below 'lmb_init_and_reserve()' in tftp.c?
> >  >>
> >  >> That should give you the output required. And while at it, tell
> us
> >  >> what 'load_addr' is set to
> >  >> (by adding a printf in tftp.c, too).
> >  >>
> >  >> Thanks,
> >  >> Simon
> >  >
> >  >
> >  > Thanks for your patience and time.
> >  >
> >  > Please find the log below,
> >  >
> >  >
> >  >
> >  > DHCP client bound to address 172.17.0.2 (1285 ms)
> >  >
> >  > Using usb_ether device
> >  >
> >  > TFTP from server 172.17.0.1; our IP address is 172.17.0.2
> >  >
> >  > Filename 'u-boot.img'.
> >  >
> >  > lmb_dump_all:
> >  >
> >  > memory.cnt = 0x0
> >  >
> >  > memory.size= 0xx
> >  >
> >  >
> >  >
> >  > reserved.cnt   = 0x0
> >  >
> >  > reserved.size  = 0xx
> >  >
> >  > load_addr: 0x8200
> >  >
> >  >
> >  >
> >  > TFTP error: trying to overwrite reserved memory...
> >  >
> >  > Problem booting with BOOTP
> >  >
> >  >
> >  >
> >  > In my u-boot it shows the DRAM size properly as 256MiB
> >  >
> >  > So, do I need to configure my RAM size in SPL stage 

Re: [U-Boot] Issue in u-boot; TFTP error: trying to overwrite reserved memory...

2019-09-11 Thread Moses Christopher
On Wed, 11 Sep, 2019, 4:43 PM Simon Goldschmidt, <
simon.k.r.goldschm...@gmail.com> wrote:

> On Wed, Sep 11, 2019 at 11:44 AM Moses Christopher
>  wrote:
> >
> >
> >
> > On Wed, 11 Sep, 2019, 10:32 AM Simon Goldschmidt, <
> simon.k.r.goldschm...@gmail.com> wrote:
> >>
> >> On Mon, Sep 9, 2019 at 11:29 AM Moses Christopher
> >>  wrote:
> >> >
> >> > Hi Simon,
> >> >
> >> >
> >> > Thanks for the prompt reply.
> >> >
> >> > On Fri, 6 Sep, 2019, 8:13 AM Simon Goldschmidt, <
> simon.k.r.goldschm...@gmail.com> wrote:
> >> >
> >> > Hi,
> >> >
> >> > On Thu, Sep 5, 2019 at 4:14 PM Moses Christopher
> >> >  wrote:
> >> > > Hello together,
> >> > >
> >> > > I was trying to build u-boot and spl for the arm target and tried
> to boot via usb-ethernet.
> >> > > I found an issue with one of the commit made in the early 2019,
> >> > > http://patchwork.ozlabs.org/patch/1024795/
> >> > >
> >> > > When using this CONFIG_LMB the max_size or the
> lmb_get_free_size(&lmb, load_addr); returns 0, no matter what.
> >> > > And it triggers the following error,
> >> > > TFTP error: trying to overwrite reserved memory...
> >> > > I did a quick fix by adding #undef CONFIG_LMB in the file,
> net/tftp.c
> >> > > So, I would like to know why this doesn’t work as it was working
> before applying this patch ?
> >> >
> >> > Can you add "#define DEBUG" as the first line in 'lib/lmb.c'? That
> >> > should give you debug
> >> > output when lmb is used.
> >> >
> >> >
> >> > I did add DEBUG macro to lmb.c but the function having the debug
> messages isn't getting called. I suppose it was from fs/fs.c
> >>
> >> Right, tftp.c is missing the call to that funcftion. Could you add the
> >> call to 'lmb_dump_all(&lmb);'
> >> right below 'lmb_init_and_reserve()' in tftp.c?
> >>
> >> That should give you the output required. And while at it, tell us
> >> what 'load_addr' is set to
> >> (by adding a printf in tftp.c, too).
> >>
> >> Thanks,
> >> Simon
> >
> >
> > Thanks for your patience and time.
> >
> > Please find the log below,
> >
> >
> >
> > DHCP client bound to address 172.17.0.2 (1285 ms)
> >
> > Using usb_ether device
> >
> > TFTP from server 172.17.0.1; our IP address is 172.17.0.2
> >
> > Filename 'u-boot.img'.
> >
> > lmb_dump_all:
> >
> > memory.cnt = 0x0
> >
> > memory.size= 0xx
> >
> >
> >
> > reserved.cnt   = 0x0
> >
> > reserved.size  = 0xx
> >
> > load_addr: 0x8200
> >
> >
> >
> > TFTP error: trying to overwrite reserved memory...
> >
> > Problem booting with BOOTP
> >
> >
> >
> > In my u-boot it shows the DRAM size properly as 256MiB
> >
> > So, do I need to configure my RAM size in SPL stage as well, such that
> SPL is aware of the memory size ?
>
> Ehrm, are you doing this from SPL?
>

Yes, SPL loads u-boot onto the DRAM from Network, when the NAND is empty.

By flashing the same MLO and u-boot binaries onto the NAND, and then
doing *dhcp
MLO *from u-boot prompt gives the following log,

Using usb_ether device
TFTP from server 172.17.0.1; our IP address is 172.17.0.2
Filename 'MLO'.
*lmb_dump_all:*








*memory.cnt = 0x1memory.size = 0x0memory.reg[0x0].base = 0x8000.size =
0x1000reserved.cnt = 0x1reserved.size = 0x0reserved.reg[0x0].base =
0x8df2ab98.size = 0x20d5468*
load_addr: 0x8020


>
> You need the RAM size for 'lmb_init_and_reserve()' to read, yes.
> Otherwise it can't know
> where to safely allocate things.
>
> Regards,
> Simon
>

Would you think, SPL should also do the same or is this valid only for
u-boot ?

Because, during SPL stage, the RAM would be mostly free anyway, so would
you think, we can just use this lmb check only for u-boot but not for SPL ?

Regards,
Moses Christopher

>

>
> >>
> >> >
> >> > FYI,
> >> > I'm trying to load SPL and uboot on RAM, using USB-ETH. Also the
> environment is not stored separately, neither the device tree.
> >> >
> >> >
> >> > The lmb code works by ge

Re: [U-Boot] Issue in u-boot; TFTP error: trying to overwrite reserved memory...

2019-09-11 Thread Moses Christopher
On Wed, 11 Sep, 2019, 10:32 AM Simon Goldschmidt, <
simon.k.r.goldschm...@gmail.com> wrote:

> On Mon, Sep 9, 2019 at 11:29 AM Moses Christopher
>  wrote:
> >
> > Hi Simon,
> >
> >
> > Thanks for the prompt reply.
> >
> > On Fri, 6 Sep, 2019, 8:13 AM Simon Goldschmidt, <
> simon.k.r.goldschm...@gmail.com> wrote:
> >
> > Hi,
> >
> > On Thu, Sep 5, 2019 at 4:14 PM Moses Christopher
> >  wrote:
> > > Hello together,
> > >
> > > I was trying to build u-boot and spl for the arm target and tried to
> boot via usb-ethernet.
> > > I found an issue with one of the commit made in the early 2019,
> > > http://patchwork.ozlabs.org/patch/1024795/
> > >
> > > When using this CONFIG_LMB the max_size or the lmb_get_free_size(&lmb,
> load_addr); returns 0, no matter what.
> > > And it triggers the following error,
> > > TFTP error: trying to overwrite reserved memory...
> > > I did a quick fix by adding #undef CONFIG_LMB in the file, net/tftp.c
> > > So, I would like to know why this doesn’t work as it was working
> before applying this patch ?
> >
> > Can you add "#define DEBUG" as the first line in 'lib/lmb.c'? That
> > should give you debug
> > output when lmb is used.
> >
> >
> > I did add DEBUG macro to lmb.c but the function having the debug
> messages isn't getting called. I suppose it was from fs/fs.c
>
> Right, tftp.c is missing the call to that funcftion. Could you add the
> call to 'lmb_dump_all(&lmb);'
> right below 'lmb_init_and_reserve()' in tftp.c?
>
> That should give you the output required. And while at it, tell us
> what 'load_addr' is set to
> (by adding a printf in tftp.c, too).
>
> Thanks,
> Simon
>

Thanks for your patience and time.

Please find the log below,



DHCP client bound to address 172.17.0.2 (1285 ms)

Using usb_ether device

TFTP from server 172.17.0.1; our IP address is 172.17.0.2

Filename 'u-boot.img'.

*lmb_dump_all:*

*memory.cnt = 0x0*

*memory.size= 0xx*



*reserved.cnt   = 0x0*

*reserved.size  = 0xx*

*load_addr: 0x8200*



TFTP error: trying to overwrite reserved memory...

Problem booting with BOOTP



*In my u-boot it shows the DRAM size properly as 256MiB*

*So, do I need to configure my RAM size in SPL stage as well, such that SPL
is aware of the memory size ?*



> >
> > FYI,
> > I'm trying to load SPL and uboot on RAM, using USB-ETH. Also the
> environment is not stored separately, neither the device tree.
> >
> >
> > The lmb code works by getting the RAM size, adding reserved areas and
> then only
> > allowing allocations in non-reserved areay. However, the RAM size is
> > not fully used
> > depending on some config options and/or environment variables. There's
> possibly
> > something wrong in your configuration around that.
> >
> >
> > Because, earlier to this patch, net/tftp.c isn't actually checking for
> the reserved memory regions and is able to download the files properly on
> the RAM and it works. I know, that's not a good approach, hence you've made
> the necessary changes to correct it.
> >
> > Could you kindly provide me some information, where I can read more
> about the reserved memory regions and how exactly some region is treated as
> reserved region ?
> >
> > Also, it'd be great if you could provide some information related to the
> configuration of Reserved and free addresses of RAM.
> >
> > Thank you for your patience and time.
> >
> > Regards,
> > Simon
> >
> > >
> > > Best regards,
> > > Moses Christopher
> >
> > Best regards,
> > Moses Christopher
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Issue in u-boot; TFTP error: trying to overwrite reserved memory...

2019-09-09 Thread Moses Christopher
Hi Simon,


Thanks for the prompt reply.

On Fri, 6 Sep, 2019, 8:13 AM Simon Goldschmidt, <
simon.k.r.goldschm...@gmail.com> wrote:

Hi,

On Thu, Sep 5, 2019 at 4:14 PM Moses Christopher
 wrote:
> Hello together,
>
> I was trying to build u-boot and spl for the arm target and tried to boot
via usb-ethernet.
> I found an issue with one of the commit made in the early 2019,
> http://patchwork.ozlabs.org/patch/1024795/
>
> When using this CONFIG_LMB the max_size or the lmb_get_free_size(&lmb,
load_addr); returns 0, no matter what.
> And it triggers the following error,
> TFTP error: trying to overwrite reserved memory...
> I did a quick fix by adding #undef CONFIG_LMB in the file, net/tftp.c
> So, I would like to know why this doesn’t work as it was working before
applying this patch ?

Can you add "#define DEBUG" as the first line in 'lib/lmb.c'? That
should give you debug
output when lmb is used.


I did add DEBUG macro to lmb.c but the function having the debug messages
isn't getting called. I suppose it was from fs/fs.c

FYI,
I'm trying to load SPL and uboot on RAM, using USB-ETH. Also the
environment is not stored separately, neither the device tree.


The lmb code works by getting the RAM size, adding reserved areas and then
only
allowing allocations in non-reserved areay. However, the RAM size is
not fully used
depending on some config options and/or environment variables. There's
possibly
something wrong in your configuration around that.


Because, earlier to this patch, net/tftp.c isn't actually checking for the
reserved memory regions and is able to download the files properly on the
RAM and it works. I know, that's not a good approach, hence you've made the
necessary changes to correct it.

Could you kindly provide me some information, where I can read more about
the reserved memory regions and how exactly some region is treated as
reserved region ?

Also, it'd be great if you could provide some information related to the
configuration of Reserved and free addresses of RAM.

Thank you for your patience and time.

Regards,
Simon

>
> Best regards,
> Moses Christopher

Best regards,
Moses Christopher
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] spl: net: usb: problem with the re-initialization of the usb_ethernet

2019-09-05 Thread Moses Christopher
Hello together,

The following patch is generating two Ethernet interfaces in SPL stage and
is not able to proceed further,

*spl: net: dm: usb: bind the gadget before attempting to load the image
<https://gitlab.denx.de/u-boot/u-boot/commit/0f46fb58a2355edf631c19797ad5c1f5f9403236>*

By removing the above patch, the SPL USB-Ethernet works fine.

May I know, what exactly is done over here ?
Because, the initialization is already happening in the beginning from the
am33xx-board file.

*Log with the above commit: *

U-Boot SPL 2019.07-dirty (Sep 03 2019 - 13:58:41 +0530)

Trying to boot from USB eth

Warning: usb_ether using MAC address from ROM

eth0: usb_etherusb_eth_probe:

*Warning: usb_ether using MAC address from ROM*

*, eth1: usb_ether*

using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in

MAC de:ad:be:ef:00:01

HOST MAC de:ad:be:ef:00:00

RNDIS ready

*Stops here……*

By removing the above mentioned patch, The SPL is able to proceed further.



Best regards,
*Moses Christopher*
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Issue in u-boot; TFTP error: trying to overwrite reserved memory...

2019-09-05 Thread Moses Christopher
Hello together,



I was trying to build u-boot and spl for the arm target and tried to boot
via usb-ethernet.

I found an issue with one of the commit made in the early 2019,

http://patchwork.ozlabs.org/patch/1024795/


When using this CONFIG_LMB the max_size or the *lmb_get_free_size(&lmb,
load_addr); *returns 0, no matter what.

And it triggers the following error,

*TFTP error: trying to overwrite reserved memory...*

I did a quick fix by adding *#undef CONFIG_LMB* in the file, *net/tftp.c*

So, I would like to know why this doesn’t work as it was working before
applying this patch ?



Best regards,
*Moses Christopher*
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot