mirror of
https://abf.rosa.ru/djam/kernel-5.15.git
synced 2025-02-23 10:32:54 +00:00

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
87 lines
2.4 KiB
Diff
87 lines
2.4 KiB
Diff
From bb4383c2491f602cb87e619418cbff9c32a0f0ac Mon Sep 17 00:00:00 2001
|
|
From: Alexey Sheplyakov <asheplyakov@altlinux.org>
|
|
Date: Thu, 3 Dec 2020 19:13:51 +0400
|
|
Subject: [PATCH 613/625] bt1-pvt: define pvt_readl/pvt_writel for BE-M1000 SoC
|
|
|
|
---
|
|
drivers/hwmon/bt1-pvt.c | 23 +++++++++++++++++++++++
|
|
drivers/hwmon/bt1-pvt.h | 8 ++++++++
|
|
2 files changed, 31 insertions(+)
|
|
|
|
diff --git a/drivers/hwmon/bt1-pvt.c b/drivers/hwmon/bt1-pvt.c
|
|
index c6749585d604..d1f66de6a2cd 100644
|
|
--- a/drivers/hwmon/bt1-pvt.c
|
|
+++ b/drivers/hwmon/bt1-pvt.c
|
|
@@ -29,6 +29,9 @@
|
|
#include <linux/seqlock.h>
|
|
#include <linux/sysfs.h>
|
|
#include <linux/types.h>
|
|
+#ifdef CONFIG_ARM64
|
|
+#include <linux/arm-smccc.h>
|
|
+#endif
|
|
|
|
#include "bt1-pvt.h"
|
|
|
|
@@ -138,6 +141,7 @@ static long pvt_calc_poly(const struct pvt_poly *poly, long data)
|
|
return ret / poly->total_divider;
|
|
}
|
|
|
|
+#ifdef BT1_PVT_DIRECT_REG_ACCESS
|
|
static inline u32 pvt_readl(struct pvt_hwmon const *pvt, int reg) {
|
|
return readl(pvt->regs + reg);
|
|
}
|
|
@@ -149,6 +153,25 @@ static inline u32 pvt_readl_relaxed(struct pvt_hwmon const *pvt, int reg) {
|
|
static inline void pvt_writel(u32 data, struct pvt_hwmon const *pvt, int reg) {
|
|
writel(data, pvt->regs + reg);
|
|
}
|
|
+#else
|
|
+static inline u32 pvt_readl(struct pvt_hwmon const *pvt, int reg) {
|
|
+ struct arm_smccc_res res;
|
|
+ arm_smccc_smc(BAIKAL_SMC_PVT_ID, PVT_READ, pvt->pvt_id, reg,
|
|
+ 0, 0, 0, 0, &res);
|
|
+ return res.a0;
|
|
+}
|
|
+
|
|
+static inline u32 pvt_readl_relaxed(struct pvt_hwmon const *pvt, int reg) {
|
|
+ return pvt_readl(pvt, reg);
|
|
+}
|
|
+
|
|
+static inline void pvt_writel(u32 data, struct pvt_hwmon const *pvt, int reg) {
|
|
+ struct arm_smccc_res res;
|
|
+ arm_smccc_smc(BAIKAL_SMC_PVT_ID, PVT_WRITE, pvt->pvt_id, reg,
|
|
+ data, 0, 0, 0, &res);
|
|
+}
|
|
+#endif
|
|
+
|
|
static inline u32 pvt_update(struct pvt_hwmon *pvt, int reg, u32 mask, u32 data)
|
|
{
|
|
u32 old;
|
|
diff --git a/drivers/hwmon/bt1-pvt.h b/drivers/hwmon/bt1-pvt.h
|
|
index 93b8dd5e7c94..0cea95b01c13 100644
|
|
--- a/drivers/hwmon/bt1-pvt.h
|
|
+++ b/drivers/hwmon/bt1-pvt.h
|
|
@@ -101,6 +101,13 @@
|
|
# define PVT_TOUT_DEF 0
|
|
#endif
|
|
|
|
+#define BAIKAL_SMC_PVT_ID 0x82000001
|
|
+#define PVT_READ 0
|
|
+#define PVT_WRITE 1
|
|
+#ifndef CONFIG_ARM64
|
|
+#define BT1_PVT_DIRECT_REG_ACCESS
|
|
+#endif
|
|
+
|
|
/*
|
|
* enum pvt_sensor_type - Baikal-T1 PVT sensor types (correspond to each PVT
|
|
* sampling mode)
|
|
@@ -217,6 +224,7 @@ struct pvt_hwmon {
|
|
enum pvt_sensor_type sensor;
|
|
struct pvt_cache cache[PVT_SENSORS_NUM];
|
|
ktime_t timeout;
|
|
+ int pvt_id;
|
|
};
|
|
|
|
/*
|
|
--
|
|
2.31.1
|
|
|