Skip to contentSkip to conversation

net: can: Add can support for TI platforms

PATCH Superseded Roger Quadros 4 participants 19 messages Sep 8, 2014 – Sep 9, 2014

Subsystems (4)

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover net: can: Add can support for TI platforms

Hi,

Some hardware (TI am43xx) has a buggy RAMINIT DONE mechanism and it might not always set the DONE bit. This will result in a lockup in c_can_hw_raminit_wait_ti(), so patch 1 adds a timeout mechanism there.

There is a non compliancy within TI platforms with respect to the layout of the RAMINIT register. The patches 2 and 3 address this issue and make a flexible but standard way of defining the RAMINIT hardware register layout in the device tree. The RAMINIT register is accessed using the syscon regmap framework.

The patches 4 to 13 add adaptation details for am43xx and dra7x Socs and EVMs.

cheers,
-roger

---

Afzal Mohammed (1):
arm: dts: am4372: Add dcan nodes

Dave Gerlach (1):
ARM: dts: am437x-gp-evm: Add pinctrl sleep states for dcan pins

Mugunthan V N (1):
arm: dts: am437x-gp: Add dcan support

Roger Quadros (10):
can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout
net: can: c_can: Add syscon/regmap RAMINIT mechanism
net: can: c_can: Add support for START pulse in RAMINIT sequence
ARM: dts: dra7: Add syscon regmap for CORE CONTROL area
ARM: dts: DRA7: Add DCAN nodes
ARM: dts: dra7-evm: Add CAN support
ARM: dts: dra72-evm: Add CAN support
ARM: dts: AM43xx: Add aliases to d_can nodes
ARM: dts: am4372: Add control module syscon node
ARM: dts: am4372: Add dcan raminit bits

 .../devicetree/bindings/net/can/c_can.txt          |  10 ++
 arch/arm/boot/dts/am4372.dtsi                      |  35 ++++++
 arch/arm/boot/dts/am437x-gp-evm.dts                |  42 ++++++++
 arch/arm/boot/dts/dra7-evm.dts                     |  21 ++++
 arch/arm/boot/dts/dra7.dtsi                        |  35 ++++++
 arch/arm/boot/dts/dra72-evm.dts                    |  23 ++++
 drivers/net/can/c_can/c_can.h                      |  12 ++-
 drivers/net/can/c_can/c_can_platform.c             | 120 ++++++++++++++++-----
 8 files changed, 270 insertions(+), 28 deletions(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/13 can: c_can_platform: Fix c_can_hw_raminit_ti() and add timeout

Pass the correct 'mask' and 'value' bits to c_can_hw_raminit_wait_ti(). They seem to have been swapped in the usage instances.

TI's RAMINIT DONE mechanism is buggy and may not always be set after the START bit is set. So add a timeout mechanism to c_can_hw_raminit_wait_ti().

---
 drivers/net/can/c_can/c_can_platform.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/can/c_can/c_can_platform.c +11 -3
index 109cb44..b144e71 100644
@@ -75,10 +75,18 @@ static void c_can_plat_write_reg_aligned_to_32bit(const struct c_can_priv *priv,
 static void c_can_hw_raminit_wait_ti(const struct c_can_priv *priv, u32 mask,
 				  u32 val)
 {
+	int timeout = 0;
 	/* We look only at the bits of our instance. */
 	val &= mask;
-	while ((readl(priv->raminit_ctrlreg) & mask) != val)
+	while ((readl(priv->raminit_ctrlreg) & mask) != val) {
 		udelay(1);
+		timeout++;
+
+		if (timeout == 1000) {
+			dev_err(&priv->dev->dev, "%s: time out\n", __func__);
+			break;
+		}
+	}
 }
 
 static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
@@ -97,14 +105,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable)
 	ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
 	writel(ctrl, priv->raminit_ctrlreg);
 	ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance);
-	c_can_hw_raminit_wait_ti(priv, ctrl, mask);
+	c_can_hw_raminit_wait_ti(priv, mask, ctrl);
 
 	if (enable) {
 		/* Set start bit and wait for the done bit. */
 		ctrl |= CAN_RAMINIT_START_MASK(priv->instance);
 		writel(ctrl, priv->raminit_ctrlreg);
 		ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance);
-		c_can_hw_raminit_wait_ti(priv, ctrl, mask);
+		c_can_hw_raminit_wait_ti(priv, mask, ctrl);
 	}
 	spin_unlock(&raminit_lock);
 }
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/13 net: can: c_can: Add syscon/regmap RAMINIT mechanism

In reply to Roger Quadros

Some TI SoCs like DRA7 have a RAMINIT register specification different from the other AMxx SoCs and as expected by the existing driver.

To add more insanity, this register is shared with other IPs like DSS, PCIe and PWM.

Provides a more generic mechanism to specify the RAMINIT register location and START/DONE bit position and use the syscon/regmap framework to access the register.

---
 .../devicetree/bindings/net/can/c_can.txt          |   7 ++
 drivers/net/can/c_can/c_can.h                      |  11 ++-
 drivers/net/can/c_can/c_can_platform.c             | 106 +++++++++++++++------
 3 files changed, 95 insertions(+), 29 deletions(-)
Documentation/devicetree/bindings/net/can/c_can.txt +7 -0
index 8f1ae81..0856209 100644
@@ -13,6 +13,13 @@ Optional properties:
 - ti,hwmods		: Must be "d_can<n>" or "c_can<n>", n being the
 			  instance number
 
+- raminit-syscon	: Handle to system control region that contains the
+			  RAMINIT register. If specified, the second memory resource
+			  in the reg property must index into the RAMINIT
+			  register within the syscon region
+- raminit-start-bit	: Bit posistion of START bit in the RAMINIT register
+- raminit-done-bit	: Bit position of DONE bit in the RAMINIT register
+
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
 Future plan is to migrate hwmod data base contents into device tree
drivers/net/can/c_can/c_can.h +9 -2
index 99ad1aa..bf68822 100644
@@ -169,6 +169,14 @@ enum c_can_dev_id {
 	BOSCH_D_CAN,
 };
 
+/* Out of band RAMINIT register access via syscon regmap */
+struct c_can_raminit {
+	struct regmap *syscon;	/* for raminit ctrl. reg. access */
+	unsigned int reg;	/* register index within syscon */
+	u8 start_bit;	/* START bit position in raminit reg. */
+	u8 done_bit;	/* DONE bit position in raminit reg. */
+};
+
 /* c_can private data structure */
 struct c_can_priv {
 	struct can_priv can;	/* must be the first member */
@@ -186,8 +194,7 @@ struct c_can_priv {
 	const u16 *regs;
 	void *priv;		/* for board-specific data */
 	enum c_can_dev_id type;
-	u32 __iomem *raminit_ctrlreg;
-	int instance;
+	struct c_can_raminit raminit_sys;	/* RAMINIT via syscon regmap */
 	void (*raminit) (const struct c_can_priv *priv, bool enable);
 	u32 comm_rcv_high;
 	u32 rxmasked;
drivers/net/can/c_can/c_can_platform.c +79 -27

162 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 3/13 net: can: c_can: Add support for START pulse in RAMINIT sequence

In reply to Roger Quadros

Some SoCs e.g. (TI DRA7xx) need a START pulse to start the RAMINIT sequence i.e. START bit must be set and cleared before checking for the DONE bit status. Add a new DT property "raminit-pulse" to specify if this mechanism must be used for RAMINIT.

---
 Documentation/devicetree/bindings/net/can/c_can.txt | 3 +++
 drivers/net/can/c_can/c_can.h                       | 1 +
 drivers/net/can/c_can/c_can_platform.c              | 8 ++++++++
 3 files changed, 12 insertions(+)
Documentation/devicetree/bindings/net/can/c_can.txt +3 -0
index 0856209..2f0a6bb 100644
@@ -19,6 +19,9 @@ Optional properties:
 			  register within the syscon region
 - raminit-start-bit	: Bit posistion of START bit in the RAMINIT register
 - raminit-done-bit	: Bit position of DONE bit in the RAMINIT register
+- raminit-pulse		: Property must exist if START pulse is needed for RAMINIT
+			  sequence i.e. START bit will be set and cleared before
+			  checking for DONE bit.
 
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
drivers/net/can/c_can/c_can.h +1 -0
index bf68822..85b5ad0 100644
@@ -175,6 +175,7 @@ struct c_can_raminit {
 	unsigned int reg;	/* register index within syscon */
 	u8 start_bit;	/* START bit position in raminit reg. */
 	u8 done_bit;	/* DONE bit position in raminit reg. */
+	bool needs_pulse;	/* If set, sets and clears START bit (pulse) */
 };
 
 /* c_can private data structure */
drivers/net/can/c_can/c_can_platform.c +8 -0
index e7ec3b6..bc09695 100644
@@ -123,6 +123,12 @@ static void c_can_hw_raminit_syscon(const struct c_can_priv *priv, bool enable)
 		ctrl |= 1 << raminit->start_bit;
 		regmap_write(raminit->syscon, raminit->reg, ctrl);
 
+		/* clear START bit if start pulse is needed */
+		if (raminit->needs_pulse) {
+			ctrl &= ~(1 << raminit->start_bit);
+			regmap_write(raminit->syscon, raminit->reg, ctrl);
+		}
+
 		ctrl |= 1 << raminit->done_bit;
 		c_can_hw_raminit_wait_syscon(priv, mask, ctrl);
 	}
@@ -343,6 +349,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 		}
 
 		priv->raminit_sys.done_bit = val;
