From 1ba639da5604a64b3ed884a2cbb1c5414a9fa728 Mon Sep 17 00:00:00 2001 From: Michael Schwingen Date: Mon, 18 Feb 2008 23:16:35 +0100 Subject: CFI: Do not use uninitialized cmd_reset Do not use uninitialized cmd_reset; issue both AMD and Intel reset commands instead From a short test, it looks like AMD-style flash roms treat *any* unknown command write as a reset, at least when in CFI Query mode, so issuing the Intel reset command to AMD-style flashs seems safe (from the small sample I have), plus the 3-cycle magic sequence should kick the state machine into the right state even without a reset command. Since the AMD-style flashs require the unlock sequence for real operation, I chose to try the AMD reset command first, so that Intel flashs do no see an invalid command prior to the CFI query. I have tested the patch on AM29LV320-style flashs from Fujitsu and Macronix, plus Intel StrataFlash. Signed-off-by: Michael Schwingen Signed-off-by: Stefan Roese --- drivers/mtd/cfi_flash.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index eb509f5..439c950 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1538,7 +1538,12 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) { int cfi_offset; - flash_write_cmd (info, 0, 0, info->cmd_reset); + /* We do not yet know what kind of commandset to use, so we issue + the reset command in both Intel and AMD variants, in the hope + that AMD flash roms ignore the Intel command. */ + flash_write_cmd (info, 0, 0, AMD_CMD_RESET); + flash_write_cmd (info, 0, 0, FLASH_CMD_RESET); + for (cfi_offset=0; cfi_offset < sizeof(flash_offset_cfi) / sizeof(uint); cfi_offset++) { -- cgit v1.1 From e845e07e1e6e64f40e35688439d3cdcf01cfff4f Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 17 Feb 2008 23:52:46 +0100 Subject: uli526x: Fix multiple differ in signedness and parentheses around comparison Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- drivers/net/uli526x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c index 8460f69..d64845f 100644 --- a/drivers/net/uli526x.c +++ b/drivers/net/uli526x.c @@ -32,9 +32,9 @@ #define ULI5261_DEVICE_ID 0x5261 #define ULI5263_DEVICE_ID 0x5263 /* ULi M5261 ID*/ -#define PCI_ULI5261_ID ULI5261_DEVICE_ID << 16 | ULI_VENDOR_ID +#define PCI_ULI5261_ID (ULI5261_DEVICE_ID << 16 | ULI_VENDOR_ID) /* ULi M5263 ID*/ -#define PCI_ULI5263_ID ULI5263_DEVICE_ID << 16 | ULI_VENDOR_ID +#define PCI_ULI5263_ID (ULI5263_DEVICE_ID << 16 | ULI_VENDOR_ID) #define ULI526X_IO_SIZE 0x100 #define TX_DESC_CNT 0x10 /* Allocated Tx descriptors */ @@ -281,7 +281,7 @@ static int uli526x_init_one(struct eth_device *dev, bd_t *bis) if (db->desc_pool_ptr == NULL) return -1; - db->buf_pool_ptr = &buf_pool[0]; + db->buf_pool_ptr = (uchar *)&buf_pool[0]; db->buf_pool_dma_ptr = (dma_addr_t)&buf_pool[0]; if (db->buf_pool_ptr == NULL) return -1; @@ -588,7 +588,7 @@ static int uli526x_rx_packet(struct eth_device *dev) __FUNCTION__, i, rxptr->rx_buf_ptr[i]); #endif - NetReceive(rxptr->rx_buf_ptr, rxlen); + NetReceive((uchar *)rxptr->rx_buf_ptr, rxlen); uli526x_reuse_buf(rxptr); } else { @@ -656,7 +656,7 @@ static void uli526x_descriptor_init(struct uli526x_board_info *db, tmp_tx_dma = db->first_tx_desc_dma; for (tmp_tx = db->first_tx_desc, i = 0; i < TX_DESC_CNT; i++, tmp_tx++) { - tmp_tx->tx_buf_ptr = tmp_buf; + tmp_tx->tx_buf_ptr = (char *)tmp_buf; tmp_tx->tdes0 = cpu_to_le32(0); tmp_tx->tdes1 = cpu_to_le32(0x81000000); /* IC, chain */ tmp_tx->tdes2 = cpu_to_le32(tmp_buf_dma); -- cgit v1.1 From d01b847c5cd070895c4ba178c85cd068a95cf7cd Mon Sep 17 00:00:00 2001 From: Larry Johnson Date: Thu, 21 Feb 2008 13:58:16 -0500 Subject: LM75 bug fix for negative temperatures When the LM75 temperature sensor measures a temperature below 0 C, the current driver does not perform sign extension, so the result returned is 256 C too high. This patch fixes the problem. Signed-off-by: Larry Johnson --- drivers/hwmon/lm75.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 63f3b75..e29b294 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -179,7 +179,13 @@ int dtt_init (void) int dtt_get_temp(int sensor) { - return (dtt_read(sensor, DTT_READ_TEMP) / 256); + int const ret = dtt_read(sensor, DTT_READ_TEMP); + + if (ret < 0) { + printf("DTT temperature read failed.\n"); + return 0; + } + return (int)((int16_t) ret / 256); } /* dtt_get_temp() */ #endif /* CONFIG_DTT_LM75 */ -- cgit v1.1