linux/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

// SPDX-License-Identifier: GPL-2.0-only
/*******************************************************************************
  This contains the functions to handle the platform driver.

  Copyright (C) 2007-2011  STMicroelectronics Ltd


  Author: Giuseppe Cavallaro <[email protected]>
*******************************************************************************/

#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>

#include "stmmac.h"
#include "stmmac_platform.h"

#ifdef CONFIG_OF

/**
 * dwmac1000_validate_mcast_bins - validates the number of Multicast filter bins
 * @dev: struct device of the platform device
 * @mcast_bins: Multicast filtering bins
 * Description:
 * this function validates the number of Multicast filtering bins specified
 * by the configuration through the device tree. The Synopsys GMAC supports
 * 64 bins, 128 bins, or 256 bins. "bins" refer to the division of CRC
 * number space. 64 bins correspond to 6 bits of the CRC, 128 corresponds
 * to 7 bits, and 256 refers to 8 bits of the CRC. Any other setting is
 * invalid and will cause the filtering algorithm to use Multicast
 * promiscuous mode.
 */
static int dwmac1000_validate_mcast_bins(struct device *dev, int mcast_bins)
{}

/**
 * dwmac1000_validate_ucast_entries - validate the Unicast address entries
 * @dev: struct device of the platform device
 * @ucast_entries: number of Unicast address entries
 * Description:
 * This function validates the number of Unicast address entries supported
 * by a particular Synopsys 10/100/1000 controller. The Synopsys controller
 * supports 1..32, 64, or 128 Unicast filter entries for it's Unicast filter
 * logic. This function validates a valid, supported configuration is
 * selected, and defaults to 1 Unicast address if an unsupported
 * configuration is selected.
 */
static int dwmac1000_validate_ucast_entries(struct device *dev,
					    int ucast_entries)
{}

/**
 * stmmac_axi_setup - parse DT parameters for programming the AXI register
 * @pdev: platform device
 * Description:
 * if required, from device-tree the AXI internal register can be tuned
 * by using platform parameters.
 */
static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
{}

/**
 * stmmac_mtl_setup - parse DT parameters for multiple queues configuration
 * @pdev: platform device
 * @plat: enet data
 */
static int stmmac_mtl_setup(struct platform_device *pdev,
			    struct plat_stmmacenet_data *plat)
{}

/**
 * stmmac_of_get_mdio() - Gets the MDIO bus from the devicetree.
 * @np: devicetree node
 *
 * The MDIO bus will be searched for in the following ways:
 * 1. The compatible is "snps,dwc-qos-ethernet-4.10" && a "mdio" named
 *    child node exists
 * 2. A child node with the "snps,dwmac-mdio" compatible is present
 *
 * Return: The MDIO node if present otherwise NULL
 */
static struct device_node *stmmac_of_get_mdio(struct device_node *np)
{}

/**
 * stmmac_mdio_setup() - Populate platform related MDIO structures.
 * @plat: driver data platform structure
 * @np: devicetree node
 * @dev: device pointer
 *
 * This searches for MDIO information from the devicetree.
 * If an MDIO node is found, it's assigned to plat->mdio_node and
 * plat->mdio_bus_data is allocated.
 * If no connection can be determined, just plat->mdio_bus_data is allocated
 * to indicate a bus should be created and scanned for a phy.
 * If it's determined there's no MDIO bus needed, both are left NULL.
 *
 * This expects that plat->phy_node has already been searched for.
 *
 * Return: 0 on success, errno otherwise.
 */
static int stmmac_mdio_setup(struct plat_stmmacenet_data *plat,
			     struct device_node *np, struct device *dev)
{}

/**
 * stmmac_of_get_mac_mode - retrieves the interface of the MAC
 * @np: - device-tree node
 * Description:
 * Similar to `of_get_phy_mode()`, this function will retrieve (from
 * the device-tree) the interface mode on the MAC side. This assumes
 * that there is mode converter in-between the MAC & PHY
 * (e.g. GMII-to-RGMII).
 */
