From 9e7d9a5f2ac5dd56e5b3718ea44049907170898b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 21 May 2015 07:26:00 +0200 Subject: dma: Use generic place for dma_addr_t typedef Instead of letting all architectures define their own dma_addr_t use a common place in include/linux/types.h and use a Kconfig symbol that architectures can select to define the width of dma_addr_t. The same is done in the Kernel. Signed-off-by: Sascha Hauer --- arch/arm/include/asm/types.h | 5 ----- arch/blackfin/include/asm/types.h | 4 ---- arch/efi/include/asm/types.h | 4 ---- arch/mips/Kconfig | 1 + arch/mips/include/asm/types.h | 12 ------------ arch/nios2/include/asm/types.h | 3 --- arch/openrisc/include/asm/types.h | 4 ---- arch/ppc/include/asm/types.h | 3 --- arch/sandbox/include/asm/types.h | 4 ---- common/Kconfig | 3 +++ include/linux/types.h | 7 +++++++ 11 files changed, 11 insertions(+), 39 deletions(-) diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index 81bd357ada..680e824876 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -47,11 +47,6 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; -typedef u32 dma64_addr_t; - #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ diff --git a/arch/blackfin/include/asm/types.h b/arch/blackfin/include/asm/types.h index 3d2bd35ef4..f1c2dc43c6 100644 --- a/arch/blackfin/include/asm/types.h +++ b/arch/blackfin/include/asm/types.h @@ -69,10 +69,6 @@ typedef unsigned int u32; typedef signed long long s64; typedef unsigned long long u64; -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; - #endif #endif /* __ASSEMBLY__ */ diff --git a/arch/efi/include/asm/types.h b/arch/efi/include/asm/types.h index 3204448dce..05122ea04e 100644 --- a/arch/efi/include/asm/types.h +++ b/arch/efi/include/asm/types.h @@ -62,10 +62,6 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 #endif -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; - #endif /* __KERNEL__ */ #endif diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ed6e1ab2df..aeb5c04fce 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -269,6 +269,7 @@ config 32BIT config 64BIT bool "64-bit barebox" depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL + select ARCH_DMA_ADDR_T_64BIT help Select this option if you want to build a 64-bit barebox. diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h index b63687d37b..4140c92e1a 100644 --- a/arch/mips/include/asm/types.h +++ b/arch/mips/include/asm/types.h @@ -13,18 +13,6 @@ #include -#ifndef __ASSEMBLY__ - -#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \ - || defined(CONFIG_64BIT) -typedef u64 dma_addr_t; -#else -typedef u32 dma_addr_t; -#endif -typedef u64 dma64_addr_t; - -#endif /* __ASSEMBLY__ */ - /* * We don't use int-l64.h for the kernel anymore but still use it for * userspace to avoid code changes. diff --git a/arch/nios2/include/asm/types.h b/arch/nios2/include/asm/types.h index 21c3415f93..0067ea83c1 100644 --- a/arch/nios2/include/asm/types.h +++ b/arch/nios2/include/asm/types.h @@ -3,7 +3,4 @@ #include -typedef u32 dma_addr_t; - #endif - diff --git a/arch/openrisc/include/asm/types.h b/arch/openrisc/include/asm/types.h index 3338fcfdeb..cacda424ba 100644 --- a/arch/openrisc/include/asm/types.h +++ b/arch/openrisc/include/asm/types.h @@ -64,10 +64,6 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; - #endif /* __KERNEL__ */ #endif /* _ASM_TYPES_H */ diff --git a/arch/ppc/include/asm/types.h b/arch/ppc/include/asm/types.h index 4ebbb9e028..37ef3530ab 100644 --- a/arch/ppc/include/asm/types.h +++ b/arch/ppc/include/asm/types.h @@ -41,9 +41,6 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 -/* DMA addresses are 32-bits wide */ -typedef u32 dma_addr_t; - #endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index d471d257be..8944b47fd9 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -56,10 +56,6 @@ typedef unsigned long long u64; #define BITS_PER_LONG 32 -/* Dma addresses are 32-bits wide. */ - -typedef u32 dma_addr_t; - #endif /* __KERNEL__ */ #endif diff --git a/common/Kconfig b/common/Kconfig index 1c5d14c1c0..3dfb5ac194 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -94,6 +94,9 @@ config EFI_DEVICEPATH config FILE_LIST bool +config ARCH_DMA_ADDR_T_64BIT + bool + menu "General Settings" config LOCALVERSION diff --git a/include/linux/types.h b/include/linux/types.h index c11e148c90..9871a66a11 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -158,6 +158,13 @@ typedef __u32 __bitwise __wsum; #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) +/* A dma_addr_t can hold any valid DMA or bus address for the platform */ +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT +typedef u64 dma_addr_t; +#else +typedef u32 dma_addr_t; +#endif /* dma_addr_t */ + #ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 phys_addr_t; typedef u64 phys_size_t; -- cgit v1.2.3