drivers: ieee802154: Make raw mode and l2 mutually exclusive

Activating both, the IEEE 802.15.4 raw mode /and/ the L2 mode is not
possible and in fact leads to a build error.

It should therefore not be possible to activate both options at the same
time. This is achieved by only offering the (rather exotic) raw mode
once the L2-support for the IEEE 802.15.4 has been switched off.

Fixes: #48715

Signed-off-by: Florian Grandel <>
diff --git a/drivers/ieee802154/Kconfig b/drivers/ieee802154/Kconfig
index c089b9f..327d7e2 100644
--- a/drivers/ieee802154/Kconfig
+++ b/drivers/ieee802154/Kconfig
@@ -26,6 +26,7 @@
 	  This option can be useful when using OpenThread or Zigbee. If you
 	  have any doubt about this option leave it as default value.
+if !NET_L2_PHY_IEEE802154
 config IEEE802154_RAW_MODE
 	bool "IEEE 802.15.4 driver without the MAC stack"
 	select NET_RAW_MODE
@@ -34,6 +35,7 @@
 	  i.e. without a MAC stack (the net L2 layer for 802.15.4 will not
 	  be built). Used only for very specific cases, such as wpan_serial
 	  and wpanusb samples.
+endif # !NET_L2_PHY_IEEE802154
 config IEEE802154_RDEV