Merge branch 'u-boot' of /home/mkr/git/u-boot-tq-group into bugfix

This commit is contained in:
Martin Krause 2007-10-23 08:30:06 +02:00
commit 341cc69d23
13 changed files with 170 additions and 73 deletions

View File

@ -301,10 +301,12 @@ LIST_83xx=" \
MPC8313ERDB_66 \ MPC8313ERDB_66 \
MPC8323ERDB \ MPC8323ERDB \
MPC832XEMDS \ MPC832XEMDS \
MPC832XEMDS_ATM \
MPC8349EMDS \ MPC8349EMDS \
MPC8349ITX \ MPC8349ITX \
MPC8349ITXGP \ MPC8349ITXGP \
MPC8360EMDS \ MPC8360EMDS \
MPC8360EMDS_ATM \
sbc8349 \ sbc8349 \
TQM834x \ TQM834x \
" "

View File

@ -1766,7 +1766,8 @@ MPC8323ERDB_config: unconfig
MPC832XEMDS_config \ MPC832XEMDS_config \
MPC832XEMDS_HOST_33_config \ MPC832XEMDS_HOST_33_config \
MPC832XEMDS_HOST_66_config \ MPC832XEMDS_HOST_66_config \
MPC832XEMDS_SLAVE_config: unconfig MPC832XEMDS_SLAVE_config \
MPC832XEMDS_ATM_config: unconfig
@mkdir -p $(obj)include @mkdir -p $(obj)include
@echo "" >$(obj)include/config.h ; \ @echo "" >$(obj)include/config.h ; \
if [ "$(findstring _HOST_,$@)" ] ; then \ if [ "$(findstring _HOST_,$@)" ] ; then \
@ -1781,11 +1782,18 @@ MPC832XEMDS_SLAVE_config: unconfig
if [ "$(findstring _33_,$@)" ] ; then \ if [ "$(findstring _33_,$@)" ] ; then \
echo -n "...33M ..." ; \ echo -n "...33M ..." ; \
echo "#define PCI_33M" >>$(obj)include/config.h ; \ echo "#define PCI_33M" >>$(obj)include/config.h ; \
echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
fi ; \ fi ; \
if [ "$(findstring _66_,$@)" ] ; then \ if [ "$(findstring _66_,$@)" ] ; then \
echo -n "...66M..." ; \ echo -n "...66M..." ; \
echo "#define PCI_66M" >>$(obj)include/config.h ; \ echo "#define PCI_66M" >>$(obj)include/config.h ; \
fi ; echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
fi ; \
if [ "$(findstring _ATM_,$@)" ] ; then \
echo -n "...ATM..." ; \
echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
echo "#define CONFIG_PQ_MDS_PIB_ATM 1" >>$(obj)include/config.h ; \
fi ;
@$(MKCONFIG) -a MPC832XEMDS ppc mpc83xx mpc832xemds freescale @$(MKCONFIG) -a MPC832XEMDS ppc mpc83xx mpc832xemds freescale
MPC8349EMDS_config: unconfig MPC8349EMDS_config: unconfig
@ -1808,7 +1816,8 @@ MPC8349ITXGP_config: unconfig
MPC8360EMDS_config \ MPC8360EMDS_config \
MPC8360EMDS_HOST_33_config \ MPC8360EMDS_HOST_33_config \
MPC8360EMDS_HOST_66_config \ MPC8360EMDS_HOST_66_config \
MPC8360EMDS_SLAVE_config: unconfig MPC8360EMDS_SLAVE_config \
MPC8360EMDS_ATM_config: unconfig
@mkdir -p $(obj)include @mkdir -p $(obj)include
@echo "" >$(obj)include/config.h ; \ @echo "" >$(obj)include/config.h ; \
if [ "$(findstring _HOST_,$@)" ] ; then \ if [ "$(findstring _HOST_,$@)" ] ; then \
@ -1823,10 +1832,17 @@ MPC8360EMDS_SLAVE_config: unconfig
if [ "$(findstring _33_,$@)" ] ; then \ if [ "$(findstring _33_,$@)" ] ; then \
echo -n "...33M ..." ; \ echo -n "...33M ..." ; \
echo "#define PCI_33M" >>$(obj)include/config.h ; \ echo "#define PCI_33M" >>$(obj)include/config.h ; \
echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
fi ; \ fi ; \
if [ "$(findstring _66_,$@)" ] ; then \ if [ "$(findstring _66_,$@)" ] ; then \
echo -n "...66M..." ; \ echo -n "...66M..." ; \
echo "#define PCI_66M" >>$(obj)include/config.h ; \ echo "#define PCI_66M" >>$(obj)include/config.h ; \
echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
fi ; \
if [ "$(findstring _ATM_,$@)" ] ; then \
echo -n "...ATM..." ; \
echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
echo "#define CONFIG_PQ_MDS_PIB_ATM 1" >>$(obj)include/config.h ; \
fi ; fi ;
@$(MKCONFIG) -a MPC8360EMDS ppc mpc83xx mpc8360emds freescale @$(MKCONFIG) -a MPC8360EMDS ppc mpc83xx mpc8360emds freescale

