Skip to content

Commit

Permalink
ARM: mach-shmobile: SH-Mobile G3 support.
Browse files Browse the repository at this point in the history
This adds preliminary support for the SH-Mobile G-series.

The SH-Mobile G-series is a series of ARM/SH multi-core CPUs that aside
from the ARM MPU are primarily composed of existing SH IP blocks.

This includes initial support for the SH7367 (SH-Mobile G3) CPU and
the G3EVM reference board.

Only timer, serial console, and NOR flash are supported at this point.
Patches for the interrupt controller, pinmux support, clock framework
and runtime pm will be submitted as feature patches on top of this.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Feb 8, 2010
1 parent 9e9622d commit c793c1b
Show file tree
Hide file tree
Showing 22 changed files with 724 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,11 @@ config ARCH_MSM
interface to the ARM9 modem processor which runs the baseband stack
and controls some vital subsystems (clock and power control, etc).

config ARCH_SHMOBILE
bool "Renesas SH-Mobile"
help
Support for Renesas's SH-Mobile ARM platforms

config ARCH_RPC
bool "RiscPC"
select ARCH_ACORN
Expand Down Expand Up @@ -822,6 +827,8 @@ source "arch/arm/mach-s3c6400/Kconfig"
source "arch/arm/mach-s3c6410/Kconfig"
endif

source "arch/arm/mach-shmobile/Kconfig"

source "arch/arm/plat-stmp3xxx/Kconfig"

if ARCH_S5PC1XX
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ machine-$(CONFIG_ARCH_S3C64XX) := s3c6400 s3c6410
machine-$(CONFIG_ARCH_S5PC1XX) := s5pc100
machine-$(CONFIG_ARCH_SA1100) := sa1100
machine-$(CONFIG_ARCH_SHARK) := shark
machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
machine-$(CONFIG_ARCH_STMP378X) := stmp378x
machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
machine-$(CONFIG_ARCH_U300) := u300
Expand Down
53 changes: 53 additions & 0 deletions arch/arm/mach-shmobile/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
if ARCH_SHMOBILE

comment "SH-Mobile System Type"

config ARCH_SH7367
bool "SH-Mobile G3 (SH7367)"
select CPU_V6
select HAVE_CLK
select COMMON_CLKDEV
select GENERIC_TIME
select GENERIC_CLOCKEVENTS

comment "SH-Mobile Board Type"

config MACH_G3EVM
bool "G3EVM board"
depends on ARCH_SH7367

comment "SH-Mobile System Configuration"

menu "Memory configuration"

config MEMORY_START
hex "Physical memory start address"
default "0x50000000" if MACH_G3EVM
default "0x00000000"
---help---
Tweak this only when porting to a new machine which does not
already have a defconfig. Changing it from the known correct
value on any of the known systems will only lead to disaster.

config MEMORY_SIZE
hex "Physical memory size"
default "0x08000000" if MACH_G3EVM
default "0x04000000"
help
This sets the default memory size assumed by your kernel. It can
be overridden as normal by the 'mem=' argument on the kernel command
line.

endmenu

menu "Timer and clock configuration"

config SH_TIMER_CMT
bool "CMT timer driver"
default y
help
This enables build of the CMT timer driver.

endmenu

endif
12 changes: 12 additions & 0 deletions arch/arm/mach-shmobile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Makefile for the linux kernel.
#

# Common objects
obj-y := timer.o

# CPU objects
obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o

# Board objects
obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o
9 changes: 9 additions & 0 deletions arch/arm/mach-shmobile/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \
$$[$(CONFIG_MEMORY_START) + 0x8000]')

zreladdr-y := $(__ZRELADDR)

# Unsupported legacy stuff
#
#params_phys-y (Instead: Pass atags pointer in r2)
#initrd_phys-y (Instead: Use compiled-in initramfs)
127 changes: 127 additions & 0 deletions arch/arm/mach-shmobile/board-g3evm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* G3EVM board support
*
* Copyright (C) 2010 Magnus Damm
* Copyright (C) 2008 Yoshihiro Shimoda
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/io.h>
#include <mach/common.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>

static struct mtd_partition nor_flash_partitions[] = {
{
.name = "loader",
.offset = 0x00000000,
.size = 512 * 1024,
},
{
.name = "bootenv",
.offset = MTDPART_OFS_APPEND,
.size = 512 * 1024,
},
{
.name = "kernel_ro",
.offset = MTDPART_OFS_APPEND,
.size = 8 * 1024 * 1024,
.mask_flags = MTD_WRITEABLE,
},
{
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = 8 * 1024 * 1024,
},
{
.name = "data",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
},
};

static struct physmap_flash_data nor_flash_data = {
.width = 2,
.parts = nor_flash_partitions,
.nr_parts = ARRAY_SIZE(nor_flash_partitions),
};

