Skip to content

Commit

Permalink
ARM: mach-shmobile: SH-Mobile AP4 support.
Browse files Browse the repository at this point in the history
This adds preliminary support for the SH7372 (SH-Mobile AP4) CPU and
the AP4EVB reference board.

Only timer, serial console and NOR flash are supported at this point.
Support 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 f2aaf66 commit 2b7eda6
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arch/arm/mach-shmobile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ config ARCH_SH7377
select GENERIC_TIME
select GENERIC_CLOCKEVENTS

config ARCH_SH7372
bool "SH-Mobile AP4 (SH7372)"
select CPU_V7
select HAVE_CLK
select COMMON_CLKDEV
select GENERIC_TIME
select GENERIC_CLOCKEVENTS

comment "SH-Mobile Board Type"

config MACH_G3EVM
Expand All @@ -28,6 +36,10 @@ config MACH_G4EVM
bool "G4EVM board"
depends on ARCH_SH7377

config MACH_AP4EVB
bool "AP4EVB board"
depends on ARCH_SH7372

comment "SH-Mobile System Configuration"

menu "Memory configuration"
Expand All @@ -36,6 +48,7 @@ config MEMORY_START
hex "Physical memory start address"
default "0x50000000" if MACH_G3EVM
default "0x40000000" if MACH_G4EVM
default "0x40000000" if MACH_AP4EVB
default "0x00000000"
---help---
Tweak this only when porting to a new machine which does not
Expand All @@ -46,6 +59,7 @@ config MEMORY_SIZE
hex "Physical memory size"
default "0x08000000" if MACH_G3EVM
default "0x08000000" if MACH_G4EVM
default "0x10000000" if MACH_AP4EVB
default "0x04000000"
help
This sets the default memory size assumed by your kernel. It can
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-shmobile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ obj-y := timer.o
# CPU objects
obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o
obj-$(CONFIG_ARCH_SH7377) += setup-sh7377.o clock-sh7367.o
obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7367.o

# Board objects
obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o
obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o
obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o
127 changes: 127 additions & 0 deletions arch/arm/mach-shmobile/board-ap4evb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* AP4EVB 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 *ap4evb_devices[] __initdata = {
&nor_flash_device,
};

static struct map_desc ap4evb_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 ap4evb_map_io(void)
{
iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));

/* setup early devices and clocks here as well */
sh7372_add_early_devices();
sh7367_clock_init(); /* use g3 clocks for now */
}

static void __init ap4evb_init(void)
{
sh7372_add_standard_devices();

platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
}

MACHINE_START(AP4EVB, "ap4evb")
.phys_io = 0xe6000000,
.io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
.map_io = ap4evb_map_io,
.init_irq = sh7372_init_irq,
.init_machine = ap4evb_init,
.timer = &shmobile_timer,
MACHINE_END
4 changes: 4 additions & 0 deletions arch/arm/mach-shmobile/include/mach/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ extern void sh7377_init_irq(void);
extern void sh7377_add_early_devices(void);
extern void sh7377_add_standard_devices(void);

extern void sh7372_init_irq(void);
extern void sh7372_add_early_devices(void);
extern void sh7372_add_standard_devices(void);

#endif /* __ARCH_MACH_COMMON_H */
Loading

0 comments on commit 2b7eda6

Please sign in to comment.