linux/drivers/soc/apple/mailbox.c

// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
 * Apple mailbox driver
 *
 * Copyright The Asahi Linux Contributors
 *
 * This driver adds support for two mailbox variants (called ASC and M3 by
 * Apple) found in Apple SoCs such as the M1. It consists of two FIFOs used to
 * exchange 64+32 bit messages between the main CPU and a co-processor.
 * Various coprocessors implement different IPC protocols based on these simple
 * messages and shared memory buffers.
 *
 * Both the main CPU and the co-processor see the same set of registers but
 * the first FIFO (A2I) is always used to transfer messages from the application
 * processor (us) to the I/O processor and the second one (I2A) for the
 * other direction.
 */

#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#include "mailbox.h"

#define APPLE_ASC_MBOX_CONTROL_FULL
#define APPLE_ASC_MBOX_CONTROL_EMPTY

#define APPLE_ASC_MBOX_A2I_CONTROL
#define APPLE_ASC_MBOX_A2I_SEND0
#define APPLE_ASC_MBOX_A2I_SEND1
#define APPLE_ASC_MBOX_A2I_RECV0
#define APPLE_ASC_MBOX_A2I_RECV1

#define APPLE_ASC_MBOX_I2A_CONTROL
#define APPLE_ASC_MBOX_I2A_SEND0
#define APPLE_ASC_MBOX_I2A_SEND1
#define APPLE_ASC_MBOX_I2A_RECV0
#define APPLE_ASC_MBOX_I2A_RECV1

#define APPLE_M3_MBOX_CONTROL_FULL
#define APPLE_M3_MBOX_CONTROL_EMPTY

#define APPLE_M3_MBOX_A2I_CONTROL
#define APPLE_M3_MBOX_A2I_SEND0
#define APPLE_M3_MBOX_A2I_SEND1
#define APPLE_M3_MBOX_A2I_RECV0
#define APPLE_M3_MBOX_A2I_RECV1

#define APPLE_M3_MBOX_I2A_CONTROL
#define APPLE_M3_MBOX_I2A_SEND0
#define APPLE_M3_MBOX_I2A_SEND1
#define APPLE_M3_MBOX_I2A_RECV0
#define APPLE_M3_MBOX_I2A_RECV1

#define APPLE_M3_MBOX_IRQ_ENABLE
#define APPLE_M3_MBOX_IRQ_ACK
#define APPLE_M3_MBOX_IRQ_A2I_EMPTY
#define APPLE_M3_MBOX_IRQ_A2I_NOT_EMPTY
#define APPLE_M3_MBOX_IRQ_I2A_EMPTY
#define APPLE_M3_MBOX_IRQ_I2A_NOT_EMPTY

#define APPLE_MBOX_MSG1_OUTCNT
#define APPLE_MBOX_MSG1_INCNT
#define APPLE_MBOX_MSG1_OUTPTR
#define APPLE_MBOX_MSG1_INPTR
#define APPLE_MBOX_MSG1_MSG

#define APPLE_MBOX_TX_TIMEOUT

struct apple_mbox_hw {};

int apple_mbox_send(struct apple_mbox *mbox, const struct apple_mbox_msg msg,
		    bool atomic)
{}
EXPORT_SYMBOL();

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

static int apple_mbox_poll_locked(struct apple_mbox *mbox)
{}

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

int apple_mbox_poll(struct apple_mbox *mbox)
{}
EXPORT_SYMBOL();

int apple_mbox_start(struct apple_mbox *mbox)
{}
EXPORT_SYMBOL();

void apple_mbox_stop(struct apple_mbox *mbox)
{}
EXPORT_SYMBOL();

struct apple_mbox *apple_mbox_get(struct device *dev, int index)
{}
EXPORT_SYMBOL();

struct apple_mbox *apple_mbox_get_byname(struct device *dev, const char *name)
{}
EXPORT_SYMBOL();

static int apple_mbox_probe(struct platform_device *pdev)
{}

static const struct apple_mbox_hw apple_mbox_asc_hw =;

static const struct apple_mbox_hw apple_mbox_m3_hw =;

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

static struct platform_driver apple_mbox_driver =;
module_platform_driver();

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