diff mbox

[OpenWrt-Devel,SIGNED-OFF] Add WeIO board (http://we-io.net) profile. This patch adds support for WeIO board, which is based on Carambola2 board from 8Devices.

Message ID 1438797376-9669-1-git-send-email-drasko.draskovic@gmail.com
State Superseded
Headers show

Commit Message

Drasko DRASKOVIC Aug. 5, 2015, 5:56 p.m. UTC
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
---
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   3 +-
 target/linux/ar71xx/config-4.1                     |   1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-weio.c | 146 +++++++++++++++++++++
 target/linux/ar71xx/generic/profiles/weio.mk       |  17 +++
 target/linux/ar71xx/image/Makefile                 |   8 ++
 .../700-MIPS-ath79-openwrt-machines.patch          |  21 ++-
 7 files changed, 193 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
 create mode 100644 target/linux/ar71xx/generic/profiles/weio.mk

Comments

Karl Palsson Aug. 8, 2015, 1:03 a.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Comments inline...

Drasko DRASKOVIC <drasko.draskovic@gmail.com> wrote:
> Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
> ---


Might just be my mail client, but might be yours, did you change
anything to send this? you seem to have lost all the commit message up
into the subject?


>  target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh      |   3 +-
>  target/linux/ar71xx/config-4.1                     |   1 +
>  .../linux/ar71xx/files/arch/mips/ath79/mach-weio.c | 146 +++++++++++++++++++++
>  target/linux/ar71xx/generic/profiles/weio.mk       |  17 +++
>  target/linux/ar71xx/image/Makefile                 |   8 ++
>  .../700-MIPS-ath79-openwrt-machines.patch          |  21 ++-
>  7 files changed, 193 insertions(+), 6 deletions(-)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
>  create mode 100644 target/linux/ar71xx/generic/profiles/weio.mk
> 
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 256bd10..80af14b 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -823,6 +823,9 @@ ar71xx_board_detect() {
>  	*"UniFi AP Pro")
>  		name="uap-pro"
>  		;;
> + 	*"WeIO")
> +		name="weio"
> +		;;       
>  	*WHR-G301N)
>  		name="whr-g301n"
>  		;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 76d8c5b..57df672 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -250,7 +250,8 @@ platform_check_image() {
>  	nbg460n_550n_550nh | \
>  	unifi | \
>  	unifi-outdoor | \
> -	carambola2 )
> +	carambola2 | \
> +	weio )
>  		[ "$magic" != "2705" ] && {
>  			echo "Invalid image type."
>  			return 1
> diff --git a/target/linux/ar71xx/config-4.1
> b/target/linux/ar71xx/config-4.1
> index 1e31a01..0f80804 100644
> --- a/target/linux/ar71xx/config-4.1
> +++ b/target/linux/ar71xx/config-4.1
> @@ -137,6 +137,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y
>  CONFIG_ATH79_MACH_TUBE2H=y
>  CONFIG_ATH79_MACH_UBNT=y
>  CONFIG_ATH79_MACH_UBNT_XM=y
> +CONFIG_ATH79_MACH_WEIO=y
>  CONFIG_ATH79_MACH_WHR_HP_G300N=y
>  CONFIG_ATH79_MACH_WLAE_AG300N=y
>  CONFIG_ATH79_MACH_WLR8100=y
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
> new file mode 100644
> index 0000000..5c707ec
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
> @@ -0,0 +1,146 @@
> +/**
> + * WEIO Web Of Things Platform
> + *
> + * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI
> + *
> + *              ##      ## ######## ####  #######  
> + *              ##  ##  ## ##        ##  ##     ## 
> + *              ##  ##  ## ##        ##  ##     ## 
> + *              ##  ##  ## ######    ##  ##     ## 
> + *              ##  ##  ## ##        ##  ##     ## 
> + *              ##  ##  ## ##        ##  ##     ## 
> + *               ###  ###  ######## ####  #######
> + *
> + *                   Web Of Things Platform
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version 2
> + * of the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> + *
> + * Authors : 
> + * Drasko DRASKOVIC <drasko.draskovic@gmail.com>
> + * Uros PETREVSKI <uros@nodesign.net>
> + */
> +
> +#include <asm/mach-ath79/ath79.h>
> +#include <asm/mach-ath79/ar71xx_regs.h>
> +#include "common.h"
> +#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 "linux/i2c-gpio.h"
> +#include "linux/platform_device.h"
> +
> +#define WEIO_GPIO_LED_STA		1
> +#define WEIO_GPIO_LED_AP		16
> +//#define WEIO_GPIO_LED_ETH0	13

It's good that you've removed the commented out ethernet code in the
other part of this file, so why is this still left here?

> +
> +#define WEIO_GPIO_BTN_AP	    20
> +#define WEIO_GPIO_BTN_RESET		23
> +
> +#define WEIO_KEYS_POLL_INTERVAL		20	/* msecs */
> +#define WEIO_KEYS_DEBOUNCE_INTERVAL	(3 * WEIO_KEYS_POLL_INTERVAL)
> +
> +#define WEIO_MAC0_OFFSET			0x0000
> +#define WEIO_MAC1_OFFSET			0x0006
> +#define WEIO_CALDATA_OFFSET		    0x1000
> +#define WEIO_WMAC_MAC_OFFSET		0x1002
> +
> +static struct gpio_led weio_leds_gpio[] __initdata = {
> +	{
> +		.name		= "weio:green:sta",
> +		.gpio		= WEIO_GPIO_LED_STA,
> +		.active_low	= 1,
> +        .default_state = LEDS_GPIO_DEFSTATE_ON,
> +	}, {
> +		.name		= "weio:green:ap",
> +		.gpio		= WEIO_GPIO_LED_AP,
> +		.active_low	= 1,
> +        .default_state = LEDS_GPIO_DEFSTATE_ON,
> +	}
> +};
> +
> +static struct gpio_keys_button weio_gpio_keys[] __initdata = {
> +	{
> +		.desc		= "ap button",
> +		.type		= EV_KEY,
> +		.code		= BTN_0,
> +		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
> +		.gpio		= WEIO_GPIO_BTN_AP,
> +		.active_low	= 1,
> +	},
> +	{
> +		.desc		= "soft-reset button",
> +		.type		= EV_KEY,
> +		.code		= BTN_1,
> +		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
> +		.gpio		= WEIO_GPIO_BTN_RESET,
> +		.active_low	= 1,
> +	}
> +};
> +
> +static struct i2c_gpio_platform_data weio_i2c_gpio_data = {
> +	.sda_pin        = 18,
> +	.scl_pin        = 19,
> +};
> +
> +static struct platform_device weio_i2c_gpio = {
> +	.name           = "i2c-gpio",
> +	.id             = 0,
> +	.dev     = {
> +		.platform_data  = &weio_i2c_gpio_data,
> +	},
> +};
> +
> +static struct platform_device *weio_devices[] __initdata = {
> +        &weio_i2c_gpio
> +};
> +
> +static void __init weio_common_setup(void)
> +{
> +	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
> +
> +	ath79_register_m25p80(NULL);
> +	ath79_register_wmac(art + WEIO_CALDATA_OFFSET,
> +			    art + WEIO_WMAC_MAC_OFFSET);
> +}

It looks like the whitespace in those structs is all of mixed style?

> +
> +static void __init weio_setup(void)
> +{
> +	weio_common_setup();
> +
> +    
> +	ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
> +				AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
> +				AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
> +				AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
> +                AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
> +
> +    platform_add_devices(weio_devices, ARRAY_SIZE(weio_devices));
> +
> +	ath79_register_leds_gpio(-1, ARRAY_SIZE(weio_leds_gpio),
> +				 weio_leds_gpio);
> +
> +	ath79_register_gpio_keys_polled(-1, WEIO_KEYS_POLL_INTERVAL,
> +					ARRAY_SIZE(weio_gpio_keys),
> +					weio_gpio_keys);
> +	ath79_register_usb();
> +}

Is there whitespace mixing here too? platform_add_... looks to be
different at least.

> +
> +MIPS_MACHINE(ATH79_MACH_WEIO, "WEIO", "WeIO board from Drasko DRASKOVIC and Uros PETREVSKI",
> +		weio_setup);
> diff --git a/target/linux/ar71xx/generic/profiles/weio.mk
> b/target/linux/ar71xx/generic/profiles/weio.mk
> new file mode 100644
> index 0000000..227cec9
> --- /dev/null
> +++ b/target/linux/ar71xx/generic/profiles/weio.mk
> @@ -0,0 +1,17 @@
> +#
> +# Copyright (C) 2013 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +define Profile/WEIO
> +        NAME:=WeIO
> +        PACKAGES:=kmod-usb-core kmod-usb2
> +endef
> +
> +define Profile/WEIO/Description
> +        Package set optimized for the WeIO board.
> +endef
> +
> +$(eval $(call Profile,WEIO))
> diff --git a/target/linux/ar71xx/image/Makefile
> b/target/linux/ar71xx/image/Makefile
> index e894d78..d750745 100644
> --- a/target/linux/ar71xx/image/Makefile
> +++ b/target/linux/ar71xx/image/Makefile
> @@ -180,6 +180,14 @@ define Device/carambola2
>  endef
>  TARGET_DEVICES += carambola2
>  
> +define Device/weio
> +  BOARDNAME = WEIO
> +  IMAGE_SIZE = 16000k
> +  CONSOLE = ttyATH0,115200
> +  MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
> +endef
> +TARGET_DEVICES += weio
> +
>  define Device/wndr3700
>    BOARDNAME = WNDR3700
>    NETGEAR_KERNEL_MAGIC = 0x33373030
> 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 02ebd1b..fa9fd0ad 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
> @@ -1,6 +1,6 @@
>  --- a/arch/mips/ath79/machtypes.h
>  +++ b/arch/mips/ath79/machtypes.h
> -@@ -16,24 +16,207 @@
> +@@ -16,24 +16,208 @@
>   
>   enum ath79_mach_type {
>   	ATH79_MACH_GENERIC = 0,
> @@ -176,6 +176,7 @@
>   	ATH79_MACH_UBNT_UNIFI_OUTDOOR,	/* Ubiquiti UnifiAP Outdoor */
>  +	ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
>   	ATH79_MACH_UBNT_XM,		/* Ubiquiti Networks XM board rev 1.0 */
> ++	ATH79_MACH_WEIO,		    /* WeIO board */
>  +	ATH79_MACH_WHR_G301N,		/* Buffalo WHR-G301N */
>  +	ATH79_MACH_WHR_HP_G300N,	/* Buffalo WHR-HP-G300N */
>  +	ATH79_MACH_WHR_HP_GN,		/* Buffalo WHR-HP-GN */
> @@ -1437,7 +1438,7 @@
>   
>   config ATH79_MACH_UBNT_XM
>   	bool "Ubiquiti Networks XM/UniFi boards"
> -@@ -83,6 +1212,97 @@ config ATH79_MACH_UBNT_XM
> +@@ -83,6 +1212,106 @@ config ATH79_MACH_UBNT_XM
>   	  Say 'Y' here if you want your kernel to support the
>   	  Ubiquiti Networks XM (rev 1.0) board.
>   
> @@ -1511,6 +1512,15 @@
>  +	select ATH79_DEV_USB
>  +	select ATH79_DEV_WMAC
>  +
> ++config ATH79_MACH_WEIO
> ++	bool "WeIO board"
> ++	select SOC_AR933X
> ++	select ATH79_DEV_GPIO_BUTTONS
> ++	select ATH79_DEV_LEDS_GPIO
> ++	select ATH79_DEV_M25P80
> ++	select ATH79_DEV_USB
> ++	select ATH79_DEV_WMAC
> ++
>  +config ATH79_MACH_BHU_BXU2000N2_A
>  +	bool "BHU BXU2000n-2 rev. A support"
>  +	select SOC_AR934X
> @@ -1535,7 +1545,7 @@
>   endmenu
>   
>   config SOC_AR71XX
> -@@ -134,7 +1354,10 @@ config ATH79_DEV_DSA
> +@@ -134,7 +1363,10 @@ config ATH79_DEV_DSA
>   config ATH79_DEV_ETH
>   	def_bool n
>   
> @@ -1547,7 +1557,7 @@
>   	def_bool n
>   
>   config ATH79_DEV_GPIO_BUTTONS
> -@@ -164,6 +1387,11 @@ config ATH79_PCI_ATH9K_FIXUP
> +@@ -164,6 +1396,11 @@ config ATH79_PCI_ATH9K_FIXUP
>   	def_bool n
>   
>   config ATH79_ROUTERBOOT
> @@ -1561,7 +1571,7 @@
>   endif
>  --- a/arch/mips/ath79/Makefile
>  +++ b/arch/mips/ath79/Makefile
> -@@ -38,9 +38,133 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
> +@@ -38,9 +38,134 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
>   #
>   # Machines
>   #
> @@ -1670,6 +1680,7 @@
>  +obj-$(CONFIG_ATH79_MACH_TUBE2H)		+= mach-tube2h.o
>  +obj-$(CONFIG_ATH79_MACH_UBNT)		+= mach-ubnt.o
>   obj-$(CONFIG_ATH79_MACH_UBNT_XM)	+= mach-ubnt-xm.o
> ++obj-$(CONFIG_ATH79_MACH_WEIO)		+= mach-weio.o
>  +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N)	+= mach-whr-hp-g300n.o
>  +obj-$(CONFIG_ATH79_MACH_WLAE_AG300N)	+= mach-wlae-ag300n.o
>  +obj-$(CONFIG_ATH79_MACH_WLR8100)	+= mach-wlr8100.o
> -- 
> 2.1.4
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Cheers,
Karl P

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJVxVVwAAoJEBmotQ/U1cr2qyoP/07Rq+xeEere5w8zJqwYP9Lo
X5nQPTZ8yflLWihWmi0D5N9ty+JnzcnurAjBYZkeASXCf9JUni0aV8O3cvWjvTNr
kOPG+ImBqPie9Fb3PhKtInifRY/PK1AJtnafIVuE7PftGBdCeJVNRTxSOQAWzZ0l
/y1LJW7pFs5bTnbLh2W+U4mNATpaN1zQDkRxjY+0YWnQ9srGZhbNxF95dqpEFl3H
1aM9nrBg9/HO6yZIhq7Q2Bq2QKzTF96+nxoSuL6dT5hdQxK4URFF5rl140cxMctN
eYSBPSilWcy2znEE/JK5RzVmTnDRofiWZWKjN5tK85EAY/dy7c1tF+JrBpKFS/Np
HWQ+6ig/ADllh50nJAT6qsWNC28Ol5tsrSGrA9Hzdpa3aliyI2cel3UjhnWtl7mh
dmtXkP4L9b7hExnxU8djfs6wuFl7VtAqpFVmtRZKn5o3zzs4q1KaTqGxFbfOVI1W
+UhWCuCWltAg84DI5RZD0kVr+bk42Bj82oTDGXe6pBxTw29h5dibGB1a95ofeFHh
UJkouob7isSRN5q/9CaCnyRwz6KKC+1G4LYxpdsbWCF6AfU8zwExYIJZImzj+7w+
DG6qXEUGU/9WrCycsafH2ZhSb0J4U3G2rsfGdw7PNyfmdcgWL+y/TXQIhQfKWZK4
yYND9S+HZQUYtosyoW8i
=0NsU
-----END PGP SIGNATURE-----
Drasko DRASKOVIC Sept. 8, 2015, 6:07 p.m. UTC | #2
Hi Karl,
corrected patch re-sent.

My comments below.

BR,
Drasko

On Sat, Aug 8, 2015 at 3:03 AM, Karl Palsson <karlp@tweak.net.au> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Comments inline...
>
> Drasko DRASKOVIC <drasko.draskovic@gmail.com> wrote:
>> Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
>> ---
>
>
> Might just be my mail client, but might be yours, did you change
> anything to send this? you seem to have lost all the commit message up
> into the subject?

Actually, I use `git send-email` directly, exactly to avoid problems
with different mail clients. All my patches are send via git.

>
>
>>  target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
>>  .../ar71xx/base-files/lib/upgrade/platform.sh      |   3 +-
>>  target/linux/ar71xx/config-4.1                     |   1 +
>>  .../linux/ar71xx/files/arch/mips/ath79/mach-weio.c | 146 +++++++++++++++++++++
>>  target/linux/ar71xx/generic/profiles/weio.mk       |  17 +++
>>  target/linux/ar71xx/image/Makefile                 |   8 ++
>>  .../700-MIPS-ath79-openwrt-machines.patch          |  21 ++-
>>  7 files changed, 193 insertions(+), 6 deletions(-)
>>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
>>  create mode 100644 target/linux/ar71xx/generic/profiles/weio.mk
>>
>> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
>> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
>> index 256bd10..80af14b 100755
>> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
>> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
>> @@ -823,6 +823,9 @@ ar71xx_board_detect() {
>>       *"UniFi AP Pro")
>>               name="uap-pro"
>>               ;;
>> +     *"WeIO")
>> +             name="weio"
>> +             ;;
>>       *WHR-G301N)
>>               name="whr-g301n"
>>               ;;
>> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>> index 76d8c5b..57df672 100755
>> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>> @@ -250,7 +250,8 @@ platform_check_image() {
>>       nbg460n_550n_550nh | \
>>       unifi | \
>>       unifi-outdoor | \
>> -     carambola2 )
>> +     carambola2 | \
>> +     weio )
>>               [ "$magic" != "2705" ] && {
>>                       echo "Invalid image type."
>>                       return 1
>> diff --git a/target/linux/ar71xx/config-4.1
>> b/target/linux/ar71xx/config-4.1
>> index 1e31a01..0f80804 100644
>> --- a/target/linux/ar71xx/config-4.1
>> +++ b/target/linux/ar71xx/config-4.1
>> @@ -137,6 +137,7 @@ CONFIG_ATH79_MACH_TL_WR941ND=y
>>  CONFIG_ATH79_MACH_TUBE2H=y
>>  CONFIG_ATH79_MACH_UBNT=y
>>  CONFIG_ATH79_MACH_UBNT_XM=y
>> +CONFIG_ATH79_MACH_WEIO=y
>>  CONFIG_ATH79_MACH_WHR_HP_G300N=y
>>  CONFIG_ATH79_MACH_WLAE_AG300N=y
>>  CONFIG_ATH79_MACH_WLR8100=y
>> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
>> b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
>> new file mode 100644
>> index 0000000..5c707ec
>> --- /dev/null
>> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
>> @@ -0,0 +1,146 @@
>> +/**
>> + * WEIO Web Of Things Platform
>> + *
>> + * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI
>> + *
>> + *              ##      ## ######## ####  #######
>> + *              ##  ##  ## ##        ##  ##     ##
>> + *              ##  ##  ## ##        ##  ##     ##
>> + *              ##  ##  ## ######    ##  ##     ##
>> + *              ##  ##  ## ##        ##  ##     ##
>> + *              ##  ##  ## ##        ##  ##     ##
>> + *               ###  ###  ######## ####  #######
>> + *
>> + *                   Web Of Things Platform
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
>> + *
>> + * Authors :
>> + * Drasko DRASKOVIC <drasko.draskovic@gmail.com>
>> + * Uros PETREVSKI <uros@nodesign.net>
>> + */
>> +
>> +#include <asm/mach-ath79/ath79.h>
>> +#include <asm/mach-ath79/ar71xx_regs.h>
>> +#include "common.h"
>> +#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 "linux/i2c-gpio.h"
>> +#include "linux/platform_device.h"
>> +
>> +#define WEIO_GPIO_LED_STA            1
>> +#define WEIO_GPIO_LED_AP             16
>> +//#define WEIO_GPIO_LED_ETH0 13
>
> It's good that you've removed the commented out ethernet code in the
> other part of this file, so why is this still left here?


Removed!


>
>> +
>> +#define WEIO_GPIO_BTN_AP         20
>> +#define WEIO_GPIO_BTN_RESET          23
>> +
>> +#define WEIO_KEYS_POLL_INTERVAL              20      /* msecs */
>> +#define WEIO_KEYS_DEBOUNCE_INTERVAL  (3 * WEIO_KEYS_POLL_INTERVAL)
>> +
>> +#define WEIO_MAC0_OFFSET                     0x0000
>> +#define WEIO_MAC1_OFFSET                     0x0006
>> +#define WEIO_CALDATA_OFFSET              0x1000
>> +#define WEIO_WMAC_MAC_OFFSET         0x1002
>> +
>> +static struct gpio_led weio_leds_gpio[] __initdata = {
>> +     {
>> +             .name           = "weio:green:sta",
>> +             .gpio           = WEIO_GPIO_LED_STA,
>> +             .active_low     = 1,
>> +        .default_state = LEDS_GPIO_DEFSTATE_ON,
>> +     }, {
>> +             .name           = "weio:green:ap",
>> +             .gpio           = WEIO_GPIO_LED_AP,
>> +             .active_low     = 1,
>> +        .default_state = LEDS_GPIO_DEFSTATE_ON,
>> +     }
>> +};
>> +
>> +static struct gpio_keys_button weio_gpio_keys[] __initdata = {
>> +     {
>> +             .desc           = "ap button",
>> +             .type           = EV_KEY,
>> +             .code           = BTN_0,
>> +             .debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
>> +             .gpio           = WEIO_GPIO_BTN_AP,
>> +             .active_low     = 1,
>> +     },
>> +     {
>> +             .desc           = "soft-reset button",
>> +             .type           = EV_KEY,
>> +             .code           = BTN_1,
>> +             .debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
>> +             .gpio           = WEIO_GPIO_BTN_RESET,
>> +             .active_low     = 1,
>> +     }
>> +};
>> +
>> +static struct i2c_gpio_platform_data weio_i2c_gpio_data = {
>> +     .sda_pin        = 18,
>> +     .scl_pin        = 19,
>> +};
>> +
>> +static struct platform_device weio_i2c_gpio = {
>> +     .name           = "i2c-gpio",
>> +     .id             = 0,
>> +     .dev     = {
>> +             .platform_data  = &weio_i2c_gpio_data,
>> +     },
>> +};
>> +
>> +static struct platform_device *weio_devices[] __initdata = {
>> +        &weio_i2c_gpio
>> +};
>> +
>> +static void __init weio_common_setup(void)
>> +{
>> +     u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
>> +
>> +     ath79_register_m25p80(NULL);
>> +     ath79_register_wmac(art + WEIO_CALDATA_OFFSET,
>> +                         art + WEIO_WMAC_MAC_OFFSET);
>> +}
>
> It looks like the whitespace in those structs is all of mixed style?

Should be OK now. Please do not hold the patch because of white
spaces, this one is pretty difficult to rebase every time because of
target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch
that must be dealt qith quilt every time, which is pretty tedious.

BR,
Drasko
Drasko DRASKOVIC Sept. 8, 2015, 6:59 p.m. UTC | #3
On Tue, Sep 8, 2015 at 8:07 PM, Drasko DRASKOVIC
<drasko.draskovic@gmail.com> wrote:
> Hi Karl,
> corrected patch re-sent.
>
> My comments below.
>
> BR,
> Drasko
>
> On Sat, Aug 8, 2015 at 3:03 AM, Karl Palsson <karlp@tweak.net.au> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Comments inline...
>>
>> Drasko DRASKOVIC <drasko.draskovic@gmail.com> wrote:
>>> Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
>>> ---
>>
>>
>> Might just be my mail client, but might be yours, did you change
>> anything to send this? you seem to have lost all the commit message up
>> into the subject?
>
> Actually, I use `git send-email` directly, exactly to avoid problems
> with different mail clients. All my patches are send via git.

I just figured out that `git send-email` will actually expect commit
message to have a subject separated by a blank line from the commit
message. Reading this helped:
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html.

Please ignore previous patch - I will re-send one with correctly
formatted commit message.

BR,
Drasko
diff mbox

Patch

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 256bd10..80af14b 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -823,6 +823,9 @@  ar71xx_board_detect() {
 	*"UniFi AP Pro")
 		name="uap-pro"
 		;;
+ 	*"WeIO")
+		name="weio"
+		;;       
 	*WHR-G301N)
 		name="whr-g301n"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 76d8c5b..57df672 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -250,7 +250,8 @@  platform_check_image() {
 	nbg460n_550n_550nh | \
 	unifi | \
 	unifi-outdoor | \
-	carambola2 )
+	carambola2 | \
+	weio )
 		[ "$magic" != "2705" ] && {
 			echo "Invalid image type."
 			return 1
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 1e31a01..0f80804 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -137,6 +137,7 @@  CONFIG_ATH79_MACH_TL_WR941ND=y
 CONFIG_ATH79_MACH_TUBE2H=y
 CONFIG_ATH79_MACH_UBNT=y
 CONFIG_ATH79_MACH_UBNT_XM=y
+CONFIG_ATH79_MACH_WEIO=y
 CONFIG_ATH79_MACH_WHR_HP_G300N=y
 CONFIG_ATH79_MACH_WLAE_AG300N=y
 CONFIG_ATH79_MACH_WLR8100=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
new file mode 100644
index 0000000..5c707ec
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-weio.c
@@ -0,0 +1,146 @@ 
+/**
+ * WEIO Web Of Things Platform
+ *
+ * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI
+ *
+ *              ##      ## ######## ####  #######  
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ######    ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *              ##  ##  ## ##        ##  ##     ## 
+ *               ###  ###  ######## ####  #######
+ *
+ *                   Web Of Things Platform
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors : 
+ * Drasko DRASKOVIC <drasko.draskovic@gmail.com>
+ * Uros PETREVSKI <uros@nodesign.net>
+ */
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+#include "common.h"
+#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 "linux/i2c-gpio.h"
+#include "linux/platform_device.h"
+
+#define WEIO_GPIO_LED_STA		1
+#define WEIO_GPIO_LED_AP		16
+//#define WEIO_GPIO_LED_ETH0	13
+
+#define WEIO_GPIO_BTN_AP	    20
+#define WEIO_GPIO_BTN_RESET		23
+
+#define WEIO_KEYS_POLL_INTERVAL		20	/* msecs */
+#define WEIO_KEYS_DEBOUNCE_INTERVAL	(3 * WEIO_KEYS_POLL_INTERVAL)
+
+#define WEIO_MAC0_OFFSET			0x0000
+#define WEIO_MAC1_OFFSET			0x0006
+#define WEIO_CALDATA_OFFSET		    0x1000
+#define WEIO_WMAC_MAC_OFFSET		0x1002
+
+static struct gpio_led weio_leds_gpio[] __initdata = {
+	{
+		.name		= "weio:green:sta",
+		.gpio		= WEIO_GPIO_LED_STA,
+		.active_low	= 1,
+        .default_state = LEDS_GPIO_DEFSTATE_ON,
+	}, {
+		.name		= "weio:green:ap",
+		.gpio		= WEIO_GPIO_LED_AP,
+		.active_low	= 1,
+        .default_state = LEDS_GPIO_DEFSTATE_ON,
+	}
+};
+
+static struct gpio_keys_button weio_gpio_keys[] __initdata = {
+	{
+		.desc		= "ap button",
+		.type		= EV_KEY,
+		.code		= BTN_0,
+		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= WEIO_GPIO_BTN_AP,
+		.active_low	= 1,
+	},
+	{
+		.desc		= "soft-reset button",
+		.type		= EV_KEY,
+		.code		= BTN_1,
+		.debounce_interval = WEIO_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= WEIO_GPIO_BTN_RESET,
+		.active_low	= 1,
+	}
+};
+
+static struct i2c_gpio_platform_data weio_i2c_gpio_data = {
+	.sda_pin        = 18,
+	.scl_pin        = 19,
+};
+
+static struct platform_device weio_i2c_gpio = {
+	.name           = "i2c-gpio",
+	.id             = 0,
+	.dev     = {
+		.platform_data  = &weio_i2c_gpio_data,
+	},
+};
+
+static struct platform_device *weio_devices[] __initdata = {
+        &weio_i2c_gpio
+};
+
+static void __init weio_common_setup(void)
+{
+	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+	ath79_register_m25p80(NULL);
+	ath79_register_wmac(art + WEIO_CALDATA_OFFSET,
+			    art + WEIO_WMAC_MAC_OFFSET);
+}
+
+static void __init weio_setup(void)
+{
+	weio_common_setup();
+
+    
+	ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+                AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+    platform_add_devices(weio_devices, ARRAY_SIZE(weio_devices));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(weio_leds_gpio),
+				 weio_leds_gpio);
+
+	ath79_register_gpio_keys_polled(-1, WEIO_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(weio_gpio_keys),
+					weio_gpio_keys);
+	ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_WEIO, "WEIO", "WeIO board from Drasko DRASKOVIC and Uros PETREVSKI",
+		weio_setup);
diff --git a/target/linux/ar71xx/generic/profiles/weio.mk b/target/linux/ar71xx/generic/profiles/weio.mk
new file mode 100644
index 0000000..227cec9
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/weio.mk
@@ -0,0 +1,17 @@ 
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/WEIO
+        NAME:=WeIO
+        PACKAGES:=kmod-usb-core kmod-usb2
+endef
+
+define Profile/WEIO/Description
+        Package set optimized for the WeIO board.
+endef
+
+$(eval $(call Profile,WEIO))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index e894d78..d750745 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -180,6 +180,14 @@  define Device/carambola2
 endef
 TARGET_DEVICES += carambola2
 
