1 /** @file
2 
3   Copyright (c) 2017, Linaro. All rights reserved.
4 
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __PLATFORM_DW_MMC_H__
16 #define __PLATFORM_DW_MMC_H__
17 
18 typedef enum {
19   RemovableSlot,
20   EmbeddedSlot,
21   SharedBusSlot,
22   UnknownSlot
23 } EFI_SD_MMC_SLOT_TYPE;
24 
25 typedef enum {
26   UnknownCardType,
27   SdCardType,
28   SdioCardType,
29   MmcCardType,
30   EmmcCardType
31 } SD_MMC_CARD_TYPE;
32 
33 typedef struct {
34   UINT32        DefaultSpeed:1;    // bit 0
35   UINT32        HighSpeed:1;       // bit 1
36   UINT32        Sdr12:1;           // bit 2
37   UINT32        Sdr25:1;           // bit 3
38   UINT32        Sdr50:1;           // bit 4
39   UINT32        Sdr104:1;          // bit 5
40   UINT32        Ddr50:1;           // bit 6
41   UINT32        SysBus64:1;        // bit 7
42   UINT32        BusWidth:4;        // bit 11:8
43   UINT32        SlotType:2;        // bit 13:12
44   UINT32        CardType:3;        // bit 16:14
45   UINT32        Voltage18:1;       // bit 17
46   UINT32        Voltage30:1;       // bit 18
47   UINT32        Voltage33:1;       // bit 19
48   UINT32        BaseClkFreq;
49   EFI_HANDLE    Controller;
50 } DW_MMC_HC_SLOT_CAP;
51 
52 //
53 // Protocol interface structure
54 //
55 typedef struct _PLATFORM_DW_MMC_PROTOCOL       PLATFORM_DW_MMC_PROTOCOL;
56 
57 typedef
58 EFI_STATUS
59 (EFIAPI *PLATFORM_DW_MMC_GET_CAPABILITY) (
60   IN     EFI_HANDLE             Controller,
61   IN     UINT8                  Slot,
62      OUT DW_MMC_HC_SLOT_CAP     *Capability
63   );
64 
65 typedef
66 BOOLEAN
67 (EFIAPI *PLATFORM_DW_MMC_CARD_DETECT) (
68   IN EFI_HANDLE                 Controller,
69   IN UINT8                      Slot
70   );
71 
72 struct _PLATFORM_DW_MMC_PROTOCOL {
73   PLATFORM_DW_MMC_GET_CAPABILITY               GetCapability;
74   PLATFORM_DW_MMC_CARD_DETECT                  CardDetect;
75 };
76 
77 extern EFI_GUID gPlatformDwMmcProtocolGuid;
78 
79 #endif /* __PLATFORM_DW_MMC_H__ */
80