mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 23:12:32 +00:00
4e46ae1f69
NETGEAR ReadyNAS Duo v2 is a NAS based on Marvell kirkwood SoC. Specification: - Processor Marvell 88F6282 (1.6 GHz) - 256MB RAM - 128MB NAND - 1x GBE LAN port (PHY: Marvell 88E1318) - 1x USB 2.0 - 2x USB 3.0 - 2x SATA - 3x button - 5x leds - serial on J5 connector accessible from rear panel (115200 8N1) (VCC,TX,RX,GND) (3V3 LOGIC!) Installation by USB + serial: - Copy initramfs image to fat32 usb drive - Connect pendrive to USB 2.0 front socket - Connect serial console - Stop booting in u-boot - Do: usb reset setenv bootargs 'console=ttyS0,115200n8 earlyprintk' setenv bootcmd 'nand read.e 0x1200000 0x200000 0x600000;bootm 0x1200000' saveenv fatload usb 0:1 0x1200000 openwrt-kirkwood-netgear_readynas-duo-v2-initramfs-uImage bootm 0x1200000 - copy sysupgrade image via ssh. - run sysupgrade Installation by TFTP + serial: - Setup TFTP server and copy initramfs image - Connect serial console - Stop booting in u-boot - Do: setenv bootargs 'console=ttyS0,115200n8 earlyprintk' setenv bootcmd 'nand read.e 0x1200000 0x200000 0x600000;bootm 0x1200000' saveenv setenv serverip 192.168.1.1 setenv ipaddr 192.168.1.2 tftpboot 0x1200000 openwrt-kirkwood-netgear_readynas-duo-v2-initramfs-uImage bootm 0x1200000 - copy sysupgrade image via ssh. - run sysupgrade Known issues: - Power button and PHY INTn pin are connected to the same GPIO. It causes that every network restart button is pressed in system. As workaround, button is used as regular BTN_1. For more info please look at file: RND_5.3.13_WW.src/u-boot/board/mv_feroceon/mv_hal/usibootup/usibootup.c from Netgear GPL sources. Tested-by: Raylynn Knight <rayknight@me.com> Tested-by: Lech Perczak <lech.perczak@gmail.com> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
103 lines
3.1 KiB
Diff
103 lines
3.1 KiB
Diff
From a2d9c86df8d12646f5bf66920e4f1e6d940cfc62 Mon Sep 17 00:00:00 2001
|
|
From: Pawel Dembicki <paweldembicki@gmail.com>
|
|
Date: Fri, 18 Jun 2021 13:25:33 +0200
|
|
Subject: [PATCH 2/2] power: reset: linkstation-poweroff: add new device
|
|
|
|
This commit introduces support for NETGEAR ReadyNAS Duo v2.
|
|
This device use bit 4 of LED[2:0] Polarity Control Register to indicate
|
|
AC Power loss.
|
|
|
|
For more details about AC loss detection in NETGEAR ReadyNAS Duo v2,
|
|
please look at the file:
|
|
RND_5.3.13_WW.src/u-boot/board/mv_feroceon/mv_hal/usibootup/usibootup.c
|
|
from Netgear GPL sources.
|
|
|
|
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
|
|
---
|
|
drivers/power/reset/linkstation-poweroff.c | 43 ++++++++++++++++++++++
|
|
1 file changed, 43 insertions(+)
|
|
|
|
diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c
|
|
index 8691cf98600d..2a92b6052cac 100644
|
|
--- a/drivers/power/reset/linkstation-poweroff.c
|
|
+++ b/drivers/power/reset/linkstation-poweroff.c
|
|
@@ -19,6 +19,7 @@
|
|
#define MII_MARVELL_PHY_PAGE 22
|
|
|
|
#define MII_PHY_LED_CTRL 16
|
|
+#define MII_PHY_LED_POL_CTRL 17
|
|
#define MII_88E1318S_PHY_LED_TCR 18
|
|
#define MII_88E1318S_PHY_WOL_CTRL 16
|
|
#define MII_M1011_IEVENT 19
|
|
@@ -29,6 +30,8 @@
|
|
#define LED2_FORCE_ON (0x8 << 8)
|
|
#define LEDMASK GENMASK(11,8)
|
|
|
|
+#define MII_88E1318S_PHY_LED_POL_LED2 BIT(4)
|
|
+
|
|
struct power_off_cfg {
|
|
char *mdio_node_name;
|
|
void (*phy_set_reg)(bool restart);
|
|
@@ -76,11 +79,48 @@ static void linkstation_mvphy_reg_intn(bool restart)
|
|
dev_err(&phydev->mdio.dev, "Write register failed, %d\n", rc);
|
|
}
|
|
|
|
+static void readynas_mvphy_set_reg(bool restart)
|
|
+{
|
|
+ int rc = 0, saved_page;
|
|
+ u16 data = 0;
|
|
+
|
|
+ if(restart)
|
|
+ data = MII_88E1318S_PHY_LED_POL_LED2;
|
|
+
|
|
+ saved_page = phy_select_page(phydev, MII_MARVELL_LED_PAGE);
|
|
+ if (saved_page < 0)
|
|
+ goto err;
|
|
+
|
|
+ /* Set the LED[2].0 Polarity bit to the required state */
|
|
+ __phy_modify(phydev, MII_PHY_LED_POL_CTRL,
|
|
+ MII_88E1318S_PHY_LED_POL_LED2, data);
|
|
+
|
|
+ if (!data) {
|
|
+
|
|
+ /* 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);
|
|
+}
|
|
+
|
|
static const struct power_off_cfg linkstation_power_off_cfg = {
|
|
.mdio_node_name = "mdio",
|
|
.phy_set_reg = linkstation_mvphy_reg_intn,
|
|
};
|
|
|
|
+static const struct power_off_cfg readynas_power_off_cfg = {
|
|
+ .mdio_node_name = "mdio-bus",
|
|
+ .phy_set_reg = readynas_mvphy_set_reg,
|
|
+};
|
|
+
|
|
static int linkstation_reboot_notifier(struct notifier_block *nb,
|
|
unsigned long action, void *unused)
|
|
{
|
|
@@ -109,6 +149,9 @@ static const struct of_device_id ls_poweroff_of_match[] = {
|
|
{ .compatible = "buffalo,ls421de",
|
|
.data = &linkstation_power_off_cfg,
|
|
},
|
|
+ { .compatible = "netgear,readynas-duo-v2",
|
|
+ .data = &readynas_power_off_cfg,
|
|
+ },
|
|
{ },
|
|
};
|
|
|
|
--
|
|
2.25.1
|
|
|