From patchwork Mon Jul 7 09:39:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 33138 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80C7020969 for ; Mon, 7 Jul 2014 09:39:43 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id uy5sf25353833obc.1 for ; Mon, 07 Jul 2014 02:39:42 -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=E7oCL9L3kgj4luelU0OvYFlUEmP869vdB8nBe/1myBA=; b=TJvy8Vk0w8taKhac9Pr/mmUsNAAUQvEBgX0qEjprH9r6CoREK+KT3OCwKKpfGGmG5m /wx/RJxjXhzF7YZ9i4BaevhkrmK5q/0XBzB++fF9cpucWeLjsqDrvptc5QQQIa0PbEfy 91fHOHQgDSgKLLWLvBRdRsYq5tcyGT51jCucXFtox7SJ2/yueaIzCAzbFicErVQPuLx1 ys3lLr5stqcO6bmleVw4vpHsGlz1YJlXO2Zkub2Lzpql1uqusmWCnW2uINkmX4yNSM7P VG6Kx2ITVS+xUKeEWVdHuo/1L0IsR3OEss3ni9Gio6QB4L9LSQbHGRG1Cuj11HoQ0Zf5 hArQ== X-Gm-Message-State: ALoCoQkTX54F3gI8U5uzb1F03zOH3IOdOWNNXjuzJQHSpcFGvFzVL0LEbdQ486UpZqdRHhRzr8d4 X-Received: by 10.182.51.228 with SMTP id n4mr13892695obo.28.1404725982767; Mon, 07 Jul 2014 02:39:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.16 with SMTP id 16ls1625298qgg.57.gmail; Mon, 07 Jul 2014 02:39:42 -0700 (PDT) X-Received: by 10.52.69.172 with SMTP id f12mr22487296vdu.26.1404725982632; Mon, 07 Jul 2014 02:39:42 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id vr7si18573908vcb.93.2014.07.07.02.39.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Jul 2014 02:39:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ij19so3600512vcb.22 for ; Mon, 07 Jul 2014 02:39:42 -0700 (PDT) X-Received: by 10.52.249.9 with SMTP id yq9mr10272554vdc.6.1404725982535; Mon, 07 Jul 2014 02:39:42 -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 tc5csp652371vcb; Mon, 7 Jul 2014 02:39:42 -0700 (PDT) X-Received: by 10.70.91.80 with SMTP id cc16mr1680362pdb.133.1404725981536; Mon, 07 Jul 2014 02:39:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si2588807pdo.177.2014.07.07.02.39.40; Mon, 07 Jul 2014 02:39:40 -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 S1751913AbaGGJjk (ORCPT + 8 others); Mon, 7 Jul 2014 05:39:40 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:22109 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751355AbaGGJji (ORCPT ); Mon, 7 Jul 2014 05:39:38 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0N8C00L535HZH990@mailout3.w1.samsung.com>; Mon, 07 Jul 2014 10:39:35 +0100 (BST) X-AuditID: cbfec7f4-b7fac6d000006cfe-a6-53ba6ad88dc6 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id DA.4E.27902.8DA6AB35; Mon, 07 Jul 2014 10:39:36 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N8C00J045HWHHA0@eusync3.samsung.com>; Mon, 07 Jul 2014 10:39:36 +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 v2] drivers: phy: exynos-usb2: add support for Exynos 3250 Date: Mon, 07 Jul 2014 11:39:26 +0200 Message-id: <1404725966-12331-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLJMWRmVeSWpSXmKPExsVy+t/xq7o3snYFGyzcJ2OxccZ6VovrX56z Wvx4fYHN4sLTHjaLs01v2C1mnN/HZLFoWSuzxdojd9kt1s94zeLA6dG3ZRWjx/Eb25k8Pm+S C2CO4rJJSc3JLEst0rdL4Mp43stV8Myo4vnfs8wNjHO1uhg5OSQETCSm3t/NBmGLSVy4tx7I 5uIQEljKKLFs9Vp2CKePSWLF4yvMIFVsAoYSXW+7wDpEBBwkliy9A9bBLLCWSWLh306whLCA l0TfvW9MXYwcHCwCqhKLN2mDhHkFPCQ2z7gGtU1O4v/LFUwTGLkXMDKsYhRNLU0uKE5KzzXU K07MLS7NS9dLzs/dxAgJki87GBcfszrEKMDBqMTD++HKzmAh1sSy4srcQ4wSHMxKIrzT43cF C/GmJFZWpRblxxeV5qQWH2Jk4uCUamAUEJ550FvaP0lrglbgsfnNS/hvv51VGLmN7/7j9h3t wqpar+ZLPbe/wBLkw23YGxHQ/CD4uPy/+15f376T862cZfBcOyrj9KxfKemMlx1jl209zrLo xI+g10pTvz8/t2r+o8r0HPUOdqdNfQuS9ZJOfqo3L/nbY67SohEcc9354JOok/81Nm9TYinO SDTUYi4qTgQAdwAfGPABAAA= 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.177 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 and lack of MODE SWITCH register. Signed-off-by: Marek Szyprowski Reviewed-by: Tomasz Figa --- Changelog: v2: - added new binding documentation - removed superfluous defines - removed mode switch for 3250, because it is not really needed --- Documentation/devicetree/bindings/phy/samsung-phy.txt | 2 ++ drivers/phy/Kconfig | 12 ++++++------ drivers/phy/phy-exynos4x12-usb2.c | 17 +++++++++++++++-- drivers/phy/phy-samsung-usb2.c | 6 ++++++ drivers/phy/phy-samsung-usb2.h | 2 ++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index 2049261d8c31..6099a5c94283 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -26,6 +26,7 @@ Samsung S5P/EXYNOS SoC series USB PHY Required properties: - compatible : should be one of the listed compatibles: + - "samsung,exynos3250-usb2-phy" - "samsung,exynos4210-usb2-phy" - "samsung,exynos4x12-usb2-phy" - "samsung,exynos5250-usb2-phy" @@ -46,6 +47,7 @@ and Exynos 4212) it is as follows: 1 - USB host ("host"), 2 - HSIC0 ("hsic0"), 3 - HSIC1 ("hsic1"), +Exynos3250 has only USB device phy available as phy 0. Exynos 4210 and Exynos 4212 use mode switching and require that mode switch register is supplied. diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 16a2f067c242..50bee8357a7f 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..f26ab22bc9c7 100644 --- a/drivers/phy/phy-exynos4x12-usb2.c +++ b/drivers/phy/phy-exynos4x12-usb2.c @@ -67,6 +67,8 @@ #define EXYNOS_4x12_UPHYCLK_PHYFSEL_24MHZ (0x5 << 0) #define EXYNOS_4x12_UPHYCLK_PHYFSEL_50MHZ (0x7 << 0) +#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 +199,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); @@ -278,7 +284,7 @@ static int exynos4x12_power_on(struct samsung_usb2_phy_instance *inst) exynos4x12_power_on_internal(&drv->instances[EXYNOS4x12_DEVICE]); } - if (inst->cfg->id == EXYNOS4x12_DEVICE) + if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, EXYNOS_4x12_MODE_SWITCH_MASK, EXYNOS_4x12_MODE_SWITCH_DEVICE); @@ -310,7 +316,7 @@ static int exynos4x12_power_off(struct samsung_usb2_phy_instance *inst) if (inst->ext_cnt-- > 1) return 0; - if (inst->cfg->id == EXYNOS4x12_DEVICE) + if (inst->cfg->id == EXYNOS4x12_DEVICE && drv->cfg->has_mode_switch) regmap_update_bits(drv->reg_sys, EXYNOS_4x12_MODE_SWITCH_OFFSET, EXYNOS_4x12_MODE_SWITCH_MASK, EXYNOS_4x12_MODE_SWITCH_HOST); @@ -358,6 +364,13 @@ static const struct samsung_usb2_common_phy exynos4x12_phys[] = { {}, }; +const struct samsung_usb2_phy_config exynos3250_usb2_phy_config = { + .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;