[PATCH] board: amlogic: jethub j100: add rescue boot from microSD

2022-12-22 Thread Vyacheslav Bocharov
From: Viacheslav Bocharov 

The new JetHub D1+ has a microSD slot. Add rescue boot from microSD

Signed-off-by: Viacheslav Bocharov 
---
 include/configs/jethub.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/jethub.h b/include/configs/jethub.h
index 35f85095ac..e22db4991d 100644
--- a/include/configs/jethub.h
+++ b/include/configs/jethub.h
@@ -12,6 +12,7 @@
 #define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
"bootcmd_rescue=" \
"if gpio input 10; then " \
+   "run bootcmd_mmc0; " \
"run bootcmd_usb0;" \
"fi;\0"
 #else
-- 
2.34.1



[PATCH] cmd: fix do_adc_single()

2022-07-03 Thread Vyacheslav Bocharov
The source code contains an error:
- argv[2] contains  arg, variable for env_set is in argv[3]
- number of args is 4

Revert 54d24d72601321f4470c4edf31c6b29adae424a7
  cmd: simplify do_adc_single()

Fixes 9de612ae4ded53f742f5f99929c06d0839471ced
  cmd: adc: Add support for storing ADC result in env variable
---
 cmd/adc.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cmd/adc.c b/cmd/adc.c
index 195efa8661..1c5d3e10a3 100644
--- a/cmd/adc.c
+++ b/cmd/adc.c
@@ -71,6 +71,7 @@ static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int 
argc,
 static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
 char *const argv[])
 {
+   char *varname = NULL;
struct udevice *dev;
unsigned int data;
int ret, uV, val;
@@ -78,6 +79,9 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int 
argc,
if (argc < 3)
return CMD_RET_USAGE;
 
+   if (argc >= 4)
+   varname = argv[3];
+
ret = adc_channel_single_shot(argv[1], simple_strtol(argv[2], NULL, 0),
  );
if (ret) {
@@ -95,7 +99,8 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int 
argc,
printf("%u\n", data);
}
 
-   env_set_ulong(argv[2], val);
+   if (varname)
+   env_set_ulong(varname, val);
 
return CMD_RET_SUCCESS;
 }
@@ -160,5 +165,5 @@ static char adc_help_text[] =
 U_BOOT_CMD_WITH_SUBCMDS(adc, "ADC sub-system", adc_help_text,
U_BOOT_SUBCMD_MKENT(list, 1, 1, do_adc_list),
U_BOOT_SUBCMD_MKENT(info, 2, 1, do_adc_info),
-   U_BOOT_SUBCMD_MKENT(single, 3, 1, do_adc_single),
+   U_BOOT_SUBCMD_MKENT(single, 4, 1, do_adc_single),
U_BOOT_SUBCMD_MKENT(scan, 3, 1, do_adc_scan));
-- 
2.30.2



[PATCH 2/2] doc: boards: amlogic: update jethub d1 specifications

2022-04-25 Thread Vyacheslav Bocharov
Signed-off-by: Vyacheslav Bocharov 
---
 doc/board/amlogic/jethub-j100.rst | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/doc/board/amlogic/jethub-j100.rst 
b/doc/board/amlogic/jethub-j100.rst
index d54519aaef..8081569bba 100644
--- a/doc/board/amlogic/jethub-j100.rst
+++ b/doc/board/amlogic/jethub-j100.rst
@@ -3,27 +3,31 @@
 U-Boot for JetHub J100
 ===
 
-JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation
-controller manufactured by JetHome with the following specifications:
+JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a series of home 
+automation controller manufactured by JetHome with the following 
+specifications:
 
  - Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
  - no video out
- - 512Mb/1GB DDR3
- - 8/16GB eMMC flash
+ - 512MB/1GB DDR3 or 2GB DDR4 SDRAM
+ - 8/16/32GB eMMC flash
  - 1 x USB 2.0
  - 1 x 10/100Mbps ethernet
- - WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE
-   802.11a/b/g/n/ac, Bluetooth 4.2.
- - TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output
-   power and Zigbee 3.0 support.
+ - WiFi / Bluetooth one from:
+   - AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, Bluetooth 4.2
+   - RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0
+   - Amlogic W155S1 WiFi5 IEEE 802.11a/b/g/n/ac, Bluetooth 5.2
  - 2 x gpio LEDS
  - GPIO user Button
+ - DC source with a voltage of 9 to 56 V / Passive POE
+ - DIN Rail Mounting case
+Basic version also has:
+ - TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output
+   power and Zigbee 3.0 support.
  - 1 x 1-Wire
  - 2 x RS-485
  - 4 x dry contact digital GPIO inputs
  - 3 x relay GPIO outputs
- - DC source with a voltage of 9 to 56 V / Passive POE
- - DIN Rail Mounting case
 
 U-Boot compilation
 --
-- 
2.30.2



[PATCH 1/2] doc: boards: amlogic: update documentation for ADC support for AXG

2022-04-25 Thread Vyacheslav Bocharov
Signed-off-by: Vyacheslav Bocharov 
---
 doc/board/amlogic/index.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 9ef1440433..9c7fadf2c0 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -55,7 +55,7 @@ This matrix concerns the actual source code version.
 
+---+---+-+--+-++-+--+
 | NAND  | No| No  | No   | 
No  | No | No  | No   |
 
+---+---+-+--+-++-+--+
-| ADC   | **Yes**   | **Yes** | **Yes**  | 
No  | No | No  | No   |
+| ADC   | **Yes**   | **Yes** | **Yes**  | 
**Yes** | No | No  | No   |
 
+---+---+-+--+-++-+--+
 | CVBS Output   | **Yes**   | **Yes** | **Yes**  | 
*N/A*   | **Yes**| **Yes** | **Yes**  |
 
+---+---+-+--+-++-+--+
-- 
2.30.2



[PATCH v3 5/6] board: amlogic: jethub j100: enable saradc in dts

2022-04-24 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 to check the hardware revision of the board:
- add u-boot dts include with saradc node

Signed-off-by: Vyacheslav Bocharov 
---
 arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi | 10 ++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi

diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi 
b/arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi
new file mode 100644
index 00..3ecb233f8e
--- /dev/null
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2022 Vyacheslav Bocharov 
+ * Author: Vyacheslav Bocharov 
+ */
+
+ {
+   status = "okay";
+   vref-supply = <_ao18>;
+};
-- 
2.30.2



[PATCH v3 6/6] board: amlogic: jethub j100: enable saradc in config

2022-04-24 Thread Vyacheslav Bocharov
Enable ADC in board config file

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Neil Armstrong 
---
 configs/jethub_j100_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 1c6db9f6a0..a30940bf1c 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -17,6 +17,7 @@ CONFIG_REMAKE_ELF=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+CONFIG_CMD_ADC=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_EEPROM=y
@@ -34,6 +35,10 @@ CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_CLK=y
+CONFIG_CLK_MESON_AXG=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD_UBI=y
 CONFIG_PHY_REALTEK=y
-- 
2.30.2



[PATCH v3 4/6] adc: meson-saradc: add AXG variant

2022-04-24 Thread Vyacheslav Bocharov
Add support for the SARADC variant found on the AXG SoCs family.

Signed-off-by: Vyacheslav Bocharov 
Acked-by: Neil Armstrong 
---
 drivers/adc/meson-saradc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 1a45a3a265..37023512f0 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -737,6 +737,8 @@ static const struct udevice_id meson_saradc_ids[] = {
  .data = (ulong)_saradc_data },
{ .compatible = "amlogic,meson-g12a-saradc",
  .data = (ulong)_saradc_data },
+   { .compatible = "amlogic,meson-axg-saradc",
+ .data = (ulong)_saradc_data },
{ }
 };
 
-- 
2.30.2



[PATCH v3 3/6] clk: meson: update driver for g12a-ao clocks

2022-04-24 Thread Vyacheslav Bocharov
Update g12a-ao clk driver:
- move clk->id check to .request function
- remove unnecessary check (gate->reg == 0)

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/g12a-ao.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
index 17b11eb52a..1a855a6896 100644
--- a/drivers/clk/meson/g12a-ao.c
+++ b/drivers/clk/meson/g12a-ao.c
@@ -28,14 +28,8 @@ static int meson_set_gate(struct clk *clk, bool on)
struct meson_clk *priv = dev_get_priv(clk->dev);
struct meson_gate *gate;
 
