{"id":2221239,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2221239/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260408220928.3328551-3-daniel@thingy.jp>","date":"2026-04-08T22:09:25","name":"[v3,2/5] m68k: Fix writew(), writel(), readw(), readl() endianness for classic m68k","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"5117c14e91c3aea0f794a1c0247b339c70afc45d","submitter":{"id":85408,"url":"http://patchwork.ozlabs.org/api/1.0/people/85408/?format=json","name":"Daniel Palmer","email":"daniel@thingy.jp"},"delegate":{"id":14103,"url":"http://patchwork.ozlabs.org/api/1.0/users/14103/?format=json","username":"spectrum","first_name":"Angelo","last_name":"Dureghello","email":"sysamfw@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260408220928.3328551-3-daniel@thingy.jp/mbox/","series":[{"id":499218,"url":"http://patchwork.ozlabs.org/api/1.0/series/499218/?format=json","date":"2026-04-08T22:09:23","name":"Add virtio-mmio support to m68k virt machine","version":3,"mbox":"http://patchwork.ozlabs.org/series/499218/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221239/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=thingy.jp header.i=@thingy.jp header.a=rsa-sha256\n header.s=google header.b=XGU6WXUM;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=thingy.jp","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=thingy.jp header.i=@thingy.jp header.b=\"XGU6WXUM\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=thingy.jp","phobos.denx.de; spf=pass smtp.mailfrom=daniel@0x0f.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frcgr2g63z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 08:10:16 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 7A56C8414B;\n\tThu,  9 Apr 2026 00:09:59 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 1B7D083DC9; Thu,  9 Apr 2026 00:09:58 +0200 (CEST)","from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com\n [IPv6:2607:f8b0:4864:20::42b])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id D162C84142\n for <u-boot@lists.denx.de>; Thu,  9 Apr 2026 00:09:55 +0200 (CEST)","by mail-pf1-x42b.google.com with SMTP id\n d2e1a72fcca58-82a7539851fso167136b3a.1\n for <u-boot@lists.denx.de>; Wed, 08 Apr 2026 15:09:55 -0700 (PDT)","from kinako ([2400:2200:7f0:5ee8:dac6:2cde:760c:93f])\n by smtp.googlemail.com with ESMTPSA id\n d2e1a72fcca58-82cf9b60199sm19877723b3a.25.2026.04.08.15.09.51\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Apr 2026 15:09:53 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=thingy.jp; s=google; t=1775686194; x=1776290994; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=h50cw41BtUAEcCIxmSMdICAf/4B9jb1hBvtV0/DAO68=;\n b=XGU6WXUMTDyZA+LRQlpKDPyGed4cEdMBcDll8pt/lLZgHWa2Apj1vSrwlVzhUJSZ3y\n oeG8pHdTr/CELQI6DO8Q+ZUcYuowzN5qD2Ij3cbh084sYSHlRcbX6QSj5P0UgEbbK8Vr\n GAEme46uBeJgvUPL36a74w7a4qKnCBeIdmO2M=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775686194; x=1776290994;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=h50cw41BtUAEcCIxmSMdICAf/4B9jb1hBvtV0/DAO68=;\n b=Wmox+PtpAS3YQkJR9adRUyujgr/bPGuwFy2AFLrT1rFOTLvmgHuf2u9AX41l+WNS32\n WD4dOi0191d1fd4xH4quqqBstvHP4+leQqmaF2ns7RYQ/mRXglKHkDrdFz6zFefKmxIT\n 0OLUmUXTZSd3g0T3YzMCNOIFnTsEkvzGaW/be18YSdgjJyZ4czn3KodEDxy2kDg6VhCq\n L+yZv1WXjPqfBFPawhrptpMNyRtp4sX0Ipm1SrLdRkNrzhqMR2tUEq+8nE+RiDFJmZYA\n bbh2E9A5rP42RoOG4TCWXMVfHThUu0wxrZTvJ/j5uLa4HpLLMChby2fbg2Fza/+I/jFc\n mErQ==","X-Gm-Message-State":"AOJu0YyyOoZhrRd0uI+N7HKqJIt9PHsBU1Lv6t0n57Wh1XEtuQthVqHJ\n 97haKEUzmfdJDK73veezPAtuoLoudbHejPuSN3V7E8087kIluqbQNh2Pelyv9y4Jhvg=","X-Gm-Gg":"AeBDievnBx8pYjiUPZR0xmR/SLs39iNF3uJ43VgOjqnRCCazx0GX9txoDgHQAYKSmZF\n Jsn0qTTb5uxiSWUEx8+4knrcDwPGgEp2Lx9mK6lNdtyx21a/fwgwiLpOKSwExvX530DTKf+QuU0\n 56BUzFNz89GA6SDORmRWpCYU31hCEDc0MEZYXSuf5zwn+viOUNN9rWeqn5C/roXPSEdOvam7HMn\n mqGUlu/La7/Zu1Em9CW9Q9D8bKJ+2qJsvUnDp+kIyzuIRWSSksE1MJCIT473WZzvOGHQ4h1F4/W\n +C8GUvY1YCJ7yS7KFQjQ9mNWSMW7Yw6MiAwrR7RL8X9WFy/FJRYebXHJV4a6K01AlYmflPV2D4d\n 5BP0lIGhPx12FbSTIocukHXemcJ86mffzYorlSScVOvYv5mjEpoWmj5Xgrp3HZdXHAKHnPDlL2I\n gW4J866wMoHxvi","X-Received":"by 2002:a05:6a00:1ac9:b0:81e:b2ba:5b3a with SMTP id\n d2e1a72fcca58-82d0da464cemr20602395b3a.8.1775686194218;\n Wed, 08 Apr 2026 15:09:54 -0700 (PDT)","From":"Daniel Palmer <daniel@thingy.jp>","To":"visitorckw@gmail.com,\n\tangelo@kernel-space.org,\n\tbmeng.cn@gmail.com","Cc":"u-boot@lists.denx.de,\n\tDaniel Palmer <daniel@thingy.jp>","Subject":"[PATCH v3 2/5] m68k: Fix writew(), writel(), readw(),\n readl() endianness for classic m68k","Date":"Thu,  9 Apr 2026 07:09:25 +0900","Message-ID":"<20260408220928.3328551-3-daniel@thingy.jp>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260408220928.3328551-1-daniel@thingy.jp>","References":"<20260408220928.3328551-1-daniel@thingy.jp>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"In Linux these are meant to read a little-endian value and swap\nto the CPU endian.\n\nIn u-boot for m68k this is currently broken and prevents\nvirtio-mmio from functioning.\n\nThis change is only for classic m68k. Coldfire has read big-endian,\nno swap for these in u-boot and Linux and existing drivers probably\ndepend on this.\n\nSigned-off-by: Daniel Palmer <daniel@thingy.jp>\n---\n arch/m68k/include/asm/io.h | 31 ++++++++++++++++++++-----------\n 1 file changed, 20 insertions(+), 11 deletions(-)","diff":"diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h\nindex 35ad4a1c0444..2577081d8363 100644\n--- a/arch/m68k/include/asm/io.h\n+++ b/arch/m68k/include/asm/io.h\n@@ -23,18 +23,27 @@\n #define __raw_writew(w,addr) ((*(volatile u16 *) (addr)) = (w))\n #define __raw_writel(l,addr) ((*(volatile u32 *) (addr)) = (l))\n \n-#define readb(addr)\t\tin_8((volatile u8 *)(addr))\n-#define writeb(b,addr)\t\tout_8((volatile u8 *)(addr), (b))\n-#if !defined(__BIG_ENDIAN)\n-#define readw(addr)\t\t(*(volatile u16 *) (addr))\n-#define readl(addr)\t\t(*(volatile u32 *) (addr))\n-#define writew(b,addr)\t\t((*(volatile u16 *) (addr)) = (b))\n-#define writel(b,addr)\t\t((*(volatile u32 *) (addr)) = (b))\n+#define readb(addr)\tin_8((volatile u8 *)(addr))\n+#define writeb(b, addr)\tout_8((volatile u8 *)(addr), (b))\n+#ifdef CONFIG_M680x0\n+/*\n+ * For classic m68k these work the same way as Linux:\n+ * Read a little endian value, swap to the CPU endian.\n+ */\n+#define readw(addr)\tin_le16((volatile u16 *)(addr))\n+#define readl(addr)\tin_le32((volatile u32 *)(addr))\n+#define writew(b, addr)\tout_le16((volatile u16 *)(addr), (b))\n+#define writel(b, addr)\tout_le32((volatile u32 *)(addr), (b))\n #else\n-#define readw(addr)\t\tin_be16((volatile u16 *)(addr))\n-#define readl(addr)\t\tin_be32((volatile u32 *)(addr))\n-#define writew(b,addr)\t\tout_be16((volatile u16 *)(addr),(b))\n-#define writel(b,addr)\t\tout_be32((volatile u32 *)(addr),(b))\n+/*\n+ * For coldfire these read a big endian value and use it\n+ * as-is. This means that for little endian devices on the\n+ * bus like PCI device these won't work as expected currently.\n+ */\n+#define readw(addr)\tin_be16((volatile u16 *)(addr))\n+#define readl(addr)\tin_be32((volatile u32 *)(addr))\n+#define writew(b, addr)\tout_be16((volatile u16 *)(addr), (b))\n+#define writel(b, addr)\tout_be32((volatile u32 *)(addr), (b))\n #endif\n \n /*\n","prefixes":["v3","2/5"]}