linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greentime Hu <green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: greentime-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	arnd-r2nGTMty4D4@public.gmane.org,
	linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org,
	marc.zyngier-5wv7dgnIgG8@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	deanbo422-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org,
	ren_guo-Y+KPrCd2zL4AvxtiuMwx3w@public.gmane.org,
	rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	jonas-A9uVI2HLR7kOP4wsBPIw7w@public.gmane.org,
	stefan.kristiansson-MbMCFXIvDHJFcC0YU169RA@public.gmane.org,
	shorne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Vincent Chen <vincentc-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org>
Subject: [PATCH v5 27/39] nds32: Miscellaneous header files
Date: Tue,  2 Jan 2018 16:24:59 +0800	[thread overview]
Message-ID: <e854b46e5a792cbb02fc66cac68117230716b87e.1514874857.git.green.hu@gmail.com> (raw)
In-Reply-To: <cover.1514874857.git.green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
In-Reply-To: <cover.1514874857.git.green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Greentime Hu <greentime-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org>

This patch introduces some miscellaneous header files.

Signed-off-by: Vincent Chen <vincentc-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org>
Signed-off-by: Greentime Hu <greentime-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org>
---
 arch/nds32/include/asm/delay.h          |   39 +++++++++++++++++++++++++++++++
 arch/nds32/include/asm/linkage.h        |   11 +++++++++
 arch/nds32/include/uapi/asm/byteorder.h |   13 +++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 arch/nds32/include/asm/delay.h
 create mode 100644 arch/nds32/include/asm/linkage.h
 create mode 100644 arch/nds32/include/uapi/asm/byteorder.h

diff --git a/arch/nds32/include/asm/delay.h b/arch/nds32/include/asm/delay.h
new file mode 100644
index 0000000..519ba97
--- /dev/null
+++ b/arch/nds32/include/asm/delay.h
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __NDS32_DELAY_H__
+#define __NDS32_DELAY_H__
+
+#include <asm/param.h>
+
+/* There is no clocksource cycle counter in the CPU. */
+static inline void __delay(unsigned long loops)
+{
+	__asm__ __volatile__(".align 2\n"
+			     "1:\n"
+			     "\taddi\t%0, %0, -1\n"
+			     "\tbgtz\t%0, 1b\n"
+			     :"=r"(loops)
+			     :"0"(loops));
+}
+
+static inline void __udelay(unsigned long usecs, unsigned long lpj)
+{
+	usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) +
+				  0x80000000ULL) >> 32);
+	usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32);
+	__delay(usecs);
+}
+
+#define udelay(usecs) __udelay((usecs), loops_per_jiffy)
+
+/* make sure "usecs *= ..." in udelay do not overflow. */
+#if HZ >= 1000
+#define MAX_UDELAY_MS	1
+#elif HZ <= 200
+#define MAX_UDELAY_MS	5
+#else
+#define MAX_UDELAY_MS	(1000 / HZ)
+#endif
+
+#endif
diff --git a/arch/nds32/include/asm/linkage.h b/arch/nds32/include/asm/linkage.h
new file mode 100644
index 0000000..e708c8b
--- /dev/null
+++ b/arch/nds32/include/asm/linkage.h
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+/* This file is required by include/linux/linkage.h */
+#define __ALIGN .align 2
+#define __ALIGN_STR ".align 2"
+
+#endif
diff --git a/arch/nds32/include/uapi/asm/byteorder.h b/arch/nds32/include/uapi/asm/byteorder.h
new file mode 100644
index 0000000..a23f6f3a
--- /dev/null
+++ b/arch/nds32/include/uapi/asm/byteorder.h
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __NDS32_BYTEORDER_H__
+#define __NDS32_BYTEORDER_H__
+
+#ifdef __NDS32_EB__
+#include <linux/byteorder/big_endian.h>
+#else
+#include <linux/byteorder/little_endian.h>
+#endif
+
+#endif /* __NDS32_BYTEORDER_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Greentime Hu <green.hu@gmail.com>
To: greentime@andestech.com, linux-kernel@vger.kernel.org,
	arnd@arndb.de, linux-arch@vger.kernel.org, tglx@linutronix.de,
	jason@lakedaemon.net, marc.zyngier@arm.com, robh+dt@kernel.org,
	netdev@vger.kernel.org, deanbo422@gmail.com,
	devicetree@vger.kernel.org, viro@zeniv.linux.org.uk,
	dhowells@redhat.com, will.deacon@arm.com,
	daniel.lezcano@linaro.org, linux-serial@vger.kernel.org,
	geert.uytterhoeven@gmail.com, linus.walleij@linaro.org,
	mark.rutland@arm.com, greg@kroah.com, ren_guo@c-sky.com,
	rdunlap@infradead.org, davem@davemloft.net, jonas@southpole.se,
	stefan.kristiansson@saunalahti.fi, shorne@gmail.com
Cc: green.hu@gmail.com, Vincent Chen <vincentc@andestech.com>
Subject: [PATCH v5 27/39] nds32: Miscellaneous header files
Date: Tue,  2 Jan 2018 16:24:59 +0800	[thread overview]
Message-ID: <e854b46e5a792cbb02fc66cac68117230716b87e.1514874857.git.green.hu@gmail.com> (raw)
Message-ID: <20180102082459.8F29_gF0aMIqf5z7VQeFT2x57BDHoCKM_NjUX-WW_E4@z> (raw)
In-Reply-To: <cover.1514874857.git.green.hu@gmail.com>
In-Reply-To: <cover.1514874857.git.green.hu@gmail.com>

From: Greentime Hu <greentime@andestech.com>

This patch introduces some miscellaneous header files.

Signed-off-by: Vincent Chen <vincentc@andestech.com>
Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/delay.h          |   39 +++++++++++++++++++++++++++++++
 arch/nds32/include/asm/linkage.h        |   11 +++++++++
 arch/nds32/include/uapi/asm/byteorder.h |   13 +++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 arch/nds32/include/asm/delay.h
 create mode 100644 arch/nds32/include/asm/linkage.h
 create mode 100644 arch/nds32/include/uapi/asm/byteorder.h

diff --git a/arch/nds32/include/asm/delay.h b/arch/nds32/include/asm/delay.h
new file mode 100644
index 0000000..519ba97
--- /dev/null
+++ b/arch/nds32/include/asm/delay.h
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __NDS32_DELAY_H__
+#define __NDS32_DELAY_H__
+
+#include <asm/param.h>
+
+/* There is no clocksource cycle counter in the CPU. */
+static inline void __delay(unsigned long loops)
+{
+	__asm__ __volatile__(".align 2\n"
+			     "1:\n"
+			     "\taddi\t%0, %0, -1\n"
+			     "\tbgtz\t%0, 1b\n"
+			     :"=r"(loops)
+			     :"0"(loops));
+}
+
+static inline void __udelay(unsigned long usecs, unsigned long lpj)
+{
+	usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) +
+				  0x80000000ULL) >> 32);
+	usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32);
+	__delay(usecs);
+}
+
+#define udelay(usecs) __udelay((usecs), loops_per_jiffy)
+
+/* make sure "usecs *= ..." in udelay do not overflow. */
+#if HZ >= 1000
+#define MAX_UDELAY_MS	1
+#elif HZ <= 200
+#define MAX_UDELAY_MS	5
+#else
+#define MAX_UDELAY_MS	(1000 / HZ)
+#endif
+
+#endif
diff --git a/arch/nds32/include/asm/linkage.h b/arch/nds32/include/asm/linkage.h
new file mode 100644
index 0000000..e708c8b
--- /dev/null
+++ b/arch/nds32/include/asm/linkage.h
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+/* This file is required by include/linux/linkage.h */
+#define __ALIGN .align 2
+#define __ALIGN_STR ".align 2"
+
+#endif
diff --git a/arch/nds32/include/uapi/asm/byteorder.h b/arch/nds32/include/uapi/asm/byteorder.h
new file mode 100644
index 0000000..a23f6f3a
--- /dev/null
+++ b/arch/nds32/include/uapi/asm/byteorder.h
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef __NDS32_BYTEORDER_H__
+#define __NDS32_BYTEORDER_H__
+
+#ifdef __NDS32_EB__
+#include <linux/byteorder/big_endian.h>
+#else
+#include <linux/byteorder/little_endian.h>
+#endif
+
+#endif /* __NDS32_BYTEORDER_H__ */
-- 
1.7.9.5

  parent reply	other threads:[~2018-01-02  8:24 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02  8:24 [PATCH v5 00/39] Andes(nds32) Linux Kernel Port Greentime Hu
2018-01-02  8:24 ` [PATCH v5 01/39] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 02/39] openrisc: add ioremap_nocache declaration before include asm-generic/io.h and sync ioremap prototype with it Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-03 14:38   ` Stafford Horne
2018-01-03 14:38     ` Stafford Horne
2018-01-03 15:23     ` Greentime Hu
2018-01-03 15:23       ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 04/39] earlycon: add reg-offset to physical address before mapping Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 05/39] nds32: Assembly macros and definitions Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 07/39] nds32: Exception handling Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 08/39] nds32: MMU definitions Greentime Hu
2018-01-02  8:24 ` [PATCH v5 09/39] nds32: MMU initialization Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 10/39] nds32: MMU fault handling and page table management Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 11/39] nds32: Cache and TLB routines Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 12/39] nds32: Process management Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 13/39] nds32: IRQ handling Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 14/39] nds32: Atomic operations Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 15/39] nds32: Device specific operations Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 16/39] nds32: DMA mapping API Greentime Hu
2018-01-02  8:24 ` [PATCH v5 17/39] nds32: ELF definitions Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 18/39] nds32: System calls handling Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 19/39] nds32: VDSO support Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 20/39] nds32: Signal handling support Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 21/39] nds32: Library functions Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 22/39] nds32: Debugging support Greentime Hu
2018-01-02  8:24 ` [PATCH v5 23/39] nds32: L2 cache support Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 24/39] nds32: Loadable modules Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 25/39] nds32: Generic timers support Greentime Hu
2018-01-02  8:24   ` Greentime Hu
2018-01-02  8:24 ` [PATCH v5 26/39] nds32: Device tree support Greentime Hu
2018-01-02  8:24   ` Greentime Hu
     [not found]   ` <7fe1190a9cf8e30f1b8af52dd382ba1176997786.1514874857.git.green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-03 19:14     ` Rob Herring
