blob: 44bead9b8f34bb426440431217fa989a0f839734 [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>
20
21#define KHZ 1000
22#define MHZ (KHZ * KHZ)
23
24struct samsung_usb2_phy_driver;
25struct samsung_usb2_phy_instance;
26struct samsung_usb2_phy_config;
27
28struct samsung_usb2_phy_instance {
29 const struct samsung_usb2_common_phy *cfg;
30 struct phy *phy;
31 struct samsung_usb2_phy_driver *drv;
Kamil Debski57416c22014-07-01 17:15:54 +020032 int int_cnt;
33 int ext_cnt;
Kamil Debski06fb0132014-03-06 12:16:48 +010034};
35
36struct samsung_usb2_phy_driver {
37 const struct samsung_usb2_phy_config *cfg;
38 struct clk *clk;
39 struct clk *ref_clk;
40 unsigned long ref_rate;
41 u32 ref_reg_val;
42 struct device *dev;
43 void __iomem *reg_phy;
44 struct regmap *reg_pmu;
45 struct regmap *reg_sys;
46 spinlock_t lock;
47 struct samsung_usb2_phy_instance instances[0];
48};
49
50struct samsung_usb2_common_phy {
51 int (*power_on)(struct samsung_usb2_phy_instance *);
52 int (*power_off)(struct samsung_usb2_phy_instance *);
53 unsigned int id;
54 char *label;
55};
56
57
58struct samsung_usb2_phy_config {
59 const struct samsung_usb2_common_phy *phys;
60 int (*rate_to_clk)(unsigned long, u32 *);
61 unsigned int num_phys;
62 bool has_mode_switch;
Marek Szyprowski016e0d32014-07-07 11:39:26 +020063 bool has_refclk_sel;
Kamil Debski06fb0132014-03-06 12:16:48 +010064};
65
Marek Szyprowski016e0d32014-07-07 11:39:26 +020066extern const struct samsung_usb2_phy_config exynos3250_usb2_phy_config;
Kamil Debski06fb0132014-03-06 12:16:48 +010067extern const struct samsung_usb2_phy_config exynos4210_usb2_phy_config;
68extern const struct samsung_usb2_phy_config exynos4x12_usb2_phy_config;
Kamil Debski64bf2b22014-03-06 12:16:49 +010069extern const struct samsung_usb2_phy_config exynos5250_usb2_phy_config;
Linus Torvaldsb3345d72014-08-08 11:14:29 -070070extern const struct samsung_usb2_phy_config s5pv210_usb2_phy_config;
Kamil Debski06fb0132014-03-06 12:16:48 +010071#endif