Skip to contentSkip to conversation

ARM: make mach/hardware.h optional

PATCH Superseded Rob Herring 6 participants 21 messages Jun 29, 2011 – Jul 25, 2011

Subsystems (13)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: make mach/hardware.h optional

From: Rob Herring <[email protected]>

Currently, all ARM platforms must have a mach/hardware.h include. This is because it is ultimately included by linux/pci.h which is included in many places even for !CONFIG_PCI.

This could be fixed simply with an ifdef around the include of mach/hardware.h in asm/pci.h. However, in the interest of fixing this for single kernel binary builds, this series removes the include of mach/hardware.h outside of mach-* and plat-*. What's used from hardware.h is a couple of PCI defines. Converting them to variables allows each platform to set the values as needed.

This does not address the inclusion of mach/hardware.h under drivers/*. This appears to be mostly older platforms. There could also be some indirect inclusions from other mach/* headers.

I've compile tested on most affected platforms.

Changes from v1:
- Added patch 2 to move ARCH_HAS_DMA_SET_COHERENT_MASK defines into memory.h.
- Separated VGA changes and renamed to vga_base.
- Reverted mach/hardware.h removal from ecard.c. It's getting implicitly included anyway.

Rob

Rob Herring (6):
microblaze: move pci flag functions into asm-generic
ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h
ARM: remove unnecessary mach/hardware.h includes
ARM: pci: make pcibios_assign_all_busses use pci_has_flag
ARM: convert PCI defines to variables
ARM: set vga memory base at run-time

 arch/arm/include/asm/pci.h                       |   12 ++++-
 arch/arm/include/asm/vga.h                       |    5 +-
 arch/arm/lib/ecard.S                             |    1 -
 arch/arm/lib/io-readsw-armv3.S                   |    1 -
 arch/arm/lib/io-writesw-armv3.S                  |    1 -
 arch/arm/mach-bcmring/include/mach/hardware.h    |    2 -
 arch/arm/mach-cns3xxx/cns3420vb.c                |    1 -
 arch/arm/mach-cns3xxx/include/mach/hardware.h    |   22 --------
 arch/arm/mach-dove/include/mach/hardware.h       |    7 ---
 arch/arm/mach-dove/pcie.c                        |    5 ++
 arch/arm/mach-ep93xx/include/mach/hardware.h     |    2 -
 arch/arm/mach-footbridge/dc21285.c               |    4 ++
 arch/arm/mach-footbridge/include/mach/hardware.h |    5 --
 arch/arm/mach-integrator/include/mach/hardware.h |    7 ---
 arch/arm/mach-integrator/pci_v3.c                |    5 ++
 arch/arm/mach-iop13xx/include/mach/hardware.h    |    7 ---
 arch/arm/mach-iop13xx/pci.c                      |    4 +-
 arch/arm/mach-iop32x/include/mach/hardware.h     |    3 -
 arch/arm/mach-iop33x/include/mach/hardware.h     |    3 -
 arch/arm/mach-ixp2000/include/mach/hardware.h    |    8 ---
 arch/arm/mach-ixp2000/pci.c                      |    2 +
 arch/arm/mach-ixp23xx/include/mach/hardware.h    |    4 --
 arch/arm/mach-ixp23xx/pci.c                      |    4 ++
 arch/arm/mach-ixp4xx/common-pci.c                |    6 ++
 arch/arm/mach-ixp4xx/include/mach/hardware.h     |    7 ---
 arch/arm/mach-ixp4xx/include/mach/memory.h       |    1 +
 arch/arm/mach-kirkwood/include/mach/hardware.h   |    7 ---
 arch/arm/mach-kirkwood/pcie.c                    |    5 ++
 arch/arm/mach-ks8695/include/mach/hardware.h     |    9 ---
 arch/arm/mach-mv78xx0/include/mach/hardware.h    |    7 ---
 arch/arm/mach-mv78xx0/pcie.c                     |    5 ++
 arch/arm/mach-orion5x/include/mach/hardware.h    |    7 ---
 arch/arm/mach-orion5x/pci.c                      |    4 ++
 arch/arm/mach-pxa/include/mach/hardware.h        |    7 ---
 arch/arm/mach-pxa/include/mach/memory.h          |    1 +
 arch/arm/mach-sa1100/include/mach/hardware.h     |    8 ---
 arch/arm/mach-shark/include/mach/hardware.h      |    6 --
 arch/arm/mach-shark/pci.c                        |   12 ++++-
 arch/arm/mach-tegra/include/mach/hardware.h      |   28 ----------
 arch/arm/mach-tegra/include/mach/system.h        |    1 -
 arch/arm/mach-tegra/io.c                         |    1 -
 arch/arm/mach-tegra/pcie.c                       |    2 +
 arch/arm/mach-tegra/platsmp.c                    |    1 -
 arch/arm/mach-versatile/include/mach/hardware.h  |    6 --
 arch/arm/mach-versatile/pci.c                    |    3 +
 arch/arm/mm/iomap.c                              |   12 ++++
 arch/arm/mm/proc-xsc3.S                          |    1 -
 arch/microblaze/include/asm/pci-bridge.h         |   36 +------------
 include/asm-generic/pci-bridge.h                 |   62 ++++++++++++++++++++++
 49 files changed, 147 insertions(+), 213 deletions(-)
 delete mode 100644 arch/arm/mach-cns3xxx/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/hardware.h
 create mode 100644 include/asm-generic/pci-bridge.h
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v2 1/6 microblaze: move pci flag functions into asm-generic

From: Rob Herring <[email protected]>

Move pci_set_flags, pci_add_flags, and pci_has_flag into asm-generic/pci-bridge.h so other archs can use them.

---
 arch/microblaze/include/asm/pci-bridge.h |   36 +-----------------
 include/asm-generic/pci-bridge.h         |   62 ++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 35 deletions(-)
 create mode 100644 include/asm-generic/pci-bridge.h
arch/microblaze/include/asm/pci-bridge.h +1 -35
index 746df91..ad1480f 100644
@@ -10,6 +10,7 @@
 #include <linux/pci.h>
 #include <linux/list.h>
 #include <linux/ioport.h>
+#include <asm-generic/pci-bridge.h>
 
 struct device_node;
 
@@ -164,40 +165,5 @@ extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
 extern void pcibios_free_controller(struct pci_controller *phb);
 extern void pcibios_setup_phb_resources(struct pci_controller *hose);
 
-#ifdef CONFIG_PCI
-extern unsigned int pci_flags;
-
-static inline void pci_set_flags(int flags)
-{
-	pci_flags = flags;
-}
-
-static inline void pci_add_flags(int flags)
-{
-	pci_flags |= flags;
-}
-
-static inline int pci_has_flag(int flag)
-{
-	return pci_flags & flag;
-}
-
-extern struct list_head hose_list;
-
-extern int pcibios_vaddr_is_ioport(void __iomem *address);
-#else
-static inline int pcibios_vaddr_is_ioport(void __iomem *address)
-{
-	return 0;
-}
-
-static inline void pci_set_flags(int flags) { }
-static inline void pci_add_flags(int flags) { }
-static inline int pci_has_flag(int flag)
-{
-	return 0;
-}
-#endif	/* CONFIG_PCI */
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_MICROBLAZE_PCI_BRIDGE_H */
include/asm-generic/pci-bridge.h new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#5 lore raw

PATCH v2 2/6 ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

In reply to Rob Herring

From: Rob Herring <[email protected]>

On ixp4xx and pxa, ARCH_HAS_DMA_SET_COHERENT_MASK resides in hardware.h which does not get directly included by dma-mapping.h. Move it into mach/memory.h which is explicitly included.

---
 arch/arm/mach-ixp4xx/include/mach/hardware.h |    2 --
 arch/arm/mach-ixp4xx/include/mach/memory.h   |    1 +
 arch/arm/mach-pxa/include/mach/hardware.h    |    1 -
 arch/arm/mach-pxa/include/mach/memory.h      |    1 +
 4 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-ixp4xx/include/mach/hardware.h +0 -2
index 8138371..f91ca6d 100644
@@ -26,8 +26,6 @@
 #define PCIBIOS_MAX_MEM		0x4BFFFFFF
 #endif
 
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
-
 #define pcibios_assign_all_busses()	1
 
 /* Register locations and bits */
arch/arm/mach-ixp4xx/include/mach/memory.h +1 -0
index 34e7940..d671f5c 100644
@@ -16,6 +16,7 @@
 
 #ifdef CONFIG_PCI
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif
arch/arm/mach-pxa/include/mach/hardware.h +0 -1
index 6957ba5..313051c 100644
@@ -340,7 +340,6 @@ extern unsigned long get_clock_tick_rate(void);
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
 #define pcibios_assign_all_busses()	1
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif  /* _ASM_ARCH_HARDWARE_H */
arch/arm/mach-pxa/include/mach/memory.h +1 -0
index 07734f3..e697578 100644
@@ -19,6 +19,7 @@
 
 #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH v2 3/6 ARM: remove unnecessary mach/hardware.h includes

In reply to Rob Herring

From: Rob Herring <[email protected]>

Remove some includes of mach/hardware.h which are not needed. hardware.h will be removed completely for tegra and cns3xxx in follow on patch.

---
 arch/arm/lib/ecard.S                      |    1 -
 arch/arm/lib/io-readsw-armv3.S            |    1 -
 arch/arm/lib/io-writesw-armv3.S           |    1 -
 arch/arm/mach-cns3xxx/cns3420vb.c         |    1 -
 arch/arm/mach-tegra/include/mach/system.h |    1 -
 arch/arm/mach-tegra/io.c                  |    1 -
 arch/arm/mach-tegra/platsmp.c             |    1 -
 arch/arm/mm/proc-xsc3.S                   |    1 -
 8 files changed, 0 insertions(+), 8 deletions(-)
arch/arm/lib/ecard.S +0 -1
index 8678eb2..e6057fa 100644
@@ -12,7 +12,6 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 
 #define CPSR2SPSR(rt) \
 		mrs	rt, cpsr; \
arch/arm/lib/io-readsw-armv3.S +0 -1
index 9aaf7c7..88487c8 100644
@@ -9,7 +9,6 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 
 .Linsw_bad_alignment:
 		adr	r0, .Linsw_bad_align_msg
arch/arm/lib/io-writesw-armv3.S +0 -1
index cd34503..49b8004 100644
@@ -9,7 +9,6 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
-#include <mach/hardware.h>
 
 .Loutsw_bad_alignment:
 		adr	r0, .Loutsw_bad_align_msg
arch/arm/mach-cns3xxx/cns3420vb.c +0 -1
index 08e5c87..85e6390 100644
@@ -29,7 +29,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
-#include <mach/hardware.h>
 #include <mach/cns3xxx.h>
 #include <mach/irqs.h>
 #include "core.h"
arch/arm/mach-tegra/include/mach/system.h +0 -1
index d0183d8..027c421 100644
@@ -21,7 +21,6 @@
 #ifndef __MACH_TEGRA_SYSTEM_H
 #define __MACH_TEGRA_SYSTEM_H
 
-#include <mach/hardware.h>
 #include <mach/iomap.h>
 
 extern void (*arch_reset)(char mode, const char *cmd);
arch/arm/mach-tegra/io.c +0 -1
index 31848a9..ea50fe2 100644
@@ -24,7 +24,6 @@
 #include <linux/mm.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/page.h>
 #include <asm/mach/map.h>
 
arch/arm/mach-tegra/platsmp.c +0 -1
index b8ae3c9..deb3851 100644
@@ -21,7 +21,6 @@
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/gic.h>
-#include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/smp_scu.h>
 
arch/arm/mm/proc-xsc3.S +0 -1
index 5962136..9ab25b4 100644
@@ -28,7 +28,6 @@
 #include <linux/init.h>
 #include <asm/assembler.h>
 #include <asm/hwcap.h>
-#include <mach/hardware.h>
 #include <asm/pgtable.h>
 #include <asm/pgtable-hwdef.h>
 #include <asm/page.h>
Signature · 1 line
1.7.4.1
#11 lore raw

PATCH v2 4/6 ARM: pci: make pcibios_assign_all_busses use pci_has_flag

In reply to Rob Herring

From: Rob Herring <[email protected]>

Convert pcibios_assign_all_busses from a define to inline so platforms can control this setting.

---
 arch/arm/include/asm/pci.h                       |    6 ++++++
 arch/arm/mach-bcmring/include/mach/hardware.h    |    2 --
 arch/arm/mach-cns3xxx/include/mach/hardware.h    |    1 -
 arch/arm/mach-dove/include/mach/hardware.h       |    2 --
 arch/arm/mach-ep93xx/include/mach/hardware.h     |    2 --
 arch/arm/mach-footbridge/include/mach/hardware.h |    2 --
 arch/arm/mach-integrator/include/mach/hardware.h |    2 --
 arch/arm/mach-iop13xx/include/mach/hardware.h    |    2 --
 arch/arm/mach-iop32x/include/mach/hardware.h     |    1 -
 arch/arm/mach-iop33x/include/mach/hardware.h     |    1 -
 arch/arm/mach-ixp2000/include/mach/hardware.h    |    2 --
 arch/arm/mach-ixp2000/pci.c                      |    2 ++
 arch/arm/mach-ixp23xx/include/mach/hardware.h    |    2 --
 arch/arm/mach-ixp23xx/pci.c                      |    2 ++
 arch/arm/mach-ixp4xx/include/mach/hardware.h     |    2 --
 arch/arm/mach-kirkwood/include/mach/hardware.h   |    3 ---
 arch/arm/mach-ks8695/include/mach/hardware.h     |    2 --
 arch/arm/mach-mv78xx0/include/mach/hardware.h    |    2 --
 arch/arm/mach-orion5x/include/mach/hardware.h    |    2 --
 arch/arm/mach-pxa/include/mach/hardware.h        |    1 -
 arch/arm/mach-sa1100/include/mach/hardware.h     |    1 -
 arch/arm/mach-shark/include/mach/hardware.h      |    2 --
 arch/arm/mach-tegra/include/mach/hardware.h      |    1 -
 arch/arm/mach-versatile/include/mach/hardware.h  |    2 --
 arch/arm/mm/iomap.c                              |    4 ++++
 25 files changed, 14 insertions(+), 37 deletions(-)
arch/arm/include/asm/pci.h +6 -0
index 92e2a83..cb77e66 100644
@@ -3,10 +3,16 @@
 
 #ifdef __KERNEL__
 #include <asm-generic/pci-dma-compat.h>
+#include <asm-generic/pci-bridge.h>
 
 #include <asm/mach/pci.h> /* for pci_sys_data */
 #include <mach/hardware.h> /* for PCIBIOS_MIN_* */
 
