aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-04-28 11:21:03 -0400
committerTony Lindgren <tony@atomide.com>2016-04-28 17:26:32 -0400
commit8453c5cafd32c4d6bd13ec4a62d4b639f4edb222 (patch)
tree965affedb15af55e92a5304e0dc8ca5ba5e4902c
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51
Before we start removing omap3 legacy booting support, let's make n900 DT booting behave the same way for ir-rx51 as the legacy booting does. For now, we need to pass pdata to the ir-rx51 driver. This means that the n900 tree can move to using DT based booting without having to carry all the legacy platform data with it when it gets dropped from the mainline tree. Note that the ir-rx51 driver is currently disabled because of the dependency to !ARCH_MULTIPLATFORM. This will get sorted out later with the help of drivers/pwm/pwm-omap-dmtimer.c. But first we need to add chained IRQ support to dmtimer code to avoid introducing new custom frameworks. So let's just pass the necessary dmtimer functions to ir-rx51 so we can get it working in the following patch. Cc: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c35
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c33
-rw-r--r--include/linux/platform_data/media/ir-rx51.h1
-rw-r--r--include/linux/platform_data/pwm_omap_dmtimer.h21
4 files changed, 87 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index da174c0d603b..9a7073949d1d 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -30,6 +30,8 @@
30#include <linux/platform_data/spi-omap2-mcspi.h> 30#include <linux/platform_data/spi-omap2-mcspi.h>
31#include <linux/platform_data/mtd-onenand-omap2.h> 31#include <linux/platform_data/mtd-onenand-omap2.h>
32 32
33#include <plat/dmtimer.h>
34
33#include <asm/system_info.h> 35#include <asm/system_info.h>
34 36
35#include "common.h" 37#include "common.h"
@@ -47,9 +49,8 @@
47 49
48#include <video/omap-panel-data.h> 50#include <video/omap-panel-data.h>
49 51
50#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) 52#include <linux/platform_data/pwm_omap_dmtimer.h>
51#include <linux/platform_data/media/ir-rx51.h> 53#include <linux/platform_data/media/ir-rx51.h>
52#endif
53 54
54#include "mux.h" 55#include "mux.h"
55#include "omap-pm.h" 56#include "omap-pm.h"
@@ -1212,10 +1213,40 @@ static void __init rx51_init_tsc2005(void)
1212 gpio_to_irq(RX51_TSC2005_IRQ_GPIO); 1213 gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
1213} 1214}
1214 1215
1216#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
1217static struct pwm_omap_dmtimer_pdata __maybe_unused pwm_dmtimer_pdata = {
1218 .request_by_node = omap_dm_timer_request_by_node,
1219 .request_specific = omap_dm_timer_request_specific,
1220 .request = omap_dm_timer_request,
1221 .set_source = omap_dm_timer_set_source,
1222 .get_irq = omap_dm_timer_get_irq,
1223 .set_int_enable = omap_dm_timer_set_int_enable,
1224 .set_int_disable = omap_dm_timer_set_int_disable,
1225 .free = omap_dm_timer_free,
1226 .enable = omap_dm_timer_enable,
1227 .disable = omap_dm_timer_disable,
1228 .get_fclk = omap_dm_timer_get_fclk,
1229 .start = omap_dm_timer_start,
1230 .stop = omap_dm_timer_stop,
1231 .set_load = omap_dm_timer_set_load,
1232 .set_match = omap_dm_timer_set_match,
1233 .set_pwm = omap_dm_timer_set_pwm,
1234 .set_prescaler = omap_dm_timer_set_prescaler,
1235 .read_counter = omap_dm_timer_read_counter,
1236 .write_counter = omap_dm_timer_write_counter,
1237 .read_status = omap_dm_timer_read_status,
1238 .write_status = omap_dm_timer_write_status,
1239};
1240#endif
1241
1215#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) 1242#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
1216static struct lirc_rx51_platform_data rx51_lirc_data = { 1243static struct lirc_rx51_platform_data rx51_lirc_data = {
1217 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat, 1244 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
1218 .pwm_timer = 9, /* Use GPT 9 for CIR */ 1245 .pwm_timer = 9, /* Use GPT 9 for CIR */
1246#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
1247 .dmtimer = &pwm_dmtimer_pdata,
1248#endif
1249
1219}; 1250};
1220 1251
1221static struct platform_device rx51_lirc_device = { 1252static struct platform_device rx51_lirc_device = {
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index a935d28443da..f8d389d031ba 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -24,6 +24,7 @@
24#include <linux/platform_data/iommu-omap.h> 24#include <linux/platform_data/iommu-omap.h>
25#include <linux/platform_data/wkup_m3.h> 25#include <linux/platform_data/wkup_m3.h>
26#include <linux/platform_data/pwm_omap_dmtimer.h> 26#include <linux/platform_data/pwm_omap_dmtimer.h>
27#include <linux/platform_data/media/ir-rx51.h>
27#include <plat/dmtimer.h> 28#include <plat/dmtimer.h>
28 29
29#include "common.h" 30#include "common.h"
@@ -31,6 +32,7 @@
31#include "dss-common.h" 32#include "dss-common.h"
32#include "control.h" 33#include "control.h"
33#include "omap_device.h" 34#include "omap_device.h"
35#include "omap-pm.h"
34#include "omap-secure.h" 36#include "omap-secure.h"
35#include "soc.h" 37#include "soc.h"
36#include "hsmmc.h" 38#include "hsmmc.h"
@@ -268,6 +270,8 @@ static struct platform_device omap3_rom_rng_device = {
268 }, 270 },
269}; 271};
270 272
273static struct platform_device rx51_lirc_device;
274
271static void __init nokia_n900_legacy_init(void) 275static void __init nokia_n900_legacy_init(void)
272{ 276{
273 hsmmc2_internal_input_clk(); 277 hsmmc2_internal_input_clk();
@@ -286,6 +290,8 @@ static void __init nokia_n900_legacy_init(void)
286 platform_device_register(&omap3_rom_rng_device); 290 platform_device_register(&omap3_rom_rng_device);
287 291
288 } 292 }
293
294 platform_device_register(&rx51_lirc_device);
289} 295}
290 296
291static void __init omap3_tao3530_legacy_init(void) 297static void __init omap3_tao3530_legacy_init(void)
@@ -453,8 +459,14 @@ void omap_auxdata_legacy_init(struct device *dev)
453 459
454/* Dual mode timer PWM callbacks platdata */ 460/* Dual mode timer PWM callbacks platdata */
455#if IS_ENABLED(CONFIG_OMAP_DM_TIMER) 461#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
456struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = { 462static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
457 .request_by_node = omap_dm_timer_request_by_node, 463 .request_by_node = omap_dm_timer_request_by_node,
464 .request_specific = omap_dm_timer_request_specific,
465 .request = omap_dm_timer_request,
466 .set_source = omap_dm_timer_set_source,
467 .get_irq = omap_dm_timer_get_irq,
468 .set_int_enable = omap_dm_timer_set_int_enable,
469 .set_int_disable = omap_dm_timer_set_int_disable,
458 .free = omap_dm_timer_free, 470 .free = omap_dm_timer_free,
459 .enable = omap_dm_timer_enable, 471 .enable = omap_dm_timer_enable,
460 .disable = omap_dm_timer_disable, 472 .disable = omap_dm_timer_disable,
@@ -465,10 +477,29 @@ struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
465 .set_match = omap_dm_timer_set_match, 477 .set_match = omap_dm_timer_set_match,
466 .set_pwm = omap_dm_timer_set_pwm, 478 .set_pwm = omap_dm_timer_set_pwm,
467 .set_prescaler = omap_dm_timer_set_prescaler, 479 .set_prescaler = omap_dm_timer_set_prescaler,
480 .read_counter = omap_dm_timer_read_counter,
468 .write_counter = omap_dm_timer_write_counter, 481 .write_counter = omap_dm_timer_write_counter,
482 .read_status = omap_dm_timer_read_status,
483 .write_status = omap_dm_timer_write_status,
469}; 484};
470#endif 485#endif
471 486
487static struct lirc_rx51_platform_data __maybe_unused rx51_lirc_data = {
488 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
489 .pwm_timer = 9, /* Use GPT 9 for CIR */
490#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
491 .dmtimer = &pwm_dmtimer_pdata,
492#endif
493};
494
495static struct platform_device __maybe_unused rx51_lirc_device = {
496 .name = "lirc_rx51",
497 .id = -1,
498 .dev = {
499 .platform_data = &rx51_lirc_data,
500 },
501};
502
472/* 503/*
473 * Few boards still need auxdata populated before we populate 504 * Few boards still need auxdata populated before we populate
474 * the dev entries in of_platform_populate(). 505 * the dev entries in of_platform_populate().
diff --git a/include/linux/platform_data/media/ir-rx51.h b/include/linux/platform_data/media/ir-rx51.h
index 104aa892f31b..3038120ca46e 100644
--- a/include/linux/platform_data/media/ir-rx51.h
+++ b/include/linux/platform_data/media/ir-rx51.h
@@ -5,6 +5,7 @@ struct lirc_rx51_platform_data {
5 int pwm_timer; 5 int pwm_timer;
6 6
7 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t); 7 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
8 struct pwm_omap_dmtimer_pdata *dmtimer;
8}; 9};
9 10
10#endif 11#endif
diff --git a/include/linux/platform_data/pwm_omap_dmtimer.h b/include/linux/platform_data/pwm_omap_dmtimer.h
index 59384217208f..e7d521e48855 100644
--- a/include/linux/platform_data/pwm_omap_dmtimer.h
+++ b/include/linux/platform_data/pwm_omap_dmtimer.h
@@ -35,6 +35,16 @@
35#ifndef __PWM_OMAP_DMTIMER_PDATA_H 35#ifndef __PWM_OMAP_DMTIMER_PDATA_H
36#define __PWM_OMAP_DMTIMER_PDATA_H 36#define __PWM_OMAP_DMTIMER_PDATA_H
37 37
38/* clock sources */
39#define PWM_OMAP_DMTIMER_SRC_SYS_CLK 0x00
40#define PWM_OMAP_DMTIMER_SRC_32_KHZ 0x01
41#define PWM_OMAP_DMTIMER_SRC_EXT_CLK 0x02
42
43/* timer interrupt enable bits */
44#define PWM_OMAP_DMTIMER_INT_CAPTURE (1 << 2)
45#define PWM_OMAP_DMTIMER_INT_OVERFLOW (1 << 1)
46#define PWM_OMAP_DMTIMER_INT_MATCH (1 << 0)
47
38/* trigger types */ 48/* trigger types */
39#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00 49#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00
40#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01 50#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01
@@ -45,15 +55,23 @@ typedef struct omap_dm_timer pwm_omap_dmtimer;
45 55
46struct pwm_omap_dmtimer_pdata { 56struct pwm_omap_dmtimer_pdata {
47 pwm_omap_dmtimer *(*request_by_node)(struct device_node *np); 57 pwm_omap_dmtimer *(*request_by_node)(struct device_node *np);
58 pwm_omap_dmtimer *(*request_specific)(int timer_id);
59 pwm_omap_dmtimer *(*request)(void);
60
48 int (*free)(pwm_omap_dmtimer *timer); 61 int (*free)(pwm_omap_dmtimer *timer);
49 62
50 void (*enable)(pwm_omap_dmtimer *timer); 63 void (*enable)(pwm_omap_dmtimer *timer);
51 void (*disable)(pwm_omap_dmtimer *timer); 64 void (*disable)(pwm_omap_dmtimer *timer);
52 65
66 int (*get_irq)(pwm_omap_dmtimer *timer);
67 int (*set_int_enable)(pwm_omap_dmtimer *timer, unsigned int value);
68 int (*set_int_disable)(pwm_omap_dmtimer *timer, u32 mask);
69
53 struct clk *(*get_fclk)(pwm_omap_dmtimer *timer); 70 struct clk *(*get_fclk)(pwm_omap_dmtimer *timer);
54 71
55 int (*start)(pwm_omap_dmtimer *timer); 72 int (*start)(pwm_omap_dmtimer *timer);
56 int (*stop)(pwm_omap_dmtimer *timer); 73 int (*stop)(pwm_omap_dmtimer *timer);
74 int (*set_source)(pwm_omap_dmtimer *timer, int source);
57 75
58 int (*set_load)(pwm_omap_dmtimer *timer, int autoreload, 76 int (*set_load)(pwm_omap_dmtimer *timer, int autoreload,
59 unsigned int value); 77 unsigned int value);
@@ -63,7 +81,10 @@ struct pwm_omap_dmtimer_pdata {
63 int toggle, int trigger); 81 int toggle, int trigger);
64 int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler); 82 int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler);
65 83
84 unsigned int (*read_counter)(pwm_omap_dmtimer *timer);
66 int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value); 85 int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value);
86 unsigned int (*read_status)(pwm_omap_dmtimer *timer);
87 int (*write_status)(pwm_omap_dmtimer *timer, unsigned int value);
67}; 88};
68 89
69#endif /* __PWM_OMAP_DMTIMER_PDATA_H */ 90#endif /* __PWM_OMAP_DMTIMER_PDATA_H */