2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2015-10-23 16:50:49 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _TEGRA_XUSB_PADCTL_COMMON_H_
|
|
|
|
#define _TEGRA_XUSB_PADCTL_COMMON_H_
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <fdtdec.h>
|
2017-07-25 14:29:59 +00:00
|
|
|
#include <dm/ofnode.h>
|
2015-10-23 16:50:49 +00:00
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch-tegra/xusb-padctl.h>
|
2017-07-25 14:29:59 +00:00
|
|
|
#include <linux/ioport.h>
|
2015-10-23 16:50:49 +00:00
|
|
|
|
|
|
|
struct tegra_xusb_padctl_lane {
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
unsigned int offset;
|
|
|
|
unsigned int shift;
|
|
|
|
unsigned int mask;
|
|
|
|
unsigned int iddq;
|
|
|
|
|
|
|
|
const unsigned int *funcs;
|
|
|
|
unsigned int num_funcs;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_xusb_phy_ops {
|
|
|
|
int (*prepare)(struct tegra_xusb_phy *phy);
|
|
|
|
int (*enable)(struct tegra_xusb_phy *phy);
|
|
|
|
int (*disable)(struct tegra_xusb_phy *phy);
|
|
|
|
int (*unprepare)(struct tegra_xusb_phy *phy);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_xusb_phy {
|
2015-10-23 16:50:50 +00:00
|
|
|
unsigned int type;
|
2015-10-23 16:50:49 +00:00
|
|
|
const struct tegra_xusb_phy_ops *ops;
|
|
|
|
struct tegra_xusb_padctl *padctl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_xusb_padctl_pin {
|
|
|
|
const struct tegra_xusb_padctl_lane *lane;
|
|
|
|
|
|
|
|
unsigned int func;
|
|
|
|
int iddq;
|
|
|
|
};
|
|
|
|
|
2015-10-23 16:50:52 +00:00
|
|
|
#define MAX_GROUPS 5
|
|
|
|
#define MAX_PINS 7
|
2015-10-23 16:50:49 +00:00
|
|
|
|
|
|
|
struct tegra_xusb_padctl_group {
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
const char *pins[MAX_PINS];
|
|
|
|
unsigned int num_pins;
|
|
|
|
|
|
|
|
const char *func;
|
|
|
|
int iddq;
|
|
|
|
};
|
|
|
|
|
2015-10-23 16:50:50 +00:00
|
|
|
struct tegra_xusb_padctl_soc {
|
|
|
|
const struct tegra_xusb_padctl_lane *lanes;
|
|
|
|
unsigned int num_lanes;
|
|
|
|
const char *const *functions;
|
|
|
|
unsigned int num_functions;
|
|
|
|
struct tegra_xusb_phy *phys;
|
|
|
|
unsigned int num_phys;
|
|
|
|
};
|
|
|
|
|
2015-10-23 16:50:49 +00:00
|
|
|
struct tegra_xusb_padctl_config {
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
struct tegra_xusb_padctl_group groups[MAX_GROUPS];
|
|
|
|
unsigned int num_groups;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_xusb_padctl {
|
2015-10-23 16:50:50 +00:00
|
|
|
const struct tegra_xusb_padctl_soc *socdata;
|
|
|
|
struct tegra_xusb_padctl_config config;
|
2017-07-25 14:29:59 +00:00
|
|
|
struct resource regs;
|
2015-10-23 16:50:49 +00:00
|
|
|
unsigned int enable;
|
|
|
|
|
|
|
|
};
|
2015-10-23 16:50:50 +00:00
|
|
|
extern struct tegra_xusb_padctl padctl;
|
2015-10-23 16:50:49 +00:00
|
|
|
|
|
|
|
static inline u32 padctl_readl(struct tegra_xusb_padctl *padctl,
|
|
|
|
unsigned long offset)
|
|
|
|
{
|
|
|
|
return readl(padctl->regs.start + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void padctl_writel(struct tegra_xusb_padctl *padctl,
|
|
|
|
u32 value, unsigned long offset)
|
|
|
|
{
|
|
|
|
writel(value, padctl->regs.start + offset);
|
|
|
|
}
|
|
|
|
|
2017-07-25 14:29:59 +00:00
|
|
|
int tegra_xusb_process_nodes(ofnode nodes[], unsigned int count,
|
|
|
|
const struct tegra_xusb_padctl_soc *socdata);
|
2015-10-23 16:50:49 +00:00
|
|
|
|
|
|
|
#endif
|