From 2015605e8dcbc6b06f82a5efeda7bb1c8d8db1b3 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 12 May 2012 20:36:12 +0000 Subject: [PATCH] * Add in the AR7240 global control field for setting the maximum frame size for the AR7240. * Include SM/MS macros, thanks to ath_hal(4). * This field is for normal packets, VLAN and other headers are added to this by the switch device. * Set the MTU to 1536, to match what is done in Linux. Use the SM macro to write this field. Obtained from: Atheros (AR7240 datasheet), Linux OpenWRT (MTU default) --- sys/dev/etherswitch/arswitch/arswitchreg.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/dev/etherswitch/arswitch/arswitchreg.h b/sys/dev/etherswitch/arswitch/arswitchreg.h index ad0b4d5a5d8..499d94cef3e 100644 --- a/sys/dev/etherswitch/arswitch/arswitchreg.h +++ b/sys/dev/etherswitch/arswitch/arswitchreg.h @@ -29,6 +29,15 @@ #ifndef __AR8X16_SWITCHREG_H__ #define __AR8X16_SWITCHREG_H__ +/* XXX doesn't belong here; stolen shamelessly from ath_hal/ah_internal.h */ +/* + * Register manipulation macros that expect bit field defines + * to follow the convention that an _S suffix is appended for + * a shift count, while the field mask has no suffix. + */ +#define SM(_v, _f) (((_v) << _f##_S) & (_f)) +#define MS(_v, _f) (((_v) & (_f)) >> _f##_S) + /* Atheros specific MII registers */ #define MII_ATH_DBG_ADDR 0x1d #define MII_ATH_DBG_DATA 0x1e @@ -77,8 +86,13 @@ #define AR8X16_REG_GLOBAL_CTRL 0x0030 #define AR8216_GLOBAL_CTRL_MTU_MASK 0x00000fff +#define AR8216_GLOBAL_CTRL_MTU_MASK_S 0 #define AR8316_GLOBAL_CTRL_MTU_MASK 0x00007fff +#define AR8316_GLOBAL_CTRL_MTU_MASK_S 0 #define AR8236_GLOBAL_CTRL_MTU_MASK 0x00007fff +#define AR8236_GLOBAL_CTRL_MTU_MASK_S 0 +#define AR7240_GLOBAL_CTRL_MTU_MASK 0x00003fff +#define AR7240_GLOBAL_CTRL_MTU_MASK_S 0 #define AR8X16_REG_VLAN_CTRL 0x0040 #define AR8X16_VLAN_OP 0x00000007