From 837a71d6c580972b9638588a50cec5fbb035add6 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Fri, 17 Jun 2011 19:49:25 +0200 Subject: [PATCH] FT232H: Handle the EEPROM Bit for Enter Powerdsave on ACBUS7 --- src/ftdi.c | 16 ++++++++++++++++ src/ftdi.h | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/src/ftdi.c b/src/ftdi.c index 76e6f42..ed2bbe0 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -2663,6 +2663,10 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) output[0x00] |= DRIVER_VCPH; else output[0x00] &= ~DRIVER_VCPH; + if (eeprom->powersave) + output[0x01] |= POWER_SAVE_DISABLE_H; + else + output[0x01] &= ~POWER_SAVE_DISABLE_H; if (eeprom->group0_drive > DRIVE_16MA) output[0x0c] |= DRIVE_16MA; @@ -2925,6 +2929,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose) { eeprom->channel_a_type = buf[0x00] & 0xf; eeprom->channel_a_driver = (buf[0x00] & DRIVER_VCPH)?DRIVER_VCP:0; + eeprom->powersave = buf[0x01] & POWER_SAVE_DISABLE_H; eeprom->group0_drive = buf[0x0c] & DRIVE_16MA; eeprom->group0_schmitt = buf[0x0c] & IS_SCHMITT; eeprom->group0_slew = buf[0x0c] & SLOW_SLEW; @@ -2963,6 +2968,11 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose) fprintf(stdout, "Suspend on DBUS7\n"); if (eeprom->suspend_pull_downs) fprintf(stdout, "Pull IO pins low during suspend\n"); + if(eeprom->powersave) + { + if(ftdi->type >= TYPE_232H) + fprintf(stdout,"Enter low power state on ACBUS7\n"); + } if (eeprom->remote_wakeup) fprintf(stdout, "Enable Remote Wake Up\n"); fprintf(stdout, "PNP: %d\n",(eeprom->is_not_pnp)?0:1); @@ -3175,6 +3185,9 @@ int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value valu case GROUP3_SLEW: *value = ftdi->eeprom->group3_slew; break; + case POWER_SAVE: + *value = ftdi->eeprom->powersave; + break; case CHIP_TYPE: *value = ftdi->eeprom->chip; break; @@ -3314,6 +3327,9 @@ int ftdi_set_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value valu case CHIP_TYPE: ftdi->eeprom->chip = value; break; + case POWER_SAVE: + ftdi->eeprom->powersave = value; + break; case CHIP_SIZE: ftdi_error_return(-2, "EEPROM Value can't be changed"); default : diff --git a/src/ftdi.h b/src/ftdi.h index cd3f63b..dd442df 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -272,6 +272,8 @@ struct ftdi_eeprom int group3_schmitt; int group3_slew; + int powersave; + /** eeprom size in bytes. This doesn't get stored in the eeprom but is the only way to pass it to ftdi_eeprom_build. */ int size; @@ -384,7 +386,8 @@ enum ftdi_eeprom_value GROUP3_SCHMITT = 36, GROUP3_SLEW = 37, CHIP_SIZE = 38, - CHIP_TYPE = 39 + CHIP_TYPE = 39, + POWER_SAVE = 40 }; /** @@ -398,6 +401,8 @@ struct ftdi_device_list struct libusb_device *dev; }; +#define POWER_SAVE_DISABLE_H 0x80 + #define USE_SERIAL_NUM 0x08 enum ftdi_cbus_func {/* FIXME: Recheck value, especially the last */ CBUS_TXDEN = 0, CBUS_PWREN = 1, CBUS_RXLED = 2, CBUS_TXLED = 3, CBUS_TXRXLED = 4, -- 1.7.1