mvebu: sync with upstream source

This commit is contained in:
CN_SZTL
2020-08-29 01:35:33 +08:00
parent 2fbf5961de
commit 2ee0e86dbe
37 changed files with 1319 additions and 48 deletions

View File

@@ -10,9 +10,8 @@ BOARD:=mvebu
BOARDNAME:=Marvell EBU Armada
FEATURES:=fpu usb pci pcie gpio nand squashfs ramdisk boot-part rootfs-part
SUBTARGETS:=cortexa9 cortexa53 cortexa72
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
KERNEL_PATCHVER:=4.19
KERNEL_PATCHVER:=5.4
KERNEL_TESTING_PATCHVER:=5.4
include $(INCLUDE_DIR)/target.mk

View File

@@ -17,7 +17,7 @@ move_config() {
esac
mkdir -p /boot
mount -o rw,noatime "/dev/$partdev" /boot
[ -f /boot/sysupgrade.tgz ] && mv -f /boot/sysupgrade.tgz /
[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
umount /boot
fi
}

View File

@@ -49,7 +49,7 @@ platform_do_upgrade_sdcard() {
sync
if [ "$SAVE_PARTITIONS" = "1" ]; then
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
@@ -106,7 +106,7 @@ platform_copy_config_sdcard() {
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot
cp -af "$CONF_TAR" /boot/
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
sync
umount /boot
fi

View File

@@ -31,6 +31,7 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_LIBATA_LEDS=y
CONFIG_ARM=y
CONFIG_ARMADA_370_CLK=y
CONFIG_ARMADA_370_XP_IRQ=y
@@ -64,6 +65,7 @@ CONFIG_ARM_UNWIND=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
CONFIG_ATA=y
CONFIG_ATA_LEDS=y
CONFIG_ATAGS=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BLK_DEV_LOOP=y

View File

@@ -37,6 +37,7 @@ CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_LIBATA_LEDS=y
CONFIG_ARM=y
CONFIG_ARMADA_370_CLK=y
CONFIG_ARMADA_370_XP_IRQ=y
@@ -69,6 +70,7 @@ CONFIG_ARM_UNWIND=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
CONFIG_ATA=y
CONFIG_ATA_LEDS=y
CONFIG_ATAGS=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y

View File

@@ -15,10 +15,10 @@ preinit_mount_udpu() {
if [ -b "${mmcdev}p4" ]; then
mkdir /misc
mount -t f2fs ${mmcdev}p4 /misc
[ -f /misc/sysupgrade.tgz ] && {
[ -f "/misc/$BACKUP_FILE" ] && {
echo "- Restoring configuration files -"
tar xzf /misc/sysupgrade.tgz -C /
rm -f /misc/sysupgrade.tgz"
tar xzf "/misc/$BACKUP_FILE" -C /
rm -f "/misc/$BACKUP_FILE"
sync
}
[ -f "/misc/firmware/recovery.itb" ] && {

View File

@@ -149,8 +149,8 @@ platform_do_upgrade_uDPU() {
platform_copy_config_uDPU() {
# Config is saved on the /misc partition and copied on the rootfs after the reboot
if [ -f /tmp/sysupgrade.tgz ]; then
cp -f /tmp/sysupgrade.tgz /misc/
if [ -f "$UPGRADE_BACKUP" ]; then
cp -f "$UPGRADE_BACKUP" "/misc/$BACKUP_FILE"
sync
fi
}

View File

@@ -11,7 +11,8 @@ board_config_update
board=$(board_name)
case "$board" in
marvell,armada8040-mcbin)
marvell,armada8040-mcbin-doubleshot|\
marvell,armada8040-mcbin-singleshot)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2"
;;
marvell,armada8040-db)

View File

@@ -9,7 +9,8 @@ REQUIRE_IMAGE_METADATA=1
platform_check_image() {
case "$(board_name)" in
marvell,armada8040-mcbin)
marvell,armada8040-mcbin-doubleshot|\
marvell,armada8040-mcbin-singleshot)
platform_check_image_sdcard "$1"
;;
*)
@@ -20,7 +21,8 @@ platform_check_image() {
platform_do_upgrade() {
case "$(board_name)" in
marvell,armada8040-mcbin)
marvell,armada8040-mcbin-doubleshot|\
marvell,armada8040-mcbin-singleshot)
platform_do_upgrade_sdcard "$1"
;;
*)
@@ -30,7 +32,8 @@ platform_do_upgrade() {
}
platform_copy_config() {
case "$(board_name)" in
marvell,armada8040-mcbin)
marvell,armada8040-mcbin-doubleshot|\
marvell,armada8040-mcbin-singleshot)
platform_copy_config_sdcard
;;
esac

View File

@@ -12,6 +12,9 @@ board=$(board_name)
boardname="${board##*,}"
case "$board" in
kobol,helios4)
ucidef_set_led_usbport "USB" "USB" "helios4:green:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" "usb5-port1"
;;
linksys,wrt1200ac)
ucidef_set_led_netdev "wan" "WAN" "pca963x:caiman:white:wan" "wan"
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:caiman:white:usb2" "usb1-port1"

View File

@@ -30,18 +30,18 @@ mvebu_setup_interfaces()
marvell,axp-gp)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
;;
solidrun,clearfog-pro-a1)
# eth0 is standalone ethernet
# eth1 is switch
# eth2 is SFP
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6" "eth0 eth2"
;;
solidrun,clearfog-base-a1)
# eth0 is standalone ethernet
# eth1 is standalone ethernet
# eth2 is SFP
ucidef_set_interfaces_lan_wan "eth1" "eth0 eth2"
;;
solidrun,clearfog-pro-a1)
# eth0 is standalone ethernet
# eth1 is switch
# eth2 is SFP
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6" "eth0 eth2"
;;
*)
ucidef_set_interface_lan "eth0"
;;

