Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions arch/arm64/boot/dts/exynos/google/zuma-husky.dts
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,22 @@
};
};
};

/*
* The battery pack's EEPROM on USI9 / hsi2c_9 (stock: "at,24c08" at 0x50 on
* a 400 kHz bus, in the pack and powered by it). Byte 0x17 is the battery ID
* that Google's driver matches against the gauge models; the rest is the
* pack's part number, dates and history, so it is read-only here. The bus
* and USI9 stay disabled; a bring-up overlay enables them. Nothing reads the
* ID into the gauge yet.
*/
&hsi2c_9 {
clock-frequency = <400000>;

eeprom@50 {
compatible = "atmel,24c08";
reg = <0x50>;
pagesize = <16>;
read-only;
};
};
8 changes: 8 additions & 0 deletions arch/arm64/boot/dts/exynos/google/zuma-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,14 @@
samsung,pin-drv = <GS101_PIN_DRV_2_5_MA>;
};

/* USI9, the battery pack EEPROM's bus: gpp19-4/5, no pull as in stock. */
hsi2c9_bus: hsi2c9-bus-pins {
samsung,pins = "gpp19-4", "gpp19-5";
samsung,pin-function = <GS101_PIN_FUNC_2>;
samsung,pin-pud = <GS101_PIN_PULL_NONE>;
samsung,pin-drv = <GS101_PIN_DRV_2_5_MA>;
};

/*
* USI11, the battery bus: stock's board file moves it to gpp21-0/1 and
* sets no pull, then zuma-typec.dtsi, applied after it, sets the
Expand Down
30 changes: 30 additions & 0 deletions arch/arm64/boot/dts/exynos/google/zuma.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,36 @@
status = "disabled";
};

usi9: usi@10c900c0 {
compatible = "google,zuma-usi", "samsung,exynos850-usi";
reg = <0x10c900c0 0x20>;
clocks = <&cmu_peric1 CLK_GOUT_PERIC1_USI9_PCLK>,
<&cmu_peric1 CLK_GOUT_PERIC1_USI9_IPCLK>;
clock-names = "pclk", "ipclk";
samsung,sysreg = <&sysreg_peric1 0x4>;
samsung,mode = <USI_MODE_I2C>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
status = "disabled";

hsi2c_9: i2c@10c90000 {
compatible = "google,zuma-hsi2c",
"samsung,exynosautov9-hsi2c";
/* USI control starts at 0xc0; do not claim it twice. */
reg = <0x10c90000 0xc0>;
interrupts = <GIC_SPI 657 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cmu_peric1 CLK_GOUT_PERIC1_USI9_IPCLK>,
<&cmu_peric1 CLK_GOUT_PERIC1_USI9_PCLK>;
clock-names = "hsi2c", "hsi2c_pclk";
pinctrl-0 = <&hsi2c9_bus>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
};

