blob: 2441d5d7e80c776f308a9cf8d5467f0459ceb87a [file] [log] [blame]
Lee Leahyeef40eb2017-03-23 10:54:57 -07001/*
Martin Roth0443ac22019-08-30 21:29:41 -06002 * This file is part of the coreboot project.
Lee Leahyeef40eb2017-03-23 10:54:57 -07003 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
Lee Leahy48dbc662017-05-08 16:56:03 -070015#ifndef __COMMONLIB_STORAGE_MMC_H__
16#define __COMMONLIB_STORAGE_MMC_H__
Lee Leahyeef40eb2017-03-23 10:54:57 -070017
Lee Leahy48dbc662017-05-08 16:56:03 -070018#include <commonlib/sd_mmc_ctrlr.h>
Lee Leahyeef40eb2017-03-23 10:54:57 -070019
20#define MMC_HS_TIMING 0x00000100
21#define MMC_HS_52MHZ 0x2
22#define MMC_HS_200MHZ 0x10
23#define MMC_HS400 0x40
24
25#define SECURE_ERASE 0x80000000
26
27#define MMC_STATUS_MASK (~0x0206BF7F)
28#define MMC_STATUS_RDY_FOR_DATA (1 << 8)
29#define MMC_STATUS_CURR_STATE (0xf << 9)
30#define MMC_STATUS_ERROR (1 << 19)
31
32#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
33#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits in EXT_CSD byte
34 addressed by index which are
35 1 in value field */
36#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits in EXT_CSD byte
37 addressed by index, which are
38 1 in value field */
39#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target byte to value */
40
41#define R1_ILLEGAL_COMMAND (1 << 22)
42#define R1_APP_CMD (1 << 5)
43
44#define MMC_INIT_TIMEOUT_US (1000 * 1000)
45#define MMC_INIT_TIMEOUT_US_MS 1000
46
47int storage_block_setup_media(struct storage_media *media,
48 struct sd_mmc_ctrlr *ctrlr);
49
Lee Leahy48dbc662017-05-08 16:56:03 -070050#endif /* __COMMONLIB_STORAGE_MMC_H__ */