Skip to content

Commit

Permalink
sh: Add SH7785 Highlander board support (R7785RP).
Browse files Browse the repository at this point in the history
This adds preliminary support for the SH7785-based Highlander board.
Some of the Highlander support code is reordered so that most of it
can be reused directly.

This also plugs in missing SH7785 checks in the places that need it,
as this is the first board to support the CPU.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt authored and Paul Mundt committed May 7, 2007
1 parent be782df commit 32351a2
Show file tree
Hide file tree
Showing 27 changed files with 1,896 additions and 144 deletions.
47 changes: 15 additions & 32 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,8 @@ config SH_RTS7751R2D
Select RTS7751R2D if configuring for a Renesas Technology
Sales SH-Graphics board.

config SH_R7780RP
bool "R7780RP-1"
select CPU_SUBTYPE_SH7780
help
Select R7780RP-1 if configuring for a Renesas Solutions
HIGHLANDER board.
config SH_HIGHLANDER
bool "Highlander"

config SH_EDOSK7705
bool "EDOSK7705"
Expand Down Expand Up @@ -262,6 +258,10 @@ config SH_UNKNOWN

endchoice

source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"
source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
source "arch/sh/boards/renesas/r7780rp/Kconfig"

source "arch/sh/mm/Kconfig"

config CF_ENABLER
Expand Down Expand Up @@ -412,8 +412,9 @@ config CPU_HAS_PTEA

endmenu

menu "Timer support"
depends on !GENERIC_TIME
menu "Timer and clock configuration"

if !GENERIC_TIME

config SH_TMU
bool "TMU timer support"
Expand All @@ -436,17 +437,11 @@ config SH_MTU2
help
This enables the use of the MTU2 as the system timer.

endmenu

source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"

source "arch/sh/boards/renesas/rts7751r2d/Kconfig"

source "arch/sh/boards/renesas/r7780rp/Kconfig"
endif

config SH_TIMER_IRQ
int
default "28" if CPU_SUBTYPE_SH7780
default "28" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
default "86" if CPU_SUBTYPE_SH7619
default "140" if CPU_SUBTYPE_SH7206
default "16"
Expand Down Expand Up @@ -476,7 +471,8 @@ config SH_PCLK_FREQ
default "33333333" if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH7770 || \
CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \
CPU_SUBTYPE_SH7206
default "50000000" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7780
default "50000000" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7780 || \
CPU_SUBTYPE_SH7785
default "60000000" if CPU_SUBTYPE_SH7751
default "66000000" if CPU_SUBTYPE_SH4_202
help
Expand All @@ -491,6 +487,8 @@ config SH_CLK_MD
help
MD2 - MD0 pin setting.

endmenu

menu "CPU Frequency scaling"

source "drivers/cpufreq/Kconfig"
Expand All @@ -509,21 +507,6 @@ config SH_CPU_FREQ

endmenu

source "arch/sh/drivers/dma/Kconfig"

source "arch/sh/cchips/Kconfig"

config HEARTBEAT
bool "Heartbeat LED"
depends on SH_MPC1211 || SH_SH03 || \
SOLUTION_ENGINE || \
SH_RTS7751R2D || SH_SH4202_MICRODEV || SH_LANDISK || \
SH_R7780RP
help
Use the power-on LED on your machine as a load meter. The exact
behavior is platform-dependent, but normally the flash frequency is
a hyperbolic function of the 5-minute load average.

source "arch/sh/drivers/Kconfig"

endmenu
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ machdir-$(CONFIG_SH_HS7751RVOIP) := renesas/hs7751rvoip
machdir-$(CONFIG_SH_RTS7751R2D) := renesas/rts7751r2d
machdir-$(CONFIG_SH_7751_SYSTEMH) := renesas/systemh
machdir-$(CONFIG_SH_EDOSK7705) := renesas/edosk7705
machdir-$(CONFIG_SH_R7780RP) := renesas/r7780rp
machdir-$(CONFIG_SH_HIGHLANDER) := renesas/r7780rp
machdir-$(CONFIG_SH_7710VOIPGW) := renesas/sh7710voipgw
machdir-$(CONFIG_SH_SH4202_MICRODEV) := superh/microdev
machdir-$(CONFIG_SH_LANDISK) := landisk
Expand Down
18 changes: 14 additions & 4 deletions arch/sh/boards/renesas/r7780rp/Kconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
if SH_R7780RP
if SH_HIGHLANDER

