1 /* 2 * MiniPC board late initialisation, based on uboot-xburst and xburst-tools. 3 * 4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 5 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn> 6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com> 7 * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk> 8 * 9 * This program is free software; you can redistribute it and/or modify it under 10 * the terms of the GNU General Public License as published by the Free Software 11 * Foundation; either version 3 of the License, or (at your option) any later 12 * version. 13 * 14 * This program is distributed in the hope that it will be useful, but WITHOUT 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License along with 20 * this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #include "board.h" 24 #include "minipc.h" 25 26 /* Later initialisation functions. */ 27 28 void gpio_init2(void) 29 { 30 /* LED enable */ 31 __gpio_as_output(GPIO_LED_EN); 32 __gpio_set_pin(GPIO_LED_EN); 33 34 __harb_usb0_uhc(); 35 __gpio_as_emc(); 36 __gpio_as_dma(); 37 38 /* 39 * Initialize LCD pins 40 */ 41 __gpio_as_lcd_master(); 42 43 /* 44 * Initialize MSC pins 45 */ 46 __gpio_as_msc(); 47 } 48 49 void cpm_init(void) 50 { 51 __cpm_stop_ipu(); 52 __cpm_stop_cim(); 53 __cpm_stop_i2c(); 54 __cpm_stop_ssi(); 55 __cpm_stop_uart1(); 56 __cpm_stop_sadc(); 57 __cpm_stop_uhc(); 58 __cpm_stop_udc(); 59 __cpm_stop_aic1(); 60 /* __cpm_stop_aic2();*/ 61 } 62 63 void rtc_init(void) 64 { 65 /* NOTE: May only be accessible via I2C. */ 66 } 67 68 /* Timer routines. */ 69 70 unsigned long timestamp; 71 unsigned long lastdec; 72 73 /* 74 * timer without interrupts 75 */ 76 77 int timer_init(void) 78 { 79 __ost_set_clock(TIMER_CHAN, OST_TCSR_CKS_PCLK_256); 80 __ost_set_reload(TIMER_CHAN, TIMER_FDATA); 81 __ost_set_count(TIMER_CHAN, TIMER_FDATA); 82 __ost_enable_channel(TIMER_CHAN); 83 84 lastdec = TIMER_FDATA; 85 timestamp = 0; 86 87 return 0; 88 }