Skip to contentSkip to conversation

power: as3722: Allow using on any i2c bus with any address

PATCH Superseded Julian Scheel 2 participants 3 messages Mar 1, 2016

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 power: as3722: Allow using on any i2c bus with any address

From: Alban Bedel <[email protected]>

The init simply hardcoded the i2c bus and address to those used on jetson. Extend the init function to take the bus number and device address as parameter. As only jetson is using this code for now just fix this single use of the function.

---
Changes in v2:
- add signed off by me

---
 arch/arm/mach-tegra/board2.c         | 2 +-
 board/nvidia/jetson-tk1/jetson-tk1.c | 2 +-
 drivers/power/as3722.c               | 4 +---
 include/power/as3722.h               | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-tegra/board2.c +1 -1
index ac274e1..55c50df 100644
@@ -148,7 +148,7 @@ int board_init(void)
 #  endif
 # endif /* CONFIG_TEGRA_PMU */
 #ifdef CONFIG_AS3722_POWER
-	err = as3722_init(NULL);
+	err = as3722_init(NULL, 0, 0x40);
 	if (err && err != -ENODEV)
 		return err;
 #endif
board/nvidia/jetson-tk1/jetson-tk1.c +1 -1
index 14f0ce5..7f16a4a 100644
@@ -39,7 +39,7 @@ int tegra_pcie_board_init(void)
 	struct udevice *pmic;
 	int err;
 
-	err = as3722_init(&pmic);
+	err = as3722_init(&pmic, 0, 0x40);
 	if (err) {
 		error("failed to initialize AS3722 PMIC: %d\n", err);
 		return err;
drivers/power/as3722.c +1 -3
index c09e1de..321d65d 100644
@@ -243,12 +243,10 @@ int as3722_get(struct udevice **devp)
 	return i2c_get_chip_for_busnum(bus, address, 1, devp);
 }
 
