Re: [OpenWrt-Devel] Board Suggestion

2013-04-01 Thread valent.turko...@gmail.com
Maybe Mikrotik boards?

http://wiki.openwrt.org/toh/start#mikrotik

On Tue, Apr 2, 2013 at 8:11 AM, Artur Wronowski  wrote:
> Maybe carambola 2?
>
>
> 2013/4/2 Pietro Paolini 
>>
>> Hello all,
>> I'd like buy a board where play with openwrt, someone can suggest me the
>> easier in terms of installation and serial cable set up ?
>>
>> Thanks,
>>
>> Pietro.
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
>
>
>
> --
> Pozdrawiam, Artur
> http://artekw.net / http://digi-led.pl / GG: 1518171 / Jabber:
> art...@jabbim.pl
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>



-- 
follow me - www.twitter.com/valentt & http://kernelreloaded.blog385.com
linux, anime, spirituality, wireless, scuba, linuxmce smart home, zwave
ICQ: 2125241, Skype: valent.turkovic, MSN: valent.turko...@hotmail.com
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Board Suggestion

2013-04-01 Thread Artur Wronowski
Maybe carambola 2?


2013/4/2 Pietro Paolini 

> Hello all,
> I'd like buy a board where play with openwrt, someone can suggest me the
> easier in terms of installation and serial cable set up ?
>
> Thanks,
>
> Pietro.
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>



-- 
Pozdrawiam, Artur
http://artekw.net / http://digi-led.pl / GG: 1518171 / Jabber:
art...@jabbim.pl
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Board Suggestion

2013-04-01 Thread Pietro Paolini
Hello all,
I'd like buy a board where play with openwrt, someone can suggest me the easier 
in terms of installation and serial cable set up ?

Thanks,

Pietro.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips/rt305x: Add I2C gpio platform data.

2013-04-01 Thread Tobias Diedrich
John Crispin wrote:
> Hi Tobias,
> 
> i have been working on an update to ramips the last weeks, which
> bumps the kernel tot the upstream OF enabled one. This update will
> superseed your patch. we are currently not merging any patches based
> on the old code pattern.

Awesome.  Device trees are a nice step forward from specific
mach-files I think.  :)

> i will try to make an image for you to test using a devicetree with
> the i2c-gpio driver enabled and i2c-tools added if that is ok.

Sure, thanks.
Ideally you could add the INA2XX module, since that is what I have
hooked up on the bus.