View File

@@ -0,0 +1,26 @@
#!/bin/sh
#
# Copyright (C) 2020 OpenWrt.org
#
. /lib/functions.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
linksys,wrt1200ac|\
linksys,wrt1900ac-v1|\
linksys,wrt1900ac-v2|\
linksys,wrt1900acs|\
linksys,wrt3200acm|\
linksys,wrt32x|\
solidrun,clearfog-base-a1|\
solidrun,clearfog-pro-a1)
ucidef_set_compat_version "1.1"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,21 @@
#
# Copyright (C) 2020 OpenWrt.org
#
. /lib/functions.sh
case "$(board_name)" in
linksys,wrt1200ac|\
linksys,wrt1900ac-v1|\
linksys,wrt1900ac-v2|\
linksys,wrt1900acs|\
linksys,wrt3200acm|\
linksys,wrt32x|\
solidrun,clearfog-base-a1|\
solidrun,clearfog-pro-a1)
uci set system.@system[0].compat_version="1.1"
uci commit system
;;
esac
exit 0

View File

@@ -27,12 +27,12 @@ preinit_mount_syscfg() {
fi
mkdir /tmp/syscfg
mount -t ubifs ubi1:syscfg /tmp/syscfg
[ -f "/tmp/syscfg/$CONF_TAR" ] && {
[ -f "/tmp/syscfg/$BACKUP_FILE" ] && {
echo "- config restore -"
cd /
mv "/tmp/syscfg/$CONF_TAR" /tmp
tar xzf "/tmp/$CONF_TAR"
rm -f "/tmp/$CONF_TAR"
mv "/tmp/syscfg/$BACKUP_FILE" /tmp
tar xzf "/tmp/$BACKUP_FILE"
rm -f "/tmp/$BACKUP_FILE"
sync
}
;;

View File

@@ -93,6 +93,6 @@ platform_do_upgrade_linksys() {
}
platform_copy_config_linksys() {
cp -f /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
cp -f "$UPGRADE_BACKUP" "/tmp/syscfg/$BACKUP_FILE"
sync
}

View File

@@ -10,6 +10,7 @@ REQUIRE_IMAGE_METADATA=1
platform_check_image() {
case "$(board_name)" in
cznic,turris-omnia|\
kobol,helios4|\
solidrun,clearfog-base-a1|\
solidrun,clearfog-pro-a1)
platform_check_image_sdcard "$1"
@@ -26,6 +27,7 @@ platform_do_upgrade() {
nand_do_upgrade "$1"
;;
cznic,turris-omnia|\
kobol,helios4|\
solidrun,clearfog-base-a1|\
solidrun,clearfog-pro-a1)
platform_do_upgrade_sdcard "$1"
@@ -46,6 +48,7 @@ platform_do_upgrade() {
platform_copy_config() {
case "$(board_name)" in
cznic,turris-omnia|\
kobol,helios4|\
solidrun,clearfog-base-a1|\
solidrun,clearfog-pro-a1)
platform_copy_config_sdcard

View File

@@ -0,0 +1,401 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Device Tree file for Buffalo LinkStation LS421DE
*
* Copyright (C) 2020 Daniel González Cabanelas <dgcbueu@gmail.com>
*/
/dts-v1/;
#include "armada-370.dtsi"
#include "mvebu-linkstation-fan.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/thermal/thermal.h>
/ {
model = "Buffalo LinkStation LS421DE";
compatible = "buffalo,ls421de", "marvell,armada370", "marvell,armada-370-xp";
aliases {
led-boot = &led_boot;
led-failsafe = &led_failsafe;
led-running = &led_power;
led-upgrade = &led_upgrade;
};
chosen {
bootargs = "console=ttyS0,115200 earlyprintk noinitrd rootfstype=squashfs";
stdout-path = "serial0:115200n8";
append-rootblock = "nullparameter="; /* override the bootloader args */
};
memory {
device_type = "memory";
reg = <0x00000000 0x20000000>; /* 512 MB */
};
soc {
ranges = <MBUS_ID(0xf0, 0x01) 0 0xd0000000 0x100000
MBUS_ID(0x01, 0xe0) 0 0xfff00000 0x100000
MBUS_ID(0x09, 0x01) 0 0xf1100000 0x10000>;
};
system_fan: gpio_fan {
gpios = <&gpio0 13 GPIO_ACTIVE_HIGH
&gpio0 14 GPIO_ACTIVE_HIGH>;
alarm-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
#cooling-cells = <2>;
};
thermal-zones {
chassis-thermal {
polling-delay = <20000>;
polling-delay-passive = <2000>;
thermal-sensors = <&hdd0_temp>, <&hdd1_temp>;
coefficients = <1 1>;
trips {
chassis_alert1: chassis-alert1 {
temperature = <36000>;
hysteresis = <2000>;
type = "active";
};
chassis_alert2: chassis-alert2 {
temperature = <46000>;
hysteresis = <2000>;
type = "active";
};
chassis_alert3: chassis-alert3 {
temperature = <56000>;
hysteresis = <2000>;
type = "passive";
};
chassis_crit: chassis-crit {
temperature = <66000>;
hysteresis = <2000>;
type = "critical";
};
};
cooling-maps {
map1 {
trip = <&chassis_alert1>;
cooling-device = <&system_fan THERMAL_NO_LIMIT 1>;
};
map2 {
trip = <&chassis_alert2>;
cooling-device = <&system_fan 2 2>;
};
map3 {
trip = <&chassis_alert3>;
cooling-device = <&system_fan 3 THERMAL_NO_LIMIT>;
};
};
};
};
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pmx_buttons>;
pinctrl-names = "default";
power {
label = "Power Switch";
linux,code = <KEY_POWER>;
linux,input-type = <EV_SW>;
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
};
function {
label = "Function Button";
linux,code = <KEY_CONFIG>;
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
};
};
gpio_leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pmx_leds1 &pmx_leds2>;
system_red {
label = "ls421de:red:system";
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
};
led_power: power_white {
label = "ls421de:white:power";
gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led_failsafe: power_red {
label = "ls421de:red:power";
gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
};
led_upgrade: power_orange {
label = "ls421de:orange:power";
gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>;
};
led_boot: system_white {
label = "ls421de:white:system";
gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
};
hdd1_red {
label = "ls421de:red:hdd1";
gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
default-state = "off";
linux,default-trigger = "disk-activity";
};
hdd2_red {
label = "ls421de:red:hdd2";
gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
default-state = "off";
linux,default-trigger = "disk-activity";
};
};
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pmx_power_usb &pmx_power_hdd1 &pmx_power_hdd2>;
pinctrl-names = "default";
usb_power: regulator@0 {
compatible = "regulator-fixed";
reg = <0>;
regulator-name = "USB";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio0 5 GPIO_ACTIVE_HIGH>;
};
sata1_power: regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
regulator-name = "HDD1";
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;
startup-delay-us = <2000000>;
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio0 8 GPIO_ACTIVE_HIGH>;
};
sata2_power: regulator@2 {
compatible = "regulator-fixed";
reg = <2>;
regulator-name = "HDD2";
regulator-min-microvolt = <12000000>;
regulator-max-microvolt = <12000000>;
startup-delay-us = <4000000>;
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio0 9 GPIO_ACTIVE_HIGH>;
};
};
};
&eth1 {
pinctrl-0 = <&ge1_rgmii_pins>;
pinctrl-names = "default";
status = "okay";
phy-handle = <&ethphy0>;
phy-connection-type = "rgmii-id";
};
&i2c0 {
pinctrl-0 = <&i2c0_pins>;
pinctrl-names = "default";
clock-frequency = <100000>;
status = "okay";
rs5c372a: rs5c372a@32 {
compatible = "ricoh,rs5c372a";
reg = <0x32>;
};
};
&mdio {
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
ethphy0: ethernet-phy@0 { /* Marvell 88E1518 */
reg = <0>;
marvell,reg-init = <0x3 0x10 0x1 0x1991>, /* LED function */
<0x3 0x11 0x1 0x4401>, /* LED polarity */
<0x3 0x12 0x1 0x4905>; /* LED timer */
};
};
&pciec {
status = "okay";
/* Connected to uPD720202 USB 3.0 Host */
pcie@1,0 {
status = "okay";
};
};
&pmsu {
pinctrl-0 = <&pmx_power_cpu>;
pinctrl-names = "default";
};
&rtc {
status = "disabled";
};
&sata {
nr-ports = <2>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
hdd0_temp: sata-port@0 {
reg = <0>;
#thermal-sensor-cells = <0>;
};
hdd1_temp: sata-port@1 {
reg = <1>;
#thermal-sensor-cells = <0>;
};
};
&sdio {
pinctrl-0 = <&sdio_pins2>;
pinctrl-names = "default";
status = "okay";
/* No CD or WP GPIOs */
broken-cd;
};
&uart0 {
status = "okay";
};
&usb0 {
status = "okay";
};
&nand_controller {
status = "okay";
nand@0 {
reg = <0>;
label = "pxa3xx_nand-0";
nand-rb = <0>;
marvell,nand-keep-config;
nand-on-flash-bbt;
nand-ecc-strength = <4>;
nand-ecc-step-size = <512>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "kernel";
reg = <0x00000000 0x02000000>; /* 32 MiB */
};
partition@2000000 {
label = "ubi";
reg = <0x02000000 0x1e000000>; /* 480 MiB */
};
};
};
};
&spi0 {
status = "okay";
pinctrl-0 = <&spi0_pins2>;
pinctrl-names = "default";
spi-flash@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mxicy,mx25l8005", "jedec,spi-nor";
reg = <0>; /* Chip select 0 */
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x00000 0xf0000>; /* 960 KiB*/
label = "u-boot";
read-only;
};
partition@f0000 {
reg = <0xf0000 0x10000>; /* 64 KiB */
label = "u-boot-env";
};
};
};
};
&pinctrl {
pmx_power_cpu: pmx-power-cpu {
marvell,pins = "mpp4";
marvell,function = "vdd";
};
pmx_power_usb: pmx-power-usb {
marvell,pins = "mpp5";
marvell,function = "gpo";
};
pmx_power_hdd1: pmx-power-hdd1 {
marvell,pins = "mpp8";
marvell,function = "gpio";
};
pmx_power_hdd2: pmx-power-hdd2 {
marvell,pins = "mpp9";
marvell,function = "gpo";
};
pmx_fan_lock: pmx-fan-lock {
marvell,pins = "mpp10";
marvell,function = "gpio";
};
pmx_hdd_present: pmx-hdd-present {
marvell,pins = "mpp11", "mpp12";
marvell,function = "gpio";
};
pmx_fan_high: pmx-fan-high {
marvell,pins = "mpp13";
marvell,function = "gpio";
};
pmx_fan_low: pmx-fan-low {
marvell,pins = "mpp14";
marvell,function = "gpio";
};
pmx_buttons: pmx-buttons {
marvell,pins = "mpp15", "mpp16";
marvell,function = "gpio";
};
pmx_leds1: pmx-leds {
marvell,pins = "mpp7", "mpp54", "mpp59", "mpp61";
marvell,function = "gpo";
};
pmx_leds2: pmx-leds {
marvell,pins = "mpp55", "mpp57", "mpp62";
marvell,function = "gpio";
};
};

View File

@@ -0,0 +1,213 @@
/*
* Device Tree file for the Linksys WRT32X (Venom)
*
* Copyright (C) 2017 Imre Kaloz <kaloz@openwrt.org>
*
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without
* any warranty of any kind, whether express or implied.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "armada-385-linksys.dtsi"
/ {
model = "Linksys WRT32X";
compatible = "linksys,wrt32x", "linksys,venom", "linksys,armada385",
"marvell,armada385", "marvell,armada380";
chosen {
bootargs = "console=ttyS0,115200";
stdout-path = "serial0:115200n8";
append-rootblock = "root=/dev/mtdblock";
};
};
&expander0 {
wan_amber@0 {
label = "venom:amber:wan";
reg = <0x0>;
};
wan_blue@1 {
label = "venom:blue:wan";
reg = <0x1>;
};
usb2@5 {
label = "venom:blue:usb2";
reg = <0x5>;
};
usb3_1@6 {
label = "venom:blue:usb3_1";
reg = <0x6>;
};
usb3_2@7 {
label = "venom:blue:usb3_2";
reg = <0x7>;
};
wps_blue@8 {
label = "venom:blue:wps";
reg = <0x8>;
};
wps_amber@9 {
label = "venom:amber:wps";
reg = <0x9>;
};
};
&gpio_leds {
power {
gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
label = "venom:blue:power";
};
sata {
gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
label = "venom:blue:sata";
};
wlan_2g {
gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
label = "venom:blue:wlan_2g";
};
wlan_5g {
gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
label = "venom:blue:wlan_5g";
};
};
&gpio_leds_pins {
marvell,pins = "mpp21", "mpp45", "mpp46", "mpp56";
};
&nand {
/* Spansion S34ML02G2 256MiB, OEM Layout */
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0000000 0x200000>; /* 2MB */
read-only;
};
partition@200000 {
label = "u_env";
reg = <0x200000 0x20000>; /* 128KB */
};
partition@220000 {
label = "s_env";
reg = <0x220000 0x40000>; /* 256KB */
};
partition@180000 {
label = "unused_area";
reg = <0x260000 0x5c0000>; /* 5.75MB */
};
partition@7e0000 {
label = "devinfo";
reg = <0x7e0000 0x40000>; /* 256KB */
read-only;
};
/* kernel1 overlaps with rootfs1 by design */
partition@900000 {
label = "kernel1";
reg = <0x900000 0x7b00000>; /* 123MB */
};
partition@c00000 {
label = "rootfs1";
reg = <0xc00000 0x7800000>; /* 120MB */
};
/* kernel2 overlaps with rootfs2 by design */
partition@8400000 {
label = "kernel2";
reg = <0x8400000 0x7b00000>; /* 123MB */
};
partition@8700000 {
label = "rootfs2";
reg = <0x8700000 0x7800000>; /* 120MB */
};
/* last MB is for the BBT, not writable */
partition@ff00000 {
label = "BBT";
reg = <0xff00000 0x100000>;
};
};
};
&pcie1 {
mwlwifi {
marvell,chainmask = <4 4>;
};
};
&pcie2 {
mwlwifi {
marvell,chainmask = <4 4>;
};
};
&sdhci {
pinctrl-names = "default";
pinctrl-0 = <&sdhci_pins>;
no-1-8-v;
non-removable;
wp-inverted;
bus-width = <8>;
status = "okay";
};
&usb3_1_vbus {
gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
};
&usb3_1_vbus_pins {
marvell,pins = "mpp44";
};

View File

@@ -0,0 +1,28 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Device Tree file for Globalscale Marvell ESPRESSOBin Board with eMMC
* Copyright (C) 2018 Marvell
*
* Romain Perier <romain.perier@free-electrons.com>
* Konstantin Porotchkin <kostap@marvell.com>
*
*/
#include "armada-3720-espressobin.dts"
/ {
model = "Globalscale Marvell ESPRESSOBin Board (eMMC)";
compatible = "globalscale,espressobin-emmc", "globalscale,espressobin",
"marvell,armada3720", "marvell,armada3710";
};
&sdhci0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
mmccard: mmccard@0 {
compatible = "mmc-card";
reg = <0>;
};
};

View File

@@ -0,0 +1,43 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Device Tree file for Globalscale Marvell ESPRESSOBin Board V7 with eMMC
* Copyright (C) 2018 Marvell
*
* Romain Perier <romain.perier@free-electrons.com>
* Konstantin Porotchkin <kostap@marvell.com>
*
*/
#include "armada-3720-espressobin.dts"
/ {
model = "Globalscale Marvell ESPRESSOBin Board V7 (eMMC)";
compatible = "globalscale,espressobin-v7-emmc", "globalscale,espressobin-v7",
"globalscale,espressobin", "marvell,armada3720",
"marvell,armada3710";
};
&ports {
port@1 {
reg = <1>;
label = "lan1";
phy-handle = <&switch0phy0>;
};
port@3 {
reg = <3>;
label = "wan";
phy-handle = <&switch0phy2>;
};
};
&sdhci0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
mmccard: mmccard@0 {
compatible = "mmc-card";
reg = <0>;
};
};

View File

