diff options
-rw-r--r-- | arch/sh/boards/mach-sdk7786/setup.c | 14 | ||||
-rw-r--r-- | arch/sh/include/mach-sdk7786/mach/fpga.h | 9 |
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c index f094ea2ee783..0c057a93fe29 100644 --- a/arch/sh/boards/mach-sdk7786/setup.c +++ b/arch/sh/boards/mach-sdk7786/setup.c | |||
@@ -165,6 +165,19 @@ static void sdk7786_restart(char *cmd) | |||
165 | fpga_write_reg(0xa5a5, SRSTR); | 165 | fpga_write_reg(0xa5a5, SRSTR); |
166 | } | 166 | } |
167 | 167 | ||
168 | static void sdk7786_power_off(void) | ||
169 | { | ||
170 | fpga_write_reg(fpga_read_reg(PWRCR) | PWRCR_PDWNREQ, PWRCR); | ||
171 | |||
172 | /* | ||
173 | * It can take up to 20us for the R8C to do its job, back off and | ||
174 | * wait a bit until we've been shut off. Even though newer FPGA | ||
175 | * versions don't set the ACK bit, the latency issue remains. | ||
176 | */ | ||
177 | while ((fpga_read_reg(PWRCR) & PWRCR_PDWNACK) == 0) | ||
178 | cpu_sleep(); | ||
179 | } | ||
180 | |||
168 | /* Initialize the board */ | 181 | /* Initialize the board */ |
169 | static void __init sdk7786_setup(char **cmdline_p) | 182 | static void __init sdk7786_setup(char **cmdline_p) |
170 | { | 183 | { |
@@ -175,6 +188,7 @@ static void __init sdk7786_setup(char **cmdline_p) | |||
175 | pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); | 188 | pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf); |
176 | 189 | ||
177 | machine_ops.restart = sdk7786_restart; | 190 | machine_ops.restart = sdk7786_restart; |
191 | pm_power_off = sdk7786_power_off; | ||
178 | } | 192 | } |
179 | 193 | ||
180 | /* | 194 | /* |
diff --git a/arch/sh/include/mach-sdk7786/mach/fpga.h b/arch/sh/include/mach-sdk7786/mach/fpga.h index 2120d67dec70..416b621d94d1 100644 --- a/arch/sh/include/mach-sdk7786/mach/fpga.h +++ b/arch/sh/include/mach-sdk7786/mach/fpga.h | |||
@@ -42,6 +42,15 @@ | |||
42 | #define SCBR_I2CCEN BIT(1) /* CPU I2C master enable */ | 42 | #define SCBR_I2CCEN BIT(1) /* CPU I2C master enable */ |
43 | 43 | ||
44 | #define PWRCR 0x1a0 | 44 | #define PWRCR 0x1a0 |
45 | #define PWRCR_SCISEL0 BIT(0) | ||
46 | #define PWRCR_SCISEL1 BIT(1) | ||
47 | #define PWRCR_SCIEN BIT(2) /* Serial port enable */ | ||
48 | #define PWRCR_PDWNACK BIT(5) /* Power down acknowledge */ | ||
49 | #define PWRCR_PDWNREQ BIT(7) /* Power down request */ | ||
50 | #define PWRCR_INT2 BIT(11) /* INT2 connection to power manager */ | ||
51 | #define PWRCR_BUPINIT BIT(13) /* DDR backup initialize */ | ||
52 | #define PWRCR_BKPRST BIT(15) /* Backup power reset */ | ||
53 | |||
45 | #define SPCBR 0x1b0 | 54 | #define SPCBR 0x1b0 |
46 | #define SPICR 0x1c0 | 55 | #define SPICR 0x1c0 |
47 | #define SPIDR 0x1d0 | 56 | #define SPIDR 0x1d0 |