Skip to contentSkip to conversation

ARM: OMAP2: hwmod: AM43XX: Add hwmod support for HDQ-1W

PATCH Superseded Vignesh R 3 participants 8 messages Feb 27, 2015 – Mar 2, 2015

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vignesh R

author
#0 lore raw

PATCH 1/2 ARM: OMAP2: hwmod: AM43XX: Add hwmod support for HDQ-1W

From: "Poddar, Sourav" <[email protected]>

This patch adds hwmod data for hdq/1w driver on AM43xx.

[vigneshr at ti.com: Ported patch to v4.0-rc1]
---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 36 ++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm43xx.h             |  1 +
 2 files changed, 37 insertions(+)
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +36 -0
index 8eb85925e444..d4f1df28475c 100644
@@ -20,6 +20,7 @@
 #include "omap_hwmod_33xx_43xx_common_data.h"
 #include "prcm43xx.h"
 #include "omap_hwmod_common_data.h"
+#include "hdq1w.h"
 
 
 /* IP blocks */
@@ -516,6 +517,33 @@ static struct omap_hwmod am43xx_dss_rfbi_hwmod = {
 	.parent_hwmod	= &am43xx_dss_core_hwmod,
 };
 
+/* HDQ1W */
+static struct omap_hwmod_class_sysconfig am43xx_hdq1w_sysc = {
+	.rev_offs       = 0x0000,
+	.sysc_offs      = 0x0014,
+	.syss_offs      = 0x0018,
+	.sysc_flags     = (SYSC_HAS_SOFTRESET),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class am43xx_hdq1w_hwmod_class = {
+	.name   = "hdq1w",
+	.sysc   = &am43xx_hdq1w_sysc,
+	.reset	= &omap_hdq1w_reset,
+};
+
+static struct omap_hwmod am43xx_hdq1w_hwmod = {
+	.name           = "hdq1w",
+	.class          = &am43xx_hdq1w_hwmod_class,
+	.clkdm_name     = "l4ls_clkdm",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET,
+			.modulemode   = MODULEMODE_SWCTRL,
+		},
+	},
+};
+
 /* Interfaces */
 static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
 	.master		= &am33xx_l3_main_hwmod,
@@ -790,6 +818,13 @@ static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_rfbi = {
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_ocp_if am43xx_l4_ls__hdq1w = {
+	.master         = &am33xx_l4_ls_hwmod,
+	.slave          = &am43xx_hdq1w_hwmod,
+	.clk            = "l4ls_gclk",
+	.user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am33xx_l4_wkup__synctimer,
 	&am43xx_l4_ls__timer8,
@@ -889,6 +924,7 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am43xx_l4_ls__dss,
 	&am43xx_l4_ls__dss_dispc,
 	&am43xx_l4_ls__dss_rfbi,
+	&am43xx_l4_ls__hdq1w,
 	NULL,
 };
 
arch/arm/mach-omap2/prcm43xx.h +1 -0
index ad7b3e9977f8..48df3b55057e 100644
@@ -143,5 +143,6 @@
 #define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET        0x0268
 #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET	0x05C0
 #define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET		0x0a20
+#define AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET		0x04a0
 
 #endif
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 w1: masters: omap_hdq: Add support for 1-wire mode

This patches makes following changes to omap_hdq driver
- Enable 1-wire mode.
- Implement w1_triplet callback to facilitate search ROM procedure and auto detection of 1-wire slaves.
- Proper enabling and disabling of interrupt.
- Cleanups (formatting and return value checks).

HDQ mode remains unchanged.

---
 Documentation/devicetree/bindings/w1/omap-hdq.txt |   7 +-
 Documentation/w1/masters/omap-hdq                 |   6 +
 drivers/w1/masters/omap_hdq.c                     | 209 ++++++++++++++++++----
 3 files changed, 188 insertions(+), 34 deletions(-)
Documentation/devicetree/bindings/w1/omap-hdq.txt +6 -1
index fef794741bd1..3927b9c910bd 100644
@@ -1,11 +1,15 @@
 * OMAP HDQ One wire bus master controller
 
 Required properties:
-- compatible : should be "ti,omap3-1w"
+- compatible : should be "ti,omap3-1w" or "ti,am43xx-hdq"
 - reg : Address and length of the register set for the device
 - interrupts : interrupt line.
 - ti,hwmods : "hdq1w"
 
+Optional properties:
+- ti,mode: should be "hdq": HDQ mode  "1w": one-wire mode.
+	   If not specified HDQ mode is implied.
+
 Example:
 
 - From omap3.dtsi
@@ -14,4 +18,5 @@ Example:
 	reg = <0x480b2000 0x1000>;
 	interrupts = <58>;
 	ti,hwmods = "hdq1w";
+	ti,mode = "hdq";
   };
