From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 1812D34575D for ; Fri, 27 Feb 2026 04:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772165507; cv=none; b=CXlmuIYN9CG+iNyODYQTYCc4KbKI7y+ZZdl63cljfgbPf4U0PHaD+9EkP7VweeUE0p8gmu67neIDJiUswXK6xIE+AygYB1YGIKrHXFcTN2FzoekfF61XEsT9tIq/cgvOyIcj/LmwbLXtL1jQaKmUvhkC8O63Xa9WsfFl/8A7xnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772165507; c=relaxed/simple; bh=c11IXnwxZ5RyIrOBBd15Hk6g/iseO2KVv2j6YYLopzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YUMSUoaTo3veWVRZBLe/rEUXnMMzXoN7VWfivK6FgVgY9hfpQHcUQGCmnnvsiQNEAZCGsIn1LlP02Pw54tX8mfTA2zhtmI+csCfsvIyEdTLBgXyyKipOeDEtVZlZCX+6AP/dwr2m+fGP1MS2faqE2RRjWBonAIlcsQAU3gQ14gQ= 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.20230601.gappssmtp.com header.i=@morsemicro-com.20230601.gappssmtp.com header.b=vwpPG05P; arc=none smtp.client-ip=209.85.214.177 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.20230601.gappssmtp.com header.i=@morsemicro-com.20230601.gappssmtp.com header.b="vwpPG05P" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2ad9a9be502so10922985ad.0 for ; Thu, 26 Feb 2026 20:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20230601.gappssmtp.com; s=20230601; t=1772165505; x=1772770305; 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=CxqowGzg2CaK2KHQ3yg4HgobTjZp7H6lsiRmrF05V2E=; b=vwpPG05P0upqUe01e0G/ZAGrLDINji7K/ZdZtOL7hRZ+zUH2rmbEDeR+dVp6eQMago HzkIS7Wkz9epB1tbD7OqeznMQHM6co6GyNl+UFw+FyG/aMj5RisBm2f4ecu2qLZHHoBR 2mVsqkDwfLxUCpzLciVGZWKejZhHNLIZil9X8j+NUk/jRuHhGdlcdJfbJFZzET/V7Geh XUUdf1VRwoVvPiWex3/Nya9Aaer7mIE965jDfjVibzUBBWbCst2k9qM86QYWsZHWJ4Qc bHO3VRMonp4Fgql/lB8NMaREY5ZGFmsWYmy6ANM4/KZGK4fRoqtEvUexe/o1LyTQc8H7 l5JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772165505; x=1772770305; 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=CxqowGzg2CaK2KHQ3yg4HgobTjZp7H6lsiRmrF05V2E=; b=uTCg5v0M0PxDrHdC2s6dySgEU+TiNTQSQ7MyrMLMmA6LLd+zXxJawob79R5YcDLw0n JeSRuVnip/Mf3xAjHvEPCrhb0s0ZQybAeuATIt9BfgLgv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by 2002:a17:902:ccc4:b0:2ad:bdc5:ba9f with SMTP id d9443c01a7336-2ae2e4d93f2mr14601015ad.55.1772165505486; Thu, 26 Feb 2026 20:11:45 -0800 (PST) Received: from mma-H9MHD44.lan (60-242-93-14.static.tpgi.com.au. [60.242.93.14]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6ba5eesm41682865ad.68.2026.02.26.20.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 20:11:45 -0800 (PST) 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 01/35] wifi: mm81x: add bus.h Date: Fri, 27 Feb 2026 15:10:11 +1100 Message-ID: <20260227041108.66508-2-lachlan.hodges@morsemicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260227041108.66508-1-lachlan.hodges@morsemicro.com> References: <20260227041108.66508-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, see cover letter for more information) Signed-off-by: Lachlan Hodges --- drivers/net/wireless/morsemicro/mm81x/bus.h | 90 +++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 drivers/net/wireless/morsemicro/mm81x/bus.h diff --git a/drivers/net/wireless/morsemicro/mm81x/bus.h b/drivers/net/wireless/morsemicro/mm81x/bus.h new file mode 100644 index 000000000000..3c0b8bb1d8c3 --- /dev/null +++ b/drivers/net/wireless/morsemicro/mm81x/bus.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2017-2026 Morse Micro + */ + +#ifndef _MM81X_BUS_H_ +#define _MM81X_BUS_H_ + +#include +#include "core.h" + +enum mm81x_bus_type { + MM81X_BUS_TYPE_USB, + MM81X_BUS_TYPE_SDIO, +}; + +struct mm81x_bus_ops { + int (*dm_read)(struct mm81x *mm, u32 addr, u8 *data, int len); + int (*dm_write)(struct mm81x *mm, u32 addr, const u8 *data, int len); + int (*reg32_read)(struct mm81x *mm, u32 addr, u32 *data); + int (*reg32_write)(struct mm81x *mm, u32 addr, u32 data); + void (*set_bus_enable)(struct mm81x *mm, bool enable); + void (*config_burst_mode)(struct mm81x *mm, bool enable_burst); + void (*claim)(struct mm81x *mm); + void (*set_irq)(struct mm81x *mm, bool enable); + void (*release)(struct mm81x *mm); + unsigned int bulk_alignment; +}; + +/* + * Default TX alignment for buses which don't care. mac80211 will give us + * SKBs aligned to the 2 byte boundary, so 2 is effectively a noop. + */ +#define MM81X_BUS_DEFAULT_BULK_ALIGNMENT (2) + +/* mm81x_dm_read - len must be rounded up to the nearest 4-byte boundary */ +static inline int mm81x_dm_read(struct mm81x *mm, u32 addr, u8 *data, int len) +{ + return mm->bus_ops->dm_read(mm, addr, data, len); +} + +static inline int mm81x_dm_write(struct mm81x *mm, u32 addr, const u8 *data, + int len) +{ + return mm->bus_ops->dm_write(mm, addr, data, len); +} + +static inline int mm81x_reg32_read(struct mm81x *mm, u32 addr, u32 *data) +{ + return mm->bus_ops->reg32_read(mm, addr, data); +} + +static inline int mm81x_reg32_write(struct mm81x *mm, u32 addr, u32 data) +{ + return mm->bus_ops->reg32_write(mm, addr, data); +} + +static inline void mm81x_set_bus_enable(struct mm81x *mm, bool enable) +{ + mm->bus_ops->set_bus_enable(mm, enable); +} + +static inline void mm81x_bus_config_burst_mode(struct mm81x *mm, + bool enable_burst) +{ + if (mm->bus_ops->config_burst_mode) + mm->bus_ops->config_burst_mode(mm, enable_burst); +} + +static inline void mm81x_claim_bus(struct mm81x *mm) +{ + mm->bus_ops->claim(mm); +} + +static inline void mm81x_bus_set_irq(struct mm81x *mm, bool enable) +{ + mm->bus_ops->set_irq(mm, enable); +} + +static inline void mm81x_release_bus(struct mm81x *mm) +{ + mm->bus_ops->release(mm); +} + +static inline unsigned int mm81x_bus_get_alignment(struct mm81x *mm) +{ + return mm->bus_ops->bulk_alignment; +} + +#endif /* !_MM81X_BUS_H_ */ -- 2.43.0