102 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * cb710/cb710-mmc.h4 *5 * Copyright by Michał Mirosław, 2008-20096 */7#ifndef LINUX_CB710_MMC_H8#define LINUX_CB710_MMC_H9 10#include <linux/cb710.h>11#include <linux/workqueue.h>12 13/* per-MMC-reader structure */14struct cb710_mmc_reader {15 struct work_struct finish_req_bh_work;16 struct mmc_request *mrq;17 spinlock_t irq_lock;18 unsigned char last_power_mode;19};20 21/* some device struct walking */22 23static inline struct mmc_host *cb710_slot_to_mmc(struct cb710_slot *slot)24{25 return platform_get_drvdata(&slot->pdev);26}27 28static inline struct cb710_slot *cb710_mmc_to_slot(struct mmc_host *mmc)29{30 struct platform_device *pdev = to_platform_device(mmc_dev(mmc));31 return cb710_pdev_to_slot(pdev);32}33 34/* registers (this might be all wrong ;) */35 36#define CB710_MMC_DATA_PORT 0x0037 38#define CB710_MMC_CONFIG_PORT 0x0439#define CB710_MMC_CONFIG0_PORT 0x0440#define CB710_MMC_CONFIG1_PORT 0x0541#define CB710_MMC_C1_4BIT_DATA_BUS 0x4042#define CB710_MMC_CONFIG2_PORT 0x0643#define CB710_MMC_C2_READ_PIO_SIZE_MASK 0x0F /* N-1 */44#define CB710_MMC_CONFIG3_PORT 0x0745 46#define CB710_MMC_CONFIGB_PORT 0x0847 48#define CB710_MMC_IRQ_ENABLE_PORT 0x0C49#define CB710_MMC_IE_TEST_MASK 0x00BF50#define CB710_MMC_IE_CARD_INSERTION_STATUS 0x100051#define CB710_MMC_IE_IRQ_ENABLE 0x800052#define CB710_MMC_IE_CISTATUS_MASK \53 (CB710_MMC_IE_CARD_INSERTION_STATUS|CB710_MMC_IE_IRQ_ENABLE)54 55#define CB710_MMC_STATUS_PORT 0x1056#define CB710_MMC_STATUS_ERROR_EVENTS 0x60FF57#define CB710_MMC_STATUS0_PORT 0x1058#define CB710_MMC_S0_FIFO_UNDERFLOW 0x4059#define CB710_MMC_STATUS1_PORT 0x1160#define CB710_MMC_S1_COMMAND_SENT 0x0161#define CB710_MMC_S1_DATA_TRANSFER_DONE 0x0262#define CB710_MMC_S1_PIO_TRANSFER_DONE 0x0463#define CB710_MMC_S1_CARD_CHANGED 0x1064#define CB710_MMC_S1_RESET 0x2065#define CB710_MMC_STATUS2_PORT 0x1266#define CB710_MMC_S2_FIFO_READY 0x0167#define CB710_MMC_S2_FIFO_EMPTY 0x0268#define CB710_MMC_S2_BUSY_10 0x1069#define CB710_MMC_S2_BUSY_20 0x2070#define CB710_MMC_STATUS3_PORT 0x1371#define CB710_MMC_S3_CARD_DETECTED 0x0272#define CB710_MMC_S3_WRITE_PROTECTED 0x0473 74#define CB710_MMC_CMD_TYPE_PORT 0x1475#define CB710_MMC_RSP_TYPE_MASK 0x000776#define CB710_MMC_RSP_R1 (0)77#define CB710_MMC_RSP_136 (5)78#define CB710_MMC_RSP_NO_CRC (2)79#define CB710_MMC_RSP_PRESENT_MASK 0x001880#define CB710_MMC_RSP_NONE (0 << 3)81#define CB710_MMC_RSP_PRESENT (1 << 3)82#define CB710_MMC_RSP_PRESENT_X (2 << 3)83#define CB710_MMC_CMD_TYPE_MASK 0x006084#define CB710_MMC_CMD_BC (0 << 5)85#define CB710_MMC_CMD_BCR (1 << 5)86#define CB710_MMC_CMD_AC (2 << 5)87#define CB710_MMC_CMD_ADTC (3 << 5)88#define CB710_MMC_DATA_READ 0x008089#define CB710_MMC_CMD_CODE_MASK 0x3F0090#define CB710_MMC_CMD_CODE_SHIFT 891#define CB710_MMC_IS_APP_CMD 0x400092#define CB710_MMC_RSP_BUSY 0x800093 94#define CB710_MMC_CMD_PARAM_PORT 0x1895#define CB710_MMC_TRANSFER_SIZE_PORT 0x1C96#define CB710_MMC_RESPONSE0_PORT 0x2097#define CB710_MMC_RESPONSE1_PORT 0x2498#define CB710_MMC_RESPONSE2_PORT 0x2899#define CB710_MMC_RESPONSE3_PORT 0x2C100 101#endif /* LINUX_CB710_MMC_H */102