Commit 0207a2ef authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Paul Mundt

sh: Add support for SH7724 (SH-Mobile R2R) CPU subtype.

This implements initial support for the SH-Mobile R2R CPU.
Based on Rev 0.11 of the initial SH7724 hardware manual.
Signed-off-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 3ee8da87
......@@ -347,6 +347,15 @@ config CPU_SUBTYPE_SH7723
help
Select SH7723 if you have an SH-MobileR2 CPU.
config CPU_SUBTYPE_SH7724
bool "Support SH7724 processor"
select CPU_SH4A
select CPU_SHX2
select ARCH_SPARSEMEM_ENABLE
select SYS_SUPPORTS_CMT
help
Select SH7724 if you have an SH-MobileR2R CPU.
config CPU_SUBTYPE_SH7763
bool "Support SH7763 processor"
select CPU_SH4A
......@@ -495,6 +504,7 @@ config SH_PCLK_FREQ
CPU_SUBTYPE_SH7203 || CPU_SUBTYPE_SH7206 || \
CPU_SUBTYPE_SH7263 || CPU_SUBTYPE_MXG || \
CPU_SUBTYPE_SH7786
default "41666666" if CPU_SUBTYPE_SH7724
default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
default "66000000" if CPU_SUBTYPE_SH4_202
default "50000000"
......
......@@ -32,7 +32,7 @@ enum cpu_type {
/* SH-4A types */
CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
CPU_SH7723, CPU_SHX3,
CPU_SH7723, CPU_SH7724, CPU_SHX3,
/* SH4AL-DSP types */
CPU_SH7343, CPU_SH7722, CPU_SH7366,
......
......@@ -25,6 +25,24 @@
#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
defined(CONFIG_CPU_SUBTYPE_SH7780)
#define FRQCR 0xffc80000
#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
#define FRQCRA 0xa4150000
#define FRQCRB 0xa4150004
#define VCLKCR 0xa4150048
#define FCLKACR 0xa4150008
#define FCLKBCR 0xa415000c
#define FRQCR FRQCRA
#define SCLKACR FCLKACR
#define SCLKBCR FCLKBCR
#define FCLKACR 0xa4150008
#define FCLKBCR 0xa415000c
#define IrDACLKCR 0xa4150018
#define MSTPCR0 0xa4150030
#define MSTPCR1 0xa4150034
#define MSTPCR2 0xa4150038
#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
#define FRQCR0 0xffc80000
#define FRQCR1 0xffc80004
......
#ifndef __ASM_SH7724_H__
#define __ASM_SH7724_H__
enum {
/* PTA */
GPIO_PTA7, GPIO_PTA6, GPIO_PTA5, GPIO_PTA4,
GPIO_PTA3, GPIO_PTA2, GPIO_PTA1, GPIO_PTA0,
/* PTB */
GPIO_PTB7, GPIO_PTB6, GPIO_PTB5, GPIO_PTB4,
GPIO_PTB3, GPIO_PTB2, GPIO_PTB1, GPIO_PTB0,
/* PTC */
GPIO_PTC7, GPIO_PTC6, GPIO_PTC5, GPIO_PTC4,
GPIO_PTC3, GPIO_PTC2, GPIO_PTC1, GPIO_PTC0,
/* PTD */
GPIO_PTD7, GPIO_PTD6, GPIO_PTD5, GPIO_PTD4,
GPIO_PTD3, GPIO_PTD2, GPIO_PTD1, GPIO_PTD0,
/* PTE */
GPIO_PTE7, GPIO_PTE6, GPIO_PTE5, GPIO_PTE4,
GPIO_PTE3, GPIO_PTE2, GPIO_PTE1, GPIO_PTE0,
/* PTF */
GPIO_PTF7, GPIO_PTF6, GPIO_PTF5, GPIO_PTF4,
GPIO_PTF3, GPIO_PTF2, GPIO_PTF1, GPIO_PTF0,
/* PTG */
GPIO_PTG5, GPIO_PTG4,
GPIO_PTG3, GPIO_PTG2, GPIO_PTG1, GPIO_PTG0,
/* PTH */
GPIO_PTH7, GPIO_PTH6, GPIO_PTH5, GPIO_PTH4,
GPIO_PTH3, GPIO_PTH2, GPIO_PTH1, GPIO_PTH0,
/* PTJ */
GPIO_PTJ7, GPIO_PTJ6, GPIO_PTJ5,
GPIO_PTJ3, GPIO_PTJ2, GP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1, GPIO_FN_KEYOUT0,
/* ATAPI (PTA/PTB/PTK/PTR/PTS/PTW) */
GPIO_FN_IDED15, GPIO_FN_IDED14, GPIO_FN_IDED13, GPIO_FN_IDED12,
GPIO_FN_IDED11, GPIO_FN_IDED10, GPIO_FN_IDED9, GPIO_FN_IDED8,
GPIO_FN_IDED7, GPIO_FN_IDED6, GPIO_FN_IDED5, GPIO_FN_IDED4,
GPIO_FN_IDED3, GPIO_FN_IDED2, GPIO_FN_IDED1, GPIO_FN_IDED0,
GPIO_FN_IDEA2, GPIO_FN_IDEA1, GPIO_FN_IDEA0, GPIO_FN_IDEIOWR,
GPIO_FN_IODREQ, GPIO_FN_IDECS0, GPIO_FN_IDECS1, GPIO_FN_IDEIORD,
GPIO_FN_DIRECTION, GPIO_FN_EXBUF_ENB, GPIO_FN_IDERST, GPIO_FN_IODACK,
GPIO_FN_IDEINT, GPIO_FN_IDEIORDY,
/* TPU (PTB/PTR/PTS) */
GPIO_FN_TPUTO3, GPIO_FN_TPUTO2, GPIO_FN_TPUTO1, GPIO_FN_TPUTO0,
GPIO_FN_TPUTI3, GPIO_FN_TPUTI2,
/* LCDC (PTC/PTD/PTE/PTF/PTM/PTR) */
GPIO_FN_LCDD23, GPIO_FN_LCDD22, GPIO_FN_LCDD21, GPIO_FN_LCDD20,
GPIO_FN_LCDD19, GPIO_FN_LCDD18, GPIO_FN_LCDD17, GPIO_FN_LCDD16,
GPIO_FN_LCDD15, GPIO_FN_LCDD14, GPIO_FN_LCDD13, GPIO_FN_LCDD12,
GPIO_FN_LCDD11, GPIO_FN_LCDD10, GPIO_FN_LCDD9, GPIO_FN_LCDD8,
GPIO_FN_LCDD7, GPIO_FN_LCDD6, GPIO_FN_LCDD5, GPIO_FN_LCDD4,
GPIO_FN_LCDD3, GPIO_FN_LCDD2, GPIO_FN_LCDD1, GPIO_FN_LCDD0,
GPIO_FN_LCDVSYN, GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_LCDHSYN,
GP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IO_FN_SDHI1CLK,
GPIO_FN_SDHI1D3, GPIO_FN_SDHI1D2, GPIO_FN_SDHI1D1, GPIO_FN_SDHI1D0,
/* MMC (PTW/PTX)*/
GPIO_FN_MMC_D7, GPIO_FN_MMC_D6, GPIO_FN_MMC_D5, GPIO_FN_MMC_D4,
GPIO_FN_MMC_D3, GPIO_FN_MMC_D2, GPIO_FN_MMC_D1, GPIO_FN_MMC_D0,
GPIO_FN_MMC_CLK, GPIO_FN_MMC_CMD,
/* IrDA (PTX) */
GPIO_FN_IRDA_OUT, GPIO_FN_IRDA_IN,
/* TSIF (PTX) */
GPIO_FN_TSIF_TS0_SDAT, GPIO_FN_TSIF_TS0_SCK,
GPIO_FN_TSIF_TS0_SDEN, GPIO_FN_TSIF_TS0_SPSYNC,
/* IRQ (PTZ) */
GPIO_FN_INTC_IRQ7, GPIO_FN_INTC_IRQ6, GPIO_FN_INTC_IRQ5,
GPIO_FN_INTC_IRQ4, GPIO_FN_INTC_IRQ3, GPIO_FN_INTC_IRQ2,
GPIO_FN_INTC_IRQ1, GPIO_FN_INTC_IRQ0,
};
#endif /* __ASM_SH7724_H__ */
......@@ -156,6 +156,12 @@ int __init detect_cpu_and_cache_system(void)
break;
}
break;
case 0x300b:
boot_cpu_data.type = CPU_SH7724;
boot_cpu_data.icache.ways = 4;
boot_cpu_data.dcache.ways = 4;
boot_cpu_data.flags |= CPU_HAS_LLSC | CPU_HAS_FPU;
break;
case 0x4000: /* 1st cut */
case 0x4001: /* 2nd cut */
boot_cpu_data.type = CPU_SHX3;
......
......@@ -11,6 +11,7 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o
obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o
obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o
obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o
obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o
obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o
......@@ -26,12 +27,14 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7786) := clock-sh7786.o
clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7722.o
clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o
clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7722.o
clock-$(CONFIG_CPU_SUBTYPE_SH7724) := clock-sh7722.o
clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7722.o
clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o
# Pinmux setup
pinmux-$(CONFIG_CPU_SUBTYPE_SH7722) := pinmux-sh7722.o
pinmux-$(CONFIG_CPU_SUBTYPE_SH7723) := pinmux-sh7723.o
pinmux-$(CONFIG_CPU_SUBTYPE_SH7724) := pinmux-sh7724.o
pinmux-$(CONFIG_CPU_SUBTYPE_SH7785) := pinmux-sh7785.o
pinmux-$(CONFIG_CPU_SUBTYPE_SH7786) := pinmux-sh7786.o
......
......@@ -130,6 +130,12 @@ static void adjust_clocks(int originate, int *l, unsigned long v[],
* is quite simple..
*/
#if defined(CONFIG_CPU_SUBTYPE_SH7724)
#define STCPLL(frqcr) ((((frqcr >> 24) & 0x3f) + 1) * 2)
#else
#define STCPLL(frqcr) (((frqcr >> 24) & 0x1f) + 1)
#endif
/*
* Instead of having two separate multipliers/divisors set, like this:
*
......@@ -139,13 +145,17 @@ static void adjust_clocks(int originate, int *l, unsigned long v[],
* I created the divisors2 array, which is used to calculate rate like
* rate = parent * 2 / divisors2[ divisor ];
*/
#if defined(CONFIG_CPU_SUBTYPE_SH7724)
static int divisors2[] = { 4, 1, 8, 12, 16, 24, 32, 1, 48, 64, 72, 96, 1, 144 };
#else
static int divisors2[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 40 };
#endif
static void master_clk_recalc(struct clk *clk)
{
unsigned frqcr = ctrl_inl(FRQCR);
clk->rate = CONFIG_SH_PCLK_FREQ * (((frqcr >> 24) & 0x1f) + 1);
clk->rate = CONFIG_SH_PCLK_FREQ * STCPLL(frqcr);
}
static void master_clk_init(struct clk *clk)
......@@ -161,13 +171,30 @@ static void module_clk_recalc(struct clk *clk)
{
unsigned long frqcr = ctrl_inl(FRQCR);
clk->rate = clk->parent->rate / (((frqcr >> 24) & 0x1f) + 1);
clk->rate = clk->parent->rate / STCPLL(frqcr);
}
#if defined(CONFIG_CPU_SUBTYPE_SH7724)
#define MASTERDIVS { 12, 16, 24, 30, 32, 36, 48 }
#define STCMASK 0x3f
#define DIVCALC(div) (div/2-1)
#define FRQCRKICK 0x80000000
#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
#define MASTERDIVS { 6, 8, 12, 16 }
#define STCMASK 0x1f
#define DIVCALC(div) (div-1)
#define FRQCRKICK 0x00000000
#else
#define MASTERDIVS { 2, 3, 4, 6, 8, 16 }
#define STCMASK 0x1f
#define DIVCALC(div) (div-1)
#define FRQCRKICK 0x00000000
#endif
static int master_clk_setrate(struct clk *clk, unsigned long rate, int id)
{
int div = rate / clk->rate;
int master_divs[] = { 2, 3, 4, 6, 8, 16 };
int master_divs[] = MASTERDIVS;
int index;
unsigned long frqcr;
......@@ -180,8 +207,9 @@ static int master_clk_setrate(struct clk *clk, unsigned long rate, int id)
div = master_divs[index - 1];
frqcr = ctrl_inl(FRQCR);
frqcr &= ~(0xF << 24);
frqcr |= ( (div-1) << 24);
frqcr &= ~(STCMASK << 24);
frqcr |= (DIVCALC(div) << 24);
frqcr |= FRQCRKICK;
ctrl_outl(frqcr, FRQCR);
return 0;
......@@ -377,6 +405,7 @@ static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
/* clear FRQCR bits */
frqcr &= ~(ctx.mask << ctx.shift);
frqcr |= div << ctx.shift;
frqcr |= FRQCRKICK;
/* ...and perform actual change */
ctrl_outl(frqcr, FRQCR);
......@@ -542,8 +571,8 @@ static struct clk sh7722_r_clock = {
.flags = CLK_RATE_PROPAGATES,
};
#ifndef CONFIG_CPU_SUBTYPE_SH7343
#if !defined(CONFIG_CPU_SUBTYPE_SH7343) &&\
!defined(CONFIG_CPU_SUBTYPE_SH7724)
/*
* these three clocks - SIU A, SIU B, IrDA - share the same clk_ops
* methods of clk_ops determine which register they should access by
......@@ -560,15 +589,16 @@ static struct clk sh7722_siu_b_clock = {
.arch_flags = SCLKBCR,
.ops = &sh7722_siu_clk_ops,
};
#endif /* CONFIG_CPU_SUBTYPE_SH7343, SH7724 */
#if defined(CONFIG_CPU_SUBTYPE_SH7722)
#if defined(CONFIG_CPU_SUBTYPE_SH7722) ||\
defined(CONFIG_CPU_SUBTYPE_SH7724)
static struct clk sh7722_irda_clock = {
.name = "irda_clk",
.arch_flags = IrDACLKCR,
.ops = &sh7722_siu_clk_ops,
};
#endif
#endif /* CONFIG_CPU_SUBTYPE_SH7343 */
static struct clk sh7722_video_clock = {
.name = "video_clk",
......@@ -715,6 +745,61 @@ static struct clk sh7722_mstpcr_clocks[] = {
MSTPCR("vpu0", "bus_clk", 2, 1),
MSTPCR("lcdc0", "bus_clk", 2, 0),
#endif
#if defined(CONFIG_CPU_SUBTYPE_SH7724)
/* See Datasheet : Overview -> Block Diagram */
MSTPCR("tlb0", "cpu_clk", 0, 31),
MSTPCR("ic0", "cpu_clk", 0, 30),
MSTPCR("oc0", "cpu_clk", 0, 29),
MSTPCR("rs0", "bus_clk", 0, 28),
MSTPCR("ilmem0", "cpu_clk", 0, 27),
MSTPCR("l2c0", "sh_clk", 0, 26),
MSTPCR("fpu0", "cpu_clk", 0, 24),
MSTPCR("intc0", "peripheral_clk", 0, 22),
MSTPCR("dmac0", "bus_clk", 0, 21),
MSTPCR("sh0", "sh_clk", 0, 20),
MSTPCR("hudi0", "peripheral_clk", 0, 19),
MSTPCR("ubc0", "cpu_clk", 0, 17),
MSTPCR("tmu0", "peripheral_clk", 0, 15),
MSTPCR("cmt0", "r_clk", 0, 14),
MSTPCR("rwdt0", "r_clk", 0, 13),
MSTPCR("dmac1", "bus_clk", 0, 12),
MSTPCR("tmu1", "peripheral_clk", 0, 10),
MSTPCR("scif0", "peripheral_clk", 0, 9),
MSTPCR("scif1", "peripheral_clk", 0, 8),
MSTPCR("scif2", "peripheral_clk", 0, 7),
MSTPCR("scif3", "bus_clk", 0, 6),
MSTPCR("scif4", "bus_clk", 0, 5),
MSTPCR("scif5", "bus_clk", 0, 4),
MSTPCR("msiof0", "bus_clk", 0, 2),
MSTPCR("msiof1", "bus_clk", 0, 1),
MSTPCR("keysc0", "r_clk", 1, 12),
MSTPCR("rtc0", "r_clk", 1, 11),
MSTPCR("i2c0", "peripheral_clk", 1, 9),
MSTPCR("i2c1", "peripheral_clk", 1, 8),
MSTPCR("mmc0", "bus_clk", 2, 29),
MSTPCR("eth0", "bus_clk", 2, 28),
MSTPCR("atapi0", "bus_clk", 2, 26),
MSTPCR("tpu0", "bus_clk", 2, 25),
MSTPCR("irda0", "peripheral_clk", 2, 24),
MSTPCR("tsif0", "bus_clk", 2, 22),
MSTPCR("usb1", "bus_clk", 2, 21),
MSTPCR("usb0", "bus_clk", 2, 20),
MSTPCR("2dg0", "bus_clk", 2, 19),
MSTPCR("sdhi0", "bus_clk", 2, 18),
MSTPCR("sdhi1", "bus_clk", 2, 17),
MSTPCR("veu1", "bus_clk", 2, 15),
MSTPCR("ceu1", "bus_clk", 2, 13),
MSTPCR("beu1", "bus_clk", 2, 12),
MSTPCR("2ddmac0", "sh_clk", 2, 10),
MSTPCR("spu0", "bus_clk", 2, 9),
MSTPCR("jpu0", "bus_clk", 2, 6),
MSTPCR("vou0", "bus_clk", 2, 5),
MSTPCR("beu0", "bus_clk", 2, 4),
MSTPCR("ceu0", "bus_clk", 2, 3),
MSTPCR("veu0", "bus_clk", 2, 2),
MSTPCR("vpu0", "bus_clk", 2, 1),
MSTPCR("lcdc0", "bus_clk", 2, 0),
#endif
#if defined(CONFIG_CPU_SUBTYPE_SH7343)
MSTPCR("uram0", "umem_clk", 0, 28),
MSTPCR("xymem0", "bus_clk", 0, 26),
......@@ -786,12 +871,15 @@ static struct clk *sh7722_clocks[] = {
&sh7722_sh_clock,
&sh7722_peripheral_clock,
&sh7722_sdram_clock,
#ifndef CONFIG_CPU_SUBTYPE_SH7343
#if !defined(CONFIG_CPU_SUBTYPE_SH7343) &&\
!defined(CONFIG_CPU_SUBTYPE_SH7724)
&sh7722_siu_a_clock,
&sh7722_siu_b_clock,
#if defined(CONFIG_CPU_SUBTYPE_SH7722)
&sh7722_irda_clock,
#endif
/* 7724 should support FSI clock */
#if defined(CONFIG_CPU_SUBTYPE_SH7722) || \
defined(CONFIG_CPU_SUBTYPE_SH7724)
&sh7722_irda_clock,
#endif
&sh7722_video_clock,
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -435,7 +435,8 @@ static const char *cpu_name[] = {
[CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
[CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
[CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
[CPU_SH7366] = "SH7366", [CPU_SH_NONE] = "Unknown"
[CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
[CPU_SH_NONE] = "Unknown"
};
const char *get_cpu_subtype(struct sh_cpuinfo *c)
......
......@@ -109,6 +109,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
case CPU_SH7785:
case CPU_SH7786:
case CPU_SH7723:
case CPU_SH7724:
case CPU_SHX3:
lmodel = &op_model_sh4a_ops;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment