Datasheet for reference here.
The port registers of the MCP23017 I2C I/O expander can be configured in two ways using the IOCON.BANK bit as follows:
If BANK = 0, the A/B registers are paired. For example, IODIRA is mapped to address 00h and IODIRB is mapped to the next address (address 01h). The mapping for all registers is from 00h -15h.
If BANK = 1, the registers associated with each port are segregated. Registers associated with PORTA are mapped from address 00h - 0Ah and registers associated with PORTB are mapped from 10h - 1Ah.
By changing the IOCON.BANK bit, the address of the IOCON register itself changes, see table 3-4, 3-5 in the datasheet.
So, in the case of a MCU reset, how do you determine the state of IOCON.BANK without resetting the MCP23017 so that any peripherals attached to the MCP23017 are unaffected?