From patchwork Sun Nov 29 20:17:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 549800 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id EFA2C1401E7 for ; Mon, 30 Nov 2015 07:19:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=dcrk1wnd; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6186A4B7BA; Sun, 29 Nov 2015 21:19:17 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KQa62UGO3oVh; Sun, 29 Nov 2015 21:19:17 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DF7764B7DD; Sun, 29 Nov 2015 21:18:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D7E964B765 for ; Sun, 29 Nov 2015 21:18:31 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gdmgv88Wbipt for ; Sun, 29 Nov 2015 21:18:31 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by theia.denx.de (Postfix) with ESMTPS id 1B2DF4B746 for ; Sun, 29 Nov 2015 21:18:27 +0100 (CET) Received: by obdgf3 with SMTP id gf3so114013826obd.3 for ; Sun, 29 Nov 2015 12:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BvvuGlWwQLCQRGiMVwMUzDwPcbWj8fXQb8gHEjU8y3k=; b=dcrk1wndk2HdiGMpzQ/b27ry/DjT5UN4EXr2ZwrmOzUbqB1QPz4g8JLZNjHW5XgrkI DaowxaWliNVAAPxZOJh7CLoBJcrINqjRAgJ2LG19ldqBGkJbZJShgGTe4xpw9e8JqpZs B+2FVp/1WP5OkkTXrfZBwsBKhC8ZsCH+GPzCHftPvI9BFXIpqaxjaatM2W+UgWlgfB+z AdvXxwgj0ArrcqceOJ8G1O1A4dYkQE+OiL9E2UDZd3fDWCQS+JYIBvIV+/4pJCyVajPS aiIGPqXoroWnwcl/37pcmTd7UIR2QPQtMqKBzUcd6qLnm5yQ6DE1HkyFJ5A/vG7sw8PM lCfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BvvuGlWwQLCQRGiMVwMUzDwPcbWj8fXQb8gHEjU8y3k=; b=UX7U/VN1nhuVC9Q0HdL88Nb6Cg8mgVfAi+DvryAvVFczCy6E22sKWZSvcj3o+EPViq GRVm0HSgAcN1D4i8JiX+NA2VS2g8K/C4AcMmI8aLSwYuTXMz5+QuzVyll0SJi/dP6iwQ CikJx9dbyeCw1GHo+KDcOCUyJMcNZGBRqt8XacIfO3UU/P+pD1yLTYxGv6590q5qZmjO J2YT/2BpHfHVrkGrjNBdlRuqubf7sWlicJWmnb6neQekKRFZnqJ9vFV0yInnhOrRdupl MVNBswS2dTte6p5oG0aRr99t9wcuTMQvN5hXTpbGbn2NdFJDEZWWGbDKH5/B6B9a63TV GUjQ== X-Gm-Message-State: ALoCoQn/dQf87tmNQqH6eeDlQGNsQbHLPw96jC16bQhABR+aZSKobJN8x/XIsnxU4CSSCbB0cAe3 X-Received: by 10.60.65.170 with SMTP id y10mr26383100oes.36.1448828306309; Sun, 29 Nov 2015 12:18:26 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:db0:6c41:dcb6:f2ad]) by smtp.gmail.com with ESMTPSA id p3sm19831362oei.9.2015.11.29.12.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Nov 2015 12:18:23 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 7085A2218C1; Sun, 29 Nov 2015 13:18:21 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sun, 29 Nov 2015 13:17:55 -0700 Message-Id: <1448828291-12660-11-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1448828291-12660-1-git-send-email-sjg@chromium.org> References: <1448828291-12660-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ Subject: [U-Boot] [PATCH v2 10/26] dm: x86: ivybridge: Convert graphics init to use DM PCI API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use the driver-model PCI functions here where possible. For now we have to search for the device with pci_bus_find_bdf() but at some point we can put this in a proper driver and avoid this. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v2: - Use pci_bus_find_bdf() arch/x86/cpu/ivybridge/bd82x6x.c | 6 ++++-- arch/x86/cpu/ivybridge/gma.c | 15 +++++++-------- arch/x86/include/asm/arch-ivybridge/bd82x6x.h | 3 +-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c index 3e7a907..434dfd6 100644 --- a/arch/x86/cpu/ivybridge/bd82x6x.c +++ b/arch/x86/cpu/ivybridge/bd82x6x.c @@ -86,8 +86,10 @@ static int bd82x6x_probe(struct udevice *dev) debug("%s: Cannot find GMA node\n", __func__); return -EINVAL; } - ret = gma_func0_init(PCH_VIDEO_DEV, pci_bus_to_hose(0), blob, - gma_node); + ret = dm_pci_bus_find_bdf(PCH_VIDEO_DEV, &dev); + if (ret) + return ret; + ret = gma_func0_init(dev, blob, gma_node); if (ret) return ret; diff --git a/arch/x86/cpu/ivybridge/gma.c b/arch/x86/cpu/ivybridge/gma.c index 89d4a5e..695578b 100644 --- a/arch/x86/cpu/ivybridge/gma.c +++ b/arch/x86/cpu/ivybridge/gma.c @@ -728,8 +728,7 @@ static int int15_handler(void) return res; } -int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, - const void *blob, int node) +int gma_func0_init(struct udevice *dev, const void *blob, int node) { #ifdef CONFIG_VIDEO ulong start; @@ -740,16 +739,16 @@ int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, int ret; /* IGD needs to be Bus Master */ - reg32 = x86_pci_read_config32(dev, PCI_COMMAND); + dm_pci_read_config32(dev, PCI_COMMAND, ®32); reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; - x86_pci_write_config32(dev, PCI_COMMAND, reg32); + dm_pci_write_config32(dev, PCI_COMMAND, reg32); /* Use write-combining for the graphics memory, 256MB */ - base = pci_read_bar32(hose, dev, 2); + base = dm_pci_read_bar32(dev, 2); mtrr_add_request(MTRR_TYPE_WRCOMB, base, 256 << 20); mtrr_commit(true); - gtt_bar = (void *)pci_read_bar32(pci_bus_to_hose(0), dev, 0); + gtt_bar = (void *)dm_pci_read_bar32(dev, 0); debug("GT bar %p\n", gtt_bar); ret = gma_pm_init_pre_vbios(gtt_bar); if (ret) @@ -757,8 +756,8 @@ int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, #ifdef CONFIG_VIDEO start = get_timer(0); - ret = pci_run_vga_bios(dev, int15_handler, PCI_ROM_USE_NATIVE | - PCI_ROM_ALLOW_FALLBACK); + ret = pci_run_vga_bios(dm_pci_get_bdf(dev), int15_handler, + PCI_ROM_USE_NATIVE | PCI_ROM_ALLOW_FALLBACK); debug("BIOS ran in %lums\n", get_timer(start)); #endif /* Post VBIOS init */ diff --git a/arch/x86/include/asm/arch-ivybridge/bd82x6x.h b/arch/x86/include/asm/arch-ivybridge/bd82x6x.h index 7786493..fcdf6e2 100644 --- a/arch/x86/include/asm/arch-ivybridge/bd82x6x.h +++ b/arch/x86/include/asm/arch-ivybridge/bd82x6x.h @@ -12,8 +12,7 @@ void bd82x6x_sata_enable(pci_dev_t dev, const void *blob, int node); void bd82x6x_pci_init(pci_dev_t dev); void bd82x6x_usb_ehci_init(pci_dev_t dev); void bd82x6x_usb_xhci_init(pci_dev_t dev); -int gma_func0_init(pci_dev_t dev, struct pci_controller *hose, - const void *blob, int node); +int gma_func0_init(struct udevice *dev, const void *blob, int node); int bd82x6x_init(void); /**