Watchdog and GPIO update for initial optical stack
Change-Id: Ib843a07de4405f03f25fbce6094bee0cd17e6014
diff --git a/arch/arm/configs/gflt110_defconfig b/arch/arm/configs/gflt110_defconfig
index cef0917..25bc9ca 100644
--- a/arch/arm/configs/gflt110_defconfig
+++ b/arch/arm/configs/gflt110_defconfig
@@ -1136,7 +1136,7 @@
CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_GPIOLIB=y
# CONFIG_DEBUG_GPIO is not set
-# CONFIG_GPIO_SYSFS is not set
+CONFIG_GPIO_SYSFS=y
#
# Memory mapped GPIO expanders:
diff --git a/arch/arm/mach-feroceon-kw2/board-gflt110.c b/arch/arm/mach-feroceon-kw2/board-gflt110.c
index db2181d..8d1b5d2 100644
--- a/arch/arm/mach-feroceon-kw2/board-gflt110.c
+++ b/arch/arm/mach-feroceon-kw2/board-gflt110.c
@@ -11,6 +11,7 @@
#include <linux/sysfs.h>
#include <linux/ctype.h>
+#define GPIO_PON_PWR_EN 37
struct gflt_led_data {
unsigned gpio;
@@ -18,6 +19,56 @@
struct led_classdev cdev;
};
+struct board_gpio {
+ unsigned gpio;
+ const char *label;
+};
+
+static struct board_gpio board_gpios[] = {
+ {
+ .gpio = GPIO_PON_PWR_EN,
+ .label = "power-enable",
+ },
+};
+
+static int board_gpio_export(struct board_gpio *gpio, struct device *dev, char *boardName)
+{
+ int rc;
+
+ rc = gpio_request(gpio->gpio, gpio->label);
+ if (rc) {
+ pr_err("%s: error %d requesting gpio %u (%s)\n", boardName, rc,
+ gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ /* this is needed to set gpiolib's out flag for the gpio */
+ rc = gpio_direction_output(gpio->gpio, gpio_get_value(gpio->gpio));
+ if (rc) {
+ pr_err("%s: error %d setting gpio %u (%s) direction\n",
+ boardName, rc, gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = gpio_export(gpio->gpio, false);
+ if (rc) {
+ pr_err("%s: error %d exporting gpio %u (%s)\n", boardName, rc,
+ gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = gpio_export_link(dev, gpio->label, gpio->gpio);
+ if (rc) {
+ pr_err("%s: error %d linking gpio %u (%s)\n", boardName, rc,
+ gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = 0;
+exit:
+ return rc;
+}
+
static ssize_t board_hw_ver_show(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -188,6 +239,11 @@
if (rc)
pr_err("%s: error %d registering GFLT LED device\n", boardName, rc);
+ /* /sys/devices/platform/board/<gpio_name> */
+ for (i = 0; i < ARRAY_SIZE(board_gpios); i++)
+ board_gpio_export(&board_gpios[i], &pdev->dev, boardName);
+
+
return 0;
}
diff --git a/arch/arm/mach-feroceon-kw2/core.c b/arch/arm/mach-feroceon-kw2/core.c
index e68380a..2c725e0 100755
--- a/arch/arm/mach-feroceon-kw2/core.c
+++ b/arch/arm/mach-feroceon-kw2/core.c
@@ -513,8 +513,13 @@
/* init the watchdog device */
static void __init mv_wdt_init(void)
{
+ MV_U32 val;
+
mv_wdt_data.tclk = mvTclk;
platform_device_register(&mv_wdt_device);
+ val = mvCntmrRead(WATCHDOG);
+ printk("Orion wdt: %ds remaining\n", val/mvTclk);
+ mvCntmrWrite(WATCHDOG, 0xffffffff);
}
diff --git a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.c b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.c
index 71a4295..da19730 100755
--- a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.c
+++ b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.c
@@ -1615,8 +1615,9 @@
MV_BOARD_GPP_INFO gflt300InfoBoardGppInfo[] = {
/* {{MV_BOARD_GPP_CLASS devClass, MV_U8 gppPinNum}} */
- {BOARD_GPP_PON_XVR_TX, 21, 1},
- {BOARD_GPP_PON_XVR_TX_POWER, 37, 0},
+ {BOARD_GPP_PON_XVR_TX, 17},
+ {BOARD_GPP_PON_XVR_TX_POWER, 11},
+ {BOARD_GPP_PON_XVR_TX_IND, 24},
};
diff --git a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h
index 008b779..e3e3915 100755
--- a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h
+++ b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h
@@ -593,18 +593,18 @@
#define GFLT300_MPP0_7 0x22222220
#define GFLT300_MPP8_15 0x05000002
-#define GFLT300_MPP16_23 0x00000000
-#define GFLT300_MPP24_31 0x40004544
+#define GFLT300_MPP16_23 0x00400000
+#define GFLT300_MPP24_31 0x40204544
#define GFLT300_MPP32_37 0x00000004
// default all ones-inputs, invert for outputs
-#define GFLT300_GPP_OUT_ENA_LOW (~(BIT9 | BIT10 | BIT21))
+#define GFLT300_GPP_OUT_ENA_LOW (~(BIT9 | BIT10 | BIT20))
#define GFLT300_GPP_OUT_ENA_MID (~(BIT5))
// BIT09 turns the LED blue.
// BIT10 turns the LED red.
-#define GFLT300_GPP_OUT_VAL_LOW (BIT9 | BIT21)
+#define GFLT300_GPP_OUT_VAL_LOW (BIT9)
#define GFLT300_GPP_OUT_VAL_MID (0)
#define GFLT300_GPP_POL_LOW 0x0