aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2019-03-21 14:00:21 -0400
committerTony Lindgren <tony@atomide.com>2019-03-26 14:26:26 -0400
commit8b30919a4e3c7aba32dd72e8208147a6496cb16c (patch)
tree83ed5f84355452710524b9f6d81f1fb058d0876e
parent70451127873fee41b966328e1617ccc04f6998e7 (diff)
ARM: OMAP2+: Handle reset quirks for dynamically allocated modules
For dynamically allocated struct omap_hwmod data, we need to populate the device IP specific reset quirks. Cc: Paul Walmsley <paul@pwsan.com> Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/common.h9
-rw-r--r--arch/arm/mach-omap2/mmc.h8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c70
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c2
4 files changed, 88 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 129455e822e4..6316da3623b3 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -336,6 +336,15 @@ static inline void omap5_secondary_hyp_startup(void)
336} 336}
337#endif 337#endif
338 338
339#ifdef CONFIG_SOC_DRA7XX
340extern int dra7xx_pciess_reset(struct omap_hwmod *oh);
341#else
342static inline int dra7xx_pciess_reset(struct omap_hwmod *oh)
343{
344 return 0;
345}
346#endif
347
339void pdata_quirks_init(const struct of_device_id *); 348void pdata_quirks_init(const struct of_device_id *);
340void omap_auxdata_legacy_init(struct device *dev); 349void omap_auxdata_legacy_init(struct device *dev);
341void omap_pcs_legacy_init(int irq, void (*rearm)(void)); 350void omap_pcs_legacy_init(int irq, void (*rearm)(void));
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
index 9145a6f720fc..7f4e053c3434 100644
--- a/arch/arm/mach-omap2/mmc.h
+++ b/arch/arm/mach-omap2/mmc.h
@@ -7,7 +7,15 @@
7#define OMAP4_MMC_REG_OFFSET 0x100 7#define OMAP4_MMC_REG_OFFSET 0x100
8 8
9struct omap_hwmod; 9struct omap_hwmod;
10
11#ifdef CONFIG_SOC_OMAP2420
10int omap_msdi_reset(struct omap_hwmod *oh); 12int omap_msdi_reset(struct omap_hwmod *oh);
13#else
14static inline int omap_msdi_reset(struct omap_hwmod *oh)
15{
16 return 0;
17}
18#endif
11 19
12/* called from board-specific card detection service routine */ 20/* called from board-specific card detection service routine */
13extern void omap_mmc_notify_cover_event(struct device *dev, int slot, 21extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index ed3d503167f4..9170fbfb7c59 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -155,6 +155,8 @@
155#include "soc.h" 155#include "soc.h"
156#include "common.h" 156#include "common.h"
157#include "clockdomain.h" 157#include "clockdomain.h"
158#include "hdq1w.h"
159#include "mmc.h"
158#include "powerdomain.h" 160#include "powerdomain.h"
159#include "cm2xxx.h" 161#include "cm2xxx.h"
160#include "cm3xxx.h" 162#include "cm3xxx.h"
@@ -165,6 +167,7 @@
165#include "prm33xx.h" 167#include "prm33xx.h"
166#include "prminst44xx.h" 168#include "prminst44xx.h"
167#include "pm.h" 169#include "pm.h"
170#include "wd_timer.h"
168 171
169/* Name of the OMAP hwmod for the MPU */ 172/* Name of the OMAP hwmod for the MPU */
170#define MPU_INITIATOR_NAME "mpu" 173#define MPU_INITIATOR_NAME "mpu"
@@ -205,6 +208,20 @@ struct clkctrl_provider {
205static LIST_HEAD(clkctrl_providers); 208static LIST_HEAD(clkctrl_providers);
206 209
207/** 210/**
211 * struct omap_hwmod_reset - IP specific reset functions
212 * @match: string to match against the module name
213 * @len: number of characters to match
214 * @reset: IP specific reset function
215 *
216 * Used only in cases where struct omap_hwmod is dynamically allocated.
217 */
218struct omap_hwmod_reset {
219 const char *match;
220 int len;
221 int (*reset)(struct omap_hwmod *oh);
222};
223
224/**
208 * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations 225 * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
209 * @enable_module: function to enable a module (via MODULEMODE) 226 * @enable_module: function to enable a module (via MODULEMODE)
210 * @disable_module: function to disable a module (via MODULEMODE) 227 * @disable_module: function to disable a module (via MODULEMODE)
@@ -3542,6 +3559,57 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
3542 return 0; 3559 return 0;
3543} 3560}
3544 3561
3562static const struct omap_hwmod_reset omap24xx_reset_quirks[] = {
3563 { .match = "msdi", .len = 4, .reset = omap_msdi_reset, },
3564};
3565
3566static const struct omap_hwmod_reset dra7_reset_quirks[] = {
3567 { .match = "pcie", .len = 4, .reset = dra7xx_pciess_reset, },
3568};
3569
3570static const struct omap_hwmod_reset omap_reset_quirks[] = {
3571 { .match = "dss", .len = 3, .reset = omap_dss_reset, },
3572 { .match = "hdq1w", .len = 5, .reset = omap_hdq1w_reset, },
3573 { .match = "i2c", .len = 3, .reset = omap_i2c_reset, },
3574 { .match = "wd_timer", .len = 8, .reset = omap2_wd_timer_reset, },
3575};
3576
3577static void
3578omap_hwmod_init_reset_quirk(struct device *dev, struct omap_hwmod *oh,
3579 const struct ti_sysc_module_data *data,
3580 const struct omap_hwmod_reset *quirks,
3581 int quirks_sz)
3582{
3583 const struct omap_hwmod_reset *quirk;
3584 int i;
3585
3586 for (i = 0; i < quirks_sz; i++) {
3587 quirk = &quirks[i];
3588 if (!strncmp(data->name, quirk->match, quirk->len)) {
3589 oh->class->reset = quirk->reset;
3590
3591 return;
3592 }
3593 }
3594}
3595
3596static void
3597omap_hwmod_init_reset_quirks(struct device *dev, struct omap_hwmod *oh,
3598 const struct ti_sysc_module_data *data)
3599{
3600 if (soc_is_omap24xx())
3601 omap_hwmod_init_reset_quirk(dev, oh, data,
3602 omap24xx_reset_quirks,
3603 ARRAY_SIZE(omap24xx_reset_quirks));
3604
3605 if (soc_is_dra7xx())
3606 omap_hwmod_init_reset_quirk(dev, oh, data, dra7_reset_quirks,
3607 ARRAY_SIZE(dra7_reset_quirks));
3608
3609 omap_hwmod_init_reset_quirk(dev, oh, data, omap_reset_quirks,
3610 ARRAY_SIZE(omap_reset_quirks));
3611}
3612
3545/** 3613/**
3546 * omap_hwmod_init_module - initialize new module 3614 * omap_hwmod_init_module - initialize new module
3547 * @dev: struct device 3615 * @dev: struct device
@@ -3580,6 +3648,8 @@ int omap_hwmod_init_module(struct device *dev,
3580 return -ENOMEM; 3648 return -ENOMEM;
3581 } 3649 }
3582 3650
3651 omap_hwmod_init_reset_quirks(dev, oh, data);
3652
3583 oh->class->name = data->name; 3653 oh->class->name = data->name;
3584 mutex_lock(&list_lock); 3654 mutex_lock(&list_lock);
3585 error = _register(oh); 3655 error = _register(oh);
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 87d1de79b032..7a800f428238 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1828,7 +1828,7 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
1828 * We use a PCIeSS HWMOD class specific reset handler to deassert the hardreset 1828 * We use a PCIeSS HWMOD class specific reset handler to deassert the hardreset
1829 * lines after asserting them. 1829 * lines after asserting them.
1830 */ 1830 */
1831static int dra7xx_pciess_reset(struct omap_hwmod *oh) 1831int dra7xx_pciess_reset(struct omap_hwmod *oh)
1832{ 1832{
1833 int i; 1833 int i;
1834 1834