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

[MIPS] Rewrite GALILEO_INL/GALILEO_OUTL to GT_READ/GT_WRITE

This patch has rewritten GALILEO_INL/GALILEO_OUTL using GT_READ/GT_WRITE.
This patch tested on Cobalt Qube2.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Yoichi Yuasa and committed by
Ralf Baechle
56ae5833 4e3884fc

+78 -67
+14 -17
arch/mips/cobalt/irq.c
··· 45 45 { 46 46 unsigned int mask, pending, devfn; 47 47 48 - mask = GALILEO_INL(GT_INTRMASK_OFS); 49 - pending = GALILEO_INL(GT_INTRCAUSE_OFS) & mask; 48 + mask = GT_READ(GT_INTRMASK_OFS); 49 + pending = GT_READ(GT_INTRCAUSE_OFS) & mask; 50 50 51 - if (pending & GALILEO_INTR_T0EXP) { 52 - 53 - GALILEO_OUTL(~GALILEO_INTR_T0EXP, GT_INTRCAUSE_OFS); 51 + if (pending & GT_INTR_T0EXP_MSK) { 52 + GT_WRITE(GT_INTRCAUSE_OFS, ~GT_INTR_T0EXP_MSK); 54 53 do_IRQ(COBALT_GALILEO_IRQ); 55 - 56 - } else if (pending & GALILEO_INTR_RETRY_CTR) { 57 - 58 - devfn = GALILEO_INL(GT_PCI0_CFGADDR_OFS) >> 8; 59 - GALILEO_OUTL(~GALILEO_INTR_RETRY_CTR, GT_INTRCAUSE_OFS); 60 - printk(KERN_WARNING "Galileo: PCI retry count exceeded (%02x.%u)\n", 61 - PCI_SLOT(devfn), PCI_FUNC(devfn)); 62 - 54 + } else if (pending & GT_INTR_RETRYCTR0_MSK) { 55 + devfn = GT_READ(GT_PCI0_CFGADDR_OFS) >> 8; 56 + GT_WRITE(GT_INTRCAUSE_OFS, ~GT_INTR_RETRYCTR0_MSK); 57 + printk(KERN_WARNING 58 + "Galileo: PCI retry count exceeded (%02x.%u)\n", 59 + PCI_SLOT(devfn), PCI_FUNC(devfn)); 63 60 } else { 64 - 65 - GALILEO_OUTL(mask & ~pending, GT_INTRMASK_OFS); 66 - printk(KERN_WARNING "Galileo: masking unexpected interrupt %08x\n", pending); 61 + GT_WRITE(GT_INTRMASK_OFS, mask & ~pending); 62 + printk(KERN_WARNING 63 + "Galileo: masking unexpected interrupt %08x\n", pending); 67 64 } 68 65 } 69 66 ··· 101 104 * Mask all Galileo interrupts. The Galileo 102 105 * handler is set in cobalt_timer_setup() 103 106 */ 104 - GALILEO_OUTL(0, GT_INTRMASK_OFS); 107 + GT_WRITE(GT_INTRMASK_OFS, 0); 105 108 106 109 init_i8259_irqs(); /* 0 ... 15 */ 107 110 mips_cpu_irq_init(COBALT_CPU_IRQ); /* 16 ... 23 */
+8 -8
arch/mips/cobalt/setup.c
··· 51 51 void __init plat_timer_setup(struct irqaction *irq) 52 52 { 53 53 /* Load timer value for HZ (TCLK is 50MHz) */ 54 - GALILEO_OUTL(50*1000*1000 / HZ, GT_TC0_OFS); 54 + GT_WRITE(GT_TC0_OFS, 50*1000*1000 / HZ); 55 55 56 56 /* Enable timer */ 57 - GALILEO_OUTL(GALILEO_ENTC0 | GALILEO_SELTC0, GT_TC_CONTROL_OFS); 57 + GT_WRITE(GT_TC_CONTROL_OFS, GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK); 58 58 59 59 /* Register interrupt */ 60 60 setup_irq(COBALT_GALILEO_IRQ, irq); 61 61 62 62 /* Enable interrupt */ 63 - GALILEO_OUTL(GALILEO_INTR_T0EXP | GALILEO_INL(GT_INTRMASK_OFS), GT_INTRMASK_OFS); 63 + GT_WRITE(GT_INTRMASK_OFS, GT_INTR_T0EXP_MSK | GT_READ(GT_INTRMASK_OFS)); 64 64 } 65 65 66 66 extern struct pci_ops gt64111_pci_ops; 67 67 68 68 static struct resource cobalt_mem_resource = { 69 - .start = GT64111_MEM_BASE, 70 - .end = GT64111_MEM_END, 69 + .start = GT_DEF_PCI0_MEM0_BASE, 70 + .end = GT_DEF_PCI0_MEM0_BASE + GT_DEF_PCI0_MEM0_SIZE - 1, 71 71 .name = "PCI memory", 72 72 .flags = IORESOURCE_MEM 73 73 }; ··· 115 115 .mem_resource = &cobalt_mem_resource, 116 116 .mem_offset = 0, 117 117 .io_resource = &cobalt_io_resource, 118 - .io_offset = 0 - GT64111_IO_BASE 118 + .io_offset = 0 - GT_DEF_PCI0_IO_BASE, 119 119 }; 120 120 121 121 void __init plat_mem_setup(void) ··· 128 128 _machine_halt = cobalt_machine_halt; 129 129 pm_power_off = cobalt_machine_power_off; 130 130 131 - set_io_port_base(CKSEG1ADDR(GT64111_IO_BASE)); 131 + set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE)); 132 132 133 133 /* I/O port resource must include UART and LCD/buttons */ 134 134 ioport_resource.end = 0x0fffffff; ··· 139 139 140 140 /* Read the cobalt id register out of the PCI config space */ 141 141 PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3)); 142 - cobalt_board_id = GALILEO_INL(GT_PCI0_CFGDATA_OFS); 142 + cobalt_board_id = GT_READ(GT_PCI0_CFGDATA_OFS); 143 143 cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8); 144 144 cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id); 145 145
+5 -6
arch/mips/pci/fixup-cobalt.c
··· 94 94 #if 0 95 95 if (galileo_id >= 0x10) { 96 96 /* New Galileo, assumes PCI stop line to VIA is connected. */ 97 - GALILEO_OUTL(0x4020, GT_PCI0_TOR_OFS); 97 + GT_WRITE(GT_PCI0_TOR_OFS, 0x4020); 98 98 } else if (galileo_id == 0x1 || galileo_id == 0x2) 99 99 #endif 100 100 { 101 101 signed int timeo; 102 102 /* XXX WE MUST DO THIS ELSE GALILEO LOCKS UP! -DaveM */ 103 - timeo = GALILEO_INL(GT_PCI0_TOR_OFS); 103 + timeo = GT_READ(GT_PCI0_TOR_OFS); 104 104 /* Old Galileo, assumes PCI STOP line to VIA is disconnected. */ 105 - GALILEO_OUTL( 105 + GT_WRITE(GT_PCI0_TOR_OFS, 106 106 (0xff << 16) | /* retry count */ 107 107 (0xff << 8) | /* timeout 1 */ 108 - 0xff, /* timeout 0 */ 109 - GT_PCI0_TOR_OFS); 108 + 0xff); /* timeout 0 */ 110 109 111 110 /* enable PCI retry exceeded interrupt */ 112 - GALILEO_OUTL(GALILEO_INTR_RETRY_CTR | GALILEO_INL(GT_INTRMASK_OFS), GT_INTRMASK_OFS); 111 + GT_WRITE(GT_INTRMASK_OFS, GT_INTR_RETRYCTR0_MSK | GT_READ(GT_INTRMASK_OFS)); 113 112 } 114 113 } 115 114
+8 -8
arch/mips/pci/ops-gt64111.c
··· 38 38 switch (size) { 39 39 case 4: 40 40 PCI_CFG_SET(devfn, where); 41 - *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS); 41 + *val = GT_READ(GT_PCI0_CFGDATA_OFS); 42 42 return PCIBIOS_SUCCESSFUL; 43 43 44 44 case 2: 45 45 PCI_CFG_SET(devfn, (where & ~0x3)); 46 - *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS) 46 + *val = GT_READ(GT_PCI0_CFGDATA_OFS) 47 47 >> ((where & 3) * 8); 48 48 return PCIBIOS_SUCCESSFUL; 49 49 50 50 case 1: 51 51 PCI_CFG_SET(devfn, (where & ~0x3)); 52 - *val = GALILEO_INL(GT_PCI0_CFGDATA_OFS) 52 + *val = GT_READ(GT_PCI0_CFGDATA_OFS) 53 53 >> ((where & 3) * 8); 54 54 return PCIBIOS_SUCCESSFUL; 55 55 } ··· 68 68 switch (size) { 69 69 case 4: 70 70 PCI_CFG_SET(devfn, where); 71 - GALILEO_OUTL(val, GT_PCI0_CFGDATA_OFS); 71 + GT_WRITE(GT_PCI0_CFGDATA_OFS, val); 72 72 73 73 return PCIBIOS_SUCCESSFUL; 74 74 75 75 case 2: 76 76 PCI_CFG_SET(devfn, (where & ~0x3)); 77 - tmp = GALILEO_INL(GT_PCI0_CFGDATA_OFS); 77 + tmp = GT_READ(GT_PCI0_CFGDATA_OFS); 78 78 tmp &= ~(0xffff << ((where & 0x3) * 8)); 79 79 tmp |= (val << ((where & 0x3) * 8)); 80 - GALILEO_OUTL(tmp, GT_PCI0_CFGDATA_OFS); 80 + GT_WRITE(GT_PCI0_CFGDATA_OFS, tmp); 81 81 82 82 return PCIBIOS_SUCCESSFUL; 83 83 84 84 case 1: 85 85 PCI_CFG_SET(devfn, (where & ~0x3)); 86 - tmp = GALILEO_INL(GT_PCI0_CFGDATA_OFS); 86 + tmp = GT_READ(GT_PCI0_CFGDATA_OFS); 87 87 tmp &= ~(0xff << ((where & 0x3) * 8)); 88 88 tmp |= (val << ((where & 0x3) * 8)); 89 - GALILEO_OUTL(tmp, GT_PCI0_CFGDATA_OFS); 89 + GT_WRITE(GT_PCI0_CFGDATA_OFS, tmp); 90 90 91 91 return PCIBIOS_SUCCESSFUL; 92 92 }
+14
include/asm-mips/gt64120.h
··· 451 451 #define GT_SDRAM_OPMODE_OP_MODE 3 452 452 #define GT_SDRAM_OPMODE_OP_CBR 4 453 453 454 + #define GT_TC_CONTROL_ENTC0_SHF 0 455 + #define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF) 456 + #define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK 457 + #define GT_TC_CONTROL_SELTC0_SHF 1 458 + #define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF) 459 + #define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK 460 + 454 461 455 462 #define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0 456 463 #define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF) ··· 529 522 #define GT_PCI0_CMD_SWORDSWAP_SHF 11 530 523 #define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF) 531 524 #define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK 525 + 526 + #define GT_INTR_T0EXP_SHF 8 527 + #define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF) 528 + #define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK 529 + #define GT_INTR_RETRYCTR0_SHF 20 530 + #define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF) 531 + #define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK 532 532 533 533 /* 534 534 * Misc
+2 -27
include/asm-mips/mach-cobalt/cobalt.h
··· 67 67 #define COBALT_BRD_ID_QUBE2 0x5 68 68 #define COBALT_BRD_ID_RAQ2 0x6 69 69 70 - /* 71 - * Galileo chipset access macros for the Cobalt. The base address for 72 - * the GT64111 chip is 0x14000000 73 - * 74 - * Most of this really should go into a separate GT64111 header file. 75 - */ 76 - #define GT64111_IO_BASE 0x10000000UL 77 - #define GT64111_IO_END 0x11ffffffUL 78 - #define GT64111_MEM_BASE 0x12000000UL 79 - #define GT64111_MEM_END 0x13ffffffUL 80 - #define GT64111_BASE 0x14000000UL 81 - #define GALILEO_REG(ofs) CKSEG1ADDR(GT64111_BASE + (unsigned long)(ofs)) 82 - 83 - #define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port)) 84 - #define GALILEO_OUTL(val, port) \ 85 - do { \ 86 - *(volatile unsigned int *) GALILEO_REG(port) = (val); \ 87 - } while (0) 88 - 89 - #define GALILEO_INTR_T0EXP (1 << 8) 90 - #define GALILEO_INTR_RETRY_CTR (1 << 20) 91 - 92 - #define GALILEO_ENTC0 0x01 93 - #define GALILEO_SELTC0 0x02 94 - 95 70 #define PCI_CFG_SET(devfn,where) \ 96 - GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \ 97 - (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS) 71 + GT_WRITE(GT_PCI0_CFGADDR_OFS, (0x80000000 | (PCI_SLOT (devfn) << 11) | \ 72 + (PCI_FUNC (devfn) << 8) | (where))) 98 73 99 74 #define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000)) 100 75 # define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */
+27 -1
include/asm-mips/mach-cobalt/mach-gt64120.h
··· 1 - /* there's something here ... in the dark */ 1 + /* 2 + * Copyright (C) 2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program; if not, write to the Free Software 16 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 + */ 18 + #ifndef _COBALT_MACH_GT64120_H 19 + #define _COBALT_MACH_GT64120_H 20 + 21 + /* 22 + * Cobalt uses GT64111. GT64111 is almost the same as GT64120. 23 + */ 24 + 25 + #define GT64120_BASE CKSEG1ADDR(GT_DEF_BASE) 26 + 27 + #endif /* _COBALT_MACH_GT64120_H */