From patchwork Mon Jan 27 05:06:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1229551 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FJQ+56vP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 485dLH4Qc9z9sR1 for ; Mon, 27 Jan 2020 16:17:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D0AF8188C; Mon, 27 Jan 2020 06:12:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FJQ+56vP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 644B9817BC; Mon, 27 Jan 2020 06:09:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (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 C4FC2817F3 for ; Mon, 27 Jan 2020 06:09:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id f16so6422240ilk.11 for ; Sun, 26 Jan 2020 21:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I/eyt7Bx4cg+jKjej8A2D52sMetWlx/QUgG6UxF56E4=; b=FJQ+56vPkc6wD08FCYA3EXddvv25HH4p42PL2BIqs9jnfFnZrdv/AD2DVK5HSfCBtm bCLeNO1McALmft5+UGL+9MpEFocjCk9JdKFYCfR3YajcQvnAXaE5nl703oHx/WhtRVR1 ASYuc6c/fzyphKhPP7uJAfJqW4D2RuTaKUycc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I/eyt7Bx4cg+jKjej8A2D52sMetWlx/QUgG6UxF56E4=; b=Ths5lqp4RJTYnXpZ40Xz8yxrJoW0DEq/KwFooW+t2BKkZ+z1VveHPQtr/bNT2qYJBP I3oO6bQT1sHm7647QFsxRqFhj+ts6geJp7Ve6xwSGI3C5gqY5OxudqOaV397pB7ebgrr 2VKXDlVEoeppBEfQ5daEWoNo4KxeHZGHt58klLzJRmLYZR//oUxiZ5xpc4iGhcq6Jnnj 1AJO1YO/gYqOe+Xrey6LMaleRVxTxoyYUqWSjlA/9STp30xVVMDcNRqPS9lQB17WoJT/ lgfnvLGmjw6P9IwyRRJpD3HGn1to/KNUmoplkFyYtDF5Jq5DwIxn1JDxk5S9QGjR2qO1 VCrw== X-Gm-Message-State: APjAAAX1CRvJPElEUrvoEuWdp+3vR25bZ5zfkqUpcRT2pqFviUB6ymLs cvkiBdvZLHF/hb+HKKwSVWvMwrzHTu6iTQ== X-Google-Smtp-Source: APXvYqxR6GwKviga0Z0Pfsd/bJPjAyaEyecAFdINx2+kdbT4UudGe3wwNYo7GQv+bNG6KHtVprT7Vg== X-Received: by 2002:a92:860f:: with SMTP id g15mr13196532ild.297.1580101746216; Sun, 26 Jan 2020 21:09:06 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id h23sm4313195ilf.57.2020.01.26.21.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2020 21:09:05 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Subject: [PATCH 053/108] dm: core: Add a way of overriding the ACPI device path Date: Sun, 26 Jan 2020 22:06:00 -0700 Message-Id: <20200126220508.53.I05c1764b12b8c4770c5a0aa9d149c551f9a8fe70@changeid> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200127050655.170614-1-sjg@chromium.org> References: <20200127050655.170614-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Herrmann Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean Some devices such as GPIO need to override the normal path that would be generated by driver model. Add a device-tree property for this. Signed-off-by: Simon Glass --- doc/device-tree-bindings/device.txt | 23 +++++++++++++++++++++++ drivers/core/acpi.c | 19 +++++++++++++++++++ include/dm/acpi.h | 13 +++++++++++++ 3 files changed, 55 insertions(+) diff --git a/doc/device-tree-bindings/device.txt b/doc/device-tree-bindings/device.txt index 61ebd7a942..107b17589c 100644 --- a/doc/device-tree-bindings/device.txt +++ b/doc/device-tree-bindings/device.txt @@ -16,6 +16,8 @@ U-Boot provides for some optional properties which are documented here. - acpi,hid : Contains the string to use as the HID (Human Interface Device) identifier _HID - acpi,hid-desc-reg-offset : HID register offset (for Human Interface Devices) + - acpi,path : Specifies the full ACPI path for a device. This overrides the + normal path built from the driver-model hierarchy - acpi,probed : Tells U-Boot to add 'linux,probed' to the ACPI tables so that Linux will not re-init the device - acpi,name : Provides the ACPI name for a device, which is a string consisting @@ -48,3 +50,24 @@ pcie-a0@14,0 { interrupts-extended = <&acpi_gpe 0x3c 0>; }; }; + +p2sb: p2sb@d,0 { + u-boot,dm-pre-reloc; + reg = <0x02006810 0 0 0 0>; + compatible = "intel,apl-p2sb"; + early-regs = ; + pci,no-autoconfig; + + n { + compatible = "intel,apl-pinctrl"; + u-boot,dm-pre-reloc; + intel,p2sb-port-id = ; + acpi,path = "\\_SB.GPO0"; + gpio_n: gpio-n { + compatible = "intel,gpio"; + u-boot,dm-pre-reloc; + gpio-controller; + #gpio-cells = <2>; + linux-name = "INT3452:00"; + }; + }; diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c index 762cc40511..65c1fed132 100644 --- a/drivers/core/acpi.c +++ b/drivers/core/acpi.c @@ -68,6 +68,25 @@ int acpi_get_name(const struct udevice *dev, char *out_name) return 0; } +int acpi_get_path(const struct udevice *dev, char *out_path, int maxlen) +{ + const char *path; + int ret; + + path = dev_read_string(dev, "acpi,path"); + if (path) { + if (strlen(path) >= maxlen) + return -E2BIG; + strcpy(out_path, path); + return 0; + } + ret = acpi_device_path(dev, out_path, maxlen); + if (ret) + return log_msg_ret("dev", ret); + + return 0; +} + /** * acpi_add_item() - Add a new item to the list of data collected * diff --git a/include/dm/acpi.h b/include/dm/acpi.h index ea3a615f60..2b4e8d7e87 100644 --- a/include/dm/acpi.h +++ b/include/dm/acpi.h @@ -172,6 +172,19 @@ int acpi_inject_dsdt(struct acpi_ctx *ctx); */ void acpi_dump_items(bool dump_contents); +/** + * acpi_get_path() - Get the full ACPI path for a device + * + * This checks for any override in the device tree and calls acpi_device_path() + * if not + * + * @dev: Device to check + * @out_path: Buffer to place the path in (should be ACPI_PATH_MAX long) + * @maxlen: Size of buffer (typically ACPI_PATH_MAX) + * @return 0 if OK, -ve on error + */ +int acpi_get_path(const struct udevice *dev, char *out_path, int maxlen); + #endif /* __ACPI__ */ #endif