diff for duplicates of <54CA6327.5070707@free.fr> diff --git a/a/1.txt b/N1/1.txt index fa7c197..b814965 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -16,3 +16,11 @@ source files? I can't just duplicate them... (I've tentatively called it temp.h for the time being.) Regards. + +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: cpufreq.c +Type: text/x-csrc +Size: 2567 bytes +Desc: not available +URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150129/ee612bdc/attachment.bin> diff --git a/a/2.hdr b/a/2.hdr deleted file mode 100644 index 277eaf1..0000000 --- a/a/2.hdr +++ /dev/null @@ -1,5 +0,0 @@ -Content-Type: text/x-csrc; - name="cpufreq.c" -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; - filename="cpufreq.c" diff --git a/a/2.txt b/a/2.txt deleted file mode 100644 index 07f0eb3..0000000 --- a/a/2.txt +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2015 Sigma Designs - * - * 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/module.h> -#include <linux/cpufreq.h> -#include <linux/io.h> -#include "temp.h" - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Sigma Designs"); -MODULE_DESCRIPTION("cpufreq driver for Tangox 87xx"); - -#define TANGOX_XTAL_FREQ 27000 /* in kHz */ -#define CLKGEN_BASE 0x10000 -#define SYS_clkgen0_pll (clkgen_base + 0x00) -#define SYS_cpuclk_div_ctrl (clkgen_base + 0x24) - -static void __iomem *clkgen_base; - -static struct cpufreq_frequency_table freq_table[] = { - { .driver_data = 1 }, - { .driver_data = 2 }, - { .driver_data = 3 }, - { .driver_data = 5 }, - { .driver_data = 9 }, - { .frequency = CPUFREQ_TABLE_END }, -}; - -static unsigned int tangox_get_freq(unsigned int cpu) -{ - union SYS_clkgen_pll pll; - union SYS_clk_div_ctrl div; - - pll.val = readl_relaxed(SYS_clkgen0_pll); - if (pll.f.Isel != 1 || pll.f.M != 0) return 0; - - div.val = readl_relaxed(SYS_cpuclk_div_ctrl); - if (div.f.BP != 0 || div.f.F != 0) return 0; - - return TANGOX_XTAL_FREQ * (pll.f.N + 1) / div.f.I >> pll.f.K; -} - -static int tangox_target(struct cpufreq_policy *policy, unsigned int index) -{ - while (readl_relaxed(SYS_cpuclk_div_ctrl) >> 31) cpu_relax(); - writel_relaxed(freq_table[index].driver_data, SYS_cpuclk_div_ctrl); - return 0; -} - -static int tangox_cpu_init(struct cpufreq_policy *policy) -{ - struct cpufreq_frequency_table *p; - unsigned int freq = tangox_get_freq(0); - unsigned int transition_latency_ns = freq / SYS_FAST_RAMP_SPEED; - if ((clkgen_base = ioremap(CLKGEN_BASE, 0x40)) == NULL) return -EFAULT; - - for (p = freq_table; p->frequency != CPUFREQ_TABLE_END; ++p) { - unsigned int I = p->driver_data; - union SYS_clk_div_ctrl div = SYS_CLK_DIV_CTRL(I); - p->driver_data = div.val; - p->frequency = freq / I; - } - - return cpufreq_generic_init(policy, freq_table, transition_latency_ns); -} - -static struct cpufreq_driver tangox_cpufreq_driver = { - .name = "tangox-cpufreq", - .init = tangox_cpu_init, - .verify = cpufreq_generic_frequency_table_verify, - .target_index = tangox_target, - .get = tangox_get_freq, - .exit = cpufreq_generic_exit, - .attr = cpufreq_generic_attr, -}; - -static int __init tangox_cpufreq_init(void) -{ - return cpufreq_register_driver(&tangox_cpufreq_driver); -} - -static void __exit tangox_cpufreq_exit(void) -{ - cpufreq_unregister_driver(&tangox_cpufreq_driver); -} - -module_init(tangox_cpufreq_init); -module_exit(tangox_cpufreq_exit); diff --git a/a/content_digest b/N1/content_digest index 4e5dc42..a12895e 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,13 +1,9 @@ "ref\054B7F7CD.7030903@free.fr\0" - "From\0Mason <mpeg.blue@free.fr>\0" - "Subject\0Re: RFC on cpufreq implementation\0" + "From\0mpeg.blue@free.fr (Mason)\0" + "Subject\0RFC on cpufreq implementation\0" "Date\0Thu, 29 Jan 2015 17:43:19 +0100\0" - "To\0Linux ARM <linux-arm-kernel@lists.infradead.org>" - Linux PM <linux-pm@vger.kernel.org> - " cpufreq <cpufreq@vger.kernel.org>\0" - "Cc\0Rafael J. Wysocki <rjw@rjwysocki.net>" - " Viresh Kumar <viresh.kumar@linaro.org>\0" - "\01:1\0" + "To\0linux-arm-kernel@lists.infradead.org\0" + "\00:1\0" "b\0" "On 15/01/2015 18:24, Mason wrote:\n" "\n" @@ -26,102 +22,14 @@ "source files? I can't just duplicate them... (I've tentatively\n" "called it temp.h for the time being.)\n" "\n" - Regards. - "\01:2\0" - "fn\0cpufreq.c\0" - "b\0" - "/*\n" - " * Copyright 2015 Sigma Designs\n" - " *\n" - " * This program is free software; you can redistribute it and/or modify\n" - " * it under the terms of the GNU General Public License version 2 as\n" - " * published by the Free Software Foundation.\n" - " *\n" - " */\n" - "#include <linux/module.h>\n" - "#include <linux/cpufreq.h>\n" - "#include <linux/io.h>\n" - "#include \"temp.h\"\n" - "\n" - "MODULE_LICENSE(\"GPL\");\n" - "MODULE_AUTHOR(\"Sigma Designs\");\n" - "MODULE_DESCRIPTION(\"cpufreq driver for Tangox 87xx\");\n" - "\n" - "#define TANGOX_XTAL_FREQ\t27000 /* in kHz */\n" - "#define CLKGEN_BASE\t\t0x10000\n" - "#define SYS_clkgen0_pll\t\t(clkgen_base + 0x00)\n" - "#define SYS_cpuclk_div_ctrl\t(clkgen_base + 0x24)\n" - "\n" - "static void __iomem *clkgen_base;\n" - "\n" - "static struct cpufreq_frequency_table freq_table[] = {\n" - "\t{ .driver_data = 1 },\n" - "\t{ .driver_data = 2 },\n" - "\t{ .driver_data = 3 },\n" - "\t{ .driver_data = 5 },\n" - "\t{ .driver_data = 9 },\n" - "\t{ .frequency = CPUFREQ_TABLE_END },\n" - "};\n" - "\n" - "static unsigned int tangox_get_freq(unsigned int cpu)\n" - "{\n" - "\tunion SYS_clkgen_pll pll;\n" - "\tunion SYS_clk_div_ctrl div;\n" - "\n" - "\tpll.val = readl_relaxed(SYS_clkgen0_pll);\n" - "\tif (pll.f.Isel != 1 || pll.f.M != 0) return 0;\n" - "\n" - "\tdiv.val = readl_relaxed(SYS_cpuclk_div_ctrl);\n" - "\tif (div.f.BP != 0 || div.f.F != 0) return 0;\n" - "\n" - "\treturn TANGOX_XTAL_FREQ * (pll.f.N + 1) / div.f.I >> pll.f.K;\n" - "}\n" - "\n" - "static int tangox_target(struct cpufreq_policy *policy, unsigned int index)\n" - "{\n" - "\twhile (readl_relaxed(SYS_cpuclk_div_ctrl) >> 31) cpu_relax();\n" - "\twritel_relaxed(freq_table[index].driver_data, SYS_cpuclk_div_ctrl);\n" - "\treturn 0;\n" - "}\n" - "\n" - "static int tangox_cpu_init(struct cpufreq_policy *policy)\n" - "{\n" - "\tstruct cpufreq_frequency_table *p;\n" - "\tunsigned int freq = tangox_get_freq(0);\n" - "\tunsigned int transition_latency_ns = freq / SYS_FAST_RAMP_SPEED;\n" - "\tif ((clkgen_base = ioremap(CLKGEN_BASE, 0x40)) == NULL) return -EFAULT;\n" - "\n" - "\tfor (p = freq_table; p->frequency != CPUFREQ_TABLE_END; ++p) {\n" - "\t\tunsigned int I = p->driver_data;\n" - "\t\tunion SYS_clk_div_ctrl div = SYS_CLK_DIV_CTRL(I);\n" - "\t\tp->driver_data = div.val;\n" - "\t\tp->frequency = freq / I;\n" - "\t}\n" - "\n" - "\treturn cpufreq_generic_init(policy, freq_table, transition_latency_ns);\n" - "}\n" - "\n" - "static struct cpufreq_driver tangox_cpufreq_driver = {\n" - "\t.name\t\t= \"tangox-cpufreq\",\n" - "\t.init\t\t= tangox_cpu_init,\n" - "\t.verify\t\t= cpufreq_generic_frequency_table_verify,\n" - "\t.target_index\t= tangox_target,\n" - "\t.get\t\t= tangox_get_freq,\n" - "\t.exit\t\t= cpufreq_generic_exit,\n" - "\t.attr\t\t= cpufreq_generic_attr,\n" - "};\n" - "\n" - "static int __init tangox_cpufreq_init(void)\n" - "{\n" - "\treturn cpufreq_register_driver(&tangox_cpufreq_driver);\n" - "}\n" - "\n" - "static void __exit tangox_cpufreq_exit(void)\n" - "{\n" - "\tcpufreq_unregister_driver(&tangox_cpufreq_driver);\n" - "}\n" + "Regards.\n" "\n" - "module_init(tangox_cpufreq_init);\n" - module_exit(tangox_cpufreq_exit); + "-------------- next part --------------\n" + "A non-text attachment was scrubbed...\n" + "Name: cpufreq.c\n" + "Type: text/x-csrc\n" + "Size: 2567 bytes\n" + "Desc: not available\n" + URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150129/ee612bdc/attachment.bin> -872dde93ef9eeeb5b2fbf5262229345fac51b9709c9813f82b1bc9741b71ef38 +c9430be725131b21da1db02fe2c72c9793b51d189cacd7b541c1d338c737a264
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.