Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ allOf:
properties:
compatible:
contains:
const: spacemit,k1-pwm
enum:
- spacemit,k1-pwm
- spacemit,k3-pwm
then:
properties:
"#pwm-cells":
Expand All @@ -26,6 +28,38 @@ allOf:
const: 1
description: |
Used for specifying the period length in nanoseconds.
- if:
properties:
compatible:
contains:
enum:
- spacemit,k3-pwm
then:
properties:
clock-names:
items:
- const: func
- const: bus
- if:
properties:
compatible:
contains:
enum:
- spacemit,k3-pwm
then:
required:
- clock-names
properties:
clocks:
minItems: 2
clock-names:
minItems: 2
else:
properties:
clocks:
maxItems: 1
clock-names:
maxItems: 1

properties:
compatible:
Expand All @@ -36,7 +70,9 @@ properties:
- marvell,pxa168-pwm
- marvell,pxa910-pwm
- items:
- const: spacemit,k1-pwm
- enum:
- spacemit,k1-pwm
- spacemit,k3-pwm
- const: marvell,pxa910-pwm

reg:
Expand All @@ -47,7 +83,18 @@ properties:
description: Number of cells in a pwm specifier.

clocks:
maxItems: 1
minItems: 1
items:
- description: The function clock
- description: An optional bus clock

clock-names:
minItems: 1
maxItems: 2
oneOf:
- items:
- const: func
- const: bus

resets:
maxItems: 1
Expand Down
8 changes: 7 additions & 1 deletion drivers/pwm/pwm-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct pxa_pwm_chip {
struct device *dev;

struct clk *clk;
struct clk *bus_clk;
void __iomem *mmio_base;
};

Expand Down Expand Up @@ -177,7 +178,12 @@ static int pwm_probe(struct platform_device *pdev)
return PTR_ERR(chip);
pc = to_pxa_pwm_chip(chip);

pc->clk = devm_clk_get(dev, NULL);
pc->bus_clk = devm_clk_get_optional_enabled(dev, "bus");
if (IS_ERR(pc->bus_clk))
return dev_err_probe(dev, PTR_ERR(pc->bus_clk), "Failed to get bus clock\n");

/* Get named func clk if bus clock is valid */
pc->clk = devm_clk_get(dev, pc->bus_clk ? "func" : NULL);
if (IS_ERR(pc->clk))
return dev_err_probe(dev, PTR_ERR(pc->clk), "Failed to get clock\n");

Expand Down