View File

@ -25,6 +25,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <i2c.h> #include <i2c.h>
#include <asm/io.h>
/* /*
* There are 2 versions of production Sequoia & Rainier platforms. * There are 2 versions of production Sequoia & Rainier platforms.
@ -39,7 +40,7 @@
* All Sequoias & Rainiers select from two possible EEPROMs in Boot * All Sequoias & Rainiers select from two possible EEPROMs in Boot
* Config F. One for 33MHz PCI, one for 66MHz PCI. The following * Config F. One for 33MHz PCI, one for 66MHz PCI. The following
* values are for the 33MHz PCI configuration. Byte 5 (0 base) is * values are for the 33MHz PCI configuration. Byte 5 (0 base) is
* the only value affected for a 66MHz PCI and simply needs a +0x10. * the only value affected for a 33MHz PCI and simply needs a | 0x08.
*/ */
#define NAND_COMPATIBLE 0x01 #define NAND_COMPATIBLE 0x01
@ -56,6 +57,7 @@ static char *config_labels[] = {
"CPU: 416 PLB: 166 OPB: 83 EBC: 55", "CPU: 416 PLB: 166 OPB: 83 EBC: 55",
"CPU: 500 PLB: 166 OPB: 83 EBC: 55", "CPU: 500 PLB: 166 OPB: 83 EBC: 55",
"CPU: 533 PLB: 133 OPB: 66 EBC: 66", "CPU: 533 PLB: 133 OPB: 66 EBC: 66",
"CPU: 667 PLB: 133 OPB: 66 EBC: 66",
"CPU: 667 PLB: 166 OPB: 83 EBC: 55", "CPU: 667 PLB: 166 OPB: 83 EBC: 55",
NULL NULL
}; };
@ -96,6 +98,11 @@ static u8 boot_configs[][17] = {
0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xa0, 0x30, 0x40, 0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xa0, 0x30, 0x40,
0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
}, },
{
(NOR_COMPATIBLE),
0x87, 0x78, 0xa2, 0x56, 0x09, 0x57, 0xa0, 0x30, 0x40,
0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
},
{ {
(NAND_COMPATIBLE | NOR_COMPATIBLE), (NAND_COMPATIBLE | NOR_COMPATIBLE),
0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xa0, 0x30, 0x40, 0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xa0, 0x30, 0x40,
@ -200,8 +207,12 @@ static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
} }
/* check CPLD register +5 for PCI 66MHz flag */ /* check CPLD register +5 for PCI 66MHz flag */
if (in8(CFG_BCSR_BASE + 5) & 0x01) if ((in_8((void *)(CFG_BCSR_BASE + 5)) & CFG_BCSR5_PCI66EN) == 0)
buf[5] += 0x10; /*
* PLB-to-PCI divisor = 3 for 33MHz sync PCI
* instead of 2 for 66MHz systems
*/
buf[5] |= 0x08;
if (i2c_write(I2C_EEPROM_ADDR, 0, 1, buf, 16) != 0) if (i2c_write(I2C_EEPROM_ADDR, 0, 1, buf, 16) != 0)
printf("Error writing to EEPROM at address 0x%x\n", I2C_EEPROM_ADDR); printf("Error writing to EEPROM at address 0x%x\n", I2C_EEPROM_ADDR);

