Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2895434yba; Mon, 15 Apr 2019 23:41:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwftHdyaLRXZ2lPYYhJV6GY+7NF5DFlyF/QXLZpdsqvbxvlANowrSZgmLQCj7EZ8UMPGGoI X-Received: by 2002:aa7:8019:: with SMTP id j25mr27804226pfi.77.1555396912791; Mon, 15 Apr 2019 23:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555396912; cv=none; d=google.com; s=arc-20160816; b=ms1rzlOxYvVirwZkHWO/KYvsemxVNMGIxq/CQNr8x1vc02y1ZwK7uAOxjq6yMq19j4 Sb13L0QzUl1U0hSNOSkjP1FudlDbPZ0O8DvPdo7PoqWFCfHBCvi4B54dcMvBdmXdWA0M ul2gehmbzCjHWgYyCIaYRW7DbJarq3LODiLrqNmUhbX6chvBqYv2ZNWcvhxAXkvNV2TM y6JwMfhaJEhd/oxyaiLdY5b7ipExlnEnK90iujYuHmpD2+NnTEpdc7jo+NxVNV3AG0Vb PehOxsIH+9YxPhkQrSNbL5ASA3UevUJrsLFG+H2eOwvz6qmfB2KTttsRdyjqDTx+5zsy yc5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Y12wtRTJuSbEPR5lb9GmFnRdg9vbLn7fLjey2XBuK6o=; b=uDurc1RG5o+vJrX9nyuRJ2Uk7CqfNHSkRbzdnxKUQ8rj8/uCMX9y5WkwQOR2BceVN4 Z5ZvO0TupYEf0r1xZpDBuCTbiNShyQYKEXH5191wwkzqiS0hK3rhrlcm3Vs7IO+8xFPA vsEkOkzarh0v84RSbCDFVyR6peYgqdtSNfbC7aozqjq8LhaIZmWuh2ELYgIVzWsLlYgx 7K5AMlu8rSrL9jx4ko9n14pNjdjXfrF5ByBeObemLcgnPQ5sysSqf1nc8Yqr++a8Npwc /IrARuPXHVC+JjyOXJ8mLMSLGjv58Eo5X/Q0BpzuPasmO+urvYtdCIXAe8OO/9Qh+3Ui pVZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t70si28786172pgd.386.2019.04.15.23.41.37; Mon, 15 Apr 2019 23:41:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728540AbfDPGkf (ORCPT + 99 others); Tue, 16 Apr 2019 02:40:35 -0400 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:33970 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727130AbfDPGk3 (ORCPT ); Tue, 16 Apr 2019 02:40:29 -0400 Received: by wens.csie.org (Postfix, from userid 1000) id 84CFD5FB5E; Tue, 16 Apr 2019 14:40:25 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Sebastian Reichel Cc: Chen-Yu Tsai , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH v4 0/7] ARM: sun8i: a83t: Enable USB OTG Date: Tue, 16 Apr 2019 14:40:17 +0800 Message-Id: <20190416064024.20414-1-wens@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai Hi everyone, This is v4 of my A83T USB power supply / OTG series. Hopefully this is the last revision even though it's kind of late in the -rc cycle for the patches to make the next release. Fingers crossed. Changes since v3: - Dropped patch for disabling current limit - Dropped mfd patch as it is already merged Changes since v2: - Added Rob's ack for dt bindings patch - Rebased onto v5.1-rc1 Changes since v1: - Added Lee's ack for mfd patch - Make axp803_usb_power_supply_resources[] const This series has since been tested. Both host mode and gadget mode work well. However this SoC seems to have a glitch in hardware. After host mode is used by plugging in a host mode cable, the hardware will not revert back to gadget mode if a standard USB cable is plugged in. Host mode continues to work however. This will likely have to be addressed with some workaround in either the musb driver or our USB PHY driver. The patches have no cross-tree dependencies, so each part can go through their respective trees (power-supply / arm-soc). I also have some follow-up patches to enable the USB power supply on AXP803 / A64. It's the boiler-plate mfd cell and device node addition. Original cover letter follows: This series enables USB OTG on the A83T boards. The AXP813/AXP818 PMICs used with the A83T have the same behavior as the AXP221 and AXP223, where if the N_VBUSEN pin is driven high, the VBUS sensing interrupts stop working. In the past Hans made a polling workaround in the USB PHY driver. In this series polling is added to the power supply driver. The power supply driver work was started by Quentin, and shared with me when I expressed interest in getting USB OTG to work some time ago. Neither of us got around to finishing it, until now that is. Patch 1 adds a new compatible string for the AXP813 VBUS power supply part. Patch 2 is a bit of cleanup work for the driver. Patch 3 allows disabling VBUS input current limiting on the AXP20x / AXP22x PMICs. While not strictly related to this series, I found it easier to just send everything together. This patch depends on the previous one. Patch 4 adds the VBUS status polling feature. This is enabled on AXP221 and all later PMICs. Patch 5 factors out code to read out the configured input current limit for the AXP20x and AXP22x PMICs. As the AXP813 uses different values, factoring out the code based on model will make the main function more readable. Patch 6 adds support for the AXP813 VBUS power supply. checkpatch.pl reports a few warnings for this patch: WARNING: Possible switch case/default not preceded by break or fallthrough comment #100: FILE: drivers/power/supply/axp20x_usb_power.c:306: + case 1500000: WARNING: Possible switch case/default not preceded by break or fallthrough comment #101: FILE: drivers/power/supply/axp20x_usb_power.c:307: + case 2000000: WARNING: Possible switch case/default not preceded by break or fallthrough comment #102: FILE: drivers/power/supply/axp20x_usb_power.c:308: + case 2500000: However they seem to be a false positive. The preceding line of the reported lines is a return statement, which is definitely not a fallthrough. Patch 7 adds an mfd cell for the newly supported VBUS power supply. Patch 8 adds a device node for the VBUS power supply to the common axp81x dtsi file. Patch 9 enables USB OTG on the Cubietruck Plus and Bananapi M3. Please have a look, and also test it on boards you have, and don't limit it to just the A83T ones. As mentioned above, the polling feature affects all boards that have an AXP221 or newer PMIC. I haven't removed the polling workaround from the USB PHY driver yet. That would be the next step after this series is merged, and preferrably a release has passed. Regards ChenYu Chen-Yu Tsai (4): dt-bindings: power: supply: axp20x_usb_power: add axp813 compatible power: supply: axp20x_usb_power: Fix typo in VBUS current limit macros power: supply: axp20x_usb_power: use polling to detect vbus status change ARM: dts: sun8i: a83t: Enable USB OTG controller on some boards Quentin Schulz (3): power: supply: axp20x_usb_power: add function to get max current power: supply: axp20x_usb_power: add support for AXP813 ARM: dtsi: axp81x: add USB power supply node .../power/supply/axp20x_usb_power.txt | 1 + arch/arm/boot/dts/axp81x.dtsi | 4 + arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts | 12 ++ .../boot/dts/sun8i-a83t-cubietruck-plus.dts | 12 ++ drivers/power/supply/axp20x_usb_power.c | 179 +++++++++++++++--- 5 files changed, 181 insertions(+), 27 deletions(-) -- 2.20.1