From patchwork Mon Oct 17 05:30:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 3208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1288349wrs; Sun, 16 Oct 2022 22:55:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45nvr0YL/ofx0HSBkDNqO54iZBiCyXSrgCIDHIsaf2b185X32CiBphHbXZHmFMXyIACzzp X-Received: by 2002:a63:7:0:b0:45b:693e:7d86 with SMTP id 7-20020a630007000000b0045b693e7d86mr9420033pga.319.1665986150875; Sun, 16 Oct 2022 22:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665986150; cv=none; d=google.com; s=arc-20160816; b=pjV65Xd3PQZYlt+Eq01YNT1heO9fGVtPqW9jvQpmP7Ms9cYfMSkjg/09UYhgtJqCUc weT9G/ACcnpa1kDnxnICvrCcomaTA8ZG9XKzO0bS+sDQV1PK9HOaLZEeciWWqwc8AReU W8MkbrXvsKA6U7u/lUbGtrx0A0kdQe0cPk6+M8yTs1XGPcyCc6C6oVvaECV+faB0iMeS i5UuDkpv6h9wLTCFvrVwMWvwMrpQ4SrHWo5PN2oG/eJWohc5QaN2FcGVIRcA6sRyRWLC pak2jDgvJ9y/Yp6BsrXBfM8Q961k0PE2YqDfKqxXLiQ4fDgb6wvM0VjRzoVZdWFh6Wsc P3vw== 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:sender:dkim-signature; bh=JRRV+BVnZSRzFh23m9ZCERUTYJbzBZ4kBt9Yb5nHkGQ=; b=Xw8dCTvO/jm+hUnikS5taXJXp4BQeav2wAWAsD9pk5trPhfSJM/NUm1lyb+89rRlMH Y08bAXUxugVhupKHlAF/Fum0+KIijrO9ufwBdwA0ZdrbpbNQ3HHx9fKpIG6T1BFv/5zb 6axnsTfPD83mJibHKyug7YLcthtf0cY9m1PVu4fPrcT6cO03PGuTNbuOxE6Cto9WMMhX JVML4LGLfrhJQC7P96wZH9uk3NKFjX3ZZbHN3k9FF1drve41Md5RsFNJOoPc7uVim/fz O+SEjxGrn6kJXF43N7QjOkXJlyYZ6NVL+a4iU2B0Xda1gDTPT2LjpbmzS4tnOH7AFYcb eMjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aFndi2mI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902eb9200b00178b7f8c5c5si10181422plg.598.2022.10.16.22.55.35; Sun, 16 Oct 2022 22:55:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aFndi2mI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbiJQFah (ORCPT + 99 others); Mon, 17 Oct 2022 01:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiJQFad (ORCPT ); Mon, 17 Oct 2022 01:30:33 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0337447B8E; Sun, 16 Oct 2022 22:30:31 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id t12-20020a17090a3b4c00b0020b04251529so9951590pjf.5; Sun, 16 Oct 2022 22:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=JRRV+BVnZSRzFh23m9ZCERUTYJbzBZ4kBt9Yb5nHkGQ=; b=aFndi2mIhdZkE4m6cZPPdm89z0CtfyCl/DJKoR1uBHdpOWdqUcEgD1ETr10JW4oy0D ksZJfpKquRnT6YQOjS8GOf3iTKNAlcbbw5jrBTbADNBfNCeYdRDKfkEbNxxk8gLLxikz 8FMLUKjz8NOXk06NSTCutG8CGH1VRQmkopOZcBhMG2tnCIwv8GRpKcs7E224pVlBsynC MjTI4fPHg5DHxjCdvAmNP2Q45bonGJh245nYeWCZMjOBSU9UMuWey4DmiG3Ko2t9aJzu ocBjWJtcm7+E92qAsdd9umVR7S/Z7D5QfQuwiH+rA5BF5ZHPwXssP9tJAIzxDfu6wq7z CEnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JRRV+BVnZSRzFh23m9ZCERUTYJbzBZ4kBt9Yb5nHkGQ=; b=OOXdAfTT2zl2ctkVNacSwIFUZa6O4qMOBCo+HhqaGmhSMAMllOikQdZrnNbohLel3h X3jZDA+VYi/lkOVCvVnVyfLfQoXK5Vp3geM6a4s4nTI4R1QoJGzyBXDMvs0xjJh9UyGC 6FX+8OEbjFA2lK16e+DH9jIaKtqtF2jcP7SkUPqGrH11aMdoCxInYIQwQ504xUipg/qe t9M4it0S8d82lhYNhpiaLdxuJYtIexbWctbkJmHFSl7/jVED3KKifkJj9nzPLpr2Kv7Q pzHjrkK7xRTFvWiRnruzLM5oSARrOHbCzEQ7ypBIGliGJhl8wM0mmLfs/Ahe08NGpAg2 C4dQ== X-Gm-Message-State: ACrzQf3ZI0pxWMP1VLRyX10ONk+u4H+ibpRWTNOEM3hcXQEkAcPl7H43 OA7cBWl41Luj7ii6Z179JUA= X-Received: by 2002:a17:90b:4b88:b0:20d:2935:7053 with SMTP id lr8-20020a17090b4b8800b0020d29357053mr11660718pjb.153.1665984630198; Sun, 16 Oct 2022 22:30:30 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.18]) by smtp.gmail.com with ESMTPSA id h15-20020a170902680f00b001728d7c831asm5596122plk.142.2022.10.16.22.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Oct 2022 22:30:29 -0700 (PDT) Sender: "joel.stan@gmail.com" From: Joel Stanley To: Felipe Balbi , Greg Kroah-Hartman , Alan Stern , Benjamin Herrenschmidt Cc: Andrew Jeffery , linux-usb@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, Zev Weiss , Jae Hyun Yoo , stable@vger.kernel.org Subject: [PATCH] usb: gadget: aspeed: Fix probe regression Date: Mon, 17 Oct 2022 16:00:06 +1030 Message-Id: <20221017053006.358520-1-joel@jms.id.au> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746913093759066940?= X-GMAIL-MSGID: =?utf-8?q?1746913093759066940?= Since commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets"), the gadget devices are proper driver core devices, which caused each device to request pinmux settings: aspeed_vhub 1e6a0000.usb-vhub: Initialized virtual hub in USB2 mode aspeed-g5-pinctrl 1e6e2080.pinctrl: pin A7 already requested by 1e6a0000.usb-vhub; cannot claim for gadget.0 aspeed-g5-pinctrl 1e6e2080.pinctrl: pin-232 (gadget.0) status -22 aspeed-g5-pinctrl 1e6e2080.pinctrl: could not request pin 232 (A7) from group USB2AD on device aspeed-g5-pinctrl g_mass_storage gadget.0: Error applying setting, reverse things back The vhub driver has already claimed the pins, so prevent the gadgets from requesting them too by setting the magic of_node_reused flag. This causes the driver core to skip the mux request. Reported-by: Zev Weiss Reported-by: Jae Hyun Yoo Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets") Cc: stable@vger.kernel.org Signed-off-by: Joel Stanley Tested-by: Zev Weiss Tested-by: Jae Hyun Yoo --- drivers/usb/gadget/udc/aspeed-vhub/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c index b0dfca43fbdc..4f3bc27c1c62 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c @@ -591,6 +591,7 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx) d->gadget.max_speed = USB_SPEED_HIGH; d->gadget.speed = USB_SPEED_UNKNOWN; d->gadget.dev.of_node = vhub->pdev->dev.of_node; + d->gadget.dev.of_node_reused = true; rc = usb_add_gadget_udc(d->port_dev, &d->gadget); if (rc != 0)