From: Florian Fuchs <fuchsfl@gmail.com>
To: Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Florian Fuchs <fuchsfl@gmail.com>
Subject: [PATCH] sh: maple: fix empty port handling
Date: Wed, 12 Nov 2025 20:04:44 +0100 [thread overview]
Message-ID: <20251112190444.3631533-1-fuchsfl@gmail.com> (raw)
Handle timeout response from empty ports of the maple bus to prevent a
stuck maple_sentq and a blocked maple bus.
When only some ports are used, e.g. if only keyboard is connected and the
other ports are empty, the device tends to timeout and return 0xff for
the empty port. This needs to be handled, just like the
MAPLE_RESPONSE_NONE response, to detect empty ports and to have usable
peripherals, if not all of the ports are utilized. Previously, an empty
port resulted in a never cleared maple_sentq which totally blocked the
maple bus to be used.
Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
---
Note: This patch was tested on real Sega Dreamcast hardware and resulted
in a usable keyboard, even when only 1 or 2 ports where populated. The
hot-plugging of the keyboard does also work fine.
The description of the timeout response can be obtained on the bottom of
of the page: https://mc.pp.se/dc/maplebus.html: "If no response is
received before the timeout, a word with all bits set (FFFFFFFF) is
written at the Result address."
drivers/sh/maple/maple.c | 1 +
include/linux/maple.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 6dc0549f7900..3d6c716cfc98 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -649,6 +649,7 @@ static void maple_dma_handler(struct work_struct *work)
list_del_init(&mq->list);
switch (code) {
case MAPLE_RESPONSE_NONE:
+ case MAPLE_RESPONSE_TIMEOUT:
maple_response_none(mdev);
break;
diff --git a/include/linux/maple.h b/include/linux/maple.h
index 3be4e567473c..4ae3cc6678a8 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -27,7 +27,8 @@ enum maple_code {
MAPLE_COMMAND_BWRITE,
MAPLE_COMMAND_BSYNC,
MAPLE_COMMAND_SETCOND,
- MAPLE_COMMAND_MICCONTROL
+ MAPLE_COMMAND_MICCONTROL,
+ MAPLE_RESPONSE_TIMEOUT = 255
};
enum maple_file_errors {
base-commit: 24172e0d79900908cf5ebf366600616d29c9b417
--
2.43.0
next reply other threads:[~2025-11-12 19:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 19:04 Florian Fuchs [this message]
2025-11-12 21:31 ` [PATCH] sh: maple: fix empty port handling John Paul Adrian Glaubitz
2025-11-12 21:46 ` Artur Rojek
2025-11-12 22:46 ` Florian Fuchs
2025-11-16 12:34 ` Artur Rojek
2025-11-16 17:52 ` Florian Fuchs
2025-11-16 18:25 ` Artur Rojek
2026-04-12 7:29 ` John Paul Adrian Glaubitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251112190444.3631533-1-fuchsfl@gmail.com \
--to=fuchsfl@gmail.com \
--cc=dalias@libc.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox