Hi stephenzhou,
the M25P40 is one to one pin compatible to the EPCS4 Device. So if you wired the Configuration Device right for the EPCS4 device then you can replace it directly with M25P40.
This works well ( I used it with Cyclone EP1C20, Ep1C12, Ep1C4 and with Cyclone II EP2C8).
M25p40 EPCS4
C-----------DCLK
D-----------ASDI
Q-----------DATA
S-----------NCS
W-----------VCC (With pullup)
HOLD-------VCC (With pullup)
VCC--------VCC
VSS--------GND
The Pins W and /Hold are used for some special featurees of the M25P40 device. I never tried the EPCS4 to support this features like Hold and Writeprotect, but i would think it can support such things even if it is not mentioned in the datasheet.
When you want to use the M25P40 with *.jic You have to chosse the EPCS4 in the Configuration dialog.
Regards
Christian