mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
clk: davinci: New driver for davinci PLL clocks
This adds a new driver for mach-davinci PLL clocks. This is porting the code from arch/arm/mach-davinci/clock.c to the common clock framework. Additionally, it adds device tree support for these clocks. The ifeq ($(CONFIG_COMMON_CLK), y) in the Makefile is needed to prevent compile errors until the clock code in arch/arm/mach-davinci is removed. Note: although there are similar clocks for TI Keystone we are not able to share the code for a few reasons. The keystone clocks are device tree only and use legacy one-node-per-clock bindings. Also the register layouts are a bit different, which would add even more if/else mess to the keystone clocks. And the keystone PLL driver doesn't support setting clock rates. Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
committed by
Stephen Boyd
parent
b6e37ce237
commit
2d17269151
@@ -13792,6 +13792,13 @@ F: arch/arm/mach-davinci/
|
||||
F: drivers/i2c/busses/i2c-davinci.c
|
||||
F: arch/arm/boot/dts/da850*
|
||||
|
||||
TI DAVINCI SERIES CLOCK DRIVER
|
||||
M: David Lechner <david@lechnology.com>
|
||||
R: Sekhar Nori <nsekhar@ti.com>
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/clock/ti/davinci/
|
||||
F: drivers/clk/davinci/
|
||||
|
||||
TI DAVINCI SERIES GPIO DRIVER
|
||||
M: Keerthy <j-keerthy@ti.com>
|
||||
L: linux-gpio@vger.kernel.org
|
||||
|
||||
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARCH_ARTPEC) += axis/
|
||||
obj-$(CONFIG_ARC_PLAT_AXS10X) += axs10x/
|
||||
obj-y += bcm/
|
||||
obj-$(CONFIG_ARCH_BERLIN) += berlin/
|
||||
obj-$(CONFIG_ARCH_DAVINCI) += davinci/
|
||||
obj-$(CONFIG_H8300) += h8300/
|
||||
obj-$(CONFIG_ARCH_HISI) += hisilicon/
|
||||
obj-y += imgtec/
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ifeq ($(CONFIG_COMMON_CLK), y)
|
||||
obj-y += pll.o
|
||||
endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,120 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Clock driver for TI Davinci PSC controllers
|
||||
*
|
||||
* Copyright (C) 2018 David Lechner <david@lechnology.com>
|
||||
*/
|
||||
|
||||
#ifndef __CLK_DAVINCI_PLL_H___
|
||||
#define __CLK_DAVINCI_PLL_H___
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define PLL_HAS_CLKMODE BIT(0) /* PLL has PLLCTL[CLKMODE] */
|
||||
#define PLL_HAS_PREDIV BIT(1) /* has prediv before PLL */
|
||||
#define PLL_PREDIV_ALWAYS_ENABLED BIT(2) /* don't clear DEN bit */
|
||||
#define PLL_PREDIV_FIXED_DIV BIT(3) /* fixed divider value */
|
||||
#define PLL_HAS_POSTDIV BIT(4) /* has postdiv after PLL */
|
||||
#define PLL_POSTDIV_ALWAYS_ENABLED BIT(5) /* don't clear DEN bit */
|
||||
#define PLL_POSTDIV_FIXED_DIV BIT(6) /* fixed divider value */
|
||||
#define PLL_HAS_EXTCLKSRC BIT(7) /* has selectable bypass */
|
||||
#define PLL_PLLM_2X BIT(8) /* PLLM value is 2x (DM365) */
|
||||
#define PLL_PREDIV_FIXED8 BIT(9) /* DM355 quirk */
|
||||
|
||||
/** davinci_pll_clk_info - controller-specific PLL info
|
||||
* @name: The name of the PLL
|
||||
* @unlock_reg: Option CFGCHIP register for unlocking PLL
|
||||
* @unlock_mask: Bitmask used with @unlock_reg
|
||||
* @pllm_mask: Bitmask for PLLM[PLLM] value
|
||||
* @pllm_min: Minimum allowable value for PLLM[PLLM]
|
||||
* @pllm_max: Maximum allowable value for PLLM[PLLM]
|
||||
* @pllout_min_rate: Minimum allowable rate for PLLOUT
|
||||
* @pllout_max_rate: Maximum allowable rate for PLLOUT
|
||||
* @flags: Bitmap of PLL_* flags.
|
||||
*/
|
||||
struct davinci_pll_clk_info {
|
||||
const char *name;
|
||||
u32 unlock_reg;
|
||||
u32 unlock_mask;
|
||||
u32 pllm_mask;
|
||||
u32 pllm_min;
|
||||
u32 pllm_max;
|
||||
unsigned long pllout_min_rate;
|
||||
unsigned long pllout_max_rate;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
#define SYSCLK_ARM_RATE BIT(0) /* Controls ARM rate */
|
||||
#define SYSCLK_ALWAYS_ENABLED BIT(1) /* Or bad things happen */
|
||||
#define SYSCLK_FIXED_DIV BIT(2) /* Fixed divider */
|
||||
|
||||
/** davinci_pll_sysclk_info - SYSCLKn-specific info
|
||||
* @name: The name of the clock
|
||||
* @parent_name: The name of the parent clock
|
||||
* @id: "n" in "SYSCLKn"
|
||||
* @ratio_width: Width (in bits) of RATIO in PLLDIVn register
|
||||
* @flags: Bitmap of SYSCLK_* flags.
|
||||
*/
|
||||
struct davinci_pll_sysclk_info {
|
||||
const char *name;
|
||||
const char *parent_name;
|
||||
u32 id;
|
||||
u32 ratio_width;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
#define SYSCLK(i, n, p, w, f) \
|
||||
static const struct davinci_pll_sysclk_info n = { \
|
||||
.name = #n, \
|
||||
.parent_name = #p, \
|
||||
.id = (i), \
|
||||
.ratio_width = (w), \
|
||||
.flags = (f), \
|
||||
}
|
||||
|
||||
/** davinci_pll_obsclk_info - OBSCLK-specific info
|
||||
* @name: The name of the clock
|
||||
* @parent_names: Array of names of the parent clocks
|
||||
* @num_parents: Length of @parent_names
|
||||
* @table: Array of values to write to OCSEL[OCSRC] cooresponding to
|
||||
* @parent_names
|
||||
* @ocsrc_mask: Bitmask for OCSEL[OCSRC]
|
||||
*/
|
||||
struct davinci_pll_obsclk_info {
|
||||
const char *name;
|
||||
const char * const *parent_names;
|
||||
u8 num_parents;
|
||||
u32 *table;
|
||||
u32 ocsrc_mask;
|
||||
};
|
||||
|
||||
struct clk *davinci_pll_clk_register(struct device *dev,
|
||||
const struct davinci_pll_clk_info *info,
|
||||
const char *parent_name,
|
||||
void __iomem *base);
|
||||
struct clk *davinci_pll_auxclk_register(struct device *dev,
|
||||
const char *name,
|
||||
void __iomem *base);
|
||||
struct clk *davinci_pll_sysclkbp_clk_register(struct device *dev,
|
||||
const char *name,
|
||||
void __iomem *base);
|
||||
struct clk *
|
||||
davinci_pll_obsclk_register(struct device *dev,
|
||||
const struct davinci_pll_obsclk_info *info,
|
||||
void __iomem *base);
|
||||
struct clk *
|
||||
davinci_pll_sysclk_register(struct device *dev,
|
||||
const struct davinci_pll_sysclk_info *info,
|
||||
void __iomem *base);
|
||||
|
||||
int of_davinci_pll_init(struct device *dev,
|
||||
const struct davinci_pll_clk_info *info,
|
||||
const struct davinci_pll_obsclk_info *obsclk_info,
|
||||
const struct davinci_pll_sysclk_info **div_info,
|
||||
u8 max_sysclk_id,
|
||||
void __iomem *base);
|
||||
|
||||
#endif /* __CLK_DAVINCI_PLL_H___ */
|
||||
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* PLL clock driver for TI Davinci SoCs
|
||||
*
|
||||
* Copyright (C) 2018 David Lechner <david@lechnology.com>
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_PLATFORM_DATA_CLK_DAVINCI_PLL_H__
|
||||
#define __LINUX_PLATFORM_DATA_CLK_DAVINCI_PLL_H__
|
||||
|
||||
#include <linux/regmap.h>
|
||||
|
||||
/**
|
||||
* davinci_pll_platform_data
|
||||
* @cfgchip: CFGCHIP syscon regmap
|
||||
*/
|
||||
struct davinci_pll_platform_data {
|
||||
struct regmap *cfgchip;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_PLATFORM_DATA_CLK_DAVINCI_PLL_H__ */
|
||||
Reference in New Issue
Block a user