• David Brownell's avatar
    [PATCH] USB: ohci, hooks for big-endian registers · ed3361ff
    David Brownell authored
    This is the second of the patches from Dale Farnsworth to
    support OHCI implementations that use big-endian byte sex
    for registers ... all register accesses changed, that's why
    it's so large.  (It also includes part of an update from
    his third patch, so that it compiles/runs by itself.)
    
    This patch adds support to the OHCI code for big-endian controllers,
    maintaining the existing little-endian support.  This is done using
    the following transforms:
    
            ohci_readl(p)   --> ohci_readl(ohci, p)
    	writel(v, p)    --> ohci_writel(ohci, v, p)
    
    	cpu_to_le16(v)  --> cpu_to_hc16(ohci, v)
    	cpu_to_le16p(v) --> cpu_to_hc16p(ohci, v)
    	cpu_to_le32(v)  --> cpu_to_hc32(ohci, v)
    	cpu_to_le32p(v) --> cpu_to_hc32p(ohci, v)
    
    	le16_to_cpu(v) --> hc16_to_cpu(ohci, v)
    	le16_to_cpup(v) --> hc16_to_cpup(ohci, v)
    	le32_to_cpu(v) --> hc32_to_cpu(ohci, v)
    	le32_to_cpup(v) --> hc32_to_cpup(ohci, v)
    
    	OHCI_FRAME_NO(ohci->hcca) --> ohci_frame_no(ohci)
    
    There's no runtime penalty except for systems configured to handle
    both byteorders at the same time.
    Signed-off-by: default avatarDale Farnsworth <dale@farnsworth.org>
    Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    ed3361ff
ohci-q.c 30.8 KB