1 /*
2 * Copyright (c) 2017, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /** ============================================================================
33 * @file MMCSD_soc.h
34 *
35 * @brief MMC driver implementation for a am57x MMC controller.
36 *
37 * The MMC header file should be included in an application as follows:
38 * @code
39 * #include <ti/drv/mmcsd/MMCSD.h>
40 * #include <ti/drv/mmcsd/soc/MMCSD_soc.h>
41 * @endcode
42 *
43 *
44 * ============================================================================
45 */
47 #ifndef MMCSD_SOC__H
48 #define MMCSD_SOC__H
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
54 #include <stdint.h>
55 #include <stdlib.h>
56 #include <string.h>
57 #include <ti/csl/soc.h>
58 #include <ti/csl/csl_chip.h>
59 #include <ti/osal/osal.h>
61 #if defined (SOC_AM574x) || defined (SOC_AM572x) || defined (SOC_AM571x) || defined (SOC_DRA72x) || defined (SOC_DRA75x) || defined (SOC_DRA78x) || defined (SOC_AM335x) || defined (SOC_AM437x) || defined(SOC_K2G)
62 #include <ti/drv/mmcsd/soc/MMCSD_v1.h>
63 #elif defined (SOC_OMAPL137) || defined(SOC_OMAPL138)
64 #include <ti/drv/mmcsd/soc/MMCSD_v0.h>
65 #elif defined(SOC_AM65XX) || defined(SOC_J721E)
66 #include <ti/drv/mmcsd/soc/MMCSD_v2.h>
67 #endif
70 #if defined(SOC_AM574x) || defined(SOC_AM572x) || defined (SOC_AM571x)
71 #define MMCSD_CNT CSL_MPU_MMCHS_CNT
72 #elif defined(SOC_AM437x) || defined (SOC_AM335x)
73 #define MMCSD_CNT 3
74 #elif defined(SOC_DRA72x) || defined(SOC_DRA75x)
75 #define MMCSD_CNT CSL_MMCHS_CNT
76 #elif defined(SOC_DRA78x)
77 #define MMCSD_CNT 1
78 #elif defined(SOC_K2G)
79 #define MMCSD_CNT CSL_MMCSD_CNT
80 #elif defined(SOC_OMAPL137) || defined(SOC_OMAPL138)
81 #define MMCSD_CNT CSL_MMCSD_CNT
82 #elif defined(SOC_AM65XX)
83 #define MMCSD_CNT 2
84 #elif defined(SOC_J721E)
85 #define MMCSD_CNT 3
86 #endif
87 #ifdef __cplusplus
88 }
89 #endif
91 /*
92 * This function converts the local L2 address to a global address and
93 * will be used for DMA transactions which needs a global address.
94 */
95 uint32_t MMCSD_soc_l2_global_addr (uint32_t addr);
97 /*
98 * This function switches the voltage of the CMD & DAT lines of MMCSD instance (1.8V <-> 3.0V)
99 * during initialization if a UHS-1 card is found. This function is board specific and is implemented
100 * by the Board library.
101 */
102 extern MMCSD_Error Board_mmc_voltageSwitchFxn(uint32_t instance, MMCSD_BusVoltage_e switch_voltage);
104 /* This function will configure the interrupt path to the destination CPU
105 * using DMSC firmware via sciclient. if setIntrPath is set to TRUE,
106 * a path is set, else the interrupt path is released
107 */
108 extern MMCSD_Error MMCSD_configSocIntrPath(const void *hwAttrs_ptr,bool setIntrPath);
110 /* This SOC function will initialize InitConfig[] as per the core/subsystem
111 * the driver is running on. This includes domain specific parameters such as
112 * intNum, baseAddress etc.
113 */
114 extern MMCSD_Error MMCSD_socInit(void);
115 #endif /* _MMCSD_SOC_H */