Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1888340pxj; Fri, 18 Jun 2021 19:24:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDHhLMmRSmGW49mZ9Ugmrr5aTl2RSiej98mQrISPrnvfbG6Drd3Qf3KAFKtQETGsOQ9J1H X-Received: by 2002:a5d:8184:: with SMTP id u4mr10018885ion.96.1624069456094; Fri, 18 Jun 2021 19:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624069456; cv=none; d=google.com; s=arc-20160816; b=cnKIit/H8iT7lT8amyw5YUVGnOkTKX+s7a2G1REu6rpOAnozvRF3hOQ68qYAAtNGy0 RWu+8UrToxcjNR+q9mg5X/cSthTf862g/9SiUcfmhsXIXJaKUfVEOKz+KZl6qCGF8B5P lD8p22ZXiqs4CIY5QS/AWUJDK7Adyy73vzJE4r5z9YW0FXRZ7RMkk/FgTbO+f7MGAtmd nZzXjVSSul/0Ah5Wl96+OFfYBTVHb0R/anhZl3nv/6SOk1lXnKfUYuVClUwR7RRufPoV sMyAffTYY7URh4uN1pGPeMYC0MU5KbZ7lUCruaTfKQ1dTlsCoxtcHSTkq6U/xPq+w9+x uesA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6QTjBFDFCa5wxgzXV7/ZQNMNegFSSiirJH3DOi2Mowg=; b=Clcfog9bxrbuY2xrqQr+yHxSIRcaMrEgzGZG3rGg/Ry22Q0He/fpJMob5JFUG1XblZ WCEh1T8+gl++mkziQDrEwfwTQxg7hLFMV45+iQ3rPXOshHJ5iH+d4F7wTg1/F1TnTaJr XK7FMjL+KcZGNtHV2iFbODoUjxy8AsNo7z3GZkEmHrJs1klE6S+rLPBxk/sClfHSBQ3G L2IV01iJbkxV7jARVhEoHeef5++sXZbmXvnjWYZ8qWuaOqI8j/WYhEYJWD2Yia9gchAT pcwOKTZU/KUcUYUAh6vzgWVyt8uat6CQh1QF+HQymPQdt8UH7ODFMlkZ2+UIlBKIE+YA H6+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=U4p6NUo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f39si6199641jav.78.2021.06.18.19.24.03; Fri, 18 Jun 2021 19:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=U4p6NUo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231630AbhFRUD5 (ORCPT + 99 others); Fri, 18 Jun 2021 16:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbhFRUD4 (ORCPT ); Fri, 18 Jun 2021 16:03:56 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26147C061574 for ; Fri, 18 Jun 2021 13:01:46 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id w21so10169081edv.3 for ; Fri, 18 Jun 2021 13:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6QTjBFDFCa5wxgzXV7/ZQNMNegFSSiirJH3DOi2Mowg=; b=U4p6NUo6NxmDTnbo2R00GUSqOPKE+qjZt8Klk6p9jMVaMwcujnDAhKDocwfnPzjfJa 7g7w/VxyBj/G+S2lqjPNd6lGwHp+FU2Y5YP4kz3a1mSzGjEodtZYT0xRNXqcrcl0Yfbh 4DIUFApCND6+hnkPtPI4EX3/vYFjEr9GZqkub0TOYThSX2LFzdV1N/Z2jWVwxZRff5KA CsLl3WMtOMbXaUpK4GcJAr0ade4BluXa7DFCladX8l9jkgHBncxIm0YbcCQbfN1EBXZL HOBjx9yl9ur6YHWnH+V4yYyeIY0kzAKwZ8bLmxcUQ5Gbp9KDiwLdv7YlVywxo0jogVlQ PpPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6QTjBFDFCa5wxgzXV7/ZQNMNegFSSiirJH3DOi2Mowg=; b=r2ApAgIcaPe3yFyegFGDWy5fDssUHFUWptgGOqjkRNJiuQ8Gg+hp/9aAgSUkil8VwQ SQOx3czBYdieX/AiM8jeH3Wy/HBrK15UfETdBlr03QLmrsFyUGBK/xeF0JjntJU6KfVx 8BXJUt88Rg/HGVotvaVTudSqqgIwxs2XfX8HtFh8gLTNWqZ91Un4rl0QnktM8fyOALvP 8rOKxDBGs+x+LWmSp7B/JvuPtRFA9u9bKsPnu68PeGFirr1cGrAat/IjKq+piL8o7RrF LyJcu9l/eX4jQ3TRBJ90XEevdblWIHmKXQv3UIycvLWhPoxzvBkCn38ZQA9UXEhUwxvc 2C7A== X-Gm-Message-State: AOAM533Kjxuhi252JfBcGMkdwd8YIVqVGwmxquWwFXwZRsKwCVAP9qDQ H5550NvQhFlNzq+XOimk3n/57idTgjzdbkKKAr8= X-Received: by 2002:a05:6402:3581:: with SMTP id y1mr7253865edc.143.1624046504688; Fri, 18 Jun 2021 13:01:44 -0700 (PDT) MIME-Version: 1.0 References: <20210617194154.2397-1-linux.amoon@gmail.com> <20210617194154.2397-5-linux.amoon@gmail.com> In-Reply-To: From: Martin Blumenstingl Date: Fri, 18 Jun 2021 22:01:33 +0200 Message-ID: Subject: Re: [RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function To: Anand Moon Cc: Kishon Vijay Abraham I , Vinod Koul , Neil Armstrong , Kevin Hilman , Jerome Brunet , Philipp Zabel , linux-phy@lists.infradead.org, linux-arm-kernel , linux-amlogic@lists.infradead.org, Linux Kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anand, On Fri, Jun 18, 2021 at 3:19 PM Anand Moon wrote: [...] > > I suggest dropping this patch until we know for sure if and which > > registers need to be updated based on the DR mode. > > Yes, I have observed this, Can you give these small changes a try? > With the below changes, I got the PHY_MODE_USB_DEVICE support working. first of all: sorry that I have not linked my source of information previously: - Meson8b: [0] - Meson8 and Meson8m2: [1] Unfortunately I don't have any datasheet or "better documentation" of how the registers should be programmed. This is why I am a bit defensive when I am asked to change something there - as I simply have no way of knowing if the changes are good or not. I can only tell whether they're "identical" or "different" from what the vendor kernel does. [...] > + case PHY_MODE_USB_DEVICE: > + case PHY_MODE_USB_OTG: > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_DCD_ENABLE, > + REG_ADP_BC_DCD_ENABLE); > + > + udelay(ACA_ENABLE_COMPLETE_TIME); > + > + regmap_read(priv->regmap, REG_ADP_BC, ®); > + if (reg & REG_ADP_BC_ACA_PIN_FLOAT) { > + dev_warn(&phy->dev, "USB ID detect failed!\n"); > + return -EINVAL; > + } > + regmap_update_bits(priv->regmap, REG_ADP_BC, > + REG_ADP_BC_ID_PULLUP, REG_ADP_BC_ID_PULLUP); > + break; According to the vendor kernel this should only be applied to "host-only" USB_PORT_IDX_B (which is usb1 in the mainline .dtsi). Based on that I think it's not correct to apply this for DEVICE and OTG modes. The vendor kernel does not configure REG_ADP_BC_ID_PULLUP anywhere. Also DCD_ENABLE is only ever set to 0 (while you are enabling it now), see [2]. As mentioned before: all I can say about this patch is that it programs the registers differently than the vendor kernel does. From your description I am not sure if you are now getting different behavior on Odroid-C1 with this patch (compared to what we had before). Best regards, Martin [0] https://github.com/endlessm/linux-meson/blob/03393bb8e8478626e03ee93b0a2a225d6de242b5/arch/arm/mach-meson8b/usbclock.c#L120 [1] https://github.com/endlessm/linux-meson/blob/03393bb8e8478626e03ee93b0a2a225d6de242b5/arch/arm/mach-meson8/usbclock.c#L120 [2] https://github.com/endlessm/linux-meson/blob/d6e13c220931110fe676ede6da69fc61a7cb04b6/drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd.c#L71