Skip to contentSkip to conversation

reset: Add brcm,bcm63xx-reset device tree binding

PATCH In review Simon Arlott 4 participants 6 messages Nov 30, 2015 – Dec 2, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 reset: Add brcm,bcm63xx-reset device tree binding

Add device tree binding for the BCM63xx soft reset controller.

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
 .../bindings/reset/brcm,bcm63xx-reset.txt          | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt
Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +37 -0
new file mode 100644
index 0000000..48e9daf
@@ -0,0 +1,37 @@
+BCM63xx reset controller
+
+The BCM63xx contains a basic soft reset controller in the perf register
+set which resets components using a bit in a register.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible:	Should be "brcm,bcm<soc>-reset", "brcm,bcm63xx-reset"
+- regmap:	The register map phandle
+- offset:	Offset in the register map for the reset register (in bytes)
+- #reset-cells:	Must be set to 1
+
+Optional properties:
+- mask:		Mask of valid reset bits in the reset register (32 bit access)
+		(Defaults to all bits)
+
+Example:
+
+periph_soft_rst: reset-controller {
+	compatible = "brcm,bcm63168-reset", "brcm,bcm63xx-reset";
+	regmap = <&periph_cntl>;
+	offset = <0x10>;
+
+	#reset-cells = <1>;
+};
+
+usbh: usbphy@10002700 {
+	compatible = "brcm,bcm63168-usbh";
+	reg = <0x10002700 0x38>;
+	clocks = <&periph_clk 13>, <&timer_clk 18>;
+	resets = <&periph_soft_rst 6>;
+	power-supply = <&power_usbh>;
+	#phy-cells = <0>;
+};
+
Signature · 8 lines
2.1.4

-- 
Simon Arlott
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH 2/2 reset: bcm63xx: Add support for the BCM63xx soft-reset controller

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
 MAINTAINERS                   |   1 +
 drivers/reset/Kconfig         |   9 +++
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-bcm63xx.c | 134 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+)
 create mode 100644 drivers/reset/reset-bcm63xx.c
MAINTAINERS +1 -0
index 07613dd..55e493a 100644
@@ -2378,6 +2378,7 @@ F:	drivers/irqchip/irq-bcm63*
 F:	drivers/irqchip/irq-bcm7*
 F:	drivers/irqchip/irq-brcmstb*
 F:	drivers/regulator/bcm63*
+F:	drivers/reset/reset-bcm63*
 F:	include/linux/bcm63xx_wdt.h
 
 BROADCOM TG3 GIGABIT ETHERNET DRIVER
drivers/reset/Kconfig +9 -0
index 0615f50..064dad2 100644
@@ -12,4 +12,13 @@ menuconfig RESET_CONTROLLER
 
 	  If unsure, say no.
 
+if RESET_CONTROLLER
+
+config RESET_BCM63XX
+	bool "BCM63xx Reset Controller"
+	help
+	  Support resetting of devices on BCM63xx boards.
+
+endif
+
 source "drivers/reset/sti/Kconfig"
drivers/reset/Makefile +1 -0
index 85d5904..f6e2171 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_ARCH_STI) += sti/
 obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
 obj-$(CONFIG_ATH79) += reset-ath79.o
+obj-$(CONFIG_RESET_BCM63XX) += reset-bcm63xx.o
drivers/reset/reset-bcm63xx.c new file +134 -0

134 lines not on this page · raw message

Signature · 8 lines
2.1.4

-- 
Simon Arlott
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH 2/2] reset: bcm63xx: Add support for the BCM63xx soft-reset controller

2015-11-30 12:58 GMT-08:00 Simon Arlott <[email protected]>:

Quoted 11 lines

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
 MAINTAINERS                   |   1 +
 drivers/reset/Kconfig         |   9 +++
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-bcm63xx.c | 134 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+)
 create mode 100644 drivers/reset/reset-bcm63xx.c

Could you create a bcm directory and then add your reset-bcm63xx.c file there? I have a pending submission for the BCM63138 reset controller which is not at all using the same structure and will share nothing with your driver.

[snip]

drivers/reset/reset-bcm63xx.c line 63

Quoted 10 lines
drivers/reset/reset-bcm63xx.c new file +10 -0
+static int bcm63xx_reset_xlate(struct reset_controller_dev *rcdev,
+       const struct of_phandle_args *reset_spec)
+{
+       struct bcm63xx_reset_priv *priv = to_bcm63xx_reset_priv(rcdev);
+
+       if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
+               return -EINVAL;
+
+       if (reset_spec->args[0] >= rcdev->nr_resets)
+               return -EINVAL;

Should not these two things be moved to the core reset controller code based on the #reset-cells value?

[snip]

drivers/reset/reset-bcm63xx.c line 101

Quoted 10 lines
drivers/reset/reset-bcm63xx.c new file +10 -0
+       if (of_property_read_u32(np, "offset", &priv->offset))
+               return -EINVAL;
+
+       /* valid reset bits */
+       if (of_property_read_u32(np, "mask", &priv->mask))
+               priv->mask = 0xffffffff;
+
+       priv->rcdev.owner = THIS_MODULE;
+       priv->rcdev.ops = &bcm63xx_reset_ops;
+       priv->rcdev.nr_resets = 32;

Should not that come from Device Tree, or be computed based on the mask property, like hweight_long() or something along these lines?

Quoted 3 lines
drivers/reset/reset-bcm63xx.c new file +3 -0
+       priv->rcdev.of_node = pdev->dev.of_node;
+       priv->rcdev.of_reset_n_cells = 1;
+       priv->rcdev.of_xlate = bcm63xx_reset_xlate;
Signature · 1 line
Florian
#3 lore raw

Re: [PATCH 2/2] reset: bcm63xx: Add support for the BCM63xx soft-reset controller

Quoted 14 lines · Florian Fainelli

2015-11-30 12:58 GMT-08:00 Simon Arlott <[email protected]>:

Quoted 11 lines

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
 MAINTAINERS                   |   1 +
 drivers/reset/Kconfig         |   9 +++
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-bcm63xx.c | 134 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+)
 create mode 100644 drivers/reset/reset-bcm63xx.c
