From patchwork Mon Aug 26 08:56:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 2849458 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 031AABF546 for ; Mon, 26 Aug 2013 08:56:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02206202F7 for ; Mon, 26 Aug 2013 08:56:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54C90202F9 for ; Mon, 26 Aug 2013 08:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756659Ab3HZI4g (ORCPT ); Mon, 26 Aug 2013 04:56:36 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:60508 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756305Ab3HZI4e (ORCPT ); Mon, 26 Aug 2013 04:56:34 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MS4009NURH4GDW0@mailout2.samsung.com>; Mon, 26 Aug 2013 17:56:33 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.48]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id E0.8C.17682.1481B125; Mon, 26 Aug 2013 17:56:33 +0900 (KST) X-AuditID: cbfee68e-b7f756d000004512-22-521b1841d061 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 3E.F0.05832.0481B125; Mon, 26 Aug 2013 17:56:32 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MS4006RXRI84T10@mmp1.samsung.com>; Mon, 26 Aug 2013 17:56:32 +0900 (KST) From: Jingoo Han To: 'Kishon Vijay Abraham I' Cc: 'Greg Kroah-Hartman' , linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-fbdev@vger.kernel.org, 'devicetree' , 'Kukjin Kim' , 'Sylwester Nawrocki' , 'Felipe Balbi' , 'Tomasz Figa' , 'Jean-Christophe PLAGNIOL-VILLARD' , 'Tomi Valkeinen' , 'Jingoo Han' References: <003e01cea23a$03aac850$0b0058f0$%han@samsung.com> In-reply-to: <003e01cea23a$03aac850$0b0058f0$%han@samsung.com> Subject: [PATCH 1/3] phy: Add driver for Exynos DP PHY Date: Mon, 26 Aug 2013 17:56:32 +0900 Message-id: <004001cea23a$29580400$7c080c00$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac6iOgN7MgvkoL3hRgS3gzfXOa2c2AAABRJg Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42I5/e+Zga6jhHSQwbZXLBYH79dbvDykaTH/ yDlWi+bF69ksLi+8xGrRu+Aqm8WFpz1sFif6PrBaXN41h81ixvl9TBbrHr5gsjj8pp3VYv2M 1ywW6+ffYnPg83h14Q6Lx/65a9g9+rasYvQ4fmM7k8fnTXIBrFFcNimpOZllqUX6dglcGXf+ LGcu2KldsXTSfMYGxkkqXYwcHBICJhIrl9R0MXICmWISF+6tZ+ti5OIQEljGKHFiwX02mJqF B+Ih4osYJdY+38kC4fxilJh9+ysTSDebgJrEly+H2UFsEQEdiYWn1zODFDELvGOWuHV8NTNI QkjAVqJ162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wCWhKbtzWxQtjyEpvXvGWGuFpd4tFfXYgbjCTefrsLVSIise/FO8YJjEKz kEyahWTSLCSTZiFpWcDIsopRNLUguaA4KT3XSK84Mbe4NC9dLzk/dxMjOL08k97BuKrB4hCj AAejEg9vAJt0kBBrYllxZe4hRgkOZiURXnNRoBBvSmJlVWpRfnxRaU5q8SHGZKBHJzJLiSbn A1NfXkm8obGJmZGlkZmFkYm5OWnCSuK8B1utA4UE0hNLUrNTUwtSi2C2MHFwSjUwiuzl5LH6 s8p4X+iDN5YfTX0iiw+nWbwLi+JPXF2heXr1m8SOhphTPycf2uirO6F5useeg4tfaDgk1Ozw 2N3bynt87b+6v7kXr+X1BDxrF7JkmrCGb9JPxiduxvPE9dP7pKV8X8cH/p7Pd3LqMWHlkm/F WyYfznzyQz9GbGqa7PzGBo79F1KuKLEUZyQaajEXFScCAMR5vvNzAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add a PHY provider driver for the Samsung Exynos SoC Display Port PHY. Signed-off-by: Jingoo Han Reviewed-by: Tomasz Figa Cc: Sylwester Nawrocki Acked-by: Felipe Balbi --- .../devicetree/bindings/phy/samsung-phy.txt | 7 ++ drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 7 +- drivers/phy/phy-exynos-dp-video.c | 111 ++++++++++++++++++++ 4 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/phy/samsung-phy.txt create mode 100644 drivers/phy/phy-exynos-dp-video.c diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt new file mode 100644 index 0000000..ee262238 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt @@ -0,0 +1,7 @@ +Samsung EXYNOS SoC series Display Port PHY +------------------------------------------------- + +Required properties: +- compatible : should be "samsung,exynos5250-dp-video-phy"; +- reg : offset and length of the Display Port PHY register set; +- #phy-cells : from the generic PHY bindings, must be 0; diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index ac239ac..fed26a0 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -38,4 +38,11 @@ config TWL4030_USB This transceiver supports high and full speed devices plus, in host mode, low speed. +config PHY_EXYNOS_DP_VIDEO + tristate "EXYNOS SoC series Display Port PHY driver" + depends on OF + select GENERIC_PHY + help + Support for Display Port PHY found on Samsung EXYNOS SoCs. + endmenu diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 0dd8a98..433e685 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -2,6 +2,7 @@ # Makefile for the phy drivers. # -obj-$(CONFIG_GENERIC_PHY) += phy-core.o -obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o -obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o +obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c new file mode 100644 index 0000000..1dbe6ce --- /dev/null +++ b/drivers/phy/phy-exynos-dp-video.c @@ -0,0 +1,111 @@ +/* + * Samsung EXYNOS SoC series Display Port PHY driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Author: Jingoo Han + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* DPTX_PHY_CONTROL register */ +#define EXYNOS_DPTX_PHY_ENABLE (1 << 0) + +struct exynos_dp_video_phy { + void __iomem *regs; +}; + +static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on) +{ + u32 reg; + + reg = readl(state->regs); + if (on) + reg |= EXYNOS_DPTX_PHY_ENABLE; + else + reg &= ~EXYNOS_DPTX_PHY_ENABLE; + writel(reg, state->regs); + + return 0; +} + +static int exynos_dp_video_phy_power_on(struct phy *phy) +{ + struct exynos_dp_video_phy *state = phy_get_drvdata(phy); + + return __set_phy_state(state, 1); +} + +static int exynos_dp_video_phy_power_off(struct phy *phy) +{ + struct exynos_dp_video_phy *state = phy_get_drvdata(phy); + + return __set_phy_state(state, 0); +} + +static struct phy_ops exynos_dp_video_phy_ops = { + .power_on = exynos_dp_video_phy_power_on, + .power_off = exynos_dp_video_phy_power_off, + .owner = THIS_MODULE, +}; + +static int exynos_dp_video_phy_probe(struct platform_device *pdev) +{ + struct exynos_dp_video_phy *state; + struct device *dev = &pdev->dev; + struct resource *res; + struct phy_provider *phy_provider; + struct phy *phy; + + state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); + if (!state) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + + state->regs = devm_ioremap_resource(dev, res); + if (IS_ERR(state->regs)) + return PTR_ERR(state->regs); + + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + return PTR_ERR(phy_provider); + + phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL); + if (IS_ERR(phy)) { + dev_err(dev, "failed to create Display Port PHY\n"); + return PTR_ERR(phy); + } + phy_set_drvdata(phy, state); + + return 0; +} + +static const struct of_device_id exynos_dp_video_phy_of_match[] = { + { .compatible = "samsung,exynos5250-dp-video-phy" }, + { }, +}; +MODULE_DEVICE_TABLE(of, exynos_dp_video_phy_of_match); + +static struct platform_driver exynos_dp_video_phy_driver = { + .probe = exynos_dp_video_phy_probe, + .driver = { + .name = "exynos-dp-video-phy", + .owner = THIS_MODULE, + .of_match_table = exynos_dp_video_phy_of_match, + } +}; +module_platform_driver(exynos_dp_video_phy_driver); + +MODULE_AUTHOR("Jingoo Han "); +MODULE_DESCRIPTION("Samsung EXYNOS SoC DP PHY driver"); +MODULE_LICENSE("GPL v2");