Skip to content

Commit 8b30919

Browse files
committed
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 <[email protected]> Cc: Tero Kristo <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent 7045112 commit 8b30919

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

arch/arm/mach-omap2/common.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,15 @@ static inline void omap5_secondary_hyp_startup(void)
336336
}
337337
#endif
338338

339+
#ifdef CONFIG_SOC_DRA7XX
340+
extern int dra7xx_pciess_reset(struct omap_hwmod *oh);
341+
#else
342+
static inline int dra7xx_pciess_reset(struct omap_hwmod *oh)
343+
{
344+
return 0;
345+
}
346+
#endif
347+
339348
void pdata_quirks_init(const struct of_device_id *);
340349
void omap_auxdata_legacy_init(struct device *dev);
341350
void omap_pcs_legacy_init(int irq, void (*rearm)(void));

arch/arm/mach-omap2/mmc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
#define OMAP4_MMC_REG_OFFSET 0x100
88

99
struct omap_hwmod;
10+
11+
#ifdef CONFIG_SOC_OMAP2420
1012
int omap_msdi_reset(struct omap_hwmod *oh);
13+
#else
14+
static inline int omap_msdi_reset(struct omap_hwmod *oh)
15+
{
16+
return 0;
17+
}
18+
#endif
1119

1220
/* called from board-specific card detection service routine */
1321
extern void omap_mmc_notify_cover_event(struct device *dev, int slot,

arch/arm/mach-omap2/omap_hwmod.c

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@
155155
#include "soc.h"
156156
#include "common.h"
157157
#include "clockdomain.h"
158+
#include "hdq1w.h"
159+
#include "mmc.h"
158160
#include "powerdomain.h"
159161
#include "cm2xxx.h"
160162
#include "cm3xxx.h"
@@ -165,6 +167,7 @@
165167
#include "prm33xx.h"
166168
#include "prminst44xx.h"
167169
#include "pm.h"
170+
#include "wd_timer.h"
168171

169172
/* Name of the OMAP hwmod for the MPU */
170173
#define MPU_INITIATOR_NAME "mpu"
@@ -204,6 +207,20 @@ struct clkctrl_provider {
204207

205208
static LIST_HEAD(clkctrl_providers);
206209

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+
207224
/**
208225
* struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations
209226
* @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,
35423559
return 0;
35433560
}
35443561

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+
35453613
/**
35463614
* omap_hwmod_init_module - initialize new module
35473615
* @dev: struct device
@@ -3580,6 +3648,8 @@ int omap_hwmod_init_module(struct device *dev,
35803648
return -ENOMEM;
35813649
}
35823650

3651+
omap_hwmod_init_reset_quirks(dev, oh, data);
3652+
35833653
oh->class->name = data->name;
35843654
mutex_lock(&list_lock);
35853655
error = _register(oh);

arch/arm/mach-omap2/omap_hwmod_7xx_data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
18281828
* We use a PCIeSS HWMOD class specific reset handler to deassert the hardreset
18291829
* lines after asserting them.
18301830
*/
1831-
static int dra7xx_pciess_reset(struct omap_hwmod *oh)
1831+
int dra7xx_pciess_reset(struct omap_hwmod *oh)
18321832
{
18331833
int i;
18341834

0 commit comments

Comments
 (0)