linux/drivers/bluetooth/hci_aml.c

// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
/*
 * Copyright (C) 2024 Amlogic, Inc. All rights reserved
 */

#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/property.h>
#include <linux/of.h>
#include <linux/serdev.h>
#include <linux/clk.h>
#include <linux/firmware.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci.h>

#include "hci_uart.h"

#define AML_EVT_HEAD_SIZE
#define AML_BDADDR_DEFAULT

#define AML_FIRMWARE_OPERATION_SIZE
#define AML_FIRMWARE_MAX_SIZE

/* TCI command */
#define AML_TCI_CMD_READ
#define AML_TCI_CMD_WRITE
#define AML_TCI_CMD_UPDATE_BAUDRATE
#define AML_TCI_CMD_HARDWARE_RESET
#define AML_TCI_CMD_DOWNLOAD_BT_FW

/* Vendor command */
#define AML_BT_HCI_VENDOR_CMD

/* TCI operation parameter in controller chip */
#define AML_OP_UART_MODE
#define AML_OP_EVT_ENABLE
#define AML_OP_MEM_HARD_TRANS_EN
#define AML_OP_RF_CFG
#define AML_OP_RAM_POWER_CTR
#define AML_OP_HARDWARE_RST
#define AML_OP_ICCM_RAM_BASE
#define AML_OP_DCCM_RAM_BASE

/* UART configuration */
#define AML_UART_XMIT_EN
#define AML_UART_RECV_EN
#define AML_UART_TIMEOUT_INT_EN
#define AML_UART_CLK_SOURCE

/* Controller event */
#define AML_EVT_EN

/* RAM power control */
#define AML_RAM_POWER_ON
#define AML_RAM_POWER_OFF

/* RF configuration */
#define AML_RF_ANT_SINGLE
#define AML_RF_ANT_DOUBLE

/* Memory transaction */
#define AML_MM_CTR_HARD_TRAS_EN

/* Controller reset */
#define AML_CTR_CPU_RESET
#define AML_CTR_MAC_RESET
#define AML_CTR_PHY_RESET

enum {};

struct aml_fw_len {};

struct aml_tci_rsp {} __packed;

struct aml_device_data {};

struct aml_serdev {};

struct aml_data {};

static const struct h4_recv_pkt aml_recv_pkts[] =;

/* The TCI command is a private command, which is for setting baud rate,
 * downloading firmware, initiating RAM.
 *
 * op_code |      op_len           | op_addr | parameter   |
 * --------|-----------------------|---------|-------------|
 *   2B    | 1B len(addr+param)    |    4B   |  len(param) |
 */
static int aml_send_tci_cmd(struct hci_dev *hdev, u16 op_code, u32 op_addr,
			    u32 *param, u32 param_len)
{}

static int aml_update_chip_baudrate(struct hci_dev *hdev, u32 baud)
{}

static int aml_start_chip(struct hci_dev *hdev)
{}

static int aml_send_firmware_segment(struct hci_dev *hdev,
				     u8 fw_type,
				     u8 *seg,
				     u32 seg_size,
				     u32 offset)
{}

static int aml_send_firmware(struct hci_dev *hdev, u8 fw_type,
			     u8 *fw, u32 fw_size, u32 offset)
{}

static int aml_download_firmware(struct hci_dev *hdev, const char *fw_name)
{}

static int aml_send_reset(struct hci_dev *hdev)
{}

static int aml_dump_fw_version(struct hci_dev *hdev)
{}

static int aml_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
{}

static int aml_check_bdaddr(struct hci_dev *hdev)
{}

static int aml_config_rf(struct hci_dev *hdev, bool is_coex)
{}

static int aml_parse_dt(struct aml_serdev *amldev)
{}

static int aml_power_on(struct aml_serdev *amldev)
{}

static int aml_power_off(struct aml_serdev *amldev)
{}

static int aml_set_baudrate(struct hci_uart *hu, unsigned int speed)
{}

/* Initialize protocol */
static int aml_open(struct hci_uart *hu)
{}

static int aml_close(struct hci_uart *hu)
{}

static int aml_flush(struct hci_uart *hu)
{}

static int aml_setup(struct hci_uart *hu)
{}

static int aml_enqueue(struct hci_uart *hu, struct sk_buff *skb)
{}

static struct sk_buff *aml_dequeue(struct hci_uart *hu)
{}

static int aml_recv(struct hci_uart *hu, const void *data, int count)
{}

static const struct hci_uart_proto aml_hci_proto =;

static void aml_device_driver_shutdown(struct device *dev)
{}

static int aml_serdev_probe(struct serdev_device *serdev)
{}

static void aml_serdev_remove(struct serdev_device *serdev)
{}

static const struct aml_device_data data_w155s2 =;

static const struct aml_device_data data_w265s2 =;

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

static struct serdev_device_driver aml_serdev_driver =;

int __init aml_init(void)
{}

int __exit aml_deinit(void)
{}