linux/drivers/net/wireless/ath/ath10k/sdio.c

// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2004-2011 Atheros Communications Inc.
 * Copyright (c) 2011-2012,2017 Qualcomm Atheros, Inc.
 * Copyright (c) 2016-2017 Erik Stromdahl <[email protected]>
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
#include <linux/mmc/card.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sd.h>
#include <linux/bitfield.h>
#include "core.h"
#include "bmi.h"
#include "debug.h"
#include "hif.h"
#include "htc.h"
#include "mac.h"
#include "targaddrs.h"
#include "trace.h"
#include "sdio.h"
#include "coredump.h"

void ath10k_sdio_fw_crashed_dump(struct ath10k *ar);

#define ATH10K_SDIO_VSG_BUF_SIZE

/* inlined helper functions */

static inline int ath10k_sdio_calc_txrx_padded_len(struct ath10k_sdio *ar_sdio,
						   size_t len)
{}

static inline enum ath10k_htc_ep_id pipe_id_to_eid(u8 pipe_id)
{}

static inline void ath10k_sdio_mbox_free_rx_pkt(struct ath10k_sdio_rx_data *pkt)
{}

static inline int ath10k_sdio_mbox_alloc_rx_pkt(struct ath10k_sdio_rx_data *pkt,
						size_t act_len, size_t full_len,
						bool part_of_bundle,
						bool last_in_bundle)
{}

static inline bool is_trailer_only_msg(struct ath10k_sdio_rx_data *pkt)
{}

/* sdio/mmc functions */

static inline void ath10k_sdio_set_cmd52_arg(u32 *arg, u8 write, u8 raw,
					     unsigned int address,
					     unsigned char val)
{}

static int ath10k_sdio_func0_cmd52_wr_byte(struct mmc_card *card,
					   unsigned int address,
					   unsigned char byte)
{}

static int ath10k_sdio_func0_cmd52_rd_byte(struct mmc_card *card,
					   unsigned int address,
					   unsigned char *byte)
{}

static int ath10k_sdio_config(struct ath10k *ar)
{}

static int ath10k_sdio_write32(struct ath10k *ar, u32 addr, u32 val)
{}

static int ath10k_sdio_writesb32(struct ath10k *ar, u32 addr, u32 val)
{}

static int ath10k_sdio_read32(struct ath10k *ar, u32 addr, u32 *val)
{}

static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, size_t len)
{}

static int ath10k_sdio_write(struct ath10k *ar, u32 addr, const void *buf, size_t len)
{}

static int ath10k_sdio_readsb(struct ath10k *ar, u32 addr, void *buf, size_t len)
{}

/* HIF mbox functions */

static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar,
					      struct ath10k_sdio_rx_data *pkt,
					      u32 *lookaheads,
					      int *n_lookaheads)
{}

static int ath10k_sdio_mbox_rx_process_packets(struct ath10k *ar,
					       u32 lookaheads[],
					       int *n_lookahead)
{}

static int ath10k_sdio_mbox_alloc_bundle(struct ath10k *ar,
					 struct ath10k_sdio_rx_data *rx_pkts,
					 struct ath10k_htc_hdr *htc_hdr,
					 size_t full_len, size_t act_len,
					 size_t *bndl_cnt)
{}

static int ath10k_sdio_mbox_rx_alloc(struct ath10k *ar,
				     u32 lookaheads[], int n_lookaheads)
{}

static int ath10k_sdio_mbox_rx_fetch(struct ath10k *ar)
{}

static int ath10k_sdio_mbox_rx_fetch_bundle(struct ath10k *ar)
{}

/* This is the timeout for mailbox processing done in the sdio irq
 * handler. The timeout is deliberately set quite high since SDIO dump logs
 * over serial port can/will add a substantial overhead to the processing
 * (if enabled).
 */
#define SDIO_MBOX_PROCESSING_TIMEOUT_HZ

static int ath10k_sdio_mbox_rxmsg_pending_handler(struct ath10k *ar,
						  u32 msg_lookahead, bool *done)
{}

static int ath10k_sdio_mbox_proc_dbg_intr(struct ath10k *ar)
{}

static int ath10k_sdio_mbox_proc_counter_intr(struct ath10k *ar)
{}

static int ath10k_sdio_mbox_proc_err_intr(struct ath10k *ar)
{}

static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar)
{}

static int ath10k_sdio_mbox_read_int_status(struct ath10k *ar,
					    u8 *host_int_status,
					    u32 *lookahead)
{}

static int ath10k_sdio_mbox_proc_pending_irqs(struct ath10k *ar,
					      bool *done)
{}

static void ath10k_sdio_set_mbox_info(struct ath10k *ar)
{}

/* BMI functions */

static int ath10k_sdio_bmi_credits(struct ath10k *ar)
{}

static int ath10k_sdio_bmi_get_rx_lookahead(struct ath10k *ar)
{}

static int ath10k_sdio_bmi_exchange_msg(struct ath10k *ar,
					void *req, u32 req_len,
					void *resp, u32 *resp_len)
{}

/* sdio async handling functions */

static struct ath10k_sdio_bus_request
*ath10k_sdio_alloc_busreq(struct ath10k *ar)
{}

static void ath10k_sdio_free_bus_req(struct ath10k *ar,
				     struct ath10k_sdio_bus_request *bus_req)
{}