-   if (clk->id >= ARRAY_SIZE(gates))
-   return -ENOENT;
-
gate = [clk->id];
 
-   if (gate->reg == 0)
-   return 0;
-
regmap_update_bits(priv->map, gate->reg,
   BIT(gate->bit), on ? BIT(gate->bit) : 0);
 
@@ -63,9 +57,18 @@ static int meson_clk_probe(struct udevice *dev)
return 0;
 }
 
+static int meson_clk_request(struct clk *clk)
+{
+   if (clk->id >= ARRAY_SIZE(gates))
+   return -ENOENT;
+
+   return 0;
+}
+
 static struct clk_ops meson_clk_ops = {
.disable= meson_clk_disable,
.enable = meson_clk_enable,
+   .request= meson_clk_request,
 };
 
 static const struct udevice_id meson_clk_ids[] = {
-- 
2.30.2



[PATCH v3 2/6] clk: meson: fix driver name for g12a-ao clocks

2022-04-24 Thread Vyacheslav Bocharov
Update the clk-g12a-ao driver from "axg" to "g12a"

Signed-off-by: Vyacheslav Bocharov 
Acked-by: Neil Armstrong 
---
 drivers/clk/meson/g12a-ao.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
index 0148529e04..17b11eb52a 100644
--- a/drivers/clk/meson/g12a-ao.c
+++ b/drivers/clk/meson/g12a-ao.c
@@ -73,7 +73,7 @@ static const struct udevice_id meson_clk_ids[] = {
{ }
 };
 
-U_BOOT_DRIVER(meson_clk_axg) = {
+U_BOOT_DRIVER(meson_clk_g12a_ao) = {
.name   = "meson_clk_g12a_ao",
.id = UCLASS_CLK,
.of_match   = meson_clk_ids,
-- 
2.30.2



[PATCH v3 1/6] clk: meson: add minimal driver for axg-ao clocks

2022-04-24 Thread Vyacheslav Bocharov
Add minimal driver AO clocks on meson AXG family. Only ADC related clocks
are supported.

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Sean Anderson 
Reviewed-by: Neil Armstrong 
---
 drivers/clk/meson/Makefile |  1 +
 drivers/clk/meson/axg-ao.c | 86 ++
 2 files changed, 87 insertions(+)
 create mode 100644 drivers/clk/meson/axg-ao.c

diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index b9c6bd66cf..a486b13e9c 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -5,5 +5,6 @@
 
 obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
 obj-$(CONFIG_CLK_MESON_AXG) += axg.o
+obj-$(CONFIG_CLK_MESON_AXG) += axg-ao.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
diff --git a/drivers/clk/meson/axg-ao.c b/drivers/clk/meson/axg-ao.c
new file mode 100644
index 00..311ffc1cca
--- /dev/null
+++ b/drivers/clk/meson/axg-ao.c
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk_meson.h"
+
+struct meson_clk {
+   struct regmap *map;
+};
+
+#define AO_CLK_GATE0   0x40
+#define AO_SAR_CLK 0x90
+
+static struct meson_gate gates[] = {
+   MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 7),
+   MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 7),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+   struct meson_clk *priv = dev_get_priv(clk->dev);
+   struct meson_gate *gate;
+
+   gate = [clk->id];
+
+   regmap_update_bits(priv->map, gate->reg,
+  BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+   return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+   return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+   return meson_set_gate(clk, false);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+   struct meson_clk *priv = dev_get_priv(dev);
+
+   priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
+   if (IS_ERR(priv->map))
+   return PTR_ERR(priv->map);
+
+   return 0;
+}
+
+static int meson_clk_request(struct clk *clk)
+{
+   if (clk->id >= ARRAY_SIZE(gates))
+   return -ENOENT;
+
+   return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+   .disable= meson_clk_disable,
+   .enable = meson_clk_enable,
+   .request= meson_clk_request,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+   { .compatible = "amlogic,meson-axg-aoclkc" },
+   { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg_ao) = {
+   .name   = "meson_clk_axg_ao",
+   .id = UCLASS_CLK,
+   .of_match   = meson_clk_ids,
+   .priv_auto  = sizeof(struct meson_clk),
+   .ops= _clk_ops,
+   .probe  = meson_clk_probe,
+};
-- 
2.30.2



[PATCH v3 0/6] meson: add clk and adc support for JetHub D1 (j100)

2022-04-24 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 in JetHub D1 (j100) to check the hardware 
revision of the board.

- add support for AXG in saradc driver
- add simple clk-ao driver for AXG (base is taken from g12a)
- enable saradc in dts and board config file
- fix typo in the g12a-clk-ao driver name
- move clk->id check to .request function for g12a-clk-ao driver
- remove unnecessary check (gate->reg == 0) in g12a-clk-ao driver
- enable saradc in dts/board config for JetHub D1 (j100)

>From v2:
- remove unnecessary check (gate->reg == 0) in axg/g12a clk-ao drivers
- move j100 dts changes to -u-boot.dtsi
>From v1:
- move clk-id check to .request function for axg/g12a-ao clk driver


Vyacheslav Bocharov (6):
  clk: meson: add minimal driver for axg-ao clocks
  clk: meson: fix driver name for g12a-ao clocks
  clk: meson: update driver for g12a-ao clocks
  adc: meson-saradc: add AXG variant
  board: amlogic: jethub j100: enable saradc in dts
  board: amlogic: jethub j100: enable saradc in config

 .../meson-axg-jethome-jethub-j100-u-boot.dtsi | 10 +++
 configs/jethub_j100_defconfig |  5 ++
 drivers/adc/meson-saradc.c|  2 +
 drivers/clk/meson/Makefile|  1 +
 drivers/clk/meson/axg-ao.c| 86 +++
 drivers/clk/meson/g12a-ao.c   | 17 ++--
 6 files changed, 114 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100-u-boot.dtsi
 create mode 100644 drivers/clk/meson/axg-ao.c

-- 
2.30.2



[PATCH v2 6/6] board: amlogic: jethub j100: enable saradc in config

2022-04-21 Thread Vyacheslav Bocharov
Enable ADC in board config file

Signed-off-by: Vyacheslav Bocharov 
---
 configs/jethub_j100_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 1c6db9f6a0..a30940bf1c 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -17,6 +17,7 @@ CONFIG_REMAKE_ELF=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+CONFIG_CMD_ADC=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_EEPROM=y
@@ -34,6 +35,10 @@ CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_CLK=y
+CONFIG_CLK_MESON_AXG=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD_UBI=y
 CONFIG_PHY_REALTEK=y
-- 
2.30.2



[PATCH v2 5/6] board: amlogic: jethub j100: enable saradc in dts

2022-04-21 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 to check the hardware revision of the board.

Signed-off-by: Vyacheslav Bocharov 
---
 arch/arm/dts/meson-axg-jethome-jethub-j100.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts 
b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
index 5783732dc6..00a0b268af 100644
--- a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
@@ -359,3 +359,8 @@
  {
#cooling-cells = <2>;
 };
+
+ {
+   status = "okay";
+   vref-supply = <_ao18>;
+};
-- 
2.30.2



[PATCH v2 4/6] adc: meson-saradc: add AXG variant

2022-04-21 Thread Vyacheslav Bocharov
Add support for the SARADC variant found on the AXG SoCs family.

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/adc/meson-saradc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 1a45a3a265..37023512f0 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -737,6 +737,8 @@ static const struct udevice_id meson_saradc_ids[] = {
  .data = (ulong)_saradc_data },
{ .compatible = "amlogic,meson-g12a-saradc",
  .data = (ulong)_saradc_data },
+   { .compatible = "amlogic,meson-axg-saradc",
+ .data = (ulong)_saradc_data },
{ }
 };
 
-- 
2.30.2



[PATCH v2 2/6] clk: meson: fix driver name for g12a-ao clocks

2022-04-21 Thread Vyacheslav Bocharov
Update the clk-g12a-ao driver from "axg" to "g12a"

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/g12a-ao.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
index 0148529e04..17b11eb52a 100644
--- a/drivers/clk/meson/g12a-ao.c
+++ b/drivers/clk/meson/g12a-ao.c
@@ -73,7 +73,7 @@ static const struct udevice_id meson_clk_ids[] = {
{ }
 };
 
-U_BOOT_DRIVER(meson_clk_axg) = {
+U_BOOT_DRIVER(meson_clk_g12a_ao) = {
.name   = "meson_clk_g12a_ao",
.id = UCLASS_CLK,
.of_match   = meson_clk_ids,
-- 
2.30.2



[PATCH v2 3/6] clk: meson: update driver for g12a-ao clocks

2022-04-21 Thread Vyacheslav Bocharov
Move clk->id check to .request function

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/g12a-ao.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
index 17b11eb52a..22c85cff1d 100644
--- a/drivers/clk/meson/g12a-ao.c
+++ b/drivers/clk/meson/g12a-ao.c
@@ -28,9 +28,6 @@ static int meson_set_gate(struct clk *clk, bool on)
struct meson_clk *priv = dev_get_priv(clk->dev);
struct meson_gate *gate;
 
-   if (clk->id >= ARRAY_SIZE(gates))
-   return -ENOENT;
-
gate = [clk->id];
 
if (gate->reg == 0)
@@ -63,9 +60,18 @@ static int meson_clk_probe(struct udevice *dev)
return 0;
 }
 
+static int meson_clk_request(struct clk *clk)
+{
+   if (clk->id >= ARRAY_SIZE(gates))
+   return -ENOENT;
+
+   return 0;
+}
+
 static struct clk_ops meson_clk_ops = {
.disable= meson_clk_disable,
.enable = meson_clk_enable,
+   .request= meson_clk_request,
 };
 
 static const struct udevice_id meson_clk_ids[] = {
-- 
2.30.2



[PATCH v2 1/6] clk: meson: add minimal driver for axg-ao clocks

2022-04-21 Thread Vyacheslav Bocharov
Add minimal driver AO clocks on meson AXG family. Only ADC related clocks
are supported.

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/Makefile |  1 +
 drivers/clk/meson/axg-ao.c | 89 ++
 2 files changed, 90 insertions(+)
 create mode 100644 drivers/clk/meson/axg-ao.c

diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index b9c6bd66cf..a486b13e9c 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -5,5 +5,6 @@
 
 obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
 obj-$(CONFIG_CLK_MESON_AXG) += axg.o
+obj-$(CONFIG_CLK_MESON_AXG) += axg-ao.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
diff --git a/drivers/clk/meson/axg-ao.c b/drivers/clk/meson/axg-ao.c
new file mode 100644
index 00..3f9617e9f7
--- /dev/null
+++ b/drivers/clk/meson/axg-ao.c
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk_meson.h"
+
+struct meson_clk {
+   struct regmap *map;
+};
+
+#define AO_CLK_GATE0   0x40
+#define AO_SAR_CLK 0x90
+
+static struct meson_gate gates[] = {
+   MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 7),
+   MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 7),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+   struct meson_clk *priv = dev_get_priv(clk->dev);
+   struct meson_gate *gate;
+
+   gate = [clk->id];
+
+   if (gate->reg == 0)
+   return 0;
+
+   regmap_update_bits(priv->map, gate->reg,
+  BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+   return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+   return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+   return meson_set_gate(clk, false);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+   struct meson_clk *priv = dev_get_priv(dev);
+
+   priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
+   if (IS_ERR(priv->map))
+   return PTR_ERR(priv->map);
+
+   return 0;
+}
+
+static int meson_clk_request(struct clk *clk)
+{
+   if (clk->id >= ARRAY_SIZE(gates))
+   return -ENOENT;
+
+   return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+   .disable= meson_clk_disable,
+   .enable = meson_clk_enable,
+   .request= meson_clk_request,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+   { .compatible = "amlogic,meson-axg-aoclkc" },
+   { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg_ao) = {
+   .name   = "meson_clk_axg_ao",
+   .id = UCLASS_CLK,
+   .of_match   = meson_clk_ids,
+   .priv_auto  = sizeof(struct meson_clk),
+   .ops= _clk_ops,
+   .probe  = meson_clk_probe,
+};
-- 
2.30.2



[PATCH v2 0/6] meson: add clk and adc support for JetHub D1 (j100)

2022-04-21 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 in JetHub D1 (j100) to check the hardware 
revision of the board.

- add support for AXG in saradc driver
- add simple clk-ao driver for AXG (base is taken from g12a)
- enable saradc in dts and board config file
- fix typo in the g12a-clk-ao driver name
- move clk->id check to .request function for g12a-clk-ao driver
- enable saradc in dts/board config for JetHub D1 (j100)

>From v1:
- move clk-id check to .request function for axg/g12a-ao clk driver

Vyacheslav Bocharov (6):
  clk: meson: add minimal driver for axg-ao clocks
  clk: meson: fix driver name for g12a-ao clocks
  clk: meson: update driver for g12a-ao clocks
  adc: meson-saradc: add AXG variant
  board: amlogic: jethub j100: enable saradc in dts
  board: amlogic: jethub j100: enable saradc in config

 .../arm/dts/meson-axg-jethome-jethub-j100.dts |  5 ++
 configs/jethub_j100_defconfig |  5 ++
 drivers/adc/meson-saradc.c|  2 +
 drivers/clk/meson/Makefile|  1 +
 drivers/clk/meson/axg-ao.c| 89 +++
 drivers/clk/meson/g12a-ao.c   | 14 ++-
 6 files changed, 112 insertions(+), 4 deletions(-)
 create mode 100644 drivers/clk/meson/axg-ao.c

-- 
2.30.2



[PATCH 5/5] board: amlogic: jethub j100: enable saradc in config

2022-04-20 Thread Vyacheslav Bocharov
Enable ADC in board config file

Signed-off-by: Vyacheslav Bocharov 
---
 configs/jethub_j100_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 1c6db9f6a0..a30940bf1c 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -17,6 +17,7 @@ CONFIG_REMAKE_ELF=y
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
+CONFIG_CMD_ADC=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_EEPROM=y
@@ -34,6 +35,10 @@ CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MESON=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_CLK=y
+CONFIG_CLK_MESON_AXG=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD_UBI=y
 CONFIG_PHY_REALTEK=y
-- 
2.30.2



[PATCH 4/5] board: amlogic: jethub j100: enable saradc in dts

2022-04-20 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 to check the hardware revision of the board.

Signed-off-by: Vyacheslav Bocharov 
---
 arch/arm/dts/meson-axg-jethome-jethub-j100.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts 
b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
index 5783732dc6..00a0b268af 100644
--- a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
@@ -359,3 +359,8 @@
  {
#cooling-cells = <2>;
 };
+
+ {
+   status = "okay";
+   vref-supply = <_ao18>;
+};
-- 
2.30.2



[PATCH 3/5] adc: meson-saradc: add AXG variant

2022-04-20 Thread Vyacheslav Bocharov
Add support for the SARADC variant found on the AXG SoCs family.

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/adc/meson-saradc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 1a45a3a265..37023512f0 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -737,6 +737,8 @@ static const struct udevice_id meson_saradc_ids[] = {
  .data = (ulong)_saradc_data },
{ .compatible = "amlogic,meson-g12a-saradc",
  .data = (ulong)_saradc_data },
+   { .compatible = "amlogic,meson-axg-saradc",
+ .data = (ulong)_saradc_data },
{ }
 };
 
-- 
2.30.2



[PATCH 1/5] clk: meson: add minimal driver for axg-ao clocks

2022-04-20 Thread Vyacheslav Bocharov
Add minimal driver AO clocks on meson AXG family. Only ADC related clocks
are supported.

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/Makefile |  1 +
 drivers/clk/meson/axg-ao.c | 83 ++
 2 files changed, 84 insertions(+)
 create mode 100644 drivers/clk/meson/axg-ao.c

diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index b9c6bd66cf..a486b13e9c 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -5,5 +5,6 @@
 
 obj-$(CONFIG_CLK_MESON_GX) += gxbb.o
 obj-$(CONFIG_CLK_MESON_AXG) += axg.o
+obj-$(CONFIG_CLK_MESON_AXG) += axg-ao.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a.o
 obj-$(CONFIG_CLK_MESON_G12A) += g12a-ao.o
diff --git a/drivers/clk/meson/axg-ao.c b/drivers/clk/meson/axg-ao.c
new file mode 100644
index 00..264ec6f0d3
--- /dev/null
+++ b/drivers/clk/meson/axg-ao.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk_meson.h"
+
+struct meson_clk {
+   struct regmap *map;
+};
+
+#define AO_CLK_GATE0   0x40
+#define AO_SAR_CLK 0x90
+
+static struct meson_gate gates[] = {
+   MESON_GATE(CLKID_AO_SAR_ADC, AO_CLK_GATE0, 7),
+   MESON_GATE(CLKID_AO_SAR_ADC_CLK, AO_SAR_CLK, 7),
+};
+
+static int meson_set_gate(struct clk *clk, bool on)
+{
+   struct meson_clk *priv = dev_get_priv(clk->dev);
+   struct meson_gate *gate;
+
+   if (clk->id >= ARRAY_SIZE(gates))
+   return -ENOENT;
+
+   gate = [clk->id];
+
+   if (gate->reg == 0)
+   return 0;
+
+   regmap_update_bits(priv->map, gate->reg,
+  BIT(gate->bit), on ? BIT(gate->bit) : 0);
+
+   return 0;
+}
+
+static int meson_clk_enable(struct clk *clk)
+{
+   return meson_set_gate(clk, true);
+}
+
+static int meson_clk_disable(struct clk *clk)
+{
+   return meson_set_gate(clk, false);
+}
+
+static int meson_clk_probe(struct udevice *dev)
+{
+   struct meson_clk *priv = dev_get_priv(dev);
+
+   priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
+   if (IS_ERR(priv->map))
+   return PTR_ERR(priv->map);
+
+   return 0;
+}
+
+static struct clk_ops meson_clk_ops = {
+   .disable= meson_clk_disable,
+   .enable = meson_clk_enable,
+};
+
+static const struct udevice_id meson_clk_ids[] = {
+   { .compatible = "amlogic,meson-axg-aoclkc" },
+   { }
+};
+
+U_BOOT_DRIVER(meson_clk_axg_ao) = {
+   .name   = "meson_clk_axg_ao",
+   .id = UCLASS_CLK,
+   .of_match   = meson_clk_ids,
+   .priv_auto  = sizeof(struct meson_clk),
+   .ops= _clk_ops,
+   .probe  = meson_clk_probe,
+};
-- 
2.30.2



[PATCH 2/5] clk: meson: fix driver name for g12a-ao clocks

2022-04-20 Thread Vyacheslav Bocharov
Update the clk-g12a-ao driver from "axg" to "g12a"

Signed-off-by: Vyacheslav Bocharov 
---
 drivers/clk/meson/g12a-ao.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c
index 0148529e04..17b11eb52a 100644
--- a/drivers/clk/meson/g12a-ao.c
+++ b/drivers/clk/meson/g12a-ao.c
@@ -73,7 +73,7 @@ static const struct udevice_id meson_clk_ids[] = {
{ }
 };
 
-U_BOOT_DRIVER(meson_clk_axg) = {
+U_BOOT_DRIVER(meson_clk_g12a_ao) = {
.name   = "meson_clk_g12a_ao",
.id = UCLASS_CLK,
.of_match   = meson_clk_ids,
-- 
2.30.2



[PATCH 0/5] meson: add clk and adc support for JetHub D1 (j100)

2022-04-20 Thread Vyacheslav Bocharov
Prepare to use ADC channel 1 in JetHub D1 (j100) to check the hardware 
revision of the board.

- add support for AXG in saradc driver
- add simple clk-ao driver for AXG (base is taken from g12a)
- enable saradc in dts and board config file
- fix typo in the g12a-clk-ao driver name


Vyacheslav Bocharov (5):
  clk: meson: add minimal driver for axg-ao clocks
  clk: meson: fix driver name for g12a-ao clocks
  adc: meson-saradc: add AXG variant
  board: amlogic: jethub j100: enable saradc in dts
  board: amlogic: jethub j100: enable saradc in config

 .../arm/dts/meson-axg-jethome-jethub-j100.dts |  5 ++
 configs/jethub_j100_defconfig |  5 ++
 drivers/adc/meson-saradc.c|  2 +
 drivers/clk/meson/Makefile|  1 +
 drivers/clk/meson/axg-ao.c| 83 +++
 drivers/clk/meson/g12a-ao.c   |  2 +-
 6 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/meson/axg-ao.c

-- 
2.30.2



[PATCH] ARM: amlogic: add JetHub D1 eth mac generation with manufacturer OUI

2021-10-29 Thread Vyacheslav Bocharov
JetHome has own MAC OUI. Add jethub-j100 board file. Update config.

Signed-off-by: Vyacheslav Bocharov 
---
 board/amlogic/jethub-j100/MAINTAINERS   |  8 +
 board/amlogic/jethub-j100/Makefile  |  6 
 board/amlogic/jethub-j100/jethub-j100.c | 41 +
 board/amlogic/jethub-j80/MAINTAINERS|  3 +-
 configs/jethub_j100_defconfig   |  1 +
 5 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100644 board/amlogic/jethub-j100/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j100/Makefile
 create mode 100644 board/amlogic/jethub-j100/jethub-j100.c

diff --git a/board/amlogic/jethub-j100/MAINTAINERS 
b/board/amlogic/jethub-j100/MAINTAINERS
new file mode 100644
index 00..43f6a5fc86
--- /dev/null
+++ b/board/amlogic/jethub-j100/MAINTAINERS
@@ -0,0 +1,8 @@
+JetHome JetHub
+M: Vyacheslav Bocharov 
+S: Maintained
+L: u-boot-amlo...@groups.io
+F: board/amlogic/jethub-j100/
+F: configs/jethub_j100_defconfig
+F: doc/board/amlogic/jethub-j100.rst
+F: include/configs/jethub.h
diff --git a/board/amlogic/jethub-j100/Makefile 
b/board/amlogic/jethub-j100/Makefile
new file mode 100644
index 00..4d935af984
--- /dev/null
+++ b/board/amlogic/jethub-j100/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2021 Vyacheslav Bocharov
+# Author: Vyacheslav Bocharov 
+
+obj-y  := jethub-j100.o
diff --git a/board/amlogic/jethub-j100/jethub-j100.c 
b/board/amlogic/jethub-j100/jethub-j100.c
new file mode 100644
index 00..575bb31573
--- /dev/null
+++ b/board/amlogic/jethub-j100/jethub-j100.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 Vyacheslav Bocharov
+ * Author: Vyacheslav Bocharov 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int misc_init_r(void)
+{
+   u8 mac_addr[ARP_HLEN];
+   char serial[SM_SERIAL_SIZE];
+   u32 sid;
+
+   if (!meson_sm_get_serial(serial, SM_SERIAL_SIZE)) {
+   sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
+   /* Ensure the NIC specific bytes of the mac are not all 0 */
+   if ((sid & 0x) == 0)
+   sid |= 0x80;
+
+   /* OUI registered MAC address */
+   mac_addr[0] = 0x10;
+   mac_addr[1] = 0x27;
+   mac_addr[2] = 0xBE;
+   mac_addr[3] = (sid >> 16) & 0xff;
+   mac_addr[4] = (sid >>  8) & 0xff;
+   mac_addr[5] = (sid >>  0) & 0xff;
+
+   eth_env_set_enetaddr("ethaddr", mac_addr);
+   }
+
+   return 0;
+}
diff --git a/board/amlogic/jethub-j80/MAINTAINERS 
b/board/amlogic/jethub-j80/MAINTAINERS
index 459e9f89da..a899153117 100644
--- a/board/amlogic/jethub-j80/MAINTAINERS
+++ b/board/amlogic/jethub-j80/MAINTAINERS
@@ -4,6 +4,5 @@ S:  Maintained
 L: u-boot-amlo...@groups.io
 F: board/amlogic/jethub-j80/
 F: configs/jethub_j80_defconfig
-F: configs/jethub_j100_defconfig
 F: doc/board/amlogic/jethub-j80.rst
-F: doc/board/amlogic/jethub-j100.rst
+F: include/configs/jethub.h
diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 290ce4db85..ad026a89e0 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_SYS_BOARD="jethub-j100"
 CONFIG_SYS_CONFIG_NAME="jethub"
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x0100
-- 
2.30.2



[PATCH v2] ARM: amlogic: update JetHub D1/H1 configs (was: add SYS_LOAD_ADDR to JetHub D1/H1 configs)

2021-10-06 Thread Vyacheslav Bocharov
- late fix for 49c8ef0e45a91ec894ef15e7d043dafe8f1c5efd commit by Tom Rini.
- enable i2c, rtc, eeprom

Changes:
- add i2c, rtc, eeprom

Signed-off-by: Vyacheslav Bocharov 
---
 configs/jethub_j100_defconfig | 8 
 configs/jethub_j80_defconfig  | 8 
 2 files changed, 16 insertions(+)

diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 290ce4db85..533f251855 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -11,21 +11,27 @@ CONFIG_DEBUG_UART_BASE=0xff803000
 CONFIG_DEBUG_UART_CLOCK=2400
 CONFIG_IDENT_STRING=" jethubj100"
 CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x0100
 CONFIG_OF_BOARD_SETUP=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
+CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPIO=y
 CONFIG_RANDOM_UUID=y
+CONFIG_CMD_I2C=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_RTC=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD_UBI=y
 CONFIG_PHY_REALTEK=y
@@ -37,6 +43,8 @@ CONFIG_PINCTRL_MESON_AXG=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_RESET=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_PCF8563=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
 CONFIG_MESON_SERIAL=y
diff --git a/configs/jethub_j80_defconfig b/configs/jethub_j80_defconfig
index 7db05af3b0..ad6bec0c43 100644
--- a/configs/jethub_j80_defconfig
+++ b/configs/jethub_j80_defconfig
@@ -12,25 +12,31 @@ CONFIG_DEBUG_UART_BASE=0xc81004c0
 CONFIG_DEBUG_UART_CLOCK=2400
 CONFIG_IDENT_STRING=" jethubj80"
 CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x0100
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_CONSOLE_MUX=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_MISC_INIT_R=y
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_IMI is not set
+CONFIG_CMD_EEPROM=y
 CONFIG_CMD_ADC=y
 CONFIG_CMD_GPIO=y
 CONFIG_RANDOM_UUID=y
+CONFIG_CMD_I2C=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_RTC=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_PARTITION_TYPE_GUID=y
 CONFIG_OF_CONTROL=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SARADC_MESON=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MESON=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_MTD_UBI=y
 CONFIG_PHY_MESON_GXL=y
@@ -45,6 +51,8 @@ CONFIG_PINCTRL_MESON_GXL=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_RESET=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_PCF8563=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_DEBUG_UART_SKIP_INIT=y
 CONFIG_MESON_SERIAL=y
-- 
2.30.2



[PATCH] ARM: amlogic: add sm efuse write support and cmd for read/write efuse

2021-10-05 Thread Vyacheslav Bocharov
This adds support for amlogic efuse write and provides two subcommands
of "sm" command: "efuseread" and "efusewrite" to read/write bytes between
memory and efuse.

Signed-off-by: Vyacheslav Bocharov 
---
 arch/arm/mach-meson/sm.c | 68 +++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
index 1a8f23cb1fa..fb437b94d14 100644
--- a/arch/arm/mach-meson/sm.c
+++ b/arch/arm/mach-meson/sm.c
@@ -68,6 +68,26 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, 
size_t size)
return regs.regs[0];
 }
 
+ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size)
+{
+   struct pt_regs regs;
+
+   meson_init_shmem();
+
+memcpy(shmem_input, buffer, size);
+
+   regs.regs[0] = FN_EFUSE_WRITE;
+   regs.regs[1] = offset;
+   regs.regs[2] = size;
+
+   smc_call();
+
+   if (regs.regs[0] == 0)
+   return -1;
+
+   return 0;
+}
+
 #define SM_CHIP_ID_LENGTH  119
 #define SM_CHIP_ID_OFFSET  4
 #define SM_CHIP_ID_SIZE12
@@ -187,9 +207,53 @@ static int do_sm_reboot_reason(struct cmd_tbl *cmdtp, int 
flag, int argc,
return CMD_RET_SUCCESS;
 }
 
+static int do_efuse_read(struct cmd_tbl *cmdtp, int flag, int argc,
+   char *const argv[])
+{
+   ulong address, offset, size;
+   int ret;
+
+   if (argc < 4)
+   return CMD_RET_USAGE;
+
+offset = simple_strtoul(argv[1], NULL, 0);
+size = simple_strtoul(argv[2], NULL, 0);
+
+address = simple_strtoul(argv[3], NULL, 0);
+
+   ret = meson_sm_read_efuse(offset, (void *)address, size);
+   if (ret)
+   return CMD_RET_FAILURE;
+
+   return CMD_RET_SUCCESS;
+}
+
+static int do_efuse_write(struct cmd_tbl *cmdtp, int flag, int argc,
+   char *const argv[])
+{
+   ulong address, offset, size;
+   int ret;
+
+   if (argc < 4)
+   return CMD_RET_USAGE;
+
+offset = simple_strtoul(argv[1], NULL, 0);
+size = simple_strtoul(argv[2], NULL, 0);
+
+address = simple_strtoul(argv[3], NULL, 0);
+
+   ret = meson_sm_write_efuse(offset, (void *)address, size);
+   if (ret)
+   return CMD_RET_FAILURE;
+
+   return CMD_RET_SUCCESS;
+}
+
 static struct cmd_tbl cmd_sm_sub[] = {
U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""),
U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""),
+U_BOOT_CMD_MKENT(efuseread, 4, 1, do_efuse_read, "", ""),
+U_BOOT_CMD_MKENT(efusewrite, 4, 0, do_efuse_write, "", ""),
 };
 
 static int do_sm(struct cmd_tbl *cmdtp, int flag, int argc,
@@ -216,5 +280,7 @@ U_BOOT_CMD(
sm, 5, 0, do_sm,
"Secure Monitor Control",
"serial  - read chip unique id to memory address\n"
-   "sm reboot_reason [name] - get reboot reason and store to to 
environment"
+   "sm reboot_reason [name] - get reboot reason and store to to 
environment\n"
+"sm efuseread- read efuse to memory 
address\n"
+"sm efusewrite- write into efuse from 
memory address"
 );
-- 
2.30.2



[PATCH] ARM: amlogic: add SYS_LOAD_ADDR to JetHub D1/H1 configs

2021-10-05 Thread Vyacheslav Bocharov
Late fix for 49c8ef0e45a91ec894ef15e7d043dafe8f1c5efd commit by Tom Rini.

Signed-off-by: Vyacheslav Bocharov 
---
 configs/jethub_j100_defconfig | 1 +
 configs/jethub_j80_defconfig  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 290ce4db850..25aee5a1471 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_SYS_CONFIG_NAME="jethub"
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x0100
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
diff --git a/configs/jethub_j80_defconfig b/configs/jethub_j80_defconfig
index 7db05af3b0d..524d4cc9b7b 100644
--- a/configs/jethub_j80_defconfig
+++ b/configs/jethub_j80_defconfig
@@ -3,6 +3,7 @@ CONFIG_SYS_BOARD="jethub-j80"
 CONFIG_SYS_CONFIG_NAME="jethub"
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x0100
+CONFIG_SYS_LOAD_ADDR=0x0100
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DM_GPIO=y
-- 
2.30.2



[PATCH v3 2/3] ARM: amlogic: add JetHub D1/H1 device support

2021-09-20 Thread Vyacheslav Bocharov
Add support for new home automation devices.

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Patches from:
- JetHub H1
  https://lore.kernel.org/r/20210915085715.1134940-4-ad...@lexina.in
  https://git.kernel.org/amlogic/c/abfaae24ecf3e7f00508b60fa05e2b6789b8f607
- JetHub D1
  https://lore.kernel.org/r/20210915085715.1134940-5-ad...@lexina.in
  https://git.kernel.org/amlogic/c/8e279fb2903990cc6296ec56b3b80b2f854b6c79

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   9 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 8 files changed, 805 insertions(+)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f0160d2dc0..d1893a9812 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -169,10 +169,12 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxl-s905x-libretech-cc-v2.dtb \
meson-gxl-s905x-khadas-vim.dtb \
meson-gxl-s905d-libretech-pc.dtb \
+   meson-gxl-s905w-jethome-jethub-j80.dtb \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
meson-gxm-wetek-core2.dtb \
meson-axg-s400.dtb \
+   meson-axg-jethome-jethub-j100.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
meson-g12b-gtking.dtb \
diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts 
b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
new file mode 100644
index 00..5783732dc6
--- /dev/null
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
@@ -0,0 +1,361 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Vyacheslav Bocharov 
+ * Copyright (c) 2020 JetHome
+ * Author: Aleksandr Kazantsev 
+ * Author: Alexey Shevelkin 
+ * Author: Vyacheslav Bocharov 
+ */
+
+/dts-v1/;
+
+#include "meson-axg.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "jethome,jethub-j100", "amlogic,a113d", 
"amlogic,meson-axg";
+   model = "JetHome JetHub J100";
+   aliases {
+   serial0 = _AO;   /* Console */
+   serial1 = _AO_B; /* External UART (Wireless Module) */
+   ethernet0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   /* 1024MB RAM */
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x4000>;
+   };
+
+   reserved-memory {
+   linux,cma {
+   size = <0x0 0x40>;
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_9 GPIO_ACTIVE_LOW>;
+   };
+
+   vcc_3v3: regulator-vcc_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3

[PATCH v3 3/3] ARM: amlogic: add JetHub D1/H1 docs

2021-09-20 Thread Vyacheslav Bocharov
Fix doc/board/amlogic/index.rst:
- Add S905W to S905X column.
- Add JetHub devices to the corresponding columns.
- Fix tabs to spaces for table alignment

Add doc/board/amlogic files:
- jethub-j100.rst
- jethub-j80.rst

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Neil Armstrong 
---
 doc/board/amlogic/index.rst   | 128 +++---
 doc/board/amlogic/jethub-j100.rst | 108 +
 doc/board/amlogic/jethub-j80.rst  |  97 ++
 3 files changed, 270 insertions(+), 63 deletions(-)
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 2913ab281a..c18f1b7e71 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -10,69 +10,69 @@ An up-do-date matrix is also available on: 
http://linux-meson.com
 
 This matrix concerns the actual source code version.
 
-+---+---+-+--+++-+--+
-|  | S905  | S905X   | S912 | 
A113X  | S905X2 | S922X   | S905X3   |
-|  |   | S805X   | S905D|  
  | S905D2 | A311D   | S905D3   |
-|  |   | |  |  
  | S905Y2 | |  |
-+===+===+=+==+++=+==+
-| Boards   | Odroid-C2 | P212| Khadas 
VIM2  | S400   | U200   | Odroid-N2   | SEI610   |
-|  | Nanopi-K2 | Khadas-VIM  | Libretech-PC |  
  | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  || GT-King/Pro | Odroid-C4|
-|  | P201  | LibreTech-AC v2 |  |  
  || GSKing-X| Odroid-HC4   |
-|   |   | |  | 
   || | BananaPi-M5  |
-+---+---+-+--+++-+--+
-| UART | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Pinctrl/GPIO | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Clock Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| PWM  | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Reset Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Infrared Decoder | No| No  | No   | 
No | No | No  | No   |
-+---+---+-+--+++-+--+
-| Ethernet | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Multi-core   | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Fuse access  | **Yes**   | **Yes** |**Yes**   
|**Yes** |**Yes** |**Yes**  | **Yes**  |
-+---+---+-+--+++-+--+
-| SPI (FC) | **Yes**   | **Yes** | **Yes**  | 
**Yes**|**Yes

[PATCH v3 0/3] ARM: meson: add support for JetHub D1/H1

2021-09-20 Thread Vyacheslav Bocharov
Add support for new home automation devices manufactured by JetHome.
Patches prepared for use with the "ARM: meson: Sync Amlogic DT from Linux 5.14" 
patch series by Neil Armstrong

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Changes from v2:
- fix "Alignment should match open parenthesis" in 
board/amlogic/jethub-j80/jethub-j80.c
- add missing files to board/amlogic/jethub-j80/MAINTAINERS
- fix unexpected unindent in doc files

Changes from v1:
- fix BOOT_TARGET_DEVICES in jethub.h (patch 1/3)
- add lore URLs to description (patch 2/3)

Signed-off-by: Vyacheslav Bocharov 

Vyacheslav Bocharov (3):
  ARM: amlogic: add JetHub common config header
  ARM: amlogic: add JetHub D1/H1 device support
  ARM: amlogic: add JetHub D1/H1 docs

 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   9 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 doc/board/amlogic/index.rst   | 128 ---
 doc/board/amlogic/jethub-j100.rst | 108 ++
 doc/board/amlogic/jethub-j80.rst  |  97 +
 include/configs/jethub.h  |  40 ++
 12 files changed, 1115 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst
 create mode 100644 include/configs/jethub.h

-- 
2.30.2



[PATCH v3 1/3] ARM: amlogic: add JetHub common config header

2021-09-20 Thread Vyacheslav Bocharov
JetHub devices uses its own boot sequence with "rescue" button

Signed-off-by: Vyacheslav Bocharov 
---
 include/configs/jethub.h | 40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/configs/jethub.h

diff --git a/include/configs/jethub.h b/include/configs/jethub.h
new file mode 100644
index 00..35f85095ac
--- /dev/null
+++ b/include/configs/jethub.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for JetHome devices
+ * Copyright (C) 2021 Vyacheslav Bocharov
+ * Author: Vyacheslav Bocharov 
+ */
+
+#ifndef __JETHUB_CONFIG_H
+#define __JETHUB_CONFIG_H
+
+#if defined(CONFIG_MESON_AXG)
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if gpio input 10; then " \
+   "run bootcmd_usb0;" \
+   "fi;\0"
+#else
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if test \"${userbutton}\" = \"true\"; then " \
+   "run bootcmd_mmc0; " \
+   "fi;\0"
+#endif
+
+#define BOOTENV_DEV_NAME_RESCUE(devtypeu, devtypel, instance) \
+   "rescue "
+
+#ifndef BOOT_TARGET_DEVICES
+#define BOOT_TARGET_DEVICES(func) \
+   func(RESCUE, rescue, na) \
+   func(MMC, mmc, 1) \
+   func(MMC, mmc, 0) \
+   BOOT_TARGET_DEVICES_USB(func) \
+   func(PXE, pxe, na) \
+   func(DHCP, dhcp, na)
+#endif
+
+#include 
+
+#endif /* __JETHUB_CONFIG_H */
-- 
2.30.2



[PATCH v2 3/3] ARM: amlogic: add JetHub D1/H1 docs

2021-09-19 Thread Vyacheslav Bocharov
Fix doc/board/amlogic/index.rst:
- Add S905W to S905X column.
- Add JetHub devices to the corresponding columns.
- Fix tabs to spaces for table alignment

Add doc/board/amlogic files:
- jethub-j100.rst
- jethub-j80.rst

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Neil Armstrong 
---
 doc/board/amlogic/index.rst   | 128 +++---
 doc/board/amlogic/jethub-j100.rst | 108 +
 doc/board/amlogic/jethub-j80.rst  |  97 ++
 3 files changed, 270 insertions(+), 63 deletions(-)
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 2913ab281a..c18f1b7e71 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -10,69 +10,69 @@ An up-do-date matrix is also available on: 
http://linux-meson.com
 
 This matrix concerns the actual source code version.
 
-+---+---+-+--+++-+--+
-|  | S905  | S905X   | S912 | 
A113X  | S905X2 | S922X   | S905X3   |
-|  |   | S805X   | S905D|  
  | S905D2 | A311D   | S905D3   |
-|  |   | |  |  
  | S905Y2 | |  |
-+===+===+=+==+++=+==+
-| Boards   | Odroid-C2 | P212| Khadas 
VIM2  | S400   | U200   | Odroid-N2   | SEI610   |
-|  | Nanopi-K2 | Khadas-VIM  | Libretech-PC |  
  | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  || GT-King/Pro | Odroid-C4|
-|  | P201  | LibreTech-AC v2 |  |  
  || GSKing-X| Odroid-HC4   |
-|   |   | |  | 
   || | BananaPi-M5  |
-+---+---+-+--+++-+--+
-| UART | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Pinctrl/GPIO | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Clock Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| PWM  | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Reset Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Infrared Decoder | No| No  | No   | 
No | No | No  | No   |
-+---+---+-+--+++-+--+
-| Ethernet | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Multi-core   | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Fuse access  | **Yes**   | **Yes** |**Yes**   
|**Yes** |**Yes** |**Yes**  | **Yes**  |
-+---+---+-+--+++-+--+
-| SPI (FC) | **Yes**   | **Yes** | **Yes**  | 
**Yes**|**Yes

[PATCH v2 2/3] ARM: amlogic: add JetHub D1/H1 device support

2021-09-19 Thread Vyacheslav Bocharov
Add support for new home automation devices.

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Patches from:
- JetHub H1
  https://lore.kernel.org/r/20210915085715.1134940-4-ad...@lexina.in
  https://git.kernel.org/amlogic/c/abfaae24ecf3e7f00508b60fa05e2b6789b8f607
- JetHub D1
  https://lore.kernel.org/r/20210915085715.1134940-5-ad...@lexina.in
  https://git.kernel.org/amlogic/c/8e279fb2903990cc6296ec56b3b80b2f854b6c79

Signed-off-by: Vyacheslav Bocharov 
Reviewed-by: Neil Armstrong 
---
 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   6 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 8 files changed, 802 insertions(+)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f0160d2dc0..d1893a9812 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -169,10 +169,12 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxl-s905x-libretech-cc-v2.dtb \
meson-gxl-s905x-khadas-vim.dtb \
meson-gxl-s905d-libretech-pc.dtb \
+   meson-gxl-s905w-jethome-jethub-j80.dtb \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
meson-gxm-wetek-core2.dtb \
meson-axg-s400.dtb \
+   meson-axg-jethome-jethub-j100.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
meson-g12b-gtking.dtb \
diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts 
b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
new file mode 100644
index 00..5783732dc6
--- /dev/null
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
@@ -0,0 +1,361 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Vyacheslav Bocharov 
+ * Copyright (c) 2020 JetHome
+ * Author: Aleksandr Kazantsev 
+ * Author: Alexey Shevelkin 
+ * Author: Vyacheslav Bocharov 
+ */
+
+/dts-v1/;
+
+#include "meson-axg.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "jethome,jethub-j100", "amlogic,a113d", 
"amlogic,meson-axg";
+   model = "JetHome JetHub J100";
+   aliases {
+   serial0 = _AO;   /* Console */
+   serial1 = _AO_B; /* External UART (Wireless Module) */
+   ethernet0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   /* 1024MB RAM */
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x4000>;
+   };
+
+   reserved-memory {
+   linux,cma {
+   size = <0x0 0x40>;
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_9 GPIO_ACTIVE_LOW>;
+   };
+
+   vcc_3v3: regulator-vcc_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3

[PATCH v2 0/3] ARM: meson: add support for JetHub D1/H1

2021-09-19 Thread Vyacheslav Bocharov
Add support for new home automation devices manufactured by JetHome.
Patches prepared for use with the "ARM: meson: Sync Amlogic DT from Linux 5.14" 
patch series by Neil Armstrong

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Changes from v1:
- fix BOOT_TARGET_DEVICES in jethub.h (patch 1/3)
- add lore URLs to description (patch 2/3)

Signed-off-by: Vyacheslav Bocharov 

Vyacheslav Bocharov (3):
  ARM: amlogic: add JetHub common config header
  ARM: amlogic: add JetHub D1/H1 device support
  ARM: amlogic: add JetHub D1/H1 docs

 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   6 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 doc/board/amlogic/index.rst   | 128 ---
 doc/board/amlogic/jethub-j100.rst | 108 ++
 doc/board/amlogic/jethub-j80.rst  |  97 +
 include/configs/jethub.h  |  40 ++
 12 files changed, 1112 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst
 create mode 100644 include/configs/jethub.h

-- 
2.30.2



[PATCH v2 1/3] ARM: amlogic: add JetHub common config header

2021-09-19 Thread Vyacheslav Bocharov
JetHub devices uses its own boot sequence with "rescue" button

Signed-off-by: Vyacheslav Bocharov 
---
 include/configs/jethub.h | 40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/configs/jethub.h

diff --git a/include/configs/jethub.h b/include/configs/jethub.h
new file mode 100644
index 00..35f85095ac
--- /dev/null
+++ b/include/configs/jethub.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for JetHome devices
+ * Copyright (C) 2021 Vyacheslav Bocharov
+ * Author: Vyacheslav Bocharov 
+ */
+
+#ifndef __JETHUB_CONFIG_H
+#define __JETHUB_CONFIG_H
+
+#if defined(CONFIG_MESON_AXG)
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if gpio input 10; then " \
+   "run bootcmd_usb0;" \
+   "fi;\0"
+#else
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if test \"${userbutton}\" = \"true\"; then " \
+   "run bootcmd_mmc0; " \
+   "fi;\0"
+#endif
+
+#define BOOTENV_DEV_NAME_RESCUE(devtypeu, devtypel, instance) \
+   "rescue "
+
+#ifndef BOOT_TARGET_DEVICES
+#define BOOT_TARGET_DEVICES(func) \
+   func(RESCUE, rescue, na) \
+   func(MMC, mmc, 1) \
+   func(MMC, mmc, 0) \
+   BOOT_TARGET_DEVICES_USB(func) \
+   func(PXE, pxe, na) \
+   func(DHCP, dhcp, na)
+#endif
+
+#include 
+
+#endif /* __JETHUB_CONFIG_H */
-- 
2.30.2



[PATCH 2/3] ARM: amlogic: add JetHub D1/H1 device support

2021-09-19 Thread Vyacheslav Bocharov
Add support for new home automation devices.

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Patches from:
- JetHub H1
  https://git.kernel.org/amlogic/c/abfaae24ecf3e7f00508b60fa05e2b6789b8f607
- JetHub D1
  https://git.kernel.org/amlogic/c/8e279fb2903990cc6296ec56b3b80b2f854b6c79

Signed-off-by: Vyacheslav Bocharov 
---
 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   6 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 8 files changed, 802 insertions(+)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f0160d2dc0..d1893a9812 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -169,10 +169,12 @@ dtb-$(CONFIG_ARCH_MESON) += \
meson-gxl-s905x-libretech-cc-v2.dtb \
meson-gxl-s905x-khadas-vim.dtb \
meson-gxl-s905d-libretech-pc.dtb \
+   meson-gxl-s905w-jethome-jethub-j80.dtb \
meson-gxm-khadas-vim2.dtb \
meson-gxm-s912-libretech-pc.dtb \
meson-gxm-wetek-core2.dtb \
meson-axg-s400.dtb \
+   meson-axg-jethome-jethub-j100.dtb \
meson-g12a-u200.dtb \
meson-g12a-sei510.dtb \
meson-g12b-gtking.dtb \
diff --git a/arch/arm/dts/meson-axg-jethome-jethub-j100.dts 
b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
new file mode 100644
index 00..5783732dc6
--- /dev/null
+++ b/arch/arm/dts/meson-axg-jethome-jethub-j100.dts
@@ -0,0 +1,361 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Vyacheslav Bocharov 
+ * Copyright (c) 2020 JetHome
+ * Author: Aleksandr Kazantsev 
+ * Author: Alexey Shevelkin 
+ * Author: Vyacheslav Bocharov 
+ */
+
+/dts-v1/;
+
+#include "meson-axg.dtsi"
+#include 
+#include 
+
+/ {
+   compatible = "jethome,jethub-j100", "amlogic,a113d", 
"amlogic,meson-axg";
+   model = "JetHome JetHub J100";
+   aliases {
+   serial0 = _AO;   /* Console */
+   serial1 = _AO_B; /* External UART (Wireless Module) */
+   ethernet0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   /* 1024MB RAM */
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x0 0x0 0x4000>;
+   };
+
+   reserved-memory {
+   linux,cma {
+   size = <0x0 0x40>;
+   };
+   };
+
+   emmc_pwrseq: emmc-pwrseq {
+   compatible = "mmc-pwrseq-emmc";
+   reset-gpios = < BOOT_9 GPIO_ACTIVE_LOW>;
+   };
+
+   vcc_3v3: regulator-vcc_3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "VCC_3V3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_3v3>;
+   regulator-always-on;
+   };
+
+   vcc_5v: regulator-vcc_5v {
+   compatible = "regulator-fixed";
+   regulator-n

[PATCH 3/3] ARM: amlogic: add JetHub D1/H1 docs

2021-09-19 Thread Vyacheslav Bocharov
Fix doc/board/amlogic/index.rst:
- Add S905W to S905X column.
- Add JetHub devices to the corresponding columns.
- Fix tabs to spaces for table alignment

Add doc/board/amlogic files:
- jethub-j100.rst
- jethub-j80.rst

Signed-off-by: Vyacheslav Bocharov 
---
 doc/board/amlogic/index.rst   | 128 +++---
 doc/board/amlogic/jethub-j100.rst | 108 +
 doc/board/amlogic/jethub-j80.rst  |  97 ++
 3 files changed, 270 insertions(+), 63 deletions(-)
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst

diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst
index 2913ab281a..c18f1b7e71 100644
--- a/doc/board/amlogic/index.rst
+++ b/doc/board/amlogic/index.rst
@@ -10,69 +10,69 @@ An up-do-date matrix is also available on: 
http://linux-meson.com
 
 This matrix concerns the actual source code version.
 
-+---+---+-+--+++-+--+
-|  | S905  | S905X   | S912 | 
A113X  | S905X2 | S922X   | S905X3   |
-|  |   | S805X   | S905D|  
  | S905D2 | A311D   | S905D3   |
-|  |   | |  |  
  | S905Y2 | |  |
-+===+===+=+==+++=+==+
-| Boards   | Odroid-C2 | P212| Khadas 
VIM2  | S400   | U200   | Odroid-N2   | SEI610   |
-|  | Nanopi-K2 | Khadas-VIM  | Libretech-PC |  
  | SEI510 | Khadas-VIM3 | Khadas-VIM3L |
-|  | P200  | LibreTech-CC v1 | WeTek Core2  |  
  || GT-King/Pro | Odroid-C4|
-|  | P201  | LibreTech-AC v2 |  |  
  || GSKing-X| Odroid-HC4   |
-|   |   | |  | 
   || | BananaPi-M5  |
-+---+---+-+--+++-+--+
-| UART | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Pinctrl/GPIO | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Clock Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| PWM  | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Reset Control| **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Infrared Decoder | No| No  | No   | 
No | No | No  | No   |
-+---+---+-+--+++-+--+
-| Ethernet | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Multi-core   | **Yes**   | **Yes** | **Yes**  | 
**Yes**| **Yes**| **Yes** | **Yes**  |
-+---+---+-+--+++-+--+
-| Fuse access  | **Yes**   | **Yes** |**Yes**   
|**Yes** |**Yes** |**Yes**  | **Yes**  |
-+---+---+-+--+++-+--+
-| SPI (FC) | **Yes**   | **Yes** | **Yes**  | 
**Yes**|**Yes** | **Yes

[PATCH 0/3] ARM: meson: add support for JetHub D1/H1

2021-09-19 Thread Vyacheslav Bocharov
Add support for new home automation devices manufactured by JetHome.
Patches prepared for use with the "ARM: meson: Sync Amlogic DT from Linux 5.14" 
patch series by Neil Armstrong

JetHome Jethub D1 (http://jethome.ru/jethub-d1) is a home automation controller 
with the following features:
- DIN Rail Mounting case
- Amlogic A113X (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 512Mb/1GB DDR3
- 8/16GB eMMC flash
- 1 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth AMPAK AP6255 (Broadcom BCM43455) IEEE 802.11a/b/g/n/ac, 
Bluetooth 4.2.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- 2 x gpio LEDS
- GPIO user Button
- 1 x 1-Wire
- 2 x RS-485
- 4 x dry contact digital GPIO inputs
- 3 x relay GPIO outputs
- DC source with a voltage of 9 to 56 V / Passive POE

JetHome Jethub H1 (http://jethome.ru/jethub-h1) is a home automation controller 
with the following features:
- Square plastic case
- Amlogic S905W (ARM Cortex-A53) quad-core up to 1.5GHz
- no video out
- 1GB DDR3
- 8/16GB eMMC flash
- 2 x USB 2.0
- 1 x 10/100Mbps ethernet
- WiFi / Bluetooth RTL8822CS IEEE 802.11a/b/g/n/ac, Bluetooth 5.0.
- TI CC2538 + CC2592 Zigbee Wireless Module with up to 20dBm output power and 
Zigbee 3.0 support.
- MicroSD 2.x/3.x/4.x DS/HS cards.
- 1 x gpio LED
- ADC user Button
- DC source 5V microUSB with serial console

Signed-off-by: Vyacheslav Bocharov 

Vyacheslav Bocharov (3):
  ARM: amlogic: add JetHub common config header
  ARM: amlogic: add JetHub D1/H1 device support
  ARM: amlogic: add JetHub D1/H1 docs

 arch/arm/dts/Makefile |   2 +
 .../arm/dts/meson-axg-jethome-jethub-j100.dts | 361 ++
 .../meson-gxl-s905w-jethome-jethub-j80.dts| 241 
 board/amlogic/jethub-j80/MAINTAINERS  |   6 +
 board/amlogic/jethub-j80/Makefile |   6 +
 board/amlogic/jethub-j80/jethub-j80.c |  68 
 configs/jethub_j100_defconfig |  55 +++
 configs/jethub_j80_defconfig  |  63 +++
 doc/board/amlogic/index.rst   | 128 ---
 doc/board/amlogic/jethub-j100.rst | 108 ++
 doc/board/amlogic/jethub-j80.rst  |  97 +
 include/configs/jethub.h  |  40 ++
 12 files changed, 1112 insertions(+), 63 deletions(-)
 create mode 100644 arch/arm/dts/meson-axg-jethome-jethub-j100.dts
 create mode 100644 arch/arm/dts/meson-gxl-s905w-jethome-jethub-j80.dts
 create mode 100644 board/amlogic/jethub-j80/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j80/Makefile
 create mode 100644 board/amlogic/jethub-j80/jethub-j80.c
 create mode 100644 configs/jethub_j100_defconfig
 create mode 100644 configs/jethub_j80_defconfig
 create mode 100644 doc/board/amlogic/jethub-j100.rst
 create mode 100644 doc/board/amlogic/jethub-j80.rst
 create mode 100644 include/configs/jethub.h

-- 
2.30.2



[PATCH 1/3] ARM: amlogic: add JetHub common config header

2021-09-19 Thread Vyacheslav Bocharov
JetHub devices uses its own boot sequence with "rescue" button.
Add custom config header file that corrects boot order.

Signed-off-by: Vyacheslav Bocharov 
---
 include/configs/jethub.h | 40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/configs/jethub.h

diff --git a/include/configs/jethub.h b/include/configs/jethub.h
new file mode 100644
index 00..09264f91a5
--- /dev/null
+++ b/include/configs/jethub.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for JetHome devices
+ * Copyright (C) 2021 Vyacheslav Bocharov
+ * Author: Vyacheslav Bocharov 
+ */
+
+#ifndef __JETHUB_CONFIG_H
+#define __JETHUB_CONFIG_H
+
+#if defined(CONFIG_MESON_AXG)
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if gpio input 10; then " \
+   "run bootcmd_usb0;" \
+   "fi;\0"
+#else
+#define BOOTENV_DEV_RESCUE(devtypeu, devtypel, instance) \
+   "bootcmd_rescue=" \
+   "if test \"${userbutton}\" = \"true\"; then " \
+   "run bootcmd_mmc0; " \
+   "fi;\0"
+#endif
+
+#define BOOTENV_DEV_NAME_RESCUE(devtypeu, devtypel, instance) \
+   "rescue "
+
+#ifndef BOOT_TARGET_DEVICES
+#define BOOT_TARGET_DEVICES(func) \
+   func(RESCUE, mmc, 1) \
+   func(MMC, mmc, 1) \
+   func(MMC, mmc, 0) \
+   BOOT_TARGET_DEVICES_USB(func) \
+   func(PXE, pxe, na) \
+   func(DHCP, dhcp, na)
+#endif
+
+#include 
+
+#endif /* __JETHUB_CONFIG_H */
-- 
2.30.2