Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp506593pxy; Thu, 22 Apr 2021 07:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJsAh8NAhK+BCHb4MzfgJQJaCwodsiu1+75jJIvtb9p/ITSnWPGRpEIygIoUl7zGUFIW1l X-Received: by 2002:a65:5b87:: with SMTP id i7mr3596900pgr.315.1619100699534; Thu, 22 Apr 2021 07:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619100699; cv=none; d=google.com; s=arc-20160816; b=0XwkeAW7L6xfgwerKJp1eqRG0bvvEE2mbKBLOAF9SQFpt7qWwihK6+eVN8diatlef/ mwXoB72PA0tdmbIhsmIromdtDr1ViLMukjS2EefvhSl8loWGc7Lazj1YhCQugOu5s4OH avKoQoYVsv4t3f1nXxHQNivEOvA1vQ8wfI/Ow3+FQWuZMiepaz/33H5rq2qMosBUgprW ZFfSGCqbWhTiyNLBS8GGK/wjtDaFnEnMJOh2P7x93KnUckdZJkuTSElGpPTqeEsgjP0E WYmjLK7v4P5wY+i3N5dEsbg/FLt25iVWNq9lmwexe8olyd4IDTD34rMSlpIgbkzPUmFD RJCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XI2YCUz+44Zy3orKtb7KsqGSJx1mxyhuJPFi/bk0Zs0=; b=Aw04R1UF8wCQFFORGCQWYGrCtRe9ZxUjx5Xkqawmi6jYlcU1wTlyJ7tHzPjdIcVOZF fv6KvEuXH/MjRQvhU/kbQBS5A4gE8GxLykPUpWhAL+UpaMvuwYLRDPmP6ov2sesFwkcO +e2U/hc5+J3Lrvf+jJajo6FnppIatCpxoNifirSQt1Q3F9BdRYWRVURSGS3QGztBeW1W q9Ku8b0/54NKuKaFt1dJF8nMXT9ZzE1KCa0Y6/U4uxHhMLu07uD5c+no8FbtkE1naRGa /vc+VLia4cM1z0/w0pZnDn0gm8xANB6njaxIaTc3FX5NDS8tFM7CRFmDmzg4+qgWwDQ/ uWsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@0x0f.com header.s=google header.b=MuN9hvNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si3143265pjy.152.2021.04.22.07.11.26; Thu, 22 Apr 2021 07:11:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@0x0f.com header.s=google header.b=MuN9hvNr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237096AbhDVOKj (ORCPT + 99 others); Thu, 22 Apr 2021 10:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237035AbhDVOKh (ORCPT ); Thu, 22 Apr 2021 10:10:37 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81771C06138B for ; Thu, 22 Apr 2021 07:10:02 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id h11so739989pfn.0 for ; Thu, 22 Apr 2021 07:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=0x0f.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XI2YCUz+44Zy3orKtb7KsqGSJx1mxyhuJPFi/bk0Zs0=; b=MuN9hvNrvNcaR2Q0CvGD3fjuOLDw3jSpv+b/lcondYlgWvEhQoK13ZyYYwnoNuNKhW CANvDi0TQlBXbQQ7fu6/gfqdiZO+AERaSLLULgxsLdTtmRoGBEg7+PypOV3c1mo0n3wI nr3vPRFWEyNzINgfF58HLykvl0iioGHIOlpuw= 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:mime-version:content-transfer-encoding; bh=XI2YCUz+44Zy3orKtb7KsqGSJx1mxyhuJPFi/bk0Zs0=; b=JO0uXeAvhVvyHPcD3EbJ6sU7gqOuPg17voKdnEoeiAukEZms6TmnNsxDcwZpLTQ+cN 5kSkh/BK0w8OaM6uQbUeGxY1QkpC7KnWEBfFRpIFzYiKKybeP1NuDgJ3PiTVuX/yCFHu UJ0hoku6st/5Kouwp0WmWA0itRmh2dTyq6zQMbRzuIz1W72ztysUh+Vm3UgZns9I2qUu WnQUrhCgszRQTnKEULftXmhbhDW4cojVuDPlLGHB0khaZTbcBTGYz/0wd63NlRbwayn5 1csHROTrq+MrRRmDj/V/dInUKGQIjl23UwfCO5XnEANqhcCiFIjvW4JAwF0TD3zr79U4 QD1w== X-Gm-Message-State: AOAM530iulnrMxZoEeGyDEbk9rbAuIWCcEPwYQwVGHqPR9I1k4bk7liz vSpMWaDOl8rxirYCXChpBWsEoA== X-Received: by 2002:a62:7d46:0:b029:247:baa2:d95c with SMTP id y67-20020a627d460000b0290247baa2d95cmr3635339pfc.15.1619100602037; Thu, 22 Apr 2021 07:10:02 -0700 (PDT) Received: from shiro.work (p345188-ipngn200408sizuokaden.shizuoka.ocn.ne.jp. [124.98.97.188]) by smtp.googlemail.com with ESMTPSA id p12sm5278968pjo.4.2021.04.22.07.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 07:10:01 -0700 (PDT) From: Daniel Palmer To: soc@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: olof@lixom.net, arnd@kernel.org, w@1wt.eu, Daniel Palmer Subject: [RFC PATCH 2/2] ARM: mstar: Add header with macros for XIU register access Date: Thu, 22 Apr 2021 23:09:45 +0900 Message-Id: <20210422140945.4131092-3-daniel@0x0f.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210422140945.4131092-1-daniel@0x0f.com> References: <20210422140945.4131092-1-daniel@0x0f.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Registers connected to the CPU via "XIU" (Maybe eXtended Interface Unit) are 32bits wide with a 64bit stride. Apparently someone realised that splitting 32bit registers into two 16bit ones was silly but at the same time didn't want to fix all of the register offsets used for "RIU" in their code. This means that any existing driver (i.e. the usb and ethernet) cannot be used as is and needs to use a special readl()/writel() to fix up the address of the register that needs to be accessed. To avoid having this code in every driver add a header with an implementation of readl()/writel() that patches over the insanity. Signed-off-by: Daniel Palmer --- include/soc/mstar/xiu.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 include/soc/mstar/xiu.h diff --git a/include/soc/mstar/xiu.h b/include/soc/mstar/xiu.h new file mode 100644 index 000000000000..d658338b8006 --- /dev/null +++ b/include/soc/mstar/xiu.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _SOC_MSTAR_XIU_H_ +#define _SOC_MSTAR_XIU_H_ + +#include + +static inline u32 xiu_readl(__iomem void *base, unsigned int offset) +{ + __iomem void *reg = base + (offset * 2); + + return readl_relaxed(reg); +} + +static inline void xiu_writel(__iomem void *base, unsigned int offset, u32 value) +{ + __iomem void *reg = base + (offset * 2); + + writel_relaxed(value, reg); +} + +#endif -- 2.31.0