linux/drivers/phy/motorola/phy-mapphone-mdm6600.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Motorola Mapphone MDM6600 modem GPIO controlled USB PHY driver
 * Copyright (C) 2018 Tony Lindgren <[email protected]>
 */

#include <linux/delay.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#include <linux/gpio/consumer.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/pinctrl/consumer.h>

#define PHY_MDM6600_PHY_DELAY_MS
#define PHY_MDM6600_ENABLED_DELAY_MS
#define PHY_MDM6600_WAKE_KICK_MS
#define MDM6600_MODEM_IDLE_DELAY_MS
#define MDM6600_MODEM_WAKE_DELAY_MS

enum phy_mdm6600_ctrl_lines {};

enum phy_mdm6600_bootmode_lines {};

enum phy_mdm6600_cmd_lines {};

enum phy_mdm6600_status_lines {};

/*
 * MDM6600 command codes. These are based on Motorola Mapphone Linux
 * kernel tree.
 */
enum phy_mdm6600_cmd {};

/*
 * MDM6600 status codes. These are based on Motorola Mapphone Linux
 * kernel tree.
 */
enum phy_mdm6600_status {};

static const char * const
phy_mdm6600_status_name[] =;

struct phy_mdm6600 {};

static int phy_mdm6600_init(struct phy *x)
{}

static int phy_mdm6600_power_on(struct phy *x)
{}

static int phy_mdm6600_power_off(struct phy *x)
{}

static const struct phy_ops gpio_usb_ops =;

/**
 * phy_mdm6600_cmd() - send a command request to mdm6600
 * @ddata: device driver data
 * @val: value of cmd to be set
 *
 * Configures the three command request GPIOs to the specified value.
 */
static void phy_mdm6600_cmd(struct phy_mdm6600 *ddata, int val)
{}

/**
 * phy_mdm6600_status() - read mdm6600 status lines
 * @work: work structure
 */
static void phy_mdm6600_status(struct work_struct *work)
{}

static irqreturn_t phy_mdm6600_irq_thread(int irq, void *data)
{}

/**
 * phy_mdm6600_wakeirq_thread - handle mode1 line OOB wake after booting
 * @irq: interrupt
 * @data: interrupt handler data
 *
 * GPIO mode1 is used initially as output to configure the USB boot
 * mode for mdm6600. After booting it is used as input for OOB wake
 * signal from mdm6600 to the SoC. Just use it for debug info only
 * for now.
 */
static irqreturn_t phy_mdm6600_wakeirq_thread(int irq, void *data)
{}

/**
 * phy_mdm6600_init_irq() - initialize mdm6600 status IRQ lines
 * @ddata: device driver data
 */
static void phy_mdm6600_init_irq(struct phy_mdm6600 *ddata)
{}

struct phy_mdm6600_map {};

static const struct phy_mdm6600_map
phy_mdm6600_ctrl_gpio_map[PHY_MDM6600_NR_CTRL_LINES] =;

/**
 * phy_mdm6600_init_lines() - initialize mdm6600 GPIO lines
 * @ddata: device driver data
 */
static int phy_mdm6600_init_lines(struct phy_mdm6600 *ddata)
{}

/**
 * phy_mdm6600_device_power_on() - power on mdm6600 device
 * @ddata: device driver data
 *
 * To get the integrated USB phy in MDM6600 takes some hoops. We must ensure
 * the shared USB bootmode GPIOs are configured, then request modem start-up,
 * reset and power-up.. And then we need to recycle the shared USB bootmode
 * GPIOs as they are also used for Out of Band (OOB) wake for the USB and
 * TS 27.010 serial mux.
 */
static int phy_mdm6600_device_power_on(struct phy_mdm6600 *ddata)
{}

/**
 * phy_mdm6600_device_power_off() - power off mdm6600 device
 * @ddata: device driver data
 */
static void phy_mdm6600_device_power_off(struct phy_mdm6600 *ddata)
{}

static void phy_mdm6600_deferred_power_on(struct work_struct *work)
{}

/*
 * USB suspend puts mdm6600 into low power mode. For any n_gsm using apps,
 * we need to keep the modem awake by kicking it's mode0 GPIO. This will
 * keep the modem awake for about 1.2 seconds. When no n_gsm apps are using
 * the modem, runtime PM auto mode can be enabled so modem can enter low
 * power mode.
 */
static void phy_mdm6600_wake_modem(struct phy_mdm6600 *ddata)
{}

static void phy_mdm6600_modem_wake(struct work_struct *work)
{}

static int __maybe_unused phy_mdm6600_runtime_suspend(struct device *dev)
{}

static int __maybe_unused phy_mdm6600_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops phy_mdm6600_pm_ops =;

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

static int phy_mdm6600_probe(struct platform_device *pdev)
{}

static void phy_mdm6600_remove(struct platform_device *pdev)
{}

static struct platform_driver phy_mdm6600_driver =;

module_platform_driver();

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