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 00000000000..3ecb233f8e2 --- /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 + */ + +&saradc { + status = "okay"; + vref-supply = <&vddio_ao18>; +}; diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig index 1c6db9f6a0d..a30940bf1ce 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 diff --git a/doc/board/amlogic/index.rst b/doc/board/amlogic/index.rst index 9ef14404331..9c7fadf2c02 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** | +-------------------------------+-----------+-----------------+--------------+-------------+------------+-------------+--------------+ diff --git a/doc/board/amlogic/jethub-j100.rst b/doc/board/amlogic/jethub-j100.rst index d54519aaefb..dd1ed68b9ce 100644 --- a/doc/board/amlogic/jethub-j100.rst +++ b/doc/board/amlogic/jethub-j100.rst @@ -3,27 +3,33 @@ 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 ------------------ diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c index 1a45a3a2655..37023512f0d 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)&gxl_saradc_data }, { .compatible = "amlogic,meson-g12a-saradc", .data = (ulong)&gxl_saradc_data }, + { .compatible = "amlogic,meson-axg-saradc", + .data = (ulong)&gxl_saradc_data }, { } }; diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile index b9c6bd66cfa..a486b13e9ce 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 00000000000..311ffc1cca9 --- /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 = &gates[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 = &meson_clk_ops, + .probe = meson_clk_probe, +}; diff --git a/drivers/clk/meson/g12a-ao.c b/drivers/clk/meson/g12a-ao.c index 0148529e04f..1a855a68966 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 = &gates[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[] = { @@ -73,7 +76,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,