From patchwork Mon Aug 18 17:29:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4738431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 226E0C0338 for ; Mon, 18 Aug 2014 17:35:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4AC1920136 for ; Mon, 18 Aug 2014 17:35:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B1DB20131 for ; Mon, 18 Aug 2014 17:35:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJQlX-0006Yh-GQ; Mon, 18 Aug 2014 17:30:43 +0000 Received: from mail-pa0-f73.google.com ([209.85.220.73]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJQl0-0004xK-CC for linux-arm-kernel@lists.infradead.org; Mon, 18 Aug 2014 17:30:11 +0000 Received: by mail-pa0-f73.google.com with SMTP id kx10so1390931pab.4 for ; Mon, 18 Aug 2014 10:29:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xVp7FUC8A5tw5dQ+pKKShUsub8+M0Zux5L2nXroTqXE=; b=eTRez8OSC+zma1lFNWi9RZmI92dHhOShBCvhdwIPUp2W+GVcQuFc1plSscu/qQXLGL CZhE10w5lsYnFylDn4vM5jHChOIsrBSp+azSLpWSFWFFcOcBRFI1zHvyLnbNA0Bc63FP xSFX9crxyfWYvUSqNKX2eZe1Bk3/6tzgi/Atfeo69f071+S0xQsxApRM1CkssN1pyXvx MNe9QyzkOXHjVE12BbEK5Ohv/VLxi7jPkYTCjqcJqJ5PmlDmY3WyHfNCnzn5BnlaQX3y GdVvDg/U/3a+mwGfg4Z+sO6YKpkmKK8mYatifHPirz/amGfmf74lu2IT39JCeN0OuTX2 I50A== X-Gm-Message-State: ALoCoQkmvwvAJsMx394ih12XpKy1jSL6QKa2NUALzc8KNnWI2EDbXE5azgsq2gWnNOM8p2+Hef05 X-Received: by 10.66.156.100 with SMTP id wd4mr13494585pab.31.1408382984374; Mon, 18 Aug 2014 10:29:44 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id y50si73880yhk.4.2014.08.18.10.29.44 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Aug 2014 10:29:44 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.15]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 3282D5A483F; Mon, 18 Aug 2014 10:29:44 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id CA5DA80742; Mon, 18 Aug 2014 10:29:43 -0700 (PDT) From: Doug Anderson To: Heiko Stuebner , Thierry Reding , Caesar Wang Subject: [PATCH v2 1/4] ARM: rockchip: rk3288: Switch to use the proper PWM IP Date: Mon, 18 Aug 2014 10:29:39 -0700 Message-Id: <1408382982-2077-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1408382982-2077-1-git-send-email-dianders@chromium.org> References: <1408382982-2077-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140818_103010_493353_BB7D8B95 X-CRM114-Status: GOOD ( 17.11 ) X-Spam-Score: -2.0 (--) Cc: linux@arm.linux.org.uk, Doug Anderson , linux-kernel@vger.kernel.org, Eddie Cai , olof@lixom.net, Sonny Rao , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 The rk3288 SoC has an option to switch all of the PWMs in the system between the old IP block and the new IP block. The new IP block is working and tested and the suggested PWM to use, so setup the SoC to use it and then we can pretend that the other IP block doesn't exist. This code could go lots of other places, but we've put it here. Why? - Pushing it to the bootloader just makes the code harder to update in the field. If we later find a bug in the new IP block and want to change our mind about what to use we want it to be easy to update. - Putting this code in the driver for IP block is a lot of extra work, device tree bindings, etc. Now that the new IP block is validated it's likely no future SoCs will need this code. Why pollute the PWM driver with this? This is an rk3288 thing so it should be in rk3288 code. - There's a single bit that switches over PWMs, which makes it extra hard to put this under the PWM device tree nodes. Signed-off-by: Doug Anderson --- Changes in v2: - Check for failed ioremap() arch/arm/mach-rockchip/rockchip.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c index 8ab9e0e..93c59f6 100644 --- a/arch/arm/mach-rockchip/rockchip.c +++ b/arch/arm/mach-rockchip/rockchip.c @@ -24,6 +24,29 @@ #include #include "core.h" +static void __init rk3288_init_machine(void) +{ + void *grf = ioremap(0xff770000, 0x10000); + + if (!grf) { + pr_warn("%s: Couldn't map GRF\n", __func__); + return; + } + + /* Set pwm_sel to RK design PWM in GRF_SOC_CON2; affects all PWMs */ + writel(0x00010001, grf + 0x24c); + + iounmap(grf); +} + +static void __init rockchip_init_machine(void) +{ + if (of_machine_is_compatible("rockchip,rk3288")) + rk3288_init_machine(); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +} + static const char * const rockchip_board_dt_compat[] = { "rockchip,rk2928", "rockchip,rk3066a", @@ -34,6 +57,7 @@ static const char * const rockchip_board_dt_compat[] = { }; DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") + .init_machine = rockchip_init_machine, .l2c_aux_val = 0, .l2c_aux_mask = ~0, .dt_compat = rockchip_board_dt_compat,