Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c86fa7f authored by Greentime Hu's avatar Greentime Hu
Browse files

nds32: Miscellaneous header files



This patch introduces some miscellaneous header files.

Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
Signed-off-by: default avatarGreentime Hu <greentime@andestech.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
parent beebdeaa
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
// 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
+11 −0
Original line number Diff line number Diff line
// 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
+13 −0
Original line number Diff line number Diff line
// 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__ */