blob: 16c6b04b98a3d98bdae7893f60cc913fa033524e [file] [log] [blame]
Jit Loon Lima7f54942023-05-17 12:26:11 +08001/*
2 * Copyright (c) 2022-2023, Intel Corporation. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SDMMC_H
8#define SDMMC_H
9
10#include <lib/mmio.h>
11#include "socfpga_handoff.h"
12
13#define PERIPHERAL_SDMMC_MASK 0x60
14#define PERIPHERAL_SDMMC_OFFSET 6
15
16#define DEFAULT_SDMMC_MAX_RETRIES 5
17#define SEND_SDMMC_OP_COND_MAX_RETRIES 100
18#define SDMMC_MULT_BY_512K_SHIFT 19
19
20static const unsigned char tran_speed_base[16] = {
21 0, 10, 12, 13, 15, 20, 26, 30, 35, 40, 45, 52, 55, 60, 70, 80
22};
23
24static const unsigned char sd_tran_speed_base[16] = {
25 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80
26};
27
28
29/* FUNCTION DEFINATION */
30/*
31 * @brief SDMMC controller initialization function
32 *
33 * @hoff_ptr: Pointer to the hand-off data
34 * Return: 0 on success, a negative errno on failure
35 */
36int sdmmc_init(handoff *hoff_ptr, struct cdns_sdmmc_params *params,
37 struct mmc_device_info *info);
38int sd_or_mmc_init(const struct mmc_ops *ops_ptr, unsigned int clk,
39 unsigned int width, unsigned int flags,
40 struct mmc_device_info *device_info);
41void sdmmc_pin_config(void);
42#endif