Skip to content

Commit

Permalink
ARM: Add Gemini architecture v3
Browse files Browse the repository at this point in the history
Adds support for Cortina Systems Gemini family CPUs:
http://www.cortina-systems.com/products/category/18

v3:
- fixed __io(a) to be defined as __typesafe_io(a)

v2:
- #include <asm/io.h> -> <linux/io.h>
- remove asm/system.h include
- revorked mm.c to use named initializers
- removed "empty" dma.h
- updated copyrights

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  • Loading branch information
Paulius Zaleckas committed Mar 26, 2009
1 parent 6a915af commit 59d3a19
Show file tree
Hide file tree
Showing 21 changed files with 1,033 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ config ARCH_EP93XX
help
This enables support for the Cirrus EP93xx series of CPUs.

config ARCH_GEMINI
bool "Cortina Systems Gemini"
select CPU_FA526
help
Support for the Cortina Systems Gemini family SoCs

config ARCH_FOOTBRIDGE
bool "FootBridge"
select CPU_SA110
Expand Down Expand Up @@ -598,6 +604,8 @@ source "arch/arm/mach-ep93xx/Kconfig"

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

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

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

source "arch/arm/mach-iop32x/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ endif
machine-$(CONFIG_ARCH_PXA) := pxa
machine-$(CONFIG_ARCH_L7200) := l7200
machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
machine-$(CONFIG_ARCH_GEMINI) := gemini
textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
machine-$(CONFIG_ARCH_CLPS711X) := clps711x
machine-$(CONFIG_ARCH_IOP32X) := iop32x
Expand Down
12 changes: 12 additions & 0 deletions arch/arm/mach-gemini/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if ARCH_GEMINI

menu "Cortina Systems Gemini Implementations"

endmenu

config GEMINI_MEM_SWAP
bool "Gemini memory is swapped"
help
Say Y here if Gemini memory is swapped by bootloader.

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

# Object file lists.

obj-y := irq.o mm.o time.o devices.o
9 changes: 9 additions & 0 deletions arch/arm/mach-gemini/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ifeq ($(CONFIG_GEMINI_MEM_SWAP),y)
zreladdr-y := 0x00008000
params_phys-y := 0x00000100
initrd_phys-y := 0x00800000
else
zreladdr-y := 0x10008000
params_phys-y := 0x10000100
initrd_phys-y := 0x10800000
endif
27 changes: 27 additions & 0 deletions arch/arm/mach-gemini/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Common Gemini architecture functions
*
* Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
*
* 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; either version 2 of the License, or
* (at your option) any later version.
*/

#ifndef __GEMINI_COMMON_H__
#define __GEMINI_COMMON_H__

struct mtd_partition;

extern void gemini_map_io(void);
extern void gemini_init_irq(void);
extern void gemini_timer_init(void);

/* Common platform devices registration functions */
extern int platform_register_uart(void);
extern int platform_register_pflash(unsigned int size,
struct mtd_partition *parts,
unsigned int nr_parts);

#endif /* __GEMINI_COMMON_H__ */
92 changes: 92 additions & 0 deletions arch/arm/mach-gemini/devices.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* Common devices definition for Gemini
*
* Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
#include <linux/mtd/physmap.h>

#include <mach/irqs.h>
#include <mach/hardware.h>
#include <mach/global_reg.h>

static struct plat_serial8250_port serial_platform_data[] = {
{
.membase = (void *)IO_ADDRESS(GEMINI_UART_BASE),
.mapbase = GEMINI_UART_BASE,
.irq = IRQ_UART,
.uartclk = UART_CLK,
.regshift = 2,
.iotype = UPIO_MEM,
.type = PORT_16550A,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_FIXED_TYPE,
},
{},
};

static struct platform_device serial_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = serial_platform_data,
},
};

int platform_register_uart(void)
{
return platform_device_register(&serial_device);
}

static struct resource flash_resource = {
.start = GEMINI_FLASH_BASE,
.flags = IORESOURCE_MEM,
};

static struct physmap_flash_data pflash_platform_data = {};

static struct platform_device pflash_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &pflash_platform_data,
},
.resource = &flash_resource,
.num_resources = 1,
};

int platform_register_pflash(unsigned int size, struct mtd_partition *parts,
unsigned int nr_parts)
{
unsigned int reg;

reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_STATUS);

if ((reg & FLASH_TYPE_MASK) != FLASH_TYPE_PARALLEL)
return -ENXIO;

if (reg & FLASH_WIDTH_16BIT)
pflash_platform_data.width = 2;
else
pflash_platform_data.width = 1;

/* enable parallel flash pins and disable others */
reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
reg &= ~PFLASH_PADS_DISABLE;
reg |= SFLASH_PADS_DISABLE | NAND_PADS_DISABLE;
__raw_writel(reg, IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);

flash_resource.end = flash_resource.start + size - 1;

pflash_platform_data.parts = parts;
pflash_platform_data.nr_parts = nr_parts;

return platform_device_register(&pflash_device);
}
23 changes: 23 additions & 0 deletions arch/arm/mach-gemini/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Debugging macro include header
*
* Copyright (C) 1994-1999 Russell King
* Copyright (C) 2001-2006 Storlink, Corp.
* Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <mach/hardware.h>

.macro addruart,rx
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?
ldreq \rx, =GEMINI_UART_BASE @ physical
ldrne \rx, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
.endm

#define UART_SHIFT 2
#define FLOW_CONTROL
#include <asm/hardware/debug-8250.S>
39 changes: 39 additions & 0 deletions arch/arm/mach-gemini/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Low-level IRQ helper macros for Gemini platform.
*
* Copyright (C) 2001-2006 Storlink, Corp.
* Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <mach/hardware.h>

#define IRQ_STATUS 0x14

.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 \irqstat, =IO_ADDRESS(GEMINI_INTERRUPT_BASE + IRQ_STATUS)
ldr \irqnr, [\irqstat]
cmp \irqnr, #0
beq 2313f
mov \tmp, \irqnr
mov \irqnr, #0
2312:
tst \tmp, #1
bne 2313f
add \irqnr, \irqnr, #1
mov \tmp, \tmp, lsr #1
cmp \irqnr, #31
bcc 2312b
2313:
.endm
Loading

0 comments on commit 59d3a19

Please sign in to comment.