STA2X11: patches for pci bridge support
v2 cover STA2X11: patches for pci bridge support
This series is V2 of what I sent on Jan 6th. Back then it was 6 patches, 3 of them are now in linux-next. The others are here again.
Patch 3 is dependent on patch 1 and 2, which are unordered.
V2: rebased, minor and less-minor changes in patch 3/3.
I repost because I got no feedback and 3 weeks passed. Also, today I found errors in my previous patch 4, now 3.
Alessandro Rubini (3):
x86: introduce CONFIG_X86_DEV_DMA_OPS
x86: introduce CONFIG_X86_DMA_REMAP
x86: initial support for sta2x11
arch/x86/Kconfig | 34 +++- arch/x86/include/asm/device.h | 4 +- arch/x86/include/asm/dma-mapping.h | 9 +- arch/x86/pci/Makefile | 2 + arch/x86/pci/sta2x11-fixup.c | 365 ++++++++++++++++++++++++++++++++++++ 5 files changed, 407 insertions(+), 7 deletions(-) create mode 100644 arch/x86/pci/sta2x11-fixup.c
Signature · 1 line
1.7.7.2
PATCH v2 1/3 x86: introduce CONFIG_X86_DEV_DMA_OPS
32-bit x86 systems may need their own DMA operations, so add a new config option, which is turned on for 64-bit systems. This patch has no functional effect but it paves the way for supporting the STA2x11 I/O Hub and possibly other chips.
--- arch/x86/Kconfig | 5 +++++ arch/x86/include/asm/device.h | 4 ++-- arch/x86/include/asm/dma-mapping.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
arch/x86/Kconfig +5 -0
@@ -12,6 +12,7 @@ config X86_32 config X86_64 def_bool 64BIT + select X86_DEV_DMA_OPS ### Arch settings config X86
@@ -2248,6 +2249,10 @@ config HAVE_TEXT_POKE_SMP bool select STOP_MACHINE if SMP +config X86_DEV_DMA_OPS + bool + depends on X86_64 + source "net/Kconfig" source "drivers/Kconfig"
arch/x86/include/asm/device.h +2 -2
@@ -5,8 +5,8 @@ struct dev_archdata {#ifdef CONFIG_ACPI void *acpi_handle;#endif -#ifdef CONFIG_X86_64 -struct dma_map_ops *dma_ops; +#ifdef CONFIG_X86_DEV_DMA_OPS +struct dma_map_ops *dma_ops;#endif #if defined(CONFIG_INTEL_IOMMU ) || defined(CONFIG_AMD_IOMMU )void *iommu;/* hook for IOMMU specific extension */
arch/x86/include/asm/dma-mapping.h +1 -1
@@ -30,7 +30,7 @@ extern struct dma_map_ops *dma_ops;static inline struct dma_map_ops *get_dma_ops (struct device *dev) { -#ifdef CONFIG_X86_32 +#ifndef CONFIG_X86_DEV_DMA_OPS return dma_ops;#else if (unlikely (!dev) || !dev->archdata.dma_ops)
Signature · 1 line
1.7.7.2
PATCH v2 2/3 x86: introduce CONFIG_X86_DMA_REMAP
In reply to Alessandro RubiniThe default functions phys_to_dma, dma_to_phys implement identity mapping as fast inline functions. Some systems, however, may need a custom function to implement its own mapping between CPU addresses and device addresses. This new configuration option allows the functions to be external when needed (such as for the ConneXt device)
--- arch/x86/Kconfig | 3 +++ arch/x86/include/asm/dma-mapping.h | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
arch/x86/Kconfig +3 -0
@@ -2253,6 +2253,9 @@ config X86_DEV_DMA_OPS bool depends on X86_64 +config X86_DMA_REMAP + bool + source "net/Kconfig" source "drivers/Kconfig"
arch/x86/include/asm/dma-mapping.h +7 -0
@@ -61,6 +61,12 @@ extern int dma_set_mask(struct device *dev, u64 mask);extern void *dma_generic_alloc_coherent (struct device *dev,size_t size,dma_addr_t *dma_addr,gfp_t flag); +#ifdef CONFIG_X86_DMA_REMAP /* Platform code defines bridge-specific code */ +extern bool dma_capable (struct device *dev,dma_addr_t addr,size_t size); +extern dma_addr_t phys_to_dma (struct device *dev,phys_addr_t paddr); +extern phys_addr_t dma_to_phys (struct device *dev,dma_addr_t daddr); +#else +static inline bool dma_capable (struct device *dev,dma_addr_t addr,size_t size) {if (!dev->dma_mask)
@@ -78,6 +84,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr) {return daddr; } +#endif /* CONFIG_X86_DMA_REMAP */ static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
Signature · 1 line
1.7.7.2
PATCH v2 3/3 x86: initial support for sta2x11
In reply to Alessandro RubiniThe "ConneXt" sta2x11 I/O Hub is a bridge from PCIe to AMBA, and is used as main chipset in some Atom boards. The set of peripherals it exports live in an AMBA bus internal to the chip, so a custom remapping of addresses is needed. This is implemented by fixup calls for the PCI deivices, based on CONFIG_X86_DEV_DMA_OPS and CONFIG_X86_DMA_REMAP .
---
V2: Removed some code that was not compiling because the relevant header is included in a later patch. Removed version reporting, because this fixup is not really being invoked in linux-next. Fix some typos in comments and clean up some messages, using dev_ calls (mainly from comments by Joe Perches)
arch/x86/Kconfig | 28 +++- arch/x86/pci/Makefile | 2 + arch/x86/pci/sta2x11-fixup.c | 365 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 390 insertions(+), 5 deletions(-) create mode 100644 arch/x86/pci/sta2x11-fixup.c
arch/x86/Kconfig +23 -5
@@ -332,6 +332,7 @@ config X86_EXTENDED_PLATFORM NUMAQ (IBM/Sequent) RDC R-321x SoC SGI 320/540 (Visual Workstation) + STA2X11-based (e.g. Northville) Summit/EXA (IBM x440) Unisys ES7000 IA32 series Moorestown MID devices
@@ -483,10 +484,10 @@ config X86_32_NON_STANDARD depends on X86_32 && SMP depends on X86_EXTENDED_PLATFORM ---help--- - This option compiles in the NUMAQ, Summit, bigsmp, ES7000, default - subarchitectures. It is intended for a generic binary kernel. - if you select them all, kernel will probe it one by one. and will - fallback to default. + This option compiles in the NUMAQ, Summit, bigsmp, ES7000, + STA2X11, default subarchitectures. It is intended for a generic + binary kernel. If you select them all, kernel will probe it + one by one and will fallback to default. # Alphabetically sorted list of Non standard 32 bit platforms
@@ -526,6 +527,22 @@ config X86_VISWS A kernel compiled for the Visual Workstation will run on general PCs as well. See <file:Documentation/sgi-visws.txt> for details. +config STA2X11 + bool "STA2X11 Companion Chip Support" + depends on X86_32_NON_STANDARD && PCI + select X86_DEV_DMA_OPS + select X86_DMA_REMAP + select SWIOTLB + select MFD_STA2X11 + select ARCH_REQUIRE_GPIOLIB + default n + ---help--- + This adds support for boards based on the STA2X11 IO-Hub, + a.k.a. "ConneXt". The chip is used in place of the standard + PC chipset, so all "standard" peripherals are missing. If this + option is selected the kernel will still be able to boot on + standard PC machines. + config X86_SUMMIT bool "Summit/EXA (IBM x440)" depends on X86_32_NON_STANDARD
@@ -2251,10 +2268,11 @@ config HAVE_TEXT_POKE_SMP config X86_DEV_DMA_OPS bool - depends on X86_64 + depends on X86_64 || STA2X11 config X86_DMA_REMAP bool + depends on STA2X11 source "net/Kconfig"
arch/x86/pci/Makefile +2 -0
@@ -11,6 +11,8 @@ obj-$(CONFIG_X86_INTEL_CE) += ce4100.o obj-$(CONFIG_ACPI) += acpi.o obj-y += legacy.o irq.o +obj-$(CONFIG_STA2X11) += sta2x11-fixup.o + obj-$(CONFIG_X86_VISWS) += visws.o obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
arch/x86/pci/sta2x11-fixup.c new file +365 -0
365 lines not on this page · raw message
Signature · 1 line
1.7.7.2