From patchwork Wed Aug 12 20:20:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11711309 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77282618 for ; Wed, 12 Aug 2020 20:20:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DDEA206B2 for ; Wed, 12 Aug 2020 20:20:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ghoiSEhj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbgHLUUt (ORCPT ); Wed, 12 Aug 2020 16:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgHLUUt (ORCPT ); Wed, 12 Aug 2020 16:20:49 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFDAC061383; Wed, 12 Aug 2020 13:20:49 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id t10so1596915plz.10; Wed, 12 Aug 2020 13:20:49 -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=o8xWeiFcuqMpOpznRWNhlTz5KRrSm7Nj77jg3nbd+YY=; b=ghoiSEhjlNenhfjUiqEhtHT9xEiKodA/KyVdxYA+q1jzK5Kq2PalXgpwTQTOSGhr/D yPthOpYAbqrYOdERbK5IGo5vahuJujvMHQGTAtAI+ANScrfvbjZVsB/R17oxaxT/R+R3 MAQDmzDLCko8fqww5DbIOW8Le0egNGZ3hIv5vq7V2VLXYXReBUXFviOcVpC4gNCpnGKk MHl7MY0Hk2gAKtqfprMa1ic+A+JCCNdB6J8aK3i/Agi2gsK4QNIg//RMKBpZ9Xs8nfUz VKqIgW5ECgpge+5NQbe8cc7yiAS1srqRlDjeqESk9+V+Azuo4Lc6WlxFXR5Hw+DuX5FG jXAw== 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=o8xWeiFcuqMpOpznRWNhlTz5KRrSm7Nj77jg3nbd+YY=; b=H8CdRSSB4dth7D0nw5VMJa9wFobezIip3DgWi3ZWOoQR7m3lmouYaYd0eLJv9e9smW UTfuGBi61VlSL5L9wWvWPxaOubbVAndXMKCaWyZLKEqzDCJz+QgmGFxC7pbD/bv/wzJx sAMjTe4aI+EgQkFWKkxuIUDQVP2/1LFO84XYj1RKlWvmhcEKNDXOU1eDbmGZ5E3BBDQs DXujYNsA7CsHk11IUwnN1irbExVcYCCLtz3lMi4FPiEP7nDvffhWYouLRTQui7dOOB+G SLEuyzxYD2B8krYZLLYoTYm7J8uysrD3KNwmrrYYs4+9yLLtn2sqIG+joE8lqKAn964D wM+A== X-Gm-Message-State: AOAM530VzMVabWeLhlXDyPmeRjmPvsdVcLTA0fhr6e0IhyV0g9TpjibL RwBKe1elIxvnJOS5IRlVHlcbKAkK X-Google-Smtp-Source: ABdhPJwqF3Ok8rRvsRYSx70jxMSy7K7/99FFjbKgtm+2NO2ANq7B770iVO9Ft0oaXXCmzTfNn8pAww== X-Received: by 2002:a17:90a:3aa6:: with SMTP id b35mr1699627pjc.69.1597263648730; Wed, 12 Aug 2020 13:20:48 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id 75sm3292999pfx.187.2020.08.12.13.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 13:20:48 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, Florian Fainelli , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Rob Herring Subject: [PATCH 1/3] dt-bindings: Add support for Broadcom USB pin map driver Date: Wed, 12 Aug 2020 16:20:16 -0400 Message-Id: <20200812202018.49046-2-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200812202018.49046-1-alcooperx@gmail.com> References: <20200812202018.49046-1-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add DT bindings for the Broadcom USB pin map driver. This driver allows some USB input and output signals to be mapped to any GPIO instead of the normal dedicated pins to/from the XHCI controller. Signed-off-by: Al Cooper --- .../bindings/usb/brcm,usb-pinmap.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml diff --git a/Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml b/Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml new file mode 100644 index 000000000000..19cf6ad36373 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/brcm,usb-pinmap.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom USB pin map Controller Device Tree Bindings + +maintainers: + - Al Cooper + +properties: + compatible: + items: + - const: brcm,usb-pinmap + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: Must be defined if any out-gpios are specified. + + in-gpios: + description: Array of one or more GPIO pins used for input signals. + + in-names: + description: Array of input signal names, one per gpio in in-gpios. + + in-masks: + description: Array of enable and mask pairs, one per gpio in-gpios. + + out-gpios: + description: Array of one or more GPIO pins used for output signals. + + out-names: + description: Array of output signal names, one per gpio in out-gpios. + + out-masks: + description: Array of enable, value, changed and clear masks, one + per gpio in out-gpios. + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + usb_pinmap: usb-pinmap@22000d0 { + compatible = "brcm,usb-pinmap"; + reg = <0x22000d0 0x4>; + in-gpios = <&gpio 18 0>, <&gpio 19 0>; + in-names = "VBUS", "PWRFLT"; + in-masks = <0x8000 0x40000 0x10000 0x80000>; + out-gpios = <&gpio 20 0>; + out-names = "PWRON"; + out-masks = <0x20000 0x800000 0x400000 0x200000>; + interrupts = <0x0 0xb2 0x4>; + }; + +... From patchwork Wed Aug 12 20:20:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11711311 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D406A618 for ; Wed, 12 Aug 2020 20:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B022F20838 for ; Wed, 12 Aug 2020 20:20:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UlO2z448" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726698AbgHLUUz (ORCPT ); Wed, 12 Aug 2020 16:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgHLUUy (ORCPT ); Wed, 12 Aug 2020 16:20:54 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABD3AC061384; Wed, 12 Aug 2020 13:20:54 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id t6so1692822pjr.0; Wed, 12 Aug 2020 13:20:54 -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=uccu95PRXmKxZHBeQCOoazjl3urZNrqvEdVXCkGpHe4=; b=UlO2z448ApUxre6aTjn1730gZ9JPksIa9Cf559Vif7hw+EMeS8OXZsBsVQQ5WUTGeH c8FtB1Ib6TzwVjexTg3cj8hon4M1M9DZyzfZ/rFFZd+0W68nPvSUUZiSO6LIqd4S4yPu lylH8Vc9tgbYGPqRYMkiovATkSVro4TWsw2wbroNy4zxtBkdwUoSWn5Cpifa9QrCzD+4 YRupHEuEBwvgUhuvwmhk5HOmgnQm+WCNWTeogC+9P+VMCYGshcuPdBpIylwqJ7wC5Ghm uPS/PaXz2s7aXR/URKcXRa+GdSKbUfQrdCViXJaPeVehTMHmv+qwpwo9vve4gDYUng8u koZg== 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=uccu95PRXmKxZHBeQCOoazjl3urZNrqvEdVXCkGpHe4=; b=IhFknTBAkp0b095JxZvUebfEM9BWg6stZ/FZcTL0WWgssusOSV1sXl4DHEoYdQyrgO 7kWEAqKVKDtjeQ/0FfTf0w/w8/5v0URqQDSxwG148RWcNk7mTJ1NQAaKD4tyV4ynq8Zp 4UxSqmUwKt1kvp6kIRPJv18t1Q3eTNt6T3ssmqVcrW9oCBkS4M1LDBSjiP+Jej9VnXK4 bDCRMmWL1lXwMMAzkSDaSq9Hmcnoe5p1fZ1se+FThKKYjYDFxBzyheVFUBzlTk5a/gvA DeDEpWRlMV5Fe2GWBjnppr+LOL9BdUlTZnQhTNRW4dGvbHKboT0GhVWHn7y2GuKJjP6H zbCw== X-Gm-Message-State: AOAM5311GR48ils2AVHYh3dc5dsMEuevTabKnIe940qdlDgAimDM8DFl H92piFtkvRyDn5IdklSLg6l9HAxJ X-Google-Smtp-Source: ABdhPJx6kdR4K1vjHtPcM8xAr4FXB1UDfT0nL2CIGERv1NTs/z7Gk9eILZTle+t1N6++zuf20L8d/A== X-Received: by 2002:a17:902:7202:: with SMTP id ba2mr977592plb.4.1597263653859; Wed, 12 Aug 2020 13:20:53 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id 75sm3292999pfx.187.2020.08.12.13.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 13:20:53 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Al Cooper , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, Florian Fainelli , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Rob Herring Subject: [PATCH 2/3] usb: Add driver to allow any GPIO to be used for 7211 USB signals Date: Wed, 12 Aug 2020 16:20:17 -0400 Message-Id: <20200812202018.49046-3-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200812202018.49046-1-alcooperx@gmail.com> References: <20200812202018.49046-1-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Al Cooper The Broadcom 7211 has new functionality that allows some USB low speed side band signals, that go from the XHCI host controller to pins on the chip, to be remapped to use any GPIO pin instead of the limited set selectable by hardware. This can be done without changing the standard driver for the host controller. There is currently support for three USB signals, PWRON, VBUS_PRESENT and PWRFLT. This driver will allow the remapping of any of these three signals based on settings in the Device Tree node for the driver. The driver was written so that it could handle additional signals added in the future by just adding the correct properties to the DT node. Below is an example of a DT node that would remap all three signals: usb_pinmap: usb-pinmap@22000d0 { compatible = "brcm,usb-pinmap"; reg = <0x22000d0 0x4>; in-names = "VBUS", "PWRFLT"; in-gpios = <&gpio 18 0>, <&gpio 19 0>; in-masks = <0x8000 0x40000 0x10000 0x80000>; out-names = "PWRON"; out-gpios = <&gpio 20 0>; out-masks = <0x20000 0x800000 0x400000 0x200000>; interrupts = <0x0 0xb2 0x4>; }; refs #SWLINUX-5537 Signed-off-by: Al Cooper --- drivers/usb/host/brcmstb-usb-pinmap.c | 348 ++++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 drivers/usb/host/brcmstb-usb-pinmap.c diff --git a/drivers/usb/host/brcmstb-usb-pinmap.c b/drivers/usb/host/brcmstb-usb-pinmap.c new file mode 100644 index 000000000000..647373b7e53b --- /dev/null +++ b/drivers/usb/host/brcmstb-usb-pinmap.c @@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (c) 2020, Broadcom */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct out_pin { + u32 enable_mask; + u32 value_mask; + u32 changed_mask; + u32 clr_changed_mask; + struct gpio_desc *gpiod; + const char *name; +}; + +struct in_pin { + u32 enable_mask; + u32 value_mask; + struct gpio_desc *gpiod; + const char *name; + struct brcmstb_usb_pinmap_data *pdata; +}; + +struct brcmstb_usb_pinmap_data { + void __iomem *regs; + int in_count; + struct in_pin *in_pins; + int out_count; + struct out_pin *out_pins; +}; + + +static void pinmap_set(void __iomem *reg, u32 mask) +{ + u32 val; + + val = readl(reg); + val |= mask; + writel(val, reg); +} + +static void pinmap_unset(void __iomem *reg, u32 mask) +{ + u32 val; + + val = readl(reg); + val &= ~mask; + writel(val, reg); +} + +static void sync_in_pin(struct in_pin *pin) +{ + u32 val; + + val = gpiod_get_value(pin->gpiod); + if (val) + pinmap_set(pin->pdata->regs, pin->value_mask); + else + pinmap_unset(pin->pdata->regs, pin->value_mask); +} + +/* + * Interrupt from override register, propagate from override bit + * to GPIO. + */ +static irqreturn_t brcmstb_usb_pinmap_ovr_isr(int irq, void *dev_id) +{ + struct brcmstb_usb_pinmap_data *pdata = dev_id; + struct out_pin *pout; + u32 val; + u32 bit; + int x; + + pr_debug("%s: reg: 0x%x\n", __func__, readl(pdata->regs)); + pout = pdata->out_pins; + for (x = 0; x < pdata->out_count; x++) { + val = readl(pdata->regs); + if (val & pout->changed_mask) { + pinmap_set(pdata->regs, pout->clr_changed_mask); + pinmap_unset(pdata->regs, pout->clr_changed_mask); + bit = val & pout->value_mask; + gpiod_set_value(pout->gpiod, bit ? 1 : 0); + pr_debug("%s: %s bit changed state to %d\n", + __func__, pout->name, bit ? 1 : 0); + } + } + return IRQ_HANDLED; +} + +/* + * Interrupt from GPIO, propagate from GPIO to override bit. + */ +static irqreturn_t brcmstb_usb_pinmap_gpio_isr(int irq, void *dev_id) +{ + struct in_pin *pin = dev_id; + + pr_debug("%s: %s pin changed state\n", __func__, pin->name); + sync_in_pin(pin); + return IRQ_HANDLED; +} + + +static void get_pin_counts(struct device_node *dn, int *in_count, + int *out_count) +{ + int in; + int out; + + *in_count = 0; + *out_count = 0; + in = of_property_count_strings(dn, "in-names"); + if (in < 0) + return; + out = of_property_count_strings(dn, "out-names"); + if (out < 0) + return; + *in_count = in; + *out_count = out; +} + +static int parse_pins(struct device *dev, struct device_node *dn, + struct brcmstb_usb_pinmap_data *pdata) +{ + struct out_pin *pout; + struct in_pin *pin; + int index; + int res; + int x; + + pin = pdata->in_pins; + for (x = 0, index = 0; x < pdata->in_count; x++) { + pin->gpiod = devm_gpiod_get_index(dev, "in", x, GPIOD_IN); + if (IS_ERR(pin->gpiod)) { + dev_err(dev, "Error getting gpio %s\n", pin->name); + return PTR_ERR(pin->gpiod); + + } + res = of_property_read_string_index(dn, "in-names", x, + &pin->name); + if (res < 0) { + dev_err(dev, "Error getting in-names for %s\n", + pin->name); + return res; + } + res = of_property_read_u32_index(dn, "in-masks", index++, + &pin->enable_mask); + if (res < 0) { + dev_err(dev, "Error getting first in-masks for %s\n", + pin->name); + return res; + } + res = of_property_read_u32_index(dn, "in-masks", index++, + &pin->value_mask); + if (res < 0) { + dev_err(dev, "Error getting second in-masks for %s\n", + pin->name); + return res; + } + pin->pdata = pdata; + pin++; + } + pout = pdata->out_pins; + for (x = 0, index = 0; x < pdata->out_count; x++) { + pout->gpiod = devm_gpiod_get_index(dev, "out", x, + GPIOD_OUT_HIGH); + if (IS_ERR(pout->gpiod)) { + dev_err(dev, "Error getting gpio %s\n", pin->name); + return PTR_ERR(pout->gpiod); + } + res = of_property_read_string_index(dn, "out-names", x, + &pout->name); + if (res < 0) { + dev_err(dev, "Error getting out-names for %s\n", + pout->name); + return res; + } + res = of_property_read_u32_index(dn, "out-masks", index++, + &pout->enable_mask); + if (res < 0) { + dev_err(dev, "Error getting first out-masks for %s\n", + pout->name); + return res; + } + res = of_property_read_u32_index(dn, "out-masks", index++, + &pout->value_mask); + if (res < 0) { + dev_err(dev, "Error getting second out-masks for %s\n", + pout->name); + return res; + } + res = of_property_read_u32_index(dn, "out-masks", index++, + &pout->changed_mask); + if (res < 0) { + dev_err(dev, "Error getting third out-masks for %s\n", + pout->name); + return res; + } + res = of_property_read_u32_index(dn, "out-masks", index++, + &pout->clr_changed_mask); + if (res < 0) { + dev_err(dev, "Error getting fourth out-masks for %s\n", + pout->name); + return res; + } + pout++; + } + return 0; +} + +void sync_all_pins(struct brcmstb_usb_pinmap_data *pdata) +{ + struct out_pin *pout; + struct in_pin *pin; + int val; + int x; + + /* + * Enable the override, clear any changed condition and + * propagate the state to the GPIO for all out pins. + */ + pout = pdata->out_pins; + for (x = 0; x < pdata->out_count; x++) { + pinmap_set(pdata->regs, pout->enable_mask); + pinmap_set(pdata->regs, pout->clr_changed_mask); + pinmap_unset(pdata->regs, pout->clr_changed_mask); + val = readl(pdata->regs) & pout->value_mask; + gpiod_set_value(pout->gpiod, val ? 1 : 0); + pout++; + } + + /* sync and enable all in pins. */ + pin = pdata->in_pins; + for (x = 0; x < pdata->in_count; x++) { + sync_in_pin(pin); + pinmap_set(pdata->regs, pin->enable_mask); + pin++; + } +} + +static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev) +{ + struct device_node *dn = pdev->dev.of_node; + struct brcmstb_usb_pinmap_data *pdata; + struct in_pin *pin; + struct resource *r; + int out_count; + int in_count; + int err; + int irq; + int x; + + get_pin_counts(dn, &in_count, &out_count); + if ((in_count + out_count) == 0) + return -EINVAL; + + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + + pdata = devm_kzalloc(&pdev->dev, + sizeof(*pdata) + + (sizeof(struct in_pin) * in_count) + + (sizeof(struct out_pin) * out_count), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdata->in_count = in_count; + pdata->out_count = out_count; + pdata->in_pins = (struct in_pin *)(pdata + 1); + pdata->out_pins = (struct out_pin *)(pdata->in_pins + in_count); + + pdata->regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); + if (IS_ERR(pdata->regs)) + return PTR_ERR(pdata->regs); + platform_set_drvdata(pdev, pdata); + + err = parse_pins(&pdev->dev, dn, pdata); + if (err) + return err; + + sync_all_pins(pdata); + + if (out_count) { + + /* Enable interrupt for out pins */ + irq = platform_get_irq(pdev, 0); + err = devm_request_irq(&pdev->dev, irq, + brcmstb_usb_pinmap_ovr_isr, + IRQF_TRIGGER_RISING, + pdev->name, pdata); + if (err < 0) { + dev_err(&pdev->dev, "Error requesting IRQ\n"); + return err; + } + } + + for (x = 0, pin = pdata->in_pins; x < pdata->in_count; x++, pin++) { + irq = gpiod_to_irq(pin->gpiod); + if (irq < 0) { + dev_err(&pdev->dev, "Error getting IRQ for %s pin\n", + pin->name); + return irq; + } + err = devm_request_irq(&pdev->dev, irq, + brcmstb_usb_pinmap_gpio_isr, + IRQF_SHARED | IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING, + pdev->name, pin); + if (err < 0) { + dev_err(&pdev->dev, "Error requesting IRQ for %s pin\n", + pin->name); + return err; + } + } + + dev_info(&pdev->dev, "Driver probe succeeded\n"); + dev_dbg(&pdev->dev, "In pin count: %d, out pin count: %d\n", + pdata->in_count, pdata->out_count); + return 0; +} + + +static const struct of_device_id brcmstb_usb_pinmap_of_match[] = { + { .compatible = "brcm,usb-pinmap" }, + { }, +}; + +static struct platform_driver brcmstb_usb_pinmap_driver = { + .driver = { + .name = "brcm-usb-pinmap", + .of_match_table = brcmstb_usb_pinmap_of_match, + }, +}; + +static int __init brcmstb_usb_pinmap_init(void) +{ + return platform_driver_probe(&brcmstb_usb_pinmap_driver, + brcmstb_usb_pinmap_probe); +} + +module_init(brcmstb_usb_pinmap_init); From patchwork Wed Aug 12 20:20:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 11711313 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E70E113B1 for ; Wed, 12 Aug 2020 20:21:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD97C20838 for ; Wed, 12 Aug 2020 20:21:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VoCPqFd+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726756AbgHLUVB (ORCPT ); Wed, 12 Aug 2020 16:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgHLUVA (ORCPT ); Wed, 12 Aug 2020 16:21:00 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E62FDC061383; Wed, 12 Aug 2020 13:20:59 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id m71so1597404pfd.1; Wed, 12 Aug 2020 13:20:59 -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=ZlYqHVX3AGBBK6l8zlqS+306syUnx3hCohlnRD0iMkM=; b=VoCPqFd+gsMxkaXdfyJpRc+EGaq7h9IdHKHP0UqWqYRVaj2o8TbQLuOd9xfTfR2owP 5IkYrInzMX6pXYMsBVviiI+fTrOsUvGGhACeEFZaoiwPB8tnp9NWEq/5NsSHG8CMTtEe VVg/xILtjqdLbYXzEpjvawEHEQb/Ra/tLmhPvOamu7THENoobjlOvW2a43IKlsooY3Y7 IMyVBJ2kgYA3IvaH90Oygg100mq03hdWfdOYdxe/DXQXN0xnSlDVVvDcMncgzONGi7jo rVc9eFvB+iioePiYMLOTXit6GSCr07dYX4WpUTifNOrp7xNsMMWkP09N4hfH0eHv33+W 9n/g== 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=ZlYqHVX3AGBBK6l8zlqS+306syUnx3hCohlnRD0iMkM=; b=jGAAJYn1kNOhqrzxd4ZQgk2PANAruR4eZts12WuHsbcI70ZfD44AItW2gKQbh4fOIM tN4G/XjF+KpOktKwCzhNTelePvlD/fBkSVc7gIcyg4f5NbD4pt2IVxs3F/10W+eI1bwO b/Q2L3mGAXmji1MTq+xmeZWdMyRbtGRLq6dGWa3dVqkp0F63G00+kR5lbXoF9RRuNxyL zyip6fF5d4/KwsCS9fA7AI4EaWuTHamGJH1G7XAp+/6gWvxhasZNqH3rc6fgBzgoEMVc WoM39spfsclcusL1sb0rD/u0vsXU7ffwO730Ws1hZ8KJr5mArbIPKouLzqSEfJuSInlT DL9w== X-Gm-Message-State: AOAM530RJlIOm0ATpFPy9S6dyPLLeiCkRdj3YKJ9ZvTez+dKx7jTHhcM Oc9HuFeC5FFRkPk+qgkU96yPa9Ap X-Google-Smtp-Source: ABdhPJxsfwcRaPxZjqTkOGUv/RiRbejbFGQa6SjbnNeOG9mjx+3XSgYAZ/9yDtcr1D/1pubSFz7z8w== X-Received: by 2002:aa7:92d7:: with SMTP id k23mr1057102pfa.295.1597263658793; Wed, 12 Aug 2020 13:20:58 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id 75sm3292999pfx.187.2020.08.12.13.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 13:20:58 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Al Cooper , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, Florian Fainelli , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, Rob Herring Subject: [PATCH 3/3] usb: Add Kconfig and Makefile changes to build brcmstb-usb-pinmap Date: Wed, 12 Aug 2020 16:20:18 -0400 Message-Id: <20200812202018.49046-4-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200812202018.49046-1-alcooperx@gmail.com> References: <20200812202018.49046-1-alcooperx@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Al Cooper Add Kconfig and Makefile changes to build brcmstb-usb-pinmap and update MAINTAINERS for the new driver. refs #SWLINUX-5537 Signed-off-by: Al Cooper Reported-by: kernel test robot Reported-by: kernel test robot --- MAINTAINERS | 8 ++++++++ drivers/usb/host/Kconfig | 4 ++++ drivers/usb/host/Makefile | 1 + 3 files changed, 13 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f0569cf304ca..3a44ac61899b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3527,6 +3527,14 @@ S: Maintained F: Documentation/devicetree/bindings/usb/brcm,bcm7445-ehci.yaml F: drivers/usb/host/ehci-brcm.* +BROADCOM BRCMSTB USB PIN MAP DRIVER +M: Al Cooper +L: linux-usb@vger.kernel.org +L: bcm-kernel-feedback-list@broadcom.com +S: Maintained +F: Documentation/devicetree/bindings/usb/brcm,usb-pinmap.yaml +F: drivers/usb/host/brcmstb-usb-pinmap.c + BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER M: Al Cooper L: linux-kernel@vger.kernel.org diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1cb3004ea7b2..9c285053bb0c 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -109,12 +109,16 @@ endif # USB_XHCI_HCD config USB_EHCI_BRCMSTB tristate +config BRCM_USB_PINMAP + tristate + config USB_BRCMSTB tristate "Broadcom STB USB support" depends on (ARCH_BRCMSTB && PHY_BRCM_USB) || COMPILE_TEST select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD select USB_EHCI_BRCMSTB if USB_EHCI_HCD select USB_XHCI_PLATFORM if USB_XHCI_HCD + select BRCM_USB_PINMAP help Enables support for XHCI, EHCI and OHCI host controllers found in Broadcom STB SoC's. diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index bc731332fed9..0e63ef94790d 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -90,3 +90,4 @@ obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o obj-$(CONFIG_USB_FOTG210_HCD) += fotg210-hcd.o obj-$(CONFIG_USB_MAX3421_HCD) += max3421-hcd.o +obj-$(CONFIG_BRCM_USB_PINMAP) += brcmstb-usb-pinmap.o