Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1120542 authored by Michal Simek's avatar Michal Simek
Browse files

microblaze: Add support for CCF



Add support for CCF for Microblaze.

Old binding:
system_timer: system-timer@41c00000 {
	clock-frequency = <75000000>;
	...
}

New binding:
system_timer: system-timer@41c00000 {
	clocks = <&clk_bus>;
	...
}

Both should be supported for a while

Microblaze clock binding:
clocks {
	#address-cells = <1>;
	#size-cells = <0>;
	clk_bus: bus {
		#clock-cells = <0>;
		clock-frequency = <75000000>;
		clock-output-names = "bus";
		compatible = "fixed-clock";
		reg = <1>;
	} ;
	clk_cpu: cpu {
		#clock-cells = <0>;
		clock-frequency = <75000000>;
		clock-output-names = "cpu";
		compatible = "fixed-clock";
		reg = <0>;
	} ;
} ;

Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent 21ecc1f1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ config MICROBLAZE
	select GENERIC_CPU_DEVICES
	select GENERIC_ATOMIC64
	select GENERIC_CLOCKEVENTS
	select COMMON_CLK
	select GENERIC_IDLE_POLL_SETUP
	select MODULES_USE_ELF_RELA
	select CLONE_BACKWARDS3
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ extern struct cpuinfo cpuinfo;

/* fwd declarations of the various CPUinfo populators */
void setup_cpuinfo(void);
void setup_cpuinfo_clk(void);

void set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu);
void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu);
+0 −3
Original line number Diff line number Diff line
@@ -112,7 +112,4 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
	CI(num_wr_brk, NUMBER_OF_WR_ADDR_BRK);

	CI(fpga_family_code, TARGET_FAMILY);

	/* take timebase-frequency from DTS */
	ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");
}
+0 −2
Original line number Diff line number Diff line
@@ -113,8 +113,6 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
	ci->num_rd_brk = fcpu(cpu, "xlnx,number-of-rd-addr-brk");
	ci->num_wr_brk = fcpu(cpu, "xlnx,number-of-wr-addr-brk");

	ci->cpu_clock_freq = fcpu(cpu, "timebase-frequency");

	ci->pvr_user1 = fcpu(cpu, "xlnx,pvr-user1");
	ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2");

+21 −2
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
 * for more details.
 */

#include <linux/clk.h>
#include <linux/init.h>
#include <asm/cpuinfo.h>
#include <asm/pvr.h>
@@ -68,11 +69,10 @@ const struct family_string_key family_string_lookup[] = {
};

struct cpuinfo cpuinfo;
static struct device_node *cpu;

void __init setup_cpuinfo(void)
{
	struct device_node *cpu = NULL;

	cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu");
	if (!cpu)
		pr_err("You don't have cpu!!!\n");
@@ -102,3 +102,22 @@ void __init setup_cpuinfo(void)
		pr_warn("%s: Stream instructions enabled"
			" - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
}

void __init setup_cpuinfo_clk(void)
{
	struct clk *clk;

	clk = of_clk_get(cpu, 0);
	if (IS_ERR(clk)) {
		pr_err("ERROR: CPU CCF input clock not found\n");
		/* take timebase-frequency from DTS */
		cpuinfo.cpu_clock_freq = fcpu(cpu, "timebase-frequency");
	} else {
		cpuinfo.cpu_clock_freq = clk_get_rate(clk);
	}

	if (!cpuinfo.cpu_clock_freq) {
		pr_err("ERROR: CPU clock frequency not setup\n");
		BUG();
	}
}
Loading