@@ -3,6 +3,7 @@ config MACH_SOCFPGA_CYCLONE5
bool "SOCFPGA Cyclone5 platform"
select HAVE_SMP
select PLAT_SOCFPGA_ETH
+ select COMMON_CLK
help
Include support for the Altera(R) Cyclone5 development platform.
@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
-obj-y := common.o clock.o dw_apb_timer.o
+obj-y := common.o dw_apb_timer.o
obj-$(CONFIG_MACH_SOCFPGA_CYCLONE5) += socfpga_cyclone5.o
obj-$(CONFIG_SMP) += platsmp.o headsmp.o
obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
\ No newline at end of file
@@ -22,6 +22,7 @@
#include <linux/clkdev.h>
#include <linux/gfp.h>
#include <linux/of_platform.h>
+#include <linux/clk-provider.h>
#include <mach/iomap.h>
#include <mach/socfpga_cyclone5.h>
@@ -49,51 +50,6 @@ extern struct dma_pl330_platdata dma_platform_data;
#define SOCFPGA_MPU_PERIHCLK_FREQ_HZ (800000000 / 4)
#define SOCFPGA_L4_MAIN_CLK (400000000)
-static struct clk dummy_apb_pclk;
-static struct clk dummy_i2c_clk = {
- .rate = 100000000,
-};
-static struct clk dummy_spim_clk = {
- .rate = 100000000,
-};
-static struct clk mpu_periphclk = {
- .rate = SOCFPGA_MPU_PERIHCLK_FREQ_HZ,
-};
-
-static struct clk l4_main_clk = {
- .rate = SOCFPGA_L4_MAIN_CLK,
-};
-
-static struct clk_lookup lookups[] = {
- { /* Bus clock */
- .con_id = "apb_pclk",
- .clk = &dummy_apb_pclk,
- },
- {
- .dev_id = "ffc04000.i2c",
- .clk = &dummy_i2c_clk,
- },
- {
- .dev_id = "ffc05000.i2c",
- .clk = &dummy_i2c_clk,
- },
- {
- .dev_id = "dw-spi-mmio.0",
- .clk = &dummy_spim_clk,
- },
- {
- .dev_id = "dw-spi-mmio.1",
- .clk = &dummy_spim_clk,
- },
- {
- .dev_id = "smp_twd",
- .clk = &mpu_periphclk,
- },
- {
- .dev_id = "dma-pl330",
- .clk = &l4_main_clk,
- }
-};
struct plat_serial8250_port uart_platform_data[] = {
{
@@ -103,11 +59,46 @@ struct plat_serial8250_port uart_platform_data[] = {
},
};
+void __init socfpga_init_clocks(void)
+{
+ struct clk *dummy_apb_pclk;
+ struct clk *dummy_i2c_clk;
+ struct clk *dummy_spim_clk;
+ struct clk *mpu_periphclk;
+ struct clk *l4_main_clk;
+
+ dummy_apb_pclk = clk_register_fixed_rate(NULL, "apb", NULL, 0, 0);
+ dummy_i2c_clk = clk_register_fixed_rate(NULL, "i2c", NULL, 0, 100000000);
+ dummy_spim_clk = clk_register_fixed_rate(NULL, "spim", NULL, 0, 100000000);
+ mpu_periphclk = clk_register_fixed_rate(NULL, "mpu_periph", NULL, 0, SOCFPGA_MPU_PERIHCLK_FREQ_HZ);
+ l4_main_clk = clk_register_fixed_rate(NULL, "l4_main", NULL, 0, SOCFPGA_L4_MAIN_CLK);
+
+ {
+ static struct clk_lookup lookups[7];
+ lookups[0].con_id = "apb_pclk"; /* Bus clock */
+ lookups[0].clk = dummy_apb_pclk;
+ lookups[1].dev_id = "ffc04000.i2c";
+ lookups[1].clk = dummy_i2c_clk;
+ lookups[2].dev_id = "ffc05000.i2c";
+ lookups[2].clk = dummy_i2c_clk;
+ lookups[3].dev_id = "dw-spi-mmio.0";
+ lookups[3].clk = dummy_spim_clk;
+ lookups[4].dev_id = "dw-spi-mmio.1";
+ lookups[4].clk = dummy_spim_clk;
+ lookups[5].dev_id = "smp_twd";
+ lookups[5].clk = mpu_periphclk;
+ lookups[6].dev_id = "dma-pl330";
+ lookups[6].clk = l4_main_clk;
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+ }
+}
+
void __init socfpga_init_early(void)
{
- clkdev_add_table(lookups, ARRAY_SIZE(lookups));
}
+//initcall(socfpga_init_clocks);
+
/*
* Where is the timer (VA)?
*/
@@ -1,11 +1,4 @@
#ifndef __MACH_CLOCK_H
#define __MACH_CLOCK_H
-struct clk;
-
-struct clk_ops {
- long (*round)(struct clk *, unsigned long);
- int (*set)(struct clk *, unsigned long);
-};
-
#endif