Add support of Baikal-M SoCs
Information about config values was taken from:
From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
Date: Thu, 4 Feb 2021 19:35:14 +0400
Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board)
* DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks
* SERIAL_8250_DW=y: serial console
* I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board
management controller) and RTC (Real Time Clock) are connected
via I2C.
* GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration
* RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically
sets the system time from the hardware clock
* TP_BMC=y: amongst other things handles the power button
* DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter
* CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence
CMA should reserve enough (contiguous) memory.
Note: CMA reserves memory during very early init, hence the size
has to be hard-coded into CONFIG
* MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob.
Note: kernel mode code is GPLv2, so it's fine to distribute it.
* SENSORS_BT1_PVT=m: hardware temperature/voltage sensors
* PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes
ages (60 seconds or so) to probe the hardware. If compiled in
substantially increases the boot time, and machine is completely
unresponsive during probing PCIe. When built as a module probing
executes concurrently with other boot activities (unless booting
from a PCIe device)
* STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
|
|
|
Subject: [PATCH 608/625] Baikal-M: USB driver
|
|
|
|
|
2022-03-17 10:23:10 +03:00
|
|
|
Update for 5.15.105
|
Add support of Baikal-M SoCs
Information about config values was taken from:
From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
Date: Thu, 4 Feb 2021 19:35:14 +0400
Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board)
* DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks
* SERIAL_8250_DW=y: serial console
* I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board
management controller) and RTC (Real Time Clock) are connected
via I2C.
* GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration
* RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically
sets the system time from the hardware clock
* TP_BMC=y: amongst other things handles the power button
* DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter
* CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence
CMA should reserve enough (contiguous) memory.
Note: CMA reserves memory during very early init, hence the size
has to be hard-coded into CONFIG
* MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob.
Note: kernel mode code is GPLv2, so it's fine to distribute it.
* SENSORS_BT1_PVT=m: hardware temperature/voltage sensors
* PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes
ages (60 seconds or so) to probe the hardware. If compiled in
substantially increases the boot time, and machine is completely
unresponsive during probing PCIe. When built as a module probing
executes concurrently with other boot activities (unless booting
from a PCIe device)
* STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
|
|
|
|
|
|
|
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
|
|
|
|
--- a/drivers/usb/dwc3/Kconfig
|
|
|
|
+++ b/drivers/usb/dwc3/Kconfig
|
2022-03-17 10:23:10 +03:00
|
|
|
@@ -158,4 +158,13 @@
|
|
|
|
This driver handles both ZynqMP and Versal SoC operations.
|
Add support of Baikal-M SoCs
Information about config values was taken from:
From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
Date: Thu, 4 Feb 2021 19:35:14 +0400
Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board)
* DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks
* SERIAL_8250_DW=y: serial console
* I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board
management controller) and RTC (Real Time Clock) are connected
via I2C.
* GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration
* RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically
sets the system time from the hardware clock
* TP_BMC=y: amongst other things handles the power button
* DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter
* CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence
CMA should reserve enough (contiguous) memory.
Note: CMA reserves memory during very early init, hence the size
has to be hard-coded into CONFIG
* MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob.
Note: kernel mode code is GPLv2, so it's fine to distribute it.
* SENSORS_BT1_PVT=m: hardware temperature/voltage sensors
* PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes
ages (60 seconds or so) to probe the hardware. If compiled in
substantially increases the boot time, and machine is completely
unresponsive during probing PCIe. When built as a module probing
executes concurrently with other boot activities (unless booting
from a PCIe device)
* STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
|
|
|
Say 'Y' or 'M' if you have one such device.
|
|
|
|
|
|
|
|
+config USB_DWC3_BAIKAL
|
|
|
|
+ tristate "Baikal Electronics Platforms"
|
|
|
|
+ depends on OF
|
|
|
|
+ default USB_DWC3
|
|
|
|
+ help
|
|
|
|
+ Baikal Electronics SoCs with one DesignWare Core USB3 IP
|
|
|
|
+ inside.
|
|
|
|
+ Say 'Y' or 'M' if you have one such device.
|
|
|
|
+
|
|
|
|
endif
|
|
|
|
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
|
|
|
|
--- a/drivers/usb/dwc3/Makefile
|
|
|
|
+++ b/drivers/usb/dwc3/Makefile
|
2022-03-17 10:23:10 +03:00
|
|
|
@@ -53,3 +53,4 @@
|
Add support of Baikal-M SoCs
Information about config values was taken from:
From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
Date: Thu, 4 Feb 2021 19:35:14 +0400
Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board)
* DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks
* SERIAL_8250_DW=y: serial console
* I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board
management controller) and RTC (Real Time Clock) are connected
via I2C.
* GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration
* RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically
sets the system time from the hardware clock
* TP_BMC=y: amongst other things handles the power button
* DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter
* CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence
CMA should reserve enough (contiguous) memory.
Note: CMA reserves memory during very early init, hence the size
has to be hard-coded into CONFIG
* MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob.
Note: kernel mode code is GPLv2, so it's fine to distribute it.
* SENSORS_BT1_PVT=m: hardware temperature/voltage sensors
* PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes
ages (60 seconds or so) to probe the hardware. If compiled in
substantially increases the boot time, and machine is completely
unresponsive during probing PCIe. When built as a module probing
executes concurrently with other boot activities (unless booting
from a PCIe device)
* STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
|
|
|
obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom.o
|
2022-03-17 10:23:10 +03:00
|
|
|
obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o
|
|
|
|
obj-$(CONFIG_USB_DWC3_XILINX) += dwc3-xilinx.o
|
Add support of Baikal-M SoCs
Information about config values was taken from:
From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
Date: Thu, 4 Feb 2021 19:35:14 +0400
Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board)
* DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks
* SERIAL_8250_DW=y: serial console
* I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board
management controller) and RTC (Real Time Clock) are connected
via I2C.
* GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration
* RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically
sets the system time from the hardware clock
* TP_BMC=y: amongst other things handles the power button
* DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter
* CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence
CMA should reserve enough (contiguous) memory.
Note: CMA reserves memory during very early init, hence the size
has to be hard-coded into CONFIG
* MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob.
Note: kernel mode code is GPLv2, so it's fine to distribute it.
* SENSORS_BT1_PVT=m: hardware temperature/voltage sensors
* PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes
ages (60 seconds or so) to probe the hardware. If compiled in
substantially increases the boot time, and machine is completely
unresponsive during probing PCIe. When built as a module probing
executes concurrently with other boot activities (unless booting
from a PCIe device)
* STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
|
|
|
+obj-$(CONFIG_USB_DWC3_BAIKAL) += dwc3-baikal.o
|
|
|
|
diff --git a/drivers/usb/dwc3/dwc3-baikal.c b/drivers/usb/dwc3/dwc3-baikal.c
|
|
|
|
new file mode 100644
|
|
|
|
index 000000000000..2426dc49bd79
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/drivers/usb/dwc3/dwc3-baikal.c
|
|
|
|
@@ -0,0 +1,126 @@
|
|
|
|
+/**
|
|
|
|
+ * dwc3-baikal.c - Baikal Electronics SoCs Specific Glue layer
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2015 Baikal Electronics JSC - http://www.baikalelectronics.ru
|
|
|
|
+ *
|
|
|
|
+ * Author: Dmitry Dunaev <dmitry.dunaev@baikalelectronics.ru>
|
|
|
|
+ *
|
|
|
|
+ * This program is free software: you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License version 2 of
|
|
|
|
+ * the License as published by the Free Software Foundation.
|
|
|
|
+ *
|
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ * GNU General Public License for more details.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <linux/clk.h>
|
|
|
|
+#include <linux/module.h>
|
|
|
|
+#include <linux/kernel.h>
|
|
|
|
+#include <linux/interrupt.h>
|
|
|
|
+#include <linux/platform_device.h>
|
|
|
|
+#include <linux/dma-mapping.h>
|
|
|
|
+#include <linux/usb/usb_phy_generic.h>
|
|
|
|
+#include <linux/io.h>
|
|
|
|
+#include <linux/of_platform.h>
|
|
|
|
+
|
|
|
|
+struct dwc3_baikal {
|
|
|
|
+ struct device *dev;
|
|
|
|
+ struct clk *clk;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static int be_dwc3_probe(struct platform_device *pdev)
|
|
|
|
+{
|
|
|
|
+ struct device *dev = &pdev->dev;
|
|
|
|
+ struct device_node *node = pdev->dev.of_node;
|
|
|
|
+ struct dwc3_baikal *dwc;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
|
|
|
|
+ if (!dwc)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(dev, "DMA mask error %d\n", ret);
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ platform_set_drvdata(pdev, dwc);
|
|
|
|
+ dwc->dev = dev;
|
|
|
|
+
|
|
|
|
+ dwc->clk = devm_clk_get(dwc->dev, "usb");
|
|
|
|
+ if (IS_ERR(dwc->clk)) {
|
|
|
|
+ dev_err(dev, "no interface clk specified\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ret = clk_prepare_enable(dwc->clk);
|
|
|
|
+ if (ret < 0) {
|
|
|
|
+ dev_err(dwc->dev, "unable to enable usb clock\n");
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (node) {
|
|
|
|
+ ret = of_platform_populate(node, NULL, NULL, dev);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "failed to create dwc3 core\n");
|
|
|
|
+ goto __error;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ dev_err(dev, "no device node, failed to add dwc3 core\n");
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto __error;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+__error:
|
|
|
|
+ clk_disable_unprepare(dwc->clk);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int be_dwc3_remove_core(struct device *dev, void *c)
|
|
|
|
+{
|
|
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
|
|
+
|
|
|
|
+ platform_device_unregister(pdev);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int be_dwc3_remove(struct platform_device *pdev)
|
|
|
|
+{
|
|
|
|
+ struct dwc3_baikal *dwc = platform_get_drvdata(pdev);
|
|
|
|
+
|
|
|
|
+ device_for_each_child(&pdev->dev, NULL, be_dwc3_remove_core);
|
|
|
|
+ clk_disable_unprepare(dwc->clk);
|
|
|
|
+
|
|
|
|
+ platform_set_drvdata(pdev, NULL);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static const struct of_device_id be_dwc3_of_match[] = {
|
|
|
|
+ { .compatible = "be,baikal-dwc3", },
|
|
|
|
+ {},
|
|
|
|
+};
|
|
|
|
+MODULE_DEVICE_TABLE(of, be_dwc3_of_match);
|
|
|
|
+
|
|
|
|
+static struct platform_driver be_dwc3_driver = {
|
|
|
|
+ .probe = be_dwc3_probe,
|
|
|
|
+ .remove = be_dwc3_remove,
|
|
|
|
+ .driver = {
|
|
|
|
+ .name = "baikal-dwc3",
|
|
|
|
+ .of_match_table = be_dwc3_of_match,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+module_platform_driver(be_dwc3_driver);
|
|
|
|
+
|
|
|
|
+MODULE_ALIAS("platform:baikal-dwc3");
|
|
|
|
+MODULE_AUTHOR("Dmitry Dunaev <dmitry.dunaev@baikalelectronics.ru>");
|
|
|
|
+MODULE_LICENSE("GPL v2");
|
|
|
|
+MODULE_DESCRIPTION("DesignWare USB3 Baikal SoCs Glue Layer");
|