From patchwork Wed May 23 07:42:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: huang lin X-Patchwork-Id: 10420475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4EE960327 for ; Wed, 23 May 2018 07:43:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5BF428DB5 for ; Wed, 23 May 2018 07:43:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA44328DC9; Wed, 23 May 2018 07:43:30 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 369F828DB5 for ; Wed, 23 May 2018 07:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TdlMMp7KJNWKw8ZxuQ5HpynCTcaJcIMopjymyWZCO3s=; b=YEucVMQ7pr1WEJ7Z+qtSTNinNS /qwDfkk2wOhzsvUWYTIox1QBUrf9wB/e9A6oqLENCYfcTKXxP2dMvItA7ZvQdYVpww4ZF4U/1T2EM P6zxsIkVakkMfI5Vas2cszodNfBLt3x2bTo0MUJ5U1k9WfmzPje9Bf6IhJ3y3cuuRbCgn3a/Ps+Ea Asr2vJovhuBEDrG7NR/4G1yq4B6Opcm/zQt9R8UZljxTtYDvMt2X7LHlJRlJEywmYMDR5QrMrXcHm s2+v3dO1J56OD/4+8dIEU4Jry1ld094A1ruEKpcKtO2KHZLTMUs+WAxrRkWFbIE2QODdn+PeN6/6B Fujtpo+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLOQf-0007Hw-Tp; Wed, 23 May 2018 07:43:25 +0000 Received: from mail-pl0-f68.google.com ([209.85.160.68]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLOQE-0006xb-6W; Wed, 23 May 2018 07:43:05 +0000 Received: by mail-pl0-f68.google.com with SMTP id c41-v6so12489737plj.10; Wed, 23 May 2018 00:42:52 -0700 (PDT) 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=RJDD/KiVTbAn074SEhusjzoQ5wQtVYlsqeRMtdcpues=; b=WHIDek9D9OfEluGSLUh8G4eXYBGSjHcC8N6o8co1ju+jtvvR6+7Beoi2KBI4TXx59U TEay8BD1Vo4+jZPI3lMFOr11vHGFuRbDFU3HhDOWMZ2GXfpR6Al7NOLUwit2KcvbeKnr +RF2P2H0kYn45I/I3dQRjBizHu9blf9fhFv6omYE+64kP7qfvjvadeP/1foaqtot2Oad ck5x9rNnqql1j2QhKeswfp/6Py+/z6KjFFPT8tVcV+dW2zbTm01BfDAjhX/GHAOBnL3Z 93J3UoZO9wJF/oF0xtPEuLws3h7JhHVI6wqZbRGzmOyuyIXEEFPIyxPo5iG9AcKkqycA nl2g== X-Gm-Message-State: ALKqPwc/hTgxHN3zKHBlmIm/Ax03YzXC/3F6hMRZ1VLQe/iyLNy3WXLe k0qu8UtoLyh8gx3p82PVMh8= X-Google-Smtp-Source: AB8JxZrrxxDyzBuWw8wl3fpZeP2T/cKQsrZQ0Jljzc/xQl1dsKYa8v/+i6SAFZpk/RwmpcUAuLn0tw== X-Received: by 2002:a17:902:a702:: with SMTP id w2-v6mr1841289plq.8.1527061372068; Wed, 23 May 2018 00:42:52 -0700 (PDT) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id j74-v6sm41139540pfk.25.2018.05.23.00.42.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 May 2018 00:42:51 -0700 (PDT) From: Lin Huang To: seanpaul@chromium.org, airlied@linux.ie, zyw@rock-chips.com, kishon@ti.com Subject: [PATCH v7 3/5] soc: rockchip: split rockchip_typec_phy struct to separate header Date: Wed, 23 May 2018 15:42:31 +0800 Message-Id: <1527061353-16902-3-git-send-email-hl@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527061353-16902-1-git-send-email-hl@rock-chips.com> References: <1527061353-16902-1-git-send-email-hl@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180523_004258_269835_E5294A82 X-CRM114-Status: GOOD ( 15.30 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, heiko@sntech.de, eballetbo@gmail.com, briannorris@chromium.org, dianders@chromium.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, robh+dt@kernel.org, daniel.vetter@intel.com, linux-arm-kernel@lists.infradead.org, Lin Huang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP we may use rockchip_phy_typec struct in other driver, so split it to separate header. Signed-off-by: Lin Huang Reviewed-by: Enric Balletbo i Serra --- Changes in v2: - None Changes in v3: - None Changes in v4: - None Changes in v5: - None Changes in v6: - new patch here Changes in v7: - move new element to next patch drivers/phy/rockchip/phy-rockchip-typec.c | 47 +------------------------- include/soc/rockchip/rockchip_phy_typec.h | 55 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 46 deletions(-) create mode 100644 include/soc/rockchip/rockchip_phy_typec.h diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 76a4b58..795055f 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -63,6 +63,7 @@ #include #include +#include #define CMN_SSM_BANDGAP (0x21 << 2) #define CMN_SSM_BIAS (0x22 << 2) @@ -349,52 +350,6 @@ #define MODE_DFP_USB BIT(1) #define MODE_DFP_DP BIT(2) -struct usb3phy_reg { - u32 offset; - u32 enable_bit; - u32 write_enable; -}; - -/** - * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. - * @reg: the base address for usb3-phy config. - * @typec_conn_dir: the register of type-c connector direction. - * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. - * @external_psm: the register of type-c phy external psm clock. - * @pipe_status: the register of type-c phy pipe status. - * @usb3_host_disable: the register of type-c usb3 host disable. - * @usb3_host_port: the register of type-c usb3 host port. - * @uphy_dp_sel: the register of type-c phy DP select control. - */ -struct rockchip_usb3phy_port_cfg { - unsigned int reg; - struct usb3phy_reg typec_conn_dir; - struct usb3phy_reg usb3tousb2_en; - struct usb3phy_reg external_psm; - struct usb3phy_reg pipe_status; - struct usb3phy_reg usb3_host_disable; - struct usb3phy_reg usb3_host_port; - struct usb3phy_reg uphy_dp_sel; -}; - -struct rockchip_typec_phy { - struct device *dev; - void __iomem *base; - struct extcon_dev *extcon; - struct regmap *grf_regs; - struct clk *clk_core; - struct clk *clk_ref; - struct reset_control *uphy_rst; - struct reset_control *pipe_rst; - struct reset_control *tcphy_rst; - const struct rockchip_usb3phy_port_cfg *port_cfgs; - /* mutex to protect access to individual PHYs */ - struct mutex lock; - - bool flip; - u8 mode; -}; - struct phy_reg { u16 value; u32 addr; diff --git a/include/soc/rockchip/rockchip_phy_typec.h b/include/soc/rockchip/rockchip_phy_typec.h new file mode 100644 index 0000000..4afe039 --- /dev/null +++ b/include/soc/rockchip/rockchip_phy_typec.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd + * Author: Lin Huang + */ + +#ifndef __SOC_ROCKCHIP_PHY_TYPEC_H +#define __SOC_ROCKCHIP_PHY_TYPEC_H + +struct usb3phy_reg { + u32 offset; + u32 enable_bit; + u32 write_enable; +}; + +/** + * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. + * @reg: the base address for usb3-phy config. + * @typec_conn_dir: the register of type-c connector direction. + * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. + * @external_psm: the register of type-c phy external psm clock. + * @pipe_status: the register of type-c phy pipe status. + * @usb3_host_disable: the register of type-c usb3 host disable. + * @usb3_host_port: the register of type-c usb3 host port. + * @uphy_dp_sel: the register of type-c phy DP select control. + */ +struct rockchip_usb3phy_port_cfg { + unsigned int reg; + struct usb3phy_reg typec_conn_dir; + struct usb3phy_reg usb3tousb2_en; + struct usb3phy_reg external_psm; + struct usb3phy_reg pipe_status; + struct usb3phy_reg usb3_host_disable; + struct usb3phy_reg usb3_host_port; + struct usb3phy_reg uphy_dp_sel; +}; + +struct rockchip_typec_phy { + struct device *dev; + void __iomem *base; + struct extcon_dev *extcon; + struct regmap *grf_regs; + struct clk *clk_core; + struct clk *clk_ref; + struct reset_control *uphy_rst; + struct reset_control *pipe_rst; + struct reset_control *tcphy_rst; + const struct rockchip_usb3phy_port_cfg *port_cfgs; + /* mutex to protect access to individual PHYs */ + struct mutex lock; + bool flip; + u8 mode; +}; + +#endif