mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[ARM] ohci-pxa27x: introduce flags to avoid direct access to OHCI registers
Direct access to USB host controller registers is considered to be not portable, and is usually a bad sign for poorly abstracted interface. Introduce .flags and .power_on_delay to "struct pxaohci_platform_data" so that most platforms don't bother to write their own .init/.exit() sequences. Signed-off-by: Eric Miao <[email protected]> Signed-off-by: Russell King <[email protected]>
This commit is contained in:
parent
52358ba3a8
commit
097b53348f
12 changed files with 70 additions and 104 deletions
|
|
@ -76,6 +76,41 @@ extern int usb_disabled(void);
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
static inline void pxa27x_setup_hc(struct pxaohci_platform_data *inf)
|
||||
{
|
||||
uint32_t uhchr = UHCHR;
|
||||
uint32_t uhcrhda = UHCRHDA;
|
||||
|
||||
if (inf->flags & ENABLE_PORT1)
|
||||
uhchr &= ~UHCHR_SSEP1;
|
||||
|
||||
if (inf->flags & ENABLE_PORT2)
|
||||
uhchr &= ~UHCHR_SSEP2;
|
||||
|
||||
if (inf->flags & ENABLE_PORT3)
|
||||
uhchr &= ~UHCHR_SSEP3;
|
||||
|
||||
if (inf->flags & POWER_CONTROL_LOW)
|
||||
uhchr |= UHCHR_PCPL;
|
||||
|
||||
if (inf->flags & POWER_SENSE_LOW)
|
||||
uhchr |= UHCHR_PSPL;
|
||||
|
||||
if (inf->flags & NO_OC_PROTECTION)
|
||||
uhcrhda |= UHCRHDA_NOCP;
|
||||
|
||||
if (inf->flags & OC_MODE_PERPORT)
|
||||
uhcrhda |= UHCRHDA_OCPM;
|
||||
|
||||
if (inf->power_on_delay) {
|
||||
uhcrhda &= ~UHCRHDA_POTPGT(0xff);
|
||||
uhcrhda |= UHCRHDA_POTPGT(inf->power_on_delay / 2);
|
||||
}
|
||||
|
||||
UHCHR = uhchr;
|
||||
UHCRHDA = uhcrhda;
|
||||
}
|
||||
|
||||
static int pxa27x_start_hc(struct device *dev)
|
||||
{
|
||||
int retval = 0;
|
||||
|
|
@ -93,6 +128,8 @@ static int pxa27x_start_hc(struct device *dev)
|
|||
while (UHCHR & UHCHR_FSBIR)
|
||||
cpu_relax();
|
||||
|
||||
pxa27x_setup_hc(inf);
|
||||
|
||||
if (inf->init)
|
||||
retval = inf->init(dev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue