Skip to contentSkip to conversation

ARM: Initial SuperH Mobile ARM support V2

PATCH New Magnus Damm 2 participants 8 messages Feb 5, 2010

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: Initial SuperH Mobile ARM support V2

ARM: Initial SuperH Mobile ARM support V2

[PATCH 01/06] ARM: SuperH Mobile ARM, sh7367 and G3EVM support V2 [PATCH 02/06] ARM: Add sh7377 and G4EVM support V2 [PATCH 03/06] ARM: Add sh7372 and AP4EVB support V2 [PATCH 04/06] sh: Build drivers/sh for SuperH Mobile ARM [PATCH 05/06] sh: Let INTC set IRQF_VALID on ARM platforms V2 [PATCH 06/06] sh-sci: SuperH Mobile ARM support V2

Here comes V2 of the initial SuperH Mobile ARM patch set.

Features:
- Console: Serial console using drivers/serial/sh-sci.c
- Timer: Early platform driver using drivers/clocksource/sh_cmt.c
- Interrupts: Minimal INTC support using drivers/sh/intc.c
- Clocks: Dummy static implementation to enable above drivers
- Defconfigs: Omitted

On top of this there will be a bunch of feature patches for the interrupt controller, gpio, clock framework, runtime pm and of course driver support.

Since there are some dependencies on SuperH code I'd prefer to handle the merge through the sh-2.6 tree. Hope that is ok, please let me know if you have some other preference.

---

 arch/arm/Kconfig                                  |    7 
 arch/arm/Makefile                                 |    1 
 arch/arm/mach-shmobile/Kconfig                    |   81 ++++++
 arch/arm/mach-shmobile/Makefile                   |   16 +
 arch/arm/mach-shmobile/Makefile.boot              |    9 
 arch/arm/mach-shmobile/board-ap4evb.c             |  127 ++++++++++
 arch/arm/mach-shmobile/board-g3evm.c              |  127 ++++++++++
 arch/arm/mach-shmobile/board-g4evm.c              |  127 ++++++++++
 arch/arm/mach-shmobile/clock-sh7367.c             |   89 +++++++
 arch/arm/mach-shmobile/include/mach/clkdev.h      |    7 
 arch/arm/mach-shmobile/include/mach/common.h      |   19 +
 arch/arm/mach-shmobile/include/mach/dma.h         |    1 
 arch/arm/mach-shmobile/include/mach/entry-macro.S |   39 +++
 arch/arm/mach-shmobile/include/mach/gpio.h        |    1 
 arch/arm/mach-shmobile/include/mach/hardware.h    |    7 
 arch/arm/mach-shmobile/include/mach/io.h          |    9 
 arch/arm/mach-shmobile/include/mach/irqs.h        |   10 
 arch/arm/mach-shmobile/include/mach/memory.h      |    7 
 arch/arm/mach-shmobile/include/mach/system.h      |   14 +
 arch/arm/mach-shmobile/include/mach/timex.h       |    6 
 arch/arm/mach-shmobile/include/mach/uncompress.h  |   21 +
 arch/arm/mach-shmobile/include/mach/vmalloc.h     |    6 
 arch/arm/mach-shmobile/setup-sh7367.c             |  241 +++++++++++++++++++
 arch/arm/mach-shmobile/setup-sh7372.c             |  241 +++++++++++++++++++
 arch/arm/mach-shmobile/setup-sh7377.c             |  260 +++++++++++++++++++++
 arch/arm/mach-shmobile/timer.c                    |   46 +++
 drivers/Makefile                                  |    1 
 drivers/serial/Kconfig                            |    2 
 drivers/serial/sh-sci.h                           |   23 +
 drivers/sh/intc.c                                 |   10 
 30 files changed, 1544 insertions(+), 11 deletions(-)
author maintainer
#1 lore raw

PATCH 1/6 ARM: SuperH Mobile ARM, sh7367 and G3EVM support V2

From: Magnus Damm <[email protected]>

This patch is V2 of the SuperH Mobile ARM base support together with sh7367 CPU and G3EVM board support. 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.

---

