]> git.sur5r.net Git - u-boot/blobdiff - drivers/block/mxc_ata.c
mmc: Fix mmc_spi error on cmd->flags field
[u-boot] / drivers / block / mxc_ata.c
index 842a63309d59734c34376d5e9d00c3da340d4878..35bc656dd74a236d24a4c2586b349b664ba720e1 100644 (file)
@@ -87,11 +87,8 @@ struct mxc_data_hdd_regs {
 
 /* PIO timing table */
 #define        NR_PIO_SPECS    5
-static uint16_t pio_t0[NR_PIO_SPECS]   = { 600, 383, 240, 180, 120 };
 static uint16_t pio_t1[NR_PIO_SPECS]   = { 70,  50,  30,  30,  25 };
 static uint16_t pio_t2_8[NR_PIO_SPECS] = { 290, 290, 290, 80,  70 };
-static uint16_t pio_t2_16[NR_PIO_SPECS]        = { 165, 125, 100, 80,  70 };
-static uint16_t pio_t2i[NR_PIO_SPECS]  = { 40,  0,   0,   0,   0 };
 static uint16_t pio_t4[NR_PIO_SPECS]   = { 30,  20,  15,  10,  10 };
 static uint16_t pio_t9[NR_PIO_SPECS]   = { 20,  15,  10,  10,  10 };
 static uint16_t pio_tA[NR_PIO_SPECS]   = { 50,  50,  50,  50,  50 };
@@ -99,7 +96,6 @@ static uint16_t pio_tA[NR_PIO_SPECS]  = { 50,  50,  50,  50,  50 };
 #define        REG2OFF(reg)    ((((uint32_t)reg) & 0x3) * 8)
 static void set_ata_bus_timing(unsigned char mode)
 {
-       uint32_t val;
        uint32_t T = 1000000000 / mxc_get_clock(MXC_IPG_CLK);
 
        struct mxc_ata_config_regs *ata_regs;
@@ -109,22 +105,19 @@ static void set_ata_bus_timing(unsigned char mode)
                return;
 
        /* Write TIME_OFF/ON/1/2W */
-       val =   (3 << REG2OFF(&ata_regs->time_off)) |
-               (3 << REG2OFF(&ata_regs->time_on)) |
-               (((pio_t1[mode] + T) / T) << REG2OFF(&ata_regs->time_1)) |
-               (((pio_t2_8[mode] + T) / T) << REG2OFF(&ata_regs->time_2w));
-       writel(val, &ata_regs->time_off);
+       writeb(3, &ata_regs->time_off);
+       writeb(3, &ata_regs->time_on);
+       writeb((pio_t1[mode] + T) / T, &ata_regs->time_1);
+       writeb((pio_t2_8[mode] + T) / T, &ata_regs->time_2w);
 
        /* Write TIME_2R/AX/RDX/4 */
-       val =   (((pio_t2_8[mode] + T) / T) << REG2OFF(&ata_regs->time_2r)) |
-               (((pio_tA[mode] + T) / T + 2) << REG2OFF(&ata_regs->time_ax)) |
-               (1 << REG2OFF(&ata_regs->time_pio_rdx)) |
-               (((pio_t4[mode] + T) / T) << REG2OFF(&ata_regs->time_4));
-       writel(val, &ata_regs->time_2r);
+       writeb((pio_t2_8[mode] + T) / T, &ata_regs->time_2r);
+       writeb((pio_tA[mode] + T) / T + 2, &ata_regs->time_ax);
+       writeb(1, &ata_regs->time_pio_rdx);
+       writeb((pio_t4[mode] + T) / T, &ata_regs->time_4);
 
        /* Write TIME_9 ; the rest of timing registers is irrelevant for PIO */
-       val =   (((pio_t9[mode] + T) / T) << REG2OFF(&ata_regs->time_9));
-       writel(val, &ata_regs->time_9);
+       writeb((pio_t9[mode] + T) / T, &ata_regs->time_9);
 }
 
 int ide_preinit(void)