Skip to content

Commit

Permalink
sh: Add support for SH7201 CPU subtype.
Browse files Browse the repository at this point in the history
This patch adds support for the SH-2A FPU based SH7201 processor subtype.

Signed-off-by: Peter Griffin <pgriffin@mpc-data.co.uk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Peter Griffin authored and Paul Mundt committed Dec 22, 2008
1 parent 135210b commit 2825999
Show file tree
Hide file tree
Showing 10 changed files with 455 additions and 8 deletions.
5 changes: 5 additions & 0 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/include/asm/bugs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion arch/sh/kernel/cpu/sh2a/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
85 changes: 85 additions & 0 deletions arch/sh/kernel/cpu/sh2a/clock-sh7201.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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];
}
7 changes: 4 additions & 3 deletions arch/sh/kernel/cpu/sh2a/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ int __init detect_cpu_and_cache_system(void)
/* All SH-2A CPUs have support for 16 and 32-bit opcodes.. */
boot_cpu_data.flags |= CPU_HAS_OP32;

#if defined(CONFIG_CPU_SUBTYPE_SH7203)
#if defined(CONFIG_CPU_SUBTYPE_SH7201)
boot_cpu_data.type = CPU_SH7201;
boot_cpu_data.flags |= CPU_HAS_FPU;
#elif defined(CONFIG_CPU_SUBTYPE_SH7203)
boot_cpu_data.type = CPU_SH7203;
/* SH7203 has an FPU.. */
boot_cpu_data.flags |= CPU_HAS_FPU;
#elif defined(CONFIG_CPU_SUBTYPE_SH7263)
boot_cpu_data.type = CPU_SH7263;
boot_cpu_data.flags |= CPU_HAS_FPU;
#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
boot_cpu_data.type = CPU_SH7206;
/* While SH7206 has a DSP.. */
boot_cpu_data.flags |= CPU_HAS_DSP;
#elif defined(CONFIG_CPU_SUBTYPE_MXG)
boot_cpu_data.type = CPU_MXG;
Expand Down
Loading

0 comments on commit 2825999

Please sign in to comment.