diff options
author | Tony Lindgren <tony@atomide.com> | 2019-03-21 14:00:21 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2019-03-26 14:26:26 -0400 |
commit | 8b30919a4e3c7aba32dd72e8208147a6496cb16c (patch) | |
tree | 83ed5f84355452710524b9f6d81f1fb058d0876e /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 70451127873fee41b966328e1617ccc04f6998e7 (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>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 70 |
1 files changed, 70 insertions, 0 deletions
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 { | |||
205 | static LIST_HEAD(clkctrl_providers); | 208 | static 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 | */ | ||
218 | struct 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 | ||
3562 | static const struct omap_hwmod_reset omap24xx_reset_quirks[] = { | ||
3563 | { .match = "msdi", .len = 4, .reset = omap_msdi_reset, }, | ||
3564 | }; | ||
3565 | |||
3566 | static const struct omap_hwmod_reset dra7_reset_quirks[] = { | ||
3567 | { .match = "pcie", .len = 4, .reset = dra7xx_pciess_reset, }, | ||
3568 | }; | ||
3569 | |||
3570 | static 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 | |||
3577 | static void | ||
3578 | omap_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 | |||
3596 | static void | ||
3597 | omap_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); |