linux/drivers/misc/pch_phub.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/string.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/if_ether.h>
#include <linux/ctype.h>
#include <linux/dmi.h>
#include <linux/of.h>

#define PHUB_STATUS
#define PHUB_CONTROL
#define PHUB_TIMEOUT
#define PCH_PHUB_ROM_WRITE_ENABLE
#define PCH_PHUB_ROM_WRITE_DISABLE
#define PCH_PHUB_MAC_START_ADDR_EG20T
#define PCH_PHUB_MAC_START_ADDR_ML7223
#define PCH_PHUB_ROM_START_ADDR_EG20T
#define PCH_PHUB_ROM_START_ADDR_ML7213
#define PCH_PHUB_ROM_START_ADDR_ML7223

/* MAX number of INT_REDUCE_CONTROL registers */
#define MAX_NUM_INT_REDUCE_CONTROL_REG
#define PCI_DEVICE_ID_PCH1_PHUB
#define PCH_MINOR_NOS
#define CLKCFG_CAN_50MHZ
#define CLKCFG_CANCLK_MASK
#define CLKCFG_UART_MASK

/* CM-iTC */
#define CLKCFG_UART_48MHZ
#define CLKCFG_UART_25MHZ
#define CLKCFG_BAUDDIV
#define CLKCFG_PLL2VCO
#define CLKCFG_UARTCLKSEL

/* Macros for ML7213 */
#define PCI_DEVICE_ID_ROHM_ML7213_PHUB

/* Macros for ML7223 */
#define PCI_DEVICE_ID_ROHM_ML7223_mPHUB
#define PCI_DEVICE_ID_ROHM_ML7223_nPHUB

/* Macros for ML7831 */
#define PCI_DEVICE_ID_ROHM_ML7831_PHUB

/* SROM ACCESS Macro */
#define PCH_WORD_ADDR_MASK

/* Registers address offset */
#define PCH_PHUB_ID_REG
#define PCH_PHUB_QUEUE_PRI_VAL_REG
#define PCH_PHUB_RC_QUEUE_MAXSIZE_REG
#define PCH_PHUB_BRI_QUEUE_MAXSIZE_REG
#define PCH_PHUB_COMP_RESP_TIMEOUT_REG
#define PCH_PHUB_BUS_SLAVE_CONTROL_REG
#define PCH_PHUB_DEADLOCK_AVOID_TYPE_REG
#define PCH_PHUB_INTPIN_REG_WPERMIT_REG0
#define PCH_PHUB_INTPIN_REG_WPERMIT_REG1
#define PCH_PHUB_INTPIN_REG_WPERMIT_REG2
#define PCH_PHUB_INTPIN_REG_WPERMIT_REG3
#define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE
#define CLKCFG_REG_OFFSET
#define FUNCSEL_REG_OFFSET

#define PCH_PHUB_OROM_SIZE

/**
 * struct pch_phub_reg - PHUB register structure
 * @phub_id_reg:			PHUB_ID register val
 * @q_pri_val_reg:			QUEUE_PRI_VAL register val
 * @rc_q_maxsize_reg:			RC_QUEUE_MAXSIZE register val
 * @bri_q_maxsize_reg:			BRI_QUEUE_MAXSIZE register val
 * @comp_resp_timeout_reg:		COMP_RESP_TIMEOUT register val
 * @bus_slave_control_reg:		BUS_SLAVE_CONTROL_REG register val
 * @deadlock_avoid_type_reg:		DEADLOCK_AVOID_TYPE register val
 * @intpin_reg_wpermit_reg0:		INTPIN_REG_WPERMIT register 0 val
 * @intpin_reg_wpermit_reg1:		INTPIN_REG_WPERMIT register 1 val
 * @intpin_reg_wpermit_reg2:		INTPIN_REG_WPERMIT register 2 val
 * @intpin_reg_wpermit_reg3:		INTPIN_REG_WPERMIT register 3 val
 * @int_reduce_control_reg:		INT_REDUCE_CONTROL registers val
 * @clkcfg_reg:				CLK CFG register val
 * @funcsel_reg:			Function select register value
 * @pch_phub_base_address:		Register base address
 * @pch_phub_extrom_base_address:	external rom base address
 * @pch_mac_start_address:		MAC address area start address
 * @pch_opt_rom_start_address:		Option ROM start address
 * @ioh_type:				Save IOH type
 * @pdev:				pointer to pci device struct
 */
