tcc77x: add tcc77x_cscfg_bw() helper for external memory bus width setup

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22729 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Vitja Makarov 2009-09-18 05:48:37 +00:00
parent 05fd9ee182
commit 36e8fc0872
3 changed files with 15 additions and 2 deletions

View file

@ -900,7 +900,7 @@ int nand_init(void)
mutex_init(&ata_mtx);
#ifdef CPU_TCC77X
CSCFG2 = 0x318a8010;
CSCFG2 = 0x018a8010 | tcc77x_cscfg_bw(TCC77X_CSCFG_BW8);
GPIOC_FUNC &= ~(CS_GPIO_BIT | WE_GPIO_BIT);
GPIOC_FUNC |= 0x1;

View file

@ -128,7 +128,7 @@ static void _display_on(void)
void lcd_init_device(void)
{
/* Configure external memory banks */
CSCFG1 = 0x2d500023 | (((MCFG >> 11) & 1) << 28);
CSCFG1 = 0x0d500023 | tcc77x_cscfg_bw(TCC77X_CSCFG_BW16);
/* may be reset */
GPIOA |= 0x8000;

View file

@ -43,4 +43,17 @@ static inline void udelay(unsigned usecs)
while (TIME_BEFORE(USEC_TIMER, stop));
}
#define TCC77X_CSCFG_BW8 0
#define TCC77X_CSCFG_BW16 1
/* Due to hardware bug or "feature" this hack is needed to set bus width bits */
static inline
unsigned long tcc77x_cscfg_bw(int bw) {
if (bw == TCC77X_CSCFG_BW8)
return (((MCFG >> 11) & 3) ^ 3) << 28;
else
return (((MCFG >> 11) & 3) ^ 2) << 28;
}
#endif /* SYSTEM_TARGET_H */