io_uring: ensure finish_wait() is always called in __io_uring_task_cancel()
[linux/fpc-iii.git] / drivers / mmc / host / dw_mmc-bluefield.c
blob10baf122bc15e4b1dddadc2d37c707e11d39c5f0
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2018 Mellanox Technologies.
4 */
6 #include <linux/bitfield.h>
7 #include <linux/bitops.h>
8 #include <linux/mmc/host.h>
9 #include <linux/mmc/mmc.h>
10 #include <linux/module.h>
11 #include <linux/of.h>
12 #include <linux/platform_device.h>
13 #include <linux/pm_runtime.h>
15 #include "dw_mmc.h"
16 #include "dw_mmc-pltfm.h"
18 #define UHS_REG_EXT_SAMPLE_MASK GENMASK(22, 16)
19 #define UHS_REG_EXT_DRIVE_MASK GENMASK(29, 23)
20 #define BLUEFIELD_UHS_REG_EXT_SAMPLE 2
21 #define BLUEFIELD_UHS_REG_EXT_DRIVE 4
23 static void dw_mci_bluefield_set_ios(struct dw_mci *host, struct mmc_ios *ios)
25 u32 reg;
27 /* Update the Drive and Sample fields in register UHS_REG_EXT. */
28 reg = mci_readl(host, UHS_REG_EXT);
29 reg &= ~UHS_REG_EXT_SAMPLE_MASK;
30 reg |= FIELD_PREP(UHS_REG_EXT_SAMPLE_MASK,
31 BLUEFIELD_UHS_REG_EXT_SAMPLE);
32 reg &= ~UHS_REG_EXT_DRIVE_MASK;
33 reg |= FIELD_PREP(UHS_REG_EXT_DRIVE_MASK, BLUEFIELD_UHS_REG_EXT_DRIVE);
34 mci_writel(host, UHS_REG_EXT, reg);
37 static const struct dw_mci_drv_data bluefield_drv_data = {
38 .set_ios = dw_mci_bluefield_set_ios
41 static const struct of_device_id dw_mci_bluefield_match[] = {
42 { .compatible = "mellanox,bluefield-dw-mshc",
43 .data = &bluefield_drv_data },
44 {},
46 MODULE_DEVICE_TABLE(of, dw_mci_bluefield_match);
48 static int dw_mci_bluefield_probe(struct platform_device *pdev)
50 return dw_mci_pltfm_register(pdev, &bluefield_drv_data);
53 static struct platform_driver dw_mci_bluefield_pltfm_driver = {
54 .probe = dw_mci_bluefield_probe,
55 .remove = dw_mci_pltfm_remove,
56 .driver = {
57 .name = "dwmmc_bluefield",
58 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
59 .of_match_table = dw_mci_bluefield_match,
60 .pm = &dw_mci_pltfm_pmops,
64 module_platform_driver(dw_mci_bluefield_pltfm_driver);
66 MODULE_DESCRIPTION("BlueField DW Multimedia Card driver");
67 MODULE_AUTHOR("Mellanox Technologies");
68 MODULE_LICENSE("GPL v2");