+static inline int pcibios_assign_all_busses(void)
+{
+	return pci_has_flag(PCI_REASSIGN_ALL_RSRC);
+}
+
 #ifdef CONFIG_PCI_DOMAINS
 static inline int pci_domain_nr(struct pci_bus *bus)
 {
arch/arm/mach-bcmring/include/mach/hardware.h +0 -2
index 8bf3564..ed78aab 100644
@@ -36,8 +36,6 @@
 #define RAM_SIZE                (CFG_GLOBAL_RAM_SIZE-CFG_GLOBAL_RAM_SIZE_RESERVED)
 #define RAM_BASE                PAGE_OFFSET
 
-#define pcibios_assign_all_busses()	1
-
 /* Macros to make managing spinlocks a bit more controlled in terms of naming. */
 /* See reg_gpio.h, reg_irq.h, arch.c, gpio.c for example usage. */
 #if defined(__KERNEL__)
arch/arm/mach-cns3xxx/include/mach/hardware.h +0 -1
index 57e0983..82a0d4e 100644
@@ -17,6 +17,5 @@
 /* macro to get at IO space when running virtually */
 #define PCIBIOS_MIN_IO		0x00000000
 #define PCIBIOS_MIN_MEM		0x00000000
-#define pcibios_assign_all_busses()	1
 
 #endif
arch/arm/mach-dove/include/mach/hardware.h +0 -2
index 32b0826..f619fb9 100644
@@ -11,8 +11,6 @@
 
 #include "dove.h"
 
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO			0x1000
 #define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			DOVE_PCIE0_MEM_PHYS_BASE
arch/arm/mach-ep93xx/include/mach/hardware.h +0 -2
index 5a3ce02..4df8428 100644
@@ -8,8 +8,6 @@
 #include <mach/ep93xx-regs.h>
 #include <mach/platform.h>
 
-#define pcibios_assign_all_busses()	0
-
 /*
  * The EP93xx has two external crystal oscillators.  To generate the
  * required high-frequency clocks, the processor uses two phase-locked-
arch/arm/mach-footbridge/include/mach/hardware.h +0 -2
index b6fdf23..082e6ce 100644
@@ -100,8 +100,6 @@ extern unsigned int nw_gpio_read(void);
 extern void nw_cpld_modify(unsigned int mask, unsigned int set);
 #endif
 
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM 	0x81000000
 
arch/arm/mach-integrator/include/mach/hardware.h +0 -2
index 57f51ba..37323ea 100644
@@ -34,8 +34,6 @@
 
 #define PCIMEM_BASE		PCI_MEMORY_VADDR
 
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO		0x6000
 #define PCIBIOS_MIN_MEM 	0x00100000
 
arch/arm/mach-iop13xx/include/mach/hardware.h +0 -2
index 8e1d562..ba81e50 100644
@@ -2,8 +2,6 @@
 #define __ASM_ARCH_HARDWARE_H
 #include <asm/types.h>
 
-#define pcibios_assign_all_busses() 1
-
 #ifndef __ASSEMBLY__
 extern unsigned long iop13xx_pcibios_min_io;
 extern unsigned long iop13xx_pcibios_min_mem;
arch/arm/mach-iop32x/include/mach/hardware.h +0 -1
index d559c4e..e68bf97 100644
@@ -18,7 +18,6 @@
  * but when we read them, we convert them to virtual addresses. See
  * arch/arm/plat-iop/pci.c.
  */
-#define pcibios_assign_all_busses() 1
 #define PCIBIOS_MIN_IO		0x00000000
 #define PCIBIOS_MIN_MEM		0x00000000
 
arch/arm/mach-iop33x/include/mach/hardware.h +0 -1
index 8c10e43..215065b 100644
@@ -18,7 +18,6 @@
  * but when we read them, we convert them to virtual addresses.  See
  * arch/arm/mach-iop3xx/iop3xx-pci.c
  */
-#define pcibios_assign_all_busses()	1
 #define PCIBIOS_MIN_IO		0x00000000
 #define PCIBIOS_MIN_MEM		0x00000000
 
arch/arm/mach-ixp2000/include/mach/hardware.h +0 -2
index f033de4..6c92008 100644
@@ -27,8 +27,6 @@
 
 #include "ixp2000-regs.h"	/* Chipset Registers */
 
-#define pcibios_assign_all_busses() 0
-
 /*
  * Platform helper functions
  */
arch/arm/mach-ixp2000/pci.c +2 -0
index f797c5f..8888ed9 100644
@@ -196,6 +196,8 @@ clear_master_aborts(void)
 void __init
 ixp2000_pci_preinit(void)
 {
+	pci_set_flags(0);
+
 #ifndef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
 	/*
 	 * Configure the PCI unit to properly byteswap I/O transactions,
arch/arm/mach-ixp23xx/include/mach/hardware.h +0 -2
index 57b508b..b8bb781 100644
@@ -20,8 +20,6 @@
 
 #include "ixp23xx.h"
 
-#define pcibios_assign_all_busses()	0
-
 /*
  * Platform helper functions
  */
arch/arm/mach-ixp23xx/pci.c +2 -0
index 563819a..72d145a 100644
@@ -227,6 +227,8 @@ static void __init ixp23xx_pci_common_init(void)
 
 void __init ixp23xx_pci_preinit(void)
 {
+	pci_set_flags(0);
+
 	ixp23xx_pci_common_init();
 
 	hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 0,
arch/arm/mach-ixp4xx/include/mach/hardware.h +0 -2
index f91ca6d..a0921c6 100644
@@ -26,8 +26,6 @@
 #define PCIBIOS_MAX_MEM		0x4BFFFFFF
 #endif
 
-#define pcibios_assign_all_busses()	1
-
 /* Register locations and bits */
 #include "ixp4xx-regs.h"
 
arch/arm/mach-kirkwood/include/mach/hardware.h +0 -3
index cde8528..31b81fe 100644
@@ -11,9 +11,6 @@
 
 #include "kirkwood.h"
 
-#define pcibios_assign_all_busses()	1
-
-#define PCIBIOS_MIN_IO			0x00001000
 #define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
 
arch/arm/mach-ks8695/include/mach/hardware.h +0 -2
index e0f911d..a46be88 100644
@@ -46,8 +46,6 @@
 /*
  * PCI support
  */
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
 
arch/arm/mach-mv78xx0/include/mach/hardware.h +0 -2
index 5d88755..c76b93f 100644
@@ -11,8 +11,6 @@
 
 #include "mv78xx0.h"
 
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO			0x00001000
 #define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
arch/arm/mach-orion5x/include/mach/hardware.h +0 -2
index e51aaf4..a42b743 100644
@@ -11,8 +11,6 @@
 
 #include "orion5x.h"
 
-#define pcibios_assign_all_busses()	1
-
 #define PCIBIOS_MIN_IO		0x00001000
 #define PCIBIOS_MIN_MEM		0x01000000
 #define PCIMEM_BASE		ORION5X_PCIE_MEM_PHYS_BASE
arch/arm/mach-pxa/include/mach/hardware.h +0 -1
index 313051c..bd6e928 100644
@@ -339,7 +339,6 @@ extern unsigned long get_clock_tick_rate(void);
 #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
-#define pcibios_assign_all_busses()	1
 #endif
 
 #endif  /* _ASM_ARCH_HARDWARE_H */
arch/arm/mach-sa1100/include/mach/hardware.h +0 -1
index 967ae76..5946af2 100644
@@ -79,7 +79,6 @@ static inline unsigned long get_clock_tick_rate(void)
 #if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_PCI)
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
-#define pcibios_assign_all_busses()	1
 #define HAVE_ARCH_PCI_SET_DMA_MASK	1
 #endif
 
arch/arm/mach-shark/include/mach/hardware.h +0 -2
index 94d84b2..24639ce 100644
@@ -12,8 +12,6 @@
 
 #define UNCACHEABLE_ADDR        0xdf010000
 
-#define pcibios_assign_all_busses()     1
-
 #define PCIBIOS_MIN_IO          0x6000
 #define PCIBIOS_MIN_MEM         0x50000000
 #define PCIMEM_BASE		0xe8000000
arch/arm/mach-tegra/include/mach/hardware.h +0 -1
index 56e43b3..84c2658 100644
@@ -23,6 +23,5 @@
 
 #define PCIBIOS_MIN_IO			0x1000
 #define PCIBIOS_MIN_MEM			0
-#define pcibios_assign_all_busses()	1
 
 #endif
arch/arm/mach-versatile/include/mach/hardware.h +0 -2
index 6911e1f..8f60e94 100644
@@ -34,8 +34,6 @@
 #define PCIBIOS_MIN_IO			0x44000000
 #define PCIBIOS_MIN_MEM			0x50000000
 
-#define pcibios_assign_all_busses()     1
-
 /* macro to get at IO space when running virtually */
 #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
 
arch/arm/mm/iomap.c +4 -0
index ffad039..ad41414 100644
@@ -8,6 +8,7 @@
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
+#include <asm/pci.h>
 
 #ifdef __io
 void __iomem *ioport_map(unsigned long port, unsigned int nr)
@@ -23,6 +24,9 @@ EXPORT_SYMBOL(ioport_unmap);
 #endif
 
 #ifdef CONFIG_PCI
+unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
+EXPORT_SYMBOL(pci_flags);
+
 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
 	resource_size_t start = pci_resource_start(dev, bar);
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH v2 5/6 ARM: convert PCI defines to variables

In reply to Rob Herring

From: Rob Herring <[email protected]>

Convert PCIBIOS_MIN_IO and PCIBIOS_MIN_MEM to variables to allow multi-platform builds. This also removes the requirement for a platform to have a mach/hardware.h.

---
 arch/arm/include/asm/pci.h                       |    6 ++++-
 arch/arm/mach-cns3xxx/include/mach/hardware.h    |   21 -----------------
 arch/arm/mach-dove/include/mach/hardware.h       |    2 -
 arch/arm/mach-dove/pcie.c                        |    2 +
 arch/arm/mach-footbridge/dc21285.c               |    3 ++
 arch/arm/mach-footbridge/include/mach/hardware.h |    3 --
 arch/arm/mach-integrator/include/mach/hardware.h |    3 --
 arch/arm/mach-integrator/pci_v3.c                |    3 ++
 arch/arm/mach-iop13xx/include/mach/hardware.h    |    5 ----
 arch/arm/mach-iop13xx/pci.c                      |    4 +--
 arch/arm/mach-iop32x/include/mach/hardware.h     |    2 -
 arch/arm/mach-iop33x/include/mach/hardware.h     |    2 -
 arch/arm/mach-ixp2000/include/mach/hardware.h    |    6 -----
 arch/arm/mach-ixp23xx/include/mach/hardware.h    |    2 -
 arch/arm/mach-ixp23xx/pci.c                      |    2 +
 arch/arm/mach-ixp4xx/common-pci.c                |    6 +++++
 arch/arm/mach-ixp4xx/include/mach/hardware.h     |    3 --
 arch/arm/mach-kirkwood/include/mach/hardware.h   |    1 -
 arch/arm/mach-kirkwood/pcie.c                    |    3 ++
 arch/arm/mach-ks8695/include/mach/hardware.h     |    7 -----
 arch/arm/mach-mv78xx0/include/mach/hardware.h    |    2 -
 arch/arm/mach-mv78xx0/pcie.c                     |    3 ++
 arch/arm/mach-orion5x/include/mach/hardware.h    |    2 -
 arch/arm/mach-orion5x/pci.c                      |    3 ++
 arch/arm/mach-pxa/include/mach/hardware.h        |    5 ----
 arch/arm/mach-sa1100/include/mach/hardware.h     |    7 -----
 arch/arm/mach-shark/include/mach/hardware.h      |    2 -
 arch/arm/mach-shark/pci.c                        |   10 ++++++-
 arch/arm/mach-tegra/include/mach/hardware.h      |   27 ----------------------
 arch/arm/mach-tegra/pcie.c                       |    2 +
 arch/arm/mach-versatile/include/mach/hardware.h  |    4 ---
 arch/arm/mach-versatile/pci.c                    |    3 ++
 arch/arm/mm/iomap.c                              |    7 +++++-
 33 files changed, 50 insertions(+), 113 deletions(-)
 delete mode 100644 arch/arm/mach-cns3xxx/include/mach/hardware.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/hardware.h
arch/arm/include/asm/pci.h +5 -1
index cb77e66..2b1f245 100644
@@ -6,7 +6,11 @@
 #include <asm-generic/pci-bridge.h>
 
 #include <asm/mach/pci.h> /* for pci_sys_data */
-#include <mach/hardware.h> /* for PCIBIOS_MIN_* */
+
+extern unsigned long pcibios_min_io;
+#define PCIBIOS_MIN_IO pcibios_min_io
+extern unsigned long pcibios_min_mem;
+#define PCIBIOS_MIN_MEM pcibios_min_mem
 
 static inline int pcibios_assign_all_busses(void)
 {
arch/arm/mach-cns3xxx/include/mach/hardware.h deleted +0 -21
deleted file mode 100644
index 82a0d4e..0000000
@@ -1,21 +0,0 @@
-/*
- * This file contains the hardware definitions of the Cavium Networks boards.
- *
- * Copyright 2003 ARM Limited.
- * Copyright 2008 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- */
-
-#ifndef __MACH_HARDWARE_H
-#define __MACH_HARDWARE_H
-
-#include <asm/sizes.h>
-
-/* macro to get at IO space when running virtually */
-#define PCIBIOS_MIN_IO		0x00000000
-#define PCIBIOS_MIN_MEM		0x00000000
-
-#endif
arch/arm/mach-dove/include/mach/hardware.h +0 -2
index f619fb9..94c5a2c 100644
@@ -11,8 +11,6 @@
 
 #include "dove.h"
 
-#define PCIBIOS_MIN_IO			0x1000
-#define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			DOVE_PCIE0_MEM_PHYS_BASE
 
 
arch/arm/mach-dove/pcie.c +2 -0
index 502d1ca..4810426 100644
@@ -228,6 +228,8 @@ static void __init add_pcie_port(int index, unsigned long base)
 
 void __init dove_pcie_init(int init_port0, int init_port1)
 {
+	pcibios_min_io = 0x1000;
+	pcibios_min_mem = 0x01000000;
 	if (init_port0)
 		add_pcie_port(0, DOVE_PCIE0_VIRT_BASE);
 
arch/arm/mach-footbridge/dc21285.c +3 -0
index 3ffa548..e7ce279 100644
@@ -295,6 +295,9 @@ void __init dc21285_preinit(void)
 	unsigned int mem_size, mem_mask;
 	int cfn_mode;
 
+	pcibios_min_io = 0x1000;
+	pcibios_min_mem = 0x81000000;
+
 	mem_size = (unsigned int)high_memory - PAGE_OFFSET;
 	for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1)
 		if (mem_mask >= mem_size)
arch/arm/mach-footbridge/include/mach/hardware.h +0 -3
index 082e6ce..15d5498 100644
@@ -100,7 +100,4 @@ extern unsigned int nw_gpio_read(void);
 extern void nw_cpld_modify(unsigned int mask, unsigned int set);
 #endif
 
-#define PCIBIOS_MIN_IO		0x1000
-#define PCIBIOS_MIN_MEM 	0x81000000
-
 #endif
arch/arm/mach-integrator/include/mach/hardware.h +0 -3
index 37323ea..0ce5212 100644
@@ -34,9 +34,6 @@
 
 #define PCIMEM_BASE		PCI_MEMORY_VADDR
 
-#define PCIBIOS_MIN_IO		0x6000
-#define PCIBIOS_MIN_MEM 	0x00100000
-
 /* macro to get at IO space when running virtually */
 #ifdef CONFIG_MMU
 #define IO_ADDRESS(x)	(((x) & 0x000fffff) | (((x) >> 4) & 0x0ff00000) | IO_BASE)
arch/arm/mach-integrator/pci_v3.c +3 -0
index 6467d99..11b86e5 100644
@@ -502,6 +502,9 @@ void __init pci_v3_preinit(void)
 	unsigned int temp;
 	int ret;
 
+	pcibios_min_io = 0x6000;
+	pcibios_min_mem = 0x00100000;
+
 	/*
 	 * Hook in our fault handler for PCI errors
 	 */
arch/arm/mach-iop13xx/include/mach/hardware.h +0 -5
index ba81e50..786fa26 100644
@@ -3,15 +3,10 @@
 #include <asm/types.h>
 
 #ifndef __ASSEMBLY__
-extern unsigned long iop13xx_pcibios_min_io;
-extern unsigned long iop13xx_pcibios_min_mem;
 extern u16 iop13xx_dev_id(void);
 extern void iop13xx_set_atu_mmr_bases(void);
 #endif
 
-#define PCIBIOS_MIN_IO      (iop13xx_pcibios_min_io)
-#define PCIBIOS_MIN_MEM     (iop13xx_pcibios_min_mem)
-
 /*
  * Generic chipset bits
  *
arch/arm/mach-iop13xx/pci.c +1 -3
index ba3dae3..6027210 100644
@@ -39,8 +39,6 @@ u32 iop13xx_atue_mem_base;
 u32 iop13xx_atux_mem_base;
 size_t iop13xx_atue_mem_size;
 size_t iop13xx_atux_mem_size;
-unsigned long iop13xx_pcibios_min_io = 0;
-unsigned long iop13xx_pcibios_min_mem = 0;
 
 EXPORT_SYMBOL(iop13xx_atue_mem_base);
 EXPORT_SYMBOL(iop13xx_atux_mem_base);
@@ -971,7 +969,7 @@ void __init iop13xx_pci_init(void)
 	__raw_writel(__raw_readl(IOP13XX_XBG_BECSR) & 3, IOP13XX_XBG_BECSR);
 
 	/* Setup the Min Address for PCI memory... */
-	iop13xx_pcibios_min_mem = IOP13XX_PCIX_LOWER_MEM_BA;
+	pcibios_min_mem = IOP13XX_PCIX_LOWER_MEM_BA;
 
 	/* if Linux is given control of an ATU
 	 * clear out its prior configuration,
arch/arm/mach-iop32x/include/mach/hardware.h +0 -2
index e68bf97..48cb1b2 100644
@@ -18,8 +18,6 @@
  * but when we read them, we convert them to virtual addresses. See
  * arch/arm/plat-iop/pci.c.
  */
-#define PCIBIOS_MIN_IO		0x00000000
-#define PCIBIOS_MIN_MEM		0x00000000
 
 #ifndef __ASSEMBLY__
 void iop32x_init_irq(void);
arch/arm/mach-iop33x/include/mach/hardware.h +0 -2
index 215065b..8392853 100644
@@ -18,8 +18,6 @@
  * but when we read them, we convert them to virtual addresses.  See
  * arch/arm/mach-iop3xx/iop3xx-pci.c
  */
-#define PCIBIOS_MIN_IO		0x00000000
-#define PCIBIOS_MIN_MEM		0x00000000
 
 #ifndef __ASSEMBLY__
 void iop33x_init_irq(void);
arch/arm/mach-ixp2000/include/mach/hardware.h +0 -6
index 6c92008..cdaf1db 100644
@@ -19,12 +19,6 @@
 #ifndef __ASM_ARCH_HARDWARE_H__
 #define __ASM_ARCH_HARDWARE_H__
 
-/*
- * This needs to be platform-specific?
- */
-#define PCIBIOS_MIN_IO          0x00000000
-#define PCIBIOS_MIN_MEM         0x00000000
-
 #include "ixp2000-regs.h"	/* Chipset Registers */
 
 /*
arch/arm/mach-ixp23xx/include/mach/hardware.h +0 -2
index b8bb781..60e55fa 100644
@@ -15,8 +15,6 @@
 #define __ASM_ARCH_HARDWARE_H
 
 /* PCI IO info */
-#define PCIBIOS_MIN_IO		0x00000000
-#define PCIBIOS_MIN_MEM		0xe0000000
 
 #include "ixp23xx.h"
 
arch/arm/mach-ixp23xx/pci.c +2 -0
index 72d145a..4913991 100644
@@ -227,6 +227,8 @@ static void __init ixp23xx_pci_common_init(void)
 
 void __init ixp23xx_pci_preinit(void)
 {
+	pcibios_min_mem = 0xe0000000;
+
 	pci_set_flags(0);
 
 	ixp23xx_pci_common_init();
arch/arm/mach-ixp4xx/common-pci.c +6 -0
index e9a5893..33e3bd8 100644
@@ -346,6 +346,12 @@ void __init ixp4xx_pci_preinit(void)
 {
 	unsigned long cpuid = read_cpuid_id();
 
+	pcibios_min_io = 0x00001000;
+#ifdef CONFIG_IXP4XX_INDIRECT_PCI
+	pcibios_min_mem = 0x10000000; /* 1 GB of indirect PCI MMIO space */
+#else
+	pcibios_min_mem = 0x48000000; /* 64 MB of PCI MMIO space */
+#endif
 	/*
 	 * Determine which PCI read method to use.
 	 * Rev 0 IXP425 requires workaround.
arch/arm/mach-ixp4xx/include/mach/hardware.h +0 -3
index a0921c6..034bb2a 100644
@@ -17,12 +17,9 @@
 #ifndef __ASM_ARCH_HARDWARE_H__
 #define __ASM_ARCH_HARDWARE_H__
 
-#define PCIBIOS_MIN_IO		0x00001000
 #ifdef CONFIG_IXP4XX_INDIRECT_PCI
-#define PCIBIOS_MIN_MEM		0x10000000 /* 1 GB of indirect PCI MMIO space */
 #define PCIBIOS_MAX_MEM		0x4FFFFFFF
 #else
-#define PCIBIOS_MIN_MEM		0x48000000 /* 64 MB of PCI MMIO space */
 #define PCIBIOS_MAX_MEM		0x4BFFFFFF
 #endif
 
arch/arm/mach-kirkwood/include/mach/hardware.h +0 -1
index 31b81fe..470899b 100644
@@ -11,7 +11,6 @@
 
 #include "kirkwood.h"
 
-#define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
 
 
arch/arm/mach-kirkwood/pcie.c +3 -0
index ca294ff..6e32b8a 100644
@@ -271,6 +271,9 @@ static void __init add_pcie_port(int index, unsigned long base)
 
 void __init kirkwood_pcie_init(unsigned int portmask)
 {
+	pcibios_min_io = 0x00001000;
+	pcibios_min_mem = 0x01000000;
+
 	if (portmask & KW_PCIE0)
 		add_pcie_port(0, PCIE_VIRT_BASE);
 
arch/arm/mach-ks8695/include/mach/hardware.h +0 -7
index a46be88..5e0c388 100644
@@ -42,11 +42,4 @@
 #define KS8695_PCIIO_PA		0x80000000
 #define KS8695_PCIIO_SIZE	SZ_64K
 
-
-/*
- * PCI support
- */
-#define PCIBIOS_MIN_IO		0
-#define PCIBIOS_MIN_MEM		0
-
 #endif
arch/arm/mach-mv78xx0/include/mach/hardware.h +0 -2
index c76b93f..29e37ed 100644
@@ -11,8 +11,6 @@
 
 #include "mv78xx0.h"
 
-#define PCIBIOS_MIN_IO			0x00001000
-#define PCIBIOS_MIN_MEM			0x01000000
 #define PCIMEM_BASE			MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
 
 
arch/arm/mach-mv78xx0/pcie.c +3 -0
index a560439..cc9d1b9 100644
@@ -297,6 +297,9 @@ static void __init add_pcie_port(int maj, int min, unsigned long base)
 
 void __init mv78xx0_pcie_init(int init_port0, int init_port1)
 {
+	pcibios_min_io = 0x00001000;
+	pcibios_min_mem = 0x01000000;
+
 	if (init_port0) {
 		add_pcie_port(0, 0, PCIE00_VIRT_BASE);
 		if (!orion_pcie_x4_mode((void __iomem *)PCIE00_VIRT_BASE)) {
arch/arm/mach-orion5x/include/mach/hardware.h +0 -2
index a42b743..b6d55bc 100644
@@ -11,8 +11,6 @@
 
 #include "orion5x.h"
 
-#define PCIBIOS_MIN_IO		0x00001000
-#define PCIBIOS_MIN_MEM		0x01000000
 #define PCIMEM_BASE		ORION5X_PCIE_MEM_PHYS_BASE
 
 
arch/arm/mach-orion5x/pci.c +3 -0
index e8706f1..d80aeef 100644
@@ -560,6 +560,9 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)
 {
 	int ret = 0;
 
+	pcibios_min_io = 0x00001000;
+	pcibios_min_mem = 0x01000000;
+
 	if (nr == 0) {
 		orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr);
 		ret = pcie_setup(sys);
arch/arm/mach-pxa/include/mach/hardware.h +0 -5
index bd6e928..e39e460 100644
@@ -336,9 +336,4 @@ extern unsigned int get_memclk_frequency_10khz(void);
 extern unsigned long get_clock_tick_rate(void);
 #endif
 
-#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
-#define PCIBIOS_MIN_IO		0
-#define PCIBIOS_MIN_MEM		0
-#endif
-
 #endif  /* _ASM_ARCH_HARDWARE_H */
arch/arm/mach-sa1100/include/mach/hardware.h +0 -7
index 5946af2..99f5856 100644
@@ -76,11 +76,4 @@ static inline unsigned long get_clock_tick_rate(void)
 #include "SA-1101.h"
 #endif
 
-#if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_PCI)
-#define PCIBIOS_MIN_IO		0
-#define PCIBIOS_MIN_MEM		0
-#define HAVE_ARCH_PCI_SET_DMA_MASK	1
-#endif
-
-
 #endif  /* _ASM_ARCH_HARDWARE_H */
arch/arm/mach-shark/include/mach/hardware.h +0 -2
index 24639ce..4342931 100644
@@ -12,8 +12,6 @@
 
 #define UNCACHEABLE_ADDR        0xdf010000
 
-#define PCIBIOS_MIN_IO          0x6000
-#define PCIBIOS_MIN_MEM         0x50000000
 #define PCIMEM_BASE		0xe8000000
 
 #endif
arch/arm/mach-shark/pci.c +8 -2
index 89d175c..4aea637 100644
@@ -37,8 +37,14 @@ static struct hw_pci shark_pci __initdata = {
 
 static int __init shark_pci_init(void)
 {
-	if (machine_is_shark())
-		pci_common_init(&shark_pci);
+	if (!machine_is_shark())
+		return;
+
+	pcibios_min_io = 0x6000;
+	pcibios_min_mem = 0x50000000;
+
+	pci_common_init(&shark_pci);
+
 	return 0;
 }
 
arch/arm/mach-tegra/include/mach/hardware.h deleted +0 -27
deleted file mode 100644
index 84c2658..0000000
@@ -1,27 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/hardware.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- *	Colin Cross <[email protected]>
- *	Erik Gilling <[email protected]>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MACH_TEGRA_HARDWARE_H
-#define __MACH_TEGRA_HARDWARE_H
-
-#define PCIBIOS_MIN_IO			0x1000
-#define PCIBIOS_MIN_MEM			0
-
-#endif
arch/arm/mach-tegra/pcie.c +2 -0
index 2941212..c4eba2c 100644
@@ -912,6 +912,8 @@ int __init tegra_pcie_init(bool init_port0, bool init_port1)
 	if (!(init_port0 || init_port1))
 		return -ENODEV;
 
+	pcibios_min_io = 0x1000;
+
 	err = tegra_pcie_get_resources();
 	if (err)
 		return err;
arch/arm/mach-versatile/include/mach/hardware.h +0 -4
index 8f60e94..4d4973d 100644
@@ -30,10 +30,6 @@
 #define VERSATILE_PCI_VIRT_BASE		(void __iomem *)0xe8000000ul
 #define VERSATILE_PCI_CFG_VIRT_BASE	(void __iomem *)0xe9000000ul
 
-/* CIK guesswork */
-#define PCIBIOS_MIN_IO			0x44000000
-#define PCIBIOS_MIN_MEM			0x50000000
-
 /* macro to get at IO space when running virtually */
 #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
 
arch/arm/mach-versatile/pci.c +3 -0
index 13c7e5f..7848a17 100644
@@ -311,6 +311,9 @@ struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
 
 void __init pci_versatile_preinit(void)
 {
+	pcibios_min_io = 0x44000000;
+	pcibios_min_mem = 0x50000000;
+
 	__raw_writel(VERSATILE_PCI_MEM_BASE0 >> 28, PCI_IMAP0);
 	__raw_writel(VERSATILE_PCI_MEM_BASE1 >> 28, PCI_IMAP1);
 	__raw_writel(VERSATILE_PCI_MEM_BASE2 >> 28, PCI_IMAP2);
arch/arm/mm/iomap.c +6 -1
index ad41414..8946326 100644
@@ -8,7 +8,6 @@
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
-#include <asm/pci.h>
 
 #ifdef __io
 void __iomem *ioport_map(unsigned long port, unsigned int nr)
@@ -24,6 +23,12 @@ EXPORT_SYMBOL(ioport_unmap);
 #endif
 
 #ifdef CONFIG_PCI
+unsigned long pcibios_min_io;
+EXPORT_SYMBOL(pcibios_min_io);
+
+unsigned long pcibios_min_mem;
+EXPORT_SYMBOL(pcibios_min_mem);
+
 unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
 EXPORT_SYMBOL(pci_flags);
 
Signature · 1 line
1.7.4.1
#16 lore raw

PATCH v2 6/6 ARM: set vga memory base at run-time

In reply to Rob Herring

From: Rob Herring <[email protected]>

Convert the incorrectly named PCIMEM_BASE to a variable called vga_base. This removes the dependency on mach/hardware.h.

---
 arch/arm/include/asm/vga.h                       |    5 +++--
 arch/arm/mach-dove/include/mach/hardware.h       |    3 ---
 arch/arm/mach-dove/pcie.c                        |    3 +++
 arch/arm/mach-footbridge/dc21285.c               |    1 +
 arch/arm/mach-integrator/include/mach/hardware.h |    2 --
 arch/arm/mach-integrator/pci_v3.c                |    2 ++
 arch/arm/mach-kirkwood/include/mach/hardware.h   |    3 ---
 arch/arm/mach-kirkwood/pcie.c                    |    2 ++
 arch/arm/mach-mv78xx0/include/mach/hardware.h    |    3 ---
 arch/arm/mach-mv78xx0/pcie.c                     |    2 ++
 arch/arm/mach-orion5x/include/mach/hardware.h    |    3 ---
 arch/arm/mach-orion5x/pci.c                      |    1 +
 arch/arm/mach-shark/include/mach/hardware.h      |    2 --
 arch/arm/mach-shark/pci.c                        |    2 ++
 arch/arm/mm/iomap.c                              |    3 +++
 15 files changed, 19 insertions(+), 18 deletions(-)
arch/arm/include/asm/vga.h +3 -2
index 250a4dd..91f4021 100644
@@ -2,9 +2,10 @@
 #define ASMARM_VGA_H
 
 #include <linux/io.h>
-#include <mach/hardware.h>
 
-#define VGA_MAP_MEM(x,s)	(PCIMEM_BASE + (x))
+extern unsigned long vga_base;
+
+#define VGA_MAP_MEM(x,s)	(vga_base + (x))
 
 #define vga_readb(x)	(*((volatile unsigned char *)x))
 #define vga_writeb(x,y)	(*((volatile unsigned char *)y) = (x))
arch/arm/mach-dove/include/mach/hardware.h +0 -3
index 94c5a2c..f1368b9 100644
@@ -11,9 +11,6 @@
 
 #include "dove.h"
 
-#define PCIMEM_BASE			DOVE_PCIE0_MEM_PHYS_BASE
-
-
 /* Macros below are required for compatibility with PXA AC'97 driver.	*/
 #define __REG(x)	(*((volatile u32 *)((x) - DOVE_SB_REGS_PHYS_BASE + \
 				DOVE_SB_REGS_VIRT_BASE)))
arch/arm/mach-dove/pcie.c +3 -0
index 4810426..021579a 100644
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/mbus.h>
+#include <video/vga.h>
 #include <asm/mach/pci.h>
 #include <asm/mach/arch.h>
 #include <asm/setup.h>
@@ -230,6 +231,8 @@ void __init dove_pcie_init(int init_port0, int init_port1)
 {
 	pcibios_min_io = 0x1000;
 	pcibios_min_mem = 0x01000000;
+	vga_base = DOVE_PCIE0_MEM_PHYS_BASE;
+
 	if (init_port0)
 		add_pcie_port(0, DOVE_PCIE0_VIRT_BASE);
 
arch/arm/mach-footbridge/dc21285.c +1 -0
index e7ce279..5821fdd 100644
@@ -297,6 +297,7 @@ void __init dc21285_preinit(void)
 
 	pcibios_min_io = 0x1000;
 	pcibios_min_mem = 0x81000000;
+	vga_base = PCIMEM_BASE;
 
 	mem_size = (unsigned int)high_memory - PAGE_OFFSET;
 	for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1)
arch/arm/mach-integrator/include/mach/hardware.h +0 -2
index 0ce5212..65fed7c 100644
@@ -32,8 +32,6 @@
 #define IO_SIZE			0x0B000000                 // How much?
 #define IO_START		INTEGRATOR_HDR_BASE        // PA of IO
 
-#define PCIMEM_BASE		PCI_MEMORY_VADDR
-
 /* macro to get@IO space when running virtually */
 #ifdef CONFIG_MMU
 #define IO_ADDRESS(x)	(((x) & 0x000fffff) | (((x) >> 4) & 0x0ff00000) | IO_BASE)
arch/arm/mach-integrator/pci_v3.c +2 -0
index 11b86e5..dd56bfb 100644
@@ -27,6 +27,7 @@
 #include <linux/spinlock.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <video/vga.h>
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
@@ -504,6 +505,7 @@ void __init pci_v3_preinit(void)
 
 	pcibios_min_io = 0x6000;
 	pcibios_min_mem = 0x00100000;
+	vga_base = PCI_MEMORY_VADDR;
 
 	/*
 	 * Hook in our fault handler for PCI errors
arch/arm/mach-kirkwood/include/mach/hardware.h +0 -3
index 470899b..742b74f 100644
@@ -11,7 +11,4 @@
 
 #include "kirkwood.h"
 
-#define PCIMEM_BASE			KIRKWOOD_PCIE_MEM_PHYS_BASE /* mem base for VGA */
-
-
 #endif
arch/arm/mach-kirkwood/pcie.c +2 -0
index 6e32b8a..b53002c 100644
@@ -12,6 +12,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/mbus.h>
+#include <video/vga.h>
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
 #include <plat/pcie.h>
@@ -273,6 +274,7 @@ void __init kirkwood_pcie_init(unsigned int portmask)
 {
 	pcibios_min_io = 0x00001000;
 	pcibios_min_mem = 0x01000000;
+	vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
 
 	if (portmask & KW_PCIE0)
 		add_pcie_port(0, PCIE_VIRT_BASE);
arch/arm/mach-mv78xx0/include/mach/hardware.h +0 -3
index 29e37ed..67cab0a 100644
@@ -11,7 +11,4 @@
 
 #include "mv78xx0.h"
 
-#define PCIMEM_BASE			MV78XX0_PCIE_MEM_PHYS_BASE /* mem base for VGA */
-
-
 #endif
arch/arm/mach-mv78xx0/pcie.c +2 -0
index cc9d1b9..bafd1ed 100644
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/mbus.h>
+#include <video/vga.h>
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
 #include <plat/pcie.h>
@@ -299,6 +300,7 @@ void __init mv78xx0_pcie_init(int init_port0, int init_port1)
 {
 	pcibios_min_io = 0x00001000;
 	pcibios_min_mem = 0x01000000;
+	vga_base = MV78XX0_PCIE_MEM_PHYS_BASE;
 
 	if (init_port0) {
 		add_pcie_port(0, 0, PCIE00_VIRT_BASE);
arch/arm/mach-orion5x/include/mach/hardware.h +0 -3
index b6d55bc..3957354 100644
@@ -11,7 +11,4 @@
 
 #include "orion5x.h"
 
-#define PCIMEM_BASE		ORION5X_PCIE_MEM_PHYS_BASE
-
-
 #endif
arch/arm/mach-orion5x/pci.c +1 -0
index d80aeef..7dc672c 100644
@@ -562,6 +562,7 @@ int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys)
 
 	pcibios_min_io = 0x00001000;
 	pcibios_min_mem = 0x01000000;
+	vga_base = ORION5X_PCIE_MEM_PHYS_BASE;
 
 	if (nr == 0) {
 		orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr);
arch/arm/mach-shark/include/mach/hardware.h +0 -2
index 4342931..663f952 100644
@@ -12,7 +12,5 @@
 
 #define UNCACHEABLE_ADDR        0xdf010000
 
-#define PCIMEM_BASE		0xe8000000
-
 #endif
 
arch/arm/mach-shark/pci.c +2 -0
index 4aea637..92d7227 100644
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <video/vga.h>
 
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
@@ -42,6 +43,7 @@ static int __init shark_pci_init(void)
 
 	pcibios_min_io = 0x6000;
 	pcibios_min_mem = 0x50000000;
+	vga_base = 0xe8000000;
 
 	pci_common_init(&shark_pci);
 
arch/arm/mm/iomap.c +3 -0
index 8946326..476ad1a 100644
@@ -9,6 +9,9 @@
 #include <linux/ioport.h>
 #include <linux/io.h>
 
+unsigned long vga_base;
+EXPORT_SYMBOL(vga_base);
+
 #ifdef __io
 void __iomem *ioport_map(unsigned long port, unsigned int nr)
 {
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/6] microblaze: move pci flag functions into asm-generic

In reply to Rob Herring
Quoted 4 lines · On Wed, 29 Jun 2011 11:46:54 -0500 Rob Herring <[email protected]> wrote:

From: Rob Herring <[email protected]>

Move pci_set_flags, pci_add_flags, and pci_has_flag into asm-generic/pci-bridge.h so other archs can use them.

Looks like something Ram may be able to re-use when adding resource alloc behavior flags for the new bridge realloc code.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
maintainer
#13 lore raw

Re: [PATCH 5/6] ARM: convert PCI defines to variables

In reply to Rob Herring

Hi Rob,

Quoted 5 lines · On Wednesday 29 June 2011 18:46:58 Rob Herring wrote:

From: Rob Herring <[email protected]>

Convert PCIBIOS_MIN_IO and PCIBIOS_MIN_MEM to variables to allow multi-platform builds. This also removes the requirement for a platform to have a mach/hardware.h.

Good idea.

arch/arm/mm/iomap.c EXPORT_SYMBOL(ioport_unmap); · line 31

Quoted 10 lines
arch/arm/mm/iomap.c +6 -0
@@ -24,6 +23,12 @@ EXPORT_SYMBOL(ioport_unmap);
 #endif
 
 #ifdef CONFIG_PCI
+unsigned long pcibios_min_io;
+EXPORT_SYMBOL(pcibios_min_io);
+
+unsigned long pcibios_min_mem;
+EXPORT_SYMBOL(pcibios_min_mem);
+

How about setting these to sensible defaults that will work on most platforms, so that the majority won't have to set them at all?

Basically, the defaults should clearly be

unsigned long pcibios_min_io = 0x1000;
unsigned long pcibios_min_mem = 0x01000000;

This just gets us out of the ISA bus range, so an ISA card behind a bridge can use all cards correctly. Most of the ones that currently set both to zero can probably just use those defaults as well, but some architectures have multiple buses or don't start the memory range at zero, so they might need higher values.

arch/arm/mach-versatile/include/mach/hardware.h line 35

Quoted 13 lines
arch/arm/mach-versatile/include/mach/hardware.h +0 -4
@@ -30,10 +30,6 @@
 #define VERSATILE_PCI_VIRT_BASE		(void __iomem *)0xe8000000ul
 #define VERSATILE_PCI_CFG_VIRT_BASE	(void __iomem *)0xe9000000ul
 
-/* CIK guesswork */
-#define PCIBIOS_MIN_IO			0x44000000
-#define PCIBIOS_MIN_MEM			0x50000000
-
 /* macro to get at IO space when running virtually */
 #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
 

This PCIBIOS_MIN_IO setting is wrong, and PIO doesn't work on versatile because of this. I have an older patch series that I should dig out again to fix them and make versatile use the defaults. Don't worry about this one.

Arnd

maintainer Reviewed-by on the v2 series
#17 lore raw
In reply to Rob Herring
Quoted 13 lines · On Wednesday 29 June 2011 18:46:53 Rob Herring wrote:

From: Rob Herring <[email protected]>

Currently, all ARM platforms must have a mach/hardware.h include. This is because it is ultimately included by linux/pci.h which is included in many places even for !CONFIG_PCI.

This could be fixed simply with an ifdef around the include of mach/hardware.h in asm/pci.h. However, in the interest of fixing this for single kernel binary builds, this series removes the include of mach/hardware.h outside of mach-* and plat-*. What's used from hardware.h is a couple of PCI defines. Converting them to variables allows each platform to set the values as needed.

Quoted 4 lines

This does not address the inclusion of mach/hardware.h under drivers/*. This appears to be mostly older platforms. There could also be some indirect inclusions from other mach/* headers.

Hi Rob,

This is very good work, I really like it. I've mentioned one idea for an improvement in patch 5, which you can still integrate, but otherwise

for the whole series.

Thanks,

Arnd

#14 lore raw

Re: [PATCH 5/6] ARM: convert PCI defines to variables

In reply to Arnd Bergmann

Arnd,

Quoted 28 lines · Arnd Bergmann

Hi Rob,

Quoted 5 lines · On Wednesday 29 June 2011 18:46:58 Rob Herring wrote:

From: Rob Herring <[email protected]>

Convert PCIBIOS_MIN_IO and PCIBIOS_MIN_MEM to variables to allow multi-platform builds. This also removes the requirement for a platform to have a mach/hardware.h.

Good idea.

arch/arm/mm/iomap.c EXPORT_SYMBOL(ioport_unmap); · line 31

Quoted 10 lines
arch/arm/mm/iomap.c +6 -0
@@ -24,6 +23,12 @@ EXPORT_SYMBOL(ioport_unmap);
 #endif
 
 #ifdef CONFIG_PCI
+unsigned long pcibios_min_io;
+EXPORT_SYMBOL(pcibios_min_io);
+
+unsigned long pcibios_min_mem;
+EXPORT_SYMBOL(pcibios_min_mem);
+

How about setting these to sensible defaults that will work on most platforms, so that the majority won't have to set them at all?

Basically, the defaults should clearly be

Quoted 8 lines

unsigned long pcibios_min_io = 0x1000;
unsigned long pcibios_min_mem = 0x01000000;

This just gets us out of the ISA bus range, so an ISA card behind a bridge can use all cards correctly. Most of the ones that currently set both to zero can probably just use those defaults as well, but some architectures have multiple buses or don't start the memory range at zero, so they might need higher values.

For many platforms, the defaults are 0 for both of these, so I went with that. Do you think those are just wrong?

Rob

Quoted 21 lines
Quoted 4 lines

arch/arm/mach-versatile/include/mach/hardware.h line 35

Quoted 10 lines
arch/arm/mach-versatile/include/mach/hardware.h +0 -4
@@ -30,10 +30,6 @@
 #define VERSATILE_PCI_VIRT_BASE		(void __iomem *)0xe8000000ul
 #define VERSATILE_PCI_CFG_VIRT_BASE	(void __iomem *)0xe9000000ul
 
-/* CIK guesswork */
-#define PCIBIOS_MIN_IO			0x44000000
-#define PCIBIOS_MIN_MEM			0x50000000
-
 /* macro to get at IO space when running virtually */
 #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
 

This PCIBIOS_MIN_IO setting is wrong, and PIO doesn't work on versatile because of this. I have an older patch series that I should dig out again to fix them and make versatile use the defaults. Don't worry about this one.

Arnd

maintainer
#15 lore raw

Re: [PATCH 5/6] ARM: convert PCI defines to variables

Quoted 5 lines · On Saturday 02 July 2011 14:40:19 Rob Herring wrote:
Quoted 5 lines

Basically, the defaults should clearly be

unsigned long pcibios_min_io = 0x1000;
unsigned long pcibios_min_mem = 0x01000000;

Quoted 8 lines
Quoted 5 lines

This just gets us out of the ISA bus range, so an ISA card behind a bridge can use all cards correctly. Most of the ones that currently set both to zero can probably just use those defaults as well, but some architectures have multiple buses or don't start the memory range at zero, so they might need higher values.

For many platforms, the defaults are 0 for both of these, so I went with that. Do you think those are just wrong?

They prevent you from having a VGA card or anything else that uses the legacy ISA I/O ranges on the PCI bus, so it's a bad default.

However, some platforms may have specific reasons not to use these values but instead start the address allocation at zero. E.g. the memory window may be severely limited in some implementations, so you can't afford to lose the first 16 MB.

I would make the default 0x1000/0x01000000 and specifically set the platforms that require other values, possibly with a comment questioning whether that's a good choice.

Arnd

maintainer
#4 lore raw

Re: [PATCH 1/6] microblaze: move pci flag functions into asm-generic

In reply to Rob Herring

Hi Arnd and Ben,

Ben: how is it going with your OF pci redesigning patches?

Quoted 125 lines · Rob Herring

From: Rob Herring <[email protected]>

Move pci_set_flags, pci_add_flags, and pci_has_flag into asm-generic/pci-bridge.h so other archs can use them.

---
 arch/microblaze/include/asm/pci-bridge.h |   36 +-----------------
 include/asm-generic/pci-bridge.h         |   62 ++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 35 deletions(-)
 create mode 100644 include/asm-generic/pci-bridge.h
arch/microblaze/include/asm/pci-bridge.h +1 -35
index 746df91..ad1480f 100644
@@ -10,6 +10,7 @@
 #include <linux/pci.h>
 #include <linux/list.h>
 #include <linux/ioport.h>
+#include <asm-generic/pci-bridge.h>
 
 struct device_node;
 
@@ -164,40 +165,5 @@ extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
 extern void pcibios_free_controller(struct pci_controller *phb);
 extern void pcibios_setup_phb_resources(struct pci_controller *hose);
 
-#ifdef CONFIG_PCI
-extern unsigned int pci_flags;
-
-static inline void pci_set_flags(int flags)
-{
-	pci_flags = flags;
-}
-
-static inline void pci_add_flags(int flags)
-{
-	pci_flags |= flags;
-}
-
-static inline int pci_has_flag(int flag)
-{
-	return pci_flags & flag;
-}
-
-extern struct list_head hose_list;
-
-extern int pcibios_vaddr_is_ioport(void __iomem *address);
-#else
-static inline int pcibios_vaddr_is_ioport(void __iomem *address)
-{
-	return 0;
-}
-
-static inline void pci_set_flags(int flags) { }
-static inline void pci_add_flags(int flags) { }
-static inline int pci_has_flag(int flag)
-{
-	return 0;
-}
-#endif	/* CONFIG_PCI */
-
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_MICROBLAZE_PCI_BRIDGE_H */
include/asm-generic/pci-bridge.h new file +52 -0
new file mode 100644
index 0000000..4a5aca2
@@ -0,0 +1,62 @@
+/*
+ * 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 the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _ASM_GENERIC_PCI_BRIDGE_H
+#define _ASM_GENERIC_PCI_BRIDGE_H
+
+#ifdef __KERNEL__
+
+enum {
+	/* Force re-assigning all resources (ignore firmware
+	 * setup completely)
+	 */
+	PCI_REASSIGN_ALL_RSRC	= 0x00000001,
+
+	/* Re-assign all bus numbers */
+	PCI_REASSIGN_ALL_BUS	= 0x00000002,
+
+	/* Do not try to assign, just use existing setup */
+	PCI_PROBE_ONLY		= 0x00000004,
+
+	/* Don't bother with ISA alignment unless the bridge has
+	 * ISA forwarding enabled
+	 */
+	PCI_CAN_SKIP_ISA_ALIGN	= 0x00000008,
+
+	/* Enable domain numbers in /proc */
+	PCI_ENABLE_PROC_DOMAINS	= 0x00000010,
+	/* ... except for domain 0 */
+	PCI_COMPAT_DOMAIN_0	= 0x00000020,
+};
+
+#ifdef CONFIG_PCI
+extern unsigned int pci_flags;
+
+static inline void pci_set_flags(int flags)
+{
+	pci_flags = flags;
+}
+
+static inline void pci_add_flags(int flags)
+{
+	pci_flags |= flags;
+}
+
+static inline int pci_has_flag(int flag)
+{
+	return pci_flags & flag;
+}
+#else

include/asm-generic/pci-bridge.h line 62

Quoted 10 lines
include/asm-generic/pci-bridge.h new file +10 -0
+static inline void pci_set_flags(int flags) { }
+static inline void pci_add_flags(int flags) { }
+static inline int pci_has_flag(int flag)
+{
+	return 0;
+}
+#endif	/* CONFIG_PCI */
+
+#endif	/* __KERNEL__ */
+#endif	/* _ASM_GENERIC_PCI_BRIDGE_H */

Rob has sent some patches about introducing asm-generic/pci-bridge.h. Interesting is that Microblaze doesn't use that functions (pci_set/add/has_flag). There are some points where we could use that generic functions.

Almost the same case is for ppc - especially pci_has_flag function should be used more.

New pci-bridge could be used just by Microblaze. For PPC you will have to change variable name.

Anyway. If you want to add this patch to the mainline you should change ppc code
and get ACK from them. I am not pci expert to tell you if is the right thing
to do it. Ben?

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#6 lore raw

Re: [PATCH 2/6] ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

In reply to Rob Herring

Nicolas,

Quoted 56 lines · Rob Herring

From: Rob Herring <[email protected]>

On ixp4xx and pxa, ARCH_HAS_DMA_SET_COHERENT_MASK resides in hardware.h which does not get directly included by dma-mapping.h. Move it into mach/memory.h which is explicitly included.

---
 arch/arm/mach-ixp4xx/include/mach/hardware.h |    2 --
 arch/arm/mach-ixp4xx/include/mach/memory.h   |    1 +
 arch/arm/mach-pxa/include/mach/hardware.h    |    1 -
 arch/arm/mach-pxa/include/mach/memory.h      |    1 +
 4 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-ixp4xx/include/mach/hardware.h +0 -2
index 8138371..f91ca6d 100644
@@ -26,8 +26,6 @@
 #define PCIBIOS_MAX_MEM		0x4BFFFFFF
 #endif
 
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
-
 #define pcibios_assign_all_busses()	1
 
 /* Register locations and bits */
arch/arm/mach-ixp4xx/include/mach/memory.h +1 -0
index 34e7940..d671f5c 100644
@@ -16,6 +16,7 @@
 
 #ifdef CONFIG_PCI
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif
arch/arm/mach-pxa/include/mach/hardware.h +0 -1
index 6957ba5..313051c 100644
@@ -340,7 +340,6 @@ extern unsigned long get_clock_tick_rate(void);
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
 #define pcibios_assign_all_busses()	1
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif  /* _ASM_ARCH_HARDWARE_H */
arch/arm/mach-pxa/include/mach/memory.h +0 -0
index 07734f3..e697578 100644

arch/arm/mach-pxa/include/mach/memory.h line 25

Quoted 7 lines
arch/arm/mach-pxa/include/mach/memory.h +1 -0
@@ -19,6 +19,7 @@
 
 #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif

I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE series. Can you add this into your series? This still presents another issue to solve for single kernel binary, but hopefully the dma mapping work will help.

Rob

#7 lore raw

Re: [PATCH 2/6] ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

Quoted 4 lines · Rob Herring

I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE series. Can you add this into your series? This still presents another issue to solve for single kernel binary, but hopefully the dma mapping work will help.

That's a different problem - its about limiting the maximum DMA mask which can be set, so that memory is sourced from the right place even for drivers which use 32-bit masks.

It's needed to ensure that dma_set_coherent_mask() can be overridden. One solution to it would be to ensure that we always define ARCH_HAS_DMA_SET_COHERENT_MASK, and handle the differences internally, which is something I've been thinking about adding to my DMA bounce series of patches.

#8 lore raw

Re: [PATCH 2/6] ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

Quoted 9 lines · Russell King - ARM Linux
Quoted 4 lines · Rob Herring

I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE series. Can you add this into your series? This still presents another issue to solve for single kernel binary, but hopefully the dma mapping work will help.

That's a different problem - its about limiting the maximum DMA mask which can be set, so that memory is sourced from the right place even for drivers which use 32-bit masks.

Yes, I know that they are different.

Quoted 5 lines

It's needed to ensure that dma_set_coherent_mask() can be overridden. One solution to it would be to ensure that we always define ARCH_HAS_DMA_SET_COHERENT_MASK, and handle the differences internally, which is something I've been thinking about adding to my DMA bounce series of patches.

asm/dma-mapping.h only includes asm/memory.h. We are getting lucky that linux/dma-mapping.h is picking up ARCH_HAS_DMA_SET_COHERENT_MASK because the include path looks like this for ixp4xx and pxa: linux/dma-mapping.h -> linux/scatterlist.h -> asm/io.h -> mach/io.h -> mach/hardware.h.

I was previously thinking the define was getting picked up thru asm/pci.h somehow. So I can just drop this from my series. It does need to get fixed though or other header re-working could silently break this.

Rob

#9 lore raw

Re: [PATCH 2/6] ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

Quoted 4 lines · Rob Herring

asm/dma-mapping.h only includes asm/memory.h. We are getting lucky that linux/dma-mapping.h is picking up ARCH_HAS_DMA_SET_COHERENT_MASK because the include path looks like this for ixp4xx and pxa: linux/dma-mapping.h -> linux/scatterlist.h -> asm/io.h -> mach/io.h -> mach/hardware.h.

That's probably because of the way the code has changed over the last year:

6fee48c dma-mapping: arm: use generic pci_set_dma_mask and pci_set_consistent_dma_mask

Removes HAVE_ARCH_PCI_SET_DMA_MASK from IXP4xx mach/hardware.h, thus breaking IXP4xx machines.

5f3cd1e dma-mapping: pci: move pci_set_dma_mask and pci_set_consistent_dma_mask to pci-dma-compat.h

Removes HAVE_ARCH_PCI_SET_DMA_MASK support from drivers/pci/pci.c, which includes linux/pci.h -> asm/pci.h -> mach/hardware.h and thus the definition.

710224fa arm: fix "arm: fix pci_set_consistent_dma_mask for dmabounce devices"

Creates the current ARCH_HAS_DMA_SET_COHERENT_MASK stuff, placing it into ixp4xx's and PXA's mach/hardware.h to fix the regression caused by 6fee48c and 5f3cd1e.

So this really could do with being made more robust first, because as you point out, the current solution is extremely fragile.

#18 lore raw
In reply to Arnd Bergmann

Arnd,

Quoted 19 lines · Arnd Bergmann
Quoted 13 lines · On Wednesday 29 June 2011 18:46:53 Rob Herring wrote:

From: Rob Herring <[email protected]>

Currently, all ARM platforms must have a mach/hardware.h include. This is because it is ultimately included by linux/pci.h which is included in many places even for !CONFIG_PCI.

This could be fixed simply with an ifdef around the include of mach/hardware.h in asm/pci.h. However, in the interest of fixing this for single kernel binary builds, this series removes the include of mach/hardware.h outside of mach-* and plat-*. What's used from hardware.h is a couple of PCI defines. Converting them to variables allows each platform to set the values as needed.

Quoted 4 lines

This does not address the inclusion of mach/hardware.h under drivers/*. This appears to be mostly older platforms. There could also be some indirect inclusions from other mach/* headers.

Quoted 9 lines

Hi Rob,

This is very good work, I really like it. I've mentioned one idea for an improvement in patch 5, which you can still integrate, but otherwise

for the whole series.

I have an updated version ready to send out. Will you take this in your tree including the 1st patch for pci flags functions? Also, what about the powerpc conversion to generic pci flags?

Rob

maintainer
#19 lore raw
Quoted 4 lines · Rob Herring
Quoted 4 lines

This is very good work, I really like it. I've mentioned one idea for an improvement in patch 5, which you can still integrate, but otherwise

Quoted 8 lines
Quoted 4 lines

for the whole series.

I have an updated version ready to send out. Will you take this in your tree including the 1st patch for pci flags functions? Also, what about the powerpc conversion to generic pci flags?

I can take it all in the arm-soc tree, yes. However for anything outside of arch/arm/{mach,plat}-*, please get an Ack from the respective maintainer (Russell, Michal, BenH, ...).

Arnd

maintainer Acked-by Nicolas Pitre
#20 lore raw
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Rob Herring
Quoted 7 lines

This is very good work, I really like it. I've mentioned one idea for an improvement in patch 5, which you can still integrate, but otherwise

for the whole series.

Quoted 7 lines
Quoted 3 lines

I have an updated version ready to send out. Will you take this in your tree including the 1st patch for pci flags functions? Also, what about the powerpc conversion to generic pci flags?

I can take it all in the arm-soc tree, yes. However for anything outside of arch/arm/{mach,plat}-*, please get an Ack from the respective maintainer (Russell, Michal, BenH, ...).

Definitely not ACK for [PATH 1/6] because it breaks Microblaze PCI compilation. Rob removed some parts from microblaze pci-bridge.h and didn't move them to generic location or keep them in it. Also didn't remove PCI bits(PCI_REASSIGN..., etc) from microblaze header. I have attached changed patch with Microblaze part.

I would also prefer to add to this patch fixes for PPC too. Microblaze pci code comes from PPC that's why will be the best to fix PPC in the same patch. There should be one more patch for ppc which rename ppc_pci_flags to pci_flags + functions and bits

From my point of view make sense do these patches.
1. (s/ppc_pci_flags/pci_flags/g) + (s/ppc_pci_/pci_/g) + (s/PPC_PCI_/PCI_/g)
2. introduce new asm-generic/pci-bridge.h with changes for microblaze and ppc
3. all others patches

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#3 lore raw

Re: [PATCH 1/6] microblaze: move pci flag functions into asm-generic

In reply to Jesse Barnes
Quoted 11 lines · Jesse Barnes
Quoted 4 lines · On Wed, 29 Jun 2011 11:46:54 -0500 Rob Herring <[email protected]> wrote:

From: Rob Herring <[email protected]>

Move pci_set_flags, pci_add_flags, and pci_has_flag into asm-generic/pci-bridge.h so other archs can use them.

Looks like something Ram may be able to re-use when adding resource alloc behavior flags for the new bridge realloc code.

Hmm..these functions modify the global pci_flags variable. If there were macros that helped check/set/reset for flags in a given variable, I could use them.

RP