From patchwork Mon Jun 25 14:06:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10486321 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 8251C60230 for ; Mon, 25 Jun 2018 14:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D7CB2847A for ; Mon, 25 Jun 2018 14:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61D7A2849B; Mon, 25 Jun 2018 14:06:48 +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 01BBE2847A for ; Mon, 25 Jun 2018 14:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934175AbeFYOGp (ORCPT ); Mon, 25 Jun 2018 10:06:45 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:38770 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934154AbeFYOGo (ORCPT ); Mon, 25 Jun 2018 10:06:44 -0400 Received: by mail-qk0-f194.google.com with SMTP id y4-v6so7534353qka.5 for ; Mon, 25 Jun 2018 07:06:44 -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=njOZNZPuEV/xnC3RIW4przbqJyNZVnIgGxgd9ZvzKTo=; b=Sp9njXEMq8a9r4B2mzuTzE/498cl+brXK/8bTfgYJqgms4IpAL6I/rWnlF6sMlp0IE Hspz75YSFPLM8mgdsT4LgMTYf90PAObegGqT7liqK90cWMbmpTbmdUKuPLDu/VNvhcQQ 52zvKJ2++6mWEmoDM4AuM+oSW1a/kguenEwXjNm6blkeyZCaLV1e2NunWIlk7lX64Bax vbpuUX7mcO1El5ig/GA7MpYK0uzjRI/o2BaTuYrSNQamjWTaEL05NzVYRc5go67Wv3Ku allR4KZSiQ/K+BgeSNLLVoEhcZBd862xG5B1UoLG55PHP0FZXPJP5Sc+56650cUpEBb/ 4MCg== 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=njOZNZPuEV/xnC3RIW4przbqJyNZVnIgGxgd9ZvzKTo=; b=lFs8c/n1HJCVh9WCwxZOkXIR1MLM3nkohHAfE4oP1qt1DFA0aDlR6I1JclMe0WHfxY 5FN+QVqNOgUsXFIzRBUJYndY734YzVuRVG9gPVmA5LAmQHs5VXUrDW3ionio/IE0cIPb pY2ZoEjAV4MhPsw7iVA8ucc1CJW1x4T5havfxOdiUFfAmFuMe0npMbuq4FIR5ArwE4Rn rzc0+8FmGB7rsuGnu+eNMimZ4krnBHzF83lWS7l9YswONcGmI8fKy2qVCI1tUJiYs+Ev nId6/x4x1BOknKOHTg7cri/WHpoIM5vUpJDZdr8m8gUhBq2X08b1DDZ6TtNg4S7UBNwi BnWg== X-Gm-Message-State: APt69E1CSOflO+pwbeZ74j7xCVZT5qESCMsQeuNr2Pfeg+5/86PUynsU 65g6sGJzw/mBCc7TGFMkYQg= X-Google-Smtp-Source: AAOMgpdYbMBHRZ6TgqWs0uK7qCSzKotA+b1Nlt786RCOY2YvWXxwGcgAD6EHulnjFobnzneFkPLNGg== X-Received: by 2002:a37:7486:: with SMTP id p128-v6mr10855728qkc.335.1529935603888; Mon, 25 Jun 2018 07:06:43 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:583:d5b4:c4a:2129:e7d1]) by smtp.gmail.com with ESMTPSA id t17-v6sm3432807qth.10.2018.06.25.07.06.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jun 2018 07:06:43 -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] USB: chipidea: Do not hang when CONFIG_USB_CHIPIDEA_ULPI is not selected Date: Mon, 25 Jun 2018 11:06:19 -0300 Message-Id: <1529935579-30845-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 --- drivers/usb/chipidea/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 85fc6db..5ab9db1 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -608,6 +608,16 @@ 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 + */ + WARN_ONCE(!IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI), + "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);