From patchwork Mon Aug 18 17:09:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 4738271 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 27C60C0338 for ; Mon, 18 Aug 2014 17:14:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62C8A20131 for ; Mon, 18 Aug 2014 17:14:29 +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 8C8A420120 for ; Mon, 18 Aug 2014 17:14:28 +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 1XJQSD-0005DC-E0; Mon, 18 Aug 2014 17:10:45 +0000 Received: from mail-yk0-f201.google.com ([209.85.160.201]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJQR3-0002up-G1 for linux-arm-kernel@lists.infradead.org; Mon, 18 Aug 2014 17:09:34 +0000 Received: by mail-yk0-f201.google.com with SMTP id 142so632964ykq.0 for ; Mon, 18 Aug 2014 10:09:11 -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=mVTMn1UhskWMIai2KU5C+p3CXMjVOBfhnQqJbbB7pTQ=; b=DYRhfdgHH5oOErclGLjcvFVk5dSvZk0bi+P0bnDT9x74nbfpQ8AYXhcNWnYwTU6gZW G6rKZu+Wx+mOPVszBwmUK3U5JMC5mI0PtBfjZxj8h7MXUWJcFjoCPi8njKL8uTwkswyG UBWOvka5Ihcu0OfJrPq+EuVQ26l6SS6oPvTr8ZLCmT6E0oUEw8/YBaOnVhfs2gcduEUB 4dnBiN82CTOHylgpjXcUilly2/27KNV31fDRxLqRrLAcmW28PsI8DmufZziFstnP4kPz FzNAvPnt3ZR6uymeZ47uJ7i3IvZtQtjycRPprTjwrqeRq5HWbBjM4RPDqv8Ce/Byi9ZX y34w== X-Gm-Message-State: ALoCoQlzlf1AABWe0KL/N1bEhdXF6TTMW+RyZ7jW+R+OLULSSMhaxRS7JK0xw1LnVr3MpXKth3ig X-Received: by 10.236.82.14 with SMTP id n14mr8803019yhe.35.1408381751772; Mon, 18 Aug 2014 10:09:11 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id o69si68908yhp.6.2014.08.18.10.09.11 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Aug 2014 10:09:11 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.15]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 9E30031C5B8; Mon, 18 Aug 2014 10:09:11 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 41E668037D; Mon, 18 Aug 2014 10:09:11 -0700 (PDT) From: Doug Anderson To: Heiko Stuebner , Thierry Reding , Caesar Wang Subject: [PATCH 1/4] ARM: rockchip: rk3288: Switch to use the proper PWM IP Date: Mon, 18 Aug 2014 10:09:06 -0700 Message-Id: <1408381749-14156-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1408381749-14156-1-git-send-email-dianders@chromium.org> References: <1408381749-14156-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140818_100933_667982_86BD35A8 X-CRM114-Status: GOOD ( 16.51 ) X-Spam-Score: -1.4 (-) 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 --- arch/arm/mach-rockchip/rockchip.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c index 8ab9e0e..99133b9 100644 --- a/arch/arm/mach-rockchip/rockchip.c +++ b/arch/arm/mach-rockchip/rockchip.c @@ -24,6 +24,24 @@ #include #include "core.h" +static void __init rk3288_init_machine(void) +{ + void *grf = ioremap(0xff770000, 0x10000); + + /* 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 +52,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,