minimig: use fast io for HDD transfer.

This commit is contained in:
sorgelig
2020-06-08 02:26:53 +08:00
parent 06b7641eab
commit f40a245f95
2 changed files with 7 additions and 36 deletions

View File

@@ -38,29 +38,8 @@ static struct nic301_registers *nic301_regs = (nic301_registers *)SOCFPGA
static uint32_t *map_base;
static int fd;
static __inline void writel(uint32_t val, const void* reg)
{
/*
if(!IS_REG(reg))
{
printf("ERROR: Trying to write undefined address: %p\n.", reg);
fatal(-1);
}
*/
*MAP_ADDR(reg) = val;
}
static __inline uint32_t readl(const void* reg)
{
/*
if (!IS_REG(reg))
{
printf("ERROR: Trying to read undefined address: %p\n.", reg);
fatal(-1);
}
*/
return *MAP_ADDR(reg);
}
#define writel(val, reg) *MAP_ADDR(reg) = val
#define readl(reg) *MAP_ADDR(reg)
#define clrsetbits_le32(addr, clear, set) writel((readl(addr) & ~(clear)) | (set), addr)
#define setbits_le32(addr, set) writel( readl(addr) | (set), addr)
@@ -540,15 +519,8 @@ void inline fpga_gpo_write(uint32_t value)
writel(value, (void*)(SOCFPGA_MGR_ADDRESS + 0x10));
}
uint32_t inline fpga_gpo_read()
{
return gpo_copy; //readl((void*)(SOCFPGA_MGR_ADDRESS + 0x10));
}
int inline fpga_gpi_read()
{
return readl((void*)(SOCFPGA_MGR_ADDRESS + 0x14));
}
#define fpga_gpo_read() gpo_copy //readl((void*)(SOCFPGA_MGR_ADDRESS + 0x10))
#define fpga_gpi_read() (int)readl((void*)(SOCFPGA_MGR_ADDRESS + 0x14))
void fpga_core_write(uint32_t offset, uint32_t value)
{
@@ -591,7 +563,7 @@ int fpga_core_id()
int fpga_get_fio_size()
{
return (fpga_gpi_read()>>16) & 1;
return (fpga_gpi_read() >> 16) & 1;
}
int fpga_get_io_version()
@@ -720,7 +692,6 @@ uint16_t fpga_spi(uint16_t word)
uint16_t fpga_spi_fast(uint16_t word)
{
uint32_t gpo = (fpga_gpo_read() & ~(0xFFFF | SSPI_STROBE)) | word;
fpga_gpo_write(gpo);
fpga_gpo_write(gpo | SSPI_STROBE);
fpga_gpo_write(gpo);

View File

@@ -227,7 +227,7 @@ void spi_block_write_16be(const uint16_t *addr)
while (len--)
{
tmp = *addr++;
spi_w(SWAPW(tmp));
fpga_spi_fast(SWAPW(tmp));
}
}
@@ -237,7 +237,7 @@ void spi_block_read_16be(uint16_t *addr)
uint16_t tmp;
while (len--)
{
tmp = spi_w(0xFFFF);
tmp = fpga_spi_fast(0xFFFF);
*addr++ = SWAPW(tmp);
}
}