@@ -0,0 +1,31 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Device Tree file for Globalscale Marvell ESPRESSOBin Board V7
* Copyright (C) 2018 Marvell
*
* Romain Perier <romain.perier@free-electrons.com>
* Konstantin Porotchkin <kostap@marvell.com>
*
*/
#include "armada-3720-espressobin.dts"
/ {
model = "Globalscale Marvell ESPRESSOBin Board V7";
compatible = "globalscale,espressobin-v7", "globalscale,espressobin",
"marvell,armada3720", "marvell,armada3710";
};
&ports {
port@1 {
reg = <1>;
label = "lan1";
phy-handle = <&switch0phy0>;
};
port@3 {
reg = <3>;
label = "wan";
phy-handle = <&switch0phy2>;
};
};

View File

@@ -0,0 +1,162 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include "armada-372x.dtsi"
/ {
model = "GL.iNet GL-MV1000";
compatible = "glinet,gl-mv1000", "marvell,armada3720";
chosen {
stdout-path = "serial0:115200n8";
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x00000000 0x00000000 0x20000000>;
};
vcc_sd_reg1: regulator {
compatible = "regulator-gpio";
regulator-name = "vcc_sd1";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
gpios-states = <0>;
states = <1800000 0x1
3300000 0x0>;
enable-active-high;
};
};
&spi0 {
status = "okay";
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>;
m25p,fast-read;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0 0xf0000>;
};
partition@f0000 {
label = "u-boot-env";
reg = <0Xf0000 0x8000>;
};
factory: partition@f8000 {
label = "factory";
reg = <0xf8000 0x8000>;
};
};
};
};
&sdhci1 {
wp-inverted;
bus-width = <4>;
cd-gpios = <&gpionb 17 GPIO_ACTIVE_LOW>;
marvell,pad-type = "sd";
no-1-8-v;
vqmmc-supply = <&vcc_sd_reg1>;
status = "okay";
};
&sdhci0 {
bus-width = <8>;
mmc-ddr-1_8v;
mmc-hs400-1_8v;
non-removable;
no-sd;
no-sdio;
marvell,pad-type = "fixed-1-8v";
status = "okay";
};
&usb3 {
status = "okay";
};
&usb2 {
status = "okay";
};
&uart0 {
status = "okay";
};
&mdio {
switch0: switch0@1 {
compatible = "marvell,mv88e6085";
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
dsa,member = <0 0>;
ports: ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "cpu";
ethernet = <&eth0>;
};
port@1 {
reg = <1>;
label = "wan";
phy-handle = <&switch0phy0>;
};
port@2 {
reg = <2>;
label = "lan0";
phy-handle = <&switch0phy1>;
};
port@3 {
reg = <3>;
label = "lan1";
phy-handle = <&switch0phy2>;
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
switch0phy0: switch0phy0@11 {
reg = <0x11>;
};
switch0phy1: switch0phy1@12 {
reg = <0x12>;
};
switch0phy2: switch0phy2@13 {
reg = <0x13>;
};
};
};
};
&eth0 {
mtd-mac-address = <&factory 0x0>;
phy-mode = "rgmii-id";
status = "okay";
fixed-link {
speed = <1000>;
full-duplex;
};
};

View File

@@ -137,16 +137,6 @@ define Device/NAND-512K
PAGESIZE := 4096
endef
ifeq ($(SUBTARGET),cortexa9)
include cortexa9.mk
endif
ifeq ($(SUBTARGET),cortexa53)
include cortexa53.mk
endif
ifeq ($(SUBTARGET),cortexa72)
include cortexa72.mk
endif
include $(SUBTARGET).mk
$(eval $(call BuildImage))

View File

@@ -16,14 +16,30 @@ define Device/marvell_armada8040-db
endef
TARGET_DEVICES += marvell_armada8040-db
define Device/marvell_macchiatobin
define Device/marvell_macchiatobin-doubleshot
$(call Device/Default-arm64)
DEVICE_VENDOR := SolidRun
DEVICE_MODEL := MACCHIATObin
DEVICE_VARIANT := Double Shot
DEVICE_ALT0_VENDOR := SolidRun
DEVICE_ALT0_MODEL := Armada 8040 Community Board
DEVICE_ALT0_VARIANT := Double Shot
DEVICE_PACKAGES += kmod-i2c-mux-pca954x
DEVICE_DTS := armada-8040-mcbin
SUPPORTED_DEVICES := marvell,armada8040-mcbin
SUPPORTED_DEVICES := marvell,armada8040-mcbin-doubleshot marvell,armada8040-mcbin
endef
TARGET_DEVICES += marvell_macchiatobin
TARGET_DEVICES += marvell_macchiatobin-doubleshot
define Device/marvell_macchiatobin-singleshot
$(call Device/Default-arm64)
DEVICE_VENDOR := SolidRun
DEVICE_MODEL := MACCHIATObin
DEVICE_VARIANT := Single Shot
DEVICE_ALT0_VENDOR := SolidRun
DEVICE_ALT0_MODEL := Armada 8040 Community Board
DEVICE_ALT0_VARIANT := Single Shot
DEVICE_PACKAGES += kmod-i2c-mux-pca954x
DEVICE_DTS := armada-8040-mcbin-singleshot
SUPPORTED_DEVICES := marvell,armada8040-mcbin-singleshot
endef
TARGET_DEVICES += marvell_macchiatobin-singleshot

View File