-int as3722_init(struct udevice **devp)
+int as3722_init(struct udevice **devp, unsigned int bus, unsigned int address)
 {
 	struct udevice *pmic;
 	u8 id, revision;
-	const unsigned int bus = 0;
-	const unsigned int address = 0x40;
 	int err;
 
 	err = i2c_get_chip_for_busnum(bus, address, 1, &pmic);
include/power/as3722.h +1 -1
index 0f22482..c37b43a 100644
@@ -14,7 +14,7 @@
 
 struct udevice;
 
-int as3722_init(struct udevice **devp);
+int as3722_init(struct udevice **devp, unsigned int bus, unsigned int address);
 int as3722_sd_enable(struct udevice *pmic, unsigned int sd);
 int as3722_sd_set_voltage(struct udevice *pmic, unsigned int sd, u8 value);
 int as3722_ldo_enable(struct udevice *pmic, unsigned int ldo);
Signature · 1 line
2.7.1
#1 lore raw

PATCH v2 2/2 Add support the Avionic Design Meerkat COM and Kein Baseboard

Add support for platforms based on the Meerkat COM module. Includes support for the minimal reference platform called Kein Baseboard, which in fact is sufficient to run most existing Meerkat carriers.

---
Changes in v2:
- Rename config options to TARGET_KEIN_BASEBOARD
- Remove unnecessary CONFIG options from kein-baseboard.h
- Remove bad as3722 gpio manipulations on pcie init
- Add clocks to meerkat dtsi, as it was removed from tegra124-dtsi lately

---
 arch/arm/dts/Makefile                              |   1 +
 arch/arm/dts/tegra124-kein-baseboard.dts           |  66 ++++
 arch/arm/dts/tegra124-meerkat.dtsi                 | 408 +++++++++++++++++++++
 arch/arm/mach-tegra/tegra124/Kconfig               |   9 +
 board/avionic-design/common/meerkat.c              |  70 ++++
 .../avionic-design/common/pinmux-config-meerkat.h  | 233 ++++++++++++
 board/avionic-design/kein-baseboard/Kconfig        |  15 +
 board/avionic-design/kein-baseboard/MAINTAINERS    |   7 +
 board/avionic-design/kein-baseboard/Makefile       |   9 +
 configs/kein-baseboard_defconfig                   |  21 ++
 include/configs/kein-baseboard.h                   |  74 ++++
 11 files changed, 913 insertions(+)
 create mode 100644 arch/arm/dts/tegra124-kein-baseboard.dts
 create mode 100644 arch/arm/dts/tegra124-meerkat.dtsi
 create mode 100644 board/avionic-design/common/meerkat.c
 create mode 100644 board/avionic-design/common/pinmux-config-meerkat.h
 create mode 100644 board/avionic-design/kein-baseboard/Kconfig
 create mode 100644 board/avionic-design/kein-baseboard/MAINTAINERS
 create mode 100644 board/avionic-design/kein-baseboard/Makefile
 create mode 100644 configs/kein-baseboard_defconfig
 create mode 100644 include/configs/kein-baseboard.h
arch/arm/dts/Makefile +1 -0
index b574284..5452e69 100644
@@ -41,6 +41,7 @@ dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra30-tec-ng.dtb \
 	tegra114-dalmore.dtb \
 	tegra124-jetson-tk1.dtb \
+	tegra124-kein-baseboard.dtb \
 	tegra124-nyan-big.dtb \
 	tegra124-venice2.dtb \
 	tegra210-e2220-1170.dtb \
arch/arm/dts/tegra124-kein-baseboard.dts new file +66 -0

66 lines not on this page · raw message

arch/arm/dts/tegra124-meerkat.dtsi new file +408 -0

408 lines not on this page · raw message

arch/arm/mach-tegra/tegra124/Kconfig +9 -0
index f3324ff..dd65d5d 100644
@@ -21,6 +21,14 @@ config TARGET_NYAN_BIG
 config TARGET_VENICE2
 	bool "NVIDIA Tegra124 Venice2"
 
+config TARGET_KEIN_BASEBOARD
+	bool "Avionic Design Kein Baseboard"
+	select CPU_V7_HAS_NONSEC if !SPL_BUILD
+	select CPU_V7_HAS_VIRT if !SPL_BUILD
+	help
+	  Minimal baseboard for Avionic Design Meerkat COM. Should work with most
+	  baseboard that follow the reference design.
+
 endchoice
 
 config SYS_SOC
@@ -29,5 +37,6 @@ config SYS_SOC
 source "board/nvidia/jetson-tk1/Kconfig"
 source "board/nvidia/nyan-big/Kconfig"
 source "board/nvidia/venice2/Kconfig"
+source "board/avionic-design/kein-baseboard/Kconfig"
 
 endif
board/avionic-design/common/meerkat.c new file +70 -0

70 lines not on this page · raw message

board/avionic-design/common/pinmux-config-meerkat.h new file +233 -0

233 lines not on this page · raw message

board/avionic-design/kein-baseboard/Kconfig new file +15 -0
new file mode 100644
index 0000000..a185a54
@@ -0,0 +1,15 @@
+if TARGET_KEIN_BASEBOARD
+
+config SYS_BOARD
+	string
+	default "kein-baseboard"
+
+config SYS_VENDOR
+	string
+	default "avionic-design"
+
+config SYS_CONFIG_NAME
+	string
+	default "kein-baseboard"
+
+endif
board/avionic-design/kein-baseboard/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..4fa20a9
@@ -0,0 +1,7 @@
+Kein Baseboard
+M:	Julian Scheel <[email protected]>
+M:	Alban Bedel <[email protected]>
+S:	Maintained
+F:	board/avionic-design/kein-baseboard
+F:	include/configs/kein-baseboard.h
+F:	configs/kein-baseboard_defconfig
board/avionic-design/kein-baseboard/Makefile new file +9 -0
new file mode 100644
index 0000000..59760f6
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2015
+# Avionic Design GmbH <www.avionic-design.de>
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y	+= ../../nvidia/venice2/as3722_init.o
+obj-y	+= ../common/meerkat.o
configs/kein-baseboard_defconfig new file +21 -0
new file mode 100644
index 0000000..0a1f8b0
@@ -0,0 +1,21 @@
+CONFIG_ARM=y
+CONFIG_TEGRA=y
+CONFIG_SPL_DM=y
+CONFIG_TEGRA124=y
+CONFIG_TARGET_KEIN_BASEBOARD=y
+CONFIG_DEFAULT_DEVICE_TREE="tegra124-kein-baseboard"
+CONFIG_SYS_PROMPT="Tegra124 (kein-baseboard) # "
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NFS is not set
+CONFIG_PCI_TEGRA=y
+CONFIG_SYS_NS16550=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_RADOM_UUID=y
include/configs/kein-baseboard.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
2.7.1
#2 lore raw

PATCH v2 2/2 Add support the Avionic Design Meerkat COM and Kein Baseboard

Quoted 10 lines · Julian Scheel

Add support for platforms based on the Meerkat COM module. Includes support for the minimal reference platform called Kein Baseboard, which in fact is sufficient to run most existing Meerkat carriers.

---
Changes in v2:
- Rename config options to TARGET_KEIN_BASEBOARD
- Remove unnecessary CONFIG options from kein-baseboard.h
- Remove bad as3722 gpio manipulations on pcie init

I think that point didn't actually happen:

Quoted 6 lines
board/avionic-design/common/meerkat.c +3 -0
 
+int tegra_pcie_board_init(void)
 
+	err = as3722_gpio_configure(pmic, 1, AS3722_GPIO_OUTPUT_VDDH |
+					     AS3722_GPIO_INVERT);

board/avionic-design/common/meerkat.c line 66

Quoted 10 lines
board/avionic-design/common/meerkat.c +10 -0
+	if (err < 0) {
+		error("failed to configure GPIO#1 as output: %d\n", err);
+		return err;
+	}
+
+	err = as3722_gpio_direction_output(pmic, 2, 1);
+	if (err < 0) {
+		error("failed to set GPIO#2 high: %d\n", err);
+		return err;
+	}

Aside from that, the series,