From clang at gateworks.com Tue Dec 8 13:25:18 2009 From: clang at gateworks.com (clang at gateworks.com) Date: Tue, 08 Dec 2009 13:25:18 -0800 Subject: [Avila] Gateworks SVN Commit r94 - in trunk/u-boot-pismo: . board/mv_feroceon/mv_dd board/mv_feroceon/mv_hal/twsi common drivers include Message-ID: Author: clang Date: 2009-12-08 13:25:17 -0800 (Tue, 08 Dec 2009) New Revision: 94 Modified: trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mvSysHwConfig.h trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mv_main.c trunk/u-boot-pismo/board/mv_feroceon/mv_hal/twsi/mvTwsi.c trunk/u-boot-pismo/common/cmd_eeprom.c trunk/u-boot-pismo/common/cmd_i2c.c trunk/u-boot-pismo/drivers/cfi_flash.c trunk/u-boot-pismo/include/i2c.h trunk/u-boot-pismo/u-boot.bin Log: Update CFI driver for larger buffered parts. Update i2c commands to work correctly. Include USB support. Write i2c byte to GSP in order to avoid contention on the reset line during bootup. Modified: trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mvSysHwConfig.h =================================================================== --- trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mvSysHwConfig.h 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mvSysHwConfig.h 2009-12-08 21:25:17 UTC (rev 94) @@ -41,7 +41,7 @@ #define MV_INCLUDE_IDMA #define MV_INCLUDE_XOR #undef MV_INCLUDE_SPI -#undef MV_INCLUDE_USB +#define MV_INCLUDE_USB /*********************************************/ /* Board Specific defines : On-Board devices */ /*********************************************/ Modified: trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mv_main.c =================================================================== --- trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mv_main.c 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/board/mv_feroceon/mv_dd/mv_main.c 2009-12-08 21:25:17 UTC (rev 94) @@ -210,9 +210,9 @@ } #else - mvCtrlPwrClckSet(USB_UNIT_ID, 0, MV_FALSE); - mvCtrlPwrClckSet(USB_UNIT_ID, 1, MV_FALSE); - mvCtrlPwrClckSet(USB_UNIT_ID, 2, MV_FALSE); + //mvCtrlPwrClckSet(USB_UNIT_ID, 0, MV_FALSE); + //mvCtrlPwrClckSet(USB_UNIT_ID, 1, MV_FALSE); + //mvCtrlPwrClckSet(USB_UNIT_ID, 2, MV_FALSE); mvCtrlPwrClckSet(SATA_UNIT_ID, 0, MV_FALSE); mvCtrlPwrClckSet(SATA_UNIT_ID, 1, MV_FALSE); mvCtrlPwrClckSet(TDM_UNIT_ID, 0, MV_FALSE); @@ -243,7 +243,6 @@ unsigned char yuk_enetaddr[6]; extern int interrupt_init (void); extern void i2c_init(int speed, int slaveaddr); - int cpuMapInit (void) { #ifndef MV_TINY_IMAGE @@ -267,7 +266,6 @@ unsigned int i; MV_REG_WRITE(0x10120, (0x1 << 18)) //MV_REG_WRITE_ASM(r6, r1, 0x10124); - maskAllInt(); if (whoAmI() == MASTER_CPU) @@ -281,7 +279,6 @@ for (i = 0; i < MV_TWSI_MAX_CHAN; i++) mvTwsiInit(i, CFG_I2C_SPEED, CFG_TCLK, &slave, 0); #endif - /* Init the Board environment module (device bank params init) */ mvBoardEnvInit(); } @@ -985,6 +982,7 @@ int misc_init_r (void) { char name[128]; + uchar byte = 0xff; if (whoAmI() == MASTER_CPU) { @@ -1027,7 +1025,8 @@ { mvBoardDebug7Seg(7); } - + i2c_write(1, 0x23, 0x7 , 1, &byte, 1); + return 0; } Modified: trunk/u-boot-pismo/board/mv_feroceon/mv_hal/twsi/mvTwsi.c =================================================================== --- trunk/u-boot-pismo/board/mv_feroceon/mv_hal/twsi/mvTwsi.c 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/board/mv_feroceon/mv_hal/twsi/mvTwsi.c 2009-12-08 21:25:17 UTC (rev 94) @@ -367,6 +367,9 @@ } } DB(mvOsPrintf("TWSI: mvTwsiInit - actN %d actM %d actFreq %d\n",actualN , actualM, actualFreq)); + actualM = 6; + actualN = 5; + /* Reset the TWSI logic */ twsiReset(chanNum); Modified: trunk/u-boot-pismo/common/cmd_eeprom.c =================================================================== --- trunk/u-boot-pismo/common/cmd_eeprom.c 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/common/cmd_eeprom.c 2009-12-08 21:25:17 UTC (rev 94) @@ -184,7 +184,7 @@ #ifdef CONFIG_SPI spi_read (addr, alen, buffer, len); #else - if (i2c_read (addr[0], offset, alen-1, buffer, len) != 0) + if (i2c_read (1, addr[0], offset, alen-1, buffer, len) != 0) rcode = 1; #endif buffer += len; @@ -294,7 +294,7 @@ addr_void[0] |= CFG_I2C_EEPROM_ADDR; #endif contr_reg[0] = 0xff; - if (i2c_read (contr_r_addr[0], contr_r_addr[1], 1, contr_reg, 1) != 0) { + if (i2c_read (1, contr_r_addr[0], contr_r_addr[1], 1, contr_reg, 1) != 0) { rcode = 1; } ctrl_reg_v = contr_reg[0]; @@ -309,21 +309,21 @@ /* Set write enable latch. */ contr_reg[0] = 0x02; - if (i2c_write (contr_r_addr[0], 0xff, 1, contr_reg, 1) != 0) { + if (i2c_write (1, contr_r_addr[0], 0xff, 1, contr_reg, 1) != 0) { rcode = 1; } /* Set register write enable latch. */ contr_reg[0] = 0x06; - if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { + if (i2c_write (1, contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { rcode = 1; } /* Modify ctrl register. */ contr_reg[0] = ctrl_reg_v; - if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { + if (i2c_write (1, contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { rcode = 1; } @@ -337,7 +337,7 @@ */ contr_reg[0] = 0; for (i = 0; i < MAX_ACKNOWLEDGE_POLLS; i++) { - if (i2c_read (addr_void[0], addr_void[1], 1, contr_reg, 1) == 0) + if (i2c_read (1, addr_void[0], addr_void[1], 1, contr_reg, 1) == 0) break; /* got ack */ #if defined(CFG_EEPROM_PAGE_WRITE_DELAY_MS) udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000); @@ -355,14 +355,14 @@ /* Set write enable latch. */ contr_reg[0] = 0x02; - if (i2c_write (contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { + if (i2c_write (1, contr_r_addr[0], 0xFF, 1, contr_reg, 1) != 0) { rcode = 1; } } /* Write is enabled ... now write eeprom value. */ #endif - if (i2c_write (addr[0], offset, alen-1, buffer, len) != 0) + if (i2c_write (1, addr[0], offset, alen-1, buffer, len) != 0) rcode = 1; #endif Modified: trunk/u-boot-pismo/common/cmd_i2c.c =================================================================== --- trunk/u-boot-pismo/common/cmd_i2c.c 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/common/cmd_i2c.c 2009-12-08 21:25:17 UTC (rev 94) @@ -185,7 +185,7 @@ linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; - if(i2c_read(chip, addr, alen, linebuf, linebytes) != 0) { + if(i2c_read(1, chip, addr, alen, linebuf, linebytes) != 0) { puts ("Error reading the chip.\n"); } else { printf("%04x:", addr); @@ -284,7 +284,7 @@ } while (count-- > 0) { - if(i2c_write(chip, addr++, alen, &byte, 1) != 0) { + if(i2c_write(1, chip, addr++, alen, &byte, 1) != 0) { puts ("Error writing the chip.\n"); } /* @@ -372,7 +372,7 @@ crc = 0; err = 0; while(count-- > 0) { - if(i2c_read(chip, addr, alen, &byte, 1) != 0) { + if(i2c_read(1, chip, addr, alen, &byte, 1) != 0) { err++; } crc = crc32 (crc, &byte, 1); @@ -461,7 +461,7 @@ */ do { printf("%08lx:", addr); - if(i2c_read(chip, addr, alen, (uchar *)&data, size) != 0) { + if(i2c_read(1, chip, addr, alen, (uchar *)&data, size) != 0) { puts ("\nError reading the chip,\n"); } else { data = cpu_to_be32(data); @@ -510,7 +510,7 @@ */ reset_cmd_timeout(); #endif - if(i2c_write(chip, addr, alen, (uchar *)&data, size) != 0) { + if(i2c_write(1, chip, addr, alen, (uchar *)&data, size) != 0) { puts ("Error writing the chip.\n"); } #ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS @@ -648,7 +648,7 @@ * Run the loop... */ while(1) { - if(i2c_read(chip, addr, alen, bytes, length) != 0) { + if(i2c_read(1, chip, addr, alen, bytes, length) != 0) { puts ("Error reading the chip.\n"); } udelay(delay); @@ -685,7 +685,7 @@ */ chip = simple_strtoul(argv[1], NULL, 16); - if(i2c_read(chip, 0, 1, data, sizeof(data)) != 0) { + if(i2c_read(1, chip, 0, 1, data, sizeof(data)) != 0) { puts ("No SDRAM Serial Presence Detect found.\n"); return 1; } Modified: trunk/u-boot-pismo/drivers/cfi_flash.c =================================================================== --- trunk/u-boot-pismo/drivers/cfi_flash.c 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/drivers/cfi_flash.c 2009-12-08 21:25:17 UTC (rev 94) @@ -668,7 +668,10 @@ buffered_size = (info->portwidth / info->chipwidth); buffered_size *= info->buffer_size; while (cnt >= info->portwidth) { - i = buffered_size > cnt ? cnt : buffered_size; + if (wp & 0x1ff) + i = 512 > cnt ? cnt : 512; + else + i = buffered_size > cnt ? cnt : buffered_size; if ((rc = flash_write_cfibuffer (info, wp, src, i)) != ERR_OK) return rc; i -= i & (info->portwidth - 1); @@ -1460,7 +1463,11 @@ return ERR_INVAL; break; } - flash_write_cmd (info, sector, 0, (uchar) cnt - 1); + if (cnt > 256) + *dst.wp = (ushort) cnt - 1; + else + flash_write_cmd (info, sector, 0, (uchar) cnt - 1); + while (cnt-- > 0) { switch (info->portwidth) { case FLASH_CFI_8BIT: Modified: trunk/u-boot-pismo/include/i2c.h =================================================================== --- trunk/u-boot-pismo/include/i2c.h 2009-09-24 05:16:38 UTC (rev 93) +++ trunk/u-boot-pismo/include/i2c.h 2009-12-08 21:25:17 UTC (rev 94) @@ -77,9 +77,14 @@ * * Returns: 0 on success, not 0 on failure */ + +#if defined(CONFIG_MARVELL) && defined(MV78XX0) +int i2c_read(uchar chanNum, uchar chip, uint addr, int alen, uchar *buffer, int len); +int i2c_write(uchar chanNum, uchar chip, uint addr, int alen, uchar *buffer, int len); +#else int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len); int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len); - +#endif /* * Utility routines to read/write registers. */ Modified: trunk/u-boot-pismo/u-boot.bin =================================================================== (Binary files differ)