@@ -6,6 +6,12 @@
# See /LICENSE for more information.
#
define Device/dsa-migration
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA \
(early adopters with DSA already set up may just force-flash keeping existing config)
endef
define Device/buffalo_ls421de
$(Device/NAND-128K)
DEVICE_VENDOR := Buffalo
@@ -17,8 +23,9 @@ define Device/buffalo_ls421de
KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
DEVICE_DTS := armada-370-buffalo-ls421de
DEVICE_PACKAGES := \
kmod-rtc-rs5c372a kmod-hwmon-gpiofan kmod-usb3 kmod-md-raid0 \
kmod-md-raid1 kmod-md-mod kmod-fs-xfs mkf2fs e2fsprogs partx-utils
kmod-rtc-rs5c372a kmod-hwmon-gpiofan kmod-hwmon-drivetemp kmod-usb3 \
kmod-linkstation-poweroff kmod-md-raid0 kmod-md-raid1 kmod-md-mod \
kmod-fs-xfs mkf2fs e2fsprogs partx-utils
endef
TARGET_DEVICES += buffalo_ls421de
@@ -30,7 +37,7 @@ define Device/cznic_turris-omnia
KERNEL_INITRAMFS := kernel-bin
DEVICE_PACKAGES := \
mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \
wpad-basic kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \
wpad-basic-wolfssl kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \
partx-utils kmod-i2c-mux-pca954x
IMAGES := $$(IMAGE_PREFIX)-sysupgrade.img.gz omnia-medkit-$$(IMAGE_PREFIX)-initramfs.tar.gz
IMAGE/$$(IMAGE_PREFIX)-sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata
@@ -50,10 +57,24 @@ define Device/globalscale_mirabox
endef
TARGET_DEVICES += globalscale_mirabox
define Device/kobol_helios4
DEVICE_VENDOR := Kobol
DEVICE_MODEL := Helios4
KERNEL_INSTALL := 1
KERNEL := kernel-bin
DEVICE_PACKAGES := mkf2fs e2fsprogs partx-utils
IMAGES := sdcard.img.gz
IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata
SOC := armada-388
UBOOT := helios4-u-boot-spl.kwb
BOOT_SCRIPT := clearfog
endef
TARGET_DEVICES += kobol_helios4
define Device/linksys
$(Device/NAND-128K)
DEVICE_VENDOR := Linksys
DEVICE_PACKAGES := kmod-mwlwifi wpad-basic
DEVICE_PACKAGES := kmod-mwlwifi wpad-basic-wolfssl
IMAGES += factory.img
IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
append-ubi | pad-to $$$$(PAGESIZE)
@@ -62,16 +83,19 @@ endef
define Device/linksys_wrt1200ac
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT1200AC
DEVICE_ALT0_VENDOR := Linksys
DEVICE_ALT0_MODEL := Caiman
DEVICE_DTS := armada-385-linksys-caiman
DEVICE_PACKAGES += mwlwifi-firmware-88w8864
SUPPORTED_DEVICES += armada-385-linksys-caiman linksys,caiman
endef
TARGET_DEVICES += linksys_wrt1200ac
define Device/linksys_wrt1900acs
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT1900ACS
DEVICE_VARIANT := v1
DEVICE_ALT0_VENDOR := Linksys
@@ -81,11 +105,13 @@ define Device/linksys_wrt1900acs
DEVICE_ALT1_MODEL := Shelby
DEVICE_DTS := armada-385-linksys-shelby
DEVICE_PACKAGES += mwlwifi-firmware-88w8864
SUPPORTED_DEVICES += armada-385-linksys-shelby linksys,shelby
endef
TARGET_DEVICES += linksys_wrt1900acs
define Device/linksys_wrt1900ac-v1
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT1900AC
DEVICE_VARIANT := v1
DEVICE_ALT0_VENDOR := Linksys
@@ -93,32 +119,39 @@ define Device/linksys_wrt1900ac-v1
DEVICE_DTS := armada-xp-linksys-mamba
DEVICE_PACKAGES += mwlwifi-firmware-88w8864
KERNEL_SIZE := 3072k
SUPPORTED_DEVICES += armada-xp-linksys-mamba linksys,mamba
DEFAULT := n
endef
TARGET_DEVICES += linksys_wrt1900ac-v1
define Device/linksys_wrt1900ac-v2
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT1900AC
DEVICE_VARIANT := v2
DEVICE_ALT0_VENDOR := Linksys
DEVICE_ALT0_MODEL := Cobra
DEVICE_DTS := armada-385-linksys-cobra
DEVICE_PACKAGES += mwlwifi-firmware-88w8864
SUPPORTED_DEVICES += armada-385-linksys-cobra linksys,cobra
endef
TARGET_DEVICES += linksys_wrt1900ac-v2
define Device/linksys_wrt3200acm
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT3200ACM
DEVICE_ALT0_VENDOR := Linksys
DEVICE_ALT0_MODEL := Rango
DEVICE_DTS := armada-385-linksys-rango
DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
SUPPORTED_DEVICES += armada-385-linksys-rango linksys,rango
endef
TARGET_DEVICES += linksys_wrt3200acm
define Device/linksys_wrt32x
$(call Device/linksys)
$(Device/dsa-migration)
DEVICE_MODEL := WRT32X
DEVICE_ALT0_VENDOR := Linksys
DEVICE_ALT0_MODEL := Venom
@@ -126,6 +159,8 @@ define Device/linksys_wrt32x
DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
KERNEL_SIZE := 3072k
KERNEL := kernel-bin | append-dtb
SUPPORTED_DEVICES += armada-385-linksys-venom linksys,venom
DEFAULT := n
endef
TARGET_DEVICES += linksys_wrt32x
@@ -210,13 +245,16 @@ define Device/solidrun_clearfog-base-a1
IMAGES := sdcard.img.gz
IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata
DEVICE_DTS := armada-388-clearfog-base armada-388-clearfog-pro
SUPPORTED_DEVICES += armada-388-clearfog-base
UBOOT := clearfog-u-boot-spl.kwb
BOOT_SCRIPT := clearfog
SUPPORTED_DEVICES += armada-388-clearfog-base
DEVICE_COMPAT_VERSION := 1.1
DEVICE_COMPAT_MESSAGE := Ethernet interface rename has been dropped
endef
TARGET_DEVICES += solidrun_clearfog-base-a1
define Device/solidrun_clearfog-pro-a1
$(Device/dsa-migration)
DEVICE_VENDOR := SolidRun
DEVICE_MODEL := ClearFog Pro
KERNEL_INSTALL := 1
@@ -227,5 +265,6 @@ define Device/solidrun_clearfog-pro-a1
DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
UBOOT := clearfog-u-boot-spl.kwb
BOOT_SCRIPT := clearfog
SUPPORTED_DEVICES += armada-388-clearfog armada-388-clearfog-pro
endef
TARGET_DEVICES += solidrun_clearfog-pro-a1

