[PATCH 1/6] Realview PCIX support - add main support module code

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Oct 28 10:02:48 EDT 2010


On Wed, Oct 20, 2010 at 02:02:54PM +0100, Colin Tuckley wrote:
> +#include <mach/platform.h>
> +#include <asm/io.h>

linux/io.h

> +static void pcie_fix_sizes(void)
> +{
> +	struct pci_dev *pdev = NULL;
> +	int rrq;
> +	int max_rrq = 4096;
> +
> +	/* Set the max read request size for all devices to the
> +	 * smallest in the tree. So far, the only device we've seen
> +	 * that fails without this is the Marvell Yukon 88E8053 but
> +	 * this may fix other devices too.
> +	 */
> +	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
> +		rrq = pcie_get_readrq(pdev);
> +		if (rrq > 0 && rrq < max_rrq)
> +			max_rrq = rrq;
> +	}
> +
> +	pdev = NULL;	/* reset scan */
> +	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
> +		rrq = pcie_get_readrq(pdev);
> +		printk(KERN_DEBUG "%s: %02x:%02x %04x/%04x : RRQSZ %d -> %d\n",
> +				__func__, pdev->bus->number, pdev->devfn,
> +				pdev->vendor, pdev->device, rrq, max_rrq);
> +		pcie_set_readrq(pdev, max_rrq);
> +	}
> +}
> +
> +static int __init realview_pcie_fixups(void)
> +{
> +	pcie_fix_sizes();
> +	return 0;
> +}
> +late_initcall(realview_pcie_fixups);

Shouldn't this be done as a PCI quirk rather than walking the entire list
of PCI devices at some point after drivers have potentially initialised
and bound to these devices?



More information about the linux-arm-kernel mailing list