+		priv->raminit_sys.needs_pulse = of_property_read_bool(np,
+								      "raminit-pulse");
 		priv->raminit = c_can_hw_raminit_syscon;
 		break;
 	default:
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 4/13 ARM: dts: dra7: Add syscon regmap for CORE CONTROL area

In reply to Roger Quadros

Display and DCAN drivers use syscon regmap to access some registers in the CORE control area. Add the syscon regmap node for this area.

Cc Tomi Valkeinen <[email protected]>
Cc Nishanth Menon <[email protected]>
---
 arch/arm/boot/dts/dra7.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/dra7.dtsi +5 -0
index d678152..370009e 100644
@@ -200,6 +200,11 @@
 			ti,hwmods = "counter_32k";
 		};
 
+		dra7_ctrl_core: ctrl_core@4a002000 {
+			compatible = "syscon";
+			reg = <0x4a002000 0x6d0>;
+		};
+
 		dra7_ctrl_general: tisyscon@4a002e00 {
 			compatible = "syscon";
 			reg = <0x4a002e00 0x7c>;
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH 5/13 ARM: dts: DRA7: Add DCAN nodes

In reply to Roger Quadros

The SoC supports 2 DCAN nodes. Add them.

---
 arch/arm/boot/dts/dra7.dtsi | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/boot/dts/dra7.dtsi +30 -0
index 370009e..4ce1a4f 100644
@@ -34,6 +34,8 @@
 		serial3 = &uart4;
 		serial4 = &uart5;
 		serial5 = &uart6;
+		d_can0 = &dcan1;
+		d_can1 = &dcan2;
 	};
 
 	timer {
@@ -1267,6 +1269,34 @@
 			ti,irqs-skip = <10 133 139 140>;
 			ti,irqs-safe-map = <0>;
 		};
+
+		dcan1: d_can@481cc000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "dcan1";
+			reg = <0x4ae3c000 0x2000>,
+			      <0x558 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&dra7_ctrl_core>;
+			raminit-start-bit = <3>;
+			raminit-done-bit = <1>;
+			raminit-pulse;
+			interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&dcan1_sys_clk_mux>;
+			status = "disabled";
+		};
+
+		dcan2: d_can@481d0000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "dcan2";
+			reg = <0x48480000 0x2000>,
+			      <0x558 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&dra7_ctrl_core>;
+			raminit-start-bit = <5>;
+			raminit-done-bit = <2>;
+			raminit-pulse;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sys_clkin1>;
+			status = "disabled";
+		};
 	};
 };
 
Signature · 1 line
1.8.3.2
#11 lore raw

PATCH 6/13 ARM: dts: dra7-evm: Add CAN support

In reply to Roger Quadros

The board has 2 CAN ports but only the first one can be used. Enable the first CAN port.

