mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
amlogic: add u-boot patch-set for 2020.04
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
From c3234c37aa9234d0d03b4fe2e9c4aba84069d38b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Mar 2020 12:12:35 +0100
|
||||
Subject: [PATCH 01/33] FROMGIT: dt-bindings: leds: import common led bindings
|
||||
from linux v5.5
|
||||
|
||||
Import the common leds bindings definition from linux
|
||||
d5226fa6dbae ("Linux 5.5")
|
||||
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
include/dt-bindings/leds/common.h | 75 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 75 insertions(+)
|
||||
create mode 100644 include/dt-bindings/leds/common.h
|
||||
|
||||
diff --git a/include/dt-bindings/leds/common.h b/include/dt-bindings/leds/common.h
|
||||
new file mode 100644
|
||||
index 0000000000..9e1256a7c1
|
||||
--- /dev/null
|
||||
+++ b/include/dt-bindings/leds/common.h
|
||||
@@ -0,0 +1,75 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * This header provides macros for the common LEDs device tree bindings.
|
||||
+ *
|
||||
+ * Copyright (C) 2015, Samsung Electronics Co., Ltd.
|
||||
+ * Author: Jacek Anaszewski <j.anaszewski@samsung.com>
|
||||
+ *
|
||||
+ * Copyright (C) 2019 Jacek Anaszewski <jacek.anaszewski@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __DT_BINDINGS_LEDS_H
|
||||
+#define __DT_BINDINGS_LEDS_H
|
||||
+
|
||||
+/* External trigger type */
|
||||
+#define LEDS_TRIG_TYPE_EDGE 0
|
||||
+#define LEDS_TRIG_TYPE_LEVEL 1
|
||||
+
|
||||
+/* Boost modes */
|
||||
+#define LEDS_BOOST_OFF 0
|
||||
+#define LEDS_BOOST_ADAPTIVE 1
|
||||
+#define LEDS_BOOST_FIXED 2
|
||||
+
|
||||
+/* Standard LED colors */
|
||||
+#define LED_COLOR_ID_WHITE 0
|
||||
+#define LED_COLOR_ID_RED 1
|
||||
+#define LED_COLOR_ID_GREEN 2
|
||||
+#define LED_COLOR_ID_BLUE 3
|
||||
+#define LED_COLOR_ID_AMBER 4
|
||||
+#define LED_COLOR_ID_VIOLET 5
|
||||
+#define LED_COLOR_ID_YELLOW 6
|
||||
+#define LED_COLOR_ID_IR 7
|
||||
+#define LED_COLOR_ID_MAX 8
|
||||
+
|
||||
+/* Standard LED functions */
|
||||
+#define LED_FUNCTION_ACTIVITY "activity"
|
||||
+#define LED_FUNCTION_ALARM "alarm"
|
||||
+#define LED_FUNCTION_BACKLIGHT "backlight"
|
||||
+#define LED_FUNCTION_BLUETOOTH "bluetooth"
|
||||
+#define LED_FUNCTION_BOOT "boot"
|
||||
+#define LED_FUNCTION_CPU "cpu"
|
||||
+#define LED_FUNCTION_CAPSLOCK "capslock"
|
||||
+#define LED_FUNCTION_CHARGING "charging"
|
||||
+#define LED_FUNCTION_DEBUG "debug"
|
||||
+#define LED_FUNCTION_DISK "disk"
|
||||
+#define LED_FUNCTION_DISK_ACTIVITY "disk-activity"
|
||||
+#define LED_FUNCTION_DISK_ERR "disk-err"
|
||||
+#define LED_FUNCTION_DISK_READ "disk-read"
|
||||
+#define LED_FUNCTION_DISK_WRITE "disk-write"
|
||||
+#define LED_FUNCTION_FAULT "fault"
|
||||
+#define LED_FUNCTION_FLASH "flash"
|
||||
+#define LED_FUNCTION_HEARTBEAT "heartbeat"
|
||||
+#define LED_FUNCTION_INDICATOR "indicator"
|
||||
+#define LED_FUNCTION_KBD_BACKLIGHT "kbd_backlight"
|
||||
+#define LED_FUNCTION_LAN "lan"
|
||||
+#define LED_FUNCTION_MAIL "mail"
|
||||
+#define LED_FUNCTION_MTD "mtd"
|
||||
+#define LED_FUNCTION_MICMUTE "micmute"
|
||||
+#define LED_FUNCTION_MUTE "mute"
|
||||
+#define LED_FUNCTION_NUMLOCK "numlock"
|
||||
+#define LED_FUNCTION_PANIC "panic"
|
||||
+#define LED_FUNCTION_PROGRAMMING "programming"
|
||||
+#define LED_FUNCTION_POWER "power"
|
||||
+#define LED_FUNCTION_RX "rx"
|
||||
+#define LED_FUNCTION_SD "sd"
|
||||
+#define LED_FUNCTION_SCROLLLOCK "scrolllock"
|
||||
+#define LED_FUNCTION_STANDBY "standby"
|
||||
+#define LED_FUNCTION_STATUS "status"
|
||||
+#define LED_FUNCTION_TORCH "torch"
|
||||
+#define LED_FUNCTION_TX "tx"
|
||||
+#define LED_FUNCTION_USB "usb"
|
||||
+#define LED_FUNCTION_WAN "wan"
|
||||
+#define LED_FUNCTION_WLAN "wlan"
|
||||
+#define LED_FUNCTION_WPS "wps"
|
||||
+
|
||||
+#endif /* __DT_BINDINGS_LEDS_H */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From aeb0006b6b0bf77bef8bb39cd65ee0a7eb4fabe3 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Mar 2020 12:12:36 +0100
|
||||
Subject: [PATCH 02/33] FROMGIT: mmc: meson-gx: enable input clocks
|
||||
|
||||
Until now, the mmc clock was left in a good enough state by the ROM
|
||||
code to be used by the controller. However on some SoC, if the ROM
|
||||
code finds a bootloader on USB or SPI, it might leave the MMC clock
|
||||
in state the controller cannot work with.
|
||||
|
||||
Enable the input clocks provided to the mmc controller. While the
|
||||
u-boot mmc controller driver is not doing fancy settings like the Linux,
|
||||
it at least needs to make these clocks are running.
|
||||
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Reviewed-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/mmc/meson_gx_mmc.c | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
|
||||
index b5f5122b1b..86c1a7164a 100644
|
||||
--- a/drivers/mmc/meson_gx_mmc.c
|
||||
+++ b/drivers/mmc/meson_gx_mmc.c
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
+#include <clk.h>
|
||||
#include <cpu_func.h>
|
||||
#include <dm.h>
|
||||
#include <fdtdec.h>
|
||||
@@ -241,12 +242,23 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
|
||||
struct mmc *mmc = &pdata->mmc;
|
||||
struct mmc_config *cfg = &pdata->cfg;
|
||||
+ struct clk_bulk clocks;
|
||||
uint32_t val;
|
||||
+ int ret;
|
||||
+
|
||||
#ifdef CONFIG_PWRSEQ
|
||||
struct udevice *pwr_dev;
|
||||
- int ret;
|
||||
#endif
|
||||
|
||||
+ /* Enable the clocks feeding the MMC controller */
|
||||
+ ret = clk_get_bulk(dev, &clocks);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = clk_enable_bulk(&clocks);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
cfg->voltages = MMC_VDD_33_34 | MMC_VDD_32_33 |
|
||||
MMC_VDD_31_32 | MMC_VDD_165_195;
|
||||
cfg->host_caps = MMC_MODE_8BIT | MMC_MODE_4BIT |
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
From fcf29e62ed25bc08e7ed7aa7e5a8a1c8dc070b86 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Mar 2020 12:12:37 +0100
|
||||
Subject: [PATCH 03/33] FROMGIT: clk: meson: reset mmc clock on probe
|
||||
|
||||
On some SoCs, depending on the boot device, the MMC clock block may be
|
||||
left in a weird state by the ROM code, in which no decent clock may be
|
||||
provided. Reset the related register to make sure a sane MMC clock is
|
||||
ready for the controller.
|
||||
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Tested-by: Anand Moon <linux.amoon@gmail.com>
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/clk/meson/axg.c | 7 +++++++
|
||||
drivers/clk/meson/g12a.c | 7 +++++++
|
||||
drivers/clk/meson/gxbb.c | 7 +++++++
|
||||
3 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
|
||||
index 7035b59a13..4b0028d04b 100644
|
||||
--- a/drivers/clk/meson/axg.c
|
||||
+++ b/drivers/clk/meson/axg.c
|
||||
@@ -291,6 +291,13 @@ static int meson_clk_probe(struct udevice *dev)
|
||||
if (IS_ERR(priv->map))
|
||||
return PTR_ERR(priv->map);
|
||||
|
||||
+ /*
|
||||
+ * Depending on the boot src, the state of the MMC clock might
|
||||
+ * be different. Reset it to make sure we won't get stuck
|
||||
+ */
|
||||
+ regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
|
||||
+ regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
|
||||
+
|
||||
debug("meson-clk-axg: probed\n");
|
||||
|
||||
return 0;
|
||||
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
|
||||
index 686d94ebfe..9e6beca94a 100644
|
||||
--- a/drivers/clk/meson/g12a.c
|
||||
+++ b/drivers/clk/meson/g12a.c
|
||||
@@ -977,6 +977,13 @@ static int meson_clk_probe(struct udevice *dev)
|
||||
if (IS_ERR(priv->map))
|
||||
return PTR_ERR(priv->map);
|
||||
|
||||
+ /*
|
||||
+ * Depending on the boot src, the state of the MMC clock might
|
||||
+ * be different. Reset it to make sure we won't get stuck
|
||||
+ */
|
||||
+ regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
|
||||
+ regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
|
||||
+
|
||||
debug("meson-clk-g12a: probed\n");
|
||||
|
||||
return 0;
|
||||
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
|
||||
index e781e08d9d..5ef4dd794d 100644
|
||||
--- a/drivers/clk/meson/gxbb.c
|
||||
+++ b/drivers/clk/meson/gxbb.c
|
||||
@@ -887,6 +887,13 @@ static int meson_clk_probe(struct udevice *dev)
|
||||
if (IS_ERR(priv->map))
|
||||
return PTR_ERR(priv->map);
|
||||
|
||||
+ /*
|
||||
+ * Depending on the boot src, the state of the MMC clock might
|
||||
+ * be different. Reset it to make sure we won't get stuck
|
||||
+ */
|
||||
+ regmap_write(priv->map, HHI_NAND_CLK_CNTL, 0);
|
||||
+ regmap_write(priv->map, HHI_SD_EMMC_CLK_CNTL, 0);
|
||||
+
|
||||
debug("meson-clk: probed\n");
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,236 @@
|
||||
From ccbac5c2b2e82ef217f87689aa86afd67993c7d4 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 5 Mar 2020 12:12:40 +0100
|
||||
Subject: [PATCH 06/33] FROMGIT: arm64: dts: meson: add libretech-pc support
|
||||
|
||||
Add support for the Amlogic based libretech-pc platform.
|
||||
This platform comes with 2 variant, based on the s905d or s912 SoC.
|
||||
|
||||
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
[narmstrong: update board/amlogic/q200/MAINTAINERS]
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm/dts/Makefile | 2 +
|
||||
.../meson-gxl-s905d-libretech-pc-u-boot.dtsi | 7 ++
|
||||
.../meson-gxm-s912-libretech-pc-u-boot.dtsi | 7 ++
|
||||
board/amlogic/q200/MAINTAINERS | 2 +
|
||||
configs/libretech-s905d-pc_defconfig | 73 +++++++++++++++++++
|
||||
configs/libretech-s912-pc_defconfig | 73 +++++++++++++++++++
|
||||
6 files changed, 164 insertions(+)
|
||||
create mode 100644 arch/arm/dts/meson-gxl-s905d-libretech-pc-u-boot.dtsi
|
||||
create mode 100644 arch/arm/dts/meson-gxm-s912-libretech-pc-u-boot.dtsi
|
||||
create mode 100644 configs/libretech-s905d-pc_defconfig
|
||||
create mode 100644 configs/libretech-s912-pc_defconfig
|
||||
|
||||
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
|
||||
index 820ee9733a..a80ce9c791 100644
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -147,7 +147,9 @@ dtb-$(CONFIG_ARCH_MESON) += \
|
||||
meson-gxl-s805x-libretech-ac.dtb \
|
||||
meson-gxl-s905x-libretech-cc.dtb \
|
||||
meson-gxl-s905x-khadas-vim.dtb \
|
||||
+ meson-gxl-s905d-libretech-pc.dtb \
|
||||
meson-gxm-khadas-vim2.dtb \
|
||||
+ meson-gxm-s912-libretech-pc.dtb \
|
||||
meson-axg-s400.dtb \
|
||||
meson-g12a-u200.dtb \
|
||||
meson-g12a-sei510.dtb \
|
||||
diff --git a/arch/arm/dts/meson-gxl-s905d-libretech-pc-u-boot.dtsi b/arch/arm/dts/meson-gxl-s905d-libretech-pc-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 0000000000..c35158d7e9
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/meson-gxl-s905d-libretech-pc-u-boot.dtsi
|
||||
@@ -0,0 +1,7 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 BayLibre, SAS.
|
||||
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
+ */
|
||||
+
|
||||
+#include "meson-gx-u-boot.dtsi"
|
||||
diff --git a/arch/arm/dts/meson-gxm-s912-libretech-pc-u-boot.dtsi b/arch/arm/dts/meson-gxm-s912-libretech-pc-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 0000000000..c35158d7e9
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/meson-gxm-s912-libretech-pc-u-boot.dtsi
|
||||
@@ -0,0 +1,7 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 BayLibre, SAS.
|
||||
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
+ */
|
||||
+
|
||||
+#include "meson-gx-u-boot.dtsi"
|
||||
diff --git a/board/amlogic/q200/MAINTAINERS b/board/amlogic/q200/MAINTAINERS
|
||||
index d3c5a4617b..6f00f87386 100644
|
||||
--- a/board/amlogic/q200/MAINTAINERS
|
||||
+++ b/board/amlogic/q200/MAINTAINERS
|
||||
@@ -5,3 +5,5 @@ L: u-boot-amlogic@groups.io
|
||||
F: board/amlogic/q200/
|
||||
F: include/configs/q200.h
|
||||
F: configs/khadas-vim2_defconfig
|
||||
+F: configs/libretech-s905d-pc_defconfig
|
||||
+F: configs/libretech-s912-pc_defconfig
|
||||
diff --git a/configs/libretech-s905d-pc_defconfig b/configs/libretech-s905d-pc_defconfig
|
||||
new file mode 100644
|
||||
index 0000000000..7e0c95872a
|
||||
--- /dev/null
|
||||
+++ b/configs/libretech-s905d-pc_defconfig
|
||||
@@ -0,0 +1,73 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_BOARD="q200"
|
||||
+CONFIG_ARCH_MESON=y
|
||||
+CONFIG_SYS_TEXT_BASE=0x01000000
|
||||
+CONFIG_MESON_GXL=y
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
+CONFIG_ENV_OFFSET=0xFFFF0000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0xc81004c0
|
||||
+CONFIG_DEBUG_UART_CLOCK=24000000
|
||||
+CONFIG_ENV_SECT_SIZE=0x10000
|
||||
+CONFIG_IDENT_STRING=" libretech-s905d-pc"
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_OF_BOARD_SETUP=y
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_PREBOOT="usb start"
|
||||
+CONFIG_MISC_INIT_R=y
|
||||
+# CONFIG_DISPLAY_CPUINFO is not set
|
||||
+# CONFIG_CMD_BDI is not set
|
||||
+# CONFIG_CMD_IMI is not set
|
||||
+CONFIG_CMD_ADC=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+# CONFIG_CMD_LOADS is not set
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_SPI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+CONFIG_CMD_REGULATOR=y
|
||||
+CONFIG_OF_CONTROL=y
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxl-s905d-libretech-pc"
|
||||
+CONFIG_ENV_IS_IN_SPI_FLASH=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SARADC_MESON=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_KEYBOARD=y
|
||||
+CONFIG_DM_MMC=y
|
||||
+CONFIG_MMC_MESON_GX=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_PHY_REALTEK=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_ETH_DESIGNWARE=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_MESON_GXL_USB_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCTRL_MESON_GXL=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_RESET=y
|
||||
+CONFIG_DEBUG_UART_MESON=y
|
||||
+CONFIG_DEBUG_UART_ANNOUNCE=y
|
||||
+CONFIG_DEBUG_UART_SKIP_INIT=y
|
||||
+CONFIG_MESON_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MESON_SPIFC=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_DWC3=y
|
||||
+CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
+CONFIG_USB_DWC3=y
|
||||
+CONFIG_USB_KEYBOARD=y
|
||||
+CONFIG_DM_VIDEO=y
|
||||
+CONFIG_SYS_WHITE_ON_BLACK=y
|
||||
+CONFIG_VIDEO_MESON=y
|
||||
+CONFIG_VIDEO_DT_SIMPLEFB=y
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
diff --git a/configs/libretech-s912-pc_defconfig b/configs/libretech-s912-pc_defconfig
|
||||
new file mode 100644
|
||||
index 0000000000..5f4ee329e2
|
||||
--- /dev/null
|
||||
+++ b/configs/libretech-s912-pc_defconfig
|
||||
@@ -0,0 +1,73 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_BOARD="q200"
|
||||
+CONFIG_ARCH_MESON=y
|
||||
+CONFIG_SYS_TEXT_BASE=0x01000000
|
||||
+CONFIG_MESON_GXM=y
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
+CONFIG_ENV_OFFSET=0xFFFF0000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0xc81004c0
|
||||
+CONFIG_DEBUG_UART_CLOCK=24000000
|
||||
+CONFIG_ENV_SECT_SIZE=0x10000
|
||||
+CONFIG_IDENT_STRING=" libretech-s912-pc"
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_OF_BOARD_SETUP=y
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_PREBOOT="usb start"
|
||||
+CONFIG_MISC_INIT_R=y
|
||||
+# CONFIG_DISPLAY_CPUINFO is not set
|
||||
+# CONFIG_CMD_BDI is not set
|
||||
+# CONFIG_CMD_IMI is not set
|
||||
+CONFIG_CMD_ADC=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+# CONFIG_CMD_LOADS is not set
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_SPI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+CONFIG_CMD_REGULATOR=y
|
||||
+CONFIG_OF_CONTROL=y
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxm-s912-libretech-pc"
|
||||
+CONFIG_ENV_IS_IN_SPI_FLASH=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SARADC_MESON=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_KEYBOARD=y
|
||||
+CONFIG_DM_MMC=y
|
||||
+CONFIG_MMC_MESON_GX=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_PHY_REALTEK=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_ETH_DESIGNWARE=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_MESON_GXL_USB_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCTRL_MESON_GXL=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MESON_GX_VPU_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_RESET=y
|
||||
+CONFIG_DEBUG_UART_MESON=y
|
||||
+CONFIG_DEBUG_UART_ANNOUNCE=y
|
||||
+CONFIG_DEBUG_UART_SKIP_INIT=y
|
||||
+CONFIG_MESON_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MESON_SPIFC=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_DWC3=y
|
||||
+CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
+CONFIG_USB_DWC3=y
|
||||
+CONFIG_USB_KEYBOARD=y
|
||||
+CONFIG_DM_VIDEO=y
|
||||
+CONFIG_SYS_WHITE_ON_BLACK=y
|
||||
+CONFIG_VIDEO_MESON=y
|
||||
+CONFIG_VIDEO_DT_SIMPLEFB=y
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 18e5ef0dc6d2368bfb6cd5736842ad895c1bfc73 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Wed, 15 Apr 2020 17:58:30 +0200
|
||||
Subject: [PATCH 07/33] FROMGIT: ARM: dts: add missing
|
||||
meson-gxl-s805x-libretech-ac-u-boot.dtsi file
|
||||
|
||||
The libretech-ac u-boot.dtsi file is missing to enabled DT nodes changes
|
||||
to enable Video output on U-Boot.
|
||||
|
||||
Fixes: 671b1db8f8 ("arm64: dts: meson-gx: vpu should be probed before relocation")
|
||||
Reported-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
arch/arm/dts/meson-gxl-s805x-libretech-ac-u-boot.dtsi | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
create mode 100644 arch/arm/dts/meson-gxl-s805x-libretech-ac-u-boot.dtsi
|
||||
|
||||
diff --git a/arch/arm/dts/meson-gxl-s805x-libretech-ac-u-boot.dtsi b/arch/arm/dts/meson-gxl-s805x-libretech-ac-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 0000000000..c35158d7e9
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/meson-gxl-s805x-libretech-ac-u-boot.dtsi
|
||||
@@ -0,0 +1,7 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 BayLibre, SAS.
|
||||
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
+ */
|
||||
+
|
||||
+#include "meson-gx-u-boot.dtsi"
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From a630363ac19a63561c0acb4e7d66456a646e0d01 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Thu, 16 Apr 2020 10:39:41 +0200
|
||||
Subject: [PATCH 08/33] FROMGIT: arm64: dts: meson-gx: add back dmc register
|
||||
range until canvas driver is available
|
||||
|
||||
The Linux VPU bindings have changed and dropped the dmc register range.
|
||||
|
||||
Add it back in the meson-gx-u-boot.dtsi file until a proper canvas driver
|
||||
is available.
|
||||
|
||||
Fixes: dd5f2351e9 ("arm64: dts: meson: sync dt and bindings from v5.6-rc2")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm/dts/meson-gx-u-boot.dtsi | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/dts/meson-gx-u-boot.dtsi b/arch/arm/dts/meson-gx-u-boot.dtsi
|
||||
index b84e5edba4..17d2cb95c1 100644
|
||||
--- a/arch/arm/dts/meson-gx-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/meson-gx-u-boot.dtsi
|
||||
@@ -11,6 +11,10 @@
|
||||
};
|
||||
|
||||
&vpu {
|
||||
+ reg = <0x0 0xd0100000 0x0 0x100000>,
|
||||
+ <0x0 0xc883c000 0x0 0x1000>,
|
||||
+ <0x0 0xc8838000 0x0 0x1000>;
|
||||
+ reg-names = "vpu", "hhi", "dmc";
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
From 9102eaa76d81c8465e995fe61297fad4c1791615 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:23 +0200
|
||||
Subject: [PATCH 09/33] FROMGIT: generic-phy: add generic_phy_get_by_node()
|
||||
|
||||
Add generic_phy_get_by_node() to get a PHY phandle from a node instead
|
||||
of a udevice.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Reviewed-by: Tom Rini <trini@konsulko.com>
|
||||
[narmstrong: fixed by including ofnode.h in generic-phy.h]
|
||||
---
|
||||
drivers/phy/phy-uclass.c | 16 +++++++++++-----
|
||||
include/generic-phy.h | 29 +++++++++++++++++++++++++++++
|
||||
2 files changed, 40 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
|
||||
index e201a90c8c..e463b0b400 100644
|
||||
--- a/drivers/phy/phy-uclass.c
|
||||
+++ b/drivers/phy/phy-uclass.c
|
||||
@@ -31,20 +31,20 @@ static int generic_phy_xlate_offs_flags(struct phy *phy,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-int generic_phy_get_by_index(struct udevice *dev, int index,
|
||||
- struct phy *phy)
|
||||
+int generic_phy_get_by_node(ofnode node, int index, struct phy *phy)
|
||||
{
|
||||
struct ofnode_phandle_args args;
|
||||
struct phy_ops *ops;
|
||||
struct udevice *phydev;
|
||||
int i, ret;
|
||||
|
||||
- debug("%s(dev=%p, index=%d, phy=%p)\n", __func__, dev, index, phy);
|
||||
+ debug("%s(node=%s, index=%d, phy=%p)\n",
|
||||
+ __func__, ofnode_get_name(node), index, phy);
|
||||
|
||||
assert(phy);
|
||||
phy->dev = NULL;
|
||||
- ret = dev_read_phandle_with_args(dev, "phys", "#phy-cells", 0, index,
|
||||
- &args);
|
||||
+ ret = ofnode_parse_phandle_with_args(node, "phys", "#phy-cells", 0,
|
||||
+ index, &args);
|
||||
if (ret) {
|
||||
debug("%s: dev_read_phandle_with_args failed: err=%d\n",
|
||||
__func__, ret);
|
||||
@@ -90,6 +90,12 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int generic_phy_get_by_index(struct udevice *dev, int index,
|
||||
+ struct phy *phy)
|
||||
+{
|
||||
+ return generic_phy_get_by_node(dev_ofnode(dev), index, phy);
|
||||
+}
|
||||
+
|
||||
int generic_phy_get_by_name(struct udevice *dev, const char *phy_name,
|
||||
struct phy *phy)
|
||||
{
|
||||
diff --git a/include/generic-phy.h b/include/generic-phy.h
|
||||
index 95caf58341..73537025c2 100644
|
||||
--- a/include/generic-phy.h
|
||||
+++ b/include/generic-phy.h
|
||||
@@ -7,6 +7,8 @@
|
||||
#ifndef __GENERIC_PHY_H
|
||||
#define __GENERIC_PHY_H
|
||||
|
||||
+#include <dm/ofnode.h>
|
||||
+
|
||||
struct ofnode_phandle_args;
|
||||
|
||||
/**
|
||||
@@ -193,6 +195,33 @@ int generic_phy_power_off(struct phy *phy);
|
||||
int generic_phy_get_by_index(struct udevice *user, int index,
|
||||
struct phy *phy);
|
||||
|
||||
+/**
|
||||
+ * generic_phy_get_by_node() - Get a PHY device by integer index on ofnode
|
||||
+ *
|
||||
+ * @node: the device node
|
||||
+ * @index: The index in the list of available PHYs
|
||||
+ * @phy: A pointer to the PHY port
|
||||
+ *
|
||||
+ * This looks up a PHY device for a client device based on its ofnode and on
|
||||
+ * its position in the list of the possible PHYs.
|
||||
+ *
|
||||
+ * example:
|
||||
+ * usb1: usb_otg_ss@xxx {
|
||||
+ * compatible = "xxx";
|
||||
+ * reg = <xxx>;
|
||||
+ * .
|
||||
+ * .
|
||||
+ * phys = <&usb2_phy>, <&usb3_phy>;
|
||||
+ * .
|
||||
+ * .
|
||||
+ * };
|
||||
+ * the USB2 phy can be accessed by passing index '0' and the USB3 phy can
|
||||
+ * be accessed by passing index '1'
|
||||
+ *
|
||||
+ * @return 0 if OK, or a negative error code
|
||||
+ */
|
||||
+int generic_phy_get_by_node(ofnode node, int index, struct phy *phy);
|
||||
+
|
||||
/**
|
||||
* generic_phy_get_by_name() - Get a PHY device by its name.
|
||||
*
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
From 5d52ec98996401176465a16408862393fcc83fc7 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:24 +0200
|
||||
Subject: [PATCH 10/33] FROMGIT: phy: meson-gxl-usb: add set_mode call to force
|
||||
switch to peripheral mode
|
||||
|
||||
Add set_mode function in the Amlogic GXL PHYs that will be called by
|
||||
the arch code to switch PHYs from/to gadget mode.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm/include/asm/arch-meson/usb-gx.h | 16 +++++++++
|
||||
drivers/phy/meson-gxl-usb2.c | 30 ++++++++++++----
|
||||
drivers/phy/meson-gxl-usb3.c | 44 +++++++++++++++++-------
|
||||
3 files changed, 72 insertions(+), 18 deletions(-)
|
||||
create mode 100644 arch/arm/include/asm/arch-meson/usb-gx.h
|
||||
|
||||
diff --git a/arch/arm/include/asm/arch-meson/usb-gx.h b/arch/arm/include/asm/arch-meson/usb-gx.h
|
||||
new file mode 100644
|
||||
index 0000000000..aeb8e0c673
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/include/asm/arch-meson/usb-gx.h
|
||||
@@ -0,0 +1,16 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright 2019 BayLibre SAS
|
||||
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
+ */
|
||||
+#ifndef _ARCH_MESON_USB_GX_H_
|
||||
+#define _ARCH_MESON_USB_GX_H_
|
||||
+
|
||||
+#include <generic-phy.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+
|
||||
+/* TOFIX add set_mode to struct phy_ops */
|
||||
+void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode);
|
||||
+void phy_meson_gxl_usb3_set_mode(struct phy *phy, enum usb_dr_mode mode);
|
||||
+
|
||||
+#endif
|
||||
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
|
||||
index c98d12b627..b4f4c3c76b 100644
|
||||
--- a/drivers/phy/meson-gxl-usb2.c
|
||||
+++ b/drivers/phy/meson-gxl-usb2.c
|
||||
@@ -17,6 +17,9 @@
|
||||
#include <regmap.h>
|
||||
#include <power/regulator.h>
|
||||
#include <clk.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+
|
||||
+#include <asm/arch/usb-gx.h>
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/compat.h>
|
||||
@@ -121,15 +124,30 @@ static void phy_meson_gxl_usb2_reset(struct phy_meson_gxl_usb2_priv *priv)
|
||||
udelay(RESET_COMPLETE_TIME);
|
||||
}
|
||||
|
||||
-static void
|
||||
-phy_meson_gxl_usb2_set_host_mode(struct phy_meson_gxl_usb2_priv *priv)
|
||||
+void phy_meson_gxl_usb2_set_mode(struct phy *phy, enum usb_dr_mode mode)
|
||||
{
|
||||
+ struct udevice *dev = phy->dev;
|
||||
+ struct phy_meson_gxl_usb2_priv *priv = dev_get_priv(dev);
|
||||
uint val;
|
||||
|
||||
regmap_read(priv->regmap, U2P_R0, &val);
|
||||
- val |= U2P_R0_DM_PULLDOWN;
|
||||
- val |= U2P_R0_DP_PULLDOWN;
|
||||
- val &= ~U2P_R0_ID_PULLUP;
|
||||
+
|
||||
+ switch (mode) {
|
||||
+ case USB_DR_MODE_UNKNOWN:
|
||||
+ case USB_DR_MODE_HOST:
|
||||
+ case USB_DR_MODE_OTG:
|
||||
+ val |= U2P_R0_DM_PULLDOWN;
|
||||
+ val |= U2P_R0_DP_PULLDOWN;
|
||||
+ val &= ~U2P_R0_ID_PULLUP;
|
||||
+ break;
|
||||
+
|
||||
+ case USB_DR_MODE_PERIPHERAL:
|
||||
+ val &= ~U2P_R0_DM_PULLDOWN;
|
||||
+ val &= ~U2P_R0_DP_PULLDOWN;
|
||||
+ val |= U2P_R0_ID_PULLUP;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
regmap_write(priv->regmap, U2P_R0, val);
|
||||
|
||||
phy_meson_gxl_usb2_reset(priv);
|
||||
@@ -146,7 +164,7 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
|
||||
val &= ~U2P_R0_POWER_ON_RESET;
|
||||
regmap_write(priv->regmap, U2P_R0, val);
|
||||
|
||||
- phy_meson_gxl_usb2_set_host_mode(priv);
|
||||
+ phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
|
||||
|
||||
#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
if (priv->phy_supply) {
|
||||
diff --git a/drivers/phy/meson-gxl-usb3.c b/drivers/phy/meson-gxl-usb3.c
|
||||
index c2a8593b39..9de55bb5df 100644
|
||||
--- a/drivers/phy/meson-gxl-usb3.c
|
||||
+++ b/drivers/phy/meson-gxl-usb3.c
|
||||
@@ -16,6 +16,9 @@
|
||||
#include <generic-phy.h>
|
||||
#include <regmap.h>
|
||||
#include <clk.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+
|
||||
+#include <asm/arch/usb-gx.h>
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/compat.h>
|
||||
@@ -93,20 +96,35 @@ struct phy_meson_gxl_usb3_priv {
|
||||
#endif
|
||||
};
|
||||
|
||||
-static int
|
||||
-phy_meson_gxl_usb3_set_host_mode(struct phy_meson_gxl_usb3_priv *priv)
|
||||
+void phy_meson_gxl_usb3_set_mode(struct phy *phy, enum usb_dr_mode mode)
|
||||
{
|
||||
+ struct udevice *dev = phy->dev;
|
||||
+ struct phy_meson_gxl_usb3_priv *priv = dev_get_priv(dev);
|
||||
uint val;
|
||||
|
||||
- regmap_read(priv->regmap, USB_R0, &val);
|
||||
- val &= ~USB_R0_U2D_ACT;
|
||||
- regmap_write(priv->regmap, USB_R0, val);
|
||||
-
|
||||
- regmap_read(priv->regmap, USB_R4, &val);
|
||||
- val &= ~USB_R4_P21_SLEEP_M0;
|
||||
- regmap_write(priv->regmap, USB_R4, val);
|
||||
-
|
||||
- return 0;
|
||||
+ switch (mode) {
|
||||
+ case USB_DR_MODE_UNKNOWN:
|
||||
+ case USB_DR_MODE_HOST:
|
||||
+ case USB_DR_MODE_OTG:
|
||||
+ regmap_read(priv->regmap, USB_R0, &val);
|
||||
+ val &= ~USB_R0_U2D_ACT;
|
||||
+ regmap_write(priv->regmap, USB_R0, val);
|
||||
+
|
||||
+ regmap_read(priv->regmap, USB_R4, &val);
|
||||
+ val &= ~USB_R4_P21_SLEEP_M0;
|
||||
+ regmap_write(priv->regmap, USB_R4, val);
|
||||
+ break;
|
||||
+
|
||||
+ case USB_DR_MODE_PERIPHERAL:
|
||||
+ regmap_read(priv->regmap, USB_R0, &val);
|
||||
+ val |= USB_R0_U2D_ACT;
|
||||
+ regmap_write(priv->regmap, USB_R0, val);
|
||||
+
|
||||
+ regmap_read(priv->regmap, USB_R4, &val);
|
||||
+ val |= USB_R4_P21_SLEEP_M0;
|
||||
+ regmap_write(priv->regmap, USB_R4, val);
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
static int phy_meson_gxl_usb3_power_on(struct phy *phy)
|
||||
@@ -122,7 +140,9 @@ static int phy_meson_gxl_usb3_power_on(struct phy *phy)
|
||||
val |= FIELD_PREP(USB_R5_ID_DIG_TH_MASK, 0xff);
|
||||
regmap_write(priv->regmap, USB_R5, val);
|
||||
|
||||
- return phy_meson_gxl_usb3_set_host_mode(priv);
|
||||
+ phy_meson_gxl_usb3_set_mode(phy, USB_DR_MODE_HOST);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static int phy_meson_gxl_usb3_power_off(struct phy *phy)
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
From 250936e89ab2a704a78aa8e8648094ee5de8702f Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:25 +0200
|
||||
Subject: [PATCH 11/33] FROMGIT: arm: meson-gx: add board_usb_init()/cleanup()
|
||||
for USB gadget
|
||||
|
||||
Add arch code to initialize USB Gadget mode using the DWC2 controller,
|
||||
and using the previously added set_mode() phy functions.
|
||||
|
||||
[narmstrong: fixup board_usb_cleanup call to phy_meson_gxl_usb2_set_mode]
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
arch/arm/mach-meson/board-gx.c | 118 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 118 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c
|
||||
index 191fd49005..3da99017a5 100644
|
||||
--- a/arch/arm/mach-meson/board-gx.c
|
||||
+++ b/arch/arm/mach-meson/board-gx.c
|
||||
@@ -14,6 +14,11 @@
|
||||
#include <asm/io.h>
|
||||
#include <asm/armv8/mmu.h>
|
||||
#include <linux/sizes.h>
|
||||
+#include <usb.h>
|
||||
+#include <linux/usb/otg.h>
|
||||
+#include <asm/arch/usb-gx.h>
|
||||
+#include <usb/dwc2_udc.h>
|
||||
+#include <clk.h>
|
||||
#include <phy.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
@@ -149,3 +154,116 @@ void meson_eth_init(phy_interface_t mode, unsigned int flags)
|
||||
/* Enable power gate */
|
||||
clrbits_le32(GX_MEM_PD_REG_0, GX_MEM_PD_REG_0_ETH_MASK);
|
||||
}
|
||||
+
|
||||
+#if CONFIG_IS_ENABLED(USB_XHCI_DWC3_OF_SIMPLE) && \
|
||||
+ CONFIG_IS_ENABLED(USB_GADGET_DWC2_OTG)
|
||||
+static struct dwc2_plat_otg_data meson_gx_dwc2_data;
|
||||
+static struct phy usb_phys[2];
|
||||
+
|
||||
+int board_usb_init(int index, enum usb_init_type init)
|
||||
+{
|
||||
+ struct ofnode_phandle_args args;
|
||||
+ struct udevice *clk_dev;
|
||||
+ ofnode dwc2_node;
|
||||
+ struct clk clk;
|
||||
+ int ret, i;
|
||||
+ u32 val;
|
||||
+
|
||||
+ /* find the dwc2 node */
|
||||
+ dwc2_node = ofnode_by_compatible(ofnode_null(), "snps,dwc2");
|
||||
+ if (!ofnode_valid(dwc2_node)) {
|
||||
+ debug("Not found dwc2 node\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ if (!ofnode_is_available(dwc2_node)) {
|
||||
+ debug("dwc2 is disabled in the device tree\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ /* get the PHYs */
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ ret = generic_phy_get_by_node(dwc2_node, i, &usb_phys[i]);
|
||||
+ if (ret && ret != -ENOENT) {
|
||||
+ pr_err("Failed to get USB PHY%d for %s\n",
|
||||
+ i, ofnode_get_name(dwc2_node));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ ret = generic_phy_init(&usb_phys[i]);
|
||||
+ if (ret) {
|
||||
+ pr_err("Can't init USB PHY%d for %s\n",
|
||||
+ i, ofnode_get_name(dwc2_node));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 2; i++) {
|
||||
+ ret = generic_phy_power_on(&usb_phys[i]);
|
||||
+ if (ret) {
|
||||
+ pr_err("Can't power USB PHY%d for %s\n",
|
||||
+ i, ofnode_get_name(dwc2_node));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ phy_meson_gxl_usb3_set_mode(&usb_phys[0], USB_DR_MODE_PERIPHERAL);
|
||||
+ phy_meson_gxl_usb2_set_mode(&usb_phys[1], USB_DR_MODE_PERIPHERAL);
|
||||
+
|
||||
+ meson_gx_dwc2_data.regs_otg = ofnode_get_addr(dwc2_node);
|
||||
+ if (meson_gx_dwc2_data.regs_otg == FDT_ADDR_T_NONE) {
|
||||
+ debug("usbotg: can't get base address\n");
|
||||
+ return -ENODATA;
|
||||
+ }
|
||||
+
|
||||
+ /* Enable clock */
|
||||
+ ret = ofnode_parse_phandle_with_args(dwc2_node, "clocks",
|
||||
+ "#clock-cells", 0, 0, &args);
|
||||
+ if (ret) {
|
||||
+ debug("usbotg has no clocks defined in the device tree\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = uclass_get_device_by_ofnode(UCLASS_CLK, args.node, &clk_dev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (args.args_count != 1) {
|
||||
+ debug("Can't find clock ID in the device tree\n");
|
||||
+ return -ENODATA;
|
||||
+ }
|
||||
+
|
||||
+ clk.dev = clk_dev;
|
||||
+ clk.id = args.args[0];
|
||||
+
|
||||
+ ret = clk_enable(&clk);
|
||||
+ if (ret) {
|
||||
+ debug("Failed to enable usbotg clock\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ofnode_read_u32(dwc2_node, "g-rx-fifo-size", &val);
|
||||
+ meson_gx_dwc2_data.rx_fifo_sz = val;
|
||||
+ ofnode_read_u32(dwc2_node, "g-np-tx-fifo-size", &val);
|
||||
+ meson_gx_dwc2_data.np_tx_fifo_sz = val;
|
||||
+ ofnode_read_u32(dwc2_node, "g-tx-fifo-size", &val);
|
||||
+ meson_gx_dwc2_data.tx_fifo_sz = val;
|
||||
+
|
||||
+ return dwc2_udc_probe(&meson_gx_dwc2_data);
|
||||
+}
|
||||
+
|
||||
+int board_usb_cleanup(int index, enum usb_init_type init)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ phy_meson_gxl_usb3_set_mode(&usb_phys[0], USB_DR_MODE_HOST);
|
||||
+ phy_meson_gxl_usb2_set_mode(&usb_phys[1], USB_DR_MODE_HOST);
|
||||
+
|
||||
+ for (i = 0; i < 2; i++)
|
||||
+ usb_phys[i].dev = NULL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From da97f35bad96e2748744968b35f823dde27dc001 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:26 +0200
|
||||
Subject: [PATCH 12/33] FROMGIT: arm: dts: meson-gxl: Add USB Gadget nodes for
|
||||
U-Boot
|
||||
|
||||
Add the USB DWC2 node to u-boot specific dtsi files since Gadget
|
||||
support is not (yet) available in upstream Linux yet.
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
.../meson-gxl-s905x-khadas-vim-u-boot.dtsi | 2 +-
|
||||
.../meson-gxl-s905x-libretech-cc-u-boot.dtsi | 6 ++++-
|
||||
arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi | 2 +-
|
||||
arch/arm/dts/meson-gxl-u-boot.dtsi | 23 +++++++++++++++++++
|
||||
4 files changed, 30 insertions(+), 3 deletions(-)
|
||||
create mode 100644 arch/arm/dts/meson-gxl-u-boot.dtsi
|
||||
|
||||
diff --git a/arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi b/arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi
|
||||
index c35158d7e9..39270ea71c 100644
|
||||
--- a/arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/meson-gxl-s905x-khadas-vim-u-boot.dtsi
|
||||
@@ -4,4 +4,4 @@
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
|
||||
-#include "meson-gx-u-boot.dtsi"
|
||||
+#include "meson-gxl-u-boot.dtsi"
|
||||
diff --git a/arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi b/arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi
|
||||
index c35158d7e9..474a3e1604 100644
|
||||
--- a/arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/meson-gxl-s905x-libretech-cc-u-boot.dtsi
|
||||
@@ -4,4 +4,8 @@
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
|
||||
-#include "meson-gx-u-boot.dtsi"
|
||||
+#include "meson-gxl-u-boot.dtsi"
|
||||
+
|
||||
+&dwc2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi b/arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi
|
||||
index c35158d7e9..39270ea71c 100644
|
||||
--- a/arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/meson-gxl-s905x-p212-u-boot.dtsi
|
||||
@@ -4,4 +4,4 @@
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*/
|
||||
|
||||
-#include "meson-gx-u-boot.dtsi"
|
||||
+#include "meson-gxl-u-boot.dtsi"
|
||||
diff --git a/arch/arm/dts/meson-gxl-u-boot.dtsi b/arch/arm/dts/meson-gxl-u-boot.dtsi
|
||||
new file mode 100644
|
||||
index 0000000000..9e88afd30e
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/meson-gxl-u-boot.dtsi
|
||||
@@ -0,0 +1,23 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2019 BayLibre, SAS.
|
||||
+ * Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
+ */
|
||||
+
|
||||
+#include "meson-gx-u-boot.dtsi"
|
||||
+
|
||||
+&usb0 {
|
||||
+ dwc2: usb@c9100000 {
|
||||
+ compatible = "snps,dwc2";
|
||||
+ reg = <0x0 0xc9100000 0x0 0x40000>;
|
||||
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&clkc CLKID_USB1_DDR_BRIDGE>;
|
||||
+ clock-names = "ddr";
|
||||
+ phys = <&usb3_phy>, <&usb2_phy1>;
|
||||
+ dr_mode = "peripheral";
|
||||
+ g-rx-fifo-size = <192>;
|
||||
+ g-np-tx-fifo-size = <128>;
|
||||
+ g-tx-fifo-size = <128 128 16 16 16>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From c0a978fcba484af5a0c643a4a7c3b69276a3c0ea Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:27 +0200
|
||||
Subject: [PATCH 13/33] FROMGIT: configs: libretech-cc: Enable USB gadget with
|
||||
Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/libretech-cc_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/libretech-cc_defconfig b/configs/libretech-cc_defconfig
|
||||
index 7c257b33b3..2c512ebc1e 100644
|
||||
--- a/configs/libretech-cc_defconfig
|
||||
+++ b/configs/libretech-cc_defconfig
|
||||
@@ -19,6 +19,7 @@ CONFIG_CMD_GPIO=y
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -51,6 +52,12 @@ CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
# CONFIG_VIDEO_BPP8 is not set
|
||||
# CONFIG_VIDEO_BPP16 is not set
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From a1657ae3f2b3101d12994b8936bbcecf899979b8 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:28 +0200
|
||||
Subject: [PATCH 14/33] FROMGIT: configs: libretech-ac: Enable USB gadget with
|
||||
Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/libretech-ac_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/libretech-ac_defconfig b/configs/libretech-ac_defconfig
|
||||
index 09b87c54d5..7e486757a2 100644
|
||||
--- a/configs/libretech-ac_defconfig
|
||||
+++ b/configs/libretech-ac_defconfig
|
||||
@@ -27,6 +27,7 @@ CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_SPI=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -69,6 +70,12 @@ CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
# CONFIG_VIDEO_BPP8 is not set
|
||||
# CONFIG_VIDEO_BPP16 is not set
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From c91bbf06c3b7489bc90a10c2bcaf20e84a251cd9 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:29 +0200
|
||||
Subject: [PATCH 15/33] FROMGIT: configs: khadas-vim2: Enable USB gadget with
|
||||
Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/khadas-vim2_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/khadas-vim2_defconfig b/configs/khadas-vim2_defconfig
|
||||
index 9cb377e55e..a533566410 100644
|
||||
--- a/configs/khadas-vim2_defconfig
|
||||
+++ b/configs/khadas-vim2_defconfig
|
||||
@@ -20,6 +20,7 @@ CONFIG_CMD_GPIO=y
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -49,4 +50,10 @@ CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 742693fe45c96a7033a861b78527b63f0847a368 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:30 +0200
|
||||
Subject: [PATCH 16/33] FROMGIT: configs: khadas-vim: Enable USB gadget with
|
||||
Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/khadas-vim_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
|
||||
index e18a5e62bb..8a0af5cebb 100644
|
||||
--- a/configs/khadas-vim_defconfig
|
||||
+++ b/configs/khadas-vim_defconfig
|
||||
@@ -20,6 +20,7 @@ CONFIG_CMD_GPIO=y
|
||||
# CONFIG_CMD_LOADS is not set
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -50,4 +51,10 @@ CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From d404f6bfbb231b38b0248f79c0b2491324b7a8a7 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:31 +0200
|
||||
Subject: [PATCH 17/33] FROMGIT: configs: libretech-s905d-pc: Enable USB gadget
|
||||
with Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/libretech-s905d-pc_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/libretech-s905d-pc_defconfig b/configs/libretech-s905d-pc_defconfig
|
||||
index 7e0c95872a..531d519a7c 100644
|
||||
--- a/configs/libretech-s905d-pc_defconfig
|
||||
+++ b/configs/libretech-s905d-pc_defconfig
|
||||
@@ -26,6 +26,7 @@ CONFIG_CMD_SF=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_SPI=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -65,6 +66,12 @@ CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_SYS_WHITE_ON_BLACK=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 86650226bce789960a7fd8d36d2e7f57f2d0d9b1 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 11:27:32 +0200
|
||||
Subject: [PATCH 18/33] FROMGIT: configs: libretech-s912-pc: Enable USB gadget
|
||||
with Mass Storage function
|
||||
|
||||
Enable configs to support USB gadget and Mass Storage
|
||||
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
configs/libretech-s912-pc_defconfig | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/configs/libretech-s912-pc_defconfig b/configs/libretech-s912-pc_defconfig
|
||||
index 5f4ee329e2..595ec21da7 100644
|
||||
--- a/configs/libretech-s912-pc_defconfig
|
||||
+++ b/configs/libretech-s912-pc_defconfig
|
||||
@@ -26,6 +26,7 @@ CONFIG_CMD_SF=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_SPI=y
|
||||
CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_USB_MASS_STORAGE=y
|
||||
# CONFIG_CMD_SETEXPR is not set
|
||||
CONFIG_CMD_REGULATOR=y
|
||||
CONFIG_OF_CONTROL=y
|
||||
@@ -65,6 +66,12 @@ CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_DWC3=y
|
||||
CONFIG_USB_XHCI_DWC3_OF_SIMPLE=y
|
||||
CONFIG_USB_DWC3=y
|
||||
+# CONFIG_USB_DWC3_GADGET is not set
|
||||
+CONFIG_USB_GADGET=y
|
||||
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
|
||||
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
|
||||
+CONFIG_USB_GADGET_DWC2_OTG=y
|
||||
+CONFIG_USB_GADGET_DOWNLOAD=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_DM_VIDEO=y
|
||||
CONFIG_SYS_WHITE_ON_BLACK=y
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 885bb5a00c3d58123a8f4efa8ef03acf27b45301 Mon Sep 17 00:00:00 2001
|
||||
From: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Date: Mon, 20 Apr 2020 15:46:30 +0200
|
||||
Subject: [PATCH 19/33] FROMGIT: clk: meson: g12a: add missing SD_EMMC_A
|
||||
controller gates
|
||||
|
||||
Add missing SD_EMMC_A controller gates needed for probe of the A
|
||||
controller, otherwise leading to a freeze of the SoC after b3d69aa596.
|
||||
|
||||
Fixes: b3d69aa596 ("clk: meson: reset mmc clock on probe")
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/clk/meson/g12a.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
|
||||
index 9e6beca94a..5a94e5560f 100644
|
||||
--- a/drivers/clk/meson/g12a.c
|
||||
+++ b/drivers/clk/meson/g12a.c
|
||||
@@ -112,6 +112,7 @@ static struct meson_gate gates[NUM_CLKS] = {
|
||||
MESON_GATE(CLKID_I2C, HHI_GCLK_MPEG0, 9),
|
||||
MESON_GATE(CLKID_UART0, HHI_GCLK_MPEG0, 13),
|
||||
MESON_GATE(CLKID_SPICC1, HHI_GCLK_MPEG0, 14),
|
||||
+ MESON_GATE(CLKID_SD_EMMC_A, HHI_GCLK_MPEG0, 4),
|
||||
MESON_GATE(CLKID_SD_EMMC_B, HHI_GCLK_MPEG0, 25),
|
||||
MESON_GATE(CLKID_SD_EMMC_C, HHI_GCLK_MPEG0, 26),
|
||||
MESON_GATE(CLKID_ETH, HHI_GCLK_MPEG1, 3),
|
||||
@@ -127,6 +128,7 @@ static struct meson_gate gates[NUM_CLKS] = {
|
||||
MESON_GATE(CLKID_FCLK_DIV4, HHI_FIX_PLL_CNTL1, 21),
|
||||
MESON_GATE(CLKID_FCLK_DIV5, HHI_FIX_PLL_CNTL1, 22),
|
||||
MESON_GATE(CLKID_FCLK_DIV7, HHI_FIX_PLL_CNTL1, 23),
|
||||
+ MESON_GATE(CLKID_SD_EMMC_A_CLK0, HHI_SD_EMMC_CLK_CNTL, 7),
|
||||
MESON_GATE(CLKID_SD_EMMC_B_CLK0, HHI_SD_EMMC_CLK_CNTL, 23),
|
||||
MESON_GATE(CLKID_SD_EMMC_C_CLK0, HHI_NAND_CLK_CNTL, 7),
|
||||
MESON_GATE(CLKID_VPU_0, HHI_VPU_CLK_CNTL, 8),
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
From 60502f9c7098cc48fe332b7c596aecf4e995e2c8 Mon Sep 17 00:00:00 2001
|
||||
From: Beniamino Galvani <b.galvani@gmail.com>
|
||||
Date: Sun, 18 Aug 2019 15:42:54 +0200
|
||||
Subject: [PATCH 20/33] FROMGIT: phy: meson: add GXBB PHY driver
|
||||
|
||||
This adds support for the USB PHY found on Amlogic GXBB SoCs.
|
||||
|
||||
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
|
||||
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/phy/Kconfig | 8 ++
|
||||
drivers/phy/Makefile | 1 +
|
||||
drivers/phy/meson-gxbb-usb2.c | 235 ++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 244 insertions(+)
|
||||
create mode 100644 drivers/phy/meson-gxbb-usb2.c
|
||||
|
||||
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
|
||||
index a72f34f0d4..1e38c8741f 100644
|
||||
--- a/drivers/phy/Kconfig
|
||||
+++ b/drivers/phy/Kconfig
|
||||
@@ -154,6 +154,14 @@ config PHY_STM32_USBPHYC
|
||||
between an HS USB OTG controller and an HS USB Host controller,
|
||||
selected by an USB switch.
|
||||
|
||||
+config MESON_GXBB_USB_PHY
|
||||
+ bool "Amlogic Meson GXBB USB PHY"
|
||||
+ depends on PHY && ARCH_MESON && MESON_GXBB
|
||||
+ imply REGMAP
|
||||
+ help
|
||||
+ This is the generic phy driver for the Amlogic Meson GXBB
|
||||
+ USB2 PHY.
|
||||
+
|
||||
config MESON_GXL_USB_PHY
|
||||
bool "Amlogic Meson GXL USB PHYs"
|
||||
depends on PHY && ARCH_MESON && (MESON_GXL || MESON_GXM)
|
||||
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
|
||||
index 43ce62e08c..74e8d931d3 100644
|
||||
--- a/drivers/phy/Makefile
|
||||
+++ b/drivers/phy/Makefile
|
||||
@@ -16,6 +16,7 @@ obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
|
||||
obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o
|
||||
obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.o
|
||||
obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o
|
||||
+obj-$(CONFIG_MESON_GXBB_USB_PHY) += meson-gxbb-usb2.o
|
||||
obj-$(CONFIG_MESON_GXL_USB_PHY) += meson-gxl-usb2.o meson-gxl-usb3.o
|
||||
obj-$(CONFIG_MESON_G12A_USB_PHY) += meson-g12a-usb2.o meson-g12a-usb3-pcie.o
|
||||
obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
|
||||
diff --git a/drivers/phy/meson-gxbb-usb2.c b/drivers/phy/meson-gxbb-usb2.c
|
||||
new file mode 100644
|
||||
index 0000000000..88c2ec69b2
|
||||
--- /dev/null
|
||||
+++ b/drivers/phy/meson-gxbb-usb2.c
|
||||
@@ -0,0 +1,235 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Meson8, Meson8b and GXBB USB2 PHY driver
|
||||
+ *
|
||||
+ * Copyright (C) 2016 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
|
||||
+ * Copyright (C) 2018 BayLibre, SAS
|
||||
+ *
|
||||
+ * Author: Beniamino Galvani <b.galvani@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <clk.h>
|
||||
+#include <dm.h>
|
||||
+#include <generic-phy.h>
|
||||
+#include <power/regulator.h>
|
||||
+#include <regmap.h>
|
||||
+#include <reset.h>
|
||||
+
|
||||
+#define REG_CONFIG 0x00
|
||||
+ #define REG_CONFIG_CLK_EN BIT(0)
|
||||
+ #define REG_CONFIG_CLK_SEL_MASK GENMASK(3, 1)
|
||||
+ #define REG_CONFIG_CLK_DIV_MASK GENMASK(10, 4)
|
||||
+ #define REG_CONFIG_CLK_32k_ALTSEL BIT(15)
|
||||
+ #define REG_CONFIG_TEST_TRIG BIT(31)
|
||||
+
|
||||
+#define REG_CTRL 0x04
|
||||
+ #define REG_CTRL_SOFT_PRST BIT(0)
|
||||
+ #define REG_CTRL_SOFT_HRESET BIT(1)
|
||||
+ #define REG_CTRL_SS_SCALEDOWN_MODE_MASK GENMASK(3, 2)
|
||||
+ #define REG_CTRL_CLK_DET_RST BIT(4)
|
||||
+ #define REG_CTRL_INTR_SEL BIT(5)
|
||||
+ #define REG_CTRL_CLK_DETECTED BIT(8)
|
||||
+ #define REG_CTRL_SOF_SENT_RCVD_TGL BIT(9)
|
||||
+ #define REG_CTRL_SOF_TOGGLE_OUT BIT(10)
|
||||
+ #define REG_CTRL_POWER_ON_RESET BIT(15)
|
||||
+ #define REG_CTRL_SLEEPM BIT(16)
|
||||
+ #define REG_CTRL_TX_BITSTUFF_ENN_H BIT(17)
|
||||
+ #define REG_CTRL_TX_BITSTUFF_ENN BIT(18)
|
||||
+ #define REG_CTRL_COMMON_ON BIT(19)
|
||||
+ #define REG_CTRL_REF_CLK_SEL_MASK GENMASK(21, 20)
|
||||
+ #define REG_CTRL_REF_CLK_SEL_SHIFT 20
|
||||
+ #define REG_CTRL_FSEL_MASK GENMASK(24, 22)
|
||||
+ #define REG_CTRL_FSEL_SHIFT 22
|
||||
+ #define REG_CTRL_PORT_RESET BIT(25)
|
||||
+ #define REG_CTRL_THREAD_ID_MASK GENMASK(31, 26)
|
||||
+
|
||||
+/* bits [31:26], [24:21] and [15:3] seem to be read-only */
|
||||
+#define REG_ADP_BC 0x0c
|
||||
+ #define REG_ADP_BC_VBUS_VLD_EXT_SEL BIT(0)
|
||||
+ #define REG_ADP_BC_VBUS_VLD_EXT BIT(1)
|
||||
+ #define REG_ADP_BC_OTG_DISABLE BIT(2)
|
||||
+ #define REG_ADP_BC_ID_PULLUP BIT(3)
|
||||
+ #define REG_ADP_BC_DRV_VBUS BIT(4)
|
||||
+ #define REG_ADP_BC_ADP_PRB_EN BIT(5)
|
||||
+ #define REG_ADP_BC_ADP_DISCHARGE BIT(6)
|
||||
+ #define REG_ADP_BC_ADP_CHARGE BIT(7)
|
||||
+ #define REG_ADP_BC_SESS_END BIT(8)
|
||||
+ #define REG_ADP_BC_DEVICE_SESS_VLD BIT(9)
|
||||
+ #define REG_ADP_BC_B_VALID BIT(10)
|
||||
+ #define REG_ADP_BC_A_VALID BIT(11)
|
||||
+ #define REG_ADP_BC_ID_DIG BIT(12)
|
||||
+ #define REG_ADP_BC_VBUS_VALID BIT(13)
|
||||
+ #define REG_ADP_BC_ADP_PROBE BIT(14)
|
||||
+ #define REG_ADP_BC_ADP_SENSE BIT(15)
|
||||
+ #define REG_ADP_BC_ACA_ENABLE BIT(16)
|
||||
+ #define REG_ADP_BC_DCD_ENABLE BIT(17)
|
||||
+ #define REG_ADP_BC_VDAT_DET_EN_B BIT(18)
|
||||
+ #define REG_ADP_BC_VDAT_SRC_EN_B BIT(19)
|
||||
+ #define REG_ADP_BC_CHARGE_SEL BIT(20)
|
||||
+ #define REG_ADP_BC_CHARGE_DETECT BIT(21)
|
||||
+ #define REG_ADP_BC_ACA_PIN_RANGE_C BIT(22)
|
||||
+ #define REG_ADP_BC_ACA_PIN_RANGE_B BIT(23)
|
||||
+ #define REG_ADP_BC_ACA_PIN_RANGE_A BIT(24)
|
||||
+ #define REG_ADP_BC_ACA_PIN_GND BIT(25)
|
||||
+ #define REG_ADP_BC_ACA_PIN_FLOAT BIT(26)
|
||||
+
|
||||
+#define RESET_COMPLETE_TIME 500
|
||||
+#define ACA_ENABLE_COMPLETE_TIME 50
|
||||
+
|
||||
+struct phy_meson_gxbb_usb2_priv {
|
||||
+ struct regmap *regmap;
|
||||
+ struct reset_ctl_bulk resets;
|
||||
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
+ struct udevice *phy_supply;
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static int phy_meson_gxbb_usb2_power_on(struct phy *phy)
|
||||
+{
|
||||
+ struct udevice *dev = phy->dev;
|
||||
+ struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
|
||||
+ uint val;
|
||||
+
|
||||
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
+ if (priv->phy_supply) {
|
||||
+ int ret = regulator_set_enable(priv->phy_supply, true);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ regmap_update_bits(priv->regmap, REG_CONFIG,
|
||||
+ REG_CONFIG_CLK_32k_ALTSEL,
|
||||
+ REG_CONFIG_CLK_32k_ALTSEL);
|
||||
+ regmap_update_bits(priv->regmap, REG_CTRL,
|
||||
+ REG_CTRL_REF_CLK_SEL_MASK,
|
||||
+ 0x2 << REG_CTRL_REF_CLK_SEL_SHIFT);
|
||||
+ regmap_update_bits(priv->regmap, REG_CTRL,
|
||||
+ REG_CTRL_FSEL_MASK,
|
||||
+ 0x5 << REG_CTRL_FSEL_SHIFT);
|
||||
+
|
||||
+ /* reset the PHY */
|
||||
+ regmap_update_bits(priv->regmap, REG_CTRL,
|
||||
+ REG_CTRL_POWER_ON_RESET,
|
||||
+ REG_CTRL_POWER_ON_RESET);
|
||||
+ udelay(RESET_COMPLETE_TIME);
|
||||
+ regmap_update_bits(priv->regmap, REG_CTRL,
|
||||
+ REG_CTRL_POWER_ON_RESET,
|
||||
+ 0);
|
||||
+ udelay(RESET_COMPLETE_TIME);
|
||||
+
|
||||
+ regmap_update_bits(priv->regmap, REG_CTRL,
|
||||
+ REG_CTRL_SOF_TOGGLE_OUT,
|
||||
+ REG_CTRL_SOF_TOGGLE_OUT);
|
||||
+
|
||||
+ /* Set host mode */
|
||||
+ regmap_update_bits(priv->regmap, REG_ADP_BC,
|
||||
+ REG_ADP_BC_ACA_ENABLE,
|
||||
+ REG_ADP_BC_ACA_ENABLE);
|
||||
+ udelay(ACA_ENABLE_COMPLETE_TIME);
|
||||
+
|
||||
+ regmap_read(priv->regmap, REG_ADP_BC, &val);
|
||||
+ if (val & REG_ADP_BC_ACA_PIN_FLOAT) {
|
||||
+ pr_err("Error powering on GXBB USB PHY\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int phy_meson_gxbb_usb2_power_off(struct phy *phy)
|
||||
+{
|
||||
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
+ struct udevice *dev = phy->dev;
|
||||
+ struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
|
||||
+
|
||||
+ if (priv->phy_supply) {
|
||||
+ int ret = regulator_set_enable(priv->phy_supply, false);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct phy_ops meson_gxbb_usb2_phy_ops = {
|
||||
+ .power_on = phy_meson_gxbb_usb2_power_on,
|
||||
+ .power_off = phy_meson_gxbb_usb2_power_off,
|
||||
+};
|
||||
+
|
||||
+static int meson_gxbb_usb2_phy_probe(struct udevice *dev)
|
||||
+{
|
||||
+ struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
|
||||
+ struct clk clk_usb_general, clk_usb;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = regmap_init_mem(dev_ofnode(dev), &priv->regmap);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = clk_get_by_name(dev, "usb_general", &clk_usb_general);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = clk_enable(&clk_usb_general);
|
||||
+ if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
|
||||
+ pr_err("Failed to enable PHY general clock\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_get_by_name(dev, "usb", &clk_usb);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = clk_enable(&clk_usb);
|
||||
+ if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
|
||||
+ pr_err("Failed to enable PHY clock\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
+ ret = device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply);
|
||||
+ if (ret && ret != -ENOENT) {
|
||||
+ pr_err("Failed to get PHY regulator\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+ ret = reset_get_bulk(dev, &priv->resets);
|
||||
+ if (!ret) {
|
||||
+ ret = reset_deassert_bulk(&priv->resets);
|
||||
+ if (ret) {
|
||||
+ pr_err("Failed to deassert reset\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int meson_gxbb_usb2_phy_remove(struct udevice *dev)
|
||||
+{
|
||||
+ struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
|
||||
+
|
||||
+ return reset_release_bulk(&priv->resets);
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id meson_gxbb_usb2_phy_ids[] = {
|
||||
+ { .compatible = "amlogic,meson8-usb2-phy" },
|
||||
+ { .compatible = "amlogic,meson8b-usb2-phy" },
|
||||
+ { .compatible = "amlogic,meson-gxbb-usb2-phy" },
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(meson_gxbb_usb2_phy) = {
|
||||
+ .name = "meson_gxbb_usb2_phy",
|
||||
+ .id = UCLASS_PHY,
|
||||
+ .of_match = meson_gxbb_usb2_phy_ids,
|
||||
+ .probe = meson_gxbb_usb2_phy_probe,
|
||||
+ .remove = meson_gxbb_usb2_phy_remove,
|
||||
+ .ops = &meson_gxbb_usb2_phy_ops,
|
||||
+ .priv_auto_alloc_size = sizeof(struct phy_meson_gxbb_usb2_priv),
|
||||
+};
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user