[PATCH V2] ARM: NUC900: Add PCI driver support for NUC960

Russell King - ARM Linux linux at arm.linux.org.uk
Tue Nov 15 12:30:23 EST 2011


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.



More information about the linux-arm-kernel mailing list