The second one cannot be used without hardware modification so we don't enable the second port.

---
 arch/arm/boot/dts/dra7-evm.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/dra7-evm.dts +21 -0
index e03fbf3..d6b9b27 100644
@@ -171,6 +171,20 @@
 			0xd0	(PIN_OUTPUT | MUX_MODE0)	/* gpmc_be0n_cle */
 		>;
 	};
+
+	dcan1_pins_default: dcan1_pins_default {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE0)		/* dcan1_tx */
+			0x3d8	(PIN_INPUT | MUX_MODE0)		/* dcan1_rx */
+		>;
+	};
+
+	dcan1_pins_sleep: dcan1_pins_sleep {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE15)	/* dcan1_tx */
+			0x3d8	(PIN_INPUT | MUX_MODE15)	/* dcan1_rx */
+		>;
+	};
 };
 
 &i2c1 {
@@ -529,3 +543,10 @@
 	ti,no-reset-on-init;
 	ti,no-idle-on-init;
 };
+
+&dcan1 {
+	status = "ok";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&dcan1_pins_default>;
+	pinctrl-1 = <&dcan1_pins_sleep>;
+};
Signature · 1 line
1.8.3.2
#12 lore raw

PATCH 7/13 ARM: dts: dra72-evm: Add CAN support

In reply to Roger Quadros

The board has 2 CAN ports but only the first one can be used. Enable the first CAN port.

The second one cannot be used without hardware modification so we don't enable the second port.

---
 arch/arm/boot/dts/dra72-evm.dts | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/boot/dts/dra72-evm.dts +23 -0
index 5147023..e5b7172 100644
@@ -19,6 +19,29 @@
 	};
 };
 
+&dra7_pmx_core {
+	dcan1_pins_default: dcan1_pins_default {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE0)		/* dcan1_tx */
+			0x418	(PIN_INPUT | MUX_MODE1)		/* wakeup0.dcan1_rx */
+		>;
+	};
+
+	dcan1_pins_sleep: dcan1_pins_sleep {
+		pinctrl-single,pins = <
+			0x3d4	(PIN_INPUT | MUX_MODE15)	/* dcan1_tx.off */
+			0x418	(PIN_INPUT | MUX_MODE15)	/* wakeup0.off */
+		>;
+	};
+};
+
 &uart1 {
 	status = "okay";
 };
+
+&dcan1 {
+	status = "ok";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&dcan1_pins_default>;
+	pinctrl-1 = <&dcan1_pins_sleep>;
+};
Signature · 1 line
1.8.3.2
#13 lore raw

PATCH 8/13 arm: dts: am4372: Add dcan nodes

In reply to Roger Quadros

From: Afzal Mohammed <[email protected]>

Add dcan nodes.

---
 arch/arm/boot/dts/am4372.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/boot/dts/am4372.dtsi +22 -0
index 8689949..3514d0a 100644
@@ -885,6 +885,28 @@
 				clock-names = "fck";
 			};
 		};
+
+		dcan0: can@481cc000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "d_can0";
+			clocks = <&dcan0_fck>;
+			clock-names = "fck";
+			reg = <0x481cc000 0x2000
+				0x44e10644 0x4>;
+			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		dcan1: can@481d0000 {
+			compatible = "bosch,d_can";
+			ti,hwmods = "d_can1";
+			clocks = <&dcan1_fck>;
+			clock-names = "fck";
+			reg = <0x481d0000 0x2000
+				0x44e10644 0x4>;
+			interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
 	};
 };
 
Signature · 1 line
1.8.3.2
#14 lore raw

PATCH 9/13 ARM: dts: AM43xx: Add aliases to d_can nodes

In reply to Roger Quadros

The d_can driver expects appropriately named aliases for the d_can nodes for the RAMINIT control register access.

Provide those, otherwise RAMINIT register won't be configured. Get's rid of the following messages during boot.

[   16.419354] c_can_platform 481cc000.can: control memory is not used for raminit
[   16.449142] c_can_platform 481d0000.can: control memory is not used for raminit
---
 arch/arm/boot/dts/am4372.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/am4372.dtsi +2 -0
