diff options
author | Yang Zhang <yang.z.zhang@intel.com> | 2015-08-28 09:58:54 +0800 |
---|---|---|
committer | Yang Zhang <yang.z.zhang@intel.com> | 2015-09-01 12:44:00 +0800 |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/u-boot/board/bf533-stamp | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/u-boot/board/bf533-stamp')
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/Makefile | 14 | ||||
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/bf533-stamp.c | 119 | ||||
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/config.mk | 11 | ||||
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/ide-cf.c | 98 | ||||
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/video.c | 171 | ||||
-rw-r--r-- | qemu/roms/u-boot/board/bf533-stamp/video.h | 22 |
6 files changed, 435 insertions, 0 deletions
diff --git a/qemu/roms/u-boot/board/bf533-stamp/Makefile b/qemu/roms/u-boot/board/bf533-stamp/Makefile new file mode 100644 index 000000000..244f9e049 --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/Makefile @@ -0,0 +1,14 @@ +# +# U-boot - Makefile +# +# Copyright (c) 2005-2008 Analog Device Inc. +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := bf533-stamp.o +obj-$(CONFIG_STAMP_CF) += ide-cf.o +obj-$(CONFIG_VIDEO) += video.o diff --git a/qemu/roms/u-boot/board/bf533-stamp/bf533-stamp.c b/qemu/roms/u-boot/board/bf533-stamp/bf533-stamp.c new file mode 100644 index 000000000..585f5f14d --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/bf533-stamp.c @@ -0,0 +1,119 @@ +/* + * U-boot - main board file + * + * Copyright (c) 2005-2008 Analog Devices Inc. + * + * (C) Copyright 2000-2004 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <netdev.h> +#include <asm/gpio.h> + +DECLARE_GLOBAL_DATA_PTR; + +int checkboard(void) +{ + printf("Board: ADI BF533 Stamp board\n"); + printf(" Support: http://blackfin.uclinux.org/\n"); + return 0; +} + +/* PF0 and PF1 are used to switch between the ethernet and flash: + * PF0 PF1 + * flash: 0 0 + * ether: 1 0 + */ +void swap_to(int device_id) +{ + gpio_request(GPIO_PF0, "eth_flash_swap"); + gpio_request(GPIO_PF1, "eth_flash_swap"); + gpio_direction_output(GPIO_PF0, device_id == ETHERNET); + gpio_direction_output(GPIO_PF1, 0); + SSYNC(); +} + +#if defined(CONFIG_MISC_INIT_R) +/* miscellaneous platform dependent initialisations */ +int misc_init_r(void) +{ +#ifdef CONFIG_STAMP_CF + cf_ide_init(); +#endif + + return 0; +} +#endif + +#ifdef CONFIG_SHOW_BOOT_PROGRESS + +#define STATUS_LED_OFF 0 +#define STATUS_LED_ON 1 + +static int gpio_setup; + +static void stamp_led_set(int LED1, int LED2, int LED3) +{ + if (!gpio_setup) { + gpio_request(GPIO_PF2, "boot_progress"); + gpio_request(GPIO_PF3, "boot_progress"); + gpio_request(GPIO_PF4, "boot_progress"); + gpio_direction_output(GPIO_PF2, LED1); + gpio_direction_output(GPIO_PF3, LED2); + gpio_direction_output(GPIO_PF4, LED3); + gpio_setup = 1; + } else { + gpio_set_value(GPIO_PF2, LED1); + gpio_set_value(GPIO_PF3, LED2); + gpio_set_value(GPIO_PF4, LED3); + } +} + +void show_boot_progress(int status) +{ + switch (status) { + case BOOTSTAGE_ID_CHECK_MAGIC: + stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON); + break; + case BOOTSTAGE_ID_CHECK_HEADER: + stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF); + break; + case BOOTSTAGE_ID_CHECK_CHECKSUM: + stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON); + break; + case BOOTSTAGE_ID_CHECK_ARCH: + stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF); + break; + case BOOTSTAGE_ID_CHECK_IMAGETYPE: + case BOOTSTAGE_ID_DECOMP_IMAGE: + stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON); + break; + case BOOTSTAGE_ID_KERNEL_LOADED: + case BOOTSTAGE_ID_CHECK_BOOT_OS: + stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF); + break; + case BOOTSTAGE_ID_BOOT_OS_RETURNED: + case BOOTSTAGE_ID_RD_MAGIC: + case BOOTSTAGE_ID_RD_HDR_CHECKSUM: + case BOOTSTAGE_ID_RD_CHECKSUM: + case BOOTSTAGE_ID_RAMDISK: + case BOOTSTAGE_ID_NO_RAMDISK: + case BOOTSTAGE_ID_RUN_OS: + stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF); + break; + default: + stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON); + break; + } +} +#endif + +#ifdef CONFIG_SMC91111 +int board_eth_init(bd_t *bis) +{ + return smc91111_initialize(0, CONFIG_SMC91111_BASE); +} +#endif diff --git a/qemu/roms/u-boot/board/bf533-stamp/config.mk b/qemu/roms/u-boot/board/bf533-stamp/config.mk new file mode 100644 index 000000000..7f9138b09 --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/config.mk @@ -0,0 +1,11 @@ +# +# Copyright (c) 2005-2008 Analog Device Inc. +# +# (C) Copyright 2001 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +# Set some default LDR flags based on boot mode. +LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8 diff --git a/qemu/roms/u-boot/board/bf533-stamp/ide-cf.c b/qemu/roms/u-boot/board/bf533-stamp/ide-cf.c new file mode 100644 index 000000000..3e4080e28 --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/ide-cf.c @@ -0,0 +1,98 @@ +/* + * CF IDE addon card code + * + * Enter bugs at http://blackfin.uclinux.org/ + * + * Copyright (c) 2005-2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include <common.h> +#include <config.h> +#include <asm/blackfin.h> + +void cf_outb(unsigned char val, volatile unsigned char *addr) +{ + /* "ETHERNET" means the expansion memory banks */ + swap_to(ETHERNET); + + *addr = val; + SSYNC(); + + swap_to(FLASH); +} + +unsigned char cf_inb(volatile unsigned char *addr) +{ + unsigned char c; + + swap_to(ETHERNET); + + c = *addr; + SSYNC(); + + swap_to(FLASH); + + return c; +} + +void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words) +{ + int i; + + swap_to(ETHERNET); + + for (i = 0; i < words; i++) { + *(sect_buf + i) = *addr; + SSYNC(); + } + + swap_to(FLASH); +} + +void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words) +{ + int i; + + swap_to(ETHERNET); + + for (i = 0; i < words; i++) { + *addr = *(sect_buf + i); + SSYNC(); + } + + swap_to(FLASH); +} + +/* Definitions used in Compact Flash Boot support */ +#define FIO_EDGE_CF_BITS 0x0000 +#define FIO_POLAR_CF_BITS 0x0000 +#define FIO_EDGE_BITS 0x1E0 +#define FIO_POLAR_BITS 0x160 + +/* Compact flash status bits in status register */ +#define CF_STAT_BITS 0x00000060 + +void cf_ide_init(void) +{ + int i, cf_stat; + + /* Check whether CF card is inserted */ + bfin_write_FIO_EDGE(FIO_EDGE_CF_BITS); + bfin_write_FIO_POLAR(FIO_POLAR_CF_BITS); + for (i = 0; i < 0x300; i++) + asm volatile("nop;"); + + cf_stat = bfin_read_FIO_FLAG_S() & CF_STAT_BITS; + + bfin_write_FIO_EDGE(FIO_EDGE_BITS); + bfin_write_FIO_POLAR(FIO_POLAR_BITS); + + if (!cf_stat) { + for (i = 0; i < 0x3000; i++) + asm volatile("nop;"); + + ide_init(); + } +} diff --git a/qemu/roms/u-boot/board/bf533-stamp/video.c b/qemu/roms/u-boot/board/bf533-stamp/video.c new file mode 100644 index 000000000..75b8adca1 --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/video.c @@ -0,0 +1,171 @@ +/* + * BF533-STAMP splash driver + * + * Copyright (c) 2006-2008 Analog Devices Inc. + * (C) Copyright 2000 + * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it + * (C) Copyright 2002 + * Wolfgang Denk, wd@denx.de + * + * Licensed under the GPL-2 or later. + */ + +#include <stdarg.h> +#include <common.h> +#include <config.h> +#include <malloc.h> +#include <asm/blackfin.h> +#include <asm/mach-common/bits/dma.h> +#include <i2c.h> +#include <linux/types.h> +#include <stdio_dev.h> + +#define DMA_SIZE16 2 + +#include <asm/mach-common/bits/ppi.h> + +#define NTSC_FRAME_ADDR 0x06000000 +#include "video.h" + +/* NTSC OUTPUT SIZE 720 * 240 */ +#define VERTICAL 2 +#define HORIZONTAL 4 + +int is_vblank_line(const int line) +{ + /* + * This array contains a single bit for each line in + * an NTSC frame. + */ + if ((line <= 18) || (line >= 264 && line <= 281) || (line == 528)) + return true; + + return false; +} + +int NTSC_framebuffer_init(char *base_address) +{ + const int NTSC_frames = 1; + const int NTSC_lines = 525; + char *dest = base_address; + int frame_num, line_num; + + for (frame_num = 0; frame_num < NTSC_frames; ++frame_num) { + for (line_num = 1; line_num <= NTSC_lines; ++line_num) { + unsigned int code; + int offset = 0; + int i; + + if (is_vblank_line(line_num)) + offset++; + + if (line_num > 266 || line_num < 3) + offset += 2; + + /* Output EAV code */ + code = system_code_map[offset].eav; + write_dest_byte((char)(code >> 24) & 0xff); + write_dest_byte((char)(code >> 16) & 0xff); + write_dest_byte((char)(code >> 8) & 0xff); + write_dest_byte((char)(code) & 0xff); + + /* Output horizontal blanking */ + for (i = 0; i < 67 * 2; ++i) { + write_dest_byte(0x80); + write_dest_byte(0x10); + } + + /* Output SAV */ + code = system_code_map[offset].sav; + write_dest_byte((char)(code >> 24) & 0xff); + write_dest_byte((char)(code >> 16) & 0xff); + write_dest_byte((char)(code >> 8) & 0xff); + write_dest_byte((char)(code) & 0xff); + + /* Output empty horizontal data */ + for (i = 0; i < 360 * 2; ++i) { + write_dest_byte(0x80); + write_dest_byte(0x10); + } + } + } + + return dest - base_address; +} + +void fill_frame(char *Frame, int Value) +{ + int *OddPtr32; + int OddLine; + int *EvenPtr32; + int EvenLine; + int i; + int *data; + int m, n; + + /* fill odd and even frames */ + for (OddLine = 22, EvenLine = 285; OddLine < 263; OddLine++, EvenLine++) { + OddPtr32 = (int *)((Frame + (OddLine * 1716)) + 276); + EvenPtr32 = (int *)((Frame + (EvenLine * 1716)) + 276); + for (i = 0; i < 360; i++, OddPtr32++, EvenPtr32++) { + *OddPtr32 = Value; + *EvenPtr32 = Value; + } + } + + for (m = 0; m < VERTICAL; m++) { + data = (int *)u_boot_logo.data; + for (OddLine = (22 + m), EvenLine = (285 + m); + OddLine < (u_boot_logo.height * VERTICAL) + (22 + m); + OddLine += VERTICAL, EvenLine += VERTICAL) { + OddPtr32 = (int *)((Frame + ((OddLine) * 1716)) + 276); + EvenPtr32 = + (int *)((Frame + ((EvenLine) * 1716)) + 276); + for (i = 0; i < u_boot_logo.width / 2; i++) { + /* enlarge one pixel to m x n */ + for (n = 0; n < HORIZONTAL; n++) { + *OddPtr32++ = *data; + *EvenPtr32++ = *data; + } + data++; + } + } + } +} + +static void video_init(char *NTSCFrame) +{ + NTSC_framebuffer_init(NTSCFrame); + fill_frame(NTSCFrame, BLUE); + + bfin_write_PPI_CONTROL(0x0082); + bfin_write_PPI_FRAME(0x020D); + + bfin_write_DMA0_START_ADDR(NTSCFrame); + bfin_write_DMA0_X_COUNT(0x035A); + bfin_write_DMA0_X_MODIFY(0x0002); + bfin_write_DMA0_Y_COUNT(0x020D); + bfin_write_DMA0_Y_MODIFY(0x0002); + bfin_write_DMA0_CONFIG(0x1015); + bfin_write_PPI_CONTROL(0x0083); +} + +void video_stop(void) +{ + bfin_write_PPI_CONTROL(0); + bfin_write_DMA0_CONFIG(0); +} + +int drv_video_init(void) +{ + struct stdio_dev videodev; + + video_init((void *)NTSC_FRAME_ADDR); + + memset(&videodev, 0, sizeof(videodev)); + strcpy(videodev.name, "video"); + videodev.ext = DEV_EXT_VIDEO; + videodev.flags = DEV_FLAGS_SYSTEM; + + return stdio_register(&videodev); +} diff --git a/qemu/roms/u-boot/board/bf533-stamp/video.h b/qemu/roms/u-boot/board/bf533-stamp/video.h new file mode 100644 index 000000000..949c3d8f3 --- /dev/null +++ b/qemu/roms/u-boot/board/bf533-stamp/video.h @@ -0,0 +1,22 @@ +#include <video_logo.h> +#define write_dest_byte(val) {*dest++=val;} +#define BLACK (0x01800180) /* black pixel pattern */ +#define BLUE (0x296E29F0) /* blue pixel pattern */ +#define RED (0x51F0515A) /* red pixel pattern */ +#define MAGENTA (0x6ADE6ACA) /* magenta pixel pattern */ +#define GREEN (0x91229136) /* green pixel pattern */ +#define CYAN (0xAA10AAA6) /* cyan pixel pattern */ +#define YELLOW (0xD292D210) /* yellow pixel pattern */ +#define WHITE (0xFE80FE80) /* white pixel pattern */ + +typedef struct { + unsigned int sav; + unsigned int eav; +} system_code_type; + +const system_code_type system_code_map[] = { + { 0xFF000080, 0xFF00009D }, + { 0xFF0000AB, 0xFF0000B6 }, + { 0xFF0000C7, 0xFF0000DA }, + { 0xFF0000EC, 0xFF0000F1 }, +}; |