apm821xx: unify My Book Live Single + Duo images

By takimata:
"Come to think of it, an MBL Single board boots up just fine on an
MBL Duo image, and the MBL Single board identifies completely
identical to the MBL Duo
(Board: Apollo-3G - APM82181 Board, 2*SATA, 1*USB).
I wonder if there is any downside to just using the MBL Duo firmware
on a MBL Single. I wonder if the two firmwares could even be unified."

<https://forum.lede-project.org/t/wd-mybook-live-duo-two-disks/16195/9>

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
openwrt-19.07
Christian Lamparter 2018-07-16 22:56:36 +02:00 committed by Mathias Kresin
parent c4f09fc9f8
commit 9b47aa93c7
4 changed files with 187 additions and 246 deletions

View File

@ -1,189 +0,0 @@
/*
* Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
* (c) Copyright 2010 Western Digital Technologies, Inc. All Rights Reserved.
*
* 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.
*/
#include "apm82181.dtsi"
/ {
compatible = "amcc,apollo3g";
aliases {
serial0 = &UART0;
led-boot = &status;
led-failsafe = &status;
led-running = &status;
led-upgrade = &status;
};
};
&POB0 {
ebc {
nor_flash@0,0 {
status = "okay";
compatible = "amd,s29gl512n", "jedec-probe", "cfi-flash", "mtd-rom";
bank-width = <1>;
reg = <0x00000000 0x00000000 0x00080000>;
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
/* Part of bootrom - Don't use it without a jump */
label = "free";
reg = <0x00000000 0x0001e000>;
};
partition@1 {
label = "env";
reg = <0x0001e000 0x00002000>;
};
partition@2 {
label = "uboot";
reg = <0x00020000 0x00050000>;
};
};
};
GPIO1: gpio1@e0000000 {
compatible = "wd,mbl-gpio", "ti,74273";
reg-names = "dat";
reg = <0xe0000000 0x1>;
#gpio-cells = <2>;
gpio-controller;
enable-phy {
/* toggle to reset EMAC PHY */
gpio-hog;
line-name = "enable EMAC PHY";
gpios = <0 GPIO_ACTIVE_LOW>;
output-low;
};
enable-button {
/* Defined in u-boot as: NOT_NOR
* "enables features other than NOR
* specifically, the buffer at CS2"
* (button).
*
* Note: This option is disabled as
* it prevents the system from being
* rebooted successfully.
*/
gpio-hog;
line-name = "Enable Reset Button, disable NOR";
gpios = <1 GPIO_ACTIVE_HIGH>;
output-low;
};
enable-usb {
gpio-hog;
line-name = "Power USB Core";
gpios = <2 GPIO_ACTIVE_LOW>;
output-low;
status = "disabled";
};
enable-port1 {
gpio-hog;
line-name = "Power Drive Port 1";
gpios = <3 GPIO_ACTIVE_LOW>;
output-low;
};
enable-port0 {
gpio-hog;
line-name = "Power Drive Port 0";
gpios = <7 GPIO_ACTIVE_LOW>;
output-low;
status = "disabled";
};
};
GPIO2: gpio2@e0100000 {
compatible = "wd,mbl-gpio", "ti,74244";
reg-names = "dat";
reg = <0xe0100000 0x1>;
#gpio-cells = <2>;
gpio-controller;
no-output;
};
gpio-leds {
compatible = "gpio-leds";
failsafe: power-red {
label = "mbl:red:power";
gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "panic";
};
status: power-green {
label = "mbl:green:power";
gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>;
};
power-blue {
label = "mbl:blue:power";
gpios = <&GPIO1 6 GPIO_ACTIVE_HIGH>;
};
};
gpio_keys_polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <60>; /* 3 * 20 = 60ms */
autorepeat;
button@1 {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&GPIO2 2 GPIO_ACTIVE_LOW>;
};
};
};
&CRYPTO {
status = "okay";
};
&PKA {
status = "okay";
};
&TRNG {
status = "okay";
};
&SATA1 {
status = "okay";
};
&UART0 {
status = "okay";
};
&EMAC0 {
status = "okay";
phy-map = <0x2>;
phy-address = <0x1>;
phy-handle = <&phy>;
mdio {
phy: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
};
};
&SATA1 {
status = "okay";
};

View File

@ -1,38 +0,0 @@
/*
* Device Tree Source for AMCC Canyonlands (460EX)
*
* Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
* (c) Copyright 2010 Western Digital Technologies, Inc. All Rights Reserved.
*
* 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.
*/
/dts-v1/;
#include "apollo3g.dtsi"
/ {
compatible = "wd,mybooklive-duo", "amcc,apollo3g";
model = "MyBook Live Duo";
};
&SATA0 {
status = "okay";
};
&USBOTG0 {
status = "okay";
dr_mode = "host";
};
&GPIO1 {
enable-usb {
status = "okay";
};
enable-port0 {
status = "okay";
};
};

View File

@ -9,9 +9,190 @@
/dts-v1/;
#include "apollo3g.dtsi"
#include "apm82181.dtsi"
/ {
compatible = "wd,mybooklive", "amcc,apollo3g";
model = "MyBook Live";
aliases {
serial0 = &UART0;
led-boot = &status;
led-failsafe = &status;
led-running = &status;
led-upgrade = &status;
};
};
&POB0 {
ebc {
nor_flash@0,0 {
status = "okay";
compatible = "amd,s29gl512n", "jedec-probe", "cfi-flash", "mtd-rom";
bank-width = <1>;
reg = <0x00000000 0x00000000 0x00080000>;
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
/* Part of bootrom - Don't use it without a jump */
label = "free";
reg = <0x00000000 0x0001e000>;
};
partition@1 {
label = "env";
reg = <0x0001e000 0x00002000>;
};
partition@2 {
label = "uboot";
reg = <0x00020000 0x00050000>;
};
};
};
GPIO1: gpio1@e0000000 {
compatible = "wd,mbl-gpio", "ti,74273";
reg-names = "dat";
reg = <0xe0000000 0x1>;
#gpio-cells = <2>;
gpio-controller;
enable-phy {
/* toggle to reset EMAC PHY */
gpio-hog;
line-name = "enable EMAC PHY";
gpios = <0 GPIO_ACTIVE_LOW>;
output-low;
};
enable-button {
/* Defined in u-boot as: NOT_NOR
* "enables features other than NOR
* specifically, the buffer at CS2"
* (button).
*
* Note: This option is disabled as
* it prevents the system from being
* rebooted successfully.
*/
gpio-hog;
line-name = "Enable Reset Button, disable NOR";
gpios = <1 GPIO_ACTIVE_HIGH>;
output-low;
};
enable-usb {
gpio-hog;
line-name = "Power USB Core";
gpios = <2 GPIO_ACTIVE_LOW>;
output-low;
};
enable-port1 {
gpio-hog;
line-name = "Power Drive Port 1";
gpios = <3 GPIO_ACTIVE_LOW>;
output-low;
};
enable-port0 {
gpio-hog;
line-name = "Power Drive Port 0";
gpios = <7 GPIO_ACTIVE_LOW>;
output-low;
};
};
GPIO2: gpio2@e0100000 {
compatible = "wd,mbl-gpio", "ti,74244";
reg-names = "dat";
reg = <0xe0100000 0x1>;
#gpio-cells = <2>;
gpio-controller;
no-output;
};
gpio-leds {
compatible = "gpio-leds";
failsafe: power-red {
label = "mbl:red:power";
gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "panic";
};
status: power-green {
label = "mbl:green:power";
gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>;
};
power-blue {
label = "mbl:blue:power";
gpios = <&GPIO1 6 GPIO_ACTIVE_HIGH>;
};
};
gpio_keys_polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <60>; /* 3 * 20 = 60ms */
autorepeat;
reset-button {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&GPIO2 2 GPIO_ACTIVE_LOW>;
};
};
};
&EMAC0 {
status = "okay";
phy-map = <0x2>;
phy-address = <0x1>;
phy-handle = <&phy>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
};
};
&CRYPTO {
status = "okay";
};
&PKA {
status = "okay";
};
&TRNG {
status = "okay";
};
&SATA0 {
status = "okay";
};
&SATA1 {
status = "okay";
};
&UART0 {
status = "okay";
};
&USBOTG0 {
status = "okay";
dr_mode = "host";
};

View File

@ -214,7 +214,11 @@ define Build/hdd-img
./mbl_gen_hdd_img.sh $@ $@.boot $(IMAGE_ROOTFS)
endef
define Device/MyBookLiveDefault
define Device/wd_mybooklive
DEVICE_TITLE := Western Digital My Book Live Series (Single + Duo)
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-mini
DEVICE_DTS := wd-mybooklive
SUPPORTED_DEVICES += mbl wd_mybooklive-duo
IMAGE_SIZE := 48m
BLOCKSIZE := 1k
DTB_SIZE := 16384
@ -228,25 +232,8 @@ define Device/MyBookLiveDefault
IMAGE/rootfs.img.gz := boot-script | boot-img | hdd-img | gzip | append-metadata
endef
define Device/wd_mybooklive
$(Device/MyBookLiveDefault)
DEVICE_TITLE := Western Digital My Book Live
DEVICE_DTS := wd-mybooklive
SUPPORTED_DEVICES += mbl
endef
TARGET_DEVICES += wd_mybooklive
define Device/wd_mybooklive-duo
$(Device/MyBookLiveDefault)
DEVICE_TITLE := Western Digital My Book Live Duo
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-mini
DEVICE_DTS := wd-mybooklive-duo
SUPPORTED_DEVICES += mbl
endef
TARGET_DEVICES += wd_mybooklive-duo
endif
$(eval $(call BuildImage))