add driver for Tegra124 memory controller
Subsystems (3)
PATCH 1/2 add driver for Tegra124 memory controller
This driver performs the required initialization to get the GPU into a functional state, so it can be used when the OS is running.
Signed-off-by Lucas Stach <[email protected]>
--- drivers/Kconfig | 1 + drivers/Makefile | 1 + drivers/memory/Kconfig | 11 +++++++ drivers/memory/Makefile | 1 + drivers/memory/mc-tegra124.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 drivers/memory/Kconfig create mode 100644 drivers/memory/Makefile create mode 100644 drivers/memory/mc-tegra124.c
drivers/Kconfig +1 -0
@@ -34,5 +34,6 @@ source "drivers/rtc/Kconfig" source "drivers/firmware/Kconfig" source "drivers/phy/Kconfig" source "drivers/crypto/Kconfig" +source "drivers/memory/Kconfig" endmenu
drivers/Makefile +1 -0
@@ -35,3 +35,4 @@ obj-$(CONFIG_GENERIC_PHY) += phy/ obj-$(CONFIG_HAB) += hab/ obj-$(CONFIG_CRYPTO_HW) += crypto/ obj-$(CONFIG_AIODEV) += aiodev/ +obj-y += memory/
drivers/memory/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +menu "Memory controller drivers" + +config MC_TEGRA124 + bool "Support for Tegra124 memory controller" + depends on ARCH_TEGRA + help + Say yes here to include the driver for the memory controller found on + the Tegra124 SoC. This driver performs the necessary initialization + to provide a function GPU when the OS is running. + +endmenu
drivers/memory/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_MC_TEGRA124) += mc-tegra124.o
drivers/memory/mc-tegra124.c new file +75 -0
75 lines not on this page · raw message
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 ARM: tegra: enable Tegra124 memory controller driver in defconfig
Signed-off-by Lucas Stach <[email protected]>
--- arch/arm/configs/tegra_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/tegra_v7_defconfig +1 -0
@@ -46,6 +46,7 @@ CONFIG_MCI=y CONFIG_MCI_MMC_BOOT_PARTITIONS=y CONFIG_MCI_TEGRA=y CONFIG_PCI_TEGRA=y +CONFIG_MC_TEGRA124=y CONFIG_FS_EXT4=y CONFIG_FS_TFTP=y CONFIG_FS_NFS=y
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 4 lines · Lucas Stach
This driver performs the required initialization to get the GPU into a functional state, so it can be used when the OS is running.
Signed-off-by Lucas Stach <[email protected]>
Quoted 10 lines
--- drivers/Kconfig | 1 + drivers/Makefile | 1 + drivers/memory/Kconfig | 11 +++++++ drivers/memory/Makefile | 1 + drivers/memory/mc-tegra124.c | 75 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 drivers/memory/Kconfig create mode 100644 drivers/memory/Makefile create mode 100644 drivers/memory/mc-tegra124.c
Applied, thanks
Sascha
Quoted 135 lines
drivers/Kconfig +1
-0@@ -34,5 +34,6 @@ source "drivers/rtc/Kconfig" source "drivers/firmware/Kconfig" source "drivers/phy/Kconfig" source "drivers/crypto/Kconfig" +source "drivers/memory/Kconfig" endmenudrivers/Makefile +1
-0@@ -35,3 +35,4 @@ obj-$(CONFIG_GENERIC_PHY) += phy/ obj-$(CONFIG_HAB) += hab/ obj-$(CONFIG_CRYPTO_HW) += crypto/ obj-$(CONFIG_AIODEV) += aiodev/ +obj-y += memory/drivers/memory/Kconfig new file +11
-0@@ -0,0 +1,11 @@ +menu "Memory controller drivers" + +config MC_TEGRA124 + bool "Support for Tegra124 memory controller" + depends on ARCH_TEGRA + help + Say yes here to include the driver for the memory controller found on + the Tegra124 SoC. This driver performs the necessary initialization + to provide a function GPU when the OS is running. + +endmenudrivers/memory/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_MC_TEGRA124) += mc-tegra124.odrivers/memory/mc-tegra124.c new file +75
-0@@ -0,0 +1,75 @@ +/* * +* Copyright (C) 2017 Lucas Stach <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <common.h> +#include <init.h> +#include <io.h> +#include <of.h> + +#define MC_VIDEO_PROTECT_SIZE_MB 0x64c +#define MC_VIDEO_PROTECT_REG_CTRL 0x650 +#define MC_VIDEO_PROTECT_REG_WR_DIS (1 << 0) + +static int tegra124_mc_of_fixup (struct device_node *root,void *context) +{ +struct device_node *np; + + np =of_find_compatible_node (root,NULL ,"nvidia,gk20a" ); +if (np) +of_device_enable (np); + +return 0 ; +} + +static int tegra124_mc_probe (struct device_d *dev) +{ +struct resource *iores; +void __iomem *base; + + iores =dev_request_mem_resource (dev,0 ); +if (IS_ERR (iores)) { +dev_err (dev,"could not get memory region\n" ); +return PTR_ERR (iores); + } + base =IOMEM (iores->start); + +/* disable video protect region */ +writel (0 , base +MC_VIDEO_PROTECT_SIZE_MB ); +writel (MC_VIDEO_PROTECT_REG_WR_DIS , base +MC_VIDEO_PROTECT_REG_CTRL ); +readl (base +MC_VIDEO_PROTECT_REG_CTRL );/* readback to flush */ + +return of_register_fixup (tegra124_mc_of_fixup,NULL ); +} + +static __maybe_unused struct of_device_id tegra124_mc_dt_ids[] = { + { + .compatible ="nvidia,tegra124-mc" , + }, { +/* sentinel */ + }, +}; + +static struct driver_d tegra124_mc_driver = { + .name ="tegra124-mc" , + .of_compatible =DRV_OF_COMPAT (tegra124_mc_dt_ids), + .probe = tegra124_mc_probe, +}; + +static int __init tegra124_mc_init (void ) +{ +return platform_driver_register (&tegra124_mc_driver); +} +device_initcall (tegra124_mc_init);Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox