Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86B3621D591 for ; Sat, 25 Jul 2026 17:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785002137; cv=none; b=tYTpBVxATTQy5fWwhxzWyC0zC+9cUlsWljln5cCcMWPtX8LAHBo2gZS4jX1rIX7spEqWNva3J/PMBbWidJxU/CGEvqgdV5tKsbpdfq+pLy6C4cK2tZBh8gwTvuSHJtVkM6TEHRS0E8Vi1gEMgmiMpM9oK5xE1HRYhod0pcTk1Zo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785002137; c=relaxed/simple; bh=kYzH+Zx2CI+LxT9f3ooa30WyH52Imx/wtBn4SFN1QQ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dAv1DQZqOJ8CDAP8a+a1+JToHyRfqjsVkenNobL9LLEPxFYkA02mCD/vWncCzSwp2T8R7Wp8kF63jSxEy3ba4fPKxoZvbvcKmlAFdEz7vYGc9MalmKIWeH2+RXqPSDfKaKONVeaSqZKEnbrYnk1mWmve+xZ3VV1qTUr93IKEyyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=hvdZ+9nT; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="hvdZ+9nT" Received: from mail01.layka.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 8163F84B39; Sat, 25 Jul 2026 19:55:32 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dav_NiQZnydG; Sat, 25 Jul 2026 19:55:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1785002131; bh=kYzH+Zx2CI+LxT9f3ooa30WyH52Imx/wtBn4SFN1QQ0=; h=From:To:Cc:Subject:Date; b=hvdZ+9nT70ADq1MytKS+vG9CCvWLCGoriw7ceG/TgCpbHo6NDjZ1/kd/6ABKvlI8c qPAbpRDWC0rc5s+xWJ9l0wJg2o44Y5kUHkVNKLBXHN4N3P4pWXnD5KVhp48ub8Pzfu fF/uFgmyX+FEVZ9mPW+w2pG1WIos6Zmlnbm2EupZA3DLRBdF2H4KEtW8N0DKwBcqmw QaZc4Yjk9FRJCXn0N68S0msd+9PXRTaFEejSnQX74a4zRwT0MGMdup26mF0XRKEIoy USoYvjpVA38A9JLc7BXTwfaKDC40E1m1Pt6fm9DoNrF4mSa3U2ByOn2XijBWon/KDg 9ee3+vdQkwKig== From: Rustam Adilov To: Daniel Lezcano , Thomas Gleixner , linux-kernel@vger.kernel.org Cc: Rustam Adilov , Chris Packham Subject: [PATCH v2] clocksource: rtl-otto: Change driver to use __raw reads and writes Date: Sat, 25 Jul 2026 22:55:10 +0500 Message-ID: <20260725175510.77240-1-adilov@disroot.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As it stands, the driver uses ioread32 and iowrite32 for register access and it works fine. However this stops working when the SWAP_IO_SPACE config is enabled as this drivers expects ioread32 and iowrite32 to be in native endian (that is big endian for currently supported SoCs). RTL9607C is a big endian MIPS SoC that has identical timer as the already supported chips but needs to have SWAP_IO_SPACE to have a functioning little endian USB host. Fix this by replacing all instances of ioread32 and iowrite32 with __raw_readl and __raw_writel variants. Since they essentially do the same register access, this shouldn't affect anything on other machines. Signed-off-by: Rustam Adilov Reviewed-by: Chris Packham --- Changes in v2: - added the review-by tag from Chris Packham. - Link to v1: https://lore.kernel.org/all/20260511131520.98420-1-adilov@disroot.org/ drivers/clocksource/timer-rtl-otto.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/timer-rtl-otto.c b/drivers/clocksource/timer-rtl-otto.c index dd236a7babee..0d1b9a01a94c 100644 --- a/drivers/clocksource/timer-rtl-otto.c +++ b/drivers/clocksource/timer-rtl-otto.c @@ -56,37 +56,37 @@ struct rttm_cs { /* Simple internal register functions */ static inline unsigned int rttm_get_counter(void __iomem *base) { - return ioread32(base + RTTM_CNT); + return __raw_readl(base + RTTM_CNT); } static inline void rttm_set_period(void __iomem *base, unsigned int period) { - iowrite32(period, base + RTTM_DATA); + __raw_writel(period, base + RTTM_DATA); } static inline void rttm_disable_timer(void __iomem *base) { - iowrite32(0, base + RTTM_CTRL); + __raw_writel(0, base + RTTM_CTRL); } static inline void rttm_enable_timer(void __iomem *base, u32 mode, u32 divisor) { - iowrite32(RTTM_CTRL_ENABLE | mode | divisor, base + RTTM_CTRL); + __raw_writel(RTTM_CTRL_ENABLE | mode | divisor, base + RTTM_CTRL); } static inline void rttm_ack_irq(void __iomem *base) { - iowrite32(ioread32(base + RTTM_INT) | RTTM_INT_PENDING, base + RTTM_INT); + __raw_writel(__raw_readl(base + RTTM_INT) | RTTM_INT_PENDING, base + RTTM_INT); } static inline void rttm_enable_irq(void __iomem *base) { - iowrite32(RTTM_INT_ENABLE, base + RTTM_INT); + __raw_writel(RTTM_INT_ENABLE, base + RTTM_INT); } static inline void rttm_disable_irq(void __iomem *base) { - iowrite32(0, base + RTTM_INT); + __raw_writel(0, base + RTTM_INT); } /* Aggregated control functions for kernel clock framework */ -- 2.55.0