menu "R7780RP options"
choice
prompt "Highlander options"
default SH_R7780MP

config SH_R7780RP
bool "R7780RP-1 board support"
select CPU_SUBTYPE_SH7780

config SH_R7780MP
bool "R7780MP board support"
default y
select CPU_SUBTYPE_SH7780
help
Selecting this option will enable support for the mass-production
version of the R7780RP. If in doubt, say Y.

endmenu
config SH_R7785RP
bool "R7785RP board support"
select CPU_SUBTYPE_SH7785

endchoice

endif
6 changes: 3 additions & 3 deletions arch/sh/boards/renesas/r7780rp/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Makefile for the R7780RP-1 specific parts of the kernel
#

obj-y := setup.o irq.o

irqinit-y := irq-r7780rp.o
irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o
obj-$(CONFIG_PUSH_SWITCH) += psw.o
obj-y := setup.o irq.o $(irqinit-y)
21 changes: 21 additions & 0 deletions arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Renesas Solutions Highlander R7780RP-1 Support.
*
* Copyright (C) 2002 Atom Create Engineering Co., Ltd.
* Copyright (C) 2006 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 <asm/io.h>
#include <asm/r7780rp.h>

void __init highlander_init_irq(void)
{
int i;

for (i = 0; i < 15; i++)
make_r7780rp_irq(i);
}
29 changes: 29 additions & 0 deletions arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Renesas Solutions Highlander R7780RP-1 Support.
*
* Copyright (C) 2002 Atom Create Engineering Co., Ltd.
* Copyright (C) 2006 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 <asm/io.h>
#include <asm/r7780rp.h>

void __init highlander_init_irq(void)
{
ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */

/* Setup the FPGA IRL */
ctrl_outw(0x0000, PA_IRLPRA); /* FPGA IRLA */
ctrl_outw(0xe598, PA_IRLPRB); /* FPGA IRLB */
ctrl_outw(0x7060, PA_IRLPRC); /* FPGA IRLC */
ctrl_outw(0x0000, PA_IRLPRD); /* FPGA IRLD */
ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */
ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */

make_r7780rp_irq(1); /* CF card */
make_r7780rp_irq(10); /* On-board ethernet */
}
25 changes: 10 additions & 15 deletions arch/sh/boards/renesas/r7780rp/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#include <linux/io.h>
#include <asm/r7780rp.h>

#ifdef CONFIG_SH_R7780MP
static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
#else
#ifdef CONFIG_SH_R7780RP
static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
#elif defined(CONFIG_SH_R7780MP)
static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
#elif defined(CONFIG_SH_R7785RP)
static int mask_pos[] = {2, 11, 2, 2, 2, 2, 9, 8, 7, 5, 10, 2, 2, 2, 2, 2};
#endif

static void enable_r7780rp_irq(unsigned int irq)
Expand All @@ -40,17 +42,10 @@ static struct irq_chip r7780rp_irq_chip __read_mostly = {
.mask_ack = disable_r7780rp_irq,
};

