.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
8 | 4 | */ |
---|
9 | 5 | |
---|
10 | 6 | #include <linux/module.h> |
---|
.. | .. |
---|
14 | 10 | #include <linux/of_address.h> |
---|
15 | 11 | #include <linux/mmc/slot-gpio.h> |
---|
16 | 12 | #include <linux/pm_runtime.h> |
---|
| 13 | +#include <linux/rockchip/cpu.h> |
---|
17 | 14 | #include <linux/slab.h> |
---|
18 | 15 | |
---|
19 | 16 | #include "dw_mmc.h" |
---|
.. | .. |
---|
394 | 391 | "rockchip,rk3288-dw-mshc")) |
---|
395 | 392 | host->bus_hz /= RK3288_CLKGEN_DIV; |
---|
396 | 393 | |
---|
| 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 | + |
---|
397 | 407 | host->need_xfer_timer = true; |
---|
398 | 408 | return 0; |
---|
399 | 409 | } |
---|
.. | .. |
---|
438 | 448 | if (!pdev->dev.of_node) |
---|
439 | 449 | return -ENODEV; |
---|
440 | 450 | |
---|
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")) |
---|
445 | 453 | use_rpm = false; |
---|
446 | 454 | |
---|
447 | 455 | match = of_match_node(dw_mci_rockchip_match, pdev->dev.of_node); |
---|
.. | .. |
---|
452 | 460 | * pm_runtime_force_resume calls rpm resume callback |
---|
453 | 461 | */ |
---|
454 | 462 | pm_runtime_get_noresume(&pdev->dev); |
---|
| 463 | + pm_runtime_set_active(&pdev->dev); |
---|
455 | 464 | |
---|
456 | 465 | if (use_rpm) { |
---|
457 | | - pm_runtime_set_active(&pdev->dev); |
---|
458 | 466 | pm_runtime_enable(&pdev->dev); |
---|
459 | 467 | pm_runtime_set_autosuspend_delay(&pdev->dev, 50); |
---|
460 | 468 | pm_runtime_use_autosuspend(&pdev->dev); |
---|