usi11: usi@10cb00c0 {
compatible = "google,zuma-usi", "samsung,exynos850-usi";
reg = <0x10cb00c0 0x20>;
Expand Down
25 changes: 19 additions & 6 deletions drivers/clk/samsung/clk-zuma.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,26 +242,33 @@ static const struct samsung_cmu_info hsi0_cmu __initconst = {
};

/*
* CMU_PERIC1, 0x10c00000. Firmware sets it up: the user muxes and the USI11
* divider are read-only, and the GPIO and sysreg gates are read-only gates.
* USI11 is the I2C bus of the MAX77759 gauge, charger and Type-C controller
* and the MAX77729 PMIC. Its gates are the ones Linux turns on, as for the
* Pixel 9a's USI10; their auto/manual mode is left as firmware set it.
* CMU_PERIC1, 0x10c00000. Firmware sets it up: the user muxes and the USI9 and
* USI11 dividers are read-only, and the GPIO and sysreg gates are read-only
* gates. USI11 is the I2C bus of the MAX77759 gauge, charger and Type-C
* controller and the MAX77759 PMIC; USI9 is the I2C bus of the battery pack's
* EEPROM. Their gates are the ones Linux turns on, as for the Pixel 9a's
* USI10; their auto/manual mode is left as firmware set it.
*/
PNAME(mout_peric1_noc_user_parents) = { "oscclk", "zuma_dout_peric1_noc" };
PNAME(mout_peric1_usi11_user_parents) = { "oscclk", "zuma_dout_peric1_ip" };
PNAME(mout_peric1_usi9_user_parents) = { "oscclk", "zuma_dout_peric1_ip" };

static const struct samsung_mux_clock peric1_muxes[] __initconst = {
MUX_F(CLK_MOUT_PERIC1_NOC_USER, "zuma_mout_peric1_noc_user",
mout_peric1_noc_user_parents, 0x610, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_PERIC1_USI11_USER, "zuma_mout_peric1_usi11_user",
mout_peric1_usi11_user_parents, 0x640, 4, 1, 0, CLK_MUX_READ_ONLY),
MUX_F(CLK_MOUT_PERIC1_USI9_USER, "zuma_mout_peric1_usi9_user",
mout_peric1_usi9_user_parents, 0x690, 4, 1, 0, CLK_MUX_READ_ONLY),
};

static const struct samsung_div_clock peric1_dividers[] __initconst = {
DIV_F(CLK_DOUT_PERIC1_USI11, "zuma_dout_peric1_usi11",
"zuma_mout_peric1_usi11_user", 0x1810, 0, 4, 0,
CLK_DIVIDER_READ_ONLY),
DIV_F(CLK_DOUT_PERIC1_USI9, "zuma_dout_peric1_usi9",
"zuma_mout_peric1_usi9_user", 0x1824, 0, 4, 0,
CLK_DIVIDER_READ_ONLY),
};

static const struct samsung_gate_clock peric1_ro_gates[] __initconst = {
Expand All @@ -278,6 +285,12 @@ static const struct samsung_gate_clock peric1_gates[] __initconst = {
"zuma_mout_peric1_noc_user", 0x204c, 21, 0, 0),
GATE(CLK_GOUT_PERIC1_USI11_RSTNSYNC, "zuma_gout_peric1_usi11_rstnsync",
"zuma_dout_peric1_usi11", 0x2094, 21, 0, 0),
GATE(CLK_GOUT_PERIC1_USI9_IPCLK, "zuma_gout_peric1_usi9_ipclk",
"zuma_dout_peric1_usi9", 0x2070, 21, 0, 0),
GATE(CLK_GOUT_PERIC1_USI9_PCLK, "zuma_gout_peric1_usi9_pclk",
"zuma_mout_peric1_noc_user", 0x2074, 21, 0, 0),
GATE(CLK_GOUT_PERIC1_USI9_RSTNSYNC, "zuma_gout_peric1_usi9_rstnsync",
"zuma_dout_peric1_usi9", 0x20a0, 21, 0, 0),
};

static const struct samsung_cmu_info peric1_cmu __initconst = {
Expand All @@ -289,7 +302,7 @@ static const struct samsung_cmu_info peric1_cmu __initconst = {
.nr_ro_gate_clks = ARRAY_SIZE(peric1_ro_gates),
.gate_clks = peric1_gates,
.nr_gate_clks = ARRAY_SIZE(peric1_gates),
.nr_clk_ids = CLK_GOUT_PERIC1_USI11_RSTNSYNC + 1,
.nr_clk_ids = CLK_GOUT_PERIC1_USI9_RSTNSYNC + 1,
.clk_name = "bus",
};

Expand Down
10 changes: 9 additions & 1 deletion include/dt-bindings/clock/google,zuma.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
#define CLK_GOUT_HSI0_USI2_IP 9
#define CLK_GOUT_HSI0_USI2_PCLK 10

/* CMU_PERIC1: USI11, the I2C bus of the battery, charger and USB-C chips. */
/*
* CMU_PERIC1: USI11, the I2C bus of the battery, charger and USB-C chips, and
* USI9, the I2C bus of the battery pack's EEPROM.
*/
#define CLK_MOUT_PERIC1_NOC_USER 1
#define CLK_GOUT_GPIO_PERIC1 2
#define CLK_GOUT_PERIC1_SYSREG 3
Expand All @@ -46,6 +49,11 @@
#define CLK_GOUT_PERIC1_USI11_IPCLK 6
#define CLK_GOUT_PERIC1_USI11_PCLK 7
#define CLK_GOUT_PERIC1_USI11_RSTNSYNC 8
#define CLK_MOUT_PERIC1_USI9_USER 9
#define CLK_DOUT_PERIC1_USI9 10
#define CLK_GOUT_PERIC1_USI9_IPCLK 11
#define CLK_GOUT_PERIC1_USI9_PCLK 12
#define CLK_GOUT_PERIC1_USI9_RSTNSYNC 13

/* CMU_APM: the APM mailbox, its SRAM and the always-on GPIO banks. */
#define CLK_APM_PLL_ALV_DIV2 1
Expand Down