index 3514d0a..a705e50 100644
@@ -25,6 +25,8 @@
 		serial0 = &uart0;
 		ethernet0 = &cpsw_emac0;
 		ethernet1 = &cpsw_emac1;
+		d_can0 = &dcan0;
+		d_can1 = &dcan1;
 	};
 
 	cpus {
Signature · 1 line
1.8.3.2
#15 lore raw

PATCH 10/13 arm: dts: am437x-gp: Add dcan support

In reply to Roger Quadros

From: Mugunthan V N <[email protected]>

Add DCAN support for AM437x GP EVM with both DCAN instances.

---
 arch/arm/boot/dts/am437x-gp-evm.dts | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/arm/boot/dts/am437x-gp-evm.dts +26 -0
index e7ac47f..6d03baa 100644
@@ -254,6 +254,20 @@
 			0x238 (PIN_OUTPUT_PULLUP | MUX_MODE7)
 		>;
 	};
+
+	dcan0_default: dcan0_default_pins {
+		pinctrl-single,pins = <
+			0x178 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_ctsn.d_can0_tx */
+			0x17c (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_rtsn.d_can0_rx */
+		>;
+	};
+
+	dcan1_default: dcan1_default_pins {
+		pinctrl-single,pins = <
+			0x180 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_rxd.d_can1_tx */
+			0x184 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
+		>;
+	};
 };
 
 &i2c0 {
@@ -511,3 +525,15 @@
 		};
 	};
 };
+
+&dcan0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&dcan0_default>;
+	status = "okay";
+};
+
+&dcan1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&dcan1_default>;
+	status = "okay";
+};
Signature · 1 line
1.8.3.2
#16 lore raw

PATCH 11/13 ARM: dts: am437x-gp-evm: Add pinctrl sleep states for dcan pins

In reply to Roger Quadros

From: Dave Gerlach <[email protected]>

Define pinctrl sleep states for both dcan0 and dcan1 to place pull downs on the lines to optimize power savings during suspend.

---
 arch/arm/boot/dts/am437x-gp-evm.dts | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
arch/arm/boot/dts/am437x-gp-evm.dts +18 -2
index 6d03baa..ca9e1ab 100644
@@ -262,12 +262,26 @@
 		>;
 	};
 
+	dcan0_sleep: dcan0_sleep_pins {
+		pinctrl-single,pins = <
+			0x178 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+			0x17c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
+
 	dcan1_default: dcan1_default_pins {
 		pinctrl-single,pins = <
 			0x180 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* uart1_rxd.d_can1_tx */
 			0x184 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
 		>;
 	};
+
+	dcan1_sleep: dcan1_sleep_pins {
+		pinctrl-single,pins = <
+			0x180 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+			0x184 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+		>;
+	};
 };
 
 &i2c0 {
@@ -527,13 +541,15 @@
 };
 
 &dcan0 {
-	pinctrl-names = "default";
+	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&dcan0_default>;
+	pinctrl-1 = <&dcan0_sleep>;
 	status = "okay";
 };
 
 &dcan1 {
-	pinctrl-names = "default";
+	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <&dcan1_default>;
+	pinctrl-1 = <&dcan1_sleep>;
 	status = "okay";
 };
Signature · 1 line
1.8.3.2
#17 lore raw

PATCH 12/13 ARM: dts: am4372: Add control module syscon node

In reply to Roger Quadros

Use syscon regmap to expose the Control module register space. This register space is shared between many users e.g. DCAN, USB, display, etc.

---
 arch/arm/boot/dts/am4372.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/am4372.dtsi +5 -0
index a705e50..d38a0ed 100644
@@ -59,6 +59,11 @@
 		cache-level = <2>;
 	};
 