Changes since V1:
- sorted entries arch/arm/Kconfig
- dropped ioremap flag in sh-sci platform data

 arch/arm/Kconfig                                  |    7 
 arch/arm/Makefile                                 |    1 
 arch/arm/mach-shmobile/Kconfig                    |   53 ++++
 arch/arm/mach-shmobile/Makefile                   |   12 +
 arch/arm/mach-shmobile/Makefile.boot              |    9 
 arch/arm/mach-shmobile/board-g3evm.c              |  127 +++++++++++
 arch/arm/mach-shmobile/clock-sh7367.c             |   89 +++++++
 arch/arm/mach-shmobile/include/mach/clkdev.h      |    7 
 arch/arm/mach-shmobile/include/mach/common.h      |   11 
 arch/arm/mach-shmobile/include/mach/dma.h         |    1 
 arch/arm/mach-shmobile/include/mach/entry-macro.S |   39 +++
 arch/arm/mach-shmobile/include/mach/gpio.h        |    1 
 arch/arm/mach-shmobile/include/mach/hardware.h    |    7 
 arch/arm/mach-shmobile/include/mach/io.h          |    9 
 arch/arm/mach-shmobile/include/mach/irqs.h        |   10 
 arch/arm/mach-shmobile/include/mach/memory.h      |    7 
 arch/arm/mach-shmobile/include/mach/system.h      |   14 +
 arch/arm/mach-shmobile/include/mach/timex.h       |    6 
 arch/arm/mach-shmobile/include/mach/uncompress.h  |   21 +
 arch/arm/mach-shmobile/include/mach/vmalloc.h     |    6 
 arch/arm/mach-shmobile/setup-sh7367.c             |  241 +++++++++++++++++++++
 arch/arm/mach-shmobile/timer.c                    |   46 ++++
 22 files changed, 724 insertions(+)
arch/arm/Kconfig +7 -0
@@ -608,6 +608,11 @@ config ARCH_MSM
 	  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
@@ -857,6 +862,8 @@ endif
 
 source "arch/arm/mach-s5p6440/Kconfig"
 
+source "arch/arm/mach-shmobile/Kconfig"
+
 source "arch/arm/plat-stmp3xxx/Kconfig"
 
 if ARCH_S5PC1XX
arch/arm/Makefile +1 -0
@@ -166,6 +166,7 @@ machine-$(CONFIG_ARCH_S5P6440)		:= s5p64
 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
arch/arm/mach-shmobile/Kconfig new file +53 -0

53 lines not on this page · raw message

arch/arm/mach-shmobile/Makefile new file +12 -0
@@ -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
arch/arm/mach-shmobile/Makefile.boot new file +9 -0
@@ -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)
arch/arm/mach-shmobile/board-g3evm.c new file +127 -0

127 lines not on this page · raw message

arch/arm/mach-shmobile/clock-sh7367.c new file +89 -0