static int stmmac_of_get_mac_mode(struct device_node *np)
{}

/**
 * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt()
 * @pdev: platform_device structure
 * @plat: driver data platform structure
 *
 * Release resources claimed by stmmac_probe_config_dt().
 */
static void stmmac_remove_config_dt(struct platform_device *pdev,
				    struct plat_stmmacenet_data *plat)
{}

/**
 * stmmac_probe_config_dt - parse device-tree driver parameters
 * @pdev: platform_device structure
 * @mac: MAC address to use
 * Description:
 * this function is to read the driver parameters from device-tree and
 * set some private fields that will be used by the main at runtime.
 */
static struct plat_stmmacenet_data *
stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
{}

static void devm_stmmac_remove_config_dt(void *data)
{}

/**
 * devm_stmmac_probe_config_dt
 * @pdev: platform_device structure
 * @mac: MAC address to use
 * Description: Devres variant of stmmac_probe_config_dt(). Does not require
 * the user to call stmmac_remove_config_dt() at driver detach.
 */
struct plat_stmmacenet_data *
devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
{}
#else
struct plat_stmmacenet_data *
devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
{
	return ERR_PTR(-EINVAL);
}
#endif /* CONFIG_OF */
EXPORT_SYMBOL_GPL();

int stmmac_get_platform_resources(struct platform_device *pdev,
				  struct stmmac_resources *stmmac_res)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmmac_pltfr_init
 * @pdev: pointer to the platform device
 * @plat: driver data platform structure
 * Description: Call the platform's init callback (if any) and propagate
 * the return value.
 */
static int stmmac_pltfr_init(struct platform_device *pdev,
			     struct plat_stmmacenet_data *plat)
{}

/**
 * stmmac_pltfr_exit
 * @pdev: pointer to the platform device
 * @plat: driver data platform structure
 * Description: Call the platform's exit callback (if any).
 */
static void stmmac_pltfr_exit(struct platform_device *pdev,
			      struct plat_stmmacenet_data *plat)
{}

/**
 * stmmac_pltfr_probe
 * @pdev: platform device pointer
 * @plat: driver data platform structure
 * @res: stmmac resources structure
 * Description: This calls the platform's init() callback and probes the
 * stmmac driver.
 */
int stmmac_pltfr_probe(struct platform_device *pdev,
		       struct plat_stmmacenet_data *plat,
		       struct stmmac_resources *res)
{}
EXPORT_SYMBOL_GPL();

static void devm_stmmac_pltfr_remove(void *data)
{}

/**
 * devm_stmmac_pltfr_probe
 * @pdev: pointer to the platform device
 * @plat: driver data platform structure
 * @res: stmmac resources
 * Description: Devres variant of stmmac_pltfr_probe(). Allows users to skip
 * calling stmmac_pltfr_remove() on driver detach.
 */
int devm_stmmac_pltfr_probe(struct platform_device *pdev,
			    struct plat_stmmacenet_data *plat,
			    struct stmmac_resources *res)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmmac_pltfr_remove
 * @pdev: pointer to the platform device
 * Description: This undoes the effects of stmmac_pltfr_probe() by removing the
 * driver and calling the platform's exit() callback.
 */
void stmmac_pltfr_remove(struct platform_device *pdev)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmmac_pltfr_suspend
 * @dev: device pointer
 * Description: this function is invoked when suspend the driver and it direcly
 * call the main suspend function and then, if required, on some platform, it
 * can call an exit helper.
 */
static int __maybe_unused stmmac_pltfr_suspend(struct device *dev)
{}

/**
 * stmmac_pltfr_resume
 * @dev: device pointer
 * Description: this function is invoked when resume the driver before calling
 * the main resume function, on some platforms, it can call own init helper
 * if required.
 */
static int __maybe_unused stmmac_pltfr_resume(struct device *dev)
{}

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

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

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

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

const struct dev_pm_ops stmmac_pltfr_pm_ops =;
EXPORT_SYMBOL_GPL();

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