Arduino, solenoid driver and current limiter

I'm sorry, I forgot to mention that I need to change the maximum forwarding current by software. At the moment, I set the current at 2A by using R17 resistor, but I want to replace it with a digital potentiometer controlled by Arduino (via I2C protocol). In this way, I can change the maximum current without changing the circuit every time. The MAX17525 device can limit the current from 0,5A to 6A and it is perfect for me.

I would like to avoid to use a resistor to limit the current and I would also like to avoid the voltage dropping.
The solenoid needs 12VDC and it needs to be controlled by PWM.

At the moment, I'm perfectly able to control the solenoid proportionally with the circuit above, but without the MAX17525 device. I'd like to know if I correctly integrated this device and if the circuit makes sense with this solution.