public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] pwm: add MACRO to limit some code which only for rk3288
@ 2016-07-08  2:45 Kever Yang
  2016-07-08  3:44 ` Ziyuan Xu
  2016-07-09 14:39 ` Simon Glass
  0 siblings, 2 replies; 10+ messages in thread
From: Kever Yang @ 2016-07-08  2:45 UTC (permalink / raw)
  To: u-boot

The grf setting for rkpwm is only need in rk3288, other SoCs like
RK3399 which also use rkpwm do not need set the grf, let's add a
MACRO to make the code only for RK3288.

Change-Id: I167a4e8cf925e840d4bbbcfb1437aaed52b81477
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
 drivers/pwm/rk_pwm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c
index 2d289a4..e34adf0 100644
--- a/drivers/pwm/rk_pwm.c
+++ b/drivers/pwm/rk_pwm.c
@@ -13,8 +13,10 @@
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#ifdef CONFIG_ROCKCHIP_RK3288
 #include <asm/arch/cru_rk3288.h>
 #include <asm/arch/grf_rk3288.h>
+#endif
 #include <asm/arch/pwm.h>
 #include <power/regulator.h>
 
@@ -22,7 +24,9 @@ DECLARE_GLOBAL_DATA_PTR;
 
 struct rk_pwm_priv {
 	struct rk3288_pwm *regs;
+#ifdef CONFIG_ROCKCHIP_RK3288
 	struct rk3288_grf *grf;
+#endif
 };
 
 static int rk_pwm_set_config(struct udevice *dev, uint channel, uint period_ns,
@@ -65,19 +69,23 @@ static int rk_pwm_ofdata_to_platdata(struct udevice *dev)
 	struct regmap *map;
 
 	priv->regs = (struct rk3288_pwm *)dev_get_addr(dev);
+#ifdef CONFIG_ROCKCHIP_RK3288
 	map = syscon_get_regmap_by_driver_data(ROCKCHIP_SYSCON_GRF);
 	if (IS_ERR(map))
 		return PTR_ERR(map);
 	priv->grf = regmap_get_range(map, 0);
+#endif
 
 	return 0;
 }
 
 static int rk_pwm_probe(struct udevice *dev)
 {
+#ifdef CONFIG_ROCKCHIP_RK3288
 	struct rk_pwm_priv *priv = dev_get_priv(dev);
 
 	rk_setreg(&priv->grf->soc_con2, 1 << 0);
+#endif
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-09-21 22:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08  2:45 [U-Boot] [PATCH] pwm: add MACRO to limit some code which only for rk3288 Kever Yang
2016-07-08  3:44 ` Ziyuan Xu
2016-07-09 14:39 ` Simon Glass
2016-07-11  6:58   ` Kever Yang
2016-07-11 23:54     ` Simon Glass
2016-07-12  2:45       ` Kever Yang
2016-07-12 13:12         ` Simon Glass
2016-07-29  2:55           ` Kever Yang
2016-07-29  4:46         ` Doug Anderson
2016-09-21 22:01           ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox