I have got the same issue. I can not write any data on MT25QL256. I am using the functions defined in the header file "altera_generic_quad_spi_controller2.h".
i.e.
int alt_qspi_controller2_read(alt_flash_dev *flash_info, int offset, void *dest_addr, int length);
int alt_qspi_controller2_get_info(alt_flash_fd *fd, flash_region **info, int *number_of_regions);
int alt_qspi_controller2_erase_block(alt_flash_dev *flash_info, int block_offset);
int alt_qspi_controller2_write_block(alt_flash_dev *flash_info, int block_offset, int data_offset, const void *data, int length);
int alt_qspi_controller2_write(alt_flash_dev *flash_info, int offset, const void *src_addr, int length);
int alt_qspi_controller2_lock(alt_flash_dev *flash_info, alt_u32 sectors_to_lock);
P.S. The Flash gets programmed using the Quartus Programmer and I can read the data from Flash in NIOS which gets written using Programmer.
Regards,
AR