From patchwork Thu Aug 31 20:22:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_Gonz=C3=A1lez_Cabanelas?= X-Patchwork-Id: 808398 X-Patchwork-Delegate: jogo@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kKV5ZGuU"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="l7CSxSFR"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xjv2Z6BLcz9s83 for ; Fri, 1 Sep 2017 06:23:18 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:Date:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=njZRcAdOA4HqaaBn94XN4ZAmMpX8ssPsOxu+HqxzADc=; b=kKV5ZGuUkpXZs2 RIebmWure5youzdmZNQFE14B7dMIHnvAcN9FFl2h/L/UqLuxbxFN7w98hP+8GX1PggdJHFKhqWsuC 9bpy0vlSgH/PRqneoP/ledrsfnRyM6X4icSi2gxUDCq/djuMExvwSnUVS1q9VQxCxF+ENa0ESam1L DlGE+kANAs8VBXIV+Tssh+2W045NCFp2nb5Q3fhZydoq7POAiB23b7fnzAee9CiGqqEOcGWeOQGWQ 0j3KxHFW1crk+bkybjbiuKLZ1fJlwUVySuf79p11+G0Vw602dfHL2WyVOKnu+hVUnQ3M3+WK8PcGh LOnelvjQ8U0bBudSynJA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dnVzW-0006ZX-Ti; Thu, 31 Aug 2017 20:23:06 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dnVzS-0006Jq-9g for lede-dev@lists.infradead.org; Thu, 31 Aug 2017 20:23:05 +0000 Received: by mail-wm0-x230.google.com with SMTP id 187so4236001wmn.1 for ; Thu, 31 Aug 2017 13:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=h31d6iAiOsWJgtfj6LsjHqnbmp5KPdYTieXiLmrA8YE=; b=l7CSxSFRoLXqE1QgkXW/W59GUPZnc28Q7nobLPEFaY/CC3BjCAiLXJLKZzliNGsgdU 1surBkNep+CjUS7eM3RO1SFxonXdgj8t0G1VNkjd9uhr9bRXIHKTrSkGfU9nXhIuzOou N49Qj3pF7LNoqsqa6Kbni9N8ybAEd1b3Qkwmfo8uWWPT3FwXCZJHm3azqB6WGvqM3khm CJEkeUBjsdh99u/Ya9Xa6vHuag1EdOevRo0PSV9DAaq+lkcueI0L2VFW1y+Fc/fMj1TO otTZ67Ri1kUzdX/SofQHv29TkRJCX/6PeoNQ9TbuKbkPmHBS+Gy7Bj+kBhap9ILsV8nO xfhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=h31d6iAiOsWJgtfj6LsjHqnbmp5KPdYTieXiLmrA8YE=; b=suceG7yUuuBZbCueyLQtGClpcWp0UPCxNJrTyQ1ovoqdyCOWFGLj7GVwWL/TwcSHsM INEiRr1a9L9/JPvp5TndSEC2nZFwZIsU/sav7HaXpRQPXmQ+Nu4wqtJNKQ3hA8DDckY6 fTYci/HfWT93kYkevv9HktYsCVJgPGgaG2GTxZBcjqDhyrl3KcMWslCRFCiMzSHAR2Rv APzEejqAKtZPRue1kFOOr5eNoACnvFX0k3L/Ikr3sQVroaDZTlc2ieieKMXMZ8BKsD1Q mb/h1Cficsoa/iq7WS/PFTtHLoz8dzaYJkjohDCpr/de/gUQso0HjH+9msxor/D1zLC+ Rfew== X-Gm-Message-State: AHYfb5im81znw6OjNthCGhw3QHBWGVURC6I7VPwAJ8t5IA8g7JPOpuX1 a+HlYvVW5a2sG4ON X-Google-Smtp-Source: ADKCNb4HPj8uWnjRLJvJp+7deHht7Oh0lTjRNAwtUz5hf2FUE3ep/o6PZpm2+WpGhLOaYSKNI+Vhtg== X-Received: by 10.28.63.204 with SMTP id m195mr1390772wma.175.1504210959939; Thu, 31 Aug 2017 13:22:39 -0700 (PDT) Received: from tool.localnet ([139.47.3.239]) by smtp.googlemail.com with ESMTPSA id e74sm835811wmg.39.2017.08.31.13.22.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Aug 2017 13:22:39 -0700 (PDT) From: Daniel Gonzalez Cabanelas To: lede-dev@lists.infradead.org Date: Thu, 31 Aug 2017 22:22:37 +0200 Message-ID: <5462005.2d8tLKgp2k@tool> User-Agent: KMail/4.14.10 (Linux/4.6.5-1-zen; KDE/4.14.14; x86_64; ; ) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170831_132302_732252_6A2D89AA X-CRM114-Status: GOOD ( 18.09 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:230 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dgcbueu[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [LEDE-DEV] [PATCH v2] brcm63xx: Add Sercomm AD1018 support X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add support for the Sercomm AD1018 router This a BCM6328 based board, 128 MB RAM, 128 MiB NAND flash, with an onboard BCM43217 wifi, 4 ethernet ports and 1 USB host port (not soldered). The board also has an FXS chip (Si32177) connected via SPI (SS2#), without support in LEDE. Since NAND flash chips aren't still supported in brcm63xx, the support is for now added to work only with SPI flash chips. Therefore hardware modding, soldering a new SPI flash chip, is required to make the board work with LEDE (tested and working OK). The flash at dts is intentionally left without partitioning to let the user choose a NOR chip of any size (8, 16 or 32 MB). Signed-off-by: Daniel Gonzalez Cabanelas --- Change in v2: - rename the board at dts for indicating this is a firmware for SPI NOR flash chips, and minor changes - add USB LED --- .../linux/brcm63xx/base-files/etc/board.d/01_leds | 3 + .../brcm63xx/base-files/etc/board.d/02_network | 1 + target/linux/brcm63xx/base-files/etc/diag.sh | 3 + target/linux/brcm63xx/base-files/lib/brcm63xx.sh | 3 + target/linux/brcm63xx/dts/ad1018-nor.dts | 136 +++++++++++++++++++++ target/linux/brcm63xx/image/bcm63xx.mk | 12 ++ .../brcm63xx/patches-4.4/580-board_AD1018.patch | 99 +++++++++++++++ 7 files changed, 257 insertions(+) create mode 100644 target/linux/brcm63xx/dts/ad1018-nor.dts create mode 100644 target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch diff --git a/target/linux/brcm63xx/base-files/etc/board.d/01_leds b/target/linux/brcm63xx/base-files/etc/board.d/01_leds index ef70cde..5503328 100755 --- a/target/linux/brcm63xx/base-files/etc/board.d/01_leds +++ b/target/linux/brcm63xx/base-files/etc/board.d/01_leds @@ -15,6 +15,9 @@ a4001n1) a4001n) ucidef_set_led_usbdev "usb" "USB" "A4001N:green:usb" "1-1" ;; +ad1018) + ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi" "wlan0" + ;; ar-5315u) ucidef_set_led_usbdev "usb" "USB" "AR-5315u:green:usb" "1-1" ;; diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network index 9addba6..826d271 100755 --- a/target/linux/brcm63xx/base-files/etc/board.d/02_network +++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network @@ -98,6 +98,7 @@ vr-3026e) "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "8t@eth0" ;; +ad1018 |\ ar-5315u |\ vh4032n) ucidef_add_switch "switch0" \ diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh index 700c9ea..2663a2c 100644 --- a/target/linux/brcm63xx/base-files/etc/diag.sh +++ b/target/linux/brcm63xx/base-files/etc/diag.sh @@ -12,6 +12,9 @@ set_state() { a4001n) status_led="A4001N:green:power" ;; + ad1018) + status_led="AD1018:green:power" + ;; ar-5315u) status_led="AR-5315u:green:power" ;; diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh index 3f46633..09a5550 100755 --- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh +++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh @@ -228,6 +228,9 @@ brcm63xx_dt_detect() { "Sagem F@ST2704V2") board_name="fast2704v2" ;; + "Sercomm AD1018 (SPI flash mod)") + board_name="ad1018" + ;; "SFR Neuf Box 4"*) board_name="neufbox4" ;; diff --git a/target/linux/brcm63xx/dts/ad1018-nor.dts b/target/linux/brcm63xx/dts/ad1018-nor.dts new file mode 100644 index 0000000..e2f7eed --- /dev/null +++ b/target/linux/brcm63xx/dts/ad1018-nor.dts @@ -0,0 +1,136 @@ +/dts-v1/; + +#include "bcm6328.dtsi" + +#include + +/ { + model = "Sercomm AD1018 (SPI flash mod)"; + compatible = "sercomm,ad1018", "brcm,bcm6328"; + + chosen { + bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + debounce-interval = <60>; + + wps { + label = "wps"; + gpios = <&pinctrl 24 1>; + linux,code = ; + }; + wifi { + label = "wifi"; + gpios = <&pinctrl 25 1>; + linux,code = ; + }; + reset { + label = "reset"; + gpios = <&pinctrl 31 1>; + linux,code = ; + }; + }; + +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1"; + }; +}; + +&leds { + status = "ok"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led + &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led + &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; + + brcm,serial-leds; + brcm,serial-shift-inv; + brcm,serial-dat-low; + + inet_red@0 { + reg = <0>; + active-low; + label = "AD1018:red:internet"; + }; + + inet_green@1 { + reg = <1>; + active-low; + label = "AD1018:green:internet"; + }; + + power_green@8 { + reg = <8>; + active-low; + label = "AD1018:green:power"; + default-state = "on"; + }; + + adsl_green@10 { + reg = <10>; + active-low; + label = "AD1018:green:adsl"; + }; + + adsl_red@11 { + reg = <11>; + active-low; + label = "AD1018:red:adsl"; + }; + + phone_green@12 { + reg = <12>; + active-low; + label = "AD1018:green:phone"; + }; + + wps_green@13 { + reg = <13>; + active-low; + label = "AD1018:green:wps"; + }; + + wifi_green@14 { + reg = <14>; + active-low; + label = "AD1018:green:wifi"; + }; + + usb_green@15 { + reg = <15>; + active-low; + label = "AD1018:green:usb"; + }; + + ephy0_spd@17 { + reg = <17>; + brcm,hardware-controlled; + }; +}; + +&hsspi { + status = "ok"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + #address-cells = <1>; + #size-cells = <1>; + + linux,part-probe = "bcm63xxpart"; + }; +}; diff --git a/target/linux/brcm63xx/image/bcm63xx.mk b/target/linux/brcm63xx/image/bcm63xx.mk index 6ad15a2..0cadfba 100644 --- a/target/linux/brcm63xx/image/bcm63xx.mk +++ b/target/linux/brcm63xx/image/bcm63xx.mk @@ -971,6 +971,18 @@ define Device/FAST2704V2 endef TARGET_DEVICES += FAST2704V2 +### Sercomm ### +define Device/AD1018-SPI_flash + $(Device/bcm63xx) + DEVICE_TITLE := Sercomm AD1018 (SPI flash mod) + DEVICE_DTS := ad1018-nor + CFE_BOARD_ID := 96328avngr + CFE_CHIP_ID := 6328 + DEVICE_PACKAGES := \ + $(B43_PACKAGES) $(USB2_PACKAGES) +endef +TARGET_DEVICES += AD1018-SPI_flash + ### SFR ### define Device/NEUFBOX4-SER $(Device/bcm63xx) diff --git a/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch b/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch new file mode 100644 index 0000000..49a6bfe --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/580-board_AD1018.patch @@ -0,0 +1,99 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -365,8 +365,76 @@ + }, + }, + }; + ++static struct sprom_fixup __initdata ad1018_fixups[] = { ++ { .offset = 6, .value = 0x1c00 }, ++ { .offset = 65, .value = 0x1256 }, ++ { .offset = 96, .value = 0x2046 }, ++ { .offset = 97, .value = 0xfe69 }, ++ { .offset = 98, .value = 0x1726 }, ++ { .offset = 99, .value = 0xfa5c }, ++ { .offset = 112, .value = 0x2046 }, ++ { .offset = 113, .value = 0xfea8 }, ++ { .offset = 114, .value = 0x1978 }, ++ { .offset = 115, .value = 0xfa26 }, ++ { .offset = 161, .value = 0x2222 }, ++ { .offset = 169, .value = 0x2222 }, ++ { .offset = 171, .value = 0x2222 }, ++ { .offset = 173, .value = 0x2222 }, ++ { .offset = 174, .value = 0x4444 }, ++ { .offset = 175, .value = 0x2222 }, ++ { .offset = 176, .value = 0x4444 }, ++}; ++ ++static struct board_info __initdata board_AD1018 = { ++ .name = "96328avngr", ++ .expected_cpu_id = 0x6328, ++ ++ .has_uart0 = 1, ++ .has_pci = 1, ++ .use_fallback_sprom = 1, ++ ++ .has_ohci0 = 1, ++ .has_ehci0 = 1, ++ .num_usbh_ports = 1, ++ ++ .has_enetsw = 1, ++ ++ .enetsw = { ++ .used_ports = { ++ [0] = { ++ .used = 1, ++ .phy_id = 1, ++ .name = "FIBRE", ++ }, ++ [1] = { ++ .used = 1, ++ .phy_id = 2, ++ .name = "LAN3", ++ }, ++ [2] = { ++ .used = 1, ++ .phy_id = 3, ++ .name = "LAN2", ++ }, ++ [3] = { ++ .used = 1, ++ .phy_id = 4, ++ .name = "LAN1", ++ }, ++ }, ++ }, ++ ++ .fallback_sprom = { ++ .type = SPROM_BCM43217, ++ .pci_bus = 1, ++ .pci_dev = 0, ++ .board_fixups = ad1018_fixups, ++ .num_board_fixups = ARRAY_SIZE(ad1018_fixups), ++ }, ++}; ++ + static struct sprom_fixup __initdata ar5381u_fixups[] = { + { .offset = 97, .value = 0xfee5 }, + { .offset = 98, .value = 0x157c }, + { .offset = 99, .value = 0xfae7 }, +@@ -2683,8 +2751,9 @@ + &board_FAST2704N, + #endif + #ifdef CONFIG_BCM63XX_CPU_6328 + &board_96328avng, ++ &board_AD1018, + &board_AR5381u, + &board_AR5387un, + &board_963281TAN, + &board_A4001N, +@@ -2797,8 +2866,9 @@ + { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, + { .compatible = "d-link,dsl-274xb-f", .data = &board_dsl_274xb_f1, }, + { .compatible = "nucom,r5010unv2", .data = &board_R5010UNV2, }, + { .compatible = "sagem,f@st2704v2", .data = &board_FAST2704V2, }, ++ { .compatible = "sercomm,ad1018", .data = &board_AD1018, }, + #endif + #ifdef CONFIG_BCM63XX_CPU_6338 + { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, + { .compatible = "brcm,bcm96338w", .data = &board_96338w, },