From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 445BB2C2346 for ; Thu, 30 Apr 2026 04:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777525044; cv=none; b=rq+qSOnyLjsFmwyA0ZP3/msbf2DUL6RPZXxI45SYV9E+GgUaF4xjJJxu99+DtN9h5QADaat9/QkY+wMdmwcu5TSeb0dxZCvsQ5lrEGenznehHZUMHvEWAcqLObFLFkb8ATq+OL5bwdV3iUuHrzdmDhFTBFgu/F2M1kQwqAJtsbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777525044; c=relaxed/simple; bh=9cgrVmILa2osJR/5b2wSJKlz6VohPPL6tweliwJXwpI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g6sYFJeyqKXfSFdUEjQLuJHevicN5Db6Bl8ssJk3LpP/JkXBjve3pi1Ubn2QZuT0MvrTDT5D9TvFJHYsHllV9Ecc5aeCOqcxj0EFQXaYcg7fHK4AM69bihBaUHujKpTJgAV2tK2Hr19LpIBQ0nR/farOSDbEbDRtchyFvNbyqLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=morsemicro.com; spf=pass smtp.mailfrom=morsemicro.com; dkim=pass (2048-bit key) header.d=morsemicro-com.20251104.gappssmtp.com header.i=@morsemicro-com.20251104.gappssmtp.com header.b=GSUaJQgd; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=morsemicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=morsemicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=morsemicro-com.20251104.gappssmtp.com header.i=@morsemicro-com.20251104.gappssmtp.com header.b="GSUaJQgd" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-c7971d0d97dso266414a12.1 for ; Wed, 29 Apr 2026 21:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20251104.gappssmtp.com; s=20251104; t=1777525042; x=1778129842; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7T/9P9GeLp7WaMB4x4lTxH07fOZQmcHmhJKRuB/evVc=; b=GSUaJQgdG3GAkGo3vlA4IZEcTNQelBjbA4GNvJXTxpQHyaiA3+PHDSSjFLOkFs8qHg nGcIdGnkB5Ys4yQKwpL4dh2wHmKsseRs7XM/T1tTzPyLvRcOdcdftwd4MLyecBFWdcZ5 b5lg5nhFZjnYerDGYDleoDb+kJ0pGUmqDGgAUoQiccQx2if/o74Kvrf/6r+hesSghraF /RreCWTHDjwzQZUovqXGg3dYSTioVofgQ05qlrWJKuzgEXy8mMETlFcam+PR2ETjNWBV lNjU4GaHROX0QIqCVPhEFVSiQAx2Ht+vuGs5M7FGzdUP+aPGU7s+s3KV9v2EsK2YaGRU hySg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777525042; x=1778129842; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7T/9P9GeLp7WaMB4x4lTxH07fOZQmcHmhJKRuB/evVc=; b=I+WNNTMqrx+8C1wal/LCSq6iAFv0FMB0W7uoKjUzKAsDUpm/wuMqiB0h1rVmz9/oqF J1fXTCxj2z09K3LHNrfYzwpaeHKnXP6R5F+nZ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Received: by 2002:a05:6a00:1821:b0:82f:964c:e3d0 with SMTP id d2e1a72fcca58-834fdc49ee1mr1883308b3a.39.1777525042434; Wed, 29 Apr 2026 21:57:22 -0700 (PDT) Received: from mma-H9MHD44.lan (60-242-93-14.static.tpgi.com.au. [60.242.93.14]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-834ed80df96sm3595073b3a.54.2026.04.29.21.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2026 21:57:22 -0700 (PDT) From: Lachlan Hodges To: johannes@sipsolutions.net, Lachlan Hodges , Dan Callaghan , Arien Judge Cc: ayman.grais@morsemicro.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH wireless-next v2 09/31] wifi: mm81x: add hif.h Date: Thu, 30 Apr 2026 14:55:35 +1000 Message-ID: <20260430045615.334669-10-lachlan.hodges@morsemicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430045615.334669-1-lachlan.hodges@morsemicro.com> References: <20260430045615.334669-1-lachlan.hodges@morsemicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit (Patches split per file for review, will be a single commit alongside SDIO ids once review is complete. See cover letter for more information) Signed-off-by: Lachlan Hodges --- drivers/net/wireless/morsemicro/mm81x/hif.h | 117 ++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 drivers/net/wireless/morsemicro/mm81x/hif.h diff --git a/drivers/net/wireless/morsemicro/mm81x/hif.h b/drivers/net/wireless/morsemicro/mm81x/hif.h new file mode 100644 index 000000000000..e3d23423049a --- /dev/null +++ b/drivers/net/wireless/morsemicro/mm81x/hif.h @@ -0,0 +1,117 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2017-2026 Morse Micro + */ + +#ifndef _MM81X_HIF_H_ +#define _MM81X_HIF_H_ + +#include "core.h" + +struct mm81x_skbq; + +#define MM81X_HIF_BYPASS_TX_STATUS_IRQ_NUM (15) +#define MM81X_HIF_BYPASS_CMD_RESP_IRQ_NUM (29) +#define MM81X_HIF_IRQ_BYPASS_TX_STATUS_AVAILABLE \ + BIT(MM81X_HIF_BYPASS_TX_STATUS_IRQ_NUM) +#define MM81X_HIF_IRQ_BYPASS_CMD_RESP_AVAILABLE \ + BIT(MM81X_HIF_BYPASS_CMD_RESP_IRQ_NUM) + +/* Hardware IF interrupt mask. We may use any interrupts in this range */ +#define MM81X_HIF_IRQ_MASK_ALL \ + (GENMASK(13, 0) | MM81X_HIF_IRQ_BYPASS_TX_STATUS_AVAILABLE | \ + MM81X_HIF_IRQ_BYPASS_CMD_RESP_AVAILABLE) + +enum mm81x_hif_flags { + MM81X_HIF_FLAGS_DIR_TO_HOST = BIT(0), + MM81X_HIF_FLAGS_DIR_TO_CHIP = BIT(1), + MM81X_HIF_FLAGS_COMMAND = BIT(2), + MM81X_HIF_FLAGS_BEACON = BIT(3), + MM81X_HIF_FLAGS_DATA = BIT(4) +}; + +struct mm81x_hif_ops { + int (*init)(struct mm81x *mors); + void (*flush_tx_data)(struct mm81x *mors); + void (*flush_cmds)(struct mm81x *mors); + void (*finish)(struct mm81x *mors); + void (*skbq_get_tx_qs)(struct mm81x *mors, struct mm81x_skbq **qs, + int *num_qs); + struct mm81x_skbq *(*get_tx_cmd_queue)(struct mm81x *mors); + struct mm81x_skbq *(*get_tx_beacon_queue)(struct mm81x *mors); + struct mm81x_skbq *(*get_tx_mgmt_queue)(struct mm81x *mors); + struct mm81x_skbq *(*get_tx_data_queue)(struct mm81x *mors, int aci); + int (*handle_irq)(struct mm81x *mors, u32 status); + int (*get_tx_buffered_count)(struct mm81x *mors); + int (*get_tx_status_pending_count)(struct mm81x *mors); +}; + +static inline void mm81x_hif_clear_events(struct mm81x *mors) +{ + mors->hif.event_flags = 0; +} + +static inline int mm81x_hif_init(struct mm81x *mors) +{ + return mors->hif.ops->init(mors); +} + +static inline void mm81x_hif_flush_tx_data(struct mm81x *mors) +{ + mors->hif.ops->flush_tx_data(mors); +} + +static inline void mm81x_hif_flush_cmds(struct mm81x *mors) +{ + mors->hif.ops->flush_cmds(mors); +} + +static inline void mm81x_hif_finish(struct mm81x *mors) +{ + mors->hif.ops->finish(mors); +} + +static inline void mm81x_hif_skbq_get_tx_qs(struct mm81x *mors, + struct mm81x_skbq **qs, int *num_qs) +{ + mors->hif.ops->skbq_get_tx_qs(mors, qs, num_qs); +} + +static inline struct mm81x_skbq *mm81x_hif_get_tx_cmd_queue(struct mm81x *mors) +{ + return mors->hif.ops->get_tx_cmd_queue(mors); +} + +static inline struct mm81x_skbq * +mm81x_hif_get_tx_beacon_queue(struct mm81x *mors) +{ + return mors->hif.ops->get_tx_beacon_queue(mors); +} + +static inline struct mm81x_skbq *mm81x_hif_get_tx_mgmt_queue(struct mm81x *mors) +{ + return mors->hif.ops->get_tx_mgmt_queue(mors); +} + +static inline struct mm81x_skbq *mm81x_hif_get_tx_data_queue(struct mm81x *mors, + int aci) +{ + return mors->hif.ops->get_tx_data_queue(mors, aci); +} + +static inline int mm81x_hif_handle_irq(struct mm81x *mors, u32 status) +{ + return mors->hif.ops->handle_irq(mors, status); +} + +static inline int mm81x_hif_get_tx_buffered_count(struct mm81x *mors) +{ + return mors->hif.ops->get_tx_buffered_count(mors); +} + +static inline int mm81x_hif_get_tx_status_pending_count(struct mm81x *mors) +{ + return mors->hif.ops->get_tx_status_pending_count(mors); +} + +#endif /* _MM81X_HIF_H_ */ -- 2.43.0