[U-Boot] [PATCH 2/2] am335x, guardian: adapt guardian board to DM

2019-09-17 Thread BollavarapuMoses.Christopher
From: Moses Christopher 

  - update partition table - remove env partitions
  - dts: add new interfaces (uart2, extra gpio-key)
 remove unneeded entries
 update nand timings for performance improvement
  - defconfig: adapt configurations to suit DM
   remove unneeded configs
  - am335x_guardian.h: remove mmc boot

Signed-off-by: Moses Christopher 
---
 arch/arm/dts/am335x-guardian.dts  | 102 ++
 configs/am335x_guardian_defconfig |  25 ++
 include/configs/am335x_guardian.h |  11 ++--
 3 files changed, 80 insertions(+), 58 deletions(-)

diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts
index f3f022c..5ed2133 100644
--- a/arch/arm/dts/am335x-guardian.dts
+++ b/arch/arm/dts/am335x-guardian.dts
@@ -32,12 +32,19 @@
gpio_keys {
compatible = "gpio-keys";
pinctrl-names = "default";
-   pinctrl-0 = <_keys_pins>;
+   pinctrl-0 = <_button_pins>;
 
-   button21 {
+   select-button {
+   label = "guardian-select-button";
+   linux,code = ;
+   gpios = < 31 GPIO_ACTIVE_LOW>;
+   wakeup-source;
+   };
+
+   power-button {
label = "guardian-power-button";
linux,code = ;
-   gpios = < 21 0>;
+   gpios = < 21 GPIO_ACTIVE_LOW>;
wakeup-source;
};
};
@@ -45,19 +52,12 @@
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
-   pinctrl-0 = <_pins>;
-
-   led1 {
-   label = "green:heartbeat";
-   gpios = < 27 GPIO_ACTIVE_HIGH>;
-   linux,default-trigger = "heartbeat";
-   default-state = "off";
-   };
+   pinctrl-0 = <_led_pins>;
 
-   led2 {
-   label = "green:mmc0";
+   life-led {
+   label = "guardian:life-led";
gpios = < 26 GPIO_ACTIVE_HIGH>;
-   linux,default-trigger = "mmc0";
+   linux,default-trigger = "heartbeat";
default-state = "off";
};
};
@@ -140,22 +140,25 @@
gpmc,device-width = <1>;
gpmc,sync-clk-ps = <0>;
gpmc,cs-on-ns = <0>;
-   gpmc,cs-rd-off-ns = <44>;
-   gpmc,cs-wr-off-ns = <44>;
-   gpmc,adv-on-ns = <6>;
-   gpmc,adv-rd-off-ns = <34>;
-   gpmc,adv-wr-off-ns = <44>;
+   gpmc,cs-rd-off-ns = <30>;
+   gpmc,cs-wr-off-ns = <30>;
+   gpmc,adv-on-ns = <0>;
+   gpmc,adv-rd-off-ns = <30>;
+   gpmc,adv-wr-off-ns = <30>;
gpmc,we-on-ns = <0>;
-   gpmc,we-off-ns = <40>;
-   gpmc,oe-on-ns = <0>;
-   gpmc,oe-off-ns = <54>;
-   gpmc,access-ns = <64>;
-   gpmc,rd-cycle-ns = <82>;
-   gpmc,wr-cycle-ns = <82>;
+   gpmc,we-off-ns = <15>;
+   gpmc,oe-on-ns = <1>;
+   gpmc,oe-off-ns = <15>;
+   gpmc,access-ns = <30>;
+   gpmc,rd-cycle-ns = <30>;
+   gpmc,wr-cycle-ns = <30>;
+   gpmc,wait-on-read = "true";
+   gpmc,wait-on-write = "true";
gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>;
gpmc,clk-activation-ns = <0>;
-   gpmc,wr-access-ns = <40>;
+   gpmc,wait-monitoring-ns = <0>;
+   gpmc,wr-access-ns = <0>;
gpmc,wr-data-mux-bus-ns = <0>;
 
/*
@@ -199,18 +202,8 @@
};
 
partition@6 {
-   label = "u-boot-env";
-   reg = <0x30 0x4>;
-   };
-
-   partition@7 {
-   label = "u-boot-env.backup1";
-   reg = <0x34 0x4>;
-   };
-
-   partition@8 {
label = "UBI";
-   reg = <0x38 0x1fc8>;
+   reg = <0x30 0x1fd0>;
};
};
 };
@@ -326,6 +319,12 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   status = "okay";
+};
+
  {
status = "okay";
 };
@@ -354,7 +353,7 @@
 
 _pinmux {
pinctrl-names = "default";
-   pinctrl-0 = <_pin _pins>;
+   pinctrl-0 = <_pin _interface_pins>;
 
clkout2_pin: pinmux_clkout2_pin {
pinctrl-single,pins = <
@@ -368,16 +367,25 @@
>;
};
 
-   gpio_keys_pins: pinmux_gpio_keys_pins {

[U-Boot] [PATCH 1/2] am335x, guardian: update guardian board

2019-09-17 Thread BollavarapuMoses.Christopher
From: Moses Christopher 

  - add BOARD_LATE_INIT function calls in board.c
  - add swi_status detection in board.c
  - mux: add guardian interfaces to single pinmux structure
  - am33xx, kconfig: add BOARD_LATE_INIT for GUARDIAN board

Signed-off-by: Moses Christopher 
---
 arch/arm/mach-omap2/am33xx/Kconfig |  1 +
 board/bosch/guardian/board.c   | 53 ++
 board/bosch/guardian/mux.c | 32 ---
 3 files changed, 65 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/Kconfig 
b/arch/arm/mach-omap2/am33xx/Kconfig
index 7f6b344..39d9c28 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -89,6 +89,7 @@ config TARGET_AM335X_SHC
 
 config TARGET_AM335X_GUARDIAN
bool "Support am335x based guardian board from bosch"
+   select BOARD_LATE_INIT
select DM
select DM_SERIAL
select DM_GPIO
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index ec0c4a17..072aa4e 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -172,6 +172,8 @@ void sdram_init(void)
 
 int board_init(void)
 {
+   save_omap_boot_params();
+
 #if defined(CONFIG_HW_WATCHDOG)
hw_watchdog_init();
 #endif
@@ -183,3 +185,54 @@ int board_init(void)
 #endif
return 0;
 }
+
+#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, _mode_desc);
+   if (ret) {
+   printf("%s is not found\n", boot_mode_gpio);
+   goto err;
+   }
+
+   ret = dm_gpio_request(_mode_desc, "setup_bootmode_env");
+   if (ret && ret != -EBUSY) {
+   printf("requesting gpio: %s failed\n", boot_mode_gpio);
+   goto err;
+   }
+
+   value = dm_gpio_get_value(_mode_desc);
+   value ? env_set("swi_status", "0") : env_set("swi_status", "1");
+   return;
+
+err:
+   env_set("swi_status", "err");
+}
+
+int board_late_init(void)
+{
+   set_bootmode_env();
+   return 0;
+}
+#endif /* CONFIG_BOARD_LATE_INIT */
diff --git a/board/bosch/guardian/mux.c b/board/bosch/guardian/mux.c
index 708c3e7..20a1f25 100644
--- a/board/bosch/guardian/mux.c
+++ b/board/bosch/guardian/mux.c
@@ -26,24 +26,16 @@ static struct module_pin_mux i2c0_pin_mux[] = {
{-1},
 };
 
-static struct module_pin_mux adc_voltages_en[] = {
-   {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUP_EN)},
-   {-1},
-};
-
-static struct module_pin_mux asp_power_en[] = {
-   {OFFSET(mcasp0_aclkx), (MODE(7) | PULLUP_EN)},
-   {-1},
-};
-
-static struct module_pin_mux switch_off_3v6_pin_mux[] = {
-   {OFFSET(mii1_txd0), (MODE(7) | PULLUP_EN)},
-   /*
-* The uart1 lines are made floating inputs, based on the Guardian
-* A2 Sample Power Supply Schematics
-*/
-   {OFFSET(uart1_rxd), (MODE(7) | PULLUDDIS)},
-   {OFFSET(uart1_txd), (MODE(7) | PULLUDDIS)},
+static struct module_pin_mux guardian_interfaces_pin_mux[] = {
+   {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLDOWN_EN)},
+   {OFFSET(mcasp0_aclkx),  (MODE(7) | PULLUP_EN)},
+   {OFFSET(mii1_txd0), (MODE(7) | PULLUP_EN)},
+   {OFFSET(uart1_rxd), (MODE(7) | RXACTIVE | PULLUDDIS)},
+   {OFFSET(uart1_txd), (MODE(7) | PULLUDDIS)},
+   {OFFSET(mii1_crs),  (MODE(7) | PULLDOWN_EN)},
+   {OFFSET(rmii1_refclk),  (MODE(7) | PULLDOWN_EN)},
+   {OFFSET(mii1_txd3), (MODE(7) | PULLUDDIS)},
+   {OFFSET(mii1_rxdv), (MODE(7) | PULLDOWN_EN)},
{-1},
 };
 
@@ -93,7 +85,5 @@ void enable_board_pin_mux(void)
 #ifdef CONFIG_NAND
configure_module_pin_mux(nand_pin_mux);
 #endif
-   configure_module_pin_mux(adc_voltages_en);
-   configure_module_pin_mux(asp_power_en);
-   configure_module_pin_mux(switch_off_3v6_pin_mux);
+   configure_module_pin_mux(guardian_interfaces_pin_mux);
 }
-- 
2.8.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] am335x, guardian: update the maintainer list

2019-06-18 Thread BollavarapuMoses.Christopher
From: Moses Christopher 

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

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

 S: Maintained
 F: board/bosch/guardian/
 F: include/configs/am335x_guardian.h
-- 
2.8.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot