summaryrefslogtreecommitdiff
path: root/io-module
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2016-12-09 18:36:08 -0600
committerJohn Klug <john.klug@multitech.com>2016-12-09 18:36:08 -0600
commit3c70423f1717cf69c321d8f2eef5f03e98c04e39 (patch)
tree7be023f07a1d4aa3a128f8fea757ec27362d45c2 /io-module
parentf3820a537bbb82761ef7fdec3902eac885eacab5 (diff)
downloadmts-io-3c70423f1717cf69c321d8f2eef5f03e98c04e39.tar.gz
mts-io-3c70423f1717cf69c321d8f2eef5f03e98c04e39.tar.bz2
mts-io-3c70423f1717cf69c321d8f2eef5f03e98c04e39.zip
Add the platform reset for the Ethernet accessory card.
Diffstat (limited to 'io-module')
-rw-r--r--io-module/mtac_eth.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/io-module/mtac_eth.c b/io-module/mtac_eth.c
index 6738080..7a35ea5 100644
--- a/io-module/mtac_eth.c
+++ b/io-module/mtac_eth.c
@@ -1,6 +1,21 @@
static char* eth_gpio_pin_name_by_attr_name(const char* name, int port) {
- log_error("attirbute name [%s] is invalid for ETH in port %d", name, port);
- return "";
+ switch (port) {
+ case port_1:
+ if (! strcmp(name, "reset")) {
+ return "ap1-reset";
+ } else {
+ log_error("attribute name [%s] is invalid for LORA in port %d", name, port);
+ return "";
+ }
+
+ case port_2:
+ if (! strcmp(name, "reset")) {
+ return "ap2-reset";
+ } else {
+ log_error("attribute name [%s] is invalid for LORA in port %d", name, port);
+ return "";
+ }
+ }
}
// 1 vendor-id
@@ -8,8 +23,9 @@ static char* eth_gpio_pin_name_by_attr_name(const char* name, int port) {
// 1 device-id
// 1 hw-version
// 1 mac-addr or eui
+// 1 reset
// NULL
-static size_t ap_eth_attrs_size = 6;
+static size_t ap_eth_attrs_size = 7;
static bool eth_setup(enum ap port) {
int i;
@@ -19,6 +35,7 @@ static bool eth_setup(enum ap port) {
int ret;
char buf[32];
struct attribute **attrs;
+ struct kobj_attribute* attr;
log_info("loading ETH accessory card in port %d", port);
@@ -57,15 +74,26 @@ static bool eth_setup(enum ap port) {
return false;
}
+ sprintf(buf, "reset");
+ attr = create_attribute(buf, MTS_ATTR_MODE_RW);
+ if (! attr) {
+ log_error("failed to create attribute [%s] for ETH in port %d", buf, port);
+ kfree(attrs);
+ return false;
+ }
+ ap_attr_groups[port_index].attrs = attrs;
+
+ attr->show = mts_attr_show_ap_gpio_pin;
+ attr->store = mts_attr_store_ap_gpio_pin;
+ attrs[index++] = &attr->attr;
+
// add attributes for eeprom contents
if (! ap_add_product_info_attributes(port, MTAC_ETH_0_0, attrs, &index)) {
log_error("failed to add product info attributes for ETH in port %d", port);
return false;
}
-
attrs[index] = NULL;
- ap_attr_groups[port_index].attrs = attrs;
if (sysfs_create_group(ap_subdirs[port_index], &ap_attr_groups[port_index])) {
log_error("sysfs_create_group failed for ETH in port %d", port);
return false;