hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/mmc/host/dw_mmc-rockchip.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
84 */
95
106 #include <linux/module.h>
....@@ -14,6 +10,7 @@
1410 #include <linux/of_address.h>
1511 #include <linux/mmc/slot-gpio.h>
1612 #include <linux/pm_runtime.h>
13
+#include <linux/rockchip/cpu.h>
1714 #include <linux/slab.h>
1815
1916 #include "dw_mmc.h"
....@@ -394,6 +391,19 @@
394391 "rockchip,rk3288-dw-mshc"))
395392 host->bus_hz /= RK3288_CLKGEN_DIV;
396393
394
+ if (of_device_is_compatible(host->dev->of_node,
395
+ "rockchip,rv1106-dw-mshc") &&
396
+ rockchip_get_cpu_version() == 0 &&
397
+ !strcmp(dev_name(host->dev), "ffaa0000.mmc")) {
398
+ if (device_property_read_bool(host->dev, "no-sd")) {
399
+ dev_err(host->dev, "Invalid usage, should be SD card only\n");
400
+ return -EINVAL;
401
+ }
402
+
403
+ host->is_rv1106_sd = true;
404
+ dev_info(host->dev, "is rv1106 sd\n");
405
+ }
406
+
397407 host->need_xfer_timer = true;
398408 return 0;
399409 }
....@@ -438,10 +448,8 @@
438448 if (!pdev->dev.of_node)
439449 return -ENODEV;
440450
441
- if ((!device_property_read_bool(&pdev->dev, "non-removable") &&
442
- !device_property_read_bool(&pdev->dev, "cd-gpios")) ||
443
- (device_property_read_bool(&pdev->dev, "no-sd") &&
444
- device_property_read_bool(&pdev->dev, "no-mmc")))
451
+ if (!device_property_read_bool(&pdev->dev, "non-removable") &&
452
+ !device_property_read_bool(&pdev->dev, "cd-gpios"))
445453 use_rpm = false;
446454
447455 match = of_match_node(dw_mci_rockchip_match, pdev->dev.of_node);
....@@ -452,9 +460,9 @@
452460 * pm_runtime_force_resume calls rpm resume callback
453461 */
454462 pm_runtime_get_noresume(&pdev->dev);
463
+ pm_runtime_set_active(&pdev->dev);
455464
456465 if (use_rpm) {
457
- pm_runtime_set_active(&pdev->dev);
458466 pm_runtime_enable(&pdev->dev);
459467 pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
460468 pm_runtime_use_autosuspend(&pdev->dev);