aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sh/Kconfig6
-rw-r--r--arch/sh/boards/Kconfig18
-rw-r--r--arch/sh/boards/Makefile2
-rw-r--r--arch/sh/boards/board-sh2007.c133
-rw-r--r--arch/sh/boards/board-sh7757lcr.c374
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c6
-rw-r--r--arch/sh/boards/mach-sdk7786/Makefile5
-rw-r--r--arch/sh/boards/mach-sdk7786/gpio.c49
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c54
-rw-r--r--arch/sh/boards/mach-sdk7786/sram.c72
-rw-r--r--arch/sh/boards/mach-x3proto/Makefile2
-rw-r--r--arch/sh/boards/mach-x3proto/gpio.c135
-rw-r--r--arch/sh/boards/mach-x3proto/ilsel.c18
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c132
-rw-r--r--arch/sh/boot/compressed/head_32.S4
-rw-r--r--arch/sh/cchips/hd6446x/Makefile2
-rw-r--r--arch/sh/configs/ap325rxa_defconfig1
-rw-r--r--arch/sh/configs/cayman_defconfig1
-rw-r--r--arch/sh/configs/dreamcast_defconfig1
-rw-r--r--arch/sh/configs/ecovec24-romimage_defconfig1
-rw-r--r--arch/sh/configs/edosk7760_defconfig1
-rw-r--r--arch/sh/configs/espt_defconfig1
-rw-r--r--arch/sh/configs/hp6xx_defconfig1
-rw-r--r--arch/sh/configs/kfr2r09-romimage_defconfig1
-rw-r--r--arch/sh/configs/kfr2r09_defconfig1
-rw-r--r--arch/sh/configs/landisk_defconfig1
-rw-r--r--arch/sh/configs/lboxre2_defconfig1
-rw-r--r--arch/sh/configs/magicpanelr2_defconfig1
-rw-r--r--arch/sh/configs/microdev_defconfig1
-rw-r--r--arch/sh/configs/migor_defconfig1
-rw-r--r--arch/sh/configs/polaris_defconfig1
-rw-r--r--arch/sh/configs/r7780mp_defconfig1
-rw-r--r--arch/sh/configs/r7785rp_defconfig1
-rw-r--r--arch/sh/configs/rts7751r2d1_defconfig1
-rw-r--r--arch/sh/configs/rts7751r2dplus_defconfig1
-rw-r--r--arch/sh/configs/sdk7780_defconfig1
-rw-r--r--arch/sh/configs/se7343_defconfig1
-rw-r--r--arch/sh/configs/se7712_defconfig1
-rw-r--r--arch/sh/configs/se7721_defconfig1
-rw-r--r--arch/sh/configs/se7722_defconfig1
-rw-r--r--arch/sh/configs/se7724_defconfig1
-rw-r--r--arch/sh/configs/se7750_defconfig1
-rw-r--r--arch/sh/configs/se7751_defconfig1
-rw-r--r--arch/sh/configs/se7780_defconfig1
-rw-r--r--arch/sh/configs/sh03_defconfig1
-rw-r--r--arch/sh/configs/sh2007_defconfig212
-rw-r--r--arch/sh/configs/sh7710voipgw_defconfig1
-rw-r--r--arch/sh/configs/sh7757lcr_defconfig85
-rw-r--r--arch/sh/configs/sh7763rdp_defconfig1
-rw-r--r--arch/sh/configs/sh7785lcr_defconfig1
-rw-r--r--arch/sh/configs/shx3_defconfig1
-rw-r--r--arch/sh/configs/snapgear_defconfig1
-rw-r--r--arch/sh/configs/systemh_defconfig1
-rw-r--r--arch/sh/configs/titan_defconfig1
-rw-r--r--arch/sh/configs/ul2_defconfig1
-rw-r--r--arch/sh/drivers/dma/dma-api.c4
-rw-r--r--arch/sh/drivers/pci/Makefile1
-rw-r--r--arch/sh/drivers/pci/fixups-sdk7786.c67
-rw-r--r--arch/sh/drivers/pci/ops-sh4.c11
-rw-r--r--arch/sh/drivers/pci/ops-sh7786.c69
-rw-r--r--arch/sh/drivers/pci/pci-sh7751.c2
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.c2
-rw-r--r--arch/sh/drivers/pci/pci-sh7780.h6
-rw-r--r--arch/sh/drivers/pci/pci.c43
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c251
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.h56
-rw-r--r--arch/sh/include/asm/Kbuild2
-rw-r--r--arch/sh/include/asm/elf.h27
-rw-r--r--arch/sh/include/asm/fixmap.h4
-rw-r--r--arch/sh/include/asm/gpio.h6
-rw-r--r--arch/sh/include/asm/irq.h2
-rw-r--r--arch/sh/include/asm/kprobes.h1
-rw-r--r--arch/sh/include/asm/pci.h2
-rw-r--r--arch/sh/include/asm/processor_32.h3
-rw-r--r--arch/sh/include/asm/processor_64.h3
-rw-r--r--arch/sh/include/asm/ptrace.h169
-rw-r--r--arch/sh/include/asm/ptrace_32.h83
-rw-r--r--arch/sh/include/asm/ptrace_64.h20
-rw-r--r--arch/sh/include/asm/sizes.h1
-rw-r--r--arch/sh/include/asm/sram.h38
-rw-r--r--arch/sh/include/asm/system.h2
-rw-r--r--arch/sh/include/asm/system_32.h15
-rw-r--r--arch/sh/include/asm/tlbflush.h2
-rw-r--r--arch/sh/include/asm/unistd_32.h27
-rw-r--r--arch/sh/include/asm/unistd_64.h5
-rw-r--r--arch/sh/include/cpu-sh3/cpu/mmu_context.h1
-rw-r--r--arch/sh/include/cpu-sh4/cpu/freq.h4
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7757.h301
-rw-r--r--arch/sh/include/cpu-sh4/cpu/shx3.h64
-rw-r--r--arch/sh/include/mach-common/mach/sh2007.h117
-rw-r--r--arch/sh/include/mach-sdk7786/mach/fpga.h26
-rw-r--r--arch/sh/include/mach-x3proto/mach/hardware.h12
-rw-r--r--arch/sh/include/mach-x3proto/mach/ilsel.h (renamed from arch/sh/include/asm/ilsel.h)0
-rw-r--r--arch/sh/kernel/Makefile8
-rw-r--r--arch/sh/kernel/clkdev.c4
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile5
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c199
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-shx3.c225
-rw-r--r--arch/sh/kernel/cpu/sh4a/intc-shx3.c34
-rw-r--r--arch/sh/kernel/cpu/sh4a/perf_event.c20
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c1582
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-shx3.c587
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c66
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c222
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c126
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c42
-rw-r--r--arch/sh/kernel/head_32.S2
-rw-r--r--arch/sh/kernel/io_trapped.c2
-rw-r--r--arch/sh/kernel/irq.c2
-rw-r--r--arch/sh/kernel/kdebugfs.c16
-rw-r--r--arch/sh/kernel/kprobes.c100
-rw-r--r--arch/sh/kernel/ptrace.c33
-rw-r--r--arch/sh/kernel/ptrace_32.c27
-rw-r--r--arch/sh/kernel/ptrace_64.c88
-rw-r--r--arch/sh/kernel/reboot.c4
-rw-r--r--arch/sh/kernel/setup.c22
-rw-r--r--arch/sh/kernel/syscalls_32.S22
-rw-r--r--arch/sh/kernel/syscalls_64.S3
-rw-r--r--arch/sh/kernel/traps_32.c29
-rw-r--r--arch/sh/kernel/traps_64.c11
-rw-r--r--arch/sh/lib/Makefile2
-rw-r--r--arch/sh/math-emu/math.c3
-rw-r--r--arch/sh/mm/Kconfig4
-rw-r--r--arch/sh/mm/Makefile3
-rw-r--r--arch/sh/mm/asids-debugfs.c2
-rw-r--r--arch/sh/mm/cache-debugfs.c10
-rw-r--r--arch/sh/mm/consistent.c3
-rw-r--r--arch/sh/mm/init.c52
-rw-r--r--arch/sh/mm/nommu.c4
-rw-r--r--arch/sh/mm/pmb.c35
-rw-r--r--arch/sh/mm/sram.c34
-rw-r--r--arch/sh/mm/tlb-debugfs.c11
-rw-r--r--arch/sh/mm/tlbflush_32.c16
-rw-r--r--arch/sh/mm/tlbflush_64.c5
-rw-r--r--arch/sh/tools/mach-types2
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/clocksource/sh_cmt.c12
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c4
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c23
-rw-r--r--drivers/mfd/sh_mobile_sdhi.c2
-rw-r--r--drivers/serial/sh-sci.h17
-rw-r--r--drivers/sh/Kconfig25
-rw-r--r--drivers/sh/Makefile7
-rw-r--r--drivers/sh/clk/Makefile3
-rw-r--r--drivers/sh/clk/core.c (renamed from drivers/sh/clk.c)203
-rw-r--r--drivers/sh/clk/cpg.c (renamed from drivers/sh/clk-cpg.c)11
-rw-r--r--drivers/sh/intc.c1390
-rw-r--r--drivers/sh/intc/Kconfig35
-rw-r--r--drivers/sh/intc/Makefile5
-rw-r--r--drivers/sh/intc/access.c237
-rw-r--r--drivers/sh/intc/balancing.c97
-rw-r--r--drivers/sh/intc/chip.c215
-rw-r--r--drivers/sh/intc/core.c469
-rw-r--r--drivers/sh/intc/dynamic.c135
-rw-r--r--drivers/sh/intc/handle.c307
-rw-r--r--drivers/sh/intc/internals.h186
-rw-r--r--drivers/sh/intc/userimask.c83
-rw-r--r--drivers/sh/intc/virq-debugfs.c64
-rw-r--r--drivers/sh/intc/virq.c255
-rw-r--r--drivers/sh/pfc.c17
-rw-r--r--drivers/usb/host/r8a66597-hcd.c4
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c6
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/sh_clk.h17
-rw-r--r--include/linux/sh_intc.h16
-rw-r--r--include/linux/sh_pfc.h1
-rw-r--r--sound/soc/sh/siu_pcm.c2
168 files changed, 7265 insertions, 3056 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 35b6879628a0..0f40fc35d0a2 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -24,6 +24,7 @@ config SUPERH
24 select HAVE_KERNEL_LZMA 24 select HAVE_KERNEL_LZMA
25 select HAVE_KERNEL_LZO 25 select HAVE_KERNEL_LZO
26 select HAVE_SYSCALL_TRACEPOINTS 26 select HAVE_SYSCALL_TRACEPOINTS
27 select HAVE_REGS_AND_STACK_ACCESS_API
27 select RTC_LIB 28 select RTC_LIB
28 select GENERIC_ATOMIC64 29 select GENERIC_ATOMIC64
29 help 30 help
@@ -46,7 +47,7 @@ config SUPERH32
46 select HAVE_ARCH_KGDB 47 select HAVE_ARCH_KGDB
47 select HAVE_HW_BREAKPOINT 48 select HAVE_HW_BREAKPOINT
48 select HAVE_MIXED_BREAKPOINTS_REGS 49 select HAVE_MIXED_BREAKPOINTS_REGS
49 select PERF_EVENTS if HAVE_HW_BREAKPOINT 50 select PERF_EVENTS
50 select ARCH_HIBERNATION_POSSIBLE if MMU 51 select ARCH_HIBERNATION_POSSIBLE if MMU
51 52
52config SUPERH64 53config SUPERH64
@@ -471,6 +472,7 @@ config CPU_SUBTYPE_SHX3
471 select CPU_SH4A 472 select CPU_SH4A
472 select CPU_SHX3 473 select CPU_SHX3
473 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 474 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
475 select ARCH_REQUIRE_GPIOLIB
474 476
475# SH4AL-DSP Processor Support 477# SH4AL-DSP Processor Support
476 478
@@ -575,7 +577,7 @@ config SH_CLK_CPG
575config SH_CLK_CPG_LEGACY 577config SH_CLK_CPG_LEGACY
576 depends on SH_CLK_CPG 578 depends on SH_CLK_CPG
577 def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \ 579 def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \
578 !CPU_SUBTYPE_SH7786 580 !CPU_SHX3 && !CPU_SUBTYPE_SH7757
579 581
580config SH_CLK_MD 582config SH_CLK_MD
581 int "CPU Mode Pin Setting" 583 int "CPU Mode Pin Setting"
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 07b35ca2f644..9c94711aa6ca 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -155,6 +155,8 @@ config SH_SDK7786
155 depends on CPU_SUBTYPE_SH7786 155 depends on CPU_SUBTYPE_SH7786
156 select SYS_SUPPORTS_PCI 156 select SYS_SUPPORTS_PCI
157 select NO_IOPORT if !PCI 157 select NO_IOPORT if !PCI
158 select ARCH_WANT_OPTIONAL_GPIOLIB
159 select HAVE_SRAM_POOL
158 help 160 help
159 Select SDK7786 if configuring for a Renesas Technology Europe 161 Select SDK7786 if configuring for a Renesas Technology Europe
160 SH7786-65nm board. 162 SH7786-65nm board.
@@ -165,6 +167,11 @@ config SH_HIGHLANDER
165 select SYS_SUPPORTS_PCI 167 select SYS_SUPPORTS_PCI
166 select IO_TRAPPED if MMU 168 select IO_TRAPPED if MMU
167 169
170config SH_SH7757LCR
171 bool "SH7757LCR"
172 depends on CPU_SUBTYPE_SH7757
173 select ARCH_REQUIRE_GPIOLIB
174
168config SH_SH7785LCR 175config SH_SH7785LCR
169 bool "SH7785LCR" 176 bool "SH7785LCR"
170 depends on CPU_SUBTYPE_SH7785 177 depends on CPU_SUBTYPE_SH7785
@@ -309,6 +316,17 @@ config SH_POLARIS
309 help 316 help
310 Select if configuring for an SMSC Polaris development board 317 Select if configuring for an SMSC Polaris development board
311 318
319config SH_SH2007
320 bool "SH-2007 board"
321 select NO_IOPORT
322 depends on CPU_SUBTYPE_SH7780
323 help
324 SH-2007 is a single-board computer based around SH7780 chip
325 intended for embedded applications.
326 It has an Ethernet interface (SMC9118), direct connected
327 Compact Flash socket, two serial ports and PC-104 bus.
328 More information at <http://sh2000.sh-linux.org>.
329
312endmenu 330endmenu
313 331
314source "arch/sh/boards/mach-r2d/Kconfig" 332source "arch/sh/boards/mach-r2d/Kconfig"
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index 4f90f9b7a922..38ef655cc0f0 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -2,6 +2,7 @@
2# Specific board support, not covered by a mach group. 2# Specific board support, not covered by a mach group.
3# 3#
4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o 4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
5obj-$(CONFIG_SH_SH2007) += board-sh2007.o
5obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 6obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
6obj-$(CONFIG_SH_URQUELL) += board-urquell.o 7obj-$(CONFIG_SH_URQUELL) += board-urquell.o
7obj-$(CONFIG_SH_SHMIN) += board-shmin.o 8obj-$(CONFIG_SH_SHMIN) += board-shmin.o
@@ -9,3 +10,4 @@ obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o
9obj-$(CONFIG_SH_ESPT) += board-espt.o 10obj-$(CONFIG_SH_ESPT) += board-espt.o
10obj-$(CONFIG_SH_POLARIS) += board-polaris.o 11obj-$(CONFIG_SH_POLARIS) += board-polaris.o
11obj-$(CONFIG_SH_TITAN) += board-titan.o 12obj-$(CONFIG_SH_TITAN) += board-titan.o
13obj-$(CONFIG_SH_SH7757LCR) += board-sh7757lcr.o
diff --git a/arch/sh/boards/board-sh2007.c b/arch/sh/boards/board-sh2007.c
new file mode 100644
index 000000000000..b90b78f6a829
--- /dev/null
+++ b/arch/sh/boards/board-sh2007.c
@@ -0,0 +1,133 @@
1/*
2 * SH-2007 board support.
3 *
4 * Copyright (C) 2003, 2004 SUGIOKA Toshinobu
5 * Copyright (C) 2010 Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
6 */
7#include <linux/init.h>
8#include <linux/irq.h>
9#include <linux/smsc911x.h>
10#include <linux/platform_device.h>
11#include <linux/ata_platform.h>
12#include <linux/io.h>
13#include <asm/machvec.h>
14#include <mach/sh2007.h>
15
16struct smsc911x_platform_config smc911x_info = {
17 .flags = SMSC911X_USE_32BIT,
18 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
19 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
20};
21
22static struct resource smsc9118_0_resources[] = {
23 [0] = {
24 .start = SMC0_BASE,
25 .end = SMC0_BASE + 0xff,
26 .flags = IORESOURCE_MEM,
27 },
28 [1] = {
29 .start = evt2irq(0x240),
30 .end = evt2irq(0x240),
31 .flags = IORESOURCE_IRQ,
32 }
33};
34
35static struct resource smsc9118_1_resources[] = {
36 [0] = {
37 .start = SMC1_BASE,
38 .end = SMC1_BASE + 0xff,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = evt2irq(0x280),
43 .end = evt2irq(0x280),
44 .flags = IORESOURCE_IRQ,
45 }
46};
47
48static struct platform_device smsc9118_0_device = {
49 .name = "smsc911x",
50 .id = 0,
51 .num_resources = ARRAY_SIZE(smsc9118_0_resources),
52 .resource = smsc9118_0_resources,
53 .dev = {
54 .platform_data = &smc911x_info,
55 },
56};
57
58static struct platform_device smsc9118_1_device = {
59 .name = "smsc911x",
60 .id = 1,
61 .num_resources = ARRAY_SIZE(smsc9118_1_resources),
62 .resource = smsc9118_1_resources,
63 .dev = {
64 .platform_data = &smc911x_info,
65 },
66};
67
68static struct resource cf_resources[] = {
69 [0] = {
70 .start = CF_BASE + CF_OFFSET,
71 .end = CF_BASE + CF_OFFSET + 0x0f,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = CF_BASE + CF_OFFSET + 0x206,
76 .end = CF_BASE + CF_OFFSET + 0x20f,
77 .flags = IORESOURCE_MEM,
78 },
79 [2] = {
80 .start = evt2irq(0x2c0),
81 .end = evt2irq(0x2c0),
82 .flags = IORESOURCE_IRQ,
83 },
84};
85
86static struct platform_device cf_device = {
87 .name = "pata_platform",
88 .id = 0,
89 .num_resources = ARRAY_SIZE(cf_resources),
90 .resource = cf_resources,
91};
92
93static struct platform_device *sh2007_devices[] __initdata = {
94 &smsc9118_0_device,
95 &smsc9118_1_device,
96 &cf_device,
97};
98
99static int __init sh2007_io_init(void)
100{
101 platform_add_devices(sh2007_devices, ARRAY_SIZE(sh2007_devices));
102 return 0;
103}
104subsys_initcall(sh2007_io_init);
105
106static void __init sh2007_init_irq(void)
107{
108 plat_irq_setup_pins(IRQ_MODE_IRQ);
109}
110
111/*
112 * Initialize the board
113 */
114static void __init sh2007_setup(char **cmdline_p)
115{
116 printk(KERN_INFO "SH-2007 Setup...");
117
118 /* setup wait control registers for area 5 */
119 __raw_writel(CS5BCR_D, CS5BCR);
120 __raw_writel(CS5WCR_D, CS5WCR);
121 __raw_writel(CS5PCR_D, CS5PCR);
122
123 printk(KERN_INFO " done.\n");
124}
125
126/*
127 * The Machine Vector
128 */
129struct sh_machine_vector mv_sh2007 __initmv = {
130 .mv_setup = sh2007_setup,
131 .mv_name = "sh2007",
132 .mv_init_irq = sh2007_init_irq,
133};
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
new file mode 100644
index 000000000000..c475f1056ab4
--- /dev/null
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -0,0 +1,374 @@
1/*
2 * Renesas R0P7757LC0012RL Support.
3 *
4 * Copyright (C) 2009 - 2010 Renesas Solutions Corp.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/gpio.h>
14#include <linux/irq.h>
15#include <linux/spi/spi.h>
16#include <linux/spi/flash.h>
17#include <linux/io.h>
18#include <cpu/sh7757.h>
19#include <asm/sh_eth.h>
20#include <asm/heartbeat.h>
21
22static struct resource heartbeat_resource = {
23 .start = 0xffec005c, /* PUDR */
24 .end = 0xffec005c,
25 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
26};
27
28static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3 };
29
30static struct heartbeat_data heartbeat_data = {
31 .bit_pos = heartbeat_bit_pos,
32 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
33 .flags = HEARTBEAT_INVERTED,
34};
35
36static struct platform_device heartbeat_device = {
37 .name = "heartbeat",
38 .id = -1,
39 .dev = {
40 .platform_data = &heartbeat_data,
41 },
42 .num_resources = 1,
43 .resource = &heartbeat_resource,
44};
45
46/* Fast Ethernet */
47static struct resource sh_eth0_resources[] = {
48 {
49 .start = 0xfef00000,
50 .end = 0xfef001ff,
51 .flags = IORESOURCE_MEM,
52 }, {
53 .start = 84,
54 .end = 84,
55 .flags = IORESOURCE_IRQ,
56 },
57};
58
59static struct sh_eth_plat_data sh7757_eth0_pdata = {
60 .phy = 1,
61 .edmac_endian = EDMAC_LITTLE_ENDIAN,
62};
63
64static struct platform_device sh7757_eth0_device = {
65 .name = "sh-eth",
66 .resource = sh_eth0_resources,
67 .id = 0,
68 .num_resources = ARRAY_SIZE(sh_eth0_resources),
69 .dev = {
70 .platform_data = &sh7757_eth0_pdata,
71 },
72};
73
74static struct resource sh_eth1_resources[] = {
75 {
76 .start = 0xfef00800,
77 .end = 0xfef009ff,
78 .flags = IORESOURCE_MEM,
79 }, {
80 .start = 84,
81 .end = 84,
82 .flags = IORESOURCE_IRQ,
83 },
84};
85
86static struct sh_eth_plat_data sh7757_eth1_pdata = {
87 .phy = 1,
88 .edmac_endian = EDMAC_LITTLE_ENDIAN,
89};
90
91static struct platform_device sh7757_eth1_device = {
92 .name = "sh-eth",
93 .resource = sh_eth1_resources,
94 .id = 1,
95 .num_resources = ARRAY_SIZE(sh_eth1_resources),
96 .dev = {
97 .platform_data = &sh7757_eth1_pdata,
98 },
99};
100
101static struct platform_device *sh7757lcr_devices[] __initdata = {
102 &heartbeat_device,
103 &sh7757_eth0_device,
104 &sh7757_eth1_device,
105};
106
107static int __init sh7757lcr_devices_setup(void)
108{
109 /* RGMII (PTA) */
110 gpio_request(GPIO_FN_ET0_MDC, NULL);
111 gpio_request(GPIO_FN_ET0_MDIO, NULL);
112 gpio_request(GPIO_FN_ET1_MDC, NULL);
113 gpio_request(GPIO_FN_ET1_MDIO, NULL);
114
115 /* ONFI (PTB, PTZ) */
116 gpio_request(GPIO_FN_ON_NRE, NULL);
117 gpio_request(GPIO_FN_ON_NWE, NULL);
118 gpio_request(GPIO_FN_ON_NWP, NULL);
119 gpio_request(GPIO_FN_ON_NCE0, NULL);
120 gpio_request(GPIO_FN_ON_R_B0, NULL);
121 gpio_request(GPIO_FN_ON_ALE, NULL);
122 gpio_request(GPIO_FN_ON_CLE, NULL);
123
124 gpio_request(GPIO_FN_ON_DQ7, NULL);
125 gpio_request(GPIO_FN_ON_DQ6, NULL);
126 gpio_request(GPIO_FN_ON_DQ5, NULL);
127 gpio_request(GPIO_FN_ON_DQ4, NULL);
128 gpio_request(GPIO_FN_ON_DQ3, NULL);
129 gpio_request(GPIO_FN_ON_DQ2, NULL);
130 gpio_request(GPIO_FN_ON_DQ1, NULL);
131 gpio_request(GPIO_FN_ON_DQ0, NULL);
132
133 /* IRQ8 to 0 (PTB, PTC) */
134 gpio_request(GPIO_FN_IRQ8, NULL);
135 gpio_request(GPIO_FN_IRQ7, NULL);
136 gpio_request(GPIO_FN_IRQ6, NULL);
137 gpio_request(GPIO_FN_IRQ5, NULL);
138 gpio_request(GPIO_FN_IRQ4, NULL);
139 gpio_request(GPIO_FN_IRQ3, NULL);
140 gpio_request(GPIO_FN_IRQ2, NULL);
141 gpio_request(GPIO_FN_IRQ1, NULL);
142 gpio_request(GPIO_FN_IRQ0, NULL);
143
144 /* SPI0 (PTD) */
145 gpio_request(GPIO_FN_SP0_MOSI, NULL);
146 gpio_request(GPIO_FN_SP0_MISO, NULL);
147 gpio_request(GPIO_FN_SP0_SCK, NULL);
148 gpio_request(GPIO_FN_SP0_SCK_FB, NULL);
149 gpio_request(GPIO_FN_SP0_SS0, NULL);
150 gpio_request(GPIO_FN_SP0_SS1, NULL);
151 gpio_request(GPIO_FN_SP0_SS2, NULL);
152 gpio_request(GPIO_FN_SP0_SS3, NULL);
153
154 /* RMII 0/1 (PTE, PTF) */
155 gpio_request(GPIO_FN_RMII0_CRS_DV, NULL);
156 gpio_request(GPIO_FN_RMII0_TXD1, NULL);
157 gpio_request(GPIO_FN_RMII0_TXD0, NULL);
158 gpio_request(GPIO_FN_RMII0_TXEN, NULL);
159 gpio_request(GPIO_FN_RMII0_REFCLK, NULL);
160 gpio_request(GPIO_FN_RMII0_RXD1, NULL);
161 gpio_request(GPIO_FN_RMII0_RXD0, NULL);
162 gpio_request(GPIO_FN_RMII0_RX_ER, NULL);
163 gpio_request(GPIO_FN_RMII1_CRS_DV, NULL);
164 gpio_request(GPIO_FN_RMII1_TXD1, NULL);
165 gpio_request(GPIO_FN_RMII1_TXD0, NULL);
166 gpio_request(GPIO_FN_RMII1_TXEN, NULL);
167 gpio_request(GPIO_FN_RMII1_REFCLK, NULL);
168 gpio_request(GPIO_FN_RMII1_RXD1, NULL);
169 gpio_request(GPIO_FN_RMII1_RXD0, NULL);
170 gpio_request(GPIO_FN_RMII1_RX_ER, NULL);
171
172 /* eMMC (PTG) */
173 gpio_request(GPIO_FN_MMCCLK, NULL);
174 gpio_request(GPIO_FN_MMCCMD, NULL);
175 gpio_request(GPIO_FN_MMCDAT7, NULL);
176 gpio_request(GPIO_FN_MMCDAT6, NULL);
177 gpio_request(GPIO_FN_MMCDAT5, NULL);
178 gpio_request(GPIO_FN_MMCDAT4, NULL);
179 gpio_request(GPIO_FN_MMCDAT3, NULL);
180 gpio_request(GPIO_FN_MMCDAT2, NULL);
181 gpio_request(GPIO_FN_MMCDAT1, NULL);
182 gpio_request(GPIO_FN_MMCDAT0, NULL);
183
184 /* LPC (PTG, PTH, PTQ, PTU) */
185 gpio_request(GPIO_FN_SERIRQ, NULL);
186 gpio_request(GPIO_FN_LPCPD, NULL);
187 gpio_request(GPIO_FN_LDRQ, NULL);
188 gpio_request(GPIO_FN_WP, NULL);
189 gpio_request(GPIO_FN_FMS0, NULL);
190 gpio_request(GPIO_FN_LAD3, NULL);
191 gpio_request(GPIO_FN_LAD2, NULL);
192 gpio_request(GPIO_FN_LAD1, NULL);
193 gpio_request(GPIO_FN_LAD0, NULL);
194 gpio_request(GPIO_FN_LFRAME, NULL);
195 gpio_request(GPIO_FN_LRESET, NULL);
196 gpio_request(GPIO_FN_LCLK, NULL);
197 gpio_request(GPIO_FN_LGPIO7, NULL);
198 gpio_request(GPIO_FN_LGPIO6, NULL);
199 gpio_request(GPIO_FN_LGPIO5, NULL);
200 gpio_request(GPIO_FN_LGPIO4, NULL);
201
202 /* SPI1 (PTH) */
203 gpio_request(GPIO_FN_SP1_MOSI, NULL);
204 gpio_request(GPIO_FN_SP1_MISO, NULL);
205 gpio_request(GPIO_FN_SP1_SCK, NULL);
206 gpio_request(GPIO_FN_SP1_SCK_FB, NULL);
207 gpio_request(GPIO_FN_SP1_SS0, NULL);
208 gpio_request(GPIO_FN_SP1_SS1, NULL);
209
210 /* SDHI (PTI) */
211 gpio_request(GPIO_FN_SD_WP, NULL);
212 gpio_request(GPIO_FN_SD_CD, NULL);
213 gpio_request(GPIO_FN_SD_CLK, NULL);
214 gpio_request(GPIO_FN_SD_CMD, NULL);
215 gpio_request(GPIO_FN_SD_D3, NULL);
216 gpio_request(GPIO_FN_SD_D2, NULL);
217 gpio_request(GPIO_FN_SD_D1, NULL);
218 gpio_request(GPIO_FN_SD_D0, NULL);
219
220 /* SCIF3/4 (PTJ, PTW) */
221 gpio_request(GPIO_FN_RTS3, NULL);
222 gpio_request(GPIO_FN_CTS3, NULL);
223 gpio_request(GPIO_FN_TXD3, NULL);
224 gpio_request(GPIO_FN_RXD3, NULL);
225 gpio_request(GPIO_FN_RTS4, NULL);
226 gpio_request(GPIO_FN_RXD4, NULL);
227 gpio_request(GPIO_FN_TXD4, NULL);
228 gpio_request(GPIO_FN_CTS4, NULL);
229
230 /* SERMUX (PTK, PTL, PTO, PTV) */
231 gpio_request(GPIO_FN_COM2_TXD, NULL);
232 gpio_request(GPIO_FN_COM2_RXD, NULL);
233 gpio_request(GPIO_FN_COM2_RTS, NULL);
234 gpio_request(GPIO_FN_COM2_CTS, NULL);
235 gpio_request(GPIO_FN_COM2_DTR, NULL);
236 gpio_request(GPIO_FN_COM2_DSR, NULL);
237 gpio_request(GPIO_FN_COM2_DCD, NULL);
238 gpio_request(GPIO_FN_COM2_RI, NULL);
239 gpio_request(GPIO_FN_RAC_RXD, NULL);
240 gpio_request(GPIO_FN_RAC_RTS, NULL);
241 gpio_request(GPIO_FN_RAC_CTS, NULL);
242 gpio_request(GPIO_FN_RAC_DTR, NULL);
243 gpio_request(GPIO_FN_RAC_DSR, NULL);
244 gpio_request(GPIO_FN_RAC_DCD, NULL);
245 gpio_request(GPIO_FN_RAC_TXD, NULL);
246 gpio_request(GPIO_FN_COM1_TXD, NULL);
247 gpio_request(GPIO_FN_COM1_RXD, NULL);
248 gpio_request(GPIO_FN_COM1_RTS, NULL);
249 gpio_request(GPIO_FN_COM1_CTS, NULL);
250
251 writeb(0x10, 0xfe470000); /* SMR0: SerMux mode 0 */
252
253 /* IIC (PTM, PTR, PTS) */
254 gpio_request(GPIO_FN_SDA7, NULL);
255 gpio_request(GPIO_FN_SCL7, NULL);
256 gpio_request(GPIO_FN_SDA6, NULL);
257 gpio_request(GPIO_FN_SCL6, NULL);
258 gpio_request(GPIO_FN_SDA5, NULL);
259 gpio_request(GPIO_FN_SCL5, NULL);
260 gpio_request(GPIO_FN_SDA4, NULL);
261 gpio_request(GPIO_FN_SCL4, NULL);
262 gpio_request(GPIO_FN_SDA3, NULL);
263 gpio_request(GPIO_FN_SCL3, NULL);
264 gpio_request(GPIO_FN_SDA2, NULL);
265 gpio_request(GPIO_FN_SCL2, NULL);
266 gpio_request(GPIO_FN_SDA1, NULL);
267 gpio_request(GPIO_FN_SCL1, NULL);
268 gpio_request(GPIO_FN_SDA0, NULL);
269 gpio_request(GPIO_FN_SCL0, NULL);
270
271 /* USB (PTN) */
272 gpio_request(GPIO_FN_VBUS_EN, NULL);
273 gpio_request(GPIO_FN_VBUS_OC, NULL);
274
275 /* SGPIO1/0 (PTN, PTO) */
276 gpio_request(GPIO_FN_SGPIO1_CLK, NULL);
277 gpio_request(GPIO_FN_SGPIO1_LOAD, NULL);
278 gpio_request(GPIO_FN_SGPIO1_DI, NULL);
279 gpio_request(GPIO_FN_SGPIO1_DO, NULL);
280 gpio_request(GPIO_FN_SGPIO0_CLK, NULL);
281 gpio_request(GPIO_FN_SGPIO0_LOAD, NULL);
282 gpio_request(GPIO_FN_SGPIO0_DI, NULL);
283 gpio_request(GPIO_FN_SGPIO0_DO, NULL);
284
285 /* WDT (PTN) */
286 gpio_request(GPIO_FN_SUB_CLKIN, NULL);
287
288 /* System (PTT) */
289 gpio_request(GPIO_FN_STATUS1, NULL);
290 gpio_request(GPIO_FN_STATUS0, NULL);
291
292 /* PWMX (PTT) */
293 gpio_request(GPIO_FN_PWMX1, NULL);
294 gpio_request(GPIO_FN_PWMX0, NULL);
295
296 /* R-SPI (PTV) */
297 gpio_request(GPIO_FN_R_SPI_MOSI, NULL);
298 gpio_request(GPIO_FN_R_SPI_MISO, NULL);
299 gpio_request(GPIO_FN_R_SPI_RSPCK, NULL);
300 gpio_request(GPIO_FN_R_SPI_SSL0, NULL);
301 gpio_request(GPIO_FN_R_SPI_SSL1, NULL);
302
303 /* EVC (PTV, PTW) */
304 gpio_request(GPIO_FN_EVENT7, NULL);
305 gpio_request(GPIO_FN_EVENT6, NULL);
306 gpio_request(GPIO_FN_EVENT5, NULL);
307 gpio_request(GPIO_FN_EVENT4, NULL);
308 gpio_request(GPIO_FN_EVENT3, NULL);
309 gpio_request(GPIO_FN_EVENT2, NULL);
310 gpio_request(GPIO_FN_EVENT1, NULL);
311 gpio_request(GPIO_FN_EVENT0, NULL);
312
313 /* LED for heartbeat */
314 gpio_request(GPIO_PTU3, NULL);
315 gpio_direction_output(GPIO_PTU3, 1);
316 gpio_request(GPIO_PTU2, NULL);
317 gpio_direction_output(GPIO_PTU2, 1);
318 gpio_request(GPIO_PTU1, NULL);
319 gpio_direction_output(GPIO_PTU1, 1);
320 gpio_request(GPIO_PTU0, NULL);
321 gpio_direction_output(GPIO_PTU0, 1);
322
323 /* control for MDIO of Gigabit Ethernet */
324 gpio_request(GPIO_PTT4, NULL);
325 gpio_direction_output(GPIO_PTT4, 1);
326
327 /* control for eMMC */
328 gpio_request(GPIO_PTT7, NULL); /* eMMC_RST# */
329 gpio_direction_output(GPIO_PTT7, 0);
330 gpio_request(GPIO_PTT6, NULL); /* eMMC_INDEX# */
331 gpio_direction_output(GPIO_PTT6, 0);
332 gpio_request(GPIO_PTT5, NULL); /* eMMC_PRST# */
333 gpio_direction_output(GPIO_PTT5, 1);
334
335 /* General platform */
336 return platform_add_devices(sh7757lcr_devices,
337 ARRAY_SIZE(sh7757lcr_devices));
338}
339arch_initcall(sh7757lcr_devices_setup);
340
341/* Initialize IRQ setting */
342void __init init_sh7757lcr_IRQ(void)
343{
344 plat_irq_setup_pins(IRQ_MODE_IRQ7654);
345 plat_irq_setup_pins(IRQ_MODE_IRQ3210);
346}
347
348/* Initialize the board */
349static void __init sh7757lcr_setup(char **cmdline_p)
350{
351 printk(KERN_INFO "Renesas R0P7757LC0012RL support.\n");
352}
353
354static int sh7757lcr_mode_pins(void)
355{
356 int value = 0;
357
358 /* These are the factory default settings of S3 (Low active).
359 * If you change these dip switches then you will need to
360 * adjust the values below as well.
361 */
362 value |= MODE_PIN0; /* Clock Mode: 1 */
363
364 return value;
365}
366
367/* The Machine Vector */
368static struct sh_machine_vector mv_sh7757lcr __initmv = {
369 .mv_name = "SH7757LCR",
370 .mv_setup = sh7757lcr_setup,
371 .mv_init_irq = init_sh7757lcr_IRQ,
372 .mv_mode_pins = sh7757lcr_mode_pins,
373};
374
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 1d7b495a7db4..71a3368ab1fc 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -1248,14 +1248,14 @@ static int __init arch_setup(void)
1248 1248
1249 /* set SPU2 clock to 83.4 MHz */ 1249 /* set SPU2 clock to 83.4 MHz */
1250 clk = clk_get(NULL, "spu_clk"); 1250 clk = clk_get(NULL, "spu_clk");
1251 if (clk) { 1251 if (!IS_ERR(clk)) {
1252 clk_set_rate(clk, clk_round_rate(clk, 83333333)); 1252 clk_set_rate(clk, clk_round_rate(clk, 83333333));
1253 clk_put(clk); 1253 clk_put(clk);
1254 } 1254 }
1255 1255
1256 /* change parent of FSI B */ 1256 /* change parent of FSI B */
1257 clk = clk_get(NULL, "fsib_clk"); 1257 clk = clk_get(NULL, "fsib_clk");
1258 if (clk) { 1258 if (!IS_ERR(clk)) {
1259 clk_register(&fsimckb_clk); 1259 clk_register(&fsimckb_clk);
1260 clk_set_parent(clk, &fsimckb_clk); 1260 clk_set_parent(clk, &fsimckb_clk);
1261 clk_set_rate(clk, 11000); 1261 clk_set_rate(clk, 11000);
@@ -1273,7 +1273,7 @@ static int __init arch_setup(void)
1273 1273
1274 /* set VPU clock to 166 MHz */ 1274 /* set VPU clock to 166 MHz */
1275 clk = clk_get(NULL, "vpu_clk"); 1275 clk = clk_get(NULL, "vpu_clk");
1276 if (clk) { 1276 if (!IS_ERR(clk)) {
1277 clk_set_rate(clk, clk_round_rate(clk, 166000000)); 1277 clk_set_rate(clk, clk_round_rate(clk, 166000000));
1278 clk_put(clk); 1278 clk_put(clk);
1279 } 1279 }
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile
index a29f19e85b63..23ff7d4ac491 100644
--- a/arch/sh/boards/mach-sdk7786/Makefile
+++ b/arch/sh/boards/mach-sdk7786/Makefile
@@ -1 +1,4 @@
1obj-y := setup.o fpga.o irq.o 1obj-y := fpga.o irq.o setup.o
2
3obj-$(CONFIG_GENERIC_GPIO) += gpio.o
4obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o
diff --git a/arch/sh/boards/mach-sdk7786/gpio.c b/arch/sh/boards/mach-sdk7786/gpio.c
new file mode 100644
index 000000000000..f71ce09d4e15
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/gpio.c
@@ -0,0 +1,49 @@
1/*
2 * SDK7786 FPGA USRGPIR Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/interrupt.h>
12#include <linux/gpio.h>
13#include <linux/irq.h>
14#include <linux/kernel.h>
15#include <linux/spinlock.h>
16#include <linux/io.h>
17#include <mach/fpga.h>
18
19#define NR_FPGA_GPIOS 8
20
21static const char *usrgpir_gpio_names[NR_FPGA_GPIOS] = {
22 "in0", "in1", "in2", "in3", "in4", "in5", "in6", "in7",
23};
24
25static int usrgpir_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
26{
27 /* always in */
28 return 0;
29}
30
31static int usrgpir_gpio_get(struct gpio_chip *chip, unsigned gpio)
32{
33 return !!(fpga_read_reg(USRGPIR) & (1 << gpio));
34}
35
36static struct gpio_chip usrgpir_gpio_chip = {
37 .label = "sdk7786-fpga",
38 .names = usrgpir_gpio_names,
39 .direction_input = usrgpir_gpio_direction_input,
40 .get = usrgpir_gpio_get,
41 .base = -1, /* don't care */
42 .ngpio = NR_FPGA_GPIOS,
43};
44
45static int __init usrgpir_gpio_setup(void)
46{
47 return gpiochip_add(&usrgpir_gpio_chip);
48}
49device_initcall(usrgpir_gpio_setup);
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 2ec1ea5cf8ef..7e0c4e3878e0 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -20,6 +20,8 @@
20#include <asm/machvec.h> 20#include <asm/machvec.h>
21#include <asm/heartbeat.h> 21#include <asm/heartbeat.h>
22#include <asm/sizes.h> 22#include <asm/sizes.h>
23#include <asm/clock.h>
24#include <asm/clkdev.h>
23#include <asm/reboot.h> 25#include <asm/reboot.h>
24#include <asm/smp-ops.h> 26#include <asm/smp-ops.h>
25 27
@@ -140,6 +142,45 @@ static int sdk7786_mode_pins(void)
140 return fpga_read_reg(MODSWR); 142 return fpga_read_reg(MODSWR);
141} 143}
142 144
145/*
146 * FPGA-driven PCIe clocks
147 *
148 * Historically these include the oscillator, clock B (slots 2/3/4) and
149 * clock A (slot 1 and the CPU clock). Newer revs of the PCB shove
150 * everything under a single PCIe clocks enable bit that happens to map
151 * to the same bit position as the oscillator bit for earlier FPGA
152 * versions.
153 *
154 * Given that the legacy clocks have the side-effect of shutting the CPU
155 * off through the FPGA along with the PCI slots, we simply leave them in
156 * their initial state and don't bother registering them with the clock
157 * framework.
158 */
159static int sdk7786_pcie_clk_enable(struct clk *clk)
160{
161 fpga_write_reg(fpga_read_reg(PCIECR) | PCIECR_CLKEN, PCIECR);
162 return 0;
163}
164
165static void sdk7786_pcie_clk_disable(struct clk *clk)
166{
167 fpga_write_reg(fpga_read_reg(PCIECR) & ~PCIECR_CLKEN, PCIECR);
168}
169
170static struct clk_ops sdk7786_pcie_clk_ops = {
171 .enable = sdk7786_pcie_clk_enable,
172 .disable = sdk7786_pcie_clk_disable,
173};
174
175static struct clk sdk7786_pcie_clk = {
176 .ops = &sdk7786_pcie_clk_ops,
177};
178
179static struct clk_lookup sdk7786_pcie_cl = {
180 .con_id = "pcie_plat_clk",
181 .clk = &sdk7786_pcie_clk,
182};
183
143static int sdk7786_clk_init(void) 184static int sdk7786_clk_init(void)
144{ 185{
145 struct clk *clk; 186 struct clk *clk;
@@ -158,7 +199,18 @@ static int sdk7786_clk_init(void)
158 ret = clk_set_rate(clk, 33333333); 199 ret = clk_set_rate(clk, 33333333);
159 clk_put(clk); 200 clk_put(clk);
160 201
161 return ret; 202 /*
203 * Setup the FPGA clocks.
204 */
205 ret = clk_register(&sdk7786_pcie_clk);
206 if (unlikely(ret)) {
207 pr_err("FPGA clock registration failed\n");
208 return ret;
209 }
210
211 clkdev_add(&sdk7786_pcie_cl);
212
213 return 0;
162} 214}
163 215
164static void sdk7786_restart(char *cmd) 216static void sdk7786_restart(char *cmd)
diff --git a/arch/sh/boards/mach-sdk7786/sram.c b/arch/sh/boards/mach-sdk7786/sram.c
new file mode 100644
index 000000000000..c81c3abbe01c
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/sram.c
@@ -0,0 +1,72 @@
1/*
2 * SDK7786 FPGA SRAM Support.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/io.h>
16#include <linux/string.h>
17#include <mach/fpga.h>
18#include <asm/sram.h>
19#include <asm/sizes.h>
20
21static int __init fpga_sram_init(void)
22{
23 unsigned long phys;
24 unsigned int area;
25 void __iomem *vaddr;
26 int ret;
27 u16 data;
28
29 /* Enable FPGA SRAM */
30 data = fpga_read_reg(LCLASR);
31 data |= LCLASR_FRAMEN;
32 fpga_write_reg(data, LCLASR);
33
34 /*
35 * FPGA_SEL determines the area mapping
36 */
37 area = (data & LCLASR_FPGA_SEL_MASK) >> LCLASR_FPGA_SEL_SHIFT;
38 if (unlikely(area == LCLASR_AREA_MASK)) {
39 pr_err("FPGA memory unmapped.\n");
40 return -ENXIO;
41 }
42
43 /*
44 * The memory itself occupies a 2KiB range at the top of the area
45 * immediately below the system registers.
46 */
47 phys = (area << 26) + SZ_64M - SZ_4K;
48
49 /*
50 * The FPGA SRAM resides in translatable physical space, so set
51 * up a mapping prior to inserting it in to the pool.
52 */
53 vaddr = ioremap(phys, SZ_2K);
54 if (unlikely(!vaddr)) {
55 pr_err("Failed remapping FPGA memory.\n");
56 return -ENXIO;
57 }
58
59 pr_info("Adding %dKiB of FPGA memory at 0x%08lx-0x%08lx "
60 "(area %d) to pool.\n",
61 SZ_2K >> 10, phys, phys + SZ_2K - 1, area);
62
63 ret = gen_pool_add(sram_pool, (unsigned long)vaddr, SZ_2K, -1);
64 if (unlikely(ret < 0)) {
65 pr_err("Failed adding memory\n");
66 iounmap(vaddr);
67 return ret;
68 }
69
70 return 0;
71}
72postcore_initcall(fpga_sram_init);
diff --git a/arch/sh/boards/mach-x3proto/Makefile b/arch/sh/boards/mach-x3proto/Makefile
index 983e4551fecf..708c21c919ff 100644
--- a/arch/sh/boards/mach-x3proto/Makefile
+++ b/arch/sh/boards/mach-x3proto/Makefile
@@ -1 +1,3 @@
1obj-y += setup.o ilsel.o 1obj-y += setup.o ilsel.o
2
3obj-$(CONFIG_GENERIC_GPIO) += gpio.o
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
new file mode 100644
index 000000000000..594adf76e46a
--- /dev/null
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -0,0 +1,135 @@
1/*
2 * arch/sh/boards/mach-x3proto/gpio.c
3 *
4 * Renesas SH-X3 Prototype Baseboard GPIO Support.
5 *
6 * Copyright (C) 2010 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/gpio.h>
17#include <linux/irq.h>
18#include <linux/kernel.h>
19#include <linux/spinlock.h>
20#include <linux/io.h>
21#include <mach/ilsel.h>
22#include <mach/hardware.h>
23
24#define KEYCTLR 0xb81c0000
25#define KEYOUTR 0xb81c0002
26#define KEYDETR 0xb81c0004
27
28static DEFINE_SPINLOCK(x3proto_gpio_lock);
29static unsigned int x3proto_gpio_irq_map[NR_BASEBOARD_GPIOS] = { 0, };
30
31static int x3proto_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
32{
33 unsigned long flags;
34 unsigned int data;
35
36 spin_lock_irqsave(&x3proto_gpio_lock, flags);
37 data = __raw_readw(KEYCTLR);
38 data |= (1 << gpio);
39 __raw_writew(data, KEYCTLR);
40 spin_unlock_irqrestore(&x3proto_gpio_lock, flags);
41
42 return 0;
43}
44
45static int x3proto_gpio_get(struct gpio_chip *chip, unsigned gpio)
46{
47 return !!(__raw_readw(KEYDETR) & (1 << gpio));
48}
49
50static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
51{
52 return x3proto_gpio_irq_map[gpio];
53}
54
55static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
56{
57 struct irq_chip *chip = get_irq_desc_chip(desc);
58 unsigned long mask;
59 int pin;
60
61 chip->mask_ack(irq);
62
63 mask = __raw_readw(KEYDETR);
64
65 for_each_set_bit(pin, &mask, NR_BASEBOARD_GPIOS)
66 generic_handle_irq(x3proto_gpio_to_irq(NULL, pin));
67
68 chip->unmask(irq);
69}
70
71struct gpio_chip x3proto_gpio_chip = {
72 .label = "x3proto-gpio",
73 .direction_input = x3proto_gpio_direction_input,
74 .get = x3proto_gpio_get,
75 .to_irq = x3proto_gpio_to_irq,
76 .base = -1,
77 .ngpio = NR_BASEBOARD_GPIOS,
78};
79
80int __init x3proto_gpio_setup(void)
81{
82 int ilsel;
83 int ret, i;
84
85 ilsel = ilsel_enable(ILSEL_KEY);
86 if (unlikely(ilsel < 0))
87 return ilsel;
88
89 ret = gpiochip_add(&x3proto_gpio_chip);
90 if (unlikely(ret))
91 goto err_gpio;
92
93 for (i = 0; i < NR_BASEBOARD_GPIOS; i++) {
94 unsigned long flags;
95 int irq = create_irq();
96
97 if (unlikely(irq < 0)) {
98 ret = -EINVAL;
99 goto err_irq;
100 }
101
102 spin_lock_irqsave(&x3proto_gpio_lock, flags);
103 x3proto_gpio_irq_map[i] = irq;
104 set_irq_chip_and_handler_name(irq, &dummy_irq_chip,
105 handle_simple_irq, "gpio");
106 spin_unlock_irqrestore(&x3proto_gpio_lock, flags);
107 }
108
109 pr_info("registering '%s' support, handling GPIOs %u -> %u, "
110 "bound to IRQ %u\n",
111 x3proto_gpio_chip.label, x3proto_gpio_chip.base,
112 x3proto_gpio_chip.base + x3proto_gpio_chip.ngpio,
113 ilsel);
114
115 set_irq_chained_handler(ilsel, x3proto_gpio_irq_handler);
116 set_irq_wake(ilsel, 1);
117
118 return 0;
119
120err_irq:
121 for (; i >= 0; --i)
122 if (x3proto_gpio_irq_map[i])
123 destroy_irq(x3proto_gpio_irq_map[i]);
124
125 ret = gpiochip_remove(&x3proto_gpio_chip);
126 if (unlikely(ret))
127 pr_err("Failed deregistering GPIO\n");
128
129err_gpio:
130 synchronize_irq(ilsel);
131
132 ilsel_disable(ILSEL_KEY);
133
134 return ret;
135}
diff --git a/arch/sh/boards/mach-x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
index 5c9842704c60..95e346139515 100644
--- a/arch/sh/boards/mach-x3proto/ilsel.c
+++ b/arch/sh/boards/mach-x3proto/ilsel.c
@@ -1,20 +1,22 @@
1/* 1/*
2 * arch/sh/boards/renesas/x3proto/ilsel.c 2 * arch/sh/boards/mach-x3proto/ilsel.c
3 * 3 *
4 * Helper routines for SH-X3 proto board ILSEL. 4 * Helper routines for SH-X3 proto board ILSEL.
5 * 5 *
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 - 2010 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 */ 11 */
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/kernel.h> 15#include <linux/kernel.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <linux/bitmap.h> 17#include <linux/bitmap.h>
16#include <linux/io.h> 18#include <linux/io.h>
17#include <asm/ilsel.h> 19#include <mach/ilsel.h>
18 20
19/* 21/*
20 * ILSEL is split across: 22 * ILSEL is split across:
@@ -64,6 +66,8 @@ static void __ilsel_enable(ilsel_source_t set, unsigned int bit)
64 unsigned int tmp, shift; 66 unsigned int tmp, shift;
65 unsigned long addr; 67 unsigned long addr;
66 68
69 pr_notice("enabling ILSEL set %d\n", set);
70
67 addr = mk_ilsel_addr(bit); 71 addr = mk_ilsel_addr(bit);
68 shift = mk_ilsel_shift(bit); 72 shift = mk_ilsel_shift(bit);
69 73
@@ -92,8 +96,10 @@ int ilsel_enable(ilsel_source_t set)
92{ 96{
93 unsigned int bit; 97 unsigned int bit;
94 98
95 /* Aliased sources must use ilsel_enable_fixed() */ 99 if (unlikely(set > ILSEL_KEY)) {
96 BUG_ON(set > ILSEL_KEY); 100 pr_err("Aliased sources must use ilsel_enable_fixed()\n");
101 return -EINVAL;
102 }
97 103
98 do { 104 do {
99 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS); 105 bit = find_first_zero_bit(&ilsel_level_map, ILSEL_LEVELS);
@@ -140,6 +146,8 @@ void ilsel_disable(unsigned int irq)
140 unsigned long addr; 146 unsigned long addr;
141 unsigned int tmp; 147 unsigned int tmp;
142 148
149 pr_notice("disabling ILSEL set %d\n", irq);
150
143 addr = mk_ilsel_addr(irq); 151 addr = mk_ilsel_addr(irq);
144 152
145 tmp = __raw_readw(addr); 153 tmp = __raw_readw(addr);
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index 102bf56befb4..d682e2b6a856 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * arch/sh/boards/renesas/x3proto/setup.c 2 * arch/sh/boards/mach-x3proto/setup.c
3 * 3 *
4 * Renesas SH-X3 Prototype Board Support. 4 * Renesas SH-X3 Prototype Board Support.
5 * 5 *
6 * Copyright (C) 2007 - 2008 Paul Mundt 6 * Copyright (C) 2007 - 2010 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -16,9 +16,13 @@
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/input.h>
19#include <linux/usb/r8a66597.h> 20#include <linux/usb/r8a66597.h>
20#include <linux/usb/m66592.h> 21#include <linux/usb/m66592.h>
21#include <asm/ilsel.h> 22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
24#include <mach/ilsel.h>
25#include <mach/hardware.h>
22#include <asm/smp-ops.h> 26#include <asm/smp-ops.h>
23 27
24static struct resource heartbeat_resources[] = { 28static struct resource heartbeat_resources[] = {
@@ -122,15 +126,128 @@ static struct platform_device m66592_usb_peripheral_device = {
122 .resource = m66592_usb_peripheral_resources, 126 .resource = m66592_usb_peripheral_resources,
123}; 127};
124 128
129static struct gpio_keys_button baseboard_buttons[NR_BASEBOARD_GPIOS] = {
130 {
131 .desc = "key44",
132 .code = KEY_POWER,
133 .active_low = 1,
134 .wakeup = 1,
135 }, {
136 .desc = "key43",
137 .code = KEY_SUSPEND,
138 .active_low = 1,
139 .wakeup = 1,
140 }, {
141 .desc = "key42",
142 .code = KEY_KATAKANAHIRAGANA,
143 .active_low = 1,
144 }, {
145 .desc = "key41",
146 .code = KEY_SWITCHVIDEOMODE,
147 .active_low = 1,
148 }, {
149 .desc = "key34",
150 .code = KEY_F12,
151 .active_low = 1,
152 }, {
153 .desc = "key33",
154 .code = KEY_F11,
155 .active_low = 1,
156 }, {
157 .desc = "key32",
158 .code = KEY_F10,
159 .active_low = 1,
160 }, {
161 .desc = "key31",
162 .code = KEY_F9,
163 .active_low = 1,
164 }, {
165 .desc = "key24",
166 .code = KEY_F8,
167 .active_low = 1,
168 }, {
169 .desc = "key23",
170 .code = KEY_F7,
171 .active_low = 1,
172 }, {
173 .desc = "key22",
174 .code = KEY_F6,
175 .active_low = 1,
176 }, {
177 .desc = "key21",
178 .code = KEY_F5,
179 .active_low = 1,
180 }, {
181 .desc = "key14",
182 .code = KEY_F4,
183 .active_low = 1,
184 }, {
185 .desc = "key13",
186 .code = KEY_F3,
187 .active_low = 1,
188 }, {
189 .desc = "key12",
190 .code = KEY_F2,
191 .active_low = 1,
192 }, {
193 .desc = "key11",
194 .code = KEY_F1,
195 .active_low = 1,
196 },
197};
198
199static struct gpio_keys_platform_data baseboard_buttons_data = {
200 .buttons = baseboard_buttons,
201 .nbuttons = ARRAY_SIZE(baseboard_buttons),
202};
203
204static struct platform_device baseboard_buttons_device = {
205 .name = "gpio-keys",
206 .id = -1,
207 .dev = {
208 .platform_data = &baseboard_buttons_data,
209 },
210};
211
125static struct platform_device *x3proto_devices[] __initdata = { 212static struct platform_device *x3proto_devices[] __initdata = {
126 &heartbeat_device, 213 &heartbeat_device,
127 &smc91x_device, 214 &smc91x_device,
128 &r8a66597_usb_host_device, 215 &r8a66597_usb_host_device,
129 &m66592_usb_peripheral_device, 216 &m66592_usb_peripheral_device,
217 &baseboard_buttons_device,
130}; 218};
131 219
220static void __init x3proto_init_irq(void)
221{
222 plat_irq_setup_pins(IRQ_MODE_IRL3210);
223
224 /* Set ICR0.LVLMODE */
225 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
226}
227
132static int __init x3proto_devices_setup(void) 228static int __init x3proto_devices_setup(void)
133{ 229{
230 int ret, i;
231
232 /*
233 * IRLs are only needed for ILSEL mappings, so flip over the INTC
234 * pins at a later point to enable the GPIOs to settle.
235 */
236 x3proto_init_irq();
237
238 /*
239 * Now that ILSELs are available, set up the baseboard GPIOs.
240 */
241 ret = x3proto_gpio_setup();
242 if (unlikely(ret))
243 return ret;
244
245 /*
246 * Propagate dynamic GPIOs for the baseboard button device.
247 */
248 for (i = 0; i < ARRAY_SIZE(baseboard_buttons); i++)
249 baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i;
250
134 r8a66597_usb_host_resources[1].start = 251 r8a66597_usb_host_resources[1].start =
135 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); 252 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);
136 253
@@ -145,14 +262,6 @@ static int __init x3proto_devices_setup(void)
145} 262}
146device_initcall(x3proto_devices_setup); 263device_initcall(x3proto_devices_setup);
147 264
148static void __init x3proto_init_irq(void)
149{
150 plat_irq_setup_pins(IRQ_MODE_IRL3210);
151
152 /* Set ICR0.LVLMODE */
153 __raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);
154}
155
156static void __init x3proto_setup(char **cmdline_p) 265static void __init x3proto_setup(char **cmdline_p)
157{ 266{
158 register_smp_ops(&shx3_smp_ops); 267 register_smp_ops(&shx3_smp_ops);
@@ -161,5 +270,4 @@ static void __init x3proto_setup(char **cmdline_p)
161static struct sh_machine_vector mv_x3proto __initmv = { 270static struct sh_machine_vector mv_x3proto __initmv = {
162 .mv_name = "x3proto", 271 .mv_name = "x3proto",
163 .mv_setup = x3proto_setup, 272 .mv_setup = x3proto_setup,
164 .mv_init_irq = x3proto_init_irq,
165}; 273};
diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S
index 200c1d4f1efe..3e150326f1fd 100644
--- a/arch/sh/boot/compressed/head_32.S
+++ b/arch/sh/boot/compressed/head_32.S
@@ -91,7 +91,9 @@ bss_start_addr:
91end_addr: 91end_addr:
92 .long _end 92 .long _end
93init_sr: 93init_sr:
94 .long 0x400000F0 /* Privileged mode, Bank=0, Block=0, IMASK=0xF */ 94 .long 0x500000F0 /* Privileged mode, Bank=0, Block=1, IMASK=0xF */
95kexec_magic:
96 .long 0x400000F0 /* magic used by kexec to parse zImage format */
95init_stack_addr: 97init_stack_addr:
96 .long stack_start 98 .long stack_start
97decompress_kernel_addr: 99decompress_kernel_addr:
diff --git a/arch/sh/cchips/hd6446x/Makefile b/arch/sh/cchips/hd6446x/Makefile
index 9682e3ab668f..59c348337bb8 100644
--- a/arch/sh/cchips/hd6446x/Makefile
+++ b/arch/sh/cchips/hd6446x/Makefile
@@ -1,3 +1,3 @@
1obj-$(CONFIG_HD64461) += hd64461.o 1obj-$(CONFIG_HD64461) += hd64461.o
2 2
3EXTRA_CFLAGS += -Werror 3ccflags-y := -Werror
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig
index 238d6833ac70..e5335123b5e9 100644
--- a/arch/sh/configs/ap325rxa_defconfig
+++ b/arch/sh/configs/ap325rxa_defconfig
@@ -3,7 +3,6 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_BSD_PROCESS_ACCT=y 4CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
8CONFIG_SLAB=y 7CONFIG_SLAB=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
diff --git a/arch/sh/configs/cayman_defconfig b/arch/sh/configs/cayman_defconfig
index b3bf11bcf025..67e150631ea5 100644
--- a/arch/sh/configs/cayman_defconfig
+++ b/arch/sh/configs/cayman_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_SLAB=y 5CONFIG_SLAB=y
7CONFIG_MODULES=y 6CONFIG_MODULES=y
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index 3cdee4f0c184..ec243ca29529 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_defconfig
@@ -2,7 +2,6 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y
6# CONFIG_SYSCTL_SYSCALL is not set 5# CONFIG_SYSCTL_SYSCALL is not set
7CONFIG_SLAB=y 6CONFIG_SLAB=y
8CONFIG_PROFILING=y 7CONFIG_PROFILING=y
diff --git a/arch/sh/configs/ecovec24-romimage_defconfig b/arch/sh/configs/ecovec24-romimage_defconfig
index 021633b02835..5fcb17bff24a 100644
--- a/arch/sh/configs/ecovec24-romimage_defconfig
+++ b/arch/sh/configs/ecovec24-romimage_defconfig
@@ -5,7 +5,6 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
10# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
11CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/sh/configs/edosk7760_defconfig b/arch/sh/configs/edosk7760_defconfig
index 365f2318e9b5..e1077a041ac3 100644
--- a/arch/sh/configs/edosk7760_defconfig
+++ b/arch/sh/configs/edosk7760_defconfig
@@ -5,7 +5,6 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
10CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
11CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/sh/configs/espt_defconfig b/arch/sh/configs/espt_defconfig
index ca7fc1b3d567..67cb1094a033 100644
--- a/arch/sh/configs/espt_defconfig
+++ b/arch/sh/configs/espt_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_NAMESPACES=y 6CONFIG_NAMESPACES=y
8CONFIG_UTS_NS=y 7CONFIG_UTS_NS=y
9CONFIG_IPC_NS=y 8CONFIG_IPC_NS=y
diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
index 45c18a3830d2..496edcdf95a3 100644
--- a/arch/sh/configs/hp6xx_defconfig
+++ b/arch/sh/configs/hp6xx_defconfig
@@ -3,7 +3,6 @@ CONFIG_BSD_PROCESS_ACCT=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
9CONFIG_SLAB=y 8CONFIG_SLAB=y
diff --git a/arch/sh/configs/kfr2r09-romimage_defconfig b/arch/sh/configs/kfr2r09-romimage_defconfig
index d4268b1953bc..029a506ca325 100644
--- a/arch/sh/configs/kfr2r09-romimage_defconfig
+++ b/arch/sh/configs/kfr2r09-romimage_defconfig
@@ -5,7 +5,6 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
10# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
11CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/sh/configs/kfr2r09_defconfig b/arch/sh/configs/kfr2r09_defconfig
index ad5d296b375f..fac13ded07b2 100644
--- a/arch/sh/configs/kfr2r09_defconfig
+++ b/arch/sh/configs/kfr2r09_defconfig
@@ -5,7 +5,6 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
10# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
11CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index 14e658e9318f..3670e937f2b7 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5# CONFIG_SYSCTL_SYSCALL is not set 4# CONFIG_SYSCTL_SYSCALL is not set
6CONFIG_KALLSYMS_EXTRA_PASS=y 5CONFIG_KALLSYMS_EXTRA_PASS=y
7CONFIG_SLAB=y 6CONFIG_SLAB=y
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index 6be7eaaa8bb6..e3c0894b1bb4 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5# CONFIG_SYSCTL_SYSCALL is not set 4# CONFIG_SYSCTL_SYSCALL is not set
6CONFIG_KALLSYMS_EXTRA_PASS=y 5CONFIG_KALLSYMS_EXTRA_PASS=y
7CONFIG_SLAB=y 6CONFIG_SLAB=y
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
index 4d61b7711b40..9479872b1ae6 100644
--- a/arch/sh/configs/magicpanelr2_defconfig
+++ b/arch/sh/configs/magicpanelr2_defconfig
@@ -5,7 +5,6 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_BSD_PROCESS_ACCT_V3=y 6CONFIG_BSD_PROCESS_ACCT_V3=y
7CONFIG_AUDIT=y 7CONFIG_AUDIT=y
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_RELAY=y 8CONFIG_RELAY=y
10CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
diff --git a/arch/sh/configs/microdev_defconfig b/arch/sh/configs/microdev_defconfig
index 0e32a24fed53..f1d2e1b5ee41 100644
--- a/arch/sh/configs/microdev_defconfig
+++ b/arch/sh/configs/microdev_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_BSD_PROCESS_ACCT=y 2CONFIG_BSD_PROCESS_ACCT=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index c19fcdfdee37..9ad904a110de 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
diff --git a/arch/sh/configs/polaris_defconfig b/arch/sh/configs/polaris_defconfig
index 984e3fe1ce5d..f3d5d9f76310 100644
--- a/arch/sh/configs/polaris_defconfig
+++ b/arch/sh/configs/polaris_defconfig
@@ -7,7 +7,6 @@ CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_BSD_PROCESS_ACCT_V3=y 7CONFIG_BSD_PROCESS_ACCT_V3=y
8CONFIG_AUDIT=y 8CONFIG_AUDIT=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_SYSFS_DEPRECATED_V2=y
11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
12CONFIG_SLAB=y 11CONFIG_SLAB=y
13CONFIG_MODULES=y 12CONFIG_MODULES=y
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index e8b5472e6d84..920b8471ceb7 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_defconfig
@@ -4,7 +4,6 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y
8# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_FUTEX is not set 8# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index fd8848060982..c77da6be06b8 100644
--- a/arch/sh/configs/r7785rp_defconfig
+++ b/arch/sh/configs/r7785rp_defconfig
@@ -8,7 +8,6 @@ CONFIG_RCU_TRACE=y
8CONFIG_IKCONFIG=y 8CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_SYSFS_DEPRECATED_V2=y
12# CONFIG_SYSCTL_SYSCALL is not set 11# CONFIG_SYSCTL_SYSCALL is not set
13CONFIG_SLAB=y 12CONFIG_SLAB=y
14CONFIG_PROFILING=y 13CONFIG_PROFILING=y
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index a42f7c22ca1a..a3d081095ce2 100644
--- a/arch/sh/configs/rts7751r2d1_defconfig
+++ b/arch/sh/configs/rts7751r2d1_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6# CONFIG_SYSCTL_SYSCALL is not set 5# CONFIG_SYSCTL_SYSCALL is not set
7CONFIG_SLAB=y 6CONFIG_SLAB=y
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 742aa61f2427..b1a04f3c598b 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6# CONFIG_SYSCTL_SYSCALL is not set 5# CONFIG_SYSCTL_SYSCALL is not set
7CONFIG_SLAB=y 6CONFIG_SLAB=y
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig
index aed394d89346..ae1115849dda 100644
--- a/arch/sh/configs/sdk7780_defconfig
+++ b/arch/sh/configs/sdk7780_defconfig
@@ -6,7 +6,6 @@ CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=18 8CONFIG_LOG_BUF_SHIFT=18
9CONFIG_SYSFS_DEPRECATED_V2=y
10CONFIG_RELAY=y 9CONFIG_RELAY=y
11CONFIG_KALLSYMS_ALL=y 10CONFIG_KALLSYMS_ALL=y
12CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/sh/configs/se7343_defconfig b/arch/sh/configs/se7343_defconfig
index 7a7e13853cfd..be9c474197b3 100644
--- a/arch/sh/configs/se7343_defconfig
+++ b/arch/sh/configs/se7343_defconfig
@@ -3,7 +3,6 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index 3620a7f4c821..1248635e4f88 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_defconfig
@@ -5,7 +5,6 @@ CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
6CONFIG_BSD_PROCESS_ACCT=y 6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
11# CONFIG_BUG is not set 10# CONFIG_BUG is not set
diff --git a/arch/sh/configs/se7721_defconfig b/arch/sh/configs/se7721_defconfig
index fe22f599c0cb..c3ba6e8a9818 100644
--- a/arch/sh/configs/se7721_defconfig
+++ b/arch/sh/configs/se7721_defconfig
@@ -5,7 +5,6 @@ CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
6CONFIG_BSD_PROCESS_ACCT=y 6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
11# CONFIG_BUG is not set 10# CONFIG_BUG is not set
diff --git a/arch/sh/configs/se7722_defconfig b/arch/sh/configs/se7722_defconfig
index b9b64c38810e..ae998c7e2ee0 100644
--- a/arch/sh/configs/se7722_defconfig
+++ b/arch/sh/configs/se7722_defconfig
@@ -4,7 +4,6 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
9CONFIG_PROFILING=y 8CONFIG_PROFILING=y
10CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/sh/configs/se7724_defconfig b/arch/sh/configs/se7724_defconfig
index 03e736781c2e..ed35093e3758 100644
--- a/arch/sh/configs/se7724_defconfig
+++ b/arch/sh/configs/se7724_defconfig
@@ -3,7 +3,6 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_BSD_PROCESS_ACCT=y 4CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
8CONFIG_SLAB=y 7CONFIG_SLAB=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
index 1a686b6d5cd4..912c98590e22 100644
--- a/arch/sh/configs/se7750_defconfig
+++ b/arch/sh/configs/se7750_defconfig
@@ -5,7 +5,6 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
11# CONFIG_HOTPLUG is not set 10# CONFIG_HOTPLUG is not set
diff --git a/arch/sh/configs/se7751_defconfig b/arch/sh/configs/se7751_defconfig
index 7e03451a9fad..75c92fc1876b 100644
--- a/arch/sh/configs/se7751_defconfig
+++ b/arch/sh/configs/se7751_defconfig
@@ -2,7 +2,6 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
diff --git a/arch/sh/configs/se7780_defconfig b/arch/sh/configs/se7780_defconfig
index 4cfc4deff135..c8c5e7f7a68d 100644
--- a/arch/sh/configs/se7780_defconfig
+++ b/arch/sh/configs/se7780_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
8# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
9# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
diff --git a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig
index b95dc76b04c1..2051821724c6 100644
--- a/arch/sh/configs/sh03_defconfig
+++ b/arch/sh/configs/sh03_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_BSD_PROCESS_ACCT=y 4CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
8# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
9CONFIG_SLAB=y 8CONFIG_SLAB=y
diff --git a/arch/sh/configs/sh2007_defconfig b/arch/sh/configs/sh2007_defconfig
new file mode 100644
index 000000000000..0d2f41472a19
--- /dev/null
+++ b/arch/sh/configs/sh2007_defconfig
@@ -0,0 +1,212 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_AUDIT=y
7CONFIG_AUDITSYSCALL=y
8CONFIG_IKCONFIG=y
9CONFIG_LOG_BUF_SHIFT=14
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_KALLSYMS_ALL=y
12CONFIG_SLAB=y
13# CONFIG_BLK_DEV_BSG is not set
14CONFIG_CPU_SUBTYPE_SH7780=y
15CONFIG_MEMORY_SIZE=0x08000000
16# CONFIG_VSYSCALL is not set
17CONFIG_FLATMEM_MANUAL=y
18CONFIG_SH_SH2007=y
19CONFIG_HIGH_RES_TIMERS=y
20CONFIG_SH_DMA=y
21CONFIG_SH_DMA_API=y
22CONFIG_NR_DMA_CHANNELS_BOOL=y
23CONFIG_HZ_100=y
24CONFIG_CMDLINE_OVERWRITE=y
25CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1"
26CONFIG_PCCARD=y
27CONFIG_BINFMT_MISC=y
28CONFIG_PACKET=y
29CONFIG_UNIX=y
30CONFIG_XFRM_USER=y
31CONFIG_NET_KEY=y
32CONFIG_NET_KEY_MIGRATE=y
33CONFIG_INET=y
34CONFIG_IP_ADVANCED_ROUTER=y
35CONFIG_IP_MULTIPLE_TABLES=y
36CONFIG_IP_ROUTE_MULTIPATH=y
37CONFIG_IP_ROUTE_VERBOSE=y
38CONFIG_IP_PNP=y
39CONFIG_IP_PNP_DHCP=y
40CONFIG_NET_IPIP=y
41# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
42# CONFIG_INET_XFRM_MODE_TUNNEL is not set
43# CONFIG_INET_XFRM_MODE_BEET is not set
44# CONFIG_INET_LRO is not set
45# CONFIG_IPV6 is not set
46CONFIG_NETWORK_SECMARK=y
47CONFIG_NET_PKTGEN=y
48CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
49CONFIG_BLK_DEV_LOOP=y
50CONFIG_BLK_DEV_RAM=y
51CONFIG_CDROM_PKTCDVD=y
52# CONFIG_MISC_DEVICES is not set
53CONFIG_RAID_ATTRS=y
54CONFIG_SCSI=y
55CONFIG_SCSI_TGT=y
56CONFIG_BLK_DEV_SD=y
57CONFIG_BLK_DEV_SR=y
58CONFIG_CHR_DEV_SG=y
59CONFIG_SCSI_MULTI_LUN=y
60CONFIG_SCSI_CONSTANTS=y
61CONFIG_SCSI_LOGGING=y
62CONFIG_SCSI_SCAN_ASYNC=y
63CONFIG_SCSI_SPI_ATTRS=y
64CONFIG_SCSI_FC_ATTRS=y
65CONFIG_SCSI_ISCSI_ATTRS=y
66CONFIG_SCSI_SRP_ATTRS=y
67# CONFIG_SCSI_LOWLEVEL is not set
68CONFIG_NETDEVICES=y
69CONFIG_DUMMY=y
70CONFIG_EQUALIZER=y
71CONFIG_TUN=y
72CONFIG_VETH=y
73CONFIG_NET_ETHERNET=y
74CONFIG_SMSC911X=y
75# CONFIG_NETDEV_1000 is not set
76# CONFIG_NETDEV_10000 is not set
77# CONFIG_WLAN is not set
78CONFIG_INPUT_FF_MEMLESS=y
79# CONFIG_INPUT_MOUSEDEV is not set
80# CONFIG_INPUT_KEYBOARD is not set
81# CONFIG_INPUT_MOUSE is not set
82# CONFIG_SERIO is not set
83CONFIG_VT_HW_CONSOLE_BINDING=y
84# CONFIG_DEVKMEM is not set
85CONFIG_SERIAL_SH_SCI=y
86CONFIG_SERIAL_SH_SCI_CONSOLE=y
87# CONFIG_LEGACY_PTYS is not set
88# CONFIG_HWMON is not set
89CONFIG_WATCHDOG=y
90CONFIG_SH_WDT=y
91CONFIG_SSB=y
92CONFIG_FB=y
93CONFIG_BACKLIGHT_LCD_SUPPORT=y
94# CONFIG_LCD_CLASS_DEVICE is not set
95CONFIG_FRAMEBUFFER_CONSOLE=y
96CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
97CONFIG_LOGO=y
98# CONFIG_HID_SUPPORT is not set
99CONFIG_USB=y
100CONFIG_USB_DEVICEFS=y
101# CONFIG_USB_DEVICE_CLASS is not set
102CONFIG_USB_MON=y
103CONFIG_NEW_LEDS=y
104CONFIG_LEDS_CLASS=y
105CONFIG_LEDS_TRIGGERS=y
106CONFIG_RTC_CLASS=y
107CONFIG_RTC_INTF_DEV_UIE_EMUL=y
108CONFIG_DMADEVICES=y
109CONFIG_TIMB_DMA=y
110CONFIG_EXT3_FS=y
111CONFIG_ISO9660_FS=y
112CONFIG_JOLIET=y
113CONFIG_ZISOFS=y
114CONFIG_UDF_FS=y
115CONFIG_MSDOS_FS=y
116CONFIG_VFAT_FS=y
117CONFIG_FAT_DEFAULT_CODEPAGE=932
118CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
119CONFIG_PROC_KCORE=y
120CONFIG_TMPFS=y
121CONFIG_TMPFS_POSIX_ACL=y
122CONFIG_CONFIGFS_FS=y
123# CONFIG_MISC_FILESYSTEMS is not set
124CONFIG_NFS_FS=y
125CONFIG_NFS_V3=y
126CONFIG_NFS_V3_ACL=y
127CONFIG_NFS_V4=y
128CONFIG_ROOT_NFS=y
129CONFIG_NLS_DEFAULT="utf8"
130CONFIG_NLS_CODEPAGE_437=y
131CONFIG_NLS_CODEPAGE_737=y
132CONFIG_NLS_CODEPAGE_775=y
133CONFIG_NLS_CODEPAGE_850=y
134CONFIG_NLS_CODEPAGE_852=y
135CONFIG_NLS_CODEPAGE_855=y
136CONFIG_NLS_CODEPAGE_857=y
137CONFIG_NLS_CODEPAGE_860=y
138CONFIG_NLS_CODEPAGE_861=y
139CONFIG_NLS_CODEPAGE_862=y
140CONFIG_NLS_CODEPAGE_863=y
141CONFIG_NLS_CODEPAGE_864=y
142CONFIG_NLS_CODEPAGE_865=y
143CONFIG_NLS_CODEPAGE_866=y
144CONFIG_NLS_CODEPAGE_869=y
145CONFIG_NLS_CODEPAGE_936=y
146CONFIG_NLS_CODEPAGE_950=y
147CONFIG_NLS_CODEPAGE_932=y
148CONFIG_NLS_CODEPAGE_949=y
149CONFIG_NLS_CODEPAGE_874=y
150CONFIG_NLS_ISO8859_8=y
151CONFIG_NLS_CODEPAGE_1250=y
152CONFIG_NLS_CODEPAGE_1251=y
153CONFIG_NLS_ASCII=y
154CONFIG_NLS_ISO8859_1=y
155CONFIG_NLS_ISO8859_2=y
156CONFIG_NLS_ISO8859_3=y
157CONFIG_NLS_ISO8859_4=y
158CONFIG_NLS_ISO8859_5=y
159CONFIG_NLS_ISO8859_6=y
160CONFIG_NLS_ISO8859_7=y
161CONFIG_NLS_ISO8859_9=y
162CONFIG_NLS_ISO8859_13=y
163CONFIG_NLS_ISO8859_14=y
164CONFIG_NLS_ISO8859_15=y
165CONFIG_NLS_KOI8_R=y
166CONFIG_NLS_KOI8_U=y
167CONFIG_NLS_UTF8=y
168# CONFIG_ENABLE_WARN_DEPRECATED is not set
169# CONFIG_ENABLE_MUST_CHECK is not set
170CONFIG_DEBUG_FS=y
171CONFIG_DEBUG_KERNEL=y
172# CONFIG_DETECT_SOFTLOCKUP is not set
173# CONFIG_SCHED_DEBUG is not set
174CONFIG_DEBUG_INFO=y
175CONFIG_FRAME_POINTER=y
176# CONFIG_RCU_CPU_STALL_DETECTOR is not set
177CONFIG_SH_STANDARD_BIOS=y
178CONFIG_CRYPTO_NULL=y
179CONFIG_CRYPTO_AUTHENC=y
180CONFIG_CRYPTO_ECB=y
181CONFIG_CRYPTO_LRW=y
182CONFIG_CRYPTO_PCBC=y
183CONFIG_CRYPTO_XTS=y
184CONFIG_CRYPTO_HMAC=y
185CONFIG_CRYPTO_XCBC=y
186CONFIG_CRYPTO_MD4=y
187CONFIG_CRYPTO_MICHAEL_MIC=y
188CONFIG_CRYPTO_SHA1=y
189CONFIG_CRYPTO_SHA256=y
190CONFIG_CRYPTO_SHA512=y
191CONFIG_CRYPTO_TGR192=y
192CONFIG_CRYPTO_WP512=y
193CONFIG_CRYPTO_AES=y
194CONFIG_CRYPTO_ANUBIS=y
195CONFIG_CRYPTO_ARC4=y
196CONFIG_CRYPTO_BLOWFISH=y
197CONFIG_CRYPTO_CAMELLIA=y
198CONFIG_CRYPTO_CAST5=y
199CONFIG_CRYPTO_CAST6=y
200CONFIG_CRYPTO_FCRYPT=y
201CONFIG_CRYPTO_KHAZAD=y
202CONFIG_CRYPTO_SEED=y
203CONFIG_CRYPTO_SERPENT=y
204CONFIG_CRYPTO_TEA=y
205CONFIG_CRYPTO_TWOFISH=y
206CONFIG_CRYPTO_DEFLATE=y
207CONFIG_CRYPTO_LZO=y
208# CONFIG_CRYPTO_ANSI_CPRNG is not set
209# CONFIG_CRYPTO_HW is not set
210CONFIG_CRC_CCITT=y
211CONFIG_CRC16=y
212CONFIG_LIBCRC32C=y
diff --git a/arch/sh/configs/sh7710voipgw_defconfig b/arch/sh/configs/sh7710voipgw_defconfig
index b804641c8dd2..f92ad17cd629 100644
--- a/arch/sh/configs/sh7710voipgw_defconfig
+++ b/arch/sh/configs/sh7710voipgw_defconfig
@@ -3,7 +3,6 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
diff --git a/arch/sh/configs/sh7757lcr_defconfig b/arch/sh/configs/sh7757lcr_defconfig
new file mode 100644
index 000000000000..273f3fa198f7
--- /dev/null
+++ b/arch/sh/configs/sh7757lcr_defconfig
@@ -0,0 +1,85 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_TASKSTATS=y
7CONFIG_TASK_DELAY_ACCT=y
8CONFIG_TASK_XACCT=y
9CONFIG_TASK_IO_ACCOUNTING=y
10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_BLK_DEV_INITRD=y
12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
13# CONFIG_SYSCTL_SYSCALL is not set
14CONFIG_KALLSYMS_ALL=y
15CONFIG_SLAB=y
16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y
18# CONFIG_BLK_DEV_BSG is not set
19CONFIG_CPU_SUBTYPE_SH7757=y
20CONFIG_MEMORY_START=0x40000000
21CONFIG_MEMORY_SIZE=0x0f000000
22CONFIG_PMB=y
23CONFIG_FLATMEM_MANUAL=y
24CONFIG_SH_SH7757LCR=y
25CONFIG_HEARTBEAT=y
26CONFIG_SECCOMP=y
27CONFIG_CMDLINE_OVERWRITE=y
28CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/nfs ip=dhcp"
29CONFIG_NET=y
30CONFIG_PACKET=y
31CONFIG_UNIX=y
32CONFIG_INET=y
33CONFIG_IP_MULTICAST=y
34CONFIG_IP_PNP=y
35CONFIG_IP_PNP_DHCP=y
36# CONFIG_INET_LRO is not set
37CONFIG_IPV6=y
38# CONFIG_WIRELESS is not set
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40# CONFIG_FW_LOADER is not set
41CONFIG_BLK_DEV_RAM=y
42# CONFIG_MISC_DEVICES is not set
43CONFIG_NETDEVICES=y
44CONFIG_PHYLIB=y
45CONFIG_VITESSE_PHY=y
46CONFIG_MDIO_BITBANG=y
47CONFIG_NET_ETHERNET=y
48CONFIG_MII=y
49# CONFIG_NETDEV_10000 is not set
50# CONFIG_WLAN is not set
51# CONFIG_KEYBOARD_ATKBD is not set
52# CONFIG_MOUSE_PS2 is not set
53# CONFIG_SERIO is not set
54CONFIG_SERIAL_8250=y
55CONFIG_SERIAL_8250_CONSOLE=y
56CONFIG_SERIAL_8250_NR_UARTS=2
57CONFIG_SERIAL_SH_SCI=y
58CONFIG_SERIAL_SH_SCI_NR_UARTS=3
59CONFIG_SERIAL_SH_SCI_CONSOLE=y
60# CONFIG_LEGACY_PTYS is not set
61# CONFIG_HW_RANDOM is not set
62# CONFIG_HWMON is not set
63# CONFIG_USB_SUPPORT is not set
64CONFIG_EXT2_FS=y
65CONFIG_EXT3_FS=y
66CONFIG_INOTIFY=y
67CONFIG_ISO9660_FS=y
68CONFIG_VFAT_FS=y
69CONFIG_PROC_KCORE=y
70CONFIG_TMPFS=y
71CONFIG_SQUASHFS=y
72CONFIG_MINIX_FS=y
73CONFIG_NFS_FS=y
74CONFIG_ROOT_NFS=y
75CONFIG_NLS_CODEPAGE_437=y
76CONFIG_NLS_CODEPAGE_932=y
77CONFIG_NLS_ISO8859_1=y
78CONFIG_DEBUG_KERNEL=y
79# CONFIG_DETECT_SOFTLOCKUP is not set
80# CONFIG_SCHED_DEBUG is not set
81# CONFIG_DEBUG_BUGVERBOSE is not set
82CONFIG_DEBUG_INFO=y
83# CONFIG_RCU_CPU_STALL_DETECTOR is not set
84# CONFIG_FTRACE is not set
85# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/sh/configs/sh7763rdp_defconfig b/arch/sh/configs/sh7763rdp_defconfig
index 361876786932..479536440264 100644
--- a/arch/sh/configs/sh7763rdp_defconfig
+++ b/arch/sh/configs/sh7763rdp_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_NAMESPACES=y 6CONFIG_NAMESPACES=y
8CONFIG_UTS_NS=y 7CONFIG_UTS_NS=y
9CONFIG_IPC_NS=y 8CONFIG_IPC_NS=y
diff --git a/arch/sh/configs/sh7785lcr_defconfig b/arch/sh/configs/sh7785lcr_defconfig
index ee6b81f7539e..51561f5677d8 100644
--- a/arch/sh/configs/sh7785lcr_defconfig
+++ b/arch/sh/configs/sh7785lcr_defconfig
@@ -4,7 +4,6 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_SLAB=y 7CONFIG_SLAB=y
9CONFIG_PROFILING=y 8CONFIG_PROFILING=y
10CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index bb4f60c0f866..3f92d37c6374 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -15,7 +15,6 @@ CONFIG_CGROUP_DEVICE=y
15CONFIG_CGROUP_CPUACCT=y 15CONFIG_CGROUP_CPUACCT=y
16CONFIG_RESOURCE_COUNTERS=y 16CONFIG_RESOURCE_COUNTERS=y
17CONFIG_CGROUP_MEM_RES_CTLR=y 17CONFIG_CGROUP_MEM_RES_CTLR=y
18CONFIG_SYSFS_DEPRECATED_V2=y
19CONFIG_RELAY=y 18CONFIG_RELAY=y
20CONFIG_NAMESPACES=y 19CONFIG_NAMESPACES=y
21CONFIG_UTS_NS=y 20CONFIG_UTS_NS=y
diff --git a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/snapgear_defconfig
index f38c98341f15..7eae4e59d7f0 100644
--- a/arch/sh/configs/snapgear_defconfig
+++ b/arch/sh/configs/snapgear_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y
5CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
6# CONFIG_SYSCTL_SYSCALL is not set 5# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
diff --git a/arch/sh/configs/systemh_defconfig b/arch/sh/configs/systemh_defconfig
index 7007d00c67e0..b58dfc505efe 100644
--- a/arch/sh/configs/systemh_defconfig
+++ b/arch/sh/configs/systemh_defconfig
@@ -1,6 +1,5 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_SYSFS_DEPRECATED_V2=y
4CONFIG_BLK_DEV_INITRD=y 3CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6# CONFIG_SYSCTL_SYSCALL is not set 5# CONFIG_SYSCTL_SYSCALL is not set
diff --git a/arch/sh/configs/titan_defconfig b/arch/sh/configs/titan_defconfig
index 45c309ff447e..0f558914e760 100644
--- a/arch/sh/configs/titan_defconfig
+++ b/arch/sh/configs/titan_defconfig
@@ -5,7 +5,6 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 7CONFIG_LOG_BUF_SHIFT=16
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
diff --git a/arch/sh/configs/ul2_defconfig b/arch/sh/configs/ul2_defconfig
index e107d424acf0..2d288b887fbd 100644
--- a/arch/sh/configs/ul2_defconfig
+++ b/arch/sh/configs/ul2_defconfig
@@ -4,7 +4,6 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
9CONFIG_PROFILING=y 8CONFIG_PROFILING=y
10CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 4a277224a871..f46848f088e4 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -412,8 +412,8 @@ EXPORT_SYMBOL(unregister_dmac);
412static int __init dma_api_init(void) 412static int __init dma_api_init(void)
413{ 413{
414 printk(KERN_NOTICE "DMA: Registering DMA API.\n"); 414 printk(KERN_NOTICE "DMA: Registering DMA API.\n");
415 create_proc_read_entry("dma", 0, 0, dma_read_proc, 0); 415 return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0)
416 return 0; 416 ? 0 : -ENOMEM;
417} 417}
418subsys_initcall(dma_api_init); 418subsys_initcall(dma_api_init);
419 419
diff --git a/arch/sh/drivers/pci/Makefile b/arch/sh/drivers/pci/Makefile
index 4a59e6890876..82f0a335fd19 100644
--- a/arch/sh/drivers/pci/Makefile
+++ b/arch/sh/drivers/pci/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_SH_RTS7751R2D) += fixups-rts7751r2d.o
19obj-$(CONFIG_SH_SH03) += fixups-sh03.o 19obj-$(CONFIG_SH_SH03) += fixups-sh03.o
20obj-$(CONFIG_SH_HIGHLANDER) += fixups-r7780rp.o 20obj-$(CONFIG_SH_HIGHLANDER) += fixups-r7780rp.o
21obj-$(CONFIG_SH_SH7785LCR) += fixups-r7780rp.o 21obj-$(CONFIG_SH_SH7785LCR) += fixups-r7780rp.o
22obj-$(CONFIG_SH_SDK7786) += fixups-sdk7786.o
22obj-$(CONFIG_SH_SDK7780) += fixups-sdk7780.o 23obj-$(CONFIG_SH_SDK7780) += fixups-sdk7780.o
23obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += fixups-sdk7780.o 24obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += fixups-sdk7780.o
24obj-$(CONFIG_SH_TITAN) += fixups-titan.o 25obj-$(CONFIG_SH_TITAN) += fixups-titan.o
diff --git a/arch/sh/drivers/pci/fixups-sdk7786.c b/arch/sh/drivers/pci/fixups-sdk7786.c
new file mode 100644
index 000000000000..0e18ee332553
--- /dev/null
+++ b/arch/sh/drivers/pci/fixups-sdk7786.c
@@ -0,0 +1,67 @@
1/*
2 * SDK7786 FPGA PCIe mux handling
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#define pr_fmt(fmt) "PCI: " fmt
11
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <mach/fpga.h>
16
17/*
18 * The SDK7786 FPGA supports mangling of most of the slots in some way or
19 * another. Slots 3/4 are special in that only one can be supported at a
20 * time, and both appear on port 3 to the PCI bus scan. Enabling slot 4
21 * (the horizontal edge connector) will disable slot 3 entirely.
22 *
23 * Misconfigurations can be detected through the FPGA via the slot
24 * resistors to determine card presence. Hotplug remains unsupported.
25 */
26static unsigned int slot4en __devinitdata;
27
28char *__devinit pcibios_setup(char *str)
29{
30 if (strcmp(str, "slot4en") == 0) {
31 slot4en = 1;
32 return NULL;
33 }
34
35 return str;
36}
37
38static int __init sdk7786_pci_init(void)
39{
40 u16 data = fpga_read_reg(PCIECR);
41
42 /*
43 * Enable slot #4 if it's been specified on the command line.
44 *
45 * Optionally reroute if slot #4 has a card present while slot #3
46 * does not, regardless of command line value.
47 *
48 * Card presence is logically inverted.
49 */
50 slot4en ?: (!(data & PCIECR_PRST4) && (data & PCIECR_PRST3));
51 if (slot4en) {
52 pr_info("Activating PCIe slot#4 (disabling slot#3)\n");
53
54 data &= ~PCIECR_PCIEMUX1;
55 fpga_write_reg(data, PCIECR);
56
57 /* Warn about forced rerouting if slot#3 is occupied */
58 if ((data & PCIECR_PRST3) == 0) {
59 pr_warning("Unreachable card detected in slot#3\n");
60 return -EBUSY;
61 }
62 } else
63 pr_info("PCIe slot#4 disabled\n");
64
65 return 0;
66}
67postcore_initcall(sdk7786_pci_init);
diff --git a/arch/sh/drivers/pci/ops-sh4.c b/arch/sh/drivers/pci/ops-sh4.c
index 0b81999fb88b..b6234203e0ac 100644
--- a/arch/sh/drivers/pci/ops-sh4.c
+++ b/arch/sh/drivers/pci/ops-sh4.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/spinlock.h>
12#include <asm/addrspace.h> 13#include <asm/addrspace.h>
13#include "pci-sh4.h" 14#include "pci-sh4.h"
14 15
@@ -18,8 +19,6 @@
18#define CONFIG_CMD(bus, devfn, where) \ 19#define CONFIG_CMD(bus, devfn, where) \
19 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 20 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
20 21
21static DEFINE_SPINLOCK(sh4_pci_lock);
22
23/* 22/*
24 * Functions for accessing PCI configuration space with type 1 accesses 23 * Functions for accessing PCI configuration space with type 1 accesses
25 */ 24 */
@@ -34,10 +33,10 @@ static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn,
34 * PCIPDR may only be accessed as 32 bit words, 33 * PCIPDR may only be accessed as 32 bit words,
35 * so we must do byte alignment by hand 34 * so we must do byte alignment by hand
36 */ 35 */
37 spin_lock_irqsave(&sh4_pci_lock, flags); 36 raw_spin_lock_irqsave(&pci_config_lock, flags);
38 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); 37 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
39 data = pci_read_reg(chan, SH4_PCIPDR); 38 data = pci_read_reg(chan, SH4_PCIPDR);
40 spin_unlock_irqrestore(&sh4_pci_lock, flags); 39 raw_spin_unlock_irqrestore(&pci_config_lock, flags);
41 40
42 switch (size) { 41 switch (size) {
43 case 1: 42 case 1:
@@ -69,10 +68,10 @@ static int sh4_pci_write(struct pci_bus *bus, unsigned int devfn,
69 int shift; 68 int shift;
70 u32 data; 69 u32 data;
71 70
72 spin_lock_irqsave(&sh4_pci_lock, flags); 71 raw_spin_lock_irqsave(&pci_config_lock, flags);
73 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); 72 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
74 data = pci_read_reg(chan, SH4_PCIPDR); 73 data = pci_read_reg(chan, SH4_PCIPDR);
75 spin_unlock_irqrestore(&sh4_pci_lock, flags); 74 raw_spin_unlock_irqrestore(&pci_config_lock, flags);
76 75
77 switch (size) { 76 switch (size) {
78 case 1: 77 case 1:
diff --git a/arch/sh/drivers/pci/ops-sh7786.c b/arch/sh/drivers/pci/ops-sh7786.c
index 48f594b9582b..128421009e3f 100644
--- a/arch/sh/drivers/pci/ops-sh7786.c
+++ b/arch/sh/drivers/pci/ops-sh7786.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic SH7786 PCI-Express operations. 2 * Generic SH7786 PCI-Express operations.
3 * 3 *
4 * Copyright (C) 2009 Paul Mundt 4 * Copyright (C) 2009 - 2010 Paul Mundt
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License v2. See the file "COPYING" in the main directory of this archive 7 * License v2. See the file "COPYING" in the main directory of this archive
@@ -19,37 +19,72 @@ enum {
19 PCI_ACCESS_WRITE, 19 PCI_ACCESS_WRITE,
20}; 20};
21 21
22static DEFINE_SPINLOCK(sh7786_pcie_lock);
23
24static int sh7786_pcie_config_access(unsigned char access_type, 22static int sh7786_pcie_config_access(unsigned char access_type,
25 struct pci_bus *bus, unsigned int devfn, int where, u32 *data) 23 struct pci_bus *bus, unsigned int devfn, int where, u32 *data)
26{ 24{
27 struct pci_channel *chan = bus->sysdata; 25 struct pci_channel *chan = bus->sysdata;
28 int dev, func; 26 int dev, func, type, reg;
29 27
30 dev = PCI_SLOT(devfn); 28 dev = PCI_SLOT(devfn);
31 func = PCI_FUNC(devfn); 29 func = PCI_FUNC(devfn);
30 type = !!bus->parent;
31 reg = where & ~3;
32 32
33 if (bus->number > 255 || dev > 31 || func > 7) 33 if (bus->number > 255 || dev > 31 || func > 7)
34 return PCIBIOS_FUNC_NOT_SUPPORTED; 34 return PCIBIOS_FUNC_NOT_SUPPORTED;
35 if (devfn) 35
36 return PCIBIOS_DEVICE_NOT_FOUND; 36 /*
37 * While each channel has its own memory-mapped extended config
38 * space, it's generally only accessible when in endpoint mode.
39 * When in root complex mode, the controller is unable to target
40 * itself with either type 0 or type 1 accesses, and indeed, any
41 * controller initiated target transfer to its own config space
42 * result in a completer abort.
43 *
44 * Each channel effectively only supports a single device, but as
45 * the same channel <-> device access works for any PCI_SLOT()
46 * value, we cheat a bit here and bind the controller's config
47 * space to devfn 0 in order to enable self-enumeration. In this
48 * case the regular PAR/PDR path is sidelined and the mangled
49 * config access itself is initiated as a SuperHyway transaction.
50 */
51 if (pci_is_root_bus(bus)) {
52 if (dev == 0) {
53 if (access_type == PCI_ACCESS_READ)
54 *data = pci_read_reg(chan, PCI_REG(reg));
55 else
56 pci_write_reg(chan, *data, PCI_REG(reg));
57
58 return PCIBIOS_SUCCESSFUL;
59 } else if (dev > 1)
60 return PCIBIOS_DEVICE_NOT_FOUND;
61 }
62
63 /* Clear errors */
64 pci_write_reg(chan, pci_read_reg(chan, SH4A_PCIEERRFR), SH4A_PCIEERRFR);
37 65
38 /* Set the PIO address */ 66 /* Set the PIO address */
39 pci_write_reg(chan, (bus->number << 24) | (dev << 19) | 67 pci_write_reg(chan, (bus->number << 24) | (dev << 19) |
40 (func << 16) | (where & ~3), SH4A_PCIEPAR); 68 (func << 16) | reg, SH4A_PCIEPAR);
41 69
42 /* Enable the configuration access */ 70 /* Enable the configuration access */
43 pci_write_reg(chan, (1 << 31), SH4A_PCIEPCTLR); 71 pci_write_reg(chan, (1 << 31) | (type << 8), SH4A_PCIEPCTLR);
72
73 /* Check for errors */
74 if (pci_read_reg(chan, SH4A_PCIEERRFR) & 0x10)
75 return PCIBIOS_DEVICE_NOT_FOUND;
76
77 /* Check for master and target aborts */
78 if (pci_read_reg(chan, SH4A_PCIEPCICONF1) & ((1 << 29) | (1 << 28)))
79 return PCIBIOS_DEVICE_NOT_FOUND;
44 80
45 if (access_type == PCI_ACCESS_READ) 81 if (access_type == PCI_ACCESS_READ)
46 *data = pci_read_reg(chan, SH4A_PCIEPDR); 82 *data = pci_read_reg(chan, SH4A_PCIEPDR);
47 else 83 else
48 pci_write_reg(chan, *data, SH4A_PCIEPDR); 84 pci_write_reg(chan, *data, SH4A_PCIEPDR);
49 85
50 /* Check for master and target aborts */ 86 /* Disable the configuration access */
51 if (pci_read_reg(chan, SH4A_PCIEPCICONF1) & ((1 << 29) | (1 << 28))) 87 pci_write_reg(chan, 0, SH4A_PCIEPCTLR);
52 return PCIBIOS_DEVICE_NOT_FOUND;
53 88
54 return PCIBIOS_SUCCESSFUL; 89 return PCIBIOS_SUCCESSFUL;
55} 90}
@@ -66,11 +101,13 @@ static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn,
66 else if ((size == 4) && (where & 3)) 101 else if ((size == 4) && (where & 3))
67 return PCIBIOS_BAD_REGISTER_NUMBER; 102 return PCIBIOS_BAD_REGISTER_NUMBER;
68 103
69 spin_lock_irqsave(&sh7786_pcie_lock, flags); 104 raw_spin_lock_irqsave(&pci_config_lock, flags);
70 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, 105 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus,
71 devfn, where, &data); 106 devfn, where, &data);
72 if (ret != PCIBIOS_SUCCESSFUL) 107 if (ret != PCIBIOS_SUCCESSFUL) {
108 *val = 0xffffffff;
73 goto out; 109 goto out;
110 }
74 111
75 if (size == 1) 112 if (size == 1)
76 *val = (data >> ((where & 3) << 3)) & 0xff; 113 *val = (data >> ((where & 3) << 3)) & 0xff;
@@ -84,7 +121,7 @@ static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn,
84 devfn, where, size, (unsigned long)*val); 121 devfn, where, size, (unsigned long)*val);
85 122
86out: 123out:
87 spin_unlock_irqrestore(&sh7786_pcie_lock, flags); 124 raw_spin_unlock_irqrestore(&pci_config_lock, flags);
88 return ret; 125 return ret;
89} 126}
90 127
@@ -100,7 +137,7 @@ static int sh7786_pcie_write(struct pci_bus *bus, unsigned int devfn,
100 else if ((size == 4) && (where & 3)) 137 else if ((size == 4) && (where & 3))
101 return PCIBIOS_BAD_REGISTER_NUMBER; 138 return PCIBIOS_BAD_REGISTER_NUMBER;
102 139
103 spin_lock_irqsave(&sh7786_pcie_lock, flags); 140 raw_spin_lock_irqsave(&pci_config_lock, flags);
104 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, 141 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus,
105 devfn, where, &data); 142 devfn, where, &data);
106 if (ret != PCIBIOS_SUCCESSFUL) 143 if (ret != PCIBIOS_SUCCESSFUL)
@@ -124,7 +161,7 @@ static int sh7786_pcie_write(struct pci_bus *bus, unsigned int devfn,
124 ret = sh7786_pcie_config_access(PCI_ACCESS_WRITE, bus, 161 ret = sh7786_pcie_config_access(PCI_ACCESS_WRITE, bus,
125 devfn, where, &data); 162 devfn, where, &data);
126out: 163out:
127 spin_unlock_irqrestore(&sh7786_pcie_lock, flags); 164 raw_spin_unlock_irqrestore(&pci_config_lock, flags);
128 return ret; 165 return ret;
129} 166}
130 167
diff --git a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c
index f98141b3b7d7..86adb1e235cd 100644
--- a/arch/sh/drivers/pci/pci-sh7751.c
+++ b/arch/sh/drivers/pci/pci-sh7751.c
@@ -81,7 +81,7 @@ static int __init sh7751_pci_init(void)
81 unsigned int id; 81 unsigned int id;
82 u32 word, reg; 82 u32 word, reg;
83 83
84 printk(KERN_NOTICE "PCI: Starting intialization.\n"); 84 printk(KERN_NOTICE "PCI: Starting initialization.\n");
85 85
86 chan->reg_base = 0xfe200000; 86 chan->reg_base = 0xfe200000;
87 87
diff --git a/arch/sh/drivers/pci/pci-sh7780.c b/arch/sh/drivers/pci/pci-sh7780.c
index ffdcbf10b95e..edb7cca14882 100644
--- a/arch/sh/drivers/pci/pci-sh7780.c
+++ b/arch/sh/drivers/pci/pci-sh7780.c
@@ -246,7 +246,7 @@ static int __init sh7780_pci_init(void)
246 const char *type; 246 const char *type;
247 int ret, i; 247 int ret, i;
248 248
249 printk(KERN_NOTICE "PCI: Starting intialization.\n"); 249 printk(KERN_NOTICE "PCI: Starting initialization.\n");
250 250
251 chan->reg_base = 0xfe040000; 251 chan->reg_base = 0xfe040000;
252 252
diff --git a/arch/sh/drivers/pci/pci-sh7780.h b/arch/sh/drivers/pci/pci-sh7780.h
index 205dcbefe275..1742e2c9db7a 100644
--- a/arch/sh/drivers/pci/pci-sh7780.h
+++ b/arch/sh/drivers/pci/pci-sh7780.h
@@ -12,12 +12,6 @@
12#ifndef _PCI_SH7780_H_ 12#ifndef _PCI_SH7780_H_
13#define _PCI_SH7780_H_ 13#define _PCI_SH7780_H_
14 14
15#define PCI_VENDOR_ID_RENESAS 0x1912
16#define PCI_DEVICE_ID_RENESAS_SH7781 0x0001
17#define PCI_DEVICE_ID_RENESAS_SH7780 0x0002
18#define PCI_DEVICE_ID_RENESAS_SH7763 0x0004
19#define PCI_DEVICE_ID_RENESAS_SH7785 0x0007
20
21/* SH7780 Control Registers */ 15/* SH7780 Control Registers */
22#define PCIECR 0xFE000008 16#define PCIECR 0xFE000008
23#define PCIECR_ENBL 0x01 17#define PCIECR_ENBL 0x01
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 1e9598d2bbf4..60ee09a4e121 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -19,6 +19,7 @@
19#include <linux/dma-debug.h> 19#include <linux/dma-debug.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22#include <linux/spinlock.h>
22 23
23unsigned long PCIBIOS_MIN_IO = 0x0000; 24unsigned long PCIBIOS_MIN_IO = 0x0000;
24unsigned long PCIBIOS_MIN_MEM = 0; 25unsigned long PCIBIOS_MIN_MEM = 0;
@@ -56,6 +57,11 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
56 } 57 }
57} 58}
58 59
60/*
61 * This interrupt-safe spinlock protects all accesses to PCI
62 * configuration space.
63 */
64DEFINE_RAW_SPINLOCK(pci_config_lock);
59static DEFINE_MUTEX(pci_scan_mutex); 65static DEFINE_MUTEX(pci_scan_mutex);
60 66
61int __devinit register_pci_controller(struct pci_channel *hose) 67int __devinit register_pci_controller(struct pci_channel *hose)
@@ -233,40 +239,7 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
233 239
234int pcibios_enable_device(struct pci_dev *dev, int mask) 240int pcibios_enable_device(struct pci_dev *dev, int mask)
235{ 241{
236 u16 cmd, old_cmd; 242 return pci_enable_resources(dev, mask);
237 int idx;
238 struct resource *r;
239
240 pci_read_config_word(dev, PCI_COMMAND, &cmd);
241 old_cmd = cmd;
242 for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
243 /* Only set up the requested stuff */
244 if (!(mask & (1<<idx)))
245 continue;
246
247 r = &dev->resource[idx];
248 if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
249 continue;
250 if ((idx == PCI_ROM_RESOURCE) &&
251 (!(r->flags & IORESOURCE_ROM_ENABLE)))
252 continue;
253 if (!r->start && r->end) {
254 printk(KERN_ERR "PCI: Device %s not available "
255 "because of resource collisions\n",
256 pci_name(dev));
257 return -EINVAL;
258 }
259 if (r->flags & IORESOURCE_IO)
260 cmd |= PCI_COMMAND_IO;
261 if (r->flags & IORESOURCE_MEM)
262 cmd |= PCI_COMMAND_MEMORY;
263 }
264 if (cmd != old_cmd) {
265 printk("PCI: Enabling device %s (%04x -> %04x)\n",
266 pci_name(dev), old_cmd, cmd);
267 pci_write_config_word(dev, PCI_COMMAND, cmd);
268 }
269 return 0;
270} 243}
271 244
272/* 245/*
@@ -295,7 +268,7 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
295 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); 268 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
296} 269}
297 270
298char * __devinit pcibios_setup(char *str) 271char * __devinit __weak pcibios_setup(char *str)
299{ 272{
300 return str; 273 return str;
301} 274}
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index 68cb9b0ac9d2..96e9b058aa1d 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -13,11 +13,14 @@
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/clk.h>
17#include <linux/sh_clk.h>
16#include "pcie-sh7786.h" 18#include "pcie-sh7786.h"
17#include <asm/sizes.h> 19#include <asm/sizes.h>
18 20
19struct sh7786_pcie_port { 21struct sh7786_pcie_port {
20 struct pci_channel *hose; 22 struct pci_channel *hose;
23 struct clk *fclk, phy_clk;
21 unsigned int index; 24 unsigned int index;
22 int endpoint; 25 int endpoint;
23 int link; 26 int link;
@@ -51,6 +54,7 @@ static struct resource sh7786_pci0_resources[] = {
51 .name = "PCIe0 MEM 2", 54 .name = "PCIe0 MEM 2",
52 .start = 0xfe100000, 55 .start = 0xfe100000,
53 .end = 0xfe100000 + SZ_1M - 1, 56 .end = 0xfe100000 + SZ_1M - 1,
57 .flags = IORESOURCE_MEM,
54 }, 58 },
55}; 59};
56 60
@@ -74,6 +78,7 @@ static struct resource sh7786_pci1_resources[] = {
74 .name = "PCIe1 MEM 2", 78 .name = "PCIe1 MEM 2",
75 .start = 0xfe300000, 79 .start = 0xfe300000,
76 .end = 0xfe300000 + SZ_1M - 1, 80 .end = 0xfe300000 + SZ_1M - 1,
81 .flags = IORESOURCE_MEM,
77 }, 82 },
78}; 83};
79 84
@@ -82,6 +87,7 @@ static struct resource sh7786_pci2_resources[] = {
82 .name = "PCIe2 IO", 87 .name = "PCIe2 IO",
83 .start = 0xfc800000, 88 .start = 0xfc800000,
84 .end = 0xfc800000 + SZ_4M - 1, 89 .end = 0xfc800000 + SZ_4M - 1,
90 .flags = IORESOURCE_IO,
85 }, { 91 }, {
86 .name = "PCIe2 MEM 0", 92 .name = "PCIe2 MEM 0",
87 .start = 0x80000000, 93 .start = 0x80000000,
@@ -96,6 +102,7 @@ static struct resource sh7786_pci2_resources[] = {
96 .name = "PCIe2 MEM 2", 102 .name = "PCIe2 MEM 2",
97 .start = 0xfcd00000, 103 .start = 0xfcd00000,
98 .end = 0xfcd00000 + SZ_1M - 1, 104 .end = 0xfcd00000 + SZ_1M - 1,
105 .flags = IORESOURCE_MEM,
99 }, 106 },
100}; 107};
101 108
@@ -117,7 +124,29 @@ static struct pci_channel sh7786_pci_channels[] = {
117 DEFINE_CONTROLLER(0xfcc00000, 2), 124 DEFINE_CONTROLLER(0xfcc00000, 2),
118}; 125};
119 126
120static int phy_wait_for_ack(struct pci_channel *chan) 127static struct clk fixed_pciexclkp = {
128 .rate = 100000000, /* 100 MHz reference clock */
129};
130
131static void __devinit sh7786_pci_fixup(struct pci_dev *dev)
132{
133 /*
134 * Prevent enumeration of root complex resources.
135 */
136 if (pci_is_root_bus(dev->bus) && dev->devfn == 0) {
137 int i;
138
139 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
140 dev->resource[i].start = 0;
141 dev->resource[i].end = 0;
142 dev->resource[i].flags = 0;
143 }
144 }
145}
146DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_SH7786,
147 sh7786_pci_fixup);
148
149static int __init phy_wait_for_ack(struct pci_channel *chan)
121{ 150{
122 unsigned int timeout = 100; 151 unsigned int timeout = 100;
123 152
@@ -131,7 +160,7 @@ static int phy_wait_for_ack(struct pci_channel *chan)
131 return -ETIMEDOUT; 160 return -ETIMEDOUT;
132} 161}
133 162
134static int pci_wait_for_irq(struct pci_channel *chan, unsigned int mask) 163static int __init pci_wait_for_irq(struct pci_channel *chan, unsigned int mask)
135{ 164{
136 unsigned int timeout = 100; 165 unsigned int timeout = 100;
137 166
@@ -145,19 +174,14 @@ static int pci_wait_for_irq(struct pci_channel *chan, unsigned int mask)
145 return -ETIMEDOUT; 174 return -ETIMEDOUT;
146} 175}
147 176
148static void phy_write_reg(struct pci_channel *chan, unsigned int addr, 177static void __init phy_write_reg(struct pci_channel *chan, unsigned int addr,
149 unsigned int lane, unsigned int data) 178 unsigned int lane, unsigned int data)
150{ 179{
151 unsigned long phyaddr, ctrl; 180 unsigned long phyaddr;
152 181
153 phyaddr = (1 << BITS_CMD) + ((lane & 0xf) << BITS_LANE) + 182 phyaddr = (1 << BITS_CMD) + ((lane & 0xf) << BITS_LANE) +
154 ((addr & 0xff) << BITS_ADR); 183 ((addr & 0xff) << BITS_ADR);
155 184
156 /* Enable clock */
157 ctrl = pci_read_reg(chan, SH4A_PCIEPHYCTLR);
158 ctrl |= (1 << BITS_CKE);
159 pci_write_reg(chan, ctrl, SH4A_PCIEPHYCTLR);
160
161 /* Set write data */ 185 /* Set write data */
162 pci_write_reg(chan, data, SH4A_PCIEPHYDOUTR); 186 pci_write_reg(chan, data, SH4A_PCIEPHYDOUTR);
163 pci_write_reg(chan, phyaddr, SH4A_PCIEPHYADRR); 187 pci_write_reg(chan, phyaddr, SH4A_PCIEPHYADRR);
@@ -165,20 +189,74 @@ static void phy_write_reg(struct pci_channel *chan, unsigned int addr,
165 phy_wait_for_ack(chan); 189 phy_wait_for_ack(chan);
166 190
167 /* Clear command */ 191 /* Clear command */
192 pci_write_reg(chan, 0, SH4A_PCIEPHYDOUTR);
168 pci_write_reg(chan, 0, SH4A_PCIEPHYADRR); 193 pci_write_reg(chan, 0, SH4A_PCIEPHYADRR);
169 194
170 phy_wait_for_ack(chan); 195 phy_wait_for_ack(chan);
196}
171 197
172 /* Disable clock */ 198static int __init pcie_clk_init(struct sh7786_pcie_port *port)
173 ctrl = pci_read_reg(chan, SH4A_PCIEPHYCTLR); 199{
174 ctrl &= ~(1 << BITS_CKE); 200 struct pci_channel *chan = port->hose;
175 pci_write_reg(chan, ctrl, SH4A_PCIEPHYCTLR); 201 struct clk *clk;
202 char fclk_name[16];
203 int ret;
204
205 /*
206 * First register the fixed clock
207 */
208 ret = clk_register(&fixed_pciexclkp);
209 if (unlikely(ret != 0))
210 return ret;
211
212 /*
213 * Grab the port's function clock, which the PHY clock depends
214 * on. clock lookups don't help us much at this point, since no
215 * dev_id is available this early. Lame.
216 */
217 snprintf(fclk_name, sizeof(fclk_name), "pcie%d_fck", port->index);
218
219 port->fclk = clk_get(NULL, fclk_name);
220 if (IS_ERR(port->fclk)) {
221 ret = PTR_ERR(port->fclk);
222 goto err_fclk;
223 }
224
225 clk_enable(port->fclk);
226
227 /*
228 * And now, set up the PHY clock
229 */
230 clk = &port->phy_clk;
231
232 memset(clk, 0, sizeof(struct clk));
233
234 clk->parent = &fixed_pciexclkp;
235 clk->enable_reg = (void __iomem *)(chan->reg_base + SH4A_PCIEPHYCTLR);
236 clk->enable_bit = BITS_CKE;
237
238 ret = sh_clk_mstp32_register(clk, 1);
239 if (unlikely(ret < 0))
240 goto err_phy;
241
242 return 0;
243
244err_phy:
245 clk_disable(port->fclk);
246 clk_put(port->fclk);
247err_fclk:
248 clk_unregister(&fixed_pciexclkp);
249
250 return ret;
176} 251}
177 252
178static int phy_init(struct pci_channel *chan) 253static int __init phy_init(struct sh7786_pcie_port *port)
179{ 254{
255 struct pci_channel *chan = port->hose;
180 unsigned int timeout = 100; 256 unsigned int timeout = 100;
181 257
258 clk_enable(&port->phy_clk);
259
182 /* Initialize the phy */ 260 /* Initialize the phy */
183 phy_write_reg(chan, 0x60, 0xf, 0x004b008b); 261 phy_write_reg(chan, 0x60, 0xf, 0x004b008b);
184 phy_write_reg(chan, 0x61, 0xf, 0x00007b41); 262 phy_write_reg(chan, 0x61, 0xf, 0x00007b41);
@@ -187,9 +265,13 @@ static int phy_init(struct pci_channel *chan)
187 phy_write_reg(chan, 0x66, 0xf, 0x00000010); 265 phy_write_reg(chan, 0x66, 0xf, 0x00000010);
188 phy_write_reg(chan, 0x74, 0xf, 0x0007001c); 266 phy_write_reg(chan, 0x74, 0xf, 0x0007001c);
189 phy_write_reg(chan, 0x79, 0xf, 0x01fc000d); 267 phy_write_reg(chan, 0x79, 0xf, 0x01fc000d);
268 phy_write_reg(chan, 0xb0, 0xf, 0x00000610);
190 269
191 /* Deassert Standby */ 270 /* Deassert Standby */
192 phy_write_reg(chan, 0x67, 0xf, 0x00000400); 271 phy_write_reg(chan, 0x67, 0x1, 0x00000400);
272
273 /* Disable clock */
274 clk_disable(&port->phy_clk);
193 275
194 while (timeout--) { 276 while (timeout--) {
195 if (pci_read_reg(chan, SH4A_PCIEPHYSR)) 277 if (pci_read_reg(chan, SH4A_PCIEPHYSR))
@@ -201,22 +283,33 @@ static int phy_init(struct pci_channel *chan)
201 return -ETIMEDOUT; 283 return -ETIMEDOUT;
202} 284}
203 285
204static int pcie_init(struct sh7786_pcie_port *port) 286static void __init pcie_reset(struct sh7786_pcie_port *port)
287{
288 struct pci_channel *chan = port->hose;
289
290 pci_write_reg(chan, 1, SH4A_PCIESRSTR);
291 pci_write_reg(chan, 0, SH4A_PCIETCTLR);
292 pci_write_reg(chan, 0, SH4A_PCIESRSTR);
293 pci_write_reg(chan, 0, SH4A_PCIETXVC0SR);
294}
295
296static int __init pcie_init(struct sh7786_pcie_port *port)
205{ 297{
206 struct pci_channel *chan = port->hose; 298 struct pci_channel *chan = port->hose;
207 unsigned int data; 299 unsigned int data;
208 phys_addr_t memphys; 300 phys_addr_t memphys;
209 size_t memsize; 301 size_t memsize;
210 int ret, i; 302 int ret, i, win;
211 303
212 /* Begin initialization */ 304 /* Begin initialization */
213 pci_write_reg(chan, 0, SH4A_PCIETCTLR); 305 pcie_reset(port);
214 306
215 /* Initialize as type1. */ 307 /*
216 data = pci_read_reg(chan, SH4A_PCIEPCICONF3); 308 * Initial header for port config space is type 1, set the device
217 data &= ~(0x7f << 16); 309 * class to match. Hardware takes care of propagating the IDSETR
218 data |= PCI_HEADER_TYPE_BRIDGE << 16; 310 * settings, so there is no need to bother with a quirk.
219 pci_write_reg(chan, data, SH4A_PCIEPCICONF3); 311 */
312 pci_write_reg(chan, PCI_CLASS_BRIDGE_PCI << 16, SH4A_PCIEIDSETR1);
220 313
221 /* Initialize default capabilities. */ 314 /* Initialize default capabilities. */
222 data = pci_read_reg(chan, SH4A_PCIEEXPCAP0); 315 data = pci_read_reg(chan, SH4A_PCIEEXPCAP0);
@@ -268,30 +361,33 @@ static int pcie_init(struct sh7786_pcie_port *port)
268 * LAR1/LAMR1. 361 * LAR1/LAMR1.
269 */ 362 */
270 if (memsize > SZ_512M) { 363 if (memsize > SZ_512M) {
271 __raw_writel(memphys + SZ_512M, chan->reg_base + SH4A_PCIELAR1); 364 pci_write_reg(chan, memphys + SZ_512M, SH4A_PCIELAR1);
272 __raw_writel(((memsize - SZ_512M) - SZ_256) | 1, 365 pci_write_reg(chan, ((memsize - SZ_512M) - SZ_256) | 1,
273 chan->reg_base + SH4A_PCIELAMR1); 366 SH4A_PCIELAMR1);
274 memsize = SZ_512M; 367 memsize = SZ_512M;
275 } else { 368 } else {
276 /* 369 /*
277 * Otherwise just zero it out and disable it. 370 * Otherwise just zero it out and disable it.
278 */ 371 */
279 __raw_writel(0, chan->reg_base + SH4A_PCIELAR1); 372 pci_write_reg(chan, 0, SH4A_PCIELAR1);
280 __raw_writel(0, chan->reg_base + SH4A_PCIELAMR1); 373 pci_write_reg(chan, 0, SH4A_PCIELAMR1);
281 } 374 }
282 375
283 /* 376 /*
284 * LAR0/LAMR0 covers up to the first 512MB, which is enough to 377 * LAR0/LAMR0 covers up to the first 512MB, which is enough to
285 * cover all of lowmem on most platforms. 378 * cover all of lowmem on most platforms.
286 */ 379 */
287 __raw_writel(memphys, chan->reg_base + SH4A_PCIELAR0); 380 pci_write_reg(chan, memphys, SH4A_PCIELAR0);
288 __raw_writel((memsize - SZ_256) | 1, chan->reg_base + SH4A_PCIELAMR0); 381 pci_write_reg(chan, (memsize - SZ_256) | 1, SH4A_PCIELAMR0);
289 382
290 /* Finish initialization */ 383 /* Finish initialization */
291 data = pci_read_reg(chan, SH4A_PCIETCTLR); 384 data = pci_read_reg(chan, SH4A_PCIETCTLR);
292 data |= 0x1; 385 data |= 0x1;
293 pci_write_reg(chan, data, SH4A_PCIETCTLR); 386 pci_write_reg(chan, data, SH4A_PCIETCTLR);
294 387
388 /* Let things settle down a bit.. */
389 mdelay(100);
390
295 /* Enable DL_Active Interrupt generation */ 391 /* Enable DL_Active Interrupt generation */
296 data = pci_read_reg(chan, SH4A_PCIEDLINTENR); 392 data = pci_read_reg(chan, SH4A_PCIEDLINTENR);
297 data |= PCIEDLINTENR_DLL_ACT_ENABLE; 393 data |= PCIEDLINTENR_DLL_ACT_ENABLE;
@@ -302,9 +398,12 @@ static int pcie_init(struct sh7786_pcie_port *port)
302 data |= PCIEMACCTLR_SCR_DIS | (0xff << 16); 398 data |= PCIEMACCTLR_SCR_DIS | (0xff << 16);
303 pci_write_reg(chan, data, SH4A_PCIEMACCTLR); 399 pci_write_reg(chan, data, SH4A_PCIEMACCTLR);
304 400
401 /*
402 * This will timeout if we don't have a link, but we permit the
403 * port to register anyways in order to support hotplug on future
404 * hardware.
405 */
305 ret = pci_wait_for_irq(chan, MASK_INT_TX_CTRL); 406 ret = pci_wait_for_irq(chan, MASK_INT_TX_CTRL);
306 if (unlikely(ret != 0))
307 return -ENODEV;
308 407
309 data = pci_read_reg(chan, SH4A_PCIEPCICONF1); 408 data = pci_read_reg(chan, SH4A_PCIEPCICONF1);
310 data &= ~(PCI_STATUS_DEVSEL_MASK << 16); 409 data &= ~(PCI_STATUS_DEVSEL_MASK << 16);
@@ -317,35 +416,48 @@ static int pcie_init(struct sh7786_pcie_port *port)
317 416
318 wmb(); 417 wmb();
319 418
320 data = pci_read_reg(chan, SH4A_PCIEMACSR); 419 if (ret == 0) {
321 printk(KERN_NOTICE "PCI: PCIe#%d link width %d\n", 420 data = pci_read_reg(chan, SH4A_PCIEMACSR);
322 port->index, (data >> 20) & 0x3f); 421 printk(KERN_NOTICE "PCI: PCIe#%d x%d link detected\n",
323 422 port->index, (data >> 20) & 0x3f);
423 } else
424 printk(KERN_NOTICE "PCI: PCIe#%d link down\n",
425 port->index);
324 426
325 for (i = 0; i < chan->nr_resources; i++) { 427 for (i = win = 0; i < chan->nr_resources; i++) {
326 struct resource *res = chan->resources + i; 428 struct resource *res = chan->resources + i;
327 resource_size_t size; 429 resource_size_t size;
328 u32 enable_mask; 430 u32 mask;
329 431
330 pci_write_reg(chan, 0x00000000, SH4A_PCIEPTCTLR(i)); 432 /*
433 * We can't use the 32-bit mode windows in legacy 29-bit
434 * mode, so just skip them entirely.
435 */
436 if ((res->flags & IORESOURCE_MEM_32BIT) && __in_29bit_mode())
437 continue;
331 438
332 size = resource_size(res); 439 pci_write_reg(chan, 0x00000000, SH4A_PCIEPTCTLR(win));
333 440
334 /* 441 /*
335 * The PAMR mask is calculated in units of 256kB, which 442 * The PAMR mask is calculated in units of 256kB, which
336 * keeps things pretty simple. 443 * keeps things pretty simple.
337 */ 444 */
338 __raw_writel(((roundup_pow_of_two(size) / SZ_256K) - 1) << 18, 445 size = resource_size(res);
339 chan->reg_base + SH4A_PCIEPAMR(i)); 446 mask = (roundup_pow_of_two(size) / SZ_256K) - 1;
447 pci_write_reg(chan, mask << 18, SH4A_PCIEPAMR(win));
340 448
341 pci_write_reg(chan, 0x00000000, SH4A_PCIEPARH(i)); 449 pci_write_reg(chan, upper_32_bits(res->start),
342 pci_write_reg(chan, 0x00000000, SH4A_PCIEPARL(i)); 450 SH4A_PCIEPARH(win));
451 pci_write_reg(chan, lower_32_bits(res->start),
452 SH4A_PCIEPARL(win));
343 453
344 enable_mask = MASK_PARE; 454 mask = MASK_PARE;
345 if (res->flags & IORESOURCE_IO) 455 if (res->flags & IORESOURCE_IO)
346 enable_mask |= MASK_SPC; 456 mask |= MASK_SPC;
457
458 pci_write_reg(chan, mask, SH4A_PCIEPTCTLR(win));
347 459
348 pci_write_reg(chan, enable_mask, SH4A_PCIEPTCTLR(i)); 460 win++;
349 } 461 }
350 462
351 return 0; 463 return 0;
@@ -356,26 +468,33 @@ int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
356 return 71; 468 return 71;
357} 469}
358 470
359static int sh7786_pcie_core_init(void) 471static int __init sh7786_pcie_core_init(void)
360{ 472{
361 /* Return the number of ports */ 473 /* Return the number of ports */
362 return test_mode_pin(MODE_PIN12) ? 3 : 2; 474 return test_mode_pin(MODE_PIN12) ? 3 : 2;
363} 475}
364 476
365static int __devinit sh7786_pcie_init_hw(struct sh7786_pcie_port *port) 477static int __init sh7786_pcie_init_hw(struct sh7786_pcie_port *port)
366{ 478{
367 int ret; 479 int ret;
368 480
369 ret = phy_init(port->hose);
370 if (unlikely(ret < 0))
371 return ret;
372
373 /* 481 /*
374 * Check if we are configured in endpoint or root complex mode, 482 * Check if we are configured in endpoint or root complex mode,
375 * this is a fixed pin setting that applies to all PCIe ports. 483 * this is a fixed pin setting that applies to all PCIe ports.
376 */ 484 */
377 port->endpoint = test_mode_pin(MODE_PIN11); 485 port->endpoint = test_mode_pin(MODE_PIN11);
378 486
487 /*
488 * Setup clocks, needed both for PHY and PCIe registers.
489 */
490 ret = pcie_clk_init(port);
491 if (unlikely(ret < 0))
492 return ret;
493
494 ret = phy_init(port);
495 if (unlikely(ret < 0))
496 return ret;
497
379 ret = pcie_init(port); 498 ret = pcie_init(port);
380 if (unlikely(ret < 0)) 499 if (unlikely(ret < 0))
381 return ret; 500 return ret;
@@ -390,9 +509,10 @@ static struct sh7786_pcie_hwops sh7786_65nm_pcie_hwops __initdata = {
390 509
391static int __init sh7786_pcie_init(void) 510static int __init sh7786_pcie_init(void)
392{ 511{
512 struct clk *platclk;
393 int ret = 0, i; 513 int ret = 0, i;
394 514
395 printk(KERN_NOTICE "PCI: Starting intialization.\n"); 515 printk(KERN_NOTICE "PCI: Starting initialization.\n");
396 516
397 sh7786_pcie_hwops = &sh7786_65nm_pcie_hwops; 517 sh7786_pcie_hwops = &sh7786_65nm_pcie_hwops;
398 518
@@ -407,6 +527,22 @@ static int __init sh7786_pcie_init(void)
407 if (unlikely(!sh7786_pcie_ports)) 527 if (unlikely(!sh7786_pcie_ports))
408 return -ENOMEM; 528 return -ENOMEM;
409 529
530 /*
531 * Fetch any optional platform clock associated with this block.
532 *
533 * This is a rather nasty hack for boards with spec-mocking FPGAs
534 * that have a secondary set of clocks outside of the on-chip
535 * ones that need to be accounted for before there is any chance
536 * of touching the existing MSTP bits or CPG clocks.
537 */
538 platclk = clk_get(NULL, "pcie_plat_clk");
539 if (IS_ERR(platclk)) {
540 /* Sane hardware should probably get a WARN_ON.. */
541 platclk = NULL;
542 }
543
544 clk_enable(platclk);
545
410 printk(KERN_NOTICE "PCI: probing %d ports.\n", nr_ports); 546 printk(KERN_NOTICE "PCI: probing %d ports.\n", nr_ports);
411 547
412 for (i = 0; i < nr_ports; i++) { 548 for (i = 0; i < nr_ports; i++) {
@@ -419,8 +555,11 @@ static int __init sh7786_pcie_init(void)
419 ret |= sh7786_pcie_hwops->port_init_hw(port); 555 ret |= sh7786_pcie_hwops->port_init_hw(port);
420 } 556 }
421 557
422 if (unlikely(ret)) 558 if (unlikely(ret)) {
559 clk_disable(platclk);
560 clk_put(platclk);
423 return ret; 561 return ret;
562 }
424 563
425 return 0; 564 return 0;
426} 565}
diff --git a/arch/sh/drivers/pci/pcie-sh7786.h b/arch/sh/drivers/pci/pcie-sh7786.h
index 90a6992576b0..1ee054e47eae 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.h
+++ b/arch/sh/drivers/pci/pcie-sh7786.h
@@ -55,8 +55,11 @@
55#define BITS_ERRRCV (0) /* 0 ERRRCV 0 */ 55#define BITS_ERRRCV (0) /* 0 ERRRCV 0 */
56#define MASK_ERRRCV (1<<BITS_ERRRCV) 56#define MASK_ERRRCV (1<<BITS_ERRRCV)
57 57
58/* PCIEENBLR */
59#define SH4A_PCIEENBLR (0x000008) /* R/W - 0x0000 0001 32 */
60
58/* PCIEECR */ 61/* PCIEECR */
59#define SH4A_PCIEECR (0x000008) /* R/W - 0x0000 0000 32 */ 62#define SH4A_PCIEECR (0x00000C) /* R/W - 0x0000 0000 32 */
60#define BITS_ENBL (0) /* 0 ENBL 0 R/W */ 63#define BITS_ENBL (0) /* 0 ENBL 0 R/W */
61#define MASK_ENBL (1<<BITS_ENBL) 64#define MASK_ENBL (1<<BITS_ENBL)
62 65
@@ -113,6 +116,27 @@
113#define BITS_MDATA (0) 116#define BITS_MDATA (0)
114#define MASK_MDATA (0xffffffff<<BITS_MDATA) 117#define MASK_MDATA (0xffffffff<<BITS_MDATA)
115 118
119/* PCIEUNLOCKCR */
120#define SH4A_PCIEUNLOCKCR (0x000048) /* R/W - 0x0000 0000 32 */
121
122/* PCIEIDR */
123#define SH4A_PCIEIDR (0x000060) /* R/W - 0x0101 1101 32 */
124
125/* PCIEDBGCTLR */
126#define SH4A_PCIEDBGCTLR (0x000100) /* R/W - 0x0000 0000 32 */
127
128/* PCIEINTXR */
129#define SH4A_PCIEINTXR (0x004000) /* R/W - 0x0000 0000 32 */
130
131/* PCIERMSGR */
132#define SH4A_PCIERMSGR (0x004010) /* R/W - 0x0000 0000 32 */
133
134/* PCIERSTR */
135#define SH4A_PCIERSTR(x) (0x008000 + ((x) * 0x4)) /* R/W - 0x0000 0000 32 */
136
137/* PCIESRSTR */
138#define SH4A_PCIESRSTR (0x008040) /* R/W - 0x0000 0000 32 */
139
116/* PCIEPHYCTLR */ 140/* PCIEPHYCTLR */
117#define SH4A_PCIEPHYCTLR (0x010000) /* R/W - 0x0000 0000 32 */ 141#define SH4A_PCIEPHYCTLR (0x010000) /* R/W - 0x0000 0000 32 */
118#define BITS_CKE (0) 142#define BITS_CKE (0)
@@ -121,6 +145,9 @@
121/* PCIERMSGIER */ 145/* PCIERMSGIER */
122#define SH4A_PCIERMSGIER (0x004040) /* R/W - 0x0000 0000 32 */ 146#define SH4A_PCIERMSGIER (0x004040) /* R/W - 0x0000 0000 32 */
123 147
148/* PCIEPHYCTLR */
149#define SH4A_PCIEPHYCTLR (0x010000) /* R/W - 0x0000 0000 32 */
150
124/* PCIEPHYADRR */ 151/* PCIEPHYADRR */
125#define SH4A_PCIEPHYADRR (0x010004) /* R/W - 0x0000 0000 32 */ 152#define SH4A_PCIEPHYADRR (0x010004) /* R/W - 0x0000 0000 32 */
126#define BITS_ACK (24) // Rev1.171 153#define BITS_ACK (24) // Rev1.171
@@ -152,7 +179,7 @@
152#define MASK_CFINT (1<<BITS_CFINT) 179#define MASK_CFINT (1<<BITS_CFINT)
153 180
154/* PCIETSTR */ 181/* PCIETSTR */
155#define SH4A_PCIETSTR (0x020004) /* R/W R/W 0x0000 0000 32 */ 182#define SH4A_PCIETSTR (0x020004) /* R 0x0000 0000 32 */
156 183
157/* PCIEINTR */ 184/* PCIEINTR */
158#define SH4A_PCIEINTR (0x020008) /* R/W R/W 0x0000 0000 32 */ 185#define SH4A_PCIEINTR (0x020008) /* R/W R/W 0x0000 0000 32 */
@@ -236,6 +263,9 @@
236#define BITS_INTPM (8) 263#define BITS_INTPM (8)
237#define MASK_INTPM (1<<BITS_INTPM) 264#define MASK_INTPM (1<<BITS_INTPM)
238 265
266/* PCIEEH0R */
267#define SH4A_PCIEEHR(x) (0x020010 + ((x) * 0x4)) /* R - 0x0000 0000 32 */
268
239/* PCIEAIR */ 269/* PCIEAIR */
240#define SH4A_PCIEAIR (SH4A_PCIE_BASE + 0x020010) /* R/W R/W 0xxxxx xxxx 32 */ 270#define SH4A_PCIEAIR (SH4A_PCIE_BASE + 0x020010) /* R/W R/W 0xxxxx xxxx 32 */
241 271
@@ -244,6 +274,25 @@
244 274
245/* PCIEERRFR */ // Rev1.18 275/* PCIEERRFR */ // Rev1.18
246#define SH4A_PCIEERRFR (0x020020) /* R/W R/W 0xxxxx xxxx 32 */ // Rev1.18 276#define SH4A_PCIEERRFR (0x020020) /* R/W R/W 0xxxxx xxxx 32 */ // Rev1.18
277
278/* PCIEERRFER */
279#define SH4A_PCIEERRFER (0x020024) /* R/W R/W 0x0000 0000 32 */
280
281/* PCIEERRFR2 */
282#define SH4A_PCIEERRFR2 (0x020028) /* R/W R/W 0x0000 0000 32 */
283
284/* PCIEMSIR */
285#define SH4A_PCIEMSIR (0x020040) /* R/W - 0x0000 0000 32 */
286
287/* PCIEMSIFR */
288#define SH4A_PCIEMSIFR (0x020044) /* R/W R/W 0x0000 0000 32 */
289
290/* PCIEPWRCTLR */
291#define SH4A_PCIEPWRCTLR (0x020100) /* R/W - 0x0000 0000 32 */
292
293/* PCIEPCCTLR */
294#define SH4A_PCIEPCCTLR (0x020180) /* R/W - 0x0000 0000 32 */
295
247 // Rev1.18 296 // Rev1.18
248/* PCIELAR0 */ 297/* PCIELAR0 */
249#define SH4A_PCIELAR0 (0x020200) /* R/W R/W 0x0000 0000 32 */ 298#define SH4A_PCIELAR0 (0x020200) /* R/W R/W 0x0000 0000 32 */
@@ -352,6 +401,7 @@
352#define SH4A_PCIEDMCCR0 (0x021120) /* R/W R/W 0x0000 0000 32 */ 401#define SH4A_PCIEDMCCR0 (0x021120) /* R/W R/W 0x0000 0000 32 */
353#define SH4A_PCIEDMCC2R0 (0x021124) /* R/W R/W 0x0000 0000 - */ 402#define SH4A_PCIEDMCC2R0 (0x021124) /* R/W R/W 0x0000 0000 - */
354#define SH4A_PCIEDMCCCR0 (0x021128) /* R/W R/W 0x0000 0000 32 */ 403#define SH4A_PCIEDMCCCR0 (0x021128) /* R/W R/W 0x0000 0000 32 */
404#define SH4A_PCIEDMCHSR0 (0x02112C) /* R/W - 0x0000 0000 32 */
355#define SH4A_PCIEDMSAR1 (0x021140) /* R/W R/W 0x0000 0000 32 */ 405#define SH4A_PCIEDMSAR1 (0x021140) /* R/W R/W 0x0000 0000 32 */
356#define SH4A_PCIEDMSAHR1 (0x021144) /* R/W R/W 0x0000 0000 32 */ 406#define SH4A_PCIEDMSAHR1 (0x021144) /* R/W R/W 0x0000 0000 32 */
357#define SH4A_PCIEDMDAR1 (0x021148) /* R/W R/W 0x0000 0000 32 */ 407#define SH4A_PCIEDMDAR1 (0x021148) /* R/W R/W 0x0000 0000 32 */
@@ -363,6 +413,7 @@
363#define SH4A_PCIEDMCCR1 (0x021160) /* R/W R/W 0x0000 0000 32 */ 413#define SH4A_PCIEDMCCR1 (0x021160) /* R/W R/W 0x0000 0000 32 */
364#define SH4A_PCIEDMCC2R1 (0x021164) /* R/W R/W 0x0000 0000 - */ 414#define SH4A_PCIEDMCC2R1 (0x021164) /* R/W R/W 0x0000 0000 - */
365#define SH4A_PCIEDMCCCR1 (0x021168) /* R/W R/W 0x0000 0000 32 */ 415#define SH4A_PCIEDMCCCR1 (0x021168) /* R/W R/W 0x0000 0000 32 */
416#define SH4A_PCIEDMCHSR1 (0x02116C) /* R/W - 0x0000 0000 32 */
366#define SH4A_PCIEDMSAR2 (0x021180) /* R/W R/W 0x0000 0000 32 */ 417#define SH4A_PCIEDMSAR2 (0x021180) /* R/W R/W 0x0000 0000 32 */
367#define SH4A_PCIEDMSAHR2 (0x021184) /* R/W R/W 0x0000 0000 32 */ 418#define SH4A_PCIEDMSAHR2 (0x021184) /* R/W R/W 0x0000 0000 32 */
368#define SH4A_PCIEDMDAR2 (0x021188) /* R/W R/W 0x0000 0000 32 */ 419#define SH4A_PCIEDMDAR2 (0x021188) /* R/W R/W 0x0000 0000 32 */
@@ -385,6 +436,7 @@
385#define SH4A_PCIEDMCCR3 (0x0211E0) /* R/W R/W 0x0000 0000 32 */ 436#define SH4A_PCIEDMCCR3 (0x0211E0) /* R/W R/W 0x0000 0000 32 */
386#define SH4A_PCIEDMCC2R3 (0x0211E4) /* R/W R/W 0x0000 0000 - */ 437#define SH4A_PCIEDMCC2R3 (0x0211E4) /* R/W R/W 0x0000 0000 - */
387#define SH4A_PCIEDMCCCR3 (0x0211E8) /* R/W R/W 0x0000 0000 32 */ 438#define SH4A_PCIEDMCCCR3 (0x0211E8) /* R/W R/W 0x0000 0000 32 */
439#define SH4A_PCIEDMCHSR3 (0x0211EC) /* R/W R/W 0x0000 0000 32 */
388#define SH4A_PCIEPCICONF0 (0x040000) /* R R - 8/16/32 */ 440#define SH4A_PCIEPCICONF0 (0x040000) /* R R - 8/16/32 */
389#define SH4A_PCIEPCICONF1 (0x040004) /* R/W R/W 0x0008 0000 8/16/32 */ 441#define SH4A_PCIEPCICONF1 (0x040004) /* R/W R/W 0x0008 0000 8/16/32 */
390#define SH4A_PCIEPCICONF2 (0x040008) /* R/W R/W 0xFF00 0000 8/16/32 */ 442#define SH4A_PCIEPCICONF2 (0x040008) /* R/W R/W 0xFF00 0000 8/16/32 */
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 0eed47b236ab..7beb42322f60 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -5,5 +5,7 @@ header-y += cpu-features.h
5header-y += hw_breakpoint.h 5header-y += hw_breakpoint.h
6header-y += posix_types_32.h 6header-y += posix_types_32.h
7header-y += posix_types_64.h 7header-y += posix_types_64.h
8header-y += ptrace_32.h
9header-y += ptrace_64.h
8header-y += unistd_32.h 10header-y += unistd_32.h
9header-y += unistd_64.h 11header-y += unistd_64.h
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index ce830faeebbf..f38112be67d2 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -50,25 +50,14 @@
50#define R_SH_GOTPC 167 50#define R_SH_GOTPC 167
51 51
52/* FDPIC relocs */ 52/* FDPIC relocs */
53#define R_SH_GOT20 70 53#define R_SH_GOT20 201
54#define R_SH_GOTOFF20 71 54#define R_SH_GOTOFF20 202
55#define R_SH_GOTFUNCDESC 72 55#define R_SH_GOTFUNCDESC 203
56#define R_SH_GOTFUNCDESC20 73 56#define R_SH_GOTFUNCDESC20 204
57#define R_SH_GOTOFFFUNCDESC 74 57#define R_SH_GOTOFFFUNCDESC 205
58#define R_SH_GOTOFFFUNCDESC20 75 58#define R_SH_GOTOFFFUNCDESC20 206
59#define R_SH_FUNCDESC 76 59#define R_SH_FUNCDESC 207
60#define R_SH_FUNCDESC_VALUE 77 60#define R_SH_FUNCDESC_VALUE 208
61
62#if 0 /* XXX - later .. */
63#define R_SH_GOT20 198
64#define R_SH_GOTOFF20 199
65#define R_SH_GOTFUNCDESC 200
66#define R_SH_GOTFUNCDESC20 201
67#define R_SH_GOTOFFFUNCDESC 202
68#define R_SH_GOTOFFFUNCDESC20 203
69#define R_SH_FUNCDESC 204
70#define R_SH_FUNCDESC_VALUE 205
71#endif
72 61
73/* SHmedia relocs */ 62/* SHmedia relocs */
74#define R_SH_IMM_LOW16 246 63#define R_SH_IMM_LOW16 246
diff --git a/arch/sh/include/asm/fixmap.h b/arch/sh/include/asm/fixmap.h
index 6e7cea453895..bd7e79a12653 100644
--- a/arch/sh/include/asm/fixmap.h
+++ b/arch/sh/include/asm/fixmap.h
@@ -58,7 +58,7 @@ enum fixed_addresses {
58 58
59#ifdef CONFIG_HIGHMEM 59#ifdef CONFIG_HIGHMEM
60 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 60 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
61 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, 61 FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1,
62#endif 62#endif
63 63
64#ifdef CONFIG_IOREMAP_FIXED 64#ifdef CONFIG_IOREMAP_FIXED
@@ -69,7 +69,7 @@ enum fixed_addresses {
69 */ 69 */
70#define FIX_N_IOREMAPS 32 70#define FIX_N_IOREMAPS 32
71 FIX_IOREMAP_BEGIN, 71 FIX_IOREMAP_BEGIN,
72 FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS, 72 FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS - 1,
73#endif 73#endif
74 74
75 __end_of_fixed_addresses 75 __end_of_fixed_addresses
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
index f8d9a731e903..04f53d31489f 100644
--- a/arch/sh/include/asm/gpio.h
+++ b/arch/sh/include/asm/gpio.h
@@ -41,14 +41,12 @@ static inline int gpio_cansleep(unsigned gpio)
41 41
42static inline int gpio_to_irq(unsigned gpio) 42static inline int gpio_to_irq(unsigned gpio)
43{ 43{
44 WARN_ON(1); 44 return __gpio_to_irq(gpio);
45 return -ENOSYS;
46} 45}
47 46
48static inline int irq_to_gpio(unsigned int irq) 47static inline int irq_to_gpio(unsigned int irq)
49{ 48{
50 WARN_ON(1); 49 return -ENOSYS;
51 return -EINVAL;
52} 50}
53 51
54#endif /* CONFIG_GPIOLIB */ 52#endif /* CONFIG_GPIOLIB */
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
index 02c2f0102cfa..45d08b6a5ef7 100644
--- a/arch/sh/include/asm/irq.h
+++ b/arch/sh/include/asm/irq.h
@@ -9,7 +9,7 @@
9 * advised to cap this at the hard limit that they're interested in 9 * advised to cap this at the hard limit that they're interested in
10 * through the machvec. 10 * through the machvec.
11 */ 11 */
12#define NR_IRQS 256 12#define NR_IRQS 512
13#define NR_IRQS_LEGACY 8 /* Legacy external IRQ0-7 */ 13#define NR_IRQS_LEGACY 8 /* Legacy external IRQ0-7 */
14 14
15/* 15/*
diff --git a/arch/sh/include/asm/kprobes.h b/arch/sh/include/asm/kprobes.h
index 036c3311233c..134f3980e44a 100644
--- a/arch/sh/include/asm/kprobes.h
+++ b/arch/sh/include/asm/kprobes.h
@@ -16,7 +16,6 @@ typedef insn_size_t kprobe_opcode_t;
16 ? (MAX_STACK_SIZE) \ 16 ? (MAX_STACK_SIZE) \
17 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) 17 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
18 18
19#define regs_return_value(_regs) ((_regs)->regs[0])
20#define flush_insn_slot(p) do { } while (0) 19#define flush_insn_slot(p) do { } while (0)
21#define kretprobe_blacklist_size 0 20#define kretprobe_blacklist_size 0
22 21
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 8bd952fcf3ba..f0efe97f1750 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -37,6 +37,8 @@ struct pci_channel {
37}; 37};
38 38
39/* arch/sh/drivers/pci/pci.c */ 39/* arch/sh/drivers/pci/pci.c */
40extern raw_spinlock_t pci_config_lock;
41
40extern int register_pci_controller(struct pci_channel *hose); 42extern int register_pci_controller(struct pci_channel *hose);
41extern void pcibios_report_status(unsigned int status_mask, int warn); 43extern void pcibios_report_status(unsigned int status_mask, int warn);
42 44
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index 61a445d2d02a..46d5179c9f49 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -13,7 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/ptrace.h>
17#include <asm/hw_breakpoint.h> 16#include <asm/hw_breakpoint.h>
18 17
19/* 18/*
@@ -194,8 +193,6 @@ extern unsigned long get_wchan(struct task_struct *p);
194#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) 193#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
195#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[15]) 194#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[15])
196 195
197#define user_stack_pointer(_regs) ((_regs)->regs[15])
198
199#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4) 196#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4)
200#define PREFETCH_STRIDE L1_CACHE_BYTES 197#define PREFETCH_STRIDE L1_CACHE_BYTES
201#define ARCH_HAS_PREFETCH 198#define ARCH_HAS_PREFETCH
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
index 621bc4618c6b..2a541ddb5a1b 100644
--- a/arch/sh/include/asm/processor_64.h
+++ b/arch/sh/include/asm/processor_64.h
@@ -17,7 +17,6 @@
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/types.h> 19#include <asm/types.h>
20#include <asm/ptrace.h>
21#include <cpu/registers.h> 20#include <cpu/registers.h>
22 21
23/* 22/*
@@ -231,7 +230,5 @@ extern unsigned long get_wchan(struct task_struct *p);
231#define KSTK_EIP(tsk) ((tsk)->thread.pc) 230#define KSTK_EIP(tsk) ((tsk)->thread.pc)
232#define KSTK_ESP(tsk) ((tsk)->thread.sp) 231#define KSTK_ESP(tsk) ((tsk)->thread.sp)
233 232
234#define user_stack_pointer(_regs) ((_regs)->regs[15])
235
236#endif /* __ASSEMBLY__ */ 233#endif /* __ASSEMBLY__ */
237#endif /* __ASM_SH_PROCESSOR_64_H */ 234#endif /* __ASM_SH_PROCESSOR_64_H */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 2168fde25611..f6edc10aa0d3 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -3,90 +3,7 @@
3 3
4/* 4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka 5 * Copyright (C) 1999, 2000 Niibe Yutaka
6 *
7 */
8#if defined(__SH5__)
9struct pt_regs {
10 unsigned long long pc;
11 unsigned long long sr;
12 long long syscall_nr;
13 unsigned long long regs[63];
14 unsigned long long tregs[8];
15 unsigned long long pad[2];
16};
17#else
18/*
19 * GCC defines register number like this:
20 * -----------------------------
21 * 0 - 15 are integer registers
22 * 17 - 22 are control/special registers
23 * 24 - 39 fp registers
24 * 40 - 47 xd registers
25 * 48 - fpscr register
26 * -----------------------------
27 *
28 * We follows above, except:
29 * 16 --- program counter (PC)
30 * 22 --- syscall #
31 * 23 --- floating point communication register
32 */ 6 */
33#define REG_REG0 0
34#define REG_REG15 15
35
36#define REG_PC 16
37
38#define REG_PR 17
39#define REG_SR 18
40#define REG_GBR 19
41#define REG_MACH 20
42#define REG_MACL 21
43
44#define REG_SYSCALL 22
45
46#define REG_FPREG0 23
47#define REG_FPREG15 38
48#define REG_XFREG0 39
49#define REG_XFREG15 54
50
51#define REG_FPSCR 55
52#define REG_FPUL 56
53
54/*
55 * This struct defines the way the registers are stored on the
56 * kernel stack during a system call or other kernel entry.
57 */
58struct pt_regs {
59 unsigned long regs[16];
60 unsigned long pc;
61 unsigned long pr;
62 unsigned long sr;
63 unsigned long gbr;
64 unsigned long mach;
65 unsigned long macl;
66 long tra;
67};
68
69/*
70 * This struct defines the way the DSP registers are stored on the
71 * kernel stack during a system call or other kernel entry.
72 */
73struct pt_dspregs {
74 unsigned long a1;
75 unsigned long a0g;
76 unsigned long a1g;
77 unsigned long m0;
78 unsigned long m1;
79 unsigned long a0;
80 unsigned long x0;
81 unsigned long x1;
82 unsigned long y0;
83 unsigned long y1;
84 unsigned long dsr;
85 unsigned long rs;
86 unsigned long re;
87 unsigned long mod;
88};
89#endif
90 7
91#define PTRACE_GETREGS 12 /* General registers */ 8#define PTRACE_GETREGS 12 /* General registers */
92#define PTRACE_SETREGS 13 9#define PTRACE_SETREGS 13
@@ -107,22 +24,102 @@ struct pt_dspregs {
107#define PT_DATA_ADDR 248 /* &(struct user)->start_data */ 24#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
108#define PT_TEXT_LEN 252 25#define PT_TEXT_LEN 252
109 26
27#if defined(__SH5__) || defined(CONFIG_CPU_SH5)
28#include "ptrace_64.h"
29#else
30#include "ptrace_32.h"
31#endif
32
110#ifdef __KERNEL__ 33#ifdef __KERNEL__
34
35#include <linux/stringify.h>
36#include <linux/stddef.h>
37#include <linux/thread_info.h>
111#include <asm/addrspace.h> 38#include <asm/addrspace.h>
112#include <asm/page.h> 39#include <asm/page.h>
113#include <asm/system.h> 40#include <asm/system.h>
114 41
115#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 42#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
43#define user_stack_pointer(regs) ((unsigned long)(regs)->regs[15])
44#define kernel_stack_pointer(regs) ((unsigned long)(regs)->regs[15])
116#define instruction_pointer(regs) ((unsigned long)(regs)->pc) 45#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
117 46
118extern void show_regs(struct pt_regs *); 47extern void show_regs(struct pt_regs *);
119 48
49#define arch_has_single_step() (1)
50
120/* 51/*
121 * These are defined as per linux/ptrace.h. 52 * kprobe-based event tracer support
122 */ 53 */
123struct task_struct; 54struct pt_regs_offset {
55 const char *name;
56 int offset;
57};
124 58
125#define arch_has_single_step() (1) 59#define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)}
60#define REGS_OFFSET_NAME(num) \
61 {.name = __stringify(r##num), .offset = offsetof(struct pt_regs, regs[num])}
62#define TREGS_OFFSET_NAME(num) \
63 {.name = __stringify(tr##num), .offset = offsetof(struct pt_regs, tregs[num])}
64#define REG_OFFSET_END {.name = NULL, .offset = 0}
65
66/* Query offset/name of register from its name/offset */
67extern int regs_query_register_offset(const char *name);
68extern const char *regs_query_register_name(unsigned int offset);
69
70extern const struct pt_regs_offset regoffset_table[];
71
72/**
73 * regs_get_register() - get register value from its offset
74 * @regs: pt_regs from which register value is gotten.
75 * @offset: offset number of the register.
76 *
77 * regs_get_register returns the value of a register. The @offset is the
78 * offset of the register in struct pt_regs address which specified by @regs.
79 * If @offset is bigger than MAX_REG_OFFSET, this returns 0.
80 */
81static inline unsigned long regs_get_register(struct pt_regs *regs,
82 unsigned int offset)
83{
84 if (unlikely(offset > MAX_REG_OFFSET))
85 return 0;
86 return *(unsigned long *)((unsigned long)regs + offset);
87}
88
89/**
90 * regs_within_kernel_stack() - check the address in the stack
91 * @regs: pt_regs which contains kernel stack pointer.
92 * @addr: address which is checked.
93 *
94 * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
95 * If @addr is within the kernel stack, it returns true. If not, returns false.
96 */
97static inline int regs_within_kernel_stack(struct pt_regs *regs,
98 unsigned long addr)
99{
100 return ((addr & ~(THREAD_SIZE - 1)) ==
101 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
102}
103
104/**
105 * regs_get_kernel_stack_nth() - get Nth entry of the stack
106 * @regs: pt_regs which contains kernel stack pointer.
107 * @n: stack entry number.
108 *
109 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
110 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
111 * this returns 0.
112 */
113static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
114 unsigned int n)
115{
116 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
117 addr += n;
118 if (regs_within_kernel_stack(regs, (unsigned long)addr))
119 return *addr;
120 else
121 return 0;
122}
126 123
127struct perf_event; 124struct perf_event;
128struct perf_sample_data; 125struct perf_sample_data;
diff --git a/arch/sh/include/asm/ptrace_32.h b/arch/sh/include/asm/ptrace_32.h
new file mode 100644
index 000000000000..35d9e257558c
--- /dev/null
+++ b/arch/sh/include/asm/ptrace_32.h
@@ -0,0 +1,83 @@
1#ifndef __ASM_SH_PTRACE_32_H
2#define __ASM_SH_PTRACE_32_H
3
4/*
5 * GCC defines register number like this:
6 * -----------------------------
7 * 0 - 15 are integer registers
8 * 17 - 22 are control/special registers
9 * 24 - 39 fp registers
10 * 40 - 47 xd registers
11 * 48 - fpscr register
12 * -----------------------------
13 *
14 * We follows above, except:
15 * 16 --- program counter (PC)
16 * 22 --- syscall #
17 * 23 --- floating point communication register
18 */
19#define REG_REG0 0
20#define REG_REG15 15
21
22#define REG_PC 16
23
24#define REG_PR 17
25#define REG_SR 18
26#define REG_GBR 19
27#define REG_MACH 20
28#define REG_MACL 21
29
30#define REG_SYSCALL 22
31
32#define REG_FPREG0 23
33#define REG_FPREG15 38
34#define REG_XFREG0 39
35#define REG_XFREG15 54
36
37#define REG_FPSCR 55
38#define REG_FPUL 56
39
40/*
41 * This struct defines the way the registers are stored on the
42 * kernel stack during a system call or other kernel entry.
43 */
44struct pt_regs {
45 unsigned long regs[16];
46 unsigned long pc;
47 unsigned long pr;
48 unsigned long sr;
49 unsigned long gbr;
50 unsigned long mach;
51 unsigned long macl;
52 long tra;
53};
54
55/*
56 * This struct defines the way the DSP registers are stored on the
57 * kernel stack during a system call or other kernel entry.
58 */
59struct pt_dspregs {
60 unsigned long a1;
61 unsigned long a0g;
62 unsigned long a1g;
63 unsigned long m0;
64 unsigned long m1;
65 unsigned long a0;
66 unsigned long x0;
67 unsigned long x1;
68 unsigned long y0;
69 unsigned long y1;
70 unsigned long dsr;
71 unsigned long rs;
72 unsigned long re;
73 unsigned long mod;
74};
75
76#ifdef __KERNEL__
77
78#define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
79#define regs_return_value(regs) ((regs)->regs[0])
80
81#endif /* __KERNEL__ */
82
83#endif /* __ASM_SH_PTRACE_32_H */
diff --git a/arch/sh/include/asm/ptrace_64.h b/arch/sh/include/asm/ptrace_64.h
new file mode 100644
index 000000000000..d43c1cb0bbe7
--- /dev/null
+++ b/arch/sh/include/asm/ptrace_64.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SH_PTRACE_64_H
2#define __ASM_SH_PTRACE_64_H
3
4struct pt_regs {
5 unsigned long long pc;
6 unsigned long long sr;
7 long long syscall_nr;
8 unsigned long long regs[63];
9 unsigned long long tregs[8];
10 unsigned long long pad[2];
11};
12
13#ifdef __KERNEL__
14
15#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7])
16#define regs_return_value(regs) ((regs)->regs[3])
17
18#endif /* __KERNEL__ */
19
20#endif /* __ASM_SH_PTRACE_64_H */
diff --git a/arch/sh/include/asm/sizes.h b/arch/sh/include/asm/sizes.h
index 3a1fb97770f1..0b9fe2d5c36d 100644
--- a/arch/sh/include/asm/sizes.h
+++ b/arch/sh/include/asm/sizes.h
@@ -32,6 +32,7 @@
32#define SZ_512 0x00000200 32#define SZ_512 0x00000200
33 33
34#define SZ_1K 0x00000400 34#define SZ_1K 0x00000400
35#define SZ_2K 0x00000800
35#define SZ_4K 0x00001000 36#define SZ_4K 0x00001000
36#define SZ_8K 0x00002000 37#define SZ_8K 0x00002000
37#define SZ_16K 0x00004000 38#define SZ_16K 0x00004000
diff --git a/arch/sh/include/asm/sram.h b/arch/sh/include/asm/sram.h
new file mode 100644
index 000000000000..a2808ce4c0aa
--- /dev/null
+++ b/arch/sh/include/asm/sram.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_SRAM_H
2#define __ASM_SRAM_H
3
4#ifdef CONFIG_HAVE_SRAM_POOL
5
6#include <linux/spinlock.h>
7#include <linux/genalloc.h>
8
9/* arch/sh/mm/sram.c */
10extern struct gen_pool *sram_pool;
11
12static inline unsigned long sram_alloc(size_t len)
13{
14 if (!sram_pool)
15 return 0UL;
16
17 return gen_pool_alloc(sram_pool, len);
18}
19
20static inline void sram_free(unsigned long addr, size_t len)
21{
22 return gen_pool_free(sram_pool, addr, len);
23}
24
25#else
26
27static inline unsigned long sram_alloc(size_t len)
28{
29 return 0;
30}
31
32static inline void sram_free(unsigned long addr, size_t len)
33{
34}
35
36#endif /* CONFIG_HAVE_SRAM_POOL */
37
38#endif /* __ASM_SRAM_H */
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 0bd7a17d5e1a..1f1af5afff03 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -140,8 +140,6 @@ extern unsigned int instruction_size(unsigned int insn);
140extern unsigned long cached_to_uncached; 140extern unsigned long cached_to_uncached;
141extern unsigned long uncached_size; 141extern unsigned long uncached_size;
142 142
143extern struct dentry *sh_debugfs_root;
144
145void per_cpu_trap_init(void); 143void per_cpu_trap_init(void);
146void default_idle(void); 144void default_idle(void);
147void cpu_idle_wait(void); 145void cpu_idle_wait(void);
diff --git a/arch/sh/include/asm/system_32.h b/arch/sh/include/asm/system_32.h
index 51296b36770e..c941b2739405 100644
--- a/arch/sh/include/asm/system_32.h
+++ b/arch/sh/include/asm/system_32.h
@@ -212,17 +212,16 @@ static inline reg_size_t register_align(void *val)
212} 212}
213 213
214int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, 214int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
215 struct mem_access *ma, int); 215 struct mem_access *ma, int, unsigned long address);
216 216
217static inline void trigger_address_error(void) 217static inline void trigger_address_error(void)
218{ 218{
219 if (__in_29bit_mode()) 219 __asm__ __volatile__ (
220 __asm__ __volatile__ ( 220 "ldc %0, sr\n\t"
221 "ldc %0, sr\n\t" 221 "mov.l @%1, %0"
222 "mov.l @%1, %0" 222 :
223 : 223 : "r" (0x10000000), "r" (0x80000001)
224 : "r" (0x10000000), "r" (0x80000001) 224 );
225 );
226} 225}
227 226
228asmlinkage void do_address_error(struct pt_regs *regs, 227asmlinkage void do_address_error(struct pt_regs *regs,
diff --git a/arch/sh/include/asm/tlbflush.h b/arch/sh/include/asm/tlbflush.h
index e0ac97221ae6..0df66f0c7284 100644
--- a/arch/sh/include/asm/tlbflush.h
+++ b/arch/sh/include/asm/tlbflush.h
@@ -21,6 +21,8 @@ extern void local_flush_tlb_kernel_range(unsigned long start,
21 unsigned long end); 21 unsigned long end);
22extern void local_flush_tlb_one(unsigned long asid, unsigned long page); 22extern void local_flush_tlb_one(unsigned long asid, unsigned long page);
23 23
24extern void __flush_tlb_global(void);
25
24#ifdef CONFIG_SMP 26#ifdef CONFIG_SMP
25 27
26extern void flush_tlb_all(void); 28extern void flush_tlb_all(void);
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 0e7f0fc8f086..903cd618eb74 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -345,12 +345,33 @@
345#define __NR_pwritev 334 345#define __NR_pwritev 334
346#define __NR_rt_tgsigqueueinfo 335 346#define __NR_rt_tgsigqueueinfo 335
347#define __NR_perf_event_open 336 347#define __NR_perf_event_open 336
348#define __NR_fanotify_init 337
349#define __NR_fanotify_mark 338
350#define __NR_prlimit64 339
348 351
349#define NR_syscalls 337 352/* Non-multiplexed socket family */
353#define __NR_socket 340
354#define __NR_bind 341
355#define __NR_connect 342
356#define __NR_listen 343
357#define __NR_accept 344
358#define __NR_getsockname 345
359#define __NR_getpeername 346
360#define __NR_socketpair 347
361#define __NR_send 348
362#define __NR_sendto 349
363#define __NR_recv 350
364#define __NR_recvfrom 351
365#define __NR_shutdown 352
366#define __NR_setsockopt 353
367#define __NR_getsockopt 354
368#define __NR_sendmsg 355
369#define __NR_recvmsg 356
370#define __NR_recvmmsg 357
350 371
351#ifdef __KERNEL__ 372#define NR_syscalls 358
352 373
353#define __IGNORE_recvmmsg 374#ifdef __KERNEL__
354 375
355#define __ARCH_WANT_IPC_PARSE_VERSION 376#define __ARCH_WANT_IPC_PARSE_VERSION
356#define __ARCH_WANT_OLD_READDIR 377#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 0580c33a1e04..09aa93f9eb70 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -387,10 +387,13 @@
387#define __NR_perf_event_open 364 387#define __NR_perf_event_open 364
388#define __NR_recvmmsg 365 388#define __NR_recvmmsg 365
389#define __NR_accept4 366 389#define __NR_accept4 366
390#define __NR_fanotify_init 367
391#define __NR_fanotify_mark 368
392#define __NR_prlimit64 369
390 393
391#ifdef __KERNEL__ 394#ifdef __KERNEL__
392 395
393#define NR_syscalls 367 396#define NR_syscalls 370
394 397
395#define __ARCH_WANT_IPC_PARSE_VERSION 398#define __ARCH_WANT_IPC_PARSE_VERSION
396#define __ARCH_WANT_OLD_READDIR 399#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/sh/include/cpu-sh3/cpu/mmu_context.h b/arch/sh/include/cpu-sh3/cpu/mmu_context.h
index ab09da73ce77..0c7c735ea82a 100644
--- a/arch/sh/include/cpu-sh3/cpu/mmu_context.h
+++ b/arch/sh/include/cpu-sh3/cpu/mmu_context.h
@@ -16,6 +16,7 @@
16#define MMU_TEA 0xFFFFFFFC /* TLB Exception Address */ 16#define MMU_TEA 0xFFFFFFFC /* TLB Exception Address */
17 17
18#define MMUCR 0xFFFFFFE0 /* MMU Control Register */ 18#define MMUCR 0xFFFFFFE0 /* MMU Control Register */
19#define MMUCR_TI (1 << 2) /* TLB flush bit */
19 20
20#define MMU_TLB_ADDRESS_ARRAY 0xF2000000 21#define MMU_TLB_ADDRESS_ARRAY 0xF2000000
21#define MMU_PAGE_ASSOC_BIT 0x80 22#define MMU_PAGE_ASSOC_BIT 0x80
diff --git a/arch/sh/include/cpu-sh4/cpu/freq.h b/arch/sh/include/cpu-sh4/cpu/freq.h
index e1e90960ee9a..cffd25ed0240 100644
--- a/arch/sh/include/cpu-sh4/cpu/freq.h
+++ b/arch/sh/include/cpu-sh4/cpu/freq.h
@@ -56,7 +56,9 @@
56#define FRQCR1 0xffc40004 56#define FRQCR1 0xffc40004
57#define FRQMR1 0xffc40014 57#define FRQMR1 0xffc40014
58#elif defined(CONFIG_CPU_SUBTYPE_SHX3) 58#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
59#define FRQCR 0xffc00014 59#define FRQCR0 0xffc00000
60#define FRQCR1 0xffc00004
61#define FRQMR1 0xffc00014
60#else 62#else
61#define FRQCR 0xffc00000 63#define FRQCR 0xffc00000
62#define FRQCR_PSTBY 0x0200 64#define FRQCR_PSTBY 0x0200
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7757.h b/arch/sh/include/cpu-sh4/cpu/sh7757.h
index f4d267efad71..15f3de11c55a 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7757.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7757.h
@@ -3,241 +3,252 @@
3 3
4enum { 4enum {
5 /* PTA */ 5 /* PTA */
6 GPIO_PTA7, GPIO_PTA6, GPIO_PTA5, GPIO_PTA4, 6 GPIO_PTA0, GPIO_PTA1, GPIO_PTA2, GPIO_PTA3,
7 GPIO_PTA3, GPIO_PTA2, GPIO_PTA1, GPIO_PTA0, 7 GPIO_PTA4, GPIO_PTA5, GPIO_PTA6, GPIO_PTA7,
8 8
9 /* PTB */ 9 /* PTB */
10 GPIO_PTB7, GPIO_PTB6, GPIO_PTB5, GPIO_PTB4, 10 GPIO_PTB0, GPIO_PTB1, GPIO_PTB2, GPIO_PTB3,
11 GPIO_PTB3, GPIO_PTB2, GPIO_PTB1, GPIO_PTB0, 11 GPIO_PTB4, GPIO_PTB5, GPIO_PTB6, GPIO_PTB7,
12 12
13 /* PTC */ 13 /* PTC */
14 GPIO_PTC7, GPIO_PTC6, GPIO_PTC5, GPIO_PTC4, 14 GPIO_PTC0, GPIO_PTC1, GPIO_PTC2, GPIO_PTC3,
15 GPIO_PTC3, GPIO_PTC2, GPIO_PTC1, GPIO_PTC0, 15 GPIO_PTC4, GPIO_PTC5, GPIO_PTC6, GPIO_PTC7,
16 16
17 /* PTD */ 17 /* PTD */
18 GPIO_PTD7, GPIO_PTD6, GPIO_PTD5, GPIO_PTD4, 18 GPIO_PTD0, GPIO_PTD1, GPIO_PTD2, GPIO_PTD3,
19 GPIO_PTD3, GPIO_PTD2, GPIO_PTD1, GPIO_PTD0, 19 GPIO_PTD4, GPIO_PTD5, GPIO_PTD6, GPIO_PTD7,
20 20
21 /* PTE */ 21 /* PTE */
22 GPIO_PTE7, GPIO_PTE6, GPIO_PTE5, GPIO_PTE4, 22 GPIO_PTE0, GPIO_PTE1, GPIO_PTE2, GPIO_PTE3,
23 GPIO_PTE3, GPIO_PTE2, GPIO_PTE1, GPIO_PTE0, 23 GPIO_PTE4, GPIO_PTE5, GPIO_PTE6, GPIO_PTE7,
24 24
25 /* PTF */ 25 /* PTF */
26 GPIO_PTF7, GPIO_PTF6, GPIO_PTF5, GPIO_PTF4, 26 GPIO_PTF0, GPIO_PTF1, GPIO_PTF2, GPIO_PTF3,
27 GPIO_PTF3, GPIO_PTF2, GPIO_PTF1, GPIO_PTF0, 27 GPIO_PTF4, GPIO_PTF5, GPIO_PTF6, GPIO_PTF7,
28 28
29 /* PTG */ 29 /* PTG */
30 GPIO_PTG7, GPIO_PTG6, GPIO_PTG5, GPIO_PTG4, 30 GPIO_PTG0, GPIO_PTG1, GPIO_PTG2, GPIO_PTG3,
31 GPIO_PTG3, GPIO_PTG2, GPIO_PTG1, GPIO_PTG0, 31 GPIO_PTG4, GPIO_PTG5, GPIO_PTG6, GPIO_PTG7,
32 32
33 /* PTH */ 33 /* PTH */
34 GPIO_PTH7, GPIO_PTH6, GPIO_PTH5, GPIO_PTH4, 34 GPIO_PTH0, GPIO_PTH1, GPIO_PTH2, GPIO_PTH3,
35 GPIO_PTH3, GPIO_PTH2, GPIO_PTH1, GPIO_PTH0, 35 GPIO_PTH4, GPIO_PTH5, GPIO_PTH6, GPIO_PTH7,
36 36
37 /* PTI */ 37 /* PTI */
38 GPIO_PTI7, GPIO_PTI6, GPIO_PTI5, GPIO_PTI4, 38 GPIO_PTI0, GPIO_PTI1, GPIO_PTI2, GPIO_PTI3,
39 GPIO_PTI3, GPIO_PTI2, GPIO_PTI1, GPIO_PTI0, 39 GPIO_PTI4, GPIO_PTI5, GPIO_PTI6, GPIO_PTI7,
40 40
41 /* PTJ */ 41 /* PTJ */
42 GPIO_PTJ7, GPIO_PTJ6, GPIO_PTJ5, GPIO_PTJ4, 42 GPIO_PTJ0, GPIO_PTJ1, GPIO_PTJ2, GPIO_PTJ3,
43 GPIO_PTJ3, GPIO_PTJ2, GPIO_PTJ1, GPIO_PTJ0, 43 GPIO_PTJ4, GPIO_PTJ5, GPIO_PTJ6, GPIO_PTJ7_RESV,
44 44
45 /* PTK */ 45 /* PTK */
46 GPIO_PTK7, GPIO_PTK6, GPIO_PTK5, GPIO_PTK4, 46 GPIO_PTK0, GPIO_PTK1, GPIO_PTK2, GPIO_PTK3,
47 GPIO_PTK3, GPIO_PTK2, GPIO_PTK1, GPIO_PTK0, 47 GPIO_PTK4, GPIO_PTK5, GPIO_PTK6, GPIO_PTK7,
48 48
49 /* PTL */ 49 /* PTL */
50 GPIO_PTL7, GPIO_PTL6, GPIO_PTL5, GPIO_PTL4, 50 GPIO_PTL0, GPIO_PTL1, GPIO_PTL2, GPIO_PTL3,
51 GPIO_PTL3, GPIO_PTL2, GPIO_PTL1, GPIO_PTL0, 51 GPIO_PTL4, GPIO_PTL5, GPIO_PTL6, GPIO_PTL7_RESV,
52 52
53 /* PTM */ 53 /* PTM */
54 GPIO_PTM6, GPIO_PTM5, GPIO_PTM4, 54 GPIO_PTM0, GPIO_PTM1, GPIO_PTM2, GPIO_PTM3,
55 GPIO_PTM3, GPIO_PTM2, GPIO_PTM1, GPIO_PTM0, 55 GPIO_PTM4, GPIO_PTM5, GPIO_PTM6, GPIO_PTM7,
56 56
57 /* PTN */ 57 /* PTN */
58 GPIO_PTN7, GPIO_PTN6, GPIO_PTN5, GPIO_PTN4, 58 GPIO_PTN0, GPIO_PTN1, GPIO_PTN2, GPIO_PTN3,
59 GPIO_PTN3, GPIO_PTN2, GPIO_PTN1, GPIO_PTN0, 59 GPIO_PTN4, GPIO_PTN5, GPIO_PTN6, GPIO_PTN7_RESV,
60 60
61 /* PTO */ 61 /* PTO */
62 GPIO_PTO7, GPIO_PTO6, GPIO_PTO5, GPIO_PTO4, 62 GPIO_PTO0, GPIO_PTO1, GPIO_PTO2, GPIO_PTO3,
63 GPIO_PTO3, GPIO_PTO2, GPIO_PTO1, GPIO_PTO0, 63 GPIO_PTO4, GPIO_PTO5, GPIO_PTO6, GPIO_PTO7,
64 64
65 /* PTP */ 65 /* PTP */
66 GPIO_PTP6, GPIO_PTP5, GPIO_PTP4, 66 GPIO_PTP0, GPIO_PTP1, GPIO_PTP2, GPIO_PTP3,
67 GPIO_PTP3, GPIO_PTP2, GPIO_PTP1, GPIO_PTP0, 67 GPIO_PTP4, GPIO_PTP5, GPIO_PTP6, GPIO_PTP7,
68 68
69 /* PTQ */ 69 /* PTQ */
70 GPIO_PTQ6, GPIO_PTQ5, GPIO_PTQ4, 70 GPIO_PTQ0, GPIO_PTQ1, GPIO_PTQ2, GPIO_PTQ3,
71 GPIO_PTQ3, GPIO_PTQ2, GPIO_PTQ1, GPIO_PTQ0, 71 GPIO_PTQ4, GPIO_PTQ5, GPIO_PTQ6, GPIO_PTQ7_RESV,
72 72
73 /* PTR */ 73 /* PTR */
74 GPIO_PTR7, GPIO_PTR6, GPIO_PTR5, GPIO_PTR4, 74 GPIO_PTR0, GPIO_PTR1, GPIO_PTR2, GPIO_PTR3,
75 GPIO_PTR3, GPIO_PTR2, GPIO_PTR1, GPIO_PTR0, 75 GPIO_PTR4, GPIO_PTR5, GPIO_PTR6, GPIO_PTR7,
76 76
77 /* PTS */ 77 /* PTS */
78 GPIO_PTS7, GPIO_PTS6, GPIO_PTS5, GPIO_PTS4, 78 GPIO_PTS0, GPIO_PTS1, GPIO_PTS2, GPIO_PTS3,
79 GPIO_PTS3, GPIO_PTS2, GPIO_PTS1, GPIO_PTS0, 79 GPIO_PTS4, GPIO_PTS5, GPIO_PTS6, GPIO_PTS7,
80 80
81 /* PTT */ 81 /* PTT */
82 GPIO_PTT5, GPIO_PTT4, 82 GPIO_PTT0, GPIO_PTT1, GPIO_PTT2, GPIO_PTT3,
83 GPIO_PTT3, GPIO_PTT2, GPIO_PTT1, GPIO_PTT0, 83 GPIO_PTT4, GPIO_PTT5, GPIO_PTT6, GPIO_PTT7,
84 84
85 /* PTU */ 85 /* PTU */
86 GPIO_PTU7, GPIO_PTU6, GPIO_PTU5, GPIO_PTU4, 86 GPIO_PTU0, GPIO_PTU1, GPIO_PTU2, GPIO_PTU3,
87 GPIO_PTU3, GPIO_PTU2, GPIO_PTU1, GPIO_PTU0, 87 GPIO_PTU4, GPIO_PTU5, GPIO_PTU6, GPIO_PTU7,
88 88
89 /* PTV */ 89 /* PTV */
90 GPIO_PTV7, GPIO_PTV6, GPIO_PTV5, GPIO_PTV4, 90 GPIO_PTV0, GPIO_PTV1, GPIO_PTV2, GPIO_PTV3,
91 GPIO_PTV3, GPIO_PTV2, GPIO_PTV1, GPIO_PTV0, 91 GPIO_PTV4, GPIO_PTV5, GPIO_PTV6, GPIO_PTV7,
92 92
93 /* PTW */ 93 /* PTW */
94 GPIO_PTW7, GPIO_PTW6, GPIO_PTW5, GPIO_PTW4, 94 GPIO_PTW0, GPIO_PTW1, GPIO_PTW2, GPIO_PTW3,
95 GPIO_PTW3, GPIO_PTW2, GPIO_PTW1, GPIO_PTW0, 95 GPIO_PTW4, GPIO_PTW5, GPIO_PTW6, GPIO_PTW7,
96 96
97 /* PTX */ 97 /* PTX */
98 GPIO_PTX7, GPIO_PTX6, GPIO_PTX5, GPIO_PTX4, 98 GPIO_PTX0, GPIO_PTX1, GPIO_PTX2, GPIO_PTX3,
99 GPIO_PTX3, GPIO_PTX2, GPIO_PTX1, GPIO_PTX0, 99 GPIO_PTX4, GPIO_PTX5, GPIO_PTX6, GPIO_PTX7,
100 100
101 /* PTY */ 101 /* PTY */
102 GPIO_PTY7, GPIO_PTY6, GPIO_PTY5, GPIO_PTY4, 102 GPIO_PTY0, GPIO_PTY1, GPIO_PTY2, GPIO_PTY3,
103 GPIO_PTY3, GPIO_PTY2, GPIO_PTY1, GPIO_PTY0, 103 GPIO_PTY4, GPIO_PTY5, GPIO_PTY6, GPIO_PTY7,
104 104
105 /* PTZ */ 105 /* PTZ */
106 GPIO_PTZ7, GPIO_PTZ6, GPIO_PTZ5, GPIO_PTZ4, 106 GPIO_PTZ0, GPIO_PTZ1, GPIO_PTZ2, GPIO_PTZ3,
107 GPIO_PTZ3, GPIO_PTZ2, GPIO_PTZ1, GPIO_PTZ0, 107 GPIO_PTZ4, GPIO_PTZ5, GPIO_PTZ6, GPIO_PTZ7,
108 108
109 109
110 /* PTA (mobule: LBSC, CPG, LPC) */ 110 /* PTA (mobule: LBSC, RGMII) */
111 GPIO_FN_BS, GPIO_FN_RDWR, GPIO_FN_WE1, GPIO_FN_RDY, 111 GPIO_FN_BS, GPIO_FN_RDWR, GPIO_FN_WE1, GPIO_FN_RDY,
112 GPIO_FN_MD10, GPIO_FN_MD9, GPIO_FN_MD8, 112 GPIO_FN_ET0_MDC, GPIO_FN_ET0_MDIO,
113 GPIO_FN_LGPIO7, GPIO_FN_LGPIO6, GPIO_FN_LGPIO5, GPIO_FN_LGPIO4, 113 GPIO_FN_ET1_MDC, GPIO_FN_ET1_MDIO,
114 GPIO_FN_LGPIO3, GPIO_FN_LGPIO2, GPIO_FN_LGPIO1, GPIO_FN_LGPIO0,
115
116 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
117 GPIO_FN_D15, GPIO_FN_D14, GPIO_FN_D13, GPIO_FN_D12,
118 GPIO_FN_D11, GPIO_FN_D10, GPIO_FN_D9, GPIO_FN_D8,
119 GPIO_FN_ET0_MDC, GPIO_FN_ET0_MDIO,
120 GPIO_FN_ET1_MDC, GPIO_FN_ET1_MDIO,
121 GPIO_FN_SIM_D, GPIO_FN_SIM_CLK, GPIO_FN_SIM_RST,
122 GPIO_FN_WPSZ1, GPIO_FN_WPSZ0, GPIO_FN_FWID, GPIO_FN_FLSHSZ,
123 GPIO_FN_LPC_SPIEN, GPIO_FN_BASEL,
124 114
125 /* PTC (mobule: SD) */ 115 /* PTB (mobule: INTC, ONFI, TMU) */
126 GPIO_FN_SD_WP, GPIO_FN_SD_CD, GPIO_FN_SD_CLK, GPIO_FN_SD_CMD, 116 GPIO_FN_IRQ15, GPIO_FN_IRQ14, GPIO_FN_IRQ13, GPIO_FN_IRQ12,
127 GPIO_FN_SD_D3, GPIO_FN_SD_D2, GPIO_FN_SD_D1, GPIO_FN_SD_D0, 117 GPIO_FN_IRQ11, GPIO_FN_IRQ10, GPIO_FN_IRQ9, GPIO_FN_IRQ8,
118 GPIO_FN_ON_NRE, GPIO_FN_ON_NWE, GPIO_FN_ON_NWP, GPIO_FN_ON_NCE0,
119 GPIO_FN_ON_R_B0, GPIO_FN_ON_ALE, GPIO_FN_ON_CLE,
120 GPIO_FN_TCLK,
128 121
129 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */ 122 /* PTC (mobule: IRQ, PWMU) */
130 GPIO_FN_IRQ7, GPIO_FN_IRQ6, GPIO_FN_IRQ5, GPIO_FN_IRQ4, 123 GPIO_FN_IRQ7, GPIO_FN_IRQ6, GPIO_FN_IRQ5, GPIO_FN_IRQ4,
131 GPIO_FN_IRQ3, GPIO_FN_IRQ2, GPIO_FN_IRQ1, GPIO_FN_IRQ0, 124 GPIO_FN_IRQ3, GPIO_FN_IRQ2, GPIO_FN_IRQ1, GPIO_FN_IRQ0,
132 GPIO_FN_MD6, GPIO_FN_MD5, GPIO_FN_MD3, GPIO_FN_MD2, 125 GPIO_FN_PWMU0, GPIO_FN_PWMU1, GPIO_FN_PWMU2, GPIO_FN_PWMU3,
133 GPIO_FN_MD1, GPIO_FN_MD0, GPIO_FN_ADTRG1, GPIO_FN_ADTRG0, 126 GPIO_FN_PWMU4, GPIO_FN_PWMU5,
134 127
135 /* PTE (mobule: EtherC) */ 128 /* PTD (mobule: SPI0, DMAC) */
136 GPIO_FN_ET0_CRS_DV, GPIO_FN_ET0_TXD1, 129 GPIO_FN_SP0_MOSI, GPIO_FN_SP0_MISO, GPIO_FN_SP0_SCK,
137 GPIO_FN_ET0_TXD0, GPIO_FN_ET0_TX_EN, 130 GPIO_FN_SP0_SCK_FB, GPIO_FN_SP0_SS0, GPIO_FN_SP0_SS1,
138 GPIO_FN_ET0_REF_CLK, GPIO_FN_ET0_RXD1, 131 GPIO_FN_SP0_SS2, GPIO_FN_SP0_SS3, GPIO_FN_DREQ0,
139 GPIO_FN_ET0_RXD0, GPIO_FN_ET0_RX_ER, 132 GPIO_FN_DACK0, GPIO_FN_TEND0,
140 133
141 /* PTF (mobule: EtherC) */ 134 /* PTE (mobule: RMII) */
142 GPIO_FN_ET1_CRS_DV, GPIO_FN_ET1_TXD1, 135 GPIO_FN_RMII0_CRS_DV, GPIO_FN_RMII0_TXD1, GPIO_FN_RMII0_TXD0,
143 GPIO_FN_ET1_TXD0, GPIO_FN_ET1_TX_EN, 136 GPIO_FN_RMII0_TXEN, GPIO_FN_RMII0_REFCLK, GPIO_FN_RMII0_RXD1,
144 GPIO_FN_ET1_REF_CLK, GPIO_FN_ET1_RXD1, 137 GPIO_FN_RMII0_RXD0, GPIO_FN_RMII0_RX_ER,
145 GPIO_FN_ET1_RXD0, GPIO_FN_ET1_RX_ER, 138
146 139 /* PTF (mobule: RMII, SerMux) */
147 /* PTG (mobule: SYSTEM, PWMX, LPC) */ 140 GPIO_FN_RMII1_CRS_DV, GPIO_FN_RMII1_TXD1, GPIO_FN_RMII1_TXD0,
148 GPIO_FN_STATUS0, GPIO_FN_STATUS1, 141 GPIO_FN_RMII1_TXEN, GPIO_FN_RMII1_REFCLK, GPIO_FN_RMII1_RXD1,
149 GPIO_FN_PWX0, GPIO_FN_PWX1, GPIO_FN_PWX2, GPIO_FN_PWX3, 142 GPIO_FN_RMII1_RXD0, GPIO_FN_RMII1_RX_ER, GPIO_FN_RAC_RI,
150 GPIO_FN_SERIRQ, GPIO_FN_CLKRUN, GPIO_FN_LPCPD, GPIO_FN_LDRQ, 143
151 144 /* PTG (mobule: system, LBSC, LPC, WDT, LPC, eMMC) */
152 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */ 145 GPIO_FN_BOOTFMS, GPIO_FN_BOOTWP,
153 GPIO_FN_TCLK, GPIO_FN_RXD4, GPIO_FN_TXD4, 146 GPIO_FN_A25, GPIO_FN_A24, GPIO_FN_SERIRQ, GPIO_FN_WDTOVF,
147 GPIO_FN_LPCPD, GPIO_FN_LDRQ, GPIO_FN_MMCCLK, GPIO_FN_MMCCMD,
148
149 /* PTH (mobule: SPI1, LPC, DMAC, ADC) */
154 GPIO_FN_SP1_MOSI, GPIO_FN_SP1_MISO, 150 GPIO_FN_SP1_MOSI, GPIO_FN_SP1_MISO,
155 GPIO_FN_SP1_SCK, GPIO_FN_SP1_SCK_FB, 151 GPIO_FN_SP1_SCK, GPIO_FN_SP1_SCK_FB,
156 GPIO_FN_SP1_SS0, GPIO_FN_SP1_SS1, 152 GPIO_FN_SP1_SS0, GPIO_FN_SP1_SS1,
157 GPIO_FN_SP0_SS1, 153 GPIO_FN_WP, GPIO_FN_FMS0, GPIO_FN_TEND1, GPIO_FN_DREQ1,
158 154 GPIO_FN_DACK1, GPIO_FN_ADTRG1, GPIO_FN_ADTRG0,
159 /* PTI (mobule: INTC) */
160 GPIO_FN_IRQ15, GPIO_FN_IRQ14, GPIO_FN_IRQ13, GPIO_FN_IRQ12,
161 GPIO_FN_IRQ11, GPIO_FN_IRQ10, GPIO_FN_IRQ9, GPIO_FN_IRQ8,
162
163 /* PTJ (mobule: SCIF234, SERMUX) */
164 GPIO_FN_RXD3, GPIO_FN_TXD3, GPIO_FN_RXD2, GPIO_FN_TXD2,
165 GPIO_FN_COM1_TXD, GPIO_FN_COM1_RXD,
166 GPIO_FN_COM1_RTS, GPIO_FN_COM1_CTS,
167
168 /* PTK (mobule: SERMUX) */
169 GPIO_FN_COM2_TXD, GPIO_FN_COM2_RXD,
170 GPIO_FN_COM2_RTS, GPIO_FN_COM2_CTS,
171 GPIO_FN_COM2_DTR, GPIO_FN_COM2_DSR,
172 GPIO_FN_COM2_DCD, GPIO_FN_COM2_RI,
173 155
174 /* PTL (mobule: SERMUX) */ 156 /* PTI (mobule: LBSC, SDHI) */
175 GPIO_FN_RAC_TXD, GPIO_FN_RAC_RXD, 157 GPIO_FN_D15, GPIO_FN_D14, GPIO_FN_D13, GPIO_FN_D12,
176 GPIO_FN_RAC_RTS, GPIO_FN_RAC_CTS, 158 GPIO_FN_D11, GPIO_FN_D10, GPIO_FN_D9, GPIO_FN_D8,
177 GPIO_FN_RAC_DTR, GPIO_FN_RAC_DSR, 159 GPIO_FN_SD_WP, GPIO_FN_SD_CD, GPIO_FN_SD_CLK, GPIO_FN_SD_CMD,
178 GPIO_FN_RAC_DCD, GPIO_FN_RAC_RI, 160 GPIO_FN_SD_D3, GPIO_FN_SD_D2, GPIO_FN_SD_D1, GPIO_FN_SD_D0,
179 161
180 /* PTM (mobule: IIC, LPC) */ 162 /* PTJ (mobule: SCIF234) */
163 GPIO_FN_RTS3, GPIO_FN_CTS3, GPIO_FN_TXD3, GPIO_FN_RXD3,
164 GPIO_FN_RTS4, GPIO_FN_RXD4, GPIO_FN_TXD4,
165
166 /* PTK (mobule: SERMUX, LBSC, SCIF) */
167 GPIO_FN_COM2_TXD, GPIO_FN_COM2_RXD, GPIO_FN_COM2_RTS,
168 GPIO_FN_COM2_CTS, GPIO_FN_COM2_DTR, GPIO_FN_COM2_DSR,
169 GPIO_FN_COM2_DCD, GPIO_FN_CLKOUT,
170 GPIO_FN_SCK2, GPIO_FN_SCK4, GPIO_FN_SCK3,
171
172 /* PTL (mobule: SERMUX, SCIF, LBSC, AUD) */
173 GPIO_FN_RAC_RXD, GPIO_FN_RAC_RTS, GPIO_FN_RAC_CTS,
174 GPIO_FN_RAC_DTR, GPIO_FN_RAC_DSR, GPIO_FN_RAC_DCD,
175 GPIO_FN_RAC_TXD, GPIO_FN_RXD2, GPIO_FN_CS5,
176 GPIO_FN_CS6, GPIO_FN_AUDSYNC, GPIO_FN_AUDCK,
177 GPIO_FN_TXD2,
178
179 /* PTM (mobule: LBSC, IIC) */
180 GPIO_FN_CS4, GPIO_FN_RD, GPIO_FN_WE0, GPIO_FN_CS0,
181 GPIO_FN_SDA6, GPIO_FN_SCL6, GPIO_FN_SDA7, GPIO_FN_SCL7, 181 GPIO_FN_SDA6, GPIO_FN_SCL6, GPIO_FN_SDA7, GPIO_FN_SCL7,
182 GPIO_FN_WP, GPIO_FN_FMS0, GPIO_FN_FMS1,
183
184 /* PTN (mobule: SCIF234, EVC) */
185 GPIO_FN_SCK2, GPIO_FN_RTS4, GPIO_FN_RTS3, GPIO_FN_RTS2,
186 GPIO_FN_CTS4, GPIO_FN_CTS3, GPIO_FN_CTS2,
187 GPIO_FN_EVENT7, GPIO_FN_EVENT6, GPIO_FN_EVENT5, GPIO_FN_EVENT4,
188 GPIO_FN_EVENT3, GPIO_FN_EVENT2, GPIO_FN_EVENT1, GPIO_FN_EVENT0,
189 182
190 /* PTO (mobule: SGPIO) */ 183 /* PTN (mobule: USB, JMC, SGPIO, WDT) */
191 GPIO_FN_SGPIO0_CLK, GPIO_FN_SGPIO0_LOAD, 184 GPIO_FN_VBUS_EN, GPIO_FN_VBUS_OC, GPIO_FN_JMCTCK,
192 GPIO_FN_SGPIO0_DI, GPIO_FN_SGPIO0_DO, 185 GPIO_FN_JMCTMS, GPIO_FN_JMCTDO, GPIO_FN_JMCTDI,
193 GPIO_FN_SGPIO1_CLK, GPIO_FN_SGPIO1_LOAD, 186 GPIO_FN_JMCTRST,
194 GPIO_FN_SGPIO1_DI, GPIO_FN_SGPIO1_DO, 187 GPIO_FN_SGPIO1_CLK, GPIO_FN_SGPIO1_LOAD, GPIO_FN_SGPIO1_DI,
188 GPIO_FN_SGPIO1_DO, GPIO_FN_SUB_CLKIN,
195 189
196 /* PTP (mobule: JMC, SCIF234) */ 190 /* PTO (mobule: SGPIO, SerMux) */
197 GPIO_FN_JMCTCK, GPIO_FN_JMCTMS, GPIO_FN_JMCTDO, GPIO_FN_JMCTDI, 191 GPIO_FN_SGPIO0_CLK, GPIO_FN_SGPIO0_LOAD, GPIO_FN_SGPIO0_DI,
198 GPIO_FN_JMCRST, GPIO_FN_SCK4, GPIO_FN_SCK3, 192 GPIO_FN_SGPIO0_DO, GPIO_FN_SGPIO2_CLK, GPIO_FN_SGPIO2_LOAD,
193 GPIO_FN_SGPIO2_DI, GPIO_FN_SGPIO2_DO, GPIO_FN_COM1_TXD,
194 GPIO_FN_COM1_RXD, GPIO_FN_COM1_RTS, GPIO_FN_COM1_CTS,
199 195
200 /* PTQ (mobule: LPC) */ 196 /* PTQ (mobule: LPC) */
201 GPIO_FN_LAD3, GPIO_FN_LAD2, GPIO_FN_LAD1, GPIO_FN_LAD0, 197 GPIO_FN_LAD3, GPIO_FN_LAD2, GPIO_FN_LAD1, GPIO_FN_LAD0,
202 GPIO_FN_LFRAME, GPIO_FN_LRESET, GPIO_FN_LCLK, 198 GPIO_FN_LFRAME, GPIO_FN_LRESET, GPIO_FN_LCLK,
203 199
204 /* PTR (mobule: GRA, IIC) */ 200 /* PTR (mobule: GRA, IIC) */
205 GPIO_FN_DDC3, GPIO_FN_DDC2, 201 GPIO_FN_DDC3, GPIO_FN_DDC2, GPIO_FN_SDA2, GPIO_FN_SCL2,
206 GPIO_FN_SDA8, GPIO_FN_SCL8, GPIO_FN_SDA2, GPIO_FN_SCL2,
207 GPIO_FN_SDA1, GPIO_FN_SCL1, GPIO_FN_SDA0, GPIO_FN_SCL0, 202 GPIO_FN_SDA1, GPIO_FN_SCL1, GPIO_FN_SDA0, GPIO_FN_SCL0,
203 GPIO_FN_SDA8, GPIO_FN_SCL8,
208 204
209 /* PTS (mobule: GRA, IIC) */ 205 /* PTS (mobule: GRA, IIC) */
210 GPIO_FN_DDC1, GPIO_FN_DDC0, 206 GPIO_FN_DDC1, GPIO_FN_DDC0, GPIO_FN_SDA5, GPIO_FN_SCL5,
211 GPIO_FN_SDA9, GPIO_FN_SCL9, GPIO_FN_SDA5, GPIO_FN_SCL5,
212 GPIO_FN_SDA4, GPIO_FN_SCL4, GPIO_FN_SDA3, GPIO_FN_SCL3, 207 GPIO_FN_SDA4, GPIO_FN_SCL4, GPIO_FN_SDA3, GPIO_FN_SCL3,
208 GPIO_FN_SDA9, GPIO_FN_SCL9,
213 209
214 /* PTT (mobule: SYSTEM, PWMX) */ 210 /* PTT (mobule: PWMX, AUD) */
215 GPIO_FN_AUDSYNC, GPIO_FN_AUDCK, 211 GPIO_FN_PWMX7, GPIO_FN_PWMX6, GPIO_FN_PWMX5, GPIO_FN_PWMX4,
216 GPIO_FN_AUDATA3, GPIO_FN_AUDATA2, 212 GPIO_FN_PWMX3, GPIO_FN_PWMX2, GPIO_FN_PWMX1, GPIO_FN_PWMX0,
217 GPIO_FN_AUDATA1, GPIO_FN_AUDATA0, 213 GPIO_FN_AUDATA3, GPIO_FN_AUDATA2, GPIO_FN_AUDATA1,
218 GPIO_FN_PWX7, GPIO_FN_PWX6, GPIO_FN_PWX5, GPIO_FN_PWX4, 214 GPIO_FN_AUDATA0, GPIO_FN_STATUS1, GPIO_FN_STATUS0,
219 215
220 /* PTU (mobule: LBSC, DMAC) */ 216 /* PTU (mobule: LPC, APM) */
221 GPIO_FN_CS6, GPIO_FN_CS5, GPIO_FN_CS4, GPIO_FN_CS0, 217 GPIO_FN_LGPIO7, GPIO_FN_LGPIO6, GPIO_FN_LGPIO5, GPIO_FN_LGPIO4,
222 GPIO_FN_RD, GPIO_FN_WE0, GPIO_FN_A25, GPIO_FN_A24, 218 GPIO_FN_LGPIO3, GPIO_FN_LGPIO2, GPIO_FN_LGPIO1, GPIO_FN_LGPIO0,
223 GPIO_FN_DREQ0, GPIO_FN_DACK0, 219 GPIO_FN_APMONCTL_O, GPIO_FN_APMPWBTOUT_O, GPIO_FN_APMSCI_O,
220 GPIO_FN_APMVDDON, GPIO_FN_APMSLPBTN, GPIO_FN_APMPWRBTN,
221 GPIO_FN_APMS5N, GPIO_FN_APMS3N,
224 222
225 /* PTV (mobule: LBSC, DMAC) */ 223 /* PTV (mobule: LBSC, SerMux, R-SPI, EVC, GRA) */
226 GPIO_FN_A23, GPIO_FN_A22, GPIO_FN_A21, GPIO_FN_A20, 224 GPIO_FN_A23, GPIO_FN_A22, GPIO_FN_A21, GPIO_FN_A20,
227 GPIO_FN_A19, GPIO_FN_A18, GPIO_FN_A17, GPIO_FN_A16, 225 GPIO_FN_A19, GPIO_FN_A18, GPIO_FN_A17, GPIO_FN_A16,
228 GPIO_FN_TEND0, GPIO_FN_DREQ1, GPIO_FN_DACK1, GPIO_FN_TEND1, 226 GPIO_FN_COM2_RI, GPIO_FN_R_SPI_MOSI, GPIO_FN_R_SPI_MISO,
227 GPIO_FN_R_SPI_RSPCK, GPIO_FN_R_SPI_SSL0, GPIO_FN_R_SPI_SSL1,
228 GPIO_FN_EVENT7, GPIO_FN_EVENT6, GPIO_FN_VBIOS_DI,
229 GPIO_FN_VBIOS_DO, GPIO_FN_VBIOS_CLK, GPIO_FN_VBIOS_CS,
229 230
230 /* PTW (mobule: LBSC) */ 231 /* PTW (mobule: LBSC, EVC, SCIF) */
231 GPIO_FN_A15, GPIO_FN_A14, GPIO_FN_A13, GPIO_FN_A12, 232 GPIO_FN_A15, GPIO_FN_A14, GPIO_FN_A13, GPIO_FN_A12,
232 GPIO_FN_A11, GPIO_FN_A10, GPIO_FN_A9, GPIO_FN_A8, 233 GPIO_FN_A11, GPIO_FN_A10, GPIO_FN_A9, GPIO_FN_A8,
234 GPIO_FN_EVENT5, GPIO_FN_EVENT4, GPIO_FN_EVENT3, GPIO_FN_EVENT2,
235 GPIO_FN_EVENT1, GPIO_FN_EVENT0, GPIO_FN_CTS4, GPIO_FN_CTS2,
233 236
234 /* PTX (mobule: LBSC) */ 237 /* PTX (mobule: LBSC, SCIF, SIM) */
235 GPIO_FN_A7, GPIO_FN_A6, GPIO_FN_A5, GPIO_FN_A4, 238 GPIO_FN_A7, GPIO_FN_A6, GPIO_FN_A5, GPIO_FN_A4,
236 GPIO_FN_A3, GPIO_FN_A2, GPIO_FN_A1, GPIO_FN_A0, 239 GPIO_FN_A3, GPIO_FN_A2, GPIO_FN_A1, GPIO_FN_A0,
240 GPIO_FN_RTS2, GPIO_FN_SIM_D, GPIO_FN_SIM_CLK, GPIO_FN_SIM_RST,
237 241
238 /* PTY (mobule: LBSC) */ 242 /* PTY (mobule: LBSC) */
239 GPIO_FN_D7, GPIO_FN_D6, GPIO_FN_D5, GPIO_FN_D4, 243 GPIO_FN_D7, GPIO_FN_D6, GPIO_FN_D5, GPIO_FN_D4,
240 GPIO_FN_D3, GPIO_FN_D2, GPIO_FN_D1, GPIO_FN_D0, 244 GPIO_FN_D3, GPIO_FN_D2, GPIO_FN_D1, GPIO_FN_D0,
245
246 /* PTZ (mobule: eMMC, ONFI) */
247 GPIO_FN_MMCDAT7, GPIO_FN_MMCDAT6, GPIO_FN_MMCDAT5,
248 GPIO_FN_MMCDAT4, GPIO_FN_MMCDAT3, GPIO_FN_MMCDAT2,
249 GPIO_FN_MMCDAT1, GPIO_FN_MMCDAT0,
250 GPIO_FN_ON_DQ7, GPIO_FN_ON_DQ6, GPIO_FN_ON_DQ5, GPIO_FN_ON_DQ4,
251 GPIO_FN_ON_DQ3, GPIO_FN_ON_DQ2, GPIO_FN_ON_DQ1, GPIO_FN_ON_DQ0,
241}; 252};
242 253
243#endif /* __ASM_SH7757_H__ */ 254#endif /* __ASM_SH7757_H__ */
diff --git a/arch/sh/include/cpu-sh4/cpu/shx3.h b/arch/sh/include/cpu-sh4/cpu/shx3.h
new file mode 100644
index 000000000000..68d9080a8da9
--- /dev/null
+++ b/arch/sh/include/cpu-sh4/cpu/shx3.h
@@ -0,0 +1,64 @@
1#ifndef __CPU_SHX3_H
2#define __CPU_SHX3_H
3
4enum {
5 /* PA */
6 GPIO_PA7, GPIO_PA6, GPIO_PA5, GPIO_PA4,
7 GPIO_PA3, GPIO_PA2, GPIO_PA1, GPIO_PA0,
8
9 /* PB */
10 GPIO_PB7, GPIO_PB6, GPIO_PB5, GPIO_PB4,
11 GPIO_PB3, GPIO_PB2, GPIO_PB1, GPIO_PB0,
12
13 /* PC */
14 GPIO_PC7, GPIO_PC6, GPIO_PC5, GPIO_PC4,
15 GPIO_PC3, GPIO_PC2, GPIO_PC1, GPIO_PC0,
16
17 /* PD */
18 GPIO_PD7, GPIO_PD6, GPIO_PD5, GPIO_PD4,
19 GPIO_PD3, GPIO_PD2, GPIO_PD1, GPIO_PD0,
20
21 /* PE */
22 GPIO_PE7, GPIO_PE6, GPIO_PE5, GPIO_PE4,
23 GPIO_PE3, GPIO_PE2, GPIO_PE1, GPIO_PE0,
24
25 /* PF */
26 GPIO_PF7, GPIO_PF6, GPIO_PF5, GPIO_PF4,
27 GPIO_PF3, GPIO_PF2, GPIO_PF1, GPIO_PF0,
28
29 /* PG */
30 GPIO_PG7, GPIO_PG6, GPIO_PG5, GPIO_PG4,
31 GPIO_PG3, GPIO_PG2, GPIO_PG1, GPIO_PG0,
32
33 /* PH */
34 GPIO_PH5, GPIO_PH4,
35 GPIO_PH3, GPIO_PH2, GPIO_PH1, GPIO_PH0,
36
37 /* SCIF */
38 GPIO_FN_SCK3, GPIO_FN_TXD3, GPIO_FN_RXD3,
39 GPIO_FN_SCK2, GPIO_FN_TXD2, GPIO_FN_RXD2,
40 GPIO_FN_SCK1, GPIO_FN_TXD1, GPIO_FN_RXD1,
41 GPIO_FN_SCK0, GPIO_FN_TXD0, GPIO_FN_RXD0,
42
43 /* LBSC */
44 GPIO_FN_D31, GPIO_FN_D30, GPIO_FN_D29, GPIO_FN_D28,
45 GPIO_FN_D27, GPIO_FN_D26, GPIO_FN_D25, GPIO_FN_D24,
46 GPIO_FN_D23, GPIO_FN_D22, GPIO_FN_D21, GPIO_FN_D20,
47 GPIO_FN_D19, GPIO_FN_D18, GPIO_FN_D17, GPIO_FN_D16,
48 GPIO_FN_WE3, GPIO_FN_WE2, GPIO_FN_CS6, GPIO_FN_CS5,
49 GPIO_FN_CS4, GPIO_FN_CLKOUTENB, GPIO_FN_BREQ,
50 GPIO_FN_IOIS16, GPIO_FN_CE2B, GPIO_FN_CE2A, GPIO_FN_BACK,
51
52 /* DMAC */
53 GPIO_FN_DACK0, GPIO_FN_DREQ0, GPIO_FN_DRAK0,
54 GPIO_FN_DACK1, GPIO_FN_DREQ1, GPIO_FN_DRAK1,
55 GPIO_FN_DACK2, GPIO_FN_DREQ2, GPIO_FN_DRAK2,
56 GPIO_FN_DACK3, GPIO_FN_DREQ3, GPIO_FN_DRAK3,
57
58 /* INTC */
59 GPIO_FN_IRQ3, GPIO_FN_IRQ2, GPIO_FN_IRQ1, GPIO_FN_IRQ0,
60 GPIO_FN_IRL3, GPIO_FN_IRL2, GPIO_FN_IRL1, GPIO_FN_IRL0,
61 GPIO_FN_IRQOUT, GPIO_FN_STATUS1, GPIO_FN_STATUS0,
62};
63
64#endif /* __CPU_SHX3_H */
diff --git a/arch/sh/include/mach-common/mach/sh2007.h b/arch/sh/include/mach-common/mach/sh2007.h
new file mode 100644
index 000000000000..48180b9aa03d
--- /dev/null
+++ b/arch/sh/include/mach-common/mach/sh2007.h
@@ -0,0 +1,117 @@
1#ifndef __MACH_SH2007_H
2#define __MACH_SH2007_H
3
4#define CS5BCR 0xff802050
5#define CS5WCR 0xff802058
6#define CS5PCR 0xff802070
7
8#define BUS_SZ8 1
9#define BUS_SZ16 2
10#define BUS_SZ32 3
11
12#define PCMCIA_IODYN 1
13#define PCMCIA_ATA 0
14#define PCMCIA_IO8 2
15#define PCMCIA_IO16 3
16#define PCMCIA_COMM8 4
17#define PCMCIA_COMM16 5
18#define PCMCIA_ATTR8 6
19#define PCMCIA_ATTR16 7
20
21#define TYPE_SRAM 0
22#define TYPE_PCMCIA 4
23
24/* write-read/write-write delay (0-7:0,1,2,3,4,5,6,7) */
25#define IWW5 0
26#define IWW6 3
27/* different area, read-write delay (0-7:0,1,2,3,4,5,6,7) */
28#define IWRWD5 2
29#define IWRWD6 2
30/* same area, read-write delay (0-7:0,1,2,3,4,5,6,7) */
31#define IWRWS5 2
32#define IWRWS6 2
33/* different area, read-read delay (0-7:0,1,2,3,4,5,6,7) */
34#define IWRRD5 2
35#define IWRRD6 2
36/* same area, read-read delay (0-7:0,1,2,3,4,5,6,7) */
37#define IWRRS5 0
38#define IWRRS6 2
39/* burst count (0-3:4,8,16,32) */
40#define BST5 0
41#define BST6 0
42/* bus size */
43#define SZ5 BUS_SZ16
44#define SZ6 BUS_SZ16
45/* RD hold for SRAM (0-1:0,1) */
46#define RDSPL5 0
47#define RDSPL6 0
48/* Burst pitch (0-7:0,1,2,3,4,5,6,7) */
49#define BW5 0
50#define BW6 0
51/* Multiplex (0-1:0,1) */
52#define MPX5 0
53#define MPX6 0
54/* device type */
55#define TYPE5 TYPE_PCMCIA
56#define TYPE6 TYPE_PCMCIA
57/* address setup before assert CSn for SRAM (0-7:0,1,2,3,4,5,6,7) */
58#define ADS5 0
59#define ADS6 0
60/* address hold after negate CSn for SRAM (0-7:0,1,2,3,4,5,6,7) */
61#define ADH5 0
62#define ADH6 0
63/* CSn assert to RD assert delay for SRAM (0-7:0,1,2,3,4,5,6,7) */
64#define RDS5 0
65#define RDS6 0
66/* RD negate to CSn negate delay for SRAM (0-7:0,1,2,3,4,5,6,7) */
67#define RDH5 0
68#define RDH6 0
69/* CSn assert to WE assert delay for SRAM (0-7:0,1,2,3,4,5,6,7) */
70#define WTS5 0
71#define WTS6 0
72/* WE negate to CSn negate delay for SRAM (0-7:0,1,2,3,4,5,6,7) */
73#define WTH5 0
74#define WTH6 0
75/* BS hold (0-1:1,2) */
76#define BSH5 0
77#define BSH6 0
78/* wait cycle (0-15:0,1,2,3,4,5,6,7,8,9,11,13,15,17,21,25) */
79#define IW5 6 /* 60ns PIO mode 4 */
80#define IW6 15 /* 250ns */
81
82#define SAA5 PCMCIA_IODYN /* IDE area b4000000-b5ffffff */
83#define SAB5 PCMCIA_IODYN /* CF area b6000000-b7ffffff */
84#define PCWA5 0 /* additional wait A (0-3:0,15,30,50) */
85#define PCWB5 0 /* additional wait B (0-3:0,15,30,50) */
86/* wait B (0-15:0,1,2,3,4,5,6,7,8,9,11,13,15,17,21,25) */
87#define PCIW5 12
88/* Address->OE/WE assert delay A (0-7:0,1,2,3,6,9,12,15) */
89#define TEDA5 2
90/* Address->OE/WE assert delay B (0-7:0,1,2,3,6,9,12,15) */
91#define TEDB5 4
92/* OE/WE negate->Address delay A (0-7:0,1,2,3,6,9,12,15) */
93#define TEHA5 2
94/* OE/WE negate->Address delay B (0-7:0,1,2,3,6,9,12,15) */
95#define TEHB5 3
96
97#define CS5BCR_D ((IWW5<<28)|(IWRWD5<<24)|(IWRWS5<<20)| \
98 (IWRRD5<<16)|(IWRRS5<<12)|(BST5<<10)| \
99 (SZ5<<8)|(RDSPL5<<7)|(BW5<<4)|(MPX5<<3)|TYPE5)
100#define CS5WCR_D ((ADS5<<28)|(ADH5<<24)|(RDS5<<20)| \
101 (RDH5<<16)|(WTS5<<12)|(WTH5<<8)|(BSH5<<4)|IW5)
102#define CS5PCR_D ((SAA5<<28)|(SAB5<<24)|(PCWA5<<22)| \
103 (PCWB5<<20)|(PCIW5<<16)|(TEDA5<<12)| \
104 (TEDB5<<8)|(TEHA5<<4)|TEHB5)
105
106#define SMC0_BASE 0xb0800000 /* eth0 */
107#define SMC1_BASE 0xb0900000 /* eth1 */
108#define CF_BASE 0xb6100000 /* Compact Flash (I/O area) */
109#define IDE_BASE 0xb4000000 /* IDE */
110#define PC104_IO_BASE 0xb8000000
111#define PC104_MEM_BASE 0xba000000
112#define SMC_IO_SIZE 0x100
113
114#define CF_OFFSET 0x1f0
115#define IDE_OFFSET 0x170
116
117#endif /* __MACH_SH2007_H */
diff --git a/arch/sh/include/mach-sdk7786/mach/fpga.h b/arch/sh/include/mach-sdk7786/mach/fpga.h
index 416b621d94d1..40f0c2d3690c 100644
--- a/arch/sh/include/mach-sdk7786/mach/fpga.h
+++ b/arch/sh/include/mach-sdk7786/mach/fpga.h
@@ -31,11 +31,35 @@
31#define EXTASR 0x110 31#define EXTASR 0x110
32#define SPCAR 0x120 32#define SPCAR 0x120
33#define INTMSR 0x130 33#define INTMSR 0x130
34
34#define PCIECR 0x140 35#define PCIECR 0x140
36#define PCIECR_PCIEMUX1 BIT(15)
37#define PCIECR_PCIEMUX0 BIT(14)
38#define PCIECR_PRST4 BIT(12) /* slot 4 card present */
39#define PCIECR_PRST3 BIT(11) /* slot 3 card present */
40#define PCIECR_PRST2 BIT(10) /* slot 2 card present */
41#define PCIECR_PRST1 BIT(9) /* slot 1 card present */
42#define PCIECR_CLKEN BIT(4) /* oscillator enable */
43
35#define FAER 0x150 44#define FAER 0x150
36#define USRGPIR 0x160 45#define USRGPIR 0x160
46
37/* 0x170 reserved */ 47/* 0x170 reserved */
38#define LCLASR 0x180 48
49#define LCLASR 0x180
50#define LCLASR_FRAMEN BIT(15)
51
52#define LCLASR_FPGA_SEL_SHIFT 12
53#define LCLASR_NAND_SEL_SHIFT 8
54#define LCLASR_NORB_SEL_SHIFT 4
55#define LCLASR_NORA_SEL_SHIFT 0
56
57#define LCLASR_AREA_MASK 0x7
58
59#define LCLASR_FPGA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_FPGA_SEL_SHIFT)
60#define LCLASR_NAND_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NAND_SEL_SHIFT)
61#define LCLASR_NORB_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORB_SEL_SHIFT)
62#define LCLASR_NORA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORA_SEL_SHIFT)
39 63
40#define SBCR 0x190 64#define SBCR 0x190
41#define SCBR_I2CMEN BIT(0) /* FPGA I2C master enable */ 65#define SCBR_I2CMEN BIT(0) /* FPGA I2C master enable */
diff --git a/arch/sh/include/mach-x3proto/mach/hardware.h b/arch/sh/include/mach-x3proto/mach/hardware.h
new file mode 100644
index 000000000000..52bca57bfeb6
--- /dev/null
+++ b/arch/sh/include/mach-x3proto/mach/hardware.h
@@ -0,0 +1,12 @@
1#ifndef __MACH_X3PROTO_HARDWARE_H
2#define __MACH_X3PROTO_HARDWARE_H
3
4struct gpio_chip;
5
6/* arch/sh/boards/mach-x3proto/gpio.c */
7int x3proto_gpio_setup(void);
8extern struct gpio_chip x3proto_gpio_chip;
9
10#define NR_BASEBOARD_GPIOS 16
11
12#endif /* __MACH_X3PROTO_HARDWARE_H */
diff --git a/arch/sh/include/asm/ilsel.h b/arch/sh/include/mach-x3proto/mach/ilsel.h
index e3d304b280f6..e3d304b280f6 100644
--- a/arch/sh/include/asm/ilsel.h
+++ b/arch/sh/include/mach-x3proto/mach/ilsel.h
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index e25f3c69525d..8eed6a485446 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,9 +12,9 @@ endif
12CFLAGS_REMOVE_return_address.o = -pg 12CFLAGS_REMOVE_return_address.o = -pg
13 13
14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \ 14obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o \
15 idle.o io.o irq.o \ 15 idle.o io.o irq.o irq_$(BITS).o kdebugfs.o \
16 irq_$(BITS).o machvec.o nmi_debug.o process.o \ 16 machvec.o nmi_debug.o process.o \
17 process_$(BITS).o ptrace_$(BITS).o \ 17 process_$(BITS).o ptrace.o ptrace_$(BITS).o \
18 reboot.o return_address.o \ 18 reboot.o return_address.o \
19 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \ 19 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \
20 syscalls_$(BITS).o time.o topology.o traps.o \ 20 syscalls_$(BITS).o time.o topology.o traps.o \
@@ -44,4 +44,4 @@ obj-$(CONFIG_HAS_IOPORT) += io_generic.o
44obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 44obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
45obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o 45obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
46 46
47EXTRA_CFLAGS += -Werror 47ccflags-y := -Werror
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c
index befc255830a4..1f800ef4a735 100644
--- a/arch/sh/kernel/clkdev.c
+++ b/arch/sh/kernel/clkdev.c
@@ -161,9 +161,11 @@ EXPORT_SYMBOL(clk_add_alias);
161 */ 161 */
162void clkdev_drop(struct clk_lookup *cl) 162void clkdev_drop(struct clk_lookup *cl)
163{ 163{
164 struct clk_lookup_alloc *cla = container_of(cl, struct clk_lookup_alloc, cl);
165
164 mutex_lock(&clocks_mutex); 166 mutex_lock(&clocks_mutex);
165 list_del(&cl->node); 167 list_del(&cl->node);
166 mutex_unlock(&clocks_mutex); 168 mutex_unlock(&clocks_mutex);
167 kfree(cl); 169 kfree(cla);
168} 170}
169EXPORT_SYMBOL(clkdev_drop); 171EXPORT_SYMBOL(clkdev_drop);
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index d180f16281ed..b93458f33b74 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -150,7 +150,7 @@ void __cpuinit cpu_probe(void)
150 boot_cpu_data.type = CPU_SH7724; 150 boot_cpu_data.type = CPU_SH7724;
151 boot_cpu_data.flags |= CPU_HAS_L2_CACHE; 151 boot_cpu_data.flags |= CPU_HAS_L2_CACHE;
152 break; 152 break;
153 case 0x50: 153 case 0x10:
154 boot_cpu_data.type = CPU_SH7757; 154 boot_cpu_data.type = CPU_SH7757;
155 break; 155 break;
156 } 156 }
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index b144e8af89dc..cc122b1d3035 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -8,13 +8,13 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7763) += setup-sh7763.o
8obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7786) += setup-sh7786.o intc-shx3.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7723) += setup-sh7723.o
15obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o 15obj-$(CONFIG_CPU_SUBTYPE_SH7724) += setup-sh7724.o
16obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o 16obj-$(CONFIG_CPU_SUBTYPE_SH7366) += setup-sh7366.o
17obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o 17obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o intc-shx3.o
18 18
19# SMP setup 19# SMP setup
20smp-$(CONFIG_CPU_SHX3) := smp-shx3.o 20smp-$(CONFIG_CPU_SHX3) := smp-shx3.o
@@ -40,6 +40,7 @@ pinmux-$(CONFIG_CPU_SUBTYPE_SH7724) := pinmux-sh7724.o
40pinmux-$(CONFIG_CPU_SUBTYPE_SH7757) := pinmux-sh7757.o 40pinmux-$(CONFIG_CPU_SUBTYPE_SH7757) := pinmux-sh7757.o
41pinmux-$(CONFIG_CPU_SUBTYPE_SH7785) := pinmux-sh7785.o 41pinmux-$(CONFIG_CPU_SUBTYPE_SH7785) := pinmux-sh7785.o
42pinmux-$(CONFIG_CPU_SUBTYPE_SH7786) := pinmux-sh7786.o 42pinmux-$(CONFIG_CPU_SUBTYPE_SH7786) := pinmux-sh7786.o
43pinmux-$(CONFIG_CPU_SUBTYPE_SHX3) := pinmux-shx3.o
43 44
44obj-y += $(clock-y) 45obj-y += $(clock-y)
45obj-$(CONFIG_SMP) += $(smp-y) 46obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
index 0a752bd324ac..ce39a2ae8c6c 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * SH7757 support for the clock framework 4 * SH7757 support for the clock framework
5 * 5 *
6 * Copyright (C) 2009 Renesas Solutions Corp. 6 * Copyright (C) 2009-2010 Renesas Solutions Corp.
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -16,124 +16,147 @@
16#include <asm/clock.h> 16#include <asm/clock.h>
17#include <asm/freq.h> 17#include <asm/freq.h>
18 18
19static int ifc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, 19/*
20 16, 1, 1, 32, 1, 1, 1, 1 }; 20 * Default rate for the root input clock, reset this with clk_set_rate()
21static int sfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, 21 * from the platform code.
22 16, 1, 1, 32, 1, 1, 1, 1 }; 22 */
23static int bfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, 23static struct clk extal_clk = {
24 16, 1, 1, 32, 1, 1, 1, 1 }; 24 .rate = 48000000,
25static int p1fc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, 25};
26 16, 1, 1, 32, 1, 1, 1, 1 };
27 26
28static void master_clk_init(struct clk *clk) 27static unsigned long pll_recalc(struct clk *clk)
29{ 28{
30 clk->rate = CONFIG_SH_PCLK_FREQ * 16; 29 int multiplier;
31}
32 30
33static struct clk_ops sh7757_master_clk_ops = { 31 multiplier = test_mode_pin(MODE_PIN0) ? 24 : 16;
34 .init = master_clk_init,
35};
36 32
37static void module_clk_recalc(struct clk *clk) 33 return clk->parent->rate * multiplier;
38{
39 int idx = __raw_readl(FRQCR) & 0x0000000f;
40 clk->rate = clk->parent->rate / p1fc_divisors[idx];
41} 34}
42 35
43static struct clk_ops sh7757_module_clk_ops = { 36static struct clk_ops pll_clk_ops = {
44 .recalc = module_clk_recalc, 37 .recalc = pll_recalc,
45}; 38};
46 39
47static void bus_clk_recalc(struct clk *clk) 40static struct clk pll_clk = {
48{ 41 .ops = &pll_clk_ops,
49 int idx = (__raw_readl(FRQCR) >> 8) & 0x0000000f; 42 .parent = &extal_clk,
50 clk->rate = clk->parent->rate / bfc_divisors[idx]; 43 .flags = CLK_ENABLE_ON_INIT,
51} 44};
52 45
53static struct clk_ops sh7757_bus_clk_ops = { 46static struct clk *clks[] = {
54 .recalc = bus_clk_recalc, 47 &extal_clk,
48 &pll_clk,
55}; 49};
56 50
57static void cpu_clk_recalc(struct clk *clk) 51static unsigned int div2[] = { 1, 1, 2, 1, 1, 4, 1, 6,
58{ 52 1, 1, 1, 16, 1, 24, 1, 1 };
59 int idx = (__raw_readl(FRQCR) >> 20) & 0x0000000f;
60 clk->rate = clk->parent->rate / ifc_divisors[idx];
61}
62 53
63static struct clk_ops sh7757_cpu_clk_ops = { 54static struct clk_div_mult_table div4_div_mult_table = {
64 .recalc = cpu_clk_recalc, 55 .divisors = div2,
56 .nr_divisors = ARRAY_SIZE(div2),
65}; 57};
66 58
67static struct clk_ops *sh7757_clk_ops[] = { 59static struct clk_div4_table div4_table = {
68 &sh7757_master_clk_ops, 60 .div_mult_table = &div4_div_mult_table,
69 &sh7757_module_clk_ops,
70 &sh7757_bus_clk_ops,
71 &sh7757_cpu_clk_ops,
72}; 61};
73 62
74void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 63enum { DIV4_I, DIV4_SH, DIV4_P, DIV4_NR };
75{
76 if (idx < ARRAY_SIZE(sh7757_clk_ops))
77 *ops = sh7757_clk_ops[idx];
78}
79 64
80static void shyway_clk_recalc(struct clk *clk) 65#define DIV4(_bit, _mask, _flags) \
81{ 66 SH_CLK_DIV4(&pll_clk, FRQCR, _bit, _mask, _flags)
82 int idx = (__raw_readl(FRQCR) >> 12) & 0x0000000f;
83 clk->rate = clk->parent->rate / sfc_divisors[idx];
84}
85
86static struct clk_ops sh7757_shyway_clk_ops = {
87 .recalc = shyway_clk_recalc,
88};
89 67
90static struct clk sh7757_shyway_clk = { 68struct clk div4_clks[DIV4_NR] = {
91 .flags = CLK_ENABLE_ON_INIT, 69 /*
92 .ops = &sh7757_shyway_clk_ops, 70 * P clock is always enable, because some P clock modules is used
71 * by Host PC.
72 */
73 [DIV4_P] = DIV4(0, 0x2800, CLK_ENABLE_ON_INIT),
74 [DIV4_SH] = DIV4(12, 0x00a0, CLK_ENABLE_ON_INIT),
75 [DIV4_I] = DIV4(20, 0x0004, CLK_ENABLE_ON_INIT),
93}; 76};
94 77
95/* 78#define MSTPCR0 0xffc80030
96 * Additional sh7757-specific on-chip clocks that aren't already part of the 79#define MSTPCR1 0xffc80034
97 * clock framework 80
98 */ 81enum { MSTP004, MSTP000, MSTP114, MSTP113, MSTP112,
99static struct clk *sh7757_onchip_clocks[] = { 82 MSTP111, MSTP110, MSTP103, MSTP102,
100 &sh7757_shyway_clk, 83 MSTP_NR };
84
85static struct clk mstp_clks[MSTP_NR] = {
86 /* MSTPCR0 */
87 [MSTP004] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 4, 0),
88 [MSTP000] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 0, 0),
89
90 /* MSTPCR1 */
91 [MSTP114] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 14, 0),
92 [MSTP113] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 13, 0),
93 [MSTP112] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 12, 0),
94 [MSTP111] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 11, 0),
95 [MSTP110] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 10, 0),
96 [MSTP103] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 3, 0),
97 [MSTP102] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 2, 0),
101}; 98};
102 99
103#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } 100#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
104 101
105static struct clk_lookup lookups[] = { 102static struct clk_lookup lookups[] = {
106 /* main clocks */ 103 /* main clocks */
107 CLKDEV_CON_ID("shyway_clk", &sh7757_shyway_clk), 104 CLKDEV_CON_ID("extal", &extal_clk),
105 CLKDEV_CON_ID("pll_clk", &pll_clk),
106
107 /* DIV4 clocks */
108 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]),
109 CLKDEV_CON_ID("shyway_clk", &div4_clks[DIV4_SH]),
110 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
111
112 /* MSTP32 clocks */
113 CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP004]),
114 CLKDEV_CON_ID("riic", &mstp_clks[MSTP000]),
115 {
116 /* TMU0 */
117 .dev_id = "sh_tmu.0",
118 .con_id = "tmu_fck",
119 .clk = &mstp_clks[MSTP113],
120 }, {
121 /* TMU1 */
122 .dev_id = "sh_tmu.1",
123 .con_id = "tmu_fck",
124 .clk = &mstp_clks[MSTP114],
125 },
126 {
127 /* SCIF4 (But, ID is 2) */
128 .dev_id = "sh-sci.2",
129 .con_id = "sci_fck",
130 .clk = &mstp_clks[MSTP112],
131 }, {
132 /* SCIF3 */
133 .dev_id = "sh-sci.1",
134 .con_id = "sci_fck",
135 .clk = &mstp_clks[MSTP111],
136 }, {
137 /* SCIF2 */
138 .dev_id = "sh-sci.0",
139 .con_id = "sci_fck",
140 .clk = &mstp_clks[MSTP110],
141 },
142 CLKDEV_CON_ID("usb0", &mstp_clks[MSTP102]),
108}; 143};
109 144
110static int __init sh7757_clk_init(void) 145int __init arch_clk_init(void)
111{ 146{
112 struct clk *clk = clk_get(NULL, "master_clk"); 147 int i, ret = 0;
113 int i;
114
115 for (i = 0; i < ARRAY_SIZE(sh7757_onchip_clocks); i++) {
116 struct clk *clkp = sh7757_onchip_clocks[i];
117 148
118 clkp->parent = clk; 149 for (i = 0; i < ARRAY_SIZE(clks); i++)
119 clk_register(clkp); 150 ret |= clk_register(clks[i]);
120 clk_enable(clkp); 151 for (i = 0; i < ARRAY_SIZE(lookups); i++)
121 } 152 clkdev_add(&lookups[i]);
122 153
123 /* 154 if (!ret)
124 * Now that we have the rest of the clocks registered, we need to 155 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
125 * force the parent clock to propagate so that these clocks will 156 &div4_table);
126 * automatically figure out their rate. We cheat by handing the 157 if (!ret)
127 * parent clock its current rate and forcing child propagation. 158 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
128 */
129 clk_set_rate(clk, clk_get_rate(clk));
130 159
131 clk_put(clk); 160 return ret;
132
133 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
134
135 return 0;
136} 161}
137 162
138arch_initcall(sh7757_clk_init);
139
diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
index 236a6282d778..4f70df6b6169 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2006-2007 Renesas Technology Corp. 6 * Copyright (C) 2006-2007 Renesas Technology Corp.
7 * Copyright (C) 2006-2007 Renesas Solutions Corp. 7 * Copyright (C) 2006-2007 Renesas Solutions Corp.
8 * Copyright (C) 2006-2007 Paul Mundt 8 * Copyright (C) 2006-2010 Paul Mundt
9 * 9 *
10 * This file is subject to the terms and conditions of the GNU General Public 10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
@@ -18,120 +18,179 @@
18#include <asm/clock.h> 18#include <asm/clock.h>
19#include <asm/freq.h> 19#include <asm/freq.h>
20 20
21static int ifc_divisors[] = { 1, 2, 4 ,6 }; 21/*
22static int bfc_divisors[] = { 1, 1, 1, 1, 1, 12, 16, 18, 24, 32, 36, 48 }; 22 * Default rate for the root input clock, reset this with clk_set_rate()
23static int pfc_divisors[] = { 1, 1, 1, 1, 1, 1, 1, 18, 24, 32, 36, 48 }; 23 * from the platform code.
24static int cfc_divisors[] = { 1, 1, 4, 6 }; 24 */
25 25static struct clk extal_clk = {
26#define IFC_POS 28 26 .rate = 16666666,
27#define IFC_MSK 0x0003
28#define BFC_MSK 0x000f
29#define PFC_MSK 0x000f
30#define CFC_MSK 0x0003
31#define BFC_POS 16
32#define PFC_POS 0
33#define CFC_POS 20
34
35static void master_clk_init(struct clk *clk)
36{
37 clk->rate *= pfc_divisors[(__raw_readl(FRQCR) >> PFC_POS) & PFC_MSK];
38}
39
40static struct clk_ops shx3_master_clk_ops = {
41 .init = master_clk_init,
42}; 27};
43 28
44static unsigned long module_clk_recalc(struct clk *clk) 29static unsigned long pll_recalc(struct clk *clk)
45{ 30{
46 int idx = ((__raw_readl(FRQCR) >> PFC_POS) & PFC_MSK); 31 /* PLL1 has a fixed x72 multiplier. */
47 return clk->parent->rate / pfc_divisors[idx]; 32 return clk->parent->rate * 72;
48} 33}
49 34
50static struct clk_ops shx3_module_clk_ops = { 35static struct clk_ops pll_clk_ops = {
51 .recalc = module_clk_recalc, 36 .recalc = pll_recalc,
52}; 37};
53 38
54static unsigned long bus_clk_recalc(struct clk *clk) 39static struct clk pll_clk = {
55{ 40 .ops = &pll_clk_ops,
56 int idx = ((__raw_readl(FRQCR) >> BFC_POS) & BFC_MSK); 41 .parent = &extal_clk,
57 return clk->parent->rate / bfc_divisors[idx]; 42 .flags = CLK_ENABLE_ON_INIT,
58} 43};
59 44
60static struct clk_ops shx3_bus_clk_ops = { 45static struct clk *clks[] = {
61 .recalc = bus_clk_recalc, 46 &extal_clk,
47 &pll_clk,
62}; 48};
63 49
64static unsigned long cpu_clk_recalc(struct clk *clk) 50static unsigned int div2[] = { 1, 2, 4, 6, 8, 12, 16, 18,
65{ 51 24, 32, 36, 48 };
66 int idx = ((__raw_readl(FRQCR) >> IFC_POS) & IFC_MSK);
67 return clk->parent->rate / ifc_divisors[idx];
68}
69 52
70static struct clk_ops shx3_cpu_clk_ops = { 53static struct clk_div_mult_table div4_div_mult_table = {
71 .recalc = cpu_clk_recalc, 54 .divisors = div2,
55 .nr_divisors = ARRAY_SIZE(div2),
72}; 56};
73 57
74static struct clk_ops *shx3_clk_ops[] = { 58static struct clk_div4_table div4_table = {
75 &shx3_master_clk_ops, 59 .div_mult_table = &div4_div_mult_table,
76 &shx3_module_clk_ops,
77 &shx3_bus_clk_ops,
78 &shx3_cpu_clk_ops,
79}; 60};
80 61
81void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 62enum { DIV4_I, DIV4_SH, DIV4_B, DIV4_DDR, DIV4_SHA, DIV4_P, DIV4_NR };
82{
83 if (idx < ARRAY_SIZE(shx3_clk_ops))
84 *ops = shx3_clk_ops[idx];
85}
86 63
87static unsigned long shyway_clk_recalc(struct clk *clk) 64#define DIV4(_bit, _mask, _flags) \
88{ 65 SH_CLK_DIV4(&pll_clk, FRQMR1, _bit, _mask, _flags)
89 int idx = ((__raw_readl(FRQCR) >> CFC_POS) & CFC_MSK);
90 return clk->parent->rate / cfc_divisors[idx];
91}
92 66
93static struct clk_ops shx3_shyway_clk_ops = { 67struct clk div4_clks[DIV4_NR] = {
94 .recalc = shyway_clk_recalc, 68 [DIV4_P] = DIV4(0, 0x0f80, 0),
69 [DIV4_SHA] = DIV4(4, 0x0ff0, 0),
70 [DIV4_DDR] = DIV4(12, 0x000c, CLK_ENABLE_ON_INIT),
71 [DIV4_B] = DIV4(16, 0x0fe0, CLK_ENABLE_ON_INIT),
72 [DIV4_SH] = DIV4(20, 0x000c, CLK_ENABLE_ON_INIT),
73 [DIV4_I] = DIV4(28, 0x000e, CLK_ENABLE_ON_INIT),
95}; 74};
96 75
97static struct clk shx3_shyway_clk = { 76#define MSTPCR0 0xffc00030
98 .flags = CLK_ENABLE_ON_INIT, 77#define MSTPCR1 0xffc00034
99 .ops = &shx3_shyway_clk_ops, 78
100}; 79enum { MSTP027, MSTP026, MSTP025, MSTP024,
101 80 MSTP009, MSTP008, MSTP003, MSTP002,
102/* 81 MSTP001, MSTP000, MSTP119, MSTP105,
103 * Additional SHx3-specific on-chip clocks that aren't already part of the 82 MSTP104, MSTP_NR };
104 * clock framework 83
105 */ 84static struct clk mstp_clks[MSTP_NR] = {
106static struct clk *shx3_onchip_clocks[] = { 85 /* MSTPCR0 */
107 &shx3_shyway_clk, 86 [MSTP027] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 27, 0),
87 [MSTP026] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 26, 0),
88 [MSTP025] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 25, 0),
89 [MSTP024] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 24, 0),
90 [MSTP009] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 9, 0),
91 [MSTP008] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 8, 0),
92 [MSTP003] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 3, 0),
93 [MSTP002] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 2, 0),
94 [MSTP001] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 1, 0),
95 [MSTP000] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 0, 0),
96
97 /* MSTPCR1 */
98 [MSTP119] = SH_CLK_MSTP32(NULL, MSTPCR1, 19, 0),
99 [MSTP105] = SH_CLK_MSTP32(NULL, MSTPCR1, 5, 0),
100 [MSTP104] = SH_CLK_MSTP32(NULL, MSTPCR1, 4, 0),
108}; 101};
109 102
110#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } 103#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
111 104
112static struct clk_lookup lookups[] = { 105static struct clk_lookup lookups[] = {
113 /* main clocks */ 106 /* main clocks */
114 CLKDEV_CON_ID("shyway_clk", &shx3_shyway_clk), 107 CLKDEV_CON_ID("extal", &extal_clk),
108 CLKDEV_CON_ID("pll_clk", &pll_clk),
109
110 /* DIV4 clocks */
111 CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]),
112 CLKDEV_CON_ID("shywaya_clk", &div4_clks[DIV4_SHA]),
113 CLKDEV_CON_ID("ddr_clk", &div4_clks[DIV4_DDR]),
114 CLKDEV_CON_ID("bus_clk", &div4_clks[DIV4_B]),
115 CLKDEV_CON_ID("shyway_clk", &div4_clks[DIV4_SH]),
116 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
117
118 /* MSTP32 clocks */
119 {
120 /* SCIF3 */
121 .dev_id = "sh-sci.3",
122 .con_id = "sci_fck",
123 .clk = &mstp_clks[MSTP027],
124 }, {
125 /* SCIF2 */
126 .dev_id = "sh-sci.2",
127 .con_id = "sci_fck",
128 .clk = &mstp_clks[MSTP026],
129 }, {
130 /* SCIF1 */
131 .dev_id = "sh-sci.1",
132 .con_id = "sci_fck",
133 .clk = &mstp_clks[MSTP025],
134 }, {
135 /* SCIF0 */
136 .dev_id = "sh-sci.0",
137 .con_id = "sci_fck",
138 .clk = &mstp_clks[MSTP024],
139 },
140 CLKDEV_CON_ID("h8ex_fck", &mstp_clks[MSTP003]),
141 CLKDEV_CON_ID("csm_fck", &mstp_clks[MSTP002]),
142 CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]),
143 CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]),
144 {
145 /* TMU0 */
146 .dev_id = "sh_tmu.0",
147 .con_id = "tmu_fck",
148 .clk = &mstp_clks[MSTP008],
149 }, {
150 /* TMU1 */
151 .dev_id = "sh_tmu.1",
152 .con_id = "tmu_fck",
153 .clk = &mstp_clks[MSTP008],
154 }, {
155 /* TMU2 */
156 .dev_id = "sh_tmu.2",
157 .con_id = "tmu_fck",
158 .clk = &mstp_clks[MSTP008],
159 }, {
160 /* TMU3 */
161 .dev_id = "sh_tmu.3",
162 .con_id = "tmu_fck",
163 .clk = &mstp_clks[MSTP009],
164 }, {
165 /* TMU4 */
166 .dev_id = "sh_tmu.4",
167 .con_id = "tmu_fck",
168 .clk = &mstp_clks[MSTP009],
169 }, {
170 /* TMU5 */
171 .dev_id = "sh_tmu.5",
172 .con_id = "tmu_fck",
173 .clk = &mstp_clks[MSTP009],
174 },
175 CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]),
176 CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]),
177 CLKDEV_CON_ID("dmac_5_0_fck", &mstp_clks[MSTP104]),
115}; 178};
116 179
117int __init arch_clk_init(void) 180int __init arch_clk_init(void)
118{ 181{
119 struct clk *clk;
120 int i, ret = 0; 182 int i, ret = 0;
121 183
122 cpg_clk_init(); 184 for (i = 0; i < ARRAY_SIZE(clks); i++)
123 185 ret |= clk_register(clks[i]);
124 clk = clk_get(NULL, "master_clk"); 186 for (i = 0; i < ARRAY_SIZE(lookups); i++)
125 for (i = 0; i < ARRAY_SIZE(shx3_onchip_clocks); i++) { 187 clkdev_add(&lookups[i]);
126 struct clk *clkp = shx3_onchip_clocks[i];
127
128 clkp->parent = clk;
129 ret |= clk_register(clkp);
130 }
131
132 clk_put(clk);
133 188
134 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 189 if (!ret)
190 ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
191 &div4_table);
192 if (!ret)
193 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
135 194
136 return ret; 195 return ret;
137} 196}
diff --git a/arch/sh/kernel/cpu/sh4a/intc-shx3.c b/arch/sh/kernel/cpu/sh4a/intc-shx3.c
new file mode 100644
index 000000000000..78c971486b4e
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/intc-shx3.c
@@ -0,0 +1,34 @@
1/*
2 * Shared support for SH-X3 interrupt controllers.
3 *
4 * Copyright (C) 2009 - 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/irq.h>
11#include <linux/io.h>
12#include <linux/init.h>
13
14#define INTACK 0xfe4100b8
15#define INTACKCLR 0xfe4100bc
16#define INTC_USERIMASK 0xfe411000
17
18#ifdef CONFIG_INTC_BALANCING
19unsigned int irq_lookup(unsigned int irq)
20{
21 return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE;
22}
23
24void irq_finish(unsigned int irq)
25{
26 __raw_writel(irq2evt(irq), INTACKCLR);
27}
28#endif
29
30static int __init shx3_irq_setup(void)
31{
32 return register_intc_userimask(INTC_USERIMASK);
33}
34arch_initcall(shx3_irq_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/perf_event.c b/arch/sh/kernel/cpu/sh4a/perf_event.c
index eddc21973fa1..b8b873d8d6b5 100644
--- a/arch/sh/kernel/cpu/sh4a/perf_event.c
+++ b/arch/sh/kernel/cpu/sh4a/perf_event.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Performance events support for SH-4A performance counters 2 * Performance events support for SH-4A performance counters
3 * 3 *
4 * Copyright (C) 2009 Paul Mundt 4 * Copyright (C) 2009, 2010 Paul Mundt
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
@@ -22,7 +22,25 @@
22#define CCBR_CMDS (1 << 1) 22#define CCBR_CMDS (1 << 1)
23#define CCBR_PPCE (1 << 0) 23#define CCBR_PPCE (1 << 0)
24 24
25#ifdef CONFIG_CPU_SHX3
26/*
27 * The PMCAT location for SH-X3 CPUs was quietly moved, while the CCBR
28 * and PMCTR locations remains tentatively constant. This change remains
29 * wholly undocumented, and was simply found through trial and error.
30 *
31 * Early cuts of SH-X3 still appear to use the SH-X/SH-X2 locations, and
32 * it's unclear when this ceased to be the case. For now we always use
33 * the new location (if future parts keep up with this trend then
34 * scanning for them at runtime also remains a viable option.)
35 *
36 * The gap in the register space also suggests that there are other
37 * undocumented counters, so this will need to be revisited at a later
38 * point in time.
39 */
40#define PPC_PMCAT 0xfc100240
41#else
25#define PPC_PMCAT 0xfc100080 42#define PPC_PMCAT 0xfc100080
43#endif
26 44
27#define PMCAT_OVF3 (1 << 27) 45#define PMCAT_OVF3 (1 << 27)
28#define PMCAT_CNN3 (1 << 26) 46#define PMCAT_CNN3 (1 << 26)
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
index ed23b155c097..4c74bd04bba4 100644
--- a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * SH7757 (A0 step) Pinmux 2 * SH7757 (B0 step) Pinmux
3 * 3 *
4 * Copyright (C) 2009 Renesas Solutions Corp. 4 * Copyright (C) 2009-2010 Renesas Solutions Corp.
5 * 5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> 6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 * 7 *
8 * Based on SH7757 Pinmux 8 * Based on SH7723 Pinmux
9 * Copyright (C) 2008 Magnus Damm 9 * Copyright (C) 2008 Magnus Damm
10 * 10 *
11 * This file is subject to the terms and conditions of the GNU General Public 11 * This file is subject to the terms and conditions of the GNU General Public
@@ -40,27 +40,27 @@ enum {
40 PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA, 40 PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA,
41 PTI7_DATA, PTI6_DATA, PTI5_DATA, PTI4_DATA, 41 PTI7_DATA, PTI6_DATA, PTI5_DATA, PTI4_DATA,
42 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA, 42 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA,
43 PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, PTJ4_DATA, 43 PTJ6_DATA, PTJ5_DATA, PTJ4_DATA,
44 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA, 44 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA,
45 PTK7_DATA, PTK6_DATA, PTK5_DATA, PTK4_DATA, 45 PTK7_DATA, PTK6_DATA, PTK5_DATA, PTK4_DATA,
46 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA, 46 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA,
47 PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA, 47 PTL6_DATA, PTL5_DATA, PTL4_DATA,
48 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA, 48 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA,
49 PTM6_DATA, PTM5_DATA, PTM4_DATA, 49 PTM7_DATA, PTM6_DATA, PTM5_DATA, PTM4_DATA,
50 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA, 50 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA,
51 PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA, 51 PTN6_DATA, PTN5_DATA, PTN4_DATA,
52 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA, 52 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA,
53 PTO7_DATA, PTO6_DATA, PTO5_DATA, PTO4_DATA, 53 PTO7_DATA, PTO6_DATA, PTO5_DATA, PTO4_DATA,
54 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA, 54 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA,
55 PTP6_DATA, PTP5_DATA, PTP4_DATA, 55 PTP7_DATA, PTP6_DATA, PTP5_DATA, PTP4_DATA,
56 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA, 56 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA,
57 PTQ6_DATA, PTQ5_DATA, PTQ4_DATA, 57 PTQ6_DATA, PTQ5_DATA, PTQ4_DATA,
58 PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA, 58 PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA,
59 PTR7_DATA, PTR6_DATA, PTR5_DATA, PTR4_DATA, 59 PTR7_DATA, PTR6_DATA, PTR5_DATA, PTR4_DATA,
60 PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA, 60 PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA,
61 PTS7_DATA, PTS6_DATA, PTS5_DATA, PTS4_DATA, 61 PTS7_DATA, PTS6_DATA, PTS5_DATA, PTS4_DATA,
62 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA, 62 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA,
63 PTT5_DATA, PTT4_DATA, 63 PTT7_DATA, PTT6_DATA, PTT5_DATA, PTT4_DATA,
64 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA, 64 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA,
65 PTU7_DATA, PTU6_DATA, PTU5_DATA, PTU4_DATA, 65 PTU7_DATA, PTU6_DATA, PTU5_DATA, PTU4_DATA,
66 PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA, 66 PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA,
@@ -95,27 +95,27 @@ enum {
95 PTH3_IN, PTH2_IN, PTH1_IN, PTH0_IN, 95 PTH3_IN, PTH2_IN, PTH1_IN, PTH0_IN,
96 PTI7_IN, PTI6_IN, PTI5_IN, PTI4_IN, 96 PTI7_IN, PTI6_IN, PTI5_IN, PTI4_IN,
97 PTI3_IN, PTI2_IN, PTI1_IN, PTI0_IN, 97 PTI3_IN, PTI2_IN, PTI1_IN, PTI0_IN,
98 PTJ7_IN, PTJ6_IN, PTJ5_IN, PTJ4_IN, 98 PTJ6_IN, PTJ5_IN, PTJ4_IN,
99 PTJ3_IN, PTJ2_IN, PTJ1_IN, PTJ0_IN, 99 PTJ3_IN, PTJ2_IN, PTJ1_IN, PTJ0_IN,
100 PTK7_IN, PTK6_IN, PTK5_IN, PTK4_IN, 100 PTK7_IN, PTK6_IN, PTK5_IN, PTK4_IN,
101 PTK3_IN, PTK2_IN, PTK1_IN, PTK0_IN, 101 PTK3_IN, PTK2_IN, PTK1_IN, PTK0_IN,
102 PTL7_IN, PTL6_IN, PTL5_IN, PTL4_IN, 102 PTL6_IN, PTL5_IN, PTL4_IN,
103 PTL3_IN, PTL2_IN, PTL1_IN, PTL0_IN, 103 PTL3_IN, PTL2_IN, PTL1_IN, PTL0_IN,
104 PTM6_IN, PTM5_IN, PTM4_IN, 104 PTM7_IN, PTM6_IN, PTM5_IN, PTM4_IN,
105 PTM3_IN, PTM2_IN, PTM1_IN, PTM0_IN, 105 PTM3_IN, PTM2_IN, PTM1_IN, PTM0_IN,
106 PTN7_IN, PTN6_IN, PTN5_IN, PTN4_IN, 106 PTN6_IN, PTN5_IN, PTN4_IN,
107 PTN3_IN, PTN2_IN, PTN1_IN, PTN0_IN, 107 PTN3_IN, PTN2_IN, PTN1_IN, PTN0_IN,
108 PTO7_IN, PTO6_IN, PTO5_IN, PTO4_IN, 108 PTO7_IN, PTO6_IN, PTO5_IN, PTO4_IN,
109 PTO3_IN, PTO2_IN, PTO1_IN, PTO0_IN, 109 PTO3_IN, PTO2_IN, PTO1_IN, PTO0_IN,
110 PTP6_IN, PTP5_IN, PTP4_IN, 110 PTP7_IN, PTP6_IN, PTP5_IN, PTP4_IN,
111 PTP3_IN, PTP2_IN, PTP1_IN, PTP0_IN, 111 PTP3_IN, PTP2_IN, PTP1_IN, PTP0_IN,
112 PTQ6_IN, PTQ5_IN, PTQ4_IN, 112 PTQ6_IN, PTQ5_IN, PTQ4_IN,
113 PTQ3_IN, PTQ2_IN, PTQ1_IN, PTQ0_IN, 113 PTQ3_IN, PTQ2_IN, PTQ1_IN, PTQ0_IN,
114 PTR7_IN, PTR6_IN, PTR5_IN, PTR4_IN, 114 PTR7_IN, PTR6_IN, PTR5_IN, PTR4_IN,
115 PTR3_IN, PTR2_IN, PTR1_IN, PTR0_IN, 115 PTR3_IN, PTR2_IN, PTR1_IN, PTR0_IN,
116 PTS7_IN, PTS6_IN, PTS5_IN, PTS4_IN, 116 PTS7_IN, PTS6_IN, PTS5_IN, PTS4_IN,
117 PTS3_IN, PTS2_IN, PTS1_IN, PTS0_IN, 117 PTS3_IN, PTS2_IN, PTS1_IN, PTS0_IN,
118 PTT5_IN, PTT4_IN, 118 PTT7_IN, PTT6_IN, PTT5_IN, PTT4_IN,
119 PTT3_IN, PTT2_IN, PTT1_IN, PTT0_IN, 119 PTT3_IN, PTT2_IN, PTT1_IN, PTT0_IN,
120 PTU7_IN, PTU6_IN, PTU5_IN, PTU4_IN, 120 PTU7_IN, PTU6_IN, PTU5_IN, PTU4_IN,
121 PTU3_IN, PTU2_IN, PTU1_IN, PTU0_IN, 121 PTU3_IN, PTU2_IN, PTU1_IN, PTU0_IN,
@@ -132,16 +132,43 @@ enum {
132 PINMUX_INPUT_END, 132 PINMUX_INPUT_END,
133 133
134 PINMUX_INPUT_PULLUP_BEGIN, 134 PINMUX_INPUT_PULLUP_BEGIN,
135 PTA7_IN_PU, PTA6_IN_PU, PTA5_IN_PU, PTA4_IN_PU,
136 PTA3_IN_PU, PTA2_IN_PU, PTA1_IN_PU, PTA0_IN_PU,
137 PTD7_IN_PU, PTD6_IN_PU, PTD5_IN_PU, PTD4_IN_PU,
138 PTD3_IN_PU, PTD2_IN_PU, PTD1_IN_PU, PTD0_IN_PU,
139 PTE7_IN_PU, PTE6_IN_PU, PTE5_IN_PU, PTE4_IN_PU,
140 PTE3_IN_PU, PTE2_IN_PU, PTE1_IN_PU, PTE0_IN_PU,
141 PTF7_IN_PU, PTF6_IN_PU, PTF5_IN_PU, PTF4_IN_PU,
142 PTF3_IN_PU, PTF2_IN_PU, PTF1_IN_PU, PTF0_IN_PU,
143 PTG7_IN_PU, PTG6_IN_PU, PTG4_IN_PU,
144 PTH7_IN_PU, PTH6_IN_PU, PTH5_IN_PU, PTH4_IN_PU,
145 PTH3_IN_PU, PTH2_IN_PU, PTH1_IN_PU, PTH0_IN_PU,
146 PTI7_IN_PU, PTI6_IN_PU, PTI4_IN_PU,
147 PTI3_IN_PU, PTI2_IN_PU, PTI1_IN_PU, PTI0_IN_PU,
148 PTJ6_IN_PU, PTJ5_IN_PU, PTJ4_IN_PU,
149 PTJ3_IN_PU, PTJ2_IN_PU, PTJ1_IN_PU, PTJ0_IN_PU,
150 PTK7_IN_PU, PTK6_IN_PU, PTK5_IN_PU, PTK4_IN_PU,
151 PTK3_IN_PU, PTK2_IN_PU, PTK1_IN_PU, PTK0_IN_PU,
152 PTL6_IN_PU, PTL5_IN_PU, PTL4_IN_PU,
153 PTL3_IN_PU, PTL2_IN_PU, PTL1_IN_PU, PTL0_IN_PU,
154 PTM7_IN_PU, PTM6_IN_PU, PTM5_IN_PU, PTM4_IN_PU,
155 PTN4_IN_PU,
156 PTN3_IN_PU, PTN2_IN_PU, PTN1_IN_PU, PTN0_IN_PU,
157 PTO7_IN_PU, PTO6_IN_PU, PTO5_IN_PU, PTO4_IN_PU,
158 PTO3_IN_PU, PTO2_IN_PU, PTO1_IN_PU, PTO0_IN_PU,
159 PTT7_IN_PU, PTT6_IN_PU, PTT5_IN_PU, PTT4_IN_PU,
160 PTT3_IN_PU, PTT2_IN_PU, PTT1_IN_PU, PTT0_IN_PU,
135 PTU7_IN_PU, PTU6_IN_PU, PTU5_IN_PU, PTU4_IN_PU, 161 PTU7_IN_PU, PTU6_IN_PU, PTU5_IN_PU, PTU4_IN_PU,
136 PTU3_IN_PU, PTU2_IN_PU, PTU1_IN_PU, PTU0_IN_PU, 162 PTU3_IN_PU, PTU2_IN_PU, PTU1_IN_PU, PTU0_IN_PU,
137 PTV7_IN_PU, PTV6_IN_PU, PTV5_IN_PU, PTV4_IN_PU, 163 PTV7_IN_PU, PTV6_IN_PU, PTV5_IN_PU, PTV4_IN_PU,
138 PTV3_IN_PU, PTV2_IN_PU, PTV1_IN_PU, PTV0_IN_PU, 164 PTV3_IN_PU, PTV2_IN_PU,
139 PTW7_IN_PU, PTW6_IN_PU, PTW5_IN_PU, PTW4_IN_PU, 165 PTW1_IN_PU, PTW0_IN_PU,
140 PTW3_IN_PU, PTW2_IN_PU, PTW1_IN_PU, PTW0_IN_PU,
141 PTX7_IN_PU, PTX6_IN_PU, PTX5_IN_PU, PTX4_IN_PU, 166 PTX7_IN_PU, PTX6_IN_PU, PTX5_IN_PU, PTX4_IN_PU,
142 PTX3_IN_PU, PTX2_IN_PU, PTX1_IN_PU, PTX0_IN_PU, 167 PTX3_IN_PU, PTX2_IN_PU, PTX1_IN_PU, PTX0_IN_PU,
143 PTY7_IN_PU, PTY6_IN_PU, PTY5_IN_PU, PTY4_IN_PU, 168 PTY7_IN_PU, PTY6_IN_PU, PTY5_IN_PU, PTY4_IN_PU,
144 PTY3_IN_PU, PTY2_IN_PU, PTY1_IN_PU, PTY0_IN_PU, 169 PTY3_IN_PU, PTY2_IN_PU, PTY1_IN_PU, PTY0_IN_PU,
170 PTZ7_IN_PU, PTZ6_IN_PU, PTZ5_IN_PU, PTZ4_IN_PU,
171 PTZ3_IN_PU, PTZ2_IN_PU, PTZ1_IN_PU, PTZ0_IN_PU,
145 PINMUX_INPUT_PULLUP_END, 172 PINMUX_INPUT_PULLUP_END,
146 173
147 PINMUX_OUTPUT_BEGIN, 174 PINMUX_OUTPUT_BEGIN,
@@ -163,27 +190,27 @@ enum {
163 PTH3_OUT, PTH2_OUT, PTH1_OUT, PTH0_OUT, 190 PTH3_OUT, PTH2_OUT, PTH1_OUT, PTH0_OUT,
164 PTI7_OUT, PTI6_OUT, PTI5_OUT, PTI4_OUT, 191 PTI7_OUT, PTI6_OUT, PTI5_OUT, PTI4_OUT,
165 PTI3_OUT, PTI2_OUT, PTI1_OUT, PTI0_OUT, 192 PTI3_OUT, PTI2_OUT, PTI1_OUT, PTI0_OUT,
166 PTJ7_OUT, PTJ6_OUT, PTJ5_OUT, PTJ4_OUT, 193 PTJ6_OUT, PTJ5_OUT, PTJ4_OUT,
167 PTJ3_OUT, PTJ2_OUT, PTJ1_OUT, PTJ0_OUT, 194 PTJ3_OUT, PTJ2_OUT, PTJ1_OUT, PTJ0_OUT,
168 PTK7_OUT, PTK6_OUT, PTK5_OUT, PTK4_OUT, 195 PTK7_OUT, PTK6_OUT, PTK5_OUT, PTK4_OUT,
169 PTK3_OUT, PTK2_OUT, PTK1_OUT, PTK0_OUT, 196 PTK3_OUT, PTK2_OUT, PTK1_OUT, PTK0_OUT,
170 PTL7_OUT, PTL6_OUT, PTL5_OUT, PTL4_OUT, 197 PTL6_OUT, PTL5_OUT, PTL4_OUT,
171 PTL3_OUT, PTL2_OUT, PTL1_OUT, PTL0_OUT, 198 PTL3_OUT, PTL2_OUT, PTL1_OUT, PTL0_OUT,
172 PTM6_OUT, PTM5_OUT, PTM4_OUT, 199 PTM7_OUT, PTM6_OUT, PTM5_OUT, PTM4_OUT,
173 PTM3_OUT, PTM2_OUT, PTM1_OUT, PTM0_OUT, 200 PTM3_OUT, PTM2_OUT, PTM1_OUT, PTM0_OUT,
174 PTN7_OUT, PTN6_OUT, PTN5_OUT, PTN4_OUT, 201 PTN6_OUT, PTN5_OUT, PTN4_OUT,
175 PTN3_OUT, PTN2_OUT, PTN1_OUT, PTN0_OUT, 202 PTN3_OUT, PTN2_OUT, PTN1_OUT, PTN0_OUT,
176 PTO7_OUT, PTO6_OUT, PTO5_OUT, PTO4_OUT, 203 PTO7_OUT, PTO6_OUT, PTO5_OUT, PTO4_OUT,
177 PTO3_OUT, PTO2_OUT, PTO1_OUT, PTO0_OUT, 204 PTO3_OUT, PTO2_OUT, PTO1_OUT, PTO0_OUT,
178 PTP6_OUT, PTP5_OUT, PTP4_OUT, 205 PTP7_OUT, PTP6_OUT, PTP5_OUT, PTP4_OUT,
179 PTP3_OUT, PTP2_OUT, PTP1_OUT, PTP0_OUT, 206 PTP3_OUT, PTP2_OUT, PTP1_OUT, PTP0_OUT,
180 PTQ6_OUT, PTQ5_OUT, PTQ4_OUT, 207 PTQ6_OUT, PTQ5_OUT, PTQ4_OUT,
181 PTQ3_OUT, PTQ2_OUT, PTQ1_OUT, PTQ0_OUT, 208 PTQ3_OUT, PTQ2_OUT, PTQ1_OUT, PTQ0_OUT,
182 PTR7_OUT, PTR6_OUT, PTR5_OUT, PTR4_OUT, 209 PTR7_OUT, PTR6_OUT, PTR5_OUT, PTR4_OUT,
183 PTR3_OUT, PTR2_OUT, PTR1_OUT, PTR0_OUT, 210 PTR3_OUT, PTR2_OUT, PTR1_OUT, PTR0_OUT,
184 PTS7_OUT, PTS6_OUT, PTS5_OUT, PTS4_OUT, 211 PTS7_OUT, PTS6_OUT, PTS5_OUT, PTS4_OUT,
185 PTS3_OUT, PTS2_OUT, PTS1_OUT, PTS0_OUT, 212 PTS3_OUT, PTS2_OUT, PTS1_OUT, PTS0_OUT,
186 PTT5_OUT, PTT4_OUT, 213 PTT7_OUT, PTT6_OUT, PTT5_OUT, PTT4_OUT,
187 PTT3_OUT, PTT2_OUT, PTT1_OUT, PTT0_OUT, 214 PTT3_OUT, PTT2_OUT, PTT1_OUT, PTT0_OUT,
188 PTU7_OUT, PTU6_OUT, PTU5_OUT, PTU4_OUT, 215 PTU7_OUT, PTU6_OUT, PTU5_OUT, PTU4_OUT,
189 PTU3_OUT, PTU2_OUT, PTU1_OUT, PTU0_OUT, 216 PTU3_OUT, PTU2_OUT, PTU1_OUT, PTU0_OUT,
@@ -218,27 +245,27 @@ enum {
218 PTH3_FN, PTH2_FN, PTH1_FN, PTH0_FN, 245 PTH3_FN, PTH2_FN, PTH1_FN, PTH0_FN,
219 PTI7_FN, PTI6_FN, PTI5_FN, PTI4_FN, 246 PTI7_FN, PTI6_FN, PTI5_FN, PTI4_FN,
220 PTI3_FN, PTI2_FN, PTI1_FN, PTI0_FN, 247 PTI3_FN, PTI2_FN, PTI1_FN, PTI0_FN,
221 PTJ7_FN, PTJ6_FN, PTJ5_FN, PTJ4_FN, 248 PTJ6_FN, PTJ5_FN, PTJ4_FN,
222 PTJ3_FN, PTJ2_FN, PTJ1_FN, PTJ0_FN, 249 PTJ3_FN, PTJ2_FN, PTJ1_FN, PTJ0_FN,
223 PTK7_FN, PTK6_FN, PTK5_FN, PTK4_FN, 250 PTK7_FN, PTK6_FN, PTK5_FN, PTK4_FN,
224 PTK3_FN, PTK2_FN, PTK1_FN, PTK0_FN, 251 PTK3_FN, PTK2_FN, PTK1_FN, PTK0_FN,
225 PTL7_FN, PTL6_FN, PTL5_FN, PTL4_FN, 252 PTL6_FN, PTL5_FN, PTL4_FN,
226 PTL3_FN, PTL2_FN, PTL1_FN, PTL0_FN, 253 PTL3_FN, PTL2_FN, PTL1_FN, PTL0_FN,
227 PTM6_FN, PTM5_FN, PTM4_FN, 254 PTM7_FN, PTM6_FN, PTM5_FN, PTM4_FN,
228 PTM3_FN, PTM2_FN, PTM1_FN, PTM0_FN, 255 PTM3_FN, PTM2_FN, PTM1_FN, PTM0_FN,
229 PTN7_FN, PTN6_FN, PTN5_FN, PTN4_FN, 256 PTN6_FN, PTN5_FN, PTN4_FN,
230 PTN3_FN, PTN2_FN, PTN1_FN, PTN0_FN, 257 PTN3_FN, PTN2_FN, PTN1_FN, PTN0_FN,
231 PTO7_FN, PTO6_FN, PTO5_FN, PTO4_FN, 258 PTO7_FN, PTO6_FN, PTO5_FN, PTO4_FN,
232 PTO3_FN, PTO2_FN, PTO1_FN, PTO0_FN, 259 PTO3_FN, PTO2_FN, PTO1_FN, PTO0_FN,
233 PTP6_FN, PTP5_FN, PTP4_FN, 260 PTP7_FN, PTP6_FN, PTP5_FN, PTP4_FN,
234 PTP3_FN, PTP2_FN, PTP1_FN, PTP0_FN, 261 PTP3_FN, PTP2_FN, PTP1_FN, PTP0_FN,
235 PTQ6_FN, PTQ5_FN, PTQ4_FN, 262 PTQ6_FN, PTQ5_FN, PTQ4_FN,
236 PTQ3_FN, PTQ2_FN, PTQ1_FN, PTQ0_FN, 263 PTQ3_FN, PTQ2_FN, PTQ1_FN, PTQ0_FN,
237 PTR7_FN, PTR6_FN, PTR5_FN, PTR4_FN, 264 PTR7_FN, PTR6_FN, PTR5_FN, PTR4_FN,
238 PTR3_FN, PTR2_FN, PTR1_FN, PTR0_FN, 265 PTR3_FN, PTR2_FN, PTR1_FN, PTR0_FN,
239 PTS7_FN, PTS6_FN, PTS5_FN, PTS4_FN, 266 PTS7_FN, PTS6_FN, PTS5_FN, PTS4_FN,
240 PTS3_FN, PTS2_FN, PTS1_FN, PTS0_FN, 267 PTS3_FN, PTS2_FN, PTS1_FN, PTS0_FN,
241 PTT5_FN, PTT4_FN, 268 PTT7_FN, PTT6_FN, PTT5_FN, PTT4_FN,
242 PTT3_FN, PTT2_FN, PTT1_FN, PTT0_FN, 269 PTT3_FN, PTT2_FN, PTT1_FN, PTT0_FN,
243 PTU7_FN, PTU6_FN, PTU5_FN, PTU4_FN, 270 PTU7_FN, PTU6_FN, PTU5_FN, PTU4_FN,
244 PTU3_FN, PTU2_FN, PTU1_FN, PTU0_FN, 271 PTU3_FN, PTU2_FN, PTU1_FN, PTU0_FN,
@@ -253,181 +280,248 @@ enum {
253 PTZ7_FN, PTZ6_FN, PTZ5_FN, PTZ4_FN, 280 PTZ7_FN, PTZ6_FN, PTZ5_FN, PTZ4_FN,
254 PTZ3_FN, PTZ2_FN, PTZ1_FN, PTZ0_FN, 281 PTZ3_FN, PTZ2_FN, PTZ1_FN, PTZ0_FN,
255 282
256 PS0_15_FN1, PS0_15_FN3, 283 PS0_15_FN1, PS0_15_FN2,
257 PS0_14_FN1, PS0_14_FN3, 284 PS0_14_FN1, PS0_14_FN2,
258 PS0_13_FN1, PS0_13_FN3, 285 PS0_13_FN1, PS0_13_FN2,
259 PS0_12_FN1, PS0_12_FN3, 286 PS0_12_FN1, PS0_12_FN2,
287 PS0_11_FN1, PS0_11_FN2,
288 PS0_10_FN1, PS0_10_FN2,
289 PS0_9_FN1, PS0_9_FN2,
290 PS0_8_FN1, PS0_8_FN2,
260 PS0_7_FN1, PS0_7_FN2, 291 PS0_7_FN1, PS0_7_FN2,
261 PS0_6_FN1, PS0_6_FN2, 292 PS0_6_FN1, PS0_6_FN2,
262 PS0_5_FN1, PS0_5_FN2, 293 PS0_5_FN1, PS0_5_FN2,
263 PS0_4_FN1, PS0_4_FN2, 294 PS0_4_FN1, PS0_4_FN2,
264 PS0_3_FN1, PS0_3_FN2, 295 PS0_3_FN1, PS0_3_FN2,
265 PS0_2_FN1, PS0_2_FN2, 296 PS0_2_FN1, PS0_2_FN2,
266 PS0_1_FN1, PS0_1_FN2,
267 297
268 PS1_7_FN1, PS1_7_FN3, 298 PS1_10_FN1, PS1_10_FN2,
269 PS1_6_FN1, PS1_6_FN3, 299 PS1_9_FN1, PS1_9_FN2,
300 PS1_8_FN1, PS1_8_FN2,
301 PS1_2_FN1, PS1_2_FN2,
302
303 PS2_13_FN1, PS2_13_FN2,
304 PS2_12_FN1, PS2_12_FN2,
305 PS2_7_FN1, PS2_7_FN2,
306 PS2_6_FN1, PS2_6_FN2,
307 PS2_5_FN1, PS2_5_FN2,
308 PS2_4_FN1, PS2_4_FN2,
309 PS2_2_FN1, PS2_2_FN2,
310
311 PS3_15_FN1, PS3_15_FN2,
312 PS3_14_FN1, PS3_14_FN2,
313 PS3_13_FN1, PS3_13_FN2,
314 PS3_12_FN1, PS3_12_FN2,
315 PS3_11_FN1, PS3_11_FN2,
316 PS3_10_FN1, PS3_10_FN2,
317 PS3_9_FN1, PS3_9_FN2,
318 PS3_8_FN1, PS3_8_FN2,
319 PS3_7_FN1, PS3_7_FN2,
320 PS3_2_FN1, PS3_2_FN2,
321 PS3_1_FN1, PS3_1_FN2,
270 322
271 PS2_13_FN1, PS2_13_FN3,
272 PS2_12_FN1, PS2_12_FN3,
273 PS2_1_FN1, PS2_1_FN2,
274 PS2_0_FN1, PS2_0_FN2,
275
276 PS4_15_FN1, PS4_15_FN2,
277 PS4_14_FN1, PS4_14_FN2, 323 PS4_14_FN1, PS4_14_FN2,
278 PS4_13_FN1, PS4_13_FN2, 324 PS4_13_FN1, PS4_13_FN2,
279 PS4_12_FN1, PS4_12_FN2, 325 PS4_12_FN1, PS4_12_FN2,
280 PS4_11_FN1, PS4_11_FN2,
281 PS4_10_FN1, PS4_10_FN2, 326 PS4_10_FN1, PS4_10_FN2,
282 PS4_9_FN1, PS4_9_FN2, 327 PS4_9_FN1, PS4_9_FN2,
328 PS4_8_FN1, PS4_8_FN2,
329 PS4_4_FN1, PS4_4_FN2,
283 PS4_3_FN1, PS4_3_FN2, 330 PS4_3_FN1, PS4_3_FN2,
284 PS4_2_FN1, PS4_2_FN2, 331 PS4_2_FN1, PS4_2_FN2,
285 PS4_1_FN1, PS4_1_FN2, 332 PS4_1_FN1, PS4_1_FN2,
286 PS4_0_FN1, PS4_0_FN2, 333 PS4_0_FN1, PS4_0_FN2,
287 334
335 PS5_11_FN1, PS5_11_FN2,
336 PS5_10_FN1, PS5_10_FN2,
288 PS5_9_FN1, PS5_9_FN2, 337 PS5_9_FN1, PS5_9_FN2,
289 PS5_8_FN1, PS5_8_FN2, 338 PS5_8_FN1, PS5_8_FN2,
290 PS5_7_FN1, PS5_7_FN2, 339 PS5_7_FN1, PS5_7_FN2,
291 PS5_6_FN1, PS5_6_FN2, 340 PS5_6_FN1, PS5_6_FN2,
292 PS5_5_FN1, PS5_5_FN2, 341 PS5_5_FN1, PS5_5_FN2,
293 PS5_4_FN1, PS5_4_FN2, 342 PS5_4_FN1, PS5_4_FN2,
294 343 PS5_3_FN1, PS5_3_FN2,
295 /* AN15 to 8 : EVENT15 to 8 */ 344 PS5_2_FN1, PS5_2_FN2,
296 PS6_7_FN_AN, PS6_7_FN_EV, 345
297 PS6_6_FN_AN, PS6_6_FN_EV, 346 PS6_15_FN1, PS6_15_FN2,
298 PS6_5_FN_AN, PS6_5_FN_EV, 347 PS6_14_FN1, PS6_14_FN2,
299 PS6_4_FN_AN, PS6_4_FN_EV, 348 PS6_13_FN1, PS6_13_FN2,
300 PS6_3_FN_AN, PS6_3_FN_EV, 349 PS6_12_FN1, PS6_12_FN2,
301 PS6_2_FN_AN, PS6_2_FN_EV, 350 PS6_11_FN1, PS6_11_FN2,
302 PS6_1_FN_AN, PS6_1_FN_EV, 351 PS6_10_FN1, PS6_10_FN2,
303 PS6_0_FN_AN, PS6_0_FN_EV, 352 PS6_9_FN1, PS6_9_FN2,
304 353 PS6_8_FN1, PS6_8_FN2,
354 PS6_7_FN1, PS6_7_FN2,
355 PS6_6_FN1, PS6_6_FN2,
356 PS6_5_FN1, PS6_5_FN2,
357 PS6_4_FN1, PS6_4_FN2,
358 PS6_3_FN1, PS6_3_FN2,
359 PS6_2_FN1, PS6_2_FN2,
360 PS6_1_FN1, PS6_1_FN2,
361 PS6_0_FN1, PS6_0_FN2,
362
363 PS7_15_FN1, PS7_15_FN2,
364 PS7_14_FN1, PS7_14_FN2,
365 PS7_13_FN1, PS7_13_FN2,
366 PS7_12_FN1, PS7_12_FN2,
367 PS7_11_FN1, PS7_11_FN2,
368 PS7_10_FN1, PS7_10_FN2,
369 PS7_9_FN1, PS7_9_FN2,
370 PS7_8_FN1, PS7_8_FN2,
371 PS7_7_FN1, PS7_7_FN2,
372 PS7_6_FN1, PS7_6_FN2,
373 PS7_5_FN1, PS7_5_FN2,
374 PS7_4_FN1, PS7_4_FN2,
375
376 PS8_15_FN1, PS8_15_FN2,
377 PS8_14_FN1, PS8_14_FN2,
378 PS8_13_FN1, PS8_13_FN2,
379 PS8_12_FN1, PS8_12_FN2,
380 PS8_11_FN1, PS8_11_FN2,
381 PS8_10_FN1, PS8_10_FN2,
382 PS8_9_FN1, PS8_9_FN2,
383 PS8_8_FN1, PS8_8_FN2,
305 PINMUX_FUNCTION_END, 384 PINMUX_FUNCTION_END,
306 385
307 PINMUX_MARK_BEGIN, 386 PINMUX_MARK_BEGIN,
308 /* PTA (mobule: LBSC, CPG, LPC) */ 387 /* PTA (mobule: LBSC, RGMII) */
309 BS_MARK, RDWR_MARK, WE1_MARK, RDY_MARK, 388 BS_MARK, RDWR_MARK, WE1_MARK, RDY_MARK,
310 MD10_MARK, MD9_MARK, MD8_MARK,
311 LGPIO7_MARK, LGPIO6_MARK, LGPIO5_MARK, LGPIO4_MARK,
312 LGPIO3_MARK, LGPIO2_MARK, LGPIO1_MARK, LGPIO0_MARK,
313
314 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
315 D15_MARK, D14_MARK, D13_MARK, D12_MARK,
316 D11_MARK, D10_MARK, D9_MARK, D8_MARK,
317 ET0_MDC_MARK, ET0_MDIO_MARK, ET1_MDC_MARK, ET1_MDIO_MARK, 389 ET0_MDC_MARK, ET0_MDIO_MARK, ET1_MDC_MARK, ET1_MDIO_MARK,
318 SIM_D_MARK, SIM_CLK_MARK, SIM_RST_MARK,
319 WPSZ1_MARK, WPSZ0_MARK, FWID_MARK, FLSHSZ_MARK,
320 LPC_SPIEN_MARK, BASEL_MARK,
321 390
322 /* PTC (mobule: SD) */ 391 /* PTB (mobule: INTC, ONFI, TMU) */
323 SD_WP_MARK, SD_CD_MARK, SD_CLK_MARK, SD_CMD_MARK, 392 IRQ15_MARK, IRQ14_MARK, IRQ13_MARK, IRQ12_MARK,
324 SD_D3_MARK, SD_D2_MARK, SD_D1_MARK, SD_D0_MARK, 393 IRQ11_MARK, IRQ10_MARK, IRQ9_MARK, IRQ8_MARK,
394 ON_NRE_MARK, ON_NWE_MARK, ON_NWP_MARK, ON_NCE0_MARK,
395 ON_R_B0_MARK, ON_ALE_MARK, ON_CLE_MARK, TCLK_MARK,
325 396
326 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */ 397 /* PTC (mobule: IRQ, PWMU) */
327 IRQ7_MARK, IRQ6_MARK, IRQ5_MARK, IRQ4_MARK, 398 IRQ7_MARK, IRQ6_MARK, IRQ5_MARK, IRQ4_MARK,
328 IRQ3_MARK, IRQ2_MARK, IRQ1_MARK, IRQ0_MARK, 399 IRQ3_MARK, IRQ2_MARK, IRQ1_MARK, IRQ0_MARK,
329 MD6_MARK, MD5_MARK, MD3_MARK, MD2_MARK, 400 PWMU0_MARK, PWMU1_MARK, PWMU2_MARK, PWMU3_MARK,
330 MD1_MARK, MD0_MARK, ADTRG1_MARK, ADTRG0_MARK, 401 PWMU4_MARK, PWMU5_MARK,
331 402
332 /* PTE (mobule: EtherC) */ 403 /* PTD (mobule: SPI0, DMAC) */
333 ET0_CRS_DV_MARK, ET0_TXD1_MARK, 404 SP0_MOSI_MARK, SP0_MISO_MARK, SP0_SCK_MARK, SP0_SCK_FB_MARK,
334 ET0_TXD0_MARK, ET0_TX_EN_MARK, 405 SP0_SS0_MARK, SP0_SS1_MARK, SP0_SS2_MARK, SP0_SS3_MARK,
335 ET0_REF_CLK_MARK, ET0_RXD1_MARK, 406 DREQ0_MARK, DACK0_MARK, TEND0_MARK,
336 ET0_RXD0_MARK, ET0_RX_ER_MARK, 407
337 408 /* PTE (mobule: RMII) */
338 /* PTF (mobule: EtherC) */ 409 RMII0_CRS_DV_MARK, RMII0_TXD1_MARK,
339 ET1_CRS_DV_MARK, ET1_TXD1_MARK, 410 RMII0_TXD0_MARK, RMII0_TXEN_MARK,
340 ET1_TXD0_MARK, ET1_TX_EN_MARK, 411 RMII0_REFCLK_MARK, RMII0_RXD1_MARK,
341 ET1_REF_CLK_MARK, ET1_RXD1_MARK, 412 RMII0_RXD0_MARK, RMII0_RX_ER_MARK,
342 ET1_RXD0_MARK, ET1_RX_ER_MARK, 413
343 414 /* PTF (mobule: RMII, SerMux) */
344 /* PTG (mobule: SYSTEM, PWMX, LPC) */ 415 RMII1_CRS_DV_MARK, RMII1_TXD1_MARK,
345 STATUS0_MARK, STATUS1_MARK, 416 RMII1_TXD0_MARK, RMII1_TXEN_MARK,
346 PWX0_MARK, PWX1_MARK, PWX2_MARK, PWX3_MARK, 417 RMII1_REFCLK_MARK, RMII1_RXD1_MARK,
347 SERIRQ_MARK, CLKRUN_MARK, LPCPD_MARK, LDRQ_MARK, 418 RMII1_RXD0_MARK, RMII1_RX_ER_MARK,
348 419 RAC_RI_MARK,
349 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */ 420
350 TCLK_MARK, RXD4_MARK, TXD4_MARK, 421 /* PTG (mobule: system, LBSC, LPC, WDT, LPC, eMMC) */
422 BOOTFMS_MARK, BOOTWP_MARK, A25_MARK, A24_MARK,
423 SERIRQ_MARK, WDTOVF_MARK, LPCPD_MARK, LDRQ_MARK,
424 MMCCLK_MARK, MMCCMD_MARK,
425
426 /* PTH (mobule: SPI1, LPC, DMAC, ADC) */
351 SP1_MOSI_MARK, SP1_MISO_MARK, SP1_SCK_MARK, SP1_SCK_FB_MARK, 427 SP1_MOSI_MARK, SP1_MISO_MARK, SP1_SCK_MARK, SP1_SCK_FB_MARK,
352 SP1_SS0_MARK, SP1_SS1_MARK, SP0_SS1_MARK, 428 SP1_SS0_MARK, SP1_SS1_MARK, WP_MARK, FMS0_MARK,
429 TEND1_MARK, DREQ1_MARK, DACK1_MARK, ADTRG1_MARK,
430 ADTRG0_MARK,
353 431
354 /* PTI (mobule: INTC) */ 432 /* PTI (mobule: LBSC, SDHI) */
355 IRQ15_MARK, IRQ14_MARK, IRQ13_MARK, IRQ12_MARK, 433 D15_MARK, D14_MARK, D13_MARK, D12_MARK,
356 IRQ11_MARK, IRQ10_MARK, IRQ9_MARK, IRQ8_MARK, 434 D11_MARK, D10_MARK, D9_MARK, D8_MARK,
435 SD_WP_MARK, SD_CD_MARK, SD_CLK_MARK, SD_CMD_MARK,
436 SD_D3_MARK, SD_D2_MARK, SD_D1_MARK, SD_D0_MARK,
357 437
358 /* PTJ (mobule: SCIF234, SERMUX) */ 438 /* PTJ (mobule: SCIF234) */
359 RXD3_MARK, TXD3_MARK, RXD2_MARK, TXD2_MARK, 439 RTS3_MARK, CTS3_MARK, TXD3_MARK, RXD3_MARK,
360 COM1_TXD_MARK, COM1_RXD_MARK, COM1_RTS_MARK, COM1_CTS_MARK, 440 RTS4_MARK, RXD4_MARK, TXD4_MARK,
361 441
362 /* PTK (mobule: SERMUX) */ 442 /* PTK (mobule: SERMUX, LBSC, SCIF) */
363 COM2_TXD_MARK, COM2_RXD_MARK, COM2_RTS_MARK, COM2_CTS_MARK, 443 COM2_TXD_MARK, COM2_RXD_MARK, COM2_RTS_MARK, COM2_CTS_MARK,
364 COM2_DTR_MARK, COM2_DSR_MARK, COM2_DCD_MARK, COM2_RI_MARK, 444 COM2_DTR_MARK, COM2_DSR_MARK, COM2_DCD_MARK, CLKOUT_MARK,
445 SCK2_MARK, SCK4_MARK, SCK3_MARK,
365 446
366 /* PTL (mobule: SERMUX) */ 447 /* PTL (mobule: SERMUX, SCIF, LBSC, AUD) */
367 RAC_TXD_MARK, RAC_RXD_MARK, RAC_RTS_MARK, RAC_CTS_MARK, 448 RAC_RXD_MARK, RAC_RTS_MARK, RAC_CTS_MARK, RAC_DTR_MARK,
368 RAC_DTR_MARK, RAC_DSR_MARK, RAC_DCD_MARK, RAC_RI_MARK, 449 RAC_DSR_MARK, RAC_DCD_MARK, RAC_TXD_MARK, RXD2_MARK,
450 CS5_MARK, CS6_MARK, AUDSYNC_MARK, AUDCK_MARK,
451 TXD2_MARK,
369 452
370 /* PTM (mobule: IIC, LPC) */ 453 /* PTM (mobule: LBSC, IIC) */
454 CS4_MARK, RD_MARK, WE0_MARK, CS0_MARK,
371 SDA6_MARK, SCL6_MARK, SDA7_MARK, SCL7_MARK, 455 SDA6_MARK, SCL6_MARK, SDA7_MARK, SCL7_MARK,
372 WP_MARK, FMS0_MARK, FMS1_MARK,
373 456
374 /* PTN (mobule: SCIF234, EVC) */ 457 /* PTN (mobule: USB, JMC, SGPIO, WDT) */
375 SCK2_MARK, RTS4_MARK, RTS3_MARK, RTS2_MARK, 458 VBUS_EN_MARK, VBUS_OC_MARK, JMCTCK_MARK, JMCTMS_MARK,
376 CTS4_MARK, CTS3_MARK, CTS2_MARK, 459 JMCTDO_MARK, JMCTDI_MARK, JMCTRST_MARK,
377 EVENT7_MARK, EVENT6_MARK, EVENT5_MARK, EVENT4_MARK, 460 SGPIO1_CLK_MARK, SGPIO1_LOAD_MARK, SGPIO1_DI_MARK,
378 EVENT3_MARK, EVENT2_MARK, EVENT1_MARK, EVENT0_MARK, 461 SGPIO1_DO_MARK, SUB_CLKIN_MARK,
379 462
380 /* PTO (mobule: SGPIO) */ 463 /* PTO (mobule: SGPIO, SerMux) */
381 SGPIO0_CLK_MARK, SGPIO0_LOAD_MARK, 464 SGPIO0_CLK_MARK, SGPIO0_LOAD_MARK, SGPIO0_DI_MARK,
382 SGPIO0_DI_MARK, SGPIO0_DO_MARK, 465 SGPIO0_DO_MARK, SGPIO2_CLK_MARK, SGPIO2_LOAD_MARK,
383 SGPIO1_CLK_MARK, SGPIO1_LOAD_MARK, 466 SGPIO2_DI_MARK, SGPIO2_DO_MARK,
384 SGPIO1_DI_MARK, SGPIO1_DO_MARK, 467 COM1_TXD_MARK, COM1_RXD_MARK, COM1_RTS_MARK, COM1_CTS_MARK,
385
386 /* PTP (mobule: JMC, SCIF234) */
387 JMCTCK_MARK, JMCTMS_MARK, JMCTDO_MARK, JMCTDI_MARK,
388 JMCRST_MARK, SCK4_MARK, SCK3_MARK,
389 468
390 /* PTQ (mobule: LPC) */ 469 /* PTQ (mobule: LPC) */
391 LAD3_MARK, LAD2_MARK, LAD1_MARK, LAD0_MARK, 470 LAD3_MARK, LAD2_MARK, LAD1_MARK, LAD0_MARK,
392 LFRAME_MARK, LRESET_MARK, LCLK_MARK, 471 LFRAME_MARK, LRESET_MARK, LCLK_MARK,
393 472
394 /* PTR (mobule: GRA, IIC) */ 473 /* PTR (mobule: GRA, IIC) */
395 DDC3_MARK, DDC2_MARK, 474 DDC3_MARK, DDC2_MARK, SDA2_MARK, SCL2_MARK,
396 SDA8_MARK, SCL8_MARK, SDA2_MARK, SCL2_MARK,
397 SDA1_MARK, SCL1_MARK, SDA0_MARK, SCL0_MARK, 475 SDA1_MARK, SCL1_MARK, SDA0_MARK, SCL0_MARK,
476 SDA8_MARK, SCL8_MARK,
398 477
399 /* PTS (mobule: GRA, IIC) */ 478 /* PTS (mobule: GRA, IIC) */
400 DDC1_MARK, DDC0_MARK, 479 DDC1_MARK, DDC0_MARK, SDA5_MARK, SCL5_MARK,
401 SDA9_MARK, SCL9_MARK, SDA5_MARK, SCL5_MARK,
402 SDA4_MARK, SCL4_MARK, SDA3_MARK, SCL3_MARK, 480 SDA4_MARK, SCL4_MARK, SDA3_MARK, SCL3_MARK,
481 SDA9_MARK, SCL9_MARK,
403 482
404 /* PTT (mobule: SYSTEM, PWMX) */ 483 /* PTT (mobule: PWMX, AUD) */
405 AUDSYNC_MARK, AUDCK_MARK, 484 PWMX7_MARK, PWMX6_MARK, PWMX5_MARK, PWMX4_MARK,
406 AUDATA3_MARK, AUDATA2_MARK, 485 PWMX3_MARK, PWMX2_MARK, PWMX1_MARK, PWMX0_MARK,
407 AUDATA1_MARK, AUDATA0_MARK, 486 AUDATA3_MARK, AUDATA2_MARK, AUDATA1_MARK, AUDATA0_MARK,
408 PWX7_MARK, PWX6_MARK, PWX5_MARK, PWX4_MARK, 487 STATUS1_MARK, STATUS0_MARK,
409 488
410 /* PTU (mobule: LBSC, DMAC) */ 489 /* PTU (mobule: LPC, APM) */
411 CS6_MARK, CS5_MARK, CS4_MARK, CS0_MARK, 490 LGPIO7_MARK, LGPIO6_MARK, LGPIO5_MARK, LGPIO4_MARK,
412 RD_MARK, WE0_MARK, A25_MARK, A24_MARK, 491 LGPIO3_MARK, LGPIO2_MARK, LGPIO1_MARK, LGPIO0_MARK,
413 DREQ0_MARK, DACK0_MARK, 492 APMONCTL_O_MARK, APMPWBTOUT_O_MARK, APMSCI_O_MARK,
493 APMVDDON_MARK, APMSLPBTN_MARK, APMPWRBTN_MARK, APMS5N_MARK,
494 APMS3N_MARK,
414 495
415 /* PTV (mobule: LBSC, DMAC) */ 496 /* PTV (mobule: LBSC, SerMux, R-SPI, EVC, GRA) */
416 A23_MARK, A22_MARK, A21_MARK, A20_MARK, 497 A23_MARK, A22_MARK, A21_MARK, A20_MARK,
417 A19_MARK, A18_MARK, A17_MARK, A16_MARK, 498 A19_MARK, A18_MARK, A17_MARK, A16_MARK,
418 TEND0_MARK, DREQ1_MARK, DACK1_MARK, TEND1_MARK, 499 COM2_RI_MARK, R_SPI_MOSI_MARK, R_SPI_MISO_MARK,
500 R_SPI_RSPCK_MARK, R_SPI_SSL0_MARK, R_SPI_SSL1_MARK,
501 EVENT7_MARK, EVENT6_MARK, VBIOS_DI_MARK, VBIOS_DO_MARK,
502 VBIOS_CLK_MARK, VBIOS_CS_MARK,
419 503
420 /* PTW (mobule: LBSC) */ 504 /* PTW (mobule: LBSC, EVC, SCIF) */
421 A15_MARK, A14_MARK, A13_MARK, A12_MARK, 505 A15_MARK, A14_MARK, A13_MARK, A12_MARK,
422 A11_MARK, A10_MARK, A9_MARK, A8_MARK, 506 A11_MARK, A10_MARK, A9_MARK, A8_MARK,
507 EVENT5_MARK, EVENT4_MARK, EVENT3_MARK, EVENT2_MARK,
508 EVENT1_MARK, EVENT0_MARK, CTS4_MARK, CTS2_MARK,
423 509
424 /* PTX (mobule: LBSC) */ 510 /* PTX (mobule: LBSC, SCIF, SIM) */
425 A7_MARK, A6_MARK, A5_MARK, A4_MARK, 511 A7_MARK, A6_MARK, A5_MARK, A4_MARK,
426 A3_MARK, A2_MARK, A1_MARK, A0_MARK, 512 A3_MARK, A2_MARK, A1_MARK, A0_MARK,
513 RTS2_MARK, SIM_D_MARK, SIM_CLK_MARK, SIM_RST_MARK,
427 514
428 /* PTY (mobule: LBSC) */ 515 /* PTY (mobule: LBSC) */
429 D7_MARK, D6_MARK, D5_MARK, D4_MARK, 516 D7_MARK, D6_MARK, D5_MARK, D4_MARK,
430 D3_MARK, D2_MARK, D1_MARK, D0_MARK, 517 D3_MARK, D2_MARK, D1_MARK, D0_MARK,
518
519 /* PTZ (mobule: eMMC, ONFI) */
520 MMCDAT7_MARK, MMCDAT6_MARK, MMCDAT5_MARK, MMCDAT4_MARK,
521 MMCDAT3_MARK, MMCDAT2_MARK, MMCDAT1_MARK, MMCDAT0_MARK,
522 ON_DQ7_MARK, ON_DQ6_MARK, ON_DQ5_MARK, ON_DQ4_MARK,
523 ON_DQ3_MARK, ON_DQ2_MARK, ON_DQ1_MARK, ON_DQ0_MARK,
524
431 PINMUX_MARK_END, 525 PINMUX_MARK_END,
432}; 526};
433 527
@@ -473,6 +567,8 @@ static pinmux_enum_t pinmux_data[] = {
473 PINMUX_DATA(PTD0_DATA, PTD0_IN, PTD0_OUT), 567 PINMUX_DATA(PTD0_DATA, PTD0_IN, PTD0_OUT),
474 568
475 /* PTE GPIO */ 569 /* PTE GPIO */
570 PINMUX_DATA(PTE7_DATA, PTE7_IN, PTE7_OUT),
571 PINMUX_DATA(PTE6_DATA, PTE6_IN, PTE6_OUT),
476 PINMUX_DATA(PTE5_DATA, PTE5_IN, PTE5_OUT), 572 PINMUX_DATA(PTE5_DATA, PTE5_IN, PTE5_OUT),
477 PINMUX_DATA(PTE4_DATA, PTE4_IN, PTE4_OUT), 573 PINMUX_DATA(PTE4_DATA, PTE4_IN, PTE4_OUT),
478 PINMUX_DATA(PTE3_DATA, PTE3_IN, PTE3_OUT), 574 PINMUX_DATA(PTE3_DATA, PTE3_IN, PTE3_OUT),
@@ -521,7 +617,6 @@ static pinmux_enum_t pinmux_data[] = {
521 PINMUX_DATA(PTI0_DATA, PTI0_IN, PTI0_OUT), 617 PINMUX_DATA(PTI0_DATA, PTI0_IN, PTI0_OUT),
522 618
523 /* PTJ GPIO */ 619 /* PTJ GPIO */
524 PINMUX_DATA(PTJ7_DATA, PTJ7_IN, PTJ7_OUT),
525 PINMUX_DATA(PTJ6_DATA, PTJ6_IN, PTJ6_OUT), 620 PINMUX_DATA(PTJ6_DATA, PTJ6_IN, PTJ6_OUT),
526 PINMUX_DATA(PTJ5_DATA, PTJ5_IN, PTJ5_OUT), 621 PINMUX_DATA(PTJ5_DATA, PTJ5_IN, PTJ5_OUT),
527 PINMUX_DATA(PTJ4_DATA, PTJ4_IN, PTJ4_OUT), 622 PINMUX_DATA(PTJ4_DATA, PTJ4_IN, PTJ4_OUT),
@@ -541,7 +636,6 @@ static pinmux_enum_t pinmux_data[] = {
541 PINMUX_DATA(PTK0_DATA, PTK0_IN, PTK0_OUT), 636 PINMUX_DATA(PTK0_DATA, PTK0_IN, PTK0_OUT),
542 637
543 /* PTL GPIO */ 638 /* PTL GPIO */
544 PINMUX_DATA(PTL7_DATA, PTL7_IN, PTL7_OUT),
545 PINMUX_DATA(PTL6_DATA, PTL6_IN, PTL6_OUT), 639 PINMUX_DATA(PTL6_DATA, PTL6_IN, PTL6_OUT),
546 PINMUX_DATA(PTL5_DATA, PTL5_IN, PTL5_OUT), 640 PINMUX_DATA(PTL5_DATA, PTL5_IN, PTL5_OUT),
547 PINMUX_DATA(PTL4_DATA, PTL4_IN, PTL4_OUT), 641 PINMUX_DATA(PTL4_DATA, PTL4_IN, PTL4_OUT),
@@ -560,7 +654,6 @@ static pinmux_enum_t pinmux_data[] = {
560 PINMUX_DATA(PTM0_DATA, PTM0_IN, PTM0_OUT), 654 PINMUX_DATA(PTM0_DATA, PTM0_IN, PTM0_OUT),
561 655
562 /* PTN GPIO */ 656 /* PTN GPIO */
563 PINMUX_DATA(PTN7_DATA, PTN7_IN, PTN7_OUT),
564 PINMUX_DATA(PTN6_DATA, PTN6_IN, PTN6_OUT), 657 PINMUX_DATA(PTN6_DATA, PTN6_IN, PTN6_OUT),
565 PINMUX_DATA(PTN5_DATA, PTN5_IN, PTN5_OUT), 658 PINMUX_DATA(PTN5_DATA, PTN5_IN, PTN5_OUT),
566 PINMUX_DATA(PTN4_DATA, PTN4_IN, PTN4_OUT), 659 PINMUX_DATA(PTN4_DATA, PTN4_IN, PTN4_OUT),
@@ -609,6 +702,8 @@ static pinmux_enum_t pinmux_data[] = {
609 PINMUX_DATA(PTS0_DATA, PTS0_IN, PTS0_OUT), 702 PINMUX_DATA(PTS0_DATA, PTS0_IN, PTS0_OUT),
610 703
611 /* PTT GPIO */ 704 /* PTT GPIO */
705 PINMUX_DATA(PTT7_DATA, PTT7_IN, PTT7_OUT),
706 PINMUX_DATA(PTT6_DATA, PTT6_IN, PTT6_OUT),
612 PINMUX_DATA(PTT5_DATA, PTT5_IN, PTT5_OUT), 707 PINMUX_DATA(PTT5_DATA, PTT5_IN, PTT5_OUT),
613 PINMUX_DATA(PTT4_DATA, PTT4_IN, PTT4_OUT), 708 PINMUX_DATA(PTT4_DATA, PTT4_IN, PTT4_OUT),
614 PINMUX_DATA(PTT3_DATA, PTT3_IN, PTT3_OUT), 709 PINMUX_DATA(PTT3_DATA, PTT3_IN, PTT3_OUT),
@@ -677,186 +772,204 @@ static pinmux_enum_t pinmux_data[] = {
677 PINMUX_DATA(PTZ0_DATA, PTZ0_IN, PTZ0_OUT), 772 PINMUX_DATA(PTZ0_DATA, PTZ0_IN, PTZ0_OUT),
678 773
679 /* PTA FN */ 774 /* PTA FN */
680 PINMUX_DATA(BS_MARK, PS0_15_FN1, PTA7_FN), 775 PINMUX_DATA(BS_MARK, PTA7_FN),
681 PINMUX_DATA(LGPIO7_MARK, PS0_15_FN3, PTA7_FN), 776 PINMUX_DATA(RDWR_MARK, PTA6_FN),
682 PINMUX_DATA(RDWR_MARK, PS0_14_FN1, PTA6_FN), 777 PINMUX_DATA(WE1_MARK, PTA5_FN),
683 PINMUX_DATA(LGPIO6_MARK, PS0_14_FN3, PTA6_FN), 778 PINMUX_DATA(RDY_MARK, PTA4_FN),
684 PINMUX_DATA(WE1_MARK, PS0_13_FN1, PTA5_FN), 779 PINMUX_DATA(ET0_MDC_MARK, PTA3_FN),
685 PINMUX_DATA(LGPIO5_MARK, PS0_13_FN3, PTA5_FN), 780 PINMUX_DATA(ET0_MDIO_MARK, PTA2_FN),
686 PINMUX_DATA(RDY_MARK, PS0_12_FN1, PTA4_FN), 781 PINMUX_DATA(ET1_MDC_MARK, PTA1_FN),
687 PINMUX_DATA(LGPIO4_MARK, PS0_12_FN3, PTA4_FN), 782 PINMUX_DATA(ET1_MDIO_MARK, PTA0_FN),
688 PINMUX_DATA(LGPIO3_MARK, PTA3_FN),
689 PINMUX_DATA(LGPIO2_MARK, PTA2_FN),
690 PINMUX_DATA(LGPIO1_MARK, PTA1_FN),
691 PINMUX_DATA(LGPIO0_MARK, PTA0_FN),
692 783
693 /* PTB FN */ 784 /* PTB FN */
694 PINMUX_DATA(D15_MARK, PS0_7_FN1, PTB7_FN), 785 PINMUX_DATA(IRQ15_MARK, PS0_15_FN1, PTB7_FN),
695 PINMUX_DATA(ET0_MDC_MARK, PS0_7_FN2, PTB7_FN), 786 PINMUX_DATA(ON_NRE_MARK, PS0_15_FN2, PTB7_FN),
696 PINMUX_DATA(D14_MARK, PS0_6_FN1, PTB6_FN), 787 PINMUX_DATA(IRQ14_MARK, PS0_14_FN1, PTB6_FN),
697 PINMUX_DATA(ET0_MDIO_MARK, PS0_6_FN2, PTB6_FN), 788 PINMUX_DATA(ON_NWE_MARK, PS0_14_FN2, PTB6_FN),
698 PINMUX_DATA(D13_MARK, PS0_5_FN1, PTB5_FN), 789 PINMUX_DATA(IRQ13_MARK, PS0_13_FN1, PTB5_FN),
699 PINMUX_DATA(ET1_MDC_MARK, PS0_5_FN2, PTB5_FN), 790 PINMUX_DATA(ON_NWP_MARK, PS0_13_FN2, PTB5_FN),
700 PINMUX_DATA(D12_MARK, PS0_4_FN1, PTB4_FN), 791 PINMUX_DATA(IRQ12_MARK, PS0_12_FN1, PTB4_FN),
701 PINMUX_DATA(ET1_MDIO_MARK, PS0_4_FN2, PTB4_FN), 792 PINMUX_DATA(ON_NCE0_MARK, PS0_12_FN2, PTB4_FN),
702 PINMUX_DATA(D11_MARK, PS0_3_FN1, PTB3_FN), 793 PINMUX_DATA(IRQ11_MARK, PS0_11_FN1, PTB3_FN),
703 PINMUX_DATA(SIM_D_MARK, PS0_3_FN2, PTB3_FN), 794 PINMUX_DATA(ON_R_B0_MARK, PS0_11_FN2, PTB3_FN),
704 PINMUX_DATA(D10_MARK, PS0_2_FN1, PTB2_FN), 795 PINMUX_DATA(IRQ10_MARK, PS0_10_FN1, PTB2_FN),
705 PINMUX_DATA(SIM_CLK_MARK, PS0_2_FN2, PTB2_FN), 796 PINMUX_DATA(ON_ALE_MARK, PS0_10_FN2, PTB2_FN),
706 PINMUX_DATA(D9_MARK, PS0_1_FN1, PTB1_FN), 797 PINMUX_DATA(IRQ9_MARK, PS0_9_FN1, PTB1_FN),
707 PINMUX_DATA(SIM_RST_MARK, PS0_1_FN2, PTB1_FN), 798 PINMUX_DATA(ON_CLE_MARK, PS0_9_FN2, PTB1_FN),
708 PINMUX_DATA(D8_MARK, PTB0_FN), 799 PINMUX_DATA(IRQ8_MARK, PS0_8_FN1, PTB0_FN),
800 PINMUX_DATA(TCLK_MARK, PS0_8_FN2, PTB0_FN),
709 801
710 /* PTC FN */ 802 /* PTC FN */
711 PINMUX_DATA(SD_WP_MARK, PTC7_FN), 803 PINMUX_DATA(IRQ7_MARK, PS0_7_FN1, PTC7_FN),
712 PINMUX_DATA(SD_CD_MARK, PTC6_FN), 804 PINMUX_DATA(PWMU0_MARK, PS0_7_FN2, PTC7_FN),
713 PINMUX_DATA(SD_CLK_MARK, PTC5_FN), 805 PINMUX_DATA(IRQ6_MARK, PS0_6_FN1, PTC6_FN),
714 PINMUX_DATA(SD_CMD_MARK, PTC4_FN), 806 PINMUX_DATA(PWMU1_MARK, PS0_6_FN2, PTC6_FN),
715 PINMUX_DATA(SD_D3_MARK, PTC3_FN), 807 PINMUX_DATA(IRQ5_MARK, PS0_5_FN1, PTC5_FN),
716 PINMUX_DATA(SD_D2_MARK, PTC2_FN), 808 PINMUX_DATA(PWMU2_MARK, PS0_5_FN2, PTC5_FN),
717 PINMUX_DATA(SD_D1_MARK, PTC1_FN), 809 PINMUX_DATA(IRQ4_MARK, PS0_4_FN1, PTC5_FN),
718 PINMUX_DATA(SD_D0_MARK, PTC0_FN), 810 PINMUX_DATA(PWMU3_MARK, PS0_4_FN2, PTC4_FN),
811 PINMUX_DATA(IRQ3_MARK, PS0_3_FN1, PTC3_FN),
812 PINMUX_DATA(PWMU4_MARK, PS0_3_FN2, PTC3_FN),
813 PINMUX_DATA(IRQ2_MARK, PS0_2_FN1, PTC2_FN),
814 PINMUX_DATA(PWMU5_MARK, PS0_2_FN2, PTC2_FN),
815 PINMUX_DATA(IRQ1_MARK, PTC1_FN),
816 PINMUX_DATA(IRQ0_MARK, PTC0_FN),
719 817
720 /* PTD FN */ 818 /* PTD FN */
721 PINMUX_DATA(IRQ7_MARK, PS1_7_FN1, PTD7_FN), 819 PINMUX_DATA(SP0_MOSI_MARK, PTD7_FN),
722 PINMUX_DATA(ADTRG1_MARK, PS1_7_FN3, PTD7_FN), 820 PINMUX_DATA(SP0_MISO_MARK, PTD6_FN),
723 PINMUX_DATA(IRQ6_MARK, PS1_6_FN1, PTD6_FN), 821 PINMUX_DATA(SP0_SCK_MARK, PTD5_FN),
724 PINMUX_DATA(ADTRG0_MARK, PS1_6_FN3, PTD6_FN), 822 PINMUX_DATA(SP0_SCK_FB_MARK, PTD4_FN),
725 PINMUX_DATA(IRQ5_MARK, PTD5_FN), 823 PINMUX_DATA(SP0_SS0_MARK, PTD3_FN),
726 PINMUX_DATA(IRQ4_MARK, PTD4_FN), 824 PINMUX_DATA(SP0_SS1_MARK, PS1_10_FN1, PTD2_FN),
727 PINMUX_DATA(IRQ3_MARK, PTD3_FN), 825 PINMUX_DATA(DREQ0_MARK, PS1_10_FN2, PTD2_FN),
728 PINMUX_DATA(IRQ2_MARK, PTD2_FN), 826 PINMUX_DATA(SP0_SS2_MARK, PS1_9_FN1, PTD1_FN),
729 PINMUX_DATA(IRQ1_MARK, PTD1_FN), 827 PINMUX_DATA(DACK0_MARK, PS1_9_FN2, PTD1_FN),
730 PINMUX_DATA(IRQ0_MARK, PTD0_FN), 828 PINMUX_DATA(SP0_SS3_MARK, PS1_8_FN1, PTD0_FN),
829 PINMUX_DATA(TEND0_MARK, PS1_8_FN2, PTD0_FN),
731 830
732 /* PTE FN */ 831 /* PTE FN */
733 PINMUX_DATA(ET0_CRS_DV_MARK, PTE7_FN), 832 PINMUX_DATA(RMII0_CRS_DV_MARK, PTE7_FN),
734 PINMUX_DATA(ET0_TXD1_MARK, PTE6_FN), 833 PINMUX_DATA(RMII0_TXD1_MARK, PTE6_FN),
735 PINMUX_DATA(ET0_TXD0_MARK, PTE5_FN), 834 PINMUX_DATA(RMII0_TXD0_MARK, PTE5_FN),
736 PINMUX_DATA(ET0_TX_EN_MARK, PTE4_FN), 835 PINMUX_DATA(RMII0_TXEN_MARK, PTE4_FN),
737 PINMUX_DATA(ET0_REF_CLK_MARK, PTE3_FN), 836 PINMUX_DATA(RMII0_REFCLK_MARK, PTE3_FN),
738 PINMUX_DATA(ET0_RXD1_MARK, PTE2_FN), 837 PINMUX_DATA(RMII0_RXD1_MARK, PTE2_FN),
739 PINMUX_DATA(ET0_RXD0_MARK, PTE1_FN), 838 PINMUX_DATA(RMII0_RXD0_MARK, PTE1_FN),
740 PINMUX_DATA(ET0_RX_ER_MARK, PTE0_FN), 839 PINMUX_DATA(RMII0_RX_ER_MARK, PTE0_FN),
741 840
742 /* PTF FN */ 841 /* PTF FN */
743 PINMUX_DATA(ET1_CRS_DV_MARK, PTF7_FN), 842 PINMUX_DATA(RMII1_CRS_DV_MARK, PTF7_FN),
744 PINMUX_DATA(ET1_TXD1_MARK, PTF6_FN), 843 PINMUX_DATA(RMII1_TXD1_MARK, PTF6_FN),
745 PINMUX_DATA(ET1_TXD0_MARK, PTF5_FN), 844 PINMUX_DATA(RMII1_TXD0_MARK, PTF5_FN),
746 PINMUX_DATA(ET1_TX_EN_MARK, PTF4_FN), 845 PINMUX_DATA(RMII1_TXEN_MARK, PTF4_FN),
747 PINMUX_DATA(ET1_REF_CLK_MARK, PTF3_FN), 846 PINMUX_DATA(RMII1_REFCLK_MARK, PTF3_FN),
748 PINMUX_DATA(ET1_RXD1_MARK, PTF2_FN), 847 PINMUX_DATA(RMII1_RXD1_MARK, PS1_2_FN1, PTF2_FN),
749 PINMUX_DATA(ET1_RXD0_MARK, PTF1_FN), 848 PINMUX_DATA(RAC_RI_MARK, PS1_2_FN2, PTF2_FN),
750 PINMUX_DATA(ET1_RX_ER_MARK, PTF0_FN), 849 PINMUX_DATA(RMII1_RXD0_MARK, PTF1_FN),
850 PINMUX_DATA(RMII1_RX_ER_MARK, PTF0_FN),
751 851
752 /* PTG FN */ 852 /* PTG FN */
753 PINMUX_DATA(PWX0_MARK, PTG7_FN), 853 PINMUX_DATA(BOOTFMS_MARK, PTG7_FN),
754 PINMUX_DATA(PWX1_MARK, PTG6_FN), 854 PINMUX_DATA(BOOTWP_MARK, PTG6_FN),
755 PINMUX_DATA(STATUS0_MARK, PS2_13_FN1, PTG5_FN), 855 PINMUX_DATA(A25_MARK, PS2_13_FN1, PTG5_FN),
756 PINMUX_DATA(PWX2_MARK, PS2_13_FN3, PTG5_FN), 856 PINMUX_DATA(MMCCLK_MARK, PS2_13_FN2, PTG5_FN),
757 PINMUX_DATA(STATUS1_MARK, PS2_12_FN1, PTG4_FN), 857 PINMUX_DATA(A24_MARK, PS2_12_FN1, PTG4_FN),
758 PINMUX_DATA(PWX3_MARK, PS2_12_FN3, PTG4_FN), 858 PINMUX_DATA(MMCCMD_MARK, PS2_12_FN2, PTG4_FN),
759 PINMUX_DATA(SERIRQ_MARK, PTG3_FN), 859 PINMUX_DATA(SERIRQ_MARK, PTG3_FN),
760 PINMUX_DATA(CLKRUN_MARK, PTG2_FN), 860 PINMUX_DATA(WDTOVF_MARK, PTG2_FN),
761 PINMUX_DATA(LPCPD_MARK, PTG1_FN), 861 PINMUX_DATA(LPCPD_MARK, PTG1_FN),
762 PINMUX_DATA(LDRQ_MARK, PTG0_FN), 862 PINMUX_DATA(LDRQ_MARK, PTG0_FN),
763 863
764 /* PTH FN */ 864 /* PTH FN */
765 PINMUX_DATA(SP1_MOSI_MARK, PTH7_FN), 865 PINMUX_DATA(SP1_MOSI_MARK, PS2_7_FN1, PTH7_FN),
766 PINMUX_DATA(SP1_MISO_MARK, PTH6_FN), 866 PINMUX_DATA(TEND1_MARK, PS2_7_FN2, PTH7_FN),
767 PINMUX_DATA(SP1_SCK_MARK, PTH5_FN), 867 PINMUX_DATA(SP1_MISO_MARK, PS2_6_FN1, PTH6_FN),
768 PINMUX_DATA(SP1_SCK_FB_MARK, PTH4_FN), 868 PINMUX_DATA(DREQ1_MARK, PS2_6_FN2, PTH6_FN),
869 PINMUX_DATA(SP1_SCK_MARK, PS2_5_FN1, PTH5_FN),
870 PINMUX_DATA(DACK1_MARK, PS2_5_FN2, PTH5_FN),
871 PINMUX_DATA(SP1_SCK_FB_MARK, PS2_4_FN1, PTH4_FN),
872 PINMUX_DATA(ADTRG1_MARK, PS2_4_FN2, PTH4_FN),
769 PINMUX_DATA(SP1_SS0_MARK, PTH3_FN), 873 PINMUX_DATA(SP1_SS0_MARK, PTH3_FN),
770 PINMUX_DATA(TCLK_MARK, PTH2_FN), 874 PINMUX_DATA(SP1_SS1_MARK, PS2_2_FN1, PTH2_FN),
771 PINMUX_DATA(RXD4_MARK, PS2_1_FN1, PTH1_FN), 875 PINMUX_DATA(ADTRG0_MARK, PS2_2_FN2, PTH2_FN),
772 PINMUX_DATA(SP1_SS1_MARK, PS2_1_FN2, PTH1_FN), 876 PINMUX_DATA(WP_MARK, PTH1_FN),
773 PINMUX_DATA(TXD4_MARK, PS2_0_FN1, PTH0_FN), 877 PINMUX_DATA(FMS0_MARK, PTH0_FN),
774 PINMUX_DATA(SP0_SS1_MARK, PS2_0_FN2, PTH0_FN),
775 878
776 /* PTI FN */ 879 /* PTI FN */
777 PINMUX_DATA(IRQ15_MARK, PTI7_FN), 880 PINMUX_DATA(D15_MARK, PS3_15_FN1, PTI7_FN),
778 PINMUX_DATA(IRQ14_MARK, PTI6_FN), 881 PINMUX_DATA(SD_WP_MARK, PS3_15_FN2, PTI7_FN),
779 PINMUX_DATA(IRQ13_MARK, PTI5_FN), 882 PINMUX_DATA(D14_MARK, PS3_14_FN1, PTI6_FN),
780 PINMUX_DATA(IRQ12_MARK, PTI4_FN), 883 PINMUX_DATA(SD_CD_MARK, PS3_14_FN2, PTI6_FN),
781 PINMUX_DATA(IRQ11_MARK, PTI3_FN), 884 PINMUX_DATA(D13_MARK, PS3_13_FN1, PTI5_FN),
782 PINMUX_DATA(IRQ10_MARK, PTI2_FN), 885 PINMUX_DATA(SD_CLK_MARK, PS3_13_FN2, PTI5_FN),
783 PINMUX_DATA(IRQ9_MARK, PTI1_FN), 886 PINMUX_DATA(D12_MARK, PS3_12_FN1, PTI4_FN),
784 PINMUX_DATA(IRQ8_MARK, PTI0_FN), 887 PINMUX_DATA(SD_CMD_MARK, PS3_12_FN2, PTI4_FN),
888 PINMUX_DATA(D11_MARK, PS3_11_FN1, PTI3_FN),
889 PINMUX_DATA(SD_D3_MARK, PS3_11_FN2, PTI3_FN),
890 PINMUX_DATA(D10_MARK, PS3_10_FN1, PTI2_FN),
891 PINMUX_DATA(SD_D2_MARK, PS3_10_FN2, PTI2_FN),
892 PINMUX_DATA(D9_MARK, PS3_9_FN1, PTI1_FN),
893 PINMUX_DATA(SD_D1_MARK, PS3_9_FN2, PTI1_FN),
894 PINMUX_DATA(D8_MARK, PS3_8_FN1, PTI0_FN),
895 PINMUX_DATA(SD_D0_MARK, PS3_8_FN2, PTI0_FN),
785 896
786 /* PTJ FN */ 897 /* PTJ FN */
787 PINMUX_DATA(RXD3_MARK, PTJ7_FN), 898 PINMUX_DATA(RTS3_MARK, PTJ6_FN),
788 PINMUX_DATA(TXD3_MARK, PTJ6_FN), 899 PINMUX_DATA(CTS3_MARK, PTJ5_FN),
789 PINMUX_DATA(RXD2_MARK, PTJ5_FN), 900 PINMUX_DATA(TXD3_MARK, PTJ4_FN),
790 PINMUX_DATA(TXD2_MARK, PTJ4_FN), 901 PINMUX_DATA(RXD3_MARK, PTJ3_FN),
791 PINMUX_DATA(COM1_TXD_MARK, PTJ3_FN), 902 PINMUX_DATA(RTS4_MARK, PTJ2_FN),
792 PINMUX_DATA(COM1_RXD_MARK, PTJ2_FN), 903 PINMUX_DATA(RXD4_MARK, PTJ1_FN),
793 PINMUX_DATA(COM1_RTS_MARK, PTJ1_FN), 904 PINMUX_DATA(TXD4_MARK, PTJ0_FN),
794 PINMUX_DATA(COM1_CTS_MARK, PTJ0_FN),
795 905
796 /* PTK FN */ 906 /* PTK FN */
797 PINMUX_DATA(COM2_TXD_MARK, PTK7_FN), 907 PINMUX_DATA(COM2_TXD_MARK, PS3_7_FN1, PTK7_FN),
908 PINMUX_DATA(SCK2_MARK, PS3_7_FN2, PTK7_FN),
798 PINMUX_DATA(COM2_RXD_MARK, PTK6_FN), 909 PINMUX_DATA(COM2_RXD_MARK, PTK6_FN),
799 PINMUX_DATA(COM2_RTS_MARK, PTK5_FN), 910 PINMUX_DATA(COM2_RTS_MARK, PTK5_FN),
800 PINMUX_DATA(COM2_CTS_MARK, PTK4_FN), 911 PINMUX_DATA(COM2_CTS_MARK, PTK4_FN),
801 PINMUX_DATA(COM2_DTR_MARK, PTK3_FN), 912 PINMUX_DATA(COM2_DTR_MARK, PTK3_FN),
802 PINMUX_DATA(COM2_DSR_MARK, PTK2_FN), 913 PINMUX_DATA(COM2_DSR_MARK, PS3_2_FN1, PTK2_FN),
803 PINMUX_DATA(COM2_DCD_MARK, PTK1_FN), 914 PINMUX_DATA(SCK4_MARK, PS3_2_FN2, PTK2_FN),
804 PINMUX_DATA(COM2_RI_MARK, PTK0_FN), 915 PINMUX_DATA(COM2_DCD_MARK, PS3_1_FN1, PTK1_FN),
916 PINMUX_DATA(SCK3_MARK, PS3_1_FN2, PTK1_FN),
917 PINMUX_DATA(CLKOUT_MARK, PTK0_FN),
805 918
806 /* PTL FN */ 919 /* PTL FN */
807 PINMUX_DATA(RAC_TXD_MARK, PTL7_FN), 920 PINMUX_DATA(RAC_RXD_MARK, PS4_14_FN1, PTL6_FN),
808 PINMUX_DATA(RAC_RXD_MARK, PTL6_FN), 921 PINMUX_DATA(RXD2_MARK, PS4_14_FN2, PTL6_FN),
809 PINMUX_DATA(RAC_RTS_MARK, PTL5_FN), 922 PINMUX_DATA(RAC_RTS_MARK, PS4_13_FN1, PTL5_FN),
810 PINMUX_DATA(RAC_CTS_MARK, PTL4_FN), 923 PINMUX_DATA(CS5_MARK, PS4_13_FN2, PTL5_FN),
924 PINMUX_DATA(RAC_CTS_MARK, PS4_12_FN1, PTL4_FN),
925 PINMUX_DATA(CS6_MARK, PS4_12_FN2, PTL4_FN),
811 PINMUX_DATA(RAC_DTR_MARK, PTL3_FN), 926 PINMUX_DATA(RAC_DTR_MARK, PTL3_FN),
812 PINMUX_DATA(RAC_DSR_MARK, PTL2_FN), 927 PINMUX_DATA(RAC_DSR_MARK, PS4_10_FN1, PTL2_FN),
813 PINMUX_DATA(RAC_DCD_MARK, PTL1_FN), 928 PINMUX_DATA(AUDSYNC_MARK, PS4_10_FN2, PTL2_FN),
814 PINMUX_DATA(RAC_RI_MARK, PTL0_FN), 929 PINMUX_DATA(RAC_DCD_MARK, PS4_9_FN1, PTL1_FN),
930 PINMUX_DATA(AUDCK_MARK, PS4_9_FN2, PTL1_FN),
931 PINMUX_DATA(RAC_TXD_MARK, PS4_8_FN1, PTL0_FN),
932 PINMUX_DATA(TXD2_MARK, PS4_8_FN1, PTL0_FN),
815 933
816 /* PTM FN */ 934 /* PTM FN */
817 PINMUX_DATA(WP_MARK, PTM6_FN), 935 PINMUX_DATA(CS4_MARK, PTM7_FN),
818 PINMUX_DATA(FMS0_MARK, PTM5_FN), 936 PINMUX_DATA(RD_MARK, PTM6_FN),
819 PINMUX_DATA(FMS1_MARK, PTM4_FN), 937 PINMUX_DATA(WE0_MARK, PTM7_FN),
938 PINMUX_DATA(CS0_MARK, PTM4_FN),
820 PINMUX_DATA(SDA6_MARK, PTM3_FN), 939 PINMUX_DATA(SDA6_MARK, PTM3_FN),
821 PINMUX_DATA(SCL6_MARK, PTM2_FN), 940 PINMUX_DATA(SCL6_MARK, PTM2_FN),
822 PINMUX_DATA(SDA7_MARK, PTM1_FN), 941 PINMUX_DATA(SDA7_MARK, PTM1_FN),
823 PINMUX_DATA(SCL7_MARK, PTM0_FN), 942 PINMUX_DATA(SCL7_MARK, PTM0_FN),
824 943
825 /* PTN FN */ 944 /* PTN FN */
826 PINMUX_DATA(SCK2_MARK, PS4_15_FN1, PTN7_FN), 945 PINMUX_DATA(VBUS_EN_MARK, PTN6_FN),
827 PINMUX_DATA(EVENT7_MARK, PS4_15_FN2, PTN7_FN), 946 PINMUX_DATA(VBUS_OC_MARK, PTN5_FN),
828 PINMUX_DATA(RTS4_MARK, PS4_14_FN1, PTN6_FN), 947 PINMUX_DATA(JMCTCK_MARK, PS4_4_FN1, PTN4_FN),
829 PINMUX_DATA(EVENT6_MARK, PS4_14_FN2, PTN6_FN), 948 PINMUX_DATA(SGPIO1_CLK_MARK, PS4_4_FN2, PTN4_FN),
830 PINMUX_DATA(RTS3_MARK, PS4_13_FN1, PTN5_FN), 949 PINMUX_DATA(JMCTMS_MARK, PS4_3_FN1, PTN5_FN),
831 PINMUX_DATA(EVENT5_MARK, PS4_13_FN2, PTN5_FN), 950 PINMUX_DATA(SGPIO1_LOAD_MARK, PS4_3_FN2, PTN5_FN),
832 PINMUX_DATA(RTS2_MARK, PS4_12_FN1, PTN4_FN), 951 PINMUX_DATA(JMCTDO_MARK, PS4_2_FN1, PTN2_FN),
833 PINMUX_DATA(EVENT4_MARK, PS4_12_FN2, PTN4_FN), 952 PINMUX_DATA(SGPIO1_DO_MARK, PS4_2_FN2, PTN2_FN),
834 PINMUX_DATA(CTS4_MARK, PS4_11_FN1, PTN3_FN), 953 PINMUX_DATA(JMCTDI_MARK, PS4_1_FN1, PTN1_FN),
835 PINMUX_DATA(EVENT3_MARK, PS4_11_FN2, PTN3_FN), 954 PINMUX_DATA(SGPIO1_DI_MARK, PS4_1_FN2, PTN1_FN),
836 PINMUX_DATA(CTS3_MARK, PS4_10_FN1, PTN2_FN), 955 PINMUX_DATA(JMCTRST_MARK, PS4_0_FN1, PTN0_FN),
837 PINMUX_DATA(EVENT2_MARK, PS4_10_FN2, PTN2_FN), 956 PINMUX_DATA(SUB_CLKIN_MARK, PS4_0_FN2, PTN0_FN),
838 PINMUX_DATA(CTS2_MARK, PS4_9_FN1, PTN1_FN),
839 PINMUX_DATA(EVENT1_MARK, PS4_9_FN2, PTN1_FN),
840 PINMUX_DATA(EVENT0_MARK, PTN0_FN),
841 957
842 /* PTO FN */ 958 /* PTO FN */
843 PINMUX_DATA(SGPIO0_CLK_MARK, PTO7_FN), 959 PINMUX_DATA(SGPIO0_CLK_MARK, PTO7_FN),
844 PINMUX_DATA(SGPIO0_LOAD_MARK, PTO6_FN), 960 PINMUX_DATA(SGPIO0_LOAD_MARK, PTO6_FN),
845 PINMUX_DATA(SGPIO0_DI_MARK, PTO5_FN), 961 PINMUX_DATA(SGPIO0_DI_MARK, PTO5_FN),
846 PINMUX_DATA(SGPIO0_DO_MARK, PTO4_FN), 962 PINMUX_DATA(SGPIO0_DO_MARK, PTO4_FN),
847 PINMUX_DATA(SGPIO1_CLK_MARK, PTO3_FN), 963 PINMUX_DATA(SGPIO2_CLK_MARK, PS5_11_FN1, PTO3_FN),
848 PINMUX_DATA(SGPIO1_LOAD_MARK, PTO2_FN), 964 PINMUX_DATA(COM1_TXD_MARK, PS5_11_FN2, PTO3_FN),
849 PINMUX_DATA(SGPIO1_DI_MARK, PTO1_FN), 965 PINMUX_DATA(SGPIO2_LOAD_MARK, PS5_10_FN1, PTO2_FN),
850 PINMUX_DATA(SGPIO1_DO_MARK, PTO0_FN), 966 PINMUX_DATA(COM1_RXD_MARK, PS5_10_FN2, PTO2_FN),
967 PINMUX_DATA(SGPIO2_DI_MARK, PS5_9_FN1, PTO1_FN),
968 PINMUX_DATA(COM1_RTS_MARK, PS5_9_FN2, PTO1_FN),
969 PINMUX_DATA(SGPIO2_DO_MARK, PS5_8_FN1, PTO0_FN),
970 PINMUX_DATA(COM1_CTS_MARK, PS5_8_FN2, PTO0_FN),
851 971
852 /* PTP FN */ 972 /* PTP FN */
853 PINMUX_DATA(JMCTCK_MARK, PTP6_FN),
854 PINMUX_DATA(JMCTMS_MARK, PTP5_FN),
855 PINMUX_DATA(JMCTDO_MARK, PTP4_FN),
856 PINMUX_DATA(JMCTDI_MARK, PTP3_FN),
857 PINMUX_DATA(JMCRST_MARK, PTP2_FN),
858 PINMUX_DATA(SCK4_MARK, PTP1_FN),
859 PINMUX_DATA(SCK3_MARK, PTP0_FN),
860 973
861 /* PTQ FN */ 974 /* PTQ FN */
862 PINMUX_DATA(LAD3_MARK, PTQ6_FN), 975 PINMUX_DATA(LAD3_MARK, PTQ6_FN),
@@ -864,8 +977,8 @@ static pinmux_enum_t pinmux_data[] = {
864 PINMUX_DATA(LAD1_MARK, PTQ4_FN), 977 PINMUX_DATA(LAD1_MARK, PTQ4_FN),
865 PINMUX_DATA(LAD0_MARK, PTQ3_FN), 978 PINMUX_DATA(LAD0_MARK, PTQ3_FN),
866 PINMUX_DATA(LFRAME_MARK, PTQ2_FN), 979 PINMUX_DATA(LFRAME_MARK, PTQ2_FN),
867 PINMUX_DATA(SCK4_MARK, PTQ1_FN), 980 PINMUX_DATA(LRESET_MARK, PTQ1_FN),
868 PINMUX_DATA(SCK3_MARK, PTQ0_FN), 981 PINMUX_DATA(LCLK_MARK, PTQ0_FN),
869 982
870 /* PTR FN */ 983 /* PTR FN */
871 PINMUX_DATA(SDA8_MARK, PTR7_FN), /* DDC3? */ 984 PINMUX_DATA(SDA8_MARK, PTR7_FN), /* DDC3? */
@@ -888,58 +1001,84 @@ static pinmux_enum_t pinmux_data[] = {
888 PINMUX_DATA(SCL3_MARK, PTS0_FN), 1001 PINMUX_DATA(SCL3_MARK, PTS0_FN),
889 1002
890 /* PTT FN */ 1003 /* PTT FN */
891 PINMUX_DATA(AUDSYNC_MARK, PTS5_FN), 1004 PINMUX_DATA(PWMX7_MARK, PS5_7_FN1, PTT7_FN),
892 PINMUX_DATA(AUDCK_MARK, PTS4_FN), 1005 PINMUX_DATA(AUDATA3_MARK, PS5_7_FN2, PTT7_FN),
893 PINMUX_DATA(AUDATA3_MARK, PS4_3_FN1, PTS3_FN), 1006 PINMUX_DATA(PWMX6_MARK, PS5_6_FN1, PTT6_FN),
894 PINMUX_DATA(PWX7_MARK, PS4_3_FN2, PTS3_FN), 1007 PINMUX_DATA(AUDATA2_MARK, PS5_6_FN2, PTT6_FN),
895 PINMUX_DATA(AUDATA2_MARK, PS4_2_FN1, PTS2_FN), 1008 PINMUX_DATA(PWMX5_MARK, PS5_5_FN1, PTT5_FN),
896 PINMUX_DATA(PWX6_MARK, PS4_2_FN2, PTS2_FN), 1009 PINMUX_DATA(AUDATA1_MARK, PS5_5_FN2, PTT5_FN),
897 PINMUX_DATA(AUDATA1_MARK, PS4_1_FN1, PTS1_FN), 1010 PINMUX_DATA(PWMX4_MARK, PS5_4_FN1, PTT4_FN),
898 PINMUX_DATA(PWX5_MARK, PS4_1_FN2, PTS1_FN), 1011 PINMUX_DATA(AUDATA0_MARK, PS5_4_FN2, PTT4_FN),
899 PINMUX_DATA(AUDATA0_MARK, PS4_0_FN1, PTS0_FN), 1012 PINMUX_DATA(PWMX3_MARK, PS5_3_FN1, PTT3_FN),
900 PINMUX_DATA(PWX4_MARK, PS4_0_FN2, PTS0_FN), 1013 PINMUX_DATA(STATUS1_MARK, PS5_3_FN2, PTT3_FN),
1014 PINMUX_DATA(PWMX2_MARK, PS5_2_FN1, PTT2_FN),
1015 PINMUX_DATA(STATUS0_MARK, PS5_2_FN2, PTT2_FN),
1016 PINMUX_DATA(PWMX1_MARK, PTT1_FN),
1017 PINMUX_DATA(PWMX0_MARK, PTT0_FN),
901 1018
902 /* PTU FN */ 1019 /* PTU FN */
903 PINMUX_DATA(CS6_MARK, PTU7_FN), 1020 PINMUX_DATA(LGPIO7_MARK, PS6_15_FN1, PTU7_FN),
904 PINMUX_DATA(CS5_MARK, PTU6_FN), 1021 PINMUX_DATA(APMONCTL_O_MARK, PS6_15_FN2, PTU7_FN),
905 PINMUX_DATA(CS4_MARK, PTU5_FN), 1022 PINMUX_DATA(LGPIO6_MARK, PS6_14_FN1, PTU6_FN),
906 PINMUX_DATA(CS0_MARK, PTU4_FN), 1023 PINMUX_DATA(APMPWBTOUT_O_MARK, PS6_14_FN2, PTU6_FN),
907 PINMUX_DATA(RD_MARK, PTU3_FN), 1024 PINMUX_DATA(LGPIO5_MARK, PS6_13_FN1, PTU5_FN),
908 PINMUX_DATA(WE0_MARK, PTU2_FN), 1025 PINMUX_DATA(APMSCI_O_MARK, PS6_13_FN2, PTU5_FN),
909 PINMUX_DATA(A25_MARK, PS5_9_FN1, PTU1_FN), 1026 PINMUX_DATA(LGPIO4_MARK, PS6_12_FN1, PTU4_FN),
910 PINMUX_DATA(DREQ0_MARK, PS5_9_FN2, PTU1_FN), 1027 PINMUX_DATA(APMVDDON_MARK, PS6_12_FN2, PTU4_FN),
911 PINMUX_DATA(A24_MARK, PS5_8_FN1, PTU0_FN), 1028 PINMUX_DATA(LGPIO3_MARK, PS6_11_FN1, PTU3_FN),
912 PINMUX_DATA(DACK0_MARK, PS5_8_FN2, PTU0_FN), 1029 PINMUX_DATA(APMSLPBTN_MARK, PS6_11_FN2, PTU3_FN),
1030 PINMUX_DATA(LGPIO2_MARK, PS6_10_FN1, PTU2_FN),
1031 PINMUX_DATA(APMPWRBTN_MARK, PS6_10_FN2, PTU2_FN),
1032 PINMUX_DATA(LGPIO1_MARK, PS6_9_FN1, PTU1_FN),
1033 PINMUX_DATA(APMS5N_MARK, PS6_9_FN2, PTU1_FN),
1034 PINMUX_DATA(LGPIO0_MARK, PS6_8_FN1, PTU0_FN),
1035 PINMUX_DATA(APMS3N_MARK, PS6_8_FN2, PTU0_FN),
913 1036
914 /* PTV FN */ 1037 /* PTV FN */
915 PINMUX_DATA(A23_MARK, PS5_7_FN1, PTV7_FN), 1038 PINMUX_DATA(A23_MARK, PS6_7_FN1, PTV7_FN),
916 PINMUX_DATA(TEND0_MARK, PS5_7_FN2, PTV7_FN), 1039 PINMUX_DATA(COM2_RI_MARK, PS6_7_FN2, PTV7_FN),
917 PINMUX_DATA(A22_MARK, PS5_6_FN1, PTV6_FN), 1040 PINMUX_DATA(A22_MARK, PS6_6_FN1, PTV6_FN),
918 PINMUX_DATA(DREQ1_MARK, PS5_6_FN2, PTV6_FN), 1041 PINMUX_DATA(R_SPI_MOSI_MARK, PS6_6_FN2, PTV6_FN),
919 PINMUX_DATA(A21_MARK, PS5_5_FN1, PTV5_FN), 1042 PINMUX_DATA(A21_MARK, PS6_5_FN1, PTV5_FN),
920 PINMUX_DATA(DACK1_MARK, PS5_5_FN2, PTV5_FN), 1043 PINMUX_DATA(R_SPI_MISO_MARK, PS6_5_FN2, PTV5_FN),
921 PINMUX_DATA(A20_MARK, PS5_4_FN1, PTV4_FN), 1044 PINMUX_DATA(A20_MARK, PS6_4_FN1, PTV4_FN),
922 PINMUX_DATA(TEND1_MARK, PS5_4_FN2, PTV4_FN), 1045 PINMUX_DATA(R_SPI_RSPCK_MARK, PS6_4_FN2, PTV4_FN),
923 PINMUX_DATA(A19_MARK, PTV3_FN), 1046 PINMUX_DATA(A19_MARK, PS6_3_FN1, PTV3_FN),
924 PINMUX_DATA(A18_MARK, PTV2_FN), 1047 PINMUX_DATA(R_SPI_SSL0_MARK, PS6_3_FN2, PTV3_FN),
925 PINMUX_DATA(A17_MARK, PTV1_FN), 1048 PINMUX_DATA(A18_MARK, PS6_2_FN1, PTV2_FN),
926 PINMUX_DATA(A16_MARK, PTV0_FN), 1049 PINMUX_DATA(R_SPI_SSL1_MARK, PS6_2_FN2, PTV2_FN),
1050 PINMUX_DATA(A17_MARK, PS6_1_FN1, PTV1_FN),
1051 PINMUX_DATA(EVENT7_MARK, PS6_1_FN2, PTV1_FN),
1052 PINMUX_DATA(A16_MARK, PS6_0_FN1, PTV0_FN),
1053 PINMUX_DATA(EVENT6_MARK, PS6_0_FN1, PTV0_FN),
927 1054
928 /* PTW FN */ 1055 /* PTW FN */
929 PINMUX_DATA(A15_MARK, PTW7_FN), 1056 PINMUX_DATA(A15_MARK, PS7_15_FN1, PTW7_FN),
930 PINMUX_DATA(A14_MARK, PTW6_FN), 1057 PINMUX_DATA(EVENT5_MARK, PS7_15_FN2, PTW7_FN),
931 PINMUX_DATA(A13_MARK, PTW5_FN), 1058 PINMUX_DATA(A14_MARK, PS7_14_FN1, PTW6_FN),
932 PINMUX_DATA(A12_MARK, PTW4_FN), 1059 PINMUX_DATA(EVENT4_MARK, PS7_14_FN2, PTW6_FN),
933 PINMUX_DATA(A11_MARK, PTW3_FN), 1060 PINMUX_DATA(A13_MARK, PS7_13_FN1, PTW5_FN),
934 PINMUX_DATA(A10_MARK, PTW2_FN), 1061 PINMUX_DATA(EVENT3_MARK, PS7_13_FN2, PTW5_FN),
935 PINMUX_DATA(A9_MARK, PTW1_FN), 1062 PINMUX_DATA(A12_MARK, PS7_12_FN1, PTW4_FN),
936 PINMUX_DATA(A8_MARK, PTW0_FN), 1063 PINMUX_DATA(EVENT2_MARK, PS7_12_FN2, PTW4_FN),
1064 PINMUX_DATA(A11_MARK, PS7_11_FN1, PTW3_FN),
1065 PINMUX_DATA(EVENT1_MARK, PS7_11_FN2, PTW3_FN),
1066 PINMUX_DATA(A10_MARK, PS7_10_FN1, PTW2_FN),
1067 PINMUX_DATA(EVENT0_MARK, PS7_10_FN2, PTW2_FN),
1068 PINMUX_DATA(A9_MARK, PS7_9_FN1, PTW1_FN),
1069 PINMUX_DATA(CTS4_MARK, PS7_9_FN2, PTW1_FN),
1070 PINMUX_DATA(A8_MARK, PS7_8_FN1, PTW0_FN),
1071 PINMUX_DATA(CTS2_MARK, PS7_8_FN2, PTW0_FN),
937 1072
938 /* PTX FN */ 1073 /* PTX FN */
939 PINMUX_DATA(A7_MARK, PTX7_FN), 1074 PINMUX_DATA(A7_MARK, PS7_7_FN1, PTX7_FN),
940 PINMUX_DATA(A6_MARK, PTX6_FN), 1075 PINMUX_DATA(RTS2_MARK, PS7_7_FN2, PTX7_FN),
941 PINMUX_DATA(A5_MARK, PTX5_FN), 1076 PINMUX_DATA(A6_MARK, PS7_6_FN1, PTX6_FN),
942 PINMUX_DATA(A4_MARK, PTX4_FN), 1077 PINMUX_DATA(SIM_D_MARK, PS7_6_FN2, PTX6_FN),
1078 PINMUX_DATA(A5_MARK, PS7_5_FN1, PTX5_FN),
1079 PINMUX_DATA(SIM_CLK_MARK, PS7_5_FN2, PTX5_FN),
1080 PINMUX_DATA(A4_MARK, PS7_4_FN1, PTX4_FN),
1081 PINMUX_DATA(SIM_RST_MARK, PS7_4_FN2, PTX4_FN),
943 PINMUX_DATA(A3_MARK, PTX3_FN), 1082 PINMUX_DATA(A3_MARK, PTX3_FN),
944 PINMUX_DATA(A2_MARK, PTX2_FN), 1083 PINMUX_DATA(A2_MARK, PTX2_FN),
945 PINMUX_DATA(A1_MARK, PTX1_FN), 1084 PINMUX_DATA(A1_MARK, PTX1_FN),
@@ -954,6 +1093,24 @@ static pinmux_enum_t pinmux_data[] = {
954 PINMUX_DATA(D2_MARK, PTY2_FN), 1093 PINMUX_DATA(D2_MARK, PTY2_FN),
955 PINMUX_DATA(D1_MARK, PTY1_FN), 1094 PINMUX_DATA(D1_MARK, PTY1_FN),
956 PINMUX_DATA(D0_MARK, PTY0_FN), 1095 PINMUX_DATA(D0_MARK, PTY0_FN),
1096
1097 /* PTZ FN */
1098 PINMUX_DATA(MMCDAT7_MARK, PS8_15_FN1, PTZ7_FN),
1099 PINMUX_DATA(ON_DQ7_MARK, PS8_15_FN2, PTZ7_FN),
1100 PINMUX_DATA(MMCDAT6_MARK, PS8_14_FN1, PTZ6_FN),
1101 PINMUX_DATA(ON_DQ6_MARK, PS8_14_FN2, PTZ6_FN),
1102 PINMUX_DATA(MMCDAT5_MARK, PS8_13_FN1, PTZ5_FN),
1103 PINMUX_DATA(ON_DQ5_MARK, PS8_13_FN2, PTZ5_FN),
1104 PINMUX_DATA(MMCDAT4_MARK, PS8_12_FN1, PTZ4_FN),
1105 PINMUX_DATA(ON_DQ4_MARK, PS8_12_FN2, PTZ4_FN),
1106 PINMUX_DATA(MMCDAT3_MARK, PS8_11_FN1, PTZ3_FN),
1107 PINMUX_DATA(ON_DQ3_MARK, PS8_11_FN2, PTZ3_FN),
1108 PINMUX_DATA(MMCDAT2_MARK, PS8_10_FN1, PTZ2_FN),
1109 PINMUX_DATA(ON_DQ2_MARK, PS8_10_FN2, PTZ2_FN),
1110 PINMUX_DATA(MMCDAT1_MARK, PS8_9_FN1, PTZ1_FN),
1111 PINMUX_DATA(ON_DQ1_MARK, PS8_9_FN2, PTZ1_FN),
1112 PINMUX_DATA(MMCDAT0_MARK, PS8_8_FN1, PTZ0_FN),
1113 PINMUX_DATA(ON_DQ0_MARK, PS8_8_FN2, PTZ0_FN),
957}; 1114};
958 1115
959static struct pinmux_gpio pinmux_gpios[] = { 1116static struct pinmux_gpio pinmux_gpios[] = {
@@ -1048,7 +1205,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1048 PINMUX_GPIO(GPIO_PTI0, PTI0_DATA), 1205 PINMUX_GPIO(GPIO_PTI0, PTI0_DATA),
1049 1206
1050 /* PTJ */ 1207 /* PTJ */
1051 PINMUX_GPIO(GPIO_PTJ7, PTJ7_DATA),
1052 PINMUX_GPIO(GPIO_PTJ6, PTJ6_DATA), 1208 PINMUX_GPIO(GPIO_PTJ6, PTJ6_DATA),
1053 PINMUX_GPIO(GPIO_PTJ5, PTJ5_DATA), 1209 PINMUX_GPIO(GPIO_PTJ5, PTJ5_DATA),
1054 PINMUX_GPIO(GPIO_PTJ4, PTJ4_DATA), 1210 PINMUX_GPIO(GPIO_PTJ4, PTJ4_DATA),
@@ -1068,7 +1224,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1068 PINMUX_GPIO(GPIO_PTK0, PTK0_DATA), 1224 PINMUX_GPIO(GPIO_PTK0, PTK0_DATA),
1069 1225
1070 /* PTL */ 1226 /* PTL */
1071 PINMUX_GPIO(GPIO_PTL7, PTL7_DATA),
1072 PINMUX_GPIO(GPIO_PTL6, PTL6_DATA), 1227 PINMUX_GPIO(GPIO_PTL6, PTL6_DATA),
1073 PINMUX_GPIO(GPIO_PTL5, PTL5_DATA), 1228 PINMUX_GPIO(GPIO_PTL5, PTL5_DATA),
1074 PINMUX_GPIO(GPIO_PTL4, PTL4_DATA), 1229 PINMUX_GPIO(GPIO_PTL4, PTL4_DATA),
@@ -1078,6 +1233,7 @@ static struct pinmux_gpio pinmux_gpios[] = {
1078 PINMUX_GPIO(GPIO_PTL0, PTL0_DATA), 1233 PINMUX_GPIO(GPIO_PTL0, PTL0_DATA),
1079 1234
1080 /* PTM */ 1235 /* PTM */
1236 PINMUX_GPIO(GPIO_PTM7, PTM7_DATA),
1081 PINMUX_GPIO(GPIO_PTM6, PTM6_DATA), 1237 PINMUX_GPIO(GPIO_PTM6, PTM6_DATA),
1082 PINMUX_GPIO(GPIO_PTM5, PTM5_DATA), 1238 PINMUX_GPIO(GPIO_PTM5, PTM5_DATA),
1083 PINMUX_GPIO(GPIO_PTM4, PTM4_DATA), 1239 PINMUX_GPIO(GPIO_PTM4, PTM4_DATA),
@@ -1087,7 +1243,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
1087 PINMUX_GPIO(GPIO_PTM0, PTM0_DATA), 1243 PINMUX_GPIO(GPIO_PTM0, PTM0_DATA),
1088 1244
1089 /* PTN */ 1245 /* PTN */
1090 PINMUX_GPIO(GPIO_PTN7, PTN7_DATA),
1091 PINMUX_GPIO(GPIO_PTN6, PTN6_DATA), 1246 PINMUX_GPIO(GPIO_PTN6, PTN6_DATA),
1092 PINMUX_GPIO(GPIO_PTN5, PTN5_DATA), 1247 PINMUX_GPIO(GPIO_PTN5, PTN5_DATA),
1093 PINMUX_GPIO(GPIO_PTN4, PTN4_DATA), 1248 PINMUX_GPIO(GPIO_PTN4, PTN4_DATA),
@@ -1107,6 +1262,7 @@ static struct pinmux_gpio pinmux_gpios[] = {
1107 PINMUX_GPIO(GPIO_PTO0, PTO0_DATA), 1262 PINMUX_GPIO(GPIO_PTO0, PTO0_DATA),
1108 1263
1109 /* PTP */ 1264 /* PTP */
1265 PINMUX_GPIO(GPIO_PTP7, PTP7_DATA),
1110 PINMUX_GPIO(GPIO_PTP6, PTP6_DATA), 1266 PINMUX_GPIO(GPIO_PTP6, PTP6_DATA),
1111 PINMUX_GPIO(GPIO_PTP5, PTP5_DATA), 1267 PINMUX_GPIO(GPIO_PTP5, PTP5_DATA),
1112 PINMUX_GPIO(GPIO_PTP4, PTP4_DATA), 1268 PINMUX_GPIO(GPIO_PTP4, PTP4_DATA),
@@ -1145,6 +1301,8 @@ static struct pinmux_gpio pinmux_gpios[] = {
1145 PINMUX_GPIO(GPIO_PTS0, PTS0_DATA), 1301 PINMUX_GPIO(GPIO_PTS0, PTS0_DATA),
1146 1302
1147 /* PTT */ 1303 /* PTT */
1304 PINMUX_GPIO(GPIO_PTT7, PTT7_DATA),
1305 PINMUX_GPIO(GPIO_PTT6, PTT6_DATA),
1148 PINMUX_GPIO(GPIO_PTT5, PTT5_DATA), 1306 PINMUX_GPIO(GPIO_PTT5, PTT5_DATA),
1149 PINMUX_GPIO(GPIO_PTT4, PTT4_DATA), 1307 PINMUX_GPIO(GPIO_PTT4, PTT4_DATA),
1150 PINMUX_GPIO(GPIO_PTT3, PTT3_DATA), 1308 PINMUX_GPIO(GPIO_PTT3, PTT3_DATA),
@@ -1212,54 +1370,35 @@ static struct pinmux_gpio pinmux_gpios[] = {
1212 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA), 1370 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
1213 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA), 1371 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA),
1214 1372
1215 /* PTA (mobule: LBSC, CPG, LPC) */ 1373 /* PTA (mobule: LBSC, RGMII) */
1216 PINMUX_GPIO(GPIO_FN_BS, BS_MARK), 1374 PINMUX_GPIO(GPIO_FN_BS, BS_MARK),
1217 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK), 1375 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK),
1218 PINMUX_GPIO(GPIO_FN_WE1, WE1_MARK), 1376 PINMUX_GPIO(GPIO_FN_WE1, WE1_MARK),
1219 PINMUX_GPIO(GPIO_FN_RDY, RDY_MARK), 1377 PINMUX_GPIO(GPIO_FN_RDY, RDY_MARK),
1220 PINMUX_GPIO(GPIO_FN_MD10, MD10_MARK),
1221 PINMUX_GPIO(GPIO_FN_MD9, MD9_MARK),
1222 PINMUX_GPIO(GPIO_FN_MD8, MD8_MARK),
1223 PINMUX_GPIO(GPIO_FN_LGPIO7, LGPIO7_MARK),
1224 PINMUX_GPIO(GPIO_FN_LGPIO6, LGPIO6_MARK),
1225 PINMUX_GPIO(GPIO_FN_LGPIO5, LGPIO5_MARK),
1226 PINMUX_GPIO(GPIO_FN_LGPIO4, LGPIO4_MARK),
1227 PINMUX_GPIO(GPIO_FN_LGPIO3, LGPIO3_MARK),
1228 PINMUX_GPIO(GPIO_FN_LGPIO2, LGPIO2_MARK),
1229 PINMUX_GPIO(GPIO_FN_LGPIO1, LGPIO1_MARK),
1230 PINMUX_GPIO(GPIO_FN_LGPIO0, LGPIO0_MARK),
1231
1232 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
1233 PINMUX_GPIO(GPIO_FN_D15, D15_MARK),
1234 PINMUX_GPIO(GPIO_FN_D14, D14_MARK),
1235 PINMUX_GPIO(GPIO_FN_D13, D13_MARK),
1236 PINMUX_GPIO(GPIO_FN_D12, D12_MARK),
1237 PINMUX_GPIO(GPIO_FN_D11, D11_MARK),
1238 PINMUX_GPIO(GPIO_FN_D10, D10_MARK),
1239 PINMUX_GPIO(GPIO_FN_D9, D9_MARK),
1240 PINMUX_GPIO(GPIO_FN_D8, D8_MARK),
1241 PINMUX_GPIO(GPIO_FN_ET0_MDC, ET0_MDC_MARK), 1378 PINMUX_GPIO(GPIO_FN_ET0_MDC, ET0_MDC_MARK),
1242 PINMUX_GPIO(GPIO_FN_ET0_MDIO, ET0_MDIO_MARK), 1379 PINMUX_GPIO(GPIO_FN_ET0_MDIO, ET0_MDC_MARK),
1243 PINMUX_GPIO(GPIO_FN_ET1_MDC, ET1_MDC_MARK), 1380 PINMUX_GPIO(GPIO_FN_ET1_MDC, ET1_MDC_MARK),
1244 PINMUX_GPIO(GPIO_FN_ET1_MDIO, ET1_MDIO_MARK), 1381 PINMUX_GPIO(GPIO_FN_ET1_MDIO, ET1_MDC_MARK),
1245 PINMUX_GPIO(GPIO_FN_WPSZ1, WPSZ1_MARK),
1246 PINMUX_GPIO(GPIO_FN_WPSZ0, WPSZ0_MARK),
1247 PINMUX_GPIO(GPIO_FN_FWID, FWID_MARK),
1248 PINMUX_GPIO(GPIO_FN_FLSHSZ, FLSHSZ_MARK),
1249 PINMUX_GPIO(GPIO_FN_LPC_SPIEN, LPC_SPIEN_MARK),
1250 PINMUX_GPIO(GPIO_FN_BASEL, BASEL_MARK),
1251
1252 /* PTC (mobule: SD) */
1253 PINMUX_GPIO(GPIO_FN_SD_WP, SD_WP_MARK),
1254 PINMUX_GPIO(GPIO_FN_SD_CD, SD_CD_MARK),
1255 PINMUX_GPIO(GPIO_FN_SD_CLK, SD_CLK_MARK),
1256 PINMUX_GPIO(GPIO_FN_SD_CMD, SD_CMD_MARK),
1257 PINMUX_GPIO(GPIO_FN_SD_D3, SD_D3_MARK),
1258 PINMUX_GPIO(GPIO_FN_SD_D2, SD_D2_MARK),
1259 PINMUX_GPIO(GPIO_FN_SD_D1, SD_D1_MARK),
1260 PINMUX_GPIO(GPIO_FN_SD_D0, SD_D0_MARK),
1261 1382
1262 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */ 1383 /* PTB (mobule: INTC, ONFI, TMU) */
1384 PINMUX_GPIO(GPIO_FN_IRQ15, IRQ15_MARK),
1385 PINMUX_GPIO(GPIO_FN_IRQ14, IRQ14_MARK),
1386 PINMUX_GPIO(GPIO_FN_IRQ13, IRQ13_MARK),
1387 PINMUX_GPIO(GPIO_FN_IRQ12, IRQ12_MARK),
1388 PINMUX_GPIO(GPIO_FN_IRQ11, IRQ11_MARK),
1389 PINMUX_GPIO(GPIO_FN_IRQ10, IRQ10_MARK),
1390 PINMUX_GPIO(GPIO_FN_IRQ9, IRQ9_MARK),
1391 PINMUX_GPIO(GPIO_FN_IRQ8, IRQ8_MARK),
1392 PINMUX_GPIO(GPIO_FN_ON_NRE, ON_NRE_MARK),
1393 PINMUX_GPIO(GPIO_FN_ON_NWE, ON_NWE_MARK),
1394 PINMUX_GPIO(GPIO_FN_ON_NWP, ON_NWP_MARK),
1395 PINMUX_GPIO(GPIO_FN_ON_NCE0, ON_NCE0_MARK),
1396 PINMUX_GPIO(GPIO_FN_ON_R_B0, ON_R_B0_MARK),
1397 PINMUX_GPIO(GPIO_FN_ON_ALE, ON_ALE_MARK),
1398 PINMUX_GPIO(GPIO_FN_ON_CLE, ON_CLE_MARK),
1399 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK),
1400
1401 /* PTC (mobule: IRQ, PWMU) */
1263 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK), 1402 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK),
1264 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK), 1403 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK),
1265 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK), 1404 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK),
@@ -1268,80 +1407,102 @@ static struct pinmux_gpio pinmux_gpios[] = {
1268 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK), 1407 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK),
1269 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK), 1408 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK),
1270 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK), 1409 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK),
1271 PINMUX_GPIO(GPIO_FN_MD6, MD6_MARK), 1410 PINMUX_GPIO(GPIO_FN_PWMU0, PWMU0_MARK),
1272 PINMUX_GPIO(GPIO_FN_MD5, MD5_MARK), 1411 PINMUX_GPIO(GPIO_FN_PWMU1, PWMU1_MARK),
1273 PINMUX_GPIO(GPIO_FN_MD3, MD3_MARK), 1412 PINMUX_GPIO(GPIO_FN_PWMU2, PWMU2_MARK),
1274 PINMUX_GPIO(GPIO_FN_MD2, MD2_MARK), 1413 PINMUX_GPIO(GPIO_FN_PWMU3, PWMU3_MARK),
1275 PINMUX_GPIO(GPIO_FN_MD1, MD1_MARK), 1414 PINMUX_GPIO(GPIO_FN_PWMU4, PWMU4_MARK),
1276 PINMUX_GPIO(GPIO_FN_MD0, MD0_MARK), 1415 PINMUX_GPIO(GPIO_FN_PWMU5, PWMU5_MARK),
1277 PINMUX_GPIO(GPIO_FN_ADTRG1, ADTRG1_MARK), 1416
1278 PINMUX_GPIO(GPIO_FN_ADTRG0, ADTRG0_MARK), 1417 /* PTD (mobule: SPI0, DMAC) */
1418 PINMUX_GPIO(GPIO_FN_SP0_MOSI, SP0_MOSI_MARK),
1419 PINMUX_GPIO(GPIO_FN_SP0_MISO, SP0_MISO_MARK),
1420 PINMUX_GPIO(GPIO_FN_SP0_SCK, SP0_SCK_MARK),
1421 PINMUX_GPIO(GPIO_FN_SP0_SCK_FB, SP0_SCK_FB_MARK),
1422 PINMUX_GPIO(GPIO_FN_SP0_SS0, SP0_SS0_MARK),
1423 PINMUX_GPIO(GPIO_FN_SP0_SS1, SP0_SS1_MARK),
1424 PINMUX_GPIO(GPIO_FN_SP0_SS2, SP0_SS2_MARK),
1425 PINMUX_GPIO(GPIO_FN_SP0_SS3, SP0_SS3_MARK),
1426 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK),
1427 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK),
1428 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK),
1279 1429
1280 /* PTE (mobule: EtherC) */ 1430 /* PTE (mobule: RMII) */
1281 PINMUX_GPIO(GPIO_FN_ET0_CRS_DV, ET0_CRS_DV_MARK), 1431 PINMUX_GPIO(GPIO_FN_RMII0_CRS_DV, RMII0_CRS_DV_MARK),
1282 PINMUX_GPIO(GPIO_FN_ET0_TXD1, ET0_TXD1_MARK), 1432 PINMUX_GPIO(GPIO_FN_RMII0_TXD1, RMII0_TXD1_MARK),
1283 PINMUX_GPIO(GPIO_FN_ET0_TXD0, ET0_TXD0_MARK), 1433 PINMUX_GPIO(GPIO_FN_RMII0_TXD0, RMII0_TXD0_MARK),
1284 PINMUX_GPIO(GPIO_FN_ET0_TX_EN, ET0_TX_EN_MARK), 1434 PINMUX_GPIO(GPIO_FN_RMII0_TXEN, RMII0_TXEN_MARK),
1285 PINMUX_GPIO(GPIO_FN_ET0_REF_CLK, ET0_REF_CLK_MARK), 1435 PINMUX_GPIO(GPIO_FN_RMII0_REFCLK, RMII0_REFCLK_MARK),
1286 PINMUX_GPIO(GPIO_FN_ET0_RXD1, ET0_RXD1_MARK), 1436 PINMUX_GPIO(GPIO_FN_RMII0_RXD1, RMII0_RXD1_MARK),
1287 PINMUX_GPIO(GPIO_FN_ET0_RXD0, ET0_RXD0_MARK), 1437 PINMUX_GPIO(GPIO_FN_RMII0_RXD0, RMII0_RXD0_MARK),
1288 PINMUX_GPIO(GPIO_FN_ET0_RX_ER, ET0_RX_ER_MARK), 1438 PINMUX_GPIO(GPIO_FN_RMII0_RX_ER, RMII0_RX_ER_MARK),
1289 1439
1290 /* PTF (mobule: EtherC) */ 1440 /* PTF (mobule: RMII, SerMux) */
1291 PINMUX_GPIO(GPIO_FN_ET1_CRS_DV, ET1_CRS_DV_MARK), 1441 PINMUX_GPIO(GPIO_FN_RMII1_CRS_DV, RMII1_CRS_DV_MARK),
1292 PINMUX_GPIO(GPIO_FN_ET1_TXD1, ET1_TXD1_MARK), 1442 PINMUX_GPIO(GPIO_FN_RMII1_TXD1, RMII1_TXD1_MARK),
1293 PINMUX_GPIO(GPIO_FN_ET1_TXD0, ET1_TXD0_MARK), 1443 PINMUX_GPIO(GPIO_FN_RMII1_TXD0, RMII1_TXD0_MARK),
1294 PINMUX_GPIO(GPIO_FN_ET1_TX_EN, ET1_TX_EN_MARK), 1444 PINMUX_GPIO(GPIO_FN_RMII1_TXEN, RMII1_TXEN_MARK),
1295 PINMUX_GPIO(GPIO_FN_ET1_REF_CLK, ET1_REF_CLK_MARK), 1445 PINMUX_GPIO(GPIO_FN_RMII1_REFCLK, RMII1_REFCLK_MARK),
1296 PINMUX_GPIO(GPIO_FN_ET1_RXD1, ET1_RXD1_MARK), 1446 PINMUX_GPIO(GPIO_FN_RMII1_RXD1, RMII1_RXD1_MARK),
1297 PINMUX_GPIO(GPIO_FN_ET1_RXD0, ET1_RXD0_MARK), 1447 PINMUX_GPIO(GPIO_FN_RMII1_RXD0, RMII1_RXD0_MARK),
1298 PINMUX_GPIO(GPIO_FN_ET1_RX_ER, ET1_RX_ER_MARK), 1448 PINMUX_GPIO(GPIO_FN_RMII1_RX_ER, RMII1_RX_ER_MARK),
1299 1449 PINMUX_GPIO(GPIO_FN_RAC_RI, RAC_RI_MARK),
1300 /* PTG (mobule: SYSTEM, PWMX, LPC) */ 1450
1301 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK), 1451 /* PTG (mobule: system, LBSC, LPC, WDT, LPC, eMMC) */
1302 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK), 1452 PINMUX_GPIO(GPIO_FN_BOOTFMS, BOOTFMS_MARK),
1303 PINMUX_GPIO(GPIO_FN_PWX0, PWX0_MARK), 1453 PINMUX_GPIO(GPIO_FN_BOOTWP, BOOTWP_MARK),
1304 PINMUX_GPIO(GPIO_FN_PWX1, PWX1_MARK), 1454 PINMUX_GPIO(GPIO_FN_A25, A25_MARK),
1305 PINMUX_GPIO(GPIO_FN_PWX2, PWX2_MARK), 1455 PINMUX_GPIO(GPIO_FN_A24, A24_MARK),
1306 PINMUX_GPIO(GPIO_FN_PWX3, PWX3_MARK),
1307 PINMUX_GPIO(GPIO_FN_SERIRQ, SERIRQ_MARK), 1456 PINMUX_GPIO(GPIO_FN_SERIRQ, SERIRQ_MARK),
1308 PINMUX_GPIO(GPIO_FN_CLKRUN, CLKRUN_MARK), 1457 PINMUX_GPIO(GPIO_FN_WDTOVF, WDTOVF_MARK),
1309 PINMUX_GPIO(GPIO_FN_LPCPD, LPCPD_MARK), 1458 PINMUX_GPIO(GPIO_FN_LPCPD, LPCPD_MARK),
1310 PINMUX_GPIO(GPIO_FN_LDRQ, LDRQ_MARK), 1459 PINMUX_GPIO(GPIO_FN_LDRQ, LDRQ_MARK),
1460 PINMUX_GPIO(GPIO_FN_MMCCLK, MMCCLK_MARK),
1461 PINMUX_GPIO(GPIO_FN_MMCCMD, MMCCMD_MARK),
1311 1462
1312 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */ 1463 /* PTH (mobule: SPI1, LPC, DMAC, ADC) */
1313 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK),
1314 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK),
1315 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK),
1316 PINMUX_GPIO(GPIO_FN_SP1_MOSI, SP1_MOSI_MARK), 1464 PINMUX_GPIO(GPIO_FN_SP1_MOSI, SP1_MOSI_MARK),
1317 PINMUX_GPIO(GPIO_FN_SP1_MISO, SP1_MISO_MARK), 1465 PINMUX_GPIO(GPIO_FN_SP1_MISO, SP1_MISO_MARK),
1318 PINMUX_GPIO(GPIO_FN_SP1_SCK, SP1_SCK_MARK), 1466 PINMUX_GPIO(GPIO_FN_SP1_SCK, SP1_SCK_MARK),
1319 PINMUX_GPIO(GPIO_FN_SP1_SCK_FB, SP1_SCK_FB_MARK), 1467 PINMUX_GPIO(GPIO_FN_SP1_SCK_FB, SP1_SCK_FB_MARK),
1320 PINMUX_GPIO(GPIO_FN_SP1_SS0, SP1_SS0_MARK), 1468 PINMUX_GPIO(GPIO_FN_SP1_SS0, SP1_SS0_MARK),
1321 PINMUX_GPIO(GPIO_FN_SP1_SS1, SP1_SS1_MARK), 1469 PINMUX_GPIO(GPIO_FN_SP1_SS1, SP1_SS1_MARK),
1322 PINMUX_GPIO(GPIO_FN_SP0_SS1, SP0_SS1_MARK), 1470 PINMUX_GPIO(GPIO_FN_WP, WP_MARK),
1471 PINMUX_GPIO(GPIO_FN_FMS0, FMS0_MARK),
1472 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK),
1473 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK),
1474 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK),
1475 PINMUX_GPIO(GPIO_FN_ADTRG1, ADTRG1_MARK),
1476 PINMUX_GPIO(GPIO_FN_ADTRG0, ADTRG0_MARK),
1323 1477
1324 /* PTI (mobule: INTC) */ 1478 /* PTI (mobule: LBSC, SDHI) */
1325 PINMUX_GPIO(GPIO_FN_IRQ15, IRQ15_MARK), 1479 PINMUX_GPIO(GPIO_FN_D15, D15_MARK),
1326 PINMUX_GPIO(GPIO_FN_IRQ14, IRQ14_MARK), 1480 PINMUX_GPIO(GPIO_FN_D14, D14_MARK),
1327 PINMUX_GPIO(GPIO_FN_IRQ13, IRQ13_MARK), 1481 PINMUX_GPIO(GPIO_FN_D13, D13_MARK),
1328 PINMUX_GPIO(GPIO_FN_IRQ12, IRQ12_MARK), 1482 PINMUX_GPIO(GPIO_FN_D12, D12_MARK),
1329 PINMUX_GPIO(GPIO_FN_IRQ11, IRQ11_MARK), 1483 PINMUX_GPIO(GPIO_FN_D11, D11_MARK),
1330 PINMUX_GPIO(GPIO_FN_IRQ10, IRQ10_MARK), 1484 PINMUX_GPIO(GPIO_FN_D10, D10_MARK),
1331 PINMUX_GPIO(GPIO_FN_IRQ9, IRQ9_MARK), 1485 PINMUX_GPIO(GPIO_FN_D9, D9_MARK),
1332 PINMUX_GPIO(GPIO_FN_IRQ8, IRQ8_MARK), 1486 PINMUX_GPIO(GPIO_FN_D8, D8_MARK),
1487 PINMUX_GPIO(GPIO_FN_SD_WP, SD_WP_MARK),
1488 PINMUX_GPIO(GPIO_FN_SD_CD, SD_CD_MARK),
1489 PINMUX_GPIO(GPIO_FN_SD_CLK, SD_CLK_MARK),
1490 PINMUX_GPIO(GPIO_FN_SD_CMD, SD_CMD_MARK),
1491 PINMUX_GPIO(GPIO_FN_SD_D3, SD_D3_MARK),
1492 PINMUX_GPIO(GPIO_FN_SD_D2, SD_D2_MARK),
1493 PINMUX_GPIO(GPIO_FN_SD_D1, SD_D1_MARK),
1494 PINMUX_GPIO(GPIO_FN_SD_D0, SD_D0_MARK),
1333 1495
1334 /* PTJ (mobule: SCIF234, SERMUX) */ 1496 /* PTJ (mobule: SCIF234, SERMUX) */
1335 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK), 1497 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK),
1498 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK),
1336 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK), 1499 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK),
1337 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK), 1500 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK),
1338 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK), 1501 PINMUX_GPIO(GPIO_FN_RTS4, RTS4_MARK),
1339 PINMUX_GPIO(GPIO_FN_COM1_TXD, COM1_TXD_MARK), 1502 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK),
1340 PINMUX_GPIO(GPIO_FN_COM1_RXD, COM1_RXD_MARK), 1503 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK),
1341 PINMUX_GPIO(GPIO_FN_COM1_RTS, COM1_RTS_MARK),
1342 PINMUX_GPIO(GPIO_FN_COM1_CTS, COM1_CTS_MARK),
1343 1504
1344 /* PTK (mobule: SERMUX) */ 1505 /* PTK (mobule: SERMUX, LBSC, SCIF) */
1345 PINMUX_GPIO(GPIO_FN_COM2_TXD, COM2_TXD_MARK), 1506 PINMUX_GPIO(GPIO_FN_COM2_TXD, COM2_TXD_MARK),
1346 PINMUX_GPIO(GPIO_FN_COM2_RXD, COM2_RXD_MARK), 1507 PINMUX_GPIO(GPIO_FN_COM2_RXD, COM2_RXD_MARK),
1347 PINMUX_GPIO(GPIO_FN_COM2_RTS, COM2_RTS_MARK), 1508 PINMUX_GPIO(GPIO_FN_COM2_RTS, COM2_RTS_MARK),
@@ -1349,62 +1510,65 @@ static struct pinmux_gpio pinmux_gpios[] = {
1349 PINMUX_GPIO(GPIO_FN_COM2_DTR, COM2_DTR_MARK), 1510 PINMUX_GPIO(GPIO_FN_COM2_DTR, COM2_DTR_MARK),
1350 PINMUX_GPIO(GPIO_FN_COM2_DSR, COM2_DSR_MARK), 1511 PINMUX_GPIO(GPIO_FN_COM2_DSR, COM2_DSR_MARK),
1351 PINMUX_GPIO(GPIO_FN_COM2_DCD, COM2_DCD_MARK), 1512 PINMUX_GPIO(GPIO_FN_COM2_DCD, COM2_DCD_MARK),
1352 PINMUX_GPIO(GPIO_FN_COM2_RI, COM2_RI_MARK), 1513 PINMUX_GPIO(GPIO_FN_CLKOUT, CLKOUT_MARK),
1514 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK),
1515 PINMUX_GPIO(GPIO_FN_SCK4, SCK4_MARK),
1516 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK),
1353 1517
1354 /* PTL (mobule: SERMUX) */ 1518 /* PTL (mobule: SERMUX, SCIF, LBSC, AUD) */
1355 PINMUX_GPIO(GPIO_FN_RAC_TXD, RAC_TXD_MARK),
1356 PINMUX_GPIO(GPIO_FN_RAC_RXD, RAC_RXD_MARK), 1519 PINMUX_GPIO(GPIO_FN_RAC_RXD, RAC_RXD_MARK),
1357 PINMUX_GPIO(GPIO_FN_RAC_RTS, RAC_RTS_MARK), 1520 PINMUX_GPIO(GPIO_FN_RAC_RTS, RAC_RTS_MARK),
1358 PINMUX_GPIO(GPIO_FN_RAC_CTS, RAC_CTS_MARK), 1521 PINMUX_GPIO(GPIO_FN_RAC_CTS, RAC_CTS_MARK),
1359 PINMUX_GPIO(GPIO_FN_RAC_DTR, RAC_DTR_MARK), 1522 PINMUX_GPIO(GPIO_FN_RAC_DTR, RAC_DTR_MARK),
1360 PINMUX_GPIO(GPIO_FN_RAC_DSR, RAC_DSR_MARK), 1523 PINMUX_GPIO(GPIO_FN_RAC_DSR, RAC_DSR_MARK),
1361 PINMUX_GPIO(GPIO_FN_RAC_DCD, RAC_DCD_MARK), 1524 PINMUX_GPIO(GPIO_FN_RAC_DCD, RAC_DCD_MARK),
1362 PINMUX_GPIO(GPIO_FN_RAC_RI, RAC_RI_MARK), 1525 PINMUX_GPIO(GPIO_FN_RAC_TXD, RAC_TXD_MARK),
1526 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK),
1527 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK),
1528 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK),
1529 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK),
1530 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK),
1531 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK),
1363 1532
1364 /* PTM (mobule: IIC, LPC) */ 1533 /* PTM (mobule: LBSC, IIC) */
1534 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK),
1535 PINMUX_GPIO(GPIO_FN_RD, RD_MARK),
1536 PINMUX_GPIO(GPIO_FN_WE0, WE0_MARK),
1537 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK),
1365 PINMUX_GPIO(GPIO_FN_SDA6, SDA6_MARK), 1538 PINMUX_GPIO(GPIO_FN_SDA6, SDA6_MARK),
1366 PINMUX_GPIO(GPIO_FN_SCL6, SCL6_MARK), 1539 PINMUX_GPIO(GPIO_FN_SCL6, SCL6_MARK),
1367 PINMUX_GPIO(GPIO_FN_SDA7, SDA7_MARK), 1540 PINMUX_GPIO(GPIO_FN_SDA7, SDA7_MARK),
1368 PINMUX_GPIO(GPIO_FN_SCL7, SCL7_MARK), 1541 PINMUX_GPIO(GPIO_FN_SCL7, SCL7_MARK),
1369 PINMUX_GPIO(GPIO_FN_WP, WP_MARK),
1370 PINMUX_GPIO(GPIO_FN_FMS0, FMS0_MARK),
1371 PINMUX_GPIO(GPIO_FN_FMS1, FMS1_MARK),
1372 1542
1373 /* PTN (mobule: SCIF234, EVC) */ 1543 /* PTN (mobule: USB, JMC, SGPIO, WDT) */
1374 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK), 1544 PINMUX_GPIO(GPIO_FN_VBUS_EN, VBUS_EN_MARK),
1375 PINMUX_GPIO(GPIO_FN_RTS4, RTS4_MARK), 1545 PINMUX_GPIO(GPIO_FN_VBUS_OC, VBUS_OC_MARK),
1376 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK), 1546 PINMUX_GPIO(GPIO_FN_JMCTCK, JMCTCK_MARK),
1377 PINMUX_GPIO(GPIO_FN_RTS2, RTS2_MARK), 1547 PINMUX_GPIO(GPIO_FN_JMCTMS, JMCTMS_MARK),
1378 PINMUX_GPIO(GPIO_FN_CTS4, CTS4_MARK), 1548 PINMUX_GPIO(GPIO_FN_JMCTDO, JMCTDO_MARK),
1379 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK), 1549 PINMUX_GPIO(GPIO_FN_JMCTDI, JMCTDI_MARK),
1380 PINMUX_GPIO(GPIO_FN_CTS2, CTS2_MARK), 1550 PINMUX_GPIO(GPIO_FN_JMCTRST, JMCTRST_MARK),
1381 PINMUX_GPIO(GPIO_FN_EVENT7, EVENT7_MARK), 1551 PINMUX_GPIO(GPIO_FN_SGPIO1_CLK, SGPIO1_CLK_MARK),
1382 PINMUX_GPIO(GPIO_FN_EVENT6, EVENT6_MARK), 1552 PINMUX_GPIO(GPIO_FN_SGPIO1_LOAD, SGPIO1_LOAD_MARK),
1383 PINMUX_GPIO(GPIO_FN_EVENT5, EVENT5_MARK), 1553 PINMUX_GPIO(GPIO_FN_SGPIO1_DI, SGPIO1_DI_MARK),
1384 PINMUX_GPIO(GPIO_FN_EVENT4, EVENT4_MARK), 1554 PINMUX_GPIO(GPIO_FN_SGPIO1_DO, SGPIO1_DO_MARK),
1385 PINMUX_GPIO(GPIO_FN_EVENT3, EVENT3_MARK), 1555 PINMUX_GPIO(GPIO_FN_SUB_CLKIN, SUB_CLKIN_MARK),
1386 PINMUX_GPIO(GPIO_FN_EVENT2, EVENT2_MARK),
1387 PINMUX_GPIO(GPIO_FN_EVENT1, EVENT1_MARK),
1388 PINMUX_GPIO(GPIO_FN_EVENT0, EVENT0_MARK),
1389 1556
1390 /* PTO (mobule: SGPIO) */ 1557 /* PTO (mobule: SGPIO, SerMux) */
1391 PINMUX_GPIO(GPIO_FN_SGPIO0_CLK, SGPIO0_CLK_MARK), 1558 PINMUX_GPIO(GPIO_FN_SGPIO0_CLK, SGPIO0_CLK_MARK),
1392 PINMUX_GPIO(GPIO_FN_SGPIO0_LOAD, SGPIO0_LOAD_MARK), 1559 PINMUX_GPIO(GPIO_FN_SGPIO0_LOAD, SGPIO0_LOAD_MARK),
1393 PINMUX_GPIO(GPIO_FN_SGPIO0_DI, SGPIO0_DI_MARK), 1560 PINMUX_GPIO(GPIO_FN_SGPIO0_DI, SGPIO0_DI_MARK),
1394 PINMUX_GPIO(GPIO_FN_SGPIO0_DO, SGPIO0_DO_MARK), 1561 PINMUX_GPIO(GPIO_FN_SGPIO0_DO, SGPIO0_DO_MARK),
1395 PINMUX_GPIO(GPIO_FN_SGPIO1_CLK, SGPIO1_CLK_MARK), 1562 PINMUX_GPIO(GPIO_FN_SGPIO2_CLK, SGPIO2_CLK_MARK),
1396 PINMUX_GPIO(GPIO_FN_SGPIO1_LOAD, SGPIO1_LOAD_MARK), 1563 PINMUX_GPIO(GPIO_FN_SGPIO2_LOAD, SGPIO2_LOAD_MARK),
1397 PINMUX_GPIO(GPIO_FN_SGPIO1_DI, SGPIO1_DI_MARK), 1564 PINMUX_GPIO(GPIO_FN_SGPIO2_DI, SGPIO2_DI_MARK),
1398 PINMUX_GPIO(GPIO_FN_SGPIO1_DO, SGPIO1_DO_MARK), 1565 PINMUX_GPIO(GPIO_FN_SGPIO2_DO, SGPIO2_DO_MARK),
1566 PINMUX_GPIO(GPIO_FN_COM1_TXD, COM1_TXD_MARK),
1567 PINMUX_GPIO(GPIO_FN_COM1_RXD, COM1_RXD_MARK),
1568 PINMUX_GPIO(GPIO_FN_COM1_RTS, COM1_RTS_MARK),
1569 PINMUX_GPIO(GPIO_FN_COM1_CTS, COM1_CTS_MARK),
1399 1570
1400 /* PTP (mobule: JMC, SCIF234) */ 1571 /* PTP (mobule: EVC, ADC) */
1401 PINMUX_GPIO(GPIO_FN_JMCTCK, JMCTCK_MARK),
1402 PINMUX_GPIO(GPIO_FN_JMCTMS, JMCTMS_MARK),
1403 PINMUX_GPIO(GPIO_FN_JMCTDO, JMCTDO_MARK),
1404 PINMUX_GPIO(GPIO_FN_JMCTDI, JMCTDI_MARK),
1405 PINMUX_GPIO(GPIO_FN_JMCRST, JMCRST_MARK),
1406 PINMUX_GPIO(GPIO_FN_SCK4, SCK4_MARK),
1407 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK),
1408 1572
1409 /* PTQ (mobule: LPC) */ 1573 /* PTQ (mobule: LPC) */
1410 PINMUX_GPIO(GPIO_FN_LAD3, LAD3_MARK), 1574 PINMUX_GPIO(GPIO_FN_LAD3, LAD3_MARK),
@@ -1439,31 +1603,41 @@ static struct pinmux_gpio pinmux_gpios[] = {
1439 PINMUX_GPIO(GPIO_FN_SDA3, SDA3_MARK), 1603 PINMUX_GPIO(GPIO_FN_SDA3, SDA3_MARK),
1440 PINMUX_GPIO(GPIO_FN_SCL3, SCL3_MARK), 1604 PINMUX_GPIO(GPIO_FN_SCL3, SCL3_MARK),
1441 1605
1442 /* PTT (mobule: SYSTEM, PWMX) */ 1606 /* PTT (mobule: PWMX, AUD) */
1443 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK), 1607 PINMUX_GPIO(GPIO_FN_PWMX7, PWMX7_MARK),
1444 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK), 1608 PINMUX_GPIO(GPIO_FN_PWMX6, PWMX6_MARK),
1609 PINMUX_GPIO(GPIO_FN_PWMX5, PWMX5_MARK),
1610 PINMUX_GPIO(GPIO_FN_PWMX4, PWMX4_MARK),
1611 PINMUX_GPIO(GPIO_FN_PWMX3, PWMX3_MARK),
1612 PINMUX_GPIO(GPIO_FN_PWMX2, PWMX2_MARK),
1613 PINMUX_GPIO(GPIO_FN_PWMX1, PWMX1_MARK),
1614 PINMUX_GPIO(GPIO_FN_PWMX0, PWMX0_MARK),
1445 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK), 1615 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK),
1446 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK), 1616 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK),
1447 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK), 1617 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK),
1448 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK), 1618 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK),
1449 PINMUX_GPIO(GPIO_FN_PWX7, PWX7_MARK), 1619 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK),
1450 PINMUX_GPIO(GPIO_FN_PWX6, PWX6_MARK), 1620 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK),
1451 PINMUX_GPIO(GPIO_FN_PWX5, PWX5_MARK),
1452 PINMUX_GPIO(GPIO_FN_PWX4, PWX4_MARK),
1453
1454 /* PTU (mobule: LBSC, DMAC) */
1455 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK),
1456 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK),
1457 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK),
1458 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK),
1459 PINMUX_GPIO(GPIO_FN_RD, RD_MARK),
1460 PINMUX_GPIO(GPIO_FN_WE0, WE0_MARK),
1461 PINMUX_GPIO(GPIO_FN_A25, A25_MARK),
1462 PINMUX_GPIO(GPIO_FN_A24, A24_MARK),
1463 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK),
1464 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK),
1465 1621
1466 /* PTV (mobule: LBSC, DMAC) */ 1622 /* PTU (mobule: LPC, APM) */
1623 PINMUX_GPIO(GPIO_FN_LGPIO7, LGPIO7_MARK),
1624 PINMUX_GPIO(GPIO_FN_LGPIO6, LGPIO6_MARK),
1625 PINMUX_GPIO(GPIO_FN_LGPIO5, LGPIO5_MARK),
1626 PINMUX_GPIO(GPIO_FN_LGPIO4, LGPIO4_MARK),
1627 PINMUX_GPIO(GPIO_FN_LGPIO3, LGPIO3_MARK),
1628 PINMUX_GPIO(GPIO_FN_LGPIO2, LGPIO2_MARK),
1629 PINMUX_GPIO(GPIO_FN_LGPIO1, LGPIO1_MARK),
1630 PINMUX_GPIO(GPIO_FN_LGPIO0, LGPIO0_MARK),
1631 PINMUX_GPIO(GPIO_FN_APMONCTL_O, APMONCTL_O_MARK),
1632 PINMUX_GPIO(GPIO_FN_APMPWBTOUT_O, APMPWBTOUT_O_MARK),
1633 PINMUX_GPIO(GPIO_FN_APMSCI_O, APMSCI_O_MARK),
1634 PINMUX_GPIO(GPIO_FN_APMVDDON, APMVDDON_MARK),
1635 PINMUX_GPIO(GPIO_FN_APMSLPBTN, APMSLPBTN_MARK),
1636 PINMUX_GPIO(GPIO_FN_APMPWRBTN, APMPWRBTN_MARK),
1637 PINMUX_GPIO(GPIO_FN_APMS5N, APMS5N_MARK),
1638 PINMUX_GPIO(GPIO_FN_APMS3N, APMS3N_MARK),
1639
1640 /* PTV (mobule: LBSC, SerMux, R-SPI, EVC, GRA) */
1467 PINMUX_GPIO(GPIO_FN_A23, A23_MARK), 1641 PINMUX_GPIO(GPIO_FN_A23, A23_MARK),
1468 PINMUX_GPIO(GPIO_FN_A22, A22_MARK), 1642 PINMUX_GPIO(GPIO_FN_A22, A22_MARK),
1469 PINMUX_GPIO(GPIO_FN_A21, A21_MARK), 1643 PINMUX_GPIO(GPIO_FN_A21, A21_MARK),
@@ -1472,12 +1646,20 @@ static struct pinmux_gpio pinmux_gpios[] = {
1472 PINMUX_GPIO(GPIO_FN_A18, A18_MARK), 1646 PINMUX_GPIO(GPIO_FN_A18, A18_MARK),
1473 PINMUX_GPIO(GPIO_FN_A17, A17_MARK), 1647 PINMUX_GPIO(GPIO_FN_A17, A17_MARK),
1474 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1648 PINMUX_GPIO(GPIO_FN_A16, A16_MARK),
1475 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK), 1649 PINMUX_GPIO(GPIO_FN_COM2_RI, COM2_RI_MARK),
1476 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK), 1650 PINMUX_GPIO(GPIO_FN_R_SPI_MOSI, R_SPI_MOSI_MARK),
1477 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK), 1651 PINMUX_GPIO(GPIO_FN_R_SPI_MISO, R_SPI_MISO_MARK),
1478 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK), 1652 PINMUX_GPIO(GPIO_FN_R_SPI_RSPCK, R_SPI_RSPCK_MARK),
1653 PINMUX_GPIO(GPIO_FN_R_SPI_SSL0, R_SPI_SSL0_MARK),
1654 PINMUX_GPIO(GPIO_FN_R_SPI_SSL1, R_SPI_SSL1_MARK),
1655 PINMUX_GPIO(GPIO_FN_EVENT7, EVENT7_MARK),
1656 PINMUX_GPIO(GPIO_FN_EVENT6, EVENT6_MARK),
1657 PINMUX_GPIO(GPIO_FN_VBIOS_DI, VBIOS_DI_MARK),
1658 PINMUX_GPIO(GPIO_FN_VBIOS_DO, VBIOS_DO_MARK),
1659 PINMUX_GPIO(GPIO_FN_VBIOS_CLK, VBIOS_CLK_MARK),
1660 PINMUX_GPIO(GPIO_FN_VBIOS_CS, VBIOS_CS_MARK),
1479 1661
1480 /* PTW (mobule: LBSC) */ 1662 /* PTW (mobule: LBSC, EVC, SCIF) */
1481 PINMUX_GPIO(GPIO_FN_A16, A16_MARK), 1663 PINMUX_GPIO(GPIO_FN_A16, A16_MARK),
1482 PINMUX_GPIO(GPIO_FN_A15, A15_MARK), 1664 PINMUX_GPIO(GPIO_FN_A15, A15_MARK),
1483 PINMUX_GPIO(GPIO_FN_A14, A14_MARK), 1665 PINMUX_GPIO(GPIO_FN_A14, A14_MARK),
@@ -1487,6 +1669,14 @@ static struct pinmux_gpio pinmux_gpios[] = {
1487 PINMUX_GPIO(GPIO_FN_A10, A10_MARK), 1669 PINMUX_GPIO(GPIO_FN_A10, A10_MARK),
1488 PINMUX_GPIO(GPIO_FN_A9, A9_MARK), 1670 PINMUX_GPIO(GPIO_FN_A9, A9_MARK),
1489 PINMUX_GPIO(GPIO_FN_A8, A8_MARK), 1671 PINMUX_GPIO(GPIO_FN_A8, A8_MARK),
1672 PINMUX_GPIO(GPIO_FN_EVENT5, EVENT5_MARK),
1673 PINMUX_GPIO(GPIO_FN_EVENT4, EVENT4_MARK),
1674 PINMUX_GPIO(GPIO_FN_EVENT3, EVENT3_MARK),
1675 PINMUX_GPIO(GPIO_FN_EVENT2, EVENT2_MARK),
1676 PINMUX_GPIO(GPIO_FN_EVENT1, EVENT1_MARK),
1677 PINMUX_GPIO(GPIO_FN_EVENT0, EVENT0_MARK),
1678 PINMUX_GPIO(GPIO_FN_CTS4, CTS4_MARK),
1679 PINMUX_GPIO(GPIO_FN_CTS2, CTS2_MARK),
1490 1680
1491 /* PTX (mobule: LBSC) */ 1681 /* PTX (mobule: LBSC) */
1492 PINMUX_GPIO(GPIO_FN_A7, A7_MARK), 1682 PINMUX_GPIO(GPIO_FN_A7, A7_MARK),
@@ -1497,6 +1687,10 @@ static struct pinmux_gpio pinmux_gpios[] = {
1497 PINMUX_GPIO(GPIO_FN_A2, A2_MARK), 1687 PINMUX_GPIO(GPIO_FN_A2, A2_MARK),
1498 PINMUX_GPIO(GPIO_FN_A1, A1_MARK), 1688 PINMUX_GPIO(GPIO_FN_A1, A1_MARK),
1499 PINMUX_GPIO(GPIO_FN_A0, A0_MARK), 1689 PINMUX_GPIO(GPIO_FN_A0, A0_MARK),
1690 PINMUX_GPIO(GPIO_FN_RTS2, RTS2_MARK),
1691 PINMUX_GPIO(GPIO_FN_SIM_D, SIM_D_MARK),
1692 PINMUX_GPIO(GPIO_FN_SIM_CLK, SIM_CLK_MARK),
1693 PINMUX_GPIO(GPIO_FN_SIM_RST, SIM_RST_MARK),
1500 1694
1501 /* PTY (mobule: LBSC) */ 1695 /* PTY (mobule: LBSC) */
1502 PINMUX_GPIO(GPIO_FN_D7, D7_MARK), 1696 PINMUX_GPIO(GPIO_FN_D7, D7_MARK),
@@ -1507,18 +1701,36 @@ static struct pinmux_gpio pinmux_gpios[] = {
1507 PINMUX_GPIO(GPIO_FN_D2, D2_MARK), 1701 PINMUX_GPIO(GPIO_FN_D2, D2_MARK),
1508 PINMUX_GPIO(GPIO_FN_D1, D1_MARK), 1702 PINMUX_GPIO(GPIO_FN_D1, D1_MARK),
1509 PINMUX_GPIO(GPIO_FN_D0, D0_MARK), 1703 PINMUX_GPIO(GPIO_FN_D0, D0_MARK),
1704
1705 /* PTZ (mobule: eMMC, ONFI) */
1706 PINMUX_GPIO(GPIO_FN_MMCDAT7, MMCDAT7_MARK),
1707 PINMUX_GPIO(GPIO_FN_MMCDAT6, MMCDAT6_MARK),
1708 PINMUX_GPIO(GPIO_FN_MMCDAT5, MMCDAT5_MARK),
1709 PINMUX_GPIO(GPIO_FN_MMCDAT4, MMCDAT4_MARK),
1710 PINMUX_GPIO(GPIO_FN_MMCDAT3, MMCDAT3_MARK),
1711 PINMUX_GPIO(GPIO_FN_MMCDAT2, MMCDAT2_MARK),
1712 PINMUX_GPIO(GPIO_FN_MMCDAT1, MMCDAT1_MARK),
1713 PINMUX_GPIO(GPIO_FN_MMCDAT0, MMCDAT0_MARK),
1714 PINMUX_GPIO(GPIO_FN_ON_DQ7, ON_DQ7_MARK),
1715 PINMUX_GPIO(GPIO_FN_ON_DQ6, ON_DQ6_MARK),
1716 PINMUX_GPIO(GPIO_FN_ON_DQ5, ON_DQ5_MARK),
1717 PINMUX_GPIO(GPIO_FN_ON_DQ4, ON_DQ4_MARK),
1718 PINMUX_GPIO(GPIO_FN_ON_DQ3, ON_DQ3_MARK),
1719 PINMUX_GPIO(GPIO_FN_ON_DQ2, ON_DQ2_MARK),
1720 PINMUX_GPIO(GPIO_FN_ON_DQ1, ON_DQ1_MARK),
1721 PINMUX_GPIO(GPIO_FN_ON_DQ0, ON_DQ0_MARK),
1510 }; 1722 };
1511 1723
1512static struct pinmux_cfg_reg pinmux_config_regs[] = { 1724static struct pinmux_cfg_reg pinmux_config_regs[] = {
1513 { PINMUX_CFG_REG("PACR", 0xffec0000, 16, 2) { 1725 { PINMUX_CFG_REG("PACR", 0xffec0000, 16, 2) {
1514 PTA7_FN, PTA7_OUT, PTA7_IN, 0, 1726 PTA7_FN, PTA7_OUT, PTA7_IN, PTA7_IN_PU,
1515 PTA6_FN, PTA6_OUT, PTA6_IN, 0, 1727 PTA6_FN, PTA6_OUT, PTA6_IN, PTA6_IN_PU,
1516 PTA5_FN, PTA5_OUT, PTA5_IN, 0, 1728 PTA5_FN, PTA5_OUT, PTA5_IN, PTA5_IN_PU,
1517 PTA4_FN, PTA4_OUT, PTA4_IN, 0, 1729 PTA4_FN, PTA4_OUT, PTA4_IN, PTA4_IN_PU,
1518 PTA3_FN, PTA3_OUT, PTA3_IN, 0, 1730 PTA3_FN, PTA3_OUT, PTA3_IN, PTA3_IN_PU,
1519 PTA2_FN, PTA2_OUT, PTA2_IN, 0, 1731 PTA2_FN, PTA2_OUT, PTA2_IN, PTA2_IN_PU,
1520 PTA1_FN, PTA1_OUT, PTA1_IN, 0, 1732 PTA1_FN, PTA1_OUT, PTA1_IN, PTA1_IN_PU,
1521 PTA0_FN, PTA0_OUT, PTA0_IN, 0 } 1733 PTA0_FN, PTA0_OUT, PTA0_IN, PTA0_IN_PU }
1522 }, 1734 },
1523 { PINMUX_CFG_REG("PBCR", 0xffec0002, 16, 2) { 1735 { PINMUX_CFG_REG("PBCR", 0xffec0002, 16, 2) {
1524 PTB7_FN, PTB7_OUT, PTB7_IN, 0, 1736 PTB7_FN, PTB7_OUT, PTB7_IN, 0,
@@ -1541,125 +1753,126 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1541 PTC0_FN, PTC0_OUT, PTC0_IN, 0 } 1753 PTC0_FN, PTC0_OUT, PTC0_IN, 0 }
1542 }, 1754 },
1543 { PINMUX_CFG_REG("PDCR", 0xffec0006, 16, 2) { 1755 { PINMUX_CFG_REG("PDCR", 0xffec0006, 16, 2) {
1544 PTD7_FN, PTD7_OUT, PTD7_IN, 0, 1756 PTD7_FN, PTD7_OUT, PTD7_IN, PTD7_IN_PU,
1545 PTD6_FN, PTD6_OUT, PTD6_IN, 0, 1757 PTD6_FN, PTD6_OUT, PTD6_IN, PTD6_IN_PU,
1546 PTD5_FN, PTD5_OUT, PTD5_IN, 0, 1758 PTD5_FN, PTD5_OUT, PTD5_IN, PTD5_IN_PU,
1547 PTD4_FN, PTD4_OUT, PTD4_IN, 0, 1759 PTD4_FN, PTD4_OUT, PTD4_IN, PTD4_IN_PU,
1548 PTD3_FN, PTD3_OUT, PTD3_IN, 0, 1760 PTD3_FN, PTD3_OUT, PTD3_IN, PTD3_IN_PU,
1549 PTD2_FN, PTD2_OUT, PTD2_IN, 0, 1761 PTD2_FN, PTD2_OUT, PTD2_IN, PTD2_IN_PU,
1550 PTD1_FN, PTD1_OUT, PTD1_IN, 0, 1762 PTD1_FN, PTD1_OUT, PTD1_IN, PTD1_IN_PU,
1551 PTD0_FN, PTD0_OUT, PTD0_IN, 0 } 1763 PTD0_FN, PTD0_OUT, PTD0_IN, PTD0_IN_PU }
1552 }, 1764 },
1553 { PINMUX_CFG_REG("PECR", 0xffec0008, 16, 2) { 1765 { PINMUX_CFG_REG("PECR", 0xffec0008, 16, 2) {
1554 PTE7_FN, PTE7_OUT, PTE7_IN, 0, 1766 PTE7_FN, PTE7_OUT, PTE7_IN, PTE7_IN_PU,
1555 PTE6_FN, PTE6_OUT, PTE6_IN, 0, 1767 PTE6_FN, PTE6_OUT, PTE6_IN, PTE6_IN_PU,
1556 PTE5_FN, PTE5_OUT, PTE5_IN, 0, 1768 PTE5_FN, PTE5_OUT, PTE5_IN, PTE5_IN_PU,
1557 PTE4_FN, PTE4_OUT, PTE4_IN, 0, 1769 PTE4_FN, PTE4_OUT, PTE4_IN, PTE4_IN_PU,
1558 PTE3_FN, PTE3_OUT, PTE3_IN, 0, 1770 PTE3_FN, PTE3_OUT, PTE3_IN, PTE3_IN_PU,
1559 PTE2_FN, PTE2_OUT, PTE2_IN, 0, 1771 PTE2_FN, PTE2_OUT, PTE2_IN, PTE2_IN_PU,
1560 PTE1_FN, PTE1_OUT, PTE1_IN, 0, 1772 PTE1_FN, PTE1_OUT, PTE1_IN, PTE1_IN_PU,
1561 PTE0_FN, PTE0_OUT, PTE0_IN, 0 } 1773 PTE0_FN, PTE0_OUT, PTE0_IN, PTE0_IN_PU }
1562 }, 1774 },
1563 { PINMUX_CFG_REG("PFCR", 0xffec000a, 16, 2) { 1775 { PINMUX_CFG_REG("PFCR", 0xffec000a, 16, 2) {
1564 PTF7_FN, PTF7_OUT, PTF7_IN, 0, 1776 PTF7_FN, PTF7_OUT, PTF7_IN, PTF7_IN_PU,
1565 PTF6_FN, PTF6_OUT, PTF6_IN, 0, 1777 PTF6_FN, PTF6_OUT, PTF6_IN, PTF6_IN_PU,
1566 PTF5_FN, PTF5_OUT, PTF5_IN, 0, 1778 PTF5_FN, PTF5_OUT, PTF5_IN, PTF5_IN_PU,
1567 PTF4_FN, PTF4_OUT, PTF4_IN, 0, 1779 PTF4_FN, PTF4_OUT, PTF4_IN, PTF4_IN_PU,
1568 PTF3_FN, PTF3_OUT, PTF3_IN, 0, 1780 PTF3_FN, PTF3_OUT, PTF3_IN, PTF3_IN_PU,
1569 PTF2_FN, PTF2_OUT, PTF2_IN, 0, 1781 PTF2_FN, PTF2_OUT, PTF2_IN, PTF2_IN_PU,
1570 PTF1_FN, PTF1_OUT, PTF1_IN, 0, 1782 PTF1_FN, PTF1_OUT, PTF1_IN, PTF1_IN_PU,
1571 PTF0_FN, PTF0_OUT, PTF0_IN, 0 } 1783 PTF0_FN, PTF0_OUT, PTF0_IN, PTF0_IN_PU }
1572 }, 1784 },
1573 { PINMUX_CFG_REG("PGCR", 0xffec000c, 16, 2) { 1785 { PINMUX_CFG_REG("PGCR", 0xffec000c, 16, 2) {
1574 PTG7_FN, PTG7_OUT, PTG7_IN, 0, 1786 PTG7_FN, PTG7_OUT, PTG7_IN, PTG7_IN_PU ,
1575 PTG6_FN, PTG6_OUT, PTG6_IN, 0, 1787 PTG6_FN, PTG6_OUT, PTG6_IN, PTG6_IN_PU ,
1576 PTG5_FN, PTG5_OUT, PTG5_IN, 0, 1788 PTG5_FN, PTG5_OUT, PTG5_IN, 0,
1577 PTG4_FN, PTG4_OUT, PTG4_IN, 0, 1789 PTG4_FN, PTG4_OUT, PTG4_IN, PTG4_IN_PU ,
1578 PTG3_FN, PTG3_OUT, PTG3_IN, 0, 1790 PTG3_FN, PTG3_OUT, PTG3_IN, 0,
1579 PTG2_FN, PTG2_OUT, PTG2_IN, 0, 1791 PTG2_FN, PTG2_OUT, PTG2_IN, 0,
1580 PTG1_FN, PTG1_OUT, PTG1_IN, 0, 1792 PTG1_FN, PTG1_OUT, PTG1_IN, 0,
1581 PTG0_FN, PTG0_OUT, PTG0_IN, 0 } 1793 PTG0_FN, PTG0_OUT, PTG0_IN, 0 }
1582 }, 1794 },
1583 { PINMUX_CFG_REG("PHCR", 0xffec000e, 16, 2) { 1795 { PINMUX_CFG_REG("PHCR", 0xffec000e, 16, 2) {
1584 PTH7_FN, PTH7_OUT, PTH7_IN, 0, 1796 PTH7_FN, PTH7_OUT, PTH7_IN, PTH7_IN_PU,
1585 PTH6_FN, PTH6_OUT, PTH6_IN, 0, 1797 PTH6_FN, PTH6_OUT, PTH6_IN, PTH6_IN_PU,
1586 PTH5_FN, PTH5_OUT, PTH5_IN, 0, 1798 PTH5_FN, PTH5_OUT, PTH5_IN, PTH5_IN_PU,
1587 PTH4_FN, PTH4_OUT, PTH4_IN, 0, 1799 PTH4_FN, PTH4_OUT, PTH4_IN, PTH4_IN_PU,
1588 PTH3_FN, PTH3_OUT, PTH3_IN, 0, 1800 PTH3_FN, PTH3_OUT, PTH3_IN, PTH3_IN_PU,
1589 PTH2_FN, PTH2_OUT, PTH2_IN, 0, 1801 PTH2_FN, PTH2_OUT, PTH2_IN, PTH2_IN_PU,
1590 PTH1_FN, PTH1_OUT, PTH1_IN, 0, 1802 PTH1_FN, PTH1_OUT, PTH1_IN, PTH1_IN_PU,
1591 PTH0_FN, PTH0_OUT, PTH0_IN, 0 } 1803 PTH0_FN, PTH0_OUT, PTH0_IN, PTH0_IN_PU }
1592 }, 1804 },
1593 { PINMUX_CFG_REG("PICR", 0xffec0010, 16, 2) { 1805 { PINMUX_CFG_REG("PICR", 0xffec0010, 16, 2) {
1594 PTI7_FN, PTI7_OUT, PTI7_IN, 0, 1806 PTI7_FN, PTI7_OUT, PTI7_IN, PTI7_IN_PU,
1595 PTI6_FN, PTI6_OUT, PTI6_IN, 0, 1807 PTI6_FN, PTI6_OUT, PTI6_IN, PTI6_IN_PU,
1596 PTI5_FN, PTI5_OUT, PTI5_IN, 0, 1808 PTI5_FN, PTI5_OUT, PTI5_IN, 0,
1597 PTI4_FN, PTI4_OUT, PTI4_IN, 0, 1809 PTI4_FN, PTI4_OUT, PTI4_IN, PTI4_IN_PU,
1598 PTI3_FN, PTI3_OUT, PTI3_IN, 0, 1810 PTI3_FN, PTI3_OUT, PTI3_IN, PTI3_IN_PU,
1599 PTI2_FN, PTI2_OUT, PTI2_IN, 0, 1811 PTI2_FN, PTI2_OUT, PTI2_IN, PTI2_IN_PU,
1600 PTI1_FN, PTI1_OUT, PTI1_IN, 0, 1812 PTI1_FN, PTI1_OUT, PTI1_IN, PTI1_IN_PU,
1601 PTI0_FN, PTI0_OUT, PTI0_IN, 0 } 1813 PTI0_FN, PTI0_OUT, PTI0_IN, PTI0_IN_PU }
1602 }, 1814 },
1603 { PINMUX_CFG_REG("PJCR", 0xffec0012, 16, 2) { 1815 { PINMUX_CFG_REG("PJCR", 0xffec0012, 16, 2) {
1604 PTJ7_FN, PTJ7_OUT, PTJ7_IN, 0, 1816 0, 0, 0, 0, /* reserved: always set 1 */
1605 PTJ6_FN, PTJ6_OUT, PTJ6_IN, 0, 1817 PTJ6_FN, PTJ6_OUT, PTJ6_IN, PTJ6_IN_PU,
1606 PTJ5_FN, PTJ5_OUT, PTJ5_IN, 0, 1818 PTJ5_FN, PTJ5_OUT, PTJ5_IN, PTJ5_IN_PU,
1607 PTJ4_FN, PTJ4_OUT, PTJ4_IN, 0, 1819 PTJ4_FN, PTJ4_OUT, PTJ4_IN, PTJ4_IN_PU,
1608 PTJ3_FN, PTJ3_OUT, PTJ3_IN, 0, 1820 PTJ3_FN, PTJ3_OUT, PTJ3_IN, PTJ3_IN_PU,
1609 PTJ2_FN, PTJ2_OUT, PTJ2_IN, 0, 1821 PTJ2_FN, PTJ2_OUT, PTJ2_IN, PTJ2_IN_PU,
1610 PTJ1_FN, PTJ1_OUT, PTJ1_IN, 0, 1822 PTJ1_FN, PTJ1_OUT, PTJ1_IN, PTJ1_IN_PU,
1611 PTJ0_FN, PTJ0_OUT, PTJ0_IN, 0 } 1823 PTJ0_FN, PTJ0_OUT, PTJ0_IN, PTJ0_IN_PU }
1612 }, 1824 },
1613 { PINMUX_CFG_REG("PKCR", 0xffec0014, 16, 2) { 1825 { PINMUX_CFG_REG("PKCR", 0xffec0014, 16, 2) {
1614 PTK7_FN, PTK7_OUT, PTK7_IN, 0, 1826 PTK7_FN, PTK7_OUT, PTK7_IN, PTK7_IN_PU,
1615 PTK6_FN, PTK6_OUT, PTK6_IN, 0, 1827 PTK6_FN, PTK6_OUT, PTK6_IN, PTK6_IN_PU,
1616 PTK5_FN, PTK5_OUT, PTK5_IN, 0, 1828 PTK5_FN, PTK5_OUT, PTK5_IN, PTK5_IN_PU,
1617 PTK4_FN, PTK4_OUT, PTK4_IN, 0, 1829 PTK4_FN, PTK4_OUT, PTK4_IN, PTK4_IN_PU,
1618 PTK3_FN, PTK3_OUT, PTK3_IN, 0, 1830 PTK3_FN, PTK3_OUT, PTK3_IN, PTK3_IN_PU,
1619 PTK2_FN, PTK2_OUT, PTK2_IN, 0, 1831 PTK2_FN, PTK2_OUT, PTK2_IN, PTK2_IN_PU,
1620 PTK1_FN, PTK1_OUT, PTK1_IN, 0, 1832 PTK1_FN, PTK1_OUT, PTK1_IN, PTK1_IN_PU,
1621 PTK0_FN, PTK0_OUT, PTK0_IN, 0 } 1833 PTK0_FN, PTK0_OUT, PTK0_IN, PTK0_IN_PU }
1622 }, 1834 },
1623 { PINMUX_CFG_REG("PLCR", 0xffec0016, 16, 2) { 1835 { PINMUX_CFG_REG("PLCR", 0xffec0016, 16, 2) {
1624 PTL7_FN, PTL7_OUT, PTL7_IN, 0, 1836 0, 0, 0, 0, /* reserved: always set 1 */
1625 PTL6_FN, PTL6_OUT, PTL6_IN, 0, 1837 PTL6_FN, PTL6_OUT, PTL6_IN, PTL6_IN_PU,
1626 PTL5_FN, PTL5_OUT, PTL5_IN, 0, 1838 PTL5_FN, PTL5_OUT, PTL5_IN, PTL5_IN_PU,
1627 PTL4_FN, PTL4_OUT, PTL4_IN, 0, 1839 PTL4_FN, PTL4_OUT, PTL4_IN, PTL4_IN_PU,
1628 PTL3_FN, PTL3_OUT, PTL3_IN, 0, 1840 PTL3_FN, PTL3_OUT, PTL3_IN, PTL3_IN_PU,
1629 PTL2_FN, PTL2_OUT, PTL2_IN, 0, 1841 PTL2_FN, PTL2_OUT, PTL2_IN, PTL2_IN_PU,
1630 PTL1_FN, PTL1_OUT, PTL1_IN, 0, 1842 PTL1_FN, PTL1_OUT, PTL1_IN, PTL1_IN_PU,
1631 PTL0_FN, PTL0_OUT, PTL0_IN, 0 } 1843 PTL0_FN, PTL0_OUT, PTL0_IN, PTL0_IN_PU }
1632 }, 1844 },
1633 { PINMUX_CFG_REG("PMCR", 0xffec0018, 16, 2) { 1845 { PINMUX_CFG_REG("PMCR", 0xffec0018, 16, 2) {
1634 0, 0, 0, 0, /* reserved: always set 1 */ 1846 PTM7_FN, PTM7_OUT, PTM7_IN, PTM7_IN_PU,
1635 PTM6_FN, PTM6_OUT, PTM6_IN, 0, 1847 PTM6_FN, PTM6_OUT, PTM6_IN, PTM6_IN_PU,
1636 PTM5_FN, PTM5_OUT, PTM5_IN, 0, 1848 PTM5_FN, PTM5_OUT, PTM5_IN, PTM5_IN_PU,
1637 PTM4_FN, PTM4_OUT, PTM4_IN, 0, 1849 PTM4_FN, PTM4_OUT, PTM4_IN, PTM4_IN_PU,
1638 PTM3_FN, PTM3_OUT, PTM3_IN, 0, 1850 PTM3_FN, PTM3_OUT, PTM3_IN, 0,
1639 PTM2_FN, PTM2_OUT, PTM2_IN, 0, 1851 PTM2_FN, PTM2_OUT, PTM2_IN, 0,
1640 PTM1_FN, PTM1_OUT, PTM1_IN, 0, 1852 PTM1_FN, PTM1_OUT, PTM1_IN, 0,
1641 PTM0_FN, PTM0_OUT, PTM0_IN, 0 } 1853 PTM0_FN, PTM0_OUT, PTM0_IN, 0 }
1642 }, 1854 },
1643 { PINMUX_CFG_REG("PNCR", 0xffec001a, 16, 2) { 1855 { PINMUX_CFG_REG("PNCR", 0xffec001a, 16, 2) {
1644 PTN7_FN, PTN7_OUT, PTN7_IN, 0, 1856 0, 0, 0, 0, /* reserved: always set 1 */
1645 PTN6_FN, PTN6_OUT, PTN6_IN, 0, 1857 PTN6_FN, PTN6_OUT, PTN6_IN, 0,
1646 PTN5_FN, PTN5_OUT, PTN5_IN, 0, 1858 PTN5_FN, PTN5_OUT, PTN5_IN, 0,
1647 PTN4_FN, PTN4_OUT, PTN4_IN, 0, 1859 PTN4_FN, PTN4_OUT, PTN4_IN, PTN4_IN_PU,
1648 PTN3_FN, PTN3_OUT, PTN3_IN, 0, 1860 PTN3_FN, PTN3_OUT, PTN3_IN, PTN3_IN_PU,
1649 PTN2_FN, PTN2_OUT, PTN2_IN, 0, 1861 PTN2_FN, PTN2_OUT, PTN2_IN, PTN2_IN_PU,
1650 PTN1_FN, PTN1_OUT, PTN1_IN, 0, 1862 PTN1_FN, PTN1_OUT, PTN1_IN, PTN1_IN_PU,
1651 PTN0_FN, PTN0_OUT, PTN0_IN, 0 } 1863 PTN0_FN, PTN0_OUT, PTN0_IN, PTN0_IN_PU }
1652 }, 1864 },
1653 { PINMUX_CFG_REG("POCR", 0xffec001c, 16, 2) { 1865 { PINMUX_CFG_REG("POCR", 0xffec001c, 16, 2) {
1654 PTO7_FN, PTO7_OUT, PTO7_IN, 0, 1866 PTO7_FN, PTO7_OUT, PTO7_IN, PTO7_IN_PU,
1655 PTO6_FN, PTO6_OUT, PTO6_IN, 0, 1867 PTO6_FN, PTO6_OUT, PTO6_IN, PTO6_IN_PU,
1656 PTO5_FN, PTO5_OUT, PTO5_IN, 0, 1868 PTO5_FN, PTO5_OUT, PTO5_IN, PTO5_IN_PU,
1657 PTO4_FN, PTO4_OUT, PTO4_IN, 0, 1869 PTO4_FN, PTO4_OUT, PTO4_IN, PTO4_IN_PU,
1658 PTO3_FN, PTO3_OUT, PTO3_IN, 0, 1870 PTO3_FN, PTO3_OUT, PTO3_IN, PTO3_IN_PU,
1659 PTO2_FN, PTO2_OUT, PTO2_IN, 0, 1871 PTO2_FN, PTO2_OUT, PTO2_IN, PTO2_IN_PU,
1660 PTO1_FN, PTO1_OUT, PTO1_IN, 0, 1872 PTO1_FN, PTO1_OUT, PTO1_IN, PTO1_IN_PU,
1661 PTO0_FN, PTO0_OUT, PTO0_IN, 0 } 1873 PTO0_FN, PTO0_OUT, PTO0_IN, PTO0_IN_PU }
1662 }, 1874 },
1875#if 0 /* FIXME: Remove it? */
1663 { PINMUX_CFG_REG("PPCR", 0xffec001e, 16, 2) { 1876 { PINMUX_CFG_REG("PPCR", 0xffec001e, 16, 2) {
1664 0, 0, 0, 0, /* reserved: always set 1 */ 1877 0, 0, 0, 0, /* reserved: always set 1 */
1665 PTP6_FN, PTP6_OUT, PTP6_IN, 0, 1878 PTP6_FN, PTP6_OUT, PTP6_IN, 0,
@@ -1670,6 +1883,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1670 PTP1_FN, PTP1_OUT, PTP1_IN, 0, 1883 PTP1_FN, PTP1_OUT, PTP1_IN, 0,
1671 PTP0_FN, PTP0_OUT, PTP0_IN, 0 } 1884 PTP0_FN, PTP0_OUT, PTP0_IN, 0 }
1672 }, 1885 },
1886#endif
1673 { PINMUX_CFG_REG("PQCR", 0xffec0020, 16, 2) { 1887 { PINMUX_CFG_REG("PQCR", 0xffec0020, 16, 2) {
1674 0, 0, 0, 0, /* reserved: always set 1 */ 1888 0, 0, 0, 0, /* reserved: always set 1 */
1675 PTQ6_FN, PTQ6_OUT, PTQ6_IN, 0, 1889 PTQ6_FN, PTQ6_OUT, PTQ6_IN, 0,
@@ -1701,14 +1915,14 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1701 PTS0_FN, PTS0_OUT, PTS0_IN, 0 } 1915 PTS0_FN, PTS0_OUT, PTS0_IN, 0 }
1702 }, 1916 },
1703 { PINMUX_CFG_REG("PTCR", 0xffec0026, 16, 2) { 1917 { PINMUX_CFG_REG("PTCR", 0xffec0026, 16, 2) {
1704 0, 0, 0, 0, /* reserved: always set 1 */ 1918 PTT7_FN, PTT7_OUT, PTT7_IN, PTO7_IN_PU,
1705 0, 0, 0, 0, /* reserved: always set 1 */ 1919 PTT6_FN, PTT6_OUT, PTT6_IN, PTO6_IN_PU,
1706 PTT5_FN, PTT5_OUT, PTT5_IN, 0, 1920 PTT5_FN, PTT5_OUT, PTT5_IN, PTO5_IN_PU,
1707 PTT4_FN, PTT4_OUT, PTT4_IN, 0, 1921 PTT4_FN, PTT4_OUT, PTT4_IN, PTO4_IN_PU,
1708 PTT3_FN, PTT3_OUT, PTT3_IN, 0, 1922 PTT3_FN, PTT3_OUT, PTT3_IN, PTO3_IN_PU,
1709 PTT2_FN, PTT2_OUT, PTT2_IN, 0, 1923 PTT2_FN, PTT2_OUT, PTT2_IN, PTO2_IN_PU,
1710 PTT1_FN, PTT1_OUT, PTT1_IN, 0, 1924 PTT1_FN, PTT1_OUT, PTT1_IN, PTO1_IN_PU,
1711 PTT0_FN, PTT0_OUT, PTT0_IN, 0 } 1925 PTT0_FN, PTT0_OUT, PTT0_IN, PTO0_IN_PU }
1712 }, 1926 },
1713 { PINMUX_CFG_REG("PUCR", 0xffec0028, 16, 2) { 1927 { PINMUX_CFG_REG("PUCR", 0xffec0028, 16, 2) {
1714 PTU7_FN, PTU7_OUT, PTU7_IN, PTU7_IN_PU, 1928 PTU7_FN, PTU7_OUT, PTU7_IN, PTU7_IN_PU,
@@ -1727,16 +1941,16 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1727 PTV4_FN, PTV4_OUT, PTV4_IN, PTV4_IN_PU, 1941 PTV4_FN, PTV4_OUT, PTV4_IN, PTV4_IN_PU,
1728 PTV3_FN, PTV3_OUT, PTV3_IN, PTV3_IN_PU, 1942 PTV3_FN, PTV3_OUT, PTV3_IN, PTV3_IN_PU,
1729 PTV2_FN, PTV2_OUT, PTV2_IN, PTV2_IN_PU, 1943 PTV2_FN, PTV2_OUT, PTV2_IN, PTV2_IN_PU,
1730 PTV1_FN, PTV1_OUT, PTV1_IN, PTV1_IN_PU, 1944 PTV1_FN, PTV1_OUT, PTV1_IN, 0,
1731 PTV0_FN, PTV0_OUT, PTV0_IN, PTV0_IN_PU } 1945 PTV0_FN, PTV0_OUT, PTV0_IN, 0 }
1732 }, 1946 },
1733 { PINMUX_CFG_REG("PWCR", 0xffec002c, 16, 2) { 1947 { PINMUX_CFG_REG("PWCR", 0xffec002c, 16, 2) {
1734 PTW7_FN, PTW7_OUT, PTW7_IN, PTW7_IN_PU, 1948 PTW7_FN, PTW7_OUT, PTW7_IN, 0,
1735 PTW6_FN, PTW6_OUT, PTW6_IN, PTW6_IN_PU, 1949 PTW6_FN, PTW6_OUT, PTW6_IN, 0,
1736 PTW5_FN, PTW5_OUT, PTW5_IN, PTW5_IN_PU, 1950 PTW5_FN, PTW5_OUT, PTW5_IN, 0,
1737 PTW4_FN, PTW4_OUT, PTW4_IN, PTW4_IN_PU, 1951 PTW4_FN, PTW4_OUT, PTW4_IN, 0,
1738 PTW3_FN, PTW3_OUT, PTW3_IN, PTW3_IN_PU, 1952 PTW3_FN, PTW3_OUT, PTW3_IN, 0,
1739 PTW2_FN, PTW2_OUT, PTW2_IN, PTW2_IN_PU, 1953 PTW2_FN, PTW2_OUT, PTW2_IN, 0,
1740 PTW1_FN, PTW1_OUT, PTW1_IN, PTW1_IN_PU, 1954 PTW1_FN, PTW1_OUT, PTW1_IN, PTW1_IN_PU,
1741 PTW0_FN, PTW0_OUT, PTW0_IN, PTW0_IN_PU } 1955 PTW0_FN, PTW0_OUT, PTW0_IN, PTW0_IN_PU }
1742 }, 1956 },
@@ -1761,32 +1975,32 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1761 PTY0_FN, PTY0_OUT, PTY0_IN, PTY0_IN_PU } 1975 PTY0_FN, PTY0_OUT, PTY0_IN, PTY0_IN_PU }
1762 }, 1976 },
1763 { PINMUX_CFG_REG("PZCR", 0xffec0032, 16, 2) { 1977 { PINMUX_CFG_REG("PZCR", 0xffec0032, 16, 2) {
1764 0, PTZ7_OUT, PTZ7_IN, 0, 1978 PTZ7_FN, PTZ7_OUT, PTZ7_IN, 0,
1765 0, PTZ6_OUT, PTZ6_IN, 0, 1979 PTZ6_FN, PTZ6_OUT, PTZ6_IN, 0,
1766 0, PTZ5_OUT, PTZ5_IN, 0, 1980 PTZ5_FN, PTZ5_OUT, PTZ5_IN, 0,
1767 0, PTZ4_OUT, PTZ4_IN, 0, 1981 PTZ4_FN, PTZ4_OUT, PTZ4_IN, 0,
1768 0, PTZ3_OUT, PTZ3_IN, 0, 1982 PTZ3_FN, PTZ3_OUT, PTZ3_IN, 0,
1769 0, PTZ2_OUT, PTZ2_IN, 0, 1983 PTZ2_FN, PTZ2_OUT, PTZ2_IN, 0,
1770 0, PTZ1_OUT, PTZ1_IN, 0, 1984 PTZ1_FN, PTZ1_OUT, PTZ1_IN, 0,
1771 0, PTZ0_OUT, PTZ0_IN, 0 } 1985 PTZ0_FN, PTZ0_OUT, PTZ0_IN, 0 }
1772 }, 1986 },
1773 1987
1774 { PINMUX_CFG_REG("PSEL0", 0xffec0070, 16, 1) { 1988 { PINMUX_CFG_REG("PSEL0", 0xffec0070, 16, 1) {
1775 PS0_15_FN3, PS0_15_FN1, 1989 PS0_15_FN1, PS0_15_FN2,
1776 PS0_14_FN3, PS0_14_FN1, 1990 PS0_14_FN1, PS0_14_FN2,
1777 PS0_13_FN3, PS0_13_FN1, 1991 PS0_13_FN1, PS0_13_FN2,
1778 PS0_12_FN3, PS0_12_FN1, 1992 PS0_12_FN1, PS0_12_FN2,
1779 0, 0, 1993 PS0_11_FN1, PS0_11_FN2,
1780 0, 0, 1994 PS0_10_FN1, PS0_10_FN2,
1995 PS0_9_FN1, PS0_9_FN2,
1996 PS0_8_FN1, PS0_8_FN2,
1997 PS0_7_FN1, PS0_7_FN2,
1998 PS0_6_FN1, PS0_6_FN2,
1999 PS0_5_FN1, PS0_5_FN2,
2000 PS0_4_FN1, PS0_4_FN2,
2001 PS0_3_FN1, PS0_3_FN2,
2002 PS0_2_FN1, PS0_2_FN2,
1781 0, 0, 2003 0, 0,
1782 0, 0,
1783 PS0_7_FN2, PS0_7_FN1,
1784 PS0_6_FN2, PS0_6_FN1,
1785 PS0_5_FN2, PS0_5_FN1,
1786 PS0_4_FN2, PS0_4_FN1,
1787 PS0_3_FN2, PS0_3_FN1,
1788 PS0_2_FN2, PS0_2_FN1,
1789 PS0_1_FN2, PS0_1_FN1,
1790 0, 0, } 2004 0, 0, }
1791 }, 2005 },
1792 { PINMUX_CFG_REG("PSEL1", 0xffec0072, 16, 1) { 2006 { PINMUX_CFG_REG("PSEL1", 0xffec0072, 16, 1) {
@@ -1795,73 +2009,136 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1795 0, 0, 2009 0, 0,
1796 0, 0, 2010 0, 0,
1797 0, 0, 2011 0, 0,
2012 PS1_10_FN1, PS1_10_FN2,
2013 PS1_9_FN1, PS1_9_FN2,
2014 PS1_8_FN1, PS1_8_FN2,
1798 0, 0, 2015 0, 0,
1799 0, 0, 2016 0, 0,
1800 0, 0, 2017 0, 0,
1801 PS1_7_FN1, PS1_7_FN3,
1802 PS1_6_FN1, PS1_6_FN3,
1803 0, 0,
1804 0, 0,
1805 0, 0, 2018 0, 0,
1806 0, 0, 2019 0, 0,
2020 PS1_2_FN1, PS1_2_FN2,
1807 0, 0, 2021 0, 0,
1808 0, 0, } 2022 0, 0, }
1809 }, 2023 },
1810 { PINMUX_CFG_REG("PSEL2", 0xffec0074, 16, 1) { 2024 { PINMUX_CFG_REG("PSEL2", 0xffec0074, 16, 1) {
1811 0, 0, 2025 0, 0,
1812 0, 0, 2026 0, 0,
1813 PS2_13_FN3, PS2_13_FN1, 2027 PS2_13_FN1, PS2_13_FN2,
1814 PS2_12_FN3, PS2_12_FN1, 2028 PS2_12_FN1, PS2_12_FN2,
1815 0, 0, 2029 0, 0,
1816 0, 0, 2030 0, 0,
1817 0, 0, 2031 0, 0,
1818 0, 0, 2032 0, 0,
2033 PS2_7_FN1, PS2_7_FN2,
2034 PS2_6_FN1, PS2_6_FN2,
2035 PS2_5_FN1, PS2_5_FN2,
2036 PS2_4_FN1, PS2_4_FN2,
1819 0, 0, 2037 0, 0,
2038 PS2_2_FN1, PS2_2_FN2,
1820 0, 0, 2039 0, 0,
2040 0, 0, }
2041 },
2042 { PINMUX_CFG_REG("PSEL3", 0xffec0076, 16, 1) {
2043 PS3_15_FN1, PS3_15_FN2,
2044 PS3_14_FN1, PS3_14_FN2,
2045 PS3_13_FN1, PS3_13_FN2,
2046 PS3_12_FN1, PS3_12_FN2,
2047 PS3_11_FN1, PS3_11_FN2,
2048 PS3_10_FN1, PS3_10_FN2,
2049 PS3_9_FN1, PS3_9_FN2,
2050 PS3_8_FN1, PS3_8_FN2,
2051 PS3_7_FN1, PS3_7_FN2,
1821 0, 0, 2052 0, 0,
1822 0, 0, 2053 0, 0,
1823 0, 0, 2054 0, 0,
1824 0, 0, 2055 0, 0,
1825 PS2_1_FN1, PS2_1_FN2, 2056 PS3_2_FN1, PS3_2_FN2,
1826 PS2_0_FN1, PS2_0_FN2, } 2057 PS3_1_FN1, PS3_1_FN2,
2058 0, 0, }
1827 }, 2059 },
2060
1828 { PINMUX_CFG_REG("PSEL4", 0xffec0078, 16, 1) { 2061 { PINMUX_CFG_REG("PSEL4", 0xffec0078, 16, 1) {
1829 PS4_15_FN2, PS4_15_FN1,
1830 PS4_14_FN2, PS4_14_FN1,
1831 PS4_13_FN2, PS4_13_FN1,
1832 PS4_12_FN2, PS4_12_FN1,
1833 PS4_11_FN2, PS4_11_FN1,
1834 PS4_10_FN2, PS4_10_FN1,
1835 PS4_9_FN2, PS4_9_FN1,
1836 0, 0, 2062 0, 0,
2063 PS4_14_FN1, PS4_14_FN2,
2064 PS4_13_FN1, PS4_13_FN2,
2065 PS4_12_FN1, PS4_12_FN2,
1837 0, 0, 2066 0, 0,
2067 PS4_10_FN1, PS4_10_FN2,
2068 PS4_9_FN1, PS4_9_FN2,
2069 PS4_8_FN1, PS4_8_FN2,
1838 0, 0, 2070 0, 0,
1839 0, 0, 2071 0, 0,
1840 0, 0, 2072 0, 0,
1841 PS4_3_FN2, PS4_3_FN1, 2073 PS4_4_FN1, PS4_4_FN2,
1842 PS4_2_FN2, PS4_2_FN1, 2074 PS4_3_FN1, PS4_3_FN2,
1843 PS4_1_FN2, PS4_1_FN1, 2075 PS4_2_FN1, PS4_2_FN2,
1844 PS4_0_FN2, PS4_0_FN1, } 2076 PS4_1_FN1, PS4_1_FN2,
2077 PS4_0_FN1, PS4_0_FN2, }
1845 }, 2078 },
1846 { PINMUX_CFG_REG("PSEL5", 0xffec007a, 16, 1) { 2079 { PINMUX_CFG_REG("PSEL5", 0xffec007a, 16, 1) {
1847 0, 0, 2080 0, 0,
1848 0, 0, 2081 0, 0,
1849 0, 0, 2082 0, 0,
1850 0, 0, 2083 0, 0,
1851 0, 0, 2084 PS5_11_FN1, PS5_11_FN2,
1852 0, 0, 2085 PS5_10_FN1, PS5_10_FN2,
1853 PS5_9_FN1, PS5_9_FN2, 2086 PS5_9_FN1, PS5_9_FN2,
1854 PS5_8_FN1, PS5_8_FN2, 2087 PS5_8_FN1, PS5_8_FN2,
1855 PS5_7_FN1, PS5_7_FN2, 2088 PS5_7_FN1, PS5_7_FN2,
1856 PS5_6_FN1, PS5_6_FN2, 2089 PS5_6_FN1, PS5_6_FN2,
1857 PS5_5_FN1, PS5_5_FN2, 2090 PS5_5_FN1, PS5_5_FN2,
2091 PS5_4_FN1, PS5_4_FN2,
2092 PS5_3_FN1, PS5_3_FN2,
2093 PS5_2_FN1, PS5_2_FN2,
2094 0, 0,
2095 0, 0, }
2096 },
2097 { PINMUX_CFG_REG("PSEL6", 0xffec007c, 16, 1) {
2098 PS6_15_FN1, PS6_15_FN2,
2099 PS6_14_FN1, PS6_14_FN2,
2100 PS6_13_FN1, PS6_13_FN2,
2101 PS6_12_FN1, PS6_12_FN2,
2102 PS6_11_FN1, PS6_11_FN2,
2103 PS6_10_FN1, PS6_10_FN2,
2104 PS6_9_FN1, PS6_9_FN2,
2105 PS6_8_FN1, PS6_8_FN2,
2106 PS6_7_FN1, PS6_7_FN2,
2107 PS6_6_FN1, PS6_6_FN2,
2108 PS6_5_FN1, PS6_5_FN2,
2109 PS6_4_FN1, PS6_4_FN2,
2110 PS6_3_FN1, PS6_3_FN2,
2111 PS6_2_FN1, PS6_2_FN2,
2112 PS6_1_FN1, PS6_1_FN2,
2113 PS6_0_FN1, PS6_0_FN2, }
2114 },
2115 { PINMUX_CFG_REG("PSEL7", 0xffec0082, 16, 1) {
2116 PS7_15_FN1, PS7_15_FN2,
2117 PS7_14_FN1, PS7_14_FN2,
2118 PS7_13_FN1, PS7_13_FN2,
2119 PS7_12_FN1, PS7_12_FN2,
2120 PS7_11_FN1, PS7_11_FN2,
2121 PS7_10_FN1, PS7_10_FN2,
2122 PS7_9_FN1, PS7_9_FN2,
2123 PS7_8_FN1, PS7_8_FN2,
2124 PS7_7_FN1, PS7_7_FN2,
2125 PS7_6_FN1, PS7_6_FN2,
2126 PS7_5_FN1, PS7_5_FN2,
1858 0, 0, 2127 0, 0,
1859 0, 0, 2128 0, 0,
1860 0, 0, 2129 0, 0,
1861 0, 0, 2130 0, 0,
1862 0, 0, } 2131 0, 0, }
1863 }, 2132 },
1864 { PINMUX_CFG_REG("PSEL6", 0xffec007c, 16, 1) { 2133 { PINMUX_CFG_REG("PSEL8", 0xffec0084, 16, 1) {
2134 PS8_15_FN1, PS8_15_FN2,
2135 PS8_14_FN1, PS8_14_FN2,
2136 PS8_13_FN1, PS8_13_FN2,
2137 PS8_12_FN1, PS8_12_FN2,
2138 PS8_11_FN1, PS8_11_FN2,
2139 PS8_10_FN1, PS8_10_FN2,
2140 PS8_9_FN1, PS8_9_FN2,
2141 PS8_8_FN1, PS8_8_FN2,
1865 0, 0, 2142 0, 0,
1866 0, 0, 2143 0, 0,
1867 0, 0, 2144 0, 0,
@@ -1869,15 +2146,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
1869 0, 0, 2146 0, 0,
1870 0, 0, 2147 0, 0,
1871 0, 0, 2148 0, 0,
1872 0, 0, 2149 0, 0, }
1873 PS6_7_FN_AN, PS6_7_FN_EV,
1874 PS6_6_FN_AN, PS6_6_FN_EV,
1875 PS6_5_FN_AN, PS6_5_FN_EV,
1876 PS6_4_FN_AN, PS6_4_FN_EV,
1877 PS6_3_FN_AN, PS6_3_FN_EV,
1878 PS6_2_FN_AN, PS6_2_FN_EV,
1879 PS6_1_FN_AN, PS6_1_FN_EV,
1880 PS6_0_FN_AN, PS6_0_FN_EV, }
1881 }, 2150 },
1882 {} 2151 {}
1883}; 2152};
@@ -1920,7 +2189,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1920 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA } 2189 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA }
1921 }, 2190 },
1922 { PINMUX_DATA_REG("PJDR", 0xffec0046, 8) { 2191 { PINMUX_DATA_REG("PJDR", 0xffec0046, 8) {
1923 PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, PTJ4_DATA, 2192 0, PTJ6_DATA, PTJ5_DATA, PTJ4_DATA,
1924 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA } 2193 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA }
1925 }, 2194 },
1926 { PINMUX_DATA_REG("PKDR", 0xffec0048, 8) { 2195 { PINMUX_DATA_REG("PKDR", 0xffec0048, 8) {
@@ -1928,15 +2197,15 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1928 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA } 2197 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA }
1929 }, 2198 },
1930 { PINMUX_DATA_REG("PLDR", 0xffec004a, 8) { 2199 { PINMUX_DATA_REG("PLDR", 0xffec004a, 8) {
1931 PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA, 2200 0, PTL6_DATA, PTL5_DATA, PTL4_DATA,
1932 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA } 2201 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA }
1933 }, 2202 },
1934 { PINMUX_DATA_REG("PMDR", 0xffec004c, 8) { 2203 { PINMUX_DATA_REG("PMDR", 0xffec004c, 8) {
1935 0, PTM6_DATA, PTM5_DATA, PTM4_DATA, 2204 PTM7_DATA, PTM6_DATA, PTM5_DATA, PTM4_DATA,
1936 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA } 2205 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA }
1937 }, 2206 },
1938 { PINMUX_DATA_REG("PNDR", 0xffec004e, 8) { 2207 { PINMUX_DATA_REG("PNDR", 0xffec004e, 8) {
1939 PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA, 2208 0, PTN6_DATA, PTN5_DATA, PTN4_DATA,
1940 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA } 2209 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA }
1941 }, 2210 },
1942 { PINMUX_DATA_REG("PODR", 0xffec0050, 8) { 2211 { PINMUX_DATA_REG("PODR", 0xffec0050, 8) {
@@ -1944,7 +2213,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1944 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA } 2213 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA }
1945 }, 2214 },
1946 { PINMUX_DATA_REG("PPDR", 0xffec0052, 8) { 2215 { PINMUX_DATA_REG("PPDR", 0xffec0052, 8) {
1947 0, PTP6_DATA, PTP5_DATA, PTP4_DATA, 2216 PTP7_DATA, PTP6_DATA, PTP5_DATA, PTP4_DATA,
1948 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA } 2217 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA }
1949 }, 2218 },
1950 { PINMUX_DATA_REG("PQDR", 0xffec0054, 8) { 2219 { PINMUX_DATA_REG("PQDR", 0xffec0054, 8) {
@@ -1960,7 +2229,7 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1960 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA } 2229 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA }
1961 }, 2230 },
1962 { PINMUX_DATA_REG("PTDR", 0xffec005a, 8) { 2231 { PINMUX_DATA_REG("PTDR", 0xffec005a, 8) {
1963 0, 0, PTT5_DATA, PTT4_DATA, 2232 PTT7_DATA, PTT6_DATA, PTT5_DATA, PTT4_DATA,
1964 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA } 2233 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA }
1965 }, 2234 },
1966 { PINMUX_DATA_REG("PUDR", 0xffec005c, 8) { 2235 { PINMUX_DATA_REG("PUDR", 0xffec005c, 8) {
@@ -2000,8 +2269,8 @@ static struct pinmux_info sh7757_pinmux_info = {
2000 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END }, 2269 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2001 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 2270 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2002 2271
2003 .first_gpio = GPIO_PTA7, 2272 .first_gpio = GPIO_PTA0,
2004 .last_gpio = GPIO_FN_D0, 2273 .last_gpio = GPIO_FN_ON_DQ0,
2005 2274
2006 .gpios = pinmux_gpios, 2275 .gpios = pinmux_gpios,
2007 .cfg_regs = pinmux_config_regs, 2276 .cfg_regs = pinmux_config_regs,
@@ -2015,5 +2284,4 @@ static int __init plat_pinmux_setup(void)
2015{ 2284{
2016 return register_pinmux(&sh7757_pinmux_info); 2285 return register_pinmux(&sh7757_pinmux_info);
2017} 2286}
2018
2019arch_initcall(plat_pinmux_setup); 2287arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
new file mode 100644
index 000000000000..aaa5338abbff
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-shx3.c
@@ -0,0 +1,587 @@
1/*
2 * SH-X3 prototype CPU pinmux
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/gpio.h>
13#include <cpu/shx3.h>
14
15enum {
16 PINMUX_RESERVED = 0,
17
18 PINMUX_DATA_BEGIN,
19 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
20 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA,
21 PB7_DATA, PB6_DATA, PB5_DATA, PB4_DATA,
22 PB3_DATA, PB2_DATA, PB1_DATA, PB0_DATA,
23 PC7_DATA, PC6_DATA, PC5_DATA, PC4_DATA,
24 PC3_DATA, PC2_DATA, PC1_DATA, PC0_DATA,
25 PD7_DATA, PD6_DATA, PD5_DATA, PD4_DATA,
26 PD3_DATA, PD2_DATA, PD1_DATA, PD0_DATA,
27 PE7_DATA, PE6_DATA, PE5_DATA, PE4_DATA,
28 PE3_DATA, PE2_DATA, PE1_DATA, PE0_DATA,
29 PF7_DATA, PF6_DATA, PF5_DATA, PF4_DATA,
30 PF3_DATA, PF2_DATA, PF1_DATA, PF0_DATA,
31 PG7_DATA, PG6_DATA, PG5_DATA, PG4_DATA,
32 PG3_DATA, PG2_DATA, PG1_DATA, PG0_DATA,
33
34 PH5_DATA, PH4_DATA,
35 PH3_DATA, PH2_DATA, PH1_DATA, PH0_DATA,
36 PINMUX_DATA_END,
37
38 PINMUX_INPUT_BEGIN,
39 PA7_IN, PA6_IN, PA5_IN, PA4_IN,
40 PA3_IN, PA2_IN, PA1_IN, PA0_IN,
41 PB7_IN, PB6_IN, PB5_IN, PB4_IN,
42 PB3_IN, PB2_IN, PB1_IN, PB0_IN,
43 PC7_IN, PC6_IN, PC5_IN, PC4_IN,
44 PC3_IN, PC2_IN, PC1_IN, PC0_IN,
45 PD7_IN, PD6_IN, PD5_IN, PD4_IN,
46 PD3_IN, PD2_IN, PD1_IN, PD0_IN,
47 PE7_IN, PE6_IN, PE5_IN, PE4_IN,
48 PE3_IN, PE2_IN, PE1_IN, PE0_IN,
49 PF7_IN, PF6_IN, PF5_IN, PF4_IN,
50 PF3_IN, PF2_IN, PF1_IN, PF0_IN,
51 PG7_IN, PG6_IN, PG5_IN, PG4_IN,
52 PG3_IN, PG2_IN, PG1_IN, PG0_IN,
53
54 PH5_IN, PH4_IN,
55 PH3_IN, PH2_IN, PH1_IN, PH0_IN,
56 PINMUX_INPUT_END,
57
58 PINMUX_INPUT_PULLUP_BEGIN,
59 PA7_IN_PU, PA6_IN_PU, PA5_IN_PU, PA4_IN_PU,
60 PA3_IN_PU, PA2_IN_PU, PA1_IN_PU, PA0_IN_PU,
61 PB7_IN_PU, PB6_IN_PU, PB5_IN_PU, PB4_IN_PU,
62 PB3_IN_PU, PB2_IN_PU, PB1_IN_PU, PB0_IN_PU,
63 PC7_IN_PU, PC6_IN_PU, PC5_IN_PU, PC4_IN_PU,
64 PC3_IN_PU, PC2_IN_PU, PC1_IN_PU, PC0_IN_PU,
65 PD7_IN_PU, PD6_IN_PU, PD5_IN_PU, PD4_IN_PU,
66 PD3_IN_PU, PD2_IN_PU, PD1_IN_PU, PD0_IN_PU,
67 PE7_IN_PU, PE6_IN_PU, PE5_IN_PU, PE4_IN_PU,
68 PE3_IN_PU, PE2_IN_PU, PE1_IN_PU, PE0_IN_PU,
69 PF7_IN_PU, PF6_IN_PU, PF5_IN_PU, PF4_IN_PU,
70 PF3_IN_PU, PF2_IN_PU, PF1_IN_PU, PF0_IN_PU,
71 PG7_IN_PU, PG6_IN_PU, PG5_IN_PU, PG4_IN_PU,
72 PG3_IN_PU, PG2_IN_PU, PG1_IN_PU, PG0_IN_PU,
73
74 PH5_IN_PU, PH4_IN_PU,
75 PH3_IN_PU, PH2_IN_PU, PH1_IN_PU, PH0_IN_PU,
76 PINMUX_INPUT_PULLUP_END,
77
78 PINMUX_OUTPUT_BEGIN,
79 PA7_OUT, PA6_OUT, PA5_OUT, PA4_OUT,
80 PA3_OUT, PA2_OUT, PA1_OUT, PA0_OUT,
81 PB7_OUT, PB6_OUT, PB5_OUT, PB4_OUT,
82 PB3_OUT, PB2_OUT, PB1_OUT, PB0_OUT,
83 PC7_OUT, PC6_OUT, PC5_OUT, PC4_OUT,
84 PC3_OUT, PC2_OUT, PC1_OUT, PC0_OUT,
85 PD7_OUT, PD6_OUT, PD5_OUT, PD4_OUT,
86 PD3_OUT, PD2_OUT, PD1_OUT, PD0_OUT,
87 PE7_OUT, PE6_OUT, PE5_OUT, PE4_OUT,
88 PE3_OUT, PE2_OUT, PE1_OUT, PE0_OUT,
89 PF7_OUT, PF6_OUT, PF5_OUT, PF4_OUT,
90 PF3_OUT, PF2_OUT, PF1_OUT, PF0_OUT,
91 PG7_OUT, PG6_OUT, PG5_OUT, PG4_OUT,
92 PG3_OUT, PG2_OUT, PG1_OUT, PG0_OUT,
93
94 PH5_OUT, PH4_OUT,
95 PH3_OUT, PH2_OUT, PH1_OUT, PH0_OUT,
96 PINMUX_OUTPUT_END,
97
98 PINMUX_FUNCTION_BEGIN,
99 PA7_FN, PA6_FN, PA5_FN, PA4_FN,
100 PA3_FN, PA2_FN, PA1_FN, PA0_FN,
101 PB7_FN, PB6_FN, PB5_FN, PB4_FN,
102 PB3_FN, PB2_FN, PB1_FN, PB0_FN,
103 PC7_FN, PC6_FN, PC5_FN, PC4_FN,
104 PC3_FN, PC2_FN, PC1_FN, PC0_FN,
105 PD7_FN, PD6_FN, PD5_FN, PD4_FN,
106 PD3_FN, PD2_FN, PD1_FN, PD0_FN,
107 PE7_FN, PE6_FN, PE5_FN, PE4_FN,
108 PE3_FN, PE2_FN, PE1_FN, PE0_FN,
109 PF7_FN, PF6_FN, PF5_FN, PF4_FN,
110 PF3_FN, PF2_FN, PF1_FN, PF0_FN,
111 PG7_FN, PG6_FN, PG5_FN, PG4_FN,
112 PG3_FN, PG2_FN, PG1_FN, PG0_FN,
113
114 PH5_FN, PH4_FN,
115 PH3_FN, PH2_FN, PH1_FN, PH0_FN,
116 PINMUX_FUNCTION_END,
117
118 PINMUX_MARK_BEGIN,
119
120 D31_MARK, D30_MARK, D29_MARK, D28_MARK, D27_MARK, D26_MARK,
121 D25_MARK, D24_MARK, D23_MARK, D22_MARK, D21_MARK, D20_MARK,
122 D19_MARK, D18_MARK, D17_MARK, D16_MARK,
123
124 BACK_MARK, BREQ_MARK,
125 WE3_MARK, WE2_MARK,
126 CS6_MARK, CS5_MARK, CS4_MARK,
127 CLKOUTENB_MARK,
128
129 DACK3_MARK, DACK2_MARK, DACK1_MARK, DACK0_MARK,
130 DREQ3_MARK, DREQ2_MARK, DREQ1_MARK, DREQ0_MARK,
131
132 IRQ3_MARK, IRQ2_MARK, IRQ1_MARK, IRQ0_MARK,
133
134 DRAK3_MARK, DRAK2_MARK, DRAK1_MARK, DRAK0_MARK,
135
136 SCK3_MARK, SCK2_MARK, SCK1_MARK, SCK0_MARK,
137 IRL3_MARK, IRL2_MARK, IRL1_MARK, IRL0_MARK,
138 TXD3_MARK, TXD2_MARK, TXD1_MARK, TXD0_MARK,
139 RXD3_MARK, RXD2_MARK, RXD1_MARK, RXD0_MARK,
140
141 CE2B_MARK, CE2A_MARK, IOIS16_MARK,
142 STATUS1_MARK, STATUS0_MARK,
143
144 IRQOUT_MARK,
145
146 PINMUX_MARK_END,
147};
148
149static pinmux_enum_t shx3_pinmux_data[] = {
150
151 /* PA GPIO */
152 PINMUX_DATA(PA7_DATA, PA7_IN, PA7_OUT, PA7_IN_PU),
153 PINMUX_DATA(PA6_DATA, PA6_IN, PA6_OUT, PA6_IN_PU),
154 PINMUX_DATA(PA5_DATA, PA5_IN, PA5_OUT, PA5_IN_PU),
155 PINMUX_DATA(PA4_DATA, PA4_IN, PA4_OUT, PA4_IN_PU),
156 PINMUX_DATA(PA3_DATA, PA3_IN, PA3_OUT, PA3_IN_PU),
157 PINMUX_DATA(PA2_DATA, PA2_IN, PA2_OUT, PA2_IN_PU),
158 PINMUX_DATA(PA1_DATA, PA1_IN, PA1_OUT, PA1_IN_PU),
159 PINMUX_DATA(PA0_DATA, PA0_IN, PA0_OUT, PA0_IN_PU),
160
161 /* PB GPIO */
162 PINMUX_DATA(PB7_DATA, PB7_IN, PB7_OUT, PB7_IN_PU),
163 PINMUX_DATA(PB6_DATA, PB6_IN, PB6_OUT, PB6_IN_PU),
164 PINMUX_DATA(PB5_DATA, PB5_IN, PB5_OUT, PB5_IN_PU),
165 PINMUX_DATA(PB4_DATA, PB4_IN, PB4_OUT, PB4_IN_PU),
166 PINMUX_DATA(PB3_DATA, PB3_IN, PB3_OUT, PB3_IN_PU),
167 PINMUX_DATA(PB2_DATA, PB2_IN, PB2_OUT, PB2_IN_PU),
168 PINMUX_DATA(PB1_DATA, PB1_IN, PB1_OUT, PB1_IN_PU),
169 PINMUX_DATA(PB0_DATA, PB0_IN, PB0_OUT, PB0_IN_PU),
170
171 /* PC GPIO */
172 PINMUX_DATA(PC7_DATA, PC7_IN, PC7_OUT, PC7_IN_PU),
173 PINMUX_DATA(PC6_DATA, PC6_IN, PC6_OUT, PC6_IN_PU),
174 PINMUX_DATA(PC5_DATA, PC5_IN, PC5_OUT, PC5_IN_PU),
175 PINMUX_DATA(PC4_DATA, PC4_IN, PC4_OUT, PC4_IN_PU),
176 PINMUX_DATA(PC3_DATA, PC3_IN, PC3_OUT, PC3_IN_PU),
177 PINMUX_DATA(PC2_DATA, PC2_IN, PC2_OUT, PC2_IN_PU),
178 PINMUX_DATA(PC1_DATA, PC1_IN, PC1_OUT, PC1_IN_PU),
179 PINMUX_DATA(PC0_DATA, PC0_IN, PC0_OUT, PC0_IN_PU),
180
181 /* PD GPIO */
182 PINMUX_DATA(PD7_DATA, PD7_IN, PD7_OUT, PD7_IN_PU),
183 PINMUX_DATA(PD6_DATA, PD6_IN, PD6_OUT, PD6_IN_PU),
184 PINMUX_DATA(PD5_DATA, PD5_IN, PD5_OUT, PD5_IN_PU),
185 PINMUX_DATA(PD4_DATA, PD4_IN, PD4_OUT, PD4_IN_PU),
186 PINMUX_DATA(PD3_DATA, PD3_IN, PD3_OUT, PD3_IN_PU),
187 PINMUX_DATA(PD2_DATA, PD2_IN, PD2_OUT, PD2_IN_PU),
188 PINMUX_DATA(PD1_DATA, PD1_IN, PD1_OUT, PD1_IN_PU),
189 PINMUX_DATA(PD0_DATA, PD0_IN, PD0_OUT, PD0_IN_PU),
190
191 /* PE GPIO */
192 PINMUX_DATA(PE7_DATA, PE7_IN, PE7_OUT, PE7_IN_PU),
193 PINMUX_DATA(PE6_DATA, PE6_IN, PE6_OUT, PE6_IN_PU),
194 PINMUX_DATA(PE5_DATA, PE5_IN, PE5_OUT, PE5_IN_PU),
195 PINMUX_DATA(PE4_DATA, PE4_IN, PE4_OUT, PE4_IN_PU),
196 PINMUX_DATA(PE3_DATA, PE3_IN, PE3_OUT, PE3_IN_PU),
197 PINMUX_DATA(PE2_DATA, PE2_IN, PE2_OUT, PE2_IN_PU),
198 PINMUX_DATA(PE1_DATA, PE1_IN, PE1_OUT, PE1_IN_PU),
199 PINMUX_DATA(PE0_DATA, PE0_IN, PE0_OUT, PE0_IN_PU),
200
201 /* PF GPIO */
202 PINMUX_DATA(PF7_DATA, PF7_IN, PF7_OUT, PF7_IN_PU),
203 PINMUX_DATA(PF6_DATA, PF6_IN, PF6_OUT, PF6_IN_PU),
204 PINMUX_DATA(PF5_DATA, PF5_IN, PF5_OUT, PF5_IN_PU),
205 PINMUX_DATA(PF4_DATA, PF4_IN, PF4_OUT, PF4_IN_PU),
206 PINMUX_DATA(PF3_DATA, PF3_IN, PF3_OUT, PF3_IN_PU),
207 PINMUX_DATA(PF2_DATA, PF2_IN, PF2_OUT, PF2_IN_PU),
208 PINMUX_DATA(PF1_DATA, PF1_IN, PF1_OUT, PF1_IN_PU),
209 PINMUX_DATA(PF0_DATA, PF0_IN, PF0_OUT, PF0_IN_PU),
210
211 /* PG GPIO */
212 PINMUX_DATA(PG7_DATA, PG7_IN, PG7_OUT, PG7_IN_PU),
213 PINMUX_DATA(PG6_DATA, PG6_IN, PG6_OUT, PG6_IN_PU),
214 PINMUX_DATA(PG5_DATA, PG5_IN, PG5_OUT, PG5_IN_PU),
215 PINMUX_DATA(PG4_DATA, PG4_IN, PG4_OUT, PG4_IN_PU),
216 PINMUX_DATA(PG3_DATA, PG3_IN, PG3_OUT, PG3_IN_PU),
217 PINMUX_DATA(PG2_DATA, PG2_IN, PG2_OUT, PG2_IN_PU),
218 PINMUX_DATA(PG1_DATA, PG1_IN, PG1_OUT, PG1_IN_PU),
219 PINMUX_DATA(PG0_DATA, PG0_IN, PG0_OUT, PG0_IN_PU),
220
221 /* PH GPIO */
222 PINMUX_DATA(PH5_DATA, PH5_IN, PH5_OUT, PH5_IN_PU),
223 PINMUX_DATA(PH4_DATA, PH4_IN, PH4_OUT, PH4_IN_PU),
224 PINMUX_DATA(PH3_DATA, PH3_IN, PH3_OUT, PH3_IN_PU),
225 PINMUX_DATA(PH2_DATA, PH2_IN, PH2_OUT, PH2_IN_PU),
226 PINMUX_DATA(PH1_DATA, PH1_IN, PH1_OUT, PH1_IN_PU),
227 PINMUX_DATA(PH0_DATA, PH0_IN, PH0_OUT, PH0_IN_PU),
228
229 /* PA FN */
230 PINMUX_DATA(D31_MARK, PA7_FN),
231 PINMUX_DATA(D30_MARK, PA6_FN),
232 PINMUX_DATA(D29_MARK, PA5_FN),
233 PINMUX_DATA(D28_MARK, PA4_FN),
234 PINMUX_DATA(D27_MARK, PA3_FN),
235 PINMUX_DATA(D26_MARK, PA2_FN),
236 PINMUX_DATA(D25_MARK, PA1_FN),
237 PINMUX_DATA(D24_MARK, PA0_FN),
238
239 /* PB FN */
240 PINMUX_DATA(D23_MARK, PB7_FN),
241 PINMUX_DATA(D22_MARK, PB6_FN),
242 PINMUX_DATA(D21_MARK, PB5_FN),
243 PINMUX_DATA(D20_MARK, PB4_FN),
244 PINMUX_DATA(D19_MARK, PB3_FN),
245 PINMUX_DATA(D18_MARK, PB2_FN),
246 PINMUX_DATA(D17_MARK, PB1_FN),
247 PINMUX_DATA(D16_MARK, PB0_FN),
248
249 /* PC FN */
250 PINMUX_DATA(BACK_MARK, PC7_FN),
251 PINMUX_DATA(BREQ_MARK, PC6_FN),
252 PINMUX_DATA(WE3_MARK, PC5_FN),
253 PINMUX_DATA(WE2_MARK, PC4_FN),
254 PINMUX_DATA(CS6_MARK, PC3_FN),
255 PINMUX_DATA(CS5_MARK, PC2_FN),
256 PINMUX_DATA(CS4_MARK, PC1_FN),
257 PINMUX_DATA(CLKOUTENB_MARK, PC0_FN),
258
259 /* PD FN */
260 PINMUX_DATA(DACK3_MARK, PD7_FN),
261 PINMUX_DATA(DACK2_MARK, PD6_FN),
262 PINMUX_DATA(DACK1_MARK, PD5_FN),
263 PINMUX_DATA(DACK0_MARK, PD4_FN),
264 PINMUX_DATA(DREQ3_MARK, PD3_FN),
265 PINMUX_DATA(DREQ2_MARK, PD2_FN),
266 PINMUX_DATA(DREQ1_MARK, PD1_FN),
267 PINMUX_DATA(DREQ0_MARK, PD0_FN),
268
269 /* PE FN */
270 PINMUX_DATA(IRQ3_MARK, PE7_FN),
271 PINMUX_DATA(IRQ2_MARK, PE6_FN),
272 PINMUX_DATA(IRQ1_MARK, PE5_FN),
273 PINMUX_DATA(IRQ0_MARK, PE4_FN),
274 PINMUX_DATA(DRAK3_MARK, PE3_FN),
275 PINMUX_DATA(DRAK2_MARK, PE2_FN),
276 PINMUX_DATA(DRAK1_MARK, PE1_FN),
277 PINMUX_DATA(DRAK0_MARK, PE0_FN),
278
279 /* PF FN */
280 PINMUX_DATA(SCK3_MARK, PF7_FN),
281 PINMUX_DATA(SCK2_MARK, PF6_FN),
282 PINMUX_DATA(SCK1_MARK, PF5_FN),
283 PINMUX_DATA(SCK0_MARK, PF4_FN),
284 PINMUX_DATA(IRL3_MARK, PF3_FN),
285 PINMUX_DATA(IRL2_MARK, PF2_FN),
286 PINMUX_DATA(IRL1_MARK, PF1_FN),
287 PINMUX_DATA(IRL0_MARK, PF0_FN),
288
289 /* PG FN */
290 PINMUX_DATA(TXD3_MARK, PG7_FN),
291 PINMUX_DATA(TXD2_MARK, PG6_FN),
292 PINMUX_DATA(TXD1_MARK, PG5_FN),
293 PINMUX_DATA(TXD0_MARK, PG4_FN),
294 PINMUX_DATA(RXD3_MARK, PG3_FN),
295 PINMUX_DATA(RXD2_MARK, PG2_FN),
296 PINMUX_DATA(RXD1_MARK, PG1_FN),
297 PINMUX_DATA(RXD0_MARK, PG0_FN),
298
299 /* PH FN */
300 PINMUX_DATA(CE2B_MARK, PH5_FN),
301 PINMUX_DATA(CE2A_MARK, PH4_FN),
302 PINMUX_DATA(IOIS16_MARK, PH3_FN),
303 PINMUX_DATA(STATUS1_MARK, PH2_FN),
304 PINMUX_DATA(STATUS0_MARK, PH1_FN),
305 PINMUX_DATA(IRQOUT_MARK, PH0_FN),
306};
307
308static struct pinmux_gpio shx3_pinmux_gpios[] = {
309 /* PA */
310 PINMUX_GPIO(GPIO_PA7, PA7_DATA),
311 PINMUX_GPIO(GPIO_PA6, PA6_DATA),
312 PINMUX_GPIO(GPIO_PA5, PA5_DATA),
313 PINMUX_GPIO(GPIO_PA4, PA4_DATA),
314 PINMUX_GPIO(GPIO_PA3, PA3_DATA),
315 PINMUX_GPIO(GPIO_PA2, PA2_DATA),
316 PINMUX_GPIO(GPIO_PA1, PA1_DATA),
317 PINMUX_GPIO(GPIO_PA0, PA0_DATA),
318
319 /* PB */
320 PINMUX_GPIO(GPIO_PB7, PB7_DATA),
321 PINMUX_GPIO(GPIO_PB6, PB6_DATA),
322 PINMUX_GPIO(GPIO_PB5, PB5_DATA),
323 PINMUX_GPIO(GPIO_PB4, PB4_DATA),
324 PINMUX_GPIO(GPIO_PB3, PB3_DATA),
325 PINMUX_GPIO(GPIO_PB2, PB2_DATA),
326 PINMUX_GPIO(GPIO_PB1, PB1_DATA),
327 PINMUX_GPIO(GPIO_PB0, PB0_DATA),
328
329 /* PC */
330 PINMUX_GPIO(GPIO_PC7, PC7_DATA),
331 PINMUX_GPIO(GPIO_PC6, PC6_DATA),
332 PINMUX_GPIO(GPIO_PC5, PC5_DATA),
333 PINMUX_GPIO(GPIO_PC4, PC4_DATA),
334 PINMUX_GPIO(GPIO_PC3, PC3_DATA),
335 PINMUX_GPIO(GPIO_PC2, PC2_DATA),
336 PINMUX_GPIO(GPIO_PC1, PC1_DATA),
337 PINMUX_GPIO(GPIO_PC0, PC0_DATA),
338
339 /* PD */
340 PINMUX_GPIO(GPIO_PD7, PD7_DATA),
341 PINMUX_GPIO(GPIO_PD6, PD6_DATA),
342 PINMUX_GPIO(GPIO_PD5, PD5_DATA),
343 PINMUX_GPIO(GPIO_PD4, PD4_DATA),
344 PINMUX_GPIO(GPIO_PD3, PD3_DATA),
345 PINMUX_GPIO(GPIO_PD2, PD2_DATA),
346 PINMUX_GPIO(GPIO_PD1, PD1_DATA),
347 PINMUX_GPIO(GPIO_PD0, PD0_DATA),
348
349 /* PE */
350 PINMUX_GPIO(GPIO_PE7, PE7_DATA),
351 PINMUX_GPIO(GPIO_PE6, PE6_DATA),
352 PINMUX_GPIO(GPIO_PE5, PE5_DATA),
353 PINMUX_GPIO(GPIO_PE4, PE4_DATA),
354 PINMUX_GPIO(GPIO_PE3, PE3_DATA),
355 PINMUX_GPIO(GPIO_PE2, PE2_DATA),
356 PINMUX_GPIO(GPIO_PE1, PE1_DATA),
357 PINMUX_GPIO(GPIO_PE0, PE0_DATA),
358
359 /* PF */
360 PINMUX_GPIO(GPIO_PF7, PF7_DATA),
361 PINMUX_GPIO(GPIO_PF6, PF6_DATA),
362 PINMUX_GPIO(GPIO_PF5, PF5_DATA),
363 PINMUX_GPIO(GPIO_PF4, PF4_DATA),
364 PINMUX_GPIO(GPIO_PF3, PF3_DATA),
365 PINMUX_GPIO(GPIO_PF2, PF2_DATA),
366 PINMUX_GPIO(GPIO_PF1, PF1_DATA),
367 PINMUX_GPIO(GPIO_PF0, PF0_DATA),
368
369 /* PG */
370 PINMUX_GPIO(GPIO_PG7, PG7_DATA),
371 PINMUX_GPIO(GPIO_PG6, PG6_DATA),
372 PINMUX_GPIO(GPIO_PG5, PG5_DATA),
373 PINMUX_GPIO(GPIO_PG4, PG4_DATA),
374 PINMUX_GPIO(GPIO_PG3, PG3_DATA),
375 PINMUX_GPIO(GPIO_PG2, PG2_DATA),
376 PINMUX_GPIO(GPIO_PG1, PG1_DATA),
377 PINMUX_GPIO(GPIO_PG0, PG0_DATA),
378
379 /* PH */
380 PINMUX_GPIO(GPIO_PH5, PH5_DATA),
381 PINMUX_GPIO(GPIO_PH4, PH4_DATA),
382 PINMUX_GPIO(GPIO_PH3, PH3_DATA),
383 PINMUX_GPIO(GPIO_PH2, PH2_DATA),
384 PINMUX_GPIO(GPIO_PH1, PH1_DATA),
385 PINMUX_GPIO(GPIO_PH0, PH0_DATA),
386
387 /* FN */
388 PINMUX_GPIO(GPIO_FN_D31, D31_MARK),
389 PINMUX_GPIO(GPIO_FN_D30, D30_MARK),
390 PINMUX_GPIO(GPIO_FN_D29, D29_MARK),
391 PINMUX_GPIO(GPIO_FN_D28, D28_MARK),
392 PINMUX_GPIO(GPIO_FN_D27, D27_MARK),
393 PINMUX_GPIO(GPIO_FN_D26, D26_MARK),
394 PINMUX_GPIO(GPIO_FN_D25, D25_MARK),
395 PINMUX_GPIO(GPIO_FN_D24, D24_MARK),
396 PINMUX_GPIO(GPIO_FN_D23, D23_MARK),
397 PINMUX_GPIO(GPIO_FN_D22, D22_MARK),
398 PINMUX_GPIO(GPIO_FN_D21, D21_MARK),
399 PINMUX_GPIO(GPIO_FN_D20, D20_MARK),
400 PINMUX_GPIO(GPIO_FN_D19, D19_MARK),
401 PINMUX_GPIO(GPIO_FN_D18, D18_MARK),
402 PINMUX_GPIO(GPIO_FN_D17, D17_MARK),
403 PINMUX_GPIO(GPIO_FN_D16, D16_MARK),
404 PINMUX_GPIO(GPIO_FN_BACK, BACK_MARK),
405 PINMUX_GPIO(GPIO_FN_BREQ, BREQ_MARK),
406 PINMUX_GPIO(GPIO_FN_WE3, WE3_MARK),
407 PINMUX_GPIO(GPIO_FN_WE2, WE2_MARK),
408 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK),
409 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK),
410 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK),
411 PINMUX_GPIO(GPIO_FN_CLKOUTENB, CLKOUTENB_MARK),
412 PINMUX_GPIO(GPIO_FN_DACK3, DACK3_MARK),
413 PINMUX_GPIO(GPIO_FN_DACK2, DACK2_MARK),
414 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK),
415 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK),
416 PINMUX_GPIO(GPIO_FN_DREQ3, DREQ3_MARK),
417 PINMUX_GPIO(GPIO_FN_DREQ2, DREQ2_MARK),
418 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK),
419 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK),
420 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK),
421 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK),
422 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK),
423 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK),
424 PINMUX_GPIO(GPIO_FN_DRAK3, DRAK3_MARK),
425 PINMUX_GPIO(GPIO_FN_DRAK2, DRAK2_MARK),
426 PINMUX_GPIO(GPIO_FN_DRAK1, DRAK1_MARK),
427 PINMUX_GPIO(GPIO_FN_DRAK0, DRAK0_MARK),
428 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK),
429 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK),
430 PINMUX_GPIO(GPIO_FN_SCK1, SCK1_MARK),
431 PINMUX_GPIO(GPIO_FN_SCK0, SCK0_MARK),
432 PINMUX_GPIO(GPIO_FN_IRL3, IRL3_MARK),
433 PINMUX_GPIO(GPIO_FN_IRL2, IRL2_MARK),
434 PINMUX_GPIO(GPIO_FN_IRL1, IRL1_MARK),
435 PINMUX_GPIO(GPIO_FN_IRL0, IRL0_MARK),
436 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK),
437 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK),
438 PINMUX_GPIO(GPIO_FN_TXD1, TXD1_MARK),
439 PINMUX_GPIO(GPIO_FN_TXD0, TXD0_MARK),
440 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK),
441 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK),
442 PINMUX_GPIO(GPIO_FN_RXD1, RXD1_MARK),
443 PINMUX_GPIO(GPIO_FN_RXD0, RXD0_MARK),
444 PINMUX_GPIO(GPIO_FN_CE2B, CE2B_MARK),
445 PINMUX_GPIO(GPIO_FN_CE2A, CE2A_MARK),
446 PINMUX_GPIO(GPIO_FN_IOIS16, IOIS16_MARK),
447 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK),
448 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK),
449 PINMUX_GPIO(GPIO_FN_IRQOUT, IRQOUT_MARK),
450};
451
452static struct pinmux_cfg_reg shx3_pinmux_config_regs[] = {
453 { PINMUX_CFG_REG("PABCR", 0xffc70000, 32, 2) {
454 PA7_FN, PA7_OUT, PA7_IN, PA7_IN_PU,
455 PA6_FN, PA6_OUT, PA6_IN, PA6_IN_PU,
456 PA5_FN, PA5_OUT, PA5_IN, PA5_IN_PU,
457 PA4_FN, PA4_OUT, PA4_IN, PA4_IN_PU,
458 PA3_FN, PA3_OUT, PA3_IN, PA3_IN_PU,
459 PA2_FN, PA2_OUT, PA2_IN, PA2_IN_PU,
460 PA1_FN, PA1_OUT, PA1_IN, PA1_IN_PU,
461 PA0_FN, PA0_OUT, PA0_IN, PA0_IN_PU,
462 PB7_FN, PB7_OUT, PB7_IN, PB7_IN_PU,
463 PB6_FN, PB6_OUT, PB6_IN, PB6_IN_PU,
464 PB5_FN, PB5_OUT, PB5_IN, PB5_IN_PU,
465 PB4_FN, PB4_OUT, PB4_IN, PB4_IN_PU,
466 PB3_FN, PB3_OUT, PB3_IN, PB3_IN_PU,
467 PB2_FN, PB2_OUT, PB2_IN, PB2_IN_PU,
468 PB1_FN, PB1_OUT, PB1_IN, PB1_IN_PU,
469 PB0_FN, PB0_OUT, PB0_IN, PB0_IN_PU, },
470 },
471 { PINMUX_CFG_REG("PCDCR", 0xffc70004, 32, 2) {
472 PC7_FN, PC7_OUT, PC7_IN, PC7_IN_PU,
473 PC6_FN, PC6_OUT, PC6_IN, PC6_IN_PU,
474 PC5_FN, PC5_OUT, PC5_IN, PC5_IN_PU,
475 PC4_FN, PC4_OUT, PC4_IN, PC4_IN_PU,
476 PC3_FN, PC3_OUT, PC3_IN, PC3_IN_PU,
477 PC2_FN, PC2_OUT, PC2_IN, PC2_IN_PU,
478 PC1_FN, PC1_OUT, PC1_IN, PC1_IN_PU,
479 PC0_FN, PC0_OUT, PC0_IN, PC0_IN_PU,
480 PD7_FN, PD7_OUT, PD7_IN, PD7_IN_PU,
481 PD6_FN, PD6_OUT, PD6_IN, PD6_IN_PU,
482 PD5_FN, PD5_OUT, PD5_IN, PD5_IN_PU,
483 PD4_FN, PD4_OUT, PD4_IN, PD4_IN_PU,
484 PD3_FN, PD3_OUT, PD3_IN, PD3_IN_PU,
485 PD2_FN, PD2_OUT, PD2_IN, PD2_IN_PU,
486 PD1_FN, PD1_OUT, PD1_IN, PD1_IN_PU,
487 PD0_FN, PD0_OUT, PD0_IN, PD0_IN_PU, },
488 },
489 { PINMUX_CFG_REG("PEFCR", 0xffc70008, 32, 2) {
490 PE7_FN, PE7_OUT, PE7_IN, PE7_IN_PU,
491 PE6_FN, PE6_OUT, PE6_IN, PE6_IN_PU,
492 PE5_FN, PE5_OUT, PE5_IN, PE5_IN_PU,
493 PE4_FN, PE4_OUT, PE4_IN, PE4_IN_PU,
494 PE3_FN, PE3_OUT, PE3_IN, PE3_IN_PU,
495 PE2_FN, PE2_OUT, PE2_IN, PE2_IN_PU,
496 PE1_FN, PE1_OUT, PE1_IN, PE1_IN_PU,
497 PE0_FN, PE0_OUT, PE0_IN, PE0_IN_PU,
498 PF7_FN, PF7_OUT, PF7_IN, PF7_IN_PU,
499 PF6_FN, PF6_OUT, PF6_IN, PF6_IN_PU,
500 PF5_FN, PF5_OUT, PF5_IN, PF5_IN_PU,
501 PF4_FN, PF4_OUT, PF4_IN, PF4_IN_PU,
502 PF3_FN, PF3_OUT, PF3_IN, PF3_IN_PU,
503 PF2_FN, PF2_OUT, PF2_IN, PF2_IN_PU,
504 PF1_FN, PF1_OUT, PF1_IN, PF1_IN_PU,
505 PF0_FN, PF0_OUT, PF0_IN, PF0_IN_PU, },
506 },
507 { PINMUX_CFG_REG("PGHCR", 0xffc7000c, 32, 2) {
508 PG7_FN, PG7_OUT, PG7_IN, PG7_IN_PU,
509 PG6_FN, PG6_OUT, PG6_IN, PG6_IN_PU,
510 PG5_FN, PG5_OUT, PG5_IN, PG5_IN_PU,
511 PG4_FN, PG4_OUT, PG4_IN, PG4_IN_PU,
512 PG3_FN, PG3_OUT, PG3_IN, PG3_IN_PU,
513 PG2_FN, PG2_OUT, PG2_IN, PG2_IN_PU,
514 PG1_FN, PG1_OUT, PG1_IN, PG1_IN_PU,
515 PG0_FN, PG0_OUT, PG0_IN, PG0_IN_PU,
516 0, 0, 0, 0,
517 0, 0, 0, 0,
518 PH5_FN, PH5_OUT, PH5_IN, PH5_IN_PU,
519 PH4_FN, PH4_OUT, PH4_IN, PH4_IN_PU,
520 PH3_FN, PH3_OUT, PH3_IN, PH3_IN_PU,
521 PH2_FN, PH2_OUT, PH2_IN, PH2_IN_PU,
522 PH1_FN, PH1_OUT, PH1_IN, PH1_IN_PU,
523 PH0_FN, PH0_OUT, PH0_IN, PH0_IN_PU, },
524 },
525 { },
526};
527
528static struct pinmux_data_reg shx3_pinmux_data_regs[] = {
529 { PINMUX_DATA_REG("PABDR", 0xffc70010, 32) {
530 0, 0, 0, 0, 0, 0, 0, 0,
531 PA7_DATA, PA6_DATA, PA5_DATA, PA4_DATA,
532 PA3_DATA, PA2_DATA, PA1_DATA, PA0_DATA,
533 0, 0, 0, 0, 0, 0, 0, 0,
534 PB7_DATA, PB6_DATA, PB5_DATA, PB4_DATA,
535 PB3_DATA, PB2_DATA, PB1_DATA, PB0_DATA, },
536 },
537 { PINMUX_DATA_REG("PCDDR", 0xffc70014, 32) {
538 0, 0, 0, 0, 0, 0, 0, 0,
539 PC7_DATA, PC6_DATA, PC5_DATA, PC4_DATA,
540 PC3_DATA, PC2_DATA, PC1_DATA, PC0_DATA,
541 0, 0, 0, 0, 0, 0, 0, 0,
542 PD7_DATA, PD6_DATA, PD5_DATA, PD4_DATA,
543 PD3_DATA, PD2_DATA, PD1_DATA, PD0_DATA, },
544 },
545 { PINMUX_DATA_REG("PEFDR", 0xffc70018, 32) {
546 0, 0, 0, 0, 0, 0, 0, 0,
547 PE7_DATA, PE6_DATA, PE5_DATA, PE4_DATA,
548 PE3_DATA, PE2_DATA, PE1_DATA, PE0_DATA,
549 0, 0, 0, 0, 0, 0, 0, 0,
550 PF7_DATA, PF6_DATA, PF5_DATA, PF4_DATA,
551 PF3_DATA, PF2_DATA, PF1_DATA, PF0_DATA, },
552 },
553 { PINMUX_DATA_REG("PGHDR", 0xffc7001c, 32) {
554 0, 0, 0, 0, 0, 0, 0, 0,
555 PG7_DATA, PG6_DATA, PG5_DATA, PG4_DATA,
556 PG3_DATA, PG2_DATA, PG1_DATA, PG0_DATA,
557 0, 0, 0, 0, 0, 0, 0, 0,
558 0, 0, PH5_DATA, PH4_DATA,
559 PH3_DATA, PH2_DATA, PH1_DATA, PH0_DATA, },
560 },
561 { },
562};
563
564static struct pinmux_info shx3_pinmux_info = {
565 .name = "shx3_pfc",
566 .reserved_id = PINMUX_RESERVED,
567 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
568 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
569 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN,
570 PINMUX_INPUT_PULLUP_END },
571 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
572 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
573 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
574 .first_gpio = GPIO_PA7,
575 .last_gpio = GPIO_FN_IRQOUT,
576 .gpios = shx3_pinmux_gpios,
577 .gpio_data = shx3_pinmux_data,
578 .gpio_data_size = ARRAY_SIZE(shx3_pinmux_data),
579 .cfg_regs = shx3_pinmux_config_regs,
580 .data_regs = shx3_pinmux_data_regs,
581};
582
583static int __init shx3_pinmux_setup(void)
584{
585 return register_pinmux(&shx3_pinmux_info);
586}
587arch_initcall(shx3_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 79c556e56262..828c9657eb52 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -524,6 +524,70 @@ static struct platform_device veu1_device = {
524 }, 524 },
525}; 525};
526 526
527/* BEU0 */
528static struct uio_info beu0_platform_data = {
529 .name = "BEU0",
530 .version = "0",
531 .irq = evt2irq(0x8A0),
532};
533
534static struct resource beu0_resources[] = {
535 [0] = {
536 .name = "BEU0",
537 .start = 0xfe930000,
538 .end = 0xfe933400,
539 .flags = IORESOURCE_MEM,
540 },
541 [1] = {
542 /* place holder for contiguous memory */
543 },
544};
545
546static struct platform_device beu0_device = {
547 .name = "uio_pdrv_genirq",
548 .id = 6,
549 .dev = {
550 .platform_data = &beu0_platform_data,
551 },
552 .resource = beu0_resources,
553 .num_resources = ARRAY_SIZE(beu0_resources),
554 .archdata = {
555 .hwblk_id = HWBLK_BEU0,
556 },
557};
558
559/* BEU1 */
560static struct uio_info beu1_platform_data = {
561 .name = "BEU1",
562 .version = "0",
563 .irq = evt2irq(0xA00),
564};
565
566static struct resource beu1_resources[] = {
567 [0] = {
568 .name = "BEU1",
569 .start = 0xfe940000,
570 .end = 0xfe943400,
571 .flags = IORESOURCE_MEM,
572 },
573 [1] = {
574 /* place holder for contiguous memory */
575 },
576};
577
578static struct platform_device beu1_device = {
579 .name = "uio_pdrv_genirq",
580 .id = 7,
581 .dev = {
582 .platform_data = &beu1_platform_data,
583 },
584 .resource = beu1_resources,
585 .num_resources = ARRAY_SIZE(beu1_resources),
586 .archdata = {
587 .hwblk_id = HWBLK_BEU1,
588 },
589};
590
527static struct sh_timer_config cmt_platform_data = { 591static struct sh_timer_config cmt_platform_data = {
528 .channel_offset = 0x60, 592 .channel_offset = 0x60,
529 .timer_bit = 5, 593 .timer_bit = 5,
@@ -857,6 +921,8 @@ static struct platform_device *sh7724_devices[] __initdata = {
857 &vpu_device, 921 &vpu_device,
858 &veu0_device, 922 &veu0_device,
859 &veu1_device, 923 &veu1_device,
924 &beu0_device,
925 &beu1_device,
860 &jpu_device, 926 &jpu_device,
861 &spu0_device, 927 &spu0_device,
862 &spu1_device, 928 &spu1_device,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 444aca95b20d..749c6388d5a5 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -26,7 +26,7 @@ static struct plat_sci_port scif2_platform_data = {
26 26
27static struct platform_device scif2_device = { 27static struct platform_device scif2_device = {
28 .name = "sh-sci", 28 .name = "sh-sci",
29 .id = 2, 29 .id = 0,
30 .dev = { 30 .dev = {
31 .platform_data = &scif2_platform_data, 31 .platform_data = &scif2_platform_data,
32 }, 32 },
@@ -41,7 +41,7 @@ static struct plat_sci_port scif3_platform_data = {
41 41
42static struct platform_device scif3_device = { 42static struct platform_device scif3_device = {
43 .name = "sh-sci", 43 .name = "sh-sci",
44 .id = 3, 44 .id = 1,
45 .dev = { 45 .dev = {
46 .platform_data = &scif3_platform_data, 46 .platform_data = &scif3_platform_data,
47 }, 47 },
@@ -56,7 +56,7 @@ static struct plat_sci_port scif4_platform_data = {
56 56
57static struct platform_device scif4_device = { 57static struct platform_device scif4_device = {
58 .name = "sh-sci", 58 .name = "sh-sci",
59 .id = 4, 59 .id = 2,
60 .dev = { 60 .dev = {
61 .platform_data = &scif4_platform_data, 61 .platform_data = &scif4_platform_data,
62 }, 62 },
@@ -163,39 +163,23 @@ enum {
163 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL, 163 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL,
164 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7, 164 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
165 165
166 SDHI, 166 SDHI, DVC,
167 DVC, 167 IRQ8, IRQ9, IRQ11, IRQ10, IRQ12, IRQ13, IRQ14, IRQ15,
168 IRQ8, IRQ9, IRQ10, 168 TMU0, TMU1, TMU2, TMU2_TICPI, TMU3, TMU4, TMU5,
169 WDT0,
170 TMU0, TMU1, TMU2, TMU2_TICPI,
171 HUDI, 169 HUDI,
172
173 ARC4, 170 ARC4,
174 DMAC0, 171 DMAC0_5, DMAC6_7, DMAC8_11,
175 IRQ11, 172 SCIF0, SCIF1, SCIF2, SCIF3, SCIF4,
176 SCIF2, 173 USB0, USB1,
177 DMAC1_6,
178 USB0,
179 IRQ12,
180 JMC, 174 JMC,
181 SPI1, 175 SPI0, SPI1,
182 IRQ13, IRQ14,
183 USB1,
184 TMR01, TMR23, TMR45, 176 TMR01, TMR23, TMR45,
185 WDT1,
186 FRT, 177 FRT,
187 LPC, 178 LPC, LPC5, LPC6, LPC7, LPC8,
188 SCIF0, SCIF1, SCIF3, 179 PECI0, PECI1, PECI2, PECI3, PECI4, PECI5,
189 PECI0I, PECI1I, PECI2I,
190 IRQ15,
191 ETHERC, 180 ETHERC,
192 SPI0, 181 ADC0, ADC1,
193 ADC1,
194 DMAC1_8,
195 SIM, 182 SIM,
196 TMU3, TMU4, TMU5,
197 ADC0,
198 SCIF4,
199 IIC0_0, IIC0_1, IIC0_2, IIC0_3, 183 IIC0_0, IIC0_1, IIC0_2, IIC0_3,
200 IIC1_0, IIC1_1, IIC1_2, IIC1_3, 184 IIC1_0, IIC1_1, IIC1_2, IIC1_3,
201 IIC2_0, IIC2_1, IIC2_2, IIC2_3, 185 IIC2_0, IIC2_1, IIC2_2, IIC2_3,
@@ -206,9 +190,23 @@ enum {
206 IIC7_0, IIC7_1, IIC7_2, IIC7_3, 190 IIC7_0, IIC7_1, IIC7_2, IIC7_3,
207 IIC8_0, IIC8_1, IIC8_2, IIC8_3, 191 IIC8_0, IIC8_1, IIC8_2, IIC8_3,
208 IIC9_0, IIC9_1, IIC9_2, IIC9_3, 192 IIC9_0, IIC9_1, IIC9_2, IIC9_3,
209 PCIINTA, 193 ONFICTL,
210 PCIE, 194 MMC1, MMC2,
195 ECCU,
196 PCIC,
197 G200,
198 RSPI,
211 SGPIO, 199 SGPIO,
200 DMINT12, DMINT13, DMINT14, DMINT15, DMINT16, DMINT17, DMINT18, DMINT19,
201 DMINT20, DMINT21, DMINT22, DMINT23,
202 DDRECC,
203 TSIP,
204 PCIE_BRIDGE,
205 WDT0B, WDT1B, WDT2B, WDT3B, WDT4B, WDT5B, WDT6B, WDT7B, WDT8B,
206 GETHER0, GETHER1, GETHER2,
207 PBIA, PBIB, PBIC,
208 DMAE2, DMAE3,
209 SERMUX2, SERMUX3,
212 210
213 /* interrupt groups */ 211 /* interrupt groups */
214 212
@@ -221,19 +219,18 @@ static struct intc_vect vectors[] __initdata = {
221 INTC_VECT(DVC, 0x4e0), 219 INTC_VECT(DVC, 0x4e0),
222 INTC_VECT(IRQ8, 0x500), INTC_VECT(IRQ9, 0x520), 220 INTC_VECT(IRQ8, 0x500), INTC_VECT(IRQ9, 0x520),
223 INTC_VECT(IRQ10, 0x540), 221 INTC_VECT(IRQ10, 0x540),
224 INTC_VECT(WDT0, 0x560),
225 INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0), 222 INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0),
226 INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0), 223 INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0),
227 INTC_VECT(HUDI, 0x600), 224 INTC_VECT(HUDI, 0x600),
228 INTC_VECT(ARC4, 0x620), 225 INTC_VECT(ARC4, 0x620),
229 INTC_VECT(DMAC0, 0x640), INTC_VECT(DMAC0, 0x660), 226 INTC_VECT(DMAC0_5, 0x640), INTC_VECT(DMAC0_5, 0x660),
230 INTC_VECT(DMAC0, 0x680), INTC_VECT(DMAC0, 0x6a0), 227 INTC_VECT(DMAC0_5, 0x680), INTC_VECT(DMAC0_5, 0x6a0),
231 INTC_VECT(DMAC0, 0x6c0), 228 INTC_VECT(DMAC0_5, 0x6c0),
232 INTC_VECT(IRQ11, 0x6e0), 229 INTC_VECT(IRQ11, 0x6e0),
233 INTC_VECT(SCIF2, 0x700), INTC_VECT(SCIF2, 0x720), 230 INTC_VECT(SCIF2, 0x700), INTC_VECT(SCIF2, 0x720),
234 INTC_VECT(SCIF2, 0x740), INTC_VECT(SCIF2, 0x760), 231 INTC_VECT(SCIF2, 0x740), INTC_VECT(SCIF2, 0x760),
235 INTC_VECT(DMAC0, 0x780), INTC_VECT(DMAC0, 0x7a0), 232 INTC_VECT(DMAC0_5, 0x780), INTC_VECT(DMAC0_5, 0x7a0),
236 INTC_VECT(DMAC1_6, 0x7c0), INTC_VECT(DMAC1_6, 0x7e0), 233 INTC_VECT(DMAC6_7, 0x7c0), INTC_VECT(DMAC6_7, 0x7e0),
237 INTC_VECT(USB0, 0x840), 234 INTC_VECT(USB0, 0x840),
238 INTC_VECT(IRQ12, 0x880), 235 INTC_VECT(IRQ12, 0x880),
239 INTC_VECT(JMC, 0x8a0), 236 INTC_VECT(JMC, 0x8a0),
@@ -242,7 +239,6 @@ static struct intc_vect vectors[] __initdata = {
242 INTC_VECT(USB1, 0x920), 239 INTC_VECT(USB1, 0x920),
243 INTC_VECT(TMR01, 0xa00), INTC_VECT(TMR23, 0xa20), 240 INTC_VECT(TMR01, 0xa00), INTC_VECT(TMR23, 0xa20),
244 INTC_VECT(TMR45, 0xa40), 241 INTC_VECT(TMR45, 0xa40),
245 INTC_VECT(WDT1, 0xa60),
246 INTC_VECT(FRT, 0xa80), 242 INTC_VECT(FRT, 0xa80),
247 INTC_VECT(LPC, 0xaa0), INTC_VECT(LPC, 0xac0), 243 INTC_VECT(LPC, 0xaa0), INTC_VECT(LPC, 0xac0),
248 INTC_VECT(LPC, 0xae0), INTC_VECT(LPC, 0xb00), 244 INTC_VECT(LPC, 0xae0), INTC_VECT(LPC, 0xb00),
@@ -250,14 +246,14 @@ static struct intc_vect vectors[] __initdata = {
250 INTC_VECT(SCIF0, 0xb40), INTC_VECT(SCIF1, 0xb60), 246 INTC_VECT(SCIF0, 0xb40), INTC_VECT(SCIF1, 0xb60),
251 INTC_VECT(SCIF3, 0xb80), INTC_VECT(SCIF3, 0xba0), 247 INTC_VECT(SCIF3, 0xb80), INTC_VECT(SCIF3, 0xba0),
252 INTC_VECT(SCIF3, 0xbc0), INTC_VECT(SCIF3, 0xbe0), 248 INTC_VECT(SCIF3, 0xbc0), INTC_VECT(SCIF3, 0xbe0),
253 INTC_VECT(PECI0I, 0xc00), INTC_VECT(PECI1I, 0xc20), 249 INTC_VECT(PECI0, 0xc00), INTC_VECT(PECI1, 0xc20),
254 INTC_VECT(PECI2I, 0xc40), 250 INTC_VECT(PECI2, 0xc40),
255 INTC_VECT(IRQ15, 0xc60), 251 INTC_VECT(IRQ15, 0xc60),
256 INTC_VECT(ETHERC, 0xc80), INTC_VECT(ETHERC, 0xca0), 252 INTC_VECT(ETHERC, 0xc80), INTC_VECT(ETHERC, 0xca0),
257 INTC_VECT(SPI0, 0xcc0), 253 INTC_VECT(SPI0, 0xcc0),
258 INTC_VECT(ADC1, 0xce0), 254 INTC_VECT(ADC1, 0xce0),
259 INTC_VECT(DMAC1_8, 0xd00), INTC_VECT(DMAC1_8, 0xd20), 255 INTC_VECT(DMAC8_11, 0xd00), INTC_VECT(DMAC8_11, 0xd20),
260 INTC_VECT(DMAC1_8, 0xd40), INTC_VECT(DMAC1_8, 0xd60), 256 INTC_VECT(DMAC8_11, 0xd40), INTC_VECT(DMAC8_11, 0xd60),
261 INTC_VECT(SIM, 0xd80), INTC_VECT(SIM, 0xda0), 257 INTC_VECT(SIM, 0xd80), INTC_VECT(SIM, 0xda0),
262 INTC_VECT(SIM, 0xdc0), INTC_VECT(SIM, 0xde0), 258 INTC_VECT(SIM, 0xdc0), INTC_VECT(SIM, 0xde0),
263 INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20), 259 INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
@@ -278,17 +274,47 @@ static struct intc_vect vectors[] __initdata = {
278 INTC_VECT(IIC5_0, 0x1860), INTC_VECT(IIC5_1, 0x1880), 274 INTC_VECT(IIC5_0, 0x1860), INTC_VECT(IIC5_1, 0x1880),
279 INTC_VECT(IIC5_2, 0x18a0), INTC_VECT(IIC5_3, 0x18c0), 275 INTC_VECT(IIC5_2, 0x18a0), INTC_VECT(IIC5_3, 0x18c0),
280 INTC_VECT(IIC6_0, 0x18e0), INTC_VECT(IIC6_1, 0x1900), 276 INTC_VECT(IIC6_0, 0x18e0), INTC_VECT(IIC6_1, 0x1900),
281 INTC_VECT(IIC6_2, 0x1920), INTC_VECT(IIC6_3, 0x1980), 277 INTC_VECT(IIC6_2, 0x1920),
278 INTC_VECT(ONFICTL, 0x1960),
279 INTC_VECT(IIC6_3, 0x1980),
282 INTC_VECT(IIC7_0, 0x19a0), INTC_VECT(IIC7_1, 0x1a00), 280 INTC_VECT(IIC7_0, 0x19a0), INTC_VECT(IIC7_1, 0x1a00),
283 INTC_VECT(IIC7_2, 0x1a20), INTC_VECT(IIC7_3, 0x1a40), 281 INTC_VECT(IIC7_2, 0x1a20), INTC_VECT(IIC7_3, 0x1a40),
284 INTC_VECT(IIC8_0, 0x1a60), INTC_VECT(IIC8_1, 0x1a80), 282 INTC_VECT(IIC8_0, 0x1a60), INTC_VECT(IIC8_1, 0x1a80),
285 INTC_VECT(IIC8_2, 0x1aa0), INTC_VECT(IIC8_3, 0x1b40), 283 INTC_VECT(IIC8_2, 0x1aa0), INTC_VECT(IIC8_3, 0x1b40),
286 INTC_VECT(IIC9_0, 0x1b60), INTC_VECT(IIC9_1, 0x1b80), 284 INTC_VECT(IIC9_0, 0x1b60), INTC_VECT(IIC9_1, 0x1b80),
287 INTC_VECT(IIC9_2, 0x1c00), INTC_VECT(IIC9_3, 0x1c20), 285 INTC_VECT(IIC9_2, 0x1c00), INTC_VECT(IIC9_3, 0x1c20),
288 INTC_VECT(PCIINTA, 0x1ce0), 286 INTC_VECT(MMC1, 0x1c60), INTC_VECT(MMC2, 0x1c80),
289 INTC_VECT(PCIE, 0x1e00), 287 INTC_VECT(ECCU, 0x1cc0),
290 INTC_VECT(SGPIO, 0x1f80), 288 INTC_VECT(PCIC, 0x1ce0),
291 INTC_VECT(SGPIO, 0x1fa0), 289 INTC_VECT(G200, 0x1d00),
290 INTC_VECT(RSPI, 0x1d80), INTC_VECT(RSPI, 0x1da0),
291 INTC_VECT(RSPI, 0x1dc0), INTC_VECT(RSPI, 0x1de0),
292 INTC_VECT(PECI3, 0x1ec0), INTC_VECT(PECI4, 0x1ee0),
293 INTC_VECT(PECI5, 0x1f00),
294 INTC_VECT(SGPIO, 0x1f80), INTC_VECT(SGPIO, 0x1fa0),
295 INTC_VECT(SGPIO, 0x1fc0),
296 INTC_VECT(DMINT12, 0x2400), INTC_VECT(DMINT13, 0x2420),
297 INTC_VECT(DMINT14, 0x2440), INTC_VECT(DMINT15, 0x2460),
298 INTC_VECT(DMINT16, 0x2480), INTC_VECT(DMINT17, 0x24e0),
299 INTC_VECT(DMINT18, 0x2500), INTC_VECT(DMINT19, 0x2520),
300 INTC_VECT(DMINT20, 0x2540), INTC_VECT(DMINT21, 0x2560),
301 INTC_VECT(DMINT22, 0x2580), INTC_VECT(DMINT23, 0x2600),
302 INTC_VECT(DDRECC, 0x2620),
303 INTC_VECT(TSIP, 0x2640),
304 INTC_VECT(PCIE_BRIDGE, 0x27c0),
305 INTC_VECT(WDT0B, 0x2800), INTC_VECT(WDT1B, 0x2820),
306 INTC_VECT(WDT2B, 0x2840), INTC_VECT(WDT3B, 0x2860),
307 INTC_VECT(WDT4B, 0x2880), INTC_VECT(WDT5B, 0x28a0),
308 INTC_VECT(WDT6B, 0x28c0), INTC_VECT(WDT7B, 0x28e0),
309 INTC_VECT(WDT8B, 0x2900),
310 INTC_VECT(GETHER0, 0x2960), INTC_VECT(GETHER1, 0x2980),
311 INTC_VECT(GETHER2, 0x29a0),
312 INTC_VECT(PBIA, 0x2a00), INTC_VECT(PBIB, 0x2a20),
313 INTC_VECT(PBIC, 0x2a40),
314 INTC_VECT(DMAE2, 0x2a60), INTC_VECT(DMAE3, 0x2a80),
315 INTC_VECT(SERMUX2, 0x2aa0), INTC_VECT(SERMUX3, 0x2b40),
316 INTC_VECT(LPC5, 0x2b60), INTC_VECT(LPC6, 0x2b80),
317 INTC_VECT(LPC7, 0x2c00), INTC_VECT(LPC8, 0x2c20),
292}; 318};
293 319
294static struct intc_group groups[] __initdata = { 320static struct intc_group groups[] __initdata = {
@@ -312,31 +338,45 @@ static struct intc_mask_reg mask_registers[] __initdata = {
312 338
313 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */ 339 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
314 { 0, 0, 0, 0, 0, 0, 0, 0, 340 { 0, 0, 0, 0, 0, 0, 0, 0,
315 0, DMAC1_8, 0, PECI0I, LPC, FRT, WDT1, TMR45, 341 0, DMAC8_11, 0, PECI0, LPC, FRT, 0, TMR45,
316 TMR23, TMR01, 0, 0, 0, 0, 0, DMAC0, 342 TMR23, TMR01, 0, 0, 0, 0, 0, DMAC0_5,
317 HUDI, 0, WDT0, SCIF3, SCIF2, SDHI, TMU345, TMU012 343 HUDI, 0, 0, SCIF3, SCIF2, SDHI, TMU345, TMU012
318 } }, 344 } },
319 345
320 { 0xffd400d0, 0xffd400d4, 32, /* INT2MSKR1 / INT2MSKCR1 */ 346 { 0xffd400d0, 0xffd400d4, 32, /* INT2MSKR1 / INT2MSKCR1 */
321 { IRQ15, IRQ14, IRQ13, IRQ12, IRQ11, IRQ10, SCIF4, ETHERC, 347 { IRQ15, IRQ14, IRQ13, IRQ12, IRQ11, IRQ10, SCIF4, ETHERC,
322 IRQ9, IRQ8, SCIF1, SCIF0, USB0, 0, 0, USB1, 348 IRQ9, IRQ8, SCIF1, SCIF0, USB0, 0, 0, USB1,
323 ADC1, 0, DMAC1_6, ADC0, SPI0, SIM, PECI2I, PECI1I, 349 ADC1, 0, DMAC6_7, ADC0, SPI0, SIM, PECI2, PECI1,
324 ARC4, 0, SPI1, JMC, 0, 0, 0, DVC 350 ARC4, 0, SPI1, JMC, 0, 0, 0, DVC
325 } }, 351 } },
326 352
327 { 0xffd10038, 0xffd1003c, 32, /* INT2MSKR2 / INT2MSKCR2 */ 353 { 0xffd10038, 0xffd1003c, 32, /* INT2MSKR2 / INT2MSKCR2 */
328 { IIC4_1, IIC4_2, IIC5_0, 0, 0, 0, SGPIO, 0, 354 { IIC4_1, IIC4_2, IIC5_0, ONFICTL, 0, 0, SGPIO, 0,
329 0, 0, 0, IIC9_2, IIC8_2, IIC8_1, IIC8_0, IIC7_3, 355 0, G200, 0, IIC9_2, IIC8_2, IIC8_1, IIC8_0, IIC7_3,
330 IIC7_2, IIC7_1, IIC6_3, IIC0_0, IIC0_1, IIC0_2, IIC0_3, IIC3_1, 356 IIC7_2, IIC7_1, IIC6_3, IIC0_0, IIC0_1, IIC0_2, IIC0_3, IIC3_1,
331 IIC2_3, 0, IIC2_1, IIC9_1, IIC3_3, IIC1_0, PCIE, IIC2_2 357 IIC2_3, 0, IIC2_1, IIC9_1, IIC3_3, IIC1_0, 0, IIC2_2
332 } }, 358 } },
333 359
334 { 0xffd100d0, 0xff1400d4, 32, /* INT2MSKR3 / INT2MSKCR4 */ 360 { 0xffd100d0, 0xffd100d4, 32, /* INT2MSKR3 / INT2MSKCR3 */
335 { 0, IIC6_1, IIC6_0, IIC5_1, IIC3_2, IIC2_0, 0, 0, 361 { MMC1, IIC6_1, IIC6_0, IIC5_1, IIC3_2, IIC2_0, PECI5, MMC2,
336 IIC1_3, IIC1_2, IIC9_0, IIC8_3, IIC4_3, IIC7_0, 0, IIC6_2, 362 IIC1_3, IIC1_2, IIC9_0, IIC8_3, IIC4_3, IIC7_0, 0, IIC6_2,
337 PCIINTA, 0, IIC4_0, 0, 0, 0, 0, IIC9_3, 363 PCIC, 0, IIC4_0, 0, ECCU, RSPI, 0, IIC9_3,
338 IIC3_0, 0, IIC5_3, IIC5_2, 0, 0, 0, IIC1_1 364 IIC3_0, 0, IIC5_3, IIC5_2, 0, 0, 0, IIC1_1
339 } }, 365 } },
366
367 { 0xffd20038, 0xffd2003c, 32, /* INT2MSKR4 / INT2MSKCR4 */
368 { WDT0B, WDT1B, WDT3B, GETHER0, 0, 0, 0, 0,
369 0, 0, 0, LPC7, SERMUX2, DMAE3, DMAE2, PBIC,
370 PBIB, PBIA, GETHER1, DMINT12, DMINT13, DMINT14, DMINT15, TSIP,
371 DMINT23, 0, DMINT21, LPC6, 0, DMINT16, 0, DMINT22
372 } },
373
374 { 0xffd200d0, 0xffd200d4, 32, /* INT2MSKR5 / INT2MSKCR5 */
375 { 0, WDT8B, WDT7B, WDT4B, 0, DMINT20, 0, 0,
376 DMINT19, DMINT18, LPC5, SERMUX3, WDT2B, GETHER2, 0, 0,
377 0, 0, PCIE_BRIDGE, 0, 0, 0, 0, LPC8,
378 DDRECC, 0, WDT6B, WDT5B, 0, 0, 0, DMINT17
379 } },
340}; 380};
341 381
342#define INTPRI 0xffd00010 382#define INTPRI 0xffd00010
@@ -372,6 +412,22 @@ static struct intc_mask_reg mask_registers[] __initdata = {
372#define INT2PRI29 0xffd100b4 412#define INT2PRI29 0xffd100b4
373#define INT2PRI30 0xffd100b8 413#define INT2PRI30 0xffd100b8
374#define INT2PRI31 0xffd100bc 414#define INT2PRI31 0xffd100bc
415#define INT2PRI32 0xffd20000
416#define INT2PRI33 0xffd20004
417#define INT2PRI34 0xffd20008
418#define INT2PRI35 0xffd2000c
419#define INT2PRI36 0xffd20010
420#define INT2PRI37 0xffd20014
421#define INT2PRI38 0xffd20018
422#define INT2PRI39 0xffd2001c
423#define INT2PRI40 0xffd200a0
424#define INT2PRI41 0xffd200a4
425#define INT2PRI42 0xffd200a8
426#define INT2PRI43 0xffd200ac
427#define INT2PRI44 0xffd200b0
428#define INT2PRI45 0xffd200b4
429#define INT2PRI46 0xffd200b8
430#define INT2PRI47 0xffd200bc
375 431
376static struct intc_prio_reg prio_registers[] __initdata = { 432static struct intc_prio_reg prio_registers[] __initdata = {
377 { INTPRI, 0, 32, 4, { IRQ0, IRQ1, IRQ2, IRQ3, 433 { INTPRI, 0, 32, 4, { IRQ0, IRQ1, IRQ2, IRQ3,
@@ -379,39 +435,61 @@ static struct intc_prio_reg prio_registers[] __initdata = {
379 435
380 { INT2PRI0, 0, 32, 8, { TMU0, TMU1, TMU2, TMU2_TICPI } }, 436 { INT2PRI0, 0, 32, 8, { TMU0, TMU1, TMU2, TMU2_TICPI } },
381 { INT2PRI1, 0, 32, 8, { TMU3, TMU4, TMU5, SDHI } }, 437 { INT2PRI1, 0, 32, 8, { TMU3, TMU4, TMU5, SDHI } },
382 { INT2PRI2, 0, 32, 8, { SCIF2, SCIF3, WDT0, IRQ8 } }, 438 { INT2PRI2, 0, 32, 8, { SCIF2, SCIF3, 0, IRQ8 } },
383 { INT2PRI3, 0, 32, 8, { HUDI, DMAC0, ADC0, IRQ9 } }, 439 { INT2PRI3, 0, 32, 8, { HUDI, DMAC0_5, ADC0, IRQ9 } },
384 { INT2PRI4, 0, 32, 8, { IRQ10, 0, TMR01, TMR23 } }, 440 { INT2PRI4, 0, 32, 8, { IRQ10, 0, TMR01, TMR23 } },
385 { INT2PRI5, 0, 32, 8, { TMR45, WDT1, FRT, LPC } }, 441 { INT2PRI5, 0, 32, 8, { TMR45, 0, FRT, LPC } },
386 { INT2PRI6, 0, 32, 8, { PECI0I, ETHERC, DMAC1_8, 0 } }, 442 { INT2PRI6, 0, 32, 8, { PECI0, ETHERC, DMAC8_11, 0 } },
387 { INT2PRI7, 0, 32, 8, { SCIF4, 0, IRQ11, IRQ12 } }, 443 { INT2PRI7, 0, 32, 8, { SCIF4, 0, IRQ11, IRQ12 } },
388 { INT2PRI8, 0, 32, 8, { 0, 0, 0, DVC } }, 444 { INT2PRI8, 0, 32, 8, { 0, 0, 0, DVC } },
389 { INT2PRI9, 0, 32, 8, { ARC4, 0, SPI1, JMC } }, 445 { INT2PRI9, 0, 32, 8, { ARC4, 0, SPI1, JMC } },
390 { INT2PRI10, 0, 32, 8, { SPI0, SIM, PECI2I, PECI1I } }, 446 { INT2PRI10, 0, 32, 8, { SPI0, SIM, PECI2, PECI1 } },
391 { INT2PRI11, 0, 32, 8, { ADC1, IRQ13, DMAC1_6, IRQ14 } }, 447 { INT2PRI11, 0, 32, 8, { ADC1, IRQ13, DMAC6_7, IRQ14 } },
392 { INT2PRI12, 0, 32, 8, { USB0, 0, IRQ15, USB1 } }, 448 { INT2PRI12, 0, 32, 8, { USB0, 0, IRQ15, USB1 } },
393 { INT2PRI13, 0, 32, 8, { 0, 0, SCIF1, SCIF0 } }, 449 { INT2PRI13, 0, 32, 8, { 0, 0, SCIF1, SCIF0 } },
394 450
395 { INT2PRI16, 0, 32, 8, { IIC2_2, 0, 0, 0 } }, 451 { INT2PRI16, 0, 32, 8, { IIC2_2, 0, 0, 0 } },
396 { INT2PRI17, 0, 32, 8, { PCIE, 0, 0, IIC1_0 } }, 452 { INT2PRI17, 0, 32, 8, { 0, 0, 0, IIC1_0 } },
397 { INT2PRI18, 0, 32, 8, { IIC3_3, IIC9_1, IIC2_1, IIC1_2 } }, 453 { INT2PRI18, 0, 32, 8, { IIC3_3, IIC9_1, IIC2_1, IIC1_2 } },
398 { INT2PRI19, 0, 32, 8, { IIC2_3, IIC3_1, 0, IIC1_3 } }, 454 { INT2PRI19, 0, 32, 8, { IIC2_3, IIC3_1, 0, IIC1_3 } },
399 { INT2PRI20, 0, 32, 8, { IIC2_0, IIC6_3, IIC7_1, IIC7_2 } }, 455 { INT2PRI20, 0, 32, 8, { IIC2_0, IIC6_3, IIC7_1, IIC7_2 } },
400 { INT2PRI21, 0, 32, 8, { IIC7_3, IIC8_0, IIC8_1, IIC8_2 } }, 456 { INT2PRI21, 0, 32, 8, { IIC7_3, IIC8_0, IIC8_1, IIC8_2 } },
401 { INT2PRI22, 0, 32, 8, { IIC9_2, 0, 0, 0 } }, 457 { INT2PRI22, 0, 32, 8, { IIC9_2, MMC2, G200, 0 } },
402 { INT2PRI23, 0, 32, 8, { 0, SGPIO, IIC3_2, IIC5_1 } }, 458 { INT2PRI23, 0, 32, 8, { PECI5, SGPIO, IIC3_2, IIC5_1 } },
403 { INT2PRI24, 0, 32, 8, { 0, 0, 0, IIC1_1 } }, 459 { INT2PRI24, 0, 32, 8, { PECI4, PECI3, 0, IIC1_1 } },
404 { INT2PRI25, 0, 32, 8, { IIC3_0, 0, IIC5_3, IIC5_2 } }, 460 { INT2PRI25, 0, 32, 8, { IIC3_0, 0, IIC5_3, IIC5_2 } },
405 { INT2PRI26, 0, 32, 8, { 0, 0, 0, IIC9_3 } }, 461 { INT2PRI26, 0, 32, 8, { ECCU, RSPI, 0, IIC9_3 } },
406 { INT2PRI27, 0, 32, 8, { PCIINTA, IIC6_0, IIC4_0, IIC6_1 } }, 462 { INT2PRI27, 0, 32, 8, { PCIC, IIC6_0, IIC4_0, IIC6_1 } },
407 { INT2PRI28, 0, 32, 8, { IIC4_3, IIC7_0, 0, IIC6_2 } }, 463 { INT2PRI28, 0, 32, 8, { IIC4_3, IIC7_0, MMC1, IIC6_2 } },
408 { INT2PRI29, 0, 32, 8, { 0, 0, IIC9_0, IIC8_3 } }, 464 { INT2PRI29, 0, 32, 8, { 0, 0, IIC9_0, IIC8_3 } },
409 { INT2PRI30, 0, 32, 8, { IIC4_1, IIC4_2, IIC5_0, 0 } }, 465 { INT2PRI30, 0, 32, 8, { IIC4_1, IIC4_2, IIC5_0, ONFICTL } },
410 { INT2PRI31, 0, 32, 8, { IIC0_0, IIC0_1, IIC0_2, IIC0_3 } }, 466 { INT2PRI31, 0, 32, 8, { IIC0_0, IIC0_1, IIC0_2, IIC0_3 } },
467 { INT2PRI32, 0, 32, 8, { DMINT22, 0, 0, 0 } },
468 { INT2PRI33, 0, 32, 8, { 0, 0, 0, DMINT16 } },
469 { INT2PRI34, 0, 32, 8, { 0, LPC6, DMINT21, DMINT18 } },
470 { INT2PRI35, 0, 32, 8, { DMINT23, TSIP, 0, DMINT19 } },
471 { INT2PRI36, 0, 32, 8, { DMINT20, GETHER1, PBIA, PBIB } },
472 { INT2PRI37, 0, 32, 8, { PBIC, DMAE2, DMAE3, SERMUX2 } },
473 { INT2PRI38, 0, 32, 8, { LPC7, 0, 0, 0 } },
474 { INT2PRI39, 0, 32, 8, { 0, 0, 0, WDT4B } },
475 { INT2PRI40, 0, 32, 8, { 0, 0, 0, DMINT17 } },
476 { INT2PRI41, 0, 32, 8, { DDRECC, 0, WDT6B, WDT5B } },
477 { INT2PRI42, 0, 32, 8, { 0, 0, 0, LPC8 } },
478 { INT2PRI43, 0, 32, 8, { 0, WDT7B, PCIE_BRIDGE, WDT8B } },
479 { INT2PRI44, 0, 32, 8, { WDT2B, GETHER2, 0, 0 } },
480 { INT2PRI45, 0, 32, 8, { 0, 0, LPC5, SERMUX3 } },
481 { INT2PRI46, 0, 32, 8, { WDT0B, WDT1B, WDT3B, GETHER0 } },
482 { INT2PRI47, 0, 32, 8, { DMINT12, DMINT13, DMINT14, DMINT15 } },
483};
484
485static struct intc_sense_reg sense_registers_irq8to15[] __initdata = {
486 { 0xffd100f8, 32, 2, /* ICR2 */ { IRQ15, IRQ14, IRQ13, IRQ12,
487 IRQ11, IRQ10, IRQ9, IRQ8 } },
411}; 488};
412 489
413static DECLARE_INTC_DESC(intc_desc, "sh7757", vectors, groups, 490static DECLARE_INTC_DESC(intc_desc, "sh7757", vectors, groups,
414 mask_registers, prio_registers, NULL); 491 mask_registers, prio_registers,
492 sense_registers_irq8to15);
415 493
416/* Support for external interrupt pins in IRQ mode */ 494/* Support for external interrupt pins in IRQ mode */
417static struct intc_vect vectors_irq0123[] __initdata = { 495static struct intc_vect vectors_irq0123[] __initdata = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index 8797723231ea..c016c0004714 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
@@ -629,33 +629,10 @@ static void __init sh7786_usb_setup(void)
629 } 629 }
630} 630}
631 631
632static int __init sh7786_devices_setup(void)
633{
634 int ret;
635
636 sh7786_usb_setup();
637
638 ret = platform_add_devices(sh7786_early_devices,
639 ARRAY_SIZE(sh7786_early_devices));
640 if (unlikely(ret != 0))
641 return ret;
642
643 return platform_add_devices(sh7786_devices,
644 ARRAY_SIZE(sh7786_devices));
645}
646arch_initcall(sh7786_devices_setup);
647
648void __init plat_early_device_setup(void)
649{
650 early_platform_add_devices(sh7786_early_devices,
651 ARRAY_SIZE(sh7786_early_devices));
652}
653
654enum { 632enum {
655 UNUSED = 0, 633 UNUSED = 0,
656 634
657 /* interrupt sources */ 635 /* interrupt sources */
658
659 IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH, 636 IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
660 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH, 637 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
661 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH, 638 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
@@ -693,9 +670,12 @@ enum {
693 Thermal, 670 Thermal,
694 INTICI0, INTICI1, INTICI2, INTICI3, 671 INTICI0, INTICI1, INTICI2, INTICI3,
695 INTICI4, INTICI5, INTICI6, INTICI7, 672 INTICI4, INTICI5, INTICI6, INTICI7,
673
674 /* Muxed sub-events */
675 TXI1, BRI1, RXI1, ERI1,
696}; 676};
697 677
698static struct intc_vect vectors[] __initdata = { 678static struct intc_vect sh7786_vectors[] __initdata = {
699 INTC_VECT(WDT, 0x3e0), 679 INTC_VECT(WDT, 0x3e0),
700 INTC_VECT(TMU0_0, 0x400), INTC_VECT(TMU0_1, 0x420), 680 INTC_VECT(TMU0_0, 0x400), INTC_VECT(TMU0_1, 0x420),
701 INTC_VECT(TMU0_2, 0x440), INTC_VECT(TMU0_3, 0x460), 681 INTC_VECT(TMU0_2, 0x440), INTC_VECT(TMU0_3, 0x460),
@@ -756,14 +736,12 @@ static struct intc_vect vectors[] __initdata = {
756 736
757#define INTDISTCR0 0xfe4100b0 737#define INTDISTCR0 0xfe4100b0
758#define INTDISTCR1 0xfe4100b4 738#define INTDISTCR1 0xfe4100b4
759#define INTACK 0xfe4100b8
760#define INTACKCLR 0xfe4100bc
761#define INT2DISTCR0 0xfe410900 739#define INT2DISTCR0 0xfe410900
762#define INT2DISTCR1 0xfe410904 740#define INT2DISTCR1 0xfe410904
763#define INT2DISTCR2 0xfe410908 741#define INT2DISTCR2 0xfe410908
764#define INT2DISTCR3 0xfe41090c 742#define INT2DISTCR3 0xfe41090c
765 743
766static struct intc_mask_reg mask_registers[] __initdata = { 744static struct intc_mask_reg sh7786_mask_registers[] __initdata = {
767 { CnINTMSK0, CnINTMSKCLR0, 32, 745 { CnINTMSK0, CnINTMSKCLR0, 32,
768 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 }, 746 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 },
769 INTC_SMP_BALANCING(INTDISTCR0) }, 747 INTC_SMP_BALANCING(INTDISTCR0) },
@@ -807,7 +785,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
807 0, 0, 0, 0, 0, 0, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR3) }, 785 0, 0, 0, 0, 0, 0, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR3) },
808}; 786};
809 787
810static struct intc_prio_reg prio_registers[] __initdata = { 788static struct intc_prio_reg sh7786_prio_registers[] __initdata = {
811 { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3, 789 { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
812 IRQ4, IRQ5, IRQ6, IRQ7 } }, 790 IRQ4, IRQ5, IRQ6, IRQ7 } },
813 { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } }, 791 { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } },
@@ -851,11 +829,27 @@ static struct intc_prio_reg prio_registers[] __initdata = {
851 INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) }, 829 INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) },
852}; 830};
853 831
854static DECLARE_INTC_DESC(intc_desc, "sh7786", vectors, NULL, 832static struct intc_subgroup sh7786_subgroups[] __initdata = {
855 mask_registers, prio_registers, NULL); 833 { 0xfe410c20, 32, SCIF1,
834 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
835 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TXI1, BRI1, RXI1, ERI1 } },
836};
856 837
857/* Support for external interrupt pins in IRQ mode */ 838static struct intc_desc sh7786_intc_desc __initdata = {
839 .name = "sh7786",
840 .hw = {
841 .vectors = sh7786_vectors,
842 .nr_vectors = ARRAY_SIZE(sh7786_vectors),
843 .mask_regs = sh7786_mask_registers,
844 .nr_mask_regs = ARRAY_SIZE(sh7786_mask_registers),
845 .subgroups = sh7786_subgroups,
846 .nr_subgroups = ARRAY_SIZE(sh7786_subgroups),
847 .prio_regs = sh7786_prio_registers,
848 .nr_prio_regs = ARRAY_SIZE(sh7786_prio_registers),
849 },
850};
858 851
852/* Support for external interrupt pins in IRQ mode */
859static struct intc_vect vectors_irq0123[] __initdata = { 853static struct intc_vect vectors_irq0123[] __initdata = {
860 INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240), 854 INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240),
861 INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0), 855 INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0),
@@ -866,23 +860,25 @@ static struct intc_vect vectors_irq4567[] __initdata = {
866 INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0), 860 INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0),
867}; 861};
868 862
869static struct intc_sense_reg sense_registers[] __initdata = { 863static struct intc_sense_reg sh7786_sense_registers[] __initdata = {
870 { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3, 864 { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
871 IRQ4, IRQ5, IRQ6, IRQ7 } }, 865 IRQ4, IRQ5, IRQ6, IRQ7 } },
872}; 866};
873 867
874static struct intc_mask_reg ack_registers[] __initdata = { 868static struct intc_mask_reg sh7786_ack_registers[] __initdata = {
875 { 0xfe410024, 0, 32, /* INTREQ */ 869 { 0xfe410024, 0, 32, /* INTREQ */
876 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 870 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
877}; 871};
878 872
879static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123", 873static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123",
880 vectors_irq0123, NULL, mask_registers, 874 vectors_irq0123, NULL, sh7786_mask_registers,
881 prio_registers, sense_registers, ack_registers); 875 sh7786_prio_registers, sh7786_sense_registers,
876 sh7786_ack_registers);
882 877
883static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567", 878static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567",
884 vectors_irq4567, NULL, mask_registers, 879 vectors_irq4567, NULL, sh7786_mask_registers,
885 prio_registers, sense_registers, ack_registers); 880 sh7786_prio_registers, sh7786_sense_registers,
881 sh7786_ack_registers);
886 882
887/* External interrupt pins in IRL mode */ 883/* External interrupt pins in IRL mode */
888 884
@@ -909,10 +905,10 @@ static struct intc_vect vectors_irl4567[] __initdata = {
909}; 905};
910 906
911static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123, 907static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123,
912 NULL, mask_registers, NULL, NULL); 908 NULL, sh7786_mask_registers, NULL, NULL);
913 909
914static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567, 910static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567,
915 NULL, mask_registers, NULL, NULL); 911 NULL, sh7786_mask_registers, NULL, NULL);
916 912
917#define INTC_ICR0 0xfe410000 913#define INTC_ICR0 0xfe410000
918#define INTC_INTMSK0 CnINTMSK0 914#define INTC_INTMSK0 CnINTMSK0
@@ -920,19 +916,6 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567,
920#define INTC_INTMSK2 INTMSK2 916#define INTC_INTMSK2 INTMSK2
921#define INTC_INTMSKCLR1 CnINTMSKCLR1 917#define INTC_INTMSKCLR1 CnINTMSKCLR1
922#define INTC_INTMSKCLR2 INTMSKCLR2 918#define INTC_INTMSKCLR2 INTMSKCLR2
923#define INTC_USERIMASK 0xfe411000
924
925#ifdef CONFIG_INTC_BALANCING
926unsigned int irq_lookup(unsigned int irq)
927{
928 return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE;
929}
930
931void irq_finish(unsigned int irq)
932{
933 __raw_writel(irq2evt(irq), INTACKCLR);
934}
935#endif
936 919
937void __init plat_irq_setup(void) 920void __init plat_irq_setup(void)
938{ 921{
@@ -946,8 +929,7 @@ void __init plat_irq_setup(void)
946 /* select IRL mode for IRL3-0 + IRL7-4 */ 929 /* select IRL mode for IRL3-0 + IRL7-4 */
947 __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0); 930 __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
948 931
949 register_intc_controller(&intc_desc); 932 register_intc_controller(&sh7786_intc_desc);
950 register_intc_userimask(INTC_USERIMASK);
951} 933}
952 934
953void __init plat_irq_setup_pins(int mode) 935void __init plat_irq_setup_pins(int mode)
@@ -991,3 +973,39 @@ void __init plat_irq_setup_pins(int mode)
991void __init plat_mem_setup(void) 973void __init plat_mem_setup(void)
992{ 974{
993} 975}
976
977static int __init sh7786_devices_setup(void)
978{
979 int ret, irq;
980
981 sh7786_usb_setup();
982
983 /*
984 * De-mux SCIF1 IRQs if possible
985 */
986 irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1);
987 if (irq > 0) {
988 scif1_platform_data.irqs[SCIx_TXI_IRQ] = irq;
989 scif1_platform_data.irqs[SCIx_ERI_IRQ] =
990 intc_irq_lookup(sh7786_intc_desc.name, ERI1);
991 scif1_platform_data.irqs[SCIx_BRI_IRQ] =
992 intc_irq_lookup(sh7786_intc_desc.name, BRI1);
993 scif1_platform_data.irqs[SCIx_RXI_IRQ] =
994 intc_irq_lookup(sh7786_intc_desc.name, RXI1);
995 }
996
997 ret = platform_add_devices(sh7786_early_devices,
998 ARRAY_SIZE(sh7786_early_devices));
999 if (unlikely(ret != 0))
1000 return ret;
1001
1002 return platform_add_devices(sh7786_devices,
1003 ARRAY_SIZE(sh7786_devices));
1004}
1005arch_initcall(sh7786_devices_setup);
1006
1007void __init plat_early_device_setup(void)
1008{
1009 early_platform_add_devices(sh7786_early_devices,
1010 ARRAY_SIZE(sh7786_early_devices));
1011}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 9158bc5ea38b..013f0b144489 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SH-X3 Prototype Setup 2 * SH-X3 Prototype Setup
3 * 3 *
4 * Copyright (C) 2007 - 2009 Paul Mundt 4 * Copyright (C) 2007 - 2010 Paul Mundt
5 * 5 *
6 * This file is subject to the terms and conditions of the GNU General Public 6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
@@ -12,7 +12,9 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/gpio.h>
15#include <linux/sh_timer.h> 16#include <linux/sh_timer.h>
17#include <cpu/shx3.h>
16#include <asm/mmzone.h> 18#include <asm/mmzone.h>
17 19
18/* 20/*
@@ -354,6 +356,10 @@ static struct intc_group groups[] __initdata = {
354 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11), 356 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11),
355}; 357};
356 358
359#define INT2DISTCR0 0xfe4108a0
360#define INT2DISTCR1 0xfe4108a4
361#define INT2DISTCR2 0xfe4108a8
362
357static struct intc_mask_reg mask_registers[] __initdata = { 363static struct intc_mask_reg mask_registers[] __initdata = {
358 { 0xfe410030, 0xfe410050, 32, /* CnINTMSK0 / CnINTMSKCLR0 */ 364 { 0xfe410030, 0xfe410050, 32, /* CnINTMSK0 / CnINTMSKCLR0 */
359 { IRQ0, IRQ1, IRQ2, IRQ3 } }, 365 { IRQ0, IRQ1, IRQ2, IRQ3 } },
@@ -363,20 +369,23 @@ static struct intc_mask_reg mask_registers[] __initdata = {
363 { FE1, FE0, 0, ATAPI, VCORE0, VIN1, VIN0, IIC, 369 { FE1, FE0, 0, ATAPI, VCORE0, VIN1, VIN0, IIC,
364 DU, GPIO3, GPIO2, GPIO1, GPIO0, PAM, 0, 0, 370 DU, GPIO3, GPIO2, GPIO1, GPIO0, PAM, 0, 0,
365 0, 0, 0, 0, 0, 0, 0, 0, /* HUDI bits ignored */ 371 0, 0, 0, 0, 0, 0, 0, 0, /* HUDI bits ignored */
366 0, TMU5, TMU4, TMU3, TMU2, TMU1, TMU0, 0, } }, 372 0, TMU5, TMU4, TMU3, TMU2, TMU1, TMU0, 0, },
373 INTC_SMP_BALANCING(INT2DISTCR0) },
367 { 0xfe410830, 0xfe410860, 32, /* CnINT2MSK1 / CnINT2MSKCLR1 */ 374 { 0xfe410830, 0xfe410860, 32, /* CnINT2MSK1 / CnINT2MSKCLR1 */
368 { 0, 0, 0, 0, DTU3, DTU2, DTU1, DTU0, /* IRM bits ignored */ 375 { 0, 0, 0, 0, DTU3, DTU2, DTU1, DTU0, /* IRM bits ignored */
369 PCII9, PCII8, PCII7, PCII6, PCII5, PCII4, PCII3, PCII2, 376 PCII9, PCII8, PCII7, PCII6, PCII5, PCII4, PCII3, PCII2,
370 PCII1, PCII0, DMAC1_DMAE, DMAC1_DMINT11, 377 PCII1, PCII0, DMAC1_DMAE, DMAC1_DMINT11,
371 DMAC1_DMINT10, DMAC1_DMINT9, DMAC1_DMINT8, DMAC1_DMINT7, 378 DMAC1_DMINT10, DMAC1_DMINT9, DMAC1_DMINT8, DMAC1_DMINT7,
372 DMAC1_DMINT6, DMAC0_DMAE, DMAC0_DMINT5, DMAC0_DMINT4, 379 DMAC1_DMINT6, DMAC0_DMAE, DMAC0_DMINT5, DMAC0_DMINT4,
373 DMAC0_DMINT3, DMAC0_DMINT2, DMAC0_DMINT1, DMAC0_DMINT0 } }, 380 DMAC0_DMINT3, DMAC0_DMINT2, DMAC0_DMINT1, DMAC0_DMINT0 },
381 INTC_SMP_BALANCING(INT2DISTCR1) },
374 { 0xfe410840, 0xfe410870, 32, /* CnINT2MSK2 / CnINT2MSKCLR2 */ 382 { 0xfe410840, 0xfe410870, 32, /* CnINT2MSK2 / CnINT2MSKCLR2 */
375 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 383 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
376 SCIF3_TXI, SCIF3_BRI, SCIF3_RXI, SCIF3_ERI, 384 SCIF3_TXI, SCIF3_BRI, SCIF3_RXI, SCIF3_ERI,
377 SCIF2_TXI, SCIF2_BRI, SCIF2_RXI, SCIF2_ERI, 385 SCIF2_TXI, SCIF2_BRI, SCIF2_RXI, SCIF2_ERI,
378 SCIF1_TXI, SCIF1_BRI, SCIF1_RXI, SCIF1_ERI, 386 SCIF1_TXI, SCIF1_BRI, SCIF1_RXI, SCIF1_ERI,
379 SCIF0_TXI, SCIF0_BRI, SCIF0_RXI, SCIF0_ERI } }, 387 SCIF0_TXI, SCIF0_BRI, SCIF0_RXI, SCIF0_ERI },
388 INTC_SMP_BALANCING(INT2DISTCR2) },
380}; 389};
381 390
382static struct intc_prio_reg prio_registers[] __initdata = { 391static struct intc_prio_reg prio_registers[] __initdata = {
@@ -433,11 +442,33 @@ static DECLARE_INTC_DESC(intc_desc_irl, "shx3-irl", vectors_irl, groups,
433 442
434void __init plat_irq_setup_pins(int mode) 443void __init plat_irq_setup_pins(int mode)
435{ 444{
445 int ret = 0;
446
436 switch (mode) { 447 switch (mode) {
437 case IRQ_MODE_IRQ: 448 case IRQ_MODE_IRQ:
449 ret |= gpio_request(GPIO_FN_IRQ3, intc_desc_irq.name);
450 ret |= gpio_request(GPIO_FN_IRQ2, intc_desc_irq.name);
451 ret |= gpio_request(GPIO_FN_IRQ1, intc_desc_irq.name);
452 ret |= gpio_request(GPIO_FN_IRQ0, intc_desc_irq.name);
453
454 if (unlikely(ret)) {
455 pr_err("Failed to set IRQ mode\n");
456 return;
457 }
458
438 register_intc_controller(&intc_desc_irq); 459 register_intc_controller(&intc_desc_irq);
439 break; 460 break;
440 case IRQ_MODE_IRL3210: 461 case IRQ_MODE_IRL3210:
462 ret |= gpio_request(GPIO_FN_IRL3, intc_desc_irl.name);
463 ret |= gpio_request(GPIO_FN_IRL2, intc_desc_irl.name);
464 ret |= gpio_request(GPIO_FN_IRL1, intc_desc_irl.name);
465 ret |= gpio_request(GPIO_FN_IRL0, intc_desc_irl.name);
466
467 if (unlikely(ret)) {
468 pr_err("Failed to set IRL mode\n");
469 return;
470 }
471
441 register_intc_controller(&intc_desc_irl); 472 register_intc_controller(&intc_desc_irl);
442 break; 473 break;
443 default: 474 default:
@@ -447,6 +478,9 @@ void __init plat_irq_setup_pins(int mode)
447 478
448void __init plat_irq_setup(void) 479void __init plat_irq_setup(void)
449{ 480{
481 reserve_intc_vectors(vectors_irq, ARRAY_SIZE(vectors_irq));
482 reserve_intc_vectors(vectors_irl, ARRAY_SIZE(vectors_irl));
483
450 register_intc_controller(&intc_desc); 484 register_intc_controller(&intc_desc);
451} 485}
452 486
diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S
index 6e35f012cc03..7db248936b60 100644
--- a/arch/sh/kernel/head_32.S
+++ b/arch/sh/kernel/head_32.S
@@ -330,7 +330,7 @@ ENTRY(_stext)
330#if defined(CONFIG_CPU_SH2) 330#if defined(CONFIG_CPU_SH2)
3311: .long 0x000000F0 ! IMASK=0xF 3311: .long 0x000000F0 ! IMASK=0xF
332#else 332#else
3331: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF 3331: .long 0x500080F0 ! MD=1, RB=0, BL=1, FD=1, IMASK=0xF
334#endif 334#endif
335ENTRY(stack_start) 335ENTRY(stack_start)
3362: .long init_thread_union+THREAD_SIZE 3362: .long init_thread_union+THREAD_SIZE
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 2947d2bd1291..32c385ef1011 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -291,7 +291,7 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address)
291 } 291 }
292 292
293 tmp = handle_unaligned_access(instruction, regs, 293 tmp = handle_unaligned_access(instruction, regs,
294 &trapped_io_access, 1); 294 &trapped_io_access, 1, address);
295 set_fs(oldfs); 295 set_fs(oldfs);
296 return tmp == 0; 296 return tmp == 0;
297} 297}
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index ae5bac39b896..9dc447db8a44 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -283,6 +283,8 @@ void __init init_IRQ(void)
283 if (sh_mv.mv_init_irq) 283 if (sh_mv.mv_init_irq)
284 sh_mv.mv_init_irq(); 284 sh_mv.mv_init_irq();
285 285
286 intc_finalize();
287
286 irq_ctx_init(smp_processor_id()); 288 irq_ctx_init(smp_processor_id());
287} 289}
288 290
diff --git a/arch/sh/kernel/kdebugfs.c b/arch/sh/kernel/kdebugfs.c
new file mode 100644
index 000000000000..e11c30bb100c
--- /dev/null
+++ b/arch/sh/kernel/kdebugfs.c
@@ -0,0 +1,16 @@
1#include <linux/module.h>
2#include <linux/init.h>
3#include <linux/debugfs.h>
4
5struct dentry *arch_debugfs_dir;
6EXPORT_SYMBOL(arch_debugfs_dir);
7
8static int __init arch_kdebugfs_init(void)
9{
10 arch_debugfs_dir = debugfs_create_dir("sh", NULL);
11 if (!arch_debugfs_dir)
12 return -ENOMEM;
13
14 return 0;
15}
16arch_initcall(arch_kdebugfs_init);
diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index 4049d99f76e1..1208b09e95c3 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -20,9 +20,9 @@
20DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 20DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
21DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 21DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
22 22
23static struct kprobe saved_current_opcode; 23static DEFINE_PER_CPU(struct kprobe, saved_current_opcode);
24static struct kprobe saved_next_opcode; 24static DEFINE_PER_CPU(struct kprobe, saved_next_opcode);
25static struct kprobe saved_next_opcode2; 25static DEFINE_PER_CPU(struct kprobe, saved_next_opcode2);
26 26
27#define OPCODE_JMP(x) (((x) & 0xF0FF) == 0x402b) 27#define OPCODE_JMP(x) (((x) & 0xF0FF) == 0x402b)
28#define OPCODE_JSR(x) (((x) & 0xF0FF) == 0x400b) 28#define OPCODE_JSR(x) (((x) & 0xF0FF) == 0x400b)
@@ -102,16 +102,21 @@ int __kprobes kprobe_handle_illslot(unsigned long pc)
102 102
103void __kprobes arch_remove_kprobe(struct kprobe *p) 103void __kprobes arch_remove_kprobe(struct kprobe *p)
104{ 104{
105 if (saved_next_opcode.addr != 0x0) { 105 struct kprobe *saved = &__get_cpu_var(saved_next_opcode);
106
107 if (saved->addr) {
106 arch_disarm_kprobe(p); 108 arch_disarm_kprobe(p);
107 arch_disarm_kprobe(&saved_next_opcode); 109 arch_disarm_kprobe(saved);
108 saved_next_opcode.addr = 0x0; 110
109 saved_next_opcode.opcode = 0x0; 111 saved->addr = NULL;
110 112 saved->opcode = 0;
111 if (saved_next_opcode2.addr != 0x0) { 113
112 arch_disarm_kprobe(&saved_next_opcode2); 114 saved = &__get_cpu_var(saved_next_opcode2);
113 saved_next_opcode2.addr = 0x0; 115 if (saved->addr) {
114 saved_next_opcode2.opcode = 0x0; 116 arch_disarm_kprobe(saved);
117
118 saved->addr = NULL;
119 saved->opcode = 0;
115 } 120 }
116 } 121 }
117} 122}
@@ -141,57 +146,59 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
141 */ 146 */
142static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 147static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
143{ 148{
144 kprobe_opcode_t *addr = NULL; 149 __get_cpu_var(saved_current_opcode).addr = (kprobe_opcode_t *)regs->pc;
145 saved_current_opcode.addr = (kprobe_opcode_t *) (regs->pc);
146 addr = saved_current_opcode.addr;
147 150
148 if (p != NULL) { 151 if (p != NULL) {
152 struct kprobe *op1, *op2;
153
149 arch_disarm_kprobe(p); 154 arch_disarm_kprobe(p);
150 155
156 op1 = &__get_cpu_var(saved_next_opcode);
157 op2 = &__get_cpu_var(saved_next_opcode2);
158
151 if (OPCODE_JSR(p->opcode) || OPCODE_JMP(p->opcode)) { 159 if (OPCODE_JSR(p->opcode) || OPCODE_JMP(p->opcode)) {
152 unsigned int reg_nr = ((p->opcode >> 8) & 0x000F); 160 unsigned int reg_nr = ((p->opcode >> 8) & 0x000F);
153 saved_next_opcode.addr = 161 op1->addr = (kprobe_opcode_t *) regs->regs[reg_nr];
154 (kprobe_opcode_t *) regs->regs[reg_nr];
155 } else if (OPCODE_BRA(p->opcode) || OPCODE_BSR(p->opcode)) { 162 } else if (OPCODE_BRA(p->opcode) || OPCODE_BSR(p->opcode)) {
156 unsigned long disp = (p->opcode & 0x0FFF); 163 unsigned long disp = (p->opcode & 0x0FFF);
157 saved_next_opcode.addr = 164 op1->addr =
158 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2); 165 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2);
159 166
160 } else if (OPCODE_BRAF(p->opcode) || OPCODE_BSRF(p->opcode)) { 167 } else if (OPCODE_BRAF(p->opcode) || OPCODE_BSRF(p->opcode)) {
161 unsigned int reg_nr = ((p->opcode >> 8) & 0x000F); 168 unsigned int reg_nr = ((p->opcode >> 8) & 0x000F);
162 saved_next_opcode.addr = 169 op1->addr =
163 (kprobe_opcode_t *) (regs->pc + 4 + 170 (kprobe_opcode_t *) (regs->pc + 4 +
164 regs->regs[reg_nr]); 171 regs->regs[reg_nr]);
165 172
166 } else if (OPCODE_RTS(p->opcode)) { 173 } else if (OPCODE_RTS(p->opcode)) {
167 saved_next_opcode.addr = (kprobe_opcode_t *) regs->pr; 174 op1->addr = (kprobe_opcode_t *) regs->pr;
168 175
169 } else if (OPCODE_BF(p->opcode) || OPCODE_BT(p->opcode)) { 176 } else if (OPCODE_BF(p->opcode) || OPCODE_BT(p->opcode)) {
170 unsigned long disp = (p->opcode & 0x00FF); 177 unsigned long disp = (p->opcode & 0x00FF);
171 /* case 1 */ 178 /* case 1 */
172 saved_next_opcode.addr = p->addr + 1; 179 op1->addr = p->addr + 1;
173 /* case 2 */ 180 /* case 2 */
174 saved_next_opcode2.addr = 181 op2->addr =
175 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2); 182 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2);
176 saved_next_opcode2.opcode = *(saved_next_opcode2.addr); 183 op2->opcode = *(op2->addr);
177 arch_arm_kprobe(&saved_next_opcode2); 184 arch_arm_kprobe(op2);
178 185
179 } else if (OPCODE_BF_S(p->opcode) || OPCODE_BT_S(p->opcode)) { 186 } else if (OPCODE_BF_S(p->opcode) || OPCODE_BT_S(p->opcode)) {
180 unsigned long disp = (p->opcode & 0x00FF); 187 unsigned long disp = (p->opcode & 0x00FF);
181 /* case 1 */ 188 /* case 1 */
182 saved_next_opcode.addr = p->addr + 2; 189 op1->addr = p->addr + 2;
183 /* case 2 */ 190 /* case 2 */
184 saved_next_opcode2.addr = 191 op2->addr =
185 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2); 192 (kprobe_opcode_t *) (regs->pc + 4 + disp * 2);
186 saved_next_opcode2.opcode = *(saved_next_opcode2.addr); 193 op2->opcode = *(op2->addr);
187 arch_arm_kprobe(&saved_next_opcode2); 194 arch_arm_kprobe(op2);
188 195
189 } else { 196 } else {
190 saved_next_opcode.addr = p->addr + 1; 197 op1->addr = p->addr + 1;
191 } 198 }
192 199
193 saved_next_opcode.opcode = *(saved_next_opcode.addr); 200 op1->opcode = *(op1->addr);
194 arch_arm_kprobe(&saved_next_opcode); 201 arch_arm_kprobe(op1);
195 } 202 }
196} 203}
197 204
@@ -376,21 +383,23 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
376 cur->post_handler(cur, regs, 0); 383 cur->post_handler(cur, regs, 0);
377 } 384 }
378 385
379 if (saved_next_opcode.addr != 0x0) { 386 p = &__get_cpu_var(saved_next_opcode);
380 arch_disarm_kprobe(&saved_next_opcode); 387 if (p->addr) {
381 saved_next_opcode.addr = 0x0; 388 arch_disarm_kprobe(p);
382 saved_next_opcode.opcode = 0x0; 389 p->addr = NULL;
390 p->opcode = 0;
383 391
384 addr = saved_current_opcode.addr; 392 addr = __get_cpu_var(saved_current_opcode).addr;
385 saved_current_opcode.addr = 0x0; 393 __get_cpu_var(saved_current_opcode).addr = NULL;
386 394
387 p = get_kprobe(addr); 395 p = get_kprobe(addr);
388 arch_arm_kprobe(p); 396 arch_arm_kprobe(p);
389 397
390 if (saved_next_opcode2.addr != 0x0) { 398 p = &__get_cpu_var(saved_next_opcode2);
391 arch_disarm_kprobe(&saved_next_opcode2); 399 if (p->addr) {
392 saved_next_opcode2.addr = 0x0; 400 arch_disarm_kprobe(p);
393 saved_next_opcode2.opcode = 0x0; 401 p->addr = NULL;
402 p->opcode = 0;
394 } 403 }
395 } 404 }
396 405
@@ -572,14 +581,5 @@ static struct kprobe trampoline_p = {
572 581
573int __init arch_init_kprobes(void) 582int __init arch_init_kprobes(void)
574{ 583{
575 saved_next_opcode.addr = 0x0;
576 saved_next_opcode.opcode = 0x0;
577
578 saved_current_opcode.addr = 0x0;
579 saved_current_opcode.opcode = 0x0;
580
581 saved_next_opcode2.addr = 0x0;
582 saved_next_opcode2.opcode = 0x0;
583
584 return register_kprobe(&trampoline_p); 584 return register_kprobe(&trampoline_p);
585} 585}
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
new file mode 100644
index 000000000000..0a05983633ca
--- /dev/null
+++ b/arch/sh/kernel/ptrace.c
@@ -0,0 +1,33 @@
1#include <linux/ptrace.h>
2
3/**
4 * regs_query_register_offset() - query register offset from its name
5 * @name: the name of a register
6 *
7 * regs_query_register_offset() returns the offset of a register in struct
8 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
9 */
10int regs_query_register_offset(const char *name)
11{
12 const struct pt_regs_offset *roff;
13 for (roff = regoffset_table; roff->name != NULL; roff++)
14 if (!strcmp(roff->name, name))
15 return roff->offset;
16 return -EINVAL;
17}
18
19/**
20 * regs_query_register_name() - query register name from its offset
21 * @offset: the offset of a register in struct pt_regs.
22 *
23 * regs_query_register_name() returns the name of a register from its
24 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
25 */
26const char *regs_query_register_name(unsigned int offset)
27{
28 const struct pt_regs_offset *roff;
29 for (roff = regoffset_table; roff->name != NULL; roff++)
30 if (roff->offset == offset)
31 return roff->name;
32 return NULL;
33}
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 6c4bbba2a675..2cd42b58cb20 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -274,6 +274,33 @@ static int dspregs_active(struct task_struct *target,
274} 274}
275#endif 275#endif
276 276
277const struct pt_regs_offset regoffset_table[] = {
278 REGS_OFFSET_NAME(0),
279 REGS_OFFSET_NAME(1),
280 REGS_OFFSET_NAME(2),
281 REGS_OFFSET_NAME(3),
282 REGS_OFFSET_NAME(4),
283 REGS_OFFSET_NAME(5),
284 REGS_OFFSET_NAME(6),
285 REGS_OFFSET_NAME(7),
286 REGS_OFFSET_NAME(8),
287 REGS_OFFSET_NAME(9),
288 REGS_OFFSET_NAME(10),
289 REGS_OFFSET_NAME(11),
290 REGS_OFFSET_NAME(12),
291 REGS_OFFSET_NAME(13),
292 REGS_OFFSET_NAME(14),
293 REGS_OFFSET_NAME(15),
294 REG_OFFSET_NAME(pc),
295 REG_OFFSET_NAME(pr),
296 REG_OFFSET_NAME(sr),
297 REG_OFFSET_NAME(gbr),
298 REG_OFFSET_NAME(mach),
299 REG_OFFSET_NAME(macl),
300 REG_OFFSET_NAME(tra),
301 REG_OFFSET_END,
302};
303
277/* 304/*
278 * These are our native regset flavours. 305 * These are our native regset flavours.
279 */ 306 */
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 5fd644da7f02..e0fb065914aa 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -20,7 +20,7 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/smp_lock.h> 23#include <linux/bitops.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/user.h> 26#include <linux/user.h>
@@ -252,6 +252,85 @@ static int fpregs_active(struct task_struct *target,
252} 252}
253#endif 253#endif
254 254
255const struct pt_regs_offset regoffset_table[] = {
256 REG_OFFSET_NAME(pc),
257 REG_OFFSET_NAME(sr),
258 REG_OFFSET_NAME(syscall_nr),
259 REGS_OFFSET_NAME(0),
260 REGS_OFFSET_NAME(1),
261 REGS_OFFSET_NAME(2),
262 REGS_OFFSET_NAME(3),
263 REGS_OFFSET_NAME(4),
264 REGS_OFFSET_NAME(5),
265 REGS_OFFSET_NAME(6),
266 REGS_OFFSET_NAME(7),
267 REGS_OFFSET_NAME(8),
268 REGS_OFFSET_NAME(9),
269 REGS_OFFSET_NAME(10),
270 REGS_OFFSET_NAME(11),
271 REGS_OFFSET_NAME(12),
272 REGS_OFFSET_NAME(13),
273 REGS_OFFSET_NAME(14),
274 REGS_OFFSET_NAME(15),
275 REGS_OFFSET_NAME(16),
276 REGS_OFFSET_NAME(17),
277 REGS_OFFSET_NAME(18),
278 REGS_OFFSET_NAME(19),
279 REGS_OFFSET_NAME(20),
280 REGS_OFFSET_NAME(21),
281 REGS_OFFSET_NAME(22),
282 REGS_OFFSET_NAME(23),
283 REGS_OFFSET_NAME(24),
284 REGS_OFFSET_NAME(25),
285 REGS_OFFSET_NAME(26),
286 REGS_OFFSET_NAME(27),
287 REGS_OFFSET_NAME(28),
288 REGS_OFFSET_NAME(29),
289 REGS_OFFSET_NAME(30),
290 REGS_OFFSET_NAME(31),
291 REGS_OFFSET_NAME(32),
292 REGS_OFFSET_NAME(33),
293 REGS_OFFSET_NAME(34),
294 REGS_OFFSET_NAME(35),
295 REGS_OFFSET_NAME(36),
296 REGS_OFFSET_NAME(37),
297 REGS_OFFSET_NAME(38),
298 REGS_OFFSET_NAME(39),
299 REGS_OFFSET_NAME(40),
300 REGS_OFFSET_NAME(41),
301 REGS_OFFSET_NAME(42),
302 REGS_OFFSET_NAME(43),
303 REGS_OFFSET_NAME(44),
304 REGS_OFFSET_NAME(45),
305 REGS_OFFSET_NAME(46),
306 REGS_OFFSET_NAME(47),
307 REGS_OFFSET_NAME(48),
308 REGS_OFFSET_NAME(49),
309 REGS_OFFSET_NAME(50),
310 REGS_OFFSET_NAME(51),
311 REGS_OFFSET_NAME(52),
312 REGS_OFFSET_NAME(53),
313 REGS_OFFSET_NAME(54),
314 REGS_OFFSET_NAME(55),
315 REGS_OFFSET_NAME(56),
316 REGS_OFFSET_NAME(57),
317 REGS_OFFSET_NAME(58),
318 REGS_OFFSET_NAME(59),
319 REGS_OFFSET_NAME(60),
320 REGS_OFFSET_NAME(61),
321 REGS_OFFSET_NAME(62),
322 REGS_OFFSET_NAME(63),
323 TREGS_OFFSET_NAME(0),
324 TREGS_OFFSET_NAME(1),
325 TREGS_OFFSET_NAME(2),
326 TREGS_OFFSET_NAME(3),
327 TREGS_OFFSET_NAME(4),
328 TREGS_OFFSET_NAME(5),
329 TREGS_OFFSET_NAME(6),
330 TREGS_OFFSET_NAME(7),
331 REG_OFFSET_END,
332};
333
255/* 334/*
256 * These are our native regset flavours. 335 * These are our native regset flavours.
257 */ 336 */
@@ -395,10 +474,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
395asmlinkage int sh64_ptrace(long request, long pid, long addr, long data) 474asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
396{ 475{
397#define WPC_DBRMODE 0x0d104008 476#define WPC_DBRMODE 0x0d104008
398 static int first_call = 1; 477 static unsigned long first_call;
399 478
400 lock_kernel(); 479 if (!test_and_set_bit(0, &first_call)) {
401 if (first_call) {
402 /* Set WPC.DBRMODE to 0. This makes all debug events get 480 /* Set WPC.DBRMODE to 0. This makes all debug events get
403 * delivered through RESVEC, i.e. into the handlers in entry.S. 481 * delivered through RESVEC, i.e. into the handlers in entry.S.
404 * (If the kernel was downloaded using a remote gdb, WPC.DBRMODE 482 * (If the kernel was downloaded using a remote gdb, WPC.DBRMODE
@@ -408,9 +486,7 @@ asmlinkage int sh64_ptrace(long request, long pid, long addr, long data)
408 * the remote gdb.) */ 486 * the remote gdb.) */
409 printk("DBRMODE set to 0 to permit native debugging\n"); 487 printk("DBRMODE set to 0 to permit native debugging\n");
410 poke_real_address_q(WPC_DBRMODE, 0); 488 poke_real_address_q(WPC_DBRMODE, 0);
411 first_call = 0;
412 } 489 }
413 unlock_kernel();
414 490
415 return sys_ptrace(request, pid, addr, data); 491 return sys_ptrace(request, pid, addr, data);
416} 492}
diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
index b1fca66bb92e..ca6a5ca64015 100644
--- a/arch/sh/kernel/reboot.c
+++ b/arch/sh/kernel/reboot.c
@@ -9,6 +9,7 @@
9#include <asm/addrspace.h> 9#include <asm/addrspace.h>
10#include <asm/reboot.h> 10#include <asm/reboot.h>
11#include <asm/system.h> 11#include <asm/system.h>
12#include <asm/tlbflush.h>
12 13
13void (*pm_power_off)(void); 14void (*pm_power_off)(void);
14EXPORT_SYMBOL(pm_power_off); 15EXPORT_SYMBOL(pm_power_off);
@@ -25,6 +26,9 @@ static void native_machine_restart(char * __unused)
25{ 26{
26 local_irq_disable(); 27 local_irq_disable();
27 28
29 /* Destroy all of the TLBs in preparation for reset by MMU */
30 __flush_tlb_global();
31
28 /* Address error with SR.BL=1 first. */ 32 /* Address error with SR.BL=1 first. */
29 trigger_address_error(); 33 trigger_address_error();
30 34
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index e769401a78ba..4e278467f76c 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -24,7 +24,6 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/debugfs.h>
28#include <linux/crash_dump.h> 27#include <linux/crash_dump.h>
29#include <linux/mmzone.h> 28#include <linux/mmzone.h>
30#include <linux/clk.h> 29#include <linux/clk.h>
@@ -136,8 +135,9 @@ void __init check_for_initrd(void)
136 goto disable; 135 goto disable;
137 } 136 }
138 137
139 if (unlikely(start < PAGE_OFFSET)) { 138 if (unlikely(start < __MEMORY_START)) {
140 pr_err("initrd start < PAGE_OFFSET\n"); 139 pr_err("initrd start (%08lx) < __MEMORY_START(%x)\n",
140 start, __MEMORY_START);
141 goto disable; 141 goto disable;
142 } 142 }
143 143
@@ -158,7 +158,7 @@ void __init check_for_initrd(void)
158 /* 158 /*
159 * Address sanitization 159 * Address sanitization
160 */ 160 */
161 initrd_start = (unsigned long)__va(__pa(start)); 161 initrd_start = (unsigned long)__va(start);
162 initrd_end = initrd_start + INITRD_SIZE; 162 initrd_end = initrd_start + INITRD_SIZE;
163 163
164 memblock_reserve(__pa(initrd_start), INITRD_SIZE); 164 memblock_reserve(__pa(initrd_start), INITRD_SIZE);
@@ -458,17 +458,3 @@ const struct seq_operations cpuinfo_op = {
458 .show = show_cpuinfo, 458 .show = show_cpuinfo,
459}; 459};
460#endif /* CONFIG_PROC_FS */ 460#endif /* CONFIG_PROC_FS */
461
462struct dentry *sh_debugfs_root;
463
464static int __init sh_debugfs_init(void)
465{
466 sh_debugfs_root = debugfs_create_dir("sh", NULL);
467 if (!sh_debugfs_root)
468 return -ENOMEM;
469 if (IS_ERR(sh_debugfs_root))
470 return PTR_ERR(sh_debugfs_root);
471
472 return 0;
473}
474arch_initcall(sh_debugfs_init);
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index 19fd11dd9871..e872e81add8a 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -353,3 +353,25 @@ ENTRY(sys_call_table)
353 .long sys_pwritev 353 .long sys_pwritev
354 .long sys_rt_tgsigqueueinfo /* 335 */ 354 .long sys_rt_tgsigqueueinfo /* 335 */
355 .long sys_perf_event_open 355 .long sys_perf_event_open
356 .long sys_fanotify_init
357 .long sys_fanotify_mark
358 .long sys_prlimit64
359 /* Broken-out socket family */
360 .long sys_socket /* 340 */
361 .long sys_bind
362 .long sys_connect
363 .long sys_listen
364 .long sys_accept
365 .long sys_getsockname /* 345 */
366 .long sys_getpeername
367 .long sys_socketpair
368 .long sys_send
369 .long sys_sendto
370 .long sys_recv /* 350 */
371 .long sys_recvfrom
372 .long sys_shutdown
373 .long sys_setsockopt
374 .long sys_getsockopt
375 .long sys_sendmsg /* 355 */
376 .long sys_recvmsg
377 .long sys_recvmmsg
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 2048a20d7c80..66585708ce90 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -393,3 +393,6 @@ sys_call_table:
393 .long sys_perf_event_open 393 .long sys_perf_event_open
394 .long sys_recvmmsg /* 365 */ 394 .long sys_recvmmsg /* 365 */
395 .long sys_accept4 395 .long sys_accept4
396 .long sys_fanotify_init
397 .long sys_fanotify_mark
398 .long sys_prlimit64
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index c3d86fa71ddf..3484c2f65aba 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -5,7 +5,7 @@
5 * SuperH version: Copyright (C) 1999 Niibe Yutaka 5 * SuperH version: Copyright (C) 1999 Niibe Yutaka
6 * Copyright (C) 2000 Philipp Rumpf 6 * Copyright (C) 2000 Philipp Rumpf
7 * Copyright (C) 2000 David Howells 7 * Copyright (C) 2000 David Howells
8 * Copyright (C) 2002 - 2007 Paul Mundt 8 * Copyright (C) 2002 - 2010 Paul Mundt
9 * 9 *
10 * This file is subject to the terms and conditions of the GNU General Public 10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
@@ -26,6 +26,7 @@
26#include <linux/limits.h> 26#include <linux/limits.h>
27#include <linux/sysfs.h> 27#include <linux/sysfs.h>
28#include <linux/uaccess.h> 28#include <linux/uaccess.h>
29#include <linux/perf_event.h>
29#include <asm/system.h> 30#include <asm/system.h>
30#include <asm/alignment.h> 31#include <asm/alignment.h>
31#include <asm/fpu.h> 32#include <asm/fpu.h>
@@ -369,7 +370,8 @@ static inline int handle_delayslot(struct pt_regs *regs,
369#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4) 370#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
370 371
371int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, 372int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
372 struct mem_access *ma, int expected) 373 struct mem_access *ma, int expected,
374 unsigned long address)
373{ 375{
374 u_int rm; 376 u_int rm;
375 int ret, index; 377 int ret, index;
@@ -383,9 +385,18 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
383 index = (instruction>>8)&15; /* 0x0F00 */ 385 index = (instruction>>8)&15; /* 0x0F00 */
384 rm = regs->regs[index]; 386 rm = regs->regs[index];
385 387
386 /* shout about fixups */ 388 /*
387 if (!expected) 389 * Log the unexpected fixups, and then pass them on to perf.
390 *
391 * We intentionally don't report the expected cases to perf as
392 * otherwise the trapped I/O case will skew the results too much
393 * to be useful.
394 */
395 if (!expected) {
388 unaligned_fixups_notify(current, instruction, regs); 396 unaligned_fixups_notify(current, instruction, regs);
397 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0,
398 regs, address);
399 }
389 400
390 ret = -EFAULT; 401 ret = -EFAULT;
391 switch (instruction&0xF000) { 402 switch (instruction&0xF000) {
@@ -574,7 +585,8 @@ fixup:
574 585
575 set_fs(USER_DS); 586 set_fs(USER_DS);
576 tmp = handle_unaligned_access(instruction, regs, 587 tmp = handle_unaligned_access(instruction, regs,
577 &user_mem_access, 0); 588 &user_mem_access, 0,
589 address);
578 set_fs(oldfs); 590 set_fs(oldfs);
579 591
580 if (tmp == 0) 592 if (tmp == 0)
@@ -607,8 +619,8 @@ uspace_segv:
607 619
608 unaligned_fixups_notify(current, instruction, regs); 620 unaligned_fixups_notify(current, instruction, regs);
609 621
610 handle_unaligned_access(instruction, regs, 622 handle_unaligned_access(instruction, regs, &user_mem_access,
611 &user_mem_access, 0); 623 0, address);
612 set_fs(oldfs); 624 set_fs(oldfs);
613 } 625 }
614} 626}
@@ -802,6 +814,9 @@ void __cpuinit per_cpu_trap_init(void)
802 : /* no output */ 814 : /* no output */
803 : "r" (&vbr_base) 815 : "r" (&vbr_base)
804 : "memory"); 816 : "memory");
817
818 /* disable exception blocking now when the vbr has been setup */
819 clear_bl_bit();
805} 820}
806 821
807void *set_exception_table_vec(unsigned int vec, void *handler) 822void *set_exception_table_vec(unsigned int vec, void *handler)
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index e67e140bf1f6..6713ca97e553 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -24,6 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/sysctl.h> 25#include <linux/sysctl.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/perf_event.h>
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/io.h> 30#include <asm/io.h>
@@ -50,7 +51,7 @@ asmlinkage void do_##name(unsigned long error_code, struct pt_regs *regs) \
50 do_unhandled_exception(trapnr, signr, str, __stringify(name), error_code, regs, current); \ 51 do_unhandled_exception(trapnr, signr, str, __stringify(name), error_code, regs, current); \
51} 52}
52 53
53spinlock_t die_lock; 54static DEFINE_SPINLOCK(die_lock);
54 55
55void die(const char * str, struct pt_regs * regs, long err) 56void die(const char * str, struct pt_regs * regs, long err)
56{ 57{
@@ -433,6 +434,8 @@ static int misaligned_load(struct pt_regs *regs,
433 return error; 434 return error;
434 } 435 }
435 436
437 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, address);
438
436 destreg = (opcode >> 4) & 0x3f; 439 destreg = (opcode >> 4) & 0x3f;
437 if (user_mode(regs)) { 440 if (user_mode(regs)) {
438 __u64 buffer; 441 __u64 buffer;
@@ -509,6 +512,8 @@ static int misaligned_store(struct pt_regs *regs,
509 return error; 512 return error;
510 } 513 }
511 514
515 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, address);
516
512 srcreg = (opcode >> 4) & 0x3f; 517 srcreg = (opcode >> 4) & 0x3f;
513 if (user_mode(regs)) { 518 if (user_mode(regs)) {
514 __u64 buffer; 519 __u64 buffer;
@@ -583,6 +588,8 @@ static int misaligned_fpu_load(struct pt_regs *regs,
583 return error; 588 return error;
584 } 589 }
585 590
591 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, address);
592
586 destreg = (opcode >> 4) & 0x3f; 593 destreg = (opcode >> 4) & 0x3f;
587 if (user_mode(regs)) { 594 if (user_mode(regs)) {
588 __u64 buffer; 595 __u64 buffer;
@@ -658,6 +665,8 @@ static int misaligned_fpu_store(struct pt_regs *regs,
658 return error; 665 return error;
659 } 666 }
660 667
668 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, address);
669
661 srcreg = (opcode >> 4) & 0x3f; 670 srcreg = (opcode >> 4) & 0x3f;
662 if (user_mode(regs)) { 671 if (user_mode(regs)) {
663 __u64 buffer; 672 __u64 buffer;
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index dab4d2129812..7b95f29e3174 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -30,4 +30,4 @@ lib-$(CONFIG_MMU) += copy_page.o __clear_user.o
30lib-$(CONFIG_MCOUNT) += mcount.o 30lib-$(CONFIG_MCOUNT) += mcount.o
31lib-y += $(memcpy-y) $(memset-y) $(udivsi3-y) 31lib-y += $(memcpy-y) $(memset-y) $(udivsi3-y)
32 32
33EXTRA_CFLAGS += -Werror 33ccflags-y := -Werror
diff --git a/arch/sh/math-emu/math.c b/arch/sh/math-emu/math.c
index 1fcdb1220975..f76a5090d5d1 100644
--- a/arch/sh/math-emu/math.c
+++ b/arch/sh/math-emu/math.c
@@ -12,6 +12,7 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/perf_event.h>
15 16
16#include <asm/system.h> 17#include <asm/system.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
@@ -619,6 +620,8 @@ int do_fpu_inst(unsigned short inst, struct pt_regs *regs)
619 struct task_struct *tsk = current; 620 struct task_struct *tsk = current;
620 struct sh_fpu_soft_struct *fpu = &(tsk->thread.xstate->softfpu); 621 struct sh_fpu_soft_struct *fpu = &(tsk->thread.xstate->softfpu);
621 622
623 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, 0, regs, 0);
624
622 if (!(task_thread_info(tsk)->status & TS_USEDFPU)) { 625 if (!(task_thread_info(tsk)->status & TS_USEDFPU)) {
623 /* initialize once. */ 626 /* initialize once. */
624 fpu_init(fpu); 627 fpu_init(fpu);
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 1445ca6257df..09370392aff1 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -168,6 +168,10 @@ config IOREMAP_FIXED
168config UNCACHED_MAPPING 168config UNCACHED_MAPPING
169 bool 169 bool
170 170
171config HAVE_SRAM_POOL
172 bool
173 select GENERIC_ALLOCATOR
174
171choice 175choice
172 prompt "Kernel page size" 176 prompt "Kernel page size"
173 default PAGE_SIZE_4KB 177 default PAGE_SIZE_4KB
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 53f7c684afb2..ab89ea4f9414 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_PMB) += pmb.o
40obj-$(CONFIG_NUMA) += numa.o 40obj-$(CONFIG_NUMA) += numa.o
41obj-$(CONFIG_IOREMAP_FIXED) += ioremap_fixed.o 41obj-$(CONFIG_IOREMAP_FIXED) += ioremap_fixed.o
42obj-$(CONFIG_UNCACHED_MAPPING) += uncached.o 42obj-$(CONFIG_UNCACHED_MAPPING) += uncached.o
43obj-$(CONFIG_HAVE_SRAM_POOL) += sram.o
43 44
44# Special flags for fault_64.o. This puts restrictions on the number of 45# Special flags for fault_64.o. This puts restrictions on the number of
45# caller-save registers that the compiler can target when building this file. 46# caller-save registers that the compiler can target when building this file.
@@ -66,4 +67,4 @@ CFLAGS_fault_64.o += -ffixed-r7 \
66 -ffixed-r60 -ffixed-r61 -ffixed-r62 \ 67 -ffixed-r60 -ffixed-r61 -ffixed-r62 \
67 -fomit-frame-pointer 68 -fomit-frame-pointer
68 69
69EXTRA_CFLAGS += -Werror 70ccflags-y := -Werror
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c
index cd8c3bf39b5a..74c03ecc4871 100644
--- a/arch/sh/mm/asids-debugfs.c
+++ b/arch/sh/mm/asids-debugfs.c
@@ -63,7 +63,7 @@ static int __init asids_debugfs_init(void)
63{ 63{
64 struct dentry *asids_dentry; 64 struct dentry *asids_dentry;
65 65
66 asids_dentry = debugfs_create_file("asids", S_IRUSR, sh_debugfs_root, 66 asids_dentry = debugfs_create_file("asids", S_IRUSR, arch_debugfs_dir,
67 NULL, &asids_debugfs_fops); 67 NULL, &asids_debugfs_fops);
68 if (!asids_dentry) 68 if (!asids_dentry)
69 return -ENOMEM; 69 return -ENOMEM;
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 690ed010d002..52411462c409 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -126,25 +126,19 @@ static int __init cache_debugfs_init(void)
126{ 126{
127 struct dentry *dcache_dentry, *icache_dentry; 127 struct dentry *dcache_dentry, *icache_dentry;
128 128
129 dcache_dentry = debugfs_create_file("dcache", S_IRUSR, sh_debugfs_root, 129 dcache_dentry = debugfs_create_file("dcache", S_IRUSR, arch_debugfs_dir,
130 (unsigned int *)CACHE_TYPE_DCACHE, 130 (unsigned int *)CACHE_TYPE_DCACHE,
131 &cache_debugfs_fops); 131 &cache_debugfs_fops);
132 if (!dcache_dentry) 132 if (!dcache_dentry)
133 return -ENOMEM; 133 return -ENOMEM;
134 if (IS_ERR(dcache_dentry))
135 return PTR_ERR(dcache_dentry);
136 134
137 icache_dentry = debugfs_create_file("icache", S_IRUSR, sh_debugfs_root, 135 icache_dentry = debugfs_create_file("icache", S_IRUSR, arch_debugfs_dir,
138 (unsigned int *)CACHE_TYPE_ICACHE, 136 (unsigned int *)CACHE_TYPE_ICACHE,
139 &cache_debugfs_fops); 137 &cache_debugfs_fops);
140 if (!icache_dentry) { 138 if (!icache_dentry) {
141 debugfs_remove(dcache_dentry); 139 debugfs_remove(dcache_dentry);
142 return -ENOMEM; 140 return -ENOMEM;
143 } 141 }
144 if (IS_ERR(icache_dentry)) {
145 debugfs_remove(dcache_dentry);
146 return PTR_ERR(icache_dentry);
147 }
148 142
149 return 0; 143 return 0;
150} 144}
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index c86a08540258..038793286990 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -38,11 +38,12 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
38 void *ret, *ret_nocache; 38 void *ret, *ret_nocache;
39 int order = get_order(size); 39 int order = get_order(size);
40 40
41 gfp |= __GFP_ZERO;
42
41 ret = (void *)__get_free_pages(gfp, order); 43 ret = (void *)__get_free_pages(gfp, order);
42 if (!ret) 44 if (!ret)
43 return NULL; 45 return NULL;
44 46
45 memset(ret, 0, size);
46 /* 47 /*
47 * Pages from the page allocator may have data present in 48 * Pages from the page allocator may have data present in
48 * cache. So flush the cache before using uncached memory. 49 * cache. So flush the cache before using uncached memory.
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 552bea5113f5..3385b28acaac 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -47,7 +47,6 @@ static pte_t *__get_pte_phys(unsigned long addr)
47 pgd_t *pgd; 47 pgd_t *pgd;
48 pud_t *pud; 48 pud_t *pud;
49 pmd_t *pmd; 49 pmd_t *pmd;
50 pte_t *pte;
51 50
52 pgd = pgd_offset_k(addr); 51 pgd = pgd_offset_k(addr);
53 if (pgd_none(*pgd)) { 52 if (pgd_none(*pgd)) {
@@ -67,8 +66,7 @@ static pte_t *__get_pte_phys(unsigned long addr)
67 return NULL; 66 return NULL;
68 } 67 }
69 68
70 pte = pte_offset_kernel(pmd, addr); 69 return pte_offset_kernel(pmd, addr);
71 return pte;
72} 70}
73 71
74static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) 72static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
@@ -125,13 +123,45 @@ void __clear_fixmap(enum fixed_addresses idx, pgprot_t prot)
125 clear_pte_phys(address, prot); 123 clear_pte_phys(address, prot);
126} 124}
127 125
126static pmd_t * __init one_md_table_init(pud_t *pud)
127{
128 if (pud_none(*pud)) {
129 pmd_t *pmd;
130
131 pmd = alloc_bootmem_pages(PAGE_SIZE);
132 pud_populate(&init_mm, pud, pmd);
133 BUG_ON(pmd != pmd_offset(pud, 0));
134 }
135
136 return pmd_offset(pud, 0);
137}
138
139static pte_t * __init one_page_table_init(pmd_t *pmd)
140{
141 if (pmd_none(*pmd)) {
142 pte_t *pte;
143
144 pte = alloc_bootmem_pages(PAGE_SIZE);
145 pmd_populate_kernel(&init_mm, pmd, pte);
146 BUG_ON(pte != pte_offset_kernel(pmd, 0));
147 }
148
149 return pte_offset_kernel(pmd, 0);
150}
151
152static pte_t * __init page_table_kmap_check(pte_t *pte, pmd_t *pmd,
153 unsigned long vaddr, pte_t *lastpte)
154{
155 return pte;
156}
157
128void __init page_table_range_init(unsigned long start, unsigned long end, 158void __init page_table_range_init(unsigned long start, unsigned long end,
129 pgd_t *pgd_base) 159 pgd_t *pgd_base)
130{ 160{
131 pgd_t *pgd; 161 pgd_t *pgd;
132 pud_t *pud; 162 pud_t *pud;
133 pmd_t *pmd; 163 pmd_t *pmd;
134 pte_t *pte; 164 pte_t *pte = NULL;
135 int i, j, k; 165 int i, j, k;
136 unsigned long vaddr; 166 unsigned long vaddr;
137 167
@@ -144,19 +174,13 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
144 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { 174 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
145 pud = (pud_t *)pgd; 175 pud = (pud_t *)pgd;
146 for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { 176 for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) {
147#ifdef __PAGETABLE_PMD_FOLDED 177 pmd = one_md_table_init(pud);
148 pmd = (pmd_t *)pud; 178#ifndef __PAGETABLE_PMD_FOLDED
149#else
150 pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE);
151 pud_populate(&init_mm, pud, pmd);
152 pmd += k; 179 pmd += k;
153#endif 180#endif
154 for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { 181 for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) {
155 if (pmd_none(*pmd)) { 182 pte = page_table_kmap_check(one_page_table_init(pmd),
156 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); 183 pmd, vaddr, pte);
157 pmd_populate_kernel(&init_mm, pmd, pte);
158 BUG_ON(pte != pte_offset_kernel(pmd, 0));
159 }
160 vaddr += PMD_SIZE; 184 vaddr += PMD_SIZE;
161 } 185 }
162 k = 0; 186 k = 0;
diff --git a/arch/sh/mm/nommu.c b/arch/sh/mm/nommu.c
index 7694f50c9034..36312d254faf 100644
--- a/arch/sh/mm/nommu.c
+++ b/arch/sh/mm/nommu.c
@@ -67,6 +67,10 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
67 BUG(); 67 BUG();
68} 68}
69 69
70void __flush_tlb_global(void)
71{
72}
73
70void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte) 74void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
71{ 75{
72} 76}
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 6379091a1647..b20b1b3eee4b 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -40,7 +40,7 @@ struct pmb_entry {
40 unsigned long flags; 40 unsigned long flags;
41 unsigned long size; 41 unsigned long size;
42 42
43 spinlock_t lock; 43 raw_spinlock_t lock;
44 44
45 /* 45 /*
46 * 0 .. NR_PMB_ENTRIES for specific entry selection, or 46 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
@@ -265,7 +265,7 @@ static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
265 265
266 memset(pmbe, 0, sizeof(struct pmb_entry)); 266 memset(pmbe, 0, sizeof(struct pmb_entry));
267 267
268 spin_lock_init(&pmbe->lock); 268 raw_spin_lock_init(&pmbe->lock);
269 269
270 pmbe->vpn = vpn; 270 pmbe->vpn = vpn;
271 pmbe->ppn = ppn; 271 pmbe->ppn = ppn;
@@ -327,9 +327,9 @@ static void set_pmb_entry(struct pmb_entry *pmbe)
327{ 327{
328 unsigned long flags; 328 unsigned long flags;
329 329
330 spin_lock_irqsave(&pmbe->lock, flags); 330 raw_spin_lock_irqsave(&pmbe->lock, flags);
331 __set_pmb_entry(pmbe); 331 __set_pmb_entry(pmbe);
332 spin_unlock_irqrestore(&pmbe->lock, flags); 332 raw_spin_unlock_irqrestore(&pmbe->lock, flags);
333} 333}
334#endif /* CONFIG_PM */ 334#endif /* CONFIG_PM */
335 335
@@ -368,7 +368,7 @@ int pmb_bolt_mapping(unsigned long vaddr, phys_addr_t phys,
368 return PTR_ERR(pmbe); 368 return PTR_ERR(pmbe);
369 } 369 }
370 370
371 spin_lock_irqsave(&pmbe->lock, flags); 371 raw_spin_lock_irqsave(&pmbe->lock, flags);
372 372
373 pmbe->size = pmb_sizes[i].size; 373 pmbe->size = pmb_sizes[i].size;
374 374
@@ -383,9 +383,10 @@ int pmb_bolt_mapping(unsigned long vaddr, phys_addr_t phys,
383 * entries for easier tear-down. 383 * entries for easier tear-down.
384 */ 384 */
385 if (likely(pmbp)) { 385 if (likely(pmbp)) {
386 spin_lock(&pmbp->lock); 386 raw_spin_lock_nested(&pmbp->lock,
387 SINGLE_DEPTH_NESTING);
387 pmbp->link = pmbe; 388 pmbp->link = pmbe;
388 spin_unlock(&pmbp->lock); 389 raw_spin_unlock(&pmbp->lock);
389 } 390 }
390 391
391 pmbp = pmbe; 392 pmbp = pmbe;
@@ -398,7 +399,7 @@ int pmb_bolt_mapping(unsigned long vaddr, phys_addr_t phys,
398 i--; 399 i--;
399 mapped++; 400 mapped++;
400 401
401 spin_unlock_irqrestore(&pmbe->lock, flags); 402 raw_spin_unlock_irqrestore(&pmbe->lock, flags);
402 } 403 }
403 } while (size >= SZ_16M); 404 } while (size >= SZ_16M);
404 405
@@ -627,15 +628,14 @@ static void __init pmb_synchronize(void)
627 continue; 628 continue;
628 } 629 }
629 630
630 spin_lock_irqsave(&pmbe->lock, irqflags); 631 raw_spin_lock_irqsave(&pmbe->lock, irqflags);
631 632
632 for (j = 0; j < ARRAY_SIZE(pmb_sizes); j++) 633 for (j = 0; j < ARRAY_SIZE(pmb_sizes); j++)
633 if (pmb_sizes[j].flag == size) 634 if (pmb_sizes[j].flag == size)
634 pmbe->size = pmb_sizes[j].size; 635 pmbe->size = pmb_sizes[j].size;
635 636
636 if (pmbp) { 637 if (pmbp) {
637 spin_lock(&pmbp->lock); 638 raw_spin_lock_nested(&pmbp->lock, SINGLE_DEPTH_NESTING);
638
639 /* 639 /*
640 * Compare the previous entry against the current one to 640 * Compare the previous entry against the current one to
641 * see if the entries span a contiguous mapping. If so, 641 * see if the entries span a contiguous mapping. If so,
@@ -644,13 +644,12 @@ static void __init pmb_synchronize(void)
644 */ 644 */
645 if (pmb_can_merge(pmbp, pmbe)) 645 if (pmb_can_merge(pmbp, pmbe))
646 pmbp->link = pmbe; 646 pmbp->link = pmbe;
647 647 raw_spin_unlock(&pmbp->lock);
648 spin_unlock(&pmbp->lock);
649 } 648 }
650 649
651 pmbp = pmbe; 650 pmbp = pmbe;
652 651
653 spin_unlock_irqrestore(&pmbe->lock, irqflags); 652 raw_spin_unlock_irqrestore(&pmbe->lock, irqflags);
654 } 653 }
655} 654}
656 655
@@ -757,7 +756,7 @@ static void __init pmb_resize(void)
757 /* 756 /*
758 * Found it, now resize it. 757 * Found it, now resize it.
759 */ 758 */
760 spin_lock_irqsave(&pmbe->lock, flags); 759 raw_spin_lock_irqsave(&pmbe->lock, flags);
761 760
762 pmbe->size = SZ_16M; 761 pmbe->size = SZ_16M;
763 pmbe->flags &= ~PMB_SZ_MASK; 762 pmbe->flags &= ~PMB_SZ_MASK;
@@ -767,7 +766,7 @@ static void __init pmb_resize(void)
767 766
768 __set_pmb_entry(pmbe); 767 __set_pmb_entry(pmbe);
769 768
770 spin_unlock_irqrestore(&pmbe->lock, flags); 769 raw_spin_unlock_irqrestore(&pmbe->lock, flags);
771 } 770 }
772 771
773 read_unlock(&pmb_rwlock); 772 read_unlock(&pmb_rwlock);
@@ -866,11 +865,9 @@ static int __init pmb_debugfs_init(void)
866 struct dentry *dentry; 865 struct dentry *dentry;
867 866
868 dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO, 867 dentry = debugfs_create_file("pmb", S_IFREG | S_IRUGO,
869 sh_debugfs_root, NULL, &pmb_debugfs_fops); 868 arch_debugfs_dir, NULL, &pmb_debugfs_fops);
870 if (!dentry) 869 if (!dentry)
871 return -ENOMEM; 870 return -ENOMEM;
872 if (IS_ERR(dentry))
873 return PTR_ERR(dentry);
874 871
875 return 0; 872 return 0;
876} 873}
diff --git a/arch/sh/mm/sram.c b/arch/sh/mm/sram.c
new file mode 100644
index 000000000000..bc156ec4545e
--- /dev/null
+++ b/arch/sh/mm/sram.c
@@ -0,0 +1,34 @@
1/*
2 * SRAM pool for tiny memories not otherwise managed.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <asm/sram.h>
13
14/*
15 * This provides a standard SRAM pool for tiny memories that can be
16 * added either by the CPU or the platform code. Typical SRAM sizes
17 * to be inserted in to the pool will generally be less than the page
18 * size, with anything more reasonably sized handled as a NUMA memory
19 * node.
20 */
21struct gen_pool *sram_pool;
22
23static int __init sram_pool_init(void)
24{
25 /*
26 * This is a global pool, we don't care about node locality.
27 */
28 sram_pool = gen_pool_create(1, -1);
29 if (unlikely(!sram_pool))
30 return -ENOMEM;
31
32 return 0;
33}
34core_initcall(sram_pool_init);
diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c
index 229bf75f28df..dea637a09246 100644
--- a/arch/sh/mm/tlb-debugfs.c
+++ b/arch/sh/mm/tlb-debugfs.c
@@ -151,15 +151,13 @@ static int __init tlb_debugfs_init(void)
151{ 151{
152 struct dentry *itlb, *utlb; 152 struct dentry *itlb, *utlb;
153 153
154 itlb = debugfs_create_file("itlb", S_IRUSR, sh_debugfs_root, 154 itlb = debugfs_create_file("itlb", S_IRUSR, arch_debugfs_dir,
155 (unsigned int *)TLB_TYPE_ITLB, 155 (unsigned int *)TLB_TYPE_ITLB,
156 &tlb_debugfs_fops); 156 &tlb_debugfs_fops);
157 if (unlikely(!itlb)) 157 if (unlikely(!itlb))
158 return -ENOMEM; 158 return -ENOMEM;
159 if (IS_ERR(itlb))
160 return PTR_ERR(itlb);
161 159
162 utlb = debugfs_create_file("utlb", S_IRUSR, sh_debugfs_root, 160 utlb = debugfs_create_file("utlb", S_IRUSR, arch_debugfs_dir,
163 (unsigned int *)TLB_TYPE_UTLB, 161 (unsigned int *)TLB_TYPE_UTLB,
164 &tlb_debugfs_fops); 162 &tlb_debugfs_fops);
165 if (unlikely(!utlb)) { 163 if (unlikely(!utlb)) {
@@ -167,11 +165,6 @@ static int __init tlb_debugfs_init(void)
167 return -ENOMEM; 165 return -ENOMEM;
168 } 166 }
169 167
170 if (IS_ERR(utlb)) {
171 debugfs_remove(itlb);
172 return PTR_ERR(utlb);
173 }
174
175 return 0; 168 return 0;
176} 169}
177module_init(tlb_debugfs_init); 170module_init(tlb_debugfs_init);
diff --git a/arch/sh/mm/tlbflush_32.c b/arch/sh/mm/tlbflush_32.c
index 3fbe03ce8fe3..a6a20d6de4c0 100644
--- a/arch/sh/mm/tlbflush_32.c
+++ b/arch/sh/mm/tlbflush_32.c
@@ -119,3 +119,19 @@ void local_flush_tlb_mm(struct mm_struct *mm)
119 local_irq_restore(flags); 119 local_irq_restore(flags);
120 } 120 }
121} 121}
122
123void __flush_tlb_global(void)
124{
125 unsigned long flags;
126
127 local_irq_save(flags);
128
129 /*
130 * This is the most destructive of the TLB flushing options,
131 * and will tear down all of the UTLB/ITLB mappings, including
132 * wired entries.
133 */
134 __raw_writel(__raw_readl(MMUCR) | MMUCR_TI, MMUCR);
135
136 local_irq_restore(flags);
137}
diff --git a/arch/sh/mm/tlbflush_64.c b/arch/sh/mm/tlbflush_64.c
index 03db41cc1268..7f5810f5dfdc 100644
--- a/arch/sh/mm/tlbflush_64.c
+++ b/arch/sh/mm/tlbflush_64.c
@@ -455,6 +455,11 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
455 flush_tlb_all(); 455 flush_tlb_all();
456} 456}
457 457
458void __flush_tlb_global(void)
459{
460 flush_tlb_all();
461}
462
458void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte) 463void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
459{ 464{
460} 465}
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index b25aa554ee5e..9f56eb978024 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -52,6 +52,8 @@ MIGOR SH_MIGOR
52RSK7201 SH_RSK7201 52RSK7201 SH_RSK7201
53RSK7203 SH_RSK7203 53RSK7203 SH_RSK7203
54AP325RXA SH_AP325RXA 54AP325RXA SH_AP325RXA
55SH2007 SH_SH2007
56SH7757LCR SH_SH7757LCR
55SH7763RDP SH_SH7763RDP 57SH7763RDP SH_SH7763RDP
56SH7785LCR SH_SH7785LCR 58SH7785LCR SH_SH7785LCR
57SH7785LCR_PT SH_SH7785LCR_PT 59SH7785LCR_PT SH_SH7785LCR_PT
diff --git a/drivers/Makefile b/drivers/Makefile
index a2aea53a75ed..167af319cfdf 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -92,6 +92,7 @@ obj-$(CONFIG_EISA) += eisa/
92obj-y += lguest/ 92obj-y += lguest/
93obj-$(CONFIG_CPU_FREQ) += cpufreq/ 93obj-$(CONFIG_CPU_FREQ) += cpufreq/
94obj-$(CONFIG_CPU_IDLE) += cpuidle/ 94obj-$(CONFIG_CPU_IDLE) += cpuidle/
95obj-$(CONFIG_DMA_ENGINE) += dma/
95obj-$(CONFIG_MMC) += mmc/ 96obj-$(CONFIG_MMC) += mmc/
96obj-$(CONFIG_MEMSTICK) += memstick/ 97obj-$(CONFIG_MEMSTICK) += memstick/
97obj-$(CONFIG_NEW_LEDS) += leds/ 98obj-$(CONFIG_NEW_LEDS) += leds/
@@ -104,7 +105,6 @@ obj-$(CONFIG_ARCH_SHMOBILE) += sh/
104ifndef CONFIG_ARCH_USES_GETTIMEOFFSET 105ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
105obj-y += clocksource/ 106obj-y += clocksource/
106endif 107endif
107obj-$(CONFIG_DMA_ENGINE) += dma/
108obj-$(CONFIG_DCA) += dca/ 108obj-$(CONFIG_DCA) += dca/
109obj-$(CONFIG_HID) += hid/ 109obj-$(CONFIG_HID) += hid/
110obj-$(CONFIG_PPC_PS3) += ps3/ 110obj-$(CONFIG_PPC_PS3) += ps3/
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 717305d30444..a44611652282 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -308,7 +308,7 @@ static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id)
308 * isr before we end up here. 308 * isr before we end up here.
309 */ 309 */
310 if (p->flags & FLAG_CLOCKSOURCE) 310 if (p->flags & FLAG_CLOCKSOURCE)
311 p->total_cycles += p->match_value; 311 p->total_cycles += p->match_value + 1;
312 312
313 if (!(p->flags & FLAG_REPROGRAM)) 313 if (!(p->flags & FLAG_REPROGRAM))
314 p->next_match_value = p->max_match_value; 314 p->next_match_value = p->max_match_value;
@@ -403,7 +403,7 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
403 raw = sh_cmt_get_counter(p, &has_wrapped); 403 raw = sh_cmt_get_counter(p, &has_wrapped);
404 404
405 if (unlikely(has_wrapped)) 405 if (unlikely(has_wrapped))
406 raw += p->match_value; 406 raw += p->match_value + 1;
407 spin_unlock_irqrestore(&p->lock, flags); 407 spin_unlock_irqrestore(&p->lock, flags);
408 408
409 return value + raw; 409 return value + raw;
@@ -445,7 +445,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
445 445
446 /* clk_get_rate() needs an enabled clock */ 446 /* clk_get_rate() needs an enabled clock */
447 clk_enable(p->clk); 447 clk_enable(p->clk);
448 p->rate = clk_get_rate(p->clk) / (p->width == 16) ? 512 : 8; 448 p->rate = clk_get_rate(p->clk) / ((p->width == 16) ? 512 : 8);
449 clk_disable(p->clk); 449 clk_disable(p->clk);
450 450
451 /* TODO: calculate good shift from rate and counter bit width */ 451 /* TODO: calculate good shift from rate and counter bit width */
@@ -478,7 +478,7 @@ static void sh_cmt_clock_event_start(struct sh_cmt_priv *p, int periodic)
478 ced->min_delta_ns = clockevent_delta2ns(0x1f, ced); 478 ced->min_delta_ns = clockevent_delta2ns(0x1f, ced);
479 479
480 if (periodic) 480 if (periodic)
481 sh_cmt_set_next(p, (p->rate + HZ/2) / HZ); 481 sh_cmt_set_next(p, ((p->rate + HZ/2) / HZ) - 1);
482 else 482 else
483 sh_cmt_set_next(p, p->max_match_value); 483 sh_cmt_set_next(p, p->max_match_value);
484} 484}
@@ -523,9 +523,9 @@ static int sh_cmt_clock_event_next(unsigned long delta,
523 523
524 BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT); 524 BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT);
525 if (likely(p->flags & FLAG_IRQCONTEXT)) 525 if (likely(p->flags & FLAG_IRQCONTEXT))
526 p->next_match_value = delta; 526 p->next_match_value = delta - 1;
527 else 527 else
528 sh_cmt_set_next(p, delta); 528 sh_cmt_set_next(p, delta - 1);
529 529
530 return 0; 530 return 0;
531} 531}
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index 4f93da31d3ad..3cad8fecc3d3 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -101,12 +101,12 @@ struct cami2c {
101 101
102static inline void OUT32(struct cami2c *cam, int reg, unsigned long val) 102static inline void OUT32(struct cami2c *cam, int reg, unsigned long val)
103{ 103{
104 ctrl_outl(val, (unsigned long)cam->iobase + reg); 104 __raw_writel(val, (unsigned long)cam->iobase + reg);
105} 105}
106 106
107static inline unsigned long IN32(struct cami2c *cam, int reg) 107static inline unsigned long IN32(struct cami2c *cam, int reg)
108{ 108{
109 return ctrl_inl((unsigned long)cam->iobase + reg); 109 return __raw_readl((unsigned long)cam->iobase + reg);
110} 110}
111 111
112static irqreturn_t sh7760_i2c_irq(int irq, void *ptr) 112static irqreturn_t sh7760_i2c_irq(int irq, void *ptr)
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 598c49acaeb5..2707f5e17158 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -538,15 +538,17 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
538{ 538{
539 struct resource *res; 539 struct resource *res;
540 int ret = -ENXIO; 540 int ret = -ENXIO;
541 int q, m; 541 int n, k = 0;
542 int k = 0;
543 int n = 0;
544 542
545 while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { 543 while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
546 for (n = res->start; hook && n <= res->end; n++) { 544 for (n = res->start; hook && n <= res->end; n++) {
547 if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, 545 if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
548 dev_name(&dev->dev), dev)) 546 dev_name(&dev->dev), dev)) {
547 for (n--; n >= res->start; n--)
548 free_irq(n, dev);
549
549 goto rollback; 550 goto rollback;
551 }
550 } 552 }
551 k++; 553 k++;
552 } 554 }
@@ -554,16 +556,17 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
554 if (hook) 556 if (hook)
555 return k > 0 ? 0 : -ENOENT; 557 return k > 0 ? 0 : -ENOENT;
556 558
557 k--;
558 ret = 0; 559 ret = 0;
559 560
560 rollback: 561 rollback:
561 for (q = k; k >= 0; k--) { 562 k--;
562 for (m = n; m >= res->start; m--) 563
563 free_irq(m, dev); 564 while (k >= 0) {
565 res = platform_get_resource(dev, IORESOURCE_IRQ, k);
566 for (n = res->start; n <= res->end; n++)
567 free_irq(n, dev);
564 568
565 res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1); 569 k--;
566 m = res->end;
567 } 570 }
568 571
569 return ret; 572 return ret;
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index cd164595f08a..49b4d069cbf9 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -65,7 +65,7 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
65 p->set_pwr(pdev, state); 65 p->set_pwr(pdev, state);
66} 66}
67 67
68static int __init sh_mobile_sdhi_probe(struct platform_device *pdev) 68static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
69{ 69{
70 struct sh_mobile_sdhi *priv; 70 struct sh_mobile_sdhi *priv;
71 struct tmio_mmc_data *mmc_data; 71 struct tmio_mmc_data *mmc_data;
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 9b52f77a9305..d2352ac437c5 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -140,7 +140,15 @@
140# define SCSPTR0 0xffe00024 /* 16 bit SCIF */ 140# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
141# define SCSPTR1 0xffe10024 /* 16 bit SCIF */ 141# define SCSPTR1 0xffe10024 /* 16 bit SCIF */
142# define SCIF_ORER 0x0001 /* Overrun error bit */ 142# define SCIF_ORER 0x0001 /* Overrun error bit */
143# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 143
144#if defined(CONFIG_SH_SH2007)
145/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=0 */
146# define SCSCR_INIT(port) 0x38
147#else
148/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=1 */
149# define SCSCR_INIT(port) 0x3a
150#endif
151
144#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \ 152#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
145 defined(CONFIG_CPU_SUBTYPE_SH7786) 153 defined(CONFIG_CPU_SUBTYPE_SH7786)
146# define SCSPTR0 0xffea0024 /* 16 bit SCIF */ 154# define SCSPTR0 0xffea0024 /* 16 bit SCIF */
@@ -616,9 +624,10 @@ static inline int sci_rxd_in(struct uart_port *port)
616 * -- Mitch Davis - 15 Jul 2000 624 * -- Mitch Davis - 15 Jul 2000
617 */ 625 */
618 626
619#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 627#if (defined(CONFIG_CPU_SUBTYPE_SH7780) || \
620 defined(CONFIG_CPU_SUBTYPE_SH7785) || \ 628 defined(CONFIG_CPU_SUBTYPE_SH7785) || \
621 defined(CONFIG_CPU_SUBTYPE_SH7786) 629 defined(CONFIG_CPU_SUBTYPE_SH7786)) && \
630 !defined(CONFIG_SH_SH2007)
622#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) 631#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
623#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 632#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
624 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 633 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
diff --git a/drivers/sh/Kconfig b/drivers/sh/Kconfig
index a54de0b9b3df..f168a6159961 100644
--- a/drivers/sh/Kconfig
+++ b/drivers/sh/Kconfig
@@ -1,24 +1,5 @@
1config INTC_USERIMASK 1menu "SuperH / SH-Mobile Driver Options"
2 bool "Userspace interrupt masking support"
3 depends on ARCH_SHMOBILE || (SUPERH && CPU_SH4A)
4 help
5 This enables support for hardware-assisted userspace hardirq
6 masking.
7 2
8 SH-4A and newer interrupt blocks all support a special shadowed 3source "drivers/sh/intc/Kconfig"
9 page with all non-masking registers obscured when mapped in to
10 userspace. This is primarily for use by userspace device
11 drivers that are using special priority levels.
12 4
13 If in doubt, say N. 5endmenu
14
15config INTC_BALANCING
16 bool "Hardware IRQ balancing support"
17 depends on SMP && SUPERH && CPU_SUBTYPE_SH7786
18 help
19 This enables support for IRQ auto-distribution mode on SH-X3
20 SMP parts. All of the balancing and CPU wakeup decisions are
21 taken care of automatically by hardware for distributed
22 vectors.
23
24 If in doubt, say N.
diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile
index 08fc653a825c..24e6cec0ae8d 100644
--- a/drivers/sh/Makefile
+++ b/drivers/sh/Makefile
@@ -1,10 +1,9 @@
1# 1#
2# Makefile for the SuperH specific drivers. 2# Makefile for the SuperH specific drivers.
3# 3#
4obj-y := clk.o intc.o 4obj-y := intc/
5 5
6obj-$(CONFIG_SUPERHYWAY) += superhyway/ 6obj-$(CONFIG_HAVE_CLK) += clk/
7obj-$(CONFIG_MAPLE) += maple/ 7obj-$(CONFIG_MAPLE) += maple/
8 8obj-$(CONFIG_SUPERHYWAY) += superhyway/
9obj-$(CONFIG_GENERIC_GPIO) += pfc.o 9obj-$(CONFIG_GENERIC_GPIO) += pfc.o
10obj-$(CONFIG_SH_CLK_CPG) += clk-cpg.o
diff --git a/drivers/sh/clk/Makefile b/drivers/sh/clk/Makefile
new file mode 100644
index 000000000000..5d15ebfaa074
--- /dev/null
+++ b/drivers/sh/clk/Makefile
@@ -0,0 +1,3 @@
1obj-y := core.o
2
3obj-$(CONFIG_SH_CLK_CPG) += cpg.o
diff --git a/drivers/sh/clk.c b/drivers/sh/clk/core.c
index 5d84adac9ec4..fd0d1b98901c 100644
--- a/drivers/sh/clk.c
+++ b/drivers/sh/clk/core.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * drivers/sh/clk.c - SuperH clock framework 2 * SuperH clock framework
3 * 3 *
4 * Copyright (C) 2005 - 2009 Paul Mundt 4 * Copyright (C) 2005 - 2010 Paul Mundt
5 * 5 *
6 * This clock framework is derived from the OMAP version by: 6 * This clock framework is derived from the OMAP version by:
7 * 7 *
@@ -14,6 +14,8 @@
14 * License. See the file "COPYING" in the main directory of this archive 14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details. 15 * for more details.
16 */ 16 */
17#define pr_fmt(fmt) "clock: " fmt
18
17#include <linux/kernel.h> 19#include <linux/kernel.h>
18#include <linux/init.h> 20#include <linux/init.h>
19#include <linux/module.h> 21#include <linux/module.h>
@@ -23,7 +25,7 @@
23#include <linux/sysdev.h> 25#include <linux/sysdev.h>
24#include <linux/seq_file.h> 26#include <linux/seq_file.h>
25#include <linux/err.h> 27#include <linux/err.h>
26#include <linux/platform_device.h> 28#include <linux/io.h>
27#include <linux/debugfs.h> 29#include <linux/debugfs.h>
28#include <linux/cpufreq.h> 30#include <linux/cpufreq.h>
29#include <linux/clk.h> 31#include <linux/clk.h>
@@ -43,6 +45,8 @@ void clk_rate_table_build(struct clk *clk,
43 unsigned long freq; 45 unsigned long freq;
44 int i; 46 int i;
45 47
48 clk->nr_freqs = nr_freqs;
49
46 for (i = 0; i < nr_freqs; i++) { 50 for (i = 0; i < nr_freqs; i++) {
47 div = 1; 51 div = 1;
48 mult = 1; 52 mult = 1;
@@ -67,29 +71,39 @@ void clk_rate_table_build(struct clk *clk,
67 freq_table[i].frequency = CPUFREQ_TABLE_END; 71 freq_table[i].frequency = CPUFREQ_TABLE_END;
68} 72}
69 73
70long clk_rate_table_round(struct clk *clk, 74struct clk_rate_round_data;
71 struct cpufreq_frequency_table *freq_table, 75
72 unsigned long rate) 76struct clk_rate_round_data {
77 unsigned long rate;
78 unsigned int min, max;
79 long (*func)(unsigned int, struct clk_rate_round_data *);
80 void *arg;
81};
82
83#define for_each_frequency(pos, r, freq) \
84 for (pos = r->min, freq = r->func(pos, r); \
85 pos <= r->max; pos++, freq = r->func(pos, r)) \
86 if (unlikely(freq == 0)) \
87 ; \
88 else
89
90static long clk_rate_round_helper(struct clk_rate_round_data *rounder)
73{ 91{
74 unsigned long rate_error, rate_error_prev = ~0UL; 92 unsigned long rate_error, rate_error_prev = ~0UL;
75 unsigned long rate_best_fit = rate; 93 unsigned long rate_best_fit = rounder->rate;
76 unsigned long highest, lowest; 94 unsigned long highest, lowest, freq;
77 int i; 95 int i;
78 96
79 highest = lowest = 0; 97 highest = 0;
80 98 lowest = ~0UL;
81 for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
82 unsigned long freq = freq_table[i].frequency;
83
84 if (freq == CPUFREQ_ENTRY_INVALID)
85 continue;
86 99
100 for_each_frequency(i, rounder, freq) {
87 if (freq > highest) 101 if (freq > highest)
88 highest = freq; 102 highest = freq;
89 if (freq < lowest) 103 if (freq < lowest)
90 lowest = freq; 104 lowest = freq;
91 105
92 rate_error = abs(freq - rate); 106 rate_error = abs(freq - rounder->rate);
93 if (rate_error < rate_error_prev) { 107 if (rate_error < rate_error_prev) {
94 rate_best_fit = freq; 108 rate_best_fit = freq;
95 rate_error_prev = rate_error; 109 rate_error_prev = rate_error;
@@ -99,14 +113,64 @@ long clk_rate_table_round(struct clk *clk,
99 break; 113 break;
100 } 114 }
101 115
102 if (rate >= highest) 116 if (rounder->rate >= highest)
103 rate_best_fit = highest; 117 rate_best_fit = highest;
104 if (rate <= lowest) 118 if (rounder->rate <= lowest)
105 rate_best_fit = lowest; 119 rate_best_fit = lowest;
106 120
107 return rate_best_fit; 121 return rate_best_fit;
108} 122}
109 123
124static long clk_rate_table_iter(unsigned int pos,
125 struct clk_rate_round_data *rounder)
126{
127 struct cpufreq_frequency_table *freq_table = rounder->arg;
128 unsigned long freq = freq_table[pos].frequency;
129
130 if (freq == CPUFREQ_ENTRY_INVALID)
131 freq = 0;
132
133 return freq;
134}
135
136long clk_rate_table_round(struct clk *clk,
137 struct cpufreq_frequency_table *freq_table,
138 unsigned long rate)
139{
140 struct clk_rate_round_data table_round = {
141 .min = 0,
142 .max = clk->nr_freqs - 1,
143 .func = clk_rate_table_iter,
144 .arg = freq_table,
145 .rate = rate,
146 };
147
148 if (clk->nr_freqs < 1)
149 return 0;
150
151 return clk_rate_round_helper(&table_round);
152}
153
154static long clk_rate_div_range_iter(unsigned int pos,
155 struct clk_rate_round_data *rounder)
156{
157 return clk_get_rate(rounder->arg) / pos;
158}
159
160long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
161 unsigned int div_max, unsigned long rate)
162{
163 struct clk_rate_round_data div_range_round = {
164 .min = div_min,
165 .max = div_max,
166 .func = clk_rate_div_range_iter,
167 .arg = clk_get_parent(clk),
168 .rate = rate,
169 };
170
171 return clk_rate_round_helper(&div_range_round);
172}
173
110int clk_rate_table_find(struct clk *clk, 174int clk_rate_table_find(struct clk *clk,
111 struct cpufreq_frequency_table *freq_table, 175 struct cpufreq_frequency_table *freq_table,
112 unsigned long rate) 176 unsigned long rate)
@@ -160,8 +224,8 @@ void propagate_rate(struct clk *tclk)
160 224
161static void __clk_disable(struct clk *clk) 225static void __clk_disable(struct clk *clk)
162{ 226{
163 if (WARN(!clk->usecount, "Trying to disable clock %s with 0 usecount\n", 227 if (WARN(!clk->usecount, "Trying to disable clock %p with 0 usecount\n",
164 clk->name)) 228 clk))
165 return; 229 return;
166 230
167 if (!(--clk->usecount)) { 231 if (!(--clk->usecount)) {
@@ -248,8 +312,88 @@ void recalculate_root_clocks(void)
248 } 312 }
249} 313}
250 314
315static struct clk_mapping dummy_mapping;
316
317static struct clk *lookup_root_clock(struct clk *clk)
318{
319 while (clk->parent)
320 clk = clk->parent;
321
322 return clk;
323}
324
325static int clk_establish_mapping(struct clk *clk)
326{
327 struct clk_mapping *mapping = clk->mapping;
328
329 /*
330 * Propagate mappings.
331 */
332 if (!mapping) {
333 struct clk *clkp;
334
335 /*
336 * dummy mapping for root clocks with no specified ranges
337 */
338 if (!clk->parent) {
339 clk->mapping = &dummy_mapping;
340 return 0;
341 }
342
343 /*
344 * If we're on a child clock and it provides no mapping of its
345 * own, inherit the mapping from its root clock.
346 */
347 clkp = lookup_root_clock(clk);
348 mapping = clkp->mapping;
349 BUG_ON(!mapping);
350 }
351
352 /*
353 * Establish initial mapping.
354 */
355 if (!mapping->base && mapping->phys) {
356 kref_init(&mapping->ref);
357
358 mapping->base = ioremap_nocache(mapping->phys, mapping->len);
359 if (unlikely(!mapping->base))
360 return -ENXIO;
361 } else if (mapping->base) {
362 /*
363 * Bump the refcount for an existing mapping
364 */
365 kref_get(&mapping->ref);
366 }
367
368 clk->mapping = mapping;
369 return 0;
370}
371
372static void clk_destroy_mapping(struct kref *kref)
373{
374 struct clk_mapping *mapping;
375
376 mapping = container_of(kref, struct clk_mapping, ref);
377
378 iounmap(mapping->base);
379}
380
381static void clk_teardown_mapping(struct clk *clk)
382{
383 struct clk_mapping *mapping = clk->mapping;
384
385 /* Nothing to do */
386 if (mapping == &dummy_mapping)
387 return;
388
389 kref_put(&mapping->ref, clk_destroy_mapping);
390 clk->mapping = NULL;
391}
392
251int clk_register(struct clk *clk) 393int clk_register(struct clk *clk)
252{ 394{
395 int ret;
396
253 if (clk == NULL || IS_ERR(clk)) 397 if (clk == NULL || IS_ERR(clk))
254 return -EINVAL; 398 return -EINVAL;
255 399
@@ -264,6 +408,10 @@ int clk_register(struct clk *clk)
264 INIT_LIST_HEAD(&clk->children); 408 INIT_LIST_HEAD(&clk->children);
265 clk->usecount = 0; 409 clk->usecount = 0;
266 410
411 ret = clk_establish_mapping(clk);
412 if (unlikely(ret))
413 goto out_unlock;
414
267 if (clk->parent) 415 if (clk->parent)
268 list_add(&clk->sibling, &clk->parent->children); 416 list_add(&clk->sibling, &clk->parent->children);
269 else 417 else
@@ -272,9 +420,11 @@ int clk_register(struct clk *clk)
272 list_add(&clk->node, &clock_list); 420 list_add(&clk->node, &clock_list);
273 if (clk->ops && clk->ops->init) 421 if (clk->ops && clk->ops->init)
274 clk->ops->init(clk); 422 clk->ops->init(clk);
423
424out_unlock:
275 mutex_unlock(&clock_list_sem); 425 mutex_unlock(&clock_list_sem);
276 426
277 return 0; 427 return ret;
278} 428}
279EXPORT_SYMBOL_GPL(clk_register); 429EXPORT_SYMBOL_GPL(clk_register);
280 430
@@ -283,6 +433,7 @@ void clk_unregister(struct clk *clk)
283 mutex_lock(&clock_list_sem); 433 mutex_lock(&clock_list_sem);
284 list_del(&clk->sibling); 434 list_del(&clk->sibling);
285 list_del(&clk->node); 435 list_del(&clk->node);
436 clk_teardown_mapping(clk);
286 mutex_unlock(&clock_list_sem); 437 mutex_unlock(&clock_list_sem);
287} 438}
288EXPORT_SYMBOL_GPL(clk_unregister); 439EXPORT_SYMBOL_GPL(clk_unregister);
@@ -354,10 +505,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
354 ret = clk_reparent(clk, parent); 505 ret = clk_reparent(clk, parent);
355 506
356 if (ret == 0) { 507 if (ret == 0) {
357 pr_debug("clock: set parent of %s to %s (new rate %ld)\n",
358 clk->name, clk->parent->name, clk->rate);
359 if (clk->ops->recalc) 508 if (clk->ops->recalc)
360 clk->rate = clk->ops->recalc(clk); 509 clk->rate = clk->ops->recalc(clk);
510 pr_debug("set parent of %p to %p (new rate %ld)\n",
511 clk, clk->parent, clk->rate);
361 propagate_rate(clk); 512 propagate_rate(clk);
362 } 513 }
363 } else 514 } else
@@ -469,9 +620,7 @@ static int clk_debugfs_register_one(struct clk *c)
469 char s[255]; 620 char s[255];
470 char *p = s; 621 char *p = s;
471 622
472 p += sprintf(p, "%s", c->name); 623 p += sprintf(p, "%p", c);
473 if (c->id >= 0)
474 sprintf(p, ":%d", c->id);
475 d = debugfs_create_dir(s, pa ? pa->dentry : clk_debugfs_root); 624 d = debugfs_create_dir(s, pa ? pa->dentry : clk_debugfs_root);
476 if (!d) 625 if (!d)
477 return -ENOMEM; 626 return -ENOMEM;
@@ -513,7 +662,7 @@ static int clk_debugfs_register(struct clk *c)
513 return err; 662 return err;
514 } 663 }
515 664
516 if (!c->dentry && c->name) { 665 if (!c->dentry) {
517 err = clk_debugfs_register_one(c); 666 err = clk_debugfs_register_one(c);
518 if (err) 667 if (err)
519 return err; 668 return err;
diff --git a/drivers/sh/clk-cpg.c b/drivers/sh/clk/cpg.c
index 8c024b984ed8..3aea5f0ceb09 100644
--- a/drivers/sh/clk-cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -1,3 +1,12 @@
1/*
2 * Helper routines for SuperH Clock Pulse Generator blocks (CPG).
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
1#include <linux/clk.h> 10#include <linux/clk.h>
2#include <linux/compiler.h> 11#include <linux/compiler.h>
3#include <linux/slab.h> 12#include <linux/slab.h>
@@ -180,7 +189,6 @@ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
180 clkp = clks + k; 189 clkp = clks + k;
181 190
182 clkp->ops = ops; 191 clkp->ops = ops;
183 clkp->id = -1;
184 clkp->freq_table = freq_table + (k * freq_table_size); 192 clkp->freq_table = freq_table + (k * freq_table_size);
185 clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END; 193 clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END;
186 194
@@ -319,7 +327,6 @@ static int __init sh_clk_div4_register_ops(struct clk *clks, int nr,
319 clkp = clks + k; 327 clkp = clks + k;
320 328
321 clkp->ops = ops; 329 clkp->ops = ops;
322 clkp->id = -1;
323 clkp->priv = table; 330 clkp->priv = table;
324 331
325 clkp->freq_table = freq_table + (k * freq_table_size); 332 clkp->freq_table = freq_table + (k * freq_table_size);
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c
deleted file mode 100644
index e91a23e5ffd8..000000000000
--- a/drivers/sh/intc.c
+++ /dev/null
@@ -1,1390 +0,0 @@
1/*
2 * Shared interrupt handling code for IPR and INTC2 types of IRQs.
3 *
4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt
6 *
7 * Based on intc2.c and ipr.c
8 *
9 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
10 * Copyright (C) 2000 Kazumoto Kojima
11 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
12 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
13 * Copyright (C) 2005, 2006 Paul Mundt
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
21#include <linux/init.h>
22#include <linux/irq.h>
23#include <linux/module.h>
24#include <linux/io.h>
25#include <linux/slab.h>
26#include <linux/interrupt.h>
27#include <linux/sh_intc.h>
28#include <linux/sysdev.h>
29#include <linux/list.h>
30#include <linux/topology.h>
31#include <linux/bitmap.h>
32#include <linux/cpumask.h>
33#include <asm/sizes.h>
34
35#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
36 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
37 ((addr_e) << 16) | ((addr_d << 24)))
38
39#define _INTC_SHIFT(h) (h & 0x1f)
40#define _INTC_WIDTH(h) ((h >> 5) & 0xf)
41#define _INTC_FN(h) ((h >> 9) & 0xf)
42#define _INTC_MODE(h) ((h >> 13) & 0x7)
43#define _INTC_ADDR_E(h) ((h >> 16) & 0xff)
44#define _INTC_ADDR_D(h) ((h >> 24) & 0xff)
45
46struct intc_handle_int {
47 unsigned int irq;
48 unsigned long handle;
49};
50
51struct intc_window {
52 phys_addr_t phys;
53 void __iomem *virt;
54 unsigned long size;
55};
56
57struct intc_desc_int {
58 struct list_head list;
59 struct sys_device sysdev;
60 pm_message_t state;
61 unsigned long *reg;
62#ifdef CONFIG_SMP
63 unsigned long *smp;
64#endif
65 unsigned int nr_reg;
66 struct intc_handle_int *prio;
67 unsigned int nr_prio;
68 struct intc_handle_int *sense;
69 unsigned int nr_sense;
70 struct intc_window *window;
71 unsigned int nr_windows;
72 struct irq_chip chip;
73};
74
75static LIST_HEAD(intc_list);
76
77/*
78 * The intc_irq_map provides a global map of bound IRQ vectors for a
79 * given platform. Allocation of IRQs are either static through the CPU
80 * vector map, or dynamic in the case of board mux vectors or MSI.
81 *
82 * As this is a central point for all IRQ controllers on the system,
83 * each of the available sources are mapped out here. This combined with
84 * sparseirq makes it quite trivial to keep the vector map tightly packed
85 * when dynamically creating IRQs, as well as tying in to otherwise
86 * unused irq_desc positions in the sparse array.
87 */
88static DECLARE_BITMAP(intc_irq_map, NR_IRQS);
89static DEFINE_SPINLOCK(vector_lock);
90
91#ifdef CONFIG_SMP
92#define IS_SMP(x) x.smp
93#define INTC_REG(d, x, c) (d->reg[(x)] + ((d->smp[(x)] & 0xff) * c))
94#define SMP_NR(d, x) ((d->smp[(x)] >> 8) ? (d->smp[(x)] >> 8) : 1)
95#else
96#define IS_SMP(x) 0
97#define INTC_REG(d, x, c) (d->reg[(x)])
98#define SMP_NR(d, x) 1
99#endif
100
101static unsigned int intc_prio_level[NR_IRQS]; /* for now */
102static unsigned int default_prio_level = 2; /* 2 - 16 */
103static unsigned long ack_handle[NR_IRQS];
104#ifdef CONFIG_INTC_BALANCING
105static unsigned long dist_handle[NR_IRQS];
106#endif
107
108static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
109{
110 struct irq_chip *chip = get_irq_chip(irq);
111 return container_of(chip, struct intc_desc_int, chip);
112}
113
114static unsigned long intc_phys_to_virt(struct intc_desc_int *d,
115 unsigned long address)
116{
117 struct intc_window *window;
118 int k;
119
120 /* scan through physical windows and convert address */
121 for (k = 0; k < d->nr_windows; k++) {
122 window = d->window + k;
123
124 if (address < window->phys)
125 continue;
126
127 if (address >= (window->phys + window->size))
128 continue;
129
130 address -= window->phys;
131 address += (unsigned long)window->virt;
132
133 return address;
134 }
135
136 /* no windows defined, register must be 1:1 mapped virt:phys */
137 return address;
138}
139
140static unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address)
141{
142 unsigned int k;
143
144 address = intc_phys_to_virt(d, address);
145
146 for (k = 0; k < d->nr_reg; k++) {
147 if (d->reg[k] == address)
148 return k;
149 }
150
151 BUG();
152 return 0;
153}
154
155static inline unsigned int set_field(unsigned int value,
156 unsigned int field_value,
157 unsigned int handle)
158{
159 unsigned int width = _INTC_WIDTH(handle);
160 unsigned int shift = _INTC_SHIFT(handle);
161
162 value &= ~(((1 << width) - 1) << shift);
163 value |= field_value << shift;
164 return value;
165}
166
167static void write_8(unsigned long addr, unsigned long h, unsigned long data)
168{
169 __raw_writeb(set_field(0, data, h), addr);
170 (void)__raw_readb(addr); /* Defeat write posting */
171}
172
173static void write_16(unsigned long addr, unsigned long h, unsigned long data)
174{
175 __raw_writew(set_field(0, data, h), addr);
176 (void)__raw_readw(addr); /* Defeat write posting */
177}
178
179static void write_32(unsigned long addr, unsigned long h, unsigned long data)
180{
181 __raw_writel(set_field(0, data, h), addr);
182 (void)__raw_readl(addr); /* Defeat write posting */
183}
184
185static void modify_8(unsigned long addr, unsigned long h, unsigned long data)
186{
187 unsigned long flags;
188 local_irq_save(flags);
189 __raw_writeb(set_field(__raw_readb(addr), data, h), addr);
190 (void)__raw_readb(addr); /* Defeat write posting */
191 local_irq_restore(flags);
192}
193
194static void modify_16(unsigned long addr, unsigned long h, unsigned long data)
195{
196 unsigned long flags;
197 local_irq_save(flags);
198 __raw_writew(set_field(__raw_readw(addr), data, h), addr);
199 (void)__raw_readw(addr); /* Defeat write posting */
200 local_irq_restore(flags);
201}
202
203static void modify_32(unsigned long addr, unsigned long h, unsigned long data)
204{
205 unsigned long flags;
206 local_irq_save(flags);
207 __raw_writel(set_field(__raw_readl(addr), data, h), addr);
208 (void)__raw_readl(addr); /* Defeat write posting */
209 local_irq_restore(flags);
210}
211
212enum { REG_FN_ERR = 0, REG_FN_WRITE_BASE = 1, REG_FN_MODIFY_BASE = 5 };
213
214static void (*intc_reg_fns[])(unsigned long addr,
215 unsigned long h,
216 unsigned long data) = {
217 [REG_FN_WRITE_BASE + 0] = write_8,
218 [REG_FN_WRITE_BASE + 1] = write_16,
219 [REG_FN_WRITE_BASE + 3] = write_32,
220 [REG_FN_MODIFY_BASE + 0] = modify_8,
221 [REG_FN_MODIFY_BASE + 1] = modify_16,
222 [REG_FN_MODIFY_BASE + 3] = modify_32,
223};
224
225enum { MODE_ENABLE_REG = 0, /* Bit(s) set -> interrupt enabled */
226 MODE_MASK_REG, /* Bit(s) set -> interrupt disabled */
227 MODE_DUAL_REG, /* Two registers, set bit to enable / disable */
228 MODE_PRIO_REG, /* Priority value written to enable interrupt */
229 MODE_PCLR_REG, /* Above plus all bits set to disable interrupt */
230};
231
232static void intc_mode_field(unsigned long addr,
233 unsigned long handle,
234 void (*fn)(unsigned long,
235 unsigned long,
236 unsigned long),
237 unsigned int irq)
238{
239 fn(addr, handle, ((1 << _INTC_WIDTH(handle)) - 1));
240}
241
242static void intc_mode_zero(unsigned long addr,
243 unsigned long handle,
244 void (*fn)(unsigned long,
245 unsigned long,
246 unsigned long),
247 unsigned int irq)
248{
249 fn(addr, handle, 0);
250}
251
252static void intc_mode_prio(unsigned long addr,
253 unsigned long handle,
254 void (*fn)(unsigned long,
255 unsigned long,
256 unsigned long),
257 unsigned int irq)
258{
259 fn(addr, handle, intc_prio_level[irq]);
260}
261
262static void (*intc_enable_fns[])(unsigned long addr,
263 unsigned long handle,
264 void (*fn)(unsigned long,
265 unsigned long,
266 unsigned long),
267 unsigned int irq) = {
268 [MODE_ENABLE_REG] = intc_mode_field,
269 [MODE_MASK_REG] = intc_mode_zero,
270 [MODE_DUAL_REG] = intc_mode_field,
271 [MODE_PRIO_REG] = intc_mode_prio,
272 [MODE_PCLR_REG] = intc_mode_prio,
273};
274
275static void (*intc_disable_fns[])(unsigned long addr,
276 unsigned long handle,
277 void (*fn)(unsigned long,
278 unsigned long,
279 unsigned long),
280 unsigned int irq) = {
281 [MODE_ENABLE_REG] = intc_mode_zero,
282 [MODE_MASK_REG] = intc_mode_field,
283 [MODE_DUAL_REG] = intc_mode_field,
284 [MODE_PRIO_REG] = intc_mode_zero,
285 [MODE_PCLR_REG] = intc_mode_field,
286};
287
288#ifdef CONFIG_INTC_BALANCING
289static inline void intc_balancing_enable(unsigned int irq)
290{
291 struct intc_desc_int *d = get_intc_desc(irq);
292 unsigned long handle = dist_handle[irq];
293 unsigned long addr;
294
295 if (irq_balancing_disabled(irq) || !handle)
296 return;
297
298 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
299 intc_reg_fns[_INTC_FN(handle)](addr, handle, 1);
300}
301
302static inline void intc_balancing_disable(unsigned int irq)
303{
304 struct intc_desc_int *d = get_intc_desc(irq);
305 unsigned long handle = dist_handle[irq];
306 unsigned long addr;
307
308 if (irq_balancing_disabled(irq) || !handle)
309 return;
310
311 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
312 intc_reg_fns[_INTC_FN(handle)](addr, handle, 0);
313}
314
315static unsigned int intc_dist_data(struct intc_desc *desc,
316 struct intc_desc_int *d,
317 intc_enum enum_id)
318{
319 struct intc_mask_reg *mr = desc->hw.mask_regs;
320 unsigned int i, j, fn, mode;
321 unsigned long reg_e, reg_d;
322
323 for (i = 0; mr && enum_id && i < desc->hw.nr_mask_regs; i++) {
324 mr = desc->hw.mask_regs + i;
325
326 /*
327 * Skip this entry if there's no auto-distribution
328 * register associated with it.
329 */
330 if (!mr->dist_reg)
331 continue;
332
333 for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
334 if (mr->enum_ids[j] != enum_id)
335 continue;
336
337 fn = REG_FN_MODIFY_BASE;
338 mode = MODE_ENABLE_REG;
339 reg_e = mr->dist_reg;
340 reg_d = mr->dist_reg;
341
342 fn += (mr->reg_width >> 3) - 1;
343 return _INTC_MK(fn, mode,
344 intc_get_reg(d, reg_e),
345 intc_get_reg(d, reg_d),
346 1,
347 (mr->reg_width - 1) - j);
348 }
349 }
350
351 /*
352 * It's possible we've gotten here with no distribution options
353 * available for the IRQ in question, so we just skip over those.
354 */
355 return 0;
356}
357#else
358static inline void intc_balancing_enable(unsigned int irq)
359{
360}
361
362static inline void intc_balancing_disable(unsigned int irq)
363{
364}
365#endif
366
367static inline void _intc_enable(unsigned int irq, unsigned long handle)
368{
369 struct intc_desc_int *d = get_intc_desc(irq);
370 unsigned long addr;
371 unsigned int cpu;
372
373 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
374#ifdef CONFIG_SMP
375 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
376 continue;
377#endif
378 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
379 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
380 [_INTC_FN(handle)], irq);
381 }
382
383 intc_balancing_enable(irq);
384}
385
386static void intc_enable(unsigned int irq)
387{
388 _intc_enable(irq, (unsigned long)get_irq_chip_data(irq));
389}
390
391static void intc_disable(unsigned int irq)
392{
393 struct intc_desc_int *d = get_intc_desc(irq);
394 unsigned long handle = (unsigned long)get_irq_chip_data(irq);
395 unsigned long addr;
396 unsigned int cpu;
397
398 intc_balancing_disable(irq);
399
400 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
401#ifdef CONFIG_SMP
402 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
403 continue;
404#endif
405 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
406 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\
407 [_INTC_FN(handle)], irq);
408 }
409}
410
411static void (*intc_enable_noprio_fns[])(unsigned long addr,
412 unsigned long handle,
413 void (*fn)(unsigned long,
414 unsigned long,
415 unsigned long),
416 unsigned int irq) = {
417 [MODE_ENABLE_REG] = intc_mode_field,
418 [MODE_MASK_REG] = intc_mode_zero,
419 [MODE_DUAL_REG] = intc_mode_field,
420 [MODE_PRIO_REG] = intc_mode_field,
421 [MODE_PCLR_REG] = intc_mode_field,
422};
423
424static void intc_enable_disable(struct intc_desc_int *d,
425 unsigned long handle, int do_enable)
426{
427 unsigned long addr;
428 unsigned int cpu;
429 void (*fn)(unsigned long, unsigned long,
430 void (*)(unsigned long, unsigned long, unsigned long),
431 unsigned int);
432
433 if (do_enable) {
434 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
435 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
436 fn = intc_enable_noprio_fns[_INTC_MODE(handle)];
437 fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
438 }
439 } else {
440 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
441 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
442 fn = intc_disable_fns[_INTC_MODE(handle)];
443 fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
444 }
445 }
446}
447
448static int intc_set_wake(unsigned int irq, unsigned int on)
449{
450 return 0; /* allow wakeup, but setup hardware in intc_suspend() */
451}
452
453#ifdef CONFIG_SMP
454/*
455 * This is held with the irq desc lock held, so we don't require any
456 * additional locking here at the intc desc level. The affinity mask is
457 * later tested in the enable/disable paths.
458 */
459static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask)
460{
461 if (!cpumask_intersects(cpumask, cpu_online_mask))
462 return -1;
463
464 cpumask_copy(irq_to_desc(irq)->affinity, cpumask);
465
466 return 0;
467}
468#endif
469
470static void intc_mask_ack(unsigned int irq)
471{
472 struct intc_desc_int *d = get_intc_desc(irq);
473 unsigned long handle = ack_handle[irq];
474 unsigned long addr;
475
476 intc_disable(irq);
477
478 /* read register and write zero only to the associated bit */
479 if (handle) {
480 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
481 switch (_INTC_FN(handle)) {
482 case REG_FN_MODIFY_BASE + 0: /* 8bit */
483 __raw_readb(addr);
484 __raw_writeb(0xff ^ set_field(0, 1, handle), addr);
485 break;
486 case REG_FN_MODIFY_BASE + 1: /* 16bit */
487 __raw_readw(addr);
488 __raw_writew(0xffff ^ set_field(0, 1, handle), addr);
489 break;
490 case REG_FN_MODIFY_BASE + 3: /* 32bit */
491 __raw_readl(addr);
492 __raw_writel(0xffffffff ^ set_field(0, 1, handle), addr);
493 break;
494 default:
495 BUG();
496 break;
497 }
498 }
499}
500
501static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
502 unsigned int nr_hp,
503 unsigned int irq)
504{
505 int i;
506
507 /*
508 * this doesn't scale well, but...
509 *
510 * this function should only be used for cerain uncommon
511 * operations such as intc_set_priority() and intc_set_sense()
512 * and in those rare cases performance doesn't matter that much.
513 * keeping the memory footprint low is more important.
514 *
515 * one rather simple way to speed this up and still keep the
516 * memory footprint down is to make sure the array is sorted
517 * and then perform a bisect to lookup the irq.
518 */
519 for (i = 0; i < nr_hp; i++) {
520 if ((hp + i)->irq != irq)
521 continue;
522
523 return hp + i;
524 }
525
526 return NULL;
527}
528
529int intc_set_priority(unsigned int irq, unsigned int prio)
530{
531 struct intc_desc_int *d = get_intc_desc(irq);
532 struct intc_handle_int *ihp;
533
534 if (!intc_prio_level[irq] || prio <= 1)
535 return -EINVAL;
536
537 ihp = intc_find_irq(d->prio, d->nr_prio, irq);
538 if (ihp) {
539 if (prio >= (1 << _INTC_WIDTH(ihp->handle)))
540 return -EINVAL;
541
542 intc_prio_level[irq] = prio;
543
544 /*
545 * only set secondary masking method directly
546 * primary masking method is using intc_prio_level[irq]
547 * priority level will be set during next enable()
548 */
549 if (_INTC_FN(ihp->handle) != REG_FN_ERR)
550 _intc_enable(irq, ihp->handle);
551 }
552 return 0;
553}
554
555#define VALID(x) (x | 0x80)
556
557static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
558 [IRQ_TYPE_EDGE_FALLING] = VALID(0),
559 [IRQ_TYPE_EDGE_RISING] = VALID(1),
560 [IRQ_TYPE_LEVEL_LOW] = VALID(2),
561 /* SH7706, SH7707 and SH7709 do not support high level triggered */
562#if !defined(CONFIG_CPU_SUBTYPE_SH7706) && \
563 !defined(CONFIG_CPU_SUBTYPE_SH7707) && \
564 !defined(CONFIG_CPU_SUBTYPE_SH7709)
565 [IRQ_TYPE_LEVEL_HIGH] = VALID(3),
566#endif
567};
568
569static int intc_set_sense(unsigned int irq, unsigned int type)
570{
571 struct intc_desc_int *d = get_intc_desc(irq);
572 unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK];
573 struct intc_handle_int *ihp;
574 unsigned long addr;
575
576 if (!value)
577 return -EINVAL;
578
579 ihp = intc_find_irq(d->sense, d->nr_sense, irq);
580 if (ihp) {
581 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
582 intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
583 }
584 return 0;
585}
586
587static intc_enum __init intc_grp_id(struct intc_desc *desc,
588 intc_enum enum_id)
589{
590 struct intc_group *g = desc->hw.groups;
591 unsigned int i, j;
592
593 for (i = 0; g && enum_id && i < desc->hw.nr_groups; i++) {
594 g = desc->hw.groups + i;
595
596 for (j = 0; g->enum_ids[j]; j++) {
597 if (g->enum_ids[j] != enum_id)
598 continue;
599
600 return g->enum_id;
601 }
602 }
603
604 return 0;
605}
606
607static unsigned int __init _intc_mask_data(struct intc_desc *desc,
608 struct intc_desc_int *d,
609 intc_enum enum_id,
610 unsigned int *reg_idx,
611 unsigned int *fld_idx)
612{
613 struct intc_mask_reg *mr = desc->hw.mask_regs;
614 unsigned int fn, mode;
615 unsigned long reg_e, reg_d;
616
617 while (mr && enum_id && *reg_idx < desc->hw.nr_mask_regs) {
618 mr = desc->hw.mask_regs + *reg_idx;
619
620 for (; *fld_idx < ARRAY_SIZE(mr->enum_ids); (*fld_idx)++) {
621 if (mr->enum_ids[*fld_idx] != enum_id)
622 continue;
623
624 if (mr->set_reg && mr->clr_reg) {
625 fn = REG_FN_WRITE_BASE;
626 mode = MODE_DUAL_REG;
627 reg_e = mr->clr_reg;
628 reg_d = mr->set_reg;
629 } else {
630 fn = REG_FN_MODIFY_BASE;
631 if (mr->set_reg) {
632 mode = MODE_ENABLE_REG;
633 reg_e = mr->set_reg;
634 reg_d = mr->set_reg;
635 } else {
636 mode = MODE_MASK_REG;
637 reg_e = mr->clr_reg;
638 reg_d = mr->clr_reg;
639 }
640 }
641
642 fn += (mr->reg_width >> 3) - 1;
643 return _INTC_MK(fn, mode,
644 intc_get_reg(d, reg_e),
645 intc_get_reg(d, reg_d),
646 1,
647 (mr->reg_width - 1) - *fld_idx);
648 }
649
650 *fld_idx = 0;
651 (*reg_idx)++;
652 }
653
654 return 0;
655}
656
657static unsigned int __init intc_mask_data(struct intc_desc *desc,
658 struct intc_desc_int *d,
659 intc_enum enum_id, int do_grps)
660{
661 unsigned int i = 0;
662 unsigned int j = 0;
663 unsigned int ret;
664
665 ret = _intc_mask_data(desc, d, enum_id, &i, &j);
666 if (ret)
667 return ret;
668
669 if (do_grps)
670 return intc_mask_data(desc, d, intc_grp_id(desc, enum_id), 0);
671
672 return 0;
673}
674
675static unsigned int __init _intc_prio_data(struct intc_desc *desc,
676 struct intc_desc_int *d,
677 intc_enum enum_id,
678 unsigned int *reg_idx,
679 unsigned int *fld_idx)
680{
681 struct intc_prio_reg *pr = desc->hw.prio_regs;
682 unsigned int fn, n, mode, bit;
683 unsigned long reg_e, reg_d;
684
685 while (pr && enum_id && *reg_idx < desc->hw.nr_prio_regs) {
686 pr = desc->hw.prio_regs + *reg_idx;
687
688 for (; *fld_idx < ARRAY_SIZE(pr->enum_ids); (*fld_idx)++) {
689 if (pr->enum_ids[*fld_idx] != enum_id)
690 continue;
691
692 if (pr->set_reg && pr->clr_reg) {
693 fn = REG_FN_WRITE_BASE;
694 mode = MODE_PCLR_REG;
695 reg_e = pr->set_reg;
696 reg_d = pr->clr_reg;
697 } else {
698 fn = REG_FN_MODIFY_BASE;
699 mode = MODE_PRIO_REG;
700 if (!pr->set_reg)
701 BUG();
702 reg_e = pr->set_reg;
703 reg_d = pr->set_reg;
704 }
705
706 fn += (pr->reg_width >> 3) - 1;
707 n = *fld_idx + 1;
708
709 BUG_ON(n * pr->field_width > pr->reg_width);
710
711 bit = pr->reg_width - (n * pr->field_width);
712
713 return _INTC_MK(fn, mode,
714 intc_get_reg(d, reg_e),
715 intc_get_reg(d, reg_d),
716 pr->field_width, bit);
717 }
718
719 *fld_idx = 0;
720 (*reg_idx)++;
721 }
722
723 return 0;
724}
725
726static unsigned int __init intc_prio_data(struct intc_desc *desc,
727 struct intc_desc_int *d,
728 intc_enum enum_id, int do_grps)
729{
730 unsigned int i = 0;
731 unsigned int j = 0;
732 unsigned int ret;
733
734 ret = _intc_prio_data(desc, d, enum_id, &i, &j);
735 if (ret)
736 return ret;
737
738 if (do_grps)
739 return intc_prio_data(desc, d, intc_grp_id(desc, enum_id), 0);
740
741 return 0;
742}
743
744static void __init intc_enable_disable_enum(struct intc_desc *desc,
745 struct intc_desc_int *d,
746 intc_enum enum_id, int enable)
747{
748 unsigned int i, j, data;
749
750 /* go through and enable/disable all mask bits */
751 i = j = 0;
752 do {
753 data = _intc_mask_data(desc, d, enum_id, &i, &j);
754 if (data)
755 intc_enable_disable(d, data, enable);
756 j++;
757 } while (data);
758
759 /* go through and enable/disable all priority fields */
760 i = j = 0;
761 do {
762 data = _intc_prio_data(desc, d, enum_id, &i, &j);
763 if (data)
764 intc_enable_disable(d, data, enable);
765
766 j++;
767 } while (data);
768}
769
770static unsigned int __init intc_ack_data(struct intc_desc *desc,
771 struct intc_desc_int *d,
772 intc_enum enum_id)
773{
774 struct intc_mask_reg *mr = desc->hw.ack_regs;
775 unsigned int i, j, fn, mode;
776 unsigned long reg_e, reg_d;
777
778 for (i = 0; mr && enum_id && i < desc->hw.nr_ack_regs; i++) {
779 mr = desc->hw.ack_regs + i;
780
781 for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
782 if (mr->enum_ids[j] != enum_id)
783 continue;
784
785 fn = REG_FN_MODIFY_BASE;
786 mode = MODE_ENABLE_REG;
787 reg_e = mr->set_reg;
788 reg_d = mr->set_reg;
789
790 fn += (mr->reg_width >> 3) - 1;
791 return _INTC_MK(fn, mode,
792 intc_get_reg(d, reg_e),
793 intc_get_reg(d, reg_d),
794 1,
795 (mr->reg_width - 1) - j);
796 }
797 }
798
799 return 0;
800}
801
802static unsigned int __init intc_sense_data(struct intc_desc *desc,
803 struct intc_desc_int *d,
804 intc_enum enum_id)
805{
806 struct intc_sense_reg *sr = desc->hw.sense_regs;
807 unsigned int i, j, fn, bit;
808
809 for (i = 0; sr && enum_id && i < desc->hw.nr_sense_regs; i++) {
810 sr = desc->hw.sense_regs + i;
811
812 for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) {
813 if (sr->enum_ids[j] != enum_id)
814 continue;
815
816 fn = REG_FN_MODIFY_BASE;
817 fn += (sr->reg_width >> 3) - 1;
818
819 BUG_ON((j + 1) * sr->field_width > sr->reg_width);
820
821 bit = sr->reg_width - ((j + 1) * sr->field_width);
822
823 return _INTC_MK(fn, 0, intc_get_reg(d, sr->reg),
824 0, sr->field_width, bit);
825 }
826 }
827
828 return 0;
829}
830
831static void __init intc_register_irq(struct intc_desc *desc,
832 struct intc_desc_int *d,
833 intc_enum enum_id,
834 unsigned int irq)
835{
836 struct intc_handle_int *hp;
837 unsigned int data[2], primary;
838
839 /*
840 * Register the IRQ position with the global IRQ map
841 */
842 set_bit(irq, intc_irq_map);
843
844 /*
845 * Prefer single interrupt source bitmap over other combinations:
846 *
847 * 1. bitmap, single interrupt source
848 * 2. priority, single interrupt source
849 * 3. bitmap, multiple interrupt sources (groups)
850 * 4. priority, multiple interrupt sources (groups)
851 */
852 data[0] = intc_mask_data(desc, d, enum_id, 0);
853 data[1] = intc_prio_data(desc, d, enum_id, 0);
854
855 primary = 0;
856 if (!data[0] && data[1])
857 primary = 1;
858
859 if (!data[0] && !data[1])
860 pr_warning("missing unique irq mask for irq %d (vect 0x%04x)\n",
861 irq, irq2evt(irq));
862
863 data[0] = data[0] ? data[0] : intc_mask_data(desc, d, enum_id, 1);
864 data[1] = data[1] ? data[1] : intc_prio_data(desc, d, enum_id, 1);
865
866 if (!data[primary])
867 primary ^= 1;
868
869 BUG_ON(!data[primary]); /* must have primary masking method */
870
871 disable_irq_nosync(irq);
872 set_irq_chip_and_handler_name(irq, &d->chip,
873 handle_level_irq, "level");
874 set_irq_chip_data(irq, (void *)data[primary]);
875
876 /*
877 * set priority level
878 * - this needs to be at least 2 for 5-bit priorities on 7780
879 */
880 intc_prio_level[irq] = default_prio_level;
881
882 /* enable secondary masking method if present */
883 if (data[!primary])
884 _intc_enable(irq, data[!primary]);
885
886 /* add irq to d->prio list if priority is available */
887 if (data[1]) {
888 hp = d->prio + d->nr_prio;
889 hp->irq = irq;
890 hp->handle = data[1];
891
892 if (primary) {
893 /*
894 * only secondary priority should access registers, so
895 * set _INTC_FN(h) = REG_FN_ERR for intc_set_priority()
896 */
897 hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0);
898 hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0);
899 }
900 d->nr_prio++;
901 }
902
903 /* add irq to d->sense list if sense is available */
904 data[0] = intc_sense_data(desc, d, enum_id);
905 if (data[0]) {
906 (d->sense + d->nr_sense)->irq = irq;
907 (d->sense + d->nr_sense)->handle = data[0];
908 d->nr_sense++;
909 }
910
911 /* irq should be disabled by default */
912 d->chip.mask(irq);
913
914 if (desc->hw.ack_regs)
915 ack_handle[irq] = intc_ack_data(desc, d, enum_id);
916
917#ifdef CONFIG_INTC_BALANCING
918 if (desc->hw.mask_regs)
919 dist_handle[irq] = intc_dist_data(desc, d, enum_id);
920#endif
921
922#ifdef CONFIG_ARM
923 set_irq_flags(irq, IRQF_VALID); /* Enable IRQ on ARM systems */
924#endif
925}
926
927static unsigned int __init save_reg(struct intc_desc_int *d,
928 unsigned int cnt,
929 unsigned long value,
930 unsigned int smp)
931{
932 if (value) {
933 value = intc_phys_to_virt(d, value);
934
935 d->reg[cnt] = value;
936#ifdef CONFIG_SMP
937 d->smp[cnt] = smp;
938#endif
939 return 1;
940 }
941
942 return 0;
943}
944
945static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
946{
947 generic_handle_irq((unsigned int)get_irq_data(irq));
948}
949
950int __init register_intc_controller(struct intc_desc *desc)
951{
952 unsigned int i, k, smp;
953 struct intc_hw_desc *hw = &desc->hw;
954 struct intc_desc_int *d;
955 struct resource *res;
956
957 pr_info("Registered controller '%s' with %u IRQs\n",
958 desc->name, hw->nr_vectors);
959
960 d = kzalloc(sizeof(*d), GFP_NOWAIT);
961 if (!d)
962 goto err0;
963
964 INIT_LIST_HEAD(&d->list);
965 list_add(&d->list, &intc_list);
966
967 if (desc->num_resources) {
968 d->nr_windows = desc->num_resources;
969 d->window = kzalloc(d->nr_windows * sizeof(*d->window),
970 GFP_NOWAIT);
971 if (!d->window)
972 goto err1;
973
974 for (k = 0; k < d->nr_windows; k++) {
975 res = desc->resource + k;
976 WARN_ON(resource_type(res) != IORESOURCE_MEM);
977 d->window[k].phys = res->start;
978 d->window[k].size = resource_size(res);
979 d->window[k].virt = ioremap_nocache(res->start,
980 resource_size(res));
981 if (!d->window[k].virt)
982 goto err2;
983 }
984 }
985
986 d->nr_reg = hw->mask_regs ? hw->nr_mask_regs * 2 : 0;
987#ifdef CONFIG_INTC_BALANCING
988 if (d->nr_reg)
989 d->nr_reg += hw->nr_mask_regs;
990#endif
991 d->nr_reg += hw->prio_regs ? hw->nr_prio_regs * 2 : 0;
992 d->nr_reg += hw->sense_regs ? hw->nr_sense_regs : 0;
993 d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
994
995 d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT);
996 if (!d->reg)
997 goto err2;
998
999#ifdef CONFIG_SMP
1000 d->smp = kzalloc(d->nr_reg * sizeof(*d->smp), GFP_NOWAIT);
1001 if (!d->smp)
1002 goto err3;
1003#endif
1004 k = 0;
1005
1006 if (hw->mask_regs) {
1007 for (i = 0; i < hw->nr_mask_regs; i++) {
1008 smp = IS_SMP(hw->mask_regs[i]);
1009 k += save_reg(d, k, hw->mask_regs[i].set_reg, smp);
1010 k += save_reg(d, k, hw->mask_regs[i].clr_reg, smp);
1011#ifdef CONFIG_INTC_BALANCING
1012 k += save_reg(d, k, hw->mask_regs[i].dist_reg, 0);
1013#endif
1014 }
1015 }
1016
1017 if (hw->prio_regs) {
1018 d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
1019 GFP_NOWAIT);
1020 if (!d->prio)
1021 goto err4;
1022
1023 for (i = 0; i < hw->nr_prio_regs; i++) {
1024 smp = IS_SMP(hw->prio_regs[i]);
1025 k += save_reg(d, k, hw->prio_regs[i].set_reg, smp);
1026 k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp);
1027 }
1028 }
1029
1030 if (hw->sense_regs) {
1031 d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
1032 GFP_NOWAIT);
1033 if (!d->sense)
1034 goto err5;
1035
1036 for (i = 0; i < hw->nr_sense_regs; i++)
1037 k += save_reg(d, k, hw->sense_regs[i].reg, 0);
1038 }
1039
1040 d->chip.name = desc->name;
1041 d->chip.mask = intc_disable;
1042 d->chip.unmask = intc_enable;
1043 d->chip.mask_ack = intc_disable;
1044 d->chip.enable = intc_enable;
1045 d->chip.disable = intc_disable;
1046 d->chip.shutdown = intc_disable;
1047 d->chip.set_type = intc_set_sense;
1048 d->chip.set_wake = intc_set_wake;
1049#ifdef CONFIG_SMP
1050 d->chip.set_affinity = intc_set_affinity;
1051#endif
1052
1053 if (hw->ack_regs) {
1054 for (i = 0; i < hw->nr_ack_regs; i++)
1055 k += save_reg(d, k, hw->ack_regs[i].set_reg, 0);
1056
1057 d->chip.mask_ack = intc_mask_ack;
1058 }
1059
1060 /* disable bits matching force_disable before registering irqs */
1061 if (desc->force_disable)
1062 intc_enable_disable_enum(desc, d, desc->force_disable, 0);
1063
1064 /* disable bits matching force_enable before registering irqs */
1065 if (desc->force_enable)
1066 intc_enable_disable_enum(desc, d, desc->force_enable, 0);
1067
1068 BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */
1069
1070 /* register the vectors one by one */
1071 for (i = 0; i < hw->nr_vectors; i++) {
1072 struct intc_vect *vect = hw->vectors + i;
1073 unsigned int irq = evt2irq(vect->vect);
1074 struct irq_desc *irq_desc;
1075
1076 if (!vect->enum_id)
1077 continue;
1078
1079 irq_desc = irq_to_desc_alloc_node(irq, numa_node_id());
1080 if (unlikely(!irq_desc)) {
1081 pr_err("can't get irq_desc for %d\n", irq);
1082 continue;
1083 }
1084
1085 intc_register_irq(desc, d, vect->enum_id, irq);
1086
1087 for (k = i + 1; k < hw->nr_vectors; k++) {
1088 struct intc_vect *vect2 = hw->vectors + k;
1089 unsigned int irq2 = evt2irq(vect2->vect);
1090
1091 if (vect->enum_id != vect2->enum_id)
1092 continue;
1093
1094 /*
1095 * In the case of multi-evt handling and sparse
1096 * IRQ support, each vector still needs to have
1097 * its own backing irq_desc.
1098 */
1099 irq_desc = irq_to_desc_alloc_node(irq2, numa_node_id());
1100 if (unlikely(!irq_desc)) {
1101 pr_err("can't get irq_desc for %d\n", irq2);
1102 continue;
1103 }
1104
1105 vect2->enum_id = 0;
1106
1107 /* redirect this interrupts to the first one */
1108 set_irq_chip(irq2, &dummy_irq_chip);
1109 set_irq_chained_handler(irq2, intc_redirect_irq);
1110 set_irq_data(irq2, (void *)irq);
1111 }
1112 }
1113
1114 /* enable bits matching force_enable after registering irqs */
1115 if (desc->force_enable)
1116 intc_enable_disable_enum(desc, d, desc->force_enable, 1);
1117
1118 return 0;
1119err5:
1120 kfree(d->prio);
1121err4:
1122#ifdef CONFIG_SMP
1123 kfree(d->smp);
1124err3:
1125#endif
1126 kfree(d->reg);
1127err2:
1128 for (k = 0; k < d->nr_windows; k++)
1129 if (d->window[k].virt)
1130 iounmap(d->window[k].virt);
1131
1132 kfree(d->window);
1133err1:
1134 kfree(d);
1135err0:
1136 pr_err("unable to allocate INTC memory\n");
1137
1138 return -ENOMEM;
1139}
1140
1141#ifdef CONFIG_INTC_USERIMASK
1142static void __iomem *uimask;
1143
1144int register_intc_userimask(unsigned long addr)
1145{
1146 if (unlikely(uimask))
1147 return -EBUSY;
1148
1149 uimask = ioremap_nocache(addr, SZ_4K);
1150 if (unlikely(!uimask))
1151 return -ENOMEM;
1152
1153 pr_info("userimask support registered for levels 0 -> %d\n",
1154 default_prio_level - 1);
1155
1156 return 0;
1157}
1158
1159static ssize_t
1160show_intc_userimask(struct sysdev_class *cls,
1161 struct sysdev_class_attribute *attr, char *buf)
1162{
1163 return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
1164}
1165
1166static ssize_t
1167store_intc_userimask(struct sysdev_class *cls,
1168 struct sysdev_class_attribute *attr,
1169 const char *buf, size_t count)
1170{
1171 unsigned long level;
1172
1173 level = simple_strtoul(buf, NULL, 10);
1174
1175 /*
1176 * Minimal acceptable IRQ levels are in the 2 - 16 range, but
1177 * these are chomped so as to not interfere with normal IRQs.
1178 *
1179 * Level 1 is a special case on some CPUs in that it's not
1180 * directly settable, but given that USERIMASK cuts off below a
1181 * certain level, we don't care about this limitation here.
1182 * Level 0 on the other hand equates to user masking disabled.
1183 *
1184 * We use default_prio_level as a cut off so that only special
1185 * case opt-in IRQs can be mangled.
1186 */
1187 if (level >= default_prio_level)
1188 return -EINVAL;
1189
1190 __raw_writel(0xa5 << 24 | level << 4, uimask);
1191
1192 return count;
1193}
1194
1195static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
1196 show_intc_userimask, store_intc_userimask);
1197#endif
1198
1199static ssize_t
1200show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
1201{
1202 struct intc_desc_int *d;
1203
1204 d = container_of(dev, struct intc_desc_int, sysdev);
1205
1206 return sprintf(buf, "%s\n", d->chip.name);
1207}
1208
1209static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
1210
1211static int intc_suspend(struct sys_device *dev, pm_message_t state)
1212{
1213 struct intc_desc_int *d;
1214 struct irq_desc *desc;
1215 int irq;
1216
1217 /* get intc controller associated with this sysdev */
1218 d = container_of(dev, struct intc_desc_int, sysdev);
1219
1220 switch (state.event) {
1221 case PM_EVENT_ON:
1222 if (d->state.event != PM_EVENT_FREEZE)
1223 break;
1224 for_each_irq_desc(irq, desc) {
1225 if (desc->handle_irq == intc_redirect_irq)
1226 continue;
1227 if (desc->chip != &d->chip)
1228 continue;
1229 if (desc->status & IRQ_DISABLED)
1230 intc_disable(irq);
1231 else
1232 intc_enable(irq);
1233 }
1234 break;
1235 case PM_EVENT_FREEZE:
1236 /* nothing has to be done */
1237 break;
1238 case PM_EVENT_SUSPEND:
1239 /* enable wakeup irqs belonging to this intc controller */
1240 for_each_irq_desc(irq, desc) {
1241 if ((desc->status & IRQ_WAKEUP) && (desc->chip == &d->chip))
1242 intc_enable(irq);
1243 }
1244 break;
1245 }
1246 d->state = state;
1247
1248 return 0;
1249}
1250
1251static int intc_resume(struct sys_device *dev)
1252{
1253 return intc_suspend(dev, PMSG_ON);
1254}
1255
1256static struct sysdev_class intc_sysdev_class = {
1257 .name = "intc",
1258 .suspend = intc_suspend,
1259 .resume = intc_resume,
1260};
1261
1262/* register this intc as sysdev to allow suspend/resume */
1263static int __init register_intc_sysdevs(void)
1264{
1265 struct intc_desc_int *d;
1266 int error;
1267 int id = 0;
1268
1269 error = sysdev_class_register(&intc_sysdev_class);
1270#ifdef CONFIG_INTC_USERIMASK
1271 if (!error && uimask)
1272 error = sysdev_class_create_file(&intc_sysdev_class,
1273 &attr_userimask);
1274#endif
1275 if (!error) {
1276 list_for_each_entry(d, &intc_list, list) {
1277 d->sysdev.id = id;
1278 d->sysdev.cls = &intc_sysdev_class;
1279 error = sysdev_register(&d->sysdev);
1280 if (error == 0)
1281 error = sysdev_create_file(&d->sysdev,
1282 &attr_name);
1283 if (error)
1284 break;
1285
1286 id++;
1287 }
1288 }
1289
1290 if (error)
1291 pr_err("sysdev registration error\n");
1292
1293 return error;
1294}
1295device_initcall(register_intc_sysdevs);
1296
1297/*
1298 * Dynamic IRQ allocation and deallocation
1299 */
1300unsigned int create_irq_nr(unsigned int irq_want, int node)
1301{
1302 unsigned int irq = 0, new;
1303 unsigned long flags;
1304 struct irq_desc *desc;
1305
1306 spin_lock_irqsave(&vector_lock, flags);
1307
1308 /*
1309 * First try the wanted IRQ
1310 */
1311 if (test_and_set_bit(irq_want, intc_irq_map) == 0) {
1312 new = irq_want;
1313 } else {
1314 /* .. then fall back to scanning. */
1315 new = find_first_zero_bit(intc_irq_map, nr_irqs);
1316 if (unlikely(new == nr_irqs))
1317 goto out_unlock;
1318
1319 __set_bit(new, intc_irq_map);
1320 }
1321
1322 desc = irq_to_desc_alloc_node(new, node);
1323 if (unlikely(!desc)) {
1324 pr_err("can't get irq_desc for %d\n", new);
1325 goto out_unlock;
1326 }
1327
1328 desc = move_irq_desc(desc, node);
1329 irq = new;
1330
1331out_unlock:
1332 spin_unlock_irqrestore(&vector_lock, flags);
1333
1334 if (irq > 0) {
1335 dynamic_irq_init(irq);
1336#ifdef CONFIG_ARM
1337 set_irq_flags(irq, IRQF_VALID); /* Enable IRQ on ARM systems */
1338#endif
1339 }
1340
1341 return irq;
1342}
1343
1344int create_irq(void)
1345{
1346 int nid = cpu_to_node(smp_processor_id());
1347 int irq;
1348
1349 irq = create_irq_nr(NR_IRQS_LEGACY, nid);
1350 if (irq == 0)
1351 irq = -1;
1352
1353 return irq;
1354}
1355
1356void destroy_irq(unsigned int irq)
1357{
1358 unsigned long flags;
1359
1360 dynamic_irq_cleanup(irq);
1361
1362 spin_lock_irqsave(&vector_lock, flags);
1363 __clear_bit(irq, intc_irq_map);
1364 spin_unlock_irqrestore(&vector_lock, flags);
1365}
1366
1367int reserve_irq_vector(unsigned int irq)
1368{
1369 unsigned long flags;
1370 int ret = 0;
1371
1372 spin_lock_irqsave(&vector_lock, flags);
1373 if (test_and_set_bit(irq, intc_irq_map))
1374 ret = -EBUSY;
1375 spin_unlock_irqrestore(&vector_lock, flags);
1376
1377 return ret;
1378}
1379
1380void reserve_irq_legacy(void)
1381{
1382 unsigned long flags;
1383 int i, j;
1384
1385 spin_lock_irqsave(&vector_lock, flags);
1386 j = find_first_bit(intc_irq_map, nr_irqs);
1387 for (i = 0; i < j; i++)
1388 __set_bit(i, intc_irq_map);
1389 spin_unlock_irqrestore(&vector_lock, flags);
1390}
diff --git a/drivers/sh/intc/Kconfig b/drivers/sh/intc/Kconfig
new file mode 100644
index 000000000000..c88cbccc62b0
--- /dev/null
+++ b/drivers/sh/intc/Kconfig
@@ -0,0 +1,35 @@
1comment "Interrupt controller options"
2
3config INTC_USERIMASK
4 bool "Userspace interrupt masking support"
5 depends on ARCH_SHMOBILE || (SUPERH && CPU_SH4A)
6 help
7 This enables support for hardware-assisted userspace hardirq
8 masking.
9
10 SH-4A and newer interrupt blocks all support a special shadowed
11 page with all non-masking registers obscured when mapped in to
12 userspace. This is primarily for use by userspace device
13 drivers that are using special priority levels.
14
15 If in doubt, say N.
16
17config INTC_BALANCING
18 bool "Hardware IRQ balancing support"
19 depends on SMP && SUPERH && CPU_SHX3
20 help
21 This enables support for IRQ auto-distribution mode on SH-X3
22 SMP parts. All of the balancing and CPU wakeup decisions are
23 taken care of automatically by hardware for distributed
24 vectors.
25
26 If in doubt, say N.
27
28config INTC_MAPPING_DEBUG
29 bool "Expose IRQ to per-controller id mapping via debugfs"
30 depends on DEBUG_FS
31 help
32 This will create a debugfs entry for showing the relationship
33 between system IRQs and the per-controller id tables.
34
35 If in doubt, say N.
diff --git a/drivers/sh/intc/Makefile b/drivers/sh/intc/Makefile
new file mode 100644
index 000000000000..bb5df868d77a
--- /dev/null
+++ b/drivers/sh/intc/Makefile
@@ -0,0 +1,5 @@
1obj-y := access.o chip.o core.o dynamic.o handle.o virq.o
2
3obj-$(CONFIG_INTC_BALANCING) += balancing.o
4obj-$(CONFIG_INTC_USERIMASK) += userimask.o
5obj-$(CONFIG_INTC_MAPPING_DEBUG) += virq-debugfs.o
diff --git a/drivers/sh/intc/access.c b/drivers/sh/intc/access.c
new file mode 100644
index 000000000000..f892ae1d212a
--- /dev/null
+++ b/drivers/sh/intc/access.c
@@ -0,0 +1,237 @@
1/*
2 * Common INTC2 register accessors
3 *
4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/io.h>
12#include "internals.h"
13
14unsigned long intc_phys_to_virt(struct intc_desc_int *d, unsigned long address)
15{
16 struct intc_window *window;
17 int k;
18
19 /* scan through physical windows and convert address */
20 for (k = 0; k < d->nr_windows; k++) {
21 window = d->window + k;
22
23 if (address < window->phys)
24 continue;
25
26 if (address >= (window->phys + window->size))
27 continue;
28
29 address -= window->phys;
30 address += (unsigned long)window->virt;
31
32 return address;
33 }
34
35 /* no windows defined, register must be 1:1 mapped virt:phys */
36 return address;
37}
38
39unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address)
40{
41 unsigned int k;
42
43 address = intc_phys_to_virt(d, address);
44
45 for (k = 0; k < d->nr_reg; k++) {
46 if (d->reg[k] == address)
47 return k;
48 }
49
50 BUG();
51 return 0;
52}
53
54unsigned int intc_set_field_from_handle(unsigned int value,
55 unsigned int field_value,
56 unsigned int handle)
57{
58 unsigned int width = _INTC_WIDTH(handle);
59 unsigned int shift = _INTC_SHIFT(handle);
60
61 value &= ~(((1 << width) - 1) << shift);
62 value |= field_value << shift;
63 return value;
64}
65
66unsigned long intc_get_field_from_handle(unsigned int value, unsigned int handle)
67{
68 unsigned int width = _INTC_WIDTH(handle);
69 unsigned int shift = _INTC_SHIFT(handle);
70 unsigned int mask = ((1 << width) - 1) << shift;
71
72 return (value & mask) >> shift;
73}
74
75static unsigned long test_8(unsigned long addr, unsigned long h,
76 unsigned long ignore)
77{
78 return intc_get_field_from_handle(__raw_readb(addr), h);
79}
80
81static unsigned long test_16(unsigned long addr, unsigned long h,
82 unsigned long ignore)
83{
84 return intc_get_field_from_handle(__raw_readw(addr), h);
85}
86
87static unsigned long test_32(unsigned long addr, unsigned long h,
88 unsigned long ignore)
89{
90 return intc_get_field_from_handle(__raw_readl(addr), h);
91}
92
93static unsigned long write_8(unsigned long addr, unsigned long h,
94 unsigned long data)
95{
96 __raw_writeb(intc_set_field_from_handle(0, data, h), addr);
97 (void)__raw_readb(addr); /* Defeat write posting */
98 return 0;
99}
100
101static unsigned long write_16(unsigned long addr, unsigned long h,
102 unsigned long data)
103{
104 __raw_writew(intc_set_field_from_handle(0, data, h), addr);
105 (void)__raw_readw(addr); /* Defeat write posting */
106 return 0;
107}
108
109static unsigned long write_32(unsigned long addr, unsigned long h,
110 unsigned long data)
111{
112 __raw_writel(intc_set_field_from_handle(0, data, h), addr);
113 (void)__raw_readl(addr); /* Defeat write posting */
114 return 0;
115}
116
117static unsigned long modify_8(unsigned long addr, unsigned long h,
118 unsigned long data)
119{
120 unsigned long flags;
121 unsigned int value;
122 local_irq_save(flags);
123 value = intc_set_field_from_handle(__raw_readb(addr), data, h);
124 __raw_writeb(value, addr);
125 (void)__raw_readb(addr); /* Defeat write posting */
126 local_irq_restore(flags);
127 return 0;
128}
129
130static unsigned long modify_16(unsigned long addr, unsigned long h,
131 unsigned long data)
132{
133 unsigned long flags;
134 unsigned int value;
135 local_irq_save(flags);
136 value = intc_set_field_from_handle(__raw_readw(addr), data, h);
137 __raw_writew(value, addr);
138 (void)__raw_readw(addr); /* Defeat write posting */
139 local_irq_restore(flags);
140 return 0;
141}
142
143static unsigned long modify_32(unsigned long addr, unsigned long h,
144 unsigned long data)
145{
146 unsigned long flags;
147 unsigned int value;
148 local_irq_save(flags);
149 value = intc_set_field_from_handle(__raw_readl(addr), data, h);
150 __raw_writel(value, addr);
151 (void)__raw_readl(addr); /* Defeat write posting */
152 local_irq_restore(flags);
153 return 0;
154}
155
156static unsigned long intc_mode_field(unsigned long addr,
157 unsigned long handle,
158 unsigned long (*fn)(unsigned long,
159 unsigned long,
160 unsigned long),
161 unsigned int irq)
162{
163 return fn(addr, handle, ((1 << _INTC_WIDTH(handle)) - 1));
164}
165
166static unsigned long intc_mode_zero(unsigned long addr,
167 unsigned long handle,
168 unsigned long (*fn)(unsigned long,
169 unsigned long,
170 unsigned long),
171 unsigned int irq)
172{
173 return fn(addr, handle, 0);
174}
175
176static unsigned long intc_mode_prio(unsigned long addr,
177 unsigned long handle,
178 unsigned long (*fn)(unsigned long,
179 unsigned long,
180 unsigned long),
181 unsigned int irq)
182{
183 return fn(addr, handle, intc_get_prio_level(irq));
184}
185
186unsigned long (*intc_reg_fns[])(unsigned long addr,
187 unsigned long h,
188 unsigned long data) = {
189 [REG_FN_TEST_BASE + 0] = test_8,
190 [REG_FN_TEST_BASE + 1] = test_16,
191 [REG_FN_TEST_BASE + 3] = test_32,
192 [REG_FN_WRITE_BASE + 0] = write_8,
193 [REG_FN_WRITE_BASE + 1] = write_16,
194 [REG_FN_WRITE_BASE + 3] = write_32,
195 [REG_FN_MODIFY_BASE + 0] = modify_8,
196 [REG_FN_MODIFY_BASE + 1] = modify_16,
197 [REG_FN_MODIFY_BASE + 3] = modify_32,
198};
199
200unsigned long (*intc_enable_fns[])(unsigned long addr,
201 unsigned long handle,
202 unsigned long (*fn)(unsigned long,
203 unsigned long,
204 unsigned long),
205 unsigned int irq) = {
206 [MODE_ENABLE_REG] = intc_mode_field,
207 [MODE_MASK_REG] = intc_mode_zero,
208 [MODE_DUAL_REG] = intc_mode_field,
209 [MODE_PRIO_REG] = intc_mode_prio,
210 [MODE_PCLR_REG] = intc_mode_prio,
211};
212
213unsigned long (*intc_disable_fns[])(unsigned long addr,
214 unsigned long handle,
215 unsigned long (*fn)(unsigned long,
216 unsigned long,
217 unsigned long),
218 unsigned int irq) = {
219 [MODE_ENABLE_REG] = intc_mode_zero,
220 [MODE_MASK_REG] = intc_mode_field,
221 [MODE_DUAL_REG] = intc_mode_field,
222 [MODE_PRIO_REG] = intc_mode_zero,
223 [MODE_PCLR_REG] = intc_mode_field,
224};
225
226unsigned long (*intc_enable_noprio_fns[])(unsigned long addr,
227 unsigned long handle,
228 unsigned long (*fn)(unsigned long,
229 unsigned long,
230 unsigned long),
231 unsigned int irq) = {
232 [MODE_ENABLE_REG] = intc_mode_field,
233 [MODE_MASK_REG] = intc_mode_zero,
234 [MODE_DUAL_REG] = intc_mode_field,
235 [MODE_PRIO_REG] = intc_mode_field,
236 [MODE_PCLR_REG] = intc_mode_field,
237};
diff --git a/drivers/sh/intc/balancing.c b/drivers/sh/intc/balancing.c
new file mode 100644
index 000000000000..cec7a96f2c09
--- /dev/null
+++ b/drivers/sh/intc/balancing.c
@@ -0,0 +1,97 @@
1/*
2 * Support for hardware-managed IRQ auto-distribution.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include "internals.h"
11
12static unsigned long dist_handle[NR_IRQS];
13
14void intc_balancing_enable(unsigned int irq)
15{
16 struct intc_desc_int *d = get_intc_desc(irq);
17 unsigned long handle = dist_handle[irq];
18 unsigned long addr;
19
20 if (irq_balancing_disabled(irq) || !handle)
21 return;
22
23 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
24 intc_reg_fns[_INTC_FN(handle)](addr, handle, 1);
25}
26
27void intc_balancing_disable(unsigned int irq)
28{
29 struct intc_desc_int *d = get_intc_desc(irq);
30 unsigned long handle = dist_handle[irq];
31 unsigned long addr;
32
33 if (irq_balancing_disabled(irq) || !handle)
34 return;
35
36 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
37 intc_reg_fns[_INTC_FN(handle)](addr, handle, 0);
38}
39
40static unsigned int intc_dist_data(struct intc_desc *desc,
41 struct intc_desc_int *d,
42 intc_enum enum_id)
43{
44 struct intc_mask_reg *mr = desc->hw.mask_regs;
45 unsigned int i, j, fn, mode;
46 unsigned long reg_e, reg_d;
47
48 for (i = 0; mr && enum_id && i < desc->hw.nr_mask_regs; i++) {
49 mr = desc->hw.mask_regs + i;
50
51 /*
52 * Skip this entry if there's no auto-distribution
53 * register associated with it.
54 */
55 if (!mr->dist_reg)
56 continue;
57
58 for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
59 if (mr->enum_ids[j] != enum_id)
60 continue;
61
62 fn = REG_FN_MODIFY_BASE;
63 mode = MODE_ENABLE_REG;
64 reg_e = mr->dist_reg;
65 reg_d = mr->dist_reg;
66
67 fn += (mr->reg_width >> 3) - 1;
68 return _INTC_MK(fn, mode,
69 intc_get_reg(d, reg_e),
70 intc_get_reg(d, reg_d),
71 1,
72 (mr->reg_width - 1) - j);
73 }
74 }
75
76 /*
77 * It's possible we've gotten here with no distribution options
78 * available for the IRQ in question, so we just skip over those.
79 */
80 return 0;
81}
82
83void intc_set_dist_handle(unsigned int irq, struct intc_desc *desc,
84 struct intc_desc_int *d, intc_enum id)
85{
86 unsigned long flags;
87
88 /*
89 * Nothing to do for this IRQ.
90 */
91 if (!desc->hw.mask_regs)
92 return;
93
94 raw_spin_lock_irqsave(&intc_big_lock, flags);
95 dist_handle[irq] = intc_dist_data(desc, d, id);
96 raw_spin_unlock_irqrestore(&intc_big_lock, flags);
97}
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
new file mode 100644
index 000000000000..35c03706cc21
--- /dev/null
+++ b/drivers/sh/intc/chip.c
@@ -0,0 +1,215 @@
1/*
2 * IRQ chip definitions for INTC IRQs.
3 *
4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/cpumask.h>
12#include <linux/io.h>
13#include "internals.h"
14
15void _intc_enable(unsigned int irq, unsigned long handle)
16{
17 struct intc_desc_int *d = get_intc_desc(irq);
18 unsigned long addr;
19 unsigned int cpu;
20
21 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
22#ifdef CONFIG_SMP
23 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
24 continue;
25#endif
26 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
27 intc_enable_fns[_INTC_MODE(handle)](addr, handle, intc_reg_fns\
28 [_INTC_FN(handle)], irq);
29 }
30
31 intc_balancing_enable(irq);
32}
33
34static void intc_enable(unsigned int irq)
35{
36 _intc_enable(irq, (unsigned long)get_irq_chip_data(irq));
37}
38
39static void intc_disable(unsigned int irq)
40{
41 struct intc_desc_int *d = get_intc_desc(irq);
42 unsigned long handle = (unsigned long)get_irq_chip_data(irq);
43 unsigned long addr;
44 unsigned int cpu;
45
46 intc_balancing_disable(irq);
47
48 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
49#ifdef CONFIG_SMP
50 if (!cpumask_test_cpu(cpu, irq_to_desc(irq)->affinity))
51 continue;
52#endif
53 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
54 intc_disable_fns[_INTC_MODE(handle)](addr, handle,intc_reg_fns\
55 [_INTC_FN(handle)], irq);
56 }
57}
58
59static int intc_set_wake(unsigned int irq, unsigned int on)
60{
61 return 0; /* allow wakeup, but setup hardware in intc_suspend() */
62}
63
64#ifdef CONFIG_SMP
65/*
66 * This is held with the irq desc lock held, so we don't require any
67 * additional locking here at the intc desc level. The affinity mask is
68 * later tested in the enable/disable paths.
69 */
70static int intc_set_affinity(unsigned int irq, const struct cpumask *cpumask)
71{
72 if (!cpumask_intersects(cpumask, cpu_online_mask))
73 return -1;
74
75 cpumask_copy(irq_to_desc(irq)->affinity, cpumask);
76
77 return 0;
78}
79#endif
80
81static void intc_mask_ack(unsigned int irq)
82{
83 struct intc_desc_int *d = get_intc_desc(irq);
84 unsigned long handle = intc_get_ack_handle(irq);
85 unsigned long addr;
86
87 intc_disable(irq);
88
89 /* read register and write zero only to the associated bit */
90 if (handle) {
91 unsigned int value;
92
93 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
94 value = intc_set_field_from_handle(0, 1, handle);
95
96 switch (_INTC_FN(handle)) {
97 case REG_FN_MODIFY_BASE + 0: /* 8bit */
98 __raw_readb(addr);
99 __raw_writeb(0xff ^ value, addr);
100 break;
101 case REG_FN_MODIFY_BASE + 1: /* 16bit */
102 __raw_readw(addr);
103 __raw_writew(0xffff ^ value, addr);
104 break;
105 case REG_FN_MODIFY_BASE + 3: /* 32bit */
106 __raw_readl(addr);
107 __raw_writel(0xffffffff ^ value, addr);
108 break;
109 default:
110 BUG();
111 break;
112 }
113 }
114}
115
116static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
117 unsigned int nr_hp,
118 unsigned int irq)
119{
120 int i;
121
122 /*
123 * this doesn't scale well, but...
124 *
125 * this function should only be used for cerain uncommon
126 * operations such as intc_set_priority() and intc_set_type()
127 * and in those rare cases performance doesn't matter that much.
128 * keeping the memory footprint low is more important.
129 *
130 * one rather simple way to speed this up and still keep the
131 * memory footprint down is to make sure the array is sorted
132 * and then perform a bisect to lookup the irq.
133 */
134 for (i = 0; i < nr_hp; i++) {
135 if ((hp + i)->irq != irq)
136 continue;
137
138 return hp + i;
139 }
140
141 return NULL;
142}
143
144int intc_set_priority(unsigned int irq, unsigned int prio)
145{
146 struct intc_desc_int *d = get_intc_desc(irq);
147 struct intc_handle_int *ihp;
148
149 if (!intc_get_prio_level(irq) || prio <= 1)
150 return -EINVAL;
151
152 ihp = intc_find_irq(d->prio, d->nr_prio, irq);
153 if (ihp) {
154 if (prio >= (1 << _INTC_WIDTH(ihp->handle)))
155 return -EINVAL;
156
157 intc_set_prio_level(irq, prio);
158
159 /*
160 * only set secondary masking method directly
161 * primary masking method is using intc_prio_level[irq]
162 * priority level will be set during next enable()
163 */
164 if (_INTC_FN(ihp->handle) != REG_FN_ERR)
165 _intc_enable(irq, ihp->handle);
166 }
167 return 0;
168}
169
170#define VALID(x) (x | 0x80)
171
172static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
173 [IRQ_TYPE_EDGE_FALLING] = VALID(0),
174 [IRQ_TYPE_EDGE_RISING] = VALID(1),
175 [IRQ_TYPE_LEVEL_LOW] = VALID(2),
176 /* SH7706, SH7707 and SH7709 do not support high level triggered */
177#if !defined(CONFIG_CPU_SUBTYPE_SH7706) && \
178 !defined(CONFIG_CPU_SUBTYPE_SH7707) && \
179 !defined(CONFIG_CPU_SUBTYPE_SH7709)
180 [IRQ_TYPE_LEVEL_HIGH] = VALID(3),
181#endif
182};
183
184static int intc_set_type(unsigned int irq, unsigned int type)
185{
186 struct intc_desc_int *d = get_intc_desc(irq);
187 unsigned char value = intc_irq_sense_table[type & IRQ_TYPE_SENSE_MASK];
188 struct intc_handle_int *ihp;
189 unsigned long addr;
190
191 if (!value)
192 return -EINVAL;
193
194 ihp = intc_find_irq(d->sense, d->nr_sense, irq);
195 if (ihp) {
196 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
197 intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
198 }
199
200 return 0;
201}
202
203struct irq_chip intc_irq_chip = {
204 .mask = intc_disable,
205 .unmask = intc_enable,
206 .mask_ack = intc_mask_ack,
207 .enable = intc_enable,
208 .disable = intc_disable,
209 .shutdown = intc_disable,
210 .set_type = intc_set_type,
211 .set_wake = intc_set_wake,
212#ifdef CONFIG_SMP
213 .set_affinity = intc_set_affinity,
214#endif
215};
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
new file mode 100644
index 000000000000..306ed287077a
--- /dev/null
+++ b/drivers/sh/intc/core.c
@@ -0,0 +1,469 @@
1/*
2 * Shared interrupt handling code for IPR and INTC2 types of IRQs.
3 *
4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt
6 *
7 * Based on intc2.c and ipr.c
8 *
9 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
10 * Copyright (C) 2000 Kazumoto Kojima
11 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
12 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
13 * Copyright (C) 2005, 2006 Paul Mundt
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#define pr_fmt(fmt) "intc: " fmt
20
21#include <linux/init.h>
22#include <linux/irq.h>
23#include <linux/io.h>
24#include <linux/slab.h>
25#include <linux/interrupt.h>
26#include <linux/sh_intc.h>
27#include <linux/sysdev.h>
28#include <linux/list.h>
29#include <linux/spinlock.h>
30#include <linux/radix-tree.h>
31#include "internals.h"
32
33LIST_HEAD(intc_list);
34DEFINE_RAW_SPINLOCK(intc_big_lock);
35unsigned int nr_intc_controllers;
36
37/*
38 * Default priority level
39 * - this needs to be at least 2 for 5-bit priorities on 7780
40 */
41static unsigned int default_prio_level = 2; /* 2 - 16 */
42static unsigned int intc_prio_level[NR_IRQS]; /* for now */
43
44unsigned int intc_get_dfl_prio_level(void)
45{
46 return default_prio_level;
47}
48
49unsigned int intc_get_prio_level(unsigned int irq)
50{
51 return intc_prio_level[irq];
52}
53
54void intc_set_prio_level(unsigned int irq, unsigned int level)
55{
56 unsigned long flags;
57
58 raw_spin_lock_irqsave(&intc_big_lock, flags);
59 intc_prio_level[irq] = level;
60 raw_spin_unlock_irqrestore(&intc_big_lock, flags);
61}
62
63static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
64{
65 generic_handle_irq((unsigned int)get_irq_data(irq));
66}
67
68static void __init intc_register_irq(struct intc_desc *desc,
69 struct intc_desc_int *d,
70 intc_enum enum_id,
71 unsigned int irq)
72{
73 struct intc_handle_int *hp;
74 unsigned int data[2], primary;
75 unsigned long flags;
76
77 /*
78 * Register the IRQ position with the global IRQ map, then insert
79 * it in to the radix tree.
80 */
81 reserve_irq_vector(irq);
82
83 raw_spin_lock_irqsave(&intc_big_lock, flags);
84 radix_tree_insert(&d->tree, enum_id, intc_irq_xlate_get(irq));
85 raw_spin_unlock_irqrestore(&intc_big_lock, flags);
86
87 /*
88 * Prefer single interrupt source bitmap over other combinations:
89 *
90 * 1. bitmap, single interrupt source
91 * 2. priority, single interrupt source
92 * 3. bitmap, multiple interrupt sources (groups)
93 * 4. priority, multiple interrupt sources (groups)
94 */
95 data[0] = intc_get_mask_handle(desc, d, enum_id, 0);
96 data[1] = intc_get_prio_handle(desc, d, enum_id, 0);
97
98 primary = 0;
99 if (!data[0] && data[1])
100 primary = 1;
101
102 if (!data[0] && !data[1])
103 pr_warning("missing unique irq mask for irq %d (vect 0x%04x)\n",
104 irq, irq2evt(irq));
105
106 data[0] = data[0] ? data[0] : intc_get_mask_handle(desc, d, enum_id, 1);
107 data[1] = data[1] ? data[1] : intc_get_prio_handle(desc, d, enum_id, 1);
108
109 if (!data[primary])
110 primary ^= 1;
111
112 BUG_ON(!data[primary]); /* must have primary masking method */
113
114 disable_irq_nosync(irq);
115 set_irq_chip_and_handler_name(irq, &d->chip,
116 handle_level_irq, "level");
117 set_irq_chip_data(irq, (void *)data[primary]);
118
119 /*
120 * set priority level
121 */
122 intc_set_prio_level(irq, intc_get_dfl_prio_level());
123
124 /* enable secondary masking method if present */
125 if (data[!primary])
126 _intc_enable(irq, data[!primary]);
127
128 /* add irq to d->prio list if priority is available */
129 if (data[1]) {
130 hp = d->prio + d->nr_prio;
131 hp->irq = irq;
132 hp->handle = data[1];
133
134 if (primary) {
135 /*
136 * only secondary priority should access registers, so
137 * set _INTC_FN(h) = REG_FN_ERR for intc_set_priority()
138 */
139 hp->handle &= ~_INTC_MK(0x0f, 0, 0, 0, 0, 0);
140 hp->handle |= _INTC_MK(REG_FN_ERR, 0, 0, 0, 0, 0);
141 }
142 d->nr_prio++;
143 }
144
145 /* add irq to d->sense list if sense is available */
146 data[0] = intc_get_sense_handle(desc, d, enum_id);
147 if (data[0]) {
148 (d->sense + d->nr_sense)->irq = irq;
149 (d->sense + d->nr_sense)->handle = data[0];
150 d->nr_sense++;
151 }
152
153 /* irq should be disabled by default */
154 d->chip.mask(irq);
155
156 intc_set_ack_handle(irq, desc, d, enum_id);
157 intc_set_dist_handle(irq, desc, d, enum_id);
158
159 activate_irq(irq);
160}
161
162static unsigned int __init save_reg(struct intc_desc_int *d,
163 unsigned int cnt,
164 unsigned long value,
165 unsigned int smp)
166{
167 if (value) {
168 value = intc_phys_to_virt(d, value);
169
170 d->reg[cnt] = value;
171#ifdef CONFIG_SMP
172 d->smp[cnt] = smp;
173#endif
174 return 1;
175 }
176
177 return 0;
178}
179
180int __init register_intc_controller(struct intc_desc *desc)
181{
182 unsigned int i, k, smp;
183 struct intc_hw_desc *hw = &desc->hw;
184 struct intc_desc_int *d;
185 struct resource *res;
186
187 pr_info("Registered controller '%s' with %u IRQs\n",
188 desc->name, hw->nr_vectors);
189
190 d = kzalloc(sizeof(*d), GFP_NOWAIT);
191 if (!d)
192 goto err0;
193
194 INIT_LIST_HEAD(&d->list);
195 list_add_tail(&d->list, &intc_list);
196
197 raw_spin_lock_init(&d->lock);
198
199 d->index = nr_intc_controllers;
200
201 if (desc->num_resources) {
202 d->nr_windows = desc->num_resources;
203 d->window = kzalloc(d->nr_windows * sizeof(*d->window),
204 GFP_NOWAIT);
205 if (!d->window)
206 goto err1;
207
208 for (k = 0; k < d->nr_windows; k++) {
209 res = desc->resource + k;
210 WARN_ON(resource_type(res) != IORESOURCE_MEM);
211 d->window[k].phys = res->start;
212 d->window[k].size = resource_size(res);
213 d->window[k].virt = ioremap_nocache(res->start,
214 resource_size(res));
215 if (!d->window[k].virt)
216 goto err2;
217 }
218 }
219
220 d->nr_reg = hw->mask_regs ? hw->nr_mask_regs * 2 : 0;
221#ifdef CONFIG_INTC_BALANCING
222 if (d->nr_reg)
223 d->nr_reg += hw->nr_mask_regs;
224#endif
225 d->nr_reg += hw->prio_regs ? hw->nr_prio_regs * 2 : 0;
226 d->nr_reg += hw->sense_regs ? hw->nr_sense_regs : 0;
227 d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
228 d->nr_reg += hw->subgroups ? hw->nr_subgroups : 0;
229
230 d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT);
231 if (!d->reg)
232 goto err2;
233
234#ifdef CONFIG_SMP
235 d->smp = kzalloc(d->nr_reg * sizeof(*d->smp), GFP_NOWAIT);
236 if (!d->smp)
237 goto err3;
238#endif
239 k = 0;
240
241 if (hw->mask_regs) {
242 for (i = 0; i < hw->nr_mask_regs; i++) {
243 smp = IS_SMP(hw->mask_regs[i]);
244 k += save_reg(d, k, hw->mask_regs[i].set_reg, smp);
245 k += save_reg(d, k, hw->mask_regs[i].clr_reg, smp);
246#ifdef CONFIG_INTC_BALANCING
247 k += save_reg(d, k, hw->mask_regs[i].dist_reg, 0);
248#endif
249 }
250 }
251
252 if (hw->prio_regs) {
253 d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
254 GFP_NOWAIT);
255 if (!d->prio)
256 goto err4;
257
258 for (i = 0; i < hw->nr_prio_regs; i++) {
259 smp = IS_SMP(hw->prio_regs[i]);
260 k += save_reg(d, k, hw->prio_regs[i].set_reg, smp);
261 k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp);
262 }
263 }
264
265 if (hw->sense_regs) {
266 d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
267 GFP_NOWAIT);
268 if (!d->sense)
269 goto err5;
270
271 for (i = 0; i < hw->nr_sense_regs; i++)
272 k += save_reg(d, k, hw->sense_regs[i].reg, 0);
273 }
274
275 if (hw->subgroups)
276 for (i = 0; i < hw->nr_subgroups; i++)
277 if (hw->subgroups[i].reg)
278 k+= save_reg(d, k, hw->subgroups[i].reg, 0);
279
280 memcpy(&d->chip, &intc_irq_chip, sizeof(struct irq_chip));
281 d->chip.name = desc->name;
282
283 if (hw->ack_regs)
284 for (i = 0; i < hw->nr_ack_regs; i++)
285 k += save_reg(d, k, hw->ack_regs[i].set_reg, 0);
286 else
287 d->chip.mask_ack = d->chip.disable;
288
289 /* disable bits matching force_disable before registering irqs */
290 if (desc->force_disable)
291 intc_enable_disable_enum(desc, d, desc->force_disable, 0);
292
293 /* disable bits matching force_enable before registering irqs */
294 if (desc->force_enable)
295 intc_enable_disable_enum(desc, d, desc->force_enable, 0);
296
297 BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */
298
299 /* register the vectors one by one */
300 for (i = 0; i < hw->nr_vectors; i++) {
301 struct intc_vect *vect = hw->vectors + i;
302 unsigned int irq = evt2irq(vect->vect);
303 struct irq_desc *irq_desc;
304
305 if (!vect->enum_id)
306 continue;
307
308 irq_desc = irq_to_desc_alloc_node(irq, numa_node_id());
309 if (unlikely(!irq_desc)) {
310 pr_err("can't get irq_desc for %d\n", irq);
311 continue;
312 }
313
314 intc_irq_xlate_set(irq, vect->enum_id, d);
315 intc_register_irq(desc, d, vect->enum_id, irq);
316
317 for (k = i + 1; k < hw->nr_vectors; k++) {
318 struct intc_vect *vect2 = hw->vectors + k;
319 unsigned int irq2 = evt2irq(vect2->vect);
320
321 if (vect->enum_id != vect2->enum_id)
322 continue;
323
324 /*
325 * In the case of multi-evt handling and sparse
326 * IRQ support, each vector still needs to have
327 * its own backing irq_desc.
328 */
329 irq_desc = irq_to_desc_alloc_node(irq2, numa_node_id());
330 if (unlikely(!irq_desc)) {
331 pr_err("can't get irq_desc for %d\n", irq2);
332 continue;
333 }
334
335 vect2->enum_id = 0;
336
337 /* redirect this interrupts to the first one */
338 set_irq_chip(irq2, &dummy_irq_chip);
339 set_irq_chained_handler(irq2, intc_redirect_irq);
340 set_irq_data(irq2, (void *)irq);
341 }
342 }
343
344 intc_subgroup_init(desc, d);
345
346 /* enable bits matching force_enable after registering irqs */
347 if (desc->force_enable)
348 intc_enable_disable_enum(desc, d, desc->force_enable, 1);
349
350 nr_intc_controllers++;
351
352 return 0;
353err5:
354 kfree(d->prio);
355err4:
356#ifdef CONFIG_SMP
357 kfree(d->smp);
358err3:
359#endif
360 kfree(d->reg);
361err2:
362 for (k = 0; k < d->nr_windows; k++)
363 if (d->window[k].virt)
364 iounmap(d->window[k].virt);
365
366 kfree(d->window);
367err1:
368 kfree(d);
369err0:
370 pr_err("unable to allocate INTC memory\n");
371
372 return -ENOMEM;
373}
374
375static ssize_t
376show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
377{
378 struct intc_desc_int *d;
379
380 d = container_of(dev, struct intc_desc_int, sysdev);
381
382 return sprintf(buf, "%s\n", d->chip.name);
383}
384
385static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
386
387static int intc_suspend(struct sys_device *dev, pm_message_t state)
388{
389 struct intc_desc_int *d;
390 struct irq_desc *desc;
391 int irq;
392
393 /* get intc controller associated with this sysdev */
394 d = container_of(dev, struct intc_desc_int, sysdev);
395
396 switch (state.event) {
397 case PM_EVENT_ON:
398 if (d->state.event != PM_EVENT_FREEZE)
399 break;
400
401 for_each_irq_desc(irq, desc) {
402 /*
403 * This will catch the redirect and VIRQ cases
404 * due to the dummy_irq_chip being inserted.
405 */
406 if (desc->chip != &d->chip)
407 continue;
408 if (desc->status & IRQ_DISABLED)
409 desc->chip->disable(irq);
410 else
411 desc->chip->enable(irq);
412 }
413 break;
414 case PM_EVENT_FREEZE:
415 /* nothing has to be done */
416 break;
417 case PM_EVENT_SUSPEND:
418 /* enable wakeup irqs belonging to this intc controller */
419 for_each_irq_desc(irq, desc) {
420 if (desc->chip != &d->chip)
421 continue;
422 if ((desc->status & IRQ_WAKEUP))
423 desc->chip->enable(irq);
424 }
425 break;
426 }
427
428 d->state = state;
429
430 return 0;
431}
432
433static int intc_resume(struct sys_device *dev)
434{
435 return intc_suspend(dev, PMSG_ON);
436}
437
438struct sysdev_class intc_sysdev_class = {
439 .name = "intc",
440 .suspend = intc_suspend,
441 .resume = intc_resume,
442};
443
444/* register this intc as sysdev to allow suspend/resume */
445static int __init register_intc_sysdevs(void)
446{
447 struct intc_desc_int *d;
448 int error;
449
450 error = sysdev_class_register(&intc_sysdev_class);
451 if (!error) {
452 list_for_each_entry(d, &intc_list, list) {
453 d->sysdev.id = d->index;
454 d->sysdev.cls = &intc_sysdev_class;
455 error = sysdev_register(&d->sysdev);
456 if (error == 0)
457 error = sysdev_create_file(&d->sysdev,
458 &attr_name);
459 if (error)
460 break;
461 }
462 }
463
464 if (error)
465 pr_err("sysdev registration error\n");
466
467 return error;
468}
469device_initcall(register_intc_sysdevs);
diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c
new file mode 100644
index 000000000000..6caecdffe201
--- /dev/null
+++ b/drivers/sh/intc/dynamic.c
@@ -0,0 +1,135 @@
1/*
2 * Dynamic IRQ management
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * Modelled after arch/x86/kernel/apic/io_apic.c
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#define pr_fmt(fmt) "intc: " fmt
13
14#include <linux/irq.h>
15#include <linux/bitmap.h>
16#include <linux/spinlock.h>
17#include "internals.h" /* only for activate_irq() damage.. */
18
19/*
20 * The intc_irq_map provides a global map of bound IRQ vectors for a
21 * given platform. Allocation of IRQs are either static through the CPU
22 * vector map, or dynamic in the case of board mux vectors or MSI.
23 *
24 * As this is a central point for all IRQ controllers on the system,
25 * each of the available sources are mapped out here. This combined with
26 * sparseirq makes it quite trivial to keep the vector map tightly packed
27 * when dynamically creating IRQs, as well as tying in to otherwise
28 * unused irq_desc positions in the sparse array.
29 */
30static DECLARE_BITMAP(intc_irq_map, NR_IRQS);
31static DEFINE_RAW_SPINLOCK(vector_lock);
32
33/*
34 * Dynamic IRQ allocation and deallocation
35 */
36unsigned int create_irq_nr(unsigned int irq_want, int node)
37{
38 unsigned int irq = 0, new;
39 unsigned long flags;
40 struct irq_desc *desc;
41
42 raw_spin_lock_irqsave(&vector_lock, flags);
43
44 /*
45 * First try the wanted IRQ
46 */
47 if (test_and_set_bit(irq_want, intc_irq_map) == 0) {
48 new = irq_want;
49 } else {
50 /* .. then fall back to scanning. */
51 new = find_first_zero_bit(intc_irq_map, nr_irqs);
52 if (unlikely(new == nr_irqs))
53 goto out_unlock;
54
55 __set_bit(new, intc_irq_map);
56 }
57
58 desc = irq_to_desc_alloc_node(new, node);
59 if (unlikely(!desc)) {
60 pr_err("can't get irq_desc for %d\n", new);
61 goto out_unlock;
62 }
63
64 desc = move_irq_desc(desc, node);
65 irq = new;
66
67out_unlock:
68 raw_spin_unlock_irqrestore(&vector_lock, flags);
69
70 if (irq > 0) {
71 dynamic_irq_init(irq);
72 activate_irq(irq);
73 }
74
75 return irq;
76}
77
78int create_irq(void)
79{
80 int nid = cpu_to_node(smp_processor_id());
81 int irq;
82
83 irq = create_irq_nr(NR_IRQS_LEGACY, nid);
84 if (irq == 0)
85 irq = -1;
86
87 return irq;
88}
89
90void destroy_irq(unsigned int irq)
91{
92 unsigned long flags;
93
94 dynamic_irq_cleanup(irq);
95
96 raw_spin_lock_irqsave(&vector_lock, flags);
97 __clear_bit(irq, intc_irq_map);
98 raw_spin_unlock_irqrestore(&vector_lock, flags);
99}
100
101int reserve_irq_vector(unsigned int irq)
102{
103 unsigned long flags;
104 int ret = 0;
105
106 raw_spin_lock_irqsave(&vector_lock, flags);
107 if (test_and_set_bit(irq, intc_irq_map))
108 ret = -EBUSY;
109 raw_spin_unlock_irqrestore(&vector_lock, flags);
110
111 return ret;
112}
113
114void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs)
115{
116 unsigned long flags;
117 int i;
118
119 raw_spin_lock_irqsave(&vector_lock, flags);
120 for (i = 0; i < nr_vecs; i++)
121 __set_bit(evt2irq(vectors[i].vect), intc_irq_map);
122 raw_spin_unlock_irqrestore(&vector_lock, flags);
123}
124
125void reserve_irq_legacy(void)
126{
127 unsigned long flags;
128 int i, j;
129
130 raw_spin_lock_irqsave(&vector_lock, flags);
131 j = find_first_bit(intc_irq_map, nr_irqs);
132 for (i = 0; i < j; i++)
133 __set_bit(i, intc_irq_map);
134 raw_spin_unlock_irqrestore(&vector_lock, flags);
135}
diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
new file mode 100644
index 000000000000..057ce56829bf
--- /dev/null
+++ b/drivers/sh/intc/handle.c
@@ -0,0 +1,307 @@
1/*
2 * Shared interrupt handling code for IPR and INTC2 types of IRQs.
3 *
4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <linux/spinlock.h>
14#include "internals.h"
15
16static unsigned long ack_handle[NR_IRQS];
17
18static intc_enum __init intc_grp_id(struct intc_desc *desc,
19 intc_enum enum_id)
20{
21 struct intc_group *g = desc->hw.groups;
22 unsigned int i, j;
23
24 for (i = 0; g && enum_id && i < desc->hw.nr_groups; i++) {
25 g = desc->hw.groups + i;
26
27 for (j = 0; g->enum_ids[j]; j++) {
28 if (g->enum_ids[j] != enum_id)
29 continue;
30
31 return g->enum_id;
32 }
33 }
34
35 return 0;
36}
37
38static unsigned int __init _intc_mask_data(struct intc_desc *desc,
39 struct intc_desc_int *d,
40 intc_enum enum_id,
41 unsigned int *reg_idx,
42 unsigned int *fld_idx)
43{
44 struct intc_mask_reg *mr = desc->hw.mask_regs;
45 unsigned int fn, mode;
46 unsigned long reg_e, reg_d;
47
48 while (mr && enum_id && *reg_idx < desc->hw.nr_mask_regs) {
49 mr = desc->hw.mask_regs + *reg_idx;
50
51 for (; *fld_idx < ARRAY_SIZE(mr->enum_ids); (*fld_idx)++) {
52 if (mr->enum_ids[*fld_idx] != enum_id)
53 continue;
54
55 if (mr->set_reg && mr->clr_reg) {
56 fn = REG_FN_WRITE_BASE;
57 mode = MODE_DUAL_REG;
58 reg_e = mr->clr_reg;
59 reg_d = mr->set_reg;
60 } else {
61 fn = REG_FN_MODIFY_BASE;
62 if (mr->set_reg) {
63 mode = MODE_ENABLE_REG;
64 reg_e = mr->set_reg;
65 reg_d = mr->set_reg;
66 } else {
67 mode = MODE_MASK_REG;
68 reg_e = mr->clr_reg;
69 reg_d = mr->clr_reg;
70 }
71 }
72
73 fn += (mr->reg_width >> 3) - 1;
74 return _INTC_MK(fn, mode,
75 intc_get_reg(d, reg_e),
76 intc_get_reg(d, reg_d),
77 1,
78 (mr->reg_width - 1) - *fld_idx);
79 }
80
81 *fld_idx = 0;
82 (*reg_idx)++;
83 }
84
85 return 0;
86}
87
88unsigned int __init
89intc_get_mask_handle(struct intc_desc *desc, struct intc_desc_int *d,
90 intc_enum enum_id, int do_grps)
91{
92 unsigned int i = 0;
93 unsigned int j = 0;
94 unsigned int ret;
95
96 ret = _intc_mask_data(desc, d, enum_id, &i, &j);
97 if (ret)
98 return ret;
99
100 if (do_grps)
101 return intc_get_mask_handle(desc, d, intc_grp_id(desc, enum_id), 0);
102
103 return 0;
104}
105
106static unsigned int __init _intc_prio_data(struct intc_desc *desc,
107 struct intc_desc_int *d,
108 intc_enum enum_id,
109 unsigned int *reg_idx,
110 unsigned int *fld_idx)
111{
112 struct intc_prio_reg *pr = desc->hw.prio_regs;
113 unsigned int fn, n, mode, bit;
114 unsigned long reg_e, reg_d;
115
116 while (pr && enum_id && *reg_idx < desc->hw.nr_prio_regs) {
117 pr = desc->hw.prio_regs + *reg_idx;
118
119 for (; *fld_idx < ARRAY_SIZE(pr->enum_ids); (*fld_idx)++) {
120 if (pr->enum_ids[*fld_idx] != enum_id)
121 continue;
122
123 if (pr->set_reg && pr->clr_reg) {
124 fn = REG_FN_WRITE_BASE;
125 mode = MODE_PCLR_REG;
126 reg_e = pr->set_reg;
127 reg_d = pr->clr_reg;
128 } else {
129 fn = REG_FN_MODIFY_BASE;
130 mode = MODE_PRIO_REG;
131 if (!pr->set_reg)
132 BUG();
133 reg_e = pr->set_reg;
134 reg_d = pr->set_reg;
135 }
136
137 fn += (pr->reg_width >> 3) - 1;
138 n = *fld_idx + 1;
139
140 BUG_ON(n * pr->field_width > pr->reg_width);
141
142 bit = pr->reg_width - (n * pr->field_width);
143
144 return _INTC_MK(fn, mode,
145 intc_get_reg(d, reg_e),
146 intc_get_reg(d, reg_d),
147 pr->field_width, bit);
148 }
149
150 *fld_idx = 0;
151 (*reg_idx)++;
152 }
153
154 return 0;
155}
156
157unsigned int __init
158intc_get_prio_handle(struct intc_desc *desc, struct intc_desc_int *d,
159 intc_enum enum_id, int do_grps)
160{
161 unsigned int i = 0;
162 unsigned int j = 0;
163 unsigned int ret;
164
165 ret = _intc_prio_data(desc, d, enum_id, &i, &j);
166 if (ret)
167 return ret;
168
169 if (do_grps)
170 return intc_get_prio_handle(desc, d, intc_grp_id(desc, enum_id), 0);
171
172 return 0;
173}
174
175static unsigned int __init intc_ack_data(struct intc_desc *desc,
176 struct intc_desc_int *d,
177 intc_enum enum_id)
178{
179 struct intc_mask_reg *mr = desc->hw.ack_regs;
180 unsigned int i, j, fn, mode;
181 unsigned long reg_e, reg_d;
182
183 for (i = 0; mr && enum_id && i < desc->hw.nr_ack_regs; i++) {
184 mr = desc->hw.ack_regs + i;
185
186 for (j = 0; j < ARRAY_SIZE(mr->enum_ids); j++) {
187 if (mr->enum_ids[j] != enum_id)
188 continue;
189
190 fn = REG_FN_MODIFY_BASE;
191 mode = MODE_ENABLE_REG;
192 reg_e = mr->set_reg;
193 reg_d = mr->set_reg;
194
195 fn += (mr->reg_width >> 3) - 1;
196 return _INTC_MK(fn, mode,
197 intc_get_reg(d, reg_e),
198 intc_get_reg(d, reg_d),
199 1,
200 (mr->reg_width - 1) - j);
201 }
202 }
203
204 return 0;
205}
206
207static void intc_enable_disable(struct intc_desc_int *d,
208 unsigned long handle, int do_enable)
209{
210 unsigned long addr;
211 unsigned int cpu;
212 unsigned long (*fn)(unsigned long, unsigned long,
213 unsigned long (*)(unsigned long, unsigned long,
214 unsigned long),
215 unsigned int);
216
217 if (do_enable) {
218 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
219 addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
220 fn = intc_enable_noprio_fns[_INTC_MODE(handle)];
221 fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
222 }
223 } else {
224 for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
225 addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
226 fn = intc_disable_fns[_INTC_MODE(handle)];
227 fn(addr, handle, intc_reg_fns[_INTC_FN(handle)], 0);
228 }
229 }
230}
231
232void __init intc_enable_disable_enum(struct intc_desc *desc,
233 struct intc_desc_int *d,
234 intc_enum enum_id, int enable)
235{
236 unsigned int i, j, data;
237
238 /* go through and enable/disable all mask bits */
239 i = j = 0;
240 do {
241 data = _intc_mask_data(desc, d, enum_id, &i, &j);
242 if (data)
243 intc_enable_disable(d, data, enable);
244 j++;
245 } while (data);
246
247 /* go through and enable/disable all priority fields */
248 i = j = 0;
249 do {
250 data = _intc_prio_data(desc, d, enum_id, &i, &j);
251 if (data)
252 intc_enable_disable(d, data, enable);
253
254 j++;
255 } while (data);
256}
257
258unsigned int __init
259intc_get_sense_handle(struct intc_desc *desc, struct intc_desc_int *d,
260 intc_enum enum_id)
261{
262 struct intc_sense_reg *sr = desc->hw.sense_regs;
263 unsigned int i, j, fn, bit;
264
265 for (i = 0; sr && enum_id && i < desc->hw.nr_sense_regs; i++) {
266 sr = desc->hw.sense_regs + i;
267
268 for (j = 0; j < ARRAY_SIZE(sr->enum_ids); j++) {
269 if (sr->enum_ids[j] != enum_id)
270 continue;
271
272 fn = REG_FN_MODIFY_BASE;
273 fn += (sr->reg_width >> 3) - 1;
274
275 BUG_ON((j + 1) * sr->field_width > sr->reg_width);
276
277 bit = sr->reg_width - ((j + 1) * sr->field_width);
278
279 return _INTC_MK(fn, 0, intc_get_reg(d, sr->reg),
280 0, sr->field_width, bit);
281 }
282 }
283
284 return 0;
285}
286
287
288void intc_set_ack_handle(unsigned int irq, struct intc_desc *desc,
289 struct intc_desc_int *d, intc_enum id)
290{
291 unsigned long flags;
292
293 /*
294 * Nothing to do for this IRQ.
295 */
296 if (!desc->hw.ack_regs)
297 return;
298
299 raw_spin_lock_irqsave(&intc_big_lock, flags);
300 ack_handle[irq] = intc_ack_data(desc, d, id);
301 raw_spin_unlock_irqrestore(&intc_big_lock, flags);
302}
303
304unsigned long intc_get_ack_handle(unsigned int irq)
305{
306 return ack_handle[irq];
307}
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
new file mode 100644
index 000000000000..d49482c623fa
--- /dev/null
+++ b/drivers/sh/intc/internals.h
@@ -0,0 +1,186 @@
1#include <linux/sh_intc.h>
2#include <linux/irq.h>
3#include <linux/list.h>
4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/radix-tree.h>
7#include <linux/sysdev.h>
8
9#define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
10 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
11 ((addr_e) << 16) | ((addr_d << 24)))
12
13#define _INTC_SHIFT(h) (h & 0x1f)
14#define _INTC_WIDTH(h) ((h >> 5) & 0xf)
15#define _INTC_FN(h) ((h >> 9) & 0xf)
16#define _INTC_MODE(h) ((h >> 13) & 0x7)
17#define _INTC_ADDR_E(h) ((h >> 16) & 0xff)
18#define _INTC_ADDR_D(h) ((h >> 24) & 0xff)
19
20#ifdef CONFIG_SMP
21#define IS_SMP(x) (x.smp)
22#define INTC_REG(d, x, c) (d->reg[(x)] + ((d->smp[(x)] & 0xff) * c))
23#define SMP_NR(d, x) ((d->smp[(x)] >> 8) ? (d->smp[(x)] >> 8) : 1)
24#else
25#define IS_SMP(x) 0
26#define INTC_REG(d, x, c) (d->reg[(x)])
27#define SMP_NR(d, x) 1
28#endif
29
30struct intc_handle_int {
31 unsigned int irq;
32 unsigned long handle;
33};
34
35struct intc_window {
36 phys_addr_t phys;
37 void __iomem *virt;
38 unsigned long size;
39};
40
41struct intc_map_entry {
42 intc_enum enum_id;
43 struct intc_desc_int *desc;
44};
45
46struct intc_subgroup_entry {
47 unsigned int pirq;
48 intc_enum enum_id;
49 unsigned long handle;
50};
51
52struct intc_desc_int {
53 struct list_head list;
54 struct sys_device sysdev;
55 struct radix_tree_root tree;
56 pm_message_t state;
57 raw_spinlock_t lock;
58 unsigned int index;
59 unsigned long *reg;
60#ifdef CONFIG_SMP
61 unsigned long *smp;
62#endif
63 unsigned int nr_reg;
64 struct intc_handle_int *prio;
65 unsigned int nr_prio;
66 struct intc_handle_int *sense;
67 unsigned int nr_sense;
68 struct intc_window *window;
69 unsigned int nr_windows;
70 struct irq_chip chip;
71};
72
73
74enum {
75 REG_FN_ERR = 0,
76 REG_FN_TEST_BASE = 1,
77 REG_FN_WRITE_BASE = 5,
78 REG_FN_MODIFY_BASE = 9
79};
80
81enum { MODE_ENABLE_REG = 0, /* Bit(s) set -> interrupt enabled */
82 MODE_MASK_REG, /* Bit(s) set -> interrupt disabled */
83 MODE_DUAL_REG, /* Two registers, set bit to enable / disable */
84 MODE_PRIO_REG, /* Priority value written to enable interrupt */
85 MODE_PCLR_REG, /* Above plus all bits set to disable interrupt */
86};
87
88static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
89{
90 struct irq_chip *chip = get_irq_chip(irq);
91
92 return container_of(chip, struct intc_desc_int, chip);
93}
94
95/*
96 * Grumble.
97 */
98static inline void activate_irq(int irq)
99{
100#ifdef CONFIG_ARM
101 /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
102 * sets on behalf of every irq_chip. Also sets IRQ_NOPROBE.
103 */
104 set_irq_flags(irq, IRQF_VALID);
105#else
106 /* same effect on other architectures */
107 set_irq_noprobe(irq);
108#endif
109}
110
111/* access.c */
112extern unsigned long
113(*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data);
114
115extern unsigned long
116(*intc_enable_fns[])(unsigned long addr, unsigned long handle,
117 unsigned long (*fn)(unsigned long,
118 unsigned long, unsigned long),
119 unsigned int irq);
120extern unsigned long
121(*intc_disable_fns[])(unsigned long addr, unsigned long handle,
122 unsigned long (*fn)(unsigned long,
123 unsigned long, unsigned long),
124 unsigned int irq);
125extern unsigned long
126(*intc_enable_noprio_fns[])(unsigned long addr, unsigned long handle,
127 unsigned long (*fn)(unsigned long,
128 unsigned long, unsigned long),
129 unsigned int irq);
130
131unsigned long intc_phys_to_virt(struct intc_desc_int *d, unsigned long address);
132unsigned int intc_get_reg(struct intc_desc_int *d, unsigned long address);
133unsigned int intc_set_field_from_handle(unsigned int value,
134 unsigned int field_value,
135 unsigned int handle);
136unsigned long intc_get_field_from_handle(unsigned int value,
137 unsigned int handle);
138
139/* balancing.c */
140#ifdef CONFIG_INTC_BALANCING
141void intc_balancing_enable(unsigned int irq);
142void intc_balancing_disable(unsigned int irq);
143void intc_set_dist_handle(unsigned int irq, struct intc_desc *desc,
144 struct intc_desc_int *d, intc_enum id);
145#else
146static inline void intc_balancing_enable(unsigned int irq) { }
147static inline void intc_balancing_disable(unsigned int irq) { }
148static inline void
149intc_set_dist_handle(unsigned int irq, struct intc_desc *desc,
150 struct intc_desc_int *d, intc_enum id) { }
151#endif
152
153/* chip.c */
154extern struct irq_chip intc_irq_chip;
155void _intc_enable(unsigned int irq, unsigned long handle);
156
157/* core.c */
158extern struct list_head intc_list;
159extern raw_spinlock_t intc_big_lock;
160extern unsigned int nr_intc_controllers;
161extern struct sysdev_class intc_sysdev_class;
162
163unsigned int intc_get_dfl_prio_level(void);
164unsigned int intc_get_prio_level(unsigned int irq);
165void intc_set_prio_level(unsigned int irq, unsigned int level);
166
167/* handle.c */
168unsigned int intc_get_mask_handle(struct intc_desc *desc,
169 struct intc_desc_int *d,
170 intc_enum enum_id, int do_grps);
171unsigned int intc_get_prio_handle(struct intc_desc *desc,
172 struct intc_desc_int *d,
173 intc_enum enum_id, int do_grps);
174unsigned int intc_get_sense_handle(struct intc_desc *desc,
175 struct intc_desc_int *d,
176 intc_enum enum_id);
177void intc_set_ack_handle(unsigned int irq, struct intc_desc *desc,
178 struct intc_desc_int *d, intc_enum id);
179unsigned long intc_get_ack_handle(unsigned int irq);
180void intc_enable_disable_enum(struct intc_desc *desc, struct intc_desc_int *d,
181 intc_enum enum_id, int enable);
182
183/* virq.c */
184void intc_subgroup_init(struct intc_desc *desc, struct intc_desc_int *d);
185void intc_irq_xlate_set(unsigned int irq, intc_enum id, struct intc_desc_int *d);
186struct intc_map_entry *intc_irq_xlate_get(unsigned int irq);
diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c
new file mode 100644
index 000000000000..e32304b66cf1
--- /dev/null
+++ b/drivers/sh/intc/userimask.c
@@ -0,0 +1,83 @@
1/*
2 * Support for hardware-assisted userspace interrupt masking.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#define pr_fmt(fmt) "intc: " fmt
11
12#include <linux/errno.h>
13#include <linux/sysdev.h>
14#include <linux/init.h>
15#include <linux/io.h>
16#include <asm/sizes.h>
17#include "internals.h"
18
19static void __iomem *uimask;
20
21static ssize_t
22show_intc_userimask(struct sysdev_class *cls,
23 struct sysdev_class_attribute *attr, char *buf)
24{
25 return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
26}
27
28static ssize_t
29store_intc_userimask(struct sysdev_class *cls,
30 struct sysdev_class_attribute *attr,
31 const char *buf, size_t count)
32{
33 unsigned long level;
34
35 level = simple_strtoul(buf, NULL, 10);
36
37 /*
38 * Minimal acceptable IRQ levels are in the 2 - 16 range, but
39 * these are chomped so as to not interfere with normal IRQs.
40 *
41 * Level 1 is a special case on some CPUs in that it's not
42 * directly settable, but given that USERIMASK cuts off below a
43 * certain level, we don't care about this limitation here.
44 * Level 0 on the other hand equates to user masking disabled.
45 *
46 * We use the default priority level as a cut off so that only
47 * special case opt-in IRQs can be mangled.
48 */
49 if (level >= intc_get_dfl_prio_level())
50 return -EINVAL;
51
52 __raw_writel(0xa5 << 24 | level << 4, uimask);
53
54 return count;
55}
56
57static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
58 show_intc_userimask, store_intc_userimask);
59
60
61static int __init userimask_sysdev_init(void)
62{
63 if (unlikely(!uimask))
64 return -ENXIO;
65
66 return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask);
67}
68late_initcall(userimask_sysdev_init);
69
70int register_intc_userimask(unsigned long addr)
71{
72 if (unlikely(uimask))
73 return -EBUSY;
74
75 uimask = ioremap_nocache(addr, SZ_4K);
76 if (unlikely(!uimask))
77 return -ENOMEM;
78
79 pr_info("userimask support registered for levels 0 -> %d\n",
80 intc_get_dfl_prio_level() - 1);
81
82 return 0;
83}
diff --git a/drivers/sh/intc/virq-debugfs.c b/drivers/sh/intc/virq-debugfs.c
new file mode 100644
index 000000000000..9e62ba9311f0
--- /dev/null
+++ b/drivers/sh/intc/virq-debugfs.c
@@ -0,0 +1,64 @@
1/*
2 * Support for virtual IRQ subgroups debugfs mapping.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * Modelled after arch/powerpc/kernel/irq.c.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/seq_file.h>
13#include <linux/fs.h>
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/debugfs.h>
17#include "internals.h"
18
19static int intc_irq_xlate_debug(struct seq_file *m, void *priv)
20{
21 int i;
22
23 seq_printf(m, "%-5s %-7s %-15s\n", "irq", "enum", "chip name");
24
25 for (i = 1; i < nr_irqs; i++) {
26 struct intc_map_entry *entry = intc_irq_xlate_get(i);
27 struct intc_desc_int *desc = entry->desc;
28
29 if (!desc)
30 continue;
31
32 seq_printf(m, "%5d ", i);
33 seq_printf(m, "0x%05x ", entry->enum_id);
34 seq_printf(m, "%-15s\n", desc->chip.name);
35 }
36
37 return 0;
38}
39
40static int intc_irq_xlate_open(struct inode *inode, struct file *file)
41{
42 return single_open(file, intc_irq_xlate_debug, inode->i_private);
43}
44
45static const struct file_operations intc_irq_xlate_fops = {
46 .open = intc_irq_xlate_open,
47 .read = seq_read,
48 .llseek = seq_lseek,
49 .release = single_release,
50};
51
52static int __init intc_irq_xlate_init(void)
53{
54 /*
55 * XXX.. use arch_debugfs_dir here when all of the intc users are
56 * converted.
57 */
58 if (debugfs_create_file("intc_irq_xlate", S_IRUGO, NULL, NULL,
59 &intc_irq_xlate_fops) == NULL)
60 return -ENOMEM;
61
62 return 0;
63}
64fs_initcall(intc_irq_xlate_init);
diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
new file mode 100644
index 000000000000..643dfd4d2057
--- /dev/null
+++ b/drivers/sh/intc/virq.c
@@ -0,0 +1,255 @@
1/*
2 * Support for virtual IRQ subgroups.
3 *
4 * Copyright (C) 2010 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#define pr_fmt(fmt) "intc: " fmt
11
12#include <linux/slab.h>
13#include <linux/irq.h>
14#include <linux/list.h>
15#include <linux/radix-tree.h>
16#include <linux/spinlock.h>
17#include "internals.h"
18
19static struct intc_map_entry intc_irq_xlate[NR_IRQS];
20
21struct intc_virq_list {
22 unsigned int irq;
23 struct intc_virq_list *next;
24};
25
26#define for_each_virq(entry, head) \
27 for (entry = head; entry; entry = entry->next)
28
29/*
30 * Tags for the radix tree
31 */
32#define INTC_TAG_VIRQ_NEEDS_ALLOC 0
33
34void intc_irq_xlate_set(unsigned int irq, intc_enum id, struct intc_desc_int *d)
35{
36 unsigned long flags;
37
38 raw_spin_lock_irqsave(&intc_big_lock, flags);
39 intc_irq_xlate[irq].enum_id = id;
40 intc_irq_xlate[irq].desc = d;
41 raw_spin_unlock_irqrestore(&intc_big_lock, flags);
42}
43
44struct intc_map_entry *intc_irq_xlate_get(unsigned int irq)
45{
46 return intc_irq_xlate + irq;
47}
48
49int intc_irq_lookup(const char *chipname, intc_enum enum_id)
50{
51 struct intc_map_entry *ptr;
52 struct intc_desc_int *d;
53 int irq = -1;
54
55 list_for_each_entry(d, &intc_list, list) {
56 int tagged;
57
58 if (strcmp(d->chip.name, chipname) != 0)
59 continue;
60
61 /*
62 * Catch early lookups for subgroup VIRQs that have not
63 * yet been allocated an IRQ. This already includes a
64 * fast-path out if the tree is untagged, so there is no
65 * need to explicitly test the root tree.
66 */
67 tagged = radix_tree_tag_get(&d->tree, enum_id,
68 INTC_TAG_VIRQ_NEEDS_ALLOC);
69 if (unlikely(tagged))
70 break;
71
72 ptr = radix_tree_lookup(&d->tree, enum_id);
73 if (ptr) {
74 irq = ptr - intc_irq_xlate;
75 break;
76 }
77 }
78
79 return irq;
80}
81EXPORT_SYMBOL_GPL(intc_irq_lookup);
82
83static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
84{
85 struct intc_virq_list **last, *entry;
86 struct irq_desc *desc = irq_to_desc(irq);
87
88 /* scan for duplicates */
89 last = (struct intc_virq_list **)&desc->handler_data;
90 for_each_virq(entry, desc->handler_data) {
91 if (entry->irq == virq)
92 return 0;
93 last = &entry->next;
94 }
95
96 entry = kzalloc(sizeof(struct intc_virq_list), GFP_ATOMIC);
97 if (!entry) {
98 pr_err("can't allocate VIRQ mapping for %d\n", virq);
99 return -ENOMEM;
100 }
101
102 entry->irq = virq;
103
104 *last = entry;
105
106 return 0;
107}
108
109static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
110{
111 struct intc_virq_list *entry, *vlist = get_irq_data(irq);
112 struct intc_desc_int *d = get_intc_desc(irq);
113
114 desc->chip->mask_ack(irq);
115
116 for_each_virq(entry, vlist) {
117 unsigned long addr, handle;
118
119 handle = (unsigned long)get_irq_data(entry->irq);
120 addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
121
122 if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
123 generic_handle_irq(entry->irq);
124 }
125
126 desc->chip->unmask(irq);
127}
128
129static unsigned long __init intc_subgroup_data(struct intc_subgroup *subgroup,
130 struct intc_desc_int *d,
131 unsigned int index)
132{
133 unsigned int fn = REG_FN_TEST_BASE + (subgroup->reg_width >> 3) - 1;
134
135 return _INTC_MK(fn, MODE_ENABLE_REG, intc_get_reg(d, subgroup->reg),
136 0, 1, (subgroup->reg_width - 1) - index);
137}
138
139static void __init intc_subgroup_init_one(struct intc_desc *desc,
140 struct intc_desc_int *d,
141 struct intc_subgroup *subgroup)
142{
143 struct intc_map_entry *mapped;
144 unsigned int pirq;
145 unsigned long flags;
146 int i;
147
148 mapped = radix_tree_lookup(&d->tree, subgroup->parent_id);
149 if (!mapped) {
150 WARN_ON(1);
151 return;
152 }
153
154 pirq = mapped - intc_irq_xlate;
155
156 raw_spin_lock_irqsave(&d->lock, flags);
157
158 for (i = 0; i < ARRAY_SIZE(subgroup->enum_ids); i++) {
159 struct intc_subgroup_entry *entry;
160 int err;
161
162 if (!subgroup->enum_ids[i])
163 continue;
164
165 entry = kmalloc(sizeof(*entry), GFP_NOWAIT);
166 if (!entry)
167 break;
168
169 entry->pirq = pirq;
170 entry->enum_id = subgroup->enum_ids[i];
171 entry->handle = intc_subgroup_data(subgroup, d, i);
172
173 err = radix_tree_insert(&d->tree, entry->enum_id, entry);
174 if (unlikely(err < 0))
175 break;
176
177 radix_tree_tag_set(&d->tree, entry->enum_id,
178 INTC_TAG_VIRQ_NEEDS_ALLOC);
179 }
180
181 raw_spin_unlock_irqrestore(&d->lock, flags);
182}
183
184void __init intc_subgroup_init(struct intc_desc *desc, struct intc_desc_int *d)
185{
186 int i;
187
188 if (!desc->hw.subgroups)
189 return;
190
191 for (i = 0; i < desc->hw.nr_subgroups; i++)
192 intc_subgroup_init_one(desc, d, desc->hw.subgroups + i);
193}
194
195static void __init intc_subgroup_map(struct intc_desc_int *d)
196{
197 struct intc_subgroup_entry *entries[32];
198 unsigned long flags;
199 unsigned int nr_found;
200 int i;
201
202 raw_spin_lock_irqsave(&d->lock, flags);
203
204restart:
205 nr_found = radix_tree_gang_lookup_tag_slot(&d->tree,
206 (void ***)entries, 0, ARRAY_SIZE(entries),
207 INTC_TAG_VIRQ_NEEDS_ALLOC);
208
209 for (i = 0; i < nr_found; i++) {
210 struct intc_subgroup_entry *entry;
211 int irq;
212
213 entry = radix_tree_deref_slot((void **)entries[i]);
214 if (unlikely(!entry))
215 continue;
216 if (unlikely(entry == RADIX_TREE_RETRY))
217 goto restart;
218
219 irq = create_irq();
220 if (unlikely(irq < 0)) {
221 pr_err("no more free IRQs, bailing..\n");
222 break;
223 }
224
225 pr_info("Setting up a chained VIRQ from %d -> %d\n",
226 irq, entry->pirq);
227
228 intc_irq_xlate_set(irq, entry->enum_id, d);
229
230 set_irq_chip_and_handler_name(irq, get_irq_chip(entry->pirq),
231 handle_simple_irq, "virq");
232 set_irq_chip_data(irq, get_irq_chip_data(entry->pirq));
233
234 set_irq_data(irq, (void *)entry->handle);
235
236 set_irq_chained_handler(entry->pirq, intc_virq_handler);
237 add_virq_to_pirq(entry->pirq, irq);
238
239 radix_tree_tag_clear(&d->tree, entry->enum_id,
240 INTC_TAG_VIRQ_NEEDS_ALLOC);
241 radix_tree_replace_slot((void **)entries[i],
242 &intc_irq_xlate[irq]);
243 }
244
245 raw_spin_unlock_irqrestore(&d->lock, flags);
246}
247
248void __init intc_finalize(void)
249{
250 struct intc_desc_int *d;
251
252 list_for_each_entry(d, &intc_list, list)
253 if (radix_tree_tagged(&d->tree, INTC_TAG_VIRQ_NEEDS_ALLOC))
254 intc_subgroup_map(d);
255}
diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
index cf0303acab8e..75934e3ea34e 100644
--- a/drivers/sh/pfc.c
+++ b/drivers/sh/pfc.c
@@ -7,6 +7,8 @@
7 * License. See the file "COPYING" in the main directory of this archive 7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details. 8 * for more details.
9 */ 9 */
10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11
10#include <linux/errno.h> 12#include <linux/errno.h>
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/list.h> 14#include <linux/list.h>
@@ -559,10 +561,8 @@ static int sh_gpio_get_value(struct pinmux_info *gpioc, unsigned gpio)
559 struct pinmux_data_reg *dr = NULL; 561 struct pinmux_data_reg *dr = NULL;
560 int bit = 0; 562 int bit = 0;
561 563
562 if (!gpioc || get_data_reg(gpioc, gpio, &dr, &bit) != 0) { 564 if (!gpioc || get_data_reg(gpioc, gpio, &dr, &bit) != 0)
563 BUG(); 565 return -EINVAL;
564 return 0;
565 }
566 566
567 return gpio_read_reg(dr->reg, dr->reg_width, 1, bit); 567 return gpio_read_reg(dr->reg, dr->reg_width, 1, bit);
568} 568}
@@ -581,7 +581,7 @@ int register_pinmux(struct pinmux_info *pip)
581{ 581{
582 struct gpio_chip *chip = &pip->chip; 582 struct gpio_chip *chip = &pip->chip;
583 583
584 pr_info("sh pinmux: %s handling gpio %d -> %d\n", 584 pr_info("%s handling gpio %d -> %d\n",
585 pip->name, pip->first_gpio, pip->last_gpio); 585 pip->name, pip->first_gpio, pip->last_gpio);
586 586
587 setup_data_regs(pip); 587 setup_data_regs(pip);
@@ -602,3 +602,10 @@ int register_pinmux(struct pinmux_info *pip)
602 602
603 return gpiochip_add(chip); 603 return gpiochip_add(chip);
604} 604}
605
606int unregister_pinmux(struct pinmux_info *pip)
607{
608 pr_info("%s deregistering\n", pip->name);
609
610 return gpiochip_remove(&pip->chip);
611}
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 77be3c24a427..3076b1cc05df 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2397,7 +2397,7 @@ static const struct dev_pm_ops r8a66597_dev_pm_ops = {
2397#define R8A66597_DEV_PM_OPS NULL 2397#define R8A66597_DEV_PM_OPS NULL
2398#endif 2398#endif
2399 2399
2400static int __init_or_module r8a66597_remove(struct platform_device *pdev) 2400static int __devexit r8a66597_remove(struct platform_device *pdev)
2401{ 2401{
2402 struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); 2402 struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev);
2403 struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); 2403 struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597);
@@ -2542,7 +2542,7 @@ clean_up:
2542 2542
2543static struct platform_driver r8a66597_driver = { 2543static struct platform_driver r8a66597_driver = {
2544 .probe = r8a66597_probe, 2544 .probe = r8a66597_probe,
2545 .remove = r8a66597_remove, 2545 .remove = __devexit_p(r8a66597_remove),
2546 .driver = { 2546 .driver = {
2547 .name = (char *) hcd_name, 2547 .name = (char *) hcd_name,
2548 .owner = THIS_MODULE, 2548 .owner = THIS_MODULE,
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index d72075a9f01c..7a1419279c8f 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1243,8 +1243,10 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1243 if (priv->ch[i].sglist) 1243 if (priv->ch[i].sglist)
1244 vfree(priv->ch[i].sglist); 1244 vfree(priv->ch[i].sglist);
1245 1245
1246 dma_free_coherent(&pdev->dev, info->fix.smem_len, 1246 if (info->screen_base)
1247 info->screen_base, priv->ch[i].dma_handle); 1247 dma_free_coherent(&pdev->dev, info->fix.smem_len,
1248 info->screen_base,
1249 priv->ch[i].dma_handle);
1248 fb_dealloc_cmap(&info->cmap); 1250 fb_dealloc_cmap(&info->cmap);
1249 framebuffer_release(info); 1251 framebuffer_release(info);
1250 } 1252 }
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d278dd9cb765..b4c3d1b50037 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2268,6 +2268,13 @@
2268 2268
2269#define PCI_VENDOR_ID_SILAN 0x1904 2269#define PCI_VENDOR_ID_SILAN 0x1904
2270 2270
2271#define PCI_VENDOR_ID_RENESAS 0x1912
2272#define PCI_DEVICE_ID_RENESAS_SH7781 0x0001
2273#define PCI_DEVICE_ID_RENESAS_SH7780 0x0002
2274#define PCI_DEVICE_ID_RENESAS_SH7763 0x0004
2275#define PCI_DEVICE_ID_RENESAS_SH7785 0x0007
2276#define PCI_DEVICE_ID_RENESAS_SH7786 0x0010
2277
2271#define PCI_VENDOR_ID_TDI 0x192E 2278#define PCI_VENDOR_ID_TDI 0x192E
2272#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2279#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2273 2280
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 875ce50719a9..4dca992f3093 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -4,11 +4,20 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/cpufreq.h> 6#include <linux/cpufreq.h>
7#include <linux/types.h>
8#include <linux/kref.h>
7#include <linux/clk.h> 9#include <linux/clk.h>
8#include <linux/err.h> 10#include <linux/err.h>
9 11
10struct clk; 12struct clk;
11 13
14struct clk_mapping {
15 phys_addr_t phys;
16 void __iomem *base;
17 unsigned long len;
18 struct kref ref;
19};
20
12struct clk_ops { 21struct clk_ops {
13 void (*init)(struct clk *clk); 22 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk); 23 int (*enable)(struct clk *clk);
@@ -21,9 +30,6 @@ struct clk_ops {
21 30
22struct clk { 31struct clk {
23 struct list_head node; 32 struct list_head node;
24 const char *name;
25 int id;
26
27 struct clk *parent; 33 struct clk *parent;
28 struct clk **parent_table; /* list of parents to */ 34 struct clk **parent_table; /* list of parents to */
29 unsigned short parent_num; /* choose between */ 35 unsigned short parent_num; /* choose between */
@@ -45,7 +51,9 @@ struct clk {
45 unsigned long arch_flags; 51 unsigned long arch_flags;
46 void *priv; 52 void *priv;
47 struct dentry *dentry; 53 struct dentry *dentry;
54 struct clk_mapping *mapping;
48 struct cpufreq_frequency_table *freq_table; 55 struct cpufreq_frequency_table *freq_table;
56 unsigned int nr_freqs;
49}; 57};
50 58
51#define CLK_ENABLE_ON_INIT (1 << 0) 59#define CLK_ENABLE_ON_INIT (1 << 0)
@@ -111,6 +119,9 @@ int clk_rate_table_find(struct clk *clk,
111 struct cpufreq_frequency_table *freq_table, 119 struct cpufreq_frequency_table *freq_table,
112 unsigned long rate); 120 unsigned long rate);
113 121
122long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
123 unsigned int div_max, unsigned long rate);
124
114#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 125#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
115{ \ 126{ \
116 .parent = _parent, \ 127 .parent = _parent, \
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 0d6cd38e673d..b4f183a31f13 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -20,6 +20,12 @@ struct intc_group {
20 20
21#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } } 21#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
22 22
23struct intc_subgroup {
24 unsigned long reg, reg_width;
25 intc_enum parent_id;
26 intc_enum enum_ids[32];
27};
28
23struct intc_mask_reg { 29struct intc_mask_reg {
24 unsigned long set_reg, clr_reg, reg_width; 30 unsigned long set_reg, clr_reg, reg_width;
25 intc_enum enum_ids[32]; 31 intc_enum enum_ids[32];
@@ -69,9 +75,12 @@ struct intc_hw_desc {
69 unsigned int nr_sense_regs; 75 unsigned int nr_sense_regs;
70 struct intc_mask_reg *ack_regs; 76 struct intc_mask_reg *ack_regs;
71 unsigned int nr_ack_regs; 77 unsigned int nr_ack_regs;
78 struct intc_subgroup *subgroups;
79 unsigned int nr_subgroups;
72}; 80};
73 81
74#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) 82#define _INTC_ARRAY(a) a, a == NULL ? 0 : sizeof(a)/sizeof(*a)
83
75#define INTC_HW_DESC(vectors, groups, mask_regs, \ 84#define INTC_HW_DESC(vectors, groups, mask_regs, \
76 prio_regs, sense_regs, ack_regs) \ 85 prio_regs, sense_regs, ack_regs) \
77{ \ 86{ \
@@ -105,8 +114,11 @@ struct intc_desc symbol __initdata = { \
105 prio_regs, sense_regs, ack_regs), \ 114 prio_regs, sense_regs, ack_regs), \
106} 115}
107 116
108int __init register_intc_controller(struct intc_desc *desc); 117int register_intc_controller(struct intc_desc *desc);
118void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
109int intc_set_priority(unsigned int irq, unsigned int prio); 119int intc_set_priority(unsigned int irq, unsigned int prio);
120int intc_irq_lookup(const char *chipname, intc_enum enum_id);
121void intc_finalize(void);
110 122
111#ifdef CONFIG_INTC_USERIMASK 123#ifdef CONFIG_INTC_USERIMASK
112int register_intc_userimask(unsigned long addr); 124int register_intc_userimask(unsigned long addr);
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index 07c08af9f8f6..30cae70874f4 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -92,5 +92,6 @@ struct pinmux_info {
92}; 92};
93 93
94int register_pinmux(struct pinmux_info *pip); 94int register_pinmux(struct pinmux_info *pip);
95int unregister_pinmux(struct pinmux_info *pip);
95 96
96#endif /* __SH_PFC_H */ 97#endif /* __SH_PFC_H */
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index 36170be15aa7..b0ccd0b862fc 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -127,6 +127,7 @@ static int siu_pcm_wr_set(struct siu_port *port_info,
127 sg_init_table(&sg, 1); 127 sg_init_table(&sg, 1);
128 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)), 128 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
129 size, offset_in_page(buff)); 129 size, offset_in_page(buff));
130 sg_dma_len(&sg) = size;
130 sg_dma_address(&sg) = buff; 131 sg_dma_address(&sg) = buff;
131 132
132 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 133 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
@@ -176,6 +177,7 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
176 sg_init_table(&sg, 1); 177 sg_init_table(&sg, 1);
177 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)), 178 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buff)),
178 size, offset_in_page(buff)); 179 size, offset_in_page(buff));
180 sg_dma_len(&sg) = size;
179 sg_dma_address(&sg) = buff; 181 sg_dma_address(&sg) = buff;
180 182
181 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 183 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,