Unverified Commit 2bb1acc6 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'reset-for-v6.11-2' of git://git.pengutronix.de/pza/linux into soc/drivers

Reset controller updates for v6.11, part 2

This tag adds USB VBUS regulator control for Renesas RZ/G2L SoCs,
which also touches PHY driver and device tree, and pulls in a new
regulator_hardware_enable() helper.

The Tegra BPMP reset driver can be compiled under COMPILE_TEST now.

* tag 'reset-for-v6.11-2' of git://git.pengutronix.de/pza/linux:
  arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS
  phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs
  reset: renesas: Add USB VBUS regulator device as child
  dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator
  reset: tegra-bpmp: allow building under COMPILE_TEST
  regulator: core: Add helper for allow HW access to enable/disable regulator

Link: https://lore.kernel.org/r/20240703100809.2773890-1-p.zabel@pengutronix.de


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents ee22fbd7 c1267e1a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -42,6 +42,12 @@ properties:
      0 = Port 1 Phy reset
      1 = Port 2 Phy reset

  regulator-vbus:
    type: object
    description: USB VBUS regulator
    $ref: /schemas/regulator/regulator.yaml#
    unevaluatedProperties: false

required:
  - compatible
  - reg
@@ -49,6 +55,7 @@ required:
  - resets
  - power-domains
  - '#reset-cells'
  - regulator-vbus

additionalProperties: false

@@ -64,4 +71,7 @@ examples:
        resets = <&cpg R9A07G044_USB_PRESETN>;
        power-domains = <&cpg>;
        #reset-cells = <1>;
        regulator-vbus {
            regulator-name = "vbus";
        };
    };
+6 −0
Original line number Diff line number Diff line
@@ -227,3 +227,9 @@ directly written to the voltage selector register, use::

	int regulator_list_hardware_vsel(struct regulator *regulator,
					 unsigned selector);

To access the hardware for enabling/disabling the regulator, consumers must
use regulator_get_exclusive(), as it can't work if there's more than one
consumer. To enable/disable regulator use::

	int regulator_hardware_enable(struct regulator *regulator, bool enable);
+3 −8
Original line number Diff line number Diff line
@@ -54,14 +54,6 @@ codec_dai: simple-audio-card,codec {
		};
	};

	usb0_vbus_otg: regulator-usb0-vbus-otg {
		compatible = "regulator-fixed";

		regulator-name = "USB0_VBUS_OTG";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
	};

	vccq_sdhi1: regulator-vccq-sdhi1 {
		compatible = "regulator-gpio";
		regulator-name = "SDHI1 VccQ";
@@ -139,6 +131,9 @@ &ohci1 {

&phyrst {
	status = "okay";
	usb0_vbus_otg: regulator-vbus {
		regulator-name = "vbus";
	};
};

&scif0 {
+7 −1
Original line number Diff line number Diff line
@@ -188,6 +188,9 @@ static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus)

	dev_vdbg(ch->dev, "%s: %08x, %d\n", __func__, val, vbus);
	if (ch->soc_no_adp_ctrl) {
		if (ch->vbus)
			regulator_hardware_enable(ch->vbus, vbus);

		vbus_ctrl_reg = USB2_VBCTRL;
		vbus_ctrl_val = USB2_VBCTRL_VBOUT;
	}
@@ -718,6 +721,9 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
		phy_set_drvdata(channel->rphys[i].phy, &channel->rphys[i]);
	}

	if (channel->soc_no_adp_ctrl && channel->is_otg_channel)
		channel->vbus = devm_regulator_get_exclusive(dev, "vbus");
	else
		channel->vbus = devm_regulator_get_optional(dev, "vbus");
	if (IS_ERR(channel->vbus)) {
		if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) {
+28 −0
Original line number Diff line number Diff line
@@ -3408,6 +3408,34 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
}
EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel);

/**
 * regulator_hardware_enable - access the HW for enable/disable regulator
 * @regulator: regulator source
 * @enable: true for enable, false for disable
 *
 * Request that the regulator be enabled/disabled with the regulator output at
 * the predefined voltage or current value.
 *
 * On success 0 is returned, otherwise a negative errno is returned.
 */
int regulator_hardware_enable(struct regulator *regulator, bool enable)
{
	struct regulator_dev *rdev = regulator->rdev;
	const struct regulator_ops *ops = rdev->desc->ops;
	int ret = -EOPNOTSUPP;

	if (!rdev->exclusive || !ops || !ops->enable || !ops->disable)
		return ret;

	if (enable)
		ret = ops->enable(rdev);
	else
		ret = ops->disable(rdev);

	return ret;
}
EXPORT_SYMBOL_GPL(regulator_hardware_enable);

/**
 * regulator_get_linear_step - return the voltage step size between VSEL values
 * @regulator: regulator source
Loading