Commit b7f257ce authored by Stephen Boyd's avatar Stephen Boyd

Merge branches 'clk-fixed-rate', 'clk-spreadtrum', 'clk-pxa' and 'clk-ti' into clk-next

 - More devm helpers for fixed rate registration
 - Add Spreadtrum UMS512 SoC clk support
 - Various PXA168 clk driver fixes

* clk-fixed-rate:
  clk: fixed-rate: add devm_clk_hw_register_fixed_rate
  clk: asm9260: use parent index to link the reference clock

* clk-spreadtrum:
  clk: sprd: Add clocks support for UMS512

* clk-pxa:
  clk: pxa: add a check for the return value of kzalloc()
  clk: mmp: pxa168: control shared SDH bits with separate clock
  dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks
  clk: mmp: pxa168: add clocks for SDH2 and SDH3
  dt-bindings: marvell,pxa168: add clock id for SDH3
  clk: mmp: pxa168: fix GPIO clock enable bits
  clk: mmp: pxa168: add muxes for more peripherals
  clk: mmp: pxa168: fix incorrect parent clocks
  clk: mmp: pxa168: fix const-correctness
  clk: mmp: pxa168: add new clocks for peripherals
  dt-bindings: marvell,pxa168: add clock ids for additional dividers
  clk: mmp: pxa168: fix incorrect dividers
  clk: mmp: pxa168: add additional register defines

* clk-ti:
  clk: davinci: cfgchip: Use dev_err_probe() helper
  clk: davinci: pll: fix spelling typo in comment
  MAINTAINERS: add header file to TI DAVINCI SERIES CLOCK DRIVER
