Merge remote-tracking branch 'gfiber-internal/prism_dev' into mergeprism2
diff --git a/arch/arm/configs/gflt200_defconfig b/arch/arm/configs/gflt200_defconfig
index 9306a95..e4da19f 100644
--- a/arch/arm/configs/gflt200_defconfig
+++ b/arch/arm/configs/gflt200_defconfig
@@ -1127,7 +1127,7 @@
# CONFIG_PPS is not set
CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_GPIOLIB=y
-# CONFIG_GPIO_SYSFS is not set
+CONFIG_GPIO_SYSFS=y
#
# Memory mapped GPIO expanders:
diff --git a/arch/arm/mach-feroceon-kw2/board-gflt200.c b/arch/arm/mach-feroceon-kw2/board-gflt200.c
index 02d5131..b1f259d 100644
--- a/arch/arm/mach-feroceon-kw2/board-gflt200.c
+++ b/arch/arm/mach-feroceon-kw2/board-gflt200.c
@@ -16,6 +16,62 @@
#define GPIO_BOARD_VER_0 13
#define GPIO_BOARD_VER_1 15
#define GPIO_BOARD_VER_2 18
+#define GPIO_PON_PWR_EN 37
+#define GPIO_PON_TX_DIS 21
+
+struct board_gpio {
+ unsigned gpio;
+ const char *label;
+};
+
+static struct board_gpio board_gpios[] = {
+ {
+ .gpio = GPIO_PON_PWR_EN,
+ .label = "power-enable",
+ },
+ {
+ .gpio = GPIO_PON_TX_DIS,
+ .label = "tx-disable",
+ },
+};
+
+static int board_gpio_export(struct board_gpio *gpio, struct device *dev)
+{
+ int rc;
+
+ rc = gpio_request(gpio->gpio, gpio->label);
+ if (rc) {
+ pr_err(BOARD_NAME ": error %d requesting gpio %u (%s)\n", 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(BOARD_NAME ": error %d setting gpio %u (%s) direction\n",
+ rc, gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = gpio_export(gpio->gpio, false);
+ if (rc) {
+ pr_err(BOARD_NAME ": error %d exporting gpio %u (%s)\n", rc,
+ gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = gpio_export_link(dev, gpio->label, gpio->gpio);
+ if (rc) {
+ pr_err(BOARD_NAME ": error %d linking gpio %u (%s)\n", rc,
+ gpio->gpio, gpio->label);
+ goto exit;
+ }
+
+ rc = 0;
+exit:
+ return rc;
+}
static int board_hw_ver(void)
{
@@ -123,6 +179,7 @@
int __init board_init(void)
{
+ int i;
int rc;
int hw_ver;
struct platform_device *pdev;
@@ -157,6 +214,10 @@
if (rc)
pr_err(BOARD_NAME ": error %d creating link 'board'\n", rc);
+ /* /sys/devices/platform/board/<gpio_name> */
+ for (i = 0; i < ARRAY_SIZE(board_gpios); i++)
+ board_gpio_export(&board_gpios[i], &pdev->dev);
+
/* /sys/devices/platform/board/hw_ver */
rc = device_create_file(&pdev->dev, &dev_attr_hw_ver);
if (rc)
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 0dd12fa..63e910b 100755
--- a/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h
+++ b/arch/arm/mach-feroceon-kw2/kw2_family/boardEnv/mvBoardEnvSpec.h
@@ -528,10 +528,10 @@
#define GFLT200_EVT1_GPP_POL_LOW 0x0
#define GFLT200_EVT1_GPP_POL_MID 0x0
-#define GFLT200_EVT2_GPP_OUT_ENA_LOW (BIT9 | BIT13 | BIT15 | BIT18 | BIT27 | BIT29)
+#define GFLT200_EVT2_GPP_OUT_ENA_LOW (BIT13 | BIT15 | BIT18 | BIT27 | BIT29)
#define GFLT200_EVT2_GPP_OUT_ENA_MID (BIT4)
-#define GFLT200_EVT2_GPP_OUT_VAL_LOW (BIT21 | BIT28)
+#define GFLT200_EVT2_GPP_OUT_VAL_LOW (BIT9 | BIT21 | BIT28)
#define GFLT200_EVT2_GPP_OUT_VAL_MID (BIT5)
#define GFLT200_EVT2_GPP_POL_LOW 0x0
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 2d9fb96..14bc1d3 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -237,6 +237,8 @@
{
struct orion_wdt_platform_data *pdata = pdev->dev.platform_data;
int ret;
+ u32 reg;
+ int time;
if (pdata) {
wdt_tclk = pdata->tclk;
@@ -259,6 +261,15 @@
printk(KERN_INFO "Orion Watchdog Timer: Initial timeout %d sec%s\n",
heartbeat, nowayout ? ", nowayout" : "");
+
+ reg = readl(TIMER_CTRL);
+ if (reg & WDT_EN) {
+ orion_wdt_get_timeleft(&time);
+ orion_wdt_ping();
+ pr_info("Orion Watchdog Timer: running at boot (%d sec left)"
+ ", resetting", time);
+ }
+
return 0;
}