|
155 | 155 | #include "soc.h"
|
156 | 156 | #include "common.h"
|
157 | 157 | #include "clockdomain.h"
|
| 158 | +#include "hdq1w.h" |
| 159 | +#include "mmc.h" |
158 | 160 | #include "powerdomain.h"
|
159 | 161 | #include "cm2xxx.h"
|
160 | 162 | #include "cm3xxx.h"
|
|
165 | 167 | #include "prm33xx.h"
|
166 | 168 | #include "prminst44xx.h"
|
167 | 169 | #include "pm.h"
|
| 170 | +#include "wd_timer.h" |
168 | 171 |
|
169 | 172 | /* Name of the OMAP hwmod for the MPU */
|
170 | 173 | #define MPU_INITIATOR_NAME "mpu"
|
@@ -204,6 +207,20 @@ struct clkctrl_provider {
|
204 | 207 |
|
205 | 208 | static LIST_HEAD(clkctrl_providers);
|
206 | 209 |
|
| 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 | + |
207 | 224 | /**
|
208 | 225 | * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
|
209 | 226 | * @enable_module: function to enable a module (via MODULEMODE)
|
@@ -3542,6 +3559,57 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
|
3542 | 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 | 3614 | * omap_hwmod_init_module - initialize new module
|
3547 | 3615 | * @dev: struct device
|
@@ -3580,6 +3648,8 @@ int omap_hwmod_init_module(struct device *dev,
|
3580 | 3648 | return -ENOMEM;
|
3581 | 3649 | }
|
3582 | 3650 |
|
| 3651 | + omap_hwmod_init_reset_quirks(dev, oh, data); |
| 3652 | + |
3583 | 3653 | oh->class->name = data->name;
|
3584 | 3654 | mutex_lock(&list_lock);
|
3585 | 3655 | error = _register(oh);
|
|
0 commit comments