mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
iPod Classic CE-ATA Support (Part 4 of 4: S5L8702 ATA driver)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29448 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
59c5e791a1
commit
30fb680a4d
10 changed files with 1702 additions and 264 deletions
|
|
@ -95,7 +95,7 @@ SECTIONS
|
|||
*(.stack)
|
||||
stackbegin = .;
|
||||
_stackbegin = .;
|
||||
. += 0x4000;
|
||||
. += 0x2000;
|
||||
stackend = .;
|
||||
_stackend = .;
|
||||
_irqstackbegin = .;
|
||||
|
|
|
|||
|
|
@ -1,197 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: ata-meg-fx.c 27935 2010-08-28 23:12:11Z funman $
|
||||
*
|
||||
* Copyright (C) 2011 by Michael Sparmann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "cpu.h"
|
||||
#include "kernel.h"
|
||||
#include "thread.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "panic.h"
|
||||
#include "pmu-target.h"
|
||||
#include "ata.h"
|
||||
#include "ata-target.h"
|
||||
#include "s5l8702.h"
|
||||
|
||||
|
||||
static struct wakeup ata_wakeup;
|
||||
|
||||
#ifdef HAVE_ATA_DMA
|
||||
static uint32_t ata_dma_flags;
|
||||
#endif
|
||||
|
||||
|
||||
void ata_reset(void)
|
||||
{
|
||||
ATA_SWRST = 1;
|
||||
sleep(HZ / 100);
|
||||
ATA_SWRST = 0;
|
||||
sleep(HZ / 10);
|
||||
}
|
||||
|
||||
void ata_enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
PWRCON(0) &= ~(1 << 5);
|
||||
ATA_CFG = 0x41;
|
||||
sleep(HZ / 100);
|
||||
ATA_CFG = 0x40;
|
||||
sleep(HZ / 20);
|
||||
ata_reset();
|
||||
ATA_CCONTROL = 1;
|
||||
sleep(HZ / 5);
|
||||
ATA_PIO_TIME = 0x191f7;
|
||||
*ATA_HCYL = 0;
|
||||
while (!(ATA_PIO_READY & 2)) yield();
|
||||
}
|
||||
else
|
||||
{
|
||||
ATA_CCONTROL = 0;
|
||||
while (!(ATA_CCONTROL & 2)) yield();
|
||||
PWRCON(1) |= 1 << 5;
|
||||
}
|
||||
}
|
||||
|
||||
bool ata_is_coldstart(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ata_device_init(void)
|
||||
{
|
||||
VIC0INTENABLE = 1 << IRQ_ATA;
|
||||
}
|
||||
|
||||
uint16_t ata_read_cbr(uint32_t volatile* reg)
|
||||
{
|
||||
while (!(ATA_PIO_READY & 2));
|
||||
volatile uint32_t __attribute__((unused)) dummy = *reg;
|
||||
while (!(ATA_PIO_READY & 1));
|
||||
return ATA_PIO_RDATA;
|
||||
}
|
||||
|
||||
void ata_write_cbr(uint32_t volatile* reg, uint16_t data)
|
||||
{
|
||||
while (!(ATA_PIO_READY & 2));
|
||||
*reg = data;
|
||||
}
|
||||
|
||||
void ata_set_pio_timings(int mode)
|
||||
{
|
||||
if (mode >= 4) ATA_PIO_TIME = 0x7083;
|
||||
if (mode >= 3) ATA_PIO_TIME = 0x2072;
|
||||
else ATA_PIO_TIME = 0x11f3;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ATA_DMA
|
||||
static void ata_set_mdma_timings(unsigned int mode)
|
||||
{
|
||||
if (mode >= 2) ATA_MDMA_TIME = 0x5072;
|
||||
if (mode >= 1) ATA_MDMA_TIME = 0x7083;
|
||||
else ATA_MDMA_TIME = 0x1c175;
|
||||
}
|
||||
|
||||
static void ata_set_udma_timings(unsigned int mode)
|
||||
{
|
||||
if (mode >= 4) ATA_UDMA_TIME = 0x2010a52;
|
||||
if (mode >= 3) ATA_UDMA_TIME = 0x2020a52;
|
||||
if (mode >= 2) ATA_UDMA_TIME = 0x3030a52;
|
||||
if (mode >= 1) ATA_UDMA_TIME = 0x3050a52;
|
||||
else ATA_UDMA_TIME = 0x5071152;
|
||||
}
|
||||
|
||||
void ata_dma_set_mode(unsigned char mode)
|
||||
{
|
||||
unsigned int modeidx = mode & 0x07;
|
||||
unsigned int dmamode = mode & 0xf8;
|
||||
|
||||
if (dmamode == 0x40 && modeidx <= ATA_MAX_UDMA)
|
||||
{
|
||||
/* Using Ultra DMA */
|
||||
ata_set_udma_timings(dmamode);
|
||||
ata_dma_flags = 0x60c;
|
||||
}
|
||||
else if (dmamode == 0x20 && modeidx <= ATA_MAX_MWDMA)
|
||||
{
|
||||
/* Using Multiword DMA */
|
||||
ata_set_mdma_timings(dmamode);
|
||||
ata_dma_flags = 0x408;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Don't understand this - force PIO. */
|
||||
ata_dma_flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ata_dma_setup(void *addr, unsigned long bytes, bool write)
|
||||
{
|
||||
if ((((int)addr) & 0xf) || (((int)bytes) & 0xf) || !ata_dma_flags)
|
||||
return false;
|
||||
|
||||
if (write) clean_dcache();
|
||||
else invalidate_dcache();
|
||||
ATA_CCOMMAND = 2;
|
||||
|
||||
if (write)
|
||||
{
|
||||
ATA_SBUF_START = addr;
|
||||
ATA_SBUF_SIZE = bytes;
|
||||
ATA_CFG |= 0x10;
|
||||
}
|
||||
else
|
||||
{
|
||||
ATA_TBUF_START = addr;
|
||||
ATA_TBUF_SIZE = bytes;
|
||||
ATA_CFG &= ~0x10;
|
||||
}
|
||||
ATA_XFR_NUM = bytes - 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ata_dma_finish(void)
|
||||
{
|
||||
ATA_CFG |= ata_dma_flags;
|
||||
ATA_CFG &= ~0x180;
|
||||
wakeup_wait(&ata_wakeup, TIMEOUT_NOBLOCK);
|
||||
ATA_IRQ = 0x1f;
|
||||
ATA_IRQ_MASK = 1;
|
||||
ATA_CCOMMAND = 1;
|
||||
if (wakeup_wait(&ata_wakeup, HZ / 2) != OBJ_WAIT_SUCCEEDED)
|
||||
{
|
||||
ATA_CCOMMAND = 2;
|
||||
ATA_CFG &= ~0x100c;
|
||||
return false;
|
||||
}
|
||||
ATA_CCOMMAND = 2;
|
||||
ATA_CFG &= ~0x100c;
|
||||
return true;
|
||||
}
|
||||
#endif /* HAVE_ATA_DMA */
|
||||
|
||||
void INT_ATA(void)
|
||||
{
|
||||
uint32_t ata_irq = ATA_IRQ;
|
||||
ATA_IRQ = ata_irq;
|
||||
if (ata_irq & ATA_IRQ_MASK) wakeup_signal(&ata_wakeup);
|
||||
ATA_IRQ_MASK = 0;
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: ata-target.h 25525 2010-04-07 20:01:21Z torne $
|
||||
*
|
||||
* Copyright (C) 2011 by Michael Sparmann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef ATA_TARGET_H
|
||||
#define ATA_TARGET_H
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "s5l8702.h"
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
#define ATA_DRIVER_CLOSE
|
||||
#endif
|
||||
|
||||
#define ATA_SWAP_IDENTIFY(word) (swap16(word))
|
||||
|
||||
void ata_reset(void);
|
||||
void ata_device_init(void);
|
||||
bool ata_is_coldstart(void);
|
||||
uint16_t ata_read_cbr(uint32_t volatile* reg);
|
||||
void ata_write_cbr(uint32_t volatile* reg, uint16_t data);
|
||||
|
||||
#define ATA_OUT8(reg, data) ata_write_cbr(reg, data)
|
||||
#define ATA_OUT16(reg, data) ata_write_cbr(reg, data)
|
||||
#define ATA_IN8(reg) ata_read_cbr(reg)
|
||||
#define ATA_IN16(reg) ata_read_cbr(reg)
|
||||
|
||||
#define ATA_SET_DEVICE_FEATURES
|
||||
void ata_set_pio_timings(int mode);
|
||||
|
||||
#endif
|
||||
345
firmware/target/arm/s5l8702/ipod6g/mmcdefs-target.h
Normal file
345
firmware/target/arm/s5l8702/ipod6g/mmcdefs-target.h
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
//
|
||||
//
|
||||
// Copyright 2010 TheSeven
|
||||
//
|
||||
//
|
||||
// This file is part of emCORE.
|
||||
//
|
||||
// emCORE is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 2 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// emCORE is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef __CONSTANTS_MMC_H__
|
||||
#define __CONSTANTS_MMC_H__
|
||||
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define BIT(x) (1 << (x))
|
||||
#define BITRANGE(x, y) ((0xfffffffful >> (31 + (x) - (y))) << (x))
|
||||
|
||||
#define ERR_RC(val) (BIT(31) | (val))
|
||||
#define IS_ERR(val) (val & BIT(31))
|
||||
#define RET_ERR(val) \
|
||||
{ \
|
||||
return ERR_RC(val); \
|
||||
}
|
||||
#define RET_ERR_MTX(val, mutex) \
|
||||
{ \
|
||||
mutex_unlock(mutex); \
|
||||
return ERR_RC(val); \
|
||||
}
|
||||
#define PASS_RC(expr, bits, val) \
|
||||
{ \
|
||||
int PASS_RC_rc = (expr); \
|
||||
if (IS_ERR(PASS_RC_rc)) \
|
||||
return ERR_RC((PASS_RC_rc << (bits)) | (val)); \
|
||||
}
|
||||
#define PASS_RC_MTX(expr, bits, val, mutex) \
|
||||
{ \
|
||||
int PASS_RC_MTX_rc = (expr); \
|
||||
if (IS_ERR(PASS_RC_MTX_rc)) \
|
||||
{ \
|
||||
mutex_unlock(mutex); \
|
||||
return ERR_RC((PASS_RC_MTX_rc << (bits)) | (val)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TIMEOUT_EXPIRED(a,b) TIME_AFTER(USEC_TIMER,a + b)
|
||||
#define udelay(duration) \
|
||||
{ \
|
||||
long timestamp = USEC_TIMER; \
|
||||
while (!TIMEOUT_EXPIRED(timestamp, (long)(duration))); \
|
||||
}
|
||||
|
||||
|
||||
#define MMC_CMD_GO_IDLE_STATE 0
|
||||
#define MMC_CMD_SEND_OP_COND 1
|
||||
#define MMC_CMD_ALL_SEND_CID 2
|
||||
#define MMC_CMD_SET_RELATIVE_ADDR 3
|
||||
#define MMC_CMD_SET_DSR 4
|
||||
#define MMC_CMD_SLEEP_AWAKE 5
|
||||
#define MMC_CMD_SWITCH 6
|
||||
#define MMC_CMD_SELECT_CARD 7
|
||||
#define MMC_CMD_SEND_EXT_CSD 8
|
||||
#define MMC_CMD_SEND_CSD 9
|
||||
#define MMC_CMD_SEND_CID 10
|
||||
#define MMC_CMD_READ_DAT_UNTIL_STOP 11
|
||||
#define MMC_CMD_STOP_TRANSMISSION 12
|
||||
#define MMC_CMD_SEND_STATUS 13
|
||||
#define MMC_CMD_BUSTEST_R 14
|
||||
#define MMC_CMD_GO_INAVTIVE_STATE 15
|
||||
#define MMC_CMD_SET_BLOCKLEN 16
|
||||
#define MMC_CMD_READ_SINGLE_BLOCK 17
|
||||
#define MMC_CMD_READ_MULTIPLE_BLOCK 18
|
||||
#define MMC_CMD_BUSTEST_W 19
|
||||
#define MMC_CMD_WRITE_DAT_UNTIL_STOP 20
|
||||
#define MMC_CMD_SET_BLOCK_COUNT 23
|
||||
#define MMC_CMD_WRITE_BLOCK 24
|
||||
#define MMC_CMD_WRITE_MULTIPLE_BLOCK 25
|
||||
#define MMC_CMD_PROGRAM_CID 26
|
||||
#define MMC_CMD_PROGRAM_CSD 27
|
||||
#define MMC_CMD_SET_WRITE_PROT 28
|
||||
#define MMC_CMD_CLR_WRITE_PROT 29
|
||||
#define MMC_CMD_SEND_WRITE_PROT 30
|
||||
#define MMC_CMD_ERASE_GROUP_START 35
|
||||
#define MMC_CMD_ERASE_GROUP_END 36
|
||||
#define MMC_CMD_ERASE 38
|
||||
#define MMC_CMD_FAST_IO 39
|
||||
#define MMC_CMD_GO_IRQ_STATE 40
|
||||
#define MMC_CMD_LOCK_UNLOCK 42
|
||||
#define MMC_CMD_APP_CMD 55
|
||||
#define MMC_CMD_GEN_CMD 56
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG 60
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK 61
|
||||
|
||||
#define MMC_CMD_SEND_OP_COND_OCR_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_SEND_OP_COND_OCR_SHIFT 0
|
||||
#define MMC_CMD_SEND_OP_COND_OCR(x) (x)
|
||||
|
||||
#define MMC_CMD_SET_RELATIVE_ADDR_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SET_RELATIVE_ADDR_RCA_SHIFT 16
|
||||
#define MMC_CMD_SET_RELATIVE_ADDR_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SET_DSR_DSR_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SET_DSR_DSR_SHIFT 16
|
||||
#define MMC_CMD_SET_DSR_DSR(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SLEEP_AWAKE_SLEEP_AWAKE_MASK BIT(15)
|
||||
#define MMC_CMD_SLEEP_AWAKE_SLEEP_AWAKE_AWAKE 0
|
||||
#define MMC_CMD_SLEEP_AWAKE_SLEEP_AWAKE_SLEEP BIT(15)
|
||||
#define MMC_CMD_SLEEP_AWAKE_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SLEEP_AWAKE_RCA_SHIFT 16
|
||||
#define MMC_CMD_SLEEP_AWAKE_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SWITCH_ACCESS_MASK BITRANGE(24, 25);
|
||||
#define MMC_CMD_SWITCH_ACCESS_CMDSET 0
|
||||
#define MMC_CMD_SWITCH_ACCESS_SET_BITS BIT(24)
|
||||
#define MMC_CMD_SWITCH_ACCESS_CLEAR_BITS BIT(25)
|
||||
#define MMC_CMD_SWITCH_ACCESS_WRITE_BYTE (BIT(24) | BIT(25))
|
||||
#define MMC_CMD_SWTICH_INDEX_MASK BITRANGE(16, 23);
|
||||
#define MMC_CMD_SWITCH_INDEX_SHIFT 16
|
||||
#define MMC_CMD_SWITCH_INDEX(x) ((x) << 16)
|
||||
#define MMC_CMD_SWTICH_VALUE_MASK BITRANGE(8, 15);
|
||||
#define MMC_CMD_SWITCH_VALUE_SHIFT 8
|
||||
#define MMC_CMD_SWITCH_VALUE(x) ((x) << 8)
|
||||
#define MMC_CMD_SWTICH_CMDSET_MASK BITRANGE(0, 2);
|
||||
#define MMC_CMD_SWITCH_CMDSET_STANDARD_MMC 0
|
||||
|
||||
#define MMC_CMD_SELECT_CARD_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SELECT_CARD_RCA_SHIFT 16
|
||||
#define MMC_CMD_SELECT_CARD_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SEND_CSD_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SEND_CSD_RCA_SHIFT 16
|
||||
#define MMC_CMD_SEND_CSD_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SEND_CID_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SEND_CID_RCA_SHIFT 16
|
||||
#define MMC_CMD_SEND_CID_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_READ_DAT_UNTIL_STOP_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_READ_DAT_UNTIL_STOP_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_READ_DAT_UNTIL_STOP_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_SEND_STATUS_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_SEND_STATUS_RCA_SHIFT 16
|
||||
#define MMC_CMD_SEND_STATUS_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_GO_INACTIVE_STATE_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_GO_INACTIVE_STATE_RCA_SHIFT 16
|
||||
#define MMC_CMD_GO_INACTIVE_STATE_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_SET_BLOCKLEN_LENGTH_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_SET_BLOCKLEN_LENGTH_SHIFT 0
|
||||
#define MMC_CMD_SET_BLOCKLEN_LENGTH(x) (x)
|
||||
|
||||
#define MMC_CMD_READ_SINGLE_BLOCK_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_READ_SINGLE_BLOCK_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_READ_SINGLE_BLOCK_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_READ_MULTIPLE_BLOCK_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_READ_MULTIPLE_BLOCK_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_READ_MULTIPLE_BLOCK_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_WRITE_DAT_UNTIL_STOP_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_WRITE_DAT_UNTIL_STOP_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_WRITE_DAT_UNTIL_STOP_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_SET_BLOCK_COUNT_RELIABLE BIT(31)
|
||||
#define MMC_CMD_SET_BLOCK_COUNT_COUNT_MASK BITRANGE(0, 15)
|
||||
#define MMC_CMD_SET_BLOCK_COUNT_COUNT_SHIFT 0
|
||||
#define MMC_CMD_SET_BLOCK_COUNT_COUNT(x) (x)
|
||||
|
||||
#define MMC_CMD_WRITE_BLOCK_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_WRITE_BLOCK_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_WRITE_BLOCK_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_WRITE_MULTIPLE_BLOCK_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_WRITE_MULTIPLE_BLOCK_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_WRITE_MULTIPLE_BLOCK_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_SET_WRITE_PROT_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_SET_WRITE_PROT_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_SET_WRITE_PROT_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_CLR_WRITE_PROT_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_CLR_WRITE_PROT_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_CLR_WRITE_PROT_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_SEND_WRITE_PROT_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_SEND_WRITE_PROT_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_SEND_WRITE_PROT_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_ERASE_GROUP_START_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_ERASE_GROUP_START_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_ERASE_GROUP_START_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_ERASE_GROUP_END_ADDRESS_MASK BITRANGE(0, 31)
|
||||
#define MMC_CMD_ERASE_GROUP_END_ADDRESS_SHIFT 0
|
||||
#define MMC_CMD_ERASE_GROUP_END_ADDRESS(x) (x)
|
||||
|
||||
#define MMC_CMD_FAST_IO_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_FAST_IO_RCA_SHIFT 16
|
||||
#define MMC_CMD_FAST_IO_RCA(x) ((x) << 16)
|
||||
#define MMC_CMD_FAST_IO_DIRECTION_MASK BIT(15)
|
||||
#define MMC_CMD_FAST_IO_DIRECTION_READ 0
|
||||
#define MMC_CMD_FAST_IO_DIRECTION_WRITE BIT(15)
|
||||
#define MMC_CMD_FAST_IO_ADDRESS_MASK BITRANGE(8, 14)
|
||||
#define MMC_CMD_FAST_IO_ADDRESS_SHIFT 8
|
||||
#define MMC_CMD_FAST_IO_ADDRESS(x) ((x) << 8)
|
||||
#define MMC_CMD_FAST_IO_DATA_MASK BITRANGE(0, 7)
|
||||
#define MMC_CMD_FAST_IO_DATA_SHIFT 0
|
||||
#define MMC_CMD_FAST_IO_DATA(x) (x)
|
||||
|
||||
#define MMC_CMD_APP_CMD_RCA_MASK BITRANGE(16, 31)
|
||||
#define MMC_CMD_APP_CMD_RCA_SHIFT 16
|
||||
#define MMC_CMD_APP_CMD_RCA(x) ((x) << 16)
|
||||
|
||||
#define MMC_CMD_GEN_CMD_DIRECTION_MASK BIT(0)
|
||||
#define MMC_CMD_GEN_CMD_DIRECTION_READ 0
|
||||
#define MMC_CMD_GEN_CMD_DIRECTION_WRITE BIT(0)
|
||||
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_DIRECTION_MASK BIT(31)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_DIRECTION_READ 0
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_DIRECTION_WRITE BIT(31)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_ADDRESS_MASK BITRANGE(16, 23)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_ADDRESS_SHIFT 16
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_ADDRESS(x) ((x) << 16)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_COUNT_MASK BITRANGE(0, 7)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_COUNT_SHIFT 0
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_REG_COUNT(x) (x)
|
||||
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_DIRECTION_MASK BIT(31)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_DIRECTION_READ 0
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_DIRECTION_WRITE BIT(31)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_COUNT_MASK BITRANGE(0, 15)
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_COUNT_SHIFT 0
|
||||
#define MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_COUNT(x) (x)
|
||||
|
||||
#define MMC_CMD_SWITCH_FIELD_ERASE_GROUP_DEF 175
|
||||
#define MMC_CMD_SWITCH_FIELD_BOOT_BUS_WIDTH 177
|
||||
#define MMC_CMD_SWITCH_FIELD_BOOT_CONFIG 179
|
||||
#define MMC_CMD_SWITCH_FIELD_ERASED_MEM_CONT 181
|
||||
#define MMC_CMD_SWITCH_FIELD_BUS_WIDTH 183
|
||||
#define MMC_CMD_SWITCH_FIELD_HS_TIMING 185
|
||||
#define MMC_CMD_SWITCH_FIELD_POWER_CLASS 187
|
||||
#define MMC_CMD_SWITCH_FIELD_CMD_SET_REV 189
|
||||
#define MMC_CMD_SWITCH_FIELD_CMD_SET 191
|
||||
#define MMC_CMD_SWITCH_FIELD_EXT_CSD_REV 192
|
||||
#define MMC_CMD_SWITCH_FIELD_CSD_STRUCTURE 194
|
||||
#define MMC_CMD_SWITCH_FIELD_CARD_TYPE 196
|
||||
#define MMC_CMD_SWITCH_FIELD_PWR_CL_52_195 200
|
||||
#define MMC_CMD_SWITCH_FIELD_PWR_CL_26_195 201
|
||||
#define MMC_CMD_SWITCH_FIELD_PWR_CL_52_360 202
|
||||
#define MMC_CMD_SWITCH_FIELD_PWR_CL_26_360 203
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_R_4_26 205
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_W_4_26 206
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_R_8_26_4_52 207
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_W_8_26_4_52 208
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_R_8_52 209
|
||||
#define MMC_CMD_SWITCH_FIELD_MIN_PERF_W_8_52 210
|
||||
#define MMC_CMD_SWITCH_FIELD_SEC_COUNT_0 212
|
||||
#define MMC_CMD_SWITCH_FIELD_SEC_COUNT_1 213
|
||||
#define MMC_CMD_SWITCH_FIELD_SEC_COUNT_2 214
|
||||
#define MMC_CMD_SWITCH_FIELD_SEC_COUNT_3 215
|
||||
#define MMC_CMD_SWITCH_FIELD_S_A_TIMEOUT 217
|
||||
#define MMC_CMD_SWITCH_FIELD_S_C_VCCQ 219
|
||||
#define MMC_CMD_SWITCH_FIELD_S_C_VCC 220
|
||||
#define MMC_CMD_SWITCH_FIELD_HC_WP_GRP_SIZE 221
|
||||
#define MMC_CMD_SWITCH_FIELD_REL_WR_SEC_C 222
|
||||
#define MMC_CMD_SWITCH_FIELD_ERASE_TIMEOUT_MULT 223
|
||||
#define MMC_CMD_SWITCH_FIELD_HC_ERASE_GRP_SIZE 224
|
||||
#define MMC_CMD_SWITCH_FIELD_ACC_SIZE 225
|
||||
#define MMC_CMD_SWITCH_FIELD_BOOT_SIZE_MULTI 226
|
||||
#define MMC_CMD_SWITCH_FIELD_S_CMD_SET 504
|
||||
|
||||
#define MMC_CMD_SWITCH_FIELD_BUS_WIDTH_1BIT 0
|
||||
#define MMC_CMD_SWITCH_FIELD_BUS_WIDTH_4BIT 1
|
||||
#define MMC_CMD_SWITCH_FIELD_BUS_WIDTH_8BIT 2
|
||||
|
||||
#define MMC_CMD_SWITCH_FIELD_HS_TIMING_LOW_SPEED 0
|
||||
#define MMC_CMD_SWITCH_FIELD_HS_TIMING_HIGH_SPEED 1
|
||||
|
||||
#define MMC_STATUS_APP_CMD BIT(5)
|
||||
#define MMC_STATUS_SWITCH_ERROR BIT(7)
|
||||
#define MMC_STATUS_READY_FOR_DATA BIT(8)
|
||||
#define MMC_STATUS_CURRENT_STATE_MASK BITRANGE(9, 12)
|
||||
#define MMC_STATUS_CURRENT_STATE_IDLE 0
|
||||
#define MMC_STATUS_CURRENT_STATE_READY BIT(9)
|
||||
#define MMC_STATUS_CURRENT_STATE_IDENT BIT(10)
|
||||
#define MMC_STATUS_CURRENT_STATE_STBY (BIT(9) | BIT(10))
|
||||
#define MMC_STATUS_CURRENT_STATE_TRAN BIT(11)
|
||||
#define MMC_STATUS_CURRENT_STATE_DATA (BIT(9) | BIT(11))
|
||||
#define MMC_STATUS_CURRENT_STATE_RCV (BIT(10) | BIT(11))
|
||||
#define MMC_STATUS_CURRENT_STATE_PRG (BIT(9) | BIT(10) | BIT(11))
|
||||
#define MMC_STATUS_CURRENT_STATE_DIS BIT(12)
|
||||
#define MMC_STATUS_CURRENT_STATE_BTST (BIT(9) | BIT(12))
|
||||
#define MMC_STATUS_CURRENT_STATE_SLP (BIT(10) | BIT(12))
|
||||
#define MMC_STATUS_ERASE_RESET BIT(13)
|
||||
#define MMC_STATUS_WP_ERASE_SKIP BIT(15)
|
||||
#define MMC_STATUS_CID_CSD_OVERWRITE BIT(16)
|
||||
#define MMC_STATUS_OVERRUN BIT(17)
|
||||
#define MMC_STATUS_UNDERRUN BIT(18)
|
||||
#define MMC_STATUS_ERROR BIT(19)
|
||||
#define MMC_STATUS_CC_ERROR BIT(20)
|
||||
#define MMC_STATUS_CARD_ECC_FAILED BIT(21)
|
||||
#define MMC_STATUS_ILLEGAL_COMMAND BIT(22)
|
||||
#define MMC_STATUS_COM_CRC_ERROR BIT(23)
|
||||
#define MMC_STATUS_LOCK_UNLOCK_FAILED BIT(24)
|
||||
#define MMC_STATUS_CARD_IS_LOCKED BIT(25)
|
||||
#define MMC_STATUS_WP_VIOLATION BIT(26)
|
||||
#define MMC_STATUS_ERASE_PARAM BIT(27)
|
||||
#define MMC_STATUS_ERASE_SEQ_ERROR BIT(28)
|
||||
#define MMC_STATUS_BLOCK_LEN_ERROR BIT(29)
|
||||
#define MMC_STATUS_ADDRESS_MISALIGN BIT(30)
|
||||
#define MMC_STATUS_ADDRESS_OUT_OF_RANGE BIT(31)
|
||||
|
||||
#define MMC_OCR_170_195 BIT(7)
|
||||
#define MMC_OCR_200_260 BITRANGE(8, 14)
|
||||
#define MMC_OCR_270_360 BITRANGE(15, 23)
|
||||
#define MMC_OCR_ACCESS_MODE_MASK BITRANGE(29, 30)
|
||||
#define MMC_OCR_ACCESS_MODE_BYTE 0
|
||||
#define MMC_OCR_ACCESS_MODE_SECTOR BIT(30)
|
||||
#define MMC_OCR_POWER_UP_DONE BIT(31)
|
||||
|
||||
|
||||
#endif
|
||||
1142
firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
Normal file
1142
firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -97,7 +97,7 @@ default_interrupt(INT_IRQ40);
|
|||
default_interrupt(INT_IRQ41);
|
||||
default_interrupt(INT_IRQ42);
|
||||
default_interrupt(INT_IRQ43);
|
||||
default_interrupt(INT_IRQ44);
|
||||
default_interrupt(INT_MMC);
|
||||
default_interrupt(INT_IRQ45);
|
||||
default_interrupt(INT_IRQ46);
|
||||
default_interrupt(INT_IRQ47);
|
||||
|
|
@ -169,7 +169,7 @@ static void (* const irqvector[])(void) =
|
|||
INT_DMAC0,INT_DMAC1,INT_IRQ18,INT_USB_FUNC,INT_IRQ20,INT_IRQ21,INT_IRQ22,INT_WHEEL,
|
||||
INT_IRQ24,INT_IRQ25,INT_IRQ26,INT_IRQ27,INT_IRQ28,INT_ATA,INT_IRQ30,INT_IRQ31,
|
||||
INT_IRQ32,INT_IRQ33,INT_IRQ34,INT_IRQ35,INT_IRQ36,INT_IRQ37,INT_IRQ38,INT_IRQ39,
|
||||
INT_IRQ40,INT_IRQ41,INT_IRQ42,INT_IRQ43,INT_IRQ55,INT_IRQ56,INT_IRQ57,INT_IRQ58,
|
||||
INT_IRQ40,INT_IRQ41,INT_IRQ42,INT_IRQ43,INT_MMC,INT_IRQ45,INT_IRQ46,INT_IRQ47,
|
||||
INT_IRQ48,INT_IRQ49,INT_IRQ50,INT_IRQ51,INT_IRQ52,INT_IRQ53,INT_IRQ54,INT_IRQ55,
|
||||
INT_IRQ56,INT_IRQ57,INT_IRQ58,INT_IRQ59,INT_IRQ60,INT_IRQ61,INT_IRQ62,INT_IRQ63
|
||||
};
|
||||
|
|
@ -218,6 +218,8 @@ void system_init(void)
|
|||
{
|
||||
pmu_init();
|
||||
VIC0INTENABLE = 1 << IRQ_WHEEL;
|
||||
VIC0INTENABLE = 1 << IRQ_ATA;
|
||||
VIC1INTENABLE = 1 << (IRQ_MMC - 32);
|
||||
}
|
||||
|
||||
void system_reboot(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue