From patchwork Mon Jun 25 14:25:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10486371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 096196023A for ; Mon, 25 Jun 2018 14:25:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB49F2859E for ; Mon, 25 Jun 2018 14:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF784285BE; Mon, 25 Jun 2018 14:24:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6F3285A4 for ; Mon, 25 Jun 2018 14:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754938AbeFYOY6 (ORCPT ); Mon, 25 Jun 2018 10:24:58 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44484 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbeFYOY5 (ORCPT ); Mon, 25 Jun 2018 10:24:57 -0400 Received: by mail-qt0-f195.google.com with SMTP id 92-v6so7618235qta.11 for ; Mon, 25 Jun 2018 07:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=m508WLjAeVch6LvGksWD+6P9bYCGKtvEbnoXmDoR7W4=; b=Dm4iDf63cS4p84OS2a2O4BxPOVUq+mJKRki4PBM4XblGO0/bR9bob1cVEJFlnPMPcV XO8ZFQFhpmL96uY/7tebnM/9ogogajJKQyeMbCiNliKbjRMYOVengFmUqsHtPTDwMI5H x3QSHjVJuCu+KMGcbFKZUOjdP/z7p9yOLSUeZVWuo4nEA4/YtmtDA9pmiJ3t+9MCBBK3 T44XlV5/TBZuipErCPJu1A7l22ztyFKu2jcdD/znbbe54TyFsFsyOoanib2z9TQ5W5w3 eTGx6UxKG5kCnfLjtLR/h5nYIjsWrZTOBCuQ13FnrzPwEYsRcBKj1BNE15rzb7fJUKS0 vB+w== 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; bh=m508WLjAeVch6LvGksWD+6P9bYCGKtvEbnoXmDoR7W4=; b=Hfhfckx33TVHSD7S98izYYnbi3mlKLGXK++MHDl6lpZAvMMUmic0ZbqdoQ/H68J/Lf SmWEXK4k082LNXvKhLTftHepIV9ar1BH7oNWqTLB2ujdNmLRwrSyBacIXDYCLofi8dmx jM7svt6s2dEF/fpXopGvUmsrh2p+JPkHes7pBT9v7DjpJRRXxjwzurFEzardaXdOGtUx pe14QsiVPJyfb9WA0iOC425/4HHuInCXQZHHOXXbl7JI/2rJXJLuHBGfGiJGZPMfEJxS 3gVhMuLGC7DikgzLf21mJlBdehJwuirWsB9R8R46HGoww1Pwn52erVGpDgTBcvS1UXQr 3Shw== X-Gm-Message-State: APt69E09QfldfqtBgcKPgmsLs2chjZSJzOGXCMFovsxG7OcTdSkbiPYd wQn0V0Hg6YPoVi0+AyDzy/M= X-Google-Smtp-Source: AAOMgpcOY8JQkvD+pZxzRZQYCxUcuVeOaMXQz3T7gyP+d/OBqMVFxvKpd5hiVdm7j+pAbXYPpyo0Kg== X-Received: by 2002:ac8:1a57:: with SMTP id q23-v6mr11336341qtk.297.1529936696824; Mon, 25 Jun 2018 07:24:56 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:583:d5b4:c4a:2129:e7d1]) by smtp.gmail.com with ESMTPSA id f9-v6sm9403397qkb.43.2018.06.25.07.24.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jun 2018 07:24:56 -0700 (PDT) From: Fabio Estevam To: Peter.Chen@nxp.com Cc: linux-usb@vger.kernel.org, andrew.smirnov@gmail.com, l.stach@pengutronix.de, sebastian.reichel@collabora.co.uk, shawnguo@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, Fabio Estevam Subject: [PATCH v2] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected Date: Mon, 25 Jun 2018 11:25:12 -0300 Message-Id: <1529936712-13081-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Since commit 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") the kernel hangs on a imx51-babbage board, when using the ULPI interface with the CONFIG_USB_CHIPIDEA_ULPI option unselected. Instead of hanging the kernel, let's warn the user that CONFIG_USB_CHIPIDEA_ULPI needs to be selected, propagate an error and continue with booting the kernel. The user can then react to the warning and select CONFIG_USB_CHIPIDEA_ULPI as needed. Fixes: 03e6275ae381087bd8 ("usb: chipidea: Fix ULPI on imx51") Suggested-by: Lucas Stach Signed-off-by: Fabio Estevam Tested-by: Andrey Smirnov --- Changes since v1: - Only propagate the error when CONFIG_USB_CHIPIDEA_ULPI is unselected drivers/usb/chipidea/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 85fc6db..e7018a1 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -608,6 +608,17 @@ static int ci_get_platdata(struct device *dev, if (!platdata->phy_mode) platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); + if (platdata->phy_mode == USBPHY_INTERFACE_MODE_ULPI) { + /* + * CONFIG_USB_CHIPIDEA_ULPI needs to be selected + * for proper usage of the ULPI mode + */ + if (!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)) { + WARN_ONCE(1, "Select CONFIG_USB_CHIPIDEA_ULPI in order to use ULPI mode\n"); + return -EINVAL; + } + } + if (!platdata->dr_mode) platdata->dr_mode = usb_get_dr_mode(dev);