From patchwork Tue Jun 4 11:32:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 2658631 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A608740213 for ; Tue, 4 Jun 2013 11:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753954Ab3FDLgl (ORCPT ); Tue, 4 Jun 2013 07:36:41 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:59766 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752508Ab3FDLgk (ORCPT ); Tue, 4 Jun 2013 07:36:40 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r54BaN5j022584; Tue, 4 Jun 2013 06:36:23 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r54BaN0b009029; Tue, 4 Jun 2013 06:36:23 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 4 Jun 2013 06:36:23 -0500 Received: from [10.167.145.172] (uglx0174654.ucm2.emeaucm.ext.ti.com [10.167.145.172]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r54BaKlq024044; Tue, 4 Jun 2013 06:36:21 -0500 Message-ID: <51ADD06B.3000201@ti.com> Date: Tue, 4 Jun 2013 14:32:59 +0300 From: Grygorii Strashko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Kevin Hilman CC: Tony Lindgren , Samuel Ortiz , Wolfram Sang , "Ben Dooks (embedded platforms)" , Santosh Shilimkar , , , Subject: Re: [PATCH 1/2] i2c: omap: convert to module_platform_driver() References: <1366723151-23209-1-git-send-email-grygorii.strashko@ti.com> <1366723151-23209-2-git-send-email-grygorii.strashko@ti.com> <87fvwylxl8.fsf@linaro.org> In-Reply-To: <87fvwylxl8.fsf@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi Kevin, On 06/03/2013 11:59 PM, Kevin Hilman wrote: > Grygorii Strashko writes: > >> The OMAP I2C driver has a relation to pinctrl-single driver. As result, >> its probe will be deferred during system boot until late init time, >> because the pinctrl-single is initizalized as moudle/device init time. >> This, in turn, will delay initialization of all I2C devices (like mfd, >> I2C regulators and etc.) and cause boot delay (more over, it can broken >> initialization of drivers which are not ready to use deferred probe >> mechanism yet, for example DSS). >> >> There are no sense to keep OMAP I2C initialization on subsys init layer >> any more, hence shift it to module/device layer where the i2c <--> >> pinctrl-single dependency is resolved in drivers/Makefile now. >> >> Cc: Wolfram Sang >> Cc: "Ben Dooks (embedded platforms)" >> Cc: Santosh Shilimkar >> Cc: linux-omap@vger.kernel.org >> Cc: linux-i2c@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> >> Signed-off-by: Grygorii Strashko > Testing this patch with PATCH 1/2, the twl_rtc driver fails to correctly > initialize on OMAP3: > > twl_rtc rtc.22: hctosys: invalid date/time > > instead of the expected result: > > twl_rtc rtc.22: setting system clock to 2000-01-01 00:00:00 UTC (946684800) > > so something is still not right for the init sequence. > > Kevin I think, the root cause of the problem isn't this patch - it's just yet another side effect of using deferred probes :). I've taken a look on twl-rtc code and found possible error place static int __init twl_rtc_init(void) { if (twl_class_is_4030()) <------ here, rtc_reg_map = (u8 *) twl4030_rtc_reg_map; else rtc_reg_map = (u8 *) twl6030_rtc_reg_map; return platform_driver_register(&twl4030rtc_driver); } In drivers/Makefile: obj-$(CONFIG_RTC_LIB) += rtc/ <------ RTC is placed before I2C obj-y += i2c/ media/ <----- and only here I2C bus instantiates TWL-core device and configures twl_priv->twl_id Thats why it's working on my OMAP4/twl6030 board. Could you check if below fix will work on OMAP3: Unfortunately, I have no OMAP3 HW and can't check it. Regards, -grygorii --- 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 diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 8751a52..aaa5015 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -469,6 +469,11 @@ static int twl_rtc_probe(struct platform_device *pdev) if (irq <= 0) goto out1; + if (twl_class_is_4030()) + rtc_reg_map = (u8 *) twl4030_rtc_reg_map; + else + rtc_reg_map = (u8 *) twl6030_rtc_reg_map; + ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); if (ret < 0) goto out1; @@ -610,11 +615,6 @@ static struct platform_driver twl4030rtc_driver = { static int __init twl_rtc_init(void) { - if (twl_class_is_4030()) - rtc_reg_map = (u8 *) twl4030_rtc_reg_map; - else - rtc_reg_map = (u8 *) twl6030_rtc_reg_map; - return platform_driver_register(&twl4030rtc_driver); } module_init(twl_rtc_init);