Cyril Chemparathy <[email protected]> writes:
> This patch modifies the pinmux implementation so as to ioremap() the pinmux
> register area on first use.
>
> Signed-off-by: Cyril Chemparathy <[email protected]>
> ---
> v2: bug --> warn
>
[...]
> @@ -29,14 +31,17 @@ int __init_or_module davinci_cfg_reg(const unsigned long
> index)
> {
> static DEFINE_SPINLOCK(mux_spin_lock);
> struct davinci_soc_info *soc_info = &davinci_soc_info;
> - void __iomem *base = soc_info->pinmux_base;
> unsigned long flags;
> const struct mux_config *cfg;
> unsigned int reg_orig = 0, reg = 0;
> unsigned int mask, warn = 0;
>
> - if (!soc_info->pinmux_pins)
> - BUG();
> + WARN_ON(!soc_info->pinmux_pins);
> +
> + if (!pinmux_base) {
> + pinmux_base = ioremap(soc_info->pinmux_base, SZ_4K);
> + WARN_ON(!pinmux_base);
probably should fail gracefully here, otherwise...
> + }
>
> if (index >= soc_info->pinmux_pins_num) {
> printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n",
> @@ -57,7 +62,7 @@ int __init_or_module davinci_cfg_reg(const unsigned long
> index)
> unsigned tmp1, tmp2;
>
> spin_lock_irqsave(&mux_spin_lock, flags);
> - reg_orig = __raw_readl(base + cfg->mux_reg);
> + reg_orig = __raw_readl(pinmux_base + cfg->mux_reg);
accesses like this will fault.
Kevin
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source