static void __ath10k_sdio_write_async(struct ath10k *ar,
				      struct ath10k_sdio_bus_request *req)
{}

/* To improve throughput use workqueue to deliver packets to HTC layer,
 * this way SDIO bus is utilised much better.
 */
static void ath10k_rx_indication_async_work(struct work_struct *work)
{}

static int ath10k_sdio_read_rtc_state(struct ath10k_sdio *ar_sdio, unsigned char *state)
{}

static int ath10k_sdio_set_mbox_sleep(struct ath10k *ar, bool enable_sleep)
{}

static void ath10k_sdio_sleep_timer_handler(struct timer_list *t)
{}

static void ath10k_sdio_write_async_work(struct work_struct *work)
{}

static int ath10k_sdio_prep_async_req(struct ath10k *ar, u32 addr,
				      struct sk_buff *skb,
				      struct completion *comp,
				      bool htc_msg, enum ath10k_htc_ep_id eid)
{}

/* IRQ handler */

static void ath10k_sdio_irq_handler(struct sdio_func *func)
{}

/* sdio HIF functions */

static int ath10k_sdio_disable_intrs(struct ath10k *ar)
{}

static int ath10k_sdio_hif_power_up(struct ath10k *ar,
				    enum ath10k_firmware_mode fw_mode)
{}

static void ath10k_sdio_hif_power_down(struct ath10k *ar)
{}

static int ath10k_sdio_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
				 struct ath10k_hif_sg_item *items, int n_items)
{}

static int ath10k_sdio_enable_intrs(struct ath10k *ar)
{}

/* HIF diagnostics */

static int ath10k_sdio_hif_diag_read(struct ath10k *ar, u32 address, void *buf,
				     size_t buf_len)
{}

static int ath10k_sdio_diag_read32(struct ath10k *ar, u32 address,
				   u32 *value)
{}

static int ath10k_sdio_hif_diag_write_mem(struct ath10k *ar, u32 address,
					  const void *data, int nbytes)
{}

static int ath10k_sdio_hif_start_post(struct ath10k *ar)
{}

static int ath10k_sdio_get_htt_tx_complete(struct ath10k *ar)
{}

/* HIF start/stop */

static int ath10k_sdio_hif_start(struct ath10k *ar)
{}

#define SDIO_IRQ_DISABLE_TIMEOUT_HZ

static void ath10k_sdio_irq_disable(struct ath10k *ar)
{}

static void ath10k_sdio_hif_stop(struct ath10k *ar)
{}

#ifdef CONFIG_PM

static int ath10k_sdio_hif_suspend(struct ath10k *ar)
{}

static int ath10k_sdio_hif_resume(struct ath10k *ar)
{}
#endif

static int ath10k_sdio_hif_map_service_to_pipe(struct ath10k *ar,
					       u16 service_id,
					       u8 *ul_pipe, u8 *dl_pipe)
{}

static void ath10k_sdio_hif_get_default_pipe(struct ath10k *ar,
					     u8 *ul_pipe, u8 *dl_pipe)
{}

static const struct ath10k_hif_ops ath10k_sdio_hif_ops =;

#ifdef CONFIG_PM_SLEEP

/* Empty handlers so that mmc subsystem doesn't remove us entirely during
 * suspend. We instead follow cfg80211 suspend/resume handlers.
 */
static int ath10k_sdio_pm_suspend(struct device *device)
{}

static int ath10k_sdio_pm_resume(struct device *device)
{}

static SIMPLE_DEV_PM_OPS(ath10k_sdio_pm_ops, ath10k_sdio_pm_suspend,
			 ath10k_sdio_pm_resume);

#define ATH10K_SDIO_PM_OPS

#else

#define ATH10K_SDIO_PM_OPS

#endif /* CONFIG_PM_SLEEP */

static int ath10k_sdio_napi_poll(struct napi_struct *ctx, int budget)
{}

static int ath10k_sdio_read_host_interest_value(struct ath10k *ar,
						u32 item_offset,
						u32 *val)
{}

static int ath10k_sdio_read_mem(struct ath10k *ar, u32 address, void *buf,
				u32 buf_len)
{}

static bool ath10k_sdio_is_fast_dump_supported(struct ath10k *ar)
{}

static void ath10k_sdio_dump_registers(struct ath10k *ar,
				       struct ath10k_fw_crash_data *crash_data,
				       bool fast_dump)
{}

static int ath10k_sdio_dump_memory_section(struct ath10k *ar,
					   const struct ath10k_mem_region *mem_region,
					   u8 *buf, size_t buf_len)
{}

/* if an error happened returns < 0, otherwise the length */
static int ath10k_sdio_dump_memory_generic(struct ath10k *ar,
					   const struct ath10k_mem_region *current_region,
					   u8 *buf,
					   bool fast_dump)
{}

static void ath10k_sdio_dump_memory(struct ath10k *ar,
				    struct ath10k_fw_crash_data *crash_data,
				    bool fast_dump)
{}

void ath10k_sdio_fw_crashed_dump(struct ath10k *ar)
{}

static int ath10k_sdio_probe(struct sdio_func *func,
			     const struct sdio_device_id *id)
{}

static void ath10k_sdio_remove(struct sdio_func *func)
{}

static const struct sdio_device_id ath10k_sdio_devices[] =;

MODULE_DEVICE_TABLE(sdio, ath10k_sdio_devices);

static struct sdio_driver ath10k_sdio_driver =;
module_sdio_driver();

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