static struct resource nor_flash_resources[] = {
[0] = {
.start = 0x00000000,
.end = 0x08000000 - 1,
.flags = IORESOURCE_MEM,
}
};

static struct platform_device nor_flash_device = {
.name = "physmap-flash",
.dev = {
.platform_data = &nor_flash_data,
},
.num_resources = ARRAY_SIZE(nor_flash_resources),
.resource = nor_flash_resources,
};


static struct platform_device *g3evm_devices[] __initdata = {
&nor_flash_device,
};

static struct map_desc g3evm_io_desc[] __initdata = {
/* create a 1:1 entity map for 0xe6xxxxxx
* used by CPGA, INTC and PFC.
*/
{
.virtual = 0xe6000000,
.pfn = __phys_to_pfn(0xe6000000),
.length = 256 << 20,
.type = MT_DEVICE_NONSHARED
},
};

static void __init g3evm_map_io(void)
{
iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));

/* setup early devices and clocks here as well */
sh7367_add_early_devices();
sh7367_clock_init();
}

static void __init g3evm_init(void)
{
sh7367_add_standard_devices();

platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
}

MACHINE_START(G3EVM, "g3evm")
.phys_io = 0xe6000000,
.io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
.map_io = g3evm_map_io,
.init_irq = sh7367_init_irq,
.init_machine = g3evm_init,
.timer = &shmobile_timer,
MACHINE_END
89 changes: 89 additions & 0 deletions arch/arm/mach-shmobile/clock-sh7367.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Preliminary clock framework support for sh7367
*
* Copyright (C) 2010 Magnus Damm
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/clk.h>

struct clk {
const char *name;
unsigned long rate;
};

#include <asm/clkdev.h>

int __clk_get(struct clk *clk)
{
return 1;
}
EXPORT_SYMBOL(__clk_get);

void __clk_put(struct clk *clk)
{
}
EXPORT_SYMBOL(__clk_put);


int clk_enable(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_enable);

void clk_disable(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_disable);

unsigned long clk_get_rate(struct clk *clk)
{
return clk ? clk->rate : 0;
}
EXPORT_SYMBOL(clk_get_rate);

/* a static peripheral clock for now - enough to get sh-sci working */
static struct clk peripheral_clk = {
.name = "peripheral_clk",
.rate = 48000000,
};

/* a static rclk for now - enough to get sh_cmt working */
static struct clk r_clk = {
.name = "r_clk",
.rate = 32768,
};

static struct clk_lookup lookups[] = {
{
.clk = &peripheral_clk,
}, {
.clk = &r_clk,
}
};

void __init sh7367_clock_init(void)
{
int i;

for (i = 0; i < ARRAY_SIZE(lookups); i++) {
lookups[i].con_id = lookups[i].clk->name;
clkdev_add(&lookups[i]);
}
}
7 changes: 7 additions & 0 deletions arch/arm/mach-shmobile/include/mach/clkdev.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H

int __clk_get(struct clk *clk);
void __clk_put(struct clk *clk);

#endif /* __ASM_MACH_CLKDEV_H */
11 changes: 11 additions & 0 deletions arch/arm/mach-shmobile/include/mach/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef __ARCH_MACH_COMMON_H
#define __ARCH_MACH_COMMON_H

extern struct sys_timer shmobile_timer;

extern void sh7367_init_irq(void);
extern void sh7367_add_early_devices(void);
extern void sh7367_add_standard_devices(void);
extern void sh7367_clock_init(void);

#endif /* __ARCH_MACH_COMMON_H */
1 change: 1 addition & 0 deletions arch/arm/mach-shmobile/include/mach/dma.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* empty */
39 changes: 39 additions & 0 deletions arch/arm/mach-shmobile/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2008 Renesas Solutions Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <mach/hardware.h>
#include <mach/irqs.h>

.macro disable_fiq
.endm

.macro get_irqnr_preamble, base, tmp
.endm

.macro arch_ret_to_user, tmp1, tmp2
.endm

.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
ldr \base, =INTFLGA
ldr \irqnr, [\base]
cmp \irqnr, #0
beq 1000f
/* intevt to irq number */
lsr \irqnr, \irqnr, #0x5
subs \irqnr, \irqnr, #16

1000:
.endm
1 change: 1 addition & 0 deletions arch/arm/mach-shmobile/include/mach/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* empty */
7 changes: 7 additions & 0 deletions arch/arm/mach-shmobile/include/mach/hardware.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __ASM_MACH_HARDWARE_H
#define __ASM_MACH_HARDWARE_H

/* INTFLGA register - used by low level interrupt code in entry-macro.S */
#define INTFLGA 0xe6980018

#endif /* __ASM_MACH_HARDWARE_H */
Loading

0 comments on commit c793c1b

Please sign in to comment.