config UFS_ROCKCHIP
bool "Rockchip specific hooks to UFS controller platform driver"
depends on UFS
+ depends on DM_GPIO
+ depends on RESET_ROCKCHIP
+ depends on SPL_DM_GPIO || !SPL_UFS_SUPPORT
+ depends on SPL_RESET_ROCKCHIP || !SPL_UFS_SUPPORT
help
This selects the Rockchip specific additions to UFSHCD platform driver.
* Copyright (C) 2025 Rockchip Electronics Co.Ltd.
*/
+#include <asm/gpio.h>
#include <asm/io.h>
#include <clk.h>
#include <dm.h>
return err;
}
+ err = gpio_request_by_name(dev, "reset-gpios", 0, &host->device_reset,
+ GPIOD_IS_OUT | GPIOD_ACTIVE_LOW);
+ if (err) {
+ dev_err(dev, "Cannot get reset GPIO\n");
+ return err;
+ }
+
host->hba = hba;
return 0;
}
+static int ufs_rockchip_device_reset(struct ufs_hba *hba)
+{
+ struct ufs_rockchip_host *host = dev_get_priv(hba->dev);
+
+ dm_gpio_set_value(&host->device_reset, true);
+ udelay(20);
+
+ dm_gpio_set_value(&host->device_reset, false);
+ udelay(20);
+
+ return 0;
+}
+
static int ufs_rockchip_rk3576_init(struct ufs_hba *hba)
{
int ret = 0;
.init = ufs_rockchip_rk3576_init,
.phy_initialization = ufs_rockchip_rk3576_phy_init,
.hce_enable_notify = ufs_rockchip_hce_enable_notify,
+ .device_reset = ufs_rockchip_device_reset,
};
static const struct udevice_id ufs_rockchip_of_match[] = {
void __iomem *ufs_sys_ctrl;
void __iomem *mphy_base;
struct reset_ctl_bulk rsts;
+ struct gpio_desc device_reset;
struct clk ref_out_clk;
uint64_t caps;
uint32_t phy_config_mode;