Re: [RESEND][PATCH] ARM: PL011: add support for extended FIFO-size of PL011-r1p5

From: Linus Walleij
Date: Sat Apr 20 2013 - 09:32:00 EST


On Mon, Apr 15, 2013 at 7:45 AM, Jongsung Kim <neidhard.kim@xxxxxxx> wrote:

At the risk to re-stating what Russell has already said...

> +
> + unsigned int (*get_fifosize)(unsigned int periphid);
> };
>
> +static unsigned int get_fifosize_arm(unsigned int periphid)
> +{
> + unsigned int rev = (periphid >> 20) & 0xf;
> + return rev < 3 ? 16 : 32;
> +}

This is a very complicated way to to something very simple.

Keep the .fifosize as part of struct vendor_data, define a
new vendor data cunk for your variant, use .id and .mask
to select your variant.

static struct vendor_data vendor_arm_deepfifo = {
.fifosize = 32,
(... the rest is the same)
}

(...)

static struct amba_id pl011_ids[] = {
{
.id = 0x00341011,
.mask = 0x00ffffff,
.data = &vendor_arm_deepfifo,
},
(...)
};

As you can see in amba_lookup() in
drivers/amba/bus.c the table is traversed from the top,
so for the new "3" variant this entry will match, while the
next entry will match all older versions.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/