blob: 6563e7ca0ac444824f4185277a33c1a5fee6a1bd [file] [log] [blame]
Kamil Debski06fb0132014-03-06 12:16:48 +01001/*
2 * Samsung SoC USB 1.1/2.0 PHY driver
3 *
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * Author: Kamil Debski <k.debski@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#ifndef _PHY_EXYNOS_USB2_H
13#define _PHY_EXYNOS_USB2_H
14
15#include <linux/clk.h>
16#include <linux/phy/phy.h>
17#include <linux/device.h>
18#include <linux/regmap.h>
19#include <linux/spinlock.h>
Marek Szyprowskia007ddb2015-08-21 14:38:37 +020020#include <linux/regulator/consumer.h>
Kamil Debski06fb0132014-03-06 12:16:48 +010021
22#define KHZ 1000
23#define MHZ (KHZ * KHZ)
24
25struct samsung_usb2_phy_driver;
26struct samsung_usb2_phy_instance;
27struct samsung_usb2_phy_config;
28
29struct samsung_usb2_phy_instance {
30 const struct samsung_usb2_common_phy *cfg;
31 struct phy *phy;
32 struct samsung_usb2_phy_driver *drv;
Kamil Debski57416c22014-07-01 17:15:54 +020033 int int_cnt;
34 int ext_cnt;
Kamil Debski06fb0132014-03-06 12:16:48 +010035};
36
37struct samsung_usb2_phy_driver {
38 const struct samsung_usb2_phy_config *cfg;
39 struct clk *clk;
40 struct clk *ref_clk;
Marek Szyprowskia007ddb2015-08-21 14:38:37 +020041 struct regulator *vbus;
Kamil Debski06fb0132014-03-06 12:16:48 +010042 unsigned long ref_rate;
43 u32 ref_reg_val;
44 struct device *dev;
45 void __iomem *reg_phy;
46 struct regmap *reg_pmu;
47 struct regmap *reg_sys;
48 spinlock_t lock;
49 struct samsung_usb2_phy_instance instances[0];
50};
51
52struct samsung_usb2_common_phy {
53 int (*power_on)(struct samsung_usb2_phy_instance *);
54 int (*power_off)(struct samsung_usb2_phy_instance *);
55 unsigned int id;
56 char *label;
57};
58
59
60struct samsung_usb2_phy_config {
61 const struct samsung_usb2_common_phy *phys;
62 int (*rate_to_clk)(unsigned long, u32 *);
63 unsigned int num_phys;
64 bool has_mode_switch;
Marek Szyprowski016e0d32014-07-07 11:39:26 +020065 bool has_refclk_sel;
Kamil Debski06fb0132014-03-06 12:16:48 +010066};
67
Marek Szyprowski016e0d32014-07-07 11:39:26 +020068extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
Kamil Debski06fb0132014-03-06 12:16:48 +010069extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
70extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
Kamil Debski64bf2b22014-03-06 12:16:49 +010071extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
Linus Torvaldsb3345d72014-08-08 11:14:29 -070072extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
Kamil Debski06fb0132014-03-06 12:16:48 +010073#endif