This adds the new target to OpenWrt, including some patches and a default kernel
configuration.

Signed-off-by: Daniel Golle <daniel.go...@gmail.com>

diff --git a/target/linux/ac49x/Makefile b/target/linux/ac49x/Makefile
new file mode 100644
index 0000000..2f51ede
--- /dev/null
+++ b/target/linux/ac49x/Makefile
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2006-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=mipsel
+BOARD:=ac49x
+BOARDNAME:=AudioCodes AC49x
+FEATURES:=squashfs jffs2
+MAINTAINER:=Daniel Golle <daniel.go...@gmail.com>
+
+LINUX_VERSION:=3.3.8
+
+CFLAGS=-Os -pipe -mips32 -mtune=mips32 -fno-caller-saves
+
+include $(INCLUDE_DIR)/target.mk
+
+define Target/Description
+       Build firmware images for AudioCodes AC49x based systems.
+       See http://www.audiocodes.com/products/ac494 for details.
+endef
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/ac49x/config-default 
b/target/linux/ac49x/config-default
new file mode 100644
index 0000000..ff85e99
--- /dev/null
+++ b/target/linux/ac49x/config-default
@@ -0,0 +1,103 @@
+CONFIG_AC49MAC=y
+CONFIG_AC49X=y
+CONFIG_AC49X_GPIO=y
+CONFIG_ADM6996_PHY=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_BCMA_POSSIBLE=y
+CONFIG_BOOT_ELF32=y
+CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
+CONFIG_CMDLINE_BOOL=y
+# CONFIG_CMDLINE_OVERRIDE is not set
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+CONFIG_CPU_LITTLE_ENDIAN=y
+CONFIG_CPU_MIPS32=y
+CONFIG_CPU_MIPS32_R1=y
+CONFIG_CPU_MIPSR1=y
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
+# CONFIG_DEBUG_ZBOOT is not set
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_FIXED_PHY=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GPIOLIB=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HW_RANDOM=y
+CONFIG_IMAGE_CMDLINE_HACK=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IP17XX_PHY=y
+CONFIG_IRQ_CPU=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_KALLSYMS=y
+CONFIG_KERNEL_GZIP=y
+CONFIG_LEDS_GPIO=y
+CONFIG_MDIO_BOARDINFO=y
+CONFIG_MIPS=y
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+# CONFIG_MIPS_MACHINE is not set
+CONFIG_MIPS_MT_DISABLED=y
+CONFIG_MTD_AC49X_PARTS=y
+CONFIG_MTD_CFI_STAA=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NET_VENDOR_AUDIOCODES=y
+CONFIG_NO_EXCEPT_FILL=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PHYLIB=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_SCSI_DMA is not set
+CONFIG_SWAP_IO_SPACE=y
+CONFIG_SWCONFIG=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
+CONFIG_SYS_SUPPORTS_ZBOOT=y
+CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y
+CONFIG_VLYNQ=y
+# CONFIG_VLYNQ_DEBUG is not set
+CONFIG_XZ_DEC=y
+CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/ac49x/image/Makefile 
b/target/linux/ac49x/image/Makefile
new file mode 100644
index 0000000..8a449eb
--- /dev/null
+++ b/target/linux/ac49x/image/Makefile
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2006-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+DROP_SECTIONS:=.reginfo .mdebug .comment .note .pdr .options .MIPS.options
+OBJCOPY_SREC:=$(TARGET_CROSS)objcopy -S -O srec $(addprefix 
--remove-section=,$(DROP_SECTIONS))
+
+LOADADDR:=0x94ACA000
+KERNEL_ENTRY:=0x945CA000
+RAMSTART:=0x94000000
+RAMSIZE:=0x00100000
+
+EVA_LOADADDR := 0x945CA000
+
+LOADER_MAKEOPTS= \
+       KDIR=$(KDIR) \
+       LOADADDR=$(LOADADDR) \
+       KERNEL_ENTRY=$(KERNEL_ENTRY) \
+       RAMSTART=$(RAMSTART) \
+       RAMSIZE=$(RAMSIZE)
+
+CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
+       -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 
-mno-abicalls -fno-pic \
+       -pipe -mlong-calls -fno-common \
+       -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap 
\
+       -DLOADADDR=$(LOADADDR)
+
+define Build/Clean
+       $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) 
clean
+endef
+
+define Image/Build/squashfs
+       cp $(KDIR)/root.squashfs $(KDIR)/root.squashfs-64k
+       $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs-64k 64
+       cp $(KDIR)/root.squashfs-64k $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs-64k
+       $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+endef
+
+define Image/Build/AudioCodes
+       ( dd if=$(KDIR)/vmlinux.elf bs=64k conv=sync | dd if=$(KDIR)/root.$(1) 
) > $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(1).bin
+endef
+
+define Image/Build
+       $(call Image/Build/AudioCodes,$(1),mp202,$(1))
+endef
+
+$(eval $(call BuildImage))
diff --git a/target/linux/ac49x/patches/100-ac49x.patch 
b/target/linux/ac49x/patches/100-ac49x.patch
new file mode 100644
index 0000000..58b85c8
--- /dev/null
+++ b/target/linux/ac49x/patches/100-ac49x.patch
@@ -0,0 +1,88 @@
+--- a/arch/mips/Kbuild.platforms
++++ b/arch/mips/Kbuild.platforms
+@@ -1,5 +1,6 @@
+ # All platforms listed in alphabetic order
+ 
++platforms += ac49x
+ platforms += alchemy
+ platforms += ar7
+ platforms += ath79
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -54,6 +54,25 @@ config MIPS_ALCHEMY
+       select USB_ARCH_HAS_OHCI
+       select USB_ARCH_HAS_EHCI
+ 
++config AC49X
++      bool "AudioCodes AC49X"
++      select BOOT_ELF32
++      select DMA_NONCOHERENT
++      select CEVT_R4K
++      select CSRC_R4K
++      select IRQ_CPU
++      select NO_EXCEPT_FILL
++      select SWAP_IO_SPACE
++      select SYS_HAS_CPU_MIPS32_R1
++      select SYS_HAS_EARLY_PRINTK
++      select SYS_SUPPORTS_32BIT_KERNEL
++      select SYS_SUPPORTS_LITTLE_ENDIAN
++      select SYS_SUPPORTS_ZBOOT_UART16550
++      select ARCH_REQUIRE_GPIOLIB
++      select VLYNQ
++      help
++        Support for the AudioCodes AC49X System-on-a-Chip family.
++
+ config AR7
+       bool "Texas Instruments AR7"
+       select BOOT_ELF32
+@@ -813,6 +832,7 @@ config NLM_XLP_BOARD
+ 
+ endchoice
+ 
++source "arch/mips/ac49x/Kconfig"
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+ source "arch/mips/bcm47xx/Kconfig"
+--- a/drivers/tty/serial/Kconfig
++++ b/drivers/tty/serial/Kconfig
+@@ -1347,4 +1347,28 @@ config SERIAL_AR933X_NR_UARTS
+         Set this to the number of serial ports you want the driver
+         to support.
+ 
++
++config SERIAL_AC49X
++      bool "AC49X serial port support"
++      depends on SOC_AC49X
++      select SERIAL_CORE
++      help
++        If you have an AudioCodes AC49X SOC based board and want to use the
++        built-in UART of the SoC, say Y to this option.
++
++config SERIAL_AC49X_CONSOLE
++      bool "Console on AC49X serial port"
++      depends on SERIAL_AC49X=y
++      select SERIAL_CORE_CONSOLE
++      help
++        Enable a built-in UART port of the AC49X to be the system console.
++
++config SERIAL_AC49X_NR_UARTS
++      int "Maximum number of AC49X serial ports"
++      depends on SERIAL_AC49X
++      default "2"
++      help
++        Set this to the number of serial ports you want the driver
++        to support.
++
+ endmenu
+--- a/include/linux/serial_core.h
++++ b/include/linux/serial_core.h
+@@ -210,6 +210,9 @@
+ /* Atheros AR933X SoC */
+ #define PORT_AR933X   99
+ 
++/* AudioCodes AC49X SoC */
++#define PORT_AC49X    100
++
+ 
+ #ifdef __KERNEL__
+ 
diff --git a/target/linux/ac49x/patches/110-flash.patch 
b/target/linux/ac49x/patches/110-flash.patch
new file mode 100644
index 0000000..da6949f
--- /dev/null
+++ b/target/linux/ac49x/patches/110-flash.patch
@@ -0,0 +1,37 @@
+--- a/drivers/mtd/maps/physmap.c
++++ b/drivers/mtd/maps/physmap.c
+@@ -78,7 +78,7 @@ static const char *rom_probe_types[] = {
+                                       "map_rom",
+                                       NULL };
+ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs",
+-                                        NULL };
++                                        "ac49xpart", NULL };
+ 
+ static int physmap_flash_probe(struct platform_device *dev)
+ {
+--- a/drivers/mtd/Makefile
++++ b/drivers/mtd/Makefile
+@@ -10,6 +10,7 @@ obj-$(CONFIG_MTD_OF_PARTS)   += ofpart.o
+ obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
+ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
+ obj-$(CONFIG_MTD_AFS_PARTS)   += afs.o
++obj-$(CONFIG_MTD_AC49X_PARTS) += ac49xpart.o
+ obj-$(CONFIG_MTD_AR7_PARTS)   += ar7part.o
+ obj-$(CONFIG_MTD_BCM63XX_PARTS)       += bcm63xxpart.o
+ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
+--- a/drivers/mtd/Kconfig
++++ b/drivers/mtd/Kconfig
+@@ -143,6 +143,13 @@ config MTD_OF_PARTS
+         the partition map from the children of the flash node,
+         as described in Documentation/devicetree/booting-without-of.txt.
+ 
++config MTD_AC49X_PARTS
++      tristate "AudioCodes AC49x partitioning support"
++      ---help---
++        AudioCodes AC49x partitioning support
++        This uses the PSPBoot environment as hint for partitions and
++        identifies them via MAGIC.
++
+ config MTD_AR7_PARTS
+       tristate "TI AR7 partitioning support"
+       ---help---
diff --git a/target/linux/ac49x/patches/120-gpio_chrdev.patch 
b/target/linux/ac49x/patches/120-gpio_chrdev.patch
new file mode 100644
index 0000000..0685ca6
--- /dev/null
+++ b/target/linux/ac49x/patches/120-gpio_chrdev.patch
@@ -0,0 +1,28 @@
+--- a/drivers/char/Kconfig
++++ b/drivers/char/Kconfig
+@@ -478,6 +478,15 @@ config MWAVE
+         To compile this driver as a module, choose M here: the
+         module will be called mwave.
+ 
++config AC49X_GPIO
++      tristate "AudioCodes AC49X GPIO Support"
++      depends on AC49X
++      help
++        Give userspace access to the GPIO pins on the AudioCodes AC49X
++        processors.
++
++        If compiled as a module, it will be called ac49x_gpio.
++
+ config SCx200_GPIO
+       tristate "NatSemi SCx200 GPIO Support"
+       depends on SCx200
+--- a/drivers/char/Makefile
++++ b/drivers/char/Makefile
+@@ -44,6 +44,7 @@ obj-$(CONFIG_HW_RANDOM)              += hw_random/
+ obj-$(CONFIG_PPDEV)           += ppdev.o
+ obj-$(CONFIG_NWBUTTON)                += nwbutton.o
+ obj-$(CONFIG_NWFLASH)         += nwflash.o
++obj-$(CONFIG_AC49X_GPIO)      += ac49x_gpio.o
+ obj-$(CONFIG_SCx200_GPIO)     += scx200_gpio.o
+ obj-$(CONFIG_PC8736x_GPIO)    += pc8736x_gpio.o
+ obj-$(CONFIG_NSC_GPIO)                += nsc_gpio.o
diff --git a/target/linux/ac49x/patches/160-vlynq_try_remote_first.patch 
b/target/linux/ac49x/patches/160-vlynq_try_remote_first.patch
new file mode 100644
index 0000000..437bc89
--- /dev/null
+++ b/target/linux/ac49x/patches/160-vlynq_try_remote_first.patch
@@ -0,0 +1,20 @@
+--- a/drivers/vlynq/vlynq.c
++++ b/drivers/vlynq/vlynq.c
+@@ -514,9 +514,14 @@ static int __vlynq_enable_device(struct
+                               !__vlynq_try_external(dev))
+                               return 0;
+               } else {
+-                      if (!__vlynq_try_external(dev) ||
+-                              !__vlynq_try_local(dev)    ||
+-                              !__vlynq_try_remote(dev))
++            /* XXX: I don't really know what difference it makes, if the order
++             * of the following calls is changed, but at least in this order
++             * my fritzbox doesn't hang at startup as in
++             * https://dev.openwrt.org/ticket/7324
++             */
++                      if (!__vlynq_try_remote(dev) ||
++                              !__vlynq_try_local(dev)  ||
++                              !__vlynq_try_external(dev))
+                               return 0;
+               }
+               break;
diff --git a/target/linux/ac49x/patches/500-serial_kludge.patch 
b/target/linux/ac49x/patches/500-serial_kludge.patch
new file mode 100644
index 0000000..f557cd5
--- /dev/null
+++ b/target/linux/ac49x/patches/500-serial_kludge.patch
@@ -0,0 +1,28 @@
+--- a/drivers/tty/serial/8250/8250.c
++++ b/drivers/tty/serial/8250/8250.c
+@@ -290,6 +290,13 @@ static const struct serial8250_config ua
+               .fcr            = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
+               .flags          = UART_CAP_FIFO | UART_CAP_AFE | UART_CAP_EFR,
+       },
++      [PORT_AC49X] = {
++              .name           = "AC49X",
++              .fifo_size      = 16,
++              .tx_loadsz      = 16,
++              .fcr            = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00,
++              .flags          = UART_CAP_FIFO | UART_CAP_AFE,
++      },
+ };
+ 
+ #if defined(CONFIG_MIPS_ALCHEMY)
+@@ -2798,7 +2805,11 @@ static void serial8250_console_putchar(s
+       struct uart_8250_port *up =
+               container_of(port, struct uart_8250_port, port);
+ 
++#ifdef CONFIG_AC49X
++      wait_for_xmitr(up, BOTH_EMPTY);
++#else
+       wait_for_xmitr(up, UART_LSR_THRE);
++#endif
+       serial_out(up, UART_TX, ch);
+ }
+ 
diff --git a/target/linux/ac49x/patches/950-add-ac49x-ethernet.patch 
b/target/linux/ac49x/patches/950-add-ac49x-ethernet.patch
new file mode 100644
index 0000000..22fe3b4
--- /dev/null
+++ b/target/linux/ac49x/patches/950-add-ac49x-ethernet.patch
@@ -0,0 +1,20 @@
+--- a/drivers/net/ethernet/Kconfig
++++ b/drivers/net/ethernet/Kconfig
+@@ -18,6 +18,7 @@ config SUNGEM_PHY
+       tristate
+ 
+ source "drivers/net/ethernet/3com/Kconfig"
++source "drivers/net/ethernet/ac/Kconfig"
+ source "drivers/net/ethernet/adaptec/Kconfig"
+ source "drivers/net/ethernet/aeroflex/Kconfig"
+ source "drivers/net/ethernet/alteon/Kconfig"
+--- a/drivers/net/ethernet/Makefile
++++ b/drivers/net/ethernet/Makefile
+@@ -4,6 +4,7 @@
+ 
+ obj-$(CONFIG_NET_VENDOR_3COM) += 3com/
+ obj-$(CONFIG_NET_VENDOR_8390) += 8390/
++obj-$(CONFIG_NET_VENDOR_AUDIOCODES) += ac/
+ obj-$(CONFIG_NET_VENDOR_ADAPTEC) += adaptec/
+ obj-$(CONFIG_GRETH) += aeroflex/
+ obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
diff --git a/target/linux/ac49x/patches/960-enable-vlynq-for-ac49x.patch 
b/target/linux/ac49x/patches/960-enable-vlynq-for-ac49x.patch
new file mode 100644
index 0000000..72b704e
--- /dev/null
+++ b/target/linux/ac49x/patches/960-enable-vlynq-for-ac49x.patch
@@ -0,0 +1,9 @@
+--- a/drivers/vlynq/Kconfig
++++ b/drivers/vlynq/Kconfig
+@@ -1,5 +1,5 @@
+ menu "TI VLYNQ"
+-      depends on AR7 && EXPERIMENTAL
++      depends on ( AR7 || AC49X ) && EXPERIMENTAL
+ 
+ config VLYNQ
+       bool "TI VLYNQ bus support"
diff --git a/target/linux/ac49x/patches/980-zboot-port.patch 
b/target/linux/ac49x/patches/980-zboot-port.patch
new file mode 100644
index 0000000..18ea8ff
--- /dev/null
+++ b/target/linux/ac49x/patches/980-zboot-port.patch
@@ -0,0 +1,14 @@
+--- a/arch/mips/boot/compressed/uart-16550.c
++++ b/arch/mips/boot/compressed/uart-16550.c
+@@ -13,6 +13,11 @@
+ #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
+ #endif
+ 
++#ifdef CONFIG_AC49X
++#include <ac49x.h>
++#define PORT(offset) (CKSEG1ADDR(AC49X_REGS_UART0) + (4 * offset))
++#endif
++
+ #ifdef CONFIG_AR7
+ #include <ar7.h>
+ #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))

Attachment: pgpHL9xbBVfSy.pgp
Description: PGP signature

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

Reply via email to