Documentation/w1/masters/omap-hdq +6 -0
index 884dc284b215..234522709a5f 100644
@@ -44,3 +44,9 @@ e.g:
 insmod omap_hdq.ko W1_ID=2
 inamod w1_bq27000.ko F_ID=2
 
+The driver also supports 1-wire mode. In this mode, there is no need to
+pass slave ID as parameter. The driver will auto-detect slaves connected
+to the bus using SEARCH_ROM procedure. 1-wire mode can be selected by
+setting "ti,mode" property to "1w" in DT (see
+Documentation/devicetree/bindings/w1/omap-hdq.txt for more details).
+By default driver is in HDQ mode.
drivers/w1/masters/omap_hdq.c +176 -33

363 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/2] w1: masters: omap_hdq: Add support for 1-wire mode

Quoted 2 lines · On Friday 27 February 2015 14:54:17 Vignesh R wrote:

+- compatible : should be "ti,omap3-1w" or "ti,am43xx-hdq"

Do not use wildcards in the compatible string, use real part numbers if you don't know the actual name of the device.

Arnd

author
#3 lore raw

Re: [PATCH 2/2] w1: masters: omap_hdq: Add support for 1-wire mode

Hi,

Quoted 6 lines · Arnd Bergmann
Quoted 2 lines · On Friday 27 February 2015 14:54:17 Vignesh R wrote:

+- compatible : should be "ti,omap3-1w" or "ti,am43xx-hdq"

Do not use wildcards in the compatible string, use real part numbers if you don't know the actual name of the device.

The DT node for hdq on AM437x is already present in mainline (commit: 741cac5f00beb) and it declares compatibility as "ti,am43xx-hdq". Hence, I cannot change into anything different.

Regards
Vignesh

#4 lore raw

Re: [PATCH 2/2] w1: masters: omap_hdq: Add support for 1-wire mode

Quoted 5 lines · On Friday 27 February 2015 16:01:03 Vignesh R wrote:
Quoted 4 lines · Arnd Bergmann
Quoted 2 lines · On Friday 27 February 2015 14:54:17 Vignesh R wrote:

+- compatible : should be "ti,omap3-1w" or "ti,am43xx-hdq"

Quoted 8 lines
Quoted 2 lines

Do not use wildcards in the compatible string, use real part numbers if you don't know the actual name of the device.

The DT node for hdq on AM437x is already present in mainline (commit: 741cac5f00beb) and it declares compatibility as "ti,am43xx-hdq". Hence, I cannot change into anything different.

No, there is no driver using this device, and the binding was not documented, so there is no problem in changing it: nobody will notice a regression when it was never working before.

Arnd

author
#5 lore raw

Re: [PATCH 2/2] w1: masters: omap_hdq: Add support for 1-wire mode

Hi,

Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · On Friday 27 February 2015 16:01:03 Vignesh R wrote:
Quoted 6 lines · Arnd Bergmann
Quoted 2 lines · On Friday 27 February 2015 14:54:17 Vignesh R wrote:

