1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/stage2/board-minipc.c Tue Jun 09 23:07:42 2015 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +/*
1.5 + * MiniPC board late initialisation, based on uboot-xburst and xburst-tools.
1.6 + *
1.7 + * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
1.8 + * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn>
1.9 + * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com>
1.10 + * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
1.11 + *
1.12 + * This program is free software; you can redistribute it and/or modify it under
1.13 + * the terms of the GNU General Public License as published by the Free Software
1.14 + * Foundation; either version 3 of the License, or (at your option) any later
1.15 + * version.
1.16 + *
1.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
1.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.19 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.20 + * details.
1.21 + *
1.22 + * You should have received a copy of the GNU General Public License along with
1.23 + * this program. If not, see <http://www.gnu.org/licenses/>.
1.24 + */
1.25 +
1.26 +#include "board.h"
1.27 +#include "minipc.h"
1.28 +
1.29 +/* Later initialisation functions. */
1.30 +
1.31 +void gpio_init2(void)
1.32 +{
1.33 + /* LED enable */
1.34 + __gpio_as_output(GPIO_LED_EN);
1.35 + __gpio_set_pin(GPIO_LED_EN);
1.36 +
1.37 + __harb_usb0_uhc();
1.38 + __gpio_as_emc();
1.39 + __gpio_as_dma();
1.40 +
1.41 + /*
1.42 + * Initialize LCD pins
1.43 + */
1.44 + __gpio_as_lcd_master();
1.45 +
1.46 + /*
1.47 + * Initialize MSC pins
1.48 + */
1.49 + __gpio_as_msc();
1.50 +}
1.51 +
1.52 +void cpm_init(void)
1.53 +{
1.54 + __cpm_stop_ipu();
1.55 + __cpm_stop_cim();
1.56 + __cpm_stop_i2c();
1.57 + __cpm_stop_ssi();
1.58 + __cpm_stop_uart1();
1.59 + __cpm_stop_sadc();
1.60 + __cpm_stop_uhc();
1.61 + __cpm_stop_udc();
1.62 + __cpm_stop_aic1();
1.63 +/* __cpm_stop_aic2();*/
1.64 +}
1.65 +
1.66 +void rtc_init(void)
1.67 +{
1.68 + /* NOTE: May only be accessible via I2C. */
1.69 +}
1.70 +
1.71 +/* Timer routines. */
1.72 +
1.73 +unsigned long timestamp;
1.74 +unsigned long lastdec;
1.75 +
1.76 +/*
1.77 + * timer without interrupts
1.78 + */
1.79 +
1.80 +int timer_init(void)
1.81 +{
1.82 + __ost_set_clock(TIMER_CHAN, OST_TCSR_CKS_PCLK_256);
1.83 + __ost_set_reload(TIMER_CHAN, TIMER_FDATA);
1.84 + __ost_set_count(TIMER_CHAN, TIMER_FDATA);
1.85 + __ost_enable_channel(TIMER_CHAN);
1.86 +
1.87 + lastdec = TIMER_FDATA;
1.88 + timestamp = 0;
1.89 +
1.90 + return 0;
1.91 +}