From patchwork Fri Jul 4 12:13:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 33088 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DC237203AC for ; Fri, 4 Jul 2014 12:13:20 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h3sf7735205igd.5 for ; Fri, 04 Jul 2014 05:13:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=sp2iZ9rg0Ji0/reUvrSeNQ5F8GyG0wj/BJN9it6KYJ8=; b=JwPdElIjxlDE9gScrl5/XZPJzNc4bqFqL/OWwWdjwOm2xL9EoXcTDGxzWfXJTvKneY OOEPYh4k2z9knN2XKz+XCAOK45kgAgVCWQRmKQWyiso0p5N8yo6HMf5wpCGBPOrpiKIN 1tIwfSlFio5n7RVNxhWs6V2oxgp+KblfL8PQNIO16NxjLsQo1iBWrPmlcGy/lf/7ezaN EDZpEm/IqyDtSQBTuLiPW36MzGvvOKv4kVDntYdxEpm+KS2VEnX6+QU1UnwspDkCOdpn togIhi+zxnaQKRPatA7Tone9C4MyLmhmf1NOKxJXrAzwT3nplOrDOFGHf6MIbz8PF5Xh AhuQ== X-Gm-Message-State: ALoCoQkM9UsDF5BMkx/+0Jp+d6DD5zM4rD8lTWOly17GoYZimHv/wLf4NhojoDiU9YSHJyUng0Hm X-Received: by 10.182.66.33 with SMTP id c1mr5243450obt.39.1404475999978; Fri, 04 Jul 2014 05:13:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.107 with SMTP id 98ls829140qga.80.gmail; Fri, 04 Jul 2014 05:13:19 -0700 (PDT) X-Received: by 10.58.229.162 with SMTP id sr2mr9285005vec.15.1404475999878; Fri, 04 Jul 2014 05:13:19 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id kh9si15406731vdb.21.2014.07.04.05.13.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Jul 2014 05:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so1515345vcb.33 for ; Fri, 04 Jul 2014 05:13:19 -0700 (PDT) X-Received: by 10.221.42.135 with SMTP id ty7mr9547111vcb.14.1404475999765; Fri, 04 Jul 2014 05:13:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp461881vcb; Fri, 4 Jul 2014 05:13:19 -0700 (PDT) X-Received: by 10.70.123.231 with SMTP id md7mr9845646pdb.67.1404475998903; Fri, 04 Jul 2014 05:13:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si35154014pbw.214.2014.07.04.05.13.18; Fri, 04 Jul 2014 05:13:18 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751850AbaGDMNR (ORCPT + 8 others); Fri, 4 Jul 2014 08:13:17 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:21138 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751158AbaGDMNQ (ORCPT ); Fri, 4 Jul 2014 08:13:16 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N860056YSM1FW50@mailout3.w1.samsung.com>; Fri, 04 Jul 2014 13:13:13 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-f7-53b69a5aa340 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 01.0D.19257.A5A96B35; Fri, 04 Jul 2014 13:13:14 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8600IOFSLZGF20@eusync4.samsung.com>; Fri, 04 Jul 2014 13:13:13 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Kishon Vijay Abraham I , Kamil Debski , Tomasz Figa , Kyungmin Park , Bartlomiej Zolnierkiewicz , Chanwoo Choi Subject: [PATCH] drivers: phy: exynos-usb2: add support for Exynos 3250 Date: Fri, 04 Jul 2014 14:13:09 +0200 Message-id: <1404475989-30588-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJMWRmVeSWpSXmKPExsVy+t/xa7pRs7YFG/RtYbTYOGM9q8X1L89Z LX68vsBmceFpD5vF2aY37BYzzu9jsli0rJXZYu2Ru+wW62e8ZnHg9OjbsorR4/iN7UwenzfJ BTBHcdmkpOZklqUW6dslcGX0vX7DVnBQpeLWns+sDYwP5boYOTkkBEwkGk6+YYOwxSQu3FsP ZHNxCAksZZT4ffAJlNPHJHH9bCc7SBWbgKFE19susA4RAQeJJUvvgBUxC6xlklj4txMsISzg LrHiww9WEJtFQFVi3p91zCA2r4CHxKKWfSwQ6+Qk/r9cwTSBkXsBI8MqRtHU0uSC4qT0XCO9 4sTc4tK8dL3k/NxNjJBA+bqDcekxq0OMAhyMSjy8DS3bgoVYE8uKK3MPMUpwMCuJ8B7oAwrx piRWVqUW5ccXleakFh9iZOLglGpgFEmwt/rUF3mgw0TK9cJuq4nPj/w4dne3wa6XB1nNNtw5 +NVU8/uTDwqH975m33Zwr8LNjqXzkpvvPs8yS0o5py/7OP6p5T1hc/vtq6Kaa+YHdF0Ms1mc vaBzwcuX+suSvT/uuXxkvtRnlqx/E17FzeHi1alZ7LLN5/D/BycKov7Ezdq184Dd2VlKLMUZ iYZazEXFiQARQ/xy8gEAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds support for Exynos3250 SoC to Exynos2USB PHY driver. Although Exynos3250 has only one device phy interface, the register layout and all operations that are required to get it enabled are almost same as on Exynos4x12. The only different is one more register (REFCLKSEL) which need to be set. Signed-off-by: Marek Szyprowski --- drivers/phy/Kconfig | 12 ++++++------ drivers/phy/phy-exynos4x12-usb2.c | 18 ++++++++++++++++++ drivers/phy/phy-samsung-usb2.c | 6 ++++++ drivers/phy/phy-samsung-usb2.h | 2 ++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 16a2f067c242..58737b9eaa6e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -141,14 +141,14 @@ config PHY_EXYNOS4210_USB2 phys are available - device, host, HSIC0 and HSIC1. config PHY_EXYNOS4X12_USB2 - bool "Support for Exynos 4x12" + bool "Support for Exynos 3250/4x12" depends on PHY_SAMSUNG_USB2 - depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) + depends on (SOC_EXYNOS3250 || SOC_EXYNOS4212 || SOC_EXYNOS4412) help - Enable USB PHY support for Exynos 4x12. This option requires that - Samsung USB 2.0 PHY driver is enabled and means that support for this - particular SoC is compiled in the driver. In case of Exynos 4x12 four - phys are available - device, host, HSIC0 and HSIC1. + Enable USB PHY support for Exynos 3250/4x12. This option requires + that Samsung USB 2.0 PHY driver is enabled and means that support for + this particular SoC is compiled in the driver. In case of Exynos 4x12 + four phys are available - device, host, HSIC0 and HSIC1. config PHY_EXYNOS5250_USB2 bool "Support for Exynos 5250" diff --git a/drivers/phy/phy-exynos4x12-usb2.c b/drivers/phy/phy-exynos4x12-usb2.c index 59d8dd3ff390..b29bbfacd4b5 100644 --- a/drivers/phy/phy-exynos4x12-usb2.c +++ b/drivers/phy/phy-exynos4x12-usb2.c @@ -67,6 +67,12 @@ #define EXYNOS_4x12_UPHYCLK_PHYFSEL_24MHZ (0x5 << 0) #define EXYNOS_4x12_UPHYCLK_PHYFSEL_50MHZ (0x7 << 0) +#define EXYNOS_4212_UPHYCLK_PHY0_ID_PULLUP (0x1 << 3) +#define EXYNOS_4212_UPHYCLK_PHY0_COMMON_ON (0x1 << 4) +#define EXYNOS_4212_UPHYCLK_PHY1_COMMON_ON (0x1 << 7) + +#define EXYNOS_3250_UPHYCLK_REFCLKSEL (0x2 << 8) + #define EXYNOS_4x12_UPHYCLK_PHY0_ID_PULLUP BIT(3) #define EXYNOS_4x12_UPHYCLK_PHY0_COMMON_ON BIT(4) #define EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON BIT(7) @@ -197,6 +203,10 @@ static void exynos4x12_setup_clk(struct samsung_usb2_phy_instance *inst) clk = readl(drv->reg_phy + EXYNOS_4x12_UPHYCLK); clk &= ~EXYNOS_4x12_UPHYCLK_PHYFSEL_MASK; + + if (drv->cfg->has_refclk_sel) + clk = EXYNOS_3250_UPHYCLK_REFCLKSEL; + clk |= drv->ref_reg_val << EXYNOS_4x12_UPHYCLK_PHYFSEL_OFFSET; clk |= EXYNOS_4x12_UPHYCLK_PHY1_COMMON_ON; writel(clk, drv->reg_phy + EXYNOS_4x12_UPHYCLK); @@ -358,6 +368,14 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = { {}, }; +const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = { + .has_mode_switch = 1, + .has_refclk_sel = 1, + .num_phys = 1, + .phys = exynos4x12_phys, + .rate_to_clk = exynos4x12_rate_to_clk, +}; + const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config = { .has_mode_switch = 1, .num_phys = EXYNOS4x12_NUM_PHYS, diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 8a8c6bc8709a..36db8eb8c5f4 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c @@ -87,6 +87,12 @@ static struct phy *samsung_usb2_phy_xlate(struct device *dev, } static const struct of_device_id samsung_usb2_phy_of_match[] = { +#ifdef CONFIG_PHY_EXYNOS4X12_USB2 + { + .compatible = "samsung,exynos3250-usb2-phy", + .data = &exynos3250_usb2_phy_config, + }, +#endif #ifdef CONFIG_PHY_EXYNOS4210_USB2 { .compatible = "samsung,exynos4210-usb2-phy", diff --git a/drivers/phy/phy-samsung-usb2.h b/drivers/phy/phy-samsung-usb2.h index 918847843a95..b03da0ef39ac 100644 --- a/drivers/phy/phy-samsung-usb2.h +++ b/drivers/phy/phy-samsung-usb2.h @@ -60,8 +60,10 @@ struct samsung_usb2_phy_config { int (*rate_to_clk)(unsigned long, u32 *); unsigned int num_phys; bool has_mode_switch; + bool has_refclk_sel; }; +extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config; extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config; extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config; extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;