89 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/clkdev.h new file +7 -0
@@ -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 */
arch/arm/mach-shmobile/include/mach/common.h new file +11 -0
@@ -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 */
arch/arm/mach-shmobile/include/mach/dma.h new file +1 -0
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-shmobile/include/mach/entry-macro.S new file +39 -0
@@ -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
arch/arm/mach-shmobile/include/mach/gpio.h new file +1 -0
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-shmobile/include/mach/hardware.h new file +7 -0
@@ -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 */
arch/arm/mach-shmobile/include/mach/io.h new file +9 -0
@@ -0,0 +1,9 @@
+#ifndef __ASM_MACH_IO_H
+#define __ASM_MACH_IO_H
+
+#define IO_SPACE_LIMIT		0xffffffff
+
+#define __io(a)			((void __iomem *)(a))
+#define __mem_pci(a)		(a)
+
+#endif /* __ASM_MACH_IO_H */
arch/arm/mach-shmobile/include/mach/irqs.h new file +10 -0
@@ -0,0 +1,10 @@
+#ifndef __ASM_MACH_IRQS_H
+#define __ASM_MACH_IRQS_H
+
+#define NR_IRQS         512
+#define NR_IRQS_LEGACY  8
+
+#define evt2irq(evt)		(((evt) >> 5) - 16)
+#define irq2evt(irq)		(((irq) + 16) << 5)
+
+#endif /* __ASM_MACH_IRQS_H */
arch/arm/mach-shmobile/include/mach/memory.h new file +7 -0
@@ -0,0 +1,7 @@
+#ifndef __ASM_MACH_MEMORY_H
+#define __ASM_MACH_MEMORY_H
+
+#define PHYS_OFFSET	UL(CONFIG_MEMORY_START)
+#define MEM_SIZE	UL(CONFIG_MEMORY_SIZE)
+
+#endif /* __ASM_MACH_MEMORY_H */
arch/arm/mach-shmobile/include/mach/system.h new file +14 -0
@@ -0,0 +1,14 @@
+#ifndef __ASM_ARCH_SYSTEM_H
+#define __ASM_ARCH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+	cpu_do_idle();
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+	cpu_reset(0);
+}
+
+#endif
arch/arm/mach-shmobile/include/mach/timex.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ASM_MACH_TIMEX_H
+#define __ASM_MACH_TIMEX_H
+
+#define CLOCK_TICK_RATE		1193180 /* unused i8253 PIT value */
+
+#endif /* __ASM_MACH_TIMEX_H */
arch/arm/mach-shmobile/include/mach/uncompress.h new file +21 -0
@@ -0,0 +1,21 @@
+#ifndef __ASM_MACH_UNCOMPRESS_H
+#define __ASM_MACH_UNCOMPRESS_H
+
+/*
+ * This does not append a newline
+ */
+static void putc(int c)
+{
+}
+
+static inline void flush(void)
+{
+}
+
+static void arch_decomp_setup(void)
+{
+}
+
+#define arch_decomp_wdog()
+
+#endif /* __ASM_MACH_UNCOMPRESS_H */
arch/arm/mach-shmobile/include/mach/vmalloc.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ASM_MACH_VMALLOC_H
+#define __ASM_MACH_VMALLOC_H
+
+#define VMALLOC_END       (PAGE_OFFSET + 0x24000000)
+
+#endif /* __ASM_MACH_VMALLOC_H */
arch/arm/mach-shmobile/setup-sh7367.c new file +241 -0

241 lines not on this page · raw message

arch/arm/mach-shmobile/timer.c new file +46 -0

46 lines not on this page · raw message

#2 lore raw

PATCH 1/6 ARM: SuperH Mobile ARM, sh7367 and G3EVM support V2

arch/arm/mach-shmobile/include/mach/entry-macro.S line 30

Quoted 8 lines · Magnus Damm
arch/arm/mach-shmobile/include/mach/entry-macro.S new file +8 -0
+	.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

There's the potential for an optimisation here - move this instruction into get_irqnr_preamble, and you'll avoid having to re-load the base register if there's multiple IRQs pending.

author maintainer
#3 lore raw

PATCH 2/6 ARM: Add sh7377 and G4EVM support V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch is V2 of base support for the SuperH Mobile ARM processor sh7372 together with AP4EVB board support. 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.

---

Changes since V1:
- dropped mach-type entry
- dropped ioremap flag in sh-sci platform data

 arch/arm/mach-shmobile/Kconfig               |   14 +
 arch/arm/mach-shmobile/Makefile              |    2 
 arch/arm/mach-shmobile/board-ap4evb.c        |  127 +++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    4 
 arch/arm/mach-shmobile/setup-sh7372.c        |  241 ++++++++++++++++++++++++++
 5 files changed, 388 insertions(+)
arch/arm/mach-shmobile/Kconfig +14 -0
@@ -18,6 +18,14 @@ config ARCH_SH7377
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 
+config ARCH_SH7372
+	bool "SH-Mobile SH7372 (AP4)"
+	select CPU_V7
+	select HAVE_CLK
+	select COMMON_CLKDEV
+	select GENERIC_TIME
+	select GENERIC_CLOCKEVENTS
+
 comment "SH-Mobile Board Type"
 
 config MACH_G3EVM
@@ -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"
@@ -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
@@ -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
arch/arm/mach-shmobile/Makefile +2 -0
@@ -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
arch/arm/mach-shmobile/board-ap4evb.c new file +127 -0

127 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/common.h +4 -0
@@ -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 */
arch/arm/mach-shmobile/setup-sh7372.c new file +241 -0

241 lines not on this page · raw message

author maintainer
#4 lore raw

