linux/drivers/net/wireless/morsemicro/mm81x/bus.h
Lachlan Hodges b1906cea00 wifi: mm81x: add mm81x Wi-Fi HaLow driver
mm81x is the first Wi-Fi HaLow driver to support the Morse Micro mm81x
chip family via USB and SDIO.

S1G support in the kernel is only new, and as a result this driver has
been scoped to be simple and only support station and AP interface.
The Wi-Fi specific features only cover the minimum required for basic
use such as powersave, aggregation, rate control and so on. The driver
will be extended into the future as S1G support for operations such as
ACS, channel switching and so on are added into the wireless stack.

The driver has been build tested on a long list of architectures and
compilers via Intels LKP.

The driver currently supports IEEE80211-2024 US channels only, with
AU 2020 also available. In order for this to be expanded additional
non-trivial kernel work is required which will begin once the
driver is upstream.

The driver has had many authors who are listed below in
alphabetical order:

Co-developed-by: Andrew Pope <andrew.pope@morsemicro.com>
Signed-off-by: Andrew Pope <andrew.pope@morsemicro.com>
Co-developed-by: Arien Judge <arien.judge@morsemicro.com>
Signed-off-by: Arien Judge <arien.judge@morsemicro.com>
Co-developed-by: Ayman Grais <ayman.grais@morsemicro.com>
Signed-off-by: Ayman Grais <ayman.grais@morsemicro.com>
Co-developed-by: Bassem Dawood <bassem@morsemicro.com>
Signed-off-by: Bassem Dawood <bassem@morsemicro.com>
Co-developed-by: Chetan Mistry <chetan.mistry@morsemicro.com>
Signed-off-by: Chetan Mistry <chetan.mistry@morsemicro.com>
Co-developed-by: Dan Callaghan <dan.callaghan@morsemicro.com>
Signed-off-by: Dan Callaghan <dan.callaghan@morsemicro.com>
Co-developed-by: James Herbert <james.herbert@morsemicro.com>
Signed-off-by: James Herbert <james.herbert@morsemicro.com>
Co-developed-by: Sahand Maleki <sahand.maleki@morsemicro.com>
Signed-off-by: Sahand Maleki <sahand.maleki@morsemicro.com>
Co-developed-by: Simon Wadsworth <simon@morsemicro.com>
Signed-off-by: Simon Wadsworth <simon@morsemicro.com>
Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
2026-07-08 12:03:50 +10:00

100 lines
2.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2026 Morse Micro
*/
#ifndef _MM81X_BUS_H_
#define _MM81X_BUS_H_
#include <linux/skbuff.h>
#include "core.h"
enum mm81x_bus_type {
MM81X_BUS_TYPE_USB,
MM81X_BUS_TYPE_SDIO,
};
struct mm81x_bus_ops {
int (*dm_read)(struct mm81x *mors, u32 addr, u8 *data, int len);
int (*dm_write)(struct mm81x *mors, u32 addr, const u8 *data, int len);
int (*reg32_read)(struct mm81x *mors, u32 addr, u32 *data);
int (*reg32_write)(struct mm81x *mors, u32 addr, u32 data);
int (*digital_reset)(struct mm81x *mors);
void (*set_bus_enable)(struct mm81x *mors, bool enable);
void (*config_burst_mode)(struct mm81x *mors, bool enable_burst);
void (*claim)(struct mm81x *mors);
void (*set_irq)(struct mm81x *mors, bool enable);
void (*release)(struct mm81x *mors);
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 *mors, u32 addr, u8 *data, int len)
{
return mors->bus_ops->dm_read(mors, addr, data, len);
}
static inline int mm81x_dm_write(struct mm81x *mors, u32 addr, const u8 *data,
int len)
{
return mors->bus_ops->dm_write(mors, addr, data, len);
}
static inline int mm81x_reg32_read(struct mm81x *mors, u32 addr, u32 *data)
{
return mors->bus_ops->reg32_read(mors, addr, data);
}
static inline int mm81x_reg32_write(struct mm81x *mors, u32 addr, u32 data)
{
return mors->bus_ops->reg32_write(mors, addr, data);
}
static inline int mm81x_bus_digital_reset(struct mm81x *mors)
{
if (mors->bus_ops->digital_reset)
return mors->bus_ops->digital_reset(mors);
return 0;
}
static inline void mm81x_set_bus_enable(struct mm81x *mors, bool enable)
{
mors->bus_ops->set_bus_enable(mors, enable);
}
static inline void mm81x_bus_config_burst_mode(struct mm81x *mors,
bool enable_burst)
{
if (mors->bus_ops->config_burst_mode)
mors->bus_ops->config_burst_mode(mors, enable_burst);
}
static inline void mm81x_claim_bus(struct mm81x *mors)
{
mors->bus_ops->claim(mors);
}
static inline void mm81x_bus_set_irq(struct mm81x *mors, bool enable)
{
mors->bus_ops->set_irq(mors, enable);
}
static inline void mm81x_release_bus(struct mm81x *mors)
{
mors->bus_ops->release(mors);
}
static inline unsigned int mm81x_bus_get_alignment(struct mm81x *mors)
{
return mors->bus_ops->bulk_alignment;
}
#endif /* !_MM81X_BUS_H_ */