summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/zii-imx6q-rdu2/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/boards/zii-imx6q-rdu2/board.c')
-rw-r--r--arch/arm/boards/zii-imx6q-rdu2/board.c82
1 files changed, 46 insertions, 36 deletions
diff --git a/arch/arm/boards/zii-imx6q-rdu2/board.c b/arch/arm/boards/zii-imx6q-rdu2/board.c
index c99f993f02..6352f49c5a 100644
--- a/arch/arm/boards/zii-imx6q-rdu2/board.c
+++ b/arch/arm/boards/zii-imx6q-rdu2/board.c
@@ -15,7 +15,9 @@
#include <common.h>
#include <envfs.h>
+#include <fs.h>
#include <gpio.h>
+#include <i2c/i2c.h>
#include <init.h>
#include <mach/bbu.h>
#include <mach/imx6.h>
@@ -97,50 +99,29 @@ static int rdu2_reset_audio_touchscreen_nfc(void)
*/
late_initcall(rdu2_reset_audio_touchscreen_nfc);
-static const struct gpio rdu2_front_panel_usb_gpios[] = {
- {
- .gpio = IMX_GPIO_NR(3, 19),
- .flags = GPIOF_OUT_INIT_LOW,
- .label = "usb-emulation",
- },
- {
- .gpio = IMX_GPIO_NR(3, 20),
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "usb-mode1",
- },
- {
- .gpio = IMX_GPIO_NR(3, 23),
- .flags = GPIOF_OUT_INIT_HIGH,
- .label = "usb-mode2",
- },
-};
-
-static int rdu2_enable_front_panel_usb(void)
+static int rdu2_devices_init(void)
{
- int ret;
+ struct i2c_client client;
if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
!of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
return 0;
- ret = gpio_request_array(rdu2_front_panel_usb_gpios,
- ARRAY_SIZE(rdu2_front_panel_usb_gpios));
- if (ret) {
- pr_err("Failed to request RDU2 front panel USB gpios: %s\n",
- strerror(-ret));
-
+ client.adapter = i2c_get_adapter(1);
+ if (client.adapter) {
+ u8 reg;
+
+ /*
+ * Reset PMIC SW1AB and SW1C rails to 1.375V. If an event
+ * caused only the i.MX6 SoC reset, the PMIC might still be
+ * stuck on the low voltage for the slow operating point.
+ */
+ client.addr = 0x08; /* PMIC i2c address */
+ reg = 0x2b; /* 1.375V, valid for both rails */
+ i2c_write_reg(&client, 0x20, &reg, 1);
+ i2c_write_reg(&client, 0x2e, &reg, 1);
}
- return ret;
-}
-late_initcall(rdu2_enable_front_panel_usb);
-
-static int rdu2_devices_init(void)
-{
- if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
- !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
- return 0;
-
barebox_set_hostname("rdu2");
imx6_bbu_internal_spi_i2c_register_handler("SPI", "/dev/m25p0.barebox",
@@ -208,3 +189,32 @@ static int rdu2_ethernet_init(void)
return 0;
}
late_initcall(rdu2_ethernet_init);
+
+#define I210_CFGWORD_PCIID_157B 0x157b1a11
+static int rdu2_i210_invm(void)
+{
+ int fd;
+ u32 val;
+
+ if (!of_machine_is_compatible("zii,imx6q-zii-rdu2") &&
+ !of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
+ return 0;
+
+ fd = open("/dev/e1000-invm0", O_RDWR);
+ if (fd < 0) {
+ pr_err("could not open e1000 iNVM device!\n");
+ return fd;
+ }
+
+ pread(fd, &val, sizeof(val), 0);
+ if (val == I210_CFGWORD_PCIID_157B) {
+ pr_debug("i210 already programmed correctly\n");
+ return 0;
+ }
+
+ val = I210_CFGWORD_PCIID_157B;
+ pwrite(fd, &val, sizeof(val), 0);
+
+ return 0;
+}
+late_initcall(rdu2_i210_invm);