aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-06-02 05:22:02 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-06-11 02:08:53 -0400
commit0d4fdbb64f472ef31195714993f1263f77cf85ca (patch)
tree2cfa619828ac2430919b3d716635e9ebf6f00a47
parent2693e2740ddae364a80e6083043ba760b6366b69 (diff)
sh: rework mode pin code
This patch reworks the mode pin code to keep the pin definitions in one place. The mode pins values are now the value of the bit instead of bit number. With this patch in place the sh7785 header file contains mode pin comments. The sh7785 clock code and the sh7785lcr board code are updated to reflect the new shared mode pins. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/board-sh7785lcr.c14
-rw-r--r--arch/sh/include/asm/processor.h17
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7785.h39
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7785.c2
-rw-r--r--arch/sh/kernel/setup.c2
5 files changed, 46 insertions, 28 deletions
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index c2894c5b71ea..7be56fb06c1f 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -330,13 +330,13 @@ static int sh7785lcr_mode_pins(void)
330 * If you change these dip switches then you will need to 330 * If you change these dip switches then you will need to
331 * adjust the values below as well. 331 * adjust the values below as well.
332 */ 332 */
333 value |= 1 << MODE_PIN_MODE4; /* Clock Mode 16 */ 333 value |= MODE_PIN4; /* Clock Mode 16 */
334 value |= 1 << MODE_PIN_MODE5; /* 32-bit Area0 bus width */ 334 value |= MODE_PIN5; /* 32-bit Area0 bus width */
335 value |= 1 << MODE_PIN_MODE6; /* 32-bit Area0 bus width */ 335 value |= MODE_PIN6; /* 32-bit Area0 bus width */
336 value |= 1 << MODE_PIN_MODE7; /* Area 0 SRAM interface [fixed] */ 336 value |= MODE_PIN7; /* Area 0 SRAM interface [fixed] */
337 value |= 1 << MODE_PIN_MODE8; /* Little Endian */ 337 value |= MODE_PIN8; /* Little Endian */
338 value |= 1 << MODE_PIN_MODE9; /* Master Mode */ 338 value |= MODE_PIN9; /* Master Mode */
339 value |= 1 << MODE_PIN_MODE14; /* No PLL step-up */ 339 value |= MODE_PIN14; /* No PLL step-up */
340 340
341 return value; 341 return value;
342} 342}
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index fb67482e47eb..ff7daaf9a620 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -95,6 +95,23 @@ const char *get_cpu_subtype(struct sh_cpuinfo *c);
95extern const struct seq_operations cpuinfo_op; 95extern const struct seq_operations cpuinfo_op;
96 96
97/* processor boot mode configuration */ 97/* processor boot mode configuration */
98#define MODE_PIN0 (1 << 0)
99#define MODE_PIN1 (1 << 1)
100#define MODE_PIN2 (1 << 2)
101#define MODE_PIN3 (1 << 3)
102#define MODE_PIN4 (1 << 4)
103#define MODE_PIN5 (1 << 5)
104#define MODE_PIN6 (1 << 6)
105#define MODE_PIN7 (1 << 7)
106#define MODE_PIN8 (1 << 8)
107#define MODE_PIN9 (1 << 9)
108#define MODE_PIN10 (1 << 10)
109#define MODE_PIN11 (1 << 11)
110#define MODE_PIN12 (1 << 12)
111#define MODE_PIN13 (1 << 13)
112#define MODE_PIN14 (1 << 14)
113#define MODE_PIN15 (1 << 15)
114
98int generic_mode_pins(void); 115int generic_mode_pins(void);
99int test_mode_pin(int pin); 116int test_mode_pin(int pin);
100 117
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7785.h b/arch/sh/include/cpu-sh4/cpu/sh7785.h
index 89afaa6dc2d8..9dc9d91e0a8e 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7785.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7785.h
@@ -1,25 +1,26 @@
1#ifndef __ASM_SH7785_H__ 1#ifndef __ASM_SH7785_H__
2#define __ASM_SH7785_H__ 2#define __ASM_SH7785_H__
3 3
4/* Boot Mode Pins, more information in sh7785 manual Rev.1.00, page 1628 */ 4/* Boot Mode Pins:
5enum { 5 *
6 MODE_PIN_MODE0, /* CPG - Initial Pck/Bck Frequency [FRQMR1] */ 6 * MODE0: CPG - Initial Pck/Bck Frequency [FRQMR1]
7 MODE_PIN_MODE1, /* CPG - Initial Uck/SHck/DDRck Frequency [FRQMR1] */ 7 * MODE1: CPG - Initial Uck/SHck/DDRck Frequency [FRQMR1]
8 MODE_PIN_MODE2, /* CPG - Reserved (L: Normal operation) */ 8 * MODE2: CPG - Reserved (L: Normal operation)
9 MODE_PIN_MODE3, /* CPG - Reserved (L: Normal operation) */ 9 * MODE3: CPG - Reserved (L: Normal operation)
10 MODE_PIN_MODE4, /* CPG - Initial PLL setting (72x/36x) */ 10 * MODE4: CPG - Initial PLL setting (72x/36x)
11 MODE_PIN_MODE5, /* LBSC - Area0 Memory Type / Bus Width [CS0BCR.8] */ 11 * MODE5: LBSC - Area0 Memory Type / Bus Width [CS0BCR.8]
12 MODE_PIN_MODE6, /* LBSC - Area0 Memory Type / Bus Width [CS0BCR.9] */ 12 * MODE6: LBSC - Area0 Memory Type / Bus Width [CS0BCR.9]
13 MODE_PIN_MODE7, /* LBSC - Area0 Memory Type / Bus Width [CS0BCR.3] */ 13 * MODE7: LBSC - Area0 Memory Type / Bus Width [CS0BCR.3]
14 MODE_PIN_MODE8, /* LBSC - Endian Mode (L: Big, H: Little) [BCR.31] */ 14 * MODE8: LBSC - Endian Mode (L: Big, H: Little) [BCR.31]
15 MODE_PIN_MODE9, /* LBSC - Master/Slave Mode (L: Slave) [BCR.30] */ 15 * MODE9: LBSC - Master/Slave Mode (L: Slave) [BCR.30]
16 MODE_PIN_MODE10, /* CPG - Clock Input (L: Ext Clk, H: Crystal) */ 16 * MODE10: CPG - Clock Input (L: Ext Clk, H: Crystal)
17 MODE_PIN_MODE11, /* PCI - Pin Mode (LL: PCI host, LH: PCI slave) */ 17 * MODE11: PCI - Pin Mode (LL: PCI host, LH: PCI slave)
18 MODE_PIN_MODE12, /* PCI - Pin Mode (HL: Local bus, HH: DU) */ 18 * MODE12: PCI - Pin Mode (HL: Local bus, HH: DU)
19 MODE_PIN_MODE13, /* Boot Address Mode (L: 29-bit, H: 32-bit) */ 19 * MODE13: Boot Address Mode (L: 29-bit, H: 32-bit)
20 MODE_PIN_MODE14, /* Reserved (H: Normal operation) */ 20 * MODE14: Reserved (H: Normal operation)
21 MODE_PIN_MPMD, /* Emulation Mode (L: Emulation mode, H: LSI mode) */ 21 *
22}; 22 * More information in sh7785 manual Rev.1.00, page 1628.
23 */
23 24
24/* Pin Function Controller: 25/* Pin Function Controller:
25 * GPIO_FN_xx - GPIO used to select pin function 26 * GPIO_FN_xx - GPIO used to select pin function
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
index dae20aca536d..73abfbf2f16d 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
@@ -32,7 +32,7 @@ static unsigned long pll_recalc(struct clk *clk)
32{ 32{
33 int multiplier; 33 int multiplier;
34 34
35 multiplier = test_mode_pin(MODE_PIN_MODE4) ? 36 : 72; 35 multiplier = test_mode_pin(MODE_PIN4) ? 36 : 72;
36 36
37 return clk->parent->rate * multiplier; 37 return clk->parent->rate * multiplier;
38} 38}
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 050131eec773..dd38338553ef 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -429,7 +429,7 @@ int generic_mode_pins(void)
429 429
430int test_mode_pin(int pin) 430int test_mode_pin(int pin)
431{ 431{
432 return sh_mv.mv_mode_pins() & (1 << pin); 432 return sh_mv.mv_mode_pins() & pin;
433} 433}
434 434
435static const char *cpu_name[] = { 435static const char *cpu_name[] = {