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: 4480991 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67D3E9F26C for ; Fri, 4 Jul 2014 12:13:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88A812039D for ; Fri, 4 Jul 2014 12:13:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2596B2038C for ; Fri, 4 Jul 2014 12:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751850AbaGDMNR (ORCPT ); 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: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;