+- compatible : should be "ti,omap3-1w" or "ti,am43xx-hdq"

Do not use wildcards in the compatible string, use real part numbers if you don't know the actual name of the device.

Quoted 8 lines
Quoted 4 lines

The DT node for hdq on AM437x is already present in mainline (commit: 741cac5f00beb) and it declares compatibility as "ti,am43xx-hdq". Hence, I cannot change into anything different.

No, there is no driver using this device, and the binding was not documented, so there is no problem in changing it: nobody will notice a regression when it was never working before

Ok... I will change it to "ti,am4372-hdq"

Regards
Vignesh

maintainer
#6 lore raw
In reply to Vignesh R

Hi

Quoted 25 lines · Vignesh R

From: "Poddar, Sourav" <[email protected]>

This patch adds hwmod data for hdq/1w driver on AM43xx.

[vigneshr at ti.com: Ported patch to v4.0-rc1]
---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 36 ++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm43xx.h             |  1 +
 2 files changed, 37 insertions(+)
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +1 -0
index 8eb85925e444..d4f1df28475c 100644
@@ -20,6 +20,7 @@
 #include "omap_hwmod_33xx_43xx_common_data.h"
 #include "prcm43xx.h"
 #include "omap_hwmod_common_data.h"
+#include "hdq1w.h"
 
 
 /* IP blocks */

arch/arm/mach-omap2/omap_hwmod_43xx_data.c static struct omap_hwmod am43xx_dss_rfbi_hwmod = { · line 525

Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +6 -0
@@ -516,6 +517,33 @@ static struct omap_hwmod am43xx_dss_rfbi_hwmod = {
 	.parent_hwmod	= &am43xx_dss_core_hwmod,
 };
 
+/* HDQ1W */
+static struct omap_hwmod_class_sysconfig am43xx_hdq1w_sysc = {
+	.rev_offs       = 0x0000,
+	.sysc_offs      = 0x0014,
+	.syss_offs      = 0x0018,
+	.sysc_flags     = (SYSC_HAS_SOFTRESET),

This is missing the SYSC_HAS_AUTOIDLE bit. Is this intentional?

Quoted 60 lines
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +29 -0
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class am43xx_hdq1w_hwmod_class = {
+	.name   = "hdq1w",
+	.sysc   = &am43xx_hdq1w_sysc,
+	.reset	= &omap_hdq1w_reset,
+};
+
+static struct omap_hwmod am43xx_hdq1w_hwmod = {
+	.name           = "hdq1w",
+	.class          = &am43xx_hdq1w_hwmod_class,
+	.clkdm_name     = "l4ls_clkdm",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET,
+			.modulemode   = MODULEMODE_SWCTRL,
+		},
+	},
+};
+
 /* Interfaces */
 static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
 	.master		= &am33xx_l3_main_hwmod,
