From patchwork Tue Jul 23 07:20:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 2831760 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 19FF19F4D4 for ; Tue, 23 Jul 2013 07:22:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 448E52011D for ; Tue, 23 Jul 2013 07:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4530720117 for ; Tue, 23 Jul 2013 07:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754250Ab3GWHWh (ORCPT ); Tue, 23 Jul 2013 03:22:37 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:48650 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754223Ab3GWHWh (ORCPT ); Tue, 23 Jul 2013 03:22:37 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6N7M8mH005236; Tue, 23 Jul 2013 02:22:08 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6N7M8jQ026394; Tue, 23 Jul 2013 02:22:08 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Tue, 23 Jul 2013 02:22:08 -0500 Received: from sokoban.tieu.ti.com (h79-8.vpn.ti.com [172.24.79.8]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6N7LQtk027090; Tue, 23 Jul 2013 02:22:06 -0500 From: Tero Kristo To: , , , , , , CC: , Subject: [PATCHv4 16/33] CLK: OMAP: DPLL: do not of_iomap NULL autoidle register Date: Tue, 23 Jul 2013 10:20:11 +0300 Message-ID: <1374564028-11352-17-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374564028-11352-1-git-send-email-t-kristo@ti.com> References: <1374564028-11352-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP AM33xx series SoCs do not have autoidle support, and for these the autoidle register is marked as NULL. Check against a NULL pointer and do not attempt to of_iomap in this case, as this just creates a bogus pointer and causes a kernel crash during boot. Signed-off-by: Tero Kristo --- drivers/clk/omap/dpll.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clk/omap/dpll.c b/drivers/clk/omap/dpll.c index 1d24feada..d8a958a 100644 --- a/drivers/clk/omap/dpll.c +++ b/drivers/clk/omap/dpll.c @@ -162,6 +162,7 @@ static void __init of_omap_dpll_setup(struct device_node *node, u32 max_multiplier = 2047; u32 max_divider = 128; u32 min_divider = 1; + u32 val; int i; dd = kzalloc(sizeof(struct dpll_data), GFP_KERNEL); @@ -210,7 +211,14 @@ static void __init of_omap_dpll_setup(struct device_node *node, dd->control_reg = of_iomap(node, 0); dd->idlest_reg = of_iomap(node, 1); - dd->autoidle_reg = of_iomap(node, 2); + /* + * AM33xx DPLLs have no autoidle support, and the autoidle reg + * for these is NULL. Do not attempt to of_iomap in this case, + * as this just creates a bogus pointer and crashes the kernel. + */ + of_property_read_u32_index(node, "reg", 2 * 2, &val); + if (val) + dd->autoidle_reg = of_iomap(node, 2); dd->mult_div1_reg = of_iomap(node, 3); dd->idlest_mask = idlest_mask;