+define Device/weio
+  BOARDNAME = WEIO
+  IMAGE_SIZE = 16000k
+  CONSOLE = ttyATH0,115200
+  MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
+endef
+TARGET_DEVICES += weio
+
 define Device/wndr3700
   BOARDNAME = WNDR3700
   NETGEAR_KERNEL_MAGIC = 0x33373030
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 02ebd1b..fa9fd0ad 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
@@ -1,6 +1,6 @@ 
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,24 +16,207 @@
+@@ -16,24 +16,208 @@
  
  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
@@ -176,6 +176,7 @@ 
  	ATH79_MACH_UBNT_UNIFI_OUTDOOR,	/* Ubiquiti UnifiAP Outdoor */
 +	ATH79_MACH_UBNT_UNIFI_OUTDOOR_PLUS, /* Ubiquiti UnifiAP Outdoor+ */
  	ATH79_MACH_UBNT_XM,		/* Ubiquiti Networks XM board rev 1.0 */
++	ATH79_MACH_WEIO,		    /* WeIO board */
 +	ATH79_MACH_WHR_G301N,		/* Buffalo WHR-G301N */
 +	ATH79_MACH_WHR_HP_G300N,	/* Buffalo WHR-HP-G300N */
 +	ATH79_MACH_WHR_HP_GN,		/* Buffalo WHR-HP-GN */
@@ -1437,7 +1438,7 @@ 
  
  config ATH79_MACH_UBNT_XM
  	bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1212,97 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1212,106 @@ config ATH79_MACH_UBNT_XM
  	  Say 'Y' here if you want your kernel to support the
  	  Ubiquiti Networks XM (rev 1.0) board.
  
@@ -1511,6 +1512,15 @@ 
 +	select ATH79_DEV_USB
 +	select ATH79_DEV_WMAC
 +
++config ATH79_MACH_WEIO
++	bool "WeIO board"
++	select SOC_AR933X
++	select ATH79_DEV_GPIO_BUTTONS
++	select ATH79_DEV_LEDS_GPIO
++	select ATH79_DEV_M25P80
++	select ATH79_DEV_USB
++	select ATH79_DEV_WMAC
++
 +config ATH79_MACH_BHU_BXU2000N2_A
 +	bool "BHU BXU2000n-2 rev. A support"
 +	select SOC_AR934X
@@ -1535,7 +1545,7 @@ 
  endmenu
  
  config SOC_AR71XX
-@@ -134,7 +1354,10 @@ config ATH79_DEV_DSA
+@@ -134,7 +1363,10 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
  	def_bool n
  
@@ -1547,7 +1557,7 @@ 
  	def_bool n
  
  config ATH79_DEV_GPIO_BUTTONS
-@@ -164,6 +1387,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -164,6 +1396,11 @@ config ATH79_PCI_ATH9K_FIXUP
  	def_bool n
  
  config ATH79_ROUTERBOOT
@@ -1561,7 +1571,7 @@ 
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,133 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
+@@ -38,9 +38,134 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
  #
  # Machines
  #
@@ -1670,6 +1680,7 @@ 
 +obj-$(CONFIG_ATH79_MACH_TUBE2H)		+= mach-tube2h.o
 +obj-$(CONFIG_ATH79_MACH_UBNT)		+= mach-ubnt.o
  obj-$(CONFIG_ATH79_MACH_UBNT_XM)	+= mach-ubnt-xm.o
++obj-$(CONFIG_ATH79_MACH_WEIO)		+= mach-weio.o
 +obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N)	+= mach-whr-hp-g300n.o
 +obj-$(CONFIG_ATH79_MACH_WLAE_AG300N)	+= mach-wlae-ag300n.o
 +obj-$(CONFIG_ATH79_MACH_WLR8100)	+= mach-wlr8100.o