arm64: tegra: Add Tegra210B01 support
Subsystems (9)
v2 cover arm64: tegra: Add Tegra210B01 support
Also known as Tegra X1+, the Tegra210B01 has higher CPU and GPU clocks than the original Tegra210.
This series adds Tegra210B01 support to several drivers, as a slight extension to the existing Tegra210 support. Then adds a generic soc dtsi in the same vein as other tegra archs. And finally adds a barebones device dts to be used for dt checks. Further device support will be submitted in later series.
Earlier internal revisions of this series included changes to the dfll driver to support Tegra210B01, but those did not work in testing, thus was dropped from the series. A bindings update to match is still in the series so the soc dtsi can declare a separate compatible from Tegra210, preventing the driver from attempting incorrect initialization on Tegra210B01.
---
Changes in v2:
- Fix patch 1 subject
- Add descriptive name in patch 8
- Fix copy-paste error in patch 13, discovered by kernel ci
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Aaron Kling (16):
dt-bindings: soc: tegra: pmc: Document Tegra210B01
dt-bindings: phy: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xudc: Document Tegra210B01
dt-bindings: thermal: tegra: Document Tegra210B01
dt-bindings: clock: tegra: Document Tegra210B01
dt-bindings: clock: tegra124-dfll: Document Tegra210B01
dt-bindings: tegra: Document Shield TV 2019
phy: tegra: xusb: Add Tegra201B01 Support
usb: xhci: tegra: Add Tegra210B01 support
usb: gadget: tegra-xudc: Add Tegra210B01 Support
thermal: tegra: Add Tegra210B01 Support
clk: tegra: Add Tegra210B01 support
arm64: tegra: Add BPMP node for Tegra210
arm64: tegra: Add Tegra210B01 support
arm64: tegra: Add support for NVIDIA Shield TV Pro 2019
Azkali Manad (1):
soc/tegra: pmc: Add Tegra210B01 support
Documentation/devicetree/bindings/arm/tegra.yaml | 6 + .../bindings/clock/nvidia,tegra124-dfll.txt | 1 + .../bindings/clock/nvidia,tegra20-car.yaml | 1 + .../bindings/phy/nvidia,tegra210-xusb-padctl.yaml | 4 +- .../bindings/soc/tegra/nvidia,tegra20-pmc.yaml | 5 +- .../bindings/thermal/nvidia,tegra124-soctherm.yaml | 2 + .../devicetree/bindings/usb/nvidia,tegra-xudc.yaml | 2 + .../bindings/usb/nvidia,tegra210-xusb.yaml | 4 +- arch/arm64/boot/dts/nvidia/Makefile | 1 + arch/arm64/boot/dts/nvidia/tegra210.dtsi | 11 + .../boot/dts/nvidia/tegra210b01-p2894-0050-a08.dts | 10 + arch/arm64/boot/dts/nvidia/tegra210b01-p2894.dtsi | 70 + arch/arm64/boot/dts/nvidia/tegra210b01.dtsi | 64 + drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra-periph.c | 3 + drivers/clk/tegra/clk-tegra210b01.c | 3758 ++++++++++++++++++++ drivers/clk/tegra/clk-utils.c | 5 +- drivers/clk/tegra/clk.c | 19 +- drivers/clk/tegra/clk.h | 6 + drivers/phy/tegra/xusb-tegra210.c | 41 + drivers/phy/tegra/xusb.c | 4 + drivers/phy/tegra/xusb.h | 1 + drivers/soc/tegra/pmc.c | 117 + drivers/thermal/tegra/soctherm.c | 4 + drivers/thermal/tegra/soctherm.h | 1 + drivers/thermal/tegra/tegra210-soctherm.c | 78 + drivers/usb/gadget/udc/tegra-xudc.c | 20 + drivers/usb/host/xhci-tegra.c | 25 + include/dt-bindings/clock/tegra210-car.h | 5 +- 29 files changed, 4262 insertions(+), 7 deletions(-)
---
base-commit: 347e9f5043c89695b01e66b3ed111755afcf1911
change-id: 20250509-t210b01-c154ca0f8994
Best regards,
Signature · 1 line
Aaron Kling <[email protected]>
PATCH v2 1/17 dt-bindings: soc: tegra: pmc: Document Tegra210B01
Add the PMC driver compatible strings for Tegra210B01
--- Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml +4 -1
@@ -18,6 +18,7 @@ properties: - nvidia,tegra114-pmc - nvidia,tegra124-pmc - nvidia,tegra210-pmc + - nvidia,tegra210b01-pmc reg: maxItems: 1
@@ -346,7 +347,9 @@ allOf: properties: compatible: contains: - const: nvidia,tegra210-pmc + enum: + - nvidia,tegra210-pmc + - nvidia,tegra210b01-pmc then: properties: pinmux:
Signature · 1 line
2.50.1
PATCH v2 2/17 dt-bindings: phy: tegra-xusb: Document Tegra210B01
In reply to Aaron KlingAdd the compatible string for the Tegra210B01 XUSB PHY
--- .../devicetree/bindings/phy/nvidia,tegra210-xusb-padctl.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/phy/nvidia,tegra210-xusb-padctl.yaml +3 -1
@@ -42,7 +42,9 @@ description: | properties: compatible: - const: nvidia,tegra210-xusb-padctl + enum: + - nvidia,tegra210-xusb-padctl + - nvidia,tegra210b01-xusb-padctl reg: maxItems: 1
Signature · 1 line
2.50.1
PATCH v2 3/17 dt-bindings: usb: tegra-xusb: Document Tegra210B01
In reply to Aaron KlingAdd the compatible string for Tegra210B01 XUSB
--- Documentation/devicetree/bindings/usb/nvidia,tegra210-xusb.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/usb/nvidia,tegra210-xusb.yaml +3 -1
@@ -15,7 +15,9 @@ description: The Tegra xHCI controller supports both USB2 and USB3 interfaces properties: compatible: - const: nvidia,tegra210-xusb + enum: + - nvidia,tegra210-xusb + - nvidia,tegra210b01-xusb reg: items:
Signature · 1 line
2.50.1
PATCH v2 4/17 dt-bindings: usb: tegra-xudc: Document Tegra210B01
In reply to Aaron KlingExtend the Tegra XUSB controller device tree binding with Tegra210B01 support.
--- Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/usb/nvidia,tegra-xudc.yaml +2 -0
@@ -20,6 +20,7 @@ properties: items: - enum: - nvidia,tegra210-xudc # For Tegra210 + - nvidia,tegra210b01-xudc # For Tegra210B01 - nvidia,tegra186-xudc # For Tegra186 - nvidia,tegra194-xudc # For Tegra194 - nvidia,tegra234-xudc # For Tegra234
@@ -130,6 +131,7 @@ allOf: contains: enum: - nvidia,tegra210-xudc + - nvidia,tegra210b01-xudc then: properties: reg:
Signature · 1 line
2.50.1
PATCH v2 5/17 dt-bindings: thermal: tegra: Document Tegra210B01
In reply to Aaron KlingAdd the compatible string for Tegra210B01 SOC_THERM
--- Documentation/devicetree/bindings/thermal/nvidia,tegra124-soctherm.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/thermal/nvidia,tegra124-soctherm.yaml +2 -0
@@ -21,6 +21,7 @@ properties: - nvidia,tegra124-soctherm - nvidia,tegra132-soctherm - nvidia,tegra210-soctherm + - nvidia,tegra210b01-soctherm reg: maxItems: 2
@@ -207,6 +208,7 @@ allOf: enum: - nvidia,tegra124-soctherm - nvidia,tegra210-soctherm + - nvidia,tegra210b01-soctherm then: properties: reg:
Signature · 1 line
2.50.1
PATCH v2 6/17 dt-bindings: clock: tegra: Document Tegra210B01
In reply to Aaron Kling* Add the compatible string for Tegra210B01 clock and reset
* Add Tegra210B01 specific clock bindings
--- Documentation/devicetree/bindings/clock/nvidia,tegra20-car.yaml | 1 + include/dt-bindings/clock/tegra210-car.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/nvidia,tegra20-car.yaml +1 -0
@@ -32,6 +32,7 @@ properties: - nvidia,tegra30-car - nvidia,tegra114-car - nvidia,tegra210-car + - nvidia,tegra210b01-car reg: maxItems: 1
include/dt-bindings/clock/tegra210-car.h +4 -1
@@ -409,6 +409,9 @@#define TEGRA210_CLK_DMIC3_SYNC_CLK 392#define TEGRA210_CLK_DMIC3_SYNC_CLK_MUX 393 -#define TEGRA210_CLK_CLK_MAX 394 +#define TEGRA210_CLK_UTMIPLL_60M 531 +#define TEGRA210_CLK_PLL_P_UPHY_OUT 532 + +#define TEGRA210_CLK_CLK_MAX 533#endif /* _DT_BINDINGS_CLOCK_TEGRA210_CAR_H */
Signature · 1 line
2.50.1
PATCH v2 7/17 dt-bindings: clock: tegra124-dfll: Document Tegra210B01
In reply to Aaron KlingAdd Tegra210B01 support for DFLL clock.
--- Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/nvidia,tegra124-dfll.txt +1 -0
@@ -13,6 +13,7 @@ Required properties: - compatible : should be one of: - "nvidia,tegra124-dfll": for Tegra124 - "nvidia,tegra210-dfll": for Tegra210 + - "nvidia,tegra210b01-dfll": for Tegra210B01 - reg : Defines the following set of registers, in the order listed: - registers for the DFLL control logic. - registers for the I2C output logic.
Signature · 1 line
2.50.1
PATCH v2 8/17 dt-bindings: tegra: Document Shield TV 2019
In reply to Aaron KlingAdd the device tree binding documentation for NVIDIA Shield TV 2019
--- Documentation/devicetree/bindings/arm/tegra.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/tegra.yaml +6 -0
@@ -174,6 +174,12 @@ properties: - nvidia,p2571 - nvidia,p2894-0050-a08 - const: nvidia,tegra210 + - description: SHIELD TV Pro 2019 + items: + - const: nvidia,p2894-0050-a08 + - const: nvidia,darcy + - const: nvidia,tegra210b01 + - const: nvidia,tegra210 - description: Jetson TX2 Developer Kit items: - const: nvidia,p2771-0000
Signature · 1 line
2.50.1
PATCH v2 9/17 soc/tegra: pmc: Add Tegra210B01 support
In reply to Aaron KlingFrom: Azkali Manad <[email protected]>
--- drivers/soc/tegra/pmc.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+)
drivers/soc/tegra/pmc.c +117 -0
@@ -3732,6 +3732,122 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = { .has_single_mmio_aperture = true, }; +static const struct tegra_io_pad_soc tegra210b01_io_pads[] = { +TEGRA_IO_PAD (TEGRA_IO_PAD_AUDIO ,17 ,0x1b8 ,0x1bc ,5 ,"audio" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_AUDIO_HV ,29 ,0x1c0 ,0x1c4 ,18 ,"audio-hv" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CAM ,4 ,0x1c0 ,0x1c4 ,10 ,"cam" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSIA ,0 ,0x1b8 ,0x1bc ,UINT_MAX ,"csia" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSIB ,1 ,0x1b8 ,0x1bc ,UINT_MAX ,"csib" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSIC ,10 ,0x1c0 ,0x1c4 ,UINT_MAX ,"csic" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSID ,11 ,0x1c0 ,0x1c4 ,UINT_MAX ,"csid" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSIE ,12 ,0x1c0 ,0x1c4 ,UINT_MAX ,"csie" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_CSIF ,13 ,0x1c0 ,0x1c4 ,UINT_MAX ,"csif" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DBG ,25 ,0x1b8 ,0x1bc ,19 ,"dbg" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DEBUG_NONAO ,26 ,0x1b8 ,0x1bc ,UINT_MAX ,"debug-nonao" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DMIC ,18 ,0x1c0 ,0x1c4 ,20 ,"dmic" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DP ,19 ,0x1c0 ,0x1c4 ,UINT_MAX ,"dp" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DSI ,2 ,0x1b8 ,0x1bc ,UINT_MAX ,"dsi" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DSIB ,7 ,0x1c0 ,0x1c4 ,UINT_MAX ,"dsib" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DSIC ,8 ,0x1c0 ,0x1c4 ,UINT_MAX ,"dsic" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_DSID ,9 ,0x1c0 ,0x1c4 ,UINT_MAX ,"dsid" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_EMMC ,3 ,0x1c0 ,0x1c4 ,UINT_MAX ,"emmc" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_EMMC2 ,5 ,0x1c0 ,0x1c4 ,UINT_MAX ,"emmc2" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_GPIO ,27 ,0x1b8 ,0x1bc ,21 ,"gpio" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_HDMI ,28 ,0x1b8 ,0x1bc ,UINT_MAX ,"hdmi" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_HSIC ,19 ,0x1b8 ,0x1bc ,UINT_MAX ,"hsic" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_LVDS ,25 ,0x1c0 ,0x1c4 ,UINT_MAX ,"lvds" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_MIPI_BIAS ,3 ,0x1b8 ,0x1bc ,UINT_MAX ,"mipi-bias" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_PEX_BIAS ,4 ,0x1b8 ,0x1bc ,UINT_MAX ,"pex-bias" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_PEX_CLK1 ,5 ,0x1b8 ,0x1bc ,UINT_MAX ,"pex-clk1" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_PEX_CLK2 ,6 ,0x1b8 ,0x1bc ,UINT_MAX ,"pex-clk2" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_PEX_CNTRL ,UINT_MAX ,UINT_MAX ,UINT_MAX ,11 ,"pex-cntrl" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_SDMMC1 ,1 ,0x1c0 ,0x1c4 ,12 ,"sdmmc1" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_SDMMC3 ,2 ,0x1c0 ,0x1c4 ,13 ,"sdmmc3" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_SPI ,14 ,0x1c0 ,0x1c4 ,22 ,"spi" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_SPI_HV ,15 ,0x1c0 ,0x1c4 ,23 ,"spi-hv" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_UART ,14 ,0x1b8 ,0x1bc ,2 ,"uart" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_USB0 ,9 ,0x1b8 ,0x1bc ,UINT_MAX ,"usb0" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_USB1 ,10 ,0x1b8 ,0x1bc ,UINT_MAX ,"usb1" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_USB2 ,11 ,0x1b8 ,0x1bc ,UINT_MAX ,"usb2" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_USB3 ,18 ,0x1b8 ,0x1bc ,UINT_MAX ,"usb3" ), +TEGRA_IO_PAD (TEGRA_IO_PAD_USB_BIAS ,12 ,0x1b8 ,0x1bc ,UINT_MAX ,"usb-bias" ), +}; + +static const struct pinctrl_pin_desc tegra210b01_pin_descs[] = { +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_AUDIO ,"audio" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_AUDIO_HV ,"audio-hv" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CAM ,"cam" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSIA ,"csia" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSIB ,"csib" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSIC ,"csic" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSID ,"csid" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSIE ,"csie" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_CSIF ,"csif" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DBG ,"dbg" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DEBUG_NONAO ,"debug-nonao" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DMIC ,"dmic" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DP ,"dp" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DSI ,"dsi" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DSIB ,"dsib" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DSIC ,"dsic" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_DSID ,"dsid" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_EMMC ,"emmc" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_EMMC2 ,"emmc2" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_GPIO ,"gpio" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_HDMI ,"hdmi" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_HSIC ,"hsic" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_LVDS ,"lvds" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_MIPI_BIAS ,"mipi-bias" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_PEX_BIAS ,"pex-bias" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_PEX_CLK1 ,"pex-clk1" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_PEX_CLK2 ,"pex-clk2" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_PEX_CNTRL ,"pex-cntrl" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_SDMMC1 ,"sdmmc1" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_SDMMC3 ,"sdmmc3" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_SPI ,"spi" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_SPI_HV ,"spi-hv" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_UART ,"uart" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_USB0 ,"usb0" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_USB1 ,"usb1" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_USB2 ,"usb2" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_USB3 ,"usb3" ), +TEGRA_IO_PIN_DESC (TEGRA_IO_PAD_USB_BIAS ,"usb-bias" ), +}; + +static const struct tegra_pmc_soc tegra210b01_pmc_soc = { + .supports_core_domain = false, + .num_powergates =ARRAY_SIZE (tegra210_powergates), + .powergates = tegra210_powergates, + .num_cpu_powergates =ARRAY_SIZE (tegra210_cpu_powergates), + .cpu_powergates = tegra210_cpu_powergates, + .has_tsense_reset = true, + .has_gpu_clamps = true, + .needs_mbist_war = true, + .has_impl_33v_pwr = false, + .maybe_tz_only = true, + .num_io_pads =ARRAY_SIZE (tegra210b01_io_pads), + .io_pads = tegra210b01_io_pads, + .num_pin_descs =ARRAY_SIZE (tegra210b01_pin_descs), + .pin_descs = tegra210b01_pin_descs, + .regs = &tegra20_pmc_regs, + .init = tegra20_pmc_init, + .setup_irq_polarity = tegra20_pmc_setup_irq_polarity, + .powergate_set = tegra114_powergate_set, + .irq_set_wake = tegra210_pmc_irq_set_wake, + .irq_set_type = tegra210_pmc_irq_set_type, + .reset_sources = tegra210_reset_sources, + .num_reset_sources =ARRAY_SIZE (tegra210_reset_sources), + .reset_levels =NULL , + .num_reset_levels =0 , + .num_wake_events =ARRAY_SIZE (tegra210_wake_events), + .wake_events = tegra210_wake_events, + .pmc_clks_data = tegra_pmc_clks_data, + .num_pmc_clks =ARRAY_SIZE (tegra_pmc_clks_data), + .has_blink_output = true, + .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, +}; +static const struct tegra_io_pad_soc tegra186_io_pads[] = {TEGRA_IO_PAD (TEGRA_IO_PAD_CSIA ,0 ,0x74 ,0x78 ,UINT_MAX ,"csia" ),TEGRA_IO_PAD (TEGRA_IO_PAD_CSIB ,1 ,0x74 ,0x78 ,UINT_MAX ,"csib" ),
@@ -4253,6 +4369,7 @@ static const struct of_device_id tegra_pmc_match[] = { { .compatible = "nvidia,tegra194-pmc", .data = &tegra194_pmc_soc }, { .compatible = "nvidia,tegra186-pmc", .data = &tegra186_pmc_soc }, { .compatible = "nvidia,tegra210-pmc", .data = &tegra210_pmc_soc }, + { .compatible = "nvidia,tegra210b01-pmc", .data = &tegra210b01_pmc_soc }, { .compatible = "nvidia,tegra132-pmc", .data = &tegra124_pmc_soc }, { .compatible = "nvidia,tegra124-pmc", .data = &tegra124_pmc_soc }, { .compatible = "nvidia,tegra114-pmc", .data = &tegra114_pmc_soc },
Signature · 1 line
2.50.1
PATCH v2 10/17 phy: tegra: xusb: Add Tegra201B01 Support
In reply to Aaron KlingIt has slightly different lanes compared to the original Tegra210.
--- drivers/phy/tegra/xusb-tegra210.c | 41 +++++++++++++++++++++++++++++++++++++++ drivers/phy/tegra/xusb.c | 4 ++++ drivers/phy/tegra/xusb.h | 1 + 3 files changed, 46 insertions(+)
drivers/phy/tegra/xusb-tegra210.c +41 -0
@@ -2559,6 +2559,15 @@ static const struct tegra_xusb_lane_soc tegra210_pcie_lanes[] = { TEGRA210_UPHY_LANE("pcie-6", 0x028, 24, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(6)), }; +static const struct tegra_xusb_lane_soc tegra210b01_pcie_lanes[] = { +TEGRA210_UPHY_LANE ("pcie-0" ,0x028 ,12 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (0 )), +TEGRA210_UPHY_LANE ("pcie-1" ,0x028 ,14 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (1 )), +TEGRA210_UPHY_LANE ("pcie-2" ,0x028 ,16 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (2 )), +TEGRA210_UPHY_LANE ("pcie-3" ,0x028 ,18 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (3 )), +TEGRA210_UPHY_LANE ("pcie-4" ,0x028 ,20 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (4 )), +TEGRA210_UPHY_LANE ("pcie-5" ,0x028 ,22 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2 (5 )), +}; +static struct tegra_xusb_usb3_port *tegra210_lane_to_usb3_port (struct tegra_xusb_lane *lane) {
@@ -2847,6 +2856,13 @@ static const struct tegra_xusb_pad_soc tegra210_pcie_pad = { .ops = &tegra210_pcie_ops, }; +static const struct tegra_xusb_pad_soc tegra210b01_pcie_pad = { + .name ="pcie" , + .num_lanes =ARRAY_SIZE (tegra210b01_pcie_lanes), + .lanes = tegra210b01_pcie_lanes, + .ops = &tegra210_pcie_ops, +}; +static const struct tegra_xusb_lane_soc tegra210_sata_lanes[] = {TEGRA210_UPHY_LANE ("sata-0" ,0x028 ,30 ,0x3 , pcie,XUSB_PADCTL_UPHY_MISC_PAD_S0_CTL2 ), };
@@ -3016,6 +3032,11 @@ static const struct tegra_xusb_pad_soc * const tegra210_pads[] = { &tegra210_sata_pad, }; +static const struct tegra_xusb_pad_soc *const tegra210b01_pads[] = { + &tegra210_usb2_pad, + &tegra210b01_pcie_pad, +}; +static int tegra210_usb2_port_enable (struct tegra_xusb_port *port) {return 0 ;
@@ -3290,6 +3311,26 @@ const struct tegra_xusb_padctl_soc tegra210_xusb_padctl_soc = { };EXPORT_SYMBOL_GPL (tegra210_xusb_padctl_soc); +const struct tegra_xusb_padctl_soc tegra210b01_xusb_padctl_soc = { + .num_pads =ARRAY_SIZE (tegra210b01_pads), + .pads = tegra210b01_pads, + .ports = { + .usb2 = { + .ops = &tegra210_usb2_port_ops, + .count =4 , + }, + .usb3 = { + .ops = &tegra210_usb3_port_ops, + .count =4 , + }, + }, + .ops = &tegra210_xusb_padctl_ops, + .supply_names = tegra210_xusb_padctl_supply_names, + .num_supplies =ARRAY_SIZE (tegra210_xusb_padctl_supply_names), + .need_fake_usb3_port = true, +}; +EXPORT_SYMBOL_GPL (tegra210b01_xusb_padctl_soc); +MODULE_AUTHOR ("Andrew Bresticker <[email protected]>" );MODULE_DESCRIPTION ("NVIDIA Tegra 210 XUSB Pad Controller driver" );MODULE_LICENSE ("GPL v2" );
drivers/phy/tegra/xusb.c +4 -0
@@ -59,6 +59,10 @@ static const struct of_device_id tegra_xusb_padctl_of_match[] = { .compatible = "nvidia,tegra210-xusb-padctl", .data = &tegra210_xusb_padctl_soc, }, + { + .compatible = "nvidia,tegra210b01-xusb-padctl", + .data = &tegra210b01_xusb_padctl_soc, + },#endif #if defined(CONFIG_ARCH_TEGRA_186_SOC ) {
drivers/phy/tegra/xusb.h +1 -0
@@ -503,6 +503,7 @@ extern const struct tegra_xusb_padctl_soc tegra124_xusb_padctl_soc;#endif #if defined(CONFIG_ARCH_TEGRA_210_SOC )extern const struct tegra_xusb_padctl_soc tegra210_xusb_padctl_soc; +extern const struct tegra_xusb_padctl_soc tegra210b01_xusb_padctl_soc;#endif #if defined(CONFIG_ARCH_TEGRA_186_SOC )extern const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc;
Signature · 1 line
2.50.1
PATCH v2 11/17 usb: xhci: tegra: Add Tegra210B01 support
In reply to Aaron KlingThis uses a different firmware, but is otherwise compatible with Tegra210.
--- drivers/usb/host/xhci-tegra.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/usb/host/xhci-tegra.c +25 -0
@@ -2547,6 +2547,30 @@ static const struct tegra_xusb_soc tegra210_soc = { };MODULE_FIRMWARE ("nvidia/tegra210/xusb.bin" ); +static const struct tegra_xusb_soc tegra210b01_soc = { + .firmware ="nvidia/tegra210b01/xusb.bin" , + .supply_names = tegra210_supply_names, + .num_supplies =ARRAY_SIZE (tegra210_supply_names), + .phy_types = tegra210_phy_types, + .num_types =ARRAY_SIZE (tegra210_phy_types), + .context = &tegra124_xusb_context, + .ports = { + .usb2 = { .offset =4 , .count =4 , }, + .hsic = { .offset =8 , .count =1 , }, + .usb3 = { .offset =0 , .count =4 , }, + }, + .scale_ss_clock = false, + .has_ipfs = true, + .otg_reset_sspi = true, + .mbox = { + .cmd =0xe4 , + .data_in =0xe8 , + .data_out =0xec , + .owner =0xf0 , + }, +}; +MODULE_FIRMWARE ("nvidia/tegra210b01/xusb.bin" ); +static const char *const tegra186_supply_names[] = { };MODULE_FIRMWARE ("nvidia/tegra186/xusb.bin" );
@@ -2659,6 +2683,7 @@ static const struct tegra_xusb_soc tegra234_soc = {static const struct of_device_id tegra_xusb_of_match[] = { { .compatible ="nvidia,tegra124-xusb" , .data = &tegra124_soc }, { .compatible ="nvidia,tegra210-xusb" , .data = &tegra210_soc }, + { .compatible ="nvidia,tegra210b01-xusb" , .data = &tegra210b01_soc }, { .compatible ="nvidia,tegra186-xusb" , .data = &tegra186_soc }, { .compatible ="nvidia,tegra194-xusb" , .data = &tegra194_soc }, { .compatible ="nvidia,tegra234-xusb" , .data = &tegra234_soc },
Signature · 1 line
2.50.1
PATCH v2 12/17 usb: gadget: tegra-xudc: Add Tegra210B01 Support
In reply to Aaron KlingIt doesn't need some of the workarounds that the original Tegra210 does.
--- drivers/usb/gadget/udc/tegra-xudc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/usb/gadget/udc/tegra-xudc.c +20 -0
@@ -3652,6 +3652,22 @@ static struct tegra_xudc_soc tegra210_xudc_soc_data = { .has_ipfs = true, }; +static struct tegra_xudc_soc tegra210b01_xudc_soc_data = { + .supply_names = tegra210_xudc_supply_names, + .num_supplies =ARRAY_SIZE (tegra210_xudc_supply_names), + .clock_names = tegra210_xudc_clock_names, + .num_clks =ARRAY_SIZE (tegra210_xudc_clock_names), + .num_phys =4 , + .u1_enable = false, + .u2_enable = true, + .lpm_enable = false, + .invalid_seq_num = false, + .pls_quirk = false, + .port_reset_quirk = true, + .port_speed_quirk = false, + .has_ipfs = true, +}; +static struct tegra_xudc_soc tegra186_xudc_soc_data = { .clock_names = tegra186_xudc_clock_names, .num_clks =ARRAY_SIZE (tegra186_xudc_clock_names),
@@ -3698,6 +3714,10 @@ static const struct of_device_id tegra_xudc_of_match[] = { .compatible = "nvidia,tegra210-xudc", .data = &tegra210_xudc_soc_data }, + { + .compatible = "nvidia,tegra210b01-xudc", + .data = &tegra210b01_xudc_soc_data + }, { .compatible ="nvidia,tegra186-xudc" , .data = &tegra186_xudc_soc_data
Signature · 1 line
2.50.1
PATCH v2 13/17 thermal: tegra: Add Tegra210B01 Support
In reply to Aaron KlingAdd Tegra210B01 SOC_THERM configuration
--- drivers/thermal/tegra/soctherm.c | 4 ++ drivers/thermal/tegra/soctherm.h | 1 + drivers/thermal/tegra/tegra210-soctherm.c | 78 +++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+)
drivers/thermal/tegra/soctherm.c +4 -0
@@ -2065,6 +2065,10 @@ static const struct of_device_id tegra_soctherm_of_match[] = { .compatible = "nvidia,tegra210-soctherm", .data = &tegra210_soctherm, }, + { + .compatible = "nvidia,tegra210b01-soctherm", + .data = &tegra210b01_soctherm, + },#endif { }, };
drivers/thermal/tegra/soctherm.h +1 -0
@@ -147,6 +147,7 @@ extern const struct tegra_soctherm_soc tegra132_soctherm;#ifdef CONFIG_ARCH_TEGRA_210_SOC extern const struct tegra_soctherm_soc tegra210_soctherm; +extern const struct tegra_soctherm_soc tegra210b01_soctherm;#endif #endif
drivers/thermal/tegra/tegra210-soctherm.c +78 -0
99 lines not on this page · raw message
Signature · 1 line
2.50.1
PATCH v2 14/17 clk: tegra: Add Tegra210B01 support
In reply to Aaron KlingThis is based on the downstream Nvidia 5.10 kernel. That version was semi-integrated into the Tegra210 clock driver. Looking at the existing Tegra210 support, it made more sense to make this a fully independent driver, so that is implemented here.
--- drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra-periph.c | 3 + drivers/clk/tegra/clk-tegra210b01.c | 3758 ++++++++++++++++++++++++++++++++++ drivers/clk/tegra/clk-utils.c | 5 +- drivers/clk/tegra/clk.c | 19 +- drivers/clk/tegra/clk.h | 6 + 6 files changed, 3789 insertions(+), 3 deletions(-)
drivers/clk/tegra/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_TEGRA124_CLK_EMC) += clk-tegra124-emc.o obj-$(CONFIG_ARCH_TEGRA_132_SOC) += clk-tegra124.o obj-y += cvb.o obj-$(CONFIG_ARCH_TEGRA_210_SOC) += clk-tegra210.o +obj-$(CONFIG_ARCH_TEGRA_210_SOC) += clk-tegra210b01.o obj-$(CONFIG_ARCH_TEGRA_210_SOC) += clk-tegra210-emc.o obj-$(CONFIG_CLK_TEGRA_BPMP) += clk-bpmp.o obj-y += clk-utils.o
drivers/clk/tegra/clk-tegra-periph.c +3 -0
@@ -878,6 +878,9 @@ static void __init periph_clk_init(void __iomem *clk_base,if (!bank)continue ; +if (tegra_clks[data->clk_id].use_integer_div) + data->periph.divider.flags |=TEGRA_DIVIDER_INT ; + data->periph.gate.regs = bank; clk =tegra_clk_register_periph_data (clk_base, data); *dt_clk = clk;
drivers/clk/tegra/clk-tegra210b01.c new file +3758 -0
2,984 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.50.1
Part of the diff is not shown here. View the raw message.
PATCH v2 15/17 arm64: tegra: Add BPMP node for Tegra210
In reply to Aaron KlingThe Tegra210 soc supports bpmp offload for power management among other things. This was considered insecure partway through the soc's lifecycle and support was removed in the bootloader. However, Tegra210B01 returned to using the bpmp. Plus old bootloaders on the original Tegra210 still work with the existing driver. So add the node to the common Tegra210 soc dtsi, but disabled by default.
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +11 -0
@@ -968,6 +968,17 @@ cec@70015000 { status = "disabled"; }; + bpmp: bpmp@70016000 { + compatible = "nvidia,tegra210-bpmp"; + reg = <0x0 0x70016000 0x0 0x2000 + 0x0 0x60001000 0x0 0x1000>; + status = "disabled"; + + interrupts = <GIC_SPI 6 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "tx", "rx"; + }; + mc: memory-controller@70019000 { compatible = "nvidia,tegra210-mc"; reg = <0x0 0x70019000 0x0 0x1000>;
Signature · 1 line
2.50.1
PATCH v2 16/17 arm64: tegra: Add Tegra210B01 support
In reply to Aaron KlingAlso known as Tegra X1+, the Tegra210B01 has higher CPU and GPU clocks than the original Tegra210.
Add a SoC-level device tree file that describes most of the hardware available on the SoC. This is derived from the Tegra210 dtsi, as they share a lot.
--- arch/arm64/boot/dts/nvidia/tegra210b01.dtsi | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210b01.dtsi new file +64 -0
@@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "tegra210.dtsi" + +/ { + compatible = "nvidia,tegra210b01", "nvidia,tegra210"; + + host1x@50000000 { + /delete-node/ sor@54540000; + /delete-node/ dpaux@545c0000; + + dc@54200000 { + nvidia,outputs = <&dsia &dsib &sor1>; + }; + + dc@54240000 { + nvidia,outputs = <&dsia &dsib &sor1>; + }; + }; + + clock@60006000 { + compatible = "nvidia,tegra210b01-car"; + }; + + i2c@7000d100 { + /delete-property/ pinctrl-0; + /delete-property/ pinctrl-1; + /delete-property/ pinctrl-names; + }; + + pmc@7000e400 { + compatible = "nvidia,tegra210b01-pmc"; + }; + + bpmp@70016000 { + status = "okay"; + }; + + usb@70090000 { + compatible = "nvidia,tegra210b01-xusb"; + }; + + padctl@7009f000 { + compatible = "nvidia,tegra210b01-xusb-padctl"; + }; + + usb@700d0000 { + compatible = "nvidia,tegra210b01-xudc"; + }; + + thermal-sensor@700e2000 { + compatible = "nvidia,tegra210b01-soctherm"; + + throttle-cfgs { + heavy { + nvidia,cpu-throt-percent = <0>; + nvidia,gpu-throt-level = <TEGRA_SOCTHERM_THROT_LEVEL_NONE>; + }; + }; + }; + + clock@70110000 { + compatible = "nvidia,tegra210b01-dfll"; + }; +};
Signature · 1 line
2.50.1
PATCH v2 17/17 arm64: tegra: Add support for NVIDIA Shield TV Pro 2019
In reply to Aaron KlingAdd initial device-tree support for NVIDIA Shield TV Pro 2019 (a.k.a MDarcy) based up the Tegra210B01 SoC with 3 GiB of LPDDR4 RAM.
This is very basic, intended for checking initial Tegra210B01 support. More complete support for the device will be added later.
--- arch/arm64/boot/dts/nvidia/Makefile | 1 + .../boot/dts/nvidia/tegra210b01-p2894-0050-a08.dts | 10 ++++ arch/arm64/boot/dts/nvidia/tegra210b01-p2894.dtsi | 70 ++++++++++++++++++++++ 3 files changed, 81 insertions(+)
arch/arm64/boot/dts/nvidia/Makefile +1 -0
@@ -20,6 +20,7 @@ dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2571.dtb dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p3450-0000.dtb dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-smaug.dtb dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-p2894-0050-a08.dtb +dtb-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210b01-p2894-0050-a08.dtb dtb-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186-p2771-0000.dtb dtb-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186-p3509-0000+p3636-0001.dtb dtb-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra194-p2972-0000.dtb
arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dts new file +10 -0
@@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +#include "tegra210b01-p2894.dtsi" + +/ { + model = "NVIDIA Shield TV Pro 2019"; + compatible = "nvidia,p2894-0050-a08", "nvidia,darcy", "nvidia,tegra210b01", + "nvidia,tegra210"; +};
arch/arm64/boot/dts/nvidia/tegra210b01-p2894.dtsi new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
2.50.1
Re: [PATCH v2 01/17] dt-bindings: soc: tegra: pmc: Document Tegra210B01
In reply to Aaron KlingQuoted 1 line · Aaron Kling
Add the PMC driver compatible strings for Tegra210B01
And what is Tegra210B01? Do not say what you are doing - it is obvious from the diff. In this case here say what you are ADDING, what hardware is this.
Quoted 11 lines
Signed-off-by Aaron Kling <[email protected]>--- Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml +0
-0
Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml properties: · line 21
Quoted 4 lines
Documentation/devicetree/bindings/soc/tegra/nvidia,tegra20-pmc.yaml +1
-0@@ -18,6 +18,7 @@ properties: - nvidia,tegra114-pmc - nvidia,tegra124-pmc - nvidia,tegra210-pmc + - nvidia,tegra210b01-pmc
Why they are not compatible? Commit msg is also silent on that.
Best regards,
Krzysztof
Rob Herring (Arm)
maintainerQuoted 76 lines · Aaron Kling
Also known as Tegra X1+, the Tegra210B01 has higher CPU and GPU clocks than the original Tegra210.
This series adds Tegra210B01 support to several drivers, as a slight extension to the existing Tegra210 support. Then adds a generic soc dtsi in the same vein as other tegra archs. And finally adds a barebones device dts to be used for dt checks. Further device support will be submitted in later series.
Earlier internal revisions of this series included changes to the dfll driver to support Tegra210B01, but those did not work in testing, thus was dropped from the series. A bindings update to match is still in the series so the soc dtsi can declare a separate compatible from Tegra210, preventing the driver from attempting incorrect initialization on Tegra210B01.
Signed-off-by Aaron Kling <[email protected]>---
Changes in v2:
- Fix patch 1 subject
- Add descriptive name in patch 8
- Fix copy-paste error in patch 13, discovered by kernel ci
- Link to v1: https://lore.kernel.org/r/[email protected]---
Aaron Kling (16):
dt-bindings: soc: tegra: pmc: Document Tegra210B01
dt-bindings: phy: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xudc: Document Tegra210B01
dt-bindings: thermal: tegra: Document Tegra210B01
dt-bindings: clock: tegra: Document Tegra210B01
dt-bindings: clock: tegra124-dfll: Document Tegra210B01
dt-bindings: tegra: Document Shield TV 2019
phy: tegra: xusb: Add Tegra201B01 Support
usb: xhci: tegra: Add Tegra210B01 support
usb: gadget: tegra-xudc: Add Tegra210B01 Support
thermal: tegra: Add Tegra210B01 Support
clk: tegra: Add Tegra210B01 support
arm64: tegra: Add BPMP node for Tegra210
arm64: tegra: Add Tegra210B01 support
arm64: tegra: Add support for NVIDIA Shield TV Pro 2019Azkali Manad (1):
soc/tegra: pmc: Add Tegra210B01 supportDocumentation/devicetree/bindings/arm/tegra.yaml | 6 + .../bindings/clock/nvidia,tegra124-dfll.txt | 1 + .../bindings/clock/nvidia,tegra20-car.yaml | 1 + .../bindings/phy/nvidia,tegra210-xusb-padctl.yaml | 4 +- .../bindings/soc/tegra/nvidia,tegra20-pmc.yaml | 5 +- .../bindings/thermal/nvidia,tegra124-soctherm.yaml | 2 + .../devicetree/bindings/usb/nvidia,tegra-xudc.yaml | 2 + .../bindings/usb/nvidia,tegra210-xusb.yaml | 4 +- arch/arm64/boot/dts/nvidia/Makefile | 1 + arch/arm64/boot/dts/nvidia/tegra210.dtsi | 11 + .../boot/dts/nvidia/tegra210b01-p2894-0050-a08.dts | 10 + arch/arm64/boot/dts/nvidia/tegra210b01-p2894.dtsi | 70 + arch/arm64/boot/dts/nvidia/tegra210b01.dtsi | 64 + drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra-periph.c | 3 + drivers/clk/tegra/clk-tegra210b01.c | 3758 ++++++++++++++++++++ drivers/clk/tegra/clk-utils.c | 5 +- drivers/clk/tegra/clk.c | 19 +- drivers/clk/tegra/clk.h | 6 + drivers/phy/tegra/xusb-tegra210.c | 41 + drivers/phy/tegra/xusb.c | 4 + drivers/phy/tegra/xusb.h | 1 + drivers/soc/tegra/pmc.c | 117 + drivers/thermal/tegra/soctherm.c | 4 + drivers/thermal/tegra/soctherm.h | 1 + drivers/thermal/tegra/tegra210-soctherm.c | 78 + drivers/usb/gadget/udc/tegra-xudc.c | 20 + drivers/usb/host/xhci-tegra.c | 25 + include/dt-bindings/clock/tegra210-car.h | 5 +- 29 files changed, 4262 insertions(+), 7 deletions(-)
Quoted 10 lines
---
base-commit:347e9f5043c89695b01e66b3ed111755afcf1911
change-id: 20250509-t210b01-c154ca0f8994Best regards,
--
Aaron Kling <[email protected]>
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
This patch series was applied (using b4) to base:
Base: using specified base-commit 347e9f5043c89695b01e66b3ed111755afcf1911
If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)
New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/nvidia/' for [email protected]:
arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /pcie@1003000: failed to match any schema with compatible: ['nvidia,tegra210-pcie'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /host1x@50000000/tsec@54100000: failed to match any schema with compatible: ['nvidia,tegra210-tsec'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /host1x@50000000/tsec@54500000: failed to match any schema with compatible: ['nvidia,tegra210-tsec'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /gpu@57000000: failed to match any schema with compatible: ['nvidia,gm20b'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /interrupt-controller@60004000: failed to match any schema with compatible: ['nvidia,tegra210-ictlr'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /dma@60020000: failed to match any schema with compatible: ['nvidia,tegra210-apbdma', 'nvidia,tegra148-apbdma'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /dma@60020000: failed to match any schema with compatible: ['nvidia,tegra210-apbdma', 'nvidia,tegra148-apbdma'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /memory-controller@70019000: failed to match any schema with compatible: ['nvidia,tegra210-mc'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: external-memory-controller@7001b000 (nvidia,tegra210-emc): '#cooling-cells' does not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra210-emc.yaml#arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /clock@70110000: failed to match any schema with compatible: ['nvidia,tegra210b01-dfll'] arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: usb-phy@7d000000 (nvidia,tegra210-usb-phy): compatible: 'oneOf' conditional failed, one must be fixed:
['nvidia,tegra210-usb-phy', 'nvidia,tegra30-usb-phy'] is too long 'nvidia,tegra210-usb-phy' is not one of ['nvidia,tegra124-usb-phy', 'nvidia,tegra114-usb-phy'] 'nvidia,tegra210-usb-phy' is not one of ['nvidia,tegra30-usb-phy', 'nvidia,tegra20-usb-phy'] from schema $id: http://devicetree.org/schemas/phy/nvidia,tegra20-usb-phy.yaml# arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /usb-phy@7d000000: failed to match any schema with compatible: ['nvidia,tegra210-usb-phy', 'nvidia,tegra30-usb-phy'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: usb-phy@7d004000 (nvidia,tegra210-usb-phy): compatible: 'oneOf' conditional failed, one must be fixed: ['nvidia,tegra210-usb-phy', 'nvidia,tegra30-usb-phy'] is too long 'nvidia,tegra210-usb-phy' is not one of ['nvidia,tegra124-usb-phy', 'nvidia,tegra114-usb-phy'] 'nvidia,tegra210-usb-phy' is not one of ['nvidia,tegra30-usb-phy', 'nvidia,tegra20-usb-phy'] from schema $id: http://devicetree.org/schemas/phy/nvidia,tegra20-usb-phy.yaml#
arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: /usb-phy@7d004000: failed to match any schema with compatible: ['nvidia,tegra210-usb-phy', 'nvidia,tegra30-usb-phy'] arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: cpu@0 (arm,cortex-a57): 'operating-points' is a dependency of 'clock-latency'
from schema $id: http://devicetree.org/schemas/arm/cpus.yaml#arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: cpu@0 (arm,cortex-a57): Unevaluated properties are not allowed ('clock-latency' was unexpected)
from schema $id: http://devicetree.org/schemas/arm/cpus.yaml#arch/arm64/boot/dts/nvidia/tegra210b01-p2894-0050-a08.dtb: thermal-zones: mem-thermal:cooling-maps: 'dram-active', 'dram-passive' do not match any of the regexes: '^map[-a-zA-Z0-9]*$', '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/thermal/thermal-zones.yaml#arch/arm64/boot/dts/nvidia/tegra210-p2371-0000.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210-p2571.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210-smaug.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp'] arch/arm64/boot/dts/nvidia/tegra210-p2894-0050-a08.dtb: /bpmp@70016000: failed to match any schema with compatible: ['nvidia,tegra210-bpmp']
Re: [PATCH v2 08/17] dt-bindings: tegra: Document Shield TV 2019
In reply to Aaron KlingQuoted 7 lines · Aaron Kling
Add the device tree binding documentation for NVIDIA Shield TV 2019
Signed-off-by Aaron Kling <[email protected]>--- Documentation/devicetree/bindings/arm/tegra.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 77 lines · On Sun, Jul 20, 2025 at 9:17 PM Aaron Kling via B4 Relay…
Also known as Tegra X1+, the Tegra210B01 has higher CPU and GPU clocks than the original Tegra210.
This series adds Tegra210B01 support to several drivers, as a slight extension to the existing Tegra210 support. Then adds a generic soc dtsi in the same vein as other tegra archs. And finally adds a barebones device dts to be used for dt checks. Further device support will be submitted in later series.
Earlier internal revisions of this series included changes to the dfll driver to support Tegra210B01, but those did not work in testing, thus was dropped from the series. A bindings update to match is still in the series so the soc dtsi can declare a separate compatible from Tegra210, preventing the driver from attempting incorrect initialization on Tegra210B01.
Signed-off-by Aaron Kling <[email protected]>---
Changes in v2:
- Fix patch 1 subject
- Add descriptive name in patch 8
- Fix copy-paste error in patch 13, discovered by kernel ci
- Link to v1: https://lore.kernel.org/r/[email protected]---
Aaron Kling (16):
dt-bindings: soc: tegra: pmc: Document Tegra210B01
dt-bindings: phy: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xusb: Document Tegra210B01
dt-bindings: usb: tegra-xudc: Document Tegra210B01
dt-bindings: thermal: tegra: Document Tegra210B01
dt-bindings: clock: tegra: Document Tegra210B01
dt-bindings: clock: tegra124-dfll: Document Tegra210B01
dt-bindings: tegra: Document Shield TV 2019
phy: tegra: xusb: Add Tegra201B01 Support
usb: xhci: tegra: Add Tegra210B01 support
usb: gadget: tegra-xudc: Add Tegra210B01 Support
thermal: tegra: Add Tegra210B01 Support
clk: tegra: Add Tegra210B01 support
arm64: tegra: Add BPMP node for Tegra210
arm64: tegra: Add Tegra210B01 support
arm64: tegra: Add support for NVIDIA Shield TV Pro 2019Azkali Manad (1):
soc/tegra: pmc: Add Tegra210B01 supportDocumentation/devicetree/bindings/arm/tegra.yaml | 6 + .../bindings/clock/nvidia,tegra124-dfll.txt | 1 + .../bindings/clock/nvidia,tegra20-car.yaml | 1 + .../bindings/phy/nvidia,tegra210-xusb-padctl.yaml | 4 +- .../bindings/soc/tegra/nvidia,tegra20-pmc.yaml | 5 +- .../bindings/thermal/nvidia,tegra124-soctherm.yaml | 2 + .../devicetree/bindings/usb/nvidia,tegra-xudc.yaml | 2 + .../bindings/usb/nvidia,tegra210-xusb.yaml | 4 +- arch/arm64/boot/dts/nvidia/Makefile | 1 + arch/arm64/boot/dts/nvidia/tegra210.dtsi | 11 + .../boot/dts/nvidia/tegra210b01-p2894-0050-a08.dts | 10 + arch/arm64/boot/dts/nvidia/tegra210b01-p2894.dtsi | 70 + arch/arm64/boot/dts/nvidia/tegra210b01.dtsi | 64 + drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra-periph.c | 3 + drivers/clk/tegra/clk-tegra210b01.c | 3758 ++++++++++++++++++++ drivers/clk/tegra/clk-utils.c | 5 +- drivers/clk/tegra/clk.c | 19 +- drivers/clk/tegra/clk.h | 6 + drivers/phy/tegra/xusb-tegra210.c | 41 + drivers/phy/tegra/xusb.c | 4 + drivers/phy/tegra/xusb.h | 1 + drivers/soc/tegra/pmc.c | 117 + drivers/thermal/tegra/soctherm.c | 4 + drivers/thermal/tegra/soctherm.h | 1 + drivers/thermal/tegra/tegra210-soctherm.c | 78 + drivers/usb/gadget/udc/tegra-xudc.c | 20 + drivers/usb/host/xhci-tegra.c | 25 + include/dt-bindings/clock/tegra210-car.h | 5 +- 29 files changed, 4262 insertions(+), 7 deletions(-)
Quoted 9 lines
---
base-commit:347e9f5043c89695b01e66b3ed111755afcf1911
change-id: 20250509-t210b01-c154ca0f8994Best regards,
--
Aaron Kling <[email protected]>
Reminder about this series.
Aaron
Stephen Boyd
maintainerRe: [PATCH v2 14/17] clk: tegra: Add Tegra210B01 support
In reply to Aaron KlingQuoting Aaron Kling via B4 Relay (2025-07-20 19:15:08)
drivers/clk/tegra/clk-tegra210b01.c line 7
Quoted 13 lines
drivers/clk/tegra/clk-tegra210b01.c new file +7
-0@@ -0,0 +1,3758 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2017-2020 NVIDIA CORPORATION. All rights reserved. +*/ + +#include <linux/io.h> +#include <linux/clk.h>
Is this include used? A clk provider shouldn't be a clk consumer as well.
drivers/clk/tegra/clk-tegra210b01.c line 14
Quoted 7 lines
drivers/clk/tegra/clk-tegra210b01.c new file +7
-0+#include <linux/clk-provider.h> +#include <linux/clkdev.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/syscore_ops.h> +#include <linux/delay.h> +#include <linux/export.h>
Is this include used?
Quoted 8 lines
drivers/clk/tegra/clk-tegra210b01.c new file +8
-0+#include <linux/clk/tegra.h> +#include <dt-bindings/clock/tegra210-car.h> +#include <dt-bindings/reset/tegra210-car.h> +#include <soc/tegra/pmc.h> + +#include "clk.h" +#include "clk-dfll.h" +#include "clk-id.h"
drivers/clk/tegra/clk-tegra210b01.c line 32
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+ +/* +* TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register +* banks present in the Tegra210 CAR IP block. The banks are +* identified by single letters, e.g.: L, H, U, V, W, X, Y. See +* periph_regs[] in drivers/clk/tegra/clk.c +*/ +#define TEGRA210_CAR_BANK_COUNT 7 + +#define CLK_SOURCE_CSITE 0x1d4
Please tab out these defines so it is more easily readable instead of having one space between the define and the value.
Quoted 22 lines
drivers/clk/tegra/clk-tegra210b01.c new file +22
-0+#define CLK_SOURCE_EMC 0x19c +#define CLK_SOURCE_SOR1 0x410 +#define CLK_SOURCE_SOR0 0x414 +#define CLK_SOURCE_LA 0x1f8 +#define CLK_SOURCE_SDMMC2 0x154 +#define CLK_SOURCE_SDMMC4 0x164 +#define CLK_SOURCE_EMC_DLL 0x664 + +#define PLLE_SS_CTRL 0x68 + +#define PLLC_BASE 0x80 +#define PLLC_OUT 0x84 +#define PLLC_MISC0 0x88 +#define PLLC_MISC1 0x8c +#define PLLC_MISC2 0x5d0 +#define PLLC_MISC3 0x5d4 + +#define PLLC2_BASE 0x4e8 +#define PLLC2_MISC0 0x4ec +#define PLLC2_MISC1 0x4f0 +#define PLLC2_MISC2 0x4f4 +#define PLLC2_MISC3 0x4f8
[...]
Quoted 17 lines
drivers/clk/tegra/clk-tegra210b01.c new file +17
-0+ { .pdiv = 4, .hw_val = 2 }, + { .pdiv = 8, .hw_val = 3 }, + { .pdiv = 16, .hw_val = 4 }, + { .pdiv = 32, .hw_val = 5 }, + { .pdiv = 64, .hw_val = 6 }, + { .pdiv = 128, .hw_val = 7 }, + { .pdiv = 0, }, +}; + +static u32 pll_expo_p_to_pdiv (u32 p,u32 *pdiv) +{ +if (p) { +u32 i =fls (p); + +if (i ==ffs (p)) + i--; +
drivers/clk/tegra/clk-tegra210b01.c line 1623
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+if (i <=PLL_EXPO_PDIV_MAX ) { +if (pdiv) + *pdiv = i; +return 1 << i; + } + } +return -EINVAL ; +} + +static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {
Can this be const?
drivers/clk/tegra/clk-tegra210b01.c line 1629
Quoted 6 lines
drivers/clk/tegra/clk-tegra210b01.c new file +6
-0+/* 1 GHz */ + { 38400000, 1000000000, 104, 2, 2, 0 }, /* actual: 998.4 MHz */ + { 0, 0, 0, 0, 0, 0 }, +}; + +static struct tegra_clk_pll_params pll_x_params = {
Can this be const?
Quoted 34 lines
drivers/clk/tegra/clk-tegra210b01.c new file +34
-0+ .input_min = 13500000, + .input_max = 800000000, + .cf_min = 13500000, + .cf_max = 38400000, + .vco_min = 1300000000, + .vco_max = 3000000000UL, + .base_reg = PLLX_BASE, + .misc_reg = PLLX_MISC0, + .lock_mask = PLL_BASE_LOCK, + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, + .lock_delay = 300, + .ext_misc_reg[0] = PLLX_MISC0, + .ext_misc_reg[1] = PLLX_MISC1, + .ext_misc_reg[2] = PLLX_MISC2, + .ext_misc_reg[3] = PLLX_MISC3, + .ext_misc_reg[4] = PLLX_MISC4, + .ext_misc_reg[5] = PLLX_MISC5, + .iddq_reg = PLLX_MISC3, + .iddq_bit_idx = PLLXP_IDDQ_BIT, + .max_p = PLL_QLIN_PDIV_MAX, + .mdiv_default = 2, + .dyn_ramp_reg = PLLX_MISC2, + .stepa_shift = 16, + .stepb_shift = 24, + .round_p_to_pdiv = pll_qlin_p_to_pdiv, + .pdiv_tohw = pll_qlin_pdiv_to_hw, + .div_nmp = &pllx_nmp, + .freq_table = pll_x_freq_table, + .flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE, + .dyn_ramp = tegra210_pllx_dyn_ramp, + .set_defaults = tegra210_pllx_set_defaults, + .calc_rate = tegra210_pll_fixed_mdiv_cfg, +}; +
drivers/clk/tegra/clk-tegra210b01.c line 1673
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+static struct div_nmp pllc_nmp = { + .divm_shift =0 , + .divm_width =8 , + .divn_shift =10 , + .divn_width =8 , + .divp_shift =20 , + .divp_width =5 , +}; + +static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = {
Can this be const?
drivers/clk/tegra/clk-tegra210b01.c line 1678
Quoted 5 lines
drivers/clk/tegra/clk-tegra210b01.c new file +5
-0+ { 38400000, 510000000, 53, 2, 2, 0 }, /* actual: 508.8 MHz */ + { 0, 0, 0, 0, 0, 0 }, +}; + +static struct tegra_clk_pll_params pll_c_params = {
I think you get the idea.
Quoted 18 lines
drivers/clk/tegra/clk-tegra210b01.c new file +18
-0+ .input_min = 19200000, + .input_max = 700000000, + .cf_min = 19200000, + .cf_max = 38400000, + .vco_min = 600000000, + .vco_max = 1200000000, + .base_reg = PLLC_BASE, + .misc_reg = PLLC_MISC0, + .lock_mask = PLL_BASE_LOCK, + .lock_delay = 300, + .iddq_reg = PLLC_MISC1, + .iddq_bit_idx = PLLCX_IDDQ_BIT, + .reset_reg = PLLC_MISC0, + .reset_bit_idx = PLLCX_RESET_BIT, + .max_p = PLL_QLIN_PDIV_MAX, + .ext_misc_reg[0] = PLLC_MISC0, + .ext_misc_reg[1] = PLLC_MISC1, + .ext_misc_reg[2] = PLLC_MISC2,
[...]
Quoted 38 lines
drivers/clk/tegra/clk-tegra210b01.c new file +38
-0+TEGRA_CLK_PERIPH (29 ,7 ,9 ,0 ,8 ,1 ,TEGRA_DIVIDER_ROUND_UP ,76 ,0 ,NULL ,NULL ); + +static __init void tegra210_periph_clk_init (struct device_node *np, +void __iomem *clk_base, +void __iomem *pmc_base) +{ +struct clk *clk; +unsigned int i; + +/* xusb_ss_div2 */ + clk =clk_register_fixed_factor (NULL ,"xusb_ss_div2" ,"xusb_ss_src" ,0 , +1 ,2 ); + clks[TEGRA210_CLK_XUSB_SS_DIV2 ] = clk; + + clk =tegra_clk_register_periph_fixed ("sor_safe" ,"pll_p" ,0 , clk_base, +1 ,17 ,222 ); + clks[TEGRA210_CLK_SOR_SAFE ] = clk; + + clk =tegra_clk_register_periph_fixed ("dpaux" ,"sor_safe" ,0 , clk_base, +1 ,17 ,181 ); + clks[TEGRA210_CLK_DPAUX ] = clk; + + clk =tegra_clk_register_periph_fixed ("dpaux1" ,"sor_safe" ,0 , clk_base, +1 ,17 ,207 ); + clks[TEGRA210_CLK_DPAUX1 ] = clk; + +/* pll_d_dsi_out */ + clk =clk_register_gate (NULL ,"pll_d_dsi_out" ,"pll_d_out0" ,0 , + clk_base +PLLD_MISC0 ,21 ,0 , &pll_d_lock); + clks[TEGRA210_CLK_PLL_D_DSI_OUT ] = clk; + +/* dsia */ + clk =tegra_clk_register_periph_gate ("dsia" ,"pll_d_dsi_out" ,0 , + clk_base,0 ,48 , + periph_clk_enb_refcnt); + clks[TEGRA210_CLK_DSIA ] = clk; + +/* dsib */
drivers/clk/tegra/clk-tegra210b01.c line 3010
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+ clk =tegra_clk_register_periph_gate ("dsib" ,"pll_d_dsi_out" ,0 , + clk_base,0 ,82 , + periph_clk_enb_refcnt); + clks[TEGRA210_CLK_DSIB ] = clk; + +/* csi_tpg */ + clk =clk_register_gate (NULL ,"csi_tpg" ,"pll_d" , +CLK_SET_RATE_PARENT , clk_base +PLLD_BASE , +23 ,0 , &pll_d_lock); +clk_register_clkdev (clk,"csi_tpg" ,NULL );
Are these clkdev structures used? Ideally we don't use clkdev because DT bindings are complete.
Quoted 569 lines
drivers/clk/tegra/clk-tegra210b01.c new file +569
-0+ clks[TEGRA210_CLK_CSI_TPG ] = clk; + +/* la */ + clk =tegra_clk_register_periph ("la" , la_parents, +ARRAY_SIZE (la_parents), &tegra210_la, clk_base, +CLK_SOURCE_LA ,0 ); + clks[TEGRA210_CLK_LA ] = clk; + +/* cml0 */ + clk =clk_register_gate (NULL ,"cml0" ,"pll_e" ,0 , clk_base +PLLE_AUX , +0 ,0 , &pll_e_lock); +clk_register_clkdev (clk,"cml0" ,NULL ); + clks[TEGRA210_CLK_CML0 ] = clk; + +/* cml1 */ + clk =clk_register_gate (NULL ,"cml1" ,"pll_e" ,0 , clk_base +PLLE_AUX , +1 ,0 , &pll_e_lock); +clk_register_clkdev (clk,"cml1" ,NULL ); + clks[TEGRA210_CLK_CML1 ] = clk; + + clk =tegra_clk_register_super_clk ("aclk" , aclk_parents, +ARRAY_SIZE (aclk_parents),0 , clk_base +0x6e0 , +0 ,NULL ); + clks[TEGRA210_CLK_ACLK ] = clk; + + clk =tegra_clk_register_sdmmc_mux_div ("sdmmc2" , clk_base, +CLK_SOURCE_SDMMC2 ,9 , +TEGRA_DIVIDER_ROUND_UP ,0 ,NULL ); + clks[TEGRA210_CLK_SDMMC2 ] = clk; + + clk =tegra_clk_register_sdmmc_mux_div ("sdmmc4" , clk_base, +CLK_SOURCE_SDMMC4 ,15 , +TEGRA_DIVIDER_ROUND_UP ,0 ,NULL ); + clks[TEGRA210_CLK_SDMMC4 ] = clk; + +for (i =0 ; i <ARRAY_SIZE (tegra210_periph); i++) { +struct tegra_periph_init_data *init = &tegra210_periph[i]; +struct clk **clkp; + + clkp =tegra_lookup_dt_id (init->clk_id, tegra210_clks); +if (!clkp) { +pr_warn ("clock %u not found\n" , init->clk_id); +continue ; + } + + clk =tegra_clk_register_periph_data (clk_base, init); + *clkp = clk; + } + +tegra_periph_clk_init (clk_base, pmc_base, tegra210_clks, &pll_p_params); + +/* mc */ +tegra210_clk_register_mc ("mc" ,"emc" ); +} + +static void __init tegra210_pll_init (void __iomem *clk_base, +void __iomem *pmc) +{ +struct clk *clk; + +/* PLL_RE reference clock must be selected by boot-loader */ + pll_re_use_utmipll =readl_relaxed (clk_base +PLLRE_BASE ) & +PLLRE_BASE_CLKIN_SEL ; + +/* PLLC */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c" ,"pll_ref" , clk_base, + pmc,0 , &pll_c_params,NULL ); +if (!WARN_ON (IS_ERR (clk))) +clk_register_clkdev (clk,"pll_c" ,NULL ); + clks[TEGRA210_CLK_PLL_C ] = clk; + +/* PLLC_OUT1 */ + clk =tegra_clk_register_divider ("pll_c_out1_div" ,"pll_c" , + clk_base +PLLC_OUT ,0 ,TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_c_out1" ,"pll_c_out1_div" , + clk_base +PLLC_OUT ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); +clk_register_clkdev (clk,"pll_c_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_C_OUT1 ] = clk; + +/* PLLC_UD */ + clk =clk_register_fixed_factor (NULL ,"pll_c_ud" ,"pll_c" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_c_ud" ,NULL ); + clks[TEGRA210_CLK_PLL_C_UD ] = clk; + +/* PLLC2 */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c2" ,"pll_ref" , clk_base, + pmc,0 , &pll_c2_params,NULL ); +clk_register_clkdev (clk,"pll_c2" ,NULL ); + clks[TEGRA210_CLK_PLL_C2 ] = clk; + +/* PLLC3 */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c3" ,"pll_ref" , clk_base, + pmc,0 , &pll_c3_params,NULL ); +clk_register_clkdev (clk,"pll_c3" ,NULL ); + clks[TEGRA210_CLK_PLL_C3 ] = clk; + +/* PLLU_VCO */ +if (!tegra210_init_pllu ()) { + clk =clk_register_fixed_rate (NULL ,"pll_u_vco" ,"pll_ref" ,0 , +480 *1000 *1000 ); +clk_register_clkdev (clk,"pll_u_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_U ] = clk; + +/* PLLU_OUT */ + clk =clk_register_fixed_factor (NULL ,"pll_u_out" ,"pll_u_vco" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_u_out" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT ] = clk; + +/* UTMIPLL_60M */ + clk =clk_register_fixed_rate (NULL ,"utmipll_60M" ,"pll_ref" ,0 , +60 *1000 *1000 ); +clk_register_clkdev (clk,"utmipll_60M" ,NULL ); + clks[TEGRA210_CLK_UTMIPLL_60M ] = clk; + } + +/* PLLU_OUT1 */ + clk =tegra_clk_register_divider ("pll_u_out1_div" ,"pll_u_out" , + clk_base +PLLU_OUTA ,0 , +TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 , &pll_u_lock); + clk =tegra_clk_register_pll_out ("pll_u_out1" ,"pll_u_out1_div" , + clk_base +PLLU_OUTA ,1 ,0 , +CLK_SET_RATE_PARENT ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT1 ] = clk; + +/* PLLU_OUT2 */ + clk =tegra_clk_register_divider ("pll_u_out2_div" ,"pll_u_out" , + clk_base +PLLU_OUTA ,0 , +TEGRA_DIVIDER_ROUND_UP , +24 ,8 ,1 , &pll_u_lock); + clk =tegra_clk_register_pll_out ("pll_u_out2" ,"pll_u_out2_div" , + clk_base +PLLU_OUTA ,17 ,16 , +CLK_SET_RATE_PARENT ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT2 ] = clk; + +/* PLLU_480M */ + clk =clk_register_gate (NULL ,"pll_u_480M" ,"pll_u_vco" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +22 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_480M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_480M ] = clk; + +/* PLLU_60M */ + clk =clk_register_gate (NULL ,"pll_u_60M" ,"pll_u_out2" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +23 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_60M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_60M ] = clk; + +/* PLLU_48M */ + clk =clk_register_gate (NULL ,"pll_u_48M" ,"pll_u_out1" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +25 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_48M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_48M ] = clk; + +/* PLLD */ + clk =tegra_clk_register_pll ("pll_d" ,"pll_ref" , clk_base, pmc,0 , + &pll_d_params, &pll_d_lock); +clk_register_clkdev (clk,"pll_d" ,NULL ); + clks[TEGRA210_CLK_PLL_D ] = clk; + +/* PLLD_OUT0 */ + clk =clk_register_fixed_factor (NULL ,"pll_d_out0" ,"pll_d" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_d_out0" ,NULL ); + clks[TEGRA210_CLK_PLL_D_OUT0 ] = clk; + +/* PLLRE */ +if (pll_re_use_utmipll) { + clk =tegra_clk_register_pllre_tegra210 ( +"pll_re_vco" ,"utmipll_60M" , clk_base, pmc,0 , + &pll_re_vco_params, &pll_re_lock,60 *1000 *1000 ); + }else { + clk =tegra_clk_register_pllre_tegra210 ( +"pll_re_vco" ,"pll_ref" , clk_base, pmc,0 , + &pll_re_vco_params, &pll_re_lock, pll_ref_freq); + } +clk_register_clkdev (clk,"pll_re_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_RE_VCO ] = clk; + + clk =clk_register_divider_table (NULL ,"pll_re_out" ,"pll_re_vco" ,0 , + clk_base +PLLRE_BASE ,16 ,5 ,0 , + pll_vco_post_div_table, &pll_re_lock); +clk_register_clkdev (clk,"pll_re_out" ,NULL ); + clks[TEGRA210_CLK_PLL_RE_OUT ] = clk; + + clk =tegra_clk_register_divider ("pll_re_out1_div" ,"pll_re_vco" , + clk_base +PLLRE_OUT1 ,0 , +TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_re_out1" ,"pll_re_out1_div" , + clk_base +PLLRE_OUT1 ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); + clks[TEGRA210_CLK_PLL_RE_OUT1 ] = clk; + +/* PLLE */ + clk =tegra_clk_register_plle_tegra210 ("pll_e" ,"pll_ref" , + clk_base,0 , &pll_e_params, &pll_e_lock); +clk_register_clkdev (clk,"pll_e" ,NULL ); + clks[TEGRA210_CLK_PLL_E ] = clk; + +/* PLLC4 */ + clk =tegra_clk_register_pllre_tegra210 ("pll_c4_vco" ,"pll_ref" , + clk_base, pmc,0 , &pll_c4_vco_params,NULL , pll_ref_freq); +clk_register_clkdev (clk,"pll_c4_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_C4 ] = clk; + +/* PLLC4_OUT1 */ + clk =clk_register_fixed_factor (NULL ,"pll_c4_out1" ,"pll_c4_vco" , +CLK_SET_RATE_PARENT ,1 ,3 ); +clk_register_clkdev (clk,"pll_c4_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT1 ] = clk; + +/* PLLC4_OUT2 */ + clk =clk_register_fixed_factor (NULL ,"pll_c4_out2" ,"pll_c4_vco" , +CLK_SET_RATE_PARENT ,1 ,5 ); +clk_register_clkdev (clk,"pll_c4_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT2 ] = clk; + +/* PLLC4_OUT3 */ + clk =tegra_clk_register_divider ("pll_c4_out3_div" ,"pll_c4_out0" , + clk_base +PLLC4_OUT ,0 ,TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_c4_out3" ,"pll_c4_out3_div" , + clk_base +PLLC4_OUT ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); +clk_register_clkdev (clk,"pll_c4_out3" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT3 ] = clk; + +/* PLLDP */ + clk =tegra_clk_register_pllss_tegra210 ("pll_dp" ,"pll_ref" , clk_base, +0 , &pll_dp_params,NULL ); +clk_register_clkdev (clk,"pll_dp" ,NULL ); + clks[TEGRA210_CLK_PLL_DP ] = clk; + +/* PLLD2 */ + clk =tegra_clk_register_pllss_tegra210 ("pll_d2" ,"pll_ref" , clk_base, +0 , &pll_d2_params,NULL ); +clk_register_clkdev (clk,"pll_d2" ,NULL ); + clks[TEGRA210_CLK_PLL_D2 ] = clk; + +/* PLLD2_OUT0 */ + clk =clk_register_fixed_factor (NULL ,"pll_d2_out0" ,"pll_d2" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_d2_out0" ,NULL ); + clks[TEGRA210_CLK_PLL_D2_OUT0 ] = clk; + +/* PLLP_OUT2 */ + clk =clk_register_fixed_factor (NULL ,"pll_p_out2" ,"pll_p" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_p_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_P_OUT2 ] = clk; + +/* PLLP_UD */ + clk =clk_register_fixed_factor (NULL ,"pll_p_ud" ,"pll_p" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_pud" ,NULL ); + clks[TEGRA210_CLK_PLL_P_UD ] = clk; + +/* PLLP_UPHY_OUT */ + clk =tegra_clk_register_divider ("pll_p_uphy_div" ,"pll_p_out_xusb" , + clk_base +PEX_SATA_USB_RX_BYP ,0 , +TEGRA_DIVIDER_ROUND_UP ,0 ,8 ,1 , &pll_p_uphy_lock); + clk =clk_register_gate (NULL ,"pll_p_uphy_out" ,"pll_p_uphy_div" , +CLK_SET_RATE_PARENT |CLK_IGNORE_UNUSED , + clk_base +PEX_SATA_USB_RX_BYP ,8 ,0 , &pll_p_uphy_lock); +clk_register_clkdev (clk,"pll_p_uphy_out" ,NULL ); + clks[TEGRA210_CLK_PLL_P_UPHY_OUT ] = clk; +} + +/* Tegra210 CPU clock and reset control functions */ +static void tegra210_wait_cpu_in_reset (u32 cpu) +{ +unsigned int reg; + +do { + reg =readl (clk_base +CLK_RST_CONTROLLER_CPU_CMPLX_STATUS ); +cpu_relax (); + }while (!(reg & (1 << cpu)));/* check CPU been reset or not */ +} + +static void tegra210_disable_cpu_clock (u32 cpu) +{ +/* flow controller would take care in the power sequence. */ +} + +#ifdef CONFIG_PM_SLEEP +#define car_readl (_base, _off) readl_relaxed(clk_base + (_base) + ((_off) * 4)) +#define car_writel (_val, _base, _off) \ + writel_relaxed(_val, clk_base + (_base) + ((_off) * 4)) + +static u32 spare_reg_ctx, misc_clk_enb_ctx, clk_msk_arm_ctx; +static u32 cpu_softrst_ctx[3 ]; + +static int tegra210_clk_suspend (void ) +{ +unsigned int i; + +clk_save_context (); + +/* +* Save the bootloader configured clock registers SPARE_REG0, +* MISC_CLK_ENB, CLK_MASK_ARM, CPU_SOFTRST_CTRL. +*/ + spare_reg_ctx =readl_relaxed (clk_base +SPARE_REG0 ); + misc_clk_enb_ctx =readl_relaxed (clk_base +MISC_CLK_ENB ); + clk_msk_arm_ctx =readl_relaxed (clk_base +CLK_MASK_ARM ); + +for (i =0 ; i <ARRAY_SIZE (cpu_softrst_ctx); i++) + cpu_softrst_ctx[i] =car_readl (CPU_SOFTRST_CTRL , i); + +tegra_clk_periph_suspend (); +return 0 ; +} + +static void tegra210_clk_resume (void ) +{ +unsigned int i; + +tegra_clk_osc_resume (clk_base); + +/* +* Restore the bootloader configured clock registers SPARE_REG0, +* MISC_CLK_ENB, CLK_MASK_ARM, CPU_SOFTRST_CTRL from saved context. +*/ +writel_relaxed (spare_reg_ctx, clk_base +SPARE_REG0 ); +writel_relaxed (misc_clk_enb_ctx, clk_base +MISC_CLK_ENB ); +writel_relaxed (clk_msk_arm_ctx, clk_base +CLK_MASK_ARM ); + +for (i =0 ; i <ARRAY_SIZE (cpu_softrst_ctx); i++) +car_writel (cpu_softrst_ctx[i],CPU_SOFTRST_CTRL , i); + +/* +* Tegra clock programming sequence recommends peripheral clock to +* be enabled prior to changing its clock source and divider to +* prevent glitchless frequency switch. +* So, enable all peripheral clocks before restoring their source +* and dividers. +*/ +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_L , clk_base +CLK_OUT_ENB_L ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_H , clk_base +CLK_OUT_ENB_H ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_U , clk_base +CLK_OUT_ENB_U ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_V , clk_base +CLK_OUT_ENB_V ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_W , clk_base +CLK_OUT_ENB_W ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_X , clk_base +CLK_OUT_ENB_X ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_Y , clk_base +CLK_OUT_ENB_Y ); + +/* wait for all writes to happen to have all the clocks enabled */ +fence_udelay (2 , clk_base); + +/* restore PLLs and all peripheral clock rates */ +tegra210_init_pllu (); +clk_restore_context (); + +/* restore saved context of peripheral clocks and reset state */ +tegra_clk_periph_resume (); +} + +static void tegra210_cpu_clock_suspend (void ) +{ +/* switch coresite to clk_m, save off original source */ + tegra210_cpu_clk_sctx.clk_csite_src = +readl (clk_base +CLK_SOURCE_CSITE ); +writel (3 <<30 , clk_base +CLK_SOURCE_CSITE ); +} + +static void tegra210_cpu_clock_resume (void ) +{ +writel (tegra210_cpu_clk_sctx.clk_csite_src, + clk_base +CLK_SOURCE_CSITE ); +} +#endif + +static struct syscore_ops tegra_clk_syscore_ops = { +#ifdef CONFIG_PM_SLEEP + .suspend = tegra210_clk_suspend, + .resume = tegra210_clk_resume, +#endif +}; + +static struct tegra_cpu_car_ops tegra210_cpu_car_ops = { + .wait_for_reset = tegra210_wait_cpu_in_reset, + .disable_clock = tegra210_disable_cpu_clock, +#ifdef CONFIG_PM_SLEEP + .suspend = tegra210_cpu_clock_suspend, + .resume = tegra210_cpu_clock_resume, +#endif +}; + +static const struct of_device_id pmc_match[]__initconst = { + { .compatible ="nvidia,tegra210b01-pmc" }, + { }, +}; + +static struct tegra_clk_init_table t210b01_init_table[]__initdata = { + {TEGRA210_CLK_PLL_A ,TEGRA210_CLK_CLK_MAX ,564480000 ,1 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_RE_VCO ,TEGRA210_CLK_CLK_MAX ,0 ,1 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_DP ,TEGRA210_CLK_CLK_MAX ,270000000 ,0 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_P_UPHY_OUT ,TEGRA210_CLK_CLK_MAX ,102000000 ,1 }, + {TEGRA210_CLK_SDMMC_LEGACY ,TEGRA210_CLK_PLL_P ,12000000 ,0 }, + {TEGRA210_CLK_I2CSLOW ,TEGRA210_CLK_CLK_32K ,32000 ,0 }, + {TEGRA210_CLK_SPDIF_IN ,TEGRA210_CLK_CLK_MAX ,136000000 ,0 }, + {TEGRA210_CLK_USB2_HSIC_TRK ,TEGRA210_CLK_CLK_MAX ,9600000 ,0 }, +/* This MUST be the last entry. */ + {TEGRA210_CLK_CLK_MAX ,TEGRA210_CLK_CLK_MAX ,0 ,0 }, +}; + +static struct tegra_clk_init_table init_table[]__initdata = { + {TEGRA210_CLK_UARTA ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTB ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTC ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTD ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_PLL_A_OUT0 ,TEGRA210_CLK_CLK_MAX ,11289600 ,0 }, + {TEGRA210_CLK_I2S0 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S1 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S2 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S3 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S4 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_HOST1X ,TEGRA210_CLK_PLL_P ,136000000 ,1 }, + {TEGRA210_CLK_SCLK_MUX ,TEGRA210_CLK_PLL_P ,0 ,1 }, + {TEGRA210_CLK_SCLK ,TEGRA210_CLK_CLK_MAX ,102000000 ,0 }, + {TEGRA210_CLK_DFLL_SOC ,TEGRA210_CLK_PLL_P ,51000000 ,1 }, + {TEGRA210_CLK_DFLL_REF ,TEGRA210_CLK_PLL_P ,51000000 ,1 }, + {TEGRA210_CLK_SBC4 ,TEGRA210_CLK_PLL_P ,12000000 ,1 }, + {TEGRA210_CLK_PLL_U_OUT1 ,TEGRA210_CLK_CLK_MAX ,48000000 ,1 }, + {TEGRA210_CLK_XUSB_GATE ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_XUSB_SS_SRC ,TEGRA210_CLK_PLL_U_480M ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_FS_SRC ,TEGRA210_CLK_PLL_U_48M ,48000000 ,0 }, + {TEGRA210_CLK_XUSB_HS_SRC ,TEGRA210_CLK_XUSB_SS_SRC ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_SSP_SRC ,TEGRA210_CLK_XUSB_SS_SRC ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_FALCON_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,204000000 ,0 }, + {TEGRA210_CLK_XUSB_HOST_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,102000000 ,0 }, + {TEGRA210_CLK_XUSB_DEV_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,102000000 ,0 }, + {TEGRA210_CLK_SATA ,TEGRA210_CLK_PLL_P ,104000000 ,0 }, + {TEGRA210_CLK_SATA_OOB ,TEGRA210_CLK_PLL_P ,204000000 ,0 }, + {TEGRA210_CLK_MSELECT ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_CSITE ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, +/* TODO find a way to enable this on-demand */ + {TEGRA210_CLK_DBGAPB ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_TSENSOR ,TEGRA210_CLK_CLK_M ,400000 ,0 }, + {TEGRA210_CLK_I2C1 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C2 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C3 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C4 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C5 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C6 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_SOC_THERM ,TEGRA210_CLK_PLL_P ,51000000 ,0 }, + {TEGRA210_CLK_CCLK_G ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_PLL_U_OUT2 ,TEGRA210_CLK_CLK_MAX ,60000000 ,1 }, + {TEGRA210_CLK_SPDIF_IN_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S0_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S1_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S2_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S3_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S4_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_VIMCLK_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_HDA ,TEGRA210_CLK_PLL_P ,51000000 ,0 }, + {TEGRA210_CLK_HDA2CODEC_2X ,TEGRA210_CLK_PLL_P ,48000000 ,0 }, + {TEGRA210_CLK_PWM ,TEGRA210_CLK_PLL_P ,48000000 ,0 }, +/* This MUST be the last entry. */ + {TEGRA210_CLK_CLK_MAX ,TEGRA210_CLK_CLK_MAX ,0 ,0 }, +}; + +static void __init tegra210b01_clock_table_init (struct clk **clks) +{ +struct clk *clk; +unsigned long rate; + +/* Set PLL_RE at 625 MHz from UTMIPLL, or 672MHz, otherwise */ + rate = (pll_re_use_utmipll ?625 :672 ) *1000 *1000 ; + clk = clks[TEGRA210_CLK_PLL_RE_VCO ]; +WARN_ON (IS_ERR_OR_NULL (clk)); +if (clk_set_rate (clk, rate)) +WARN (1 ,"%s: Failed to set rate %lu of %s\n" , + __func__, rate,__clk_get_name (clk)); + +tegra_init_from_table (t210b01_init_table, clks,TEGRA210_CLK_CLK_MAX ); +} + +/** +* tegra210b01_clock_apply_init_table - initialize clocks on Tegra210 SoCs +* +* Program an initial clock rate and enable or disable clocks needed +* by the rest of the kernel, for Tegra210 SoCs. It is intended to be +* called by assigning a pointer to it to tegra_clk_apply_init_table - +* this will be called as an arch_initcall. No return value. +*/ +static void __init tegra210b01_clock_apply_init_table (void ) +{ +tegra210b01_clock_table_init (clks); +tegra_init_from_table (init_table, clks,TEGRA210_CLK_CLK_MAX ); +} + +/** +* tegra210b01_car_barrier - wait for pending writes to the CAR to complete +* +* Wait for any outstanding writes to the CAR MMIO space from this CPU +* to complete before continuing execution. No return value. +*/ +static void tegra210b01_car_barrier (void ) +{ +readl_relaxed (clk_base +RST_DFLL_DVCO ); +} + +/** +* tegra210b01_clock_assert_dfll_dvco_reset - assert the DFLL's DVCO reset +* +* Assert the reset line of the DFLL's DVCO. No return value. +*/ +static void tegra210b01_clock_assert_dfll_dvco_reset (void ) +{ +u32 v; + + v =readl_relaxed (clk_base +RST_DFLL_DVCO ); + v |= (1 <<DVFS_DFLL_RESET_SHIFT ); +writel_relaxed (v, clk_base +RST_DFLL_DVCO ); +tegra210b01_car_barrier (); +} + +/** +* tegra210b01_clock_deassert_dfll_dvco_reset - deassert the DFLL's DVCO reset +* +* Deassert the reset line of the DFLL's DVCO, allowing the DVCO to +* operate. No return value. +*/ +static void tegra210b01_clock_deassert_dfll_dvco_reset (void ) +{ +u32 v; + + v =readl_relaxed (clk_base +RST_DFLL_DVCO ); + v &= ~(1 <<DVFS_DFLL_RESET_SHIFT ); +writel_relaxed (v, clk_base +RST_DFLL_DVCO ); +tegra210b01_car_barrier (); +} + +static int tegra210b01_reset_assert (unsigned long id) +{ +if (id ==TEGRA210_RST_DFLL_DVCO ) +tegra210b01_clock_assert_dfll_dvco_reset (); +else if (id ==TEGRA210_RST_ADSP ) +writel (GENMASK (26 ,21 ) |BIT (7 ), + clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_SET ); +else +return -EINVAL ; + +return 0 ; +} + +static int tegra210b01_reset_deassert (unsigned long id) +{ +if (id ==TEGRA210_RST_DFLL_DVCO ) +tegra210b01_clock_deassert_dfll_dvco_reset (); +else if (id ==TEGRA210_RST_ADSP ) { +writel (BIT (21 ), clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_CLR ); +/* +* Considering adsp cpu clock (min: 12.5MHZ, max: 1GHz) +* a delay of 5us ensures that it's at least +* 6 * adsp_cpu_cycle_period long. +*/
drivers/clk/tegra/clk-tegra210b01.c line 3589
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+udelay (5 ); +writel (GENMASK (26 ,22 ) |BIT (7 ), + clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_CLR ); + }else +return -EINVAL ; + +return 0 ; +} + +static enum clk_id tegra210b01_integer_div_id[] = {
const?
Quoted 159 lines
drivers/clk/tegra/clk-tegra210b01.c new file +159
-0+ tegra_clk_cilab, + tegra_clk_cilcd, + + tegra_clk_spdif_out, + + tegra_clk_sbc1_9, + tegra_clk_sbc2_9, + tegra_clk_sbc3_9, + tegra_clk_sbc4_9, + + tegra_clk_sdmmc_legacy, + tegra_clk_i2cslow, + tegra_clk_qspi, + + tegra_clk_soc_therm_8, + tegra_clk_tsensor, +}; + +static void tegra210b01_adjust_clks (struct tegra_clk *tegra_clks) +{ +int i; + +/* Remove CPU_LP claster clocks */ + tegra_clks[tegra_clk_cclk_lp].present = false; + tegra_clks[tegra_clk_pll_x_out0].present = false; + +/* Prevent 1:1.5 fractional divider setting */ + div1_5_not_allowed = true; + +/* Prevent any fractional setting */ +for (i =0 ; i <ARRAY_SIZE (tegra210b01_integer_div_id); i++) { +enum clk_id cid = tegra210b01_integer_div_id[i]; + +if (cid >= tegra_clk_max || !tegra_clks[cid].present) { +pr_warn ("%s: clk %d is not present\n" , __func__, cid); +continue ; + } + tegra_clks[cid].use_integer_div = true; + } +} + +static void tegra210b01_mbist_clk_init (void ) +{ +unsigned int i, j; + +for (i =0 ; i <ARRAY_SIZE (tegra210_pg_mbist_war); i++) { +unsigned int num_clks = tegra210_pg_mbist_war[i].num_clks; +struct clk_bulk_data *clk_data; + +if (!num_clks) +continue ; + + clk_data =kmalloc_array (num_clks,sizeof (*clk_data), +GFP_KERNEL ); +if (WARN_ON (!clk_data)) +return ; + + tegra210_pg_mbist_war[i].clks = clk_data; +for (j =0 ; j < num_clks; j++) { +int clk_id = tegra210_pg_mbist_war[i].clk_init_data[j]; +struct clk *clk = clks[clk_id]; + +if (WARN (IS_ERR (clk),"clk_id: %d\n" , clk_id)) { +kfree (clk_data); + tegra210_pg_mbist_war[i].clks =NULL ; +break ; + } + clk_data[j].clk = clk; + } + } +} + +/** +* tegra210b01_clock_init - Tegra210-specific clock initialization +* @np: struct device_node * of the DT node for the SoC CAR IP block +* +* Register most SoC clocks for the Tegra210B01 system-on-chip. Intended +* to be called by the OF init code when a DT node with the +* "nvidia,tegra210b01-car" string is encountered, and declared with +* CLK_OF_DECLARE. No return value. +*/ +static void __init tegra210b01_clock_init (struct device_node *np) +{ +struct device_node *node; +u32 value, clk_m_div; + + clk_base =of_iomap (np,0 ); +if (!clk_base) { +pr_err ("ioremap tegra210 CAR failed\n" ); +return ; + } + + node =of_find_matching_node (NULL , pmc_match); +if (!node) { +pr_err ("Failed to find pmc node\n" ); +WARN_ON (1 ); +return ; + } + + pmc_base =of_iomap (node,0 ); +of_node_put (node); +if (!pmc_base) { +pr_err ("Can't map pmc registers\n" ); +WARN_ON (1 ); +return ; + } + + ahub_base =ioremap (TEGRA210_AHUB_BASE ,SZ_64K ); +if (!ahub_base) { +pr_err ("ioremap tegra210 APE failed\n" ); +return ; + } + + dispa_base =ioremap (TEGRA210_DISPA_BASE ,SZ_256K ); +if (!dispa_base) { +pr_err ("ioremap tegra210 DISPA failed\n" ); +return ; + } + + vic_base =ioremap (TEGRA210_VIC_BASE ,SZ_256K ); +if (!vic_base) { +pr_err ("ioremap tegra210 VIC failed\n" ); +return ; + } + + clks =tegra_clk_init (clk_base,TEGRA210_CLK_CLK_MAX , +TEGRA210_CAR_BANK_COUNT ); +if (!clks) +return ; + +tegra210b01_adjust_clks (tegra210_clks); + + value =readl (clk_base +SPARE_REG0 ) >>CLK_M_DIVISOR_SHIFT ; + clk_m_div = (value &CLK_M_DIVISOR_MASK ) +1 ; + +if (tegra_osc_clk_init (clk_base, tegra210_clks, tegra210_input_freq, +ARRAY_SIZE (tegra210_input_freq), clk_m_div, + &osc_freq, &pll_ref_freq) <0 ) +return ; + +tegra_fixed_clk_init (tegra210_clks); +tegra210_pll_init (clk_base, pmc_base); +tegra210_periph_clk_init (np, clk_base, pmc_base); +tegra_audio_clk_init (clk_base, pmc_base, tegra210_clks, + tegra210_audio_plls, +ARRAY_SIZE (tegra210_audio_plls),24576000 ); + +/* For Tegra210, PLLD is the only source for DSIA & DSIB */ + value =readl (clk_base +PLLD_BASE ); + value &= ~BIT (25 ); +writel (value, clk_base +PLLD_BASE ); + + tegra_clk_apply_init_table = tegra210b01_clock_apply_init_table; + +tegra_super_clk_gen5_init (clk_base, pmc_base, tegra210_clks, + &pll_x_params); +tegra_init_special_resets (2 , tegra210b01_reset_assert, + tegra210b01_reset_deassert); +
drivers/clk/tegra/clk-tegra210b01.c line 3758
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+tegra_add_of_provider (np, of_clk_src_onecell_get); +tegra_register_devclks (devclks,ARRAY_SIZE (devclks)); + +tegra210b01_mbist_clk_init (); + + tegra_cpu_car_ops = &tegra210_cpu_car_ops; + +register_syscore_ops (&tegra_clk_syscore_ops); +} +CLK_OF_DECLARE (tegra210b01,"nvidia,tegra210b01-car" , tegra210b01_clock_init);
Can it be a platform device instead of using CLK_OF_DECLARE? Maybe that is not possible with syscore ops though.
Re: [PATCH v2 14/17] clk: tegra: Add Tegra210B01 support
Quoted 984 lines · Stephen Boyd
Quoting Aaron Kling via B4 Relay (2025-07-20 19:15:08)
drivers/clk/tegra/clk-tegra210b01.c line 7
Quoted 13 lines
drivers/clk/tegra/clk-tegra210b01.c new file +7
-0@@ -0,0 +1,3758 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2017-2020 NVIDIA CORPORATION. All rights reserved. +*/ + +#include <linux/io.h> +#include <linux/clk.h> Is this include used? A clk provider shouldn't be a clk consumer as well.
drivers/clk/tegra/clk-tegra210b01.c line 14
Quoted 7 lines
drivers/clk/tegra/clk-tegra210b01.c new file +7
-0+#include <linux/clk-provider.h> +#include <linux/clkdev.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/syscore_ops.h> +#include <linux/delay.h> +#include <linux/export.h> Is this include used?
Quoted 8 lines
drivers/clk/tegra/clk-tegra210b01.c new file +8
-0+#include <linux/clk/tegra.h> +#include <dt-bindings/clock/tegra210-car.h> +#include <dt-bindings/reset/tegra210-car.h> +#include <soc/tegra/pmc.h> + +#include "clk.h" +#include "clk-dfll.h" +#include "clk-id.h" drivers/clk/tegra/clk-tegra210b01.c line 32
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+ +/* +* TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register +* banks present in the Tegra210 CAR IP block. The banks are +* identified by single letters, e.g.: L, H, U, V, W, X, Y. See +* periph_regs[] in drivers/clk/tegra/clk.c +*/ +#define TEGRA210_CAR_BANK_COUNT 7 + +#define CLK_SOURCE_CSITE 0x1d4Please tab out these defines so it is more easily readable instead of having one space between the define and the value.
Quoted 22 lines
drivers/clk/tegra/clk-tegra210b01.c new file +22
-0+#define CLK_SOURCE_EMC 0x19c +#define CLK_SOURCE_SOR1 0x410 +#define CLK_SOURCE_SOR0 0x414 +#define CLK_SOURCE_LA 0x1f8 +#define CLK_SOURCE_SDMMC2 0x154 +#define CLK_SOURCE_SDMMC4 0x164 +#define CLK_SOURCE_EMC_DLL 0x664 + +#define PLLE_SS_CTRL 0x68 + +#define PLLC_BASE 0x80 +#define PLLC_OUT 0x84 +#define PLLC_MISC0 0x88 +#define PLLC_MISC1 0x8c +#define PLLC_MISC2 0x5d0 +#define PLLC_MISC3 0x5d4 + +#define PLLC2_BASE 0x4e8 +#define PLLC2_MISC0 0x4ec +#define PLLC2_MISC1 0x4f0 +#define PLLC2_MISC2 0x4f4 +#define PLLC2_MISC3 0x4f8[...]
Quoted 17 lines
drivers/clk/tegra/clk-tegra210b01.c new file +17
-0+ { .pdiv = 4, .hw_val = 2 }, + { .pdiv = 8, .hw_val = 3 }, + { .pdiv = 16, .hw_val = 4 }, + { .pdiv = 32, .hw_val = 5 }, + { .pdiv = 64, .hw_val = 6 }, + { .pdiv = 128, .hw_val = 7 }, + { .pdiv = 0, }, +}; + +static u32 pll_expo_p_to_pdiv (u32 p,u32 *pdiv) +{ +if (p) { +u32 i =fls (p); + +if (i ==ffs (p)) + i--; +drivers/clk/tegra/clk-tegra210b01.c line 1623
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+if (i <=PLL_EXPO_PDIV_MAX ) { +if (pdiv) + *pdiv = i; +return 1 << i; + } + } +return -EINVAL ; +} + +static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {Can this be const?
drivers/clk/tegra/clk-tegra210b01.c line 1629
Quoted 6 lines
drivers/clk/tegra/clk-tegra210b01.c new file +6
-0+/* 1 GHz */ + { 38400000, 1000000000, 104, 2, 2, 0 }, /* actual: 998.4 MHz */ + { 0, 0, 0, 0, 0, 0 }, +}; + +static struct tegra_clk_pll_params pll_x_params = {Can this be const?
Quoted 34 lines
drivers/clk/tegra/clk-tegra210b01.c new file +34
-0+ .input_min = 13500000, + .input_max = 800000000, + .cf_min = 13500000, + .cf_max = 38400000, + .vco_min = 1300000000, + .vco_max = 3000000000UL, + .base_reg = PLLX_BASE, + .misc_reg = PLLX_MISC0, + .lock_mask = PLL_BASE_LOCK, + .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, + .lock_delay = 300, + .ext_misc_reg[0] = PLLX_MISC0, + .ext_misc_reg[1] = PLLX_MISC1, + .ext_misc_reg[2] = PLLX_MISC2, + .ext_misc_reg[3] = PLLX_MISC3, + .ext_misc_reg[4] = PLLX_MISC4, + .ext_misc_reg[5] = PLLX_MISC5, + .iddq_reg = PLLX_MISC3, + .iddq_bit_idx = PLLXP_IDDQ_BIT, + .max_p = PLL_QLIN_PDIV_MAX, + .mdiv_default = 2, + .dyn_ramp_reg = PLLX_MISC2, + .stepa_shift = 16, + .stepb_shift = 24, + .round_p_to_pdiv = pll_qlin_p_to_pdiv, + .pdiv_tohw = pll_qlin_pdiv_to_hw, + .div_nmp = &pllx_nmp, + .freq_table = pll_x_freq_table, + .flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE, + .dyn_ramp = tegra210_pllx_dyn_ramp, + .set_defaults = tegra210_pllx_set_defaults, + .calc_rate = tegra210_pll_fixed_mdiv_cfg, +}; +drivers/clk/tegra/clk-tegra210b01.c line 1673
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+static struct div_nmp pllc_nmp = { + .divm_shift =0 , + .divm_width =8 , + .divn_shift =10 , + .divn_width =8 , + .divp_shift =20 , + .divp_width =5 , +}; + +static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = {Can this be const?
drivers/clk/tegra/clk-tegra210b01.c line 1678
Quoted 5 lines
drivers/clk/tegra/clk-tegra210b01.c new file +5
-0+ { 38400000, 510000000, 53, 2, 2, 0 }, /* actual: 508.8 MHz */ + { 0, 0, 0, 0, 0, 0 }, +}; + +static struct tegra_clk_pll_params pll_c_params = {I think you get the idea.
Quoted 18 lines
drivers/clk/tegra/clk-tegra210b01.c new file +18
-0+ .input_min = 19200000, + .input_max = 700000000, + .cf_min = 19200000, + .cf_max = 38400000, + .vco_min = 600000000, + .vco_max = 1200000000, + .base_reg = PLLC_BASE, + .misc_reg = PLLC_MISC0, + .lock_mask = PLL_BASE_LOCK, + .lock_delay = 300, + .iddq_reg = PLLC_MISC1, + .iddq_bit_idx = PLLCX_IDDQ_BIT, + .reset_reg = PLLC_MISC0, + .reset_bit_idx = PLLCX_RESET_BIT, + .max_p = PLL_QLIN_PDIV_MAX, + .ext_misc_reg[0] = PLLC_MISC0, + .ext_misc_reg[1] = PLLC_MISC1, + .ext_misc_reg[2] = PLLC_MISC2,[...]
Quoted 38 lines
drivers/clk/tegra/clk-tegra210b01.c new file +38
-0+TEGRA_CLK_PERIPH (29 ,7 ,9 ,0 ,8 ,1 ,TEGRA_DIVIDER_ROUND_UP ,76 ,0 ,NULL ,NULL ); + +static __init void tegra210_periph_clk_init (struct device_node *np, +void __iomem *clk_base, +void __iomem *pmc_base) +{ +struct clk *clk; +unsigned int i; + +/* xusb_ss_div2 */ + clk =clk_register_fixed_factor (NULL ,"xusb_ss_div2" ,"xusb_ss_src" ,0 , +1 ,2 ); + clks[TEGRA210_CLK_XUSB_SS_DIV2 ] = clk; + + clk =tegra_clk_register_periph_fixed ("sor_safe" ,"pll_p" ,0 , clk_base, +1 ,17 ,222 ); + clks[TEGRA210_CLK_SOR_SAFE ] = clk; + + clk =tegra_clk_register_periph_fixed ("dpaux" ,"sor_safe" ,0 , clk_base, +1 ,17 ,181 ); + clks[TEGRA210_CLK_DPAUX ] = clk; + + clk =tegra_clk_register_periph_fixed ("dpaux1" ,"sor_safe" ,0 , clk_base, +1 ,17 ,207 ); + clks[TEGRA210_CLK_DPAUX1 ] = clk; + +/* pll_d_dsi_out */ + clk =clk_register_gate (NULL ,"pll_d_dsi_out" ,"pll_d_out0" ,0 , + clk_base +PLLD_MISC0 ,21 ,0 , &pll_d_lock); + clks[TEGRA210_CLK_PLL_D_DSI_OUT ] = clk; + +/* dsia */ + clk =tegra_clk_register_periph_gate ("dsia" ,"pll_d_dsi_out" ,0 , + clk_base,0 ,48 , + periph_clk_enb_refcnt); + clks[TEGRA210_CLK_DSIA ] = clk; + +/* dsib */ drivers/clk/tegra/clk-tegra210b01.c line 3010
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+ clk =tegra_clk_register_periph_gate ("dsib" ,"pll_d_dsi_out" ,0 , + clk_base,0 ,82 , + periph_clk_enb_refcnt); + clks[TEGRA210_CLK_DSIB ] = clk; + +/* csi_tpg */ + clk =clk_register_gate (NULL ,"csi_tpg" ,"pll_d" , +CLK_SET_RATE_PARENT , clk_base +PLLD_BASE , +23 ,0 , &pll_d_lock); +clk_register_clkdev (clk,"csi_tpg" ,NULL );Are these clkdev structures used? Ideally we don't use clkdev because DT bindings are complete.
Quoted 569 lines
drivers/clk/tegra/clk-tegra210b01.c new file +569
-0+ clks[TEGRA210_CLK_CSI_TPG ] = clk; + +/* la */ + clk =tegra_clk_register_periph ("la" , la_parents, +ARRAY_SIZE (la_parents), &tegra210_la, clk_base, +CLK_SOURCE_LA ,0 ); + clks[TEGRA210_CLK_LA ] = clk; + +/* cml0 */ + clk =clk_register_gate (NULL ,"cml0" ,"pll_e" ,0 , clk_base +PLLE_AUX , +0 ,0 , &pll_e_lock); +clk_register_clkdev (clk,"cml0" ,NULL ); + clks[TEGRA210_CLK_CML0 ] = clk; + +/* cml1 */ + clk =clk_register_gate (NULL ,"cml1" ,"pll_e" ,0 , clk_base +PLLE_AUX , +1 ,0 , &pll_e_lock); +clk_register_clkdev (clk,"cml1" ,NULL ); + clks[TEGRA210_CLK_CML1 ] = clk; + + clk =tegra_clk_register_super_clk ("aclk" , aclk_parents, +ARRAY_SIZE (aclk_parents),0 , clk_base +0x6e0 , +0 ,NULL ); + clks[TEGRA210_CLK_ACLK ] = clk; + + clk =tegra_clk_register_sdmmc_mux_div ("sdmmc2" , clk_base, +CLK_SOURCE_SDMMC2 ,9 , +TEGRA_DIVIDER_ROUND_UP ,0 ,NULL ); + clks[TEGRA210_CLK_SDMMC2 ] = clk; + + clk =tegra_clk_register_sdmmc_mux_div ("sdmmc4" , clk_base, +CLK_SOURCE_SDMMC4 ,15 , +TEGRA_DIVIDER_ROUND_UP ,0 ,NULL ); + clks[TEGRA210_CLK_SDMMC4 ] = clk; + +for (i =0 ; i <ARRAY_SIZE (tegra210_periph); i++) { +struct tegra_periph_init_data *init = &tegra210_periph[i]; +struct clk **clkp; + + clkp =tegra_lookup_dt_id (init->clk_id, tegra210_clks); +if (!clkp) { +pr_warn ("clock %u not found\n" , init->clk_id); +continue ; + } + + clk =tegra_clk_register_periph_data (clk_base, init); + *clkp = clk; + } + +tegra_periph_clk_init (clk_base, pmc_base, tegra210_clks, &pll_p_params); + +/* mc */ +tegra210_clk_register_mc ("mc" ,"emc" ); +} + +static void __init tegra210_pll_init (void __iomem *clk_base, +void __iomem *pmc) +{ +struct clk *clk; + +/* PLL_RE reference clock must be selected by boot-loader */ + pll_re_use_utmipll =readl_relaxed (clk_base +PLLRE_BASE ) & +PLLRE_BASE_CLKIN_SEL ; + +/* PLLC */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c" ,"pll_ref" , clk_base, + pmc,0 , &pll_c_params,NULL ); +if (!WARN_ON (IS_ERR (clk))) +clk_register_clkdev (clk,"pll_c" ,NULL ); + clks[TEGRA210_CLK_PLL_C ] = clk; + +/* PLLC_OUT1 */ + clk =tegra_clk_register_divider ("pll_c_out1_div" ,"pll_c" , + clk_base +PLLC_OUT ,0 ,TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_c_out1" ,"pll_c_out1_div" , + clk_base +PLLC_OUT ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); +clk_register_clkdev (clk,"pll_c_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_C_OUT1 ] = clk; + +/* PLLC_UD */ + clk =clk_register_fixed_factor (NULL ,"pll_c_ud" ,"pll_c" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_c_ud" ,NULL ); + clks[TEGRA210_CLK_PLL_C_UD ] = clk; + +/* PLLC2 */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c2" ,"pll_ref" , clk_base, + pmc,0 , &pll_c2_params,NULL ); +clk_register_clkdev (clk,"pll_c2" ,NULL ); + clks[TEGRA210_CLK_PLL_C2 ] = clk; + +/* PLLC3 */ + clk =tegra_clk_register_pllc_tegra210 ("pll_c3" ,"pll_ref" , clk_base, + pmc,0 , &pll_c3_params,NULL ); +clk_register_clkdev (clk,"pll_c3" ,NULL ); + clks[TEGRA210_CLK_PLL_C3 ] = clk; + +/* PLLU_VCO */ +if (!tegra210_init_pllu ()) { + clk =clk_register_fixed_rate (NULL ,"pll_u_vco" ,"pll_ref" ,0 , +480 *1000 *1000 ); +clk_register_clkdev (clk,"pll_u_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_U ] = clk; + +/* PLLU_OUT */ + clk =clk_register_fixed_factor (NULL ,"pll_u_out" ,"pll_u_vco" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_u_out" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT ] = clk; + +/* UTMIPLL_60M */ + clk =clk_register_fixed_rate (NULL ,"utmipll_60M" ,"pll_ref" ,0 , +60 *1000 *1000 ); +clk_register_clkdev (clk,"utmipll_60M" ,NULL ); + clks[TEGRA210_CLK_UTMIPLL_60M ] = clk; + } + +/* PLLU_OUT1 */ + clk =tegra_clk_register_divider ("pll_u_out1_div" ,"pll_u_out" , + clk_base +PLLU_OUTA ,0 , +TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 , &pll_u_lock); + clk =tegra_clk_register_pll_out ("pll_u_out1" ,"pll_u_out1_div" , + clk_base +PLLU_OUTA ,1 ,0 , +CLK_SET_RATE_PARENT ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT1 ] = clk; + +/* PLLU_OUT2 */ + clk =tegra_clk_register_divider ("pll_u_out2_div" ,"pll_u_out" , + clk_base +PLLU_OUTA ,0 , +TEGRA_DIVIDER_ROUND_UP , +24 ,8 ,1 , &pll_u_lock); + clk =tegra_clk_register_pll_out ("pll_u_out2" ,"pll_u_out2_div" , + clk_base +PLLU_OUTA ,17 ,16 , +CLK_SET_RATE_PARENT ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_U_OUT2 ] = clk; + +/* PLLU_480M */ + clk =clk_register_gate (NULL ,"pll_u_480M" ,"pll_u_vco" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +22 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_480M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_480M ] = clk; + +/* PLLU_60M */ + clk =clk_register_gate (NULL ,"pll_u_60M" ,"pll_u_out2" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +23 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_60M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_60M ] = clk; + +/* PLLU_48M */ + clk =clk_register_gate (NULL ,"pll_u_48M" ,"pll_u_out1" , +CLK_SET_RATE_PARENT , clk_base +PLLU_BASE , +25 ,0 , &pll_u_lock); +clk_register_clkdev (clk,"pll_u_48M" ,NULL ); + clks[TEGRA210_CLK_PLL_U_48M ] = clk; + +/* PLLD */ + clk =tegra_clk_register_pll ("pll_d" ,"pll_ref" , clk_base, pmc,0 , + &pll_d_params, &pll_d_lock); +clk_register_clkdev (clk,"pll_d" ,NULL ); + clks[TEGRA210_CLK_PLL_D ] = clk; + +/* PLLD_OUT0 */ + clk =clk_register_fixed_factor (NULL ,"pll_d_out0" ,"pll_d" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_d_out0" ,NULL ); + clks[TEGRA210_CLK_PLL_D_OUT0 ] = clk; + +/* PLLRE */ +if (pll_re_use_utmipll) { + clk =tegra_clk_register_pllre_tegra210 ( +"pll_re_vco" ,"utmipll_60M" , clk_base, pmc,0 , + &pll_re_vco_params, &pll_re_lock,60 *1000 *1000 ); + }else { + clk =tegra_clk_register_pllre_tegra210 ( +"pll_re_vco" ,"pll_ref" , clk_base, pmc,0 , + &pll_re_vco_params, &pll_re_lock, pll_ref_freq); + } +clk_register_clkdev (clk,"pll_re_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_RE_VCO ] = clk; + + clk =clk_register_divider_table (NULL ,"pll_re_out" ,"pll_re_vco" ,0 , + clk_base +PLLRE_BASE ,16 ,5 ,0 , + pll_vco_post_div_table, &pll_re_lock); +clk_register_clkdev (clk,"pll_re_out" ,NULL ); + clks[TEGRA210_CLK_PLL_RE_OUT ] = clk; + + clk =tegra_clk_register_divider ("pll_re_out1_div" ,"pll_re_vco" , + clk_base +PLLRE_OUT1 ,0 , +TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_re_out1" ,"pll_re_out1_div" , + clk_base +PLLRE_OUT1 ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); + clks[TEGRA210_CLK_PLL_RE_OUT1 ] = clk; + +/* PLLE */ + clk =tegra_clk_register_plle_tegra210 ("pll_e" ,"pll_ref" , + clk_base,0 , &pll_e_params, &pll_e_lock); +clk_register_clkdev (clk,"pll_e" ,NULL ); + clks[TEGRA210_CLK_PLL_E ] = clk; + +/* PLLC4 */ + clk =tegra_clk_register_pllre_tegra210 ("pll_c4_vco" ,"pll_ref" , + clk_base, pmc,0 , &pll_c4_vco_params,NULL , pll_ref_freq); +clk_register_clkdev (clk,"pll_c4_vco" ,NULL ); + clks[TEGRA210_CLK_PLL_C4 ] = clk; + +/* PLLC4_OUT1 */ + clk =clk_register_fixed_factor (NULL ,"pll_c4_out1" ,"pll_c4_vco" , +CLK_SET_RATE_PARENT ,1 ,3 ); +clk_register_clkdev (clk,"pll_c4_out1" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT1 ] = clk; + +/* PLLC4_OUT2 */ + clk =clk_register_fixed_factor (NULL ,"pll_c4_out2" ,"pll_c4_vco" , +CLK_SET_RATE_PARENT ,1 ,5 ); +clk_register_clkdev (clk,"pll_c4_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT2 ] = clk; + +/* PLLC4_OUT3 */ + clk =tegra_clk_register_divider ("pll_c4_out3_div" ,"pll_c4_out0" , + clk_base +PLLC4_OUT ,0 ,TEGRA_DIVIDER_ROUND_UP , +8 ,8 ,1 ,NULL ); + clk =tegra_clk_register_pll_out ("pll_c4_out3" ,"pll_c4_out3_div" , + clk_base +PLLC4_OUT ,1 ,0 , +CLK_SET_RATE_PARENT ,0 ,NULL ); +clk_register_clkdev (clk,"pll_c4_out3" ,NULL ); + clks[TEGRA210_CLK_PLL_C4_OUT3 ] = clk; + +/* PLLDP */ + clk =tegra_clk_register_pllss_tegra210 ("pll_dp" ,"pll_ref" , clk_base, +0 , &pll_dp_params,NULL ); +clk_register_clkdev (clk,"pll_dp" ,NULL ); + clks[TEGRA210_CLK_PLL_DP ] = clk; + +/* PLLD2 */ + clk =tegra_clk_register_pllss_tegra210 ("pll_d2" ,"pll_ref" , clk_base, +0 , &pll_d2_params,NULL ); +clk_register_clkdev (clk,"pll_d2" ,NULL ); + clks[TEGRA210_CLK_PLL_D2 ] = clk; + +/* PLLD2_OUT0 */ + clk =clk_register_fixed_factor (NULL ,"pll_d2_out0" ,"pll_d2" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_d2_out0" ,NULL ); + clks[TEGRA210_CLK_PLL_D2_OUT0 ] = clk; + +/* PLLP_OUT2 */ + clk =clk_register_fixed_factor (NULL ,"pll_p_out2" ,"pll_p" , +CLK_SET_RATE_PARENT ,1 ,2 ); +clk_register_clkdev (clk,"pll_p_out2" ,NULL ); + clks[TEGRA210_CLK_PLL_P_OUT2 ] = clk; + +/* PLLP_UD */ + clk =clk_register_fixed_factor (NULL ,"pll_p_ud" ,"pll_p" , +CLK_SET_RATE_PARENT ,1 ,1 ); +clk_register_clkdev (clk,"pll_pud" ,NULL ); + clks[TEGRA210_CLK_PLL_P_UD ] = clk; + +/* PLLP_UPHY_OUT */ + clk =tegra_clk_register_divider ("pll_p_uphy_div" ,"pll_p_out_xusb" , + clk_base +PEX_SATA_USB_RX_BYP ,0 , +TEGRA_DIVIDER_ROUND_UP ,0 ,8 ,1 , &pll_p_uphy_lock); + clk =clk_register_gate (NULL ,"pll_p_uphy_out" ,"pll_p_uphy_div" , +CLK_SET_RATE_PARENT |CLK_IGNORE_UNUSED , + clk_base +PEX_SATA_USB_RX_BYP ,8 ,0 , &pll_p_uphy_lock); +clk_register_clkdev (clk,"pll_p_uphy_out" ,NULL ); + clks[TEGRA210_CLK_PLL_P_UPHY_OUT ] = clk; +} + +/* Tegra210 CPU clock and reset control functions */ +static void tegra210_wait_cpu_in_reset (u32 cpu) +{ +unsigned int reg; + +do { + reg =readl (clk_base +CLK_RST_CONTROLLER_CPU_CMPLX_STATUS ); +cpu_relax (); + }while (!(reg & (1 << cpu)));/* check CPU been reset or not */ +} + +static void tegra210_disable_cpu_clock (u32 cpu) +{ +/* flow controller would take care in the power sequence. */ +} + +#ifdef CONFIG_PM_SLEEP +#define car_readl (_base, _off) readl_relaxed(clk_base + (_base) + ((_off) * 4)) +#define car_writel (_val, _base, _off) \ + writel_relaxed(_val, clk_base + (_base) + ((_off) * 4)) + +static u32 spare_reg_ctx, misc_clk_enb_ctx, clk_msk_arm_ctx; +static u32 cpu_softrst_ctx[3 ]; + +static int tegra210_clk_suspend (void ) +{ +unsigned int i; + +clk_save_context (); + +/* +* Save the bootloader configured clock registers SPARE_REG0, +* MISC_CLK_ENB, CLK_MASK_ARM, CPU_SOFTRST_CTRL. +*/ + spare_reg_ctx =readl_relaxed (clk_base +SPARE_REG0 ); + misc_clk_enb_ctx =readl_relaxed (clk_base +MISC_CLK_ENB ); + clk_msk_arm_ctx =readl_relaxed (clk_base +CLK_MASK_ARM ); + +for (i =0 ; i <ARRAY_SIZE (cpu_softrst_ctx); i++) + cpu_softrst_ctx[i] =car_readl (CPU_SOFTRST_CTRL , i); + +tegra_clk_periph_suspend (); +return 0 ; +} + +static void tegra210_clk_resume (void ) +{ +unsigned int i; + +tegra_clk_osc_resume (clk_base); + +/* +* Restore the bootloader configured clock registers SPARE_REG0, +* MISC_CLK_ENB, CLK_MASK_ARM, CPU_SOFTRST_CTRL from saved context. +*/ +writel_relaxed (spare_reg_ctx, clk_base +SPARE_REG0 ); +writel_relaxed (misc_clk_enb_ctx, clk_base +MISC_CLK_ENB ); +writel_relaxed (clk_msk_arm_ctx, clk_base +CLK_MASK_ARM ); + +for (i =0 ; i <ARRAY_SIZE (cpu_softrst_ctx); i++) +car_writel (cpu_softrst_ctx[i],CPU_SOFTRST_CTRL , i); + +/* +* Tegra clock programming sequence recommends peripheral clock to +* be enabled prior to changing its clock source and divider to +* prevent glitchless frequency switch. +* So, enable all peripheral clocks before restoring their source +* and dividers. +*/ +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_L , clk_base +CLK_OUT_ENB_L ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_H , clk_base +CLK_OUT_ENB_H ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_U , clk_base +CLK_OUT_ENB_U ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_V , clk_base +CLK_OUT_ENB_V ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_W , clk_base +CLK_OUT_ENB_W ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_X , clk_base +CLK_OUT_ENB_X ); +writel_relaxed (TEGRA210_CLK_ENB_VLD_MSK_Y , clk_base +CLK_OUT_ENB_Y ); + +/* wait for all writes to happen to have all the clocks enabled */ +fence_udelay (2 , clk_base); + +/* restore PLLs and all peripheral clock rates */ +tegra210_init_pllu (); +clk_restore_context (); + +/* restore saved context of peripheral clocks and reset state */ +tegra_clk_periph_resume (); +} + +static void tegra210_cpu_clock_suspend (void ) +{ +/* switch coresite to clk_m, save off original source */ + tegra210_cpu_clk_sctx.clk_csite_src = +readl (clk_base +CLK_SOURCE_CSITE ); +writel (3 <<30 , clk_base +CLK_SOURCE_CSITE ); +} + +static void tegra210_cpu_clock_resume (void ) +{ +writel (tegra210_cpu_clk_sctx.clk_csite_src, + clk_base +CLK_SOURCE_CSITE ); +} +#endif + +static struct syscore_ops tegra_clk_syscore_ops = { +#ifdef CONFIG_PM_SLEEP + .suspend = tegra210_clk_suspend, + .resume = tegra210_clk_resume, +#endif +}; + +static struct tegra_cpu_car_ops tegra210_cpu_car_ops = { + .wait_for_reset = tegra210_wait_cpu_in_reset, + .disable_clock = tegra210_disable_cpu_clock, +#ifdef CONFIG_PM_SLEEP + .suspend = tegra210_cpu_clock_suspend, + .resume = tegra210_cpu_clock_resume, +#endif +}; + +static const struct of_device_id pmc_match[]__initconst = { + { .compatible ="nvidia,tegra210b01-pmc" }, + { }, +}; + +static struct tegra_clk_init_table t210b01_init_table[]__initdata = { + {TEGRA210_CLK_PLL_A ,TEGRA210_CLK_CLK_MAX ,564480000 ,1 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_RE_VCO ,TEGRA210_CLK_CLK_MAX ,0 ,1 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_DP ,TEGRA210_CLK_CLK_MAX ,270000000 ,0 , +TEGRA_TABLE_RATE_CHANGE_OVERCLOCK }, + {TEGRA210_CLK_PLL_P_UPHY_OUT ,TEGRA210_CLK_CLK_MAX ,102000000 ,1 }, + {TEGRA210_CLK_SDMMC_LEGACY ,TEGRA210_CLK_PLL_P ,12000000 ,0 }, + {TEGRA210_CLK_I2CSLOW ,TEGRA210_CLK_CLK_32K ,32000 ,0 }, + {TEGRA210_CLK_SPDIF_IN ,TEGRA210_CLK_CLK_MAX ,136000000 ,0 }, + {TEGRA210_CLK_USB2_HSIC_TRK ,TEGRA210_CLK_CLK_MAX ,9600000 ,0 }, +/* This MUST be the last entry. */ + {TEGRA210_CLK_CLK_MAX ,TEGRA210_CLK_CLK_MAX ,0 ,0 }, +}; + +static struct tegra_clk_init_table init_table[]__initdata = { + {TEGRA210_CLK_UARTA ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTB ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTC ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_UARTD ,TEGRA210_CLK_PLL_P ,408000000 ,0 }, + {TEGRA210_CLK_PLL_A_OUT0 ,TEGRA210_CLK_CLK_MAX ,11289600 ,0 }, + {TEGRA210_CLK_I2S0 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S1 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S2 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S3 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_I2S4 ,TEGRA210_CLK_PLL_A_OUT0 ,11289600 ,0 }, + {TEGRA210_CLK_HOST1X ,TEGRA210_CLK_PLL_P ,136000000 ,1 }, + {TEGRA210_CLK_SCLK_MUX ,TEGRA210_CLK_PLL_P ,0 ,1 }, + {TEGRA210_CLK_SCLK ,TEGRA210_CLK_CLK_MAX ,102000000 ,0 }, + {TEGRA210_CLK_DFLL_SOC ,TEGRA210_CLK_PLL_P ,51000000 ,1 }, + {TEGRA210_CLK_DFLL_REF ,TEGRA210_CLK_PLL_P ,51000000 ,1 }, + {TEGRA210_CLK_SBC4 ,TEGRA210_CLK_PLL_P ,12000000 ,1 }, + {TEGRA210_CLK_PLL_U_OUT1 ,TEGRA210_CLK_CLK_MAX ,48000000 ,1 }, + {TEGRA210_CLK_XUSB_GATE ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_XUSB_SS_SRC ,TEGRA210_CLK_PLL_U_480M ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_FS_SRC ,TEGRA210_CLK_PLL_U_48M ,48000000 ,0 }, + {TEGRA210_CLK_XUSB_HS_SRC ,TEGRA210_CLK_XUSB_SS_SRC ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_SSP_SRC ,TEGRA210_CLK_XUSB_SS_SRC ,120000000 ,0 }, + {TEGRA210_CLK_XUSB_FALCON_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,204000000 ,0 }, + {TEGRA210_CLK_XUSB_HOST_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,102000000 ,0 }, + {TEGRA210_CLK_XUSB_DEV_SRC ,TEGRA210_CLK_PLL_P_OUT_XUSB ,102000000 ,0 }, + {TEGRA210_CLK_SATA ,TEGRA210_CLK_PLL_P ,104000000 ,0 }, + {TEGRA210_CLK_SATA_OOB ,TEGRA210_CLK_PLL_P ,204000000 ,0 }, + {TEGRA210_CLK_MSELECT ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_CSITE ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, +/* TODO find a way to enable this on-demand */ + {TEGRA210_CLK_DBGAPB ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_TSENSOR ,TEGRA210_CLK_CLK_M ,400000 ,0 }, + {TEGRA210_CLK_I2C1 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C2 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C3 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C4 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C5 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_I2C6 ,TEGRA210_CLK_PLL_P ,0 ,0 }, + {TEGRA210_CLK_SOC_THERM ,TEGRA210_CLK_PLL_P ,51000000 ,0 }, + {TEGRA210_CLK_CCLK_G ,TEGRA210_CLK_CLK_MAX ,0 ,1 }, + {TEGRA210_CLK_PLL_U_OUT2 ,TEGRA210_CLK_CLK_MAX ,60000000 ,1 }, + {TEGRA210_CLK_SPDIF_IN_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S0_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S1_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S2_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S3_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_I2S4_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_VIMCLK_SYNC ,TEGRA210_CLK_CLK_MAX ,24576000 ,0 }, + {TEGRA210_CLK_HDA ,TEGRA210_CLK_PLL_P ,51000000 ,0 }, + {TEGRA210_CLK_HDA2CODEC_2X ,TEGRA210_CLK_PLL_P ,48000000 ,0 }, + {TEGRA210_CLK_PWM ,TEGRA210_CLK_PLL_P ,48000000 ,0 }, +/* This MUST be the last entry. */ + {TEGRA210_CLK_CLK_MAX ,TEGRA210_CLK_CLK_MAX ,0 ,0 }, +}; + +static void __init tegra210b01_clock_table_init (struct clk **clks) +{ +struct clk *clk; +unsigned long rate; + +/* Set PLL_RE at 625 MHz from UTMIPLL, or 672MHz, otherwise */ + rate = (pll_re_use_utmipll ?625 :672 ) *1000 *1000 ; + clk = clks[TEGRA210_CLK_PLL_RE_VCO ]; +WARN_ON (IS_ERR_OR_NULL (clk)); +if (clk_set_rate (clk, rate)) +WARN (1 ,"%s: Failed to set rate %lu of %s\n" , + __func__, rate,__clk_get_name (clk)); + +tegra_init_from_table (t210b01_init_table, clks,TEGRA210_CLK_CLK_MAX ); +} + +/** +* tegra210b01_clock_apply_init_table - initialize clocks on Tegra210 SoCs +* +* Program an initial clock rate and enable or disable clocks needed +* by the rest of the kernel, for Tegra210 SoCs. It is intended to be +* called by assigning a pointer to it to tegra_clk_apply_init_table - +* this will be called as an arch_initcall. No return value. +*/ +static void __init tegra210b01_clock_apply_init_table (void ) +{ +tegra210b01_clock_table_init (clks); +tegra_init_from_table (init_table, clks,TEGRA210_CLK_CLK_MAX ); +} + +/** +* tegra210b01_car_barrier - wait for pending writes to the CAR to complete +* +* Wait for any outstanding writes to the CAR MMIO space from this CPU +* to complete before continuing execution. No return value. +*/ +static void tegra210b01_car_barrier (void ) +{ +readl_relaxed (clk_base +RST_DFLL_DVCO ); +} + +/** +* tegra210b01_clock_assert_dfll_dvco_reset - assert the DFLL's DVCO reset +* +* Assert the reset line of the DFLL's DVCO. No return value. +*/ +static void tegra210b01_clock_assert_dfll_dvco_reset (void ) +{ +u32 v; + + v =readl_relaxed (clk_base +RST_DFLL_DVCO ); + v |= (1 <<DVFS_DFLL_RESET_SHIFT ); +writel_relaxed (v, clk_base +RST_DFLL_DVCO ); +tegra210b01_car_barrier (); +} + +/** +* tegra210b01_clock_deassert_dfll_dvco_reset - deassert the DFLL's DVCO reset +* +* Deassert the reset line of the DFLL's DVCO, allowing the DVCO to +* operate. No return value. +*/ +static void tegra210b01_clock_deassert_dfll_dvco_reset (void ) +{ +u32 v; + + v =readl_relaxed (clk_base +RST_DFLL_DVCO ); + v &= ~(1 <<DVFS_DFLL_RESET_SHIFT ); +writel_relaxed (v, clk_base +RST_DFLL_DVCO ); +tegra210b01_car_barrier (); +} + +static int tegra210b01_reset_assert (unsigned long id) +{ +if (id ==TEGRA210_RST_DFLL_DVCO ) +tegra210b01_clock_assert_dfll_dvco_reset (); +else if (id ==TEGRA210_RST_ADSP ) +writel (GENMASK (26 ,21 ) |BIT (7 ), + clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_SET ); +else +return -EINVAL ; + +return 0 ; +} + +static int tegra210b01_reset_deassert (unsigned long id) +{ +if (id ==TEGRA210_RST_DFLL_DVCO ) +tegra210b01_clock_deassert_dfll_dvco_reset (); +else if (id ==TEGRA210_RST_ADSP ) { +writel (BIT (21 ), clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_CLR ); +/* +* Considering adsp cpu clock (min: 12.5MHZ, max: 1GHz) +* a delay of 5us ensures that it's at least +* 6 * adsp_cpu_cycle_period long. +*/ drivers/clk/tegra/clk-tegra210b01.c line 3589
Quoted 10 lines
drivers/clk/tegra/clk-tegra210b01.c new file +10
-0+udelay (5 ); +writel (GENMASK (26 ,22 ) |BIT (7 ), + clk_base +CLK_RST_CONTROLLER_RST_DEV_Y_CLR ); + }else +return -EINVAL ; + +return 0 ; +} + +static enum clk_id tegra210b01_integer_div_id[] = {const?
Quoted 164 lines
drivers/clk/tegra/clk-tegra210b01.c new file +164
-0+ tegra_clk_cilab, + tegra_clk_cilcd, + + tegra_clk_spdif_out, + + tegra_clk_sbc1_9, + tegra_clk_sbc2_9, + tegra_clk_sbc3_9, + tegra_clk_sbc4_9, + + tegra_clk_sdmmc_legacy, + tegra_clk_i2cslow, + tegra_clk_qspi, + + tegra_clk_soc_therm_8, + tegra_clk_tsensor, +}; + +static void tegra210b01_adjust_clks (struct tegra_clk *tegra_clks) +{ +int i; + +/* Remove CPU_LP claster clocks */ + tegra_clks[tegra_clk_cclk_lp].present = false; + tegra_clks[tegra_clk_pll_x_out0].present = false; + +/* Prevent 1:1.5 fractional divider setting */ + div1_5_not_allowed = true; + +/* Prevent any fractional setting */ +for (i =0 ; i <ARRAY_SIZE (tegra210b01_integer_div_id); i++) { +enum clk_id cid = tegra210b01_integer_div_id[i]; + +if (cid >= tegra_clk_max || !tegra_clks[cid].present) { +pr_warn ("%s: clk %d is not present\n" , __func__, cid); +continue ; + } + tegra_clks[cid].use_integer_div = true; + } +} + +static void tegra210b01_mbist_clk_init (void ) +{ +unsigned int i, j; + +for (i =0 ; i <ARRAY_SIZE (tegra210_pg_mbist_war); i++) { +unsigned int num_clks = tegra210_pg_mbist_war[i].num_clks; +struct clk_bulk_data *clk_data; + +if (!num_clks) +continue ; + + clk_data =kmalloc_array (num_clks,sizeof (*clk_data), +GFP_KERNEL ); +if (WARN_ON (!clk_data)) +return ; + + tegra210_pg_mbist_war[i].clks = clk_data; +for (j =0 ; j < num_clks; j++) { +int clk_id = tegra210_pg_mbist_war[i].clk_init_data[j]; +struct clk *clk = clks[clk_id]; + +if (WARN (IS_ERR (clk),"clk_id: %d\n" , clk_id)) { +kfree (clk_data); + tegra210_pg_mbist_war[i].clks =NULL ; +break ; + } + clk_data[j].clk = clk; + } + } +} + +/** +* tegra210b01_clock_init - Tegra210-specific clock initialization +* @np: struct device_node * of the DT node for the SoC CAR IP block +* +* Register most SoC clocks for the Tegra210B01 system-on-chip. Intended +* to be called by the OF init code when a DT node with the +* "nvidia,tegra210b01-car" string is encountered, and declared with +* CLK_OF_DECLARE. No return value. +*/ +static void __init tegra210b01_clock_init (struct device_node *np) +{ +struct device_node *node; +u32 value, clk_m_div; + + clk_base =of_iomap (np,0 ); +if (!clk_base) { +pr_err ("ioremap tegra210 CAR failed\n" ); +return ; + } + + node =of_find_matching_node (NULL , pmc_match); +if (!node) { +pr_err ("Failed to find pmc node\n" ); +WARN_ON (1 ); +return ; + } + + pmc_base =of_iomap (node,0 ); +of_node_put (node); +if (!pmc_base) { +pr_err ("Can't map pmc registers\n" ); +WARN_ON (1 ); +return ; + } + + ahub_base =ioremap (TEGRA210_AHUB_BASE ,SZ_64K ); +if (!ahub_base) { +pr_err ("ioremap tegra210 APE failed\n" ); +return ; + } + + dispa_base =ioremap (TEGRA210_DISPA_BASE ,SZ_256K ); +if (!dispa_base) { +pr_err ("ioremap tegra210 DISPA failed\n" ); +return ; + } + + vic_base =ioremap (TEGRA210_VIC_BASE ,SZ_256K ); +if (!vic_base) { +pr_err ("ioremap tegra210 VIC failed\n" ); +return ; + } + + clks =tegra_clk_init (clk_base,TEGRA210_CLK_CLK_MAX , +TEGRA210_CAR_BANK_COUNT ); +if (!clks) +return ; + +tegra210b01_adjust_clks (tegra210_clks); + + value =readl (clk_base +SPARE_REG0 ) >>CLK_M_DIVISOR_SHIFT ; + clk_m_div = (value &CLK_M_DIVISOR_MASK ) +1 ; + +if (tegra_osc_clk_init (clk_base, tegra210_clks, tegra210_input_freq, +ARRAY_SIZE (tegra210_input_freq), clk_m_div, + &osc_freq, &pll_ref_freq) <0 ) +return ; + +tegra_fixed_clk_init (tegra210_clks); +tegra210_pll_init (clk_base, pmc_base); +tegra210_periph_clk_init (np, clk_base, pmc_base); +tegra_audio_clk_init (clk_base, pmc_base, tegra210_clks, + tegra210_audio_plls, +ARRAY_SIZE (tegra210_audio_plls),24576000 ); + +/* For Tegra210, PLLD is the only source for DSIA & DSIB */ + value =readl (clk_base +PLLD_BASE ); + value &= ~BIT (25 ); +writel (value, clk_base +PLLD_BASE ); + + tegra_clk_apply_init_table = tegra210b01_clock_apply_init_table; + +tegra_super_clk_gen5_init (clk_base, pmc_base, tegra210_clks, + &pll_x_params); +tegra_init_special_resets (2 , tegra210b01_reset_assert, + tegra210b01_reset_deassert); + +tegra_add_of_provider (np, of_clk_src_onecell_get); +tegra_register_devclks (devclks,ARRAY_SIZE (devclks)); + +tegra210b01_mbist_clk_init (); +
Quoted 8 lines
drivers/clk/tegra/clk-tegra210b01.c line 3758
Quoted 5 lines
drivers/clk/tegra/clk-tegra210b01.c new file +5
-0+ tegra_cpu_car_ops = &tegra210_cpu_car_ops; + +register_syscore_ops (&tegra_clk_syscore_ops); +} +CLK_OF_DECLARE (tegra210b01,"nvidia,tegra210b01-car" , tegra210b01_clock_init);Can it be a platform device instead of using
CLK_OF_DECLARE? Maybe that is not possible with syscore ops though.
Stephen,
Sorry for delaying a response for so long. I am about to resubmit this driver as an independent series instead of having everything soc related combined.
This driver was based on the tegra210 clk driver and I was trying to keep the similarities as in sync as feasible. Much of the suggestions here would be taking things out of sync. Would it be okay to keep things as is in the initial submission for consistency and if updates need done, have them done as followup changes that keep things consistent across the two drivers? Some of the suggestions may even apply across more of the tegra clock drivers.
Aaron