From 1a9a1936a387ba0d18b276da6460c72491856426 Mon Sep 17 00:00:00 2001 From: Steffen Sledz Date: Mon, 9 Mar 2009 17:09:45 +0100 Subject: linux-2.6.24: PCI config delay patch for OXNAS machine --- .../oxnas/oxnas-pci-config-delay.patch | 56 ++++++++++++++++++++++ packages/linux/linux_2.6.24.bb | 3 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 packages/linux/linux-2.6.24/oxnas/oxnas-pci-config-delay.patch (limited to 'packages/linux') diff --git a/packages/linux/linux-2.6.24/oxnas/oxnas-pci-config-delay.patch b/packages/linux/linux-2.6.24/oxnas/oxnas-pci-config-delay.patch new file mode 100644 index 0000000000..5936b5bbca --- /dev/null +++ b/packages/linux/linux-2.6.24/oxnas/oxnas-pci-config-delay.patch @@ -0,0 +1,56 @@ +--- linux-2.6.24.org/arch/arm/mach-oxnas/pci.c 2009-03-09 14:26:43.000000000 +0100 ++++ linux-2.6.24/arch/arm/mach-oxnas/pci.c 2009-03-09 14:31:12.000000000 +0100 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -71,6 +72,12 @@ + + extern spinlock_t oxnas_gpio_spinlock; + ++#ifdef CONFIG_OXNAS_PCI_RESET ++static unsigned long pci_trhfa_startwait = 0; ++static unsigned long pci_trhfa_msec = 0; ++static unsigned long pci_trhfa_timeout = 0; ++#endif // CONFIG_OXNAS_PCI_RESET ++ + #define PCI_BUS_NONMEM_START 0x00000000 + #define PCI_BUS_NONMEM_SIZE 0x00080000 + +@@ -505,6 +512,15 @@ + struct pci_bus *oxnas_pci_scan_bus(int nr, struct pci_sys_data *sys) + { + // printk(KERN_DEBUG "PCI: oxnas_pci_scan_bus\n"); ++ ++#ifdef CONFIG_OXNAS_PCI_RESET ++ printk(KERN_DEBUG "PCI: oxnas_pci_scan_bus now it's %lu, still waiting till %lu to become ready for config\n", jiffies, pci_trhfa_timeout); ++ if (time_after_eq(jiffies + msecs_to_jiffies(pci_trhfa_msec), pci_trhfa_timeout)) /* ensure not wrap */ ++ while(time_before(jiffies, pci_trhfa_timeout)) ++ udelay(100); ++ printk(KERN_DEBUG "PCI: oxnas_pci_scan_bus waited from %lu to %lu to become ready for config\n", pci_trhfa_startwait, jiffies); ++#endif // CONFIG_OXNAS_PCI_RESET ++ + return pci_scan_bus(sys->busnr, &oxnas_pci_ops, sys); + } + +@@ -651,6 +667,16 @@ + + static int __init oxnas_pci_init(void) + { ++#ifdef CONFIG_OXNAS_PCI_RESET ++ // CPU has reset PCI bus via GPIO. ++ // According to PCI spec, we have to wait for 2^25 PCI clocks to meet ++ // the PCI timing parameter Trhfa (RST# high to first access). ++ pci_trhfa_startwait = jiffies; ++ pci_trhfa_msec = 1000; // 1 sec should be fine for 33MHz ++ pci_trhfa_timeout = jiffies + msecs_to_jiffies(pci_trhfa_msec); ++ printk(KERN_DEBUG "PCI: oxnas_pci_init now it's %lu, will wait till %lu to become ready for config\n", pci_trhfa_startwait, pci_trhfa_timeout); ++#endif // CONFIG_OXNAS_PCI_RESET ++ + pci_common_init(&oxnas_pci); + return 0; + } diff --git a/packages/linux/linux_2.6.24.bb b/packages/linux/linux_2.6.24.bb index 338e62cc67..be88eab7b1 100644 --- a/packages/linux/linux_2.6.24.bb +++ b/packages/linux/linux_2.6.24.bb @@ -11,7 +11,7 @@ DEFAULT_PREFERENCE_ts72xx = "1" DEFAULT_PREFERENCE_oxnas = "1" DEFAULT_PREFERENCE_cs-e9302 = "1" -PR = "r23" +PR = "r24" SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-2.6.24.tar.bz2 \ http://kamikaze.waninkoko.info/patches/2.6.24/kamikaze1/broken-out/squashfs-lzma-2.6.24.patch;patch=1 \ @@ -87,6 +87,7 @@ SRC_URI_append_ts72xx = "\ SRC_URI_append_oxnas = " \ file://oxnas.diff;patch=1 \ file://oxnas-uart.patch;patch=1 \ + file://oxnas-pci-config-delay.patch;patch=1 \ " CMDLINE_cm-x270 = "console=${CMX270_CONSOLE_SERIAL_PORT},38400 monitor=1 mem=64M mtdparts=physmap-flash.0:256k(boot)ro,0x180000(kernel),-(root);cm-x270-nand:64m(app),-(data) rdinit=/sbin/init root=mtd3 rootfstype=jffs2" -- cgit 1.2.3-korg