Loading Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +4 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Required properties: Optional properties: - ufs-phy : phandle to UFS PHY node - vdd-hba-supply : phandle to UFS host controller supply regulator node - vcc-supply : phandle to VCC supply regulator node - vccq-supply : phandle to VCCQ supply regulator node - vccq2-supply : phandle to VCCQ2 supply regulator node Loading @@ -21,6 +22,7 @@ Optional properties: - vcc-max-microamp : specifies max. load that can be drawn from vcc supply - vccq-max-microamp : specifies max. load that can be drawn from vccq supply - vccq2-max-microamp : specifies max. load that can be drawn from vccq2 supply - <name>-fixed-regulator : boolean property specifying that <name>-supply is a fixed regulator - clocks : List of phandle and clock specifier pairs - clock-names : List of clock input name strings sorted in the same Loading @@ -41,6 +43,8 @@ Example: interrupts = <0 28 0>; ufs-phy = <&ufsphy>; vdd-hba-supply = <&xxx_reg0>; vdd-hba-fixed-regulator; vcc-supply = <&xxx_reg1>; vcc-supply-1p8; vccq-supply = <&xxx_reg2>; Loading drivers/scsi/ufs/ufs.h +1 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,7 @@ struct ufs_vreg_info { struct ufs_vreg *vcc; struct ufs_vreg *vccq; struct ufs_vreg *vccq2; struct ufs_vreg *vdd_hba; }; struct ufs_dev_info { Loading drivers/scsi/ufs/ufshcd-pltfrm.c +9 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, vreg->name = kstrdup(name, GFP_KERNEL); /* if fixed regulator no need further initialization */ snprintf(prop_name, MAX_PROP_SIZE, "%s-fixed-regulator", name); if (of_property_read_bool(np, prop_name)) goto out; snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name); ret = of_property_read_u32(np, prop_name, &vreg->max_uA); if (ret) { Loading Loading @@ -214,6 +219,10 @@ static int ufshcd_parse_regulator_info(struct ufs_hba *hba) struct device *dev = hba->dev; struct ufs_vreg_info *info = &hba->vreg_info; err = ufshcd_populate_vreg(dev, "vdd-hba", &info->vdd_hba); if (err) goto out; err = ufshcd_populate_vreg(dev, "vcc", &info->vcc); if (err) goto out; Loading drivers/scsi/ufs/ufshcd.c +40 −2 Original line number Diff line number Diff line Loading @@ -4968,6 +4968,16 @@ out: return ret; } static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on) { struct ufs_vreg_info *info = &hba->vreg_info; if (info) return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on); else return 0; } static int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg) { int ret = 0; Loading Loading @@ -5007,6 +5017,16 @@ out: return ret; } static int ufshcd_init_hba_vreg(struct ufs_hba *hba) { struct ufs_vreg_info *info = &hba->vreg_info; if (info) return ufshcd_get_vreg(hba->dev, info->vdd_hba); else return 0; } static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, bool skip_ref_clk) { Loading Loading @@ -5152,14 +5172,29 @@ static int ufshcd_hba_init(struct ufs_hba *hba) { int err; err = ufshcd_init_clocks(hba); /* * Handle host controller power separately from the UFS device power * rails as it will help controlling the UFS host controller power * collapse easily which is different than UFS device power collapse. * Also, enable the host controller power before we go ahead with rest * of the initialization here. */ err = ufshcd_init_hba_vreg(hba); if (err) goto out; err = ufshcd_setup_clocks(hba, true); err = ufshcd_setup_hba_vreg(hba, true); if (err) goto out; err = ufshcd_init_clocks(hba); if (err) goto out_disable_hba_vreg; err = ufshcd_setup_clocks(hba, true); if (err) goto out_disable_hba_vreg; err = ufshcd_init_vreg(hba); if (err) goto out_disable_clks; Loading @@ -5179,6 +5214,8 @@ out_disable_vreg: ufshcd_setup_vreg(hba, false); out_disable_clks: ufshcd_setup_clocks(hba, false); out_disable_hba_vreg: ufshcd_setup_hba_vreg(hba, false); out: return err; } Loading @@ -5189,6 +5226,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba) ufshcd_variant_hba_exit(hba); ufshcd_setup_vreg(hba, false); ufshcd_setup_clocks(hba, false); ufshcd_setup_hba_vreg(hba, false); hba->is_powered = false; } } Loading Loading
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +4 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Required properties: Optional properties: - ufs-phy : phandle to UFS PHY node - vdd-hba-supply : phandle to UFS host controller supply regulator node - vcc-supply : phandle to VCC supply regulator node - vccq-supply : phandle to VCCQ supply regulator node - vccq2-supply : phandle to VCCQ2 supply regulator node Loading @@ -21,6 +22,7 @@ Optional properties: - vcc-max-microamp : specifies max. load that can be drawn from vcc supply - vccq-max-microamp : specifies max. load that can be drawn from vccq supply - vccq2-max-microamp : specifies max. load that can be drawn from vccq2 supply - <name>-fixed-regulator : boolean property specifying that <name>-supply is a fixed regulator - clocks : List of phandle and clock specifier pairs - clock-names : List of clock input name strings sorted in the same Loading @@ -41,6 +43,8 @@ Example: interrupts = <0 28 0>; ufs-phy = <&ufsphy>; vdd-hba-supply = <&xxx_reg0>; vdd-hba-fixed-regulator; vcc-supply = <&xxx_reg1>; vcc-supply-1p8; vccq-supply = <&xxx_reg2>; Loading
drivers/scsi/ufs/ufs.h +1 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,7 @@ struct ufs_vreg_info { struct ufs_vreg *vcc; struct ufs_vreg *vccq; struct ufs_vreg *vccq2; struct ufs_vreg *vdd_hba; }; struct ufs_dev_info { Loading
drivers/scsi/ufs/ufshcd-pltfrm.c +9 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,11 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, vreg->name = kstrdup(name, GFP_KERNEL); /* if fixed regulator no need further initialization */ snprintf(prop_name, MAX_PROP_SIZE, "%s-fixed-regulator", name); if (of_property_read_bool(np, prop_name)) goto out; snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name); ret = of_property_read_u32(np, prop_name, &vreg->max_uA); if (ret) { Loading Loading @@ -214,6 +219,10 @@ static int ufshcd_parse_regulator_info(struct ufs_hba *hba) struct device *dev = hba->dev; struct ufs_vreg_info *info = &hba->vreg_info; err = ufshcd_populate_vreg(dev, "vdd-hba", &info->vdd_hba); if (err) goto out; err = ufshcd_populate_vreg(dev, "vcc", &info->vcc); if (err) goto out; Loading
drivers/scsi/ufs/ufshcd.c +40 −2 Original line number Diff line number Diff line Loading @@ -4968,6 +4968,16 @@ out: return ret; } static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on) { struct ufs_vreg_info *info = &hba->vreg_info; if (info) return ufshcd_toggle_vreg(hba->dev, info->vdd_hba, on); else return 0; } static int ufshcd_get_vreg(struct device *dev, struct ufs_vreg *vreg) { int ret = 0; Loading Loading @@ -5007,6 +5017,16 @@ out: return ret; } static int ufshcd_init_hba_vreg(struct ufs_hba *hba) { struct ufs_vreg_info *info = &hba->vreg_info; if (info) return ufshcd_get_vreg(hba->dev, info->vdd_hba); else return 0; } static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, bool skip_ref_clk) { Loading Loading @@ -5152,14 +5172,29 @@ static int ufshcd_hba_init(struct ufs_hba *hba) { int err; err = ufshcd_init_clocks(hba); /* * Handle host controller power separately from the UFS device power * rails as it will help controlling the UFS host controller power * collapse easily which is different than UFS device power collapse. * Also, enable the host controller power before we go ahead with rest * of the initialization here. */ err = ufshcd_init_hba_vreg(hba); if (err) goto out; err = ufshcd_setup_clocks(hba, true); err = ufshcd_setup_hba_vreg(hba, true); if (err) goto out; err = ufshcd_init_clocks(hba); if (err) goto out_disable_hba_vreg; err = ufshcd_setup_clocks(hba, true); if (err) goto out_disable_hba_vreg; err = ufshcd_init_vreg(hba); if (err) goto out_disable_clks; Loading @@ -5179,6 +5214,8 @@ out_disable_vreg: ufshcd_setup_vreg(hba, false); out_disable_clks: ufshcd_setup_clocks(hba, false); out_disable_hba_vreg: ufshcd_setup_hba_vreg(hba, false); out: return err; } Loading @@ -5189,6 +5226,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba) ufshcd_variant_hba_exit(hba); ufshcd_setup_vreg(hba, false); ufshcd_setup_clocks(hba, false); ufshcd_setup_hba_vreg(hba, false); hba->is_powered = false; } } Loading