summaryrefslogtreecommitdiff
path: root/bsp/raspberry-pi/raspi-dm2.0/drivers/sdhci/include/sdhci-platform.h
blob: bc5c7dab2ae49f24838713730b294e2aa7f080b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * Copyright (c) 2006-2024 RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author        Notes
 * 2024-08-16     zhujiale     first version
 */

#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
#define _DRIVERS_MMC_SDHCI_PLTFM_H
#include <rtthread.h>
#include <drivers/core/dm.h>
#include <drivers/ofw.h>
#include <drivers/platform.h>
#include <drivers/clk.h>
#include "sdhci.h"

struct sdhci_pltfm_data
{
    const struct sdhci_ops *ops;
    unsigned int            quirks;
    unsigned int            quirks2;
};

struct sdhci_pltfm_host
{
    struct rt_clk *clk;

    /* migrate from sdhci_of_host */
    unsigned int clock;
    rt_uint64_t  xfer_mode_shadow;

    unsigned long private[];
};

void sdhci_get_property(struct rt_platform_device *pdev);

static inline void sdhci_get_of_property(struct rt_platform_device *pdev)
{
    return sdhci_get_property(pdev);
}


extern struct sdhci_host *sdhci_pltfm_init(struct rt_platform_device     *pdev,
                                           const struct sdhci_pltfm_data *pdata,
                                           size_t                         priv_size);
extern void               sdhci_pltfm_free(struct rt_platform_device *pdev);

extern int  sdhci_pltfm_init_and_add_host(struct rt_platform_device     *pdev,
                                          const struct sdhci_pltfm_data *pdata,
                                          size_t                         priv_size);
extern void sdhci_pltfm_remove(struct rt_platform_device *pdev);

extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);

static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host)
{
    return host->private;
}

extern const struct dev_pm_ops sdhci_pltfm_pmops;
static inline int              sdhci_pltfm_suspend(struct rt_device *dev)
{
    return 0;
}
static inline int sdhci_pltfm_resume(struct rt_device *dev)
{
    return 0;
}


#endif