Skip to content

Commit

Permalink
Merge tag 'samsung-soc64-4.6-2' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/krzk/linux into next/arm64

Samsung Exynos ARM64 improvements for v4.6:
1. Remove separate ARCH_EXYNOS7 symbol and consolidate it into
   one ARCH_EXYNOS.

This depends on clk tree: removal of last presence of ARCH_EXYNOS7.

* tag 'samsung-soc64-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  arm64: EXYNOS: Consolidate ARCH_EXYNOS7 symbol into ARCH_EXYNOS
  clk: samsung: Don't build ARMv8 clock drivers on ARMv7
  clk: samsung: Enable COMPILE_TEST for Samsung clocks
  clk: Move vendor's Kconfig into CCF menu section
  clk: mediatek: Fix memory leak on clock init fail
  clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h
  clk: xgene: Remove return from void function
  clk: xgene: Add SoC and PMD PLL clocks with v2 hardware
  Documentation: Update APM X-Gene clock binding for v2 hardware
  clk: s2mps11: remove redundant code
  clk: s2mps11: remove redundant static variables declaration
  clk: s2mps11: allocate only one structure for clock init
  clk: s2mps11: merge two for loops in one
  clk-divider: make sure read-only dividers do not write to their register
  clk: tango4: rename ARCH_TANGOX to ARCH_TANGO
  clk: scpi: Fix checking return value of platform_device_register_simple()
  clk: mvebu: Mark ioremapped memory as __iomem

Signed-off-by: Olof Johansson <olof@lixom.net>
  • Loading branch information
Olof Johansson committed Mar 13, 2016
2 parents 2f85bb0 + c87b3e9 commit c7e1d89
Show file tree
Hide file tree
Showing 40 changed files with 178 additions and 198 deletions.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/clock/xgene.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Required properties:
"apm,xgene-socpll-clock" - for a X-Gene SoC PLL clock
"apm,xgene-pcppll-clock" - for a X-Gene PCP PLL clock
"apm,xgene-device-clock" - for a X-Gene device clock
"apm,xgene-socpll-v2-clock" - for a X-Gene SoC PLL v2 clock
"apm,xgene-pcppll-v2-clock" - for a X-Gene PCP PLL v2 clock

Required properties for SoC or PCP PLL clocks:
- reg : shall be the physical PLL register address for the pll clock.
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-s3c24xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ config PLAT_S3C24XX
select NO_IOPORT_MAP
select S3C_DEV_NAND
select IRQ_DOMAIN
select COMMON_CLK
help
Base platform code for any Samsung S3C24XX device

Expand Down
11 changes: 2 additions & 9 deletions arch/arm64/Kconfig.platforms
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,14 @@ config ARCH_BERLIN
This enables support for Marvell Berlin SoC Family

config ARCH_EXYNOS
bool
help
This enables support for Samsung Exynos SoC family

config ARCH_EXYNOS7
bool "ARMv8 based Samsung Exynos7"
select ARCH_EXYNOS
bool "ARMv8 based Samsung Exynos SoC family"
select COMMON_CLK_SAMSUNG
select HAVE_S3C2410_WATCHDOG if WATCHDOG
select HAVE_S3C_RTC if RTC_CLASS
select PINCTRL
select PINCTRL_EXYNOS

help
This enables support for Samsung Exynos7 SoC family
This enables support for ARMv8 based Samsung Exynos SoC family.

config ARCH_LAYERSCAPE
bool "ARMv8 based Freescale Layerscape SoC family"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/boot/dts/exynos/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dtb-$(CONFIG_ARCH_EXYNOS7) += exynos7-espresso.dtb
dtb-$(CONFIG_ARCH_EXYNOS) += exynos7-espresso.dtb

always := $(dtb-y)
subdir-y := $(dts-dirs)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CONFIG_ARCH_SUNXI=y
CONFIG_ARCH_ALPINE=y
CONFIG_ARCH_BCM_IPROC=y
CONFIG_ARCH_BERLIN=y
CONFIG_ARCH_EXYNOS7=y
CONFIG_ARCH_EXYNOS=y
CONFIG_ARCH_LAYERSCAPE=y
CONFIG_ARCH_HISI=y
CONFIG_ARCH_MEDIATEK=y
Expand Down
8 changes: 3 additions & 5 deletions drivers/clk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,9 @@ config COMMON_CLK_CDCE706

source "drivers/clk/bcm/Kconfig"
source "drivers/clk/hisilicon/Kconfig"
source "drivers/clk/qcom/Kconfig"

endmenu

source "drivers/clk/mvebu/Kconfig"

source "drivers/clk/qcom/Kconfig"
source "drivers/clk/samsung/Kconfig"
source "drivers/clk/tegra/Kconfig"

