Commit 287c1297 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Paul Mundt

sh: Add ms7724se (SH7724) board support

This adds preliminary support for the ms7724se solution engine board.
Signed-off-by: default avatarKuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 3709ab8d
...@@ -46,6 +46,15 @@ config SH_7722_SOLUTION_ENGINE ...@@ -46,6 +46,15 @@ config SH_7722_SOLUTION_ENGINE
Select 7722 SolutionEngine if configuring for a Hitachi SH772 Select 7722 SolutionEngine if configuring for a Hitachi SH772
evaluation board. evaluation board.
config SH_7724_SOLUTION_ENGINE
bool "SolutionEngine7724"
select SOLUTION_ENGINE
depends on CPU_SUBTYPE_SH7724
select ARCH_REQUIRE_GPIOLIB
help
Select 7724 SolutionEngine if configuring for a Hitachi SH7724
evaluation board.
config SH_7751_SOLUTION_ENGINE config SH_7751_SOLUTION_ENGINE
bool "SolutionEngine7751" bool "SolutionEngine7751"
select SOLUTION_ENGINE select SOLUTION_ENGINE
......
#
# Makefile for the HITACHI UL SolutionEngine 7724 specific parts of the kernel
#
# 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.
#
#
obj-y := setup.o irq.o
\ No newline at end of file
/*
* linux/arch/sh/boards/se/7724/irq.c
*
* Copyright (C) 2009 Renesas Solutions Corp.
*
* Kuninori Morimoto <morimoto.kuninori@renesas.com>
*
* Based on linux/arch/sh/boards/se/7722/irq.c
* Copyright (C) 2007 Nobuhiro Iwamatsu
*
* Hitachi UL SolutionEngine 7724 Support.
*
* 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/irq.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <mach-se/mach/se7724.h>
struct fpga_irq {
unsigned long sraddr;
unsigned long mraddr;
unsigned short mask;
unsigned int base;
};
static unsigned int fpga2irq(unsigned int irq)
{
if (irq >= IRQ0_BASE &&
irq <= IRQ0_END)
return IRQ0_IRQ;
else if (irq >= IRQ1_BASE &&
irq <= IRQ1_END)
return IRQ1_IRQ;
else
return IRQ2_IRQ;
}
static struct fpga_irq get_fpga_irq(unsigned int irq)
{
struct fpga_irq set;
switch (irq) {
case IRQ0_IRQ:
set.sraddr = IRQ0_SR;
set.mraddr = IRQ0_MR;
set.mask = IRQ0_MASK;
set.base = IRQ0_BASE;
break;
case IRQ1_IRQ:
set.sraddr = IRQ1_SR;
set.mraddr = IRQ1_MR;
set.mask = IRQ1_MASK;
set.base = IRQ1_BASE;
break;
default:
set.sraddr = IRQ2_SR;
set.mraddr = IRQ2_MR;
set.mask = IRQ2_MASK;
set.base = IRQ2_BASE;
break;
}
return set;
}
static void disable_se7724_irq(unsigned int irq)
{
struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
unsigned int bit = irq - set.base;
ctrl_outw(ctrl_inw(set.mraddr) | 0x0001 << bit, set.mraddr);
}
static void enable_se7724_irq(unsigned int irq)
{
struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
unsigned int bit = irq - set.base;
ctrl_outw(ctrl_inw(set.mraddr) & ~(0x0001 << bit), set.mraddr);
}
static struct irq_chip se7724_irq_chip __read_mostly = {
.name = "SE7724-FPGA",
.mask = disable_se7724_irq,
.unmask = enable_se7724_irq,
.mask_ack = disable_se7724_irq,
};
static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
{
struct fpga_irq set = get_fpga_irq(irq);
unsigned short intv = ctrl_inw(set.sraddr);
struct irq_desc *ext_desc;
unsigned int ext_irq = set.base;
intv &= set.mask;
while (intv) {
if (intv & 0x0001) {
ext_desc = irq_desc + ext_irq;
handle_level_irq(ext_irq, ext_desc);
}
intv >>= 1;
ext_irq++;
}
}
/*
* Initialize IRQ setting
*/
void __init init_se7724_IRQ(void)
{
int i;
ctrl_outw(0xffff, IRQ0_MR); /* mask all */
ctrl_outw(0xffff, IRQ1_MR); /* mask all */
ctrl_outw(0xffff, IRQ2_MR); /* mask all */
ctrl_outw(0x0000, IRQ0_SR); /* clear irq */
ctrl_outw(0x0000, IRQ1_SR); /* clear irq */
ctrl_outw(0x0000, IRQ2_SR); /* clear irq */
ctrl_outw(0x002a, IRQ_MODE); /* set irq type */
for (i = 0; i < SE7724_FPGA_IRQ_NR; i++)
set_irq_chip_and_handler_name(SE7724_FPGA_IRQ_BASE + i,
&se7724_irq_chip,
handle_level_irq, "level");
set_irq_chained_handler(IRQ0_IRQ, se7724_irq_demux);
set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
set_irq_chained_handler(IRQ1_IRQ, se7724_irq_demux);
set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
set_irq_chained_handler(IRQ2_IRQ, se7724_irq_demux);
set_irq_type(IRQ2_IRQ, IRQ_TYPE_LEVEL_LOW);
}
This diff is collapsed.
...@@ -7,3 +7,4 @@ obj-$(CONFIG_SH_7751_SOLUTION_ENGINE) += 7751/ ...@@ -7,3 +7,4 @@ obj-$(CONFIG_SH_7751_SOLUTION_ENGINE) += 7751/
obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += 7780/ obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += 7780/
obj-$(CONFIG_SH_7343_SOLUTION_ENGINE) += 7343/ obj-$(CONFIG_SH_7343_SOLUTION_ENGINE) += 7343/
obj-$(CONFIG_SH_7721_SOLUTION_ENGINE) += 7721/ obj-$(CONFIG_SH_7721_SOLUTION_ENGINE) += 7721/
obj-$(CONFIG_SH_7724_SOLUTION_ENGINE) += 7724/
This diff is collapsed.
#ifndef __ASM_SH_SE7724_H
#define __ASM_SH_SE7724_H
/*
* linux/include/asm-sh/se7724.h
*
* Copyright (C) 2009 Renesas Solutions Corp.
*
* Kuninori Morimoto <morimoto.kuninori@renesas.com>
*
* Hitachi UL SolutionEngine 7724 Support.
*
* Based on se7722.h
* Copyright (C) 2007 Nobuhiro Iwamatsu
*
* 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 <asm/addrspace.h>
#define PA_LED (0xba203000) /* 8bit LED */
#define IRQ_MODE (0xba200010)
#define IRQ0_SR (0xba200014)
#define IRQ1_SR (0xba200018)
#define IRQ2_SR (0xba20001c)
#define IRQ0_MR (0xba200020)
#define IRQ1_MR (0xba200024)
#define IRQ2_MR (0xba200028)
/* IRQ */
#define IRQ0_IRQ 32
#define IRQ1_IRQ 33
#define IRQ2_IRQ 34
/* Bits in IRQ012 registers */
#define SE7724_FPGA_IRQ_BASE 220
/* IRQ0 */
#define IRQ0_BASE SE7724_FPGA_IRQ_BASE
#define IRQ0_KEY (IRQ0_BASE + 12)
#define IRQ0_RMII (IRQ0_BASE + 13)
#define IRQ0_SMC (IRQ0_BASE + 14)
#define IRQ0_MASK 0x7fff
#define IRQ0_END IRQ0_SMC
/* IRQ1 */
#define IRQ1_BASE (IRQ0_END + 1)
#define IRQ1_TS (IRQ1_BASE + 0)
#define IRQ1_MASK 0x0001
#define IRQ1_END IRQ1_TS
/* IRQ2 */
#define IRQ2_BASE (IRQ1_END + 1)
#define IRQ2_USB0 (IRQ1_BASE + 0)
#define IRQ2_USB1 (IRQ1_BASE + 1)
#define IRQ2_MASK 0x0003
#define IRQ2_END IRQ2_USB1
#define SE7724_FPGA_IRQ_NR (IRQ2_END - IRQ0_BASE)
/* arch/sh/boards/se/7724/irq.c */
void init_se7724_IRQ(void);
#define __IO_PREFIX se7724
#include <asm/io_generic.h>
#endif /* __ASM_SH_SE7724_H */
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