# HG changeset patch # User Paul Boddie # Date 1433884062 -7200 # Node ID 953638e23d0595965576cea76ba42332212c1837 # Parent ae273a827f2024b52133b5d09bd16269e6d21694 Extended MiniPC board support. diff -r ae273a827f20 -r 953638e23d05 stage2/board-minipc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stage2/board-minipc.c Tue Jun 09 23:07:42 2015 +0200 @@ -0,0 +1,88 @@ +/* + * MiniPC board late initialisation, based on uboot-xburst and xburst-tools. + * + * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, + * Copyright (C) 2005-2006 Ingenic Semiconductor, + * Copyright (C) Xiangfu Liu + * Copyright (C) 2015 Paul Boddie + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "board.h" +#include "minipc.h" + +/* Later initialisation functions. */ + +void gpio_init2(void) +{ + /* LED enable */ + __gpio_as_output(GPIO_LED_EN); + __gpio_set_pin(GPIO_LED_EN); + + __harb_usb0_uhc(); + __gpio_as_emc(); + __gpio_as_dma(); + + /* + * Initialize LCD pins + */ + __gpio_as_lcd_master(); + + /* + * Initialize MSC pins + */ + __gpio_as_msc(); +} + +void cpm_init(void) +{ + __cpm_stop_ipu(); + __cpm_stop_cim(); + __cpm_stop_i2c(); + __cpm_stop_ssi(); + __cpm_stop_uart1(); + __cpm_stop_sadc(); + __cpm_stop_uhc(); + __cpm_stop_udc(); + __cpm_stop_aic1(); +/* __cpm_stop_aic2();*/ +} + +void rtc_init(void) +{ + /* NOTE: May only be accessible via I2C. */ +} + +/* Timer routines. */ + +unsigned long timestamp; +unsigned long lastdec; + +/* + * timer without interrupts + */ + +int timer_init(void) +{ + __ost_set_clock(TIMER_CHAN, OST_TCSR_CKS_PCLK_256); + __ost_set_reload(TIMER_CHAN, TIMER_FDATA); + __ost_set_count(TIMER_CHAN, TIMER_FDATA); + __ost_enable_channel(TIMER_CHAN); + + lastdec = TIMER_FDATA; + timestamp = 0; + + return 0; +} diff -r ae273a827f20 -r 953638e23d05 stage2/board-minipc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stage2/board-minipc.h Tue Jun 09 23:07:42 2015 +0200 @@ -0,0 +1,11 @@ +#ifndef __BOARD_MINIPC_H__ +#define __BOARD_MINIPC_H__ + +/* Initialisation functions. */ + +void gpio_init2(void); +void cpm_init(void); +void rtc_init(void); +int timer_init(void); + +#endif /* __BOARD_MINIPC_H__ */ diff -r ae273a827f20 -r 953638e23d05 stage2/minipc_claa070vc01.c --- a/stage2/minipc_claa070vc01.c Tue Jun 09 23:07:03 2015 +0200 +++ b/stage2/minipc_claa070vc01.c Tue Jun 09 23:07:42 2015 +0200 @@ -22,6 +22,7 @@ #include "minipc_claa070vc01.h" #include "jzlcd.h" +#include "minipc.h" struct jzfb_info jzfb = { MODE_GENERIC_TFT | PCLK_N | HSYNC_N | VSYNC_N, diff -r ae273a827f20 -r 953638e23d05 stage2/minipc_claa070vc01.h --- a/stage2/minipc_claa070vc01.h Tue Jun 09 23:07:03 2015 +0200 +++ b/stage2/minipc_claa070vc01.h Tue Jun 09 23:07:42 2015 +0200 @@ -23,4 +23,36 @@ #ifndef __MINIPC_CLAA070VC01_H__ #define __MINIPC_CLAA070VC01_H__ +#define __lcd_set_backlight_level(n) \ +do { \ + __gpio_as_pwm(); \ + REG_PWM_DUT(0) = n; \ + REG_PWM_PER(0) = 7; \ + REG_PWM_CTR(0) = 0xc1; \ +} while (0) + +#define __lcd_close_backlight() \ +do { \ +__gpio_as_output(GPIO_PWM0);\ +__gpio_clear_pin(GPIO_PWM0);\ +} while (0) + +#define __lcd_display_pin_init() \ +do { \ + __gpio_as_output(GPIO_DISP_OFF_N); \ + __lcd_set_backlight_level(8); \ +} while (0) + +#define __lcd_display_on() \ +do { \ + __gpio_set_pin(GPIO_DISP_OFF_N); \ + __lcd_set_backlight_level(8); \ +} while (0) + +#define __lcd_display_off() \ +do { \ + __lcd_close_backlight(); \ + __gpio_clear_pin(GPIO_DISP_OFF_N); \ +} while (0) + #endif /* __MINIPC_CLAA070VC01_H__ */