From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 0E224345750 for ; Fri, 27 Feb 2026 04:11:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772165507; cv=none; b=vFZDGWwm/xSqEHduPuIW5T6UVmLlE7TmmTvW1oqISjCKq+OVSgxr5EeuYCwOmpAiGEatN48Hhdvjglg4Iv/d99YmuiEC2nA//a982Mh4hhHsq4j2fgBMqyJ7piZB4rUh5m5gstEfIoVuNY7ZcC+nH0BUC/pVpGqWMf9d6Zzv3Hc= 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.176 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-f176.google.com with SMTP id d9443c01a7336-2a871daa98fso12467635ad.1 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=UzKqNa5gryKkjd1A7aWK9Bn04LFsFF0rVi7gj7/LpsCjPJSPzmEA9qfU0sEzPfxfVn GKnEDsjLGMLFFAAEDvlFW7+SF3uhKBJtmXB4Si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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-wireless@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