Created
December 19, 2018 18:10
-
-
Save xerpi/33c47b22dec925a4eb0fbcc2fd214464 to your computer and use it in GitHub Desktop.
Linux PSVita initial support (over Linux 62393dbcbe0f3001691e4bd479a25beb5941f2ed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ecba9fec7aa4bac172addd78a468a87b06b5b0da Mon Sep 17 00:00:00 2001 | |
From: Sergi Granell <xerpi.g.12@gmail.com> | |
Date: Wed, 19 Dec 2018 19:04:27 +0100 | |
Subject: [PATCH] arm: Add initial PSVita support | |
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com> | |
--- | |
arch/arm/Kconfig | 2 ++ | |
arch/arm/Kconfig.debug | 23 ++++++++++--- | |
arch/arm/Makefile | 1 + | |
arch/arm/boot/dts/vita.dts | 56 ++++++++++++++++++++++++++++++++ | |
arch/arm/include/debug/vita.S | 37 +++++++++++++++++++++ | |
arch/arm/mach-vita/Kconfig | 15 +++++++++ | |
arch/arm/mach-vita/Makefile | 1 + | |
arch/arm/mach-vita/Makefile.boot | 7 ++++ | |
arch/arm/mach-vita/vita.c | 23 +++++++++++++ | |
9 files changed, 160 insertions(+), 5 deletions(-) | |
create mode 100644 arch/arm/boot/dts/vita.dts | |
create mode 100644 arch/arm/include/debug/vita.S | |
create mode 100644 arch/arm/mach-vita/Kconfig | |
create mode 100644 arch/arm/mach-vita/Makefile | |
create mode 100644 arch/arm/mach-vita/Makefile.boot | |
create mode 100644 arch/arm/mach-vita/vita.c | |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig | |
index 91be74d8df65..67133f5cab16 100644 | |
--- a/arch/arm/Kconfig | |
+++ b/arch/arm/Kconfig | |
@@ -635,6 +635,8 @@ config ARCH_OMAP1 | |
help | |
Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx) | |
+source "arch/arm/mach-vita/Kconfig" | |
+ | |
endchoice | |
menu "Multiple platform selection" | |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug | |
index d6a49f59ecd9..64094729bf47 100644 | |
--- a/arch/arm/Kconfig.debug | |
+++ b/arch/arm/Kconfig.debug | |
@@ -1303,6 +1303,14 @@ choice | |
This option selects UART0 at 0xb0090000. This is appropriate for | |
Cortex-R series tiles and SMMs, such as Cortex-R5 and Cortex-R7 | |
+ config DEBUG_VITA_UART0 | |
+ bool "Kernel low-level debugging on PSVita using UART0" | |
+ depends on ARCH_VITA | |
+ help | |
+ Say Y here if you want the debug print routines to direct | |
+ their output to UART0 on the PSVita platform. | |
+ | |
+ | |
config DEBUG_VF_UART | |
bool "Vybrid UART" | |
depends on SOC_VF610 | |
@@ -1528,6 +1536,7 @@ config DEBUG_LL_INCLUDE | |
default "debug/tegra.S" if DEBUG_TEGRA_UART | |
default "debug/ux500.S" if DEBUG_UX500_UART | |
default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT | |
+ default "debug/vita.S" if DEBUG_VITA_UART0 | |
default "debug/vf.S" if DEBUG_VF_UART | |
default "debug/vt8500.S" if DEBUG_VT8500_UART0 | |
default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 | |
@@ -1633,6 +1642,7 @@ config DEBUG_UART_PHYS | |
default 0xd4017000 if DEBUG_MMP_UART2 | |
default 0xd4018000 if DEBUG_MMP_UART3 | |
default 0xe0000000 if DEBUG_SPEAR13XX | |
+ default 0xe2030000 if DEBUG_VITA_UART0 | |
default 0xe4007000 if DEBUG_HIP04_UART | |
default 0xe6c40000 if DEBUG_RMOBILE_SCIFA0 | |
default 0xe6c50000 if DEBUG_RMOBILE_SCIFA1 | |
@@ -1681,7 +1691,7 @@ config DEBUG_UART_PHYS | |
DEBUG_S3C64XX_UART || \ | |
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ | |
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \ | |
- DEBUG_AT91_UART | |
+ DEBUG_AT91_UART || DEBUG_VITA_UART0 | |
config DEBUG_UART_VIRT | |
hex "Virtual base address of debug UART" | |
@@ -1705,6 +1715,7 @@ config DEBUG_UART_VIRT | |
default 0xf1c28000 if DEBUG_SUNXI_UART0 | |
default 0xf1c28400 if DEBUG_SUNXI_UART1 | |
default 0xf1f02800 if DEBUG_SUNXI_R_UART | |
+ default 0xf2030000 if DEBUG_VITA_UART0 | |
default 0xf31004c0 if DEBUG_MESON_UARTAO | |
default 0xf4090000 if DEBUG_LPC32XX | |
default 0xf4200000 if DEBUG_GEMINI | |
@@ -1796,7 +1807,7 @@ config DEBUG_UART_VIRT | |
DEBUG_S3C64XX_UART || \ | |
DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ | |
DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0 || \ | |
- DEBUG_AT91_UART | |
+ DEBUG_AT91_UART || DEBUG_VITA_UART0 | |
config DEBUG_UART_8250_SHIFT | |
int "Register offset shift for the 8250 debug UART" | |
@@ -1833,7 +1844,8 @@ config DEBUG_UART_8250_FLOW_CONTROL | |
config DEBUG_UNCOMPRESS | |
bool "Enable decompressor debugging via DEBUG_LL output" | |
- depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M | |
+ depends on ARCH_MULTIPLATFORM || PLAT_SAMSUNG || ARM_SINGLE_ARMV7M || \ | |
+ ARCH_VITA | |
depends on DEBUG_LL && !DEBUG_OMAP2PLUS_UART && \ | |
(!DEBUG_TEGRA_UART || !ZBOOT_ROM) && \ | |
!DEBUG_BRCMSTB_UART | |
@@ -1846,12 +1858,13 @@ config DEBUG_UNCOMPRESS | |
When this option is set, the selected DEBUG_LL output method | |
will be re-used for normal decompressor output on multiplatform | |
kernels. | |
- | |
+ | |
config UNCOMPRESS_INCLUDE | |
string | |
default "debug/uncompress.h" if ARCH_MULTIPLATFORM || ARCH_MSM || \ | |
- PLAT_SAMSUNG || ARM_SINGLE_ARMV7M | |
+ PLAT_SAMSUNG || ARM_SINGLE_ARMV7M || \ | |
+ ARCH_VITA | |
default "mach/uncompress.h" | |
config EARLY_PRINTK | |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile | |
index 05a91d8b89f3..ed0c899b68cf 100644 | |
--- a/arch/arm/Makefile | |
+++ b/arch/arm/Makefile | |
@@ -221,6 +221,7 @@ machine-$(CONFIG_ARCH_U300) += u300 | |
machine-$(CONFIG_ARCH_U8500) += ux500 | |
machine-$(CONFIG_ARCH_VERSATILE) += versatile | |
machine-$(CONFIG_ARCH_VEXPRESS) += vexpress | |
+machine-$(CONFIG_ARCH_VITA) += vita | |
machine-$(CONFIG_ARCH_VT8500) += vt8500 | |
machine-$(CONFIG_ARCH_W90X900) += w90x900 | |
machine-$(CONFIG_ARCH_ZX) += zx | |
diff --git a/arch/arm/boot/dts/vita.dts b/arch/arm/boot/dts/vita.dts | |
new file mode 100644 | |
index 000000000000..c2c2e99af6a0 | |
--- /dev/null | |
+++ b/arch/arm/boot/dts/vita.dts | |
@@ -0,0 +1,56 @@ | |
+// SPDX-License-Identifier: GPL-2.0 | |
+/* | |
+ * Base Device Tree Source for the PlayStation Vita | |
+ * | |
+ * Copyright (C) 2018 Sergi Granell | |
+ * | |
+ */ | |
+ | |
+/dts-v1/; | |
+ | |
+/ { | |
+ model = "PlayStation Vita"; | |
+ compatible = "vita,vita"; | |
+ | |
+ #address-cells = <1>; | |
+ #size-cells = <1>; | |
+ | |
+ chosen { | |
+ bootargs = "keep_bootcon earlyprintk"; | |
+ }; | |
+ | |
+ cpus { | |
+ #address-cells = <1>; | |
+ #size-cells = <0>; | |
+ | |
+ cpu@0 { | |
+ device_type = "cpu"; | |
+ compatible = "arm,cortex-a9"; | |
+ reg = <0>; | |
+ }; | |
+ | |
+ cpu@1 { | |
+ device_type = "cpu"; | |
+ compatible = "arm,cortex-a9"; | |
+ reg = <1>; | |
+ }; | |
+ | |
+ cpu@2 { | |
+ device_type = "cpu"; | |
+ compatible = "arm,cortex-a9"; | |
+ reg = <2>; | |
+ }; | |
+ | |
+ cpu@3 { | |
+ device_type = "cpu"; | |
+ compatible = "arm,cortex-a9"; | |
+ reg = <3>; | |
+ }; | |
+ }; | |
+ | |
+ memory { | |
+ device_type = "memory"; | |
+ reg = <0x40200000 0x1FE00000>; | |
+ }; | |
+ | |
+}; | |
diff --git a/arch/arm/include/debug/vita.S b/arch/arm/include/debug/vita.S | |
new file mode 100644 | |
index 000000000000..00228fa841f9 | |
--- /dev/null | |
+++ b/arch/arm/include/debug/vita.S | |
@@ -0,0 +1,37 @@ | |
+/* | |
+ * Copyright (C) 2018 Sergi Granell | |
+ * | |
+ * Debugging macro include header | |
+ * | |
+ * This program is free software; you can redistribute it and/or modify | |
+ * it under the terms of the GNU General Public License version 2 as | |
+ * published by the Free Software Foundation. | |
+ * | |
+*/ | |
+ | |
+#define VITA_UART_STATUS (0x28) | |
+#define VITA_UART_WRITE_FIFO (0x70) | |
+ | |
+#define VITA_UART_STATUS_TXREADY (1 << 8) | |
+#define VITA_UART_STATUS_DEVREADY (1 << 9) | |
+ | |
+ .macro addruart,rp,rv,tmp | |
+ ldr \rp, =CONFIG_DEBUG_UART_PHYS | |
+ ldr \rv, =CONFIG_DEBUG_UART_VIRT | |
+ .endm | |
+ | |
+ .macro senduart,rd,rx | |
+ strb \rd, [\rx, #(VITA_UART_WRITE_FIFO)] | |
+ .endm | |
+ | |
+ .macro waituart,rd,rx | |
+1001: ldr \rd, [\rx, #(VITA_UART_STATUS)] | |
+ tst \rd, #VITA_UART_STATUS_TXREADY | |
+ beq 1001b | |
+ .endm | |
+ | |
+ .macro busyuart,rd,rx | |
+1001: ldr \rd, [\rx, #(VITA_UART_STATUS)] | |
+ tst \rd, #VITA_UART_STATUS_DEVREADY | |
+ beq 1001b | |
+ .endm | |
diff --git a/arch/arm/mach-vita/Kconfig b/arch/arm/mach-vita/Kconfig | |
new file mode 100644 | |
index 000000000000..cde40913ce18 | |
--- /dev/null | |
+++ b/arch/arm/mach-vita/Kconfig | |
@@ -0,0 +1,15 @@ | |
+# SPDX-License-Identifier: GPL-2.0 | |
+config ARCH_VITA | |
+ bool "PlayStation Vita" | |
+ depends on MMU | |
+ select CPU_V7 | |
+ select HAVE_SMP | |
+ select TIMER_OF | |
+ select COMMON_CLK | |
+ select GENERIC_CLOCKEVENTS | |
+ select GENERIC_IRQ_MULTI_HANDLER | |
+ select SPARSE_IRQ | |
+ select USE_OF | |
+ select ARM_GIC | |
+ help | |
+ Support for the Sony PlayStation Vita gaming console | |
diff --git a/arch/arm/mach-vita/Makefile b/arch/arm/mach-vita/Makefile | |
new file mode 100644 | |
index 000000000000..09880cd7e426 | |
--- /dev/null | |
+++ b/arch/arm/mach-vita/Makefile | |
@@ -0,0 +1 @@ | |
+obj-$(CONFIG_ARCH_VITA) += vita.o | |
diff --git a/arch/arm/mach-vita/Makefile.boot b/arch/arm/mach-vita/Makefile.boot | |
new file mode 100644 | |
index 000000000000..4bdb4599acdb | |
--- /dev/null | |
+++ b/arch/arm/mach-vita/Makefile.boot | |
@@ -0,0 +1,7 @@ | |
+# SPDX-License-Identifier: GPL-2.0 | |
+ | |
+# The Vita's shared (NS) DRAM base is actually at 0x40200000 | |
+# but __fixup_pv_table expects it to be 16MiB aligned | |
+zreladdr-y += 0x41008000 | |
+params_phys-y := 0x41000100 | |
+initrd_phys-y := 0x41000000 | |
diff --git a/arch/arm/mach-vita/vita.c b/arch/arm/mach-vita/vita.c | |
new file mode 100644 | |
index 000000000000..810e74b19f92 | |
--- /dev/null | |
+++ b/arch/arm/mach-vita/vita.c | |
@@ -0,0 +1,23 @@ | |
+/* | |
+ * Device Tree support for PlayStation Vita | |
+ * | |
+ * Copyright (C) 2018 Sergi Granell | |
+ * | |
+ * | |
+ * This file is licensed under the terms of the GNU General Public | |
+ * License version 2. This program is licensed "as is" without any | |
+ * warranty of any kind, whether express or implied. | |
+ */ | |
+ | |
+#include <linux/init.h> | |
+ | |
+#include <asm/mach/arch.h> | |
+ | |
+static const char * const vita_dt_compat[] = { | |
+ "vita,vita", | |
+ NULL, | |
+}; | |
+ | |
+DT_MACHINE_START(VITA_DT, "PlayStation Vita (Device Tree Support)") | |
+ .dt_compat = vita_dt_compat, | |
+MACHINE_END | |
-- | |
2.20.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
make ARCH=arm CROSS_COMPILE=arm-linux- zImage vita.dtb -j8 | |
curl --ftp-create-dirs -T arch/arm/boot/zImage ftp://$PSVITAIP:1337/ux0:/linux/zImage | |
curl --ftp-create-dirs -T arch/arm/boot/dts/vita.dtb ftp://$PSVITAIP:1337/ux0:/linux/vita.dtb | |
echo "Sent!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment