···11+NVIDIA Tegra210 Clock And Reset Controller22+33+This binding uses the common clock binding:44+Documentation/devicetree/bindings/clock/clock-bindings.txt55+66+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible77+for muxing and gating Tegra's clocks, and setting their rates.88+99+Required properties :1010+- compatible : Should be "nvidia,tegra210-car"1111+- reg : Should contain CAR registers location and length1212+- clocks : Should contain phandle and clock specifiers for two clocks:1313+ the 32 KHz "32k_in".1414+- #clock-cells : Should be 1.1515+ In clock consumers, this cell represents the clock ID exposed by the1616+ CAR. The assignments may be found in header file1717+ <dt-bindings/clock/tegra210-car.h>.1818+- #reset-cells : Should be 1.1919+ In clock consumers, this cell represents the bit number in the CAR's2020+ array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.2121+2222+Example SoC include file:2323+2424+/ {2525+ tegra_car: clock {2626+ compatible = "nvidia,tegra210-car";2727+ reg = <0x60006000 0x1000>;2828+ #clock-cells = <1>;2929+ #reset-cells = <1>;3030+ };3131+3232+ usb@c5004000 {3333+ clocks = <&tegra_car TEGRA210_CLK_USB2>;3434+ };3535+};3636+3737+Example board file:3838+3939+/ {4040+ clocks {4141+ compatible = "simple-bus";4242+ #address-cells = <1>;4343+ #size-cells = <0>;4444+4545+ clk_32k: clock@1 {4646+ compatible = "fixed-clock";4747+ reg = <1>;4848+ #clock-cells = <0>;4949+ clock-frequency = <32768>;5050+ };5151+ };5252+5353+ &tegra_car {5454+ clocks = <&clk_32k>;5555+ };5656+};
···110110 * @m: input divider111111 * @p: post divider112112 * @cpcon: charge pump current113113+ * @sdm_data: fraction divider setting (0 = disabled)113114 */114115struct tegra_clk_pll_freq_table {115116 unsigned long input_rate;116117 unsigned long output_rate;117117- u16 n;118118+ u32 n;118119 u16 m;119120 u8 p;120121 u8 cpcon;122122+ u16 sdm_data;121123};122124123125/**···158156 u8 override_divp_shift;159157};160158159159+#define MAX_PLL_MISC_REG_COUNT 6160160+161161+struct tegra_clk_pll;162162+161163/**162164 * struct tegra_clk_pll_params - PLL parameters163165 *···178172 * @lock_enable_bit_idx: Bit index to enable PLL lock179173 * @iddq_reg: PLL IDDQ register offset180174 * @iddq_bit_idx: Bit index to enable PLL IDDQ175175+ * @reset_reg: Register offset of where RESET bit is176176+ * @reset_bit_idx: Shift of reset bit in reset_reg177177+ * @sdm_din_reg: Register offset where SDM settings are178178+ * @sdm_din_mask: Mask of SDM divider bits179179+ * @sdm_ctrl_reg: Register offset where SDM enable is180180+ * @sdm_ctrl_en_mask: Mask of SDM enable bit181181+ * @ssc_ctrl_reg: Register offset where SSC settings are182182+ * @ssc_ctrl_en_mask: Mask of SSC enable bit181183 * @aux_reg: AUX register offset182184 * @dyn_ramp_reg: Dynamic ramp control register offset183185 * @ext_misc_reg: Miscellaneous control register offsets···196182 * @stepb_shift: Dynamic ramp step B field shift197183 * @lock_delay: Delay in us if PLL lock is not used198184 * @max_p: maximum value for the p divider185185+ * @defaults_set: Boolean signaling all reg defaults for PLL set.199186 * @pdiv_tohw: mapping of p divider to register values200187 * @div_nmp: offsets and widths on n, m and p fields201188 * @freq_table: array of frequencies supported by PLL202189 * @fixed_rate: PLL rate if it is fixed190190+ * @mdiv_default: Default value for fixed mdiv for this PLL191191+ * @round_p_to_pdiv: Callback used to round p to the closed pdiv192192+ * @set_gain: Callback to adjust N div for SDM enabled193193+ * PLL's based on fractional divider value.194194+ * @calc_rate: Callback used to change how out of table195195+ * rates (dividers and multipler) are calculated.196196+ * @adjust_vco: Callback to adjust the programming range of the197197+ * divider range (if SDM is present)198198+ * @set_defaults: Callback which will try to initialize PLL199199+ * registers to sane default values. This is first200200+ * tried during PLL registration, but if the PLL201201+ * is already enabled, it will be done the first202202+ * time the rate is changed while the PLL is203203+ * disabled.204204+ * @dyn_ramp: Callback which can be used to define a custom205205+ * dynamic ramp function for a given PLL.203206 *204207 * Flags:205208 * TEGRA_PLL_USE_LOCK - This flag indicated to use lock bits for···238207 * base register.239208 * TEGRA_PLL_BYPASS - PLL has bypass bit240209 * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring210210+ * TEGRA_MDIV_NEW - Switch to new method for calculating fixed mdiv211211+ * it may be more accurate (especially if SDM present)212212+ * TEGRA_PLLMB - PLLMB has should be treated similar to PLLM. This213213+ * flag indicated that it is PLLMB.214214+ * TEGRA_PLL_VCO_OUT - Used to indicate that the PLL has a VCO output241215 */242216struct tegra_clk_pll_params {243217 unsigned long input_min;···259223 u32 lock_enable_bit_idx;260224 u32 iddq_reg;261225 u32 iddq_bit_idx;226226+ u32 reset_reg;227227+ u32 reset_bit_idx;228228+ u32 sdm_din_reg;229229+ u32 sdm_din_mask;230230+ u32 sdm_ctrl_reg;231231+ u32 sdm_ctrl_en_mask;232232+ u32 ssc_ctrl_reg;233233+ u32 ssc_ctrl_en_mask;262234 u32 aux_reg;263235 u32 dyn_ramp_reg;264264- u32 ext_misc_reg[3];236236+ u32 ext_misc_reg[MAX_PLL_MISC_REG_COUNT];265237 u32 pmc_divnm_reg;266238 u32 pmc_divp_reg;267239 u32 flags;···277233 int stepb_shift;278234 int lock_delay;279235 int max_p;280280- struct pdiv_map *pdiv_tohw;236236+ bool defaults_set;237237+ const struct pdiv_map *pdiv_tohw;281238 struct div_nmp *div_nmp;282239 struct tegra_clk_pll_freq_table *freq_table;283240 unsigned long fixed_rate;241241+ u16 mdiv_default;242242+ u32 (*round_p_to_pdiv)(u32 p, u32 *pdiv);243243+ void (*set_gain)(struct tegra_clk_pll_freq_table *cfg);244244+ int (*calc_rate)(struct clk_hw *hw,245245+ struct tegra_clk_pll_freq_table *cfg,246246+ unsigned long rate, unsigned long parent_rate);247247+ unsigned long (*adjust_vco)(struct tegra_clk_pll_params *pll_params,248248+ unsigned long parent_rate);249249+ void (*set_defaults)(struct tegra_clk_pll *pll);250250+ int (*dyn_ramp)(struct tegra_clk_pll *pll,251251+ struct tegra_clk_pll_freq_table *cfg);284252};285253286254#define TEGRA_PLL_USE_LOCK BIT(0)···306250#define TEGRA_PLL_LOCK_MISC BIT(8)307251#define TEGRA_PLL_BYPASS BIT(9)308252#define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10)253253+#define TEGRA_MDIV_NEW BIT(11)254254+#define TEGRA_PLLMB BIT(12)255255+#define TEGRA_PLL_VCO_OUT BIT(13)309256310257/**311258 * struct tegra_clk_pll - Tegra PLL clock···362303 struct tegra_clk_pll_params *pll_params,363304 spinlock_t *lock);364305306306+struct clk *tegra_clk_register_pllxc_tegra210(const char *name,307307+ const char *parent_name, void __iomem *clk_base,308308+ void __iomem *pmc, unsigned long flags,309309+ struct tegra_clk_pll_params *pll_params,310310+ spinlock_t *lock);311311+365312struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,366313 void __iomem *clk_base, void __iomem *pmc,367314 unsigned long flags,···392327 struct tegra_clk_pll_params *pll_params,393328 spinlock_t *lock);394329330330+struct clk *tegra_clk_register_plle_tegra210(const char *name,331331+ const char *parent_name,332332+ void __iomem *clk_base, unsigned long flags,333333+ struct tegra_clk_pll_params *pll_params,334334+ spinlock_t *lock);335335+336336+struct clk *tegra_clk_register_pllc_tegra210(const char *name,337337+ const char *parent_name, void __iomem *clk_base,338338+ void __iomem *pmc, unsigned long flags,339339+ struct tegra_clk_pll_params *pll_params,340340+ spinlock_t *lock);341341+342342+struct clk *tegra_clk_register_pllss_tegra210(const char *name,343343+ const char *parent_name, void __iomem *clk_base,344344+ unsigned long flags,345345+ struct tegra_clk_pll_params *pll_params,346346+ spinlock_t *lock);347347+395348struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,396349 void __iomem *clk_base, unsigned long flags,350350+ struct tegra_clk_pll_params *pll_params,351351+ spinlock_t *lock);352352+353353+struct clk *tegra_clk_register_pllmb(const char *name, const char *parent_name,354354+ void __iomem *clk_base, void __iomem *pmc,355355+ unsigned long flags,397356 struct tegra_clk_pll_params *pll_params,398357 spinlock_t *lock);399358···742653void tegra_super_clk_gen4_init(void __iomem *clk_base,743654 void __iomem *pmc_base, struct tegra_clk *tegra_clks,744655 struct tegra_clk_pll_params *pll_params);656656+void tegra_super_clk_gen5_init(void __iomem *clk_base,657657+ void __iomem *pmc_base, struct tegra_clk *tegra_clks,658658+ struct tegra_clk_pll_params *pll_params);745659746660#ifdef CONFIG_TEGRA_CLK_EMC747661struct clk *tegra_clk_register_emc(void __iomem *base, struct device_node *np,···766674767675typedef void (*tegra_clk_apply_init_table_func)(void);768676extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table;677677+int tegra_pll_wait_for_lock(struct tegra_clk_pll *pll);678678+u16 tegra_pll_get_fixed_mdiv(struct clk_hw *hw, unsigned long input_rate);679679+int tegra_pll_p_div_to_hw(struct tegra_clk_pll *pll, u8 p_div);769680770681#endif /* TEGRA_CLK_H */