summaryrefslogtreecommitdiff
path: root/polux
diff options
context:
space:
mode:
authorJean-Philippe SAVE2013-01-03 18:42:57 +0100
committerJean-Philippe SAVE2013-01-09 16:20:24 +0100
commit58677bad086e978def7d6fd4c09af3cb0c53993f (patch)
tree5153dcb50d5ff5c51ff4a4c2c01fd5ad8c4b8d2f /polux
parentbd0e538f80df60be4aad8e3df3c9f8a3fd777397 (diff)
polux/devkit/plc-polux: add sysctl for system led ON on low level, closes #3668
Diffstat (limited to 'polux')
-rw-r--r--polux/devkit/plc-polux/core/ce_core.c2
-rw-r--r--polux/devkit/plc-polux/core/linux_drv.c12
-rw-r--r--polux/devkit/plc-polux/core/plc_drv.h2
-rw-r--r--polux/devkit/plc-polux/core/plc_nd.c4
-rw-r--r--polux/devkit/plc-polux/core/plc_sysctl.c38
-rw-r--r--polux/devkit/plc-polux/core/plc_sysctl.h3
-rw-r--r--polux/devkit/plc-polux/gpio/gpio.h2
-rw-r--r--polux/devkit/plc-polux/gpio/gpio_management.c3
8 files changed, 57 insertions, 9 deletions
diff --git a/polux/devkit/plc-polux/core/ce_core.c b/polux/devkit/plc-polux/core/ce_core.c
index 5324573863..dbb6604e62 100644
--- a/polux/devkit/plc-polux/core/ce_core.c
+++ b/polux/devkit/plc-polux/core/ce_core.c
@@ -3924,7 +3924,7 @@ void ce_event_timeout_reply (struct plc_drv_unit *unit, struct plcp_host *host)
/* We are considered as disassociated. So
* switch off the system LED for a
* management as on 300/500 chips. */
- plc_system_led (LED_OFF);
+ plc_system_led (LED_OFF, unit->system_led_low_level_on);
}
/* Update broadcast host bssid */
broadcast_host->BSSID = unit->BSSID;
diff --git a/polux/devkit/plc-polux/core/linux_drv.c b/polux/devkit/plc-polux/core/linux_drv.c
index 45a4c5eccf..a9ffca66f9 100644
--- a/polux/devkit/plc-polux/core/linux_drv.c
+++ b/polux/devkit/plc-polux/core/linux_drv.c
@@ -1104,7 +1104,11 @@ DevErr __init plc_open_under_rtai (void)
if ((p->system_led_lookslike_500 == false) ||
(p->mode == repeater))
{
- plc_system_led (LED_ON);
+ plc_system_led (LED_ON, p->system_led_low_level_on);
+ }
+ else
+ {
+ plc_system_led (LED_OFF, p->system_led_low_level_on);
}
/* start the MAC layer */
@@ -1624,8 +1628,10 @@ static int __init plc_drv_init (struct net_device *dev)
ze_unit->tx_int_enabled = 1;
ze_unit->id = 0;
ze_unit->dev = dev;
- /* By default system led management is 200 compatible. */
- ze_unit->system_led_lookslike_500 = false;
+ /* By default system led management is 200 compatible. */
+ ze_unit->system_led_lookslike_500 = false;
+ /* By default system led is ON on high level. */
+ ze_unit->system_led_low_level_on = false;
read_nvram (dev);
diff --git a/polux/devkit/plc-polux/core/plc_drv.h b/polux/devkit/plc-polux/core/plc_drv.h
index 1846eb992a..de46bcd860 100644
--- a/polux/devkit/plc-polux/core/plc_drv.h
+++ b/polux/devkit/plc-polux/core/plc_drv.h
@@ -135,6 +135,8 @@ struct plc_drv_unit {
bool system_led_lookslike_500; /* true when the system LED is managed as in SPiDCOM Chips 300/500 */
+ bool system_led_low_level_on; /* true when the system LED is ON on low level */
+
/********************* données driver ****************************/
bool polled; /* true if the device is in polled mode. */
bool init; /* true if the device has been found and initialized */
diff --git a/polux/devkit/plc-polux/core/plc_nd.c b/polux/devkit/plc-polux/core/plc_nd.c
index 8cf70407d2..fa0052b01a 100644
--- a/polux/devkit/plc-polux/core/plc_nd.c
+++ b/polux/devkit/plc-polux/core/plc_nd.c
@@ -893,7 +893,7 @@ static void assoc_reply (struct plc_drv_unit *unit, struct assoc_reply *reply)
/* We are considered as associated. So
* switch on the system LED for a
* management as on 300/500 chips. */
- plc_system_led (LED_ON);
+ plc_system_led (LED_ON, unit->system_led_low_level_on);
}
bhost->BSSID = unit->BSSID;
bhost->localTEI = unit->TEI;
@@ -1160,7 +1160,7 @@ static void disassoc_reply (struct plc_drv_unit *unit, struct disassoc_reply *re
/* We are considered as disassociated. So
* switch off the system LED for a
* management as on 300/500 chips. */
- plc_system_led (LED_OFF);
+ plc_system_led (LED_OFF, unit->system_led_low_level_on);
}
bhost->BSSID = BSSID_UNDEF;
bhost->localTEI = TEI_UNDEF;
diff --git a/polux/devkit/plc-polux/core/plc_sysctl.c b/polux/devkit/plc-polux/core/plc_sysctl.c
index e09cbfd124..623e737bad 100644
--- a/polux/devkit/plc-polux/core/plc_sysctl.c
+++ b/polux/devkit/plc-polux/core/plc_sysctl.c
@@ -727,6 +727,36 @@ SYSCTL_function (sysctl_system_led_lookslike_500)
return 0;
}
+SYSCTL_function (sysctl_system_led_low_level_on)
+{
+ struct plc_drv_unit *unit = plc_drv_get_unit (0);
+
+ if (oldval) // read
+ {
+ if (unit->system_led_low_level_on)
+ {
+ *oldlenp = sprintf (oldval, "1");
+ }
+ else
+ {
+ *oldlenp = sprintf (oldval, "0");
+ }
+ }
+ else if (newval) // write
+ {
+ if (strtoul (newval, NULL, 0))
+ {
+ unit->system_led_low_level_on = true;
+ }
+ else
+ {
+ unit->system_led_low_level_on = false;
+ }
+ }
+
+ return 0;
+}
+
SYSCTL_function (sysctl_auto_balance_mac_frame)
{
struct plc_drv_unit *unit = plc_drv_get_unit (0);
@@ -2786,6 +2816,14 @@ static ctl_table plc_table[] = {
.mode = 0666,
.proc_handler = &std_proc_handler,
.strategy = &sysctl_system_led_lookslike_500},
+ {
+ .ctl_name = PLC_SYSLED_LOW_LEVEL_ON,
+ .procname = "system_led_low_level_on",
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0666,
+ .proc_handler = &std_proc_handler,
+ .strategy = &sysctl_system_led_low_level_on},
{0}
};
diff --git a/polux/devkit/plc-polux/core/plc_sysctl.h b/polux/devkit/plc-polux/core/plc_sysctl.h
index 0d281e92ca..55e96676e1 100644
--- a/polux/devkit/plc-polux/core/plc_sysctl.h
+++ b/polux/devkit/plc-polux/core/plc_sysctl.h
@@ -125,7 +125,8 @@ enum {
PLC_ND_MODE,
PLC_WL_LOGDELAY,
PLC_TX_GAIN,
- PLC_SYSLED_LOOKSLIKE_500
+ PLC_SYSLED_LOOKSLIKE_500,
+ PLC_SYSLED_LOW_LEVEL_ON
// Always insert on the end list.
};
diff --git a/polux/devkit/plc-polux/gpio/gpio.h b/polux/devkit/plc-polux/gpio/gpio.h
index 7fe5ae4271..6fb845a500 100644
--- a/polux/devkit/plc-polux/gpio/gpio.h
+++ b/polux/devkit/plc-polux/gpio/gpio.h
@@ -5,7 +5,7 @@
#define LED_OFF false
#define LED_ON true
-extern int plc_system_led(bool value);
+extern int plc_system_led(bool value, bool low_level_on);
extern int shell_software_reset(int argc, char **argv);
extern int shell_software_reset_no_wait(int argc, char **argv);
extern int soft_reset(void);
diff --git a/polux/devkit/plc-polux/gpio/gpio_management.c b/polux/devkit/plc-polux/gpio/gpio_management.c
index bc6460b232..b90ef5b86a 100644
--- a/polux/devkit/plc-polux/gpio/gpio_management.c
+++ b/polux/devkit/plc-polux/gpio/gpio_management.c
@@ -76,8 +76,9 @@ int soft_reset() {
}
#endif
-int plc_system_led(bool value)
+int plc_system_led(bool value, bool low_level_on)
{
+ value ^= low_level_on;
#ifdef SP_CRISTINA
if (value)
ApGpio_dev->GPIO_15_8.data_out |= (1<<5) ;