Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: OMAP: USB: Change omap USB code to use omap_read/write instead of __REG

Change omap USB code to use omap_read/write instead of __REG for multi-omap

Cc: David Brownell <david-b@pacbell.net>
Cc: linux-usb@vger.kernel.org
Cc: i2c@lm-sensors.org
Signed-off-by: Tony Lindgren <tony@atomide.com>


+499 -357
+4 -1
arch/arm/mach-omap1/board-osk.c
··· 546 546 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 547 547 omap_board_config = osk_config; 548 548 omap_board_config_size = ARRAY_SIZE(osk_config); 549 - USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 549 + 550 + l = omap_readl(USB_TRANSCEIVER_CTRL); 551 + l |= (3 << 1); 552 + omap_writel(l, USB_TRANSCEIVER_CTRL); 550 553 551 554 /* irq for tps65010 chip */ 552 555 /* bootloader effectively does: omap_cfg_reg(U19_1610_MPUIO1); */
+91 -40
arch/arm/plat-omap/usb.c
··· 1 - /* 1 + /* 2 2 * arch/arm/plat-omap/usb.c -- platform level USB initialization 3 3 * 4 4 * Copyright (C) 2004 Texas Instruments, Inc. ··· 156 156 157 157 if (nwires == 0) { 158 158 if (cpu_class_is_omap1() && !cpu_is_omap15xx()) { 159 + u32 l; 160 + 159 161 /* pulldown D+/D- */ 160 - USB_TRANSCEIVER_CTRL_REG &= ~(3 << 1); 162 + l = omap_readl(USB_TRANSCEIVER_CTRL); 163 + l &= ~(3 << 1); 164 + omap_writel(l, USB_TRANSCEIVER_CTRL); 161 165 } 162 166 return 0; 163 167 } ··· 175 171 176 172 /* internal transceiver (unavailable on 17xx, 24xx) */ 177 173 if (!cpu_class_is_omap2() && nwires == 2) { 174 + u32 l; 175 + 178 176 // omap_cfg_reg(P9_USB_DP); 179 177 // omap_cfg_reg(R8_USB_DM); 180 178 ··· 191 185 * - OTG support on this port not yet written 192 186 */ 193 187 194 - USB_TRANSCEIVER_CTRL_REG &= ~(7 << 4); 188 + l = omap_readl(USB_TRANSCEIVER_CTRL); 189 + l &= ~(7 << 4); 195 190 if (!is_device) 196 - USB_TRANSCEIVER_CTRL_REG |= (3 << 1); 191 + l |= (3 << 1); 192 + omap_writel(l, USB_TRANSCEIVER_CTRL); 197 193 198 194 return 3 << 16; 199 195 } ··· 225 217 * with VBUS switching and overcurrent detection. 226 218 */ 227 219 228 - if (cpu_class_is_omap1() && nwires != 6) 229 - USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 220 + if (cpu_class_is_omap1() && nwires != 6) { 221 + u32 l; 222 + 223 + l = omap_readl(USB_TRANSCEIVER_CTRL); 224 + l &= ~CONF_USB2_UNI_R; 225 + omap_writel(l, USB_TRANSCEIVER_CTRL); 226 + } 230 227 231 228 switch (nwires) { 232 229 case 3: ··· 251 238 omap_cfg_reg(K20_24XX_USB0_VM); 252 239 omap2_usb_devconf_set(0, USB_UNIDIR); 253 240 } else { 241 + u32 l; 242 + 254 243 omap_cfg_reg(AA9_USB0_VP); 255 244 omap_cfg_reg(R9_USB0_VM); 256 - USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 245 + l = omap_readl(USB_TRANSCEIVER_CTRL); 246 + l |= CONF_USB2_UNI_R; 247 + omap_writel(l, USB_TRANSCEIVER_CTRL); 257 248 } 258 249 break; 259 250 default: ··· 271 254 { 272 255 u32 syscon1 = 0; 273 256 274 - if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 275 - USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB1_UNI_R; 257 + if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) { 258 + u32 l; 259 + 260 + l = omap_readl(USB_TRANSCEIVER_CTRL); 261 + l &= ~CONF_USB1_UNI_R; 262 + omap_writel(l, USB_TRANSCEIVER_CTRL); 263 + } 276 264 if (cpu_is_omap24xx()) 277 265 omap2_usb_devconf_clear(1, USB_BIDIR_TLL); 278 266 ··· 338 316 syscon1 = 3; 339 317 omap_cfg_reg(USB1_VP); 340 318 omap_cfg_reg(USB1_VM); 341 - if (!cpu_is_omap15xx()) 342 - USB_TRANSCEIVER_CTRL_REG |= CONF_USB1_UNI_R; 319 + if (!cpu_is_omap15xx()) { 320 + u32 l; 321 + 322 + l = omap_readl(USB_TRANSCEIVER_CTRL); 323 + l |= CONF_USB1_UNI_R; 324 + omap_writel(l, USB_TRANSCEIVER_CTRL); 325 + } 343 326 break; 344 327 default: 345 328 bad: ··· 367 340 if (alt_pingroup || nwires == 0) 368 341 return 0; 369 342 370 - if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) 371 - USB_TRANSCEIVER_CTRL_REG &= ~CONF_USB2_UNI_R; 343 + if (cpu_class_is_omap1() && !cpu_is_omap15xx() && nwires != 6) { 344 + u32 l; 345 + 346 + l = omap_readl(USB_TRANSCEIVER_CTRL); 347 + l &= ~CONF_USB2_UNI_R; 348 + omap_writel(l, USB_TRANSCEIVER_CTRL); 349 + } 372 350 373 351 /* external transceiver */ 374 352 if (cpu_is_omap15xx()) { ··· 442 410 omap_cfg_reg(USB2_VP); 443 411 omap_cfg_reg(USB2_VM); 444 412 } else { 413 + u32 l; 414 + 445 415 omap_cfg_reg(AA9_USB2_VP); 446 416 omap_cfg_reg(R9_USB2_VM); 447 - USB_TRANSCEIVER_CTRL_REG |= CONF_USB2_UNI_R; 417 + l = omap_readl(USB_TRANSCEIVER_CTRL); 418 + l |= CONF_USB2_UNI_R; 419 + omap_writel(l, USB_TRANSCEIVER_CTRL); 448 420 } 449 421 break; 450 422 default: ··· 567 531 568 532 /*-------------------------------------------------------------------------*/ 569 533 570 - #define ULPD_CLOCK_CTRL_REG __REG16(ULPD_CLOCK_CTRL) 571 - #define ULPD_SOFT_REQ_REG __REG16(ULPD_SOFT_REQ) 572 - 573 - 574 534 // FIXME correct answer depends on hmc_mode, 575 535 // as does (on omap1) any nonzero value for config->otg port number 576 536 #ifdef CONFIG_USB_GADGET_OMAP ··· 582 550 void __init 583 551 omap_otg_init(struct omap_usb_config *config) 584 552 { 585 - u32 syscon = OTG_SYSCON_1_REG & 0xffff; 553 + u32 syscon; 586 554 int status; 587 555 int alt_pingroup = 0; 588 556 589 557 /* NOTE: no bus or clock setup (yet?) */ 590 558 591 - syscon = OTG_SYSCON_1_REG & 0xffff; 559 + syscon = omap_readl(OTG_SYSCON_1) & 0xffff; 592 560 if (!(syscon & OTG_RESET_DONE)) 593 561 pr_debug("USB resets not complete?\n"); 594 562 595 - // OTG_IRQ_EN_REG = 0; 563 + //omap_writew(0, OTG_IRQ_EN); 596 564 597 565 /* pin muxing and transceiver pinouts */ 598 566 if (config->pins[0] > 2) /* alt pingroup 2 */ ··· 600 568 syscon |= omap_usb0_init(config->pins[0], is_usb0_device(config)); 601 569 syscon |= omap_usb1_init(config->pins[1]); 602 570 syscon |= omap_usb2_init(config->pins[2], alt_pingroup); 603 - pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 604 - OTG_SYSCON_1_REG = syscon; 571 + pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1)); 572 + omap_writel(syscon, OTG_SYSCON_1); 605 573 606 574 syscon = config->hmc_mode; 607 575 syscon |= USBX_SYNCHRO | (4 << 16) /* B_ASE0_BRST */; ··· 610 578 syscon |= OTG_EN; 611 579 #endif 612 580 if (cpu_class_is_omap1()) 613 - pr_debug("USB_TRANSCEIVER_CTRL_REG = %03x\n", USB_TRANSCEIVER_CTRL_REG); 614 - pr_debug("OTG_SYSCON_2_REG = %08x\n", syscon); 615 - OTG_SYSCON_2_REG = syscon; 581 + pr_debug("USB_TRANSCEIVER_CTRL = %03x\n", 582 + omap_readl(USB_TRANSCEIVER_CTRL)); 583 + pr_debug("OTG_SYSCON_2 = %08x\n", omap_readl(OTG_SYSCON_2)); 584 + omap_writel(syscon, OTG_SYSCON_2); 616 585 617 586 printk("USB: hmc %d", config->hmc_mode); 618 587 if (!alt_pingroup) ··· 630 597 printk("\n"); 631 598 632 599 if (cpu_class_is_omap1()) { 600 + u16 w; 601 + 633 602 /* leave USB clocks/controllers off until needed */ 634 - ULPD_SOFT_REQ_REG &= ~SOFT_USB_CLK_REQ; 635 - ULPD_CLOCK_CTRL_REG &= ~USB_MCLK_EN; 636 - ULPD_CLOCK_CTRL_REG |= DIS_USB_PVCI_CLK; 603 + w = omap_readw(ULPD_SOFT_REQ); 604 + w &= ~SOFT_USB_CLK_REQ; 605 + omap_writew(w, ULPD_SOFT_REQ); 606 + 607 + w = omap_readw(ULPD_CLOCK_CTRL); 608 + w &= ~USB_MCLK_EN; 609 + w |= DIS_USB_PVCI_CLK; 610 + omap_writew(w, ULPD_CLOCK_CTRL); 637 611 } 638 - syscon = OTG_SYSCON_1_REG; 612 + syscon = omap_readl(OTG_SYSCON_1); 639 613 syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; 640 614 641 615 #ifdef CONFIG_USB_GADGET_OMAP ··· 679 639 pr_debug("can't register OTG device, %d\n", status); 680 640 } 681 641 #endif 682 - pr_debug("OTG_SYSCON_1_REG = %08x\n", syscon); 683 - OTG_SYSCON_1_REG = syscon; 642 + pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1)); 643 + omap_writel(syscon, OTG_SYSCON_1); 684 644 685 645 status = 0; 686 646 } ··· 693 653 694 654 #ifdef CONFIG_ARCH_OMAP15XX 695 655 696 - #define ULPD_DPLL_CTRL_REG __REG16(ULPD_DPLL_CTRL) 656 + /* ULPD_DPLL_CTRL */ 697 657 #define DPLL_IOB (1 << 13) 698 658 #define DPLL_PLL_ENABLE (1 << 4) 699 659 #define DPLL_LOCK (1 << 0) 700 660 701 - #define ULPD_APLL_CTRL_REG __REG16(ULPD_APLL_CTRL) 661 + /* ULPD_APLL_CTRL */ 702 662 #define APLL_NDPLL_SWITCH (1 << 0) 703 663 704 664 705 665 static void __init omap_1510_usb_init(struct omap_usb_config *config) 706 666 { 707 667 unsigned int val; 668 + u16 w; 708 669 709 670 omap_usb0_init(config->pins[0], is_usb0_device(config)); 710 671 omap_usb1_init(config->pins[1]); ··· 726 685 printk("\n"); 727 686 728 687 /* use DPLL for 48 MHz function clock */ 729 - pr_debug("APLL %04x DPLL %04x REQ %04x\n", ULPD_APLL_CTRL_REG, 730 - ULPD_DPLL_CTRL_REG, ULPD_SOFT_REQ_REG); 731 - ULPD_APLL_CTRL_REG &= ~APLL_NDPLL_SWITCH; 732 - ULPD_DPLL_CTRL_REG |= DPLL_IOB | DPLL_PLL_ENABLE; 733 - ULPD_SOFT_REQ_REG |= SOFT_UDC_REQ | SOFT_DPLL_REQ; 734 - while (!(ULPD_DPLL_CTRL_REG & DPLL_LOCK)) 688 + pr_debug("APLL %04x DPLL %04x REQ %04x\n", omap_readw(ULPD_APLL_CTRL), 689 + omap_readw(ULPD_DPLL_CTRL), omap_readw(ULPD_SOFT_REQ)); 690 + 691 + w = omap_readw(ULPD_APLL_CTRL); 692 + w &= ~APLL_NDPLL_SWITCH; 693 + omap_writew(w, ULPD_APLL_CTRL); 694 + 695 + w = omap_readw(ULPD_DPLL_CTRL); 696 + w |= DPLL_IOB | DPLL_PLL_ENABLE; 697 + omap_writew(w, ULPD_DPLL_CTRL); 698 + 699 + w = omap_readw(ULPD_SOFT_REQ); 700 + w |= SOFT_UDC_REQ | SOFT_DPLL_REQ; 701 + omap_writew(w, ULPD_SOFT_REQ); 702 + 703 + while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) 735 704 cpu_relax(); 736 705 737 706 #ifdef CONFIG_USB_GADGET_OMAP
+99 -64
drivers/i2c/chips/isp1301_omap.c
··· 72 72 }; 73 73 74 74 75 - /* bits in OTG_CTRL_REG */ 75 + /* bits in OTG_CTRL */ 76 76 77 77 #define OTG_XCEIV_OUTPUTS \ 78 78 (OTG_ASESSVLD|OTG_BSESSEND|OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID) ··· 186 186 187 187 /* operational registers */ 188 188 #define ISP1301_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */ 189 - # define MC1_SPEED_REG (1 << 0) 190 - # define MC1_SUSPEND_REG (1 << 1) 189 + # define MC1_SPEED (1 << 0) 190 + # define MC1_SUSPEND (1 << 1) 191 191 # define MC1_DAT_SE0 (1 << 2) 192 192 # define MC1_TRANSPARENT (1 << 3) 193 193 # define MC1_BDIS_ACON_EN (1 << 4) ··· 274 274 isp->otg.state = OTG_STATE_UNDEFINED; 275 275 276 276 // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 277 - isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 277 + isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); 278 278 279 279 isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_ID_PULLDOWN); 280 280 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); ··· 283 283 static void power_up(struct isp1301 *isp) 284 284 { 285 285 // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); 286 - isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG); 286 + isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); 287 287 288 288 /* do this only when cpu is driving transceiver, 289 289 * so host won't see a low speed device... ··· 360 360 /* called from irq handlers */ 361 361 static void a_idle(struct isp1301 *isp, const char *tag) 362 362 { 363 + u32 l; 364 + 363 365 if (isp->otg.state == OTG_STATE_A_IDLE) 364 366 return; 365 367 ··· 375 373 gadget_suspend(isp); 376 374 } 377 375 isp->otg.state = OTG_STATE_A_IDLE; 378 - isp->last_otg_ctrl = OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 376 + l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; 377 + omap_writel(l, OTG_CTRL); 378 + isp->last_otg_ctrl = l; 379 379 pr_debug(" --> %s/%s\n", state_name(isp), tag); 380 380 } 381 381 382 382 /* called from irq handlers */ 383 383 static void b_idle(struct isp1301 *isp, const char *tag) 384 384 { 385 + u32 l; 386 + 385 387 if (isp->otg.state == OTG_STATE_B_IDLE) 386 388 return; 387 389 ··· 399 393 gadget_suspend(isp); 400 394 } 401 395 isp->otg.state = OTG_STATE_B_IDLE; 402 - isp->last_otg_ctrl = OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 396 + l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; 397 + omap_writel(l, OTG_CTRL); 398 + isp->last_otg_ctrl = l; 403 399 pr_debug(" --> %s/%s\n", state_name(isp), tag); 404 400 } 405 401 ··· 414 406 u8 src = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE); 415 407 416 408 pr_debug("otg: %06x, %s %s, otg/%02x stat/%02x.%02x\n", 417 - OTG_CTRL_REG, label, state_name(isp), 409 + omap_readl(OTG_CTRL), label, state_name(isp), 418 410 ctrl, status, src); 419 411 /* mode control and irq enables don't change much */ 420 412 #endif ··· 437 429 static void check_state(struct isp1301 *isp, const char *tag) 438 430 { 439 431 enum usb_otg_state state = OTG_STATE_UNDEFINED; 440 - u8 fsm = OTG_TEST_REG & 0x0ff; 432 + u8 fsm = omap_readw(OTG_TEST) & 0x0ff; 441 433 unsigned extra = 0; 442 434 443 435 switch (fsm) { ··· 502 494 if (isp->otg.state == state && !extra) 503 495 return; 504 496 pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, 505 - state_string(state), fsm, state_name(isp), OTG_CTRL_REG); 497 + state_string(state), fsm, state_name(isp), 498 + omap_readl(OTG_CTRL)); 506 499 } 507 500 508 501 #else ··· 517 508 { 518 509 u32 otg_ctrl; 519 510 520 - otg_ctrl = OTG_CTRL_REG 521 - & OTG_CTRL_MASK 522 - & ~OTG_XCEIV_INPUTS 523 - & ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); 511 + otg_ctrl = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; 512 + otg_ctrl &= ~OTG_XCEIV_INPUTS; 513 + otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); 514 + 515 + 524 516 if (int_src & INTR_SESS_VLD) 525 517 otg_ctrl |= OTG_ASESSVLD; 526 518 else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) { ··· 544 534 return; 545 535 } 546 536 } 547 - OTG_CTRL_REG = otg_ctrl; 537 + omap_writel(otg_ctrl, OTG_CTRL); 548 538 } 549 539 550 540 /* outputs from ISP1301_OTG_STATUS */ ··· 552 542 { 553 543 u32 otg_ctrl; 554 544 555 - otg_ctrl = OTG_CTRL_REG 556 - & OTG_CTRL_MASK 557 - & ~OTG_XCEIV_INPUTS 558 - & ~(OTG_BSESSVLD|OTG_BSESSEND); 545 + otg_ctrl = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; 546 + otg_ctrl &= ~OTG_XCEIV_INPUTS; 547 + otg_ctrl &= ~(OTG_BSESSVLD | OTG_BSESSEND); 559 548 if (otg_status & OTG_B_SESS_VLD) 560 549 otg_ctrl |= OTG_BSESSVLD; 561 550 else if (otg_status & OTG_B_SESS_END) 562 551 otg_ctrl |= OTG_BSESSEND; 563 - OTG_CTRL_REG = otg_ctrl; 552 + omap_writel(otg_ctrl, OTG_CTRL); 564 553 } 565 554 566 555 /* inputs going to ISP1301 */ ··· 568 559 u32 otg_ctrl, otg_change; 569 560 u8 set = OTG1_DM_PULLDOWN, clr = OTG1_DM_PULLUP; 570 561 571 - otg_ctrl = OTG_CTRL_REG; 562 + otg_ctrl = omap_readl(OTG_CTRL); 572 563 otg_change = otg_ctrl ^ isp->last_otg_ctrl; 573 564 isp->last_otg_ctrl = otg_ctrl; 574 565 otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; ··· 648 639 649 640 /* HNP switch to host or peripheral; and SRP */ 650 641 if (otg_change & OTG_PULLUP) { 642 + u32 l; 643 + 651 644 switch (isp->otg.state) { 652 645 case OTG_STATE_B_IDLE: 653 646 if (clr & OTG1_DP_PULLUP) ··· 666 655 default: 667 656 break; 668 657 } 669 - OTG_CTRL_REG |= OTG_PULLUP; 658 + l = omap_readl(OTG_CTRL); 659 + l |= OTG_PULLUP; 660 + omap_writel(l, OTG_CTRL); 670 661 } 671 662 672 663 check_state(isp, __func__); ··· 677 664 678 665 static irqreturn_t omap_otg_irq(int irq, void *_isp) 679 666 { 680 - u16 otg_irq = OTG_IRQ_SRC_REG; 667 + u16 otg_irq = omap_readw(OTG_IRQ_SRC); 681 668 u32 otg_ctrl; 682 669 int ret = IRQ_NONE; 683 670 struct isp1301 *isp = _isp; 684 671 685 672 /* update ISP1301 transciever from OTG controller */ 686 673 if (otg_irq & OPRT_CHG) { 687 - OTG_IRQ_SRC_REG = OPRT_CHG; 674 + omap_writew(OPRT_CHG, OTG_IRQ_SRC); 688 675 isp1301_defer_work(isp, WORK_UPDATE_ISP); 689 676 ret = IRQ_HANDLED; 690 677 691 678 /* SRP to become b_peripheral failed */ 692 679 } else if (otg_irq & B_SRP_TMROUT) { 693 - pr_debug("otg: B_SRP_TIMEOUT, %06x\n", OTG_CTRL_REG); 680 + pr_debug("otg: B_SRP_TIMEOUT, %06x\n", omap_readl(OTG_CTRL)); 694 681 notresponding(isp); 695 682 696 683 /* gadget drivers that care should monitor all kinds of ··· 700 687 if (isp->otg.state == OTG_STATE_B_SRP_INIT) 701 688 b_idle(isp, "srp_timeout"); 702 689 703 - OTG_IRQ_SRC_REG = B_SRP_TMROUT; 690 + omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC); 704 691 ret = IRQ_HANDLED; 705 692 706 693 /* HNP to become b_host failed */ 707 694 } else if (otg_irq & B_HNP_FAIL) { 708 695 pr_debug("otg: %s B_HNP_FAIL, %06x\n", 709 - state_name(isp), OTG_CTRL_REG); 696 + state_name(isp), omap_readl(OTG_CTRL)); 710 697 notresponding(isp); 711 698 712 - otg_ctrl = OTG_CTRL_REG; 699 + otg_ctrl = omap_readl(OTG_CTRL); 713 700 otg_ctrl |= OTG_BUSDROP; 714 701 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 715 - OTG_CTRL_REG = otg_ctrl; 702 + omap_writel(otg_ctrl, OTG_CTRL); 716 703 717 704 /* subset of b_peripheral()... */ 718 705 isp->otg.state = OTG_STATE_B_PERIPHERAL; 719 706 pr_debug(" --> b_peripheral\n"); 720 707 721 - OTG_IRQ_SRC_REG = B_HNP_FAIL; 708 + omap_writew(B_HNP_FAIL, OTG_IRQ_SRC); 722 709 ret = IRQ_HANDLED; 723 710 724 711 /* detect SRP from B-device ... */ 725 712 } else if (otg_irq & A_SRP_DETECT) { 726 713 pr_debug("otg: %s SRP_DETECT, %06x\n", 727 - state_name(isp), OTG_CTRL_REG); 714 + state_name(isp), omap_readl(OTG_CTRL)); 728 715 729 716 isp1301_defer_work(isp, WORK_UPDATE_OTG); 730 717 switch (isp->otg.state) { ··· 732 719 if (!isp->otg.host) 733 720 break; 734 721 isp1301_defer_work(isp, WORK_HOST_RESUME); 735 - otg_ctrl = OTG_CTRL_REG; 722 + otg_ctrl = omap_readl(OTG_CTRL); 736 723 otg_ctrl |= OTG_A_BUSREQ; 737 724 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ) 738 725 & ~OTG_XCEIV_INPUTS 739 726 & OTG_CTRL_MASK; 740 - OTG_CTRL_REG = otg_ctrl; 727 + omap_writel(otg_ctrl, OTG_CTRL); 741 728 break; 742 729 default: 743 730 break; 744 731 } 745 732 746 - OTG_IRQ_SRC_REG = A_SRP_DETECT; 733 + omap_writew(A_SRP_DETECT, OTG_IRQ_SRC); 747 734 ret = IRQ_HANDLED; 748 735 749 736 /* timer expired: T(a_wait_bcon) and maybe T(a_wait_vrise) 750 737 * we don't track them separately 751 738 */ 752 739 } else if (otg_irq & A_REQ_TMROUT) { 753 - otg_ctrl = OTG_CTRL_REG; 740 + otg_ctrl = omap_readl(OTG_CTRL); 754 741 pr_info("otg: BCON_TMOUT from %s, %06x\n", 755 742 state_name(isp), otg_ctrl); 756 743 notresponding(isp); 757 744 758 745 otg_ctrl |= OTG_BUSDROP; 759 746 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 760 - OTG_CTRL_REG = otg_ctrl; 747 + omap_writel(otg_ctrl, OTG_CTRL); 761 748 isp->otg.state = OTG_STATE_A_WAIT_VFALL; 762 749 763 - OTG_IRQ_SRC_REG = A_REQ_TMROUT; 750 + omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC); 764 751 ret = IRQ_HANDLED; 765 752 766 753 /* A-supplied voltage fell too low; overcurrent */ 767 754 } else if (otg_irq & A_VBUS_ERR) { 768 - otg_ctrl = OTG_CTRL_REG; 755 + otg_ctrl = omap_readl(OTG_CTRL); 769 756 printk(KERN_ERR "otg: %s, VBUS_ERR %04x ctrl %06x\n", 770 757 state_name(isp), otg_irq, otg_ctrl); 771 758 772 759 otg_ctrl |= OTG_BUSDROP; 773 760 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 774 - OTG_CTRL_REG = otg_ctrl; 761 + omap_writel(otg_ctrl, OTG_CTRL); 775 762 isp->otg.state = OTG_STATE_A_VBUS_ERR; 776 763 777 - OTG_IRQ_SRC_REG = A_VBUS_ERR; 764 + omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); 778 765 ret = IRQ_HANDLED; 779 766 780 767 /* switch driver; the transciever code activates it, ··· 783 770 } else if (otg_irq & DRIVER_SWITCH) { 784 771 int kick = 0; 785 772 786 - otg_ctrl = OTG_CTRL_REG; 773 + otg_ctrl = omap_readl(OTG_CTRL); 787 774 printk(KERN_NOTICE "otg: %s, SWITCH to %s, ctrl %06x\n", 788 775 state_name(isp), 789 776 (otg_ctrl & OTG_DRIVER_SEL) ··· 806 793 } else { 807 794 if (!(otg_ctrl & OTG_ID)) { 808 795 otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; 809 - OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ; 796 + omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL); 810 797 } 811 798 812 799 if (isp->otg.host) { ··· 831 818 } 832 819 } 833 820 834 - OTG_IRQ_SRC_REG = DRIVER_SWITCH; 821 + omap_writew(DRIVER_SWITCH, OTG_IRQ_SRC); 835 822 ret = IRQ_HANDLED; 836 823 837 824 if (kick) ··· 847 834 848 835 static int otg_init(struct isp1301 *isp) 849 836 { 837 + u32 l; 838 + 850 839 if (!otg_dev) 851 840 return -ENODEV; 852 841 853 842 dump_regs(isp, __func__); 854 843 /* some of these values are board-specific... */ 855 - OTG_SYSCON_2_REG |= OTG_EN 844 + l = omap_readl(OTG_SYSCON_2); 845 + l |= OTG_EN 856 846 /* for B-device: */ 857 847 | SRP_GPDATA /* 9msec Bdev D+ pulse */ 858 848 | SRP_GPDVBUS /* discharge after VBUS pulse */ ··· 865 849 | SRP_DPW /* detect 167+ns SRP pulses */ 866 850 | SRP_DATA | SRP_VBUS /* accept both kinds of SRP pulse */ 867 851 ; 852 + omap_writel(l, OTG_SYSCON_2); 868 853 869 854 update_otg1(isp, isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE)); 870 855 update_otg2(isp, isp1301_get_u8(isp, ISP1301_OTG_STATUS)); 871 856 872 857 check_state(isp, __func__); 873 858 pr_debug("otg: %s, %s %06x\n", 874 - state_name(isp), __func__, OTG_CTRL_REG); 859 + state_name(isp), __func__, omap_readl(OTG_CTRL)); 875 860 876 - OTG_IRQ_EN_REG = DRIVER_SWITCH | OPRT_CHG 861 + omap_writew(DRIVER_SWITCH | OPRT_CHG 877 862 | B_SRP_TMROUT | B_HNP_FAIL 878 - | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT; 879 - OTG_SYSCON_2_REG |= OTG_EN; 863 + | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT, OTG_IRQ_EN); 864 + 865 + l = omap_readl(OTG_SYSCON_2); 866 + l |= OTG_EN; 867 + omap_writel(l, OTG_SYSCON_2); 880 868 881 869 return 0; 882 870 } ··· 947 927 948 928 static void b_peripheral(struct isp1301 *isp) 949 929 { 950 - OTG_CTRL_REG = OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 930 + u32 l; 931 + 932 + l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; 933 + omap_writel(l, OTG_CTRL); 934 + 951 935 usb_gadget_vbus_connect(isp->otg.gadget); 952 936 953 937 #ifdef CONFIG_USB_OTG ··· 1023 999 isp_bstat = 0; 1024 1000 } 1025 1001 } else { 1002 + u32 l; 1003 + 1026 1004 /* if user unplugged mini-A end of cable, 1027 1005 * don't bypass A_WAIT_VFALL. 1028 1006 */ ··· 1045 1019 isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, 1046 1020 MC1_BDIS_ACON_EN); 1047 1021 isp->otg.state = OTG_STATE_B_IDLE; 1048 - OTG_CTRL_REG &= OTG_CTRL_REG & OTG_CTRL_MASK 1049 - & ~OTG_CTRL_BITS; 1022 + l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; 1023 + l &= ~OTG_CTRL_BITS; 1024 + omap_writel(l, OTG_CTRL); 1050 1025 break; 1051 1026 case OTG_STATE_B_IDLE: 1052 1027 break; ··· 1073 1046 /* FALLTHROUGH */ 1074 1047 case OTG_STATE_B_SRP_INIT: 1075 1048 b_idle(isp, __func__); 1076 - OTG_CTRL_REG &= OTG_CTRL_REG & OTG_XCEIV_OUTPUTS; 1049 + l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; 1050 + omap_writel(l, OTG_CTRL); 1077 1051 /* FALLTHROUGH */ 1078 1052 case OTG_STATE_B_IDLE: 1079 1053 if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) { ··· 1158 1130 case OTG_STATE_A_WAIT_VRISE: 1159 1131 isp->otg.state = OTG_STATE_A_HOST; 1160 1132 pr_debug(" --> a_host\n"); 1161 - otg_ctrl = OTG_CTRL_REG; 1133 + otg_ctrl = omap_readl(OTG_CTRL); 1162 1134 otg_ctrl |= OTG_A_BUSREQ; 1163 1135 otg_ctrl &= ~(OTG_BUSDROP|OTG_B_BUSREQ) 1164 1136 & OTG_CTRL_MASK; 1165 - OTG_CTRL_REG = otg_ctrl; 1137 + omap_writel(otg_ctrl, OTG_CTRL); 1166 1138 break; 1167 1139 case OTG_STATE_B_WAIT_ACON: 1168 1140 isp->otg.state = OTG_STATE_B_HOST; ··· 1302 1274 return -ENODEV; 1303 1275 1304 1276 if (!host) { 1305 - OTG_IRQ_EN_REG = 0; 1277 + omap_writew(0, OTG_IRQ_EN); 1306 1278 power_down(isp); 1307 1279 isp->otg.host = 0; 1308 1280 return 0; ··· 1353 1325 isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) 1354 1326 { 1355 1327 struct isp1301 *isp = container_of(otg, struct isp1301, otg); 1328 + u32 l; 1356 1329 1357 1330 if (!otg || isp != the_transceiver) 1358 1331 return -ENODEV; 1359 1332 1360 1333 if (!gadget) { 1361 - OTG_IRQ_EN_REG = 0; 1334 + omap_writew(0, OTG_IRQ_EN); 1362 1335 if (!isp->otg.default_a) 1363 1336 enable_vbus_draw(isp, 0); 1364 1337 usb_gadget_vbus_disconnect(isp->otg.gadget); ··· 1380 1351 isp->otg.gadget = gadget; 1381 1352 // FIXME update its refcount 1382 1353 1383 - OTG_CTRL_REG = (OTG_CTRL_REG & OTG_CTRL_MASK 1384 - & ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS)) 1385 - | OTG_ID; 1354 + l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; 1355 + l &= ~(OTG_XCEIV_OUTPUTS|OTG_CTRL_BITS); 1356 + l |= OTG_ID; 1357 + omap_writel(l, OTG_CTRL); 1358 + 1386 1359 power_up(isp); 1387 1360 isp->otg.state = OTG_STATE_B_IDLE; 1388 1361 ··· 1436 1405 || isp->otg.state != OTG_STATE_B_IDLE) 1437 1406 return -ENODEV; 1438 1407 1439 - otg_ctrl = OTG_CTRL_REG; 1408 + otg_ctrl = omap_readl(OTG_CTRL); 1440 1409 if (!(otg_ctrl & OTG_BSESSEND)) 1441 1410 return -EINVAL; 1442 1411 1443 1412 otg_ctrl |= OTG_B_BUSREQ; 1444 1413 otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; 1445 - OTG_CTRL_REG = otg_ctrl; 1414 + omap_writel(otg_ctrl, OTG_CTRL); 1446 1415 isp->otg.state = OTG_STATE_B_SRP_INIT; 1447 1416 1448 - pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), OTG_CTRL_REG); 1417 + pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), 1418 + omap_readl(OTG_CTRL)); 1449 1419 #ifdef CONFIG_USB_OTG 1450 1420 check_state(isp, __func__); 1451 1421 #endif ··· 1458 1426 { 1459 1427 #ifdef CONFIG_USB_OTG 1460 1428 struct isp1301 *isp = container_of(dev, struct isp1301, otg); 1429 + u32 l; 1461 1430 1462 1431 if (!dev || isp != the_transceiver) 1463 1432 return -ENODEV; ··· 1485 1452 #endif 1486 1453 /* caller must suspend then clear A_BUSREQ */ 1487 1454 usb_gadget_vbus_connect(isp->otg.gadget); 1488 - OTG_CTRL_REG |= OTG_A_SETB_HNPEN; 1455 + l = omap_readl(OTG_CTRL); 1456 + l |= OTG_A_SETB_HNPEN; 1457 + omap_writel(l, OTG_CTRL); 1489 1458 1490 1459 break; 1491 1460 case OTG_STATE_A_PERIPHERAL: ··· 1497 1462 return -EILSEQ; 1498 1463 } 1499 1464 pr_debug("otg: HNP %s, %06x ...\n", 1500 - state_name(isp), OTG_CTRL_REG); 1465 + state_name(isp), omap_readl(OTG_CTRL)); 1501 1466 check_state(isp, __func__); 1502 1467 return 0; 1503 1468 #else
+261 -207
drivers/usb/gadget/omap_udc.c
··· 135 135 136 136 if (ep->bEndpointAddress & USB_DIR_IN) 137 137 num |= UDC_EP_DIR; 138 - UDC_EP_NUM_REG = num | select; 138 + omap_writew(num | select, UDC_EP_NUM); 139 139 /* when select, MUST deselect later !! */ 140 140 } 141 141 142 142 static inline void deselect_ep(void) 143 143 { 144 - UDC_EP_NUM_REG &= ~UDC_EP_SEL; 144 + u16 w; 145 + 146 + w = omap_readw(UDC_EP_NUM); 147 + w &= ~UDC_EP_SEL; 148 + omap_writew(w, UDC_EP_NUM); 145 149 /* 6 wait states before TX will happen */ 146 150 } 147 151 ··· 220 216 ep->has_dma = 0; 221 217 ep->lch = -1; 222 218 use_ep(ep, UDC_EP_SEL); 223 - UDC_CTRL_REG = udc->clr_halt; 219 + omap_writew(udc->clr_halt, UDC_CTRL); 224 220 ep->ackwait = 0; 225 221 deselect_ep(); 226 222 ··· 236 232 if (desc->bmAttributes != USB_ENDPOINT_XFER_ISOC 237 233 && !ep->has_dma 238 234 && !(ep->bEndpointAddress & USB_DIR_IN)) { 239 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 235 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 240 236 ep->ackwait = 1 + ep->double_buf; 241 237 } 242 238 ··· 263 259 nuke (ep, -ESHUTDOWN); 264 260 ep->ep.maxpacket = ep->maxpacket; 265 261 ep->has_dma = 0; 266 - UDC_CTRL_REG = UDC_SET_HALT; 262 + omap_writew(UDC_SET_HALT, UDC_CTRL); 267 263 list_del_init(&ep->iso); 268 264 del_timer(&ep->timer); 269 265 ··· 364 360 if (likely((((int)buf) & 1) == 0)) { 365 361 wp = (u16 *)buf; 366 362 while (max >= 2) { 367 - UDC_DATA_REG = *wp++; 363 + omap_writew(*wp++, UDC_DATA); 368 364 max -= 2; 369 365 } 370 366 buf = (u8 *)wp; 371 367 } 372 368 while (max--) 373 - *(volatile u8 *)&UDC_DATA_REG = *buf++; 369 + omap_writeb(*buf++, UDC_DATA); 374 370 return len; 375 371 } 376 372 ··· 389 385 prefetch(buf); 390 386 391 387 /* PIO-IN isn't double buffered except for iso */ 392 - ep_stat = UDC_STAT_FLG_REG; 388 + ep_stat = omap_readw(UDC_STAT_FLG); 393 389 if (ep_stat & UDC_FIFO_UNWRITABLE) 394 390 return 0; 395 391 396 392 count = ep->ep.maxpacket; 397 393 count = write_packet(buf, req, count); 398 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 394 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 399 395 ep->ackwait = 1; 400 396 401 397 /* last packet is often short (sometimes a zlp) */ ··· 429 425 if (likely((((int)buf) & 1) == 0)) { 430 426 wp = (u16 *)buf; 431 427 while (avail >= 2) { 432 - *wp++ = UDC_DATA_REG; 428 + *wp++ = omap_readw(UDC_DATA); 433 429 avail -= 2; 434 430 } 435 431 buf = (u8 *)wp; 436 432 } 437 433 while (avail--) 438 - *buf++ = *(volatile u8 *)&UDC_DATA_REG; 434 + *buf++ = omap_readb(UDC_DATA); 439 435 return len; 440 436 } 441 437 ··· 450 446 prefetchw(buf); 451 447 452 448 for (;;) { 453 - u16 ep_stat = UDC_STAT_FLG_REG; 449 + u16 ep_stat = omap_readw(UDC_STAT_FLG); 454 450 455 451 is_last = 0; 456 452 if (ep_stat & FIFO_EMPTY) { ··· 464 460 if (ep_stat & UDC_FIFO_FULL) 465 461 avail = ep->ep.maxpacket; 466 462 else { 467 - avail = UDC_RXFSTAT_REG; 463 + avail = omap_readw(UDC_RXFSTAT); 468 464 ep->fnf = ep->double_buf; 469 465 } 470 466 count = read_packet(buf, req, avail); ··· 477 473 req->req.status = -EOVERFLOW; 478 474 avail -= count; 479 475 while (avail--) 480 - (void) *(volatile u8 *)&UDC_DATA_REG; 476 + omap_readw(UDC_DATA); 481 477 } 482 478 } else if (req->req.length == req->req.actual) 483 479 is_last = 1; ··· 539 535 540 536 static void next_in_dma(struct omap_ep *ep, struct omap_req *req) 541 537 { 542 - u16 txdma_ctrl; 538 + u16 txdma_ctrl, w; 543 539 unsigned length = req->req.length - req->req.actual; 544 540 const int sync_mode = cpu_is_omap15xx() 545 541 ? OMAP_DMA_SYNC_FRAME ··· 571 567 572 568 omap_start_dma(ep->lch); 573 569 ep->dma_counter = omap_get_dma_src_pos(ep->lch); 574 - UDC_DMA_IRQ_EN_REG |= UDC_TX_DONE_IE(ep->dma_channel); 575 - UDC_TXDMA_REG(ep->dma_channel) = UDC_TXN_START | txdma_ctrl; 570 + w = omap_readw(UDC_DMA_IRQ_EN); 571 + w |= UDC_TX_DONE_IE(ep->dma_channel); 572 + omap_writew(w, UDC_DMA_IRQ_EN); 573 + omap_writew(UDC_TXN_START | txdma_ctrl, UDC_TXDMA(ep->dma_channel)); 576 574 req->dma_bytes = length; 577 575 } 578 576 579 577 static void finish_in_dma(struct omap_ep *ep, struct omap_req *req, int status) 580 578 { 579 + u16 w; 580 + 581 581 if (status == 0) { 582 582 req->req.actual += req->dma_bytes; 583 583 ··· 598 590 599 591 /* tx completion */ 600 592 omap_stop_dma(ep->lch); 601 - UDC_DMA_IRQ_EN_REG &= ~UDC_TX_DONE_IE(ep->dma_channel); 593 + w = omap_readw(UDC_DMA_IRQ_EN); 594 + w &= ~UDC_TX_DONE_IE(ep->dma_channel); 595 + omap_writew(w, UDC_DMA_IRQ_EN); 602 596 done(ep, req, status); 603 597 } 604 598 ··· 608 598 { 609 599 unsigned packets = req->req.length - req->req.actual; 610 600 int dma_trigger = 0; 601 + u16 w; 611 602 612 603 if (cpu_is_omap24xx()) 613 604 dma_trigger = OMAP24XX_DMA(USB_W2FC_RX0, ep->dma_channel); ··· 637 626 0, 0); 638 627 ep->dma_counter = omap_get_dma_dst_pos(ep->lch); 639 628 640 - UDC_RXDMA_REG(ep->dma_channel) = UDC_RXN_STOP | (packets - 1); 641 - UDC_DMA_IRQ_EN_REG |= UDC_RX_EOT_IE(ep->dma_channel); 642 - UDC_EP_NUM_REG = (ep->bEndpointAddress & 0xf); 643 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 629 + omap_writew(UDC_RXN_STOP | (packets - 1), UDC_RXDMA(ep->dma_channel)); 630 + w = omap_readw(UDC_DMA_IRQ_EN); 631 + w |= UDC_RX_EOT_IE(ep->dma_channel); 632 + omap_writew(w, UDC_DMA_IRQ_EN); 633 + omap_writew(ep->bEndpointAddress & 0xf, UDC_EP_NUM); 634 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 644 635 645 636 omap_start_dma(ep->lch); 646 637 } ··· 650 637 static void 651 638 finish_out_dma(struct omap_ep *ep, struct omap_req *req, int status, int one) 652 639 { 653 - u16 count; 640 + u16 count, w; 654 641 655 642 if (status == 0) 656 643 ep->dma_counter = (u16) (req->req.dma + req->req.actual); ··· 669 656 return; 670 657 671 658 /* rx completion */ 672 - UDC_DMA_IRQ_EN_REG &= ~UDC_RX_EOT_IE(ep->dma_channel); 659 + w = omap_readw(UDC_DMA_IRQ_EN); 660 + w &= ~UDC_RX_EOT_IE(ep->dma_channel); 661 + omap_writew(w, UDC_DMA_IRQ_EN); 673 662 done(ep, req, status); 674 663 } 675 664 676 665 static void dma_irq(struct omap_udc *udc, u16 irq_src) 677 666 { 678 - u16 dman_stat = UDC_DMAN_STAT_REG; 667 + u16 dman_stat = omap_readw(UDC_DMAN_STAT); 679 668 struct omap_ep *ep; 680 669 struct omap_req *req; 681 670 ··· 691 676 struct omap_req, queue); 692 677 finish_in_dma(ep, req, 0); 693 678 } 694 - UDC_IRQ_SRC_REG = UDC_TXN_DONE; 679 + omap_writew(UDC_TXN_DONE, UDC_IRQ_SRC); 695 680 696 681 if (!list_empty (&ep->queue)) { 697 682 req = container_of(ep->queue.next, ··· 710 695 struct omap_req, queue); 711 696 finish_out_dma(ep, req, 0, dman_stat & UDC_DMA_RX_SB); 712 697 } 713 - UDC_IRQ_SRC_REG = UDC_RXN_EOT; 698 + omap_writew(UDC_RXN_EOT, UDC_IRQ_SRC); 714 699 715 700 if (!list_empty (&ep->queue)) { 716 701 req = container_of(ep->queue.next, ··· 724 709 ep->irqs++; 725 710 /* omap15xx does this unasked... */ 726 711 VDBG("%s, RX_CNT irq?\n", ep->ep.name); 727 - UDC_IRQ_SRC_REG = UDC_RXN_CNT; 712 + omap_writew(UDC_RXN_CNT, UDC_IRQ_SRC); 728 713 } 729 714 } 730 715 ··· 747 732 748 733 is_in = ep->bEndpointAddress & USB_DIR_IN; 749 734 if (is_in) 750 - reg = UDC_TXDMA_CFG_REG; 735 + reg = omap_readw(UDC_TXDMA_CFG); 751 736 else 752 - reg = UDC_RXDMA_CFG_REG; 737 + reg = omap_readw(UDC_RXDMA_CFG); 753 738 reg |= UDC_DMA_REQ; /* "pulse" activated */ 754 739 755 740 ep->dma_channel = 0; ··· 777 762 status = omap_request_dma(dma_channel, 778 763 ep->ep.name, dma_error, ep, &ep->lch); 779 764 if (status == 0) { 780 - UDC_TXDMA_CFG_REG = reg; 765 + omap_writew(reg, UDC_TXDMA_CFG); 781 766 /* EMIFF or SDRC */ 782 767 omap_set_dma_src_burst_mode(ep->lch, 783 768 OMAP_DMA_DATA_BURST_4); ··· 786 771 omap_set_dma_dest_params(ep->lch, 787 772 OMAP_DMA_PORT_TIPB, 788 773 OMAP_DMA_AMODE_CONSTANT, 789 - (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), 774 + (unsigned long) io_v2p(UDC_DATA_DMA), 790 775 0, 0); 791 776 } 792 777 } else { ··· 798 783 status = omap_request_dma(dma_channel, 799 784 ep->ep.name, dma_error, ep, &ep->lch); 800 785 if (status == 0) { 801 - UDC_RXDMA_CFG_REG = reg; 786 + omap_writew(reg, UDC_RXDMA_CFG); 802 787 /* TIPB */ 803 788 omap_set_dma_src_params(ep->lch, 804 789 OMAP_DMA_PORT_TIPB, 805 790 OMAP_DMA_AMODE_CONSTANT, 806 - (unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG), 791 + (unsigned long) io_v2p(UDC_DATA_DMA), 807 792 0, 0); 808 793 /* EMIFF or SDRC */ 809 794 omap_set_dma_dest_burst_mode(ep->lch, ··· 845 830 (is_in ? write_fifo : read_fifo)(ep, req); 846 831 deselect_ep(); 847 832 if (!is_in) { 848 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 833 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 849 834 ep->ackwait = 1 + ep->double_buf; 850 835 } 851 836 /* IN: 6 wait states before it'll tx */ ··· 879 864 880 865 /* wait till current packet DMA finishes, and fifo empties */ 881 866 if (ep->bEndpointAddress & USB_DIR_IN) { 882 - UDC_TXDMA_CFG_REG = (UDC_TXDMA_CFG_REG & ~mask) | UDC_DMA_REQ; 867 + omap_writew((omap_readw(UDC_TXDMA_CFG) & ~mask) | UDC_DMA_REQ, 868 + UDC_TXDMA_CFG); 883 869 884 870 if (req) { 885 871 finish_in_dma(ep, req, -ECONNRESET); 886 872 887 873 /* clear FIFO; hosts probably won't empty it */ 888 874 use_ep(ep, UDC_EP_SEL); 889 - UDC_CTRL_REG = UDC_CLR_EP; 875 + omap_writew(UDC_CLR_EP, UDC_CTRL); 890 876 deselect_ep(); 891 877 } 892 - while (UDC_TXDMA_CFG_REG & mask) 878 + while (omap_readw(UDC_TXDMA_CFG) & mask) 893 879 udelay(10); 894 880 } else { 895 - UDC_RXDMA_CFG_REG = (UDC_RXDMA_CFG_REG & ~mask) | UDC_DMA_REQ; 881 + omap_writew((omap_readw(UDC_RXDMA_CFG) & ~mask) | UDC_DMA_REQ, 882 + UDC_RXDMA_CFG); 896 883 897 884 /* dma empties the fifo */ 898 - while (UDC_RXDMA_CFG_REG & mask) 885 + while (omap_readw(UDC_RXDMA_CFG) & mask) 899 886 udelay(10); 900 887 if (req) 901 888 finish_out_dma(ep, req, -ECONNRESET, 0); ··· 984 967 req->req.actual = 0; 985 968 986 969 /* maybe kickstart non-iso i/o queues */ 987 - if (is_iso) 988 - UDC_IRQ_EN_REG |= UDC_SOF_IE; 989 - else if (list_empty(&ep->queue) && !ep->stopped && !ep->ackwait) { 970 + if (is_iso) { 971 + u16 w; 972 + 973 + w = omap_readw(UDC_IRQ_EN); 974 + w |= UDC_SOF_IE; 975 + omap_writew(w, UDC_IRQ_EN); 976 + } else if (list_empty(&ep->queue) && !ep->stopped && !ep->ackwait) { 990 977 int is_in; 991 978 992 979 if (ep->bEndpointAddress == 0) { ··· 1008 987 * requests to non-control endpoints 1009 988 */ 1010 989 if (udc->ep0_set_config) { 1011 - u16 irq_en = UDC_IRQ_EN_REG; 990 + u16 irq_en = omap_readw(UDC_IRQ_EN); 1012 991 1013 992 irq_en |= UDC_DS_CHG_IE | UDC_EP0_IE; 1014 993 if (!udc->ep0_reset_config) 1015 994 irq_en |= UDC_EPN_RX_IE 1016 995 | UDC_EPN_TX_IE; 1017 - UDC_IRQ_EN_REG = irq_en; 996 + omap_writew(irq_en, UDC_IRQ_EN); 1018 997 } 1019 998 1020 999 /* STATUS for zero length DATA stages is 1021 1000 * always an IN ... even for IN transfers, 1022 1001 * a weird case which seem to stall OMAP. 1023 1002 */ 1024 - UDC_EP_NUM_REG = (UDC_EP_SEL|UDC_EP_DIR); 1025 - UDC_CTRL_REG = UDC_CLR_EP; 1026 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1027 - UDC_EP_NUM_REG = UDC_EP_DIR; 1003 + omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM); 1004 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1005 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1006 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1028 1007 1029 1008 /* cleanup */ 1030 1009 udc->ep0_pending = 0; ··· 1033 1012 1034 1013 /* non-empty DATA stage */ 1035 1014 } else if (is_in) { 1036 - UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1015 + omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM); 1037 1016 } else { 1038 1017 if (udc->ep0_setup) 1039 1018 goto irq_wait; 1040 - UDC_EP_NUM_REG = UDC_EP_SEL; 1019 + omap_writew(UDC_EP_SEL, UDC_EP_NUM); 1041 1020 } 1042 1021 } else { 1043 1022 is_in = ep->bEndpointAddress & USB_DIR_IN; ··· 1053 1032 req = NULL; 1054 1033 deselect_ep(); 1055 1034 if (!is_in) { 1056 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1035 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1057 1036 ep->ackwait = 1 + ep->double_buf; 1058 1037 } 1059 1038 /* IN: 6 wait states before it'll tx */ ··· 1121 1100 else if (value) { 1122 1101 if (ep->udc->ep0_set_config) { 1123 1102 WARN("error changing config?\n"); 1124 - UDC_SYSCON2_REG = UDC_CLR_CFG; 1103 + omap_writew(UDC_CLR_CFG, UDC_SYSCON2); 1125 1104 } 1126 - UDC_SYSCON2_REG = UDC_STALL_CMD; 1105 + omap_writew(UDC_STALL_CMD, UDC_SYSCON2); 1127 1106 ep->udc->ep0_pending = 0; 1128 1107 status = 0; 1129 1108 } else /* NOP */ ··· 1150 1129 channel = 0; 1151 1130 1152 1131 use_ep(ep, UDC_EP_SEL); 1153 - if (UDC_STAT_FLG_REG & UDC_NON_ISO_FIFO_EMPTY) { 1154 - UDC_CTRL_REG = UDC_SET_HALT; 1132 + if (omap_readw(UDC_STAT_FLG) & UDC_NON_ISO_FIFO_EMPTY) { 1133 + omap_writew(UDC_SET_HALT, UDC_CTRL); 1155 1134 status = 0; 1156 1135 } else 1157 1136 status = -EAGAIN; ··· 1161 1140 dma_channel_claim(ep, channel); 1162 1141 } else { 1163 1142 use_ep(ep, 0); 1164 - UDC_CTRL_REG = ep->udc->clr_halt; 1143 + omap_writew(ep->udc->clr_halt, UDC_CTRL); 1165 1144 ep->ackwait = 0; 1166 1145 if (!(ep->bEndpointAddress & USB_DIR_IN)) { 1167 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1146 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1168 1147 ep->ackwait = 1 + ep->double_buf; 1169 1148 } 1170 1149 } ··· 1196 1175 1197 1176 static int omap_get_frame(struct usb_gadget *gadget) 1198 1177 { 1199 - u16 sof = UDC_SOF_REG; 1178 + u16 sof = omap_readw(UDC_SOF); 1200 1179 return (sof & UDC_TS_OK) ? (sof & UDC_TS) : -EL2NSYNC; 1201 1180 } 1202 1181 ··· 1215 1194 */ 1216 1195 if (udc->devstat & (UDC_B_HNP_ENABLE|UDC_R_WK_OK)) { 1217 1196 DBG("remote wakeup...\n"); 1218 - UDC_SYSCON2_REG = UDC_RMT_WKP; 1197 + omap_writew(UDC_RMT_WKP, UDC_SYSCON2); 1219 1198 retval = 0; 1220 1199 } 1221 1200 ··· 1238 1217 1239 1218 udc = container_of(gadget, struct omap_udc, gadget); 1240 1219 spin_lock_irqsave(&udc->lock, flags); 1241 - syscon1 = UDC_SYSCON1_REG; 1220 + syscon1 = omap_readw(UDC_SYSCON1); 1242 1221 if (is_selfpowered) 1243 1222 syscon1 |= UDC_SELF_PWR; 1244 1223 else 1245 1224 syscon1 &= ~UDC_SELF_PWR; 1246 - UDC_SYSCON1_REG = syscon1; 1225 + omap_writew(syscon1, UDC_SYSCON1); 1247 1226 spin_unlock_irqrestore(&udc->lock, flags); 1248 1227 1249 1228 return 0; ··· 1256 1235 1257 1236 static void pullup_enable(struct omap_udc *udc) 1258 1237 { 1259 - UDC_SYSCON1_REG |= UDC_PULLUP_EN; 1260 - if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) 1261 - OTG_CTRL_REG |= OTG_BSESSVLD; 1262 - UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1238 + u16 w; 1239 + 1240 + w = omap_readw(UDC_SYSCON1); 1241 + w |= UDC_PULLUP_EN; 1242 + omap_writew(w, UDC_SYSCON1); 1243 + if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) { 1244 + u32 l; 1245 + 1246 + l = omap_readl(OTG_CTRL); 1247 + l |= OTG_BSESSVLD; 1248 + omap_writel(l, OTG_CTRL); 1249 + } 1250 + omap_writew(UDC_DS_CHG_IE, UDC_IRQ_EN); 1263 1251 } 1264 1252 1265 1253 static void pullup_disable(struct omap_udc *udc) 1266 1254 { 1267 - if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) 1268 - OTG_CTRL_REG &= ~OTG_BSESSVLD; 1269 - UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1270 - UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; 1255 + u16 w; 1256 + 1257 + if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) { 1258 + u32 l; 1259 + 1260 + l = omap_readl(OTG_CTRL); 1261 + l &= ~OTG_BSESSVLD; 1262 + omap_writel(l, OTG_CTRL); 1263 + } 1264 + omap_writew(UDC_DS_CHG_IE, UDC_IRQ_EN); 1265 + w = omap_readw(UDC_SYSCON1); 1266 + w &= ~UDC_PULLUP_EN; 1267 + omap_writew(w, UDC_SYSCON1); 1271 1268 } 1272 1269 1273 1270 static struct omap_udc *udc; ··· 1313 1274 { 1314 1275 struct omap_udc *udc; 1315 1276 unsigned long flags; 1277 + u32 l; 1316 1278 1317 1279 udc = container_of(gadget, struct omap_udc, gadget); 1318 1280 spin_lock_irqsave(&udc->lock, flags); ··· 1321 1281 udc->vbus_active = (is_active != 0); 1322 1282 if (cpu_is_omap15xx()) { 1323 1283 /* "software" detect, ignored if !VBUS_MODE_1510 */ 1284 + l = omap_readl(FUNC_MUX_CTRL_0); 1324 1285 if (is_active) 1325 - FUNC_MUX_CTRL_0_REG |= VBUS_CTRL_1510; 1286 + l |= VBUS_CTRL_1510; 1326 1287 else 1327 - FUNC_MUX_CTRL_0_REG &= ~VBUS_CTRL_1510; 1288 + l &= ~VBUS_CTRL_1510; 1289 + omap_writel(l, FUNC_MUX_CTRL_0); 1328 1290 } 1329 1291 if (udc->dc_clk != NULL && is_active) { 1330 1292 if (!udc->clk_requested) { ··· 1396 1354 dma_channel_release(ep); 1397 1355 1398 1356 use_ep(ep, 0); 1399 - UDC_CTRL_REG = UDC_CLR_EP; 1357 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1400 1358 if (ep->bEndpointAddress && ep->bmAttributes != USB_ENDPOINT_XFER_ISOC) 1401 - UDC_CTRL_REG = UDC_SET_HALT; 1359 + omap_writew(UDC_SET_HALT, UDC_CTRL); 1402 1360 1403 1361 while (!list_empty(&ep->queue)) { 1404 1362 req = list_entry(ep->queue.next, struct omap_req, queue); ··· 1426 1384 if (!gadget_is_otg(&udc->gadget)) 1427 1385 return; 1428 1386 1429 - if (OTG_CTRL_REG & OTG_ID) 1430 - devstat = UDC_DEVSTAT_REG; 1387 + if (omap_readl(OTG_CTRL) & OTG_ID) 1388 + devstat = omap_readw(UDC_DEVSTAT); 1431 1389 else 1432 1390 devstat = 0; 1433 1391 ··· 1438 1396 /* Enable HNP early, avoiding races on suspend irq path. 1439 1397 * ASSUMES OTG state machine B_BUS_REQ input is true. 1440 1398 */ 1441 - if (udc->gadget.b_hnp_enable) 1442 - OTG_CTRL_REG = (OTG_CTRL_REG | OTG_B_HNPEN | OTG_B_BUSREQ) 1443 - & ~OTG_PULLUP; 1399 + if (udc->gadget.b_hnp_enable) { 1400 + u32 l; 1401 + 1402 + l = omap_readl(OTG_CTRL); 1403 + l |= OTG_B_HNPEN | OTG_B_BUSREQ; 1404 + l &= ~OTG_PULLUP; 1405 + omap_writel(l, OTG_CTRL); 1406 + } 1444 1407 } 1445 1408 1446 1409 static void ep0_irq(struct omap_udc *udc, u16 irq_src) ··· 1463 1416 1464 1417 nuke(ep0, 0); 1465 1418 if (ack) { 1466 - UDC_IRQ_SRC_REG = ack; 1419 + omap_writew(ack, UDC_IRQ_SRC); 1467 1420 irq_src = UDC_SETUP; 1468 1421 } 1469 1422 } ··· 1483 1436 if (irq_src & UDC_EP0_TX) { 1484 1437 int stat; 1485 1438 1486 - UDC_IRQ_SRC_REG = UDC_EP0_TX; 1487 - UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1488 - stat = UDC_STAT_FLG_REG; 1439 + omap_writew(UDC_EP0_TX, UDC_IRQ_SRC); 1440 + omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM); 1441 + stat = omap_readw(UDC_STAT_FLG); 1489 1442 if (stat & UDC_ACK) { 1490 1443 if (udc->ep0_in) { 1491 1444 /* write next IN packet from response, ··· 1493 1446 */ 1494 1447 if (req) 1495 1448 stat = write_fifo(ep0, req); 1496 - UDC_EP_NUM_REG = UDC_EP_DIR; 1449 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1497 1450 if (!req && udc->ep0_pending) { 1498 - UDC_EP_NUM_REG = UDC_EP_SEL; 1499 - UDC_CTRL_REG = UDC_CLR_EP; 1500 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1501 - UDC_EP_NUM_REG = 0; 1451 + omap_writew(UDC_EP_SEL, UDC_EP_NUM); 1452 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1453 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1454 + omap_writew(0, UDC_EP_NUM); 1502 1455 udc->ep0_pending = 0; 1503 1456 } /* else: 6 wait states before it'll tx */ 1504 1457 } else { 1505 1458 /* ack status stage of OUT transfer */ 1506 - UDC_EP_NUM_REG = UDC_EP_DIR; 1459 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1507 1460 if (req) 1508 1461 done(ep0, req, 0); 1509 1462 } 1510 1463 req = NULL; 1511 1464 } else if (stat & UDC_STALL) { 1512 - UDC_CTRL_REG = UDC_CLR_HALT; 1513 - UDC_EP_NUM_REG = UDC_EP_DIR; 1465 + omap_writew(UDC_CLR_HALT, UDC_CTRL); 1466 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1514 1467 } else { 1515 - UDC_EP_NUM_REG = UDC_EP_DIR; 1468 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1516 1469 } 1517 1470 } 1518 1471 ··· 1520 1473 if (irq_src & UDC_EP0_RX) { 1521 1474 int stat; 1522 1475 1523 - UDC_IRQ_SRC_REG = UDC_EP0_RX; 1524 - UDC_EP_NUM_REG = UDC_EP_SEL; 1525 - stat = UDC_STAT_FLG_REG; 1476 + omap_writew(UDC_EP0_RX, UDC_IRQ_SRC); 1477 + omap_writew(UDC_EP_SEL, UDC_EP_NUM); 1478 + stat = omap_readw(UDC_STAT_FLG); 1526 1479 if (stat & UDC_ACK) { 1527 1480 if (!udc->ep0_in) { 1528 1481 stat = 0; ··· 1530 1483 * reactiviting the fifo; stall on errors. 1531 1484 */ 1532 1485 if (!req || (stat = read_fifo(ep0, req)) < 0) { 1533 - UDC_SYSCON2_REG = UDC_STALL_CMD; 1486 + omap_writew(UDC_STALL_CMD, UDC_SYSCON2); 1534 1487 udc->ep0_pending = 0; 1535 1488 stat = 0; 1536 1489 } else if (stat == 0) 1537 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1538 - UDC_EP_NUM_REG = 0; 1490 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1491 + omap_writew(0, UDC_EP_NUM); 1539 1492 1540 1493 /* activate status stage */ 1541 1494 if (stat == 1) { 1542 1495 done(ep0, req, 0); 1543 1496 /* that may have STALLed ep0... */ 1544 - UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1545 - UDC_CTRL_REG = UDC_CLR_EP; 1546 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1547 - UDC_EP_NUM_REG = UDC_EP_DIR; 1497 + omap_writew(UDC_EP_SEL | UDC_EP_DIR, 1498 + UDC_EP_NUM); 1499 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1500 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1501 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1548 1502 udc->ep0_pending = 0; 1549 1503 } 1550 1504 } else { 1551 1505 /* ack status stage of IN transfer */ 1552 - UDC_EP_NUM_REG = 0; 1506 + omap_writew(0, UDC_EP_NUM); 1553 1507 if (req) 1554 1508 done(ep0, req, 0); 1555 1509 } 1556 1510 } else if (stat & UDC_STALL) { 1557 - UDC_CTRL_REG = UDC_CLR_HALT; 1558 - UDC_EP_NUM_REG = 0; 1511 + omap_writew(UDC_CLR_HALT, UDC_CTRL); 1512 + omap_writew(0, UDC_EP_NUM); 1559 1513 } else { 1560 - UDC_EP_NUM_REG = 0; 1514 + omap_writew(0, UDC_EP_NUM); 1561 1515 } 1562 1516 } 1563 1517 ··· 1573 1525 1574 1526 /* read the (latest) SETUP message */ 1575 1527 do { 1576 - UDC_EP_NUM_REG = UDC_SETUP_SEL; 1528 + omap_writew(UDC_SETUP_SEL, UDC_EP_NUM); 1577 1529 /* two bytes at a time */ 1578 - u.word[0] = UDC_DATA_REG; 1579 - u.word[1] = UDC_DATA_REG; 1580 - u.word[2] = UDC_DATA_REG; 1581 - u.word[3] = UDC_DATA_REG; 1582 - UDC_EP_NUM_REG = 0; 1583 - } while (UDC_IRQ_SRC_REG & UDC_SETUP); 1530 + u.word[0] = omap_readw(UDC_DATA); 1531 + u.word[1] = omap_readw(UDC_DATA); 1532 + u.word[2] = omap_readw(UDC_DATA); 1533 + u.word[3] = omap_readw(UDC_DATA); 1534 + omap_writew(0, UDC_EP_NUM); 1535 + } while (omap_readw(UDC_IRQ_SRC) & UDC_SETUP); 1584 1536 1585 1537 #define w_value le16_to_cpu(u.r.wValue) 1586 1538 #define w_index le16_to_cpu(u.r.wIndex) ··· 1611 1563 * later if it fails the request. 1612 1564 */ 1613 1565 if (udc->ep0_reset_config) 1614 - UDC_SYSCON2_REG = UDC_CLR_CFG; 1566 + omap_writew(UDC_CLR_CFG, UDC_SYSCON2); 1615 1567 else 1616 - UDC_SYSCON2_REG = UDC_DEV_CFG; 1568 + omap_writew(UDC_DEV_CFG, UDC_SYSCON2); 1617 1569 update_otg(udc); 1618 1570 goto delegate; 1619 1571 case USB_REQ_CLEAR_FEATURE: ··· 1631 1583 || !ep->desc) 1632 1584 goto do_stall; 1633 1585 use_ep(ep, 0); 1634 - UDC_CTRL_REG = udc->clr_halt; 1586 + omap_writew(udc->clr_halt, UDC_CTRL); 1635 1587 ep->ackwait = 0; 1636 1588 if (!(ep->bEndpointAddress & USB_DIR_IN)) { 1637 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1589 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1638 1590 ep->ackwait = 1 + ep->double_buf; 1639 1591 } 1640 1592 /* NOTE: assumes the host behaves sanely, ··· 1667 1619 } 1668 1620 use_ep(ep, 0); 1669 1621 /* can't halt if fifo isn't empty... */ 1670 - UDC_CTRL_REG = UDC_CLR_EP; 1671 - UDC_CTRL_REG = UDC_SET_HALT; 1622 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1623 + omap_writew(UDC_SET_HALT, UDC_CTRL); 1672 1624 VDBG("%s halted by host\n", ep->name); 1673 1625 ep0out_status_stage: 1674 1626 status = 0; 1675 - UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1676 - UDC_CTRL_REG = UDC_CLR_EP; 1677 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1678 - UDC_EP_NUM_REG = UDC_EP_DIR; 1627 + omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM); 1628 + omap_writew(UDC_CLR_EP, UDC_CTRL); 1629 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1630 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1679 1631 udc->ep0_pending = 0; 1680 1632 break; 1681 1633 case USB_REQ_GET_STATUS: ··· 1712 1664 1713 1665 zero_status: 1714 1666 /* return two zero bytes */ 1715 - UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1716 - UDC_DATA_REG = 0; 1717 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1718 - UDC_EP_NUM_REG = UDC_EP_DIR; 1667 + omap_writew(UDC_EP_SEL|UDC_EP_DIR, UDC_EP_NUM); 1668 + omap_writew(0, UDC_DATA); 1669 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1670 + omap_writew(UDC_EP_DIR, UDC_EP_NUM); 1719 1671 status = 0; 1720 1672 VDBG("GET_STATUS, interface %d\n", w_index); 1721 1673 /* next, status stage */ ··· 1724 1676 delegate: 1725 1677 /* activate the ep0out fifo right away */ 1726 1678 if (!udc->ep0_in && w_length) { 1727 - UDC_EP_NUM_REG = 0; 1728 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1679 + omap_writew(0, UDC_EP_NUM); 1680 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1729 1681 } 1730 1682 1731 1683 /* gadget drivers see class/vendor specific requests, ··· 1766 1718 if (udc->ep0_reset_config) 1767 1719 WARN("error resetting config?\n"); 1768 1720 else 1769 - UDC_SYSCON2_REG = UDC_CLR_CFG; 1721 + omap_writew(UDC_CLR_CFG, UDC_SYSCON2); 1770 1722 } 1771 - UDC_SYSCON2_REG = UDC_STALL_CMD; 1723 + omap_writew(UDC_STALL_CMD, UDC_SYSCON2); 1772 1724 udc->ep0_pending = 0; 1773 1725 } 1774 1726 } ··· 1782 1734 { 1783 1735 u16 devstat, change; 1784 1736 1785 - devstat = UDC_DEVSTAT_REG; 1737 + devstat = omap_readw(UDC_DEVSTAT); 1786 1738 change = devstat ^ udc->devstat; 1787 1739 udc->devstat = devstat; 1788 1740 ··· 1822 1774 INFO("USB reset done, gadget %s\n", 1823 1775 udc->driver->driver.name); 1824 1776 /* ep0 traffic is legal from now on */ 1825 - UDC_IRQ_EN_REG = UDC_DS_CHG_IE | UDC_EP0_IE; 1777 + omap_writew(UDC_DS_CHG_IE | UDC_EP0_IE, 1778 + UDC_IRQ_EN); 1826 1779 } 1827 1780 change &= ~UDC_USB_RESET; 1828 1781 } ··· 1867 1818 VDBG("devstat %03x, ignore change %03x\n", 1868 1819 devstat, change); 1869 1820 1870 - UDC_IRQ_SRC_REG = UDC_DS_CHG; 1821 + omap_writew(UDC_DS_CHG, UDC_IRQ_SRC); 1871 1822 } 1872 1823 1873 1824 static irqreturn_t omap_udc_irq(int irq, void *_udc) ··· 1878 1829 unsigned long flags; 1879 1830 1880 1831 spin_lock_irqsave(&udc->lock, flags); 1881 - irq_src = UDC_IRQ_SRC_REG; 1832 + irq_src = omap_readw(UDC_IRQ_SRC); 1882 1833 1883 1834 /* Device state change (usb ch9 stuff) */ 1884 1835 if (irq_src & UDC_DS_CHG) { ··· 1901 1852 irq_src &= ~(UDC_TXN_DONE|UDC_RXN_CNT|UDC_RXN_EOT); 1902 1853 } 1903 1854 1904 - irq_src &= ~(UDC_SOF|UDC_EPN_TX|UDC_EPN_RX); 1855 + irq_src &= ~(UDC_IRQ_SOF | UDC_EPN_TX|UDC_EPN_RX); 1905 1856 if (irq_src) 1906 1857 DBG("udc_irq, unhandled %03x\n", irq_src); 1907 1858 spin_unlock_irqrestore(&udc->lock, flags); ··· 1922 1873 spin_lock_irqsave(&ep->udc->lock, flags); 1923 1874 if (!list_empty(&ep->queue) && ep->ackwait) { 1924 1875 use_ep(ep, UDC_EP_SEL); 1925 - stat_flg = UDC_STAT_FLG_REG; 1876 + stat_flg = omap_readw(UDC_STAT_FLG); 1926 1877 1927 1878 if ((stat_flg & UDC_ACK) && (!(stat_flg & UDC_FIFO_EN) 1928 1879 || (ep->double_buf && HALF_FULL(stat_flg)))) { ··· 1932 1883 req = container_of(ep->queue.next, 1933 1884 struct omap_req, queue); 1934 1885 (void) read_fifo(ep, req); 1935 - UDC_EP_NUM_REG = ep->bEndpointAddress; 1936 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1886 + omap_writew(ep->bEndpointAddress, UDC_EP_NUM); 1887 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1937 1888 ep->ackwait = 1 + ep->double_buf; 1938 1889 } else 1939 1890 deselect_ep(); ··· 1953 1904 unsigned long flags; 1954 1905 1955 1906 spin_lock_irqsave(&udc->lock, flags); 1956 - epn_stat = UDC_EPN_STAT_REG; 1957 - irq_src = UDC_IRQ_SRC_REG; 1907 + epn_stat = omap_readw(UDC_EPN_STAT); 1908 + irq_src = omap_readw(UDC_IRQ_SRC); 1958 1909 1959 1910 /* handle OUT first, to avoid some wasteful NAKs */ 1960 1911 if (irq_src & UDC_EPN_RX) { 1961 1912 epnum = (epn_stat >> 8) & 0x0f; 1962 - UDC_IRQ_SRC_REG = UDC_EPN_RX; 1913 + omap_writew(UDC_EPN_RX, UDC_IRQ_SRC); 1963 1914 status = IRQ_HANDLED; 1964 1915 ep = &udc->ep[epnum]; 1965 1916 ep->irqs++; 1966 1917 1967 - UDC_EP_NUM_REG = epnum | UDC_EP_SEL; 1918 + omap_writew(epnum | UDC_EP_SEL, UDC_EP_NUM); 1968 1919 ep->fnf = 0; 1969 - if ((UDC_STAT_FLG_REG & UDC_ACK)) { 1920 + if (omap_readw(UDC_STAT_FLG) & UDC_ACK) { 1970 1921 ep->ackwait--; 1971 1922 if (!list_empty(&ep->queue)) { 1972 1923 int stat; ··· 1978 1929 } 1979 1930 } 1980 1931 /* min 6 clock delay before clearing EP_SEL ... */ 1981 - epn_stat = UDC_EPN_STAT_REG; 1982 - epn_stat = UDC_EPN_STAT_REG; 1983 - UDC_EP_NUM_REG = epnum; 1932 + epn_stat = omap_readw(UDC_EPN_STAT); 1933 + epn_stat = omap_readw(UDC_EPN_STAT); 1934 + omap_writew(epnum, UDC_EP_NUM); 1984 1935 1985 1936 /* enabling fifo _after_ clearing ACK, contrary to docs, 1986 1937 * reduces lossage; timer still needed though (sigh). 1987 1938 */ 1988 1939 if (ep->fnf) { 1989 - UDC_CTRL_REG = UDC_SET_FIFO_EN; 1940 + omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); 1990 1941 ep->ackwait = 1 + ep->double_buf; 1991 1942 } 1992 1943 mod_timer(&ep->timer, PIO_OUT_TIMEOUT); ··· 1995 1946 /* then IN transfers */ 1996 1947 else if (irq_src & UDC_EPN_TX) { 1997 1948 epnum = epn_stat & 0x0f; 1998 - UDC_IRQ_SRC_REG = UDC_EPN_TX; 1949 + omap_writew(UDC_EPN_TX, UDC_IRQ_SRC); 1999 1950 status = IRQ_HANDLED; 2000 1951 ep = &udc->ep[16 + epnum]; 2001 1952 ep->irqs++; 2002 1953 2003 - UDC_EP_NUM_REG = epnum | UDC_EP_DIR | UDC_EP_SEL; 2004 - if ((UDC_STAT_FLG_REG & UDC_ACK)) { 1954 + omap_writew(epnum | UDC_EP_DIR | UDC_EP_SEL, UDC_EP_NUM); 1955 + if (omap_readw(UDC_STAT_FLG) & UDC_ACK) { 2005 1956 ep->ackwait = 0; 2006 1957 if (!list_empty(&ep->queue)) { 2007 1958 req = container_of(ep->queue.next, ··· 2010 1961 } 2011 1962 } 2012 1963 /* min 6 clock delay before clearing EP_SEL ... */ 2013 - epn_stat = UDC_EPN_STAT_REG; 2014 - epn_stat = UDC_EPN_STAT_REG; 2015 - UDC_EP_NUM_REG = epnum | UDC_EP_DIR; 1964 + epn_stat = omap_readw(UDC_EPN_STAT); 1965 + epn_stat = omap_readw(UDC_EPN_STAT); 1966 + omap_writew(epnum | UDC_EP_DIR, UDC_EP_NUM); 2016 1967 /* then 6 clocks before it'd tx */ 2017 1968 } 2018 1969 ··· 2040 1991 req = list_entry(ep->queue.next, struct omap_req, queue); 2041 1992 2042 1993 use_ep(ep, UDC_EP_SEL); 2043 - stat = UDC_STAT_FLG_REG; 1994 + stat = omap_readw(UDC_STAT_FLG); 2044 1995 2045 1996 /* NOTE: like the other controller drivers, this isn't 2046 1997 * currently reporting lost or damaged frames. ··· 2072 2023 if (!list_empty(&ep->queue)) 2073 2024 pending = 1; 2074 2025 } 2075 - if (!pending) 2076 - UDC_IRQ_EN_REG &= ~UDC_SOF_IE; 2077 - UDC_IRQ_SRC_REG = UDC_SOF; 2026 + if (!pending) { 2027 + u16 w; 2028 + 2029 + w = omap_readw(UDC_IRQ_EN); 2030 + w &= ~UDC_SOF_IE; 2031 + omap_writew(w, UDC_IRQ_EN); 2032 + } 2033 + omap_writew(UDC_IRQ_SOF, UDC_IRQ_SRC); 2078 2034 2079 2035 spin_unlock_irqrestore(&udc->lock, flags); 2080 2036 return IRQ_HANDLED; ··· 2128 2074 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) 2129 2075 continue; 2130 2076 use_ep(ep, 0); 2131 - UDC_CTRL_REG = UDC_SET_HALT; 2077 + omap_writew(UDC_SET_HALT, UDC_CTRL); 2132 2078 } 2133 2079 udc->ep0_pending = 0; 2134 2080 udc->ep[0].irqs = 0; ··· 2152 2098 } 2153 2099 DBG("bound to driver %s\n", driver->driver.name); 2154 2100 2155 - UDC_IRQ_SRC_REG = UDC_IRQ_SRC_MASK; 2101 + omap_writew(UDC_IRQ_SRC_MASK, UDC_IRQ_SRC); 2156 2102 2157 2103 /* connect to bus through transceiver */ 2158 2104 if (udc->transceiver) { ··· 2249 2195 else 2250 2196 buf[0] = 0; 2251 2197 2252 - stat_flg = UDC_STAT_FLG_REG; 2198 + stat_flg = omap_readw(UDC_STAT_FLG); 2253 2199 seq_printf(s, 2254 2200 "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS "%s\n", 2255 2201 ep->name, buf, ··· 2316 2262 trans = CONTROL_DEVCONF_REG; 2317 2263 } else { 2318 2264 ctrl_name = "tranceiver_ctrl"; 2319 - trans = USB_TRANSCEIVER_CTRL_REG; 2265 + trans = omap_readw(USB_TRANSCEIVER_CTRL); 2320 2266 } 2321 2267 seq_printf(s, "\nOTG rev %d.%d, %s %05x\n", 2322 2268 tmp >> 4, tmp & 0xf, ctrl_name, trans); 2323 - tmp = OTG_SYSCON_1_REG; 2269 + tmp = omap_readw(OTG_SYSCON_1); 2324 2270 seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s," 2325 2271 FOURBITS "\n", tmp, 2326 2272 trx_mode(USB2_TRX_MODE(tmp), trans & CONF_USB2_UNI_R), ··· 2332 2278 (tmp & HST_IDLE_EN) ? " !host" : "", 2333 2279 (tmp & DEV_IDLE_EN) ? " !dev" : "", 2334 2280 (tmp & OTG_RESET_DONE) ? " reset_done" : " reset_active"); 2335 - tmp = OTG_SYSCON_2_REG; 2281 + tmp = omap_readl(OTG_SYSCON_2); 2336 2282 seq_printf(s, "otg_syscon2 %08x%s" EIGHTBITS 2337 2283 " b_ase_brst=%d hmc=%d\n", tmp, 2338 2284 (tmp & OTG_EN) ? " otg_en" : "", ··· 2347 2293 (tmp & HMC_TLLATTACH) ? " tllattach" : "", 2348 2294 B_ASE_BRST(tmp), 2349 2295 OTG_HMC(tmp)); 2350 - tmp = OTG_CTRL_REG; 2296 + tmp = omap_readl(OTG_CTRL); 2351 2297 seq_printf(s, "otg_ctrl %06x" EIGHTBITS EIGHTBITS "%s\n", tmp, 2352 2298 (tmp & OTG_ASESSVLD) ? " asess" : "", 2353 2299 (tmp & OTG_BSESSEND) ? " bsess_end" : "", ··· 2367 2313 (tmp & OTG_PU_VBUS) ? " pu_vb" : "", 2368 2314 (tmp & OTG_PU_ID) ? " pu_id" : "" 2369 2315 ); 2370 - tmp = OTG_IRQ_EN_REG; 2316 + tmp = omap_readw(OTG_IRQ_EN); 2371 2317 seq_printf(s, "otg_irq_en %04x" "\n", tmp); 2372 - tmp = OTG_IRQ_SRC_REG; 2318 + tmp = omap_readw(OTG_IRQ_SRC); 2373 2319 seq_printf(s, "otg_irq_src %04x" "\n", tmp); 2374 - tmp = OTG_OUTCTRL_REG; 2320 + tmp = omap_readw(OTG_OUTCTRL); 2375 2321 seq_printf(s, "otg_outctrl %04x" "\n", tmp); 2376 - tmp = OTG_TEST_REG; 2322 + tmp = omap_readw(OTG_TEST); 2377 2323 seq_printf(s, "otg_test %04x" "\n", tmp); 2378 2324 return 0; 2379 2325 } ··· 2394 2340 driver_desc, 2395 2341 use_dma ? " (dma)" : ""); 2396 2342 2397 - tmp = UDC_REV_REG & 0xff; 2343 + tmp = omap_readw(UDC_REV) & 0xff; 2398 2344 seq_printf(s, 2399 2345 "UDC rev %d.%d, fifo mode %d, gadget %s\n" 2400 2346 "hmc %d, transceiver %s\n", ··· 2408 2354 ? "external" : "(none)")); 2409 2355 if (cpu_class_is_omap1()) { 2410 2356 seq_printf(s, "ULPD control %04x req %04x status %04x\n", 2411 - __REG16(ULPD_CLOCK_CTRL), 2412 - __REG16(ULPD_SOFT_REQ), 2413 - __REG16(ULPD_STATUS_REQ)); 2357 + omap_readw(ULPD_CLOCK_CTRL), 2358 + omap_readw(ULPD_SOFT_REQ), 2359 + omap_readw(ULPD_STATUS_REQ)); 2414 2360 } 2415 2361 2416 2362 /* OTG controller registers */ 2417 2363 if (!cpu_is_omap15xx()) 2418 2364 proc_otg_show(s); 2419 2365 2420 - tmp = UDC_SYSCON1_REG; 2366 + tmp = omap_readw(UDC_SYSCON1); 2421 2367 seq_printf(s, "\nsyscon1 %04x" EIGHTBITS "\n", tmp, 2422 2368 (tmp & UDC_CFG_LOCK) ? " cfg_lock" : "", 2423 2369 (tmp & UDC_DATA_ENDIAN) ? " data_endian" : "", ··· 2436 2382 return 0; 2437 2383 } 2438 2384 2439 - tmp = UDC_DEVSTAT_REG; 2385 + tmp = omap_readw(UDC_DEVSTAT); 2440 2386 seq_printf(s, "devstat %04x" EIGHTBITS "%s%s\n", tmp, 2441 2387 (tmp & UDC_B_HNP_ENABLE) ? " b_hnp" : "", 2442 2388 (tmp & UDC_A_HNP_SUPPORT) ? " a_hnp" : "", ··· 2448 2394 (tmp & UDC_ADD) ? " ADD" : "", 2449 2395 (tmp & UDC_DEF) ? " DEF" : "", 2450 2396 (tmp & UDC_ATT) ? " ATT" : ""); 2451 - seq_printf(s, "sof %04x\n", UDC_SOF_REG); 2452 - tmp = UDC_IRQ_EN_REG; 2397 + seq_printf(s, "sof %04x\n", omap_readw(UDC_SOF)); 2398 + tmp = omap_readw(UDC_IRQ_EN); 2453 2399 seq_printf(s, "irq_en %04x" FOURBITS "%s\n", tmp, 2454 2400 (tmp & UDC_SOF_IE) ? " sof" : "", 2455 2401 (tmp & UDC_EPN_RX_IE) ? " epn_rx" : "", 2456 2402 (tmp & UDC_EPN_TX_IE) ? " epn_tx" : "", 2457 2403 (tmp & UDC_DS_CHG_IE) ? " ds_chg" : "", 2458 2404 (tmp & UDC_EP0_IE) ? " ep0" : ""); 2459 - tmp = UDC_IRQ_SRC_REG; 2405 + tmp = omap_readw(UDC_IRQ_SRC); 2460 2406 seq_printf(s, "irq_src %04x" EIGHTBITS "%s%s\n", tmp, 2461 2407 (tmp & UDC_TXN_DONE) ? " txn_done" : "", 2462 2408 (tmp & UDC_RXN_CNT) ? " rxn_cnt" : "", 2463 2409 (tmp & UDC_RXN_EOT) ? " rxn_eot" : "", 2464 - (tmp & UDC_SOF) ? " sof" : "", 2410 + (tmp & UDC_IRQ_SOF) ? " sof" : "", 2465 2411 (tmp & UDC_EPN_RX) ? " epn_rx" : "", 2466 2412 (tmp & UDC_EPN_TX) ? " epn_tx" : "", 2467 2413 (tmp & UDC_DS_CHG) ? " ds_chg" : "", ··· 2471 2417 if (use_dma) { 2472 2418 unsigned i; 2473 2419 2474 - tmp = UDC_DMA_IRQ_EN_REG; 2420 + tmp = omap_readw(UDC_DMA_IRQ_EN); 2475 2421 seq_printf(s, "dma_irq_en %04x%s" EIGHTBITS "\n", tmp, 2476 2422 (tmp & UDC_TX_DONE_IE(3)) ? " tx2_done" : "", 2477 2423 (tmp & UDC_RX_CNT_IE(3)) ? " rx2_cnt" : "", ··· 2485 2431 (tmp & UDC_RX_CNT_IE(1)) ? " rx0_cnt" : "", 2486 2432 (tmp & UDC_RX_EOT_IE(1)) ? " rx0_eot" : ""); 2487 2433 2488 - tmp = UDC_RXDMA_CFG_REG; 2434 + tmp = omap_readw(UDC_RXDMA_CFG); 2489 2435 seq_printf(s, "rxdma_cfg %04x\n", tmp); 2490 2436 if (tmp) { 2491 2437 for (i = 0; i < 3; i++) { 2492 2438 if ((tmp & (0x0f << (i * 4))) == 0) 2493 2439 continue; 2494 2440 seq_printf(s, "rxdma[%d] %04x\n", i, 2495 - UDC_RXDMA_REG(i + 1)); 2441 + omap_readw(UDC_RXDMA(i + 1))); 2496 2442 } 2497 2443 } 2498 - tmp = UDC_TXDMA_CFG_REG; 2444 + tmp = omap_readw(UDC_TXDMA_CFG); 2499 2445 seq_printf(s, "txdma_cfg %04x\n", tmp); 2500 2446 if (tmp) { 2501 2447 for (i = 0; i < 3; i++) { 2502 2448 if (!(tmp & (0x0f << (i * 4)))) 2503 2449 continue; 2504 2450 seq_printf(s, "txdma[%d] %04x\n", i, 2505 - UDC_TXDMA_REG(i + 1)); 2451 + omap_readw(UDC_TXDMA(i + 1))); 2506 2452 } 2507 2453 } 2508 2454 } 2509 2455 2510 - tmp = UDC_DEVSTAT_REG; 2456 + tmp = omap_readw(UDC_DEVSTAT); 2511 2457 if (tmp & UDC_ATT) { 2512 2458 proc_ep_show(s, &udc->ep[0]); 2513 2459 if (tmp & UDC_ADD) { ··· 2559 2505 * buffer space among the endpoints we'll be operating. 2560 2506 * 2561 2507 * NOTE: as of OMAP 1710 ES2.0, writing a new endpoint config when 2562 - * UDC_SYSCON_1_REG.CFG_LOCK is set can now work. We won't use that 2508 + * UDC_SYSCON_1.CFG_LOCK is set can now work. We won't use that 2563 2509 * capability yet though. 2564 2510 */ 2565 2511 static unsigned __init ··· 2621 2567 name, addr, epn_rxtx, maxp, dbuf ? "x2" : "", buf); 2622 2568 2623 2569 if (addr & USB_DIR_IN) 2624 - UDC_EP_TX_REG(addr & 0xf) = epn_rxtx; 2570 + omap_writew(epn_rxtx, UDC_EP_TX(addr & 0xf)); 2625 2571 else 2626 - UDC_EP_RX_REG(addr) = epn_rxtx; 2572 + omap_writew(epn_rxtx, UDC_EP_RX(addr)); 2627 2573 2628 2574 /* next endpoint's buffer starts after this one's */ 2629 2575 buf += maxp; ··· 2662 2608 unsigned tmp, buf; 2663 2609 2664 2610 /* abolish any previous hardware state */ 2665 - UDC_SYSCON1_REG = 0; 2666 - UDC_IRQ_EN_REG = 0; 2667 - UDC_IRQ_SRC_REG = UDC_IRQ_SRC_MASK; 2668 - UDC_DMA_IRQ_EN_REG = 0; 2669 - UDC_RXDMA_CFG_REG = 0; 2670 - UDC_TXDMA_CFG_REG = 0; 2611 + omap_writew(0, UDC_SYSCON1); 2612 + omap_writew(0, UDC_IRQ_EN); 2613 + omap_writew(UDC_IRQ_SRC_MASK, UDC_IRQ_SRC); 2614 + omap_writew(0, UDC_DMA_IRQ_EN); 2615 + omap_writew(0, UDC_RXDMA_CFG); 2616 + omap_writew(0, UDC_TXDMA_CFG); 2671 2617 2672 2618 /* UDC_PULLUP_EN gates the chip clock */ 2673 - // OTG_SYSCON_1_REG |= DEV_IDLE_EN; 2619 + // OTG_SYSCON_1 |= DEV_IDLE_EN; 2674 2620 2675 2621 udc = kzalloc(sizeof(*udc), GFP_KERNEL); 2676 2622 if (!udc) ··· 2701 2647 2702 2648 /* initially disable all non-ep0 endpoints */ 2703 2649 for (tmp = 1; tmp < 15; tmp++) { 2704 - UDC_EP_RX_REG(tmp) = 0; 2705 - UDC_EP_TX_REG(tmp) = 0; 2650 + omap_writew(0, UDC_EP_RX(tmp)); 2651 + omap_writew(0, UDC_EP_TX(tmp)); 2706 2652 } 2707 2653 2708 2654 #define OMAP_BULK_EP(name,addr) \ ··· 2787 2733 ERR("unsupported fifo_mode #%d\n", fifo_mode); 2788 2734 return -ENODEV; 2789 2735 } 2790 - UDC_SYSCON1_REG = UDC_CFG_LOCK|UDC_SELF_PWR; 2736 + omap_writew(UDC_CFG_LOCK|UDC_SELF_PWR, UDC_SYSCON1); 2791 2737 INFO("fifo mode %d, %d bytes not used\n", fifo_mode, 2048 - buf); 2792 2738 return 0; 2793 2739 } ··· 2831 2777 } 2832 2778 2833 2779 INFO("OMAP UDC rev %d.%d%s\n", 2834 - UDC_REV_REG >> 4, UDC_REV_REG & 0xf, 2780 + omap_readw(UDC_REV) >> 4, omap_readw(UDC_REV) & 0xf, 2835 2781 config->otg ? ", Mini-AB" : ""); 2836 2782 2837 2783 /* use the mode given to us by board init code */ ··· 2846 2792 * know when to turn PULLUP_EN on/off; and that 2847 2793 * means we always "need" the 48MHz clock. 2848 2794 */ 2849 - u32 tmp = FUNC_MUX_CTRL_0_REG; 2850 - 2851 - FUNC_MUX_CTRL_0_REG &= ~VBUS_CTRL_1510; 2795 + u32 tmp = omap_readl(FUNC_MUX_CTRL_0); 2796 + tmp &= ~VBUS_CTRL_1510; 2797 + omap_writel(tmp, FUNC_MUX_CTRL_0); 2852 2798 tmp |= VBUS_MODE_1510; 2853 2799 tmp &= ~VBUS_CTRL_1510; 2854 - FUNC_MUX_CTRL_0_REG = tmp; 2800 + omap_writel(tmp, FUNC_MUX_CTRL_0); 2855 2801 } 2856 2802 } else { 2857 2803 /* The transceiver may package some GPIO logic or handle ··· 2931 2877 #endif 2932 2878 2933 2879 /* starting with omap1710 es2.0, clear toggle is a separate bit */ 2934 - if (UDC_REV_REG >= 0x61) 2880 + if (omap_readw(UDC_REV) >= 0x61) 2935 2881 udc->clr_halt = UDC_RESET_EP | UDC_CLRDATA_TOGGLE; 2936 2882 else 2937 2883 udc->clr_halt = UDC_RESET_EP; ··· 3029 2975 put_device(udc->transceiver->dev); 3030 2976 udc->transceiver = NULL; 3031 2977 } 3032 - UDC_SYSCON1_REG = 0; 2978 + omap_writew(0, UDC_SYSCON1); 3033 2979 3034 2980 remove_proc_file(); 3035 2981 ··· 3060 3006 * 3061 3007 * REVISIT we should probably reject suspend requests when there's a host 3062 3008 * session active, rather than disconnecting, at least on boards that can 3063 - * report VBUS irqs (UDC_DEVSTAT_REG.UDC_ATT). And in any case, we need to 3009 + * report VBUS irqs (UDC_DEVSTAT.UDC_ATT). And in any case, we need to 3064 3010 * make host resumes and VBUS detection trigger OMAP wakeup events; that 3065 3011 * may involve talking to an external transceiver (e.g. isp1301). 3066 3012 */ ··· 3069 3015 { 3070 3016 u32 devstat; 3071 3017 3072 - devstat = UDC_DEVSTAT_REG; 3018 + devstat = omap_readw(UDC_DEVSTAT); 3073 3019 3074 3020 /* we're requesting 48 MHz clock if the pullup is enabled 3075 3021 * (== we're attached to the host) and we're not suspended,
+30 -31
drivers/usb/gadget/omap_udc.h
··· 8 8 /* 9 9 * USB device/endpoint management registers 10 10 */ 11 - #define UDC_REG(offset) __REG16(UDC_BASE + (offset)) 12 11 13 - #define UDC_REV_REG UDC_REG(0x0) /* Revision */ 14 - #define UDC_EP_NUM_REG UDC_REG(0x4) /* Which endpoint */ 12 + #define UDC_REV (UDC_BASE + 0x0) /* Revision */ 13 + #define UDC_EP_NUM (UDC_BASE + 0x4) /* Which endpoint */ 15 14 # define UDC_SETUP_SEL (1 << 6) 16 15 # define UDC_EP_SEL (1 << 5) 17 16 # define UDC_EP_DIR (1 << 4) 18 17 /* low 4 bits for endpoint number */ 19 - #define UDC_DATA_REG UDC_REG(0x08) /* Endpoint FIFO */ 20 - #define UDC_CTRL_REG UDC_REG(0x0C) /* Endpoint control */ 18 + #define UDC_DATA (UDC_BASE + 0x08) /* Endpoint FIFO */ 19 + #define UDC_CTRL (UDC_BASE + 0x0C) /* Endpoint control */ 21 20 # define UDC_CLR_HALT (1 << 7) 22 21 # define UDC_SET_HALT (1 << 6) 23 22 # define UDC_CLRDATA_TOGGLE (1 << 3) 24 23 # define UDC_SET_FIFO_EN (1 << 2) 25 24 # define UDC_CLR_EP (1 << 1) 26 25 # define UDC_RESET_EP (1 << 0) 27 - #define UDC_STAT_FLG_REG UDC_REG(0x10) /* Endpoint status */ 26 + #define UDC_STAT_FLG (UDC_BASE + 0x10) /* Endpoint status */ 28 27 # define UDC_NO_RXPACKET (1 << 15) 29 28 # define UDC_MISS_IN (1 << 14) 30 29 # define UDC_DATA_FLUSH (1 << 13) ··· 37 38 # define UDC_FIFO_EN (1 << 2) 38 39 # define UDC_NON_ISO_FIFO_EMPTY (1 << 1) 39 40 # define UDC_NON_ISO_FIFO_FULL (1 << 0) 40 - #define UDC_RXFSTAT_REG UDC_REG(0x14) /* OUT bytecount */ 41 - #define UDC_SYSCON1_REG UDC_REG(0x18) /* System config 1 */ 41 + #define UDC_RXFSTAT (UDC_BASE + 0x14) /* OUT bytecount */ 42 + #define UDC_SYSCON1 (UDC_BASE + 0x18) /* System config 1 */ 42 43 # define UDC_CFG_LOCK (1 << 8) 43 44 # define UDC_DATA_ENDIAN (1 << 7) 44 45 # define UDC_DMA_ENDIAN (1 << 6) ··· 47 48 # define UDC_SELF_PWR (1 << 2) 48 49 # define UDC_SOFF_DIS (1 << 1) 49 50 # define UDC_PULLUP_EN (1 << 0) 50 - #define UDC_SYSCON2_REG UDC_REG(0x1C) /* System config 2 */ 51 + #define UDC_SYSCON2 (UDC_BASE + 0x1C) /* System config 2 */ 51 52 # define UDC_RMT_WKP (1 << 6) 52 53 # define UDC_STALL_CMD (1 << 5) 53 54 # define UDC_DEV_CFG (1 << 3) 54 55 # define UDC_CLR_CFG (1 << 2) 55 - #define UDC_DEVSTAT_REG UDC_REG(0x20) /* Device status */ 56 + #define UDC_DEVSTAT (UDC_BASE + 0x20) /* Device status */ 56 57 # define UDC_B_HNP_ENABLE (1 << 9) 57 58 # define UDC_A_HNP_SUPPORT (1 << 8) 58 59 # define UDC_A_ALT_HNP_SUPPORT (1 << 7) ··· 63 64 # define UDC_ADD (1 << 2) 64 65 # define UDC_DEF (1 << 1) 65 66 # define UDC_ATT (1 << 0) 66 - #define UDC_SOF_REG UDC_REG(0x24) /* Start of frame */ 67 + #define UDC_SOF (UDC_BASE + 0x24) /* Start of frame */ 67 68 # define UDC_FT_LOCK (1 << 12) 68 69 # define UDC_TS_OK (1 << 11) 69 70 # define UDC_TS 0x03ff 70 - #define UDC_IRQ_EN_REG UDC_REG(0x28) /* Interrupt enable */ 71 + #define UDC_IRQ_EN (UDC_BASE + 0x28) /* Interrupt enable */ 71 72 # define UDC_SOF_IE (1 << 7) 72 73 # define UDC_EPN_RX_IE (1 << 5) 73 74 # define UDC_EPN_TX_IE (1 << 4) 74 75 # define UDC_DS_CHG_IE (1 << 3) 75 76 # define UDC_EP0_IE (1 << 0) 76 - #define UDC_DMA_IRQ_EN_REG UDC_REG(0x2C) /* DMA irq enable */ 77 + #define UDC_DMA_IRQ_EN (UDC_BASE + 0x2C) /* DMA irq enable */ 77 78 /* rx/tx dma channels numbered 1-3 not 0-2 */ 78 79 # define UDC_TX_DONE_IE(n) (1 << (4 * (n) - 2)) 79 80 # define UDC_RX_CNT_IE(n) (1 << (4 * (n) - 3)) 80 81 # define UDC_RX_EOT_IE(n) (1 << (4 * (n) - 4)) 81 - #define UDC_IRQ_SRC_REG UDC_REG(0x30) /* Interrupt source */ 82 + #define UDC_IRQ_SRC (UDC_BASE + 0x30) /* Interrupt source */ 82 83 # define UDC_TXN_DONE (1 << 10) 83 84 # define UDC_RXN_CNT (1 << 9) 84 85 # define UDC_RXN_EOT (1 << 8) 85 - # define UDC_SOF (1 << 7) 86 + # define UDC_IRQ_SOF (1 << 7) 86 87 # define UDC_EPN_RX (1 << 5) 87 88 # define UDC_EPN_TX (1 << 4) 88 89 # define UDC_DS_CHG (1 << 3) ··· 90 91 # define UDC_EP0_RX (1 << 1) 91 92 # define UDC_EP0_TX (1 << 0) 92 93 # define UDC_IRQ_SRC_MASK 0x7bf 93 - #define UDC_EPN_STAT_REG UDC_REG(0x34) /* EP irq status */ 94 - #define UDC_DMAN_STAT_REG UDC_REG(0x38) /* DMA irq status */ 94 + #define UDC_EPN_STAT (UDC_BASE + 0x34) /* EP irq status */ 95 + #define UDC_DMAN_STAT (UDC_BASE + 0x38) /* DMA irq status */ 95 96 # define UDC_DMA_RX_SB (1 << 12) 96 97 # define UDC_DMA_RX_SRC(x) (((x)>>8) & 0xf) 97 98 # define UDC_DMA_TX_SRC(x) (((x)>>0) & 0xf) 98 99 99 100 100 101 /* DMA configuration registers: up to three channels in each direction. */ 101 - #define UDC_RXDMA_CFG_REG UDC_REG(0x40) /* 3 eps for RX DMA */ 102 + #define UDC_RXDMA_CFG (UDC_BASE + 0x40) /* 3 eps for RX DMA */ 102 103 # define UDC_DMA_REQ (1 << 12) 103 - #define UDC_TXDMA_CFG_REG UDC_REG(0x44) /* 3 eps for TX DMA */ 104 - #define UDC_DATA_DMA_REG UDC_REG(0x48) /* rx/tx fifo addr */ 104 + #define UDC_TXDMA_CFG (UDC_BASE + 0x44) /* 3 eps for TX DMA */ 105 + #define UDC_DATA_DMA (UDC_BASE + 0x48) /* rx/tx fifo addr */ 105 106 106 107 /* rx/tx dma control, numbering channels 1-3 not 0-2 */ 107 - #define UDC_TXDMA_REG(chan) UDC_REG(0x50 - 4 + 4 * (chan)) 108 + #define UDC_TXDMA(chan) (UDC_BASE + 0x50 - 4 + 4 * (chan)) 108 109 # define UDC_TXN_EOT (1 << 15) /* bytes vs packets */ 109 110 # define UDC_TXN_START (1 << 14) /* start transfer */ 110 111 # define UDC_TXN_TSC 0x03ff /* units in xfer */ 111 - #define UDC_RXDMA_REG(chan) UDC_REG(0x60 - 4 + 4 * (chan)) 112 + #define UDC_RXDMA(chan) (UDC_BASE + 0x60 - 4 + 4 * (chan)) 112 113 # define UDC_RXN_STOP (1 << 15) /* enable EOT irq */ 113 114 # define UDC_RXN_TC 0x00ff /* packets in xfer */ 114 115 115 116 116 117 /* 117 118 * Endpoint configuration registers (used before CFG_LOCK is set) 118 - * UDC_EP_TX_REG(0) is unused 119 + * UDC_EP_TX(0) is unused 119 120 */ 120 - #define UDC_EP_RX_REG(endpoint) UDC_REG(0x80 + (endpoint)*4) 121 + #define UDC_EP_RX(endpoint) (UDC_BASE + 0x80 + (endpoint)*4) 121 122 # define UDC_EPN_RX_VALID (1 << 15) 122 123 # define UDC_EPN_RX_DB (1 << 14) 123 124 /* buffer size in bits 13, 12 */ 124 125 # define UDC_EPN_RX_ISO (1 << 11) 125 126 /* buffer pointer in low 11 bits */ 126 - #define UDC_EP_TX_REG(endpoint) UDC_REG(0xc0 + (endpoint)*4) 127 - /* same bitfields as in RX_REG */ 127 + #define UDC_EP_TX(endpoint) (UDC_BASE + 0xc0 + (endpoint)*4) 128 + /* same bitfields as in RX */ 128 129 129 130 /*-------------------------------------------------------------------------*/ 130 131 ··· 194 195 195 196 /*-------------------------------------------------------------------------*/ 196 197 197 - #define MOD_CONF_CTRL_0_REG __REG32(MOD_CONF_CTRL_0) 198 - #define VBUS_W2FC_1510 (1 << 17) /* 0 gpio0, 1 dvdd2 pin */ 198 + /* MOD_CONF_CTRL_0 */ 199 + #define VBUS_W2FC_1510 (1 << 17) /* 0 gpio0, 1 dvdd2 pin */ 199 200 200 - #define FUNC_MUX_CTRL_0_REG __REG32(FUNC_MUX_CTRL_0) 201 + /* FUNC_MUX_CTRL_0 */ 201 202 #define VBUS_CTRL_1510 (1 << 19) /* 1 connected (software) */ 202 203 #define VBUS_MODE_1510 (1 << 18) /* 0 hardware, 1 software */ 203 204 204 - #define HMC_1510 ((MOD_CONF_CTRL_0_REG >> 1) & 0x3f) 205 - #define HMC_1610 (OTG_SYSCON_2_REG & 0x3f) 205 + #define HMC_1510 ((omap_readl(MOD_CONF_CTRL_0) >> 1) & 0x3f) 206 + #define HMC_1610 (omap_readl(OTG_SYSCON_2) & 0x3f) 206 207 #define HMC (cpu_is_omap15xx() ? HMC_1510 : HMC_1610) 207 208
+4 -1
drivers/usb/host/ohci-omap.c
··· 169 169 { 170 170 const unsigned port = ohci_to_hcd(ohci)->self.otg_port - 1; 171 171 unsigned long flags; 172 + u32 l; 172 173 173 174 otg_start_hnp(ohci->transceiver); 174 175 175 176 local_irq_save(flags); 176 177 ohci->transceiver->state = OTG_STATE_A_SUSPEND; 177 178 writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); 178 - OTG_CTRL_REG &= ~OTG_A_BUSREQ; 179 + l = omap_readl(OTG_CTRL); 180 + l &= ~OTG_A_BUSREQ; 181 + omap_writel(l, OTG_CTRL); 179 182 local_irq_restore(flags); 180 183 } 181 184
+10 -13
include/asm-arm/arch-omap/usb.h
··· 34 34 /* 35 35 * OTG and transceiver registers, for OMAPs starting with ARM926 36 36 */ 37 - #define OTG_REG32(offset) __REG32(OTG_BASE + (offset)) 38 - #define OTG_REG16(offset) __REG16(OTG_BASE + (offset)) 39 - 40 - #define OTG_REV_REG OTG_REG32(0x00) 41 - #define OTG_SYSCON_1_REG OTG_REG32(0x04) 37 + #define OTG_REV (OTG_BASE + 0x00) 38 + #define OTG_SYSCON_1 (OTG_BASE + 0x04) 42 39 # define USB2_TRX_MODE(w) (((w)>>24)&0x07) 43 40 # define USB1_TRX_MODE(w) (((w)>>20)&0x07) 44 41 # define USB0_TRX_MODE(w) (((w)>>16)&0x07) ··· 44 47 # define DEV_IDLE_EN (1 << 13) 45 48 # define OTG_RESET_DONE (1 << 2) 46 49 # define OTG_SOFT_RESET (1 << 1) 47 - #define OTG_SYSCON_2_REG OTG_REG32(0x08) 50 + #define OTG_SYSCON_2 (OTG_BASE + 0x08) 48 51 # define OTG_EN (1 << 31) 49 52 # define USBX_SYNCHRO (1 << 30) 50 53 # define OTG_MST16 (1 << 29) ··· 62 65 # define HMC_TLLSPEED (1 << 7) 63 66 # define HMC_TLLATTACH (1 << 6) 64 67 # define OTG_HMC(w) (((w)>>0)&0x3f) 65 - #define OTG_CTRL_REG OTG_REG32(0x0c) 68 + #define OTG_CTRL (OTG_BASE + 0x0c) 66 69 # define OTG_USB2_EN (1 << 29) 67 70 # define OTG_USB2_DP (1 << 28) 68 71 # define OTG_USB2_DM (1 << 27) ··· 89 92 # define OTG_PD_VBUS (1 << 2) 90 93 # define OTG_PU_VBUS (1 << 1) 91 94 # define OTG_PU_ID (1 << 0) 92 - #define OTG_IRQ_EN_REG OTG_REG16(0x10) 95 + #define OTG_IRQ_EN (OTG_BASE + 0x10) /* 16-bit */ 93 96 # define DRIVER_SWITCH (1 << 15) 94 97 # define A_VBUS_ERR (1 << 13) 95 98 # define A_REQ_TMROUT (1 << 12) ··· 99 102 # define B_SRP_DONE (1 << 8) 100 103 # define B_SRP_STARTED (1 << 7) 101 104 # define OPRT_CHG (1 << 0) 102 - #define OTG_IRQ_SRC_REG OTG_REG16(0x14) 105 + #define OTG_IRQ_SRC (OTG_BASE + 0x14) /* 16-bit */ 103 106 // same bits as in IRQ_EN 104 - #define OTG_OUTCTRL_REG OTG_REG16(0x18) 107 + #define OTG_OUTCTRL (OTG_BASE + 0x18) /* 16-bit */ 105 108 # define OTGVPD (1 << 14) 106 109 # define OTGVPU (1 << 13) 107 110 # define OTGPUID (1 << 12) ··· 114 117 # define USB0VDR (1 << 2) 115 118 # define USB0PDEN (1 << 1) 116 119 # define USB0PUEN (1 << 0) 117 - #define OTG_TEST_REG OTG_REG16(0x20) 118 - #define OTG_VENDOR_CODE_REG OTG_REG32(0xfc) 120 + #define OTG_TEST (OTG_BASE + 0x20) /* 16-bit */ 121 + #define OTG_VENDOR_CODE (OTG_BASE + 0xfc) /* 16-bit */ 119 122 120 123 /*-------------------------------------------------------------------------*/ 121 124 122 125 /* OMAP1 */ 123 - #define USB_TRANSCEIVER_CTRL_REG __REG32(0xfffe1000 + 0x0064) 126 + #define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064) 124 127 # define CONF_USB2_UNI_R (1 << 8) 125 128 # define CONF_USB1_UNI_R (1 << 7) 126 129 # define CONF_USB_PORT0_R(x) (((x)>>4)&0x7)