From patchwork Wed Oct 17 22:29:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 10646137 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E18E1508 for ; Wed, 17 Oct 2018 22:30:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3A77285A2 for ; Wed, 17 Oct 2018 22:30:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7809286E6; Wed, 17 Oct 2018 22:30:33 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 817C2285A2 for ; Wed, 17 Oct 2018 22:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727602AbeJRG2A (ORCPT ); Thu, 18 Oct 2018 02:28:00 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38391 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726644AbeJRG17 (ORCPT ); Thu, 18 Oct 2018 02:27:59 -0400 Received: by mail-pl1-f194.google.com with SMTP id q19-v6so10283416pll.5; Wed, 17 Oct 2018 15:30:13 -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:in-reply-to:references; bh=G/avwaNHR2AwcRj8BPEvkwQlcWjIT4+gT2UzKciw+Gs=; b=CWyzRpfh3in0HjrziB0WF7IfjdlJgWDIGi+EUIzlUQ5rizDgb+wrJHZwZfzLV6vIED TQ3t3+7UJmQP5QMG+Ojnfb7mXfmNfRG5CzlpQw0Zz/wqB48Xw8kKnibEuO1NfbCY0OCR qHwEvETYqrwqJnFaFvlGHQE9OQB9HxzeaAA24ev6898PIAxup+K6kYe2Zguy1WZjhcoB Hagv1b0tFTcZq6Z6ejh6CMI641COCrty4+y4hTYnXuENCoTGkW8VRIGsKhdxYTRYtXaW IOLw/sCaA+wHAXmtlH2OO0LbRdtQ27pEeucNX3o0zhCjhxvmY97mvuAuZ/ZZ+F3gn/CV Zg6w== 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; bh=G/avwaNHR2AwcRj8BPEvkwQlcWjIT4+gT2UzKciw+Gs=; b=KtOXQ7ApBUQKKWWX/2hNl69CvN16QutxyM8Q+jLnuMfW7CkOeeRDbZJCgxnKz/ne8t xb3tTS9pT4tNVVBVhhuJFRqLadBrG5mD+THCxJ5X4XE4z9IEyWZXKSV1HOJExVSR1NrU vGXn+oDUzfwnPJxik9Mz6kyyZpyEKTUN7+/YHWhYQlOtDs0SJQaEB+S45Z/hE7oienKn Crsvn/0nb246KCFXc8SuidZR0ScWlRvJ/mwus6RzAb7a8Eb9MLhjVZCIGJG9ll6mP7K0 5wrEbweYxjBZx6ainQ0NPGD72xVbDNKAJJafQK45nW15f9hu8UP3Qq+JkLogvqF6tWh+ S2lw== X-Gm-Message-State: ABuFfohUClRqjF6DdwjKE7Tvgk/avXQANGv5GanbS7Z3SDshB2OlEvO/ Mhg95BOGvH2BACAssJl+gekpcrw3bL0= X-Google-Smtp-Source: ACcGV61u664iHvXBUIUDQl+1OeNUaT2iFmeRT/rORzqrQNU3WiktxvC+jRi0xHnKsBMmSkvt0e5+sg== X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr19008508plp.282.1539815413047; Wed, 17 Oct 2018 15:30:13 -0700 (PDT) Received: from stbsrv-and-3.and.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id p3-v6sm352597pgl.2.2018.10.17.15.30.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:30:12 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Alan Stern , Alban Bedel , Alex Elder , Andrew Morton , Arnd Bergmann , Avi Fishman , bcm-kernel-feedback-list@broadcom.com, Bjorn Andersson , Chunfeng Yun , "David S. Miller" , devicetree@vger.kernel.org, Dmitry Osipenko , Greg Kroah-Hartman , "Gustavo A. R. Silva" , Hans de Goede , James Hogan , Jianguo Sun , Johan Hovold , Kees Cook , linux-usb@vger.kernel.org, Lu Baolu , Mark Rutland , Martin Blumenstingl , Mathias Nyman , Mathias Nyman , Mauro Carvalho Chehab , Rishabh Bhatnagar , Rob Herring , Roger Quadros Subject: [PATCH V2 4/6] usb: ohci-platform: Add support for Broadcom STB SoC's Date: Wed, 17 Oct 2018 18:29:07 -0400 Message-Id: <1539815349-24126-5-git-send-email-alcooperx@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1539815349-24126-1-git-send-email-alcooperx@gmail.com> References: <1539815349-24126-1-git-send-email-alcooperx@gmail.com> 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 Add support for Broadcom STB SoC's to the ohci platform driver. Signed-off-by: Al Cooper --- drivers/usb/host/ohci-platform.c | 35 +++++++++++++++++++++++++++++------ include/linux/usb/ohci_pdriver.h | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 65a1c3fdc88c..363d6fa676a5 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -99,12 +100,24 @@ static int ohci_platform_probe(struct platform_device *dev) if (usb_disabled()) return -ENODEV; - /* - * Use reasonable defaults so platforms don't have to provide these - * with DT probing on ARM. - */ - if (!pdata) - pdata = &ohci_platform_defaults; + if (!pdata) { + const struct usb_ohci_pdata *match_pdata; + + match_pdata = of_device_get_match_data(&dev->dev); + if (match_pdata) { + pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), + GFP_KERNEL); + if (!pdata) + return -ENOMEM; + *pdata = *match_pdata; + } else { + /* + * Use reasonable defaults so platforms don't have + * to provide these with DT probing on ARM. + */ + pdata = &ohci_platform_defaults; + } + } err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32)); if (err) @@ -177,6 +190,8 @@ static int ohci_platform_probe(struct platform_device *dev) ohci->flags |= OHCI_QUIRK_FRAME_NO; if (pdata->num_ports) ohci->num_ports = pdata->num_ports; + if (pdata->suspend_without_phy_exit) + hcd->suspend_without_phy_exit = 1; #ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO if (ohci->flags & OHCI_QUIRK_BE_MMIO) { @@ -305,10 +320,18 @@ static int ohci_platform_resume(struct device *dev) } #endif /* CONFIG_PM_SLEEP */ +static const struct usb_ohci_pdata ohci_plat_brcm_bcm7445_ohci = { + .power_on = ohci_platform_power_on, + .power_suspend = ohci_platform_power_off, + .power_off = ohci_platform_power_off, + .suspend_without_phy_exit = 1, +}; + static const struct of_device_id ohci_platform_ids[] = { { .compatible = "generic-ohci", }, { .compatible = "cavium,octeon-6335-ohci", }, { .compatible = "ti,ohci-omap3", }, + { .compatible = "brcm,bcm7445-ohci", &ohci_plat_brcm_bcm7445_ohci}, { } }; MODULE_DEVICE_TABLE(of, ohci_platform_ids); diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h index 7eb16cf587ee..16b24ea1e3bb 100644 --- a/include/linux/usb/ohci_pdriver.h +++ b/include/linux/usb/ohci_pdriver.h @@ -35,6 +35,7 @@ struct usb_ohci_pdata { unsigned big_endian_desc:1; unsigned big_endian_mmio:1; unsigned no_big_frame_no:1; + unsigned suspend_without_phy_exit:1; unsigned int num_ports; /* Turn on all power and clocks */