Skip to contentSkip to conversation

Support for NXP LPC2K SoCs

PATCH Superseded Ithamar R. Adema 2 participants 13 messages Mar 29, 2011 – Apr 4, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover Support for NXP LPC2K SoCs

The following patch series implements support for the ARM7TDMI-S based NXP LPC2K System-on-Chips, and, as first board, the EmbeddedArtists LPC2478 Developer's Kit.

This code will work on the LPC23XX and LPC24XX ranges of chips, but will need some more work for LPC21XX and LPC22XX chips.
---
v4 incorporates comments from Kevin Wells. Also included is a NOMMU patch taken from http://lkml.org/lkml/2011/3/25/430 which is just included to keep this patch set buildable.

v3 incorporates comments from Russell King and Kevin Wells.

v2 incorporates comments from Kevin Wells, Jamie Iles, and Uwe Kleine-K?nig.

#1 lore raw

PATCH v4 1/10 lpc2k: Core support

Core files (including IRQ handling) for NXP LPC2K architecture.

---
no changes since v3.

changes since v2:
* Removed GENERIC_TIME from selects.

changes since v1:
* implement arch_idle() using PCON register.
* implement arch_reset() using WDT block.
* Fix PLL 'N' mask in regs-scb.h

---
 arch/arm/Kconfig                               |   13 ++++++
 arch/arm/Makefile                              |    1 +
 arch/arm/mach-lpc2k/Kconfig                    |    5 ++
 arch/arm/mach-lpc2k/Makefile                   |    1 +
 arch/arm/mach-lpc2k/Makefile.boot              |    3 +
 arch/arm/mach-lpc2k/include/mach/debug-macro.S |   19 +++++++++
 arch/arm/mach-lpc2k/include/mach/entry-macro.S |   33 +++++++++++++++
 arch/arm/mach-lpc2k/include/mach/hardware.h    |   25 ++++++++++++
 arch/arm/mach-lpc2k/include/mach/io.h          |   18 ++++++++
 arch/arm/mach-lpc2k/include/mach/irqs.h        |   49 +++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/memory.h      |   15 +++++++
 arch/arm/mach-lpc2k/include/mach/regs-scb.h    |   42 +++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/regs-wdt.h    |   26 ++++++++++++
 arch/arm/mach-lpc2k/include/mach/system.h      |   51 ++++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/timex.h       |   15 +++++++
 arch/arm/mach-lpc2k/include/mach/uncompress.h  |   50 +++++++++++++++++++++++
 arch/arm/mach-lpc2k/irq.c                      |   17 ++++++++
 17 files changed, 383 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/Kconfig
 create mode 100644 arch/arm/mach-lpc2k/Makefile
 create mode 100644 arch/arm/mach-lpc2k/Makefile.boot
 create mode 100644 arch/arm/mach-lpc2k/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-lpc2k/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-lpc2k/include/mach/hardware.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/io.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/irqs.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/memory.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/regs-scb.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/regs-wdt.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/system.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/timex.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-lpc2k/irq.c
arch/arm/Kconfig +13 -0
index efe06e0..1ff6e18 100644
@@ -493,6 +493,17 @@ config ARCH_LOKI
 	help
 	  Support for the Marvell Loki (88RC8480) SoC.
 
+config ARCH_LPC2K
+	bool "NXP LPC2K Family"
+	depends on !MMU
+	select CPU_ARM7TDMI
+	select ARM_VIC
+	select GENERIC_CLOCKEVENTS
+	help
+	  Support for NXP LPC2K family of SoCs. These SoCs are based on
+	  an ARM7TDMI-S core, and have optional on-chip flash and SRAM,
+	  also UART, I2C, SPI, SSP, CAN, RTC, and other peripherals.
+
 config ARCH_LPC32XX
 	bool "NXP LPC32XX"
 	select CPU_ARM926T
@@ -934,6 +945,8 @@ source "arch/arm/mach-ks8695/Kconfig"
 
 source "arch/arm/mach-loki/Kconfig"
 
+source "arch/arm/mach-lpc2k/Kconfig"
+
 source "arch/arm/mach-lpc32xx/Kconfig"
 
 source "arch/arm/mach-msm/Kconfig"
arch/arm/Makefile +1 -0
index c7d321a..9bf8421 100644
@@ -151,6 +151,7 @@ machine-$(CONFIG_ARCH_IXP4XX)		:= ixp4xx
 machine-$(CONFIG_ARCH_KIRKWOOD)		:= kirkwood
 machine-$(CONFIG_ARCH_KS8695)		:= ks8695
 machine-$(CONFIG_ARCH_LOKI) 		:= loki