> On 01/04/13 00:59, Tobias Diedrich wrote:
> >Add I2C gpio platform data.
> >
> >This is useful for the Carambola dev board (and maybe others if they
> >use I2C).
> >
> >Signed-off-by: Tobias Diedrich
> >
> >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
> >===
> >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
> >2013-03-31 23:21:42.992809485 +0200
> >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.c
> >2013-03-31 23:21:50.142819472 +0200
> >@@ -12,6 +12,7 @@
> >  #include
> >  #include
> >  #include
> >+#include
> >  #include
> >  #include
> >  #include
> >@@ -260,6 +261,33 @@
> > platform_device_register(&rt305x_wdt_device);
> >  }
> >
> >+static struct i2c_gpio_platform_data rt305x_i2c_pdata = {
> >+.sda_pin= RT305X_GPIO_I2C_SD,
> >+.scl_pin= RT305X_GPIO_I2C_SCLK,
> >+.sda_is_open_drain  = 0,
> >+.scl_is_open_drain  = 0,
> >+.udelay = 10,
> >+};
> >+
> >+static struct platform_device rt305x_i2c_device = {
> >+.name   = "i2c-gpio",
> >+.id = 0,
> >+.dev= {
> >+.platform_data =&rt305x_i2c_pdata,
> >+},
> >+};
> >+
> >+void __init rt305x_register_i2c(void)
> >+{
> >+/*
> >+ * There is even a dedicated i2c controller block, but it is probably
> >+ * not worth implementing support for the minimal speed gain.
> >+ * Just use the generic linux bitbanging and register the necessary
> >+ * platform data for the default I2C pin mapping the HW would use.
> >+ */
> >+platform_device_register(&rt305x_i2c_device);
> >+}
> >+
> >  static struct resource rt305x_spi_resources[] = {
> > {
> > .flags  = IORESOURCE_MEM,
> >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
> >===
> >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
> >2013-03-31 23:21:42.992809485 +0200
> >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/devices.h
> >2013-03-31 23:21:42.982809471 +0200
> >@@ -23,6 +23,7 @@
> >
> >  void rt305x_register_flash(unsigned int id);
> >  void rt305x_register_ethernet(void);
> >+void rt305x_register_i2c(void);
> >  void rt305x_register_wifi(void);
> >  void rt305x_register_wdt(void);
> >  void rt305x_register_spi(struct spi_board_info *info, int n);
> >Index: a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c
> >===
> >--- b/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c 
> >2013-03-31 23:21:42.992809485 +0200
> >+++ a/target/linux/ramips/files/arch/mips/ralink/rt305x/mach-carambola.c 
> >2013-03-31 23:21:42.982809471 +0200
> >@@ -36,6 +36,7 @@
> > rt305x_register_wifi();
> > rt305x_register_wdt();
> > rt305x_register_usb();
> >+rt305x_register_i2c();  /* platform data for i2c-gpio */
> >  }
> >
> >  MIPS_MACHINE(RAMIPS_MACH_CARAMBOLA, "CARAMBOLA", "8devices Carambola",
> >
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 

-- 
Tobias  PGP: http://8ef7ddba.uguu.de
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCHv2 06/10] libpcap: update to 1.3.0

2013-04-01 Thread Russell Senior

Disabled canusb by setting ac_cv_header_libusb_1_0_libusb_h to no in
Makefile.  Upstream configure script ignores --disable-canusb.

Signed-off-by: Russell Senior 
---
 package/libs/libpcap/Makefile  |   12 +-
 .../libpcap/patches/100-debian_shared_lib.patch|  130 ++--
 .../patches/102-makefile_disable_manpages.patch|   37 ++
 .../libs/libpcap/patches/202-protocol_api.patch|   43 ---
 4 files changed, 102 insertions(+), 120 deletions(-)

diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile
index de77c00..75b5487 100644
--- a/package/libs/libpcap/Makefile
+++ b/package/libs/libpcap/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2013 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libpcap
-PKG_VERSION:=1.1.1
-PKG_RELEASE:=2
+PKG_VERSION:=1.3.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.tcpdump.org/release/
-PKG_MD5SUM:=1bca27d206970badae248cfa471bbb47
+PKG_MD5SUM:=f78455a92622b7a3c05c58b6ad1cec7e
 
 PKG_MAINTAINER:=Felix Fietkau 
 
@@ -45,7 +45,9 @@ TARGET_CFLAGS += \
-fdata-sections
 
 CONFIGURE_VARS += \
-   ac_cv_linux_vers=$(LINUX_VERSION)
+   ac_cv_linux_vers=$(LINUX_VERSION) \
+   ac_cv_header_libusb_1_0_libusb_h=no
+
 
 CONFIGURE_ARGS += \
--enable-shared \
diff --git a/package/libs/libpcap/patches/100-debian_shared_lib.patch 
b/package/libs/libpcap/patches/100-debian_shared_lib.patch
index 5be33b0..30cb10a 100644
--- a/package/libs/libpcap/patches/100-debian_shared_lib.patch
+++ b/package/libs/libpcap/patches/100-debian_shared_lib.patch
@@ -1,20 +1,15 @@
 Debian-specific modifications to the upstream Makefile.in to
 build a shared library.

- Makefile.in  |   45 ++---
- configure|2 +-
- configure.in |2 +-
- 3 files changed, 44 insertions(+), 5 deletions(-)
 
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -40,6 +40,14 @@ mandir = @mandir@
+@@ -40,6 +40,14 @@
  srcdir = @srcdir@
  VPATH = @srcdir@
  
 +# some defines for shared library compilation
-+MAJ=1.1
-+LIBVERSION=$(MAJ).1
++MAJ=1.3
++LIBVERSION=$(MAJ).0
 +LIBNAME=pcap
 +LIBRARY=lib$(LIBNAME).a
 +SOLIBRARY=lib$(LIBNAME).so
@@ -23,28 +18,30 @@ build a shared library.
  #
  # You shouldn't need to edit anything below.
  #
-@@ -59,6 +67,7 @@ PROG=libpcap
+@@ -60,7 +68,8 @@
+ PROG=libpcap
  
  # Standard CFLAGS
- CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
+-FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
++FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
  
  INSTALL = @INSTALL@
  INSTALL_PROGRAM = @INSTALL_PROGRAM@
-@@ -78,7 +87,11 @@ YACC = @V_YACC@
+@@ -80,7 +89,11 @@
  # problem if you don't own the file but can write to the directory.
  .c.o:
@rm -f $@
--  $(CC) $(CFLAGS) -c $(srcdir)/$*.c
-+  $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
+-  $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
++  $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
 +
 +%_pic.o: %.c
 +  @rm -f $@
-+  $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
++  $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
  
- PSRC =pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@
+ PSRC =pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ 
@CANUSB_SRC@
  FSRC =  fad-@V_FINDALLDEVS@.c
-@@ -94,6 +107,7 @@ SRC =   $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
+@@ -96,6 +109,7 @@
  # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
  # hack the extra indirection
  OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) 
