Skip to content

Commit

Permalink
Merge tag 'omap-for-v4.7/legacy-signed' of git://git.kernel.org/pub/s…
Browse files Browse the repository at this point in the history
…cm/linux/kernel/git/tmlind/linux-omap into next/fixes-non-critical

Merge "omap legacy boot vs dt boot fixes for v4.7 merge window"
from Tony Lindgren:

Legacy booting vs device tree booting fixes for omaps for
v4.7 merge window. These are not considered urgent fixes enough
for the v4.6-rc cycle, but we need them in v4.7 in order to drop
the last remaining board-*.c files for omap3 for v4.8 merge window.

On Nokia N900, we need to pass the MMC slot names for the legacy
user space to work. Let's do that using auxdata as the driver is
setting up things already with the pdata for legacy booting. Then
we can later on discuss if we may want to have some generic binding
describing where the MMC slots are on the device.

N900 also has had the ir-rx51 device driver unusable with multiarch
for a long time. Let's pass the dmtimer data in pdata for the driver
to get it going again. Then once things are working, we can eventually
change the driver to use just hrtimer and PWM framework. The driver
changes will be queued separately.

* tag 'omap-for-v4.7/legacy-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: n900 needs MMC slot names for legacy user space
  ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51
  • Loading branch information
Arnd Bergmann committed May 9, 2016
2 parents ea46a1f + 10c1f7d commit 11c3aea
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 3 deletions.
35 changes: 33 additions & 2 deletions arch/arm/mach-omap2/board-rx51-peripherals.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <linux/platform_data/spi-omap2-mcspi.h>
#include <linux/platform_data/mtd-onenand-omap2.h>

#include <plat/dmtimer.h>

#include <asm/system_info.h>

#include "common.h"
Expand All @@ -47,9 +49,8 @@

#include <video/omap-panel-data.h>

#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
#include <linux/platform_data/pwm_omap_dmtimer.h>
#include <linux/platform_data/media/ir-rx51.h>
#endif

#include "mux.h"
#include "omap-pm.h"
Expand Down Expand Up @@ -1212,10 +1213,40 @@ static void __init rx51_init_tsc2005(void)
gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
}

#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
static struct pwm_omap_dmtimer_pdata __maybe_unused pwm_dmtimer_pdata = {
.request_by_node = omap_dm_timer_request_by_node,
.request_specific = omap_dm_timer_request_specific,
.request = omap_dm_timer_request,
.set_source = omap_dm_timer_set_source,
.get_irq = omap_dm_timer_get_irq,
.set_int_enable = omap_dm_timer_set_int_enable,
.set_int_disable = omap_dm_timer_set_int_disable,
.free = omap_dm_timer_free,
.enable = omap_dm_timer_enable,
.disable = omap_dm_timer_disable,
.get_fclk = omap_dm_timer_get_fclk,
.start = omap_dm_timer_start,
.stop = omap_dm_timer_stop,
.set_load = omap_dm_timer_set_load,
.set_match = omap_dm_timer_set_match,
.set_pwm = omap_dm_timer_set_pwm,
.set_prescaler = omap_dm_timer_set_prescaler,
.read_counter = omap_dm_timer_read_counter,
.write_counter = omap_dm_timer_write_counter,
.read_status = omap_dm_timer_read_status,
.write_status = omap_dm_timer_write_status,
};
#endif

#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
static struct lirc_rx51_platform_data rx51_lirc_data = {
.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
.pwm_timer = 9, /* Use GPT 9 for CIR */
#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
.dmtimer = &pwm_dmtimer_pdata,
#endif

};

static struct platform_device rx51_lirc_device = {
Expand Down
40 changes: 39 additions & 1 deletion arch/arm/mach-omap2/pdata-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,25 @@
#include <linux/regulator/fixed.h>

#include <linux/platform_data/pinctrl-single.h>
#include <linux/platform_data/hsmmc-omap.h>
#include <linux/platform_data/iommu-omap.h>
#include <linux/platform_data/wkup_m3.h>
#include <linux/platform_data/pwm_omap_dmtimer.h>
#include <linux/platform_data/media/ir-rx51.h>
#include <plat/dmtimer.h>

#include "common.h"
#include "common-board-devices.h"
#include "dss-common.h"
#include "control.h"
#include "omap_device.h"
#include "omap-pm.h"
#include "omap-secure.h"
#include "soc.h"
#include "hsmmc.h"

static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];

struct pdata_init {
const char *compatible;
void (*fn)(void);
Expand Down Expand Up @@ -268,9 +273,13 @@ static struct platform_device omap3_rom_rng_device = {
},
};

static struct platform_device rx51_lirc_device;

static void __init nokia_n900_legacy_init(void)
{
hsmmc2_internal_input_clk();
mmc_pdata[0].name = "external";
mmc_pdata[1].name = "internal";

if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
Expand All @@ -286,6 +295,8 @@ static void __init nokia_n900_legacy_init(void)
platform_device_register(&omap3_rom_rng_device);

}

