From c5330ae8c8169fa9e81e2f8f5db4a9388d0a89d6 Mon Sep 17 00:00:00 2001 From: Konstantin Porotchkin Date: Thu, 16 Feb 2017 13:52:22 +0200 Subject: arm64: mvebu: Rename the db-88f3720 to armada-37xx platform Modify the file names and deifinitions relater to Marvell db-77f3720 board support. Convert these names to more generic armada-37xx platform for future addition of more boards based on the same SoC family. Signed-off-by: Konstantin Porotchkin Cc: Stefan Roese Cc: Igal Liberman Cc: Nadav Haklai Signed-off-by: Stefan Roese --- board/Marvell/mvebu_armada-37xx/MAINTAINERS | 6 ++ board/Marvell/mvebu_armada-37xx/Makefile | 7 ++ board/Marvell/mvebu_armada-37xx/board.c | 134 ++++++++++++++++++++++++++++ board/Marvell/mvebu_db-88f3720/MAINTAINERS | 6 -- board/Marvell/mvebu_db-88f3720/Makefile | 7 -- board/Marvell/mvebu_db-88f3720/board.c | 134 ---------------------------- 6 files changed, 147 insertions(+), 147 deletions(-) create mode 100644 board/Marvell/mvebu_armada-37xx/MAINTAINERS create mode 100644 board/Marvell/mvebu_armada-37xx/Makefile create mode 100644 board/Marvell/mvebu_armada-37xx/board.c delete mode 100644 board/Marvell/mvebu_db-88f3720/MAINTAINERS delete mode 100644 board/Marvell/mvebu_db-88f3720/Makefile delete mode 100644 board/Marvell/mvebu_db-88f3720/board.c (limited to 'board') diff --git a/board/Marvell/mvebu_armada-37xx/MAINTAINERS b/board/Marvell/mvebu_armada-37xx/MAINTAINERS new file mode 100644 index 0000000..52a3869 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/MAINTAINERS @@ -0,0 +1,6 @@ +MVEBU_DB_88F3720 BOARD +M: Stefan Roese +S: Maintained +F: board/Marvell/mvebu_armada-37xx/ +F: include/configs/mvebu_armada-37xx.h +F: configs/mvebu_db-88f3720_defconfig diff --git a/board/Marvell/mvebu_armada-37xx/Makefile b/board/Marvell/mvebu_armada-37xx/Makefile new file mode 100644 index 0000000..ed39738 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/Makefile @@ -0,0 +1,7 @@ +# +# Copyright (C) 2016 Stefan Roese +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := board.o diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c new file mode 100644 index 0000000..edf88c7 --- /dev/null +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2016 Stefan Roese + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/* IO expander I2C device */ +#define I2C_IO_EXP_ADDR 0x22 +#define I2C_IO_CFG_REG_0 0x6 +#define I2C_IO_DATA_OUT_REG_0 0x2 +#define I2C_IO_REG_0_SATA_OFF 2 +#define I2C_IO_REG_0_USB_H_OFF 1 + +int board_early_init_f(void) +{ + /* Nothing to do (yet), perhaps later some pin-muxing etc */ + + return 0; +} + +int board_init(void) +{ + /* adress of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + + return 0; +} + +/* Board specific AHCI / SATA enable code */ +int board_ahci_enable(void) +{ + struct udevice *dev; + int ret; + u8 buf[8]; + + /* Configure IO exander PCA9555: 7bit address 0x22 */ + ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); + if (ret) { + printf("Cannot find PCA9555: %d\n", ret); + return 0; + } + + ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + + /* + * Enable SATA power via IO expander connected via I2C by setting + * the corresponding bit to output mode to enable power for SATA + */ + buf[0] &= ~(1 << I2C_IO_REG_0_SATA_OFF); + ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + return 0; +} + +/* Board specific xHCI enable code */ +int board_xhci_enable(void) +{ + struct udevice *dev; + int ret; + u8 buf[8]; + + /* Configure IO exander PCA9555: 7bit address 0x22 */ + ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); + if (ret) { + printf("Cannot find PCA9555: %d\n", ret); + return 0; + } + + printf("Enable USB VBUS\n"); + + /* + * Read configuration (direction) and set VBUS pin as output + * (reset pin = output) + */ + ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + /* Read VBUS output value and disable it */ + ret = dm_i2c_read(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to read IO expander value via I2C\n"); + return -EIO; + } + buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + /* + * Required delay for configuration to settle - must wait for + * power on port is disabled in case VBUS signal was high, + * required 3 seconds delay to let VBUS signal fully settle down + */ + mdelay(3000); + + /* Enable VBUS power: Set output value of VBUS pin as enabled */ + buf[0] |= (1 << I2C_IO_REG_0_USB_H_OFF); + ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); + if (ret) { + printf("Failed to set IO expander via I2C\n"); + return -EIO; + } + + mdelay(500); /* required delay to let output value settle */ + + return 0; +} diff --git a/board/Marvell/mvebu_db-88f3720/MAINTAINERS b/board/Marvell/mvebu_db-88f3720/MAINTAINERS deleted file mode 100644 index 4e80917..0000000 --- a/board/Marvell/mvebu_db-88f3720/MAINTAINERS +++ /dev/null @@ -1,6 +0,0 @@ -MVEBU_DB_88F3720 BOARD -M: Stefan Roese -S: Maintained -F: board/Marvell/mvebu_db-88f3720/ -F: include/configs/mvebu_db-88f3720.h -F: configs/mvebu_db-88f3720_defconfig diff --git a/board/Marvell/mvebu_db-88f3720/Makefile b/board/Marvell/mvebu_db-88f3720/Makefile deleted file mode 100644 index ed39738..0000000 --- a/board/Marvell/mvebu_db-88f3720/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (C) 2016 Stefan Roese -# -# SPDX-License-Identifier: GPL-2.0+ -# - -obj-y := board.o diff --git a/board/Marvell/mvebu_db-88f3720/board.c b/board/Marvell/mvebu_db-88f3720/board.c deleted file mode 100644 index edf88c7..0000000 --- a/board/Marvell/mvebu_db-88f3720/board.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2016 Stefan Roese - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -/* IO expander I2C device */ -#define I2C_IO_EXP_ADDR 0x22 -#define I2C_IO_CFG_REG_0 0x6 -#define I2C_IO_DATA_OUT_REG_0 0x2 -#define I2C_IO_REG_0_SATA_OFF 2 -#define I2C_IO_REG_0_USB_H_OFF 1 - -int board_early_init_f(void) -{ - /* Nothing to do (yet), perhaps later some pin-muxing etc */ - - return 0; -} - -int board_init(void) -{ - /* adress of boot parameters */ - gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; - - return 0; -} - -/* Board specific AHCI / SATA enable code */ -int board_ahci_enable(void) -{ - struct udevice *dev; - int ret; - u8 buf[8]; - - /* Configure IO exander PCA9555: 7bit address 0x22 */ - ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); - if (ret) { - printf("Cannot find PCA9555: %d\n", ret); - return 0; - } - - ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - - /* - * Enable SATA power via IO expander connected via I2C by setting - * the corresponding bit to output mode to enable power for SATA - */ - buf[0] &= ~(1 << I2C_IO_REG_0_SATA_OFF); - ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - return 0; -} - -/* Board specific xHCI enable code */ -int board_xhci_enable(void) -{ - struct udevice *dev; - int ret; - u8 buf[8]; - - /* Configure IO exander PCA9555: 7bit address 0x22 */ - ret = i2c_get_chip_for_busnum(0, I2C_IO_EXP_ADDR, 1, &dev); - if (ret) { - printf("Cannot find PCA9555: %d\n", ret); - return 0; - } - - printf("Enable USB VBUS\n"); - - /* - * Read configuration (direction) and set VBUS pin as output - * (reset pin = output) - */ - ret = dm_i2c_read(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_CFG_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - /* Read VBUS output value and disable it */ - ret = dm_i2c_read(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to read IO expander value via I2C\n"); - return -EIO; - } - buf[0] &= ~(1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - /* - * Required delay for configuration to settle - must wait for - * power on port is disabled in case VBUS signal was high, - * required 3 seconds delay to let VBUS signal fully settle down - */ - mdelay(3000); - - /* Enable VBUS power: Set output value of VBUS pin as enabled */ - buf[0] |= (1 << I2C_IO_REG_0_USB_H_OFF); - ret = dm_i2c_write(dev, I2C_IO_DATA_OUT_REG_0, buf, 1); - if (ret) { - printf("Failed to set IO expander via I2C\n"); - return -EIO; - } - - mdelay(500); /* required delay to let output value settle */ - - return 0; -} -- cgit v1.1