+	am43xx_control_module: control_module@4a002000 {
+		compatible = "syscon";
+		reg = <0x44e10000 0x7f4>;
+	};
+
 	am43xx_pinmux: pinmux@44e10800 {
 		compatible = "pinctrl-single";
 		reg = <0x44e10800 0x31c>;
Signature · 1 line
1.8.3.2
#18 lore raw

PATCH 13/13 ARM: dts: am4372: Add dcan raminit bits

In reply to Roger Quadros

Add RAMINIT specific bits into the DCAN nodes.

---
 arch/arm/boot/dts/am4372.dtsi | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/boot/dts/am4372.dtsi +8 -2
index d38a0ed..33d27cd 100644
@@ -899,7 +899,10 @@
 			clocks = <&dcan0_fck>;
 			clock-names = "fck";
 			reg = <0x481cc000 0x2000
-				0x44e10644 0x4>;
+				0x644 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&am43xx_control_module>;
+			raminit-start-bit = <0>;
+			raminit-done-bit = <8>;
 			interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
@@ -910,7 +913,10 @@
 			clocks = <&dcan1_fck>;
 			clock-names = "fck";
 			reg = <0x481d0000 0x2000
-				0x44e10644 0x4>;
+				0x644 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&am43xx_control_module>;
+			raminit-start-bit = <1>;
+			raminit-done-bit = <9>;
 			interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
 			status = "disabled";
 		};
Signature · 1 line
1.8.3.2
#7 lore raw

Re: [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes

In reply to Roger Quadros

Hello.

Quoted 11 lines · Roger Quadros

The SoC supports 2 DCAN nodes. Add them.

---
  arch/arm/boot/dts/dra7.dtsi | 30 ++++++++++++++++++++++++++++++
  1 file changed, 30 insertions(+)
arch/arm/boot/dts/dra7.dtsi +0 -0
index 370009e..4ce1a4f 100644

[...]

arch/arm/boot/dts/dra7.dtsi line 1273

Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi +2 -0
@@ -1267,6 +1269,34 @@
  			ti,irqs-skip = <10 133 139 140>;
  			ti,irqs-safe-map = <0>;
  		};
+
+		dcan1: d_can@481cc000 {

The ePAPR standard has something to say here:

Quoted 1 line
Quoted 1 line

The name of a node should be somewhat generic, reflecting the function of the device and not its precise programming model. If appropriate, the name should be one of the following choices:

• can

arch/arm/boot/dts/dra7.dtsi line 1281

Quoted 10 lines
Quoted 1 line
arch/arm/boot/dts/dra7.dtsi +8 -0
+			compatible = "bosch,d_can";
+			ti,hwmods = "dcan1";
+			reg = <0x4ae3c000 0x2000>,
+			      <0x558 0x4>; /* index to RAMINIT reg within syscon */
+			raminit-syscon = <&dra7_ctrl_core>;
+			raminit-start-bit = <3>;
+			raminit-done-bit = <1>;
+			raminit-pulse;

Hm, aren't the above 4 properties vendor specific? If so, they should
start with a vendor prefix and comma.

arch/arm/boot/dts/dra7.dtsi line 1285

Quoted 4 lines
arch/arm/boot/dts/dra7.dtsi +4 -0
+			interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&dcan1_sys_clk_mux>;
+			status = "disabled";
+		};

WBR, Sergei

#5 lore raw

Re: [PATCH 04/13] ARM: dts: dra7: Add syscon regmap for CORE CONTROL area

In reply to Roger Quadros
Quoted 3 lines · Roger Quadros

Display and DCAN drivers use syscon regmap to access some registers in the CORE control area. Add the syscon regmap node for this area.

Please repost the .dts changes in a separate series to avoid conflicts.

Thanks,

Tony

#8 lore raw

Re: [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes

In reply to Sergei Shtylyov

Hi,

Quoted 26 lines · Sergei Shtylyov

Hello.

Quoted 11 lines · Roger Quadros

The SoC supports 2 DCAN nodes. Add them.

---
  arch/arm/boot/dts/dra7.dtsi | 30 ++++++++++++++++++++++++++++++
  1 file changed, 30 insertions(+)
arch/arm/boot/dts/dra7.dtsi +0 -0
index 370009e..4ce1a4f 100644

[...]

arch/arm/boot/dts/dra7.dtsi line 1273

Quoted 6 lines
arch/arm/boot/dts/dra7.dtsi +2 -0
@@ -1267,6 +1269,34 @@
              ti,irqs-skip = <10 133 139 140>;
              ti,irqs-safe-map = <0>;
          };
+
+        dcan1: d_can@481cc000 {

The ePAPR standard has something to say here:

Quoted 1 line
Quoted 1 line
Quoted 3 lines

The name of a node should be somewhat generic, reflecting the function of the device and not its precise programming model. If appropriate, the name should be one of the following choices:

• can

Right. I'll fix it up.

Quoted 11 lines

arch/arm/boot/dts/dra7.dtsi line 1281

Quoted 10 lines
Quoted 1 line
arch/arm/boot/dts/dra7.dtsi +8 -0
+            compatible = "bosch,d_can";
+            ti,hwmods = "dcan1";
+            reg = <0x4ae3c000 0x2000>,
+                  <0x558 0x4>; /* index to RAMINIT reg within syscon */
+            raminit-syscon = <&dra7_ctrl_core>;
+            raminit-start-bit = <3>;
+            raminit-done-bit = <1>;
+            raminit-pulse;
Quoted 1 line

Hm, aren't the above 4 properties vendor specific? If so, they should start with a vendor prefix and comma.

At least for now I don't know about any other platform other than TI using a RAMINIT register outside the CAN register space. However the mechanism is generic enough and not limited to TI platforms.

I don't mind vendor prefix or not, but would like to hear the opinion of the CAN maintainers as to what they would prefer.

Quoted 6 lines

arch/arm/boot/dts/dra7.dtsi line 1285

Quoted 5 lines
arch/arm/boot/dts/dra7.dtsi +4 -0
+            interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>;
+            clocks = <&dcan1_sys_clk_mux>;
+            status = "disabled";
+        };

cheers,
-roger

#9 lore raw

Re: [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes

Quoted 9 lines · Roger Quadros
Quoted 9 lines
Quoted 8 lines
arch/arm/boot/dts/dra7.dtsi +8 -0
+            compatible = "bosch,d_can";
+            ti,hwmods = "dcan1";
+            reg = <0x4ae3c000 0x2000>,
+                  <0x558 0x4>; /* index to RAMINIT reg within syscon */
+            raminit-syscon = <&dra7_ctrl_core>;
+            raminit-start-bit = <3>;
+            raminit-done-bit = <1>;
+            raminit-pulse;
Quoted 6 lines
Quoted 1 line

Hm, aren't the above 4 properties vendor specific? If so, they should start with a vendor prefix and comma.

At least for now I don't know about any other platform other than TI using a RAMINIT register outside the CAN register space. However the mechanism is generic enough and not limited to TI platforms.

I don't mind vendor prefix or not, but would like to hear the opinion of the CAN maintainers as to what they would prefer.

I don't know of any c_can/d_can implementation outside of TI that implements the raminit outside of the register space. So a "ti," prefix seems appropriate.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
#10 lore raw

Re: [PATCH 05/13] ARM: dts: DRA7: Add DCAN nodes

Hi Marc,

Quoted 12 lines · Marc Kleine-Budde
Quoted 11 lines · Roger Quadros
Quoted 10 lines

arch/arm/boot/dts/dra7.dtsi line 1281

Quoted 8 lines
arch/arm/boot/dts/dra7.dtsi +8 -0
+            compatible = "bosch,d_can";
+            ti,hwmods = "dcan1";
+            reg = <0x4ae3c000 0x2000>,
+                  <0x558 0x4>; /* index to RAMINIT reg within syscon */
+            raminit-syscon = <&dra7_ctrl_core>;
+            raminit-start-bit = <3>;
+            raminit-done-bit = <1>;
+            raminit-pulse;

Hm, aren't the above 4 properties vendor specific? If so, they should start with a vendor prefix and comma.

Quoted 9 lines
Quoted 4 lines

At least for now I don't know about any other platform other than TI using a RAMINIT register outside the CAN register space. However the mechanism is generic enough and not limited to TI platforms.

I don't mind vendor prefix or not, but would like to hear the opinion of the CAN maintainers as to what they would prefer.

I don't know of any c_can/d_can implementation outside of TI that implements the raminit outside of the register space. So a "ti," prefix seems appropriate.

Fine, I'll re-spin this with the "ti," prefix. Thanks.

cheers,
-roger