Skip to content

Commit aa01567

Browse files
fcoopertinsekhar
authored andcommitted
pwms: pwm-ti*: Remove support for local clock gating
The PWMSS local clock gating registers have no real purpose on OMAP ARM devices. These registers were left over registers from DSP IP where the PRCM doesn't exist. There is a silicon bug where gating and ungating clocks don't function properly. TRMs will be update to indicate that these registers shouldn't be touched. Therefore, all code that accesses the PWMSS_CLKCONFIG or PWMSS_CLKSTATUS will be removed by this patch with zero loss of functionality by the ECAP and EPWM drivers. Signed-off-by: Franklin S Cooper Jr <[email protected]> Signed-off-by: Sekhar Nori <[email protected]>
1 parent a3f4b98 commit aa01567

File tree

4 files changed

+0
-145
lines changed

4 files changed

+0
-145
lines changed

drivers/pwm/pwm-tiecap.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <linux/pwm.h>
2828
#include <linux/of_device.h>
2929

30-
#include "pwm-tipwmss.h"
31-
3230
/* ECAP registers and bits definitions */
3331
#define CAP1 0x08
3432
#define CAP2 0x0C
@@ -206,7 +204,6 @@ static int ecap_pwm_probe(struct platform_device *pdev)
206204
struct resource *r;
207205
struct clk *clk;
208206
struct ecap_pwm_chip *pc;
209-
u16 status;
210207

211208
pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
212209
if (!pc)
@@ -243,40 +240,15 @@ static int ecap_pwm_probe(struct platform_device *pdev)
243240
}
244241

245242
pm_runtime_enable(&pdev->dev);
246-
pm_runtime_get_sync(&pdev->dev);
247-
248-
status = pwmss_submodule_state_change(pdev->dev.parent,
249-
PWMSS_ECAPCLK_EN);
250-
if (!(status & PWMSS_ECAPCLK_EN_ACK)) {
251-
dev_err(&pdev->dev, "PWMSS config space clock enable failed\n");
252-
ret = -EINVAL;
253-
goto pwmss_clk_failure;
254-
}
255-
256-
pm_runtime_put_sync(&pdev->dev);
257243

258244
platform_set_drvdata(pdev, pc);
259245
return 0;
260-
261-
pwmss_clk_failure:
262-
pm_runtime_put_sync(&pdev->dev);
263-
pm_runtime_disable(&pdev->dev);
264-
pwmchip_remove(&pc->chip);
265-
return ret;
266246
}
267247

268248
static int ecap_pwm_remove(struct platform_device *pdev)
269249
{
270250
struct ecap_pwm_chip *pc = platform_get_drvdata(pdev);
271251

272-
pm_runtime_get_sync(&pdev->dev);
273-
/*
274-
* Due to hardware misbehaviour, acknowledge of the stop_req
275-
* is missing. Hence checking of the status bit skipped.
276-
*/
277-
pwmss_submodule_state_change(pdev->dev.parent, PWMSS_ECAPCLK_STOP_REQ);
278-
pm_runtime_put_sync(&pdev->dev);
279-
280252
pm_runtime_disable(&pdev->dev);
281253
return pwmchip_remove(&pc->chip);
282254
}

drivers/pwm/pwm-tiehrpwm.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <linux/pm_runtime.h>
2828
#include <linux/of_device.h>
2929

30-
#include "pwm-tipwmss.h"
31-
3230
/* EHRPWM registers and bits definitions */
3331

3432
/* Time base module registers */
@@ -437,7 +435,6 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
437435
struct resource *r;
438436
struct clk *clk;
439437
struct ehrpwm_pwm_chip *pc;
440-
u16 status;
441438

442439
pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
443440
if (!pc)
@@ -487,27 +484,9 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
487484
}
488485

489486
pm_runtime_enable(&pdev->dev);
490-
pm_runtime_get_sync(&pdev->dev);
491-
492-
status = pwmss_submodule_state_change(pdev->dev.parent,
493-
PWMSS_EPWMCLK_EN);
494-
if (!(status & PWMSS_EPWMCLK_EN_ACK)) {
495-
dev_err(&pdev->dev, "PWMSS config space clock enable failed\n");
496-
ret = -EINVAL;
497-
goto pwmss_clk_failure;
498-
}
499-
500-
pm_runtime_put_sync(&pdev->dev);
501487

502488
platform_set_drvdata(pdev, pc);
503489
return 0;
504-
505-
pwmss_clk_failure:
506-
pm_runtime_put_sync(&pdev->dev);
507-
pm_runtime_disable(&pdev->dev);
508-
pwmchip_remove(&pc->chip);
509-
clk_unprepare(pc->tbclk);
510-
return ret;
511490
}
512491

