pmaports/device/community/linux-samsung-espresso3g/03-Add-clk32kg-to-twl6030-and-fix-wifi-reboot-issue.patch
Antoni Aloy Torrens e822fde276
community/linux-samsung-espresso3g: Fix WiFi reboot issue (MR 3130)
- Patch from Robert Nelson and Hansem Ro.

- Based on the work of Hansem Ro,
  who owns another device, the First Generation Kindle Fire,
  which has similar specifications as the Samsung Galaxy Tab 2 7.0.
2022-05-12 16:30:11 +01:00

104 lines
3.6 KiB
Diff

Patch picked from https://raw.githubusercontent.com/hansemro/kc1-linux/v5.16.x/patches/0006-Add-clk32kg-to-twl6030.patch
From 6418e8fe6b80d906ac5a1d3570dd92ab0e7ec3e8 Mon Sep 17 00:00:00 2001
From: Hansem Ro <hansemro@outlook.com>
Date: Wed, 12 May 2021 18:26:38 -0700
Subject: [PATCH] Add clk32kg to twl6030
Needed for wl1271/wlcore driver bringup on Kindle Fire.
Patch from Robert Nelson:
https://github.com/RobertCNelson/armv7-multiplatform/commit/27fd28715ecf47dee1f36e70faecc1243125b06d
This patch also fixes a WiFi reboot issue on Samsung Galaxy Tab 2 7.0 tablet,
see https://gitlab.com/postmarketOS/pmaports/-/issues/1211
---
arch/arm/boot/dts/twl6030.dtsi | 5 +++++
drivers/regulator/twl6030-regulator.c | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 9d588cfaa5cb..4eee3133ce4e 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -97,6 +97,11 @@ twl_pwmled: pwmled {
#pwm-cells = <2>;
};
+ clk32kg: regulator-clk32kg {
+ compatible = "ti,twl6030-clk32kg";
+ regulator-always-on;
+ };
+
gpadc {
compatible = "ti,twl6030-gpadc";
interrupts = <3>;
diff --git a/drivers/regulator/twl6030-regulator.c b/drivers/regulator/twl6030-regulator.c
index 430265c404d6..8ee55a0e3d2f 100644
--- a/drivers/regulator/twl6030-regulator.c
+++ b/drivers/regulator/twl6030-regulator.c
@@ -299,6 +299,13 @@ static const struct regulator_ops twl6030fixed_ops = {
.get_status = twl6030reg_get_status,
};
+static struct regulator_ops twl6030_fixed_resource = {
+ .enable = twl6030reg_enable,
+ .disable = twl6030reg_disable,
+ .is_enabled = twl6030reg_is_enabled,
+ .get_status = twl6030reg_get_status,
+};
+
/*
* SMPS status and control
*/
@@ -572,6 +579,19 @@ static const struct twlreg_info TWLSMPS_INFO_##label = { \
}, \
}
+#define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) \
+static struct twlreg_info TWLRES_INFO_##label = { \
+ .base = offset, \
+ .desc = { \
+ .name = #label, \
+ .id = TWL6030_REG_##label, \
+ .ops = &twl6030_fixed_resource, \
+ .type = REGULATOR_VOLTAGE, \
+ .owner = THIS_MODULE, \
+ .enable_time = turnon_delay, \
+ }, \
+ }
+
/* VUSBCP is managed *only* by the USB subchip */
/* 6030 REG with base as PMC Slave Misc : 0x0030 */
/* Turnon-delay and remap configuration values for 6030 are not
@@ -601,6 +621,7 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0);
TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0);
TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0);
TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0);
+TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 0);
TWL6032_ADJUSTABLE_SMPS(SMPS3, 0x34);
TWL6032_ADJUSTABLE_SMPS(SMPS4, 0x10);
TWL6032_ADJUSTABLE_SMPS(VIO, 0x16);
@@ -632,6 +653,7 @@ static u8 twl_get_smps_mult(void)
#define TWL6030_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6030, label)
#define TWL6032_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWL6032, label)
#define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label)
+#define TWLRES_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLRES, label)
#define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label)
static const struct of_device_id twl_of_match[] = {
@@ -659,6 +681,7 @@ static const struct of_device_id twl_of_match[] = {
TWLFIXED_OF_MATCH("ti,twl6030-vusb", VUSB),
TWLFIXED_OF_MATCH("ti,twl6030-v1v8", V1V8),
TWLFIXED_OF_MATCH("ti,twl6030-v2v1", V2V1),
+ TWLRES_OF_MATCH("ti,twl6030-clk32kg", CLK32KG),
TWLSMPS_OF_MATCH("ti,twl6032-smps3", SMPS3),
TWLSMPS_OF_MATCH("ti,twl6032-smps4", SMPS4),
TWLSMPS_OF_MATCH("ti,twl6032-vio", VIO),
--
2.31.1