mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
Blackfin: bf537-stamp: split CF/IDE code out into dedicated cf-ide.c
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
@ -30,6 +30,7 @@ include $(TOPDIR)/config.mk
|
|||||||
LIB = $(obj)lib$(BOARD).a
|
LIB = $(obj)lib$(BOARD).a
|
||||||
|
|
||||||
COBJS-y := $(BOARD).o cmd_bf537led.o
|
COBJS-y := $(BOARD).o cmd_bf537led.o
|
||||||
|
COBJS-$(CONFIG_BFIN_IDE) += ide-cf.o
|
||||||
COBJS-$(CONFIG_CMD_EEPROM) += spi_flash.o
|
COBJS-$(CONFIG_CMD_EEPROM) += spi_flash.o
|
||||||
COBJS-$(CONFIG_CMD_NAND) += nand.o
|
COBJS-$(CONFIG_CMD_NAND) += nand.o
|
||||||
COBJS-$(CONFIG_POST) += post.o post-memory.o
|
COBJS-$(CONFIG_POST) += post.o post-memory.o
|
||||||
|
@ -43,43 +43,6 @@ int checkboard(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BFIN_IDE)
|
|
||||||
|
|
||||||
void cf_outb(unsigned char val, volatile unsigned char *addr)
|
|
||||||
{
|
|
||||||
*(addr) = val;
|
|
||||||
SSYNC();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char cf_inb(volatile unsigned char *addr)
|
|
||||||
{
|
|
||||||
volatile unsigned char c;
|
|
||||||
|
|
||||||
c = *(addr);
|
|
||||||
SSYNC();
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < words; i++)
|
|
||||||
*(sect_buf + i) = *(addr);
|
|
||||||
SSYNC();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < words; i++)
|
|
||||||
*(addr) = *(sect_buf + i);
|
|
||||||
SSYNC();
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_BFIN_IDE */
|
|
||||||
|
|
||||||
phys_size_t initdram(int board_type)
|
phys_size_t initdram(int board_type)
|
||||||
{
|
{
|
||||||
gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
|
gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
|
||||||
@ -130,7 +93,6 @@ int board_eth_init(bd_t *bis)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_MISC_INIT_R)
|
|
||||||
/* miscellaneous platform dependent initialisations */
|
/* miscellaneous platform dependent initialisations */
|
||||||
int misc_init_r(void)
|
int misc_init_r(void)
|
||||||
{
|
{
|
||||||
@ -146,22 +108,9 @@ int misc_init_r(void)
|
|||||||
flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
|
flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_BFIN_IDE)
|
#ifdef CONFIG_BFIN_IDE
|
||||||
#if defined(CONFIG_BFIN_TRUE_IDE)
|
cf_ide_init();
|
||||||
/* Enable ATASEL when in True IDE mode */
|
|
||||||
printf("Using CF True IDE Mode\n");
|
|
||||||
cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_ENA);
|
|
||||||
udelay(1000);
|
|
||||||
#elif defined(CONFIG_BFIN_CF_IDE)
|
|
||||||
/* Disable ATASEL when we're in Common Memory Mode */
|
|
||||||
printf("Using CF Common Memory Mode\n");
|
|
||||||
cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_DIS);
|
|
||||||
udelay(1000);
|
|
||||||
#elif defined(CONFIG_BFIN_HDD_IDE)
|
|
||||||
printf("Using HDD IDE Mode\n");
|
|
||||||
#endif
|
#endif
|
||||||
ide_init();
|
|
||||||
#endif /* CONFIG_BFIN_IDE */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_MISC_INIT_R */
|
|
||||||
|
66
board/bf537-stamp/ide-cf.c
Normal file
66
board/bf537-stamp/ide-cf.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* 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 <command.h>
|
||||||
|
#include <asm/blackfin.h>
|
||||||
|
|
||||||
|
void cf_outb(unsigned char val, volatile unsigned char *addr)
|
||||||
|
{
|
||||||
|
*(addr) = val;
|
||||||
|
SSYNC();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char cf_inb(volatile unsigned char *addr)
|
||||||
|
{
|
||||||
|
volatile unsigned char c;
|
||||||
|
|
||||||
|
c = *(addr);
|
||||||
|
SSYNC();
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < words; i++)
|
||||||
|
*(sect_buf + i) = *(addr);
|
||||||
|
SSYNC();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < words; i++)
|
||||||
|
*(addr) = *(sect_buf + i);
|
||||||
|
SSYNC();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cf_ide_init(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_BFIN_TRUE_IDE)
|
||||||
|
/* Enable ATASEL when in True IDE mode */
|
||||||
|
printf("Using CF True IDE Mode\n");
|
||||||
|
cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_ENA);
|
||||||
|
udelay(1000);
|
||||||
|
#elif defined(CONFIG_BFIN_CF_IDE)
|
||||||
|
/* Disable ATASEL when we're in Common Memory Mode */
|
||||||
|
printf("Using CF Common Memory Mode\n");
|
||||||
|
cf_outb(0, (unsigned char *)CONFIG_CF_ATASEL_DIS);
|
||||||
|
udelay(1000);
|
||||||
|
#elif defined(CONFIG_BFIN_HDD_IDE)
|
||||||
|
printf("Using HDD IDE Mode\n");
|
||||||
|
#endif
|
||||||
|
ide_init();
|
||||||
|
}
|
Reference in New Issue
Block a user