* [PATCH 0/2 v2] OMAP2/3: fix the i2c,gpio reset timeouts during boot.
@ 2011-04-05 15:40 Avinash.H.M
2011-04-05 15:40 ` [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup Avinash.H.M
2011-04-05 15:40 ` [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen " Avinash.H.M
0 siblings, 2 replies; 7+ messages in thread
From: Avinash.H.M @ 2011-04-05 15:40 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel; +Cc: Avinash.H.M
Hi ,
The patches solve the reset timeouts seen in i2c and gpio modules while
booting omap2 and omap3.
version: v2
* For discussion on v1, please refer
http://www.spinics.net/lists/linux-omap/msg49483.html
* changes from v1:
- moved i2c specific things from hwmod files to i2c files.
- fixed comments from Paul.
Baseline:
The patches are based on
* git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
* master branch.
* v2.6.39-rc1 commit (0ce790e)
Testing:
* build tested omap2plus_defconfig for warnings and errors. none introduced.
* boot tested on 2430.
* tested for 'core off' in suspend resume on 3430 sdp. core off counters
increment after suspend resume. Core off works with below commands,
echo 1 > /debug/pm_debug/enable_off_mode
echo mem > /sys/power/state
cat /debug/pm_debug/count | grep ^core
Dependencies:
* need patch "OMAP2+: hwmod data: Set hwmod flags to only allow 16-bit
accesses to i2c" from Andry Green for accessing i2c_sysc. Without this even
with this patch, we will see i2c reset timeouts.
br ,
- Avinash
---
Avinash.H.M (2):
OMAP2/3: hwmod: fix the i2c-reset timeout during bootup
OMAP2/3: hwmod: fix gpio-reset timeouts seen during bootup.
arch/arm/mach-omap2/i2c.c | 58 ++++++++++++++++++++++++++++
arch/arm/mach-omap2/omap_hwmod_2420_data.c | 5 ++
arch/arm/mach-omap2/omap_hwmod_2430_data.c | 6 +++
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 7 +++
arch/arm/plat-omap/include/plat/i2c.h | 3 +
5 files changed, 79 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup
2011-04-05 15:40 [PATCH 0/2 v2] OMAP2/3: fix the i2c,gpio reset timeouts during boot Avinash.H.M
@ 2011-04-05 15:40 ` Avinash.H.M
2011-04-05 18:27 ` Kevin Hilman
2011-04-05 15:40 ` [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen " Avinash.H.M
1 sibling, 1 reply; 7+ messages in thread
From: Avinash.H.M @ 2011-04-05 15:40 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel
Cc: Avinash.H.M, Rajendra Nayak, Paul Walmsley, Benoit Cousson,
Kevin Hilman
The i2c module has a special reset sequence. The sequence is
- Disable the I2C.
- Write to SOFTRESET bit.
- Enable the I2C.
- Poll on the RESETDONE bit.
This sequence must be followed for i2c reset in omap2, omap3. The sequence is
implemented as a function and the i2c_class is updated with the correct
'reset' pointer.
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: Avinash.H.M <avinashhm@ti.com>
---
arch/arm/mach-omap2/i2c.c | 58 ++++++++++++++++++++++++++++
arch/arm/mach-omap2/omap_hwmod_2420_data.c | 1 +
arch/arm/mach-omap2/omap_hwmod_2430_data.c | 1 +
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 1 +
arch/arm/plat-omap/include/plat/i2c.h | 3 +
5 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index 79c478c..67c7957 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -21,9 +21,16 @@
#include <plat/cpu.h>
#include <plat/i2c.h>
+#include <plat/common.h>
#include "mux.h"
+/* In register I2C_CON, Bit 15 is the I2C enable bit */
+#define I2C_EN BIT(15)
+#define I2C_CON_OFFSET 0x24
+/* Maximum microseconds to wait for OMAP module to softreset */
+#define MAX_MODULE_SOFTRESET_WAIT 10000
+
void __init omap2_i2c_mux_pins(int bus_id)
{
char mux_name[sizeof("i2c2_scl.i2c2_scl")];
@@ -37,3 +44,54 @@ void __init omap2_i2c_mux_pins(int bus_id)
sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
}
+
+/**
+ * omap_i2c_reset- reset the omap i2c module.
+ * @oh: struct omap_hwmod *
+ *
+ * The i2c moudle in omap2, omap3 had a special sequence to reset. The
+ * sequence is:
+ * - Disable the I2C.
+ * - Write to SOFTRESET bit.
+ * - Enable the I2C.
+ * - Poll on the RESETDONE bit.
+ * The sequence is implemented in below function. This is called for 2420,
+ * 2430 and omap3.
+ */
+int omap_i2c_reset(struct omap_hwmod *oh)
+{
+ u32 v;
+ int c = 0;
+
+ /* Disable I2C */
+ v = omap_hwmod_read(oh, I2C_CON_OFFSET);
+ v = v & ~I2C_EN;
+ omap_hwmod_write(v, oh, I2C_CON_OFFSET);
+
+ /* Write to the SOFTRESET bit */
+ v = oh->_sysc_cache;
+ v |= (0x1 << oh->class->sysc->sysc_fields->srst_shift);
+
+ oh->_sysc_cache = v;
+ omap_hwmod_write(v, oh, oh->class->sysc->sysc_offs);
+
+ /* Enable I2C */
+ v = omap_hwmod_read(oh, I2C_CON_OFFSET);
+ v |= I2C_EN;
+ omap_hwmod_write(v, oh, I2C_CON_OFFSET);
+
+ /* Poll on RESETDONE bit */
+ omap_test_timeout((omap_hwmod_read(oh,
+ oh->class->sysc->syss_offs)
+ & SYSS_RESETDONE_MASK),
+ MAX_MODULE_SOFTRESET_WAIT, c);
+
+ if (c == MAX_MODULE_SOFTRESET_WAIT)
+ pr_warning("%s: %s: softreset failed (waited %d usec)\n",
+ __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
+ else
+ pr_debug("%s: %s: softreset in %d usec\n", __func__,
+ oh->name, c);
+
+ return 0;
+}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 8eb3ce1..82ff5f7 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1447,6 +1447,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
static struct omap_hwmod_class i2c_class = {
.name = "i2c",
.sysc = &i2c_sysc,
+ .reset = &omap_i2c_reset,
};
static struct omap_i2c_dev_attr i2c_dev_attr;
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index a860fb5..ce292f0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1524,6 +1524,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
static struct omap_hwmod_class i2c_class = {
.name = "i2c",
.sysc = &i2c_sysc,
+ .reset = &omap_i2c_reset,
};
static struct omap_i2c_dev_attr i2c_dev_attr = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index b98e2df..c74f972 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1460,6 +1460,7 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
static struct omap_hwmod_class i2c_class = {
.name = "i2c",
.sysc = &i2c_sysc,
+ .reset = &omap_i2c_reset,
};
/*
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 878d632..749306f 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -22,6 +22,7 @@
#define __ASM__ARCH_OMAP_I2C_H
#include <linux/i2c.h>
+#include <plat/omap_hwmod.h>
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
@@ -52,4 +53,6 @@ struct omap_i2c_dev_attr {
void __init omap1_i2c_mux_pins(int bus_id);
void __init omap2_i2c_mux_pins(int bus_id);
+int omap_i2c_reset(struct omap_hwmod *oh);
+
#endif /* __ASM__ARCH_OMAP_I2C_H */
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen during bootup.
2011-04-05 15:40 [PATCH 0/2 v2] OMAP2/3: fix the i2c,gpio reset timeouts during boot Avinash.H.M
2011-04-05 15:40 ` [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup Avinash.H.M
@ 2011-04-05 15:40 ` Avinash.H.M
2011-04-06 5:58 ` Gulati, Shweta
1 sibling, 1 reply; 7+ messages in thread
From: Avinash.H.M @ 2011-04-05 15:40 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel
Cc: Avinash.H.M, Rajendra Nayak, Paul Walmsley, Benoit Cousson,
Kevin Hilman
GPIO module expects the debounce clocks to be enabled during reset. It doesn't
reset properly and timeouts are seen, if this clock isn't enabled during
reset. Add the HWMOD_CONTROL_OPT_CLKS_IN_RESET flags to the GPIO HWMODs, with
which the debounce clocks are enabled during reset.
Cc: Rajendra Nayak <rnayak@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Signed-off-by: Avinash.H.M <avinashhm@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_2420_data.c | 4 ++++
arch/arm/mach-omap2/omap_hwmod_2430_data.c | 5 +++++
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 6 ++++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 82ff5f7..e0bda0a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1640,6 +1640,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = {
static struct omap_hwmod omap2420_gpio1_hwmod = {
.name = "gpio1",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap242x_gpio1_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs),
.main_clk = "gpios_fck",
@@ -1670,6 +1671,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = {
static struct omap_hwmod omap2420_gpio2_hwmod = {
.name = "gpio2",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap242x_gpio2_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs),
.main_clk = "gpios_fck",
@@ -1700,6 +1702,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = {
static struct omap_hwmod omap2420_gpio3_hwmod = {
.name = "gpio3",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap242x_gpio3_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs),
.main_clk = "gpios_fck",
@@ -1730,6 +1733,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = {
static struct omap_hwmod omap2420_gpio4_hwmod = {
.name = "gpio4",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap242x_gpio4_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs),
.main_clk = "gpios_fck",
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index ce292f0..99cd7bd 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1743,6 +1743,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = {
static struct omap_hwmod omap2430_gpio1_hwmod = {
.name = "gpio1",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap243x_gpio1_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs),
.main_clk = "gpios_fck",
@@ -1773,6 +1774,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = {
static struct omap_hwmod omap2430_gpio2_hwmod = {
.name = "gpio2",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap243x_gpio2_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs),
.main_clk = "gpios_fck",
@@ -1803,6 +1805,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = {
static struct omap_hwmod omap2430_gpio3_hwmod = {
.name = "gpio3",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap243x_gpio3_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs),
.main_clk = "gpios_fck",
@@ -1833,6 +1836,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = {
static struct omap_hwmod omap2430_gpio4_hwmod = {
.name = "gpio4",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap243x_gpio4_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs),
.main_clk = "gpios_fck",
@@ -1863,6 +1867,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = {
static struct omap_hwmod omap2430_gpio5_hwmod = {
.name = "gpio5",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap243x_gpio5_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs),
.main_clk = "gpio5_fck",
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index c74f972..7552b2f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -2142,6 +2142,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
static struct omap_hwmod omap3xxx_gpio1_hwmod = {
.name = "gpio1",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio1_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs),
.main_clk = "gpio1_ick",
@@ -2178,6 +2179,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
static struct omap_hwmod omap3xxx_gpio2_hwmod = {
.name = "gpio2",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio2_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs),
.main_clk = "gpio2_ick",
@@ -2214,6 +2216,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
static struct omap_hwmod omap3xxx_gpio3_hwmod = {
.name = "gpio3",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio3_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs),
.main_clk = "gpio3_ick",
@@ -2250,6 +2253,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
static struct omap_hwmod omap3xxx_gpio4_hwmod = {
.name = "gpio4",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio4_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs),
.main_clk = "gpio4_ick",
@@ -2286,6 +2290,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
static struct omap_hwmod omap3xxx_gpio5_hwmod = {
.name = "gpio5",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio5_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs),
.main_clk = "gpio5_ick",
@@ -2322,6 +2327,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
static struct omap_hwmod omap3xxx_gpio6_hwmod = {
.name = "gpio6",
+ .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
.mpu_irqs = omap3xxx_gpio6_irqs,
.mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs),
.main_clk = "gpio6_ick",
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup
2011-04-05 15:40 ` [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup Avinash.H.M
@ 2011-04-05 18:27 ` Kevin Hilman
2011-04-07 6:42 ` Mahadeva, Avinash
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Hilman @ 2011-04-05 18:27 UTC (permalink / raw)
To: Avinash.H.M
Cc: linux-omap, linux-arm-kernel, Rajendra Nayak, Paul Walmsley,
Benoit Cousson
"Avinash.H.M" <avinashhm@ti.com> writes:
> The i2c module has a special reset sequence. The sequence is
> - Disable the I2C.
> - Write to SOFTRESET bit.
> - Enable the I2C.
> - Poll on the RESETDONE bit.
> This sequence must be followed for i2c reset in omap2, omap3. The sequence is
> implemented as a function and the i2c_class is updated with the correct
> 'reset' pointer.
>
> Cc: Rajendra Nayak <rnayak@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Avinash.H.M <avinashhm@ti.com>
[...]
> +
> +/**
> + * omap_i2c_reset- reset the omap i2c module.
> + * @oh: struct omap_hwmod *
> + *
> + * The i2c moudle in omap2, omap3 had a special sequence to reset. The
> + * sequence is:
> + * - Disable the I2C.
> + * - Write to SOFTRESET bit.
> + * - Enable the I2C.
> + * - Poll on the RESETDONE bit.
> + * The sequence is implemented in below function. This is called for 2420,
> + * 2430 and omap3.
> + */
> +int omap_i2c_reset(struct omap_hwmod *oh)
> +{
> + u32 v;
> + int c = 0;
> +
> + /* Disable I2C */
> + v = omap_hwmod_read(oh, I2C_CON_OFFSET);
> + v = v & ~I2C_EN;
> + omap_hwmod_write(v, oh, I2C_CON_OFFSET);
> +
> + /* Write to the SOFTRESET bit */
> + v = oh->_sysc_cache;
> + v |= (0x1 << oh->class->sysc->sysc_fields->srst_shift);
> +
> + oh->_sysc_cache = v;
> + omap_hwmod_write(v, oh, oh->class->sysc->sysc_offs);
Direct SYSCONFIG access isn't right here. This should go through
omap_hwmod.
What is probably needed is exposing _ocp_softreset to device code
via something like omap_hwmod_ocp_softreset() and calling that here.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen during bootup.
2011-04-05 15:40 ` [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen " Avinash.H.M
@ 2011-04-06 5:58 ` Gulati, Shweta
2011-04-07 6:45 ` Avinash.H.M.
0 siblings, 1 reply; 7+ messages in thread
From: Gulati, Shweta @ 2011-04-06 5:58 UTC (permalink / raw)
To: Avinash.H.M
Cc: linux-omap, linux-arm-kernel, Rajendra Nayak, Paul Walmsley,
Benoit Cousson, Kevin Hilman
Hi,
On Tue, Apr 5, 2011 at 9:10 PM, Avinash.H.M <avinashhm@ti.com> wrote:
> GPIO module expects the debounce clocks to be enabled during reset. It doesn't
> reset properly and timeouts are seen, if this clock isn't enabled during
> reset. Add the HWMOD_CONTROL_OPT_CLKS_IN_RESET flags to the GPIO HWMODs, with
> which the debounce clocks are enabled during reset.
Minor comment,
Rephrase as " GPIO module doesn't reset properly and timeouts are seen
during bootup, if
debounce clock is not enabled"
to make commit log more clear.
> Cc: Rajendra Nayak <rnayak@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Signed-off-by: Avinash.H.M <avinashhm@ti.com>
> ---
> arch/arm/mach-omap2/omap_hwmod_2420_data.c | 4 ++++
> arch/arm/mach-omap2/omap_hwmod_2430_data.c | 5 +++++
> arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 6 ++++++
> 3 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> index 82ff5f7..e0bda0a 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
> @@ -1640,6 +1640,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = {
>
> static struct omap_hwmod omap2420_gpio1_hwmod = {
> .name = "gpio1",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap242x_gpio1_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs),
> .main_clk = "gpios_fck",
> @@ -1670,6 +1671,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = {
>
> static struct omap_hwmod omap2420_gpio2_hwmod = {
> .name = "gpio2",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap242x_gpio2_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs),
> .main_clk = "gpios_fck",
> @@ -1700,6 +1702,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = {
>
> static struct omap_hwmod omap2420_gpio3_hwmod = {
> .name = "gpio3",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap242x_gpio3_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs),
> .main_clk = "gpios_fck",
> @@ -1730,6 +1733,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = {
>
> static struct omap_hwmod omap2420_gpio4_hwmod = {
> .name = "gpio4",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap242x_gpio4_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs),
> .main_clk = "gpios_fck",
> diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> index ce292f0..99cd7bd 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
> @@ -1743,6 +1743,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = {
>
> static struct omap_hwmod omap2430_gpio1_hwmod = {
> .name = "gpio1",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap243x_gpio1_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs),
> .main_clk = "gpios_fck",
> @@ -1773,6 +1774,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = {
>
> static struct omap_hwmod omap2430_gpio2_hwmod = {
> .name = "gpio2",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap243x_gpio2_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs),
> .main_clk = "gpios_fck",
> @@ -1803,6 +1805,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = {
>
> static struct omap_hwmod omap2430_gpio3_hwmod = {
> .name = "gpio3",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap243x_gpio3_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs),
> .main_clk = "gpios_fck",
> @@ -1833,6 +1836,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = {
>
> static struct omap_hwmod omap2430_gpio4_hwmod = {
> .name = "gpio4",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap243x_gpio4_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs),
> .main_clk = "gpios_fck",
> @@ -1863,6 +1867,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = {
>
> static struct omap_hwmod omap2430_gpio5_hwmod = {
> .name = "gpio5",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap243x_gpio5_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs),
> .main_clk = "gpio5_fck",
> diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> index c74f972..7552b2f 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
> @@ -2142,6 +2142,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio1_hwmod = {
> .name = "gpio1",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio1_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs),
> .main_clk = "gpio1_ick",
> @@ -2178,6 +2179,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio2_hwmod = {
> .name = "gpio2",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio2_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs),
> .main_clk = "gpio2_ick",
> @@ -2214,6 +2216,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio3_hwmod = {
> .name = "gpio3",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio3_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs),
> .main_clk = "gpio3_ick",
> @@ -2250,6 +2253,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio4_hwmod = {
> .name = "gpio4",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio4_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs),
> .main_clk = "gpio4_ick",
> @@ -2286,6 +2290,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio5_hwmod = {
> .name = "gpio5",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio5_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs),
> .main_clk = "gpio5_ick",
> @@ -2322,6 +2327,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
>
> static struct omap_hwmod omap3xxx_gpio6_hwmod = {
> .name = "gpio6",
> + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
> .mpu_irqs = omap3xxx_gpio6_irqs,
> .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs),
> .main_clk = "gpio6_ick",
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks,
Regards,
Shweta
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup
2011-04-05 18:27 ` Kevin Hilman
@ 2011-04-07 6:42 ` Mahadeva, Avinash
0 siblings, 0 replies; 7+ messages in thread
From: Mahadeva, Avinash @ 2011-04-07 6:42 UTC (permalink / raw)
To: Kevin Hilman
Cc: Paul Walmsley, linux-omap, Benoit Cousson, linux-arm-kernel,
Rajendra Nayak
[-- Attachment #1.1: Type: text/plain, Size: 2041 bytes --]
On Tue, Apr 5, 2011 at 11:57 PM, Kevin Hilman <khilman@ti.com> wrote:
> "Avinash.H.M" <avinashhm@ti.com> writes:
>
> > The i2c module has a special reset sequence. The sequence is
> > - Disable the I2C.
> > - Write to SOFTRESET bit.
> > - Enable the I2C.
> > - Poll on the RESETDONE bit.
> > This sequence must be followed for i2c reset in omap2, omap3. The
> sequence is
> > implemented as a function and the i2c_class is updated with the correct
> > 'reset' pointer.
> >
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Paul Walmsley <paul@pwsan.com>
> > Cc: Benoit Cousson <b-cousson@ti.com>
> > Cc: Kevin Hilman <khilman@ti.com>
> > Signed-off-by: Avinash.H.M <avinashhm@ti.com>
>
> [...]
>
> > +
> > +/**
> > + * omap_i2c_reset- reset the omap i2c module.
> > + * @oh: struct omap_hwmod *
> > + *
> > + * The i2c moudle in omap2, omap3 had a special sequence to reset. The
> > + * sequence is:
> > + * - Disable the I2C.
> > + * - Write to SOFTRESET bit.
> > + * - Enable the I2C.
> > + * - Poll on the RESETDONE bit.
> > + * The sequence is implemented in below function. This is called for
> 2420,
> > + * 2430 and omap3.
> > + */
> > +int omap_i2c_reset(struct omap_hwmod *oh)
> > +{
> > + u32 v;
> > + int c = 0;
> > +
> > + /* Disable I2C */
> > + v = omap_hwmod_read(oh, I2C_CON_OFFSET);
> > + v = v & ~I2C_EN;
> > + omap_hwmod_write(v, oh, I2C_CON_OFFSET);
> > +
> > + /* Write to the SOFTRESET bit */
> > + v = oh->_sysc_cache;
> > + v |= (0x1 << oh->class->sysc->sysc_fields->srst_shift);
> > +
> > + oh->_sysc_cache = v;
> > + omap_hwmod_write(v, oh, oh->class->sysc->sysc_offs);
>
> Direct SYSCONFIG access isn't right here. This should go through
> omap_hwmod.
>
> What is probably needed is exposing _ocp_softreset to device code
> via something like omap_hwmod_ocp_softreset() and calling that here.
>
>
Hi Kevin ,
thanks for the review.
OK. I ll create a wrapper function ' omap_hwmod_ocp_softreset'
around '_ocp_softreset' and call it here .
b r ,
- avinash.
> Kevin
>
[-- Attachment #1.2: Type: text/html, Size: 3233 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen during bootup.
2011-04-06 5:58 ` Gulati, Shweta
@ 2011-04-07 6:45 ` Avinash.H.M.
0 siblings, 0 replies; 7+ messages in thread
From: Avinash.H.M. @ 2011-04-07 6:45 UTC (permalink / raw)
To: Gulati, Shweta
Cc: linux-omap, linux-arm-kernel, Rajendra Nayak, Paul Walmsley,
Benoit Cousson, Kevin Hilman
On Wed, Apr 06, 2011 at 11:28:00AM +0530, Gulati, Shweta wrote:
> Hi,
>
> On Tue, Apr 5, 2011 at 9:10 PM, Avinash.H.M <avinashhm@ti.com> wrote:
> > GPIO module expects the debounce clocks to be enabled during reset. It doesn't
> > reset properly and timeouts are seen, if this clock isn't enabled during
> > reset. Add the HWMOD_CONTROL_OPT_CLKS_IN_RESET flags to the GPIO HWMODs, with
> > which the debounce clocks are enabled during reset.
> Minor comment,
> Rephrase as " GPIO module doesn't reset properly and timeouts are seen
> during bootup, if
> debounce clock is not enabled"
> to make commit log more clear.
Hi Shweta ,
thanks for the review.
i will fix the rephrase the change log .
br ,
- avinash
> > Cc: Rajendra Nayak <rnayak@ti.com>
> > Cc: Paul Walmsley <paul@pwsan.com>
> > Cc: Benoit Cousson <b-cousson@ti.com>
> > Cc: Kevin Hilman <khilman@ti.com>
> > Signed-off-by: Avinash.H.M <avinashhm@ti.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-07 6:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 15:40 [PATCH 0/2 v2] OMAP2/3: fix the i2c,gpio reset timeouts during boot Avinash.H.M
2011-04-05 15:40 ` [PATCH 1/2 v2] OMAP2/3: hwmod: fix the i2c-reset timeout during bootup Avinash.H.M
2011-04-05 18:27 ` Kevin Hilman
2011-04-07 6:42 ` Mahadeva, Avinash
2011-04-05 15:40 ` [PATCH 2/2 v2] OMAP2/3: hwmod: fix gpio-reset timeouts seen " Avinash.H.M
2011-04-06 5:58 ` Gulati, Shweta
2011-04-07 6:45 ` Avinash.H.M.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).