513492
static int ehrpwm_pwm_remove(struct platform_device *pdev)
@@ -516,14 +495,6 @@ static int ehrpwm_pwm_remove(struct platform_device *pdev)
516495

517496
clk_unprepare(pc->tbclk);
518497

519-
pm_runtime_get_sync(&pdev->dev);
520-
/*
521-
* Due to hardware misbehaviour, acknowledge of the stop_req
522-
* is missing. Hence checking of the status bit skipped.
523-
*/
524-
pwmss_submodule_state_change(pdev->dev.parent, PWMSS_EPWMCLK_STOP_REQ);
525-
pm_runtime_put_sync(&pdev->dev);
526-
527498
pm_runtime_put_sync(&pdev->dev);
528499
pm_runtime_disable(&pdev->dev);
529500
return pwmchip_remove(&pc->chip);

drivers/pwm/pwm-tipwmss.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,6 @@
2222
#include <linux/pm_runtime.h>
2323
#include <linux/of_device.h>
2424

25-
#include "pwm-tipwmss.h"
26-
27-
#define PWMSS_CLKCONFIG 0x8 /* Clock gating reg */
28-
#define PWMSS_CLKSTATUS 0xc /* Clock gating status reg */
29-
30-
struct pwmss_info {
31-
void __iomem *mmio_base;
32-
struct mutex pwmss_lock;
33-
u16 pwmss_clkconfig;
34-
};
35-
36-
u16 pwmss_submodule_state_change(struct device *dev, int set)
37-
{
38-
struct pwmss_info *info = dev_get_drvdata(dev);
39-
u16 val;
40-
41-
mutex_lock(&info->pwmss_lock);
42-
val = readw(info->mmio_base + PWMSS_CLKCONFIG);
43-
val |= set;
44-
writew(val , info->mmio_base + PWMSS_CLKCONFIG);
45-
mutex_unlock(&info->pwmss_lock);
46-
47-
return readw(info->mmio_base + PWMSS_CLKSTATUS);
48-
}
49-
EXPORT_SYMBOL(pwmss_submodule_state_change);
50-
5125
static const struct of_device_id pwmss_of_match[] = {
5226
{ .compatible = "ti,am33xx-pwmss" },
5327
{},
@@ -57,24 +31,10 @@ MODULE_DEVICE_TABLE(of, pwmss_of_match);
5731
static int pwmss_probe(struct platform_device *pdev)
5832
{
5933
int ret;
60-
struct resource *r;
61-
struct pwmss_info *info;
6234
struct device_node *node = pdev->dev.of_node;
6335

64-
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
65-
if (!info)
66-
return -ENOMEM;
67-
68-
mutex_init(&info->pwmss_lock);
69-
70-
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
71-
info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
72-
if (IS_ERR(info->mmio_base))
73-
return PTR_ERR(info->mmio_base);
74-
7536
pm_runtime_enable(&pdev->dev);
7637
pm_runtime_get_sync(&pdev->dev);
77-
platform_set_drvdata(pdev, info);
7838

7939
/* Populate all the child nodes here... */
8040
ret = of_platform_populate(node, NULL, NULL, &pdev->dev);
@@ -86,30 +46,21 @@ static int pwmss_probe(struct platform_device *pdev)
8646

8747
static int pwmss_remove(struct platform_device *pdev)
8848
{
89-
struct pwmss_info *info = platform_get_drvdata(pdev);
90-
9149
pm_runtime_put_sync(&pdev->dev);
9250
pm_runtime_disable(&pdev->dev);
93-
mutex_destroy(&info->pwmss_lock);
9451
return 0;
9552
}
9653

9754
#ifdef CONFIG_PM_SLEEP
9855
static int pwmss_suspend(struct device *dev)
9956
{
100-
struct pwmss_info *info = dev_get_drvdata(dev);
101-
102-
info->pwmss_clkconfig = readw(info->mmio_base + PWMSS_CLKCONFIG);
10357
pm_runtime_put_sync(dev);
10458
return 0;
10559
}
10660

10761
static int pwmss_resume(struct device *dev)
10862
{
109-
struct pwmss_info *info = dev_get_drvdata(dev);
110-
11163
pm_runtime_get_sync(dev);
112-
writew(info->pwmss_clkconfig, info->mmio_base + PWMSS_CLKCONFIG);
11364
return 0;
11465
}
11566
#endif

drivers/pwm/pwm-tipwmss.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)