From patchwork Fri Jul 13 16:37:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 1204151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 78FC83FC8E for ; Tue, 17 Jul 2012 09:08:37 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sr3h3-0005XM-TO; Tue, 17 Jul 2012 09:03:46 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Spitj-0000oZ-KQ for linux-arm-kernel@merlin.infradead.org; Fri, 13 Jul 2012 16:39:21 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SpitN-0001TP-Qi for linux-arm-kernel@lists.infradead.org; Fri, 13 Jul 2012 16:38:59 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6DGcAKS004063; Fri, 13 Jul 2012 11:38:10 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6DGcAgc004147; Fri, 13 Jul 2012 11:38:10 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Fri, 13 Jul 2012 11:38:10 -0500 Received: from localhost.localdomain (h64-15.vpn.ti.com [172.24.64.15]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6DGbxqh001357; Fri, 13 Jul 2012 11:38:09 -0500 From: Tero Kristo To: , , Subject: [RFC 6/6] ARM: OMAP3: hwmod data: add custom setup_preprogram for sad2d hwmod Date: Fri, 13 Jul 2012 19:37:39 +0300 Message-ID: <1342197459-7920-7-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1342197459-7920-1-git-send-email-t-kristo@ti.com> References: <1342197459-7920-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20120713_173858_137282_68B0F794 X-CRM114-Status: GOOD ( 22.68 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.41 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Mailman-Approved-At: Tue, 17 Jul 2012 04:58:13 -0400 Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org SAD2D module must be properly put to idle mode during boot, as if there is no stacked modem with OMAP3, the pads can be left in a wrong mode by the bootloader and this can prevent idle. Previously this was done within pm34xx.c, but the code is now moved to the right location. This patch introduces following warning during boot: omap_hwmod: sad2d: failed to hardreset This is generated by asserting the hardresets for SAD2D hwmod, and is caused by the fuzzy behavior of reset status bits for the module. This warning is not fatal however and doesn't cause any functional problems. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 2 + arch/arm/mach-omap2/pm34xx.c | 26 ------------ include/linux/platform_data/omap3-d2d.h | 61 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 include/linux/platform_data/omap3-d2d.h diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index dd1335e..0a87269 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -19,6 +19,7 @@ #include "control.h" #include "iomap.h" #include +#include #include #include @@ -2025,6 +2026,7 @@ static struct omap_hwmod_rst_info omap3xxx_sad2d_resets[] = { static struct omap_hwmod_class omap3xxx_sad2d_class = { .name = "sad2d", + .setup_preprogram = hwmod_sad2d_preprogram, }; static struct omap_hwmod omap3xxx_sad2d_hwmod = { diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index d407b32..f987c0d 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -333,30 +333,6 @@ restore: #endif /* CONFIG_SUSPEND */ -static void __init omap3_d2d_idle(void) -{ - u16 mask, padconf; - - /* In a stand alone OMAP3430 where there is not a stacked - * modem for the D2D Idle Ack and D2D MStandby must be pulled - * high. S CONTROL_PADCONF_SAD2D_IDLEACK and - * CONTROL_PADCONF_SAD2D_MSTDBY to have a pull up. */ - mask = (1 << 4) | (1 << 3); /* pull-up, enabled */ - padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_MSTANDBY); - padconf |= mask; - omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_MSTANDBY); - - padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_IDLEACK); - padconf |= mask; - omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_IDLEACK); - - /* reset modem */ - omap2_prm_write_mod_reg(OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RSTPWRON_MASK | - OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RST_MASK, - CORE_MOD, OMAP2_RM_RSTCTRL); - omap2_prm_write_mod_reg(0, CORE_MOD, OMAP2_RM_RSTCTRL); -} - static void __init prcm_setup_regs(void) { u32 omap3630_en_uart4_mask = cpu_is_omap3630() ? @@ -429,8 +405,6 @@ static void __init prcm_setup_regs(void) /* Clear any pending PRCM interrupts */ omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); - - omap3_d2d_idle(); } void omap3_pm_off_mode_enable(int enable) diff --git a/include/linux/platform_data/omap3-d2d.h b/include/linux/platform_data/omap3-d2d.h new file mode 100644 index 0000000..d8b44bb --- /dev/null +++ b/include/linux/platform_data/omap3-d2d.h @@ -0,0 +1,61 @@ +/* + * OMAP3 Die 2 Die IP block integration + * + * Copyright (C) 2012 Texas Instruments, Inc. + * Tero Kristo + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#ifndef __LINUX_PLATFORM_DATA_OMAP3_D2D_H__ +#define __LINUX_PLATFORM_DATA_OMAP3_D2D_H__ + +#include + +#include + +/** + * hwmod_sad2d_preprogram - programs pull ups for sad2d interface + * @oh: pointer to iva2 hwmod + * + * In a stand alone OMAP3430 chip without a stacked modem, the D2D + * Idle Ack and D2D MStandy pads must be pulled + * high. So program CONTROL_PADCONF_SAD2D_IDLEACK and + * CONTROL_PADCONF_SAD2D_MSTDBY to have a pull up. Always returns 0. + */ +static int __maybe_unused hwmod_sad2d_preprogram(struct omap_hwmod *oh) +{ + u16 mask, padconf; + int i; + + mask = (1 << 4) | (1 << 3); /* pull-up, enabled */ + padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_MSTANDBY); + padconf |= mask; + omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_MSTANDBY); + + padconf = omap_ctrl_readw(OMAP3_PADCONF_SAD2D_IDLEACK); + padconf |= mask; + omap_ctrl_writew(padconf, OMAP3_PADCONF_SAD2D_IDLEACK); + + /* reset modem */ + for (i = 0; i < oh->rst_lines_cnt; i++) + omap_hwmod_assert_hardreset(oh, oh->rst_lines[i].name); + + for (i = 0; i < oh->rst_lines_cnt; i++) + omap_hwmod_deassert_hardreset(oh, oh->rst_lines[i].name); + + return 0; +} + +#endif /* __LINUX_PLATFORM_DATA_OMAP3_D2D_H__ */