Skip to content

Commit

Permalink
[ARM] tegra: initial tegra support
Browse files Browse the repository at this point in the history
v2: Fixes from Mike Rapoport
	- remove unused header files (mach/dma.h and mach/nand.h)
	- remove tegra 1 references from Makefile.boot

v2: fixes from Russell King
	- remove mach/io.h include from mach/iomap.h
	- fix whitespace in Kconfig

v2: from Colin Cross
	- fix invalid immediate in debug-macro.S

v3:
	- allow selection of multiple boards

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Erik Gilling <konkers@android.com>
  • Loading branch information
Erik Gilling committed Aug 5, 2010
1 parent cdd854b commit c5f8006
Show file tree
Hide file tree
Showing 20 changed files with 923 additions and 1 deletion.
13 changes: 13 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,17 @@ config ARCH_NUC93X
Support for Nuvoton (Winbond logic dept.) NUC93X MCU,The NUC93X is a
low-power and high performance MPEG-4/JPEG multimedia controller chip.

config ARCH_TEGRA
bool "NVIDIA Tegra"
select GENERIC_TIME
select GENERIC_CLOCKEVENTS
select GENERIC_GPIO
select HAVE_CLK
select ARCH_HAS_BARRIERS if CACHE_L2X0
help
This enables support for NVIDIA Tegra based systems (Tegra APX,
Tegra 6xx and Tegra 2 series).

config ARCH_PNX4008
bool "Philips Nexperia PNX4008 Mobile"
select CPU_ARM926T
Expand Down Expand Up @@ -911,6 +922,8 @@ source "arch/arm/mach-shmobile/Kconfig"

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

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

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

source "arch/arm/mach-ux500/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ machine-$(CONFIG_ARCH_SHARK) := shark
machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
machine-$(CONFIG_ARCH_STMP378X) := stmp378x
machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx
machine-$(CONFIG_ARCH_TEGRA) := tegra
machine-$(CONFIG_ARCH_U300) := u300
machine-$(CONFIG_ARCH_U8500) := ux500
machine-$(CONFIG_ARCH_VERSATILE) := versatile
Expand Down
49 changes: 49 additions & 0 deletions arch/arm/mach-tegra/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
if ARCH_TEGRA

comment "NVIDIA Tegra options"

choice
prompt "Select Tegra processor family for target system"

config ARCH_TEGRA_2x_SOC
bool "Tegra 2 family"
select CPU_V7
select ARM_GIC
help
Support for NVIDIA Tegra AP20 and T20 processors, based on the
ARM CortexA9MP CPU and the ARM PL310 L2 cache controller

endchoice

comment "Tegra board type"

config MACH_HARMONY
bool "Harmony board"
help
Support for nVidia Harmony development platform

choice
prompt "Low-level debug console UART"
default TEGRA_DEBUG_UART_NONE

config TEGRA_DEBUG_UART_NONE
bool "None"

config TEGRA_DEBUG_UARTA
bool "UART-A"

config TEGRA_DEBUG_UARTB
bool "UART-B"

config TEGRA_DEBUG_UARTC
bool "UART-C"

config TEGRA_DEBUG_UARTD
bool "UART-D"

config TEGRA_DEBUG_UARTE
bool "UART-E"

endchoice

endif
2 changes: 2 additions & 0 deletions arch/arm/mach-tegra/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj-y += common.o
obj-y += io.o
3 changes: 3 additions & 0 deletions arch/arm/mach-tegra/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000
params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
32 changes: 32 additions & 0 deletions arch/arm/mach-tegra/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* arch/arm/mach-tegra/board.h
*
* Copyright (C) 2010 Google, Inc.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#ifndef __MACH_TEGRA_BOARD_H
#define __MACH_TEGRA_BOARD_H

#include <linux/types.h>

void __init tegra_common_init(void);
void __init tegra_map_common_io(void);
void __init tegra_init_irq(void);
void __init tegra_init_clock(void);

extern struct sys_timer tegra_timer;
#endif
44 changes: 44 additions & 0 deletions arch/arm/mach-tegra/common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* arch/arm/mach-tegra/board-harmony.c
*
* Copyright (C) 2010 Google, Inc.
*
* Author:
* Colin Cross <ccross@android.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#include <linux/init.h>
#include <linux/io.h>

#include <asm/hardware/cache-l2x0.h>

#include <mach/iomap.h>

#include "board.h"

void __init tegra_init_cache(void)
{
#ifdef CONFIG_CACHE_L2X0
void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;

writel(0x331, p + L2X0_TAG_LATENCY_CTRL);
writel(0x441, p + L2X0_DATA_LATENCY_CTRL);

l2x0_init(p, 0x6C080001, 0x8200c3fe);
#endif
}

void __init tegra_common_init(void)
{
tegra_init_cache();
}
30 changes: 30 additions & 0 deletions arch/arm/mach-tegra/include/mach/barriers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* arch/arm/mach-realview/include/mach/barriers.h
*
* Copyright (C) 2010 ARM Ltd.
* Written by Catalin Marinas <catalin.marinas@arm.com>
*
* 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.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef __MACH_BARRIERS_H
#define __MACH_BARRIERS_H

