Re: [RESEND PATCH V6 1/4] cpufreq: exynos: Add cpufreq driver for exynos5440
On Thursday, April 11, 2013 06:23:52 PM Nishanth Menon wrote: Hi, On Mon, Apr 8, 2013 at 4:57 AM, Amit Daniel Kachhap amit.dan...@samsung.com wrote: + +static int init_div_table(void) +{ + struct cpufreq_frequency_table *freq_tbl = dvfs_info-freq_table; + unsigned int tmp, clk_div, ema_div, freq, volt_id; + int i = 0; + struct opp *opp; + + for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { + + opp = opp_find_freq_exact(dvfs_info-dev, + freq_tbl[i].frequency * 1000, true); + if (IS_ERR(opp)) { + dev_err(dvfs_info-dev, + failed to find valid OPP for %u KHZ\n, + freq_tbl[i].frequency); + return PTR_ERR(opp); + } please use RCU read locks. + + freq = freq_tbl[i].frequency / 1000; /* In MHZ */ + clk_div = ((freq / CPU_DIV_FREQ_MAX) P0_7_CPUCLKDEV_MASK) +P0_7_CPUCLKDEV_SHIFT; + clk_div |= ((freq / CPU_ATB_FREQ_MAX) P0_7_ATBCLKDEV_MASK) +P0_7_ATBCLKDEV_SHIFT; + clk_div |= ((freq / CPU_DBG_FREQ_MAX) P0_7_CSCLKDEV_MASK) +P0_7_CSCLKDEV_SHIFT; + + /* Calculate EMA */ + volt_id = opp_get_voltage(opp); Please use RCU read locks as documented for OPP library. Argh. I overlooked that and the series has been applied already. Care to send a fix against linux-pm.git/linux-next? Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RESEND PATCH V6 1/4] cpufreq: exynos: Add cpufreq driver for exynos5440
Hi Rafael, On Fri, Apr 12, 2013 at 4:49 PM, Rafael J. Wysocki r...@sisk.pl wrote: On Thursday, April 11, 2013 06:23:52 PM Nishanth Menon wrote: Hi, On Mon, Apr 8, 2013 at 4:57 AM, Amit Daniel Kachhap amit.dan...@samsung.com wrote: + +static int init_div_table(void) +{ + struct cpufreq_frequency_table *freq_tbl = dvfs_info-freq_table; + unsigned int tmp, clk_div, ema_div, freq, volt_id; + int i = 0; + struct opp *opp; + + for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { + + opp = opp_find_freq_exact(dvfs_info-dev, + freq_tbl[i].frequency * 1000, true); + if (IS_ERR(opp)) { + dev_err(dvfs_info-dev, + failed to find valid OPP for %u KHZ\n, + freq_tbl[i].frequency); + return PTR_ERR(opp); + } please use RCU read locks. + + freq = freq_tbl[i].frequency / 1000; /* In MHZ */ + clk_div = ((freq / CPU_DIV_FREQ_MAX) P0_7_CPUCLKDEV_MASK) +P0_7_CPUCLKDEV_SHIFT; + clk_div |= ((freq / CPU_ATB_FREQ_MAX) P0_7_ATBCLKDEV_MASK) +P0_7_ATBCLKDEV_SHIFT; + clk_div |= ((freq / CPU_DBG_FREQ_MAX) P0_7_CSCLKDEV_MASK) +P0_7_CSCLKDEV_SHIFT; + + /* Calculate EMA */ + volt_id = opp_get_voltage(opp); Please use RCU read locks as documented for OPP library. Argh. I overlooked that and the series has been applied already. Care to send a fix against linux-pm.git/linux-next? Will submit a patch with RCU lock changes. Thanks, Amit Daniel Rafael -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RESEND PATCH V6 1/4] cpufreq: exynos: Add cpufreq driver for exynos5440
Hi, On Mon, Apr 8, 2013 at 4:57 AM, Amit Daniel Kachhap amit.dan...@samsung.com wrote: + +static int init_div_table(void) +{ + struct cpufreq_frequency_table *freq_tbl = dvfs_info-freq_table; + unsigned int tmp, clk_div, ema_div, freq, volt_id; + int i = 0; + struct opp *opp; + + for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) { + + opp = opp_find_freq_exact(dvfs_info-dev, + freq_tbl[i].frequency * 1000, true); + if (IS_ERR(opp)) { + dev_err(dvfs_info-dev, + failed to find valid OPP for %u KHZ\n, + freq_tbl[i].frequency); + return PTR_ERR(opp); + } please use RCU read locks. + + freq = freq_tbl[i].frequency / 1000; /* In MHZ */ + clk_div = ((freq / CPU_DIV_FREQ_MAX) P0_7_CPUCLKDEV_MASK) +P0_7_CPUCLKDEV_SHIFT; + clk_div |= ((freq / CPU_ATB_FREQ_MAX) P0_7_ATBCLKDEV_MASK) +P0_7_ATBCLKDEV_SHIFT; + clk_div |= ((freq / CPU_DBG_FREQ_MAX) P0_7_CSCLKDEV_MASK) +P0_7_CSCLKDEV_SHIFT; + + /* Calculate EMA */ + volt_id = opp_get_voltage(opp); Please use RCU read locks as documented for OPP library. Regards, Nishanth Menon -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND PATCH V6 1/4] cpufreq: exynos: Add cpufreq driver for exynos5440
This patch adds dvfs support for exynos5440 SOC. This soc has 4 cores and they scale at same frequency. The nature of exynos5440 clock controller is different from previous exynos controllers so not using the common exynos cpufreq framework. The major difference being interrupt notification for frequency change. Also, OPP library is used for device tree parsing to get different parameters like frequency, voltage etc. Since the opp library sorts the frequency table in ascending order so they are again re-arranged in descending order. This will have one-to-one mapping with the clock controller state management logic. Cc: Viresh Kumar viresh.ku...@linaro.org Cc: Rafael J. Wysocki r...@sisk.pl Cc: Kukjin Kim kgene@samsung.com Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- Re-sending this patch with a minor comment from Viresh about the correct usage of cpufreq_notify_transition API. .../bindings/cpufreq/cpufreq-exynos5440.txt| 28 ++ drivers/cpufreq/Kconfig.arm|9 + drivers/cpufreq/Makefile |1 + drivers/cpufreq/exynos5440-cpufreq.c | 478 4 files changed, 516 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-exynos5440.txt create mode 100644 drivers/cpufreq/exynos5440-cpufreq.c diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos5440.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos5440.txt new file mode 100644 index 000..caff1a5 --- /dev/null +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-exynos5440.txt @@ -0,0 +1,28 @@ + +Exynos5440 cpufreq driver +--- + +Exynos5440 SoC cpufreq driver for CPU frequency scaling. + +Required properties: +- interrupts: Interrupt to know the completion of cpu frequency change. +- operating-points: Table of frequencies and voltage CPU could be transitioned into, + in the decreasing order. Frequency should be in KHz units and voltage + should be in microvolts. + +Optional properties: +- clock-latency: Clock monitor latency in microsecond. + +All the required listed above must be defined under node cpufreq. + +Example: + + cpufreq@16 { + compatible = samsung,exynos5440-cpufreq; + reg = 0x16 0x1000; + interrupts = 0 57 0; + operating-points = + 100 975000 + 80 925000; + clock-latency = 10; + }; diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index f3f3b14..bce2195 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -42,6 +42,15 @@ config ARM_EXYNOS5250_CPUFREQ This adds the CPUFreq driver for Samsung EXYNOS5250 SoC. +config ARM_EXYNOS5440_CPUFREQ + def_bool SOC_EXYNOS5440 + depends on HAVE_CLK PM_OPP OF + help + This adds the CPUFreq driver for Samsung EXYNOS5440 + SoC. The nature of exynos5440 clock controller is + different than previous exynos controllers so not using + the common exynos framework. + config ARM_HIGHBANK_CPUFREQ tristate Calxeda Highbank-based depends on ARCH_HIGHBANK diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 5db1f1f..6ad0b91 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o obj-$(CONFIG_ARM_EXYNOS4X12_CPUFREQ) += exynos4x12-cpufreq.o obj-$(CONFIG_ARM_EXYNOS5250_CPUFREQ) += exynos5250-cpufreq.o +obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ) += exynos5440-cpufreq.o obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ) += highbank-cpufreq.o obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)+= imx6q-cpufreq.o obj-$(CONFIG_ARM_INTEGRATOR) += integrator-cpufreq.o diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c new file mode 100644 index 000..ead7ed4 --- /dev/null +++ b/drivers/cpufreq/exynos5440-cpufreq.c @@ -0,0 +1,478 @@ +/* + * Copyright (c) 2013 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Amit Daniel Kachhap amit.dan...@samsung.com + * + * EXYNOS5440 - CPU frequency scaling support + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include linux/clk.h +#include linux/cpu.h +#include linux/cpufreq.h +#include linux/err.h +#include linux/interrupt.h +#include linux/io.h +#include linux/module.h +#include linux/of_address.h +#include linux/of_irq.h +#include linux/opp.h +#include linux/platform_device.h +#include linux/slab.h + +/* Register definitions */ +#define XMU_DVFS_CTRL 0x0060 +#define