From patchwork Fri Jan 10 16:02:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 856259 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:385:e875:8a9e with SMTP id k28csp302645wrc; Fri, 10 Jan 2025 08:04:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWR4e89t60cSutGpN9mo9j55HyG41CCoEhXlzFX8miZdXfqtarBa1AoAX8ldI2H+qSA3uhH2Q==@linaro.org X-Google-Smtp-Source: AGHT+IHbBaLqmWdG0gbsK6o4liLyTzOFSccUH/3EF0Eg1cC47BONrNqv89Bf+KDDB47Rqr7illq8 X-Received: by 2002:a05:651c:b0f:b0:302:4115:18b with SMTP id 38308e7fff4ca-305f4525446mr34176821fa.1.1736525073693; Fri, 10 Jan 2025 08:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736525073; cv=none; d=google.com; s=arc-20240605; b=kOCP4GKszM2tam3jpwJGB39I5n6n2Tl1L4sn92Dhsdplx2i5dziZyq9nXv6Snw8mL2 KIftHEaLcTbicmHYRsFHmBHGkfHcVENqiW5K+Q4gtmOx18bCv37jqsL+iwOidP26sJWC 48ix4VdT5dy0vcC1NcJBxcTH0dA8gKI9knzICAc5epL0jYDbIeAyLcrxdIjMRRzdvX3H H8a3mepILOfsjlvoSfgMzH1eOr391bKuYJdnJpFmm12CymgZeeg8SooZUIv+DAbReGCm ImtjgqqpewCQZXKDrrC5BQTT5IzrjJnU6be1/C7+ii/KURyUND9SXD96dLUP9MDpg5AM rLQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=11iHBCaGxzy1H3GllyQ3szfgtatw8IIZSrsd+4vXp4U=; fh=Uq4CCH4qgIScoA1ZlzK6h1LD8Rw6xac8JtYTs6G5zlc=; b=Od1OfsCUDIheh+g0QDzp7p6m4coh6amIn1IvAIbU5+1Vi8cU5NXxcCjO4veFAzYHMm Zb4yGiCspL7OCeoq+MrnU/sf3I3Vk8oAbXViWDVKy9zoaCKwPpmIFjIn5oaSFxZpY+rn UUH7PsG/8grIKFWy4aRg75km1LhiM5q4n3yfju3+T/ffZecKD9J4uqJeZvMRubeEZgd3 GQIjsDTQxKAViNx0lgMCiDQbvl+7/nS9+2HIVTxAJtaFcRZVOpmkiOLsKb/kC0tOUHA3 imnac0R3637xWxPC9rjYX8uJYw7LzZ1/K8T63F6WKyMjNpfOC2JEhHlu+j2GGkLz/A0x l5kw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NkvdhhWM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 38308e7fff4ca-305ff198a0csi12563731fa.136.2025.01.10.08.04.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2025 08:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NkvdhhWM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tWHTo-0007i3-TP; Fri, 10 Jan 2025 11:03:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tWHT9-0007KA-50 for qemu-devel@nongnu.org; Fri, 10 Jan 2025 11:02:49 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tWHT2-0004Gv-32 for qemu-devel@nongnu.org; Fri, 10 Jan 2025 11:02:40 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3862a921123so1455898f8f.3 for ; Fri, 10 Jan 2025 08:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736524954; x=1737129754; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=11iHBCaGxzy1H3GllyQ3szfgtatw8IIZSrsd+4vXp4U=; b=NkvdhhWM97FlZ0SiKA3u++Pj6W6O/NWm0zAysZfRm+6NGAhHlvbZDeokZ2tC0P1vp9 x8umtUCV9vyM5GuHyNeiVxibQ3VkLs3nqba1nlzudTeZnzSLmARocCHBwEUliTTrhiLl u5jbkOZz6q14VZUnld0J5rdZdK2oE9/ZtD8b85pPraFsgiEh2L59ysSGPOXbUHvCqKl1 IRI6zk4JUW8BVLxIY8OzdReZCffma2RfX1ywHXniA9a1nC5ZrpxU0PEl7GozRIRYtcCl cGDtRdK2Lceu03kR7tlgoRmptJfq8feKF0m5KG+cLXTMiAzOtqdKUsH321pLgi400DXj I07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736524954; x=1737129754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=11iHBCaGxzy1H3GllyQ3szfgtatw8IIZSrsd+4vXp4U=; b=UeRmp9W+GnUUfzC4spxcwnQEdmy4l0SOu/1Kbze+2xcmV139wqgtC87kEA610zzt16 7pkgzk+5qh9zqZQKxLBFhnwfQqJ3mfPOPnMU+tiwkUdYI21usEK3j/clwk1T/2YCCjE4 er0/PdCSIKdnJuh8E9x8HFh+1kiRZAJUI1gEvdJrQ0Vc3S385z1DfMW7GX5Xyj00Q1zY 2wcLND9wRHSBRfAkEdvwO4pknD4vyWtkEz0H40KVzOiW/rOokp8e0toM3Pfauh9HEfHq wfvqIvXIXa4CSWboAAoNJFi4l53Oc1DnkUs+V5NzhL5yZyp9ftwotPJ0tcGHzlKkgcK0 J8FQ== X-Gm-Message-State: AOJu0YwCSZjKbDzTvG4+InxqjoPsv365m/F0ArFdjc6QbsmFsovExUZB mispTMyRilu+m99W1jjLJpzgsH9zr37x97nF/2L6jlPERUzMAo8mvB0AvL0qTIMpLVhlsBYSKnW 3RRA= X-Gm-Gg: ASbGncvWVlTUjXkEiEzDqHOvQRQj02Qh3DjJEaB4zhzFJqh8/l7g1jY5SfW+467ys4i DrpoWyQ4NVDA30/xEesEkrHwyynJhAXkPIASt+56qlhpg/gh94UP6Rac+Fqn4wA03HBpx+Tahvq QwuA+UHUI909cG0Q9RkVqufglXtp4bodbhj6o92IYBCA+ZhEv07tO65AkdWf+tA6DgxaRBDLb++ sxWdzMA8gn/za4YosVVcQ40nCyC2BXMwtXqqTFx6Vr5iYnXbFH0AY1rDRg/S46l7MgAhlZKW1Q+ uy3Co5FQC5XKASkp2Zw0xvSyvekJ7y4= X-Received: by 2002:a05:6000:1847:b0:386:3825:2c3b with SMTP id ffacd0b85a97d-38a87304672mr9420072f8f.18.1736524953527; Fri, 10 Jan 2025 08:02:33 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1967sm4765917f8f.86.2025.01.10.08.02.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 10 Jan 2025 08:02:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/9] hw/arm/stellaris: Map both I2C controllers Date: Fri, 10 Jan 2025 17:02:01 +0100 Message-ID: <20250110160204.74997-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110160204.74997-1-philmd@linaro.org> References: <20250110160204.74997-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org There are 2 I2C controllers, map them both, removing the unimplemented one. Keep the OLED controller on the first I2C bus. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/stellaris.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 64e6797553a..655bf85e89e 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1021,6 +1021,8 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) { 0x40004000, 0x40005000, 0x40006000, 0x40007000, 0x40024000, 0x40025000, 0x40026000}; static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31}; + static const uint32_t i2c_addr[NUM_I2C] = {0x40020000, 0x40021000}; + static const int i2c_irq[NUM_I2C] = {8, 37}; /* Memory map of SoC devices, from * Stellaris LM3S6965 Microcontroller Data Sheet (rev I) @@ -1062,7 +1064,7 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) qemu_irq adc; int sram_size; int flash_size; - I2CBus *i2c; + DeviceState *i2c_dev[NUM_I2C]; DeviceState *dev; DeviceState *ssys_dev; int i; @@ -1195,14 +1197,18 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) } } - if (DEV_CAP(2, I2C(0))) { - dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000, - qdev_get_gpio_in(nvic, 8)); - i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c"); - if (board->peripherals & BP_OLED_I2C) { - i2c_slave_create_simple(i2c, "ssd0303", 0x3d); + for (i = 0; i < NUM_I2C; i++) { + if (DEV_CAP(2, I2C(i))) { + i2c_dev[i] = sysbus_create_simple(TYPE_STELLARIS_I2C, i2c_addr[i], + qdev_get_gpio_in(nvic, + i2c_irq[i])); } } + if (board->peripherals & BP_OLED_I2C) { + I2CBus *bus = (I2CBus *)qdev_get_child_bus(i2c_dev[0], "i2c"); + + i2c_slave_create_simple(bus, "ssd0303", 0x3d); + } for (i = 0; i < NUM_UART; i++) { if (DEV_CAP(2, UART(i))) { @@ -1381,7 +1387,6 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) /* Add dummy regions for the devices we don't implement yet, * so guest accesses don't cause unlogged crashes. */ - create_unimplemented_device("i2c-2", 0x40021000, 0x1000); create_unimplemented_device("PWM", 0x40028000, 0x1000); create_unimplemented_device("QEI-0", 0x4002c000, 0x1000); create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);