+machine-$(CONFIG_ARCH_LPC2K)		:= lpc2k
 machine-$(CONFIG_ARCH_LPC32XX)		:= lpc32xx
 machine-$(CONFIG_ARCH_MMP)		:= mmp
 machine-$(CONFIG_ARCH_MSM)		:= msm
arch/arm/mach-lpc2k/Kconfig new file +5 -0
new file mode 100644
index 0000000..fad47b8
@@ -0,0 +1,5 @@
+if ARCH_LPC2K
+
+comment "LPC2K machines"
+
+endif
arch/arm/mach-lpc2k/Makefile new file +1 -0
new file mode 100644
index 0000000..546666b
@@ -0,0 +1 @@
+obj-y	:= irq.o
arch/arm/mach-lpc2k/Makefile.boot new file +3 -0
new file mode 100644
index 0000000..8b6b745
@@ -0,0 +1,3 @@
+   zreladdr-y	:= 0xa0008000
+params_phys-y	:= 0xa0000100
+initrd_phys-y	:= 0xa1800000
arch/arm/mach-lpc2k/include/mach/debug-macro.S new file +19 -0
new file mode 100644
index 0000000..0f581d3
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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, rp, rv
+	ldr	\rp, =APB_UART0_BASE
+	ldr	\rv, =APB_UART0_BASE
+	.endm
+
+#define UART_SHIFT	2
+#include <asm/hardware/debug-8250.S>
arch/arm/mach-lpc2k/include/mach/entry-macro.S new file +33 -0
new file mode 100644
index 0000000..f6c7a46
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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  disable_fiq
+        .endm
+
+		.macro	get_irqnr_preamble, base, tmp
+		ldr	\base, =APH_VIC_BASE
+		.endm
+
+		.macro	arch_ret_to_user, tmp1, tmp2
+		.endm
+
+		.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
+		ldr	\irqstat, [\base, #0]
+		mov     \irqnr, #0
+1001:
+		tst     \irqstat, #1
+		bne     1002f
+		add     \irqnr, \irqnr, #1
+		mov     \irqstat, \irqstat, lsr #1
+		cmp     \irqnr, #32
+		bcc     1001b
+1002:
+		.endm
arch/arm/mach-lpc2k/include/mach/hardware.h new file +25 -0
new file mode 100644
index 0000000..3463b47
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef MACH_LPC2K_HARDWARE_H
+#define MACH_LPC2K_HARDWARE_H
+
+#include <asm/sizes.h>
+
+/* Default memory size if no ATAGS found */
+#define MEM_SIZE	(SZ_32M)
+
+#define APB_WDT_BASE		0xe0000000
+#define APB_TIMER0_BASE		0xe0004000
+#define APB_TIMER1_BASE		0xe0008000
+#define APB_UART0_BASE		0xe000c000
+#define APB_SCB_BASE		0xe01fc000
+#define APH_VIC_BASE		0xfffff000
+
+#endif /* MACH_LPC2K_HARDWARE_H */
arch/arm/mach-lpc2k/include/mach/io.h new file +18 -0
new file mode 100644
index 0000000..e1a2b7f
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef MACH_LPC2K_IO_H
+#define MACH_LPC2K_IO_H
+
+#define IO_SPACE_LIMIT	0xffffffff
+
+#define __mem_pci(a)	(a)
+#define __io(a)		__typesafe_io(a)
+
+#endif /* MACH_LPC2K_IO_H */
arch/arm/mach-lpc2k/include/mach/irqs.h new file +49 -0

49 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/memory.h new file +15 -0
new file mode 100644
index 0000000..6432147
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef MACH_LPC2K_MEMORY_H
+#define MACH_LPC2K_MEMORY_H
+
+#define PHYS_OFFSET	0xa0000000
+
+#endif /* MACH_LPC2K_MEMORY_H */
arch/arm/mach-lpc2k/include/mach/regs-scb.h new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/regs-wdt.h new file +26 -0
new file mode 100644
index 0000000..eb6ab91
@@ -0,0 +1,26 @@
+/*
+ * Watchdog Timer register definitions
+ *
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef MACH_LPC2K_REGS_WDT_H
+#define MACH_LPC2K_REGS_WDT_H
+
+#define WDMOD		0x0000
+#define WDTC		0x0004
+#define WDFEED		0x0008
+#define WDTV		0x000a
+#define WDCLKSEL	0x0010
+
+#define WDMOD_WDEN	(1 << 0)
+#define WDMOD_WDRESET	(1 << 1)
+#define WDMOD_WDTOF	(1 << 2)
+#define WDMOD_WDINT	(1 << 3)
+
+#endif /* MACH_LPC2K_REGS_WDT_H */
arch/arm/mach-lpc2k/include/mach/system.h new file +51 -0

51 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/timex.h new file +15 -0
new file mode 100644
index 0000000..ba7c8dc
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef MACH_LPC2K_TIMEX_H
+#define MACH_LPC2K_TIMEX_H
+
+#define CLOCK_TICK_RATE		(HZ * 100UL)
+
+#endif /* MACH_LPC2K_TIMEX_H */
arch/arm/mach-lpc2k/include/mach/uncompress.h new file +50 -0

50 lines not on this page · raw message

arch/arm/mach-lpc2k/irq.c new file +17 -0
new file mode 100644
index 0000000..58d291d
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2011 Team Embeded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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/module.h>
+#include <asm/hardware/vic.h>
+#include <mach/hardware.h>
+
+void __init lpc2k_init_irq(void)
+{
+	vic_init((void __iomem *)APH_VIC_BASE, 0, ~0, 0);
+}
Signature · 1 line
1.7.1
#2 lore raw

PATCH v4 2/10 lpc2k: Exception vector handling

In reply to Ithamar R. Adema

The LPC2K optionally remaps the first 64 bytes of SRAM to address 0, to facilitate writable low vectors. However, since it only remaps the first 64 bytes the stubs can't be copied there and end up too far away from the vectors, requiring the vectors to use an indirect jump instead of branch to get to the stubs.

Since now VECTOR_BASE is below PHYS_OFFSET, do not try to reserve the vector page, as it will fail (and prevent the kernel from booting).

Also, commit 247055aa (6384/1: Remove the domain switching on ARMv6k/v7 CPUs) broke the placement of vectors in the !MMU case, so fix this too.

---
no changes since v3.

changes since v2:
* reworded reason for vector branch changes.

changes since v1:
* added comment to entry-armv.S vector #ifdef.

---
 arch/arm/Kconfig             |    1 +
 arch/arm/kernel/entry-armv.S |   23 +++++++++++++++++++++++
 arch/arm/kernel/traps.c      |    2 +-
 arch/arm/mm/nommu.c          |    2 ++
 4 files changed, 27 insertions(+), 1 deletions(-)
arch/arm/Kconfig +1 -0
index 1ff6e18..c96908e 100644
@@ -186,6 +186,7 @@ config VECTORS_BASE
 	hex
 	default 0xffff0000 if MMU || CPU_HIGH_VECTOR
 	default DRAM_BASE if REMAP_VECTORS_TO_RAM
+	default 0x40000000 if ARCH_LPC2K
 	default 0x00000000
 	help
 	  The base address of exception vectors.
arch/arm/kernel/entry-armv.S +23 -0
index e8d8856..65be7b1 100644
@@ -1208,6 +1208,7 @@ __stubs_end:
 
 	.globl	__vectors_start
 __vectors_start:
+#ifndef CONFIG_ARCH_LPC2K
  ARM(	swi	SYS_ERROR0	)
  THUMB(	svc	#0		)
  THUMB(	nop			)
@@ -1218,6 +1219,28 @@ __vectors_start:
 	W(b)	vector_addrexcptn + stubs_offset
 	W(b)	vector_irq + stubs_offset
 	W(b)	vector_fiq + stubs_offset
+#else /* CONFIG_ARCH_LPC2K */
+	/*
+	 * The LPC2K remaps 64 bytes of SRAM to address 0 for vectors. This
+	 * means that the stubs can't be in the same page, and end up too far
+	 * away from the vectors to use a branch instruction.
+	 */
+	swi	SYS_ERROR0
+	ldr	pc, .vector_und
+	ldr	pc, .vector_swi
+	ldr	pc, .vector_pabt
+	ldr	pc, .vector_dabt
+	ldr	pc, .vector_addrexcptn
+	ldr	pc, .vector_irq
+	ldr	pc, .vector_fiq
+.vector_und:		.word   vector_und
+.vector_swi:		.word   vector_swi
+.vector_pabt:		.word   vector_pabt
+.vector_dabt:		.word   vector_dabt
+.vector_addrexcptn:	.word   vector_addrexcptn
+.vector_irq:		.word   vector_irq
+.vector_fiq:		.word   vector_fiq
+#endif
 
 	.globl	__vectors_end
 __vectors_end:
arch/arm/kernel/traps.c +1 -1
index f0000e1..db101fc 100644
@@ -758,7 +758,7 @@ static void __init kuser_get_tls_init(unsigned long vectors)
 
 void __init early_trap_init(void)
 {
-#if defined(CONFIG_CPU_USE_DOMAINS)
+#if defined(CONFIG_CPU_USE_DOMAINS) || !defined(CONFIG_MMU)
 	unsigned long vectors = CONFIG_VECTORS_BASE;
 #else
 	unsigned long vectors = (unsigned long)vectors_page;
arch/arm/mm/nommu.c +2 -0
index 687d023..e3bec02 100644
@@ -24,7 +24,9 @@ void __init arm_mm_memblock_reserve(void)
 	 * some architectures which the DRAM is the exception vector to trap,
 	 * alloc_page breaks with error, although it is not NULL, but "0."
 	 */
+#if PHYS_OFFSET <= CONFIG_VECTORS_BASE
 	memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
+#endif
 }
 
 /*
Signature · 1 line
1.7.1
#3 lore raw

PATCH v4 3/10 lpc2k: clk API

In reply to Ithamar R. Adema

Implements clock API using the CLKDEV_LOOKUP common code.

---
changes since v3:
* removed 'rate' field from struct clk, and implemented get_rate hook for the 3 fixed rate clocks.
* removed generation of get_rate function per peripheral clock, and introduced clk_id field in struct clk used by the new single per_get_rate function.

no changes since v2.

changes since v1:
* changed mutex into spinlock
* simplified clk_readl/clk_writel macros

---
 arch/arm/Kconfig                          |    1 +
 arch/arm/mach-lpc2k/Makefile              |    2 +-
 arch/arm/mach-lpc2k/clock.c               |  388 +++++++++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/clkdev.h |   17 ++
 4 files changed, 407 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/clock.c
 create mode 100644 arch/arm/mach-lpc2k/include/mach/clkdev.h
arch/arm/Kconfig +1 -0
index c96908e..4a399e0 100644
@@ -499,6 +499,7 @@ config ARCH_LPC2K
 	depends on !MMU
 	select CPU_ARM7TDMI
 	select ARM_VIC
+	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
 	help
 	  Support for NXP LPC2K family of SoCs. These SoCs are based on
arch/arm/mach-lpc2k/Makefile +1 -1
index 546666b..9eb0a6a 100644
@@ -1 +1 @@
-obj-y	:= irq.o
+obj-y	:= clock.o irq.o
arch/arm/mach-lpc2k/clock.c new file +388 -0

388 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/clkdev.h new file +17 -0
new file mode 100644
index 0000000..92267cc
@@ -0,0 +1,17 @@
+/*
+ *  Copyright (C) 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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 MACH_LPC2K_CLKDEV_H
+#define MACH_LPC2K_CLKDEV_H
+
+#define __clk_get(clk) ({ 1; })
+#define __clk_put(clk) do { } while (0)
+
+#endif /* MACH_LPC2K_CLKDEV_H */
Signature · 1 line
1.7.1
#4 lore raw

PATCH v4 4/10 lpc2k: generic time and clockevents

In reply to Ithamar R. Adema

This code was mostly "borrowed" form the lpc32xx implementation.

---
no changes since v3.

changes since v2:
* Removed clk_put() from init code.
* Added clk_get()/clk_enable() for timer0.

changes since v1:
* make use of clockevents_calc_mult_shift.

---
 arch/arm/mach-lpc2k/Makefile |    2 +-
 arch/arm/mach-lpc2k/time.c   |  176 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/time.c
arch/arm/mach-lpc2k/Makefile +1 -1
index 9eb0a6a..267432c 100644
@@ -1 +1 @@
-obj-y	:= clock.o irq.o
+obj-y	:= clock.o irq.o time.o
arch/arm/mach-lpc2k/time.c new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH v4 5/10 lpc2k: gpiolib

In reply to Ithamar R. Adema

gpiolib support, including gpio interrupts.

---
no changes since v3.

changes since v2:
* Added LPC2K_GPIO(port,pin) macro and used similar macros to minimize declarations of GPIO IRQs.

no changes since v1.

---
 arch/arm/Kconfig                            |    1 +
 arch/arm/mach-lpc2k/Makefile                |    2 +-
 arch/arm/mach-lpc2k/gpio.c                  |  265 +++++++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/gpio.h     |   25 +++
 arch/arm/mach-lpc2k/include/mach/hardware.h |    2 +
 arch/arm/mach-lpc2k/include/mach/irqs.h     |    5 +-
 6 files changed, 298 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/gpio.c
 create mode 100644 arch/arm/mach-lpc2k/include/mach/gpio.h
arch/arm/Kconfig +1 -0
index 4a399e0..eaa5f8c 100644
@@ -501,6 +501,7 @@ config ARCH_LPC2K
 	select ARM_VIC
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
+	select ARCH_REQUIRE_GPIOLIB
 	help
 	  Support for NXP LPC2K family of SoCs. These SoCs are based on
 	  an ARM7TDMI-S core, and have optional on-chip flash and SRAM,
arch/arm/mach-lpc2k/Makefile +1 -1
index 267432c..89596a7 100644
@@ -1 +1 @@
-obj-y	:= clock.o irq.o time.o
+obj-y	:= clock.o irq.o gpio.o time.o
arch/arm/mach-lpc2k/gpio.c new file +265 -0

265 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/gpio.h new file +25 -0
new file mode 100644
index 0000000..533e3da
@@ -0,0 +1,25 @@
+/*
+ *  Copyright (C) 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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 MACH_LPC2K_GPIO_H
+#define MACH_LPC2K_GPIO_H
+
+#include <asm-generic/gpio.h>
+
+#define gpio_get_value		__gpio_get_value
+#define gpio_set_value		__gpio_set_value
+#define gpio_cansleep		__gpio_cansleep
+#define gpio_to_irq		__gpio_to_irq
+
+/* Convert from PX.Y notation to GPIO number */
+#define LPC2K_GPIO(port,pin)	(((port) * 32) + (pin))
+
+#endif /* MACH_LPC2K_GPIO_H */
arch/arm/mach-lpc2k/include/mach/hardware.h +2 -0
index 3463b47..b8c471b 100644
@@ -15,10 +15,12 @@
 /* Default memory size if no ATAGS found */
 #define MEM_SIZE	(SZ_32M)
 
+#define FAST_GPIO_BASE		0x3fffc000
 #define APB_WDT_BASE		0xe0000000
 #define APB_TIMER0_BASE		0xe0004000
 #define APB_TIMER1_BASE		0xe0008000
 #define APB_UART0_BASE		0xe000c000
+#define APB_GPIO_BASE		0xe0028000
 #define APB_SCB_BASE		0xe01fc000
 #define APH_VIC_BASE		0xfffff000
 
arch/arm/mach-lpc2k/include/mach/irqs.h +4 -1
index 87b80dd..9207702 100644
@@ -44,6 +44,9 @@
 #define IRQ_LPC2K_I2C2		30
 #define IRQ_LPC2K_I2S		31
 
-#define NR_IRQS			32
+#define IRQ_LPC2K_PORT0(pin)	(32 + (pin))
+#define IRQ_LPC2K_PORT2(pin)	(64 + (pin))
+
+#define NR_IRQS			96
 
 #endif /* MACH_LPC2K_IRQS_H */
Signature · 1 line
1.7.1
#6 lore raw

PATCH v4 6/10 lpc2k: multifunction pin configuration

In reply to Ithamar R. Adema

Inspired by the mfp support in PXA. Includes definition of pins for NXP LPC2468/78.

---
no changes since v3.

changes since v2:
* Removed MFP_PIN_* enum.
* Renamed GPIOx_signal defines to Px_y_signal.

no changes since v1.

---
 arch/arm/mach-lpc2k/Makefile                   |    2 +-
 arch/arm/mach-lpc2k/include/mach/hardware.h    |    1 +
 arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h |   98 +++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/mfp.h         |   43 ++++++++++
 arch/arm/mach-lpc2k/mfp.c                      |  100 ++++++++++++++++++++++++
 5 files changed, 243 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h
 create mode 100644 arch/arm/mach-lpc2k/include/mach/mfp.h
 create mode 100644 arch/arm/mach-lpc2k/mfp.c
arch/arm/mach-lpc2k/Makefile +1 -1
index 89596a7..2c50bb9 100644
@@ -1 +1 @@
-obj-y	:= clock.o irq.o gpio.o time.o
+obj-y	:= clock.o irq.o gpio.o mfp.o time.o
arch/arm/mach-lpc2k/include/mach/hardware.h +1 -0
index b8c471b..1a20126 100644
@@ -21,6 +21,7 @@
 #define APB_TIMER1_BASE		0xe0008000
 #define APB_UART0_BASE		0xe000c000
 #define APB_GPIO_BASE		0xe0028000
+#define APB_PINSEL_BASE		0xe002c000
 #define APB_SCB_BASE		0xe01fc000
 #define APH_VIC_BASE		0xfffff000
 
arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h new file +98 -0

98 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/mfp.h new file +43 -0

43 lines not on this page · raw message

arch/arm/mach-lpc2k/mfp.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
1.7.1
#7 lore raw

PATCH v4 7/10 lpc2k: Add EmbeddedArtists LPC2478 Developer's Kit board

In reply to Ithamar R. Adema

Add support for EmbeddedArtists LPC2478 Developer's Kit, consisting of the LPC2478OEM board, with QVGA base board. For details, see:

http://www.embeddedartists.com/products/kits/lpc2478_kit.php

The mach-types change included is simply one generated from
http://www.arm.linux.org.uk/developer/machines/, and is only included so this patch can be build.

---
no changes since v3.

changes since v2:
* Changed machine name from web interface, and included mach-types update generated from there.

changes since v1:
* Fixed RTC clock rate
* Marked mfp_cfgs as __initdata.
* renamed LPC2478OEM to more appropriate EA2478DEVKIT.

---
 arch/arm/mach-lpc2k/Kconfig             |    7 +
 arch/arm/mach-lpc2k/Makefile            |    2 +
 arch/arm/mach-lpc2k/common.h            |   21 +
 arch/arm/mach-lpc2k/mach-ea2478devkit.c |  122 ++
 arch/arm/tools/mach-types               | 2303 ++++++++++++++++++++++++++++++-
 5 files changed, 2449 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/common.h
 create mode 100644 arch/arm/mach-lpc2k/mach-ea2478devkit.c
arch/arm/mach-lpc2k/Kconfig +7 -0
index fad47b8..210b641 100644
@@ -2,4 +2,11 @@ if ARCH_LPC2K
 
 comment "LPC2K machines"
 
+config MACH_EA2478DEVKIT
+	bool "Embedded Artists LPC2478 Developer's Kit"
+	help
+	  Say Y if you want the kernel to support the EmbeddedArtists
+	  LPC2478 Developer's Kit. For more hardware details, see:
+	  http://www.embeddedartists.com/products/kits/lpc2478_kit.php
+
 endif
arch/arm/mach-lpc2k/Makefile +2 -0
index 2c50bb9..93e27fb 100644
@@ -1 +1,3 @@
 obj-y	:= clock.o irq.o gpio.o mfp.o time.o
+
+obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o
arch/arm/mach-lpc2k/common.h new file +21 -0
new file mode 100644
index 0000000..6b775d9
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Team Embedded VOF
+ *     Ithamar R. Adema <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef LPC2K_COMMON_H
+#define LPC2K_COMMON_H
+
+struct sys_timer;
+
+extern void lpc2k_init_clocks(unsigned long xtal, unsigned long rtc);
+extern void lpc2k_mfp_config(unsigned long *mfp_cfgs, int num);
+extern void lpc2k_init_irq(void);
+
+extern struct sys_timer lpc2k_timer;
+
+#endif /* LPC2K_COMMON_H */
arch/arm/mach-lpc2k/mach-ea2478devkit.c new file +122 -0

122 lines not on this page · raw message

arch/arm/tools/mach-types +2297 -6

2,770 lines not on this page · raw message

Signature · 1 line
1.7.1
#8 lore raw

PATCH v4 8/10 lpc2k: Add UART, SSP, and MCI devices

In reply to Ithamar R. Adema

Adds devices for which the drivers are already in the tree. For the relevant devices, let the ea2478devkit board set them up.

---
no changes since v3.

changes since v2:
* removed clk_put() from UART init routine.

no changes since v1.

---
 arch/arm/Kconfig                            |    1 +
 arch/arm/mach-lpc2k/Makefile                |    2 +-
 arch/arm/mach-lpc2k/common.h                |    4 +
 arch/arm/mach-lpc2k/devices.c               |  173 +++++++++++++++++++++++++++
 arch/arm/mach-lpc2k/include/mach/hardware.h |    6 +
 arch/arm/mach-lpc2k/mach-ea2478devkit.c     |   20 +++
 6 files changed, 205 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-lpc2k/devices.c
arch/arm/Kconfig +1 -0
index eaa5f8c..0ad1915 100644
@@ -499,6 +499,7 @@ config ARCH_LPC2K
 	depends on !MMU
 	select CPU_ARM7TDMI
 	select ARM_VIC
+	select ARM_AMBA
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
 	select ARCH_REQUIRE_GPIOLIB
arch/arm/mach-lpc2k/Makefile +1 -1
index 93e27fb..aa2b353 100644
@@ -1,3 +1,3 @@
 obj-y	:= clock.o irq.o gpio.o mfp.o time.o
 
-obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o
+obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o devices.o
arch/arm/mach-lpc2k/common.h +4 -0
index 6b775d9..1d4c21e 100644
@@ -16,6 +16,10 @@ extern void lpc2k_init_clocks(unsigned long xtal, unsigned long rtc);
 extern void lpc2k_mfp_config(unsigned long *mfp_cfgs, int num);
 extern void lpc2k_init_irq(void);
 
+extern void lpc2k_add_uart(int nr);
+extern void lpc2k_add_ssp(int nr, void *platform_data);
+extern void lpc2k_add_mci(void *platform_data, int pwr_high);
+
 extern struct sys_timer lpc2k_timer;
 
 #endif /* LPC2K_COMMON_H */
arch/arm/mach-lpc2k/devices.c new file +173 -0

173 lines not on this page · raw message

arch/arm/mach-lpc2k/include/mach/hardware.h +6 -0
index 1a20126..b2e3a18 100644
@@ -20,8 +20,14 @@
 #define APB_TIMER0_BASE		0xe0004000
 #define APB_TIMER1_BASE		0xe0008000
 #define APB_UART0_BASE		0xe000c000
+#define APB_UART1_BASE		0xe0010000
 #define APB_GPIO_BASE		0xe0028000
 #define APB_PINSEL_BASE		0xe002c000
+#define APB_SSP1_BASE		0xe0030000
+#define APB_SSP0_BASE		0xe0068000
+#define APB_UART2_BASE		0xe0078000
+#define APB_UART3_BASE		0xe007c000
+#define APB_MCI_BASE		0xe008c000
 #define APB_SCB_BASE		0xe01fc000
 #define APH_VIC_BASE		0xfffff000
 
arch/arm/mach-lpc2k/mach-ea2478devkit.c +20 -0
index d59f5ba..4d7e95b 100644
@@ -8,6 +8,8 @@
  */
 
 #include <linux/module.h>
+#include <linux/amba/pl022.h>
+#include <linux/amba/mmci.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
 
@@ -96,9 +98,27 @@ static unsigned long mfp_cfgs[] __initdata = {
 	P1_12_MCIDAT3,
 };
 
+static struct pl022_ssp_controller ssp0_plat_data = {
+	.bus_id = 0,
+	.enable_dma = 0,
+	.num_chipselect = 1,
+};
+
+static struct mmci_platform_data mci_plat_data = {
+	.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
+	.capabilities = MMC_CAP_4_BIT_DATA,
+	.f_max = 200000,
+	.gpio_cd = -1,
+	.gpio_wp = -1,
+};
+
 void __init ea2478devkit_init_machine(void)
 {
 	lpc2k_mfp_config(mfp_cfgs, ARRAY_SIZE(mfp_cfgs));
+
+	lpc2k_add_uart(0);
+	lpc2k_add_ssp(0, &ssp0_plat_data);
+	lpc2k_add_mci(&mci_plat_data, 0 /* active low */);
 }
 
 static void __init ea2478devkit_init_irq(void)
Signature · 1 line
1.7.1
#9 lore raw

PATCH v4 9/10 lpc2k: defconfig for NXP LPC2K platform

In reply to Ithamar R. Adema

Add a defconfig that is setup to support booting a uClinux based system. This enables ROMFS/CRAMFS, initrd, and FLAT binaries besides the drivers for the devices added in the previous patch.

---
no changes since v3.

no changes since v2.

changes since v1:
* enabled CONFIG_MAGIC_SYSRQ for testing arch_reset.

---
 arch/arm/configs/lpc2k_defconfig |   57 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/configs/lpc2k_defconfig
arch/arm/configs/lpc2k_defconfig new file +57 -0
new file mode 100644
index 0000000..47a7bcf
@@ -0,0 +1,57 @@
+CONFIG_EXPERIMENTAL=y
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_TINY_RCU=y
+# CONFIG_UTS_NS is not set
+# CONFIG_PID_NS is not set
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_COMPAT_BRK is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_MMU is not set
+CONFIG_ARCH_LPC2K=y
+CONFIG_MACH_EA2478DEVKIT=y
+CONFIG_PROCESSOR_ID=0x41007700
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_PREEMPT=y
+CONFIG_AEABI=y
+CONFIG_CMDLINE="root=/dev/ram initrd=0xa1a00000,4000k console=ttyS0,115200N8 debug rw earlyprintk"
+CONFIG_BINFMT_FLAT=y
+CONFIG_BINFMT_ZFLAT=y
+CONFIG_BINFMT_SHARED_FLAT=y
+# CONFIG_SUSPEND is not set
+# CONFIG_PREVENT_FIRMWARE_BUILD is not set
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_SPI=y
+CONFIG_SPI_PL022=y
+# CONFIG_HWMON is not set
+# CONFIG_MFD_SUPPORT is not set
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
+CONFIG_MMC=y
+CONFIG_MMC_ARMMMCI=y
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+CONFIG_CRAMFS=y
+CONFIG_ROMFS_FS=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_FTRACE is not set
+CONFIG_DEBUG_USER=y
+CONFIG_DEBUG_ERRORS=y
+CONFIG_DEBUG_LL=y
+CONFIG_EARLY_PRINTK=y
Signature · 1 line
1.7.1
#10 lore raw

PATCH v4 10/10 NOMMU: implement access_remote_vm

In reply to Ithamar R. Adema

From: Mike Frysinger <[email protected]>

Recent vm changes brought in a new function which the core procfs code utilizes. So implement it for nommu systems too to avoid link failures.

---
This patch was already sent to LKML, but I included it only to keep the current patchset buildable....

---
 mm/nommu.c |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)
mm/nommu.c +39 -13
index cb86e7d..c4c542c 100644
@@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 }
 EXPORT_SYMBOL(filemap_fault);
 
-/*
- * Access another process' address space.
- * - source/target buffer must be kernel space
- */
-int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
+		unsigned long addr, void *buf, int len, int write)
 {
 	struct vm_area_struct *vma;
-	struct mm_struct *mm;
-
-	if (addr + len < addr)
-		return 0;
-
-	mm = get_task_mm(tsk);
-	if (!mm)
-		return 0;
 
 	down_read(&mm->mmap_sem);
 
@@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
 	}
 
 	up_read(&mm->mmap_sem);
+
+	return len;
+}
+
+/**
+ * @access_remote_vm - access another process' address space
+ * @mm:		the mm_struct of the target address space
+ * @addr:	start address to access
+ * @buf:	source or destination buffer
+ * @len:	number of bytes to transfer
+ * @write:	whether the access is a write
+ *
+ * The caller must hold a reference on @mm.
+ */
+int access_remote_vm(struct mm_struct *mm, unsigned long addr,
+		void *buf, int len, int write)
+{
+	return __access_remote_vm(NULL, mm, addr, buf, len, write);
+}
+
+/*
+ * Access another process' address space.
+ * - source/target buffer must be kernel space
+ */
+int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+{
+	struct mm_struct *mm;
+
+	if (addr + len < addr)
+		return 0;
+
+	mm = get_task_mm(tsk);
+	if (!mm)
+		return 0;
+
+	len = __access_remote_vm(tsk, mm, addr, buf, len, write);
+
 	mmput(mm);
 	return len;
 }
Signature · 1 line
1.7.1
#11 lore raw

v4 cover Support for NXP LPC2K SoCs

In reply to Ithamar R. Adema

Hi Russell,

Quoted 3 lines · Ithamar R. Adema

The following patch series implements support for the ARM7TDMI-S based NXP LPC2K System-on-Chips, and, as first board, the EmbeddedArtists LPC2478 Developer's Kit.

[snip]

Since there have been no further comments, can I send these patches to your patch system or do you prefer to have a git repository to pull from?

If there are still other things to take care of first, please let me know and I'll try to take care of it.

Regards,

Ithamar.

#12 lore raw

v4 cover Support for NXP LPC2K SoCs

Quoted 7 lines · Ithamar R. Adema
Quoted 3 lines

The following patch series implements support for the ARM7TDMI-S based NXP LPC2K System-on-Chips, and, as first board, the EmbeddedArtists LPC2478 Developer's Kit.

[snip]

I've been running your patches on an EA2468 board with a modified board file and it's been stable as a rock so far. Nice job getting this CPU running!

Quoted 12 lines

Since there have been no further comments, can I send these patches to your patch system or do you prefer to have a git repository to pull from?

If there are still other things to take care of first, please let me know and I'll try to take care of it.

Regards,

Ithamar.