mirror of
https://github.com/ps5-linux/ps5-linux-patches.git
synced 2026-07-16 10:10:38 +00:00
Compare commits
7 Commits
v1.1
...
kernel-7.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d44cfeb934 | ||
|
|
99e816eccb | ||
|
|
f2c40a90d5 | ||
|
|
042599e9f5 | ||
|
|
fe852d3cdb | ||
|
|
3da1ba3610 | ||
|
|
874c43ebb6 |
2
.config
2
.config
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 7.0.5 Kernel Configuration
|
||||
# Linux/x86 7.0.8 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
|
||||
93
.github/workflows/build-kernel.yml
vendored
Normal file
93
.github/workflows/build-kernel.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: Build Kernel
|
||||
run-name: Build Kernel
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
format:
|
||||
description: 'Package format'
|
||||
default: 'all'
|
||||
type: choice
|
||||
options: [deb, arch, all]
|
||||
patches_ref:
|
||||
description: 'Patches branch/tag/SHA (empty = default)'
|
||||
default: ''
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
patches_ref:
|
||||
type: string
|
||||
default: ''
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
CCACHE_DIR: /home/opc/ccache
|
||||
|
||||
steps:
|
||||
- name: Checkout image builder
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: ps5-linux/ps5-linux-image
|
||||
path: image
|
||||
ref: main
|
||||
|
||||
- name: Build kernel
|
||||
run: |
|
||||
FORMAT="${{ inputs.format || github.event.client_payload.format || 'all' }}"
|
||||
PATCHES_REF="${{ inputs.patches_ref || '' }}"
|
||||
bash image/build_image.sh --kernel-only \
|
||||
--distro "$FORMAT" \
|
||||
--patches-ref "$PATCHES_REF"
|
||||
|
||||
- name: Read kernel and patches version
|
||||
id: version
|
||||
run: |
|
||||
psha=$(git -C image/work/ps5-linux-patches rev-parse --short HEAD)
|
||||
kver=$(cat image/linux-bin/VERSION)
|
||||
ts=$(date -u +%Y%m%d-%H%M%S)
|
||||
echo "kver=$kver" >> "$GITHUB_OUTPUT"
|
||||
echo "psha=$psha" >> "$GITHUB_OUTPUT"
|
||||
echo "ts=$ts" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: kernel-${{ steps.version.outputs.kver }}-${{ steps.version.outputs.psha }}
|
||||
path: |
|
||||
image/linux-bin/*.deb
|
||||
image/linux-bin/*.pkg.tar.zst
|
||||
retention-days: 7
|
||||
|
||||
- name: Compute checksums
|
||||
id: sha
|
||||
run: |
|
||||
{
|
||||
echo 'sums<<SHAEOF'
|
||||
sha256sum image/linux-bin/*.deb image/linux-bin/*.pkg.tar.zst | sed 's|image/linux-bin/||'
|
||||
echo 'SHAEOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create or update release
|
||||
if: github.event_name != 'pull_request' && github.event_name != 'pull_request_target'
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag_name: kernel-${{ steps.version.outputs.kver }}-${{ steps.version.outputs.psha }}
|
||||
name: Kernel ${{ steps.version.outputs.kver }} (${{ steps.version.outputs.psha }})
|
||||
body: |
|
||||
PS5 Linux kernel packages for **${{ steps.version.outputs.kver }}**.
|
||||
|
||||
Patches: [`${{ steps.version.outputs.psha }}`](https://github.com/ps5-linux/ps5-linux-patches/commit/${{ steps.version.outputs.psha }})
|
||||
|
||||
```
|
||||
${{ steps.sha.outputs.sums }}
|
||||
```
|
||||
files: |
|
||||
image/linux-bin/*.deb
|
||||
image/linux-bin/*.pkg.tar.zst
|
||||
make_latest: true
|
||||
19
.github/workflows/trigger-build.yml
vendored
Normal file
19
.github/workflows/trigger-build.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request_target:
|
||||
types: [labeled]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
kernel:
|
||||
if: github.event.label.name == 'run-ci' || github.event_name != 'pull_request_target'
|
||||
permissions:
|
||||
contents: write
|
||||
uses: ./.github/workflows/build-kernel.yml
|
||||
with:
|
||||
patches_ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
secrets: inherit
|
||||
@@ -30,8 +30,6 @@ sudo mkinitcpio -k "$(make kernelrelease)" -g /boot/initrd.img-$(make kernelrele
|
||||
If you are updating Linux on your external USB SSD or if you are directly booting into M.2 SSD, i.e. if you use `-m2` in `cmdline.txt`, then you have to update the files on the FAT32 partition of your USB drive:
|
||||
|
||||
```bash
|
||||
sudo mv /boot/efi/bzImage /boot/efi/bzImage.old
|
||||
sudo mv /boot/efi/initrd.img /boot/efi/initrd.img.old
|
||||
sudo cp /boot/vmlinuz /boot/efi/bzImage
|
||||
sudo cp /boot/initrd.img /boot/efi/initrd.img
|
||||
```
|
||||
@@ -44,7 +42,6 @@ If you are updating Linux on your M.2 SSD, but you do not directly boot into it,
|
||||
- amdgpu smu driver to show correct gpu frequency and temperature
|
||||
- ethernet driver for (mediatek?) 0x104d:0x9104
|
||||
- xhci driver adjustment for 0x104d:0x9108 to enable bluetooth
|
||||
- wlan driver marvell 1b4b:2b56 (https://github.com/nxp-imx/mwifiex)
|
||||
- hdmi converter improvments: hdr, rgb range, 120hz
|
||||
|
||||
## Bugs
|
||||
|
||||
417
linux.patch
417
linux.patch
@@ -18,7 +18,7 @@ index fe106da41ae5..6fd78cbfe1d6 100644
|
||||
bool "ScaleMP vSMP"
|
||||
select HYPERVISOR_GUEST
|
||||
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
|
||||
index 92bb6b2f778e..0a02f339b98a 100644
|
||||
index 4efbbf9d117b..403d5ff74ef0 100644
|
||||
--- a/arch/x86/include/asm/msr-index.h
|
||||
+++ b/arch/x86/include/asm/msr-index.h
|
||||
@@ -26,6 +26,7 @@
|
||||
@@ -1143,7 +1143,7 @@ index 000000000000..7acb030a4976
|
||||
+obj-y += spcie.o tpcie.o hdmi.o mp1.o
|
||||
diff --git a/drivers/ps5/hdmi.c b/drivers/ps5/hdmi.c
|
||||
new file mode 100644
|
||||
index 000000000000..a24459de573a
|
||||
index 000000000000..78ffc4f80a6d
|
||||
--- /dev/null
|
||||
+++ b/drivers/ps5/hdmi.c
|
||||
@@ -0,0 +1,1237 @@
|
||||
@@ -2026,8 +2026,8 @@ index 000000000000..a24459de573a
|
||||
+
|
||||
+static void setHdmiVideoConfigFlava3(const struct drm_display_mode *mode)
|
||||
+{
|
||||
+ configParamFlava3Pre();
|
||||
+ configLinkTrainingFlava3();
|
||||
+ // configParamFlava3Pre();
|
||||
+ // configLinkTrainingFlava3();
|
||||
+ setHdmiBasicVideoConfigFlava3(mode);
|
||||
+ initHdmiPhyForFlava3_1st();
|
||||
+ initHdmiPhyForFlava3_2nd();
|
||||
@@ -2386,10 +2386,10 @@ index 000000000000..a24459de573a
|
||||
+EXPORT_SYMBOL(hdmi_notification_handler);
|
||||
diff --git a/drivers/ps5/mp1.c b/drivers/ps5/mp1.c
|
||||
new file mode 100644
|
||||
index 000000000000..73bb7ca5d1d9
|
||||
index 000000000000..4af890c842a7
|
||||
--- /dev/null
|
||||
+++ b/drivers/ps5/mp1.c
|
||||
@@ -0,0 +1,366 @@
|
||||
@@ -0,0 +1,488 @@
|
||||
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
@@ -2421,9 +2421,12 @@ index 000000000000..73bb7ca5d1d9
|
||||
+#define MP1_C2PMSG_58 0x3b109e8
|
||||
+#define MP1_C2PMSG_59 0x3b109ec
|
||||
+#define MP1_C2PMSG_66 0x3b10a08
|
||||
+#define MP1_C2PMSG_72 0x3b10a20
|
||||
+#define MP1_C2PMSG_81 0x3b10a44
|
||||
+#define MP1_C2PMSG_82 0x3b10a48
|
||||
+#define MP1_C2PMSG_90 0x3b10a68
|
||||
+#define MP1_C2PMSG_96 0x3b10a80
|
||||
+#define MP1_C2PMSG_98 0x3b10a88
|
||||
+
|
||||
+#define PPSMC_MSG_ConfigureS3PwrOffRegisterAddressHigh 0x16
|
||||
+#define PPSMC_MSG_ConfigureS3PwrOffRegisterAddressLow 0x17
|
||||
@@ -2518,6 +2521,78 @@ index 000000000000..73bb7ca5d1d9
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static const struct bapm_param_set bapm_param_set_2 = {
|
||||
+ .dpm_wac = {
|
||||
+ 0x0000c3adb08d0000, 0x00a800008d000000, 0xa000008e000000a6,
|
||||
+ 0x00000000c900a500, 0xc8d000d3b8daea00, 0x0000d000a3d200dc,
|
||||
+ 0x00bfc80000c6f100, 0x00fe00000000ad00, 0x0000abb300000000,
|
||||
+ 0x00008600000000cf, 0x00ae0095ff000000, 0x000000000000ac00,
|
||||
+ 0x00b00000008500ad, 0x0098849600b18000, 0xa2a38bac00b00000,
|
||||
+ 0x97007479000092ab, 0x0095a30000008f00, 0x000000b5000000a0,
|
||||
+ 0x0000c200a80000bd, 0x0000bcc1c4b2a300, 0xa700000000000000
|
||||
+ },
|
||||
+ .l3_cacw = {
|
||||
+ [71] = 0x3ff80000,
|
||||
+ },
|
||||
+ .gfx_cacw = {
|
||||
+ [2] = 0xefa,
|
||||
+ [6] = 0x7bf,
|
||||
+ [12] = 0x14d10000,
|
||||
+ [14] = 0x287b0000,
|
||||
+ [20] = 0x2f2,
|
||||
+ [22] = 0x1085ffff, 0xcd80e51, 0x4b86145a,
|
||||
+ [27] = 0x15a7,
|
||||
+ [29] = 0x13c2, 0x2d02,
|
||||
+ [34] = 0x78ad0000, 0x2ea0,
|
||||
+ [54] = 0x257d, 0x8c8,
|
||||
+ [58] = 0x799e,
|
||||
+ [63] = 0x152,
|
||||
+ },
|
||||
+ .gfx_cacw_len = 64,
|
||||
+ .bapm_param = {
|
||||
+ {1, 0xbc22f028}, {1, 0x3e113314}, {1, 0xbe8d0750}, {1, 0x3e16ae78},
|
||||
+ {1, 0xbe4d4746}, {1, 0x3f34470b}, {1, 0x3704564c}, {1, 0x3f516a34},
|
||||
+ {1, 0x3f3fdd1c}, {1, 0x3f74f5de}, {1, 0x3dec9763}, {1, 0xbc2c0ab6},
|
||||
+ {1, 0x3d1582c2}, {1, 0x367468e6}, {1, 0x3f059935}, {1, 0x3ef4cd95},
|
||||
+ {1, 0x3f74f5de}, {1, 0x3d524dae}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2},
|
||||
+ {1, 0x357db71b}, {1, 0x40b1089a}, {1, 0x41751b15}, {1, 0x4287d1bc},
|
||||
+ {1, 0x3fb89949}, {1, 0x411eefdf}, {1, 0xbc816b59}, {1, 0x3d41513a},
|
||||
+ [49] =
|
||||
+ {1, 0x41751b15}, {1, 0x4287d1bc}, {1, 0x3fb89949}, {1, 0x412d973c},
|
||||
+ {1, 0xbc816b59}, {1, 0x3d41513a}, {1, 0x3e0654c8}, {1, 0xbe27b465},
|
||||
+ {1, 0x3f2d3daa}, {1, 0x41751b15}, {1, 0x4287d1bc}, {1, 0x3fb89949},
|
||||
+ {1, 0x4061d4cc}, {1, 0xbc816b59}, {1, 0x3d41513a}, {1, 0x3e97c980},
|
||||
+ {1, 0xbf1d9856}, {1, 0x3f828e45}, {1, 0x41751b15}, {1, 0x4287d1bc},
|
||||
+ {1, 0x3fb89949}, {1, 0x409c4b3c}, {1, 0xbc816b59}, {1, 0x3d41513a},
|
||||
+ {1, 0x3e7a6107}, {1, 0xbeedd766}, {1, 0x3f67aa70}, {1, 0x41751b15},
|
||||
+ {1, 0x4287d1bc}, {1, 0x3fb89949}, {1, 0x40ccf558}, {1, 0xbc816b59},
|
||||
+ {1, 0x3d41513a}, {1, 0x3e600a8a}, {1, 0xbecbe79c}, {1, 0x3f5b627c},
|
||||
+ {1, 0x41751b15}, {1, 0x4287d1bc}, {1, 0x3fb89949}, {1, 0x41050555},
|
||||
+ {1, 0xbc816b59}, {1, 0x3d41513a}, {1, 0x3e379205}, {1, 0xbe94367e},
|
||||
+ {1, 0x3f46233f}, {1, 0x3f96c5af}, {1, 0x3eb99add}, {1, 0x3f85bb54},
|
||||
+ {1, 0x3e6a30f6}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2}, {1, 0xbbda394d},
|
||||
+ {1, 0x3dff4eb1}, {1, 0xbe8b186c}, {1, 0x3f8fbf3f}, {1, 0x3ee87500},
|
||||
+ {1, 0x3f7c5aff}, {1, 0x3e92470e}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2},
|
||||
+ {1, 0x396640ab}, {1, 0x3dad4b04}, {1, 0xbe6283c5}, {1, 0x3f8051ba},
|
||||
+ {1, 0x3f13f766}, {1, 0x3f87a42b}, {1, 0x3e52acf5}, {1, 0xbc2c0ab6},
|
||||
+ {1, 0x3d1582c2}, {1, 0xbbd8e837}, {1, 0x3e005ec6}, {1, 0xbe8c6197},
|
||||
+ {1, 0x3f61d86e}, {1, 0x3f276f79}, {1, 0x3f7b0bf0}, {1, 0x3e25ca59},
|
||||
+ {1, 0xbc2c0ab6}, {1, 0x3d1582c2}, {1, 0xbbc01a0e}, {1, 0x3dfb13b3},
|
||||
+ {1, 0xbe84dd83}, {1, 0x3fa32142}, {1, 0x3ea341fd}, {1, 0x3f85d724},
|
||||
+ {1, 0x3e8c3c1d}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2}, {1, 0xbaa01624},
|
||||
+ {1, 0x3dbebfaf}, {1, 0xbe6f57f4}, {1, 0x3f43c147}, {1, 0x3e70fae5},
|
||||
+ {1, 0x3f85bb54}, {1, 0x3dd02b85}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2},
|
||||
+ {1, 0x3f364cb6}, {1, 0x3e936695}, {1, 0x3f7c5aff}, {1, 0x3e020645},
|
||||
+ {1, 0xbc2c0ab6}, {1, 0x3d1582c2}, {1, 0x3f226119}, {1, 0x3ebb3dcd},
|
||||
+ {1, 0x3f87a42b}, {1, 0x3dbb4468}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2},
|
||||
+ {1, 0x3f1302b3}, {1, 0x3ed9fa9b}, {1, 0x3f7b0bf0}, {1, 0x3d935e88},
|
||||
+ {1, 0xbc2c0ab6}, {1, 0x3d1582c2}, {1, 0x3f4cc495}, {1, 0x3e4cedab},
|
||||
+ {1, 0x3f85d724}, {1, 0x3df94e6d}, {1, 0xbc2c0ab6}, {1, 0x3d1582c2},
|
||||
+ {1, 0x3c437be5}, {1, 0x3f3de47f}, {1, 0x3f40c129}, {1, 0x3f3cc9e7},
|
||||
+ {1, 0x3f41350f}, {1, 0x3f3dcec6}, {1, 0x3f3e1c51}
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static u32 pcirc_smn_read(u32 reg)
|
||||
+{
|
||||
+ u32 val = 0;
|
||||
@@ -2584,6 +2659,48 @@ index 000000000000..73bb7ca5d1d9
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mp1fw_test_sendmsg(struct mp1_msg *msg, uint8_t msgid)
|
||||
+{
|
||||
+ if (mp1fw_waitmsg(MP1_C2PMSG_96, msgid)) {
|
||||
+ printk("[MP1ERROR] : %s: Error : busy msgid=0x%X, arg=0x%08X\n", __func__, msgid, msg->arg);
|
||||
+ return -EBUSY;
|
||||
+ }
|
||||
+ pcirc_smn_write(MP1_C2PMSG_96, 0);
|
||||
+ pcirc_smn_write(MP1_C2PMSG_98, msg->arg);
|
||||
+ pcirc_smn_write(MP1_C2PMSG_72, msgid);
|
||||
+ if (mp1fw_waitmsg(MP1_C2PMSG_96, msgid)) {
|
||||
+ printk("[MP1ERROR] : %s: retry over msgid=0x%X, arg=0x%08X\n", __func__, msgid, msg->arg);
|
||||
+ return -EBUSY;
|
||||
+ }
|
||||
+ u32 resp = pcirc_smn_read(MP1_C2PMSG_96);
|
||||
+ u32 resp_val = pcirc_smn_read(MP1_C2PMSG_98);
|
||||
+ if ((msgid != 0x75 && resp != 1) || (msgid == 0x75 && resp != 1 && resp != 0xf8)) {
|
||||
+ printk("[MP1ERROR] : %s: invalid response msgid=0x%X, resp=0x%08X\n", __func__, msgid, resp);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ msg->resp = resp;
|
||||
+ msg->resp_val = resp_val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mp1_set_wc_cpu(int mode)
|
||||
+{
|
||||
+ struct mp1_msg msg = {};
|
||||
+ msg.arg = mode;
|
||||
+ return mp1fw_test_sendmsg(&msg, 0x9b);
|
||||
+}
|
||||
+
|
||||
+static int mp1_get_wc_cpu(int *mode)
|
||||
+{
|
||||
+ struct mp1_msg msg = {};
|
||||
+ int ret;
|
||||
+ ret = mp1fw_test_sendmsg(&msg, 0x9c);
|
||||
+ *mode = msg.resp_val;
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int mp1_configure_s3_pwr_off_reg_addr_high(u64 addr)
|
||||
+{
|
||||
+ struct mp1_msg msg = {};
|
||||
@@ -2669,7 +2786,7 @@ index 000000000000..73bb7ca5d1d9
|
||||
+
|
||||
+ for (i = 0; i < 21; i++) {
|
||||
+ wrmsrq(MSR_DPM_WAC_ACC_INDEX, i);
|
||||
+ wrmsrq(MSR_DPM_WAC_DATA, bapm_param_set_1.dpm_wac[i]);
|
||||
+ wrmsrq(MSR_DPM_WAC_DATA, bapm_param_set_2.dpm_wac[i]);
|
||||
+ }
|
||||
+
|
||||
+ wrmsrq(MSR_DPM_CFG, msr_dpm_cfg);
|
||||
@@ -2682,16 +2799,16 @@ index 000000000000..73bb7ca5d1d9
|
||||
+ on_each_cpu(update_bapm_weights_smp, NULL, 1);
|
||||
+
|
||||
+ for (i = 0; i < 80; i++) {
|
||||
+ mp1_bapm_set_l3_cacw(i, bapm_param_set_1.l3_cacw[i]);
|
||||
+ mp1_bapm_set_l3_cacw(i, bapm_param_set_2.l3_cacw[i]);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < bapm_param_set_1.gfx_cacw_len; i++) {
|
||||
+ mp1_bapm_set_gfx_cacw(i, bapm_param_set_1.gfx_cacw[i]);
|
||||
+ for (i = 0; i < bapm_param_set_2.gfx_cacw_len; i++) {
|
||||
+ mp1_bapm_set_gfx_cacw(i, bapm_param_set_2.gfx_cacw[i]);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 176; i++) {
|
||||
+ if (bapm_param_set_1.bapm_param[i][0])
|
||||
+ mp1_bapm_write_param(i, bapm_param_set_1.bapm_param[i][1]);
|
||||
+ if (bapm_param_set_2.bapm_param[i][0])
|
||||
+ mp1_bapm_write_param(i, bapm_param_set_2.bapm_param[i][1]);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
@@ -2731,10 +2848,15 @@ index 000000000000..73bb7ca5d1d9
|
||||
+static int __init mp1_init(void)
|
||||
+{
|
||||
+ int ret;
|
||||
+ int mode = 0;
|
||||
+
|
||||
+ mp1_universal_mode_exit();
|
||||
+
|
||||
+ pr_info("Set BAPM params\n");
|
||||
+ mp1_get_wc_cpu(&mode);
|
||||
+ if (mode != 1) {
|
||||
+ mp1_set_wc_cpu(1);
|
||||
+ }
|
||||
+ mp1_set_bapm_param_set_all();
|
||||
+
|
||||
+ ret = misc_register(&mp1_misc_device);
|
||||
@@ -2758,10 +2880,10 @@ index 000000000000..73bb7ca5d1d9
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff --git a/drivers/ps5/spcie.c b/drivers/ps5/spcie.c
|
||||
new file mode 100644
|
||||
index 000000000000..eca41996f4a1
|
||||
index 000000000000..d13dc14c0a14
|
||||
--- /dev/null
|
||||
+++ b/drivers/ps5/spcie.c
|
||||
@@ -0,0 +1,678 @@
|
||||
@@ -0,0 +1,898 @@
|
||||
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
@@ -2770,6 +2892,7 @@ index 000000000000..eca41996f4a1
|
||||
+#include <linux/pci.h>
|
||||
+#include <linux/ps5.h>
|
||||
+#include <linux/dmi.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#define PCI_DEVICE_ID_SPCIE 0x9107
|
||||
+#define SPCIE_SUBFUNC_ICC 12
|
||||
@@ -2821,13 +2944,16 @@ index 000000000000..eca41996f4a1
|
||||
+
|
||||
+struct spcie_dev {
|
||||
+ struct pci_dev *pdev;
|
||||
+ void __iomem *bar2;
|
||||
+ void __iomem *bar4;
|
||||
+ struct spcie_icc_dev *icc_dev;
|
||||
+ void __iomem *bar2;
|
||||
+ void __iomem *pervasive0;
|
||||
+};
|
||||
+
|
||||
+static struct spcie_dev *sdev;
|
||||
+static struct spcie_icc_dev *icc_dev;
|
||||
+
|
||||
+static u32 spcie_chip_revision_id = 0;
|
||||
+
|
||||
+static u8 indicator_white_dim[] = {
|
||||
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x11,
|
||||
+ 0x01, 0x00, 0x20, 0x00, 0x01, 0x00, 0x12, 0x01, 0x00, 0x00, 0x00, 0x02,
|
||||
@@ -3318,7 +3444,7 @@ index 000000000000..eca41996f4a1
|
||||
+ init_waitqueue_head(&icc_dev->wq);
|
||||
+
|
||||
+ icc_dev->icc_doorbell_base = sdev->bar2 + ICC_DOORBELL_OFFSET;
|
||||
+ icc_dev->icc_base = sdev->bar4;
|
||||
+ icc_dev->icc_base = sdev->pervasive0;
|
||||
+
|
||||
+ ret = spcie_power_button_init(icc_dev);
|
||||
+ if (ret)
|
||||
@@ -3374,9 +3500,179 @@ index 000000000000..eca41996f4a1
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int spcie_icc_shutdown(struct spcie_dev *sdev)
|
||||
+{
|
||||
+ icc_fan_change_servo_pattern(0);
|
||||
+
|
||||
+ /* Disable IRQs */
|
||||
+ writel(0, icc_dev->icc_doorbell_base + ICC_REG_INTR_MASK);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+u32 spcie_get_chip_id(void)
|
||||
+{
|
||||
+ return spcie_chip_revision_id & 0xff0000;
|
||||
+}
|
||||
+EXPORT_SYMBOL(spcie_get_chip_id);
|
||||
+
|
||||
+u32 spcie_get_revision_id(void)
|
||||
+{
|
||||
+ return spcie_chip_revision_id & 0xffff;
|
||||
+}
|
||||
+EXPORT_SYMBOL(spcie_get_revision_id);
|
||||
+
|
||||
+u32 spcie_bar2_180000_read(u32 reg)
|
||||
+{
|
||||
+ return readl(sdev->bar2 + 0x180000 + reg);
|
||||
+}
|
||||
+EXPORT_SYMBOL(spcie_bar2_180000_read);
|
||||
+
|
||||
+void spcie_bar2_180000_write(u32 reg, u32 val)
|
||||
+{
|
||||
+ writel(val, sdev->bar2 + 0x180000 + reg);
|
||||
+}
|
||||
+EXPORT_SYMBOL(spcie_bar2_180000_write);
|
||||
+
|
||||
+u32 spcie_pervasive0_4000_read(u32 reg)
|
||||
+{
|
||||
+ return readl(sdev->pervasive0 + 0x4000 + reg);
|
||||
+}
|
||||
+EXPORT_SYMBOL(spcie_pervasive0_4000_read);
|
||||
+
|
||||
+static int spcie_init_dev(struct spcie_dev *sdev, int dev_ip)
|
||||
+{
|
||||
+ void __iomem *bar;
|
||||
+ u32 offset0, offset1, offset2;
|
||||
+ u32 val;
|
||||
+ int retries = 10000;
|
||||
+
|
||||
+ switch (dev_ip) {
|
||||
+ case 0:
|
||||
+ bar = sdev->bar2;
|
||||
+ offset0 = 0x142020;
|
||||
+ offset1 = 0x142028;
|
||||
+ offset2 = 0x180020;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ bar = sdev->bar2;
|
||||
+ offset0 = 0x143820;
|
||||
+ offset1 = 0x143828;
|
||||
+ offset2 = 0x18002c;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ bar = sdev->bar2;
|
||||
+ offset0 = 0x144820;
|
||||
+ offset1 = 0x144828;
|
||||
+ offset2 = 0x180030;
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ bar = sdev->bar2;
|
||||
+ offset0 = 0x144020;
|
||||
+ offset1 = 0x144028;
|
||||
+ offset2 = 0x180024;
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ bar = sdev->pervasive0;
|
||||
+ offset0 = 0x42420;
|
||||
+ offset1 = 0x42428;
|
||||
+ offset2 = 0x7010;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ writel(readl(bar + offset0) | 0x10, bar + offset0);
|
||||
+
|
||||
+ while (1) {
|
||||
+ val = readl(bar + offset1);
|
||||
+ if ((val & 0x10) == 0 && (val & 0x20) == 0 && (val & 0x40) == 0 && (val & 0x80) == 0)
|
||||
+ break;
|
||||
+ udelay(10);
|
||||
+ if (!--retries) {
|
||||
+ printk("[ERROR]: cannot stop the transaction(%X): %X\n", offset0, val);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ writel(readl(bar + offset0) | 0x1, bar + offset0);
|
||||
+
|
||||
+ if (dev_ip == 4) {
|
||||
+ writel(1, sdev->pervasive0 + offset2);
|
||||
+ writel(3, sdev->pervasive0 + 0x74b4);
|
||||
+ } else {
|
||||
+ writel(3, sdev->bar2 + offset2);
|
||||
+
|
||||
+ switch (dev_ip) {
|
||||
+ case 0:
|
||||
+ writel(1, sdev->pervasive0 + 0x74c8);
|
||||
+ writel(0x1f, sdev->pervasive0 + 0x7c28);
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ writel(3, sdev->pervasive0 + 0x74c4);
|
||||
+ writel(7, sdev->pervasive0 + 0x7c14);
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ writel(3, sdev->pervasive0 + 0x7498);
|
||||
+ writel(7, sdev->pervasive0 + 0x7c18);
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ if (spcie_get_chip_id() == 0x110000) {
|
||||
+ writel(7, sdev->pervasive0 + 0x74cc);
|
||||
+ } else {
|
||||
+ writel(1, sdev->pervasive0 + 0x74cc);
|
||||
+ }
|
||||
+ writel(0xf, sdev->pervasive0 + 0x7c1c);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ writel(readl(bar + offset0) & ~0x11, bar + offset0);
|
||||
+
|
||||
+ if (dev_ip == 4) {
|
||||
+ writel(0, sdev->pervasive0 + offset2);
|
||||
+ } else if (dev_ip == 0) {
|
||||
+ writel(0, sdev->bar2 + offset2);
|
||||
+
|
||||
+ writel(readl(sdev->pervasive0 + 0x7c28) & ~8, sdev->pervasive0 + 0x7c28);
|
||||
+ writel(readl(sdev->pervasive0 + 0x7c28) & ~1, sdev->pervasive0 + 0x7c28);
|
||||
+
|
||||
+ writel(1, sdev->bar2 + offset2);
|
||||
+ writel(0, sdev->bar2 + offset2);
|
||||
+
|
||||
+ writel(readl(sdev->pervasive0 + 0x7c28) | 8, sdev->pervasive0 + 0x7c28);
|
||||
+ writel(readl(sdev->pervasive0 + 0x7c28) | 1, sdev->pervasive0 + 0x7c28);
|
||||
+
|
||||
+ udelay(680);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int spcie_init(struct spcie_dev *sdev)
|
||||
+{
|
||||
+ writel(1, sdev->pervasive0 + 0x22004);
|
||||
+ while ((readl(sdev->pervasive0 + 0x22000) & 7) != 4);
|
||||
+
|
||||
+ spcie_init_dev(sdev, 0);
|
||||
+ if (spcie_get_chip_id() == 0x110000)
|
||||
+ spcie_init_dev(sdev, 1);
|
||||
+ spcie_init_dev(sdev, 2);
|
||||
+ spcie_init_dev(sdev, 3);
|
||||
+ spcie_init_dev(sdev, 4);
|
||||
+
|
||||
+ writel(1, sdev->bar2 + 0x18004c);
|
||||
+ writel(1, sdev->pervasive0 + 0x7c08);
|
||||
+
|
||||
+ writel(0, sdev->bar2 + 0x18004c);
|
||||
+ writel(0, sdev->pervasive0 + 0x22004);
|
||||
+ while ((readl(sdev->pervasive0 + 0x22000) & 4) != 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int spcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
+{
|
||||
+ struct spcie_dev *sdev;
|
||||
+ u32 chip_revision, chip_id0, chip_id1;
|
||||
+ char *chip_name, *rev_name;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = pcim_enable_device(pdev);
|
||||
@@ -3393,12 +3689,49 @@ index 000000000000..eca41996f4a1
|
||||
+ if (!sdev->bar2)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ sdev->bar4 = pcim_iomap(pdev, 4, 0);
|
||||
+ if (!sdev->bar4)
|
||||
+ sdev->pervasive0 = pcim_iomap(pdev, 4, 0);
|
||||
+ if (!sdev->pervasive0)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ pci_set_master(pdev);
|
||||
+
|
||||
+ chip_revision = readl(sdev->pervasive0 + 0x4000);
|
||||
+ dev_info(&sdev->pdev->dev, "Chip revision: %08x\n", chip_revision);
|
||||
+
|
||||
+ chip_id0 = readl(sdev->pervasive0 + 0x4008);
|
||||
+ dev_info(&sdev->pdev->dev, "Chip ID0: %08x\n", chip_id0);
|
||||
+
|
||||
+ chip_id1 = readl(sdev->pervasive0 + 0x4004);
|
||||
+ dev_info(&sdev->pdev->dev, "Chip ID1: %08x\n", chip_id1);
|
||||
+
|
||||
+ if ((chip_revision & 0xff000000) == 0x11000000) {
|
||||
+ chip_name = "Salina";
|
||||
+ spcie_chip_revision_id = 0x110000;
|
||||
+ } else if ((chip_revision & 0xff000000) == 0x12000000) {
|
||||
+ chip_name = "Salina2";
|
||||
+ spcie_chip_revision_id = 0x120000;
|
||||
+ } else {
|
||||
+ panic("unknown subsys %08x\n", chip_revision);
|
||||
+ }
|
||||
+
|
||||
+ switch (chip_revision & 0xffff) {
|
||||
+ case 0x100: rev_name = "A0"; break;
|
||||
+ case 0x101: rev_name = "A1"; break;
|
||||
+ case 0x200: rev_name = "B0"; break;
|
||||
+ case 0x201: rev_name = "B1"; break;
|
||||
+ case 0x300: rev_name = "C0"; break;
|
||||
+ default:
|
||||
+ panic("unknown subsys %08x\n", chip_revision);
|
||||
+ }
|
||||
+
|
||||
+ spcie_chip_revision_id |= (chip_revision & 0xffff);
|
||||
+
|
||||
+ dev_info(&sdev->pdev->dev, "%s %s\n", chip_name, rev_name);
|
||||
+
|
||||
+ ret = spcie_init(sdev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = pci_alloc_irq_vectors(pdev, NUM_IRQS, NUM_IRQS, PCI_IRQ_MSI);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
@@ -3422,6 +3755,14 @@ index 000000000000..eca41996f4a1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void spcie_shutdown(struct pci_dev *pdev)
|
||||
+{
|
||||
+ struct spcie_dev *sdev = pci_get_drvdata(pdev);
|
||||
+ if (sdev) {
|
||||
+ spcie_icc_shutdown(sdev);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const struct pci_device_id spcie_ids[] = {
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_SONY, PCI_DEVICE_ID_SPCIE) },
|
||||
+ { 0, }
|
||||
@@ -3433,6 +3774,7 @@ index 000000000000..eca41996f4a1
|
||||
+ .id_table = spcie_ids,
|
||||
+ .probe = spcie_probe,
|
||||
+ .remove = spcie_remove,
|
||||
+ .shutdown = spcie_shutdown,
|
||||
+};
|
||||
+
|
||||
+module_pci_driver(spcie_driver);
|
||||
@@ -3442,10 +3784,10 @@ index 000000000000..eca41996f4a1
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff --git a/drivers/ps5/tpcie.c b/drivers/ps5/tpcie.c
|
||||
new file mode 100644
|
||||
index 000000000000..cfe53c9861c1
|
||||
index 000000000000..23de43ea4b00
|
||||
--- /dev/null
|
||||
+++ b/drivers/ps5/tpcie.c
|
||||
@@ -0,0 +1,294 @@
|
||||
@@ -0,0 +1,303 @@
|
||||
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
+
|
||||
+#include <linux/console.h>
|
||||
@@ -3660,12 +4002,6 @@ index 000000000000..cfe53c9861c1
|
||||
+
|
||||
+static void tpcie_uart_remove(struct tpcie_dev *tdev)
|
||||
+{
|
||||
+ if (!uart_dev)
|
||||
+ return;
|
||||
+
|
||||
+ /* Disable IRQs */
|
||||
+ writel(0, uart_dev->uart_base + 0x8);
|
||||
+
|
||||
+ unregister_console(&tpcie_uart_console);
|
||||
+
|
||||
+ if (uart_dev->tty_drv) {
|
||||
@@ -3676,6 +4012,12 @@ index 000000000000..cfe53c9861c1
|
||||
+ tty_port_destroy(&uart_dev->tty_port);
|
||||
+}
|
||||
+
|
||||
+static void tpcie_uart_shutdown(struct tpcie_dev *tdev)
|
||||
+{
|
||||
+ /* Disable IRQs */
|
||||
+ writel(0, uart_dev->uart_base + 0x8);
|
||||
+}
|
||||
+
|
||||
+static int tpcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
+{
|
||||
+ struct tpcie_dev *tdev;
|
||||
@@ -3722,6 +4064,14 @@ index 000000000000..cfe53c9861c1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void tpcie_shutdown(struct pci_dev *pdev)
|
||||
+{
|
||||
+ struct tpcie_dev *tdev = pci_get_drvdata(pdev);
|
||||
+ if (tdev) {
|
||||
+ tpcie_uart_shutdown(tdev);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const struct pci_device_id tpcie_ids[] = {
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_SONY, PCI_DEVICE_ID_TPCIE) },
|
||||
+ { 0, }
|
||||
@@ -3733,6 +4083,7 @@ index 000000000000..cfe53c9861c1
|
||||
+ .id_table = tpcie_ids,
|
||||
+ .probe = tpcie_probe,
|
||||
+ .remove = tpcie_remove,
|
||||
+ .shutdown = tpcie_shutdown,
|
||||
+};
|
||||
+
|
||||
+module_pci_driver(tpcie_driver);
|
||||
@@ -3756,10 +4107,10 @@ index 927f8a8b7a1d..474f1207e2f3 100644
|
||||
extern void dmi_setup(void);
|
||||
diff --git a/include/linux/ps5.h b/include/linux/ps5.h
|
||||
new file mode 100644
|
||||
index 000000000000..cbbab4044922
|
||||
index 000000000000..35ef3d05525b
|
||||
--- /dev/null
|
||||
+++ b/include/linux/ps5.h
|
||||
@@ -0,0 +1,80 @@
|
||||
@@ -0,0 +1,86 @@
|
||||
+#ifndef _LINUX_PS5_H
|
||||
+#define _LINUX_PS5_H
|
||||
+
|
||||
@@ -3802,6 +4153,12 @@ index 000000000000..cbbab4044922
|
||||
+ ICC_SERVICE_ID_FLOYD = 0x9a,
|
||||
+};
|
||||
+
|
||||
+u32 spcie_get_chip_id(void);
|
||||
+u32 spcie_get_revision_id(void);
|
||||
+u32 spcie_bar2_180000_read(u32 reg);
|
||||
+void spcie_bar2_180000_write(u32 reg, u32 val);
|
||||
+u32 spcie_pervasive0_4000_read(u32 reg);
|
||||
+
|
||||
+int icc_query(u8 *query, u8 *reply);
|
||||
+
|
||||
+void hdmiSystemResume(void);
|
||||
|
||||
Reference in New Issue
Block a user