2018-01-03 19:14       ` Rob Herring
     [not found]       ` <CAL_Jsq+CC-3w8BVcUP77__ZR8aYMhxiXDYJ--HZwA=ezHG548g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04  7:57         ` Greentime Hu
2018-01-04  7:57           ` Greentime Hu
     [not found] ` <cover.1514874857.git.green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-02  8:24   ` [PATCH v5 03/39] sparc: io: To use the define of ioremap_[nocache|wc|wb] in asm-generic/io.h Greentime Hu
2018-01-02  8:24     ` Greentime Hu
2018-01-02  8:24   ` [PATCH v5 06/39] nds32: Kernel booting and initialization Greentime Hu
2018-01-02  8:24     ` Greentime Hu
2018-01-02  8:24   ` Greentime Hu [this message]
2018-01-02  8:24     ` [PATCH v5 27/39] nds32: Miscellaneous header files Greentime Hu
2018-01-02  8:25   ` [PATCH v5 31/39] dt-bindings: nds32 CPU Bindings Greentime Hu
2018-01-02  8:25     ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 28/39] nds32: defconfig Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 29/39] nds32: Build infrastructure Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 30/39] MAINTAINERS: Add nds32 Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 32/39] dt-bindings: nds32 L2 cache controller Bindings Greentime Hu
2018-01-02  8:25   ` Greentime Hu
     [not found]   ` <fc1f58a97003b4bedfbb8b6e3d29b1628ff61f9a.1514874858.git.green.hu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-03 21:10     ` Rob Herring
2018-01-03 21:10       ` Rob Herring
2018-01-02  8:25 ` [PATCH v5 33/39] dt-bindings: nds32 SoC Bindings Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 34/39] dt-bindings: interrupt-controller: Andestech Internal Vector Interrupt Controller Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 35/39] irqchip: Andestech Internal Vector Interrupt Controller driver Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 36/39] net: faraday add nds32 support Greentime Hu
2018-01-02  8:25   ` Greentime Hu
2018-01-02  8:25 ` [PATCH v5 37/39] clocksource/drivers/atcpit100: Add andestech atcpit100 timer Greentime Hu
2018-01-02  8:25 ` [PATCH v5 38/39] clocksource/drivers/atcpit100: VDSO support Greentime Hu
2018-01-02  8:25 ` [PATCH v5 39/39] dt-bindings: timer: Add andestech atcpit100 timer binding doc Greentime Hu
2018-01-02  8:25   ` Greentime Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e854b46e5a792cbb02fc66cac68117230716b87e.1514874857.git.green.hu@gmail.com \
    --to=green.hu-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=deanbo422-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=geert.uytterhoeven-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=greentime-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org \
    --cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jonas-A9uVI2HLR7kOP4wsBPIw7w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=ren_guo-Y+KPrCd2zL4AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=shorne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=stefan.kristiansson-MbMCFXIvDHJFcC0YU169RA@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=vincentc-MUIXKm3Oiri1Z/+hSey0Gg@public.gmane.org \
    --cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).