#include <asm/outercache.h>

#define rmb() dmb()
#define wmb() do { dsb(); outer_sync(); } while (0)
#define mb() wmb()

#endif /* __MACH_BARRIERS_H */
46 changes: 46 additions & 0 deletions arch/arm/mach-tegra/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* arch/arm/mach-tegra/include/mach/debug-macro.S
*
* Copyright (C) 2010 Google, Inc.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#include <mach/io.h>

.macro addruart,rx, tmp
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?
ldreq \rx, =IO_APB_PHYS @ physical
ldrne \rx, =IO_APB_VIRT @ virtual
#if defined(CONFIG_TEGRA_DEBUG_UART_NONE)
#error "A debug UART must be selected in the kernel config to use DEBUG_LL"
#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
orr \rx, \rx, #0x6000
#elif defined(CONFIG_TEGRA_DEBUG_UARTB)
ldr \tmp, =0x6040
orr \rx, \rx, \tmp
#elif defined(CONFIG_TEGRA_DEBUG_UARTC)
orr \rx, \rx, #0x6200
#elif defined(CONFIG_TEGRA_DEBUG_UARTD)
orr \rx, \rx, #0x6300
#elif defined(CONFIG_TEGRA_DEBUG_UARTE)
orr \rx, \rx, #0x6400
#endif
.endm

#define UART_SHIFT 2
#include <asm/hardware/debug-8250.S>

118 changes: 118 additions & 0 deletions arch/arm/mach-tegra/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* arch/arm/mach-tegra/include/mach/entry-macro.S
*
* Copyright (C) 2009 Palm, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/
#include <mach/iomap.h>
#include <mach/io.h>

#if defined(CONFIG_ARM_GIC)

#include <asm/hardware/gic.h>

/* Uses the GIC interrupt controller built into the cpu */
#define ICTRL_BASE (IO_CPU_VIRT + 0x100)

.macro disable_fiq
.endm

.macro get_irqnr_preamble, base, tmp
movw \base, #(ICTRL_BASE & 0x0000ffff)
movt \base, #((ICTRL_BASE & 0xffff0000) >> 16)
.endm

.macro arch_ret_to_user, tmp1, tmp2
.endm

/*
* The interrupt numbering scheme is defined in the
* interrupt controller spec. To wit:
*
* Interrupts 0-15 are IPI
* 16-28 are reserved
* 29-31 are local. We allow 30 to be used for the watchdog.
* 32-1020 are global
* 1021-1022 are reserved
* 1023 is "spurious" (no interrupt)
*
* For now, we ignore all local interrupts so only return an interrupt
* if it's between 30 and 1020. The test_for_ipi routine below will
* pick up on IPIs.
*
* A simple read from the controller will tell us the number of the
* highest priority enabled interrupt. We then just need to check
* whether it is in the valid range for an IRQ (30-1020 inclusive).
*/

.macro get_irqnr_and_base, irqnr, irqstat, base, tmp

/* bits 12-10 = src CPU, 9-0 = int # */
ldr \irqstat, [\base, #GIC_CPU_INTACK]

ldr \tmp, =1021

bic \irqnr, \irqstat, #0x1c00

cmp \irqnr, #29
cmpcc \irqnr, \irqnr
cmpne \irqnr, \tmp
cmpcs \irqnr, \irqnr

.endm

/* We assume that irqstat (the raw value of the IRQ acknowledge
* register) is preserved from the macro above.
* If there is an IPI, we immediately signal end of interrupt on the
* controller, since this requires the original irqstat value which
* we won't easily be able to recreate later.
*/

.macro test_for_ipi, irqnr, irqstat, base, tmp
bic \irqnr, \irqstat, #0x1c00
cmp \irqnr, #16
strcc \irqstat, [\base, #GIC_CPU_EOI]
cmpcs \irqnr, \irqnr
.endm

/* As above, this assumes that irqstat and base are preserved.. */

.macro test_for_ltirq, irqnr, irqstat, base, tmp
bic \irqnr, \irqstat, #0x1c00
mov \tmp, #0
cmp \irqnr, #29
moveq \tmp, #1
streq \irqstat, [\base, #GIC_CPU_EOI]
cmp \tmp, #0
.endm

#else
/* legacy interrupt controller for AP16 */
.macro disable_fiq
.endm

.macro get_irqnr_preamble, base, tmp
@ enable imprecise aborts
cpsie a
@ EVP base at 0xf010f000
mov \base, #0xf0000000
orr \base, #0x00100000
orr \base, #0x0000f000
.endm

.macro arch_ret_to_user, tmp1, tmp2
.endm

.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
ldr \irqnr, [\base, #0x20] @ EVT_IRQ_STS
cmp \irqnr, #0x80
.endm
#endif
24 changes: 24 additions & 0 deletions arch/arm/mach-tegra/include/mach/hardware.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* arch/arm/mach-tegra/include/mach/hardware.h
*
* Copyright (C) 2010 Google, Inc.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#ifndef __MACH_TEGRA_HARDWARE_H
#define __MACH_TEGRA_HARDWARE_H

#endif
Loading

0 comments on commit c5f8006

Please sign in to comment.