summaryrefslogtreecommitdiff
path: root/bootloader/meizu_m3.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/meizu_m3.c')
-rw-r--r--bootloader/meizu_m3.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/bootloader/meizu_m3.c b/bootloader/meizu_m3.c
index 8e3a7f64c8..acd07d7c66 100644
--- a/bootloader/meizu_m3.c
+++ b/bootloader/meizu_m3.c
@@ -104,43 +104,32 @@ void bl_debug_int(unsigned int input,unsigned int count)
104void main(void) 104void main(void)
105{ 105{
106 char mystring[64]; 106 char mystring[64];
107 int tmpval;
108
109 /* set fclk = 200MHz, hclk = 100MHz, pclk = 50MHz, others off */
110 CLKCON = 0x00800080;
111 PLLCON = 0;
112 PLL0PMS = 0x1ad200;
113 PLL0LCNT = 8100;
114 PLLCON = 1;
115 while (!(PLLLOCK & 1)) ;
116 CLKCON2= 0x80;
117 CLKCON = 0x20803180;
118
119 /* mask all interrupts
120 this is done, because the lcd framebuffer
121 overwrites some stuff, which leads to a freeze
122 when an irq is generated after the dfu upload.
123 crt0 should have disabled irqs,
124 but the bootrom hands us execution in
125 user mode so we can't switch interrupts off */
126 INTMSK = 0;
127 107
128 //Set backlight pin to output and enable 108 //Set backlight pin to output and enable
129 int oldval = PCON0; 109 int oldval = PCON0;
130 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4)); 110 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
131 PDAT0 |= (1 << 2); 111 PDAT0 |= (1 << 2);
132 112
133 //Set PLAY to input 113 //power on
134 oldval = PCON1; 114// oldval = PCON1;
135 PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16)); 115// PCON1 = ((oldval & ~(0xf << 12)) | (1 << 12));
116// PDAT1|=(1<<3);
136 117
137 asm volatile("mrs %0, cpsr \n\t" 118 //Set PLAY to EINT4
138 : "=r" (tmpval) 119 oldval = PCON1;
139 ); 120 PCON1 = ((oldval & ~(0xf << 16)) | (2 << 16));
140 121
122 //Set MENU to EINT0
123 oldval = PCON1;
124 PCON1 = (oldval & ~(0xf)) | 2;
125
126 // enable external interrupts
127 EINTPOL = 0x11;
128 INTMSK = 0x11;
129 EINTMSK = 0x11;
130 asm volatile("msr cpsr_c, #0x13\n\t"); // enable interrupts
131
141 lcd_init(); 132 lcd_init();
142 snprintf(mystring, 64, "tmpval: %x", tmpval);
143 lcd_puts(0,0,mystring);
144 lcd_update(); 133 lcd_update();
145 134
146 init_qt1106(); 135 init_qt1106();