From patchwork Thu Sep 14 22:05:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813959 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXfv1M8zz9s7h for ; Fri, 15 Sep 2017 08:06:15 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DFE54C21ECC; Thu, 14 Sep 2017 22:06:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 952F4C21F44; Thu, 14 Sep 2017 22:05:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B5F33C21F01; Thu, 14 Sep 2017 22:05:51 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 83654C21F18 for ; Thu, 14 Sep 2017 22:05:50 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 07BEBB289CB21; Thu, 14 Sep 2017 23:05:44 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:05:48 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:01 -0700 Message-ID: <20170914220513.9359-2-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Albert Aribaud , Angelo Dureghello , Alexey Brodkin , Macpaul Lin Subject: [U-Boot] [PATCH v2 01/13] Provide a generic io.h & address mapping functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Most architectures currently supported by U-Boot use trivial implementations of map_to_physmem & virt_to_phys which simply cast a physical address to a pointer for use a virtual address & vice-versa. This results in a lot of duplicate implementations of these mapping functions. The set of functions provided by different architectures also differs, with some having implementations of phys_to_virt & others not. A later patch will make use of phys_to_virt in architecture-neutral code, and so requires that it be provided for all architectures. This patch introduces an asm-generic/io.h which provides generic implementations of address mapping functions, allowing the duplication of them between architectures to be removed. Once architectures are converted to make use of this generic header it will also ensure that all of phys_to_virt, virt_to_phys, map_physmem & unmap_physmem are provided. The 2 families of functions differ in that map_physmem may create dynamic mappings whilst phys_to_virt may not & therefore is more limited in scope but doesn't require information such as a length & flags. This patch doesn't convert any architectures to make use of this generic header - later patches in the series will do so. Signed-off-by: Paul Burton Cc: Albert Aribaud Cc: Alexey Brodkin Cc: Angelo Dureghello Cc: Bin Meng Cc: Daniel Schwierzeck Cc: Macpaul Lin Cc: Michal Simek Cc: Nobuhiro Iwamatsu Cc: Thomas Chou Cc: Wolfgang Denk Acked-by: Angelo Dureghello Tested-by: Angelo Dureghello Reviewed-by: Simon Glass Reviewed-by: Daniel Schwierzeck --- Changes in v2: - Reformat map_physmem to split args across lines, rather than return type. include/asm-generic/io.h | 110 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 include/asm-generic/io.h diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h new file mode 100644 index 0000000000..0f5160c6f1 --- /dev/null +++ b/include/asm-generic/io.h @@ -0,0 +1,110 @@ +/* + * Generic I/O functions. + * + * Copyright (c) 2016 Imagination Technologies Ltd. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __ASM_GENERIC_IO_H__ +#define __ASM_GENERIC_IO_H__ + +/* + * This file should be included at the end of each architecture-specific + * asm/io.h such that we may provide generic implementations without + * conflicting with architecture-specific code. + */ + +#ifndef __ASSEMBLY__ + +/** + * phys_to_virt() - Return a virtual address mapped to a given physical address + * @paddr: the physical address + * + * Returns a virtual address which the CPU can access that maps to the physical + * address @paddr. This should only be used where it is known that no dynamic + * mapping is required. In general, map_physmem should be used instead. + * + * Returns: a virtual address which maps to @paddr + */ +#ifndef phys_to_virt +static inline void *phys_to_virt(phys_addr_t paddr) +{ + return (void *)(unsigned long)paddr; +} +#endif + +/** + * virt_to_phys() - Return the physical address that a virtual address maps to + * @vaddr: the virtual address + * + * Returns the physical address which the CPU-accessible virtual address @vaddr + * maps to. + * + * Returns: the physical address which @vaddr maps to + */ +#ifndef virt_to_phys +static inline phys_addr_t virt_to_phys(void *vaddr) +{ + return (phys_addr_t)((unsigned long)vaddr); +} +#endif + +/* + * Flags for use with map_physmem() & unmap_physmem(). Architectures need not + * support all of these, in which case they will be defined as zero here & + * ignored. Callers that may run on multiple architectures should therefore + * treat them as hints rather than requirements. + */ +#ifndef MAP_NOCACHE +# define MAP_NOCACHE 0 /* Produce an uncached mapping */ +#endif +#ifndef MAP_WRCOMBINE +# define MAP_WRCOMBINE 0 /* Allow write-combining on the mapping */ +#endif +#ifndef MAP_WRBACK +# define MAP_WRBACK 0 /* Map using write-back caching */ +#endif +#ifndef MAP_WRTHROUGH +# define MAP_WRTHROUGH 0 /* Map using write-through caching */ +#endif + +/** + * map_physmem() - Return a virtual address mapped to a given physical address + * @paddr: the physical address + * @len: the length of the required mapping + * @flags: flags affecting the type of mapping + * + * Return a virtual address through which the CPU may access the memory at + * physical address @paddr. The mapping will be valid for at least @len bytes, + * and may be affected by flags passed to the @flags argument. This function + * may create new mappings, so should generally be paired with a matching call + * to unmap_physmem once the caller is finished with the memory in question. + * + * Returns: a virtual address suitably mapped to @paddr + */ +#ifndef map_physmem +static inline void *map_physmem(phys_addr_t paddr, unsigned long len, + unsigned long flags) +{ + return phys_to_virt(paddr); +} +#endif + +/** + * unmap_physmem() - Remove mappings created by a prior call to map_physmem() + * @vaddr: the virtual address which map_physmem() previously returned + * @flags: flags matching those originally passed to map_physmem() + * + * Unmap memory which was previously mapped by a call to map_physmem(). If + * map_physmem() dynamically created a mapping for the memory in question then + * unmap_physmem() will remove that mapping. + */ +#ifndef unmap_physmem +static inline void unmap_physmem(void *vaddr, unsigned long flags) +{ +} +#endif + +#endif /* !__ASSEMBLY__ */ +#endif /* __ASM_GENERIC_IO_H__ */ From patchwork Thu Sep 14 22:05:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813960 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXgh5hDkz9s7h for ; Fri, 15 Sep 2017 08:06:56 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5F35FC21F13; Thu, 14 Sep 2017 22:06:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8AC51C21F3A; Thu, 14 Sep 2017 22:06:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 596FCC21E9D; Thu, 14 Sep 2017 22:06:13 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id BCAD2C21EE7 for ; Thu, 14 Sep 2017 22:06:07 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id F05C086D856BE; Thu, 14 Sep 2017 23:06:01 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:06:06 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:02 -0700 Message-ID: <20170914220513.9359-3-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Alexey Brodkin Subject: [U-Boot] [PATCH v2 02/13] arc: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the arc architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for arc this is primarily a matter of removing code. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Alexey Brodkin Acked-by: Alexey Brodkin --- Changes in v2: None arch/arc/include/asm/io.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h index 42e7f22b28..a12303bc73 100644 --- a/arch/arc/include/asm/io.h +++ b/arch/arc/include/asm/io.h @@ -50,30 +50,6 @@ #define __iowmb() do { } while (0) #endif -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)((unsigned long)paddr); -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - static inline void sync(void) { /* Not yet implemented */ @@ -302,9 +278,6 @@ static inline int __raw_writesl(unsigned int addr, void *data, int longlen) #define setbits_8(addr, set) setbits(8, addr, set) #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)((unsigned long)vaddr); -} +#include #endif /* __ASM_ARC_IO_H */ From patchwork Thu Sep 14 22:05:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813961 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXgl6LMsz9s7h for ; Fri, 15 Sep 2017 08:06:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 75846C21EF2; Thu, 14 Sep 2017 22:06:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5C43EC21E79; Thu, 14 Sep 2017 22:06:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E11FC21EE7; Thu, 14 Sep 2017 22:06:26 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 8ED4EC21EF8 for ; Thu, 14 Sep 2017 22:06:25 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id C344C64FB2487; Thu, 14 Sep 2017 23:06:19 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:06:24 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:03 -0700 Message-ID: <20170914220513.9359-4-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Albert Aribaud Subject: [U-Boot] [PATCH v2 03/13] arm: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the arm architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for arm this is primarily a matter of removing code. This has only been build-tested, feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Albert Aribaud Reviewed-by: Simon Glass --- Changes in v2: None arch/arm/include/asm/io.h | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 5834f5b3dc..5df74728de 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -34,35 +34,6 @@ static inline void sync(void) { } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)((unsigned long)paddr); -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void * vaddr) -{ - return (phys_addr_t)((unsigned long)vaddr); -} - /* * Generic virtual read/write. Note that we don't support half-word * read/writes. We define __arch_*[bl] here, and leave __arch_*w @@ -426,6 +397,7 @@ out: #endif /* __mem_isa */ #endif /* __KERNEL__ */ +#include #include #endif /* __ASM_ARM_IO_H */ From patchwork Thu Sep 14 22:05:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813962 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXhq4TRzz9s5L for ; Fri, 15 Sep 2017 08:07:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 50A67C21EE9; Thu, 14 Sep 2017 22:07:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 03B00C21F46; Thu, 14 Sep 2017 22:07:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CE8D3C21F51; Thu, 14 Sep 2017 22:06:47 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 70763C21ED7 for ; Thu, 14 Sep 2017 22:06:43 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id AAECC453BFF9C; Thu, 14 Sep 2017 23:06:37 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:06:42 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:04 -0700 Message-ID: <20170914220513.9359-5-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Angelo Dureghello , Huan Wang Subject: [U-Boot] [PATCH v2 04/13] m68k: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the m68k architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for m68k this is primarily a matter of emoving code. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Huan Wang Cc: Angelo Dureghello Acked-by: Angelo Dureghello Tested-by: Angelo Dureghello --- Changes in v2: None arch/m68k/include/asm/io.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index 384308b747..dfe77f0756 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -253,33 +253,6 @@ static inline void sync(void) */ } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void *map_physmem(phys_addr_t paddr, unsigned long len, - unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void * vaddr) -{ - return (phys_addr_t)(vaddr); -} +#include #endif /* __ASM_M68K_IO_H__ */ From patchwork Thu Sep 14 22:05:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813963 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXjv6d2zz9s5L for ; Fri, 15 Sep 2017 08:08:51 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 94E54C21F1F; Thu, 14 Sep 2017 22:08:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 213BEC21F44; Thu, 14 Sep 2017 22:08:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 19A6BC21F3E; Thu, 14 Sep 2017 22:07:04 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 5A8BAC21F0A for ; Thu, 14 Sep 2017 22:07:01 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 886786B195D91; Thu, 14 Sep 2017 23:06:55 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:07:00 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:05 -0700 Message-ID: <20170914220513.9359-6-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 05/13] microblaze: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the microblaze architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for microblaze this is primarily a matter of removing code. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Michal Simek --- Changes in v2: None arch/microblaze/include/asm/io.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index 584cbce358..c7516a47e8 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -131,33 +131,6 @@ static inline void sync(void) { } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void * vaddr) -{ - return (phys_addr_t)(vaddr); -} +#include #endif /* __MICROBLAZE_IO_H__ */ From patchwork Thu Sep 14 22:05:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813964 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXkx3l2fz9s5L for ; Fri, 15 Sep 2017 08:09:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3F230C21F26; Thu, 14 Sep 2017 22:07:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 745F5C21F29; Thu, 14 Sep 2017 22:07:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D55B3C21F27; Thu, 14 Sep 2017 22:07:19 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 958C5C21F3A for ; Thu, 14 Sep 2017 22:07:19 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id C9EF85D4306A9; Thu, 14 Sep 2017 23:07:13 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:07:18 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:06 -0700 Message-ID: <20170914220513.9359-7-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Macpaul Lin Subject: [U-Boot] [PATCH v2 06/13] nds32: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the nds32 architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for nds32 this is primarily a matter of removing code. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Macpaul Lin --- Changes in v2: None arch/nds32/include/asm/io.h | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h index b2c4d0ef8c..46ce8c4a13 100644 --- a/arch/nds32/include/asm/io.h +++ b/arch/nds32/include/asm/io.h @@ -38,35 +38,6 @@ static inline void sync(void) { } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)(vaddr); -} - /* * Generic virtual read/write. Note that we don't support half-word * read/writes. We define __arch_*[bl] here, and leave __arch_*w @@ -459,5 +430,8 @@ out: #define isa_check_signature(io, sig, len) (0) #endif /* __mem_isa */ + +#include + #endif /* __KERNEL__ */ #endif /* __ASM_NDS_IO_H */ From patchwork Thu Sep 14 22:05:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813966 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXm42C0Vz9s3T for ; Fri, 15 Sep 2017 08:10:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 235C1C21F74; Thu, 14 Sep 2017 22:08:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BE8A1C21F0B; Thu, 14 Sep 2017 22:08:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3E313C21F1F; Thu, 14 Sep 2017 22:07:41 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id EB1BDC21F1F for ; Thu, 14 Sep 2017 22:07:37 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 350048831FD5A; Thu, 14 Sep 2017 23:07:32 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:07:36 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:07 -0700 Message-ID: <20170914220513.9359-8-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 07/13] sh: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the sh architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for sh this is primarily a matter of moving code. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Nobuhiro Iwamatsu --- Changes in v2: None arch/sh/include/asm/io.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index 5cb000cada..be1ff4ad70 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h @@ -231,34 +231,7 @@ static inline void sync(void) #define setbits_8(addr, set) setbits(8, addr, set) #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)(vaddr); -} +#include #endif /* __KERNEL__ */ #endif /* __ASM_SH_IO_H */ From patchwork Thu Sep 14 22:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813968 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXms2Pc6z9s3T for ; Fri, 15 Sep 2017 08:11:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 164A4C21F51; Thu, 14 Sep 2017 22:09:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CB8A3C21F44; Thu, 14 Sep 2017 22:09:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 82B32C21ED7; Thu, 14 Sep 2017 22:07:59 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 07E2FC21EF2 for ; Thu, 14 Sep 2017 22:07:56 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 2DF4CA478878B; Thu, 14 Sep 2017 23:07:50 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:07:54 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:08 -0700 Message-ID: <20170914220513.9359-9-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 08/13] x86: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the x86 architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for x86 this is primarily a matter of moving code. This has only been build-tested, feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Simon Glass Reviewed-by: Simon Glass --- Changes in v2: None arch/x86/include/asm/io.h | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index a72daf2263..263dd8fd17 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -230,35 +230,6 @@ static inline void sync(void) { } -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)(uintptr_t)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} - -static inline phys_addr_t virt_to_phys(void * vaddr) -{ - return (phys_addr_t)(uintptr_t)(vaddr); -} - /* * TODO: The kernel offers some more advanced versions of barriers, it might * have some advantages to use them instead of the simple one here. @@ -267,4 +238,6 @@ static inline phys_addr_t virt_to_phys(void * vaddr) #define __iormb() dmb() #define __iowmb() dmb() +#include + #endif /* _ASM_IO_H */ From patchwork Thu Sep 14 22:05:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813965 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXln56D6z9s5L for ; Fri, 15 Sep 2017 08:10:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 760F5C21E9D; Thu, 14 Sep 2017 22:10:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2D3D5C21E79; Thu, 14 Sep 2017 22:10:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2BF5AC21ED7; Thu, 14 Sep 2017 22:08:14 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id CFB83C21F44 for ; Thu, 14 Sep 2017 22:08:13 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 0C32DD1B96B9; Thu, 14 Sep 2017 23:08:08 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:08:12 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:09 -0700 Message-ID: <20170914220513.9359-10-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 09/13] xtensa: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the xtensa architecture to make use of the new asm-generic/io.h to provide address mapping functions. As the generic implementations are suitable for xtensa this is primarily a matter of moving code. This has only been build-tested, feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Max Filippov Acked-by: Max Filippov --- Changes in v2: None arch/xtensa/include/asm/io.h | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index e34d6e1d7f..c9e335f4f6 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h @@ -115,29 +115,6 @@ void outsl(unsigned long port, const void *src, unsigned long count); */ #define xlate_dev_kmem_ptr(p) p -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) -{ - return (void *)paddr; -} - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ -} - -static inline phys_addr_t virt_to_phys(void *vaddr) -{ - return (phys_addr_t)((unsigned long)vaddr); -} - /* * Dummy function to keep U-Boot's cfi_flash.c driver happy. */ @@ -145,4 +122,6 @@ static inline void sync(void) { } +#include + #endif /* _XTENSA_IO_H */ From patchwork Thu Sep 14 22:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813967 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXm83zlTz9s3T for ; Fri, 15 Sep 2017 08:10:48 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5C758C21F64; Thu, 14 Sep 2017 22:09:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D3F92C21F3B; Thu, 14 Sep 2017 22:09:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EE133C21F0B; Thu, 14 Sep 2017 22:08:32 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id D486DC21F3B for ; Thu, 14 Sep 2017 22:08:31 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id E76E3ADAD5401; Thu, 14 Sep 2017 23:08:25 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:08:30 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:10 -0700 Message-ID: <20170914220513.9359-11-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 10/13] mips: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the mips architecture to make use of the new asm-generic/io.h to provide address mapping functions. As mips actually performs non-identity mapping between physical & virtual addresses we can't simply make use of the generic functions, with the exception of being able to drop our no-op unmap_physmem() and definitions of unused map flags. Signed-off-by: Paul Burton Cc: Daniel Schwierzeck Reviewed-by: Daniel Schwierzeck Acked-by: Daniel Schwierzeck --- Changes in v2: None arch/mips/include/asm/io.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index ee7a59290d..45d7ca0cc6 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -95,6 +95,7 @@ static inline unsigned long virt_to_phys(volatile const void *address) #endif return CPHYSADDR(addr); } +#define virt_to_phys virt_to_phys /* * phys_to_virt - map physical address to virtual @@ -112,6 +113,7 @@ static inline void *phys_to_virt(unsigned long address) { return (void *)(address + PAGE_OFFSET - PHYS_OFFSET); } +#define phys_to_virt phys_to_virt /* * ISA I/O bus memory addresses are 1:1 with the physical address. @@ -490,10 +492,7 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int */ #define sync() mmiowb() -#define MAP_NOCACHE (1) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) +#define MAP_NOCACHE 1 static inline void * map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) @@ -503,13 +502,7 @@ map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) return (void *)CKSEG0ADDR(paddr); } - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ -} +#define map_physmem map_physmem #define __BUILD_CLRBITS(bwlq, sfx, end, type) \ \ @@ -566,4 +559,6 @@ BUILD_CLRSETBITS(q, le64, le64, u64) BUILD_CLRSETBITS(q, be64, be64, u64) BUILD_CLRSETBITS(q, 64, _, u64) +#include + #endif /* _ASM_IO_H */ From patchwork Thu Sep 14 22:05:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813971 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXr20ztGz9s5L for ; Fri, 15 Sep 2017 08:14:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DB968C21F6F; Thu, 14 Sep 2017 22:11:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 931F2C21F74; Thu, 14 Sep 2017 22:11:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BD04EC21F64; Thu, 14 Sep 2017 22:08:52 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 9E7BAC21EF8 for ; Thu, 14 Sep 2017 22:08:49 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id BB05FFC761497; Thu, 14 Sep 2017 23:08:43 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:08:48 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:11 -0700 Message-ID: <20170914220513.9359-12-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Scott McNutt Subject: [U-Boot] [PATCH v2 11/13] nios2: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the nios2 architecture to make use of the new asm-generic/io.h to provide address mapping functions. As nios2 actually performs non-identity mapping between physical & virtual addresses we can't simply make use of the generic functions, with the exception of being able to drop our no-op unmap_physmem() and definitions of unused map flags. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Thomas Chou --- Changes in v2: None arch/nios2/include/asm/io.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h index e951500190..4e5b44a4e4 100644 --- a/arch/nios2/include/asm/io.h +++ b/arch/nios2/include/asm/io.h @@ -19,9 +19,6 @@ static inline void sync(void) * properties specified by "flags". */ #define MAP_NOCACHE 1 -#define MAP_WRCOMBINE 0 -#define MAP_WRBACK 0 -#define MAP_WRTHROUGH 0 static inline void * map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) @@ -32,20 +29,22 @@ map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) else return (void *)(paddr | gd->arch.mem_region_base); } +#define map_physmem map_physmem -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) +static inline void *phys_to_virt(phys_addr_t paddr) { + DECLARE_GLOBAL_DATA_PTR; + return (void *)(paddr | gd->arch.mem_region_base); } +#define phys_to_virt phys_to_virt static inline phys_addr_t virt_to_phys(void * vaddr) { DECLARE_GLOBAL_DATA_PTR; return (phys_addr_t)vaddr & gd->arch.physaddr_mask; } +#define virt_to_phys virt_to_phys #define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v)) #define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v)) @@ -171,4 +170,6 @@ static inline void outsl (unsigned long port, const void *src, unsigned long cou #define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c)) #define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) +#include + #endif /* __ASM_NIOS2_IO_H_ */ From patchwork Thu Sep 14 22:05:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813970 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXpz0dyXz9s3T for ; Fri, 15 Sep 2017 08:13:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B7408C21F27; Thu, 14 Sep 2017 22:12:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 04892C21F86; Thu, 14 Sep 2017 22:12:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 01813C21F6E; Thu, 14 Sep 2017 22:09:11 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 92605C21F52 for ; Thu, 14 Sep 2017 22:09:07 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 9BE17DE7966BA; Thu, 14 Sep 2017 23:09:01 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:09:06 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:12 -0700 Message-ID: <20170914220513.9359-13-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Cc: Kim Phillips , Kumar Gala , Andy Fleming , Stefan Roese Subject: [U-Boot] [PATCH v2 12/13] powerpc: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the powerpc architecture to make use of the new asm-generic/io.h to provide address mapping functions. As powerpc can actually perform non-identity mapping between physical & virtual addresses we can't simply make use of the generic phys_to_virt() & virt_to_phys() functions. However since map_physmem() already effectively implemented the same thing as virt_to_phys() we can simply implement virt_to_phys() instead of map_physmem() & use the generic map_physmem(). We also drop the no-op unmap_physmem(). This has only been build-tested, feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton Cc: Wolfgang Denk --- Changes in v2: None arch/powerpc/include/asm/io.h | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index a54fc468d5..34fbfdf1cf 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -282,18 +282,7 @@ static inline void out_be32(volatile unsigned __iomem *addr, u32 val) #define setbits_8(addr, set) setbits(8, addr, set) #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) - -static inline void * -map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) +static inline void *phys_to_virt(phys_addr_t paddr) { #ifdef CONFIG_ADDR_MAP return addrmap_phys_to_virt(paddr); @@ -301,14 +290,7 @@ map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) return (void *)((unsigned long)paddr); #endif } - -/* - * Take down a mapping set up by map_physmem(). - */ -static inline void unmap_physmem(void *vaddr, unsigned long flags) -{ - -} +#define phys_to_virt phys_to_virt static inline phys_addr_t virt_to_phys(void * vaddr) { @@ -318,5 +300,8 @@ static inline phys_addr_t virt_to_phys(void * vaddr) return (phys_addr_t)((unsigned long)vaddr); #endif } +#define virt_to_phys virt_to_phys + +#include #endif From patchwork Thu Sep 14 22:05:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 813969 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xtXps0L5rz9s3T for ; Fri, 15 Sep 2017 08:13:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C9F49C21F4B; Thu, 14 Sep 2017 22:12:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 64FA3C21F26; Thu, 14 Sep 2017 22:12:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 73195C21F74; Thu, 14 Sep 2017 22:09:28 +0000 (UTC) Received: from mailapp01.imgtec.com (mailapp01.imgtec.com [195.59.15.196]) by lists.denx.de (Postfix) with ESMTP id 74727C21F01 for ; Thu, 14 Sep 2017 22:09:25 +0000 (UTC) Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 7DC31D59A4CCC; Thu, 14 Sep 2017 23:09:19 +0100 (IST) Received: from localhost (10.20.1.88) by hhmail02.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 14 Sep 2017 23:09:24 +0100 From: Paul Burton To: Date: Thu, 14 Sep 2017 15:05:13 -0700 Message-ID: <20170914220513.9359-14-paul.burton@imgtec.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170914220513.9359-1-paul.burton@imgtec.com> References: <20170914220513.9359-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [10.20.1.88] Subject: [U-Boot] [PATCH v2 13/13] sandbox: Use asm-generic/io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert the sandbox architecture to make use of the new asm-generic/io.h to provide address mapping functions. As sandbox actually performs non-identity mapping between physical & virtual addresses we can't simply make use of the generic mapping functions, but are able to implement phys_to_virt() & make use of it from map_physmem(). Signed-off-by: Paul Burton Cc: Simon Glass Acked-by: Simon Glass --- Changes in v2: - Move include earlier to get MAP_WRBACK for (un)map_sysmem() - Cast vaddr to uint8_t* in virt_to_phys() for arithmetic with ram_buf arch/sandbox/cpu/cpu.c | 12 +++++++++++- arch/sandbox/include/asm/io.h | 18 +++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 01991049cc..66c3a6a88a 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -56,6 +56,16 @@ int cleanup_before_linux_select(int flags) return 0; } +void *phys_to_virt(phys_addr_t paddr) +{ + return (void *)(gd->arch.ram_buf + paddr); +} + +phys_addr_t virt_to_phys(void *vaddr) +{ + return (phys_addr_t)((uint8_t *)vaddr - gd->arch.ram_buf); +} + void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) { #if defined(CONFIG_PCI) && !defined(CONFIG_SPL_BUILD) @@ -73,7 +83,7 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) } #endif - return (void *)(gd->arch.ram_buf + paddr); + return phys_to_virt(paddr); } void unmap_physmem(const void *vaddr, unsigned long flags) diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index a6856356df..fd3c2478f7 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -7,22 +7,22 @@ #ifndef __SANDBOX_ASM_IO_H #define __SANDBOX_ASM_IO_H -/* - * Given a physical address and a length, return a virtual address - * that can be used to access the memory range with the caching - * properties specified by "flags". - */ -#define MAP_NOCACHE (0) -#define MAP_WRCOMBINE (0) -#define MAP_WRBACK (0) -#define MAP_WRTHROUGH (0) +void *phys_to_virt(phys_addr_t paddr); +#define phys_to_virt phys_to_virt + +phys_addr_t virt_to_phys(void *vaddr); +#define virt_to_phys virt_to_phys void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags); +#define map_physmem map_physmem /* * Take down a mapping set up by map_physmem(). */ void unmap_physmem(const void *vaddr, unsigned long flags); +#define unmap_physmem unmap_physmem + +#include /* For sandbox, we want addresses to point into our RAM buffer */ static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)