summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c')
-rw-r--r--firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
index a50a9e5c80..42cd43a880 100644
--- a/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
+++ b/firmware/target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
@@ -26,11 +26,25 @@
26#include "system.h" 26#include "system.h"
27#include "cpu.h" 27#include "cpu.h"
28 28
29static void ssp_set_prescaler(unsigned int prescaler)
30{
31 int oldlevel = disable_interrupt_save(IRQ_FIQ_STATUS);
32 /* must be on to write regs */
33 bool ssp_enabled = bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE) &
34 CGU_SSP_CLOCK_ENABLE;
35 SSP_CPSR = prescaler;
36
37 if (!ssp_enabled) /* put it back how we found it */
38 bitclr32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE);
39
40 restore_irq(oldlevel);
41}
42
29int lcd_hw_init(void) 43int lcd_hw_init(void)
30{ 44{
31 bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE); 45 bitset32(&CGU_PERI, CGU_SSP_CLOCK_ENABLE);
32 46
33 SSP_CPSR = AS3525_SSP_PRESCALER; /* OF = 0x10 */ 47 ssp_set_prescaler(AS3525_SSP_PRESCALER); /* OF = 0x10 */
34 SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */ 48 SSP_CR0 = (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */
35 SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */ 49 SSP_CR1 = (1<<3) | (1<<1); /* SSP Operation enabled */
36 SSP_IMSC = 0; /* No interrupts */ 50 SSP_IMSC = 0; /* No interrupts */