widewing wrote:hi gregd, does this patch work for your box?
i'm really busy the following days, so if you've tested, please help to submit them. :-)
Hi widewing,
I spent some time yesterday investigating this and I think I've got it working (on AA). Basically, you were spot on with missing RT305X_GPIO_MODE_MDIO 'or' when initializing GPIO. However, you patch was initializing GPIO twice.
The patch below is a refined version and is adjusted to AA:
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c (revision 35572)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c (working copy)
@@ -22,6 +22,9 @@
#define DIR_300B_GPIO_LED_STATUS_AMBER 8
#define DIR_300B_GPIO_LED_STATUS_GREEN 9
#define DIR_300B_GPIO_LED_WPS 13
+
+#define DIR_615D_GPIO_LED_WPS_RED 13
+#define DIR_615D_GPIO_LED_WPS_BLUE 11
/*
* NOTE: The wan led is also connected to the switch, both
* switch and gpio must be active to make it light up
@@ -83,6 +86,34 @@
}
};
+static struct gpio_led dir_615d_leds_gpio[] __initdata = {
+ {
+ .name = "d-link:amber:status",
+ .gpio = DIR_300B_GPIO_LED_STATUS_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "d-link:green:status",
+ .gpio = DIR_300B_GPIO_LED_STATUS_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "d-link:amber:wan",
+ .gpio = DIR_300B_GPIO_LED_WAN_AMBER,
+ .active_low = 1,
+ }, {
+ .name = "d-link:green:wan",
+ .gpio = DIR_300B_GPIO_LED_WAN_GREEN,
+ .active_low = 1,
+ }, {
+ .name = "d-link:blue:wps",
+ .gpio = DIR_615D_GPIO_LED_WPS_BLUE,
+ .active_low = 1,
+ }, {
+ .name = "d-link:red:wps",
+ .gpio = DIR_615D_GPIO_LED_WPS_RED,
+ .active_low = 1,
+ }
+};
+
static struct gpio_led dir_620_leds_gpio[] __initdata = {
{
.name = "d-link:amber:status",
@@ -131,6 +162,24 @@
dir_300b_leds_gpio);
}
+static void __init dir_615d_init(void)
+{
+ rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT |
+ RT305X_GPIO_MODE_MDIO);
+ rt305x_register_flash(0);
+
+ rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
+ rt305x_register_ethernet();
+ ramips_register_gpio_buttons(-1, DIR_300B_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(dir_300b_gpio_buttons),
+ dir_300b_gpio_buttons);
+ rt305x_register_wifi();
+ rt305x_register_wdt();
+
+ ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_615d_leds_gpio),
+ dir_615d_leds_gpio);
+}
+
static void __init dir_620a1_init(void)
{
dir_common_init();
@@ -149,7 +187,7 @@
dir_300b_init);
MIPS_MACHINE(RAMIPS_MACH_DIR_615_D, "DIR-615-D", "D-Link DIR-615 D",
- dir_300b_init);
+ dir_615d_init);
MIPS_MACHINE(RAMIPS_MACH_DIR_620_A1, "DIR-620-A1", "D-Link DIR-620 A1",
dir_620a1_init);
Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
===================================================================
--- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 36157)
+++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
@@ -28,7 +28,8 @@
;;
dir-300-b1 |\
dir-300-b2 |\
- dir-600-b1)
+ dir-600-b1 |\
+ dir-615-d)
mac=$(ramips_get_mac_binary devdata 16388)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
Index: target/linux/ramips/base-files/etc/uci-defaults/network
===================================================================
--- target/linux/ramips/base-files/etc/uci-defaults/network (revision 36157)
+++ target/linux/ramips/base-files/etc/uci-defaults/network (working copy)
@@ -164,7 +164,8 @@
dir-300-b1 |\
dir-300-b2 |\
- dir-600-b1)
+ dir-600-b1 |\
+ dir-615-d)
lan_mac=$(ramips_get_mac_binary devdata 16388)
wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
;;
I experienced a problem with config/network when doing a sysupgrade. Basically, the switch configuration did not seem right. Full tftp flash of factory firmware should solve it or run 'firstboot' command after sysupgrade.
And here are the builds for Attitude Adjustment:
dir-615d-factory: https://mega.co.nz/#!94kziKYY!Bl0TXHhh8vDonGmcyY6RZSFe34g8WWZn0OF50-GAzbE
dir-615d-sysupgrade: https://mega.co.nz/#!th9jkCSI!UZNzLWaf9kg_mWVxYEF8YXL4KaESPO39JUtTLj5WHvA
Update:
It looks like this does not work with the latest AA branch/trunk. There must have been somewhere a commit that breaks something. I am tempted to say that the problem is in uci network initialization and set_iface_mac. Hopefully, I will try it tomorrow
(Last edited by gregd72002 on 17 Apr 2013, 21:14)