View File

@ -1,5 +1,5 @@
/* /*
* (C) Copyright 2006 * (C) Copyright 2006-2007
* Stefan Roese, DENX Software Engineering, sr@denx.de. * Stefan Roese, DENX Software Engineering, sr@denx.de.
* *
* (C) Copyright 2006 * (C) Copyright 2006
@ -24,6 +24,7 @@
#include <common.h> #include <common.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/io.h>
#include <ppc440.h> #include <ppc440.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -362,8 +363,8 @@ int checkboard(void)
printf("Board: Rainier - AMCC PPC440GRx Evaluation Board"); printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
#endif #endif
rev = in8(CFG_BCSR_BASE + 0); rev = in_8((void *)(CFG_BCSR_BASE + 0));
val = in8(CFG_BCSR_BASE + 5) & 0x01; val = in_8((void *)(CFG_BCSR_BASE + 5)) & CFG_BCSR5_PCI66EN;
printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33); printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33);
if (s != NULL) { if (s != NULL) {

View File

@ -1,4 +1,6 @@
/* /*
* (C) Copyright 2006-2007
* Stefan Roese, DENX Software Engineering, sr@denx.de.
* *
* See file CREDITS for list of people who contributed to this * See file CREDITS for list of people who contributed to this
* project. * project.
@ -22,6 +24,7 @@
#include <common.h> #include <common.h>
#include <ppc4xx.h> #include <ppc4xx.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/io.h>
#include <spd_sdram.h> #include <spd_sdram.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -181,8 +184,8 @@ int checkboard(void)
printf("Board: Yellowstone - AMCC PPC440GR Evaluation Board"); printf("Board: Yellowstone - AMCC PPC440GR Evaluation Board");
#endif #endif
rev = *(u8 *)(CFG_CPLD + 0); rev = in_8((void *)(CFG_BCSR_BASE + 0));
val = *(u8 *)(CFG_CPLD + 5) & 0x01; val = in_8((void *)(CFG_BCSR_BASE + 5)) & CFG_BCSR5_PCI66EN;
printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33); printf(", Rev. %X, PCI=%d MHz", rev, val ? 66 : 33);
if (s != NULL) { if (s != NULL) {

View File

@ -79,19 +79,19 @@ int pib_init(void)
printf("QOC3 ATM card on PMC0\n"); printf("QOC3 ATM card on PMC0\n");
#elif defined(CONFIG_MPC832XEMDS) #elif defined(CONFIG_MPC832XEMDS)
val = 0; val8 = 0;
i2c_write(0x26, 0x7, 1, &val, 1); i2c_write(0x26, 0x7, 1, &val8, 1);
val = 0xf7; val8 = 0xf7;
i2c_write(0x26, 0x3, 1, &val, 1); i2c_write(0x26, 0x3, 1, &val8, 1);
val = 0; val8 = 0;
i2c_write(0x21, 0x6, 1, &val, 1); i2c_write(0x21, 0x6, 1, &val8, 1);
i2c_write(0x21, 0x7, 1, &val, 1); i2c_write(0x21, 0x7, 1, &val8, 1);
val = 0xdf; val8 = 0xdf;
i2c_write(0x21, 0x2, 1, &val, 1); i2c_write(0x21, 0x2, 1, &val8, 1);
val = 0xef; val8 = 0xef;
i2c_write(0x21, 0x3, 1, &val, 1); i2c_write(0x21, 0x3, 1, &val8, 1);
eieio(); eieio();

View File

@ -466,7 +466,7 @@ U_BOOT_CMD(
"\t'arg' can be the address of an initrd image\n" "\t'arg' can be the address of an initrd image\n"
#if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT) #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
"\tWhen booting a Linux kernel which requires a flat device-tree\n" "\tWhen booting a Linux kernel which requires a flat device-tree\n"
"\ta third argument is required which is the address of the of the\n" "\ta third argument is required which is the address of the\n"
"\tdevice-tree blob. To boot that kernel without an initrd image,\n" "\tdevice-tree blob. To boot that kernel without an initrd image,\n"
"\tuse a '-' for the second argument. If you do not pass a third\n" "\tuse a '-' for the second argument. If you do not pass a third\n"
"\ta bd_info struct will be passed instead\n" "\ta bd_info struct will be passed instead\n"

View File

@ -57,7 +57,7 @@ int do_dtt (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
U_BOOT_CMD( U_BOOT_CMD(
dtt, 1, 1, do_dtt, dtt, 1, 1, do_dtt,
"dtt - Digital Thermometer and Themostat\n", "dtt - Digital Thermometer and Thermostat\n",
" - Read temperature from digital thermometer and thermostat.\n" " - Read temperature from digital thermometer and thermostat.\n"
); );

View File

@ -948,19 +948,25 @@ unsigned int enable_ddr(unsigned int ddr_num)
* Read both dimm slots and decide whether * Read both dimm slots and decide whether
* or not to enable this controller. * or not to enable this controller.
*/ */
memset((void *)&spd1,0,sizeof(spd1)); memset((void *)&spd1, 0, sizeof(spd1));
memset((void *)&spd2,0,sizeof(spd2)); memset((void *)&spd2, 0, sizeof(spd2));
if (ddr_num == 1) { if (ddr_num == 1) {
CFG_READ_SPD(SPD_EEPROM_ADDRESS1, CFG_READ_SPD(SPD_EEPROM_ADDRESS1,
0, 1, (uchar *) &spd1, sizeof(spd1)); 0, 1, (uchar *) &spd1, sizeof(spd1));
#if defined(SPD_EEPROM_ADDRESS2)
CFG_READ_SPD(SPD_EEPROM_ADDRESS2, CFG_READ_SPD(SPD_EEPROM_ADDRESS2,
0, 1, (uchar *) &spd2, sizeof(spd2)); 0, 1, (uchar *) &spd2, sizeof(spd2));
#endif
} else { } else {
#if defined(SPD_EEPROM_ADDRESS3)
CFG_READ_SPD(SPD_EEPROM_ADDRESS3, CFG_READ_SPD(SPD_EEPROM_ADDRESS3,
0, 1, (uchar *) &spd1, sizeof(spd1)); 0, 1, (uchar *) &spd1, sizeof(spd1));
#endif
#if defined(SPD_EEPROM_ADDRESS4)
CFG_READ_SPD(SPD_EEPROM_ADDRESS4, CFG_READ_SPD(SPD_EEPROM_ADDRESS4,
0, 1, (uchar *) &spd2, sizeof(spd2)); 0, 1, (uchar *) &spd2, sizeof(spd2));
#endif
} }
/* /*
@ -1105,21 +1111,25 @@ spd_sdram(void)
{ {
int memsize_ddr1_dimm1 = 0; int memsize_ddr1_dimm1 = 0;
int memsize_ddr1_dimm2 = 0; int memsize_ddr1_dimm2 = 0;
int memsize_ddr1 = 0;
unsigned int law_size_ddr1;
volatile immap_t *immap = (immap_t *)CFG_IMMR;
volatile ccsr_ddr_t *ddr1 = &immap->im_ddr1;
volatile ccsr_local_mcm_t *mcm = &immap->im_local_mcm;
#if (CONFIG_NUM_DDR_CONTROLLERS > 1)
int memsize_ddr2_dimm1 = 0; int memsize_ddr2_dimm1 = 0;
int memsize_ddr2_dimm2 = 0; int memsize_ddr2_dimm2 = 0;
int memsize_total = 0;
int memsize_ddr1 = 0;
int memsize_ddr2 = 0; int memsize_ddr2 = 0;
unsigned int law_size_ddr2;
#endif
unsigned int ddr1_enabled = 0; unsigned int ddr1_enabled = 0;
unsigned int ddr2_enabled = 0; unsigned int ddr2_enabled = 0;
unsigned int law_size_ddr1; int memsize_total = 0;
unsigned int law_size_ddr2;
volatile immap_t *immap = (immap_t *)CFG_IMMR;
volatile ccsr_local_mcm_t *mcm = &immap->im_local_mcm;
#ifdef CONFIG_DDR_INTERLEAVE #ifdef CONFIG_DDR_INTERLEAVE
unsigned int law_size_interleaved; unsigned int law_size_interleaved;
volatile ccsr_ddr_t *ddr1 = &immap->im_ddr1;
volatile ccsr_ddr_t *ddr2 = &immap->im_ddr2; volatile ccsr_ddr_t *ddr2 = &immap->im_ddr2;
memsize_ddr1_dimm1 = spd_init(SPD_EEPROM_ADDRESS1, memsize_ddr1_dimm1 = spd_init(SPD_EEPROM_ADDRESS1,
@ -1194,9 +1204,11 @@ spd_sdram(void)
(unsigned int)memsize_total * 1024*1024); (unsigned int)memsize_total * 1024*1024);
memsize_total += memsize_ddr1_dimm1; memsize_total += memsize_ddr1_dimm1;
#if defined(SPD_EEPROM_ADDRESS2)
memsize_ddr1_dimm2 = spd_init(SPD_EEPROM_ADDRESS2, memsize_ddr1_dimm2 = spd_init(SPD_EEPROM_ADDRESS2,
1, 2, 1, 2,
(unsigned int)memsize_total * 1024*1024); (unsigned int)memsize_total * 1024*1024);
#endif
memsize_total += memsize_ddr1_dimm2; memsize_total += memsize_ddr1_dimm2;
/* /*

View File

@ -67,6 +67,22 @@ int usb_cpu_init()
int usb_cpu_stop() int usb_cpu_stop()
{ {
UHCHR |= UHCHR_FHR;
udelay(11);
UHCHR &= ~UHCHR_FHR;
UHCCOMS |= 1;
udelay(10);
#if defined(CONFIG_CPU_MONAHANS)
UHCHR |= UHCHR_SSEP0;
#endif
#if defined(CONFIG_PXA27X)
UHCHR |= UHCHR_SSEP2;
#endif
UHCHR |= UHCHR_SSEP1;
UHCHR |= UHCHR_SSE;
return 0; return 0;
} }

View File

@ -113,9 +113,9 @@ static const char hcd_name[] = "isp116x-hcd";
struct isp116x isp116x_dev; struct isp116x isp116x_dev;
struct isp116x_platform_data isp116x_board; struct isp116x_platform_data isp116x_board;
int got_rhsc = 0; /* root hub status change */ static int got_rhsc; /* root hub status change */
struct usb_device *devgone; /* device which was disconnected */ struct usb_device *devgone; /* device which was disconnected */
int rh_devnum = 0; /* address of Root Hub endpoint */ static int rh_devnum; /* address of Root Hub endpoint */
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -522,11 +522,13 @@ static int unpack_fifo(struct isp116x *isp116x, struct usb_device *dev,
done += PTD_GET_LEN(&ptd[i]); done += PTD_GET_LEN(&ptd[i]);
cc = PTD_GET_CC(&ptd[i]); cc = PTD_GET_CC(&ptd[i]);
if (cc == TD_DATAUNDERRUN) { /* underrun is no error... */
DBG("allowed data underrun"); /* Data underrun means basically that we had more buffer space than
cc = TD_CC_NOERROR; * the function had data. It is perfectly normal but upper levels have
} * to know how much we actually transferred.
if (cc != TD_CC_NOERROR && ret == TD_CC_NOERROR) */
if (cc == TD_NOTACCESSED ||
(cc != TD_CC_NOERROR && (ret == TD_CC_NOERROR || ret == TD_DATAUNDERRUN)))
ret = cc; ret = cc;
} }
@ -592,11 +594,19 @@ static int isp116x_interrupt(struct isp116x *isp116x)
return ret; return ret;
} }
#define PTD_NUM 64 /* it should be enougth... */ /* With one PTD we can transfer almost 1K in one go;
struct ptd ptd[PTD_NUM]; * HC does the splitting into endpoint digestible transactions
*/
struct ptd ptd[1];
static inline int max_transfer_len(struct usb_device *dev, unsigned long pipe) static inline int max_transfer_len(struct usb_device *dev, unsigned long pipe)
{ {
return min(PTD_NUM * usb_maxpacket(dev, pipe), PTD_NUM * 16); unsigned mpck = usb_maxpacket(dev, pipe);
/* One PTD can transfer 1023 bytes but try to always
* transfer multiples of endpoint buffer size
*/
return 1023 / mpck * mpck;
} }
/* Do an USB transfer /* Do an USB transfer
@ -610,13 +620,21 @@ static int isp116x_submit_job(struct usb_device *dev, unsigned long pipe,
int max = usb_maxpacket(dev, pipe); int max = usb_maxpacket(dev, pipe);
int dir_out = usb_pipeout(pipe); int dir_out = usb_pipeout(pipe);
int speed_low = usb_pipeslow(pipe); int speed_low = usb_pipeslow(pipe);
int i, done, stat, timeout, cc; int i, done = 0, stat, timeout, cc;
int retries = 10;
/* 500 frames or 0.5s timeout when function is busy and NAKs transactions for a while */
int retries = 500;
DBG("------------------------------------------------"); DBG("------------------------------------------------");
dump_msg(dev, pipe, buffer, len, "SUBMIT"); dump_msg(dev, pipe, buffer, len, "SUBMIT");
DBG("------------------------------------------------"); DBG("------------------------------------------------");
if (len >= 1024) {
ERR("Too big job");
dev->status = USB_ST_CRC_ERR;
return -1;
}
if (isp116x->disabled) { if (isp116x->disabled) {
ERR("EPIPE"); ERR("EPIPE");
dev->status = USB_ST_CRC_ERR; dev->status = USB_ST_CRC_ERR;
@ -653,29 +671,15 @@ static int isp116x_submit_job(struct usb_device *dev, unsigned long pipe,
isp116x_write_reg32(isp116x, HCINTSTAT, 0xff); isp116x_write_reg32(isp116x, HCINTSTAT, 0xff);
/* Prepare the PTD data */ /* Prepare the PTD data */
done = 0; ptd->count = PTD_CC_MSK | PTD_ACTIVE_MSK |
i = 0; PTD_TOGGLE(usb_gettoggle(dev, epnum, dir_out));
do { ptd->mps = PTD_MPS(max) | PTD_SPD(speed_low) | PTD_EP(epnum) | PTD_LAST_MSK;
ptd[i].count = PTD_CC_MSK | PTD_ACTIVE_MSK | ptd->len = PTD_LEN(len) | PTD_DIR(dir);
PTD_TOGGLE(usb_gettoggle(dev, epnum, dir_out)); ptd->faddr = PTD_FA(usb_pipedevice(pipe));
ptd[i].mps = PTD_MPS(max) | PTD_SPD(speed_low) | PTD_EP(epnum);
ptd[i].len = PTD_LEN(max > len - done ? len - done : max) |
PTD_DIR(dir);
ptd[i].faddr = PTD_FA(usb_pipedevice(pipe));
usb_dotoggle(dev, epnum, dir_out);
done += PTD_GET_LEN(&ptd[i]);
i++;
if (i >= PTD_NUM) {
ERR("****** Cannot pack buffer! ******");
dev->status = USB_ST_BUF_ERR;
return -1;
}
} while (done < len);
ptd[i - 1].mps |= PTD_LAST_MSK;
retry_same:
/* Pack data into FIFO ram */ /* Pack data into FIFO ram */
pack_fifo(isp116x, dev, pipe, ptd, i, buffer, len); pack_fifo(isp116x, dev, pipe, ptd, 1, buffer, len);
#ifdef EXTRA_DELAY #ifdef EXTRA_DELAY
wait_ms(EXTRA_DELAY); wait_ms(EXTRA_DELAY);
#endif #endif
@ -738,17 +742,42 @@ static int isp116x_submit_job(struct usb_device *dev, unsigned long pipe,
} }
/* Unpack data from FIFO ram */ /* Unpack data from FIFO ram */
cc = unpack_fifo(isp116x, dev, pipe, ptd, i, buffer, len); cc = unpack_fifo(isp116x, dev, pipe, ptd, 1, buffer, len);
/* Mmm... sometime we get 0x0f as cc which is a non sense! i = PTD_GET_COUNT(ptd);
* Just retry the transfer... done += i;
buffer += i;
len -= i;
/* There was some kind of real problem; Prepare the PTD again
* and retry from the failed transaction on
*/ */
if (cc == 0x0f && retries-- > 0) { if (cc && cc != TD_NOTACCESSED && cc != TD_DATAUNDERRUN) {
usb_dotoggle(dev, epnum, dir_out); if (retries >= 100) {
goto retry; retries -= 100;
/* The chip will have toggled the toggle bit for the failed
* transaction too. We have to toggle it back.
*/
usb_settoggle(dev, epnum, dir_out, !PTD_GET_TOGGLE(ptd));
goto retry;
}
}
/* "Normal" errors; TD_NOTACCESSED would mean in effect that the function have NAKed
* the transactions from the first on for the whole frame. It may be busy and we retry
* with the same PTD. PTD_ACTIVE (and not TD_NOTACCESSED) would mean that some of the
* PTD didn't make it because the function was busy or the frame ended before the PTD
* finished. We prepare the rest of the data and try again.
*/
else if (cc == TD_NOTACCESSED || PTD_GET_ACTIVE(ptd) || (cc != TD_DATAUNDERRUN && PTD_GET_COUNT(ptd) < PTD_GET_LEN(ptd))) {
if (retries) {
--retries;
if (cc == TD_NOTACCESSED && PTD_GET_ACTIVE(ptd) && !PTD_GET_COUNT(ptd)) goto retry_same;
usb_settoggle(dev, epnum, dir_out, PTD_GET_TOGGLE(ptd));
goto retry;
}
} }
if (cc != TD_CC_NOERROR) { if (cc != TD_CC_NOERROR && cc != TD_DATAUNDERRUN) {
DBG("****** completition code error %x ******", cc); DBG("****** completition code error %x ******", cc);
switch (cc) { switch (cc) {
case TD_CC_BITSTUFFING: case TD_CC_BITSTUFFING:
@ -766,6 +795,7 @@ static int isp116x_submit_job(struct usb_device *dev, unsigned long pipe,
} }
return -cc; return -cc;
} }
else usb_settoggle(dev, epnum, dir_out, PTD_GET_TOGGLE(ptd));
dump_msg(dev, pipe, buffer, len, "SUBMIT(ret)"); dump_msg(dev, pipe, buffer, len, "SUBMIT(ret)");
@ -1369,6 +1399,8 @@ int usb_lowlevel_init(void)
DBG(""); DBG("");
got_rhsc = rh_devnum = 0;
/* Init device registers addr */ /* Init device registers addr */
isp116x->addr_reg = (u16 *) ISP116X_HCD_ADDR; isp116x->addr_reg = (u16 *) ISP116X_HCD_ADDR;
isp116x->data_reg = (u16 *) ISP116X_HCD_DATA; isp116x->data_reg = (u16 *) ISP116X_HCD_DATA;

View File

@ -450,6 +450,8 @@
#define CFG_EBC_PB2AP 0x24814580 #define CFG_EBC_PB2AP 0x24814580
#define CFG_EBC_PB2CR (CFG_BCSR_BASE | 0x38000) #define CFG_EBC_PB2CR (CFG_BCSR_BASE | 0x38000)
#define CFG_BCSR5_PCI66EN 0x80
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* NAND FLASH * NAND FLASH
*----------------------------------------------------------------------*/ *----------------------------------------------------------------------*/

View File

@ -359,6 +359,8 @@
#define CFG_EBC_PB2AP 0x04814500 #define CFG_EBC_PB2AP 0x04814500
#define CFG_EBC_PB2CR (CFG_CPLD | 0x18000) #define CFG_EBC_PB2CR (CFG_CPLD | 0x18000)
#define CFG_BCSR5_PCI66EN 0x80
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* Cache Configuration * Cache Configuration
*/ */