$(LIBOBJS)
@@ -52,97 +49,77 @@ build a shared library.
  PUBHDR = \
pcap.h \
pcap-bpf.h \
-@@ -131,7 +145,7 @@ TAGFILES = \
+@@ -148,7 +162,7 @@
  
- CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \
-   opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
+ CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
+   $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
 -  lex.yy.c pcap-config
 +  lex.yy.c pcap-config $(OBJ_PIC)
  
  MAN1 = pcap-config.1
  
-@@ -324,21 +338,14 @@ EXTRA_DIST = \
-   Win32/Src/inet_net.c \
-   Win32/Src/inet_pton.c
- 
--all: libpcap.a shared pcap-config
-+all: libpcap.a shared pcap-config $(SHAREDLIB)
- 
- libpcap.a: $(OBJ)
-   @rm -f $@
-   ar rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
+@@ -352,7 +366,7 @@
+   $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
$(RANLIB) $@
  
 -shared: libpcap.$(DYEXT)
--
--libpcap.so: $(OBJ)
--  @rm -f $@
--  VER=`cat $(srcdir)/VERSION`; \
--  MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
--  @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
--  -o $@.$$VER $(OBJ) $(AD

[OpenWrt-Devel] [PATCH] [include] If cmake running ccache, use nocache compiler flavor

2013-04-01 Thread Jay Carlson

On my Ubuntu 12.04 system, /usr/bin/ccache was getting picked up as the
compiler under race-y conditions, and then cmake would try to run

  /usr/bin/ccache ccache_cc

causing the compilation to fail with a "ccache invoked recursively"
error.

It's possible the filter-out can go away with this change.

Signed-off-by: Jay Carlson 
---
 include/cmake.mk |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/cmake.mk b/include/cmake.mk
index 4c4af50..a1a5a4b 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -22,9 +22,9 @@ else
 CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
   endif
   CMAKE_C_COMPILER:=$(CCACHE)
-  CMAKE_C_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CC))
+  CMAKE_C_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CC_NOCACHE))
   CMAKE_CXX_COMPILER:=$(CCACHE)
-  CMAKE_CXX_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CXX))
+  CMAKE_CXX_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CXX_NOCACHE))
 endif
 
 define Build/Configure/Default
-- 
1.7.9.5

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] iputils: replace busybox symlinks for commands arping/ping/ping6 when installing the corresponding iputils alternatives

2013-04-01 Thread Gui Iribarren

This fixes this error:

root@6470028f4363:~# opkg install iputils-arping_20101006-1_ar71xx.ipk
Installing iputils-arping (20101006-1) to root...
Installing libsysfs (2.1.0-2) to root...
Configuring libsysfs.
Collected errors:
 * check_data_file_clashes: Package iputils-arping wants to install 
file /usr/bin/arping

But that file is already provided by package  * busybox
 * opkg_install_cmd: Cannot install package iputils-arping.


And in addition smooths out the install of ping/ping6, which currently 
give no errors, but /bin/ping6 is preferred by $PATH, so this patch 
disables that feature-less busybox version right away, giving a 
streamlined experience (?) like the following:


root@6470028f4363:~# ping6
BusyBox v1.19.4 (2013-03-30 05:23:56 ART) multi-call binary.

Usage: ping6 [OPTIONS] HOST

Send ICMP ECHO_REQUEST packets to network hosts

-c CNT  Send only CNT pings
-s SIZE Send SIZE data bytes in packets (default:56)
-I IFACE/IP Use interface or IP address as source
-q  Quiet, only displays output at start
and when finished