...@@ -20308,6 +20308,7 @@ R: Sekhar Nori <nsekhar@ti.com> ...@@ -20308,6 +20308,7 @@ R: Sekhar Nori <nsekhar@ti.com>
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/clock/ti/davinci/ F: Documentation/devicetree/bindings/clock/ti/davinci/
F: drivers/clk/davinci/ F: drivers/clk/davinci/
F: include/linux/clk/davinci.h
TI DAVINCI SERIES GPIO DRIVER TI DAVINCI SERIES GPIO DRIVER
M: Keerthy <j-keerthy@ti.com> M: Keerthy <j-keerthy@ti.com>
......
...@@ -80,7 +80,7 @@ struct asm9260_mux_clock { ...@@ -80,7 +80,7 @@ struct asm9260_mux_clock {
u8 mask; u8 mask;
u32 *table; u32 *table;
const char *name; const char *name;
const char **parent_names; const struct clk_parent_data *parent_data;
u8 num_parents; u8 num_parents;
unsigned long offset; unsigned long offset;
unsigned long flags; unsigned long flags;
...@@ -232,10 +232,10 @@ static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = { ...@@ -232,10 +232,10 @@ static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = {
HW_AHBCLKCTRL1, 16 }, HW_AHBCLKCTRL1, 16 },
}; };
static const char __initdata *main_mux_p[] = { NULL, NULL }; static struct clk_parent_data __initdata main_mux_p[] = { { .index = 0, }, { .name = "pll" } };
static const char __initdata *i2s0_mux_p[] = { NULL, NULL, "i2s0m_div"}; static struct clk_parent_data __initdata i2s0_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "i2s0m_div"} };
static const char __initdata *i2s1_mux_p[] = { NULL, NULL, "i2s1m_div"}; static struct clk_parent_data __initdata i2s1_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "i2s1m_div"} };
static const char __initdata *clkout_mux_p[] = { NULL, NULL, "rtc"}; static struct clk_parent_data __initdata clkout_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "rtc"} };
static u32 three_mux_table[] = {0, 1, 3}; static u32 three_mux_table[] = {0, 1, 3};
static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = {
...@@ -255,9 +255,10 @@ static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = { ...@@ -255,9 +255,10 @@ static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = {
static void __init asm9260_acc_init(struct device_node *np) static void __init asm9260_acc_init(struct device_node *np)
{ {
struct clk_hw *hw; struct clk_hw *hw, *pll_hw;
struct clk_hw **hws; struct clk_hw **hws;
const char *ref_clk, *pll_clk = "pll"; const char *pll_clk = "pll";
struct clk_parent_data pll_parent_data = { .index = 0 };
u32 rate; u32 rate;
int n; int n;
...@@ -274,21 +275,15 @@ static void __init asm9260_acc_init(struct device_node *np) ...@@ -274,21 +275,15 @@ static void __init asm9260_acc_init(struct device_node *np)
/* register pll */ /* register pll */
rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000; rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000;
/* TODO: Convert to DT parent scheme */ pll_hw = clk_hw_register_fixed_rate_parent_accuracy(NULL, pll_clk, &pll_parent_data,
ref_clk = of_clk_get_parent_name(np, 0); 0, rate);
hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk, if (IS_ERR(pll_hw))
ref_clk, NULL, NULL, 0, rate, 0,
CLK_FIXED_RATE_PARENT_ACCURACY);
if (IS_ERR(hw))
panic("%pOFn: can't register REFCLK. Check DT!", np); panic("%pOFn: can't register REFCLK. Check DT!", np);
for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) { for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) {
const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n]; const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n];
mc->parent_names[0] = ref_clk; hw = clk_hw_register_mux_table_parent_data(NULL, mc->name, mc->parent_data,
mc->parent_names[1] = pll_clk;
hw = clk_hw_register_mux_table(NULL, mc->name, mc->parent_names,
mc->num_parents, mc->flags, base + mc->offset, mc->num_parents, mc->flags, base + mc->offset,
0, mc->mask, 0, mc->table, &asm9260_clk_lock); 0, mc->mask, 0, mc->table, &asm9260_clk_lock);
} }
......
...@@ -49,12 +49,24 @@ const struct clk_ops clk_fixed_rate_ops = { ...@@ -49,12 +49,24 @@ const struct clk_ops clk_fixed_rate_ops = {
}; };
EXPORT_SYMBOL_GPL(clk_fixed_rate_ops); EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
static void devm_clk_hw_register_fixed_rate_release(struct device *dev, void *res)
{
struct clk_fixed_rate *fix = res;
/*
* We can not use clk_hw_unregister_fixed_rate, since it will kfree()
* the hw, resulting in double free. Just unregister the hw and let
* devres code kfree() it.
*/
clk_hw_unregister(&fix->hw);
}
struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
struct device_node *np, const char *name, struct device_node *np, const char *name,
const char *parent_name, const struct clk_hw *parent_hw, const char *parent_name, const struct clk_hw *parent_hw,
const struct clk_parent_data *parent_data, unsigned long flags, const struct clk_parent_data *parent_data, unsigned long flags,
unsigned long fixed_rate, unsigned long fixed_accuracy, unsigned long fixed_rate, unsigned long fixed_accuracy,
unsigned long clk_fixed_flags) unsigned long clk_fixed_flags, bool devm)
{ {
struct clk_fixed_rate *fixed; struct clk_fixed_rate *fixed;
struct clk_hw *hw; struct clk_hw *hw;
...@@ -62,7 +74,11 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, ...@@ -62,7 +74,11 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
int ret = -EINVAL; int ret = -EINVAL;
/* allocate fixed-rate clock */ /* allocate fixed-rate clock */
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL); if (devm)
fixed = devres_alloc(devm_clk_hw_register_fixed_rate_release,
sizeof(*fixed), GFP_KERNEL);
else
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
if (!fixed) if (!fixed)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -90,9 +106,13 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, ...@@ -90,9 +106,13 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
else else
ret = of_clk_hw_register(np, hw); ret = of_clk_hw_register(np, hw);
if (ret) { if (ret) {
kfree(fixed); if (devm)
devres_free(fixed);
else
kfree(fixed);
hw = ERR_PTR(ret); hw = ERR_PTR(ret);
} } else if (devm)
devres_add(dev, fixed);
return hw; return hw;
} }
......
...@@ -510,8 +510,7 @@ da8xx_cfgchip_register_usb0_clk48(struct device *dev, ...@@ -510,8 +510,7 @@ da8xx_cfgchip_register_usb0_clk48(struct device *dev,
fck_clk = devm_clk_get(dev, "fck"); fck_clk = devm_clk_get(dev, "fck");
if (IS_ERR(fck_clk)) { if (IS_ERR(fck_clk)) {
if (PTR_ERR(fck_clk) != -EPROBE_DEFER) dev_err_probe(dev, PTR_ERR(fck_clk), "Missing fck clock\n");
dev_err(dev, "Missing fck clock\n");
return ERR_CAST(fck_clk); return ERR_CAST(fck_clk);
} }
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
* @hw: clk_hw for the pll * @hw: clk_hw for the pll
* @base: Base memory address * @base: Base memory address
* @pllm_min: The minimum allowable PLLM[PLLM] value * @pllm_min: The minimum allowable PLLM[PLLM] value
* @pllm_max: The maxiumum allowable PLLM[PLLM] value * @pllm_max: The maximum allowable PLLM[PLLM] value
* @pllm_mask: Bitmask for PLLM[PLLM] value * @pllm_mask: Bitmask for PLLM[PLLM] value
*/ */
struct davinci_pll_clk { struct davinci_pll_clk {
......
This diff is collapsed.
...@@ -104,6 +104,8 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks, ...@@ -104,6 +104,8 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
for (i = 0; i < nb_clks; i++) { for (i = 0; i < nb_clks; i++) {
pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL); pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL);
if (!pxa_clk)
return -ENOMEM;
pxa_clk->is_in_low_power = clks[i].is_in_low_power; pxa_clk->is_in_low_power = clks[i].is_in_low_power;
pxa_clk->lp = clks[i].lp; pxa_clk->lp = clks[i].lp;
pxa_clk->hp = clks[i].hp; pxa_clk->hp = clks[i].hp;
......
...@@ -21,4 +21,10 @@ config SPRD_SC9863A_CLK ...@@ -21,4 +21,10 @@ config SPRD_SC9863A_CLK
help help
Support for the global clock controller on sc9863a devices. Support for the global clock controller on sc9863a devices.
Say Y if you want to use peripheral devices on sc9863a SoC. Say Y if you want to use peripheral devices on sc9863a SoC.
config SPRD_UMS512_CLK
tristate "Support for the Spreadtrum UMS512 clocks"
help
Support for the global clock controller on ums512 devices.
Say Y if you want to use peripheral devices on ums512 SoC.
endif endif
...@@ -11,3 +11,4 @@ clk-sprd-y += pll.o ...@@ -11,3 +11,4 @@ clk-sprd-y += pll.o
## SoC support ## SoC support
obj-$(CONFIG_SPRD_SC9860_CLK) += sc9860-clk.o obj-$(CONFIG_SPRD_SC9860_CLK) += sc9860-clk.o
obj-$(CONFIG_SPRD_SC9863A_CLK) += sc9863a-clk.o obj-$(CONFIG_SPRD_SC9863A_CLK) += sc9863a-clk.o
obj-$(CONFIG_SPRD_UMS512_CLK) += ums512-clk.o
This diff is collapsed.
...@@ -20,8 +20,11 @@ ...@@ -20,8 +20,11 @@
#define PXA168_CLK_PLL1_2_1_5 19 #define PXA168_CLK_PLL1_2_1_5 19
#define PXA168_CLK_PLL1_3_16 20 #define PXA168_CLK_PLL1_3_16 20
#define PXA168_CLK_PLL1_192 21 #define PXA168_CLK_PLL1_192 21
#define PXA168_CLK_PLL1_2_1_10 22
#define PXA168_CLK_PLL1_2_3_16 23
#define PXA168_CLK_UART_PLL 27 #define PXA168_CLK_UART_PLL 27
#define PXA168_CLK_USB_PLL 28 #define PXA168_CLK_USB_PLL 28
#define PXA168_CLK_CLK32_2 50
/* apb peripherals */ /* apb peripherals */
#define PXA168_CLK_TWSI0 60 #define PXA168_CLK_TWSI0 60
...@@ -56,6 +59,9 @@ ...@@ -56,6 +59,9 @@
#define PXA168_CLK_CCIC0 107 #define PXA168_CLK_CCIC0 107
#define PXA168_CLK_CCIC0_PHY 108 #define PXA168_CLK_CCIC0_PHY 108
#define PXA168_CLK_CCIC0_SPHY 109 #define PXA168_CLK_CCIC0_SPHY 109
#define PXA168_CLK_SDH3 110
#define PXA168_CLK_SDH01_AXI 111
#define PXA168_CLK_SDH23_AXI 112
#define PXA168_NR_CLKS 200 #define PXA168_NR_CLKS 200
#endif #endif
...@@ -350,7 +350,7 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, ...@@ -350,7 +350,7 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
const char *parent_name, const struct clk_hw *parent_hw, const char *parent_name, const struct clk_hw *parent_hw,
const struct clk_parent_data *parent_data, unsigned long flags, const struct clk_parent_data *parent_data, unsigned long flags,
unsigned long fixed_rate, unsigned long fixed_accuracy, unsigned long fixed_rate, unsigned long fixed_accuracy,
unsigned long clk_fixed_flags); unsigned long clk_fixed_flags, bool devm);
struct clk *clk_register_fixed_rate(struct device *dev, const char *name, struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
const char *parent_name, unsigned long flags, const char *parent_name, unsigned long flags,
unsigned long fixed_rate); unsigned long fixed_rate);
...@@ -365,7 +365,20 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -365,7 +365,20 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
*/ */
#define clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \ #define clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \ __clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \
NULL, (flags), (fixed_rate), 0, 0) NULL, (flags), (fixed_rate), 0, 0, false)
/**
* devm_clk_hw_register_fixed_rate - register fixed-rate clock with the clock
* framework
* @dev: device that is registering this clock
* @name: name of this clock
* @parent_name: name of clock's parent
* @flags: framework-specific flags
* @fixed_rate: non-adjustable clock rate
*/
#define devm_clk_hw_register_fixed_rate(dev, name, parent_name, flags, fixed_rate) \
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), NULL, \
NULL, (flags), (fixed_rate), 0, 0, true)
/** /**
* clk_hw_register_fixed_rate_parent_hw - register fixed-rate clock with * clk_hw_register_fixed_rate_parent_hw - register fixed-rate clock with
* the clock framework * the clock framework
...@@ -378,7 +391,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -378,7 +391,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
#define clk_hw_register_fixed_rate_parent_hw(dev, name, parent_hw, flags, \ #define clk_hw_register_fixed_rate_parent_hw(dev, name, parent_hw, flags, \
fixed_rate) \ fixed_rate) \
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw), \ __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw), \
NULL, (flags), (fixed_rate), 0, 0) NULL, (flags), (fixed_rate), 0, 0, false)
/** /**
* clk_hw_register_fixed_rate_parent_data - register fixed-rate clock with * clk_hw_register_fixed_rate_parent_data - register fixed-rate clock with
* the clock framework * the clock framework
...@@ -392,7 +405,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -392,7 +405,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
fixed_rate) \ fixed_rate) \
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
(parent_data), (flags), (fixed_rate), 0, \ (parent_data), (flags), (fixed_rate), 0, \
0) 0, false)
/** /**
* clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with * clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with
* the clock framework * the clock framework
...@@ -408,7 +421,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -408,7 +421,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
fixed_accuracy) \ fixed_accuracy) \
__clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \ __clk_hw_register_fixed_rate((dev), NULL, (name), (parent_name), \
NULL, NULL, (flags), (fixed_rate), \ NULL, NULL, (flags), (fixed_rate), \
(fixed_accuracy), 0) (fixed_accuracy), 0, false)
/** /**
* clk_hw_register_fixed_rate_with_accuracy_parent_hw - register fixed-rate * clk_hw_register_fixed_rate_with_accuracy_parent_hw - register fixed-rate
* clock with the clock framework * clock with the clock framework
...@@ -423,7 +436,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -423,7 +436,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
parent_hw, flags, fixed_rate, fixed_accuracy) \ parent_hw, flags, fixed_rate, fixed_accuracy) \
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw) \ __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, (parent_hw) \
NULL, NULL, (flags), (fixed_rate), \ NULL, NULL, (flags), (fixed_rate), \
(fixed_accuracy), 0) (fixed_accuracy), 0, false)
/** /**
* clk_hw_register_fixed_rate_with_accuracy_parent_data - register fixed-rate * clk_hw_register_fixed_rate_with_accuracy_parent_data - register fixed-rate
* clock with the clock framework * clock with the clock framework
...@@ -438,7 +451,21 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, ...@@ -438,7 +451,21 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
parent_data, flags, fixed_rate, fixed_accuracy) \ parent_data, flags, fixed_rate, fixed_accuracy) \
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \ __clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
(parent_data), NULL, (flags), \ (parent_data), NULL, (flags), \
(fixed_rate), (fixed_accuracy), 0) (fixed_rate), (fixed_accuracy), 0, false)
/**
* clk_hw_register_fixed_rate_parent_accuracy - register fixed-rate clock with
* the clock framework
* @dev: device that is registering this clock
* @name: name of this clock
* @parent_name: name of clock's parent
* @flags: framework-specific flags
* @fixed_rate: non-adjustable clock rate
*/
#define clk_hw_register_fixed_rate_parent_accuracy(dev, name, parent_data, \
flags, fixed_rate) \
__clk_hw_register_fixed_rate((dev), NULL, (name), NULL, NULL, \
(parent_data), (flags), (fixed_rate), 0, \
CLK_FIXED_RATE_PARENT_ACCURACY, false)
void clk_unregister_fixed_rate(struct clk *clk); void clk_unregister_fixed_rate(struct clk *clk);
void clk_hw_unregister_fixed_rate(struct clk_hw *hw); void clk_hw_unregister_fixed_rate(struct clk_hw *hw);
...@@ -957,6 +984,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, ...@@ -957,6 +984,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name,
(parent_names), NULL, NULL, (flags), (reg), \ (parent_names), NULL, NULL, (flags), (reg), \
(shift), (mask), (clk_mux_flags), (table), \ (shift), (mask), (clk_mux_flags), (table), \
(lock)) (lock))
#define clk_hw_register_mux_table_parent_data(dev, name, parent_data, \
num_parents, flags, reg, shift, mask, \
clk_mux_flags, table, lock) \
__clk_hw_register_mux((dev), NULL, (name), (num_parents), \
NULL, NULL, (parent_data), (flags), (reg), \
(shift), (mask), (clk_mux_flags), (table), \
(lock))
#define clk_hw_register_mux(dev, name, parent_names, num_parents, flags, reg, \ #define clk_hw_register_mux(dev, name, parent_names, num_parents, flags, reg, \
shift, width, clk_mux_flags, lock) \ shift, width, clk_mux_flags, lock) \
__clk_hw_register_mux((dev), NULL, (name), (num_parents), \ __clk_hw_register_mux((dev), NULL, (name), (num_parents), \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment