arm64: mvebu: armada-8k: Only configure xHCI power on DB-88F7040 board

This patch uses of_machine_is_compatible() to detect the board at runtime
and only configured the I2C IO expander for the xHCI power / reset on
the DB-88F7040 board. As this code will be used by other Armada-7k/8k
ports, its necessary to use this runtime detection here.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Nadav Haklai <nadavh@marvell.com>
Cc: Neta Zur Hershkovits <neta@marvell.com>
Cc: Kostya Porotchkin <kostap@marvell.com>
Cc: Omri Itach <omrii@marvell.com>
Cc: Igal Liberman <igall@marvell.com>
Cc: Haim Boot <hayim@marvell.com>
Cc: Hanna Hawa <hannah@marvell.com>
This commit is contained in:
Stefan Roese 2016-10-25 12:41:45 +02:00
parent bf2150b9ae
commit acd3b0760b
1 changed files with 75 additions and 65 deletions

View File

@ -5,6 +5,7 @@
*/
#include <common.h>
#include <dm.h>
#include <i2c.h>
#include <asm/io.h>
#include <asm/arch/cpu.h>
@ -12,6 +13,11 @@
DECLARE_GLOBAL_DATA_PTR;
/*
* Information specific to the DB-88F7040 eval board. We strive to use
* DT for such platform specfic configurations. At some point, this
* might be removed here and implemented via DT.
*/
/* IO expander I2C device */
#define I2C_IO_EXP_ADDR 0x21
#define I2C_IO_CFG_REG_0 0x6
@ -44,6 +50,7 @@ int board_xhci_config(void)
int ret;
u8 buf[8];
if (of_machine_is_compatible("marvell,armada7040-db")) {
/* Configure IO exander PCA9555: 7bit address 0x21 */
ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev);
if (ret) {
@ -83,6 +90,7 @@ int board_xhci_config(void)
}
mdelay(500); /* required delay to let output value settle */
}
return 0;
}
@ -93,6 +101,7 @@ int board_xhci_enable(void)
int ret;
u8 buf[8];
if (of_machine_is_compatible("marvell,armada7040-db")) {
/*
* This function enables all USB ports simultaniously,
* it only needs to get called once
@ -124,6 +133,7 @@ int board_xhci_enable(void)
mdelay(500); /* required delay to let output value settle */
usb_enabled = 1;
}
return 0;
}