platform_device_register(&rx51_lirc_device);
}

static void __init omap3_tao3530_legacy_init(void)
Expand Down Expand Up @@ -453,8 +464,14 @@ void omap_auxdata_legacy_init(struct device *dev)

/* Dual mode timer PWM callbacks platdata */
#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
.request_by_node = omap_dm_timer_request_by_node,
.request_specific = omap_dm_timer_request_specific,
.request = omap_dm_timer_request,
.set_source = omap_dm_timer_set_source,
.get_irq = omap_dm_timer_get_irq,
.set_int_enable = omap_dm_timer_set_int_enable,
.set_int_disable = omap_dm_timer_set_int_disable,
.free = omap_dm_timer_free,
.enable = omap_dm_timer_enable,
.disable = omap_dm_timer_disable,
Expand All @@ -465,10 +482,29 @@ struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
.set_match = omap_dm_timer_set_match,
.set_pwm = omap_dm_timer_set_pwm,
.set_prescaler = omap_dm_timer_set_prescaler,
.read_counter = omap_dm_timer_read_counter,
.write_counter = omap_dm_timer_write_counter,
.read_status = omap_dm_timer_read_status,
.write_status = omap_dm_timer_write_status,
};
#endif

static struct lirc_rx51_platform_data __maybe_unused rx51_lirc_data = {
.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
.pwm_timer = 9, /* Use GPT 9 for CIR */
#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
.dmtimer = &pwm_dmtimer_pdata,
#endif
};

static struct platform_device __maybe_unused rx51_lirc_device = {
.name = "lirc_rx51",
.id = -1,
.dev = {
.platform_data = &rx51_lirc_data,
},
};

/*
* Few boards still need auxdata populated before we populate
* the dev entries in of_platform_populate().
Expand Down Expand Up @@ -497,6 +533,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
&omap3_iommu_pdata),
OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
/* Only on am3517 */
OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
Expand Down
1 change: 1 addition & 0 deletions include/linux/platform_data/media/ir-rx51.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct lirc_rx51_platform_data {
int pwm_timer;

int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
struct pwm_omap_dmtimer_pdata *dmtimer;
};

#endif
21 changes: 21 additions & 0 deletions include/linux/platform_data/pwm_omap_dmtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
#ifndef __PWM_OMAP_DMTIMER_PDATA_H
#define __PWM_OMAP_DMTIMER_PDATA_H

/* clock sources */
#define PWM_OMAP_DMTIMER_SRC_SYS_CLK 0x00
#define PWM_OMAP_DMTIMER_SRC_32_KHZ 0x01
#define PWM_OMAP_DMTIMER_SRC_EXT_CLK 0x02

/* timer interrupt enable bits */
#define PWM_OMAP_DMTIMER_INT_CAPTURE (1 << 2)
#define PWM_OMAP_DMTIMER_INT_OVERFLOW (1 << 1)
#define PWM_OMAP_DMTIMER_INT_MATCH (1 << 0)

/* trigger types */
#define PWM_OMAP_DMTIMER_TRIGGER_NONE 0x00
#define PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW 0x01
Expand All @@ -45,15 +55,23 @@ typedef struct omap_dm_timer pwm_omap_dmtimer;

struct pwm_omap_dmtimer_pdata {
pwm_omap_dmtimer *(*request_by_node)(struct device_node *np);
pwm_omap_dmtimer *(*request_specific)(int timer_id);
pwm_omap_dmtimer *(*request)(void);

int (*free)(pwm_omap_dmtimer *timer);

void (*enable)(pwm_omap_dmtimer *timer);
void (*disable)(pwm_omap_dmtimer *timer);

int (*get_irq)(pwm_omap_dmtimer *timer);
int (*set_int_enable)(pwm_omap_dmtimer *timer, unsigned int value);
int (*set_int_disable)(pwm_omap_dmtimer *timer, u32 mask);

struct clk *(*get_fclk)(pwm_omap_dmtimer *timer);

int (*start)(pwm_omap_dmtimer *timer);
int (*stop)(pwm_omap_dmtimer *timer);
int (*set_source)(pwm_omap_dmtimer *timer, int source);

int (*set_load)(pwm_omap_dmtimer *timer, int autoreload,
unsigned int value);
Expand All @@ -63,7 +81,10 @@ struct pwm_omap_dmtimer_pdata {
int toggle, int trigger);
int (*set_prescaler)(pwm_omap_dmtimer *timer, int prescaler);

unsigned int (*read_counter)(pwm_omap_dmtimer *timer);
int (*write_counter)(pwm_omap_dmtimer *timer, unsigned int value);
unsigned int (*read_status)(pwm_omap_dmtimer *timer);
int (*write_status)(pwm_omap_dmtimer *timer, unsigned int value);
};

#endif /* __PWM_OMAP_DMTIMER_PDATA_H */

0 comments on commit 11c3aea

Please sign in to comment.