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 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/stage2/board-minipc.h Tue Jun 09 23:07:42 2015 +0200
2.3 @@ -0,0 +1,11 @@
2.4 +#ifndef __BOARD_MINIPC_H__
2.5 +#define __BOARD_MINIPC_H__
2.6 +
2.7 +/* Initialisation functions. */
2.8 +
2.9 +void gpio_init2(void);
2.10 +void cpm_init(void);
2.11 +void rtc_init(void);
2.12 +int timer_init(void);
2.13 +
2.14 +#endif /* __BOARD_MINIPC_H__ */
3.1 --- a/stage2/minipc_claa070vc01.c Tue Jun 09 23:07:03 2015 +0200
3.2 +++ b/stage2/minipc_claa070vc01.c Tue Jun 09 23:07:42 2015 +0200
3.3 @@ -22,6 +22,7 @@
3.4
3.5 #include "minipc_claa070vc01.h"
3.6 #include "jzlcd.h"
3.7 +#include "minipc.h"
3.8
3.9 struct jzfb_info jzfb = {
3.10 MODE_GENERIC_TFT | PCLK_N | HSYNC_N | VSYNC_N,
4.1 --- a/stage2/minipc_claa070vc01.h Tue Jun 09 23:07:03 2015 +0200
4.2 +++ b/stage2/minipc_claa070vc01.h Tue Jun 09 23:07:42 2015 +0200
4.3 @@ -23,4 +23,36 @@
4.4 #ifndef __MINIPC_CLAA070VC01_H__
4.5 #define __MINIPC_CLAA070VC01_H__
4.6
4.7 +#define __lcd_set_backlight_level(n) \
4.8 +do { \
4.9 + __gpio_as_pwm(); \
4.10 + REG_PWM_DUT(0) = n; \
4.11 + REG_PWM_PER(0) = 7; \
4.12 + REG_PWM_CTR(0) = 0xc1; \
4.13 +} while (0)
4.14 +
4.15 +#define __lcd_close_backlight() \
4.16 +do { \
4.17 +__gpio_as_output(GPIO_PWM0);\
4.18 +__gpio_clear_pin(GPIO_PWM0);\
4.19 +} while (0)
4.20 +
4.21 +#define __lcd_display_pin_init() \
4.22 +do { \
4.23 + __gpio_as_output(GPIO_DISP_OFF_N); \
4.24 + __lcd_set_backlight_level(8); \
4.25 +} while (0)
4.26 +
4.27 +#define __lcd_display_on() \
4.28 +do { \
4.29 + __gpio_set_pin(GPIO_DISP_OFF_N); \
4.30 + __lcd_set_backlight_level(8); \
4.31 +} while (0)
4.32 +
4.33 +#define __lcd_display_off() \
4.34 +do { \
4.35 + __lcd_close_backlight(); \
4.36 + __gpio_clear_pin(GPIO_DISP_OFF_N); \
4.37 +} while (0)
4.38 +
4.39 #endif /* __MINIPC_CLAA070VC01_H__ */