Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-20 Thread Gareth Parker
Because there are two versions of this device there are two different $board 
values cf-e380ac-v1 and cf-e380ac-v2, however there is one struct for gpio's in 
the corresponding mach file referencing cf-e380ac.  What would be the procedure 
or protocol to follow here in regards to using $board in diag.sh and 02_leds?

Gareth

-Original Message-
From: John Crispin [mailto:j...@phrozen.org] 
Sent: Tuesday, 18 October 2016 7:13 p.m.
To: Rafał Miłecki; Gareth Parker
Cc: LEDE Development List; gar...@zappie.net.nz
Subject: Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2



On 18/10/2016 07:54, Rafał Miłecki wrote:
> On 17 October 2016 at 12:14, Gareth Parker  wrote:
>> The Comfast E380AC is a single port PoE Dual Band AP.
>>
>> There are two versions which are only identifiable through the web 
>> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
>> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings 
>> are the same.
> 
> Minor note: mb means milli-bits. You probably meant MiB which means 
> mebi-bytes.
> https://en.wikipedia.org/wiki/Metric_prefix
> https://en.wikipedia.org/wiki/Binary_prefix
> 
> 
>> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
>> b/target/linux/ar71xx/base-files/etc/diag.sh
>> index d6e257d..c8e6b48 100644
>> --- a/target/linux/ar71xx/base-files/etc/diag.sh
>> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
>> @@ -82,6 +82,10 @@ get_status_led() {
>> cf-e316n-v2)
>> status_led="$board:blue:wan"
>> ;;
>> +   cf-e380ac-v1|\
>> +   cf-e380ac-v2)
>> +   status_led="cfe380ac:green"
>> +   ;;
>> cpe510)
>> status_led="tp-link:green:link4"
>> ;;
> 
> See comment below.
> 
> 
>> +static struct gpio_led cf_e380ac_leds_gpio[] __initdata = {
>> +   {
>> +   .name   = "cfe380ac:red",
>> +   .gpio   = CF_E380AC_GPIO_LED_RED,
>> +   .active_low = 0,
>> +   },
>> +   {
>> +   .name   = "cfe380ac:green",
>> +   .gpio   = CF_E380AC_GPIO_LED_GREEN,
>> +   .active_low = 0,
>> +   },
>> +   {
>> +   .name   = "cfe380ac:blue",
>> +   .gpio   = CF_E380AC_GPIO_LED_BLUE,
>> +   .active_low = 0,
>> +   },
>> +
>> +};
> 
> What about functions of these LEDs? Take a look at 
> Documentation/leds/leds-class.txt, you should be using 
> "devicename:colour:function".

please make sure to use $board instead of the board name when referencing the 
leds.

> 
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
> 


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-19 Thread Piotr Dymacz
Hello Gareth,

I will be back in ~2 weeks, there is no need to wait for me. You can
push your changes and I will update/rebase my patches later and
combine your code into one, common mach-*.c file.

Greetings from Japan!
Piotr

2016-10-19 18:56 GMT+09:00 Gareth Parker :
> Hi Piotr
> Thanks for your input, I have fixed up all the issues in my patch and was
> about to re-submit it, however having seen your email below what would be
> the best approach from here?
>
> I can submit my patch as is if you want?  Then you can move all comfast
> devices into one mach file later?
>
> I also have a cf-e355ac which I'm going to be submitting a patch for, plus
> my company is also going to be importing more comfast gear soon (outdoor
> high power ap's) and hence will be adding support for this also.
>
> Cheers,
>
> Gareth
>
> -Original Message-
> From: Lede-dev [mailto:lede-dev-boun...@lists.infradead.org] On Behalf Of
> Piotr Dymacz
> Sent: Wednesday, 19 October 2016 4:32 p.m.
> To: Gareth Parker
> Cc: LEDE Development List; gar...@zappie.net.nz
> Subject: Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2
>
> Hello Gareth,
>
> Please, take a look how I made support for other Comfast devices (QCA953x
> based) [1].
>
> I will rebase, update and send PR when I'm back from my holidays.
> Maybe we could keep everything in one mach-*.c file as there are some common
> parts, ex. timer for external watchdog.
>
> [1]
> https://github.com/pepe2k/lede-project-source/commit/9bb9b210ad483611304a2f6
> bcba418866b550e17
>
> Cheers,
> Piotr
>
> 2016-10-17 19:14 GMT+09:00 Gareth Parker :
>> The Comfast E380AC is a single port PoE Dual Band AP.
>>
>> There are two versions which are only identifiable through the web
> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has
> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings
> are the same.
>>
>> The factory firmware is built on openwrt and will accept a sysupgrade
> file, this patch produces two sysupgrade files for both versions.
>>
>> Signed-off-by: Gareth Parker 
>> ---
>>  target/linux/ar71xx/base-files/etc/diag.sh |4 +
>>  .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
>>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
>>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
>>  target/linux/ar71xx/config-4.4 |1 +
>>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
>>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
>>  .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197
> 
>>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
>>  target/linux/ar71xx/image/generic.mk   |   18 ++
>>  10 files changed, 256 insertions(+)
>>  create mode 100644
>> target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c
>>
>> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
>> b/target/linux/ar71xx/base-files/etc/diag.sh
>> index d6e257d..c8e6b48 100644
>> --- a/target/linux/ar71xx/base-files/etc/diag.sh
>> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
>> @@ -82,6 +82,10 @@ get_status_led() {
>> cf-e316n-v2)
>> status_led="$board:blue:wan"
>> ;;
>> +   cf-e380ac-v1|\
>> +   cf-e380ac-v2)
>> +   status_led="cfe380ac:green"
>> +   ;;
>> cpe510)
>> status_led="tp-link:green:link4"
>> ;;
>> diff --git
>> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
>> ata
>> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
>> ata
>> index 0e93feb..7598a83 100644
>> ---
>> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
>> ata
>> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
>> +++ caldata
>> @@ -47,6 +47,11 @@ board=$(ar71xx_board_name)  case "$FIRMWARE" in
>>  "ath10k/cal-pci-:00:00.0.bin")
>> case $board in
>> +   cf-e380ac-v1 | \
>> +   cf-e380ac-v2)
>> +   ath10kcal_extract "art" 20480 2116
>> +   ath10kcal_patch_mac $(macaddr_add $(cat
> /sys/class/net/eth0/address) +3)
>> +   ;;
>> dlan-pro-1200-ac)
>> ath10kcal_extract "art" 20480 2116
>> ;;
>> diff --git a/target/linux/ar71xx/base-files/lib/ar7

Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-19 Thread Gareth Parker
Hi Piotr
Thanks for your input, I have fixed up all the issues in my patch and was
about to re-submit it, however having seen your email below what would be
the best approach from here?

I can submit my patch as is if you want?  Then you can move all comfast
devices into one mach file later?

