Commit 79fa88f3 authored by wdenk's avatar wdenk

Patch by Pantelis Antoniou, 5 May 2004:

- Intracom board update.
- Add Codec POST.
parent cea655a2
......@@ -2,6 +2,10 @@
Changes since U-Boot 1.1.1:
======================================================================
* Patch by Pantelis Antoniou, 5 May 2004:
- Intracom board update.
- Add Codec POST.
* Add support for the second Ethernet interface for the 'PPChameleon'
board.
......
......@@ -33,22 +33,23 @@ LIST_5xxx=" \
#########################################################################
LIST_8xx=" \
AdderII ADS860 AMX860 c2mon \
CCM cogent_mpc8xx MPC885ADS ESTEEM192E \
ETX094 ELPT860 FADS823 FADS850SAR \
FADS860T FLAGADM FPS850L GEN860T \
GEN860T_SC GENIETV GTH hermes \
IAD210 ICU862_100MHz IP860 IVML24 \
IVML24_128 IVML24_256 IVMS8 IVMS8_128 \
IVMS8_256 KUP4K KUP4X LANTEC \
lwmon MBX MBX860T MHPC \
MPC86xADS MVS1 NETVIA NETVIA_V2 \
NX823 pcu_e QS823 QS850 \
QS860T R360MPI RBC823 rmu \
RPXClassic RPXlite RRvision SM850 \
SPD823TS svm_sc8xx SXNI855T TOP860 \
TQM823L TQM823L_LCD TQM850L TQM855L \
TQM860L v37 NETTA NETPHONE \
ADS860 ICU862_100MHz NETPHONE SPD823TS \
AMX860 IP860 NETTA SXNI855T \
AdderII IVML24 NETTA2 TOP860 \
CCM IVML24_128 NETTA_ISDN TQM823L \
ELPT860 IVML24_256 NETVIA TQM823L_LCD \
ESTEEM192E IVMS8 NETVIA_V2 TQM850L \
ETX094 IVMS8_128 NX823 TQM855L \
FADS823 IVMS8_256 QS823 TQM860L \
FADS850SAR KUP4K QS850 c2mon \
FADS860T KUP4X QS860T cogent_mpc8xx \
FLAGADM LANTEC R360MPI hermes \
FPS850L MBX RBC823 lwmon \
GEN860T MBX860T RPXClassic pcu_e \
GEN860T_SC MHPC RPXlite rmu \
GENIETV MPC86xADS RRvision svm_sc8xx \
GTH MPC885ADS SM850 v37 \
IAD210 MVS1
"
#########################################################################
......
......@@ -417,19 +417,50 @@ NETPHONE_config: unconfig
}
@./mkconfig -a $(call xtract_NETPHONE,$@) ppc mpc8xx netphone
xtract_NETTA = $(subst _ISDN,,$(subst _config,,$1))
xtract_NETTA = $(subst _SWAPHOOK,,$(subst _6412,,$(subst _ISDN,,$(subst _config,,$1))))
NETTA_ISDN_6412_SWAPHOOK_config \
NETTA_ISDN_SWAPHOOK_config \
NETTA_6412_SWAPHOOK_config \
NETTA_SWAPHOOK_config \
NETTA_ISDN_6412_config \
NETTA_ISDN_config \
NETTA_6412_config \
NETTA_config: unconfig
@ >include/config.h
@[ -z "$(findstring NETTA_config,$@)" ] || \
@[ -z "$(findstring ISDN_,$@)" ] || \
{ echo "#define CONFIG_NETTA_ISDN 1" >>include/config.h ; \
}
@[ -n "$(findstring ISDN_,$@)" ] || \
{ echo "#undef CONFIG_NETTA_ISDN" >>include/config.h ; \
}
@[ -z "$(findstring NETTA_ISDN_config,$@)" ] || \
{ echo "#define CONFIG_NETTA_ISDN 1" >>include/config.h ; \
@[ -z "$(findstring 6412_,$@)" ] || \
{ echo "#define CONFIG_NETTA_6412 1" >>include/config.h ; \
}
@[ -n "$(findstring 6412_,$@)" ] || \
{ echo "#undef CONFIG_NETTA_6412" >>include/config.h ; \
}
@[ -z "$(findstring SWAPHOOK_,$@)" ] || \
{ echo "#define CONFIG_NETTA_SWAPHOOK 1" >>include/config.h ; \
}
@[ -n "$(findstring SWAPHOOK_,$@)" ] || \
{ echo "#undef CONFIG_NETTA_SWAPHOOK" >>include/config.h ; \
}
@./mkconfig -a $(call xtract_NETTA,$@) ppc mpc8xx netta
xtract_NETTA2 = $(subst _V2,,$(subst _config,,$1))
NETTA2_V2_config \
NETTA2_config: unconfig
@ >include/config.h
@[ -z "$(findstring NETTA2_config,$@)" ] || \
{ echo "#define CONFIG_NETTA2_VERSION 1" >>include/config.h ; \
}
@[ -z "$(findstring NETTA2_V2_config,$@)" ] || \
{ echo "#define CONFIG_NETTA2_VERSION 2" >>include/config.h ; \
}
@./mkconfig -a $(call xtract_NETTA2,$@) ppc mpc8xx netta2
NX823_config: unconfig
@./mkconfig $(@:_config=) ppc mpc8xx nx823
......
......@@ -87,21 +87,22 @@ unsigned long flash_init(void)
#if CONFIG_NETPHONE_VERSION == 2
size1 = flash_get_size((vu_long *) FLASH_BASE4_PRELIM, &flash_info[1]);
if (size1 > 0) {
if (flash_info[1].flash_id == FLASH_UNKNOWN)
printf("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n", size1, size1 << 20);
if (flash_info[1].flash_id == FLASH_UNKNOWN && size1 > 0) {
printf("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n", size1, size1 << 20);
}
/* Remap FLASH according to real size */
memctl->memc_or4 = CFG_OR_TIMING_FLASH | (-size1 & 0xFFFF8000);
memctl->memc_br4 = (CFG_FLASH_BASE4 & BR_BA_MSK) | (memctl->memc_br4 & ~(BR_BA_MSK));
/* Remap FLASH according to real size */
memctl->memc_or4 = CFG_OR_TIMING_FLASH | (-size1 & 0xFFFF8000);
memctl->memc_br4 = (CFG_FLASH_BASE4 & BR_BA_MSK) | (memctl->memc_br4 & ~(BR_BA_MSK));
/* Re-do sizing to get full correct info */
size1 = flash_get_size((vu_long *) CFG_FLASH_BASE4, &flash_info[1]);
/* Re-do sizing to get full correct info */
size1 = flash_get_size((vu_long *) CFG_FLASH_BASE4, &flash_info[1]);
flash_get_offsets(CFG_FLASH_BASE4, &flash_info[1]);
flash_get_offsets(CFG_FLASH_BASE4, &flash_info[1]);
size += size1;
size += size1;
} else
memctl->memc_br4 &= ~BR_V;
#endif
return (size);
......
......@@ -12,7 +12,7 @@
*
* 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
* 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
......@@ -52,7 +52,7 @@
/*************************************************************************************************/
#define DISPLAY_BACKLIT_PORT ((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat
#define DISPLAY_BACKLIT_MASK 0x0010
#define DISPLAY_BACKLIT_MASK 0x0010
/*************************************************************************************************/
......@@ -63,23 +63,23 @@
#define KP_IDLE_DELAY_HZ (CFG_HZ/2) /* key was released and idle */
#if CONFIG_NETPHONE_VERSION == 1
#define KP_SPI_RXD_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_RXD_MASK 0x0008
#define KP_SPI_RXD_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_RXD_MASK 0x0008
#define KP_SPI_TXD_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_TXD_MASK 0x0004
#define KP_SPI_TXD_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_TXD_MASK 0x0004
#define KP_SPI_CLK_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_CLK_MASK 0x0001
#define KP_SPI_CLK_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
#define KP_SPI_CLK_MASK 0x0001
#elif CONFIG_NETPHONE_VERSION == 2
#define KP_SPI_RXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_RXD_MASK 0x00000008
#define KP_SPI_RXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_RXD_MASK 0x00000008
#define KP_SPI_TXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_TXD_MASK 0x00000004
#define KP_SPI_TXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_TXD_MASK 0x00000004
#define KP_SPI_CLK_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_CLK_MASK 0x00000002
#define KP_SPI_CLK_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
#define KP_SPI_CLK_MASK 0x00000002
#endif
#define KP_CS_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat)
......@@ -115,8 +115,8 @@
KP_CS_PORT &= ~KP_CS_MASK; \
} while(0)
#define KP_ROWS 7
#define KP_COLS 4
#define KP_ROWS 7
#define KP_COLS 4
#define KP_ROWS_MASK ((1 << KP_ROWS) - 1)
#define KP_COLS_MASK ((1 << KP_COLS) - 1)
......@@ -124,29 +124,29 @@
#define SCAN 0
#define SCAN_FILTER 1
#define SCAN_COL 2
#define SCAN_COL_FILTER 3
#define SCAN_COL_FILTER 3
#define PRESSED 4
#define KP_F1 0 /* leftmost dot (tab) */
#define KP_F2 1 /* middle left dot */
#define KP_F3 2 /* up */
#define KP_F4 3 /* middle right dot */
#define KP_F5 4 /* rightmost dot */
#define KP_F6 5 /* C */
#define KP_F7 6 /* left */
#define KP_F8 7 /* down */
#define KP_F9 8 /* right */
#define KP_F10 9 /* enter */
#define KP_F11 10 /* R */
#define KP_F12 11 /* save */
#define KP_F13 12 /* redial */
#define KP_F14 13 /* speaker */
#define KP_F15 14 /* unused */
#define KP_F16 15 /* unused */
#define KP_RELEASE -1 /* key depressed */
#define KP_FORCE -2 /* key was pressed for more than force hz */
#define KP_IDLE -3 /* key was released and idle */
#define KP_F1 0 /* leftmost dot (tab) */
#define KP_F2 1 /* middle left dot */
#define KP_F3 2 /* up */
#define KP_F4 3 /* middle right dot */
#define KP_F5 4 /* rightmost dot */
#define KP_F6 5 /* C */
#define KP_F7 6 /* left */
#define KP_F8 7 /* down */
#define KP_F9 8 /* right */
#define KP_F10 9 /* enter */
#define KP_F11 10 /* R */
#define KP_F12 11 /* save */
#define KP_F13 12 /* redial */
#define KP_F14 13 /* speaker */
#define KP_F15 14 /* unused */
#define KP_F16 15 /* unused */
#define KP_RELEASE -1 /* key depressed */
#define KP_FORCE -2 /* key was pressed for more than force hz */
#define KP_IDLE -3 /* key was released and idle */
#define KP_1 '1'
#define KP_2 '2'
......@@ -158,8 +158,8 @@
#define KP_8 '8'
#define KP_9 '9'
#define KP_0 '0'
#define KP_STAR '*'
#define KP_HASH '#'
#define KP_STAR '*'
#define KP_HASH '#'
/*************************************************************************************************/
......@@ -198,7 +198,7 @@ static const char *whspace = " 0\n";
/* per mode character select (for 2-9) */
static const char *digits_sel[2][8] = {
{ /* small */
"abc2", /* 2 */
"abc2", /* 2 */
"def3", /* 3 */
"ghi4", /* 4 */
"jkl5", /* 5 */
......@@ -206,8 +206,8 @@ static const char *digits_sel[2][8] = {
"pqrs7", /* 7 */
"tuv8", /* 8 */
"wxyz9", /* 9 */
}, { /* capital */
"ABC2", /* 2 */
}, { /* capital */
"ABC2", /* 2 */
"DEF3", /* 3 */
"GHI4", /* 4 */
"JKL5", /* 5 */
......@@ -810,10 +810,10 @@ static void ensure_visible(int col, int row, int dx, int dy)
/* move to easier to use vars */
x1 = disp_col; y1 = disp_row;
x1 = disp_col; y1 = disp_row;
x2 = x1 + width; y2 = y1 + height;
a1 = col; b1 = row;
a2 = a1 + dx; b2 = b1 + dy;
a1 = col; b1 = row;
a2 = a1 + dx; b2 = b1 + dy;
/* printf("(%d,%d) - (%d,%d) : (%d, %d) - (%d, %d)\n", x1, y1, x2, y2, a1, b1, a2, b2); */
......@@ -891,7 +891,7 @@ void phone_putc(const char c)
blink_time = BLINK_HZ;
switch (c) {
case '\a': /* ignore bell */
case '\a': /* ignore bell */
case '\r': /* ignore carriage return */
break;
......@@ -900,7 +900,7 @@ void phone_putc(const char c)
ensure_visible(curs_col, curs_row, 1, 1);
break;
case 9: /* tab 8 */
case 9: /* tab 8 */
/* move to tab */
i = curs_col;
i |= 0x0008;
......@@ -1006,13 +1006,13 @@ unsigned int kp_get_col_mask(unsigned int row_mask)
/**************************************************************************************/
static const int kp_scancodes[KP_ROWS * KP_COLS] = {
KP_F1, KP_F3, KP_F4, KP_F2,
KP_F6, KP_F8, KP_F9, KP_F7,
KP_1, KP_3, KP_F11, KP_2,
KP_4, KP_6, KP_F12, KP_5,
KP_7, KP_9, KP_F13, KP_8,
KP_F1, KP_F3, KP_F4, KP_F2,
KP_F6, KP_F8, KP_F9, KP_F7,
KP_1, KP_3, KP_F11, KP_2,
KP_4, KP_6, KP_F12, KP_5,
KP_7, KP_9, KP_F13, KP_8,
KP_STAR, KP_HASH, KP_F14, KP_0,
KP_F5, KP_F15, KP_F16, KP_F10,
KP_F5, KP_F15, KP_F16, KP_F10,
};
static const int kp_repeats[KP_ROWS * KP_COLS] = {
......
......@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = lib$(BOARD).a
OBJS = $(BOARD).o flash.o dsp.o
OBJS = $(BOARD).o flash.o dsp.o codec.o
$(LIB): .depend $(OBJS)
$(AR) crv $@ $(OBJS)
......
This diff is collapsed.
/*
* Intracom TI6711 DSP
* Intracom TI6711/TI6412 DSP
*/
#include <common.h>
......@@ -12,6 +12,38 @@ struct ram_range {
u32 size;
};
#if defined(CONFIG_NETTA_6412)
static const struct ram_range int_ram[] = {
{ 0x00000000U, 0x00040000U },
};
static const struct ram_range ext_ram[] = {
{ 0x80000000U, 0x00100000U },
};
static const struct ram_range ranges[] = {
{ 0x00000000U, 0x00040000U },
{ 0x80000000U, 0x00100000U },
};
static inline u16 bit_invert(u16 d)
{
register u8 i;
register u16 r;
register u16 bit;
r = 0;
for (i = 0; i < 16; i++) {
bit = d & (1 << i);
if (bit != 0)
r |= 1 << (15 - i);
}
return r;
}
#else
static const struct ram_range int_ram[] = {
{ 0x00000000U, 0x00010000U },
};
......@@ -25,6 +57,8 @@ static const struct ram_range ranges[] = {
{ 0x80000000U, 0x00100000U },
};
#endif
/*******************************************************************************************************/
static inline int addr_in_int_ram(u32 addr)
......@@ -62,8 +96,11 @@ static volatile u32 *ti6711_delay = &dummy_delay;
static inline void dsp_go_slow(void)
{
volatile memctl8xx_t *memctl = &((immap_t *)CFG_IMMR)->im_memctl;
#if defined(CONFIG_NETTA_6412)
memctl->memc_or6 |= OR_SCY_15_CLK | OR_TRLX;
#else
memctl->memc_or2 |= OR_SCY_15_CLK | OR_TRLX;
#endif
memctl->memc_or5 |= OR_SCY_15_CLK | OR_TRLX;
ti6711_delay = (u32 *)DUMMY_BASE;
......@@ -72,8 +109,11 @@ static inline void dsp_go_slow(void)
static inline void dsp_go_fast(void)
{
volatile memctl8xx_t *memctl = &((immap_t *)CFG_IMMR)->im_memctl;
#if defined(CONFIG_NETTA_6412)
memctl->memc_or6 = (memctl->memc_or6 & ~(OR_SCY_15_CLK | OR_TRLX)) | OR_SCY_0_CLK;
#else
memctl->memc_or2 = (memctl->memc_or2 & ~(OR_SCY_15_CLK | OR_TRLX)) | OR_SCY_3_CLK;
#endif
memctl->memc_or5 = (memctl->memc_or5 & ~(OR_SCY_15_CLK | OR_TRLX)) | OR_SCY_0_CLK;
ti6711_delay = &dummy_delay;
......@@ -89,62 +129,50 @@ static inline void dsp_delay(void)
static inline u16 dsp_read_hpic(void)
{
#if defined(CONFIG_NETTA_6412)
return bit_invert(*((volatile u16 *)DSP_BASE));
#else
return *((volatile u16 *)DSP_BASE);
#endif
}
static inline void dsp_write_hpic(u16 val)
{
#if defined(CONFIG_NETTA_6412)
*((volatile u16 *)DSP_BASE) = bit_invert(val);
#else
*((volatile u16 *)DSP_BASE) = val;
#endif
}
static inline void dsp_reset(void)
{
#if defined(CONFIG_NETTA_6412)
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pddat &= ~(1 << (15 - 15));
udelay(500);
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pddat |= (1 << (15 - 15));
udelay(500);
#else
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pddat &= ~(1 << (15 - 7));
udelay(250);
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pddat |= (1 << (15 - 7));
udelay(250);
}
static inline void dsp_init_hpic(void)
{
int i;
volatile u16 *p;
dsp_go_slow();
i = 0;
while (i < 1000 && (dsp_read_hpic() & 0x08) == 0) {
dsp_delay();
i++;
}
dsp_delay();
/* write control register */
p = (volatile u16 *)DSP_BASE;
p[0] = 0x0000;
dsp_delay();
p[1] = 0x0000;
dsp_delay();
dsp_go_fast();
}
static inline void dsp_wait_hrdy(void)
{
int i;
i = 0;
while (i < 1000 && (dsp_read_hpic() & 0x08) == 0) {
dsp_delay();
i++;
}
#endif
}
static inline u32 dsp_read_hpic_word(u32 addr)
{
u32 val;
volatile u16 *p;
#if defined(CONFIG_NETTA_6412)
p = (volatile u16 *)((volatile u8 *)DSP_BASE + addr);
val = ((u32) bit_invert(p[0]) << 16);
/* dsp_delay(); */
val |= bit_invert(p[1]);
/* dsp_delay(); */
#else
p = (volatile u16 *)((volatile u8 *)DSP_BASE + addr);
val = ((u32) p[0] << 16);
......@@ -152,40 +180,80 @@ static inline u32 dsp_read_hpic_word(u32 addr)
val |= p[1];
dsp_delay();
#endif
return val;
}
static inline u16 dsp_read_hpic_hi_hword(u32 addr)
{
#if defined(CONFIG_NETTA_6412)
return bit_invert(*(volatile u16 *)((volatile u8 *)DSP_BASE + addr));
#else
return *(volatile u16 *)((volatile u8 *)DSP_BASE + addr);
#endif
}
static inline u16 dsp_read_hpic_lo_hword(u32 addr)
{
#if defined(CONFIG_NETTA_6412)
return bit_invert(*(volatile u16 *)((volatile u8 *)DSP_BASE + addr + 2));
#else
return *(volatile u16 *)((volatile u8 *)DSP_BASE + addr + 2);
#endif
}
static inline void dsp_wait_hrdy(void)
{
int i;
i = 0;
#if defined(CONFIG_NETTA_6412)
while (i < 1000 && (dsp_read_hpic_word(DSP_HPIC) & 0x08) == 0) {
#else
while (i < 1000 && (dsp_read_hpic() & 0x08) == 0) {
#endif
dsp_delay();
i++;
}
}
static inline void dsp_write_hpic_word(u32 addr, u32 val)
{
volatile u16 *p;
#if defined(CONFIG_NETTA_6412)
p = (volatile u16 *)((volatile u8 *)DSP_BASE + addr);
p[0] = bit_invert((u16)(val >> 16));
/* dsp_delay(); */
p[1] = bit_invert((u16)val);
/* dsp_delay(); */
#else
p = (volatile u16 *)((volatile u8 *)DSP_BASE + addr);
p[0] = (u16)(val >> 16);
dsp_delay();
p[1] = (u16)val;
dsp_delay();
#endif
}
static inline void dsp_write_hpic_hi_hword(u32 addr, u16 val_h)
{
#if defined(CONFIG_NETTA_6412)
*(volatile u16 *)((volatile u8 *)DSP_BASE + addr) = bit_invert(val_h);
#else
*(volatile u16 *)((volatile u8 *)DSP_BASE + addr) = val_h;
#endif
}
static inline void dsp_write_hpic_lo_hword(u32 addr, u16 val_l)
{
#if defined(CONFIG_NETTA_6412)
*(volatile u16 *)((volatile u8 *)DSP_BASE + addr + 2) = bit_invert(val_l);
#else
*(volatile u16 *)((volatile u8 *)DSP_BASE + addr + 2) = val_l;
#endif
}
/********************************************************************/
......@@ -193,21 +261,29 @@ static inline void dsp_write_hpic_lo_hword(u32 addr, u16 val_l)
static inline void c62_write_word(u32 addr, u32 val)
{
dsp_write_hpic_hi_hword(DSP_HPIA, (u16)(addr >> 16));
#if !defined(CONFIG_NETTA_6412)
dsp_delay();
#endif
dsp_write_hpic_lo_hword(DSP_HPIA, (u16)addr);
#if !defined(CONFIG_NETTA_6412)
dsp_delay();
#endif
dsp_wait_hrdy();
#if !defined(CONFIG_NETTA_6412)
dsp_delay();
#endif
dsp_write_hpic_hi_hword(DSP_HPID2, (u16)(val >> 16));
#if !defined(CONFIG_NETTA_6412)
dsp_delay();
dsp_wait_hrdy();
dsp_delay();
/* dsp_wait_hrdy();
dsp_delay(); */
#endif
dsp_write_hpic_lo_hword(DSP_HPID2, (u16)val);
#if !defined(CONFIG_NETTA_6412)
dsp_delay();
#endif
}
static u32 c62_read_word(u32 addr)
......@@ -215,26 +291,36 @@ static u32 c62_read_word(u32 addr)
u32 val;
dsp_write_hpic_hi_hword(DSP_HPIA, (u16)(addr >> 16));