0
target/linux/mvebu/image/udpu.bootscript Executable file → Normal file
View File

View File

@@ -0,0 +1,21 @@
define KernelPackage/linkstation-poweroff
SUBMENU:=$(OTHER_MENU)
DEPENDS:=@TARGET_mvebu
TITLE:=Buffalo LinkStation power off driver
KCONFIG:= \
CONFIG_POWER_RESET=y \
CONFIG_POWER_RESET_LINKSTATION \
CONFIG_POWER_RESET_QNAP=n
FILES:=$(LINUX_DIR)/drivers/power/reset/linkstation-poweroff.ko
AUTOLOAD:=$(call AutoLoad,31,linkstation-poweroff,1)
endef
define KernelPackage/linkstation-poweroff/description
This driver supports turning off some Buffalo LinkStations by
setting an output pin at the ethernet PHY to the correct state.
It also makes the device compatible with the WoL function.
Say Y here if you have a Buffalo LinkStation LS421D/E.
endef
$(eval $(call KernelPackage,linkstation-poweroff))

View File

@@ -0,0 +1,14 @@
--- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dts
@@ -10,8 +10,9 @@
#include <dt-bindings/gpio/gpio.h>
/ {
- model = "Marvell 8040 MACCHIATOBin";
- compatible = "marvell,armada8040-mcbin", "marvell,armada8040",
+ model = "Marvell 8040 MACCHIATOBin Double-shot";
+ compatible = "marvell,armada8040-mcbin-doubleshot",
+ "marvell,armada8040-mcbin", "marvell,armada8040",
"marvell,armada-ap806-quad", "marvell,armada-ap806";
chosen {

View File

@@ -15,7 +15,7 @@ Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
@@ -66,9 +66,31 @@
@@ -60,9 +60,31 @@
cd-gpios = <&gpionb 3 GPIO_ACTIVE_LOW>;
marvell,pad-type = "sd";
vqmmc-supply = <&vcc_sd_reg1>;

View File

@@ -29,7 +29,7 @@ Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
@@ -96,25 +96,9 @@
@@ -90,25 +90,9 @@
flash@0 {
reg = <0>;

View File

@@ -15,7 +15,7 @@ Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
@@ -138,7 +138,7 @@
@@ -132,7 +132,7 @@
dsa,member = <0 0>;

View File

@@ -62,7 +62,7 @@ Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dts
@@ -52,6 +52,8 @@
@@ -46,6 +46,8 @@
/* J9 */
&pcie0 {
status = "okay";

View File

@@ -0,0 +1,28 @@
--- a/arch/arm/boot/dts/armada-388-helios4.dts
+++ b/arch/arm/boot/dts/armada-388-helios4.dts
@@ -15,6 +15,13 @@
model = "Helios4";
compatible = "kobol,helios4", "marvell,armada388",
"marvell,armada385", "marvell,armada380";
+
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ };
memory {
device_type = "memory";
@@ -70,10 +77,9 @@
system-leds {
compatible = "gpio-leds";
- status-led {
+ led_status: status-led {
label = "helios4:green:status";
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
- linux,default-trigger = "heartbeat";
default-state = "on";
};

View File

@@ -0,0 +1,10 @@
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -68,6 +68,7 @@ config MACH_ARMADA_38X
select HAVE_SMP
select MACH_MVEBU_V7
select PINCTRL_ARMADA_38X
+ select ARCH_WANT_LIBATA_LEDS
help
Say 'Y' here if you want your kernel to support boards based
on the Marvell Armada 380/385 SoC with device tree.

View File

@@ -0,0 +1,177 @@
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -99,6 +99,17 @@
help
Reboot support for Hisilicon boards.
+config POWER_RESET_LINKSTATION
+ tristate "Buffalo LinkStation power-off driver"
+ depends on ARCH_MVEBU || COMPILE_TEST
+ depends on OF_MDIO && PHYLIB
+ help
+ This driver supports turning off some Buffalo LinkStations by
+ setting an output pin at the ethernet PHY to the correct state.
+ It also makes the device compatible with the WoL function.
+
+ Say Y here if you have a Buffalo LinkStation LS421D/E.
+
config POWER_RESET_MSM
bool "Qualcomm MSM power-off driver"
depends on ARCH_QCOM
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -10,6 +10,7 @@
obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
+obj-${CONFIG_POWER_RESET_LINKSTATION} += linkstation-poweroff.o
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
--- a/dev/null
+++ b/drivers/power/reset/linkstation-poweroff.c
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * LinkStation power off restart driver
+ * Copyright (C) 2020 Daniel González Cabanelas <dgcbueu@gmail.com>
+ */
+
+#include <linux/module.h>
+#include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_mdio.h>
+#include <linux/of_platform.h>
+#include <linux/reboot.h>
+#include <linux/phy.h>
+
+/* Defines from the eth phy Marvell driver */
+#define MII_MARVELL_COPPER_PAGE 0
+#define MII_MARVELL_LED_PAGE 3
+#define MII_MARVELL_WOL_PAGE 17
+#define MII_MARVELL_PHY_PAGE 22
+
+#define MII_PHY_LED_CTRL 16
+#define MII_88E1318S_PHY_LED_TCR 18
+#define MII_88E1318S_PHY_WOL_CTRL 16
+#define MII_M1011_IEVENT 19
+
+#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7)
+#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15)
+#define MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS BIT(12)
+#define LED2_FORCE_ON (0x8 << 8)
+#define LEDMASK GENMASK(11,8)
+
+static struct phy_device *phydev;
+
+static void mvphy_reg_intn(u16 data)
+{
+ int rc = 0, saved_page;
+
+ saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE);
+ if (saved_page < 0)
+ goto err;
+
+ /* Force manual LED2 control to let INTn work */
+ __phy_modify(phydev, MII_PHY_LED_CTRL, LEDMASK, LED2_FORCE_ON);
+
+ /* Set the LED[2]/INTn pin to the required state */
+ __phy_modify(phydev, MII_88E1318S_PHY_LED_TCR,
+ MII_88E1318S_PHY_LED_TCR_FORCE_INT,
+ MII_88E1318S_PHY_LED_TCR_INTn_ENABLE | data);
+
+ if (!data) {
+ /* Clear interrupts to ensure INTn won't be holded in high state */
+ __phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_MARVELL_COPPER_PAGE);
+ __phy_read(phydev, MII_M1011_IEVENT);
+
+ /* If WOL was enabled and a magic packet was received before powering
+ * off, we won't be able to wake up by sending another magic packet.
+ * Clear WOL status.
+ */
+ __phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_MARVELL_WOL_PAGE);
+ __phy_set_bits(phydev, MII_88E1318S_PHY_WOL_CTRL,
+ MII_88E1318S_PHY_WOL_CTRL_CLEAR_WOL_STATUS);
+ }
+err:
+ rc = phy_restore_page(phydev, saved_page, rc);
+ if (rc < 0)
+ dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc);
+
+ if (!data) {
+ /* Slow down the PHY to save energy */
+ rc= phy_speed_down(phydev, false);
+ if (rc < 0)
+ dev_err(&phydev->mdio.dev, "PHY speed down failed, %d\n", rc);
+ }
+}
+
+static int linkstation_reboot_notifier(struct notifier_block *nb,
+ unsigned long action, void *unused)
+{
+ if (action == SYS_RESTART)
+ mvphy_reg_intn(MII_88E1318S_PHY_LED_TCR_FORCE_INT);
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block linkstation_reboot_nb = {
+ .notifier_call = linkstation_reboot_notifier,
+};
+
+static void linkstation_poweroff(void)
+{
+ unregister_reboot_notifier(&linkstation_reboot_nb);
+ mvphy_reg_intn(0);
+
+ kernel_restart("Power off");
+}
+
+static const struct of_device_id ls_poweroff_of_match[] = {
+ { .compatible = "buffalo,ls421d" },
+ { .compatible = "buffalo,ls421de" },
+ { },
+};
+
+static int __init linkstation_poweroff_init(void)
+{
+ struct mii_bus *bus;
+ struct device_node *dn;
+
+ dn = of_find_matching_node(NULL, ls_poweroff_of_match);
+ if (!dn)
+ return -ENODEV;
+ of_node_put(dn);
+
+ dn = of_find_node_by_name(NULL, "mdio");
+ if (!dn)
+ return -ENODEV;
+
+ bus = of_mdio_find_bus(dn);
+ of_node_put(dn);
+ if (!bus)
+ return -EPROBE_DEFER;
+
+ phydev = phy_find_first(bus);
+ if (!phydev)
+ return -EPROBE_DEFER;
+
+ register_reboot_notifier(&linkstation_reboot_nb);
+ pm_power_off = linkstation_poweroff;
+
+ pr_info("LinkStation power off driver registered\n");
+ return 0;
+}
+
+static void __exit linkstation_poweroff_exit(void)
+{
+ pm_power_off = NULL;
+ unregister_reboot_notifier(&linkstation_reboot_nb);
+}
+
+module_init(linkstation_poweroff_init);
+module_exit(linkstation_poweroff_exit);
+
+MODULE_AUTHOR("Daniel González Cabanelas <dgcbueu@gmail.com>");
+MODULE_DESCRIPTION("LinkStation power off driver");
+MODULE_LICENSE("GPL v2");

View File

@@ -0,0 +1,28 @@
--- a/arch/arm/boot/dts/armada-388-helios4.dts
+++ b/arch/arm/boot/dts/armada-388-helios4.dts
@@ -15,6 +15,13 @@
model = "Helios4";
compatible = "kobol,helios4", "marvell,armada388",
"marvell,armada385", "marvell,armada380";
+
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ };
memory {
device_type = "memory";
@@ -70,10 +77,9 @@
system-leds {
compatible = "gpio-leds";
- status-led {
+ led_status: status-led {
label = "helios4:green:status";
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
- linux,default-trigger = "heartbeat";
default-state = "on";
};

View File

@@ -0,0 +1,10 @@
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -69,6 +69,7 @@ config MACH_ARMADA_38X
select HAVE_SMP
select MACH_MVEBU_V7
select PINCTRL_ARMADA_38X
+ select ARCH_WANT_LIBATA_LEDS
help
Say 'Y' here if you want your kernel to support boards based
on the Marvell Armada 380/385 SoC with device tree.