diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-10-16 12:28:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-16 16:48:08 -0400 |
commit | 74988e8b5718b561457fd035dc3ab9b9d8f45a5d (patch) | |
tree | b18855ad19447b2ffea5be7799dfb65de86e447d | |
parent | e66f233dc7f7aef51d82cac1b93b46f7c9bf42ef (diff) |
phy: Add driver for Exynos DP PHY
Add a PHY provider driver for the Samsung Exynos SoC Display Port PHY.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/devicetree/bindings/phy/samsung-phy.txt | 8 | ||||
-rw-r--r-- | drivers/phy/Kconfig | 7 | ||||
-rw-r--r-- | drivers/phy/Makefile | 1 | ||||
-rw-r--r-- | drivers/phy/phy-exynos-dp-video.c | 111 |
4 files changed, 127 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt index 5ff208c7f1f2..c0fccaa1671e 100644 --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt | |||
@@ -12,3 +12,11 @@ the PHY specifier identifies the PHY and its meaning is as follows: | |||
12 | 1 - MIPI DSIM 0, | 12 | 1 - MIPI DSIM 0, |
13 | 2 - MIPI CSIS 1, | 13 | 2 - MIPI CSIS 1, |
14 | 3 - MIPI DSIM 1. | 14 | 3 - MIPI DSIM 1. |
15 | |||
16 | Samsung EXYNOS SoC series Display Port PHY | ||
17 | ------------------------------------------------- | ||
18 | |||
19 | Required properties: | ||
20 | - compatible : should be "samsung,exynos5250-dp-video-phy"; | ||
21 | - reg : offset and length of the Display Port PHY register set; | ||
22 | - #phy-cells : from the generic PHY bindings, must be 0; | ||
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 0062d7e60dbe..a344f3d52361 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -44,4 +44,11 @@ config TWL4030_USB | |||
44 | This transceiver supports high and full speed devices plus, | 44 | This transceiver supports high and full speed devices plus, |
45 | in host mode, low speed. | 45 | in host mode, low speed. |
46 | 46 | ||
47 | config PHY_EXYNOS_DP_VIDEO | ||
48 | tristate "EXYNOS SoC series Display Port PHY driver" | ||
49 | depends on OF | ||
50 | select GENERIC_PHY | ||
51 | help | ||
52 | Support for Display Port PHY found on Samsung EXYNOS SoCs. | ||
53 | |||
47 | endmenu | 54 | endmenu |
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 6344053661f4..d0caae9cfb83 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_GENERIC_PHY) += phy-core.o | 5 | obj-$(CONFIG_GENERIC_PHY) += phy-core.o |
6 | obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o | ||
6 | obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o | 7 | obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o |
7 | obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o | 8 | obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o |
8 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o | 9 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o |
diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c new file mode 100644 index 000000000000..1dbe6ce7b2ce --- /dev/null +++ b/drivers/phy/phy-exynos-dp-video.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * Samsung EXYNOS SoC series Display Port PHY driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Samsung Electronics Co., Ltd. | ||
5 | * Author: Jingoo Han <jg1.han@samsung.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/io.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_address.h> | ||
17 | #include <linux/phy/phy.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | |||
20 | /* DPTX_PHY_CONTROL register */ | ||
21 | #define EXYNOS_DPTX_PHY_ENABLE (1 << 0) | ||
22 | |||
23 | struct exynos_dp_video_phy { | ||
24 | void __iomem *regs; | ||
25 | }; | ||
26 | |||
27 | static int __set_phy_state(struct exynos_dp_video_phy *state, unsigned int on) | ||
28 | { | ||
29 | u32 reg; | ||
30 | |||
31 | reg = readl(state->regs); | ||
32 | if (on) | ||
33 | reg |= EXYNOS_DPTX_PHY_ENABLE; | ||
34 | else | ||
35 | reg &= ~EXYNOS_DPTX_PHY_ENABLE; | ||
36 | writel(reg, state->regs); | ||
37 | |||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static int exynos_dp_video_phy_power_on(struct phy *phy) | ||
42 | { | ||
43 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); | ||
44 | |||
45 | return __set_phy_state(state, 1); | ||
46 | } | ||
47 | |||
48 | static int exynos_dp_video_phy_power_off(struct phy *phy) | ||
49 | { | ||
50 | struct exynos_dp_video_phy *state = phy_get_drvdata(phy); | ||
51 | |||
52 | return __set_phy_state(state, 0); | ||
53 | } | ||
54 | |||
55 | static struct phy_ops exynos_dp_video_phy_ops = { | ||
56 | .power_on = exynos_dp_video_phy_power_on, | ||
57 | .power_off = exynos_dp_video_phy_power_off, | ||
58 | .owner = THIS_MODULE, | ||
59 | }; | ||
60 | |||
61 | static int exynos_dp_video_phy_probe(struct platform_device *pdev) | ||
62 | { | ||
63 | struct exynos_dp_video_phy *state; | ||
64 | struct device *dev = &pdev->dev; | ||
65 | struct resource *res; | ||
66 | struct phy_provider *phy_provider; | ||
67 | struct phy *phy; | ||
68 | |||
69 | state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); | ||
70 | if (!state) | ||
71 | return -ENOMEM; | ||
72 | |||
73 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
74 | |||
75 | state->regs = devm_ioremap_resource(dev, res); | ||
76 | if (IS_ERR(state->regs)) | ||
77 | return PTR_ERR(state->regs); | ||
78 | |||
79 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); | ||
80 | if (IS_ERR(phy_provider)) | ||
81 | return PTR_ERR(phy_provider); | ||
82 | |||
83 | phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL); | ||
84 | if (IS_ERR(phy)) { | ||
85 | dev_err(dev, "failed to create Display Port PHY\n"); | ||
86 | return PTR_ERR(phy); | ||
87 | } | ||
88 | phy_set_drvdata(phy, state); | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static const struct of_device_id exynos_dp_video_phy_of_match[] = { | ||
94 | { .compatible = "samsung,exynos5250-dp-video-phy" }, | ||
95 | { }, | ||
96 | }; | ||
97 | MODULE_DEVICE_TABLE(of, exynos_dp_video_phy_of_match); | ||
98 | |||
99 | static struct platform_driver exynos_dp_video_phy_driver = { | ||
100 | .probe = exynos_dp_video_phy_probe, | ||
101 | .driver = { | ||
102 | .name = "exynos-dp-video-phy", | ||
103 | .owner = THIS_MODULE, | ||
104 | .of_match_table = exynos_dp_video_phy_of_match, | ||
105 | } | ||
106 | }; | ||
107 | module_platform_driver(exynos_dp_video_phy_driver); | ||
108 | |||
109 | MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>"); | ||
110 | MODULE_DESCRIPTION("Samsung EXYNOS SoC DP PHY driver"); | ||
111 | MODULE_LICENSE("GPL v2"); | ||