root@6470028f4363:~# opkg install iputils-ping6_20101006-2_ar71xx.ipk
Installing iputils-ping6 (20101006-2) to root...
Configuring iputils-ping6.
Removing /bin/ping6 symlink for busybox
root@6470028f4363:~# ping6
Usage: ping6 [-LUdfnqrvVaAD] [-c count] [-i interval] [-w deadline]
 [-p pattern] [-s packetsize] [-t ttl] [-I interface]
 [-M pmtudisc-hint] [-S sndbuf] [-F flowlabel] [-Q tclass]
 [hop1 ...] destination

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] iputils: replace busybox symlinks for commands arping/ping/ping6 when installing the corresponding iputils alternatives

2013-04-01 Thread Gui Iribarren
Add preinst/postrm hooks to iputils, so that there are no install-time 
conflicts,
either when opkg installing, or embedding in a binary.

Symlink is restored on package removal.

---
 package/network/utils/iputils/Makefile |   44 +++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/package/network/utils/iputils/Makefile 
b/package/network/utils/iputils/Makefile
index ff7505b..e887331 100644
--- a/package/network/utils/iputils/Makefile
+++ b/package/network/utils/iputils/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iputils
 PKG_VERSION:=20101006
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-s$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.skbuff.net/iputils
@@ -170,6 +170,48 @@ define Package/iputils-traceroute6/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/traceroute6 $(1)/usr/bin/
 endef
 
+define Package/iputils-arping/preinst
+#!/bin/sh
+echo "Removing /usr/bin/arping symlink for busybox"
+[ -h "$${IPKG_INSTROOT}/usr/bin/arping" ] && rm -f 
"$${IPKG_INSTROOT}/usr/bin/arping"
+exit 0
+endef
+
+define Package/iputils-arping/postrm
+#!/bin/sh
+echo "Re-enabling /usr/bin/arping symlink for busybox"
+ln -sf ../../bin/busybox "$${IPKG_INSTROOT}/usr/bin/arping"
+exit 0
+endef
+
+define Package/iputils-ping/preinst
+#!/bin/sh
+echo "Removing /bin/ping symlink for busybox"
+[ -h "$${IPKG_INSTROOT}/bin/ping" ] && rm -f "$${IPKG_INSTROOT}/bin/ping"
+exit 0
+endef
+
+define Package/iputils-ping/postrm
+#!/bin/sh
+echo "Re-enabling /bin/ping symlink for busybox"
+ln -sf busybox "$${IPKG_INSTROOT}/bin/ping"
+exit 0
+endef
+
+define Package/iputils-ping6/preinst
+#!/bin/sh
+echo "Removing /bin/ping6 symlink for busybox"
+[ -h "$${IPKG_INSTROOT}/bin/ping6" ] && rm -f "$${IPKG_INSTROOT}/bin/ping6"
+exit 0
+endef
+
+define Package/iputils-ping6/postrm
+#!/bin/sh
+echo "Re-enabling /bin/ping6 symlink for busybox"
+ln -sf busybox "$${IPKG_INSTROOT}/bin/ping6"
+exit 0
+endef
+
 $(eval $(call BuildPackage,iputils-arping))
 $(eval $(call BuildPackage,iputils-clockdiff))
 $(eval $(call BuildPackage,iputils-ping))
-- 
1.7.2.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 10/10] valgrind: update to v3.8.1

2013-04-01 Thread Felix Fietkau
On 2013-03-28 7:55 AM, Russell Senior wrote:
> 
> Signed-off-by: Russell Senior 
Committed in r36143, thanks.

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 06/10] libpcap: update to 1.3.0

2013-04-01 Thread Felix Fietkau
On 2013-03-28 7:49 AM, Russell Senior wrote:
> 
> Signed-off-by: Russell Senior 
This patch breaks the build in my tests. It does not disable libusb
support properly and thus fails with a missing dependency on it.

- Felix

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [generic] Add port mirroring/monitoring capability to AR8327 switch driver

2013-04-01 Thread Colin Leitner
Hi,

this patch adds the swlib attributes

enable_mirror_rx
enable_mirror_tx
mirror_monitor_port
mirror_source_port

to the AR8327 switch/PHY driver that allow to mirror Ethernet packets to a 
monitor port.

Tested on a TL-WDR4300 router.

Signed-off-by: Colin Leitner 