endmenu
2 changes: 1 addition & 1 deletion drivers/clk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o
obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
obj-$(CONFIG_COMMON_CLK_CDCE925) += clk-cdce925.o
obj-$(CONFIG_ARCH_STM32) += clk-stm32f4.o
obj-$(CONFIG_ARCH_TANGOX) += clk-tango4.o
obj-$(CONFIG_ARCH_TANGO) += clk-tango4.o
obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
obj-$(CONFIG_ARCH_U300) += clk-u300.o
obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <linux/err.h>
#include <linux/slab.h>

#define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw)

static u8 clk_composite_get_parent(struct clk_hw *hw)
{
struct clk_composite *composite = to_clk_composite(hw);
Expand Down
13 changes: 10 additions & 3 deletions drivers/clk/clk-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* parent - fixed parent. No clk_set_parent support
*/

#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)

#define div_mask(width) ((1 << (width)) - 1)

static unsigned int _get_table_maxdiv(const struct clk_div_table *table,
Expand Down Expand Up @@ -423,6 +421,12 @@ const struct clk_ops clk_divider_ops = {
};
EXPORT_SYMBOL_GPL(clk_divider_ops);

const struct clk_ops clk_divider_ro_ops = {
.recalc_rate = clk_divider_recalc_rate,
.round_rate = clk_divider_round_rate,
};
EXPORT_SYMBOL_GPL(clk_divider_ro_ops);

static struct clk *_register_divider(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
void __iomem *reg, u8 shift, u8 width,
Expand All @@ -446,7 +450,10 @@ static struct clk *_register_divider(struct device *dev, const char *name,
return ERR_PTR(-ENOMEM);

init.name = name;
init.ops = &clk_divider_ops;
if (clk_divider_flags & CLK_DIVIDER_READ_ONLY)
init.ops = &clk_divider_ro_ops;
else
init.ops = &clk_divider_ops;
init.flags = flags | CLK_IS_BASIC;
init.parent_names = (parent_name ? &parent_name: NULL);
init.num_parents = (parent_name ? 1 : 0);
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-fixed-factor.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
* parent - fixed parent. No clk_set_parent support
*/

#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)

static unsigned long clk_factor_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-fixed-rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* parent - fixed parent. No clk_set_parent support
*/

#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw)

static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-fractional-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include <linux/slab.h>
#include <linux/rational.h>

#define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw)

static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* parent - fixed parent. No clk_set_parent support
*/

#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)

/*
* It works on following logic:
*
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
* parent - fixed parent. No clk_set_parent support
*/

#define to_clk_gpio(_hw) container_of(_hw, struct clk_gpio, hw)

static int clk_gpio_gate_enable(struct clk_hw *hw)
{
struct clk_gpio *clk = to_clk_gpio(hw);
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-multiplier.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <linux/of.h>
#include <linux/slab.h>

#define to_clk_multiplier(_hw) container_of(_hw, struct clk_multiplier, hw)

static unsigned long __get_mult(struct clk_multiplier *mult,
unsigned long rate,
unsigned long parent_rate)
Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/clk-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
* parent - parent is adjustable through clk_set_parent
*/

#define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)

static u8 clk_mux_get_parent(struct clk_hw *hw)
{
struct clk_mux *mux = to_clk_mux(hw);
Expand Down
108 changes: 31 additions & 77 deletions drivers/clk/clk-s2mps11.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
#include <linux/mfd/samsung/s5m8767.h>
#include <linux/mfd/samsung/core.h>

#define s2mps11_name(a) (a->hw.init->name)

static struct clk **clk_table;
static struct clk_onecell_data clk_data;

enum {
S2MPS11_CLK_AP = 0,
S2MPS11_CLK_CP,
Expand Down Expand Up @@ -99,6 +94,7 @@ static struct clk_ops s2mps11_clk_ops = {
.recalc_rate = s2mps11_clk_recalc_rate,
};

/* This s2mps11_clks_init tructure is common to s2mps11, s2mps13 and s2mps14 */
static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps11_ap",
Expand All @@ -117,37 +113,6 @@ static struct clk_init_data s2mps11_clks_init[S2MPS11_CLKS_NUM] = {
},
};

static struct clk_init_data s2mps13_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps13_ap",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_CP] = {
.name = "s2mps13_cp",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_BT] = {
.name = "s2mps13_bt",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
};

static struct clk_init_data s2mps14_clks_init[S2MPS11_CLKS_NUM] = {
[S2MPS11_CLK_AP] = {
.name = "s2mps14_ap",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
[S2MPS11_CLK_BT] = {
.name = "s2mps14_bt",
.ops = &s2mps11_clk_ops,
.flags = CLK_IS_ROOT,
},
};

static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
struct clk_init_data *clks_init)
{
Expand All @@ -164,99 +129,88 @@ static struct device_node *s2mps11_clk_parse_dt(struct platform_device *pdev,
return ERR_PTR(-EINVAL);
}

for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
if (!clks_init[i].name)
continue; /* Skip clocks not present in some devices */
for (i = 0; i < S2MPS11_CLKS_NUM; i++)
of_property_read_string_index(clk_np, "clock-output-names", i,
&clks_init[i].name);
}

return clk_np;
}

static int s2mps11_clk_probe(struct platform_device *pdev)
{
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct s2mps11_clk *s2mps11_clks, *s2mps11_clk;
struct s2mps11_clk *s2mps11_clks;
struct clk_onecell_data *clk_data;
unsigned int s2mps11_reg;
struct clk_init_data *clks_init;
int i, ret = 0;
enum sec_device_type hwid = platform_get_device_id(pdev)->driver_data;

s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
sizeof(*s2mps11_clk), GFP_KERNEL);
sizeof(*s2mps11_clks), GFP_KERNEL);
if (!s2mps11_clks)
return -ENOMEM;

s2mps11_clk = s2mps11_clks;
clk_data = devm_kzalloc(&pdev->dev, sizeof(*clk_data), GFP_KERNEL);
if (!clk_data)
return -ENOMEM;

clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
clk_data->clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM,
sizeof(struct clk *), GFP_KERNEL);
if (!clk_table)
if (!clk_data->clks)
return -ENOMEM;

switch(platform_get_device_id(pdev)->driver_data) {
switch (hwid) {
case S2MPS11X:
s2mps11_reg = S2MPS11_REG_RTC_CTRL;
clks_init = s2mps11_clks_init;
break;
case S2MPS13X:
s2mps11_reg = S2MPS13_REG_RTCCTRL;
clks_init = s2mps13_clks_init;
break;
case S2MPS14X:
s2mps11_reg = S2MPS14_REG_RTCCTRL;
clks_init = s2mps14_clks_init;
break;
case S5M8767X:
s2mps11_reg = S5M8767_REG_CTRL1;
clks_init = s2mps11_clks_init;
break;
default:
dev_err(&pdev->dev, "Invalid device type\n");
return -EINVAL;
}

/* Store clocks of_node in first element of s2mps11_clks array */
s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, clks_init);
s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, s2mps11_clks_init);
if (IS_ERR(s2mps11_clks->clk_np))
return PTR_ERR(s2mps11_clks->clk_np);

for (i = 0; i < S2MPS11_CLKS_NUM; i++, s2mps11_clk++) {
if (!clks_init[i].name)
for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
if (i == S2MPS11_CLK_CP && hwid == S2MPS14X)
continue; /* Skip clocks not present in some devices */
s2mps11_clk->iodev = iodev;
s2mps11_clk->hw.init = &clks_init[i];
s2mps11_clk->mask = 1 << i;
s2mps11_clk->reg = s2mps11_reg;

s2mps11_clk->clk = devm_clk_register(&pdev->dev,
&s2mps11_clk->hw);
if (IS_ERR(s2mps11_clk->clk)) {
s2mps11_clks[i].iodev = iodev;
s2mps11_clks[i].hw.init = &s2mps11_clks_init[i];
s2mps11_clks[i].mask = 1 << i;
s2mps11_clks[i].reg = s2mps11_reg;

s2mps11_clks[i].clk = devm_clk_register(&pdev->dev,
&s2mps11_clks[i].hw);
if (IS_ERR(s2mps11_clks[i].clk)) {
dev_err(&pdev->dev, "Fail to register : %s\n",
s2mps11_name(s2mps11_clk));
ret = PTR_ERR(s2mps11_clk->clk);
s2mps11_clks_init[i].name);
ret = PTR_ERR(s2mps11_clks[i].clk);
goto err_reg;
}

s2mps11_clk->lookup = clkdev_create(s2mps11_clk->clk,
s2mps11_name(s2mps11_clk), NULL);
if (!s2mps11_clk->lookup) {
s2mps11_clks[i].lookup = clkdev_create(s2mps11_clks[i].clk,
s2mps11_clks_init[i].name, NULL);
if (!s2mps11_clks[i].lookup) {
ret = -ENOMEM;
goto err_reg;
}
clk_data->clks[i] = s2mps11_clks[i].clk;
}

for (i = 0; i < S2MPS11_CLKS_NUM; i++) {
/* Skip clocks not present on S2MPS14 */
if (!clks_init[i].name)
continue;
clk_table[i] = s2mps11_clks[i].clk;
}

clk_data.clks = clk_table;
clk_data.clk_num = S2MPS11_CLKS_NUM;
clk_data->clk_num = S2MPS11_CLKS_NUM;
of_clk_add_provider(s2mps11_clks->clk_np, of_clk_src_onecell_get,
&clk_data);
clk_data);

platform_set_drvdata(pdev, s2mps11_clks);

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/clk-scpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static int scpi_clocks_probe(struct platform_device *pdev)
/* Add the virtual cpufreq device */
cpufreq_dev = platform_device_register_simple("scpi-cpufreq",
-1, NULL, 0);
if (!cpufreq_dev)
if (IS_ERR(cpufreq_dev))
pr_warn("unable to register cpufreq device");

return 0;
Expand Down
Loading

0 comments on commit c7e1d89

Please sign in to comment.