Re: Interface change: Now or later?

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Wed Aug 02 2000 - 09:23:39 EST


Werner Almesberger wrote:
> Mitchell Blank Jr wrote:
> > There are at least two workable ways to work around this limitation in your
> > driver:
>
> A third possibility: widen the phy_put/get interface (i.e. go from
> unsigned char to u32) and treat exotic cases like registers with
> variable width by assigning them different ("virtual") addresses.

All things considered this isn't a bad idea.

28 address bits, 2 bits "don't care"/8/16/32, two bits "future expansion".

Correctly implemented phy-writers would then do:

        switch (addr >> 28) {
        case 0: if (val < 0x100) write_phy_8 (addr & 0x0fffffff, val);
           else if (val < 0x10000) write_phy_16 (addr & 0x0fffffff, val);
           else write_phy_32 (addr & 0x0fffffff, val);
           break;
        case 1: write_phy_8 (addr & 0x0fffffff, val);break;
        case 2: write_phy_16 (addr & 0x0fffffff, val);break;
        case 3: write_phy_32 (addr & 0x0fffffff, val);break;
        default: return -EIO; /* Don't know about fancy stuff */
        }

(My SAR has 32 bits for the value, and 32 bits for the address (from a
software point-of-view), but only 8-18 bits in the hardware. I wouldn't
know how to write an 8-bit value, so I'd just

        write_phy (addr & 0x0fffffff, val);
)

but current "expect only 8 bits" practise would work just fine for all
the other drivers. We'd just change the prototype a bit.

Mitch, Linus, can you live with this?

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Aug 07 2000 - 21:00:08 EST