A system comprising: a first power supply; a second power supply supplying a control voltage (Vdd_Drvr); a headswitch disposed between the first power supply and logic circuitry; an enable driver coupling the second power supply to a control terminal of the headswitch, wherein the enable driver is operable to apply the control voltage of the second power supply to the control terminal of the headswitch; and a voltage generator operable to adjust the control voltage of the second power supply in response to a first voltage level of the first power supply exceeding a reference voltage level; wherein the voltage generator comprises: a comparator having a first input coupled to the first power supply and a second input coupled to a reference voltage circuit generating the reference voltage level; a first transistor coupled to a first power rail at the reference voltage level, the first transistor being gate-coupled to an output of the comparator through an inverter; and a second transistor coupled to the first power supply, the second transistor being gate-coupled to an output of the comparator; characterised in that the reference voltage circuit comprises: a first switch coupled to a first reference voltage source; a second switch coupled to a second reference voltage source; and a switch controller configured to operate the first and second switches such that the reference voltage generated by the reference voltage circuit is set as a voltage of the first reference voltage source or the second reference voltage source. a first power supply; a second power supply supplying a control voltage (Vdd_Drvr); a headswitch disposed between the first power supply and logic circuitry; an enable driver coupling the second power supply to a control terminal of the headswitch, wherein the enable driver is operable to apply the control voltage of the second power supply to the control terminal of the headswitch; and a voltage generator operable to adjust the control voltage of the second power supply in response to a first voltage level of the first power supply exceeding a reference voltage level; wherein the voltage generator comprises: a comparator having a first input coupled to the first power supply and a second input coupled to a reference voltage circuit generating the reference voltage level; a first transistor coupled to a first power rail at the reference voltage level, the first transistor being gate-coupled to an output of the comparator through an inverter; and a second transistor coupled to the first power supply, the second transistor being gate-coupled to an output of the comparator; characterised in that the reference voltage circuit comprises: a first switch coupled to a first reference voltage source; a second switch coupled to a second reference voltage source; and a switch controller configured to operate the first and second switches such that the reference voltage generated by the reference voltage circuit is set as a voltage of the first reference voltage source or the second reference voltage source. a comparator having a first input coupled to the first power supply and a second input coupled to a reference voltage circuit generating the reference voltage level; a first transistor coupled to a first power rail at the reference voltage level, the first transistor being gate-coupled to an output of the comparator through an inverter; and a second transistor coupled to the first power supply, the second transistor being gate-coupled to an output of the comparator; characterised in that the reference voltage circuit comprises: a first switch coupled to a first reference voltage source; a second switch coupled to a second reference voltage source; and a switch controller configured to operate the first and second switches such that the reference voltage generated by the reference voltage circuit is set as a voltage of the first reference voltage source or the second reference voltage source. a first switch coupled to a first reference voltage source; a second switch coupled to a second reference voltage source; and a switch controller configured to operate the first and second switches such that the reference voltage generated by the reference voltage circuit is set as a voltage of the first reference voltage source or the second reference voltage source.