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