I also have a cf-e355ac which I'm going to be submitting a patch for, plus
my company is also going to be importing more comfast gear soon (outdoor
high power ap's) and hence will be adding support for this also.

Cheers,

Gareth

-Original Message-
From: Lede-dev [mailto:lede-dev-boun...@lists.infradead.org] On Behalf Of
Piotr Dymacz
Sent: Wednesday, 19 October 2016 4:32 p.m.
To: Gareth Parker
Cc: LEDE Development List; gar...@zappie.net.nz
Subject: Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

Hello Gareth,

Please, take a look how I made support for other Comfast devices (QCA953x
based) [1].

I will rebase, update and send PR when I'm back from my holidays.
Maybe we could keep everything in one mach-*.c file as there are some common
parts, ex. timer for external watchdog.

[1]
https://github.com/pepe2k/lede-project-source/commit/9bb9b210ad483611304a2f6
bcba418866b550e17

Cheers,
Piotr

2016-10-17 19:14 GMT+09:00 Gareth Parker :
> The Comfast E380AC is a single port PoE Dual Band AP.
>
> There are two versions which are only identifiable through the web
administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has
256mb ram and a uboot size of 256k, the remaining hardware and PCB markings
are the same.
>
> The factory firmware is built on openwrt and will accept a sysupgrade
file, this patch produces two sysupgrade files for both versions.
>
> Signed-off-by: Gareth Parker 
> ---
>  target/linux/ar71xx/base-files/etc/diag.sh |4 +
>  .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
>  target/linux/ar71xx/config-4.4 |1 +
>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
>  .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197

>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
>  target/linux/ar71xx/image/generic.mk   |   18 ++
>  10 files changed, 256 insertions(+)
>  create mode 100644 
> target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c
>
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..c8e6b48 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -82,6 +82,10 @@ get_status_led() {
> cf-e316n-v2)
> status_led="$board:blue:wan"
> ;;
> +   cf-e380ac-v1|\
> +   cf-e380ac-v2)
> +   status_led="cfe380ac:green"
> +   ;;
> cpe510)
> status_led="tp-link:green:link4"
> ;;
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata
> index 0e93feb..7598a83 100644
> --- 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> +++ caldata
> @@ -47,6 +47,11 @@ board=$(ar71xx_board_name)  case "$FIRMWARE" in
>  "ath10k/cal-pci-:00:00.0.bin")
> case $board in
> +   cf-e380ac-v1 | \
> +   cf-e380ac-v2)
> +   ath10kcal_extract "art" 20480 2116
> +   ath10kcal_patch_mac $(macaddr_add $(cat
/sys/class/net/eth0/address) +3)
> +   ;;
> dlan-pro-1200-ac)
> ath10kcal_extract "art" 20480 2116
> ;;
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index dae6fb2..fb017f5 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -488,6 +488,12 @@ ar71xx_board_detect() {
> *"COMFAST CF-E316N v2")
> name="cf-e316n-v2"
> ;;
> +   *"COMFAST CF-E380AC-V1")
> +   name="cf-e380ac-v1"
> +   ;;
> +   *"COMFAST CF-E380AC-V2")
> +   name="cf-e380ac-v2"
> +   ;;
> *"CPE210/220")
> name="cpe210"
> tplink_pharos_bo

Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-18 Thread Piotr Dymacz
Hello Gareth,

Please, take a look how I made support for other Comfast devices
(QCA953x based) [1].

I will rebase, update and send PR when I'm back from my holidays.
Maybe we could keep everything in one mach-*.c file as there are some
common parts, ex. timer for external watchdog.

[1] 
https://github.com/pepe2k/lede-project-source/commit/9bb9b210ad483611304a2f6bcba418866b550e17

Cheers,
Piotr

2016-10-17 19:14 GMT+09:00 Gareth Parker :
> The Comfast E380AC is a single port PoE Dual Band AP.
>
> There are two versions which are only identifiable through the web 
> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings 
> are the same.
>
> The factory firmware is built on openwrt and will accept a sysupgrade file, 
> this patch produces two sysupgrade files for both versions.
>
> Signed-off-by: Gareth Parker 
> ---
>  target/linux/ar71xx/base-files/etc/diag.sh |4 +
>  .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
>  target/linux/ar71xx/config-4.4 |1 +
>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
>  .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197 
> 
>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
>  target/linux/ar71xx/image/generic.mk   |   18 ++
>  10 files changed, 256 insertions(+)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c
>
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..c8e6b48 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -82,6 +82,10 @@ get_status_led() {
> cf-e316n-v2)
> status_led="$board:blue:wan"
> ;;
> +   cf-e380ac-v1|\
> +   cf-e380ac-v2)
> +   status_led="cfe380ac:green"
> +   ;;
> cpe510)
> status_led="tp-link:green:link4"
> ;;
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 0e93feb..7598a83 100644
> --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> @@ -47,6 +47,11 @@ board=$(ar71xx_board_name)
>  case "$FIRMWARE" in
>  "ath10k/cal-pci-:00:00.0.bin")
> case $board in
> +   cf-e380ac-v1 | \
> +   cf-e380ac-v2)
> +   ath10kcal_extract "art" 20480 2116
> +   ath10kcal_patch_mac $(macaddr_add $(cat 
> /sys/class/net/eth0/address) +3)
> +   ;;
> dlan-pro-1200-ac)
> ath10kcal_extract "art" 20480 2116
> ;;
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index dae6fb2..fb017f5 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -488,6 +488,12 @@ ar71xx_board_detect() {
> *"COMFAST CF-E316N v2")
> name="cf-e316n-v2"
> ;;
> +   *"COMFAST CF-E380AC-V1")
> +   name="cf-e380ac-v1"
> +   ;;
> +   *"COMFAST CF-E380AC-V2")
> +   name="cf-e380ac-v2"
> +   ;;
> *"CPE210/220")
> name="cpe210"
> tplink_pharos_board_detect
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 559f97d..2463587 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -495,6 +495,16 @@ platform_check_image() {
> alfa_check_image "$1" && return 0
> return 1
> ;;
> +
> +   cf-e380ac-v1|\
> +   cf-e380ac-v2)
> +   [ "$magic_long" != "27051956" ] && {
> +   echo "Invalid image type."
> +   return 1
> +   }
> +   return 0
> +   ;;
> +
> wndr3700|\
> wnr1000-v2|\
> wnr2000-v3|\
> @@ -597,6 +607,8 @@ platform_do_upgrade() {
> om5p)
> platform_do_upgrade_openmesh "$ARGV"
> ;;
> +   cf-e380ac-v1|\
> +   cf-e380ac-v2|\
> uap-pro|\
> unifi-outdoor-plus)
> MTD_CONFIG_ARGS="-s 0x18"
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> index 7aeac89..9232c4c 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linu

Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-18 Thread Gareth Parker
Thanks, I'm sorting out all of this and all previous comments then will
re-submit.

Gareth

-Original Message-
From: Lede-dev [mailto:lede-dev-boun...@lists.infradead.org] On Behalf Of
John Crispin
Sent: Tuesday, 18 October 2016 7:14 p.m.
To: Gareth Parker; lede-dev@lists.infradead.org; gar...@zappie.net.nz
Subject: Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

Hi,

2 ordering comments inline. please prefix the patch subject with "ar71xx: "

John

On 17/10/2016 12:14, Gareth Parker wrote:
> The Comfast E380AC is a single port PoE Dual Band AP.
> 
> There are two versions which are only identifiable through the web
administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has
256mb ram and a uboot size of 256k, the remaining hardware and PCB markings
are the same.
> 
> The factory firmware is built on openwrt and will accept a sysupgrade
file, this patch produces two sysupgrade files for both versions.
> 
> Signed-off-by: Gareth Parker 
> ---
>  target/linux/ar71xx/base-files/etc/diag.sh |4 +
>  .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
>  target/linux/ar71xx/config-4.4 |1 +
>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
>  .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197

>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
>  target/linux/ar71xx/image/generic.mk   |   18 ++
>  10 files changed, 256 insertions(+)
>  create mode 100644 
> target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c
> 
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..c8e6b48 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -82,6 +82,10 @@ get_status_led() {
>   cf-e316n-v2)
>   status_led="$board:blue:wan"
>   ;;
> + cf-e380ac-v1|\
> + cf-e380ac-v2)
> + status_led="cfe380ac:green"
> + ;;
>   cpe510)
>   status_led="tp-link:green:link4"
>   ;;
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata
> index 0e93feb..7598a83 100644
> --- 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-cald
> ata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> +++ caldata
> @@ -47,6 +47,11 @@ board=$(ar71xx_board_name)  case "$FIRMWARE" in
>  "ath10k/cal-pci-:00:00.0.bin")
>   case $board in
> + cf-e380ac-v1 | \
> + cf-e380ac-v2)
> + ath10kcal_extract "art" 20480 2116
> + ath10kcal_patch_mac $(macaddr_add $(cat
/sys/class/net/eth0/address) +3)
> + ;;
>   dlan-pro-1200-ac)
>   ath10kcal_extract "art" 20480 2116
>   ;;
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index dae6fb2..fb017f5 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -488,6 +488,12 @@ ar71xx_board_detect() {
>   *"COMFAST CF-E316N v2")
>   name="cf-e316n-v2"
>   ;;
> + *"COMFAST CF-E380AC-V1")
> + name="cf-e380ac-v1"
> + ;;
> + *"COMFAST CF-E380AC-V2")
> + name="cf-e380ac-v2"
> + ;;
>   *"CPE210/220")
>   name="cpe210"
>   tplink_pharos_board_detect
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 559f97d..2463587 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -495,6 +495,16 @@ platform_check_image() {
>   alfa_check_image "$1" && return 0
>   return 1
>   ;;
> +
> + cf-e380ac-v1|\
> + cf-e380ac-v2)
> + [ "$magic_long" != "27051956" ] && {
> + echo "Invalid image type."
> + return 1
> + }
> + return 0
> + ;;
>

Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-17 Thread John Crispin
Hi,

2 ordering comments inline. please prefix the patch subject with "ar71xx: "

John

On 17/10/2016 12:14, Gareth Parker wrote:
> The Comfast E380AC is a single port PoE Dual Band AP.
> 
> There are two versions which are only identifiable through the web 
> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings 
> are the same.
> 
> The factory firmware is built on openwrt and will accept a sysupgrade file, 
> this patch produces two sysupgrade files for both versions.
> 
> Signed-off-by: Gareth Parker 
> ---
>  target/linux/ar71xx/base-files/etc/diag.sh |4 +
>  .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
>  target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
>  .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
>  target/linux/ar71xx/config-4.4 |1 +
>  .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
>  target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
>  .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197 
> 
>  .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
>  target/linux/ar71xx/image/generic.mk   |   18 ++
>  10 files changed, 256 insertions(+)
>  create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c
> 
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..c8e6b48 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -82,6 +82,10 @@ get_status_led() {
>   cf-e316n-v2)
>   status_led="$board:blue:wan"
>   ;;
> + cf-e380ac-v1|\
> + cf-e380ac-v2)
> + status_led="cfe380ac:green"
> + ;;
>   cpe510)
>   status_led="tp-link:green:link4"
>   ;;
> diff --git 
> a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
> b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 0e93feb..7598a83 100644
> --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> @@ -47,6 +47,11 @@ board=$(ar71xx_board_name)
>  case "$FIRMWARE" in
>  "ath10k/cal-pci-:00:00.0.bin")
>   case $board in
> + cf-e380ac-v1 | \
> + cf-e380ac-v2)
> + ath10kcal_extract "art" 20480 2116
> + ath10kcal_patch_mac $(macaddr_add $(cat 
> /sys/class/net/eth0/address) +3)
> + ;;
>   dlan-pro-1200-ac)
>   ath10kcal_extract "art" 20480 2116
>   ;;
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index dae6fb2..fb017f5 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -488,6 +488,12 @@ ar71xx_board_detect() {
>   *"COMFAST CF-E316N v2")
>   name="cf-e316n-v2"
>   ;;
> + *"COMFAST CF-E380AC-V1")
> + name="cf-e380ac-v1"
> + ;;
> + *"COMFAST CF-E380AC-V2")
> + name="cf-e380ac-v2"
> + ;;
>   *"CPE210/220")
>   name="cpe210"
>   tplink_pharos_board_detect
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 559f97d..2463587 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -495,6 +495,16 @@ platform_check_image() {
>   alfa_check_image "$1" && return 0
>   return 1
>   ;;
> +
> + cf-e380ac-v1|\
> + cf-e380ac-v2)
> + [ "$magic_long" != "27051956" ] && {
> + echo "Invalid image type."
> + return 1
> + }
> + return 0
> + ;;
> +

this block is not properly sorted. please stick to alphabetical order.


>   wndr3700|\
>   wnr1000-v2|\
>   wnr2000-v3|\
> @@ -597,6 +607,8 @@ platform_do_upgrade() {
>   om5p)
>   platform_do_upgrade_openmesh "$ARGV"
>   ;;
> + cf-e380ac-v1|\
> + cf-e380ac-v2|\
>   uap-pro|\
>   unifi-outdoor-plus)

this whole chunk needs to be moved to be alphabetically ordered,



>   MTD_CONFIG_ARGS="-s 0x18"
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> index 7aeac89..9232c4c 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linux/ar71xx/config-4.4
> @@ -60,6 +60,7 @@ CONFIG_ATH79_MACH_CAP324=y
>  CONFIG_ATH79_MACH_CAP4200AG=y
>  CONFIG_ATH79_MACH_CARAMBOLA2=y
>  CONFIG_ATH79_MACH_CF_E316N_V2=y
> +CONFIG_ATH79_MACH_CF_E380AC=y
>  CONFIG_ATH79_MACH_CPE510=y
>  CONFIG_ATH79_MACH_CR3000=y
>  

Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-17 Thread John Crispin


On 18/10/2016 07:54, Rafał Miłecki wrote:
> On 17 October 2016 at 12:14, Gareth Parker  wrote:
>> The Comfast E380AC is a single port PoE Dual Band AP.
>>
>> There are two versions which are only identifiable through the web 
>> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
>> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings 
>> are the same.
> 
> Minor note: mb means milli-bits. You probably meant MiB which means 
> mebi-bytes.
> https://en.wikipedia.org/wiki/Metric_prefix
> https://en.wikipedia.org/wiki/Binary_prefix
> 
> 
>> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
>> b/target/linux/ar71xx/base-files/etc/diag.sh
>> index d6e257d..c8e6b48 100644
>> --- a/target/linux/ar71xx/base-files/etc/diag.sh
>> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
>> @@ -82,6 +82,10 @@ get_status_led() {
>> cf-e316n-v2)
>> status_led="$board:blue:wan"
>> ;;
>> +   cf-e380ac-v1|\
>> +   cf-e380ac-v2)
>> +   status_led="cfe380ac:green"
>> +   ;;
>> cpe510)
>> status_led="tp-link:green:link4"
>> ;;
> 
> See comment below.
> 
> 
>> +static struct gpio_led cf_e380ac_leds_gpio[] __initdata = {
>> +   {
>> +   .name   = "cfe380ac:red",
>> +   .gpio   = CF_E380AC_GPIO_LED_RED,
>> +   .active_low = 0,
>> +   },
>> +   {
>> +   .name   = "cfe380ac:green",
>> +   .gpio   = CF_E380AC_GPIO_LED_GREEN,
>> +   .active_low = 0,
>> +   },
>> +   {
>> +   .name   = "cfe380ac:blue",
>> +   .gpio   = CF_E380AC_GPIO_LED_BLUE,
>> +   .active_low = 0,
>> +   },
>> +
>> +};
> 
> What about functions of these LEDs? Take a look at
> Documentation/leds/leds-class.txt, you should be using
> "devicename:colour:function".

please make sure to use $board instead of the board name when
referencing the leds.

> 
> ___
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
> 

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-17 Thread Rafał Miłecki
On 17 October 2016 at 12:14, Gareth Parker  wrote:
> The Comfast E380AC is a single port PoE Dual Band AP.
>
> There are two versions which are only identifiable through the web 
> administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
> 256mb ram and a uboot size of 256k, the remaining hardware and PCB markings 
> are the same.

Minor note: mb means milli-bits. You probably meant MiB which means mebi-bytes.
https://en.wikipedia.org/wiki/Metric_prefix
https://en.wikipedia.org/wiki/Binary_prefix


> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
> b/target/linux/ar71xx/base-files/etc/diag.sh
> index d6e257d..c8e6b48 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -82,6 +82,10 @@ get_status_led() {
> cf-e316n-v2)
> status_led="$board:blue:wan"
> ;;
> +   cf-e380ac-v1|\
> +   cf-e380ac-v2)
> +   status_led="cfe380ac:green"
> +   ;;
> cpe510)
> status_led="tp-link:green:link4"
> ;;

See comment below.


> +static struct gpio_led cf_e380ac_leds_gpio[] __initdata = {
> +   {
> +   .name   = "cfe380ac:red",
> +   .gpio   = CF_E380AC_GPIO_LED_RED,
> +   .active_low = 0,
> +   },
> +   {
> +   .name   = "cfe380ac:green",
> +   .gpio   = CF_E380AC_GPIO_LED_GREEN,
> +   .active_low = 0,
> +   },
> +   {
> +   .name   = "cfe380ac:blue",
> +   .gpio   = CF_E380AC_GPIO_LED_BLUE,
> +   .active_low = 0,
> +   },
> +
> +};

What about functions of these LEDs? Take a look at
Documentation/leds/leds-class.txt, you should be using
"devicename:colour:function".

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] Add support for Comfast E380AC v1 and v2

2016-10-17 Thread Gareth Parker
The Comfast E380AC is a single port PoE Dual Band AP.

There are two versions which are only identifiable through the web 
administration interface, v1 has 128mb ram and a uboot size of 128k, v2 has 
256mb ram and a uboot size of 256k, the remaining hardware and PCB markings are 
the same.

The factory firmware is built on openwrt and will accept a sysupgrade file, 
this patch produces two sysupgrade files for both versions.

Signed-off-by: Gareth Parker 
---
 target/linux/ar71xx/base-files/etc/diag.sh |4 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata   |5 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |6 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   12 ++
 target/linux/ar71xx/config-4.4 |1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |   10 +
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |1 +
 .../ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c  |  197 
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |2 +
 target/linux/ar71xx/image/generic.mk   |   18 ++
 10 files changed, 256 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e380ac.c

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index d6e257d..c8e6b48 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -82,6 +82,10 @@ get_status_led() {
cf-e316n-v2)
status_led="$board:blue:wan"
;;
+   cf-e380ac-v1|\
+   cf-e380ac-v2)
+   status_led="cfe380ac:green"
+   ;;
cpe510)
status_led="tp-link:green:link4"
;;
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 0e93feb..7598a83 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -47,6 +47,11 @@ board=$(ar71xx_board_name)
 case "$FIRMWARE" in
 "ath10k/cal-pci-:00:00.0.bin")
case $board in
+   cf-e380ac-v1 | \
+   cf-e380ac-v2)
+   ath10kcal_extract "art" 20480 2116
+   ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth0/address) +3)
+   ;;
dlan-pro-1200-ac)
ath10kcal_extract "art" 20480 2116
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index dae6fb2..fb017f5 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -488,6 +488,12 @@ ar71xx_board_detect() {
*"COMFAST CF-E316N v2")
name="cf-e316n-v2"
;;
+   *"COMFAST CF-E380AC-V1")
+   name="cf-e380ac-v1"
+   ;;
+   *"COMFAST CF-E380AC-V2")
+   name="cf-e380ac-v2"
+   ;;
*"CPE210/220")
name="cpe210"
tplink_pharos_board_detect
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 559f97d..2463587 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -495,6 +495,16 @@ platform_check_image() {
alfa_check_image "$1" && return 0
return 1
;;
+
+   cf-e380ac-v1|\
+   cf-e380ac-v2)
+   [ "$magic_long" != "27051956" ] && {
+   echo "Invalid image type."
+   return 1
+   }
+   return 0
+   ;;
+
wndr3700|\
wnr1000-v2|\
wnr2000-v3|\
@@ -597,6 +607,8 @@ platform_do_upgrade() {
om5p)
platform_do_upgrade_openmesh "$ARGV"
;;
+   cf-e380ac-v1|\
+   cf-e380ac-v2|\
uap-pro|\
unifi-outdoor-plus)
MTD_CONFIG_ARGS="-s 0x18"
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 7aeac89..9232c4c 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -60,6 +60,7 @@ CONFIG_ATH79_MACH_CAP324=y
 CONFIG_ATH79_MACH_CAP4200AG=y
 CONFIG_ATH79_MACH_CARAMBOLA2=y
 CONFIG_ATH79_MACH_CF_E316N_V2=y
+CONFIG_ATH79_MACH_CF_E380AC=y
 CONFIG_ATH79_MACH_CPE510=y
 CONFIG_ATH79_MACH_CR3000=y
 CONFIG_ATH79_MACH_CR5000=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt 
b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 4cefde1..340d6f3 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1623,6 +1623,16 @@ config ATH79_MACH_CF_E316N_V2
select ATH79_DEV_USB
select ATH79_