Hi,

On 01/11/2015 15:15, Hauke Mehrtens wrote:
> This is based on patches from Federico Fissore <f.fiss...@arduino.cc>
> especially this one:
> https://github.com/arduino/openwrt-yun/commit/7e2976fa83fb0d72a955574499178c387a1b3c92
> 
> The console is running with 250000 baud which is a non standard baud
> rate and needs an extra patch to be applied, I will try to get this
> patch upstream or something else which accomplish the same.

that patch and the gpio one need to commited separatley with a proper
description. i would also remove the Lininio from the patches name.

> 
> Some upstream code looks like there are many different versions of this
> SoC, are these only internal versions and all versions on the consumer
> market are the same? I saw different GPIO configuration and flash sizes
> of 8MB and 16MB?

hehe and a shield adapter that does not work with normal 2,54mil

> Should I name it Arduino Yun or Genuino Yun or Linino Yun? My device
> has Arduino Yun printed on it so I would prefer that.

arduino i guess

        John

> 
> Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>
> CC: Federico Fissore <f.fiss...@arduino.cc>
> ---
>  .../ar71xx/base-files/etc/uci-defaults/01_leds     |   5 +
>  .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
>  target/linux/ar71xx/config-4.1                     |   5 +-
>  .../files/arch/mips/ath79/mach-arduino-yun.c       | 137 
> +++++++++++++++++++++
>  target/linux/ar71xx/generic/profiles/linino.mk     |  18 +++
>  target/linux/ar71xx/image/Makefile                 |   5 +
>  .../700-MIPS-ath79-openwrt-machines.patch          |   2 +-
>  .../817-MIPS-ath79-Linino-gpio-support.patch       |  68 ++++++++++
>  .../818-MIPS-ath79-Linino-uart-fix-baudrate.patch  |  57 +++++++++
>  .../819-MIPS-ath79-Linino-support.patch            |  42 +++++++
>  12 files changed, 342 insertions(+), 2 deletions(-)
>  create mode 100644 
> target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c
>  create mode 100644 target/linux/ar71xx/generic/profiles/linino.mk
>  create mode 100644 
> target/linux/ar71xx/patches-4.1/817-MIPS-ath79-Linino-gpio-support.patch
>  create mode 100644 
> target/linux/ar71xx/patches-4.1/818-MIPS-ath79-Linino-uart-fix-baudrate.patch
>  create mode 100644 
> target/linux/ar71xx/patches-4.1/819-MIPS-ath79-Linino-support.patch
> 
> diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 
> b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> index abed456..8c1a0bc 100644
> --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
> @@ -43,6 +43,11 @@ antminer-s3)
>       ucidef_set_led_default "lan" "LAN" "antminer-s3:yellow:lan" "0"
>       ;;
>  
> +arduino-yun)
> +     ucidef_set_led_wlan "wlan" "WLAN" "arduino:blue:wlan" "phy0tpt"
> +     ucidef_set_led_usbdev "usb" "USB" "arduino:white:usb" "1-1.1"
> +     ;;
> +
>  ap113)
>       ucidef_set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
>       ;;
> diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
> b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> index f6ac891..c729594 100644
> --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
> @@ -386,6 +386,7 @@ wp543)
>       ucidef_set_interface_lan "eth0"
>       ;;
>  
> +arduino-yun | \
>  dir-505-a1)
>       ucidef_set_interface_lan "eth1"
>       ;;
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 5f02e4e..5a0c322 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -359,6 +359,9 @@ ar71xx_board_detect() {
>       *Antminer-S3)
>               name="antminer-s3"
>               ;;
> +     *"Arduino Yun")
> +             name="arduino-yun"
> +             ;;
>       *AP113)
>               name="ap113"
>               ;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index a464fee..987e4cf 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -173,6 +173,7 @@ platform_check_image() {
>               ;;
>       alfa-ap96 | \
>       alfa-nx | \
> +     arduino-yun | \
>       ap113 | \
>       ap121 | \
>       ap121-mini | \
> diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
> index 6d31f67..30f22e6 100644
> --- a/target/linux/ar71xx/config-4.1
> +++ b/target/linux/ar71xx/config-4.1
> @@ -46,6 +46,7 @@ CONFIG_ATH79_MACH_AP81=y
>  CONFIG_ATH79_MACH_AP83=y
>  CONFIG_ATH79_MACH_AP96=y
>  CONFIG_ATH79_MACH_ARCHER_C7=y
> +CONFIG_ATH79_MACH_ARDUINO_YUN=y
>  CONFIG_ATH79_MACH_AW_NR580=y
>  CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
>  CONFIG_ATH79_MACH_BSB=y
> @@ -192,6 +193,8 @@ CONFIG_CPU_R4K_FPU=y
>  CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
>  CONFIG_CPU_SUPPORTS_HIGHMEM=y
>  CONFIG_CPU_SUPPORTS_MSA=y
> +CONFIG_CRYPTO_RNG2=y
> +CONFIG_CRYPTO_WORKQUEUE=y
>  CONFIG_CSRC_R4K=y
>  CONFIG_DMA_NONCOHERENT=y
>  CONFIG_EARLY_PRINTK=y
> @@ -333,7 +336,7 @@ CONFIG_SOC_AR933X=y
>  CONFIG_SOC_AR934X=y
>  CONFIG_SOC_QCA953X=y
>  CONFIG_SOC_QCA955X=y
> -# CONFIG_SOC_QCA956X is not set
> +CONFIG_SOC_QCA956X=y
>  CONFIG_SPI=y
>  CONFIG_SPI_AP83=y
>  CONFIG_SPI_ATH79=y
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c 
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c
> new file mode 100644
> index 0000000..fbe1f99
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-arduino-yun.c
> @@ -0,0 +1,137 @@
> +/*
> + *  Arduino Yun support
> + *
> + *  Copyright (C) 2011-2012 Gabor Juhos <juh...@openwrt.org>
> + *  Copyright (C) 2015 Hauke Mehrtens <ha...@hauke-m.de>
> + *
> + *  This program is free software; you can redistribute it and/or modify it
> + *  under the terms of the GNU General Public License version 2 as published
> + *  by the Free Software Foundation.
> + */
> +
> +#include "dev-eth.h"
> +#include "dev-gpio-buttons.h"
> +#include "dev-leds-gpio.h"
> +#include "dev-m25p80.h"
> +#include "dev-spi.h"
> +#include "dev-usb.h"
> +#include "dev-wmac.h"
> +#include "machtypes.h"
> +#include <asm/mach-ath79/ar71xx_regs.h>
> +#include <asm/mach-ath79/ath79.h>
> +#include "common.h"
> +#include "gpio.h"
> +#include "linux/gpio.h"
> +
> +// Uncomment to have reset on gpio18 instead of gipo7
> +#define DS2_B
> +
> +#define DS_GPIO_LED_WLAN             0
> +#define DS_GPIO_LED_USB                      1
> +
> +#define DS_GPIO_OE                   21
> +#define DS_GPIO_AVR_RESET            18
> +
> +// Maintained to have the console in the previous version of DS2 working
> +#define DS_GPIO_AVR_RESET_DS2                7
> +
> +#define DS_GPIO_OE2                  22
> +#define DS_GPIO_UART_ENA             23
> +#define DS_GPIO_CONF_BTN             20
> +
> +#define DS_KEYS_POLL_INTERVAL                20      /* msecs */
> +#define DS_KEYS_DEBOUNCE_INTERVAL    (3 * DS_KEYS_POLL_INTERVAL)
> +
> +#define DS_MAC0_OFFSET                       0x0000
> +#define DS_MAC1_OFFSET                       0x0006
> +#define DS_CALDATA_OFFSET            0x1000
> +#define DS_WMAC_MAC_OFFSET           0x1002
> +
> +
> +static struct gpio_led ds_leds_gpio[] __initdata = {
> +     {
> +             .name           = "arduino:white:usb",
> +             .gpio           = DS_GPIO_LED_USB,
> +             .active_low     = 0,
> +     },
> +     {
> +             .name           = "arduino:blue:wlan",
> +             .gpio           = DS_GPIO_LED_WLAN,
> +             .active_low     = 0,
> +     },
> +};
> +
> +static void __init ds_common_setup(void)
> +{
> +     static u8 mac[6];
> +
> +     u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
> +     ath79_register_m25p80(NULL);
> +
> +     if (ar93xx_wmac_read_mac_address(mac)) {
> +             ath79_register_wmac(NULL, NULL);
> +     } else {
> +             ath79_register_wmac(art + DS_CALDATA_OFFSET,
> +                                 art + DS_WMAC_MAC_OFFSET);
> +             memcpy(mac, art + DS_WMAC_MAC_OFFSET, sizeof(mac));
> +     }
> +
> +     mac[3] |= 0x08;
> +     ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> +
> +     mac[3] &= 0xF7;
> +     ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
> +     ath79_register_mdio(0, 0x0);
> +
> +     /* LAN ports */
> +     ath79_register_eth(1);
> +
> +     /* WAN port */
> +     ath79_register_eth(0);
> +}
> +
> +static void __init ds_setup(void)
> +{
> +     u32 t;
> +
> +     ds_common_setup();
> +
> +     ath79_register_leds_gpio(-1, ARRAY_SIZE(ds_leds_gpio),
> +                              ds_leds_gpio);
> +     ath79_register_usb();
> +
> +     //Disable the Function for some pins to have GPIO functionality active
> +     // GPIO6-7-8 and GPIO11
> +     ath79_gpio_function_setup(AR933X_GPIO_FUNC_JTAG_DISABLE | 
> AR933X_GPIO_FUNC_I2S_MCK_EN, 0);
> +
> +     ath79_gpio_function2_setup(AR933X_GPIO_FUNC2_JUMPSTART_DISABLE, 0);
> +
> +     printk("Setting DogStick2 GPIO\n");
> +
> +     t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
> +     t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN;
> +     ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t);
> +
> +     // Put the avr reset to high 
> +     if (gpio_request_one(DS_GPIO_AVR_RESET_DS2,
> +         GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0)
> +             printk("Error setting GPIO OE\n");
> +     gpio_unexport(DS_GPIO_AVR_RESET_DS2);
> +     gpio_free(DS_GPIO_AVR_RESET_DS2);
> +
> +     // enable OE of level shifter
> +     if (gpio_request_one(DS_GPIO_OE,
> +         GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-1") != 0)
> +             printk("Error setting GPIO OE\n");
> +
> +     if (gpio_request_one(DS_GPIO_UART_ENA,
> +         GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "UART-ENA") != 0)
> +             printk("Error setting GPIO Uart Enable\n");
> +
> +     // enable OE of level shifter
> +     if (gpio_request_one(DS_GPIO_OE2,
> +         GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, "OE-2") != 0)
> +             printk("Error setting GPIO OE2\n");
> +}
> +
> +MIPS_MACHINE(ATH79_MACH_ARDUINO_YUN, "Yun", "Arduino Yun", ds_setup);
> diff --git a/target/linux/ar71xx/generic/profiles/linino.mk 
> b/target/linux/ar71xx/generic/profiles/linino.mk
> new file mode 100644
> index 0000000..9a34759
> --- /dev/null
> +++ b/target/linux/ar71xx/generic/profiles/linino.mk
> @@ -0,0 +1,18 @@
> +#
> +# Copyright (C) 2009-2010 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +define Profile/Yun
> +     NAME:=Arduino Yun based on Atheros AR9331
> +     PACKAGES:=kmod-usb-core kmod-usb2
> +endef
> +
> +define Profile/Yun/Description
> +     Package set optimized for the Arduino Yun.
> +endef
> +
> +$(eval $(call Profile,Yun))
> +
> diff --git a/target/linux/ar71xx/image/Makefile 
> b/target/linux/ar71xx/image/Makefile
> index ddc0fc1..7e92a36 100644
> --- a/target/linux/ar71xx/image/Makefile
> +++ b/target/linux/ar71xx/image/Makefile
> @@ -1481,6 +1481,8 @@ 
> mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdat
>  
> mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro
>  
> zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
>  
> qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
> +yun_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6464k(rootfs),1280k(kernel),64k(nvram),64k(art),7744k@0x50000(firmware)
> +yun_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware)
>  
>  
>  define Image/BuildKernel
> @@ -2208,6 +2210,8 @@ $(eval $(call 
> SingleProfile,AthLzma,64k,WLR8100,wlr8100,WLR8100,ttyS0,115200,$$(
>  $(eval $(call 
> SingleProfile,AthLzma,64k,WPJ344_16M,wpj344-16M,WPJ344,ttyS0,115200,$$(wpj344_mtdlayout_16M),KRuImage,65536))
>  $(eval $(call 
> SingleProfile,AthLzma,64k,WPJ531_16M,wpj531-16M,WPJ531,ttyS0,115200,$$(wpj531_mtdlayout_16M),KRuImage,65536))
>  $(eval $(call 
> SingleProfile,AthLzma,64k,WPJ558_16M,wpj558-16M,WPJ558,ttyS0,115200,$$(wpj558_mtdlayout_16M),KRuImage,65536))
> +$(eval $(call 
> SingleProfile,AthLzma,64k,YUN_8M,yun-8M,Yun,ttyATH0,250000,$$(yun_mtdlayout_8M),RKuImage))
> +$(eval $(call 
> SingleProfile,AthLzma,64k,YUN_16M,yun-16M,Yun,ttyATH0,250000,$$(yun_mtdlayout_16M),RKuImage))
>  
>  $(eval $(call 
> SingleProfile,Belkin,64k,F9K1115V2,f9k1115v2,F9K1115V2,ttyS0,115200,$$(f9k1115v2_mtdlayout),BR-6679BAC))
>  
> @@ -2334,6 +2338,7 @@ $(eval $(call MultiProfile,WPE72,WPE72_4M WPE72_8M 
> WPE72_16M))
>  $(eval $(call MultiProfile,WPJ344,WPJ344_16M))
>  $(eval $(call MultiProfile,WPJ531,WPJ531_16M))
>  $(eval $(call MultiProfile,WPJ558,WPJ558_16M))
> +$(eval $(call MultiProfile,Yun,YUN_16M YUN_8M))
>  
>  $(eval $(call MultiProfile,Minimal,$(SINGLE_PROFILES)))
>  $(eval $(call MultiProfile,Madwifi,EAP7660D WP543))
> diff --git 
> a/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch 
> b/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch
> index 17cabe1..324da0c 100644
> --- a/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch
> +++ b/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch
> @@ -1721,7 +1721,7 @@
>  +obj-$(CONFIG_ATH79_MACH_NBG6716)    += mach-nbg6716.o
>  --- a/arch/mips/ath79/prom.c
>  +++ b/arch/mips/ath79/prom.c
> -@@ -130,6 +130,13 @@ void __init prom_init(void)
> +@@ -136,6 +136,13 @@ void __init prom_init(void)
>               initrd_end = initrd_start + fw_getenvl("initrd_size");
>       }
>   #endif
> diff --git 
> a/target/linux/ar71xx/patches-4.1/817-MIPS-ath79-Linino-gpio-support.patch 
> b/target/linux/ar71xx/patches-4.1/817-MIPS-ath79-Linino-gpio-support.patch
> new file mode 100644
> index 0000000..2fe5e18
> --- /dev/null
> +++ b/target/linux/ar71xx/patches-4.1/817-MIPS-ath79-Linino-gpio-support.patch
> @@ -0,0 +1,68 @@
> +--- a/arch/mips/ath79/common.h
> ++++ b/arch/mips/ath79/common.h
> +@@ -27,6 +27,7 @@ void ath79_ddr_wb_flush(unsigned int reg
> + void ath79_gpio_function_enable(u32 mask);
> + void ath79_gpio_function_disable(u32 mask);
> + void ath79_gpio_function_setup(u32 set, u32 clear);
> ++void ath79_gpio_function2_setup(u32 set, u32 clear);
> + void ath79_gpio_output_select(unsigned gpio, u8 val);
> + int ath79_gpio_direction_select(unsigned gpio, bool oe);
> + void ath79_gpio_init(void);
> +--- a/arch/mips/ath79/gpio.c
> ++++ b/arch/mips/ath79/gpio.c
> +@@ -193,6 +193,36 @@ static void __iomem *ath79_gpio_get_func
> +     return ath79_gpio_base + reg;
> + }
> + 
> ++static void __iomem *ath79_gpio_get_function2_reg(void)
> ++{
> ++    u32 reg = 0;
> ++
> ++    if (soc_is_ar71xx() ||
> ++        soc_is_ar724x() ||
> ++        soc_is_ar913x() ||
> ++        soc_is_ar933x())
> ++            reg = AR71XX_GPIO_REG_FUNC_2;
> ++    else
> ++            BUG();
> ++
> ++    return ath79_gpio_base + reg;
> ++}
> ++
> ++
> ++void ath79_gpio_function2_setup(u32 set, u32 clear)
> ++{
> ++    void __iomem *reg = ath79_gpio_get_function2_reg();
> ++    unsigned long flags;
> ++
> ++    spin_lock_irqsave(&ath79_gpio_lock, flags);
> ++
> ++    __raw_writel((__raw_readl(reg) & ~clear) | set, reg);
> ++    /* flush write */
> ++    __raw_readl(reg);
> ++
> ++    spin_unlock_irqrestore(&ath79_gpio_lock, flags);
> ++}
> ++
> + void ath79_gpio_function_setup(u32 set, u32 clear)
> + {
> +     void __iomem *reg = ath79_gpio_get_function_reg();
> +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> ++++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> +@@ -840,6 +840,7 @@
> + #define AR71XX_GPIO_REG_INT_PENDING 0x20
> + #define AR71XX_GPIO_REG_INT_ENABLE  0x24
> + #define AR71XX_GPIO_REG_FUNC                0x28
> ++#define AR71XX_GPIO_REG_FUNC_2              0x30
> + 
> + #define AR934X_GPIO_REG_OUT_FUNC0   0x2c
> + #define AR934X_GPIO_REG_OUT_FUNC1   0x30
> +@@ -964,6 +965,8 @@
> + #define AR724X_GPIO_FUNC_UART_EN            BIT(1)
> + #define AR724X_GPIO_FUNC_JTAG_DISABLE               BIT(0)
> + 
> ++#define AR933X_GPIO_FUNC2_JUMPSTART_DISABLE         BIT(9)
> ++
> + #define AR913X_GPIO_FUNC_WMAC_LED_EN                BIT(22)
> + #define AR913X_GPIO_FUNC_EXP_PORT_CS_EN             BIT(21)
> + #define AR913X_GPIO_FUNC_I2S_REFCLKEN               BIT(20)
> diff --git 
> a/target/linux/ar71xx/patches-4.1/818-MIPS-ath79-Linino-uart-fix-baudrate.patch
>  
> b/target/linux/ar71xx/patches-4.1/818-MIPS-ath79-Linino-uart-fix-baudrate.patch
> new file mode 100644
> index 0000000..c64bdb2
> --- /dev/null
> +++ 
> b/target/linux/ar71xx/patches-4.1/818-MIPS-ath79-Linino-uart-fix-baudrate.patch
> @@ -0,0 +1,57 @@
> +--- a/drivers/tty/serial/serial_core.c
> ++++ b/drivers/tty/serial/serial_core.c
> +@@ -164,6 +164,8 @@ static int uart_port_startup(struct tty_
> +     if (retval == 0) {
> +             if (uart_console(uport) && uport->cons->cflag) {
> +                     tty->termios.c_cflag = uport->cons->cflag;
> ++                    tty->termios.c_ospeed = uport->cons->baud;
> ++                    tty->termios.c_ispeed = uport->cons->baud;
> +                     uport->cons->cflag = 0;
> +             }
> +             /*
> +@@ -1901,7 +1903,7 @@ static const struct baud_rates baud_rate
> +     {   4800, B4800   },
> +     {   2400, B2400   },
> +     {   1200, B1200   },
> +-    {      0, B38400  }
> ++    {      0, BOTHER  }
> + };
> + 
> + /**
> +@@ -1940,10 +1942,13 @@ uart_set_options(struct uart_port *port,
> +      * Construct a cflag setting.
> +      */
> +     for (i = 0; baud_rates[i].rate; i++)
> +-            if (baud_rates[i].rate <= baud)
> ++            if (baud_rates[i].rate == baud)
> +                     break;
> + 
> +     termios.c_cflag |= baud_rates[i].cflag;
> ++    if (!baud_rates[i].rate) {
> ++            termios.c_ospeed = baud;
> ++    }
> + 
> +     if (bits == 7)
> +             termios.c_cflag |= CS7;
> +@@ -1973,8 +1978,10 @@ uart_set_options(struct uart_port *port,
> +      * Allow the setting of the UART parameters with a NULL console
> +      * too:
> +      */
> +-    if (co)
> ++    if (co) {
> +             co->cflag = termios.c_cflag;
> ++            co->baud = baud;
> ++    }
> + 
> +     return 0;
> + }
> +--- a/include/linux/console.h
> ++++ b/include/linux/console.h
> +@@ -127,6 +127,7 @@ struct console {
> +     short   flags;
> +     short   index;
> +     int     cflag;
> ++    int     baud;
> +     void    *data;
> +     struct   console *next;
> + };
> diff --git 
> a/target/linux/ar71xx/patches-4.1/819-MIPS-ath79-Linino-support.patch 
> b/target/linux/ar71xx/patches-4.1/819-MIPS-ath79-Linino-support.patch
> new file mode 100644
> index 0000000..7007310
> --- /dev/null
> +++ b/target/linux/ar71xx/patches-4.1/819-MIPS-ath79-Linino-support.patch
> @@ -0,0 +1,42 @@
> +--- a/arch/mips/ath79/Kconfig
> ++++ b/arch/mips/ath79/Kconfig
> +@@ -76,6 +76,19 @@ config ATH79_MACH_ANTMINER_S3
> +     select ATH79_DEV_USB
> +     select ATH79_DEV_WMAC
> + 
> ++config ATH79_MACH_ARDUINO_YUN
> ++    bool "Arduino Yun"
> ++    select SOC_AR933X
> ++    select ATH79_DEV_ETH
> ++    select ATH79_DEV_GPIO_BUTTONS
> ++    select ATH79_DEV_LEDS_GPIO
> ++    select ATH79_DEV_M25P80
> ++    select ATH79_DEV_USB
> ++    select ATH79_DEV_WMAC
> ++    help
> ++      Say 'Y' here if you want your kernel to support the
> ++      Arduino Yun.
> ++
> + config ATH79_MACH_AP113
> +     bool "Atheros AP113 board support"
> +     select SOC_AR724X
> +--- a/arch/mips/ath79/machtypes.h
> ++++ b/arch/mips/ath79/machtypes.h
> +@@ -23,6 +23,7 @@ enum ath79_mach_type {
> +     ATH79_MACH_ALL0315N,            /* Allnet ALL0315N */
> +     ATH79_MACH_ANTMINER_S1, /* Antminer S1 */
> +     ATH79_MACH_ANTMINER_S3, /* Antminer S3 */
> ++    ATH79_MACH_ARDUINO_YUN,         /* Yun */
> +     ATH79_MACH_AP113,               /* Atheros AP113 reference board */
> +     ATH79_MACH_AP121,               /* Atheros AP121 reference board */
> +     ATH79_MACH_AP121_MINI,          /* Atheros AP121-MINI reference board */
> +--- a/arch/mips/ath79/Makefile
> ++++ b/arch/mips/ath79/Makefile
> +@@ -44,6 +44,7 @@ obj-$(CONFIG_ATH79_MACH_ALL0258N)  += mac
> + obj-$(CONFIG_ATH79_MACH_ALL0315N)   += mach-all0315n.o
> + obj-$(CONFIG_ATH79_MACH_ANTMINER_S1)+= mach-antminer-s1.o
> + obj-$(CONFIG_ATH79_MACH_ANTMINER_S3)+= mach-antminer-s3.o
> ++obj-$(CONFIG_ATH79_MACH_ARDUINO_YUN)        += mach-arduino-yun.o
> + obj-$(CONFIG_ATH79_MACH_AP113)              += mach-ap113.o
> + obj-$(CONFIG_ATH79_MACH_AP121)              += mach-ap121.o
> + obj-$(CONFIG_ATH79_MACH_AP132)              += mach-ap132.o
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to