/*
* Initialize IRQ setting
*/
void __init init_r7780rp_IRQ(void)
void make_r7780rp_irq(unsigned int irq)
{
int i;

for (i = 0; i < 15; i++) {
disable_irq_nosync(i);
set_irq_chip_and_handler_name(i, &r7780rp_irq_chip,
handle_level_irq, "level");
enable_r7780rp_irq(i);
}
disable_irq_nosync(irq);
set_irq_chip_and_handler_name(irq, &r7780rp_irq_chip,
handle_level_irq, "level");
enable_r7780rp_irq(irq);
}
74 changes: 28 additions & 46 deletions arch/sh/boards/renesas/r7780rp/setup.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/*
* arch/sh/boards/renesas/r7780rp/setup.c
*
* Renesas Solutions Highlander Support.
*
* Copyright (C) 2002 Atom Create Engineering Co., Ltd.
* Copyright (C) 2005 - 2007 Paul Mundt
*
* Renesas Solutions Highlander R7780RP-1 Support.
* This contains support for the R7780RP-1, R7780MP, and R7785RP
* Highlander modules.
*
* 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
Expand All @@ -18,32 +21,6 @@
#include <asm/clock.h>
#include <asm/io.h>

extern void init_r7780rp_IRQ(void);

static struct resource m66596_usb_host_resources[] = {
[0] = {
.start = 0xa4800000,
.end = 0xa4ffffff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 6, /* irq number */
.end = 6,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device m66596_usb_host_device = {
.name = "m66596-hcd",
.id = 0,
.dev = {
.dma_mask = NULL, /* don't use dma */
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(m66596_usb_host_resources),
.resource = m66596_usb_host_resources,
};

static struct resource cf_ide_resources[] = {
[0] = {
.start = PA_AREA5_IO + 0x1000,
Expand All @@ -56,10 +33,10 @@ static struct resource cf_ide_resources[] = {
.flags = IORESOURCE_MEM,
},
[2] = {
#ifdef CONFIG_SH_R7780MP
.start = 1,
#else
#ifdef CONFIG_SH_R7780RP
.start = 4,
#else
.start = 1,
#endif
.flags = IORESOURCE_IRQ,
},
Expand Down Expand Up @@ -92,15 +69,18 @@ static struct resource heartbeat_resources[] = {
static struct platform_device heartbeat_device = {
.name = "heartbeat",
.id = -1,

/* R7785RP has a slightly more sensible FPGA.. */
#ifndef CONFIG_SH_R7785RP
.dev = {
.platform_data = heartbeat_bit_pos,
},
#endif
.num_resources = ARRAY_SIZE(heartbeat_resources),
.resource = heartbeat_resources,
};

static struct platform_device *r7780rp_devices[] __initdata = {
&m66596_usb_host_device,
&cf_ide_device,
&heartbeat_device,
};
Expand All @@ -110,6 +90,7 @@ static int __init r7780rp_devices_setup(void)
return platform_add_devices(r7780rp_devices,
ARRAY_SIZE(r7780rp_devices));
}
device_initcall(r7780rp_devices_setup);

/*
* Platform specific clocks
Expand Down Expand Up @@ -140,22 +121,22 @@ static struct clk *r7780rp_clocks[] = {

static void r7780rp_power_off(void)
{
#ifdef CONFIG_SH_R7780MP
ctrl_outw(0x0001, PA_POFF);
#endif
if (mach_is_r7780mp() || mach_is_r7785rp())
ctrl_outw(0x0001, PA_POFF);
}

/*
* Initialize the board
*/
static void __init r7780rp_setup(char **cmdline_p)
static void __init highlander_setup(char **cmdline_p)
{
u16 ver = ctrl_inw(PA_VERREG);
int i;

device_initcall(r7780rp_devices_setup);

printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n");
printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
mach_is_r7780rp() ? "R7780RP-1" :
mach_is_r7780mp() ? "R7780MP" :
"R7785RP");

printk(KERN_INFO "Board version: %d (revision %d), "
"FPGA version: %d (revision %d)\n",
Expand All @@ -173,9 +154,10 @@ static void __init r7780rp_setup(char **cmdline_p)
}

ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
#ifndef CONFIG_SH_R7780MP
ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
#endif

if (mach_is_r7780rp())
ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */

ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */

pm_power_off = r7780rp_power_off;
Expand All @@ -184,10 +166,10 @@ static void __init r7780rp_setup(char **cmdline_p)
/*
* The Machine Vector
*/
struct sh_machine_vector mv_r7780rp __initmv = {
.mv_name = "Highlander R7780RP-1",
.mv_setup = r7780rp_setup,
struct sh_machine_vector mv_highlander __initmv = {
.mv_name = "Highlander",
.mv_nr_irqs = 109,
.mv_init_irq = init_r7780rp_IRQ,
.mv_setup = highlander_setup,
.mv_init_irq = highlander_init_irq,
};
ALIAS_MV(r7780rp)
ALIAS_MV(highlander)
Loading

0 comments on commit 32351a2

Please sign in to comment.