From patchwork Thu Aug 27 11:54:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1352508 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=a2yBjst2; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bch3r5p1Xz9sT6 for ; Thu, 27 Aug 2020 21:54:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21F9881F19; Thu, 27 Aug 2020 13:54:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="a2yBjst2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4003682189; Thu, 27 Aug 2020 13:54:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 817DD81F05 for ; Thu, 27 Aug 2020 13:54:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-wr1-x444.google.com with SMTP id r15so5068875wrp.13 for ; Thu, 27 Aug 2020 04:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zix5gewCkGHwFgVrp0C2JYlR77NMmGN1Kr/EegeVR/s=; b=a2yBjst28ejiclrFFqhx0euWrUVE6UoLMqBZN5lEfwqiRXaOk1zA34be8oI+ThSVFy D3d1I2zanjoQoT+gO6BYuCZ0/ZHMVumckHyHZKMayj5QPUrWLterJCNHX8AeBdTfWPUb ujlpD+eljyIQpaXSgQoS04IIXBcIGN/4xFLI2pL1Co6s5jpMJZrxXJTIRpYxk6rp2IQi Z5njFsKRHdM7lIAMoJqVbMexoW3ZpqQOiFMaFxToe95tHiFsX3JGgck6+f0tMDmcz3xR D/ZzPaF4GEi+777GiNBSt4B+5BKZkTCLCxm/euUyt3RJZoaPN6BsVeVWCMsn9d+Y/2hl YfSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=zix5gewCkGHwFgVrp0C2JYlR77NMmGN1Kr/EegeVR/s=; b=X8jk5M0l6568XZ0SQfDFDWUF5PQUzomeOIifPfhl0B4SI0wmQ7ECNJyvgocGtw45aV BkULz+vicXgffKDBY4fr+JTuZFv0OznbU96bfQSurwYkTjIv4FMN1q6uN3LYJnmTgyei ukEhbrLQ5WxBVMxrGrPkY9a9BgZVggOYWnyhcaMOKN4dgJ5SLWukGcX5GyvB+YrpVNOD a8+4i8aOjIp4CsPr7WSqOIqs9UKAHczr0rW7IJ4BR7EBkuN7GFm5KIWVk1iWvuXkmgNx 8Dow7hCaFrMGxCKW/5Ze0+WoHaoOON3q9a6TGL3MviRNG/DxUOrLlYvoqW4BTXTTE9ll bErA== X-Gm-Message-State: AOAM533n/f9uXbjnZkXXyu5cl6ojwp7+iu/fuSIbFKi/cHIWTKro4V6S mpr9WnmTqjWq7WPz6bYlQ097NOwjFF7ouw== X-Google-Smtp-Source: ABdhPJwgo2xMPo+Q/OFDX3KdAjPstrZjNYn0LQR0mVpwhkWfoMz+vpivyxNTmLgLHH6f31NqtPJwBQ== X-Received: by 2002:adf:ec8c:: with SMTP id z12mr20080471wrn.177.1598529279799; Thu, 27 Aug 2020 04:54:39 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id h5sm6015882wrc.97.2020.08.27.04.54.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Aug 2020 04:54:39 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: T Karthik Reddy , Ashok Reddy Soma , Michal Simek Subject: [PATCH] microblaze: Add support for little/big endian in/out api's Date: Thu, 27 Aug 2020 13:54:38 +0200 Message-Id: <71ba8a45e37f56664f2d8911c92432b5d95104a1.1598529276.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: T Karthik Reddy Add read/write memory utilities for 16 and 32 bits. Add these api's for both little and big endian systems similar to arm architecture. Signed-off-by: T Karthik Reddy Signed-off-by: Ashok Reddy Soma Signed-off-by: Michal Simek --- arch/microblaze/include/asm/io.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index 8e6be0ae267f..632bb236fbbe 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -50,14 +50,24 @@ #define outw(x, addr) ((void)writew(x, addr)) #define outl(x, addr) ((void)writel(x, addr)) -/* Some #definitions to keep strange Xilinx code happy */ -#define in_8(addr) readb(addr) -#define in_be16(addr) readw(addr) -#define in_be32(addr) readl(addr) +#define out_arch(type, endian, addr, x) \ + __raw_write##type(cpu_to_##endian(x), addr) +#define in_arch(type, endian, addr) \ + endian##_to_cpu(__raw_read##type(addr)) + +#define out_le16(addr, x) out_arch(w, le16, addr, x) +#define out_le32(addr, x) out_arch(l, le32, addr, x) + +#define in_le16(addr) in_arch(w, le16, addr) +#define in_le32(addr) in_arch(l, le32, addr) + +#define in_8(addr) readb(addr) +#define in_be16(addr) in_arch(w, be16, addr) +#define in_be32(addr) in_arch(l, be32, addr) #define out_8(addr, x) outb(x, addr) -#define out_be16(addr, x) outw(x, addr) -#define out_be32(addr, x) outl(x, addr) +#define out_be16(addr, x) out_arch(w, be16, addr, x) +#define out_be32(addr, x) out_arch(l, be32, addr, x) #define inb_p(port) inb((port)) #define outb_p(val, port) outb((val), (port))