From patchwork Thu Apr 8 03:21:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 417384 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp164848jai; Wed, 7 Apr 2021 20:22:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj4TMfQp0EoaY1GXCz/iydOB2EGaMW9bN8UT1QDpe0gwjGPnxHrOT3UACQ2d7V8HsvweHN X-Received: by 2002:a17:90a:e2d8:: with SMTP id fr24mr6363389pjb.3.1617852129621; Wed, 07 Apr 2021 20:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617852129; cv=none; d=google.com; s=arc-20160816; b=xDNO1mkIMkhuDLQJPWfdOSx1WoWD40VvBfMB7GZHbTV0+rSGUHLcLwZ4e4DfsQPRlu 03OZqcNcyDOy16a1sakT+IQe5u3rpsjmG3Wo4TIJUcxDOwR6SKfs4rR2HRMbd9tFn8K7 h1n4X/XOpbFfTjiNb8/3jlSJg+hNggjJ64If3k7OiF09cODEhkWEb6kKev1ynzILfyxU xa6FBbxQ3UfLoLY5i8b4kkO4c7QL8FH/C3sm7ZYTbuwT/2ffzhGM9SLpRtiphEa/h7lK xAXk8vpGNc8eLNZkWKxbCbQ/vN1cOW7qRyoBPyXebcMHgBY2qbNAdzw+406j4Qdpy0Qv StHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=B6cOju1rQQneOVQ82poMl4pqSX0MJ8sxEWStAd4p3gM=; b=CwaIS8xvDNo+t6pmbRf/3ff+i3Gu8Thel/gQlnG2CEDnoECe4prb4WcYDrh0OLlmwc ScrFLzF+rTkoNMIntmAQwpjWnXRi46ABdEEHgJgt4Xz0YSJE/ITXPDHIOH6IMYjUnan5 gxCze8MH6Ftucga4lYVyOgZWZzW+PCjy00YJ8bSnhMICuVFsWrkCzPQl+AJ1mIQj3cj4 pfHwOmqCcu8DSYIkRWLcG266AlIkCs+vRC6+/ho4QCLeW3zvflrE96qyMQzlGcPvlGSY A6+HvpP7sDKCTAx7ELPGAnVELZ+kUL/b++QfnV6l+GKYwFn3ZPzLqZNLaWmRrFl0TbUS Ve2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si26276263plr.185.2021.04.07.20.22.09; Wed, 07 Apr 2021 20:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbhDHDWS (ORCPT + 3 others); Wed, 7 Apr 2021 23:22:18 -0400 Received: from foss.arm.com ([217.140.110.172]:38316 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhDHDWR (ORCPT ); Wed, 7 Apr 2021 23:22:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ABD6A1063; Wed, 7 Apr 2021 20:22:05 -0700 (PDT) Received: from u200856.usa.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 634A03F792; Wed, 7 Apr 2021 20:22:05 -0700 (PDT) From: jlinton To: linux-usb@vger.kernel.org Cc: gregkh@linuxfoundation.org, hminas@synopsys.com, linux-kernel@vger.kernel.org, Jeremy Linton Subject: [PATCH] usb: dwc2: Enable RPi in ACPI mode Date: Wed, 7 Apr 2021 22:21:56 -0500 Message-Id: <20210408032156.5732-1-jeremy.linton@arm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Jeremy Linton The dwc2 driver has everything we need to run in ACPI mode except for the ACPI module device table boilerplate. With that added and identified as "BCM2848", an id in use by other OSs for this device, the dw2 controller on the BCM2711 will work. Signed-off-by: Jeremy Linton --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/params.c | 14 ++++++++++++++ drivers/usb/dwc2/platform.c | 1 + 3 files changed, 17 insertions(+) -- 2.26.2 Reported-by: kernel test robot Reported-by: kernel test robot diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 7161344c6522..defc6034af49 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -38,6 +38,7 @@ #ifndef __DWC2_CORE_H__ #define __DWC2_CORE_H__ +#include #include #include #include @@ -1339,6 +1340,7 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev); /* The device ID match table */ extern const struct of_device_id dwc2_of_match_table[]; +extern const struct acpi_device_id dwc2_acpi_match[]; int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg); int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg); diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 92df3d620f7d..127878a0a397 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -232,6 +232,12 @@ const struct of_device_id dwc2_of_match_table[] = { }; MODULE_DEVICE_TABLE(of, dwc2_of_match_table); +const struct acpi_device_id dwc2_acpi_match[] = { + { "BCM2848", dwc2_set_bcm_params }, + { }, +}; +MODULE_DEVICE_TABLE(acpi, dwc2_acpi_match); + static void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg) { u8 val; @@ -878,6 +884,14 @@ int dwc2_init_params(struct dwc2_hsotg *hsotg) if (match && match->data) { set_params = match->data; set_params(hsotg); + } else { + struct acpi_device_id *amatch; + + amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev); + if (amatch && amatch->driver_data) { + set_params = amatch->driver_data; + set_params(hsotg); + } } dwc2_check_params(hsotg); diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 5f18acac7406..53fc6bc3ed1a 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -734,6 +734,7 @@ static struct platform_driver dwc2_platform_driver = { .driver = { .name = dwc2_driver_name, .of_match_table = dwc2_of_match_table, + .acpi_match_table = ACPI_PTR(dwc2_acpi_match), .pm = &dwc2_dev_pm_ops, }, .probe = dwc2_driver_probe,