Quoted 5 lines

Could you create a bcm directory and then add your reset-bcm63xx.c file there? I have a pending submission for the BCM63138 reset controller which is not at all using the same structure and will share nothing with your driver.

Ok, I'll call it reset-bcm6345.c to avoid confusion.

Quoted 15 lines

drivers/reset/reset-bcm63xx.c line 63

Quoted 11 lines
drivers/reset/reset-bcm63xx.c new file +10 -0
+static int bcm63xx_reset_xlate(struct reset_controller_dev *rcdev,
+       const struct of_phandle_args *reset_spec)
+{
+       struct bcm63xx_reset_priv *priv = to_bcm63xx_reset_priv(rcdev);
+
+       if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells))
+               return -EINVAL;
+
+       if (reset_spec->args[0] >= rcdev->nr_resets)
+               return -EINVAL;

Should not these two things be moved to the core reset controller code based on the #reset-cells value?

This has already been removed from the next version of the patch.

Quoted 14 lines

drivers/reset/reset-bcm63xx.c line 101

Quoted 11 lines
drivers/reset/reset-bcm63xx.c new file +10 -0
+       if (of_property_read_u32(np, "offset", &priv->offset))
+               return -EINVAL;
+
+       /* valid reset bits */
+       if (of_property_read_u32(np, "mask", &priv->mask))
+               priv->mask = 0xffffffff;
+
+       priv->rcdev.owner = THIS_MODULE;
+       priv->rcdev.ops = &bcm63xx_reset_ops;
+       priv->rcdev.nr_resets = 32;

Should not that come from Device Tree, or be computed based on the mask property, like hweight_long() or something along these lines?

The "mask" property has been removed. It will assume 32 resets and rely on the rest of the DT to only refer to valid bits.

Signature · 1 line
Simon Arlott
maintainer
#4 lore raw
In reply to Simon Arlott
Quoted 24 lines · Simon Arlott

Add device tree binding for the BCM63xx soft reset controller.

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
 .../bindings/reset/brcm,bcm63xx-reset.txt          | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt
Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +7 -0
new file mode 100644
index 0000000..48e9daf
@@ -0,0 +1,37 @@
+BCM63xx reset controller
+
+The BCM63xx contains a basic soft reset controller in the perf register
+set which resets components using a bit in a register.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.

Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +10 -0
+
+Required properties:
+- compatible:	Should be "brcm,bcm<soc>-reset", "brcm,bcm63xx-reset"
+- regmap:	The register map phandle
+- offset:	Offset in the register map for the reset register (in bytes)
+- #reset-cells:	Must be set to 1
+
+Optional properties:
+- mask:		Mask of valid reset bits in the reset register (32 bit access)
+		(Defaults to all bits)

The bits correspond to the cell values in resets properties? If so then, is this really needed? If you are only validating cell values against this mask, then drop it (assume the DT does not have crap).

Rob

Quoted 25 lines
Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +20 -0
+
+Example:
+
+periph_soft_rst: reset-controller {
+	compatible = "brcm,bcm63168-reset", "brcm,bcm63xx-reset";
+	regmap = <&periph_cntl>;
+	offset = <0x10>;
+
+	#reset-cells = <1>;
+};
+
+usbh: usbphy@10002700 {
+	compatible = "brcm,bcm63168-usbh";
+	reg = <0x10002700 0x38>;
+	clocks = <&periph_clk 13>, <&timer_clk 18>;
+	resets = <&periph_soft_rst 6>;
+	power-supply = <&power_usbh>;
+	#phy-cells = <0>;
+};
+
Signature · 4 lines
2.1.4

-- 
Simon Arlott
#5 lore raw
In reply to Simon Arlott

Hello.

Quoted 17 lines · Simon Arlott

Add device tree binding for the BCM63xx soft reset controller.

The BCM63xx contains a soft-reset controller activated by setting a bit (that must previously have cleared).

---
  .../bindings/reset/brcm,bcm63xx-reset.txt          | 37 ++++++++++++++++++++++
  1 file changed, 37 insertions(+)

create mode 100644 Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt

Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +0 -0
new file mode 100644
index 0000000..48e9daf

Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/reset/brcm,bcm63xx-reset.txt new file +10 -0
@@ -0,0 +1,37 @@
+BCM63xx reset controller
+
+The BCM63xx contains a basic soft reset controller in the perf register
+set which resets components using a bit in a register.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible:	Should be "brcm,bcm<soc>-reset", "brcm,bcm63xx-reset"

Wildcards (xx) are not allowed here. Please choose a "least common
denominator" SoC and name the string after it.

[...]

MBR, Sergei