diff --git a/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml b/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml new file mode 100644 index 0000000000..cd708ab082 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/google,zuma-clock.yaml @@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/google,zuma-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Tensor G3 clock controllers + +maintainers: + - Brett-Michael Green + +description: | + CMU_TOP supplies the HSI0 NoC and peripheral clocks to CMU_HSI0 from its + shared PLLs. CMU_HSI0 supplies USI2, the touchscreen's SPI, from the HSI0 + peripheral clock; its NoC path also takes the board-level HSI0 ALT clock. + CMU_APM supplies the APM mailbox, its internal memory and the always-on + GPIO banks from the always-on ALV PLL and the oscillator. + The external oscillator supplies the PLL reference and the oscillator mux + paths. + Clock identifiers are defined in dt-bindings/clock/google,zuma.h. + +properties: + compatible: + enum: + - google,zuma-cmu-top + - google,zuma-cmu-apm + - google,zuma-cmu-hsi0 + + reg: + maxItems: 1 + + "#clock-cells": + const: 1 + + clocks: + minItems: 1 + maxItems: 4 + + clock-names: + minItems: 1 + maxItems: 4 + +required: + - compatible + - reg + - "#clock-cells" + - clocks + - clock-names + +allOf: + - if: + properties: + compatible: + enum: + - google,zuma-cmu-top + - google,zuma-cmu-apm + then: + properties: + clocks: + items: + - description: External oscillator reference clock + clock-names: + items: + - const: oscclk + - if: + properties: + compatible: + const: google,zuma-cmu-hsi0 + then: + properties: + clocks: + items: + - description: External oscillator reference clock + - description: HSI0 NoC clock from CMU_TOP + - description: HSI0 peripheral clock from CMU_TOP + - description: HSI0 ALT input clock + clock-names: + items: + - const: oscclk + - const: bus + - const: peri + - const: alt + +additionalProperties: false + +examples: + - | + #include + + cmu_top: clock-controller@26040000 { + compatible = "google,zuma-cmu-top"; + reg = <0x26040000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>; + clock-names = "oscclk"; + }; + + clock-controller@11000000 { + compatible = "google,zuma-cmu-hsi0"; + reg = <0x11000000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>, <&cmu_top CLK_DOUT_HSI0_NOC>, + <&cmu_top CLK_DOUT_HSI0_PERI>, <&hsi0_alt>; + clock-names = "oscclk", "bus", "peri", "alt"; + }; + +... diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml index 58a0301f09..9163560a19 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -25,6 +25,7 @@ properties: enum: - google,gs101-acpm-ipc - google,gs201-acpm-ipc + - google,zuma-acpm-ipc - google,zumapro-acpm-ipc "#clock-cells": @@ -111,7 +112,9 @@ allOf: - if: properties: compatible: - const: google,zumapro-acpm-ipc + enum: + - google,zuma-acpm-ipc + - google,zumapro-acpm-ipc then: properties: pmic: false diff --git a/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml b/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml index d1a6c6eda1..559da23935 100644 --- a/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml +++ b/Documentation/devicetree/bindings/mailbox/google,gs101-mbox.yaml @@ -27,6 +27,7 @@ properties: - items: - enum: - google,gs201-mbox + - google,zuma-mbox - google,zumapro-mbox - const: google,gs101-mbox diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2mpg14-pmic.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2mpg14-pmic.yaml index 5419f15224..5a94a65452 100644 --- a/Documentation/devicetree/bindings/mfd/samsung,s2mpg14-pmic.yaml +++ b/Documentation/devicetree/bindings/mfd/samsung,s2mpg14-pmic.yaml @@ -10,8 +10,9 @@ maintainers: - W4HO <87742609+W4HO-ham@users.noreply.github.com> description: | - S2MPG14 is the main PMIC paired with Google's Tensor G4. Its LDO4M and - LDO25M outputs supply the analog and digital touchscreen power rails. + S2MPG14 is the main PMIC paired with Google's Tensor G3 and Tensor G4. + Its LDO4M and LDO25M outputs supply the analog and digital touchscreen + power rails. properties: compatible: diff --git a/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml b/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml index 9a2a8867b6..870ad437ff 100644 --- a/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml +++ b/Documentation/devicetree/bindings/soc/samsung/exynos-usi.yaml @@ -37,6 +37,7 @@ properties: - enum: - google,gs101-usi - google,gs201-usi + - google,zuma-usi - google,zumapro-usi - samsung,exynos2200-usi - samsung,exynosautov9-usi diff --git a/Documentation/devicetree/bindings/soc/samsung/samsung,exynos-sysreg.yaml b/Documentation/devicetree/bindings/soc/samsung/samsung,exynos-sysreg.yaml index 5acd0e0efb..2a181df90c 100644 --- a/Documentation/devicetree/bindings/soc/samsung/samsung,exynos-sysreg.yaml +++ b/Documentation/devicetree/bindings/soc/samsung/samsung,exynos-sysreg.yaml @@ -27,6 +27,7 @@ properties: - google,gs201-peric0-sysreg - google,gs201-peric1-sysreg - google,gs201-vgpio2ap-sysreg + - google,zuma-hsi0-sysreg - google,zuma-ufs-sysreg - google,zumapro-apm-sysreg - google,zumapro-hsi0-sysreg diff --git a/Documentation/devicetree/bindings/spi/samsung,spi.yaml b/Documentation/devicetree/bindings/spi/samsung,spi.yaml index 2cc3ba1341..7feee66b25 100644 --- a/Documentation/devicetree/bindings/spi/samsung,spi.yaml +++ b/Documentation/devicetree/bindings/spi/samsung,spi.yaml @@ -33,6 +33,7 @@ properties: - items: - enum: - google,gs201-spi + - google,zuma-spi - google,zumapro-spi - const: google,gs101-spi - const: samsung,exynos7-spi diff --git a/MAINTAINERS b/MAINTAINERS index 4841af951f..d5c748f6f6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11166,6 +11166,7 @@ P: Documentation/process/maintainer-soc-clean-dts.rst C: irc://irc.oftc.net/pixel6-kernel-dev F: Documentation/devicetree/bindings/clock/google,gs101-clock.yaml F: Documentation/devicetree/bindings/clock/google,gs201-clock.yaml +F: Documentation/devicetree/bindings/clock/google,zuma-clock.yaml F: Documentation/devicetree/bindings/clock/google,zumapro* F: Documentation/devicetree/bindings/phy/google,lga-usb-phy.yaml F: Documentation/devicetree/bindings/soc/google/google,gs101-dtzpc.yaml @@ -11175,6 +11176,7 @@ F: Documentation/devicetree/bindings/usb/google,lga-dwc3.yaml F: arch/arm64/boot/dts/exynos/google/ F: drivers/clk/samsung/clk-gs101.c F: drivers/clk/samsung/clk-gs201.c +F: drivers/clk/samsung/clk-zuma.c F: drivers/clk/samsung/clk-zumapro.c F: drivers/phy/phy-google-usb.c F: drivers/soc/samsung/gs101-pmu.c @@ -11184,6 +11186,7 @@ F: drivers/thermal/samsung/gs101_acpm_tmu.c F: drivers/usb/dwc3/dwc3-google.c F: include/dt-bindings/clock/google,gs101* F: include/dt-bindings/clock/google,gs201* +F: include/dt-bindings/clock/google,zuma.h F: include/dt-bindings/clock/google,zumapro* K: [gG]oogle.?[tT]ensor diff --git a/arch/arm64/boot/dts/exynos/google/zuma-husky.dts b/arch/arm64/boot/dts/exynos/google/zuma-husky.dts index 074eee930f..29b9a11b98 100644 --- a/arch/arm64/boot/dts/exynos/google/zuma-husky.dts +++ b/arch/arm64/boot/dts/exynos/google/zuma-husky.dts @@ -117,6 +117,54 @@ }; }; +/* + * The main PMIC, behind the ACPM firmware. Its regulators are described + * with their consumers, which run them through the firmware. + */ +&acpm_ipc { + pmic-1 { + compatible = "samsung,s2mpg14-pmic"; + + regulators { + touch_avdd: ldo4m { + regulator-name = "touch-avdd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + touch_vdd: ldo25m { + regulator-name = "touch-vdd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + }; + }; +}; + +&spi20 { + status = "okay"; + + /* + * ST FTM5 (SALIXP, chip id 36 40), as stock's fts node: 10 MHz, + * manual chip select. Not stock's axis inversion: salixp already + * reports in the panel's orientation. + */ + touchscreen@0 { + compatible = "st,salixp"; + reg = <0>; + spi-max-frequency = <10000000>; + interrupt-parent = <&gpn0>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + vdd-supply = <&touch_vdd>; + avdd-supply = <&touch_avdd>; + reset-gpios = <&gpp21 2 GPIO_ACTIVE_LOW>; + touchscreen-size-x = <1344>; + touchscreen-size-y = <2992>; + pinctrl-names = "default"; + pinctrl-0 = <&ts_irq &ts_reset>; + }; +}; + &usb_dwc3 { status = "okay"; }; @@ -141,3 +189,7 @@ &ufs_0_phy { status = "okay"; }; + +&usi2_hsi0 { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/exynos/google/zuma-pinctrl.dtsi b/arch/arm64/boot/dts/exynos/google/zuma-pinctrl.dtsi index 724ef95913..a88e0eaa20 100644 --- a/arch/arm64/boot/dts/exynos/google/zuma-pinctrl.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zuma-pinctrl.dtsi @@ -160,6 +160,105 @@ }; }; +&pinctrl_custom_alive { + gpn0: gpn0-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn1: gpn1-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn2: gpn2-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn3: gpn3-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn4: gpn4-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn5: gpn5-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn6: gpn6-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn7: gpn7-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn8: gpn8-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + gpn9: gpn9-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gic>; + interrupts = ; + }; + + ts_irq: ts-irq-pins { + samsung,pins = "gpn0-0"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; +}; + &pinctrl_peric0 { gpp0: gpp0-gpio-bank { gpio-controller; @@ -288,6 +387,57 @@ }; }; +&pinctrl_peric1 { + gpp19: gpp19-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpp20: gpp20-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpp21: gpp21-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpp24: gpp24-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpp22: gpp22-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + gpp23: gpp23-gpio-bank { + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + ts_reset: ts-reset-pins { + samsung,pins = "gpp21-2"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; +}; + &pinctrl_hsi2ufs { gph5: gph5-gpio-bank { gpio-controller; diff --git a/arch/arm64/boot/dts/exynos/google/zuma.dtsi b/arch/arm64/boot/dts/exynos/google/zuma.dtsi index 92bef7f97d..2e76d03326 100644 --- a/arch/arm64/boot/dts/exynos/google/zuma.dtsi +++ b/arch/arm64/boot/dts/exynos/google/zuma.dtsi @@ -5,13 +5,16 @@ * Addresses, interrupts and reservations are the ones a retail Pixel 8 Pro * (husky) runs with: its live device tree and Google's GPL zuma tree * (android-gs-shusky-6.1-android16). Nothing here is copied from gs101 or - * gs201. No clock, pinctrl or power-domain providers yet: the bootloader - * leaves what first light needs running, and the board's bootargs carry - * clk_ignore_unused and pd_ignore_unused. + * gs201. The clock providers describe only the touchscreen SPI's path, and + * there are no power-domain providers yet: the bootloader leaves what the + * rest needs running, and the board's bootargs carry clk_ignore_unused and + * pd_ignore_unused. */ +#include #include #include +#include / { compatible = "google,zuma"; @@ -22,8 +25,10 @@ /* The pin controllers are numbered as in Tensor G4's driver data. */ aliases { pinctrl0 = &pinctrl_gpio_alive; + pinctrl1 = &pinctrl_custom_alive; pinctrl10 = &pinctrl_hsi2ufs; pinctrl11 = &pinctrl_peric0; + pinctrl12 = &pinctrl_peric1; }; /* @@ -146,6 +151,15 @@ }; }; + firmware { + acpm_ipc: power-management { + compatible = "google,zuma-acpm-ipc"; + #clock-cells = <1>; + mboxes = <&ap2apm_mailbox>; + shmem = <&apm_sram>; + }; + }; + psci { compatible = "arm,psci-1.0"; method = "smc"; @@ -269,6 +283,21 @@ clock-output-names = "ufs_ref_stub"; }; + oscclk: clock-oscclk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24576000>; + clock-output-names = "oscclk"; + }; + + /* The CAL's nominal I_CLK_HSI0_ALT rate. */ + hsi0_alt: clock-hsi0-alt { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <213000000>; + clock-output-names = "hsi0-alt"; + }; + soc: soc@0 { compatible = "simple-bus"; #address-cells = <1>; @@ -318,6 +347,28 @@ interrupts = ; }; + pinctrl_peric1: pinctrl@10c40000 { + compatible = "google,zuma-pinctrl"; + reg = <0x10c40000 0x1000>; + clocks = <&clk_gpio_stub>; + clock-names = "pclk"; + interrupts = ; + }; + + cmu_hsi0: clock-controller@11000000 { + compatible = "google,zuma-cmu-hsi0"; + reg = <0x11000000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>, <&cmu_top CLK_DOUT_HSI0_NOC>, + <&cmu_top CLK_DOUT_HSI0_PERI>, <&hsi0_alt>; + clock-names = "oscclk", "bus", "peri", "alt"; + }; + + sysreg_hsi0: syscon@11020000 { + compatible = "google,zuma-hsi0-sysreg", "syscon"; + reg = <0x11020000 0x10000>; + }; + /* * USB control block: Exynos 2200's link registers, with the * eUSB2 PHY below as its high-speed PHY. The USB3/DP combo PHY @@ -346,6 +397,33 @@ status = "disabled"; }; + usi2_hsi0: usi@111d00c0 { + compatible = "google,zuma-usi", "samsung,exynos850-usi"; + reg = <0x111d00c0 0x20>; + clocks = <&cmu_hsi0 CLK_GOUT_HSI0_USI2_PCLK>, + <&cmu_hsi0 CLK_GOUT_HSI0_USI2_IP>; + clock-names = "pclk", "ipclk"; + samsung,sysreg = <&sysreg_hsi0 0x101c>; + samsung,mode = ; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + spi20: spi@111d0000 { + compatible = "google,zuma-spi", "google,gs101-spi"; + /* USI control starts at 0xc0; do not claim it twice. */ + reg = <0x111d0000 0xc0>; + interrupts = ; + clocks = <&cmu_hsi0 CLK_GOUT_HSI0_USI2_PCLK>, + <&cmu_hsi0 CLK_GOUT_HSI0_USI2_IP>; + clock-names = "spi", "spi_busclk0"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + }; + /* * The DWC3 controller, in peripheral mode as on stock (which * wraps it in Google's exynos9-dwusb glue). On a normal boot @@ -413,6 +491,35 @@ status = "disabled"; }; + pinctrl_custom_alive: pinctrl@15060000 { + compatible = "google,zuma-pinctrl"; + reg = <0x15060000 0x1000>; + clocks = <&cmu_apm CLK_GOUT_APM_GPIO_CUSTOM_ALIVE>; + clock-names = "pclk"; + + wakeup-interrupt-controller { + compatible = "google,zuma-wakeup-eint", + "google,zumapro-wakeup-eint"; + }; + }; + + ap2apm_mailbox: mailbox@15110000 { + compatible = "google,zuma-mbox", "google,gs101-mbox"; + reg = <0x15110000 0x1000>; + clocks = <&cmu_apm CLK_GOUT_APM_MAILBOX_AP>; + clock-names = "pclk"; + interrupts = ; + #mbox-cells = <0>; + }; + + cmu_apm: clock-controller@15400000 { + compatible = "google,zuma-cmu-apm"; + reg = <0x15400000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>; + clock-names = "oscclk"; + }; + /* Writes go through EL3 (SMC), as on gs101. */ pmu_system_controller: system-controller@15460000 { compatible = "google,zuma-pmu"; @@ -443,6 +550,29 @@ "google,zumapro-wakeup-eint"; }; }; + + apm_sram: sram@15700000 { + compatible = "mmio-sram"; + reg = <0x15700000 0x58000>; + clocks = <&cmu_apm CLK_GOUT_APM_INTMEM_ACLK>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x15700000 0x58000>; + no-memory-wc; + + /* The APM firmware's window, as one block. */ + firmware-sram@0 { + reg = <0x0 0x58000>; + }; + }; + + cmu_top: clock-controller@26040000 { + compatible = "google,zuma-cmu-top"; + reg = <0x26040000 0x8000>; + #clock-cells = <1>; + clocks = <&oscclk>; + clock-names = "oscclk"; + }; }; }; diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile index c2df88230e..0b299f87f8 100644 --- a/drivers/clk/samsung/Makefile +++ b/drivers/clk/samsung/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynosautov9.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynosautov920.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-gs101.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-gs201.o +obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-zuma.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-zumapro.o obj-$(CONFIG_EXYNOS_ACPM_CLK) += clk-acpm.o obj-$(CONFIG_S3C64XX_COMMON_CLK) += clk-s3c64xx.o diff --git a/drivers/clk/samsung/clk-zuma.c b/drivers/clk/samsung/clk-zuma.c new file mode 100644 index 0000000000..ccb80f62e4 --- /dev/null +++ b/drivers/clk/samsung/clk-zuma.c @@ -0,0 +1,253 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Google Tensor G3 (zuma) clocks for the touchscreen and its PMIC. + * + * Register layout and parents derived from Google's GPL CMUCAL tables in + * cal-if/zuma/cmucal-{sfr,node}.c, Copyright 2022 Samsung Electronics Co., Ltd. + * Only the path from CMU_TOP to HSI0's USI2 is described, with CMU_APM's + * clocks for the APM mailbox, its SRAM and the always-on GPIO banks. PLLs, + * muxes and dividers keep their firmware settings, except USI2's own + * divider, which sets the SPI rate. No PLL rate table is supplied. + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk.h" +#include "clk-exynos-arm64.h" +#include "clk-pll.h" + +/* CMU_TOP, 0x26040000. PLL CON3 is the read-only rate source. */ +static const struct samsung_pll_clock top_plls[] __initconst = { + PLL(pll_0517x, CLK_FOUT_SHARED0, "zuma_shared0", "oscclk", + 0x004, 0x14c, NULL), + PLL(pll_0517x, CLK_FOUT_SHARED1, "zuma_shared1", "oscclk", + 0x008, 0x18c, NULL), + PLL(pll_0518x, CLK_FOUT_SHARED2, "zuma_shared2", "oscclk", + 0x00c, 0x1cc, NULL), + PLL(pll_0518x, CLK_FOUT_SHARED3, "zuma_shared3", "oscclk", + 0x010, 0x20c, NULL), + PLL(pll_0518x, CLK_FOUT_SPARE, "zuma_spare", "oscclk", + 0x014, 0x24c, NULL), +}; + +static const struct samsung_fixed_factor_clock top_factors[] __initconst = { + FFACTOR(CLK_SHARED0_D4, "zuma_shared0_d4", "zuma_shared0", 1, 4, 0), + FFACTOR(CLK_SHARED1_D4, "zuma_shared1_d4", "zuma_shared1", 1, 4, 0), + FFACTOR(CLK_SHARED2_D2, "zuma_shared2_d2", "zuma_shared2", 1, 2, 0), + FFACTOR(CLK_SHARED3_D2, "zuma_shared3_d2", "zuma_shared3", 1, 2, 0), +}; + +PNAME(mout_hsi0_noc_parents) = { + "zuma_shared0_d4", "zuma_shared1_d4", "zuma_shared2_d2", + "zuma_shared3_d2", "zuma_spare", "oscclk", "oscclk", "oscclk", +}; + +PNAME(mout_hsi0_peri_parents) = { + "zuma_shared0_d4", "zuma_shared2_d2", "zuma_shared3_d2", "zuma_spare", +}; + +static const struct samsung_mux_clock top_muxes[] __initconst = { + MUX_F(CLK_MOUT_HSI0_NOC, "zuma_mout_hsi0_noc", mout_hsi0_noc_parents, + 0x1094, 0, 3, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_HSI0_PERI, "zuma_mout_hsi0_peri", mout_hsi0_peri_parents, + 0x1098, 0, 2, 0, CLK_MUX_READ_ONLY), +}; + +/* The hardware order is mux -> gate -> divider. HSI0 is firmware-owned. */ +static const struct samsung_gate_clock top_ro_gates[] __initconst = { + GATE(CLK_GOUT_HSI0_NOC, "zuma_gout_hsi0_noc", "zuma_mout_hsi0_noc", + 0x20bc, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_HSI0_PERI, "zuma_gout_hsi0_peri", "zuma_mout_hsi0_peri", + 0x20c0, 21, CLK_IGNORE_UNUSED, 0), +}; + +static const struct samsung_div_clock top_dividers[] __initconst = { + DIV_F(CLK_DOUT_HSI0_NOC, "zuma_dout_hsi0_noc", "zuma_gout_hsi0_noc", + 0x188c, 0, 4, 0, CLK_DIVIDER_READ_ONLY), + DIV_F(CLK_DOUT_HSI0_PERI, "zuma_dout_hsi0_peri", "zuma_gout_hsi0_peri", + 0x1890, 0, 4, 0, CLK_DIVIDER_READ_ONLY), +}; + +static const struct samsung_cmu_info top_cmu __initconst = { + .pll_clks = top_plls, + .nr_pll_clks = ARRAY_SIZE(top_plls), + .fixed_factor_clks = top_factors, + .nr_fixed_factor_clks = ARRAY_SIZE(top_factors), + .mux_clks = top_muxes, + .nr_mux_clks = ARRAY_SIZE(top_muxes), + .ro_gate_clks = top_ro_gates, + .nr_ro_gate_clks = ARRAY_SIZE(top_ro_gates), + .div_clks = top_dividers, + .nr_div_clks = ARRAY_SIZE(top_dividers), + .nr_clk_ids = CLK_DOUT_HSI0_PERI + 1, +}; + +static void __init zuma_top_init(struct device_node *np) +{ + exynos_arm64_register_cmu(NULL, np, &top_cmu); +} + +CLK_OF_DECLARE(zuma_cmu_top, "google,zuma-cmu-top", zuma_top_init); + +/* + * CMU_APM, 0x15400000. The always-on domain is firmware-owned, so it is + * read-only. ALV runs at the oscillator times 32. + */ +static const struct samsung_fixed_rate_clock apm_fixed_clks[] __initconst = { + FRATE(CLK_APM_PLL_ALV_DIV2, "zuma_apm_pll_alv_div2", NULL, 0, 393216000), + FRATE(CLK_APM_PLL_ALV_DIV4, "zuma_apm_pll_alv_div4", NULL, 0, 196608000), + FRATE(CLK_APM_PLL_ALV_DIV8, "zuma_apm_pll_alv_div8", NULL, 0, 98304000), + FRATE(CLK_APM_PLL_ALV_DIV16, "zuma_apm_pll_alv_div16", NULL, 0, 49152000), +}; + +PNAME(mout_apm_funcsrc_parents) = { + "zuma_apm_pll_alv_div2", "zuma_apm_pll_alv_div4", + "zuma_apm_pll_alv_div16", "zuma_apm_pll_alv_div8", +}; + +PNAME(mout_apm_func_parents) = { + "oscclk", "zuma_mout_apm_funcsrc", "pad_clk_apm", "oscclk", +}; + +static const struct samsung_mux_clock apm_muxes[] __initconst = { + MUX_F(CLK_MOUT_APM_FUNCSRC, "zuma_mout_apm_funcsrc", + mout_apm_funcsrc_parents, 0x1004, 0, 2, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_APM_FUNC, "zuma_mout_apm_func", mout_apm_func_parents, + 0x1000, 0, 2, 0, CLK_MUX_READ_ONLY), +}; + +static const struct samsung_div_clock apm_dividers[] __initconst = { + DIV_F(CLK_DOUT_APM_NOC, "zuma_dout_apm_noc", "zuma_gout_apm_func", + 0x1808, 0, 3, 0, CLK_DIVIDER_READ_ONLY), +}; + +static const struct samsung_gate_clock apm_ro_gates[] __initconst = { + GATE(CLK_GOUT_APM_FUNC, "zuma_gout_apm_func", "zuma_mout_apm_func", + 0x20d4, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_MAILBOX_AP, "zuma_gout_apm_mailbox_ap", + "zuma_dout_apm_noc", 0x211c, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_INTMEM_ACLK, "zuma_gout_apm_intmem_aclk", + "zuma_dout_apm_noc", 0x2108, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_INTMEM_PCLK, "zuma_gout_apm_intmem_pclk", + "zuma_dout_apm_noc", 0x210c, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_GPIO_ALIVE, "zuma_gout_apm_gpio_alive", + "zuma_dout_apm_noc", 0x20d8, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_GPIO_FAR_ALIVE, "zuma_gout_apm_gpio_far_alive", + "zuma_dout_apm_noc", 0x20dc, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_APM_GPIO_CUSTOM_ALIVE, "zuma_gout_apm_gpio_custom_alive", + "zuma_dout_apm_noc", 0x2000, 21, CLK_IGNORE_UNUSED, 0), +}; + +static const struct samsung_cmu_info apm_cmu __initconst = { + .fixed_clks = apm_fixed_clks, + .nr_fixed_clks = ARRAY_SIZE(apm_fixed_clks), + .mux_clks = apm_muxes, + .nr_mux_clks = ARRAY_SIZE(apm_muxes), + .div_clks = apm_dividers, + .nr_div_clks = ARRAY_SIZE(apm_dividers), + .ro_gate_clks = apm_ro_gates, + .nr_ro_gate_clks = ARRAY_SIZE(apm_ro_gates), + .nr_clk_ids = CLK_GOUT_APM_GPIO_CUSTOM_ALIVE + 1, +}; + +/* CMU_HSI0, 0x11000000. Firmware keeps the domain powered. */ +PNAME(mout_hsi0_noc_user_parents) = { "oscclk", "zuma_dout_hsi0_noc" }; + +PNAME(mout_hsi0_alt_user_parents) = { "oscclk", "zuma_gout_hsi0_alt" }; + +PNAME(mout_hsi0_noc_local_parents) = { + "zuma_mout_hsi0_noc_user", "zuma_mout_hsi0_alt_user", +}; + +PNAME(mout_hsi0_peri_user_parents) = { "oscclk", "zuma_dout_hsi0_peri" }; + +PNAME(mout_hsi0_usi2_parents) = { "zuma_mout_hsi0_peri_user", "oscclk" }; + +static const struct samsung_mux_clock hsi0_muxes[] __initconst = { + MUX_F(CLK_MOUT_HSI0_NOC_USER, "zuma_mout_hsi0_noc_user", + mout_hsi0_noc_user_parents, 0x620, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_HSI0_ALT_USER, "zuma_mout_hsi0_alt_user", + mout_hsi0_alt_user_parents, 0x600, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_HSI0_NOC_LOCAL, "zuma_mout_hsi0_noc_local", + mout_hsi0_noc_local_parents, 0x1000, 0, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_HSI0_PERI_USER, "zuma_mout_hsi0_peri_user", + mout_hsi0_peri_user_parents, 0x680, 4, 1, 0, CLK_MUX_READ_ONLY), + MUX_F(CLK_MOUT_HSI0_USI2, "zuma_mout_hsi0_usi2", mout_hsi0_usi2_parents, + 0x101c, 0, 1, 0, CLK_MUX_READ_ONLY), +}; + +static const struct samsung_div_clock hsi0_dividers[] __initconst = { + DIV(CLK_DOUT_HSI0_USI2, "zuma_dout_hsi0_usi2", + "zuma_gout_hsi0_usi2_source", 0x181c, 0, 4), +}; + +static const struct samsung_gate_clock hsi0_gates[] __initconst = { + GATE(CLK_GOUT_HSI0_USI2_SOURCE, "zuma_gout_hsi0_usi2_source", + "zuma_mout_hsi0_usi2", 0x2120, 21, CLK_IGNORE_UNUSED, 0), + GATE(CLK_GOUT_HSI0_USI2_IP, "zuma_gout_hsi0_usi2_ip", + "zuma_dout_hsi0_usi2", 0x20fc, 21, + CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0), + GATE(CLK_GOUT_HSI0_USI2_PCLK, "zuma_gout_hsi0_usi2_pclk", + "zuma_mout_hsi0_noc_local", 0x2100, 21, CLK_IGNORE_UNUSED, 0), +}; + +/* Firmware-owned gates are observed, never switched. */ +static const struct samsung_gate_clock hsi0_ro_gates[] __initconst = { + GATE(CLK_GOUT_HSI0_ALT, "zuma_gout_hsi0_alt", "hsi0-alt", + 0x204c, 21, CLK_IGNORE_UNUSED, 0), +}; + +/* USI2's gates run in manual mode; the rest of HSI0 is left alone. */ +static const unsigned long hsi0_regs[] __initconst = { + 0x2120, 0x20fc, 0x2100, +}; + +static const struct samsung_cmu_info hsi0_cmu __initconst = { + .mux_clks = hsi0_muxes, + .nr_mux_clks = ARRAY_SIZE(hsi0_muxes), + .div_clks = hsi0_dividers, + .nr_div_clks = ARRAY_SIZE(hsi0_dividers), + .gate_clks = hsi0_gates, + .nr_gate_clks = ARRAY_SIZE(hsi0_gates), + .ro_gate_clks = hsi0_ro_gates, + .nr_ro_gate_clks = ARRAY_SIZE(hsi0_ro_gates), + .nr_clk_ids = CLK_GOUT_HSI0_USI2_PCLK + 1, + .clk_regs = hsi0_regs, + .nr_clk_regs = ARRAY_SIZE(hsi0_regs), + .clk_name = "bus", +}; + +static int __init zuma_cmu_probe(struct platform_device *pdev) +{ + const struct samsung_cmu_info *cmu = device_get_match_data(&pdev->dev); + + exynos_arm64_register_cmu(&pdev->dev, pdev->dev.of_node, cmu); + return 0; +} + +static const struct of_device_id zuma_cmu_match[] = { + { .compatible = "google,zuma-cmu-apm", .data = &apm_cmu }, + { .compatible = "google,zuma-cmu-hsi0", .data = &hsi0_cmu }, + { } +}; + +static struct platform_driver zuma_cmu_driver __refdata = { + .driver = { + .name = "zuma-cmu", + .of_match_table = zuma_cmu_match, + .suppress_bind_attrs = true, + }, + .probe = zuma_cmu_probe, +}; + +static int __init zuma_cmu_init(void) +{ + return platform_driver_register(&zuma_cmu_driver); +} +core_initcall(zuma_cmu_init); diff --git a/drivers/firmware/samsung/exynos-acpm.c b/drivers/firmware/samsung/exynos-acpm.c index 45f3a56168..dfac2a004c 100644 --- a/drivers/firmware/samsung/exynos-acpm.c +++ b/drivers/firmware/samsung/exynos-acpm.c @@ -42,6 +42,7 @@ #define ACPM_GS101_INITDATA_BASE 0xa000 #define ACPM_GS201_INITDATA_BASE 0xa000 +#define ACPM_ZUMA_INITDATA_BASE 0xa000 #define ACPM_ZUMAPRO_INITDATA_BASE 0xa000 /* Sanity limit for the channel count read from SRAM. */ @@ -738,9 +739,15 @@ static int acpm_channels_init(struct acpm_info *acpm) achan->chan = mbox_request_channel(cl, 0); if (IS_ERR(achan->chan)) { - dev_warn(dev, "chan %d: no mailbox channel (%pe), skipped\n", - i, achan->chan); + ret = PTR_ERR(achan->chan); achan->chan = NULL; + /* The mailbox may simply not have probed yet. */ + if (ret == -EPROBE_DEFER) + return dev_err_probe(dev, ret, + "chan %d: no mailbox channel yet\n", + i); + dev_warn(dev, "chan %d: no mailbox channel (%pe), skipped\n", + i, ERR_PTR(ret)); continue; } @@ -975,6 +982,11 @@ static const struct acpm_match_data acpm_gs201 = { .acpm_clk_dev_name = "gs201-acpm-clk", }; +static const struct acpm_match_data acpm_zuma = { + .initdata_base = ACPM_ZUMA_INITDATA_BASE, + .acpm_clk_dev_name = "zuma-acpm-clk", +}; + static const struct acpm_match_data acpm_zumapro = { .initdata_base = ACPM_ZUMAPRO_INITDATA_BASE, .acpm_clk_dev_name = "zumapro-acpm-clk", @@ -987,6 +999,9 @@ static const struct of_device_id acpm_match[] = { }, { .compatible = "google,gs201-acpm-ipc", .data = &acpm_gs201, + }, { + .compatible = "google,zuma-acpm-ipc", + .data = &acpm_zuma, }, { .compatible = "google,zumapro-acpm-ipc", .data = &acpm_zumapro, diff --git a/drivers/input/touchscreen/salixp.c b/drivers/input/touchscreen/salixp.c index c1752a8583..f7c665d96c 100644 --- a/drivers/input/touchscreen/salixp.c +++ b/drivers/input/touchscreen/salixp.c @@ -97,7 +97,7 @@ #define SALIXP_SCAN_ALL 0xff #define SALIXP_EVT_STATUS 0x43 #define SALIXP_ECHO_TYPE 0x01 -#define SALIXP_ECHO_MS 50 +#define SALIXP_ECHO_MS 2500 #define SALIXP_TOUCH_POLL_MS 10 #define SALIXP_TOUCH_LOG_MAX 8 #define SALIXP_CS_DELAY_US 10 @@ -431,9 +431,11 @@ static int salixp_poll_cx(struct salixp *ts) * and address 0x20000000, the same prefix as the flash commands, so * this does not send it. The echo is 0x43 0x01 followed by the * command. Stock treats a missing echo as failure after retries - * (ftsIO.c:523-547). This sends the scan command once and fails - * probe if the echo does not arrive. It does not send it again. - * No interrupt is requested. + * (ftsIO.c:523-547), waiting up to 2.5 s for it (TIEMOUT_ECHO in + * ftsCore.c:330). Husky's firmware reports a forced calibration + * first and echoes about 60 ms after the command. This sends the + * scan command once, stops at the echo and fails probe if it does + * not arrive. It does not send it again. No interrupt is requested. */ static int salixp_sense_on(struct salixp *ts) { @@ -460,7 +462,8 @@ static int salixp_sense_on(struct salixp *ts) return ret; deadline = ktime_add_ms(ktime_get(), SALIXP_ECHO_MS); - while (ktime_before(ktime_get(), deadline) && n < SALIXP_POLL_MAX_EVT) { + while (!echo && ktime_before(ktime_get(), deadline) && + n < SALIXP_POLL_MAX_EVT) { ret = salixp_read_fifo(ts, event); if (ret) return ret; diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 870aae6592..4edda4cc02 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1676,6 +1676,9 @@ static const struct platform_device_id s3c64xx_spi_driver_ids[] = { MODULE_DEVICE_TABLE(platform, s3c64xx_spi_driver_ids); static const struct of_device_id s3c64xx_spi_dt_match[] = { + { .compatible = "google,zuma-spi", + .data = &zumapro_spi_port_config, + }, { .compatible = "google,zumapro-spi", .data = &zumapro_spi_port_config, }, diff --git a/include/dt-bindings/clock/google,zuma.h b/include/dt-bindings/clock/google,zuma.h new file mode 100644 index 0000000000..45aef7817c --- /dev/null +++ b/include/dt-bindings/clock/google,zuma.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +#ifndef _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_H +#define _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_H + +/* CMU_TOP: the HSI0 NoC and peripheral clock paths. */ +#define CLK_FOUT_SHARED0 1 +#define CLK_FOUT_SHARED1 2 +#define CLK_FOUT_SHARED2 3 +#define CLK_FOUT_SHARED3 4 +#define CLK_FOUT_SPARE 5 +#define CLK_SHARED0_D4 6 +#define CLK_SHARED1_D4 7 +#define CLK_SHARED2_D2 8 +#define CLK_SHARED3_D2 9 +#define CLK_MOUT_HSI0_NOC 10 +#define CLK_GOUT_HSI0_NOC 11 +#define CLK_DOUT_HSI0_NOC 12 +#define CLK_MOUT_HSI0_PERI 13 +#define CLK_GOUT_HSI0_PERI 14 +#define CLK_DOUT_HSI0_PERI 15 + +/* CMU_HSI0: USI2, the touchscreen's SPI. */ +#define CLK_GOUT_HSI0_ALT 1 +#define CLK_MOUT_HSI0_NOC_USER 2 +#define CLK_MOUT_HSI0_ALT_USER 3 +#define CLK_MOUT_HSI0_NOC_LOCAL 4 +#define CLK_MOUT_HSI0_PERI_USER 5 +#define CLK_MOUT_HSI0_USI2 6 +#define CLK_GOUT_HSI0_USI2_SOURCE 7 +#define CLK_DOUT_HSI0_USI2 8 +#define CLK_GOUT_HSI0_USI2_IP 9 +#define CLK_GOUT_HSI0_USI2_PCLK 10 + +/* CMU_APM: the APM mailbox, its SRAM and the always-on GPIO banks. */ +#define CLK_APM_PLL_ALV_DIV2 1 +#define CLK_APM_PLL_ALV_DIV4 2 +#define CLK_APM_PLL_ALV_DIV8 3 +#define CLK_APM_PLL_ALV_DIV16 4 +#define CLK_MOUT_APM_FUNCSRC 5 +#define CLK_MOUT_APM_FUNC 6 +#define CLK_GOUT_APM_FUNC 7 +#define CLK_DOUT_APM_NOC 8 +#define CLK_GOUT_APM_MAILBOX_AP 9 +#define CLK_GOUT_APM_INTMEM_ACLK 10 +#define CLK_GOUT_APM_INTMEM_PCLK 11 +#define CLK_GOUT_APM_GPIO_ALIVE 12 +#define CLK_GOUT_APM_GPIO_FAR_ALIVE 13 +#define CLK_GOUT_APM_GPIO_CUSTOM_ALIVE 14 + +#endif /* _DT_BINDINGS_CLOCK_GOOGLE_ZUMA_H */