linux/drivers/soc/aspeed/aspeed-p2a-ctrl.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright 2019 Google Inc
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * Provides a simple driver to control the ASPEED P2A interface which allows
 * the host to read and write to various regions of the BMC's memory.
 */

#include <linux/fs.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/uaccess.h>

#include <linux/aspeed-p2a-ctrl.h>

#define DEVICE_NAME

/* SCU2C is a Misc. Control Register. */
#define SCU2C
/* SCU180 is the PCIe Configuration Setting Control Register. */
#define SCU180
/* Bit 1 controls the P2A bridge, while bit 0 controls the entire VGA device
 * on the PCI bus.
 */
#define SCU180_ENP2A

/* The ast2400/2500 both have six ranges. */
#define P2A_REGION_COUNT

struct region {};

struct aspeed_p2a_model_data {};

struct aspeed_p2a_ctrl {};

struct aspeed_p2a_user {};

static void aspeed_p2a_enable_bridge(struct aspeed_p2a_ctrl *p2a_ctrl)
{}

static void aspeed_p2a_disable_bridge(struct aspeed_p2a_ctrl *p2a_ctrl)
{}

static int aspeed_p2a_mmap(struct file *file, struct vm_area_struct *vma)
{}

static bool aspeed_p2a_region_acquire(struct aspeed_p2a_user *priv,
		struct aspeed_p2a_ctrl *ctrl,
		struct aspeed_p2a_ctrl_mapping *map)
{}

static long aspeed_p2a_ioctl(struct file *file, unsigned int cmd,
		unsigned long data)
{}


/*
 * When a user opens this file, we create a structure to track their mappings.
 *
 * A user can map a region as read-only (bridge enabled), or read-write (bit
 * flipped, and bridge enabled).  Either way, this tracking is used, s.t. when
 * they release the device references are handled.
 *
 * The bridge is not enabled until a user calls an ioctl to map a region,
 * simply opening the device does not enable it.
 */
static int aspeed_p2a_open(struct inode *inode, struct file *file)
{}

/*
 * This will close the users mappings.  It will go through what they had opened
 * for readwrite, and decrement those counts.  If at the end, this is the last
 * user, it'll close the bridge.
 */
static int aspeed_p2a_release(struct inode *inode, struct file *file)
{}

static const struct file_operations aspeed_p2a_ctrl_fops =;

/* The regions are controlled by SCU2C */
static void aspeed_p2a_disable_all(struct aspeed_p2a_ctrl *p2a_ctrl)
{}

static int aspeed_p2a_ctrl_probe(struct platform_device *pdev)
{}

static void aspeed_p2a_ctrl_remove(struct platform_device *pdev)
{}

#define SCU2C_DRAM
#define SCU2C_SPI
#define SCU2C_SOC
#define SCU2C_FLASH

static const struct aspeed_p2a_model_data ast2400_model_data =;

static const struct aspeed_p2a_model_data ast2500_model_data =;

static const struct of_device_id aspeed_p2a_ctrl_match[] =;

static struct platform_driver aspeed_p2a_ctrl_driver =;

module_platform_driver();

MODULE_DEVICE_TABLE(of, aspeed_p2a_ctrl_match);
MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();