#include <linux/types.h>
#include <dma.h>
#include <config.h>

void fast_copy(void)
{
	u32 len, dest_addr, src_addr;

	/*set baud rate , dramc clock/(1*2) */
	REG32(SPIC_VA + SPIC_BAUDR) = 0x01;

	/*set dual_o  read command*/
	REG32(SPIC_VA + SPIC_READ_DUAL_DATA) = 0x3b;

	/*set dual_o read dummy to : baud *2 * dummy+ 5 */
	REG32(SPIC_VA + SPIC_AUTO_LENGTH) = 0x28030011;

	/*set dual_o auto read valid*/
	REG32(SPIC_VA + SPIC_VALID_CMD) = 0x202;

	dest_addr = CONFIG_LOAD_BASE;
	src_addr = CONFIG_SYS_FLASH_BASE + CONFIG_RAM_OFFSET;
	len = CONFIG_RAM_SIZE;

	if (len % 4)
		len = (len / 4) * 4 + 4;
	else
		len = len;

	dma_copy((src_addr & 0x1FFFFFFF), (dest_addr & 0x7FFFFFFF), len);

}
