From patchwork Wed Jan 29 09:27:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Finn Thain X-Patchwork-Id: 11355763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAEE592A for ; Wed, 29 Jan 2020 09:39:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBA732070E for ; Wed, 29 Jan 2020 09:39:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBA732070E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=telegraphics.com.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwjok-0003k1-VA for patchwork-qemu-devel@patchwork.kernel.org; Wed, 29 Jan 2020 04:39:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51449) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwjl4-0003bk-Kk for qemu-devel@nongnu.org; Wed, 29 Jan 2020 04:35:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwjl3-0000nb-H9 for qemu-devel@nongnu.org; Wed, 29 Jan 2020 04:35:38 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:50070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iwjl3-0000kF-Ch; Wed, 29 Jan 2020 04:35:37 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id C1180299C9; Wed, 29 Jan 2020 04:35:35 -0500 (EST) To: Jason Wang , qemu-devel@nongnu.org Message-Id: <61d9753b631e9071809cdd1bb8e12385aa06c83e.1580290069.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH v4 13/14] dp8393x: Don't reset Silicon Revision register MIME-Version: 1.0 Date: Wed, 29 Jan 2020 20:27:49 +1100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 98.124.60.144 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= , Aleksandar Rikalo , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Laurent Vivier , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The jazzsonic driver in Linux uses the Silicon Revision register value to probe the chip. The driver fails unless the SR register contains 4. Unfortunately, reading this register in QEMU usually returns 0 because the s->regs[] array gets wiped after a software reset. Fixes: bd8f1ebce4 ("net/dp8393x: fix hardware reset") Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- Changed since v3: - Simplified as per suggestion from Philippe Mathieu-Daudé. --- hw/net/dp8393x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 1b73a8703b..93eb07e6c8 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -919,6 +919,7 @@ static void dp8393x_reset(DeviceState *dev) timer_del(s->watchdog); memset(s->regs, 0, sizeof(s->regs)); + s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux/mips */ s->regs[SONIC_CR] = SONIC_CR_RST | SONIC_CR_STP | SONIC_CR_RXDIS; s->regs[SONIC_DCR] &= ~(SONIC_DCR_EXBUS | SONIC_DCR_LBR); s->regs[SONIC_RCR] &= ~(SONIC_RCR_LB0 | SONIC_RCR_LB1 | SONIC_RCR_BRD | SONIC_RCR_RNT); @@ -971,7 +972,6 @@ static void dp8393x_realize(DeviceState *dev, Error **errp) qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); - s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ memory_region_init_ram(&s->prom, OBJECT(dev), "dp8393x-prom", SONIC_PROM_SIZE, &local_err);