Received: by 10.223.164.202 with SMTP id h10csp1588450wrb; Mon, 27 Nov 2017 04:55:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMZstFrAt0rm1SAHNxbm6PoKe3SJB6XDEN2yWqG8Ld0AAzQpBx0D2USBHlz2fn6emCC414KU X-Received: by 10.159.255.65 with SMTP id u1mr4053587pls.233.1511787352421; Mon, 27 Nov 2017 04:55:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511787352; cv=none; d=google.com; s=arc-20160816; b=GHhXkHYFY0WkYR2MtYAjZXix1EzaPfdsuu7Fdakv/tpcJTGa6U5d0pR6Z8AqyeiWZV 5DkM1s0zhjX+Lba+a/Bn3fcBx78lRNdTpFHHXGLUeQ92ulZGgkT/Z6txugPr2V+nYTyw rTkYcang62QICR1U2k0otKJ/2tlkMjMB4tIBoXL6jsZLn+kU8OT/QcY/Y74RISc3vFxD HFjyuVx0nG7y/SII6tvTVt0P6m6rG+c9injmQB6bsKpDELi6So5C6MXcplJZN5bIdwQ5 eIY7imMVu7a9DUBfI1VN7Jc7qHB6d8bnysEoWxs1/u6Fcv/flbuzI4iHDhh5PRaX/mdb 5Lsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=e+x1zEA4Of184WGdT9Qbb4LJsq9+yanpqA0c/PpW/To=; b=OmpFZhGRNYFzo51VV/Fbe6XbyBnfFSNVJTim8PW4z866+wb7u6JRqLNy2Zx/oWMV8x idDa9k6dv8W4GkcXeyXBQMRUtHAPI2E6Z5UlEKNAxcUigR7on8noZA7tUa7ZrAJJJR0Q xCdnbsqWWCVExECPUq0QXAMrL4JtfnNLymDtxYwtMQzvr9qoMSOQDeMJo7Z1c3haU2Pp +VuC1diQdcSke/uxgugjztotxDwbjh4eNKsXJ4nc2TG4y5S3rJj2nCdGuKMhR0kO/a0G XQBefrRTES8rBYQmE98NXuCWmyq7XM0Fz6pNtq9zgkBcwdtsGpJc0eiGdiJSIX7Q/vMJ ncJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VaEjGswp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s36si23434208pld.67.2017.11.27.04.55.40; Mon, 27 Nov 2017 04:55:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VaEjGswp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752261AbdK0Mys (ORCPT + 77 others); Mon, 27 Nov 2017 07:54:48 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:41006 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670AbdK0Myp (ORCPT ); Mon, 27 Nov 2017 07:54:45 -0500 Received: by mail-pf0-f193.google.com with SMTP id j28so17323100pfk.8; Mon, 27 Nov 2017 04:54:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=e+x1zEA4Of184WGdT9Qbb4LJsq9+yanpqA0c/PpW/To=; b=VaEjGswpWa7WgbUHJ+4llZugHi2kpO18E7BYofUtWT39OwBd7a4h7cikvs7qQt/7Pm WjojMCdnanq6HLPOoHcUIcdfsCcK+Igg90ylXXd0lS7t5NKUeF3BJVgi31Sl3oCqvY6y /KbL3HEoLeaf+B8kiQrdZEeTPWTYxKDzlq1W0LKS8VD8FokNYL1PiFeXqqX7BjdaMJkr ZMLOLikoquRPE5eqrwuFs/Q1FFKqzsvL7PePjPPYNYToLDMdPfvIpJkNOSaZyJN4gl1l ic0JPfLU0xn6EPIMip4gINIh6NHEWE5nMNMhApetln86Mi81bs4IXt2CvHJFLFF3i03F 5Rqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=e+x1zEA4Of184WGdT9Qbb4LJsq9+yanpqA0c/PpW/To=; b=oh+rVNRZyfAsRHThXpmOWPs41rdbhbZizQSNIn880bwRmxnvpVuc8tRHj9FjGz+Xv2 mqcG9+cys5OzgxFdRTrgddmuNhHIF3Lmsev/kR7cekMu9IWirXd4pidzImk0h6Cm1hqG DmEgiWpiM3D3LM0wIie2mwpijDr0KiKfiw68P+CpPfROQis72T3YFZ4KIQ6E0mzMHuYZ +ubuR7tE4mnIRrdU+j0eYZZt/tWeiID74Rurf9t3uWmMKIDjHI/CP6QUQeP07BusssS+ cEbQTS8KIFsq6iyDUf9z73F4mKV0rGTDoK5esak0jFBbbuvt9W5OK6CULyrW7p8Bac0D qqug== X-Gm-Message-State: AJaThX55/eVNT60BLmdXReXYvg/260dGXZ3k7lsnUUoTXLvWJfDCZFvH v19kGN7jce/TC7KYHvpb4Fk= X-Received: by 10.98.133.65 with SMTP id u62mr36195867pfd.22.1511787284079; Mon, 27 Nov 2017 04:54:44 -0800 (PST) Received: from app09.andestech.com ([118.163.51.199]) by smtp.gmail.com with ESMTPSA id w64sm55225459pfj.62.2017.11.27.04.54.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 04:54:43 -0800 (PST) From: Greentime Hu 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 Cc: green.hu@gmail.com, Vincent Chen Subject: [PATCH v2 23/35] nds32: Miscellaneous header files Date: Mon, 27 Nov 2017 20:28:10 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greentime Hu This patch introduces some miscellaneous header files. Signed-off-by: Vincent Chen Signed-off-by: Greentime Hu --- arch/nds32/include/asm/delay.h | 51 +++++++++++++++++++++++++++++++ arch/nds32/include/asm/linkage.h | 24 +++++++++++++++ arch/nds32/include/uapi/asm/byteorder.h | 26 ++++++++++++++++ 3 files changed, 101 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..bdeeb76 --- /dev/null +++ b/arch/nds32/include/asm/delay.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2005-2017 Andes Technology Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __NDS32_DELAY_H__ +#define __NDS32_DELAY_H__ + +#include + +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..d17abd8 --- /dev/null +++ b/arch/nds32/include/asm/linkage.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2005-2017 Andes Technology Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#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..198e8dd --- /dev/null +++ b/arch/nds32/include/uapi/asm/byteorder.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2005-2017 Andes Technology Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __NDS32_BYTEORDER_H__ +#define __NDS32_BYTEORDER_H__ + +#ifdef __NDS32_EB__ +#include +#else +#include +#endif + +#endif /* __NDS32_BYTEORDER_H__ */ -- 1.7.9.5 From 1585194742070803987@xxx Mon Nov 27 05:11:52 +0000 2017 X-GM-THRID: 1585194742070803987 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread