Re: [OpenWrt-Devel] [PATCH 3/3][ESR1750][V2] ar71xx: add support for EnGenius ESR1750

2014-07-11 Thread
Hi Forest,

Vendors are not always consistent over time with what colour they use
for their LED's. Several factors could play in, like matching LED with
a tooling colour or just change of mind.
It would be more safe to bind the LED to specific device rather than vendor.

Best regards,
Jon


On Fri, Jul 11, 2014 at 6:46 AM, Forest Crossman cyro...@gmail.com wrote:
 diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
 b/target/linux/ar71xx/base-files/etc/diag.sh
 index ef172b4..144459b 100755
 --- a/target/linux/ar71xx/base-files/etc/diag.sh
 +++ b/target/linux/ar71xx/base-files/etc/diag.sh
 @@ -69,6 +69,9 @@ get_status_led() {
 el-m150)
 status_led=EasyLink:green:system
 ;;
 +   esr1750)
 +   status_led=esr1750:amber:power
 +   ;;
 hiwifi-hc6361)
 status_led=hiwifi:blue:system
 ;;

 +static struct gpio_led esr1750_leds_gpio[] __initdata = {
 +   {
 +   .name   = esr1750:amber:power,
 +   .gpio   = ESR1750_GPIO_LED_POWER_AMBER,
 +   .active_low = 1,
 +   },
 +   {
 +   .name   = esr1750:blue:wps,
 +   .gpio   = ESR1750_GPIO_LED_WPS_BLUE,
 +   .active_low = 1,
 +   },
 +   {
 +   .name   = esr1750:amber:wps,
 +   .gpio   = ESR1750_GPIO_LED_WPS_AMBER,
 +   .active_low = 1,
 +   },
 +   {
 +   .name   = esr1750:blue:wlan-2g,
 +   .gpio   = ESR1750_GPIO_LED_WLAN_2G,
 +   .active_low = 1,
 +   },
 +   {
 +   .name   = esr1750:blue:wlan-5g,
 +   .gpio   = ESR1750_GPIO_LED_WLAN_5G,
 +   .active_low = 1,
 +   }
 +};
 +

 This isn't really specific to the ESR1750, but does anyone know if
 it's better to use device:color:name or manufacturer:color:name
 for the LEDs? For the ESR900, I made it manufacturer:color:name (ex.
 engenius:amber:power) because they're the same for each of the
 saucer-shaped ESR routers and I saw some other routers with
 similarly-named LEDs. I tried searching the wiki to see if there was a
 standard convention to use, but I haven't had any luck finding one.

 --
 Forest Crossman



-- 
Best regards,
Jon
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for EnGenius ESR1750

2014-07-02 Thread
Answers inline.

On Tue, Jul 1, 2014 at 3:16 PM, John Crispin j...@phrozen.org wrote:
 On 01/07/2014 13:44, Jon Suphammer wrote:
 0t 1 +  part=$(find_mtd_part u-boot-env) +  mac=$(strings $part |
 sed -n 's/^'ethaddr'=//p' |sed 's/\//g') +
 mac_lan=$(macaddr_canonicalize $mac) +[ -n $mac_lan ] 
 ucidef_set_interface_macaddr lan $mac_lan +
 mac_wan=$(mtd_get_mac_ascii u-boot-env wanaddr) + [ -n $mac_wan ]
  ucidef_set_interface_macaddr wan $mac_wan +
 mac_wifi2=$(macaddr_add $mac_lan 1) + ;; +

 package/kernel/uboot-env/ can solve this problem for you i believe
The reason for doing it this was is that macaddr_canonicalize will see
LAN mac address as invalid as the string includes quotation marks
which makes the string greater than 17 chars.

A more correct fix for this would be to strip quotation marks in
macaddr_canonicalize. By doing this we can use mtd_get_mac_ascii to
retrieve LAN mac address as we do for WAN mac address.

I suggest we add: mac=$(echo ${mac} | sed 's/\//g') at top of
macaddr_canonicalize function. I can send a separate patch for this if
you prefer this approach.


 + +static void __init esr1750_gmac_setup(void) +{ +   void __iomem
 *base; +  u32 t; + +  base = ioremap(QCA955X_GMAC_BASE,
 QCA955X_GMAC_SIZE); + +   t = __raw_readl(base +
 QCA955X_GMAC_REG_ETH_CFG); + +t = ~(QCA955X_ETH_CFG_RGMII_EN |
 QCA955X_ETH_CFG_GE0_SGMII); + t |= QCA955X_ETH_CFG_RGMII_EN; + +
 __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); + +
 iounmap(base); +} +

 this function looks wrong. are you sure this cannot be fixed with
 existing code ?
There is currently no ath79_setup_qca955x_eth_cfg function. However I
have made this function in dev_eth now, so I can submit this as a
separate patch. Is this ok ?

If the above solutions is acceptable, I will resubmit this patch once
the two above mentioned patches is accepted.

-- 
Best regards,
Jon
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] cns3xxx: Initial support for Hydrogen board

2012-11-08 Thread
Hi Kaloz,

Thanks for your comments. See below for answers.

On Thu, Nov 7, 2012 at 18:40 PM, Imre Kaloz ka...@openwrt.org wrote:

 Thanks, please see comments / questions below.

 On Wed, 07 Nov 2012 17:52:57 +0100, Jon Suphammer jon at pingcom.net wrote:

  Add Ping Communication Hydrogen board support.
 
  Signed-off-by: Jon Suphammer jon at pingcom.net
  ---
   target/linux/cns3xxx/base-files/lib/cns3xxx.sh |   13 +-
   target/linux/cns3xxx/config-3.3|1 +
   .../cns3xxx/files/arch/arm/mach-cns3xxx/hydrogen.c |  363 
  
   target/linux/cns3xxx/image/Makefile|2 +
   .../cns3xxx/patches-3.3/301-hydrogen_support.patch |   23 ++
   .../patches-3.3/460-cns3xxx_fiq_support.patch  |4 +-
   .../patches-3.3/980-arm_openwrt_machtypes.patch|3 +-
   7 files changed, 401 insertions(+), 8 deletions(-)
   create mode 100644 
  target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/hydrogen.c
   create mode 100644 
  target/linux/cns3xxx/patches-3.3/301-hydrogen_support.patch
 
  diff --git a/target/linux/cns3xxx/base-files/lib/cns3xxx.sh 
  b/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
  index d446777..da27b77 100644
  --- a/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
  +++ b/target/linux/cns3xxx/base-files/lib/cns3xxx.sh
  @@ -4,19 +4,22 @@
   #
  cns3xxx_board_name() {
  -local machine
  -local name
  +   local machine
  +   local name
 -machine=$(awk 'BEGIN{FS=[ \t]+:[ \t]} /Hardware/ {print $2}' 
 /proc/cpuinfo)
  +   machine=$(awk 'BEGIN{FS=[ \t]+:[ \t]} /Hardware/ {print $2}' 
  /proc/cpuinfo)
 -case $machine in
  +   case $machine in
  Gateworks Corporation Laguna*)
  name=laguna
  ;;
  +   Ping Communication Hydrogen*)
  +   name=hydrogen
  +   ;;
  *)
  name=generic;
  ;;
  esac
  -   
  +
  echo $name
   }

 Please add only the needed things here, cleanups should come as a separate 
 patch.
Will do.

  diff --git a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/hydrogen.c 
  b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/hydrogen.c
  new file mode 100644
  index 000..37fefff
  --- /dev/null
  +++ b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/hydrogen.c
  @@ -0,0 +1,363 @@
  +/*
  + * Ping Communication Hydrogen
  + *
  + * Copyright 2000 Deep Blue Solutions Ltd
  + * Copyright 2008 ARM Limited
  + * Copyright 2008 Cavium Networks
  + *   Scott Shu
  + * Copyright 2010 MontaVista Software, LLC.
  + *   Anton Vorontsov avorontsov at mvista.com
  + * Copyright 2012 Ping Communication
  + *   Jon Suphammer jon at suphammer.net
  + *
  + * This file 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 linux/init.h
  +#include linux/kernel.h
  +#include linux/compiler.h
  +#include linux/io.h
  +#include linux/gpio.h
  +#include linux/dma-mapping.h
  +#include linux/serial_core.h
  +#include linux/serial_8250.h
  +#include linux/platform_device.h
  +#include linux/mtd/mtd.h
  +#include linux/mtd/physmap.h
  +#include linux/mtd/partitions.h
  +#include linux/leds.h
  +#include linux/spi/spi.h
  +#include linux/spi/flash.h
  +#include linux/if_ether.h
  +#include linux/etherdevice.h
  +#include asm/setup.h
  +#include asm/mach-types.h
  +#include asm/mach/arch.h
  +#include asm/mach/map.h
  +#include asm/mach/time.h
  +#include mach/cns3xxx.h
  +#include mach/irqs.h
  +#include mach/platform.h
  +#include asm/hardware/gic.h
  +#include core.h
  +#include devices.h
  +
  +#define ARRAY_AND_SIZE(x)  (x), ARRAY_SIZE(x)
  +
  +static int spi_enable __initdata = 0;
  +
  +static int __init hydrogen_spi_enable(char *s)
  +{
  +   spi_enable = 1;
  +   return 1;
  +}
  +__setup (hydrogen_spi, hydrogen_spi_enable);
  +
  +
  +/*
  + * NOR Flash
  + */
  +static struct mtd_partition hydrogen_nor_partitions[] = {
  +   {
  +   .name   = uboot,
  +   .size   = SZ_512K,
  +   .offset = 0,
  +   .mask_flags = MTD_WRITEABLE,
  +   }, {
  +   .name   = uboot_env,
  +   .size   = SZ_128K,
  +   .offset = MTDPART_OFS_APPEND,
  +   .mask_flags = MTD_WRITEABLE,
  +   }, {
  +   .name   = staging,
  +   .size   = SZ_2M + SZ_1M,
  +   .offset = MTDPART_OFS_APPEND,
  +   .mask_flags = MTD_WRITEABLE,
  +   }, {
  +   .name   = kernel,
  +   .size   = SZ_2M,
  +   .offset = MTDPART_OFS_APPEND,
  +   }, {
  +   .name   = rootfs,
  +   .size   = MTDPART_SIZ_FULL,
  +   .offset = MTDPART_OFS_APPEND,
  +   },
  +};