Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa49d628 authored by Vignesh R's avatar Vignesh R Committed by Thierry Reding
Browse files

pwm: tiehrpwm: Don't use emulation mode bits to control PWM output



As per AM335x TRM SPRUH73P "15.2.2.11 ePWM Behavior During Emulation",
TBCTL[15:14] only have effect during emulation suspend events (IOW,
to stop PWM when debugging using a debugger). These bits have no effect
on PWM output during normal running of system. Hence, remove code
accessing these bits as they have no role in enabling/disabling PWMs.

Fixes: 19891b20 ("pwm: pwm-tiehrpwm: PWM driver support for EHRPWM")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarVignesh R <vigneshr@ti.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 4de445cb
Loading
Loading
Loading
Loading
+1 −11
Original line number Original line Diff line number Diff line
@@ -33,10 +33,6 @@
#define TBCTL			0x00
#define TBCTL			0x00
#define TBPRD			0x0A
#define TBPRD			0x0A


#define TBCTL_RUN_MASK		(BIT(15) | BIT(14))
#define TBCTL_STOP_NEXT		0
#define TBCTL_STOP_ON_CYCLE	BIT(14)
#define TBCTL_FREE_RUN		(BIT(15) | BIT(14))
#define TBCTL_PRDLD_MASK	BIT(3)
#define TBCTL_PRDLD_MASK	BIT(3)
#define TBCTL_PRDLD_SHDW	0
#define TBCTL_PRDLD_SHDW	0
#define TBCTL_PRDLD_IMDT	BIT(3)
#define TBCTL_PRDLD_IMDT	BIT(3)
@@ -360,7 +356,7 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
	/* Channels polarity can be configured from action qualifier module */
	/* Channels polarity can be configured from action qualifier module */
	configure_polarity(pc, pwm->hwpwm);
	configure_polarity(pc, pwm->hwpwm);


	/* Enable TBCLK before enabling PWM device */
	/* Enable TBCLK */
	ret = clk_enable(pc->tbclk);
	ret = clk_enable(pc->tbclk);
	if (ret) {
	if (ret) {
		dev_err(chip->dev, "Failed to enable TBCLK for %s: %d\n",
		dev_err(chip->dev, "Failed to enable TBCLK for %s: %d\n",
@@ -368,9 +364,6 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
		return ret;
		return ret;
	}
	}


	/* Enable time counter for free_run */
	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_FREE_RUN);

	return 0;
	return 0;
}
}


@@ -400,9 +393,6 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
	/* Disabling TBCLK on PWM disable */
	/* Disabling TBCLK on PWM disable */
	clk_disable(pc->tbclk);
	clk_disable(pc->tbclk);


	/* Stop Time base counter */
	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_STOP_NEXT);

	/* Disable clock on PWM disable */
	/* Disable clock on PWM disable */
	pm_runtime_put_sync(chip->dev);
	pm_runtime_put_sync(chip->dev);
}
}