Subversion Repositories freemyipod

Rev

Rev 339 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 339 Rev 357
Line 146... Line 146...
146
}
146
}
147
 
147
 
148
int ata_power_up()
148
int ata_power_up()
149
{
149
{
150
    ata_set_active();
150
    ata_set_active();
-
 
151
    if (ata_powered) return 0;
151
    i2c_sendbyte(0, 0xe6, 0x1b, 1);
152
    i2c_sendbyte(0, 0xe6, 0x1b, 1);
152
    clockgate_enable(5, true);
153
    clockgate_enable(5, true);
153
    ATA_CFG = BIT(0);
154
    ATA_CFG = BIT(0);
154
    sleep(1000);
155
    sleep(1000);
155
    ATA_CFG = 0;
156
    ATA_CFG = 0;
Line 237... Line 238...
237
    return 0;
238
    return 0;
238
}
239
}
239
 
240
 
240
void ata_power_down()
241
void ata_power_down()
241
{
242
{
-
 
243
    if (!ata_powered) return;
242
    ata_powered = false;
244
    ata_powered = false;
243
    ata_wait_for_rdy(1000000);
245
    ata_wait_for_rdy(1000000);
244
    ata_write_cbr(&ATA_PIO_DVR, 0);
246
    ata_write_cbr(&ATA_PIO_DVR, 0);
245
    ata_write_cbr(&ATA_PIO_CSD, 0xe0);
247
    ata_write_cbr(&ATA_PIO_CSD, 0xe0);
246
    ata_wait_for_rdy(1000000);
248
    ata_wait_for_rdy(1000000);