Index: target/linux/generic/files/drivers/net/phy/ar8216.c
===
--- target/linux/generic/files/drivers/net/phy/ar8216.c (revision 34185)
+++ target/linux/generic/files/drivers/net/phy/ar8216.c (working copy)
@@ -88,6 +88,12 @@
u8 vlan_table[AR8X16_MAX_VLANS];
u8 vlan_tagged;
u16 pvid[AR8X16_MAX_PORTS];
+
+   /* Mirroring */
+   bool mirror_rx;
+   bool mirror_tx;
+   int source_port;
+   int monitor_port;
 };
 
 #define to_ar8216(_dev) container_of(_dev, struct ar8216_priv, dev)
@@ -1001,8 +1007,132 @@
return 0;
 }
 
+static void
+ar8327_set_mirror_regs(struct ar8216_priv *priv)
+{
+   int port;
 
+   /* Reset all mirror registers */
+   ar8216_rmw(priv, AR8327_REG_FWD_CTRL0,
+  AR8327_FWD_CTRL0_MIRROR_PORT,
+  (0xF << AR8327_FWD_CTRL0_MIRROR_PORT_S));
+   for (port = 0; port < AR8327_NUM_PORTS; port++) {
+   ar8216_rmw(priv, AR8327_REG_PORT_LOOKUP(port),
+  AR8327_PORT_LOOKUP_ING_MIRROR_EN,
+  0);
+
+   ar8216_rmw(priv, AR8327_REG_PORT_HOL_CTRL1(port),
+  AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN,
+  0);
+   }
+
+   /* Now enable mirroring if necessary */
+   if (priv->source_port >= AR8327_NUM_PORTS ||
+   priv->monitor_port >= AR8327_NUM_PORTS ||
+   priv->source_port == priv->monitor_port) {
+   return;
+   }
+
+   ar8216_rmw(priv, AR8327_REG_FWD_CTRL0,
+  AR8327_FWD_CTRL0_MIRROR_PORT,
+  (priv->monitor_port << AR8327_FWD_CTRL0_MIRROR_PORT_S));
+
+   if (priv->mirror_tx)
+   ar8216_rmw(priv, AR8327_REG_PORT_LOOKUP(priv->source_port),
+  AR8327_PORT_LOOKUP_ING_MIRROR_EN,
+  AR8327_PORT_LOOKUP_ING_MIRROR_EN);
+
+   if (priv->mirror_rx)
+   ar8216_rmw(priv, AR8327_REG_PORT_HOL_CTRL1(priv->source_port),
+  AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN,
+  AR8327_PORT_HOL_CTRL1_EG_MIRROR_EN);
+}
+
 static int
+ar8327_sw_set_mirror_rx_enable(struct switch_dev *dev,
+  const struct switch_attr *attr,
+  struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   priv->mirror_rx = !!val->value.i;
+   ar8327_set_mirror_regs(priv);
+   return 0;
+}
+
+static int
+ar8327_sw_get_mirror_rx_enable(struct switch_dev *dev,
+  const struct switch_attr *attr,
+  struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   val->value.i = priv->mirror_rx;
+   return 0;
+}
+
+static int
+ar8327_sw_set_mirror_tx_enable(struct switch_dev *dev,
+  const struct switch_attr *attr,
+  struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   priv->mirror_tx = !!val->value.i;
+   ar8327_set_mirror_regs(priv);
+   return 0;
+}
+
+static int
+ar8327_sw_get_mirror_tx_enable(struct switch_dev *dev,
+  const struct switch_attr *attr,
+  struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   val->value.i = priv->mirror_tx;
+   return 0;
+}
+
+static int
+ar8327_sw_set_mirror_monitor_port(struct switch_dev *dev,
+ const struct switch_attr *attr,
+ struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   priv->monitor_port = val->value.i;
+   ar8327_set_mirror_regs(priv);
+   return 0;
+}
+
+static int
+ar8327_sw_get_mirror_monitor_port(struct switch_dev *dev,
+ const struct switch_attr *attr,
+ struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   val->value.i = priv->monitor_port;
+   return 0;
+}
+
+static int
+ar8327_sw_set_mirror_source_port(struct switch_dev *dev,
+const struct switch_attr *attr,
+struct switch_val *val)
+{
+   struct ar8216_priv *priv = to_ar8216(dev);
+   priv->source_port = val->value.i;
+   ar8327_set_mirror_regs(priv);
+   return 0;
+}
+
+static int
+ar8327_sw_get_mirror_source_port(struct switch_dev *dev,
+const struct switch_attr *attr,
+struct switch_val *val)
+{
+   s