struct pch_phub_reg {};

/* SROM SPEC for MAC address assignment offset */
static const int pch_phub_mac_offset[ETH_ALEN] =;

static DEFINE_MUTEX(pch_phub_mutex);

/**
 * pch_phub_read_modify_write_reg() - Reading modifying and writing register
 * @chip:		Pointer to the PHUB register structure
 * @reg_addr_offset:	Register offset address value.
 * @data:		Writing value.
 * @mask:		Mask value.
 */
static void pch_phub_read_modify_write_reg(struct pch_phub_reg *chip,
					   unsigned int reg_addr_offset,
					   unsigned int data, unsigned int mask)
{}

/* pch_phub_save_reg_conf - saves register configuration */
static void __maybe_unused pch_phub_save_reg_conf(struct pci_dev *pdev)
{}

/* pch_phub_restore_reg_conf - restore register configuration */
static void __maybe_unused pch_phub_restore_reg_conf(struct pci_dev *pdev)
{}

/**
 * pch_phub_read_serial_rom() - Reading Serial ROM
 * @chip:		Pointer to the PHUB register structure
 * @offset_address:	Serial ROM offset address to read.
 * @data:		Read buffer for specified Serial ROM value.
 */
static void pch_phub_read_serial_rom(struct pch_phub_reg *chip,
				     unsigned int offset_address, u8 *data)
{}

/**
 * pch_phub_write_serial_rom() - Writing Serial ROM
 * @chip:		Pointer to the PHUB register structure
 * @offset_address:	Serial ROM offset address.
 * @data:		Serial ROM value to write.
 */
static int pch_phub_write_serial_rom(struct pch_phub_reg *chip,
				     unsigned int offset_address, u8 data)
{}

/**
 * pch_phub_read_serial_rom_val() - Read Serial ROM value
 * @chip:		Pointer to the PHUB register structure
 * @offset_address:	Serial ROM address offset value.
 * @data:		Serial ROM value to read.
 */
static void pch_phub_read_serial_rom_val(struct pch_phub_reg *chip,
					 unsigned int offset_address, u8 *data)
{}

/**
 * pch_phub_write_serial_rom_val() - writing Serial ROM value
 * @chip:		Pointer to the PHUB register structure
 * @offset_address:	Serial ROM address offset value.
 * @data:		Serial ROM value.
 */
static int pch_phub_write_serial_rom_val(struct pch_phub_reg *chip,
					 unsigned int offset_address, u8 data)
{}

/* pch_phub_gbe_serial_rom_conf - makes Serial ROM header format configuration
 * for Gigabit Ethernet MAC address
 */
static int pch_phub_gbe_serial_rom_conf(struct pch_phub_reg *chip)
{}

/* pch_phub_gbe_serial_rom_conf_mp - makes SerialROM header format configuration
 * for Gigabit Ethernet MAC address
 */
static int pch_phub_gbe_serial_rom_conf_mp(struct pch_phub_reg *chip)
{}

/**
 * pch_phub_read_gbe_mac_addr() - Read Gigabit Ethernet MAC address
 * @chip:		Pointer to the PHUB register structure
 * @data:		Buffer of the Gigabit Ethernet MAC address value.
 */
static void pch_phub_read_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
{}

/**
 * pch_phub_write_gbe_mac_addr() - Write MAC address
 * @chip:		Pointer to the PHUB register structure
 * @data:		Gigabit Ethernet MAC address value.
 */
static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data)
{}

static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
				 struct bin_attribute *attr, char *buf,
				 loff_t off, size_t count)
{}

static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj,
				  struct bin_attribute *attr,
				  char *buf, loff_t off, size_t count)
{}

static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr,
			    char *buf)
{}

static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{}

static DEVICE_ATTR(pch_mac, S_IRUGO | S_IWUSR, show_pch_mac, store_pch_mac);

static const struct bin_attribute pch_bin_attr =;

static int pch_phub_probe(struct pci_dev *pdev,
				    const struct pci_device_id *id)
{}

static void pch_phub_remove(struct pci_dev *pdev)
{}

static int __maybe_unused pch_phub_suspend(struct device *dev_d)
{}

static int __maybe_unused pch_phub_resume(struct device *dev_d)
{}

static const struct pci_device_id pch_phub_pcidev_id[] =;
MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);

static SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume);

static struct pci_driver pch_phub_driver =;

module_pci_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();