PATCH 3/6 ARM: Add sh7372 and AP4EVB support V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch is V2 of base support for the SuperH Mobile ARM processor sh7377 together with G4EVM board support. 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.

---

Changes since V1:
- dropped ioremap flag in sh-sci platform data

 arch/arm/mach-shmobile/Kconfig               |   14 +
 arch/arm/mach-shmobile/Makefile              |    2 
 arch/arm/mach-shmobile/board-g4evm.c         |  127 ++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    4 
 arch/arm/mach-shmobile/setup-sh7377.c        |  260 ++++++++++++++++++++++++++
 5 files changed, 407 insertions(+)
arch/arm/mach-shmobile/Kconfig +14 -0
@@ -10,12 +10,24 @@ config ARCH_SH7367
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 
+config ARCH_SH7377
+	bool "SH-Mobile SH7377 (G4)"
+	select CPU_V7
+	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
 
+config MACH_G4EVM
+	bool "G4EVM board"
+	depends on ARCH_SH7377
+
 comment "SH-Mobile System Configuration"
 
 menu "Memory configuration"
@@ -23,6 +35,7 @@ menu "Memory configuration"
 config MEMORY_START
 	hex "Physical memory start address"
 	default "0x50000000" if MACH_G3EVM
+	default "0x40000000" if MACH_G4EVM
 	default "0x00000000"
 	---help---
 	  Tweak this only when porting to a new machine which does not
@@ -32,6 +45,7 @@ config MEMORY_START
 config MEMORY_SIZE
 	hex "Physical memory size"
 	default "0x08000000" if MACH_G3EVM
+	default "0x08000000" if MACH_G4EVM
 	default "0x04000000"
 	help
 	  This sets the default memory size assumed by your kernel. It can
arch/arm/mach-shmobile/Makefile +2 -0
@@ -7,6 +7,8 @@ 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
 
 # Board objects
 obj-$(CONFIG_MACH_G3EVM)	+= board-g3evm.o
+obj-$(CONFIG_MACH_G4EVM)	+= board-g4evm.o
arch/arm/mach-shmobile/board-g4evm.c new file +127 -0

