linux/drivers/phy/allwinner/phy-sun4i-usb.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Allwinner sun4i USB phy driver
 *
 * Copyright (C) 2014-2015 Hans de Goede <[email protected]>
 *
 * Based on code from
 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
 *
 * Modelled after: Samsung S5P/Exynos SoC series MIPI CSIS/DSIM DPHY driver
 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
 * Author: Sylwester Nawrocki <[email protected]>
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/extcon-provider.h>
#include <linux/gpio/consumer.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/phy/phy.h>
#include <linux/phy/phy-sun4i-usb.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/spinlock.h>
#include <linux/usb/of.h>
#include <linux/workqueue.h>

#define REG_ISCR
#define REG_PHYCTL_A10
#define REG_PHYBIST
#define REG_PHYTUNE
#define REG_PHYCTL_A33
#define REG_PHY_OTGCTL

#define REG_HCI_PHY_CTL

#define PHYCTL_DATA

#define OTGCTL_ROUTE_MUSB

#define SUNXI_AHB_ICHR8_EN
#define SUNXI_AHB_INCR4_BURST_EN
#define SUNXI_AHB_INCRX_ALIGN_EN
#define SUNXI_ULPI_BYPASS_EN

/* ISCR, Interface Status and Control bits */
#define ISCR_ID_PULLUP_EN
#define ISCR_DPDM_PULLUP_EN
/* sunxi has the phy id/vbus pins not connected, so we use the force bits */
#define ISCR_FORCE_ID_MASK
#define ISCR_FORCE_ID_LOW
#define ISCR_FORCE_ID_HIGH
#define ISCR_FORCE_VBUS_MASK
#define ISCR_FORCE_VBUS_LOW
#define ISCR_FORCE_VBUS_HIGH

/* Common Control Bits for Both PHYs */
#define PHY_PLL_BW
#define PHY_RES45_CAL_EN

/* Private Control Bits for Each PHY */
#define PHY_TX_AMPLITUDE_TUNE
#define PHY_TX_SLEWRATE_TUNE
#define PHY_VBUSVALID_TH_SEL
#define PHY_PULLUP_RES_SEL
#define PHY_OTG_FUNC_EN
#define PHY_VBUS_DET_EN
#define PHY_DISCON_TH_SEL
#define PHY_SQUELCH_DETECT

/* A83T specific control bits for PHY0 */
#define PHY_CTL_VBUSVLDEXT
#define PHY_CTL_SIDDQ
#define PHY_CTL_H3_SIDDQ

/* A83T specific control bits for PHY2 HSIC */
#define SUNXI_EHCI_HS_FORCE
#define SUNXI_HSIC_CONNECT_DET
#define SUNXI_HSIC_CONNECT_INT
#define SUNXI_HSIC

#define MAX_PHYS

/*
 * Note do not raise the debounce time, we must report Vusb high within 100ms
 * otherwise we get Vbus errors
 */
#define DEBOUNCE_TIME
#define POLL_TIME

struct sun4i_usb_phy_cfg {};

struct sun4i_usb_phy_data {};

#define to_sun4i_usb_phy_data(phy)

static void sun4i_usb_phy0_update_iscr(struct phy *_phy, u32 clr, u32 set)
{}

static void sun4i_usb_phy0_set_id_detect(struct phy *phy, u32 val)
{}

static void sun4i_usb_phy0_set_vbus_detect(struct phy *phy, u32 val)
{}

static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
				int len)
{}

static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable)
{}

static int sun4i_usb_phy_init(struct phy *_phy)
{}

static int sun4i_usb_phy_exit(struct phy *_phy)
{}

static int sun4i_usb_phy0_get_id_det(struct sun4i_usb_phy_data *data)
{}

static int sun4i_usb_phy0_get_vbus_det(struct sun4i_usb_phy_data *data)
{}

static bool sun4i_usb_phy0_have_vbus_det(struct sun4i_usb_phy_data *data)
{}

static bool sun4i_usb_phy0_poll(struct sun4i_usb_phy_data *data)
{}

static int sun4i_usb_phy_power_on(struct phy *_phy)
{}

static int sun4i_usb_phy_power_off(struct phy *_phy)
{}

static int sun4i_usb_phy_set_mode(struct phy *_phy,
				  enum phy_mode mode, int submode)
{}

void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled)
{}
EXPORT_SYMBOL_GPL();

static const struct phy_ops sun4i_usb_phy_ops =;

static void sun4i_usb_phy0_reroute(struct sun4i_usb_phy_data *data, int id_det)
{}

static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work)
{}

static irqreturn_t sun4i_usb_phy0_id_vbus_det_irq(int irq, void *dev_id)
{}

static int sun4i_usb_phy0_vbus_notify(struct notifier_block *nb,
				      unsigned long val, void *v)
{}

static struct phy *sun4i_usb_phy_xlate(struct device *dev,
					const struct of_phandle_args *args)
{}

static void sun4i_usb_phy_remove(struct platform_device *pdev)
{}

static const unsigned int sun4i_usb_phy0_cable[] =;

static int sun4i_usb_phy_probe(struct platform_device *pdev)
{}

static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg =;

static const struct sun4i_usb_phy_cfg sun4i_a10_cfg =;

static const struct sun4i_usb_phy_cfg sun5i_a13_cfg =;

static const struct sun4i_usb_phy_cfg sun6i_a31_cfg =;

static const struct sun4i_usb_phy_cfg sun7i_a20_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_a23_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_a33_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_a83t_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_h3_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_r40_cfg =;

static const struct sun4i_usb_phy_cfg sun8i_v3s_cfg =;

static const struct sun4i_usb_phy_cfg sun20i_d1_cfg =;

static const struct sun4i_usb_phy_cfg sun50i_a64_cfg =;

static const struct sun4i_usb_phy_cfg sun50i_h6_cfg =;

static const struct sun4i_usb_phy_cfg sun50i_h616_cfg =;

static const struct of_device_id sun4i_usb_phy_of_match[] =;
MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);

static struct platform_driver sun4i_usb_phy_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();