Re: [PATCH 2.6.12-rc1-mm4] mips: update VR41xx CPU-PCI bridge support
Hello Andrew, I received a comment from Mita-san. On Tue, 5 Apr 2005 00:45:24 +0900 Yoichi Yuasa <[EMAIL PROTECTED]> wrote: > This patch updates NEC VR4100 series CPU-PCI bridge support. > This patch already had applied to Ralf's cvs. > > + if (request_mem_region(PCIU_BASE, PCIU_SIZE, "PCIU") == NULL) > + return -EBUSY; > + > + pciu_base = ioremap(PCIU_BASE, PCIU_SIZE); > + if (pciu_base == NULL) > + return -EBUSY; > + I forgot to put release_mem_region() in here. I update this patch. Please apply new one. Yoichi Signed-off-by: Yoichi Yuasa <[EMAIL PROTECTED]> diff -urN -X dontdiff rc1-mm4-orig/arch/mips/pci/ops-vr41xx.c rc1-mm4/arch/mips/pci/ops-vr41xx.c --- rc1-mm4-orig/arch/mips/pci/ops-vr41xx.c Wed Mar 2 16:38:17 2005 +++ rc1-mm4/arch/mips/pci/ops-vr41xx.c Mon Apr 4 22:46:44 2005 @@ -3,7 +3,7 @@ * * Copyright (C) 2001-2003 MontaVista Software Inc. *Author: Yoichi Yuasa <[EMAIL PROTECTED] or [EMAIL PROTECTED]> - * Copyright (C) 2004 Yoichi Yuasa <[EMAIL PROTECTED]> + * Copyright (C) 2004-2005 Yoichi Yuasa <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +29,8 @@ #include -#define PCICONFDREGKSEG1ADDR(0x0f000c14) -#define PCICONFAREGKSEG1ADDR(0x0f000c18) +#define PCICONFDREG(void __iomem *)KSEG1ADDR(0x0f000c14) +#define PCICONFAREG(void __iomem *)KSEG1ADDR(0x0f000c18) static inline int set_pci_configuration_address(unsigned char number, unsigned int devfn, int where) diff -urN -X dontdiff rc1-mm4-orig/arch/mips/pci/pci-vr41xx.c rc1-mm4/arch/mips/pci/pci-vr41xx.c --- rc1-mm4-orig/arch/mips/pci/pci-vr41xx.c Fri Apr 1 21:17:30 2005 +++ rc1-mm4/arch/mips/pci/pci-vr41xx.c Tue Apr 5 07:47:17 2005 @@ -3,8 +3,8 @@ * * Copyright (C) 2001-2003 MontaVista Software Inc. *Author: Yoichi Yuasa <[EMAIL PROTECTED] or [EMAIL PROTECTED]> - * Copyright (C) 2004 Yoichi Yuasa <[EMAIL PROTECTED]> - * Copyright (C) 2004 by Ralf Baechle ([EMAIL PROTECTED]) + * Copyright (C) 2004-2005 Yoichi Yuasa <[EMAIL PROTECTED]> + * Copyright (C) 2004 by Ralf Baechle ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,18 @@ #include #include +#include #include #include "pci-vr41xx.h" extern struct pci_ops vr41xx_pci_ops; +static void __iomem *pciu_base; + +#define pciu_read(offset) readl(pciu_base + (offset)) +#define pciu_write(offset, value) writel((value), pciu_base + (offset)) + static struct pci_master_address_conversion pci_master_memory1 = { .bus_base_address = PCI_MASTER_MEM1_BUS_BASE_ADDRESS, .address_mask = PCI_MASTER_MEM1_ADDRESS_MASK, @@ -113,6 +119,15 @@ setup = &vr41xx_pci_controller_unit_setup; + if (request_mem_region(PCIU_BASE, PCIU_SIZE, "PCIU") == NULL) + return -EBUSY; + + pciu_base = ioremap(PCIU_BASE, PCIU_SIZE); + if (pciu_base == NULL) { + release_mem_region(PCIU_BASE, PCIU_SIZE); + return -EBUSY; + } + /* Disable PCI interrupt */ vr41xx_disable_pciint(); @@ -129,14 +144,14 @@ pci_clock_max = PCI_CLOCK_MAX; vtclock = vr41xx_get_vtclock_frequency(); if (vtclock < pci_clock_max) - writel(EQUAL_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, EQUAL_VTCLOCK); else if ((vtclock / 2) < pci_clock_max) - writel(HALF_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, HALF_VTCLOCK); else if (current_cpu_data.processor_id >= PRID_VR4131_REV2_1 && (vtclock / 3) < pci_clock_max) - writel(ONE_THIRD_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, ONE_THIRD_VTCLOCK); else if ((vtclock / 4) < pci_clock_max) - writel(QUARTER_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, QUARTER_VTCLOCK); else { printk(KERN_ERR "PCI Clock is over 33MHz.\n"); return -EINVAL; @@ -151,11 +166,11 @@ MASTER_MSK(master->address_mask) | WINEN | PCIA(master->pci_base_address); - writel(val, PCIMMAW1REG); + pciu_write(PCIMMAW1REG, val); } else { - val = readl(PCIMMAW1REG); + val = pciu_read(PCIMMAW1REG); val &= ~WINEN; - writel(val, PCIMMAW1REG); + pciu_write(PCIMMAW1REG, val); } if (setup->master_memory2 != NULL) { @@ -164,11 +179,11 @@ MASTER_MSK(master->address_mask) | WINEN | PCIA(maste
[PATCH 2.6.12-rc1-mm4] mips: update VR41xx CPU-PCI bridge support
This patch updates NEC VR4100 series CPU-PCI bridge support. This patch already had applied to Ralf's cvs. Yoichi Signed-off-by: Yoichi Yuasa <[EMAIL PROTECTED]> diff -urN -X dontdiff rc1-mm4-orig/arch/mips/pci/ops-vr41xx.c rc1-mm4/arch/mips/pci/ops-vr41xx.c --- rc1-mm4-orig/arch/mips/pci/ops-vr41xx.c Wed Mar 2 16:38:17 2005 +++ rc1-mm4/arch/mips/pci/ops-vr41xx.c Mon Apr 4 22:46:44 2005 @@ -3,7 +3,7 @@ * * Copyright (C) 2001-2003 MontaVista Software Inc. *Author: Yoichi Yuasa <[EMAIL PROTECTED] or [EMAIL PROTECTED]> - * Copyright (C) 2004 Yoichi Yuasa <[EMAIL PROTECTED]> + * Copyright (C) 2004-2005 Yoichi Yuasa <[EMAIL PROTECTED]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,8 +29,8 @@ #include -#define PCICONFDREGKSEG1ADDR(0x0f000c14) -#define PCICONFAREGKSEG1ADDR(0x0f000c18) +#define PCICONFDREG(void __iomem *)KSEG1ADDR(0x0f000c14) +#define PCICONFAREG(void __iomem *)KSEG1ADDR(0x0f000c18) static inline int set_pci_configuration_address(unsigned char number, unsigned int devfn, int where) diff -urN -X dontdiff rc1-mm4-orig/arch/mips/pci/pci-vr41xx.c rc1-mm4/arch/mips/pci/pci-vr41xx.c --- rc1-mm4-orig/arch/mips/pci/pci-vr41xx.c Fri Apr 1 21:17:30 2005 +++ rc1-mm4/arch/mips/pci/pci-vr41xx.c Mon Apr 4 22:46:44 2005 @@ -3,8 +3,8 @@ * * Copyright (C) 2001-2003 MontaVista Software Inc. *Author: Yoichi Yuasa <[EMAIL PROTECTED] or [EMAIL PROTECTED]> - * Copyright (C) 2004 Yoichi Yuasa <[EMAIL PROTECTED]> - * Copyright (C) 2004 by Ralf Baechle ([EMAIL PROTECTED]) + * Copyright (C) 2004-2005 Yoichi Yuasa <[EMAIL PROTECTED]> + * Copyright (C) 2004 by Ralf Baechle ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,12 +31,18 @@ #include #include +#include #include #include "pci-vr41xx.h" extern struct pci_ops vr41xx_pci_ops; +static void __iomem *pciu_base; + +#define pciu_read(offset) readl(pciu_base + (offset)) +#define pciu_write(offset, value) writel((value), pciu_base + (offset)) + static struct pci_master_address_conversion pci_master_memory1 = { .bus_base_address = PCI_MASTER_MEM1_BUS_BASE_ADDRESS, .address_mask = PCI_MASTER_MEM1_ADDRESS_MASK, @@ -113,6 +119,13 @@ setup = &vr41xx_pci_controller_unit_setup; + if (request_mem_region(PCIU_BASE, PCIU_SIZE, "PCIU") == NULL) + return -EBUSY; + + pciu_base = ioremap(PCIU_BASE, PCIU_SIZE); + if (pciu_base == NULL) + return -EBUSY; + /* Disable PCI interrupt */ vr41xx_disable_pciint(); @@ -129,14 +142,14 @@ pci_clock_max = PCI_CLOCK_MAX; vtclock = vr41xx_get_vtclock_frequency(); if (vtclock < pci_clock_max) - writel(EQUAL_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, EQUAL_VTCLOCK); else if ((vtclock / 2) < pci_clock_max) - writel(HALF_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, HALF_VTCLOCK); else if (current_cpu_data.processor_id >= PRID_VR4131_REV2_1 && (vtclock / 3) < pci_clock_max) - writel(ONE_THIRD_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, ONE_THIRD_VTCLOCK); else if ((vtclock / 4) < pci_clock_max) - writel(QUARTER_VTCLOCK, PCICLKSELREG); + pciu_write(PCICLKSELREG, QUARTER_VTCLOCK); else { printk(KERN_ERR "PCI Clock is over 33MHz.\n"); return -EINVAL; @@ -151,11 +164,11 @@ MASTER_MSK(master->address_mask) | WINEN | PCIA(master->pci_base_address); - writel(val, PCIMMAW1REG); + pciu_write(PCIMMAW1REG, val); } else { - val = readl(PCIMMAW1REG); + val = pciu_read(PCIMMAW1REG); val &= ~WINEN; - writel(val, PCIMMAW1REG); + pciu_write(PCIMMAW1REG, val); } if (setup->master_memory2 != NULL) { @@ -164,11 +177,11 @@ MASTER_MSK(master->address_mask) | WINEN | PCIA(master->pci_base_address); - writel(val, PCIMMAW2REG); + pciu_write(PCIMMAW2REG, val); } else { - val = readl(PCIMMAW2REG); + val = pciu_read(PCIMMAW2REG); val &= ~WINEN; - writel(val, PCIMMAW2REG); + pciu_write(PCIMMAW2REG, val); } if (setup->target_memory1 != NULL) { @@ -176,11 +189,11 @@ val = TARGET_MSK(target->address_mask) | WINEN |