Commit 2825999e authored by Peter Griffin's avatar Peter Griffin Committed by Paul Mundt
Browse files

sh: Add support for SH7201 CPU subtype.



This patch adds support for the SH-2A FPU based SH7201 processor subtype.

Signed-off-by: default avatarPeter Griffin <pgriffin@mpc-data.co.uk>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 135210b3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -185,6 +185,11 @@ config CPU_SUBTYPE_SH7619

# SH-2A Processor Support

config CPU_SUBTYPE_SH7201
	bool "Support SH7201 processor"
	select CPU_SH2A
	select CPU_HAS_FPU
 
config CPU_SUBTYPE_SH7203
	bool "Support SH7203 processor"
	select CPU_SH2A
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ static void __init check_bugs(void)
	case CPU_SH7619:
		*p++ = '2';
		break;
	case CPU_SH7203 ... CPU_MXG:
	case CPU_SH7201 ... CPU_MXG:
		*p++ = '2';
		*p++ = 'a';
		break;
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ enum cpu_type {
	CPU_SH7619,

	/* SH-2A types */
	CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
	CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,

	/* SH-3 types */
	CPU_SH7705, CPU_SH7706, CPU_SH7707,
+2 −1
Original line number Diff line number Diff line
@@ -8,9 +8,10 @@ common-y += ex.o entry.o

obj-$(CONFIG_SH_FPU)	+= fpu.o

obj-$(CONFIG_CPU_SUBTYPE_SH7206)	+= setup-sh7206.o clock-sh7206.o
obj-$(CONFIG_CPU_SUBTYPE_SH7201)	+= setup-sh7201.o clock-sh7201.o
obj-$(CONFIG_CPU_SUBTYPE_SH7203)	+= setup-sh7203.o clock-sh7203.o
obj-$(CONFIG_CPU_SUBTYPE_SH7263)	+= setup-sh7203.o clock-sh7203.o
obj-$(CONFIG_CPU_SUBTYPE_SH7206)	+= setup-sh7206.o clock-sh7206.o
obj-$(CONFIG_CPU_SUBTYPE_MXG)		+= setup-mxg.o clock-sh7206.o

# Pinmux setup
+85 −0
Original line number Diff line number Diff line
/*
 * arch/sh/kernel/cpu/sh2a/clock-sh7201.c
 *
 * SH7201 support for the clock framework
 *
 *  Copyright (C) 2008 Peter Griffin  <pgriffin@mpc-data.co.uk>
 *
 * Based on clock-sh4.c
 *  Copyright (C) 2005  Paul Mundt
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/init.h>
#include <linux/kernel.h>
#include <asm/clock.h>
#include <asm/freq.h>
#include <asm/io.h>

const static int pll1rate[]={1,2,3,4,6,8};
const static int pfc_divisors[]={1,2,3,4,6,8,12};
#define ifc_divisors pfc_divisors

#if (CONFIG_SH_CLK_MD == 0)
#define PLL2 (4)
#elif (CONFIG_SH_CLK_MD == 2)
#define PLL2 (2)
#elif (CONFIG_SH_CLK_MD == 3)
#define PLL2 (1)
#else
#error "Illegal Clock Mode!"
#endif

static void master_clk_init(struct clk *clk)
{
	clk->rate = 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
}

static struct clk_ops sh7201_master_clk_ops = {
	.init		= master_clk_init,
};

static void module_clk_recalc(struct clk *clk)
{
	int idx = (ctrl_inw(FREQCR) & 0x0007);
	clk->rate = clk->parent->rate / pfc_divisors[idx];
}

static struct clk_ops sh7201_module_clk_ops = {
	.recalc		= module_clk_recalc,
};

static void bus_clk_recalc(struct clk *clk)
{
	int idx = (ctrl_inw(FREQCR) & 0x0007);
	clk->rate = clk->parent->rate / pfc_divisors[idx];
}

static struct clk_ops sh7201_bus_clk_ops = {
	.recalc		= bus_clk_recalc,
};

static void cpu_clk_recalc(struct clk *clk)
{
	int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
	clk->rate = clk->parent->rate / ifc_divisors[idx];
}

static struct clk_ops sh7201_cpu_clk_ops = {
	.recalc		= cpu_clk_recalc,
};

static struct clk_ops *sh7201_clk_ops[] = {
	&sh7201_master_clk_ops,
	&sh7201_module_clk_ops,
	&sh7201_bus_clk_ops,
	&sh7201_cpu_clk_ops,
};

void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{
	if (idx < ARRAY_SIZE(sh7201_clk_ops))
		*ops = sh7201_clk_ops[idx];
}
Loading