127 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/common.h +4 -0
@@ -8,4 +8,8 @@ extern void sh7367_add_early_devices(voi
 extern void sh7367_add_standard_devices(void);
 extern void sh7367_clock_init(void);
 
+extern void sh7377_init_irq(void);
+extern void sh7377_add_early_devices(void);
+extern void sh7377_add_standard_devices(void);
+
 #endif /* __ARCH_MACH_COMMON_H */
arch/arm/mach-shmobile/setup-sh7377.c new file +260 -0

260 lines not on this page · raw message

author maintainer
#5 lore raw

PATCH 4/6 sh: Build drivers/sh for SuperH Mobile ARM

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Build drivers/sh in the case for SuperH Mobile ARM. Shared code for the interrupt controller (INTC) and the gpio/pinmux (PFC) is located there.

---

 drivers/Makefile |    1 +
 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
@@ -99,6 +99,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
 obj-$(CONFIG_GENERIC_TIME)	+= clocksource/
 obj-$(CONFIG_DMA_ENGINE)	+= dma/
 obj-$(CONFIG_DCA)		+= dca/
author maintainer
#6 lore raw

PATCH 5/6 sh: Let INTC set IRQF_VALID on ARM platforms V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Reuse the SuperH INTC code on ARM by using set_irq_flags() to set IRQF_VALID on ARM platforms. (V2)

---

Changes since V1:
- wrap with CONFIG_ARM instead of CONFIG_ARCH_SHMOBILE
- use set_irq_flags() in create_irq_nr() as well

 drivers/sh/intc.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/sh/intc.c +9 -1
@@ -658,6 +658,10 @@ static void __init intc_register_irq(str
 
 	if (desc->ack_regs)
 		ack_handle[irq] = intc_ack_data(desc, d, enum_id);
+
+#ifdef CONFIG_ARM
+	set_irq_flags(irq, IRQF_VALID); /* Enable IRQ on ARM systems */
+#endif
 }
 
 static unsigned int __init save_reg(struct intc_desc_int *d,
@@ -906,8 +910,12 @@ unsigned int create_irq_nr(unsigned int 
 out_unlock:
 	spin_unlock_irqrestore(&vector_lock, flags);
 
-	if (irq > 0)
+	if (irq > 0) {
 		dynamic_irq_init(irq);
+#ifdef CONFIG_ARM
+		set_irq_flags(irq, IRQF_VALID); /* Enable IRQ on ARM systems */
+#endif
+	}
 
 	return irq;
 }
author maintainer
#7 lore raw

PATCH 6/6 sh-sci: SuperH Mobile ARM support V2

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SuperH Mobile ARM support to the sh-sci driver. (V2) Also remove the SCLSR register that is missing on sh772x, sh7705 and SH-Mobile.

---

Applies on top of the sci_rxd_in() cleanup patch

Changes since V1:
- rewrote the patch

 drivers/serial/Kconfig  |    2 +-
 drivers/serial/sh-sci.h |   23 ++++++++++++++---------
 2 files changed, 15 insertions(+), 10 deletions(-)
drivers/serial/Kconfig +1 -1
@@ -1013,7 +1013,7 @@ config SERIAL_IP22_ZILOG_CONSOLE
 
 config SERIAL_SH_SCI
 	tristate "SuperH SCI(F) serial port support"
-	depends on HAVE_CLK && (SUPERH || H8300)
+	depends on HAVE_CLK && (SUPERH || H8300 || ARCH_SHMOBILE)
 	select SERIAL_CORE
 
 config SERIAL_SH_SCI_NR_UARTS
drivers/serial/sh-sci.h +14 -9
@@ -30,9 +30,9 @@
  */
 # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
 #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7721)
+      defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+      defined(CONFIG_ARCH_SHMOBILE)
 # define SCSCR_INIT(port)  0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCIF_ORER	   0x0200   /* overrun error bit */
 #elif defined(CONFIG_CPU_SUBTYPE_SH7750)  || \
       defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
       defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
@@ -166,7 +166,8 @@
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7721)
+    defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+    defined(CONFIG_ARCH_SHMOBILE)
 # define SCIF_ORER    0x0200
 # define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
 # define SCIF_RFDC_MASK 0x007f
@@ -199,7 +200,8 @@
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7721)
+    defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+    defined(CONFIG_ARCH_SHMOBILE)
 # define SCxSR_RDxF_CLEAR(port)	 (sci_in(port, SCxSR) & 0xfffc)
 # define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
 # define SCxSR_TDxE_CLEAR(port)	 (sci_in(port, SCxSR) & 0xffdf)
@@ -294,7 +296,7 @@
     SCI_OUT(sci_size, sci_offset, value);				\
   }
 
-#ifdef CONFIG_CPU_SH3
+#if defined(CONFIG_CPU_SH3) || defined(CONFIG_ARCH_SHMOBILE)
 #if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
 #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
 		                sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
@@ -304,7 +306,8 @@
 	  CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
       defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7721)
+      defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+      defined(CONFIG_ARCH_SHMOBILE)
 #define SCIF_FNS(name, scif_offset, scif_size) \
   CPU_SCIF_FNS(name, scif_offset, scif_size)
 #else
@@ -339,7 +342,8 @@
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7721)
+    defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+    defined(CONFIG_ARCH_SHMOBILE)
 
 SCIF_FNS(SCSMR,  0x00, 16)
 SCIF_FNS(SCBRR,  0x04,  8)
@@ -351,7 +355,7 @@ SCIF_FNS(SCFCR,  0x18, 16)
 SCIF_FNS(SCFDR,  0x1c, 16)
 SCIF_FNS(SCxTDR, 0x20,  8)
 SCIF_FNS(SCxRDR, 0x24,  8)
-SCIF_FNS(SCLSR,  0x24, 16)
+SCIF_FNS(SCLSR,  0x00,  0)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
       defined(CONFIG_CPU_SUBTYPE_SH7724)
 SCIx_FNS(SCSMR,  0x00, 16, 0x00, 16)
@@ -521,7 +525,8 @@ static inline int sci_rxd_in(struct uart
 #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
       defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7721)
+      defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+      defined(CONFIG_ARCH_SHMOBILE)
 #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
       defined(CONFIG_CPU_SUBTYPE_SH7724)