From 45ad86dec8a330bc61b4f60e80654ec2d7282064 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Mon, 1 Sep 2014 03:26:38 +0300 Subject: [PATCH 1/1] ARM: OMAP3: hwmod data and setup code for band gap thermal driver --- arch/arm/mach-omap2/devices.c | 24 +++++++++++++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 40 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index c15cfada5f13..982eba8f3afa 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -673,6 +673,29 @@ static inline void omap_init_vout(void) {} /*-------------------------------------------------------------------------*/ +#if defined(CONFIG_ARCH_OMAP3) && \ + (defined(CONFIG_OMAP3_THERMAL) || defined(CONFIG_OMAP3_THERMAL_MODULE)) +static void omap_init_temp_sensor(void) +{ + struct omap_hwmod *oh; + struct platform_device *pdev; + + oh = omap_hwmod_lookup("bandgap_ts"); + if (!oh) { + pr_err("%s: unable to find hwmod\n", __func__); + return; + } + + pdev = omap_device_build("omap3-thermal", -1, oh, NULL, 0, NULL, 0, 0); + WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", + __func__, PTR_ERR(pdev)); +} +#else +static inline void omap_init_temp_sensor(void) {} +#endif + +/*-------------------------------------------------------------------------*/ + static int __init omap2_init_devices(void) { /* @@ -690,6 +713,7 @@ static int __init omap2_init_devices(void) omap_init_sham(); omap_init_aes(); omap_init_vout(); + omap_init_temp_sensor(); return 0; } diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index b3e2cd3c9cf7..2db400dad139 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -2967,6 +2967,44 @@ static struct omap_hwmod omap34xx_mcspi4 = { .dev_attr = &omap_mcspi4_dev_attr, }; +/* temp. sensor */ +struct omap_hwmod_class omap34xx_bandgap_ts_class = { + .name = "bandgap_ts", +}; + +static struct omap_hwmod_addr_space omap3xxx_bandgap_ts_addrs[] = { + { + .name = "mpu", + .pa_start = 0x48002524, + .pa_end = 0x48002524 + 4, + .flags = ADDR_TYPE_RT + }, + { } +}; + +static struct omap_hwmod omap34xx_bandgap_ts; + +/* l4_core -> bandgap */ +static struct omap_hwmod_ocp_if omap3xxx_l4_core__bandgap_ts = { + .master = &omap3xxx_l4_core_hwmod, + .slave = &omap34xx_bandgap_ts, + .addr = omap3xxx_bandgap_ts_addrs, + .user = OCP_USER_MPU, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_bandgap_ts_slaves[] = { + &omap3xxx_l4_core__bandgap_ts, +}; + +static struct omap_hwmod omap34xx_bandgap_ts = { + .name = "bandgap_ts", + .main_clk = "ts_fck", + .slaves = omap3xxx_bandgap_ts_slaves, + .slaves_cnt = ARRAY_SIZE(omap3xxx_bandgap_ts_slaves), + .class = &omap34xx_bandgap_ts_class, + .flags = HWMOD_NO_IDLEST, +}; + /* * usbhsotg */ @@ -3315,6 +3353,8 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { &omap34xx_mcspi3, &omap34xx_mcspi4, + &omap34xx_bandgap_ts, + NULL, }; -- 2.39.2