From mboxrd@z Thu Jan 1 00:00:00 1970 From: linux@arm.linux.org.uk (Russell King - ARM Linux) Date: Tue, 15 Nov 2011 17:30:23 +0000 Subject: [PATCH V2] ARM: NUC900: Add PCI driver support for NUC960 In-Reply-To: <4EC0BF9B.2050300@gmail.com> References: <4EBE98FC.6070903@gmail.com> <4EC0BF9B.2050300@gmail.com> Message-ID: <20111115173023.GC9581@n2100.arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Nov 14, 2011 at 03:13:31PM +0800, Wan ZongShun wrote: > +#define NUC900_PCI_MEM_BASE 0xC0000000 > +#define NUC900_PCI_MEM_END 0xDFFFEFFFF > +#define NUC900_PCI_MEM_SIZE 0x20000000 NUC900_PCI_MEM_END has more than 32 bits. > +#define NUC900_PCI_IO_BASE 0xE0000000 > +#define NUC900_PCI_IO_END 0xE000FFFF > +#define NUC900_PCI_IO_SIZE 0x10000 ... > +static struct resource pci_io = { > + .name = "NUC900 PCI IO", > + .start = NUC900_PCI_IO_BASE, > + .end = NUC900_PCI_IO_BASE + NUC900_PCI_IO_SIZE - 1, > + .flags = IORESOURCE_IO, > +}; ... > +static int __init pci_nuc900_setup_resources(struct resource **resource) > +{ > + int ret = 0; > + > + ret = request_resource(&ioport_resource, &pci_io); > + if (ret) { > + pr_err("%s: failed to request resources: %d\n", __func__, ret); > + goto out; > + } ... > + /* > + * bus->resource[0] is the IO resource for this bus > + * bus->resource[1] is the mem resource for this bus > + * bus->resource[2] is the prefetch mem resource for this bus > + */ > + resource[0] = &pci_io; > + resource[1] = &pci_mem; > + resource[2] = NULL; This is better, but still not correct. 1. in mach/io.h: -#define IO_SPACE_LIMIT 0xffffffff +#define IO_SPACE_LIMIT 0xffff -#define __io(a) __typesafe_io(a) +#define __io(a) ((void __iomem __force *)(a) + VA_OF_IO_SPACE) where VA_OF_IO_SPACE is correctly named and typed. 2. set resource[0] = &ioport_resource and get rid of pci_io entirely. 3. if (!request_mem_region(PA_OF_IO_SPACE, 64K, "PCI IO emulation space")) pr_warn("Unable to request PCI IO space\n"); in your pre-init function.