Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC6AAC77B74 for ; Tue, 11 Apr 2023 15:07:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6CDEE85EC3; Tue, 11 Apr 2023 17:07:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kkeRAN0D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D13A85DD9; Tue, 11 Apr 2023 17:07:11 +0200 (CEST) Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C014D83A35 for ; Tue, 11 Apr 2023 17:07:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=christian.gmeiner@gmail.com Received: by mail-ej1-x62e.google.com with SMTP id xi5so21215445ejb.13 for ; Tue, 11 Apr 2023 08:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681225627; x=1683817627; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ntkHqjY0etBPeHaloHj/s5111SScJKieFRqO6Vi9Dv0=; b=kkeRAN0DTPc0TeiEuO6mZuAvEEL6XSGKXUNNjoDxaWZt5jm5P+V+2vfHAutp2uAT8y Vk2ym8e0QanbP7+rEk44fQ1infd2HfG6jvSZLOSND19u32zN+h+qUy/JQ4GiN1VzisAm p75URRksJUo9XY7zn+MK+Bgp3yhyQL+pIfosIz8k5MnMXo9wLhLdbDLrY7uVW49wCJFK QZpJEw1pqJn1FV6y9qTKWtpGugSs14HnOJmEkBVf4jcyBauPqRVayjhrMUU2+OS5kYn4 lYaMScxRuHtJWDLffI0a3B94979IbRRy1gu1k7Eg+Gqh3IZ4H9imOKBS5c9elrHIJbWb ZhpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681225627; x=1683817627; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ntkHqjY0etBPeHaloHj/s5111SScJKieFRqO6Vi9Dv0=; b=63ZajHAquBbEq6kJ3hya1DHUAyGmbUr9yzQsjlI7E+kPf2lZoagjZyB/raMUaKgomN N+lQNifeqKAwZd4L2gJPYDsamZ5QW6nS6JNilFa3XwQ07SGdQsUSKxZTVzuddz+p/oQX tYEb3VYYpcP6W32KISEt8camcnuE5Xxh8PfzaNKLL6hOaKJ+PTL5EE31mgHJoDQlIyZ0 HxMVRDvnHcVmivk+KECsVl56Izq4rs0vUM70cAB4GZQmI2pMmfkCaVg1Tm4AXR9VU3wj fQyQC3/p6Cg99MfXq3J4Kf87TBF3+1uQo3ffWCKl4BhcB479CC5huzDldHvuw/9SsDeU 5aQA== X-Gm-Message-State: AAQBX9dwaYAIppAtl1JR1iaKY1qQhba17SfmTBbmshn/cWQHkNBZQ1X9 NpbADXcPw/qEJLFaJUzEk/o= X-Google-Smtp-Source: AKy350ZFmU7eBLjXH7pwQyXpGUVLdqCUjadPWY2lBLk7h6fza+GiHUnnHJCDSFEYfO2YZZIO/ppv2g== X-Received: by 2002:a17:907:989c:b0:94a:4d39:a518 with SMTP id ja28-20020a170907989c00b0094a4d39a518mr8266132ejc.21.1681225627057; Tue, 11 Apr 2023 08:07:07 -0700 (PDT) Received: from localhost.localdomain (80-108-76-242.cable.dynamic.surfer.at. [80.108.76.242]) by smtp.gmail.com with ESMTPSA id wu14-20020a170906eece00b00947740a4373sm6159656ejb.81.2023.04.11.08.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 08:07:06 -0700 (PDT) From: Christian Gmeiner To: Bin Meng , Simon Glass , Andrew Scull , Christian Gmeiner , Heinrich Schuchardt , u-boot@lists.denx.de (open list) Subject: [PATCH v3] ata: pci: enable bus mastering Date: Tue, 11 Apr 2023 17:07:02 +0200 Message-Id: <20230411150703.70659-1-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.40.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The non DM code path already would enable pci bus mastering. Do the same for the DM code path. Fixes AHCI problems I am seeing on an Intel Apollolake device. Signed-off-by: Christian Gmeiner Reviewed-by: Bin Meng --- v2: Add Bin's R-b and remove the ending '.' from comment. v3: Add the patch changelog to the correct place drivers/ata/ahci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6998b82aa5..360ac2c060 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1152,7 +1152,12 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) int ahci_probe_scsi_pci(struct udevice *ahci_dev) { ulong base; - u16 vendor, device; + u16 vendor, device, cmd; + + /* Enable bus mastering */ + dm_pci_read_config16(dev, PCI_COMMAND, &cmd); + cmd |= PCI_COMMAND_MASTER; + dm_pci_write_config16(dev, PCI_COMMAND, cmd); base = (ulong)dm_pci_map_bar(ahci_dev, PCI_BASE_ADDRESS_5, 0, 0, PCI_REGION_TYPE, PCI_REGION_MEM); -- 2.40.0