aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2018-02-23 11:59:23 -0500
committerTony Lindgren <tony@atomide.com>2018-02-28 19:32:09 -0500
commita88443068572aaa79048bc19c741e0edae17faa7 (patch)
tree4199d51f28aa9cfdc9d8854b4d0b7cd88cf5247b /arch/arm/mach-omap2/omap_hwmod.c
parent8c87970543b17adfbd829ec1541c72a7da518acf (diff)
ARM: OMAP2+: Add checks for device tree based sysconfig data
We can check the device tree based sysconfig data against the existing platform data to make sure we're not introducing regressions. Then at some point after the sysconfig data comes from device tree, we can just drop the related platform data. Cc: Paul Walmsley <paul@pwsan.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.c109
1 files changed, 106 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 20895fcadbf5..fca22f7ac0e3 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3062,6 +3062,53 @@ int __init omap_hwmod_setup_one(const char *oh_name)
3062 return 0; 3062 return 0;
3063} 3063}
3064 3064
3065static void omap_hwmod_check_one(struct device *dev,
3066 const char *name, s8 v1, u8 v2)
3067{
3068 if (v1 < 0)
3069 return;
3070
3071 if (v1 != v2)
3072 dev_warn(dev, "%s %d != %d\n", name, v1, v2);
3073}
3074
3075/**
3076 * omap_hwmod_check_sysc - check sysc against platform sysc
3077 * @dev: struct device
3078 * @data: module data
3079 * @sysc_fields: new sysc configuration
3080 */
3081static int omap_hwmod_check_sysc(struct device *dev,
3082 const struct ti_sysc_module_data *data,
3083 struct sysc_regbits *sysc_fields)
3084{
3085 const struct sysc_regbits *regbits = data->cap->regbits;
3086
3087 omap_hwmod_check_one(dev, "dmadisable_shift",
3088 regbits->dmadisable_shift,
3089 sysc_fields->dmadisable_shift);
3090 omap_hwmod_check_one(dev, "midle_shift",
3091 regbits->midle_shift,
3092 sysc_fields->midle_shift);
3093 omap_hwmod_check_one(dev, "sidle_shift",
3094 regbits->sidle_shift,
3095 sysc_fields->sidle_shift);
3096 omap_hwmod_check_one(dev, "clkact_shift",
3097 regbits->clkact_shift,
3098 sysc_fields->clkact_shift);
3099 omap_hwmod_check_one(dev, "enwkup_shift",
3100 regbits->enwkup_shift,
3101 sysc_fields->enwkup_shift);
3102 omap_hwmod_check_one(dev, "srst_shift",
3103 regbits->srst_shift,
3104 sysc_fields->srst_shift);
3105 omap_hwmod_check_one(dev, "autoidle_shift",
3106 regbits->autoidle_shift,
3107 sysc_fields->autoidle_shift);
3108
3109 return 0;
3110}
3111
3065/** 3112/**
3066 * omap_hwmod_init_regbits - init sysconfig specific register bits 3113 * omap_hwmod_init_regbits - init sysconfig specific register bits
3067 * @dev: struct device 3114 * @dev: struct device
@@ -3111,7 +3158,7 @@ static int omap_hwmod_init_regbits(struct device *dev,
3111 return -EINVAL; 3158 return -EINVAL;
3112 } 3159 }
3113 3160
3114 return 0; 3161 return omap_hwmod_check_sysc(dev, data, *sysc_fields);
3115} 3162}
3116 3163
3117/** 3164/**
@@ -3250,6 +3297,59 @@ int omap_hwmod_init_idlemodes(struct device *dev,
3250} 3297}
3251 3298
3252/** 3299/**
3300 * omap_hwmod_check_module - check new module against platform data
3301 * @dev: struct device
3302 * @oh: module
3303 * @data: new module data
3304 * @sysc_fields: sysc register bits
3305 * @rev_offs: revision register offset
3306 * @sysc_offs: sysconfig register offset
3307 * @syss_offs: sysstatus register offset
3308 * @sysc_flags: sysc specific flags
3309 * @idlemodes: sysc supported idlemodes
3310 */
3311static int omap_hwmod_check_module(struct device *dev,
3312 struct omap_hwmod *oh,
3313 const struct ti_sysc_module_data *data,
3314 struct sysc_regbits *sysc_fields,
3315 u32 rev_offs, u32 sysc_offs,
3316 u32 syss_offs, u32 sysc_flags,
3317 u32 idlemodes)
3318{
3319 if (!oh->class->sysc)
3320 return -ENODEV;
3321
3322 if (sysc_fields != oh->class->sysc->sysc_fields)
3323 dev_warn(dev, "sysc_fields %p != %p\n", sysc_fields,
3324 oh->class->sysc->sysc_fields);
3325
3326 if (rev_offs != oh->class->sysc->rev_offs)
3327 dev_warn(dev, "rev_offs %08x != %08x\n", rev_offs,
3328 oh->class->sysc->rev_offs);
3329 if (sysc_offs != oh->class->sysc->sysc_offs)
3330 dev_warn(dev, "sysc_offs %08x != %08x\n", sysc_offs,
3331 oh->class->sysc->sysc_offs);
3332 if (syss_offs != oh->class->sysc->syss_offs)
3333 dev_warn(dev, "syss_offs %08x != %08x\n", syss_offs,
3334 oh->class->sysc->syss_offs);
3335
3336 if (sysc_flags != oh->class->sysc->sysc_flags)
3337 dev_warn(dev, "sysc_flags %08x != %08x\n", sysc_flags,
3338 oh->class->sysc->sysc_flags);
3339
3340 if (idlemodes != oh->class->sysc->idlemodes)
3341 dev_warn(dev, "idlemodes %08x != %08x\n", idlemodes,
3342 oh->class->sysc->idlemodes);
3343
3344 if (data->cfg->srst_udelay != oh->class->sysc->srst_udelay)
3345 dev_warn(dev, "srst_udelay %i != %i\n",
3346 data->cfg->srst_udelay,
3347 oh->class->sysc->srst_udelay);
3348
3349 return 0;
3350}
3351
3352/**
3253 * omap_hwmod_allocate_module - allocate new module 3353 * omap_hwmod_allocate_module - allocate new module
3254 * @dev: struct device 3354 * @dev: struct device
3255 * @oh: module 3355 * @oh: module
@@ -3359,8 +3459,11 @@ int omap_hwmod_init_module(struct device *dev,
3359 if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT) 3459 if (data->cfg->quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
3360 oh->flags |= HWMOD_INIT_NO_RESET; 3460 oh->flags |= HWMOD_INIT_NO_RESET;
3361 3461
3362 if (oh->class->sysc) 3462 error = omap_hwmod_check_module(dev, oh, data, sysc_fields,
3363 return 0; 3463 rev_offs, sysc_offs, syss_offs,
3464 sysc_flags, idlemodes);
3465 if (!error)
3466 return error;
3364 3467
3365 return omap_hwmod_allocate_module(dev, oh, data, sysc_fields, 3468 return omap_hwmod_allocate_module(dev, oh, data, sysc_fields,
3366 rev_offs, sysc_offs, syss_offs, 3469 rev_offs, sysc_offs, syss_offs,