@@ -790,6 +818,13 @@ static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_rfbi = {
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_ocp_if am43xx_l4_ls__hdq1w = {
+	.master         = &am33xx_l4_ls_hwmod,
+	.slave          = &am43xx_hdq1w_hwmod,
+	.clk            = "l4ls_gclk",
+	.user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am33xx_l4_wkup__synctimer,
 	&am43xx_l4_ls__timer8,
@@ -889,6 +924,7 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am43xx_l4_ls__dss,
 	&am43xx_l4_ls__dss_dispc,
 	&am43xx_l4_ls__dss_rfbi,
+	&am43xx_l4_ls__hdq1w,
 	NULL,
 };
 
arch/arm/mach-omap2/prcm43xx.h +1 -0
index ad7b3e9977f8..48df3b55057e 100644
@@ -143,5 +143,6 @@
 #define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET        0x0268
 #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET	0x05C0
 #define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET		0x0a20
+#define AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET		0x04a0
 
 #endif
Signature · 1 line
1.9.1

- Paul

author
#7 lore raw

Hi,

Quoted 32 lines · Paul Walmsley

Hi

Quoted 28 lines · Vignesh R

From: "Poddar, Sourav" <[email protected]>

This patch adds hwmod data for hdq/1w driver on AM43xx.

[vigneshr at ti.com: Ported patch to v4.0-rc1]
---
 arch/arm/mach-omap2/omap_hwmod_43xx_data.c | 36 ++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prcm43xx.h             |  1 +
 2 files changed, 37 insertions(+)
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +1 -0
index 8eb85925e444..d4f1df28475c 100644
@@ -20,6 +20,7 @@
 #include "omap_hwmod_33xx_43xx_common_data.h"
 #include "prcm43xx.h"
 #include "omap_hwmod_common_data.h"
+#include "hdq1w.h"
 
 
 /* IP blocks */
@@ -516,6 +517,33 @@ static struct omap_hwmod am43xx_dss_rfbi_hwmod = {
 	.parent_hwmod	= &am43xx_dss_core_hwmod,
 };
 
Quoted 8 lines

arch/arm/mach-omap2/omap_hwmod_43xx_data.c static struct omap_hwmod am43xx_dss_rfbi_hwmod = { · line 525

Quoted 6 lines
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +6 -0
+/* HDQ1W */
+static struct omap_hwmod_class_sysconfig am43xx_hdq1w_sysc = {
+	.rev_offs       = 0x0000,
+	.sysc_offs      = 0x0014,
+	.syss_offs      = 0x0018,
+	.sysc_flags     = (SYSC_HAS_SOFTRESET),

This is missing the SYSC_HAS_AUTOIDLE bit. Is this intentional?

Sorry.. my bad.. I didn't observe this while porting the patch. I will fix this and repost.

Regards
Vignesh

Quoted 65 lines
Quoted 61 lines
arch/arm/mach-omap2/omap_hwmod_43xx_data.c +29 -0
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class am43xx_hdq1w_hwmod_class = {
+	.name   = "hdq1w",
+	.sysc   = &am43xx_hdq1w_sysc,
+	.reset	= &omap_hdq1w_reset,
+};
+
+static struct omap_hwmod am43xx_hdq1w_hwmod = {
+	.name           = "hdq1w",
+	.class          = &am43xx_hdq1w_hwmod_class,
+	.clkdm_name     = "l4ls_clkdm",
+	.prcm = {
+		.omap4 = {
+			.clkctrl_offs = AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET,
+			.modulemode   = MODULEMODE_SWCTRL,
+		},
+	},
+};
+
 /* Interfaces */
 static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
 	.master		= &am33xx_l3_main_hwmod,
@@ -790,6 +818,13 @@ static struct omap_hwmod_ocp_if am43xx_l4_ls__dss_rfbi = {
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+static struct omap_hwmod_ocp_if am43xx_l4_ls__hdq1w = {
+	.master         = &am33xx_l4_ls_hwmod,
+	.slave          = &am43xx_hdq1w_hwmod,
+	.clk            = "l4ls_gclk",
+	.user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am33xx_l4_wkup__synctimer,
 	&am43xx_l4_ls__timer8,
@@ -889,6 +924,7 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
 	&am43xx_l4_ls__dss,
 	&am43xx_l4_ls__dss_dispc,
 	&am43xx_l4_ls__dss_rfbi,
+	&am43xx_l4_ls__hdq1w,
 	NULL,
 };
 
arch/arm/mach-omap2/prcm43xx.h +1 -0
index ad7b3e9977f8..48df3b55057e 100644
@@ -143,5 +143,6 @@
 #define AM43XX_CM_PER_USB_OTG_SS1_CLKCTRL_OFFSET        0x0268
 #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET	0x05C0
 #define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET		0x0a20
+#define AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET		0x04a0
 
 #endif
Signature · 1 line
1.9.1

- Paul