From: dianders@chromium.org (Doug Anderson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ARM: rockchip: rk3288: Switch to use the proper PWM IP
Date: Mon, 18 Aug 2014 10:09:06 -0700 [thread overview]
Message-ID: <1408381749-14156-2-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1408381749-14156-1-git-send-email-dianders@chromium.org>
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 <dianders@chromium.org>
---
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 <asm/hardware/cache-l2x0.h>
#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,
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-08-18 17:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 17:09 [PATCH 0/4] PWM changes for rk3288-evb Doug Anderson
2014-08-18 17:09 ` Doug Anderson [this message]
2014-08-18 17:11 ` [PATCH 1/4] ARM: rockchip: rk3288: Switch to use the proper PWM IP Sonny Rao
2014-08-18 17:19 ` Doug Anderson
2014-08-19 7:10 ` Thierry Reding
2014-08-19 15:18 ` Doug Anderson
2014-08-20 6:08 ` Thierry Reding
2014-08-20 15:20 ` Doug Anderson
2014-08-20 15:38 ` Thierry Reding
2014-08-20 15:55 ` Doug Anderson
2014-08-20 16:20 ` Heiko Stübner
2014-08-20 16:27 ` Doug Anderson
2014-08-20 18:03 ` Heiko Stübner
2014-08-20 20:49 ` Doug Anderson
2014-08-21 6:36 ` Thierry Reding
2014-08-21 15:38 ` Doug Anderson
2014-08-21 15:49 ` Tomasz Figa
2014-08-21 16:49 ` Thierry Reding
2014-08-21 16:47 ` Thierry Reding
2014-08-25 23:40 ` Doug Anderson
2014-08-26 7:31 ` Thierry Reding
2014-08-21 6:24 ` Thierry Reding
2014-08-21 15:39 ` Doug Anderson
2014-08-21 15:53 ` Heiko Stübner
2014-08-18 17:09 ` [PATCH 2/4] pwm: rockchip: Allow polarity invert on rk3288 Doug Anderson
2014-08-19 7:18 ` Thierry Reding
2014-08-19 16:05 ` Doug Anderson
2014-08-20 6:09 ` Thierry Reding
2014-08-18 17:09 ` [PATCH 3/4] ARM: dts: Add main PWM info to rk3288 Doug Anderson
2014-08-18 17:09 ` [PATCH 4/4] ARM: dts: Enable pwm backlight on rk3288-EVB Doug Anderson
2014-08-19 7:22 ` Thierry Reding
2014-08-19 16:05 ` Doug Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408381749-14156-2-git-send-email-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).