From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA92B246776 for ; Sat, 26 Jul 2025 13:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535413; cv=none; b=IS5m7cley+ILPI90xmOe0C+U0YlGq65xZTbYI9gI3oPEq9txSYGW6rFRCNleF/SUbUthTYMlidv2jXpd4cTWOeoEPKejU+zm3/MeVp6D+qiUTuUkYHV1u67RefI6lwbC3vvTehpwEopIXh0NV05mZamBXOH7pLk828C2xlJli8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535413; c=relaxed/simple; bh=f3e7VDZ5RpctNbfj+dyIcOXKfTplNtROBxfFMgGp3q0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EPN1/zbtUOynvFb3ceQqrXf69h2VdKnT3DNmJSrFVi4Y/e/ah2qi1Xs8oXG1FW6TX0s7F00+HOLHGrcW+nrW+Y1VRyixWdfwZHLkfFGuIzz2CnAPQRwAHtLnPzazAhZ4QyyKGFTrQMvWqOTCCQpxWnoURmWlQ2lghb2F3+BqXYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=MEalPpci; arc=none smtp.client-ip=209.85.166.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="MEalPpci" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-87c46159b24so110263639f.0 for ; Sat, 26 Jul 2025 06:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535411; x=1754140211; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ek2s2DUqL/jgDZvOvv6Rjx1Dp3m/erc1mrYIyBeINSk=; b=MEalPpciqofsTD23ypHVjOoZg3mhGgZTUzOcbhXJTTdTJEva7ETDHaxzFQzd+NzOdQ qAa9IffOjDq56G2SQk00cTgfbzW6PVVKLr3ebteErRFswMxoFOzqWrjIZnED2xm8egmC ykQXraZf/d/XWxS5mU7+GnsmMADwkKK456CO2HR+xzCNW4wlaHahXkGLfykABkJLJSoQ rJugMYJPbEFd4hC+ti36Pud7Nahtd3oMCmVbtX/MdpEywWPlKIm590sXN9TOvTRA8FPF Kur9IME8CCWZwYiOibua8U4YZb7pkOjd7eO+l5KBufTupbpmrIFlEADxuBGow7dbGHof hndQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535411; x=1754140211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ek2s2DUqL/jgDZvOvv6Rjx1Dp3m/erc1mrYIyBeINSk=; b=Ph848lKDy9BsB+6tlmAoorkWQWpCwPN8Vh1/ZplxgAUgN+TQNXC+qNiyABpZRbD//B z2g+W9sCsIXWd351wcqpBv/LhXR8H0EEfEzAgUzwbHbvY5mQWG/bNALxu18Ym7ZRvMuM IIiMl1U+hWoc7GC2sSQ2vVAgB3oSUoT2IdPUpy2K9pUbzyHRaTrDL6FWQamcqpG9oros DfwtiiLilMU98Oodui2Eh5GU4LytFKYnrcbNmXIAV8AY3UezHc62gHvSM1wGoMCNNK1g yjgXj/W5jp1OjL3D9aw93OD2wLMzWPZ4ZdqUcP6qR0SIJE65XUSeJgr0Dt5eqDTJHWY0 iErg== X-Forwarded-Encrypted: i=1; AJvYcCXIICSOkEUQ9Lqq49A1ZFSvugrFZGnHyrH2brVQ14+m6OGU/OJkk2oJCzua9o3jhgvUWiY9a91TE51kBhA=@vger.kernel.org X-Gm-Message-State: AOJu0YxVOiVgXuMjBDWLhlMyhNacn0X/F29fECzDW5jqBRVwYxxGPS7g VrGVLPj47m5wxA4tbPjNFTmPQMzJAO2KMs/EyfrPZaXFtOCt1iWFr5uCpX+mJmd7EXw= X-Gm-Gg: ASbGncviVVUqob+mYQawpw+cU2bRi3WGXEG70zdMhS020FdW0tRNdOSYr6OfKMukPUL EIjAndXeVKWFMWTlBx7qb4MOO+mY/gu23a7Uafw//7PmLAHYjQ/7MLOuEDYq5VtiguUqgTuUqgA pqhB8lA4Kmzi/9gp/EW8p05CNAFDHnBjyQNIk6YGowfNvpqi207fMkttWZrp/q5EXmXkh3paP/x N7TySmFQfSwNoo9j9i5QIlenkxOYVdY0OT0DePAzMedrLUZheUdEVXqu8XbKAy6nQUiiRASyyrc 1aQQFvt2WFKkzMPsZuNsmA5NbnJP23AwYSte2VUdu8L2psEYahX6OqZ+94tRyrFXI7ZL5Kl/TJw MMK9JKk+fNgbuVVQ6oW1JiobNmCMB52QqXAYp45W7OYf4Euu4lBi5ajCxW66fYHyeSqyiV1yTL4 2A X-Google-Smtp-Source: AGHT+IHyyfkAGrv7e9QP0fqrvp0iqIuBvwoIPIrl5BUPHk4N3KVmqmw/7gL1AW8CJAs0LQjqCf81DA== X-Received: by 2002:a05:6602:29d2:b0:85b:476e:ede2 with SMTP id ca18e2360f4ac-8802293bd79mr912922239f.13.1753535410568; Sat, 26 Jul 2025 06:10:10 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:09 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 1/8] dt-bindings: mfd: add support the SpacemiT P1 PMIC Date: Sat, 26 Jul 2025 08:09:55 -0500 Message-ID: <20250726131003.3137282-2-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable the SpacemiT P1, which is an I2C-controlled PMIC. Initially only the RTC and regulators will be supported. Signed-off-by: Alex Elder Reviewed-by: Rob Herring (Arm) --- .../devicetree/bindings/mfd/spacemit,p1.yaml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/spacemit,p1.yaml diff --git a/Documentation/devicetree/bindings/mfd/spacemit,p1.yaml b/Docum= entation/devicetree/bindings/mfd/spacemit,p1.yaml new file mode 100644 index 0000000000000..5cc34d4934b54 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/spacemit,p1.yaml @@ -0,0 +1,86 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/spacemit,p1.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SpacemiT P1 Power Management Integrated Circuit + +maintainers: + - Troy Mitchell + +description: + P1 is an I2C-controlled PMIC produced by SpacemiT. It implements six + constant-on-time buck converters and twelve low-dropout regulators. + It also contains a load switch, watchdog timer, real-time clock, eight + 12-bit ADC channels, and six GPIOs. Additional details are available + in the "Power Stone/P1" section at the following link. + https://developer.spacemit.com/documentation + +properties: + compatible: + const: spacemit,p1 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vin-supply: + description: Input supply phandle. + + regulators: + type: object + + patternProperties: + "^(buck[1-6]|aldo[1-4]|dldo[1-7])$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + unevaluatedProperties: false + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + pmic@41 { + compatible =3D "spacemit,p1"; + reg =3D <0x41>; + interrupts =3D <64>; + + regulators { + buck1 { + regulator-name =3D "buck1"; + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3450000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + aldo1 { + regulator-name =3D "aldo1"; + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-boot-on; + }; + + dldo1 { + regulator-name =3D "dldo1"; + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-boot-on; + }; + }; + }; + }; --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61300246BC5 for ; Sat, 26 Jul 2025 13:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535415; cv=none; b=tmqL1iW8zT2pHNxTFcPdcBSesaYgGe/HuvSxIsTb9CNVB2REev8aX0LK+275CW+BQ+6xqKq6q3uy5JMZQ0gTGMsUrtFi0QA7LZnR4sLvCcTeb5RXvCbXG3TME2DY3zuYjMzPwRcKe3JEsw+stUJgPIBwNO4FBZkkR1h/ZNnpr4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535415; c=relaxed/simple; bh=i24VZQoL4HdNicf8fZrx7hfEBriE1Lb+9VIUFSrq24E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VyMuEjVNoJCr6s0AP6LY91uiBHg/uWoGbE3/3WZFCZjAjcnMvAw5fdTk1vOTT6W0J6vV7toT8ioRu2XEozjdqp4UJmc+6xQRit0N28whkCjopDXXBSI41p5iO6BBJQad8bzNPfVj3vWJUB/Itbaw2GVMrlB7t/IhBQpX14Ck1rU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=dG+4ollu; arc=none smtp.client-ip=209.85.166.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="dG+4ollu" Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-86cf3dd8c97so243044739f.2 for ; Sat, 26 Jul 2025 06:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535412; x=1754140212; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OBjRH5dYFSfxMS2Dw/xrzSnit2iXBotKiwm7tMWcaRU=; b=dG+4ollu30Ry+lgXOeq2KFgfSF/tjhwFz6Lgt5s3FNiPOwjMOsge5JQAuyiYM658oZ nKV/H6umysR4seyMKph3u/Arq5VStH36mYiLFhYYlFlm4nIDYn4dKQMjFJheiLNVp6u5 hsXirVeM92LE9oIYKDv6qT7dn+KVIyeLX27A2xqDk9D+kxg3KqLqp3MHKjOuAwNZ4ZL6 aslVd21jZqzcZoOZiHNdFXKxtnEFyZcxr7Gil+7TWVprSyXl9CDF+JJF+DlrqmDs72N4 RZTcAT+cChsvEVzAvutVoWkvEeolIyo6V3O+2VGfVs9Mzd+bRrN9wEcHGFSiiCx3tQ19 RPug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535412; x=1754140212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OBjRH5dYFSfxMS2Dw/xrzSnit2iXBotKiwm7tMWcaRU=; b=uWUgdbrCH0z9OhWhRa1OQbo//kCZDerqkWk1RSfJrktvyZFfZXp34pNQsLKNA+d1M2 09S5jO6EJE+EX9WXQGH8uwlpXb19mv7DmJl0nnmV5qGdbcapu/nlfLvv4OLA7cyFRhjz M71Ws652RukAePJ3wZ5YvN373X96MhegvJhZHmxjHTy2U3ObRvKthPwruAqN+SlUiHQm G2spsik4GPPJeft7QqSMUM0++Hc1zoXulOGklN4WYNA9Kgim9x4vQuS/ZH5lHo815YpQ mjx37cGc3cq3HT4zeZ1MX+Dl1xCMLbSmgG9ySr+PMsabUrfoqMpJr5mIH5mDlO1nLUuv DNAg== X-Forwarded-Encrypted: i=1; AJvYcCVCakI1zhPRqVURnsO3T+k3mPLahj9KgKwpQ42ryso5q8LK8CjwdzQVUELMN3bF2oqYyji8xyCbvda00ak=@vger.kernel.org X-Gm-Message-State: AOJu0YwZfshh2mac9sGNGRHDIiQJvMxgpQYE1ucvXRW7/YKEwtuVZco1 ewjTzH37+TVzlp1qeOFcIDE12rpce+9iqnB9wBa1QoYF5Rdw25ccz2v33f3OTGTUiHQ= X-Gm-Gg: ASbGncs/80ahUrqTuG2fbhmBeVLhc7Dtdx+cdHqa+xoysSx9kWPYMA76ev9BD1dQ/Cv rjmPJz2dzCHsvTHq6Xv5sEzBe5M5nXomFnoAN5+SPyqhgal1dtAMfj7UV6oYB6msyVSBibjqDXX nKGb5sYt5xYSQLpK9PQeeWMhd1HWpGj2phBeWNRhM7PK3KJNY7KrNsQ+SjUljoAibpQrQu9Y67t KAzr/Rq601z8BhPpqJxqAUpuRr76Qor8u++41oe++VNDIeU2JJ5OlE9GiCB4QUDHC92UXA+7OwO ajRCWcMD8FfITpG4+bNvRvWePBKFscR13sLH4N1r8tiWHGrKMtuVo2BJlDUwx0RAbABvsBPmBaB OzbVTrcK8bJIVgE+6x9DtZXyHqAsgpvpjFuro0KJCZcXGlsvPOG8arNjx4wVDBRDbxg== X-Google-Smtp-Source: AGHT+IEMiSe1+TI8S2A/w2fU5yeWMCGvndi/cNc/yR7qunidcz9YFlCFnwcgzawUglMsdcxbT5XxBQ== X-Received: by 2002:a05:6602:1582:b0:879:c609:f5a1 with SMTP id ca18e2360f4ac-880229bbf86mr905586239f.12.1753535412429; Sat, 26 Jul 2025 06:10:12 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:11 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 2/8] mfd: simple-mfd-i2c: specify max_register Date: Sat, 26 Jul 2025 08:09:56 -0500 Message-ID: <20250726131003.3137282-3-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" All devices supported by simple MFD use the same 8-bit register 8-bit value regmap configuration. There is an option available for a device to specify a custom configuration, but no existing device uses it. Rather than requiring a "full" regmap configuration to be provided to change only the max_register value, Lee Jones suggested allowing max_register to be specified in the simple_mfd_data structure. The 8-bit register 8-bit configuration is still used by default, but max_register is also applied if it is non-zero. If both regmap_config and max_register are provided, the max_register field in the regmap_config structure is ignored. Signed-off-by: Alex Elder Suggested-by: Lee Jones --- v10: - Rename simple_regmap_config() -> simple_regmap_config_get() - Introduce simple_regmap_config_put() to free regmap_config drivers/mfd/simple-mfd-i2c.c | 45 ++++++++++++++++++++++++++++++++---- drivers/mfd/simple-mfd-i2c.h | 5 +--- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 22159913bea03..3622f189c8342 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -29,6 +29,40 @@ static const struct regmap_config regmap_config_8r_8v = =3D { .val_bits =3D 8, }; =20 +static const struct regmap_config * +simple_regmap_config_get(const struct simple_mfd_data *data) +{ + struct regmap_config *regmap_config; + const struct regmap_config *source; + + if (!data) + return ®map_config_8r_8v; + + source =3D data->regmap_config ? : ®map_config_8r_8v; + + if (!data->max_register) + return source; + + regmap_config =3D kmemdup(source, sizeof(*regmap_config), GFP_KERNEL); + if (regmap_config) + regmap_config->max_register =3D data->max_register; + + return regmap_config; +} + +static void simple_regmap_config_put(const struct simple_mfd_data *data, + const struct regmap_config *regmap_config) +{ + /* This condition holds if data is null */ + if (regmap_config =3D=3D ®map_config_8r_8v) + return; + + if (regmap_config =3D=3D data->regmap_config) + return; + + kfree(regmap_config); +} + static int simple_mfd_i2c_probe(struct i2c_client *i2c) { const struct simple_mfd_data *simple_mfd_data; @@ -38,13 +72,14 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c) =20 simple_mfd_data =3D device_get_match_data(&i2c->dev); =20 - /* If no regmap_config is specified, use the default 8reg and 8val bits */ - if (!simple_mfd_data || !simple_mfd_data->regmap_config) - regmap_config =3D ®map_config_8r_8v; - else - regmap_config =3D simple_mfd_data->regmap_config; + regmap_config =3D simple_regmap_config_get(simple_mfd_data); + if (!regmap_config) + return -ENOMEM; =20 regmap =3D devm_regmap_init_i2c(i2c, regmap_config); + + simple_regmap_config_put(simple_mfd_data, regmap_config); + if (IS_ERR(regmap)) return PTR_ERR(regmap); =20 diff --git a/drivers/mfd/simple-mfd-i2c.h b/drivers/mfd/simple-mfd-i2c.h index 7cb2bdd347d97..6fa36b3d7a217 100644 --- a/drivers/mfd/simple-mfd-i2c.h +++ b/drivers/mfd/simple-mfd-i2c.h @@ -8,10 +8,6 @@ * shared by all sub-devices. Children can use their parent's device stru= cture * (dev.parent) in order to reference it. * - * This driver creates a single register map with the intention for it to = be - * shared by all sub-devices. Children can use their parent's device stru= cture - * (dev.parent) in order to reference it. - * * Once the register map has been successfully initialised, any sub-devices * represented by child nodes in Device Tree or via the MFD cells in the * associated C file will be subsequently registered. @@ -25,6 +21,7 @@ =20 struct simple_mfd_data { const struct regmap_config *regmap_config; + unsigned int max_register; const struct mfd_cell *mfd_cell; size_t mfd_cell_size; }; --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E36A24886E for ; Sat, 26 Jul 2025 13:10:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535418; cv=none; b=GiJfrK7Oq0X14smJTTL4EI9Q256nWMqJKvGazXP/RSeTruSFoYCNu9nyPVlP5qIXDmz7MYUwHi9dnINVkIcLUfghVmM0za9q9yyQD/Irkdz9WrDzsWcn++hmFOtvgIQMv2ck58jzmoFhdg4AolFYE0/idEF/hAj9hUVCeONGPtA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535418; c=relaxed/simple; bh=Q38X3FLb9rUyS71bvg/6Qwxh+WP/snpwbPt/FQFY2Xw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HkCkOYaZCuRT94Sps/BIB7ivcfX9tJIMU45SknDiw8CNM79rYBHszHczl5iPmy36TVkmA59jBTQO2C3aS3/5gmCSo3mSMjMSUPrhHx75P8fYfaO1QLuOr9zNw4wVZyLmANmx1Okl1i8uu0BFr/r/BOeGqxdPDHiy7q4OC1K+pzo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=GAM64i66; arc=none smtp.client-ip=209.85.166.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="GAM64i66" Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-86cf3dd8c97so243050239f.2 for ; Sat, 26 Jul 2025 06:10:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535415; x=1754140215; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A31+naPc141WdyGnSXK5HnsnuvFJAqLMKGUUSxCKCSg=; b=GAM64i662JuErc2DkNjWKAnGCOw/Wz7mww1xvKkTf9sGycD13Cnv6E2bGJy4KAFRb7 ZqieVL+AYQsuet14pPu39ITCDa8k6jVlsjBcJvnPTSzfatLtlR3HcqBdQ4lcUTySHuqJ QzH6RLIXcnAvcFY3UjPczM4ejCTmeKCrmr0D1hxPmLP/MAHN4ZbB3pIKOf3HIm/W6J+j epMvGFMgWM9xxnlKEsIcyvcvqpuaryUEYn64IKC494ex/gji4L6X7fDgxdvJRfdWnCCl 5K3c3zzMudYRQhqrArsaRYQ8S+KeZyPhgkZRRuuCVSIypoqfTvgG7Z53K12dIpLgI+jb 12Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535415; x=1754140215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A31+naPc141WdyGnSXK5HnsnuvFJAqLMKGUUSxCKCSg=; b=e+NH9ySsgKqVrTd3dyHd2OXgQfxNsiyaRY5jZA6b/Qv1wgivuh886EyThL+Z49kt1H hyTmns9vKTKvrTjn6EWKquWQpxscQupF4QoSKAhJgNipBUvMnus0mk8CWTQREQdr2zdt Y+En0cm12HhXRmK4ti87OLvY3LX7nePvNdjrbfyi+AjuK9/cNAenoeNKH2S3BXcLYPMm KCEmQQbJESPt6i0Ndg+uXqMVXgx3fCgQuQb+6grzz2ooUCnohmQyxNiuOrdpzm18Hudt c5vBtxgAHokfmeD9Z7duEoPSG3BBukc7tsgWN5axVDJMoWPkXD1cv5RNa9elIcaYgoKW 53Rw== X-Forwarded-Encrypted: i=1; AJvYcCW1ndAbKfntn0+ydAtWDgBVwuvqSjE4mG40FrykmpJPnLcuVS3c7FucEE23h98heNEcFNFWHF9mD/EJv0M=@vger.kernel.org X-Gm-Message-State: AOJu0YzljXU0Omcb8JADnmek0aESAGNY6UeOXH/qFacDKu1tO5WITaXC CBvQEGKOf92IqviVRzutqeHbIptBAAE5jFiptN1icHTs6Tm/GgKcd81SM+OyzomE288= X-Gm-Gg: ASbGncszqiA+Cam6y6kFsiEZoEDW0IHnMC3ixXpKbmquz5K9XSWFmEVU9ygHiNBHqKi MC34VPRZQmkXHDLaypeOFf0SMOOGJ+8qTMJ+mmwnDAffpNKfrME8xHAq+FNhFZ/WdWe91swzk8p h+A61vBEIBMNZmdkGNs+UsnbMZawhfD5FzzjfXtW+JoyrtYyp7LiGZG7iJ8BHXe+rdPqhdxnmQi W1sRmcomqMsZFISuDAwiufmE6/10E/A3KZLoD1RdB5+ArjRCXx8ITjAfkbOHU7rkGDmSDeNmofV HyFWwsBtfNilZYIvCbWc8xxNqfDUZ+SjCtCHl7po0FmrOCUKAjapS6eveWAf5+wcE22sd7zsLEh CpvOkeWmS4CMVZv34PXBhzN5NfF1kAIfKLnqokjHygJ2lof/uLKVjqmsqWtGYQLHzrA== X-Google-Smtp-Source: AGHT+IEQtMmfXcpXrDYRw35RuK7bf++10bNgw0KJuXM1PCXb+Br9VU8Nk8Ms01AyRIuf+S7EyGrohQ== X-Received: by 2002:a05:6602:3d1:b0:87c:5e79:203 with SMTP id ca18e2360f4ac-8800f12d61fmr1072437639f.4.1753535414633; Sat, 26 Jul 2025 06:10:14 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:13 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 3/8] mfd: simple-mfd-i2c: add SpacemiT P1 support Date: Sat, 26 Jul 2025 08:09:57 -0500 Message-ID: <20250726131003.3137282-4-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable support for the RTC and regulators found in the SpacemiT P1 PMIC. Support is implemented by the simple I2C MFD driver. The P1 PMIC is normally implemented with the SpacemiT K1 SoC. This PMIC provides 6 buck converters and 12 LDO regulators. It also implements a switch, watchdog timer, real-time clock, and more. Initially its RTC and regulators are supported. Signed-off-by: Alex Elder --- drivers/mfd/Kconfig | 11 +++++++++++ drivers/mfd/simple-mfd-i2c.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 8f11b2df14704..3fe242ffcb31d 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1238,6 +1238,17 @@ config MFD_QCOM_RPM Say M here if you want to include support for the Qualcomm RPM as a module. This will build a module called "qcom_rpm". =20 +config MFD_SPACEMIT_P1 + tristate "SpacemiT P1 PMIC" + depends on I2C + select MFD_SIMPLE_MFD_I2C + help + This option supports the I2C-based SpacemiT P1 PMIC, which + contains regulators, a power switch, GPIOs, an RTC, and more. + This option is selected when any of the supported sub-devices + is configured. The basic functionality is implemented by the + simple MFD I2C driver. + config MFD_SPMI_PMIC tristate "Qualcomm SPMI PMICs" depends on ARCH_QCOM || COMPILE_TEST diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 3622f189c8342..34c69ef4a7e94 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -128,12 +128,24 @@ static const struct simple_mfd_data maxim_mon_max7770= 5 =3D { .mfd_cell_size =3D ARRAY_SIZE(max77705_sensor_cells), }; =20 +static const struct mfd_cell spacemit_p1_cells[] =3D { + { .name =3D "spacemit-p1-regulator", }, + { .name =3D "spacemit-p1-rtc", }, +}; + +static const struct simple_mfd_data spacemit_p1 =3D { + .mfd_cell =3D spacemit_p1_cells, + .mfd_cell_size =3D ARRAY_SIZE(spacemit_p1_cells), + .max_register =3D 0xaa, +}; + static const struct of_device_id simple_mfd_i2c_of_match[] =3D { { .compatible =3D "kontron,sl28cpld" }, { .compatible =3D "silergy,sy7636a", .data =3D &silergy_sy7636a}, { .compatible =3D "maxim,max5970", .data =3D &maxim_max5970}, { .compatible =3D "maxim,max5978", .data =3D &maxim_max5970}, { .compatible =3D "maxim,max77705-battery", .data =3D &maxim_mon_max77705= }, + { .compatible =3D "spacemit,p1", .data =3D &spacemit_p1, }, {} }; MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98E9B24A06B for ; Sat, 26 Jul 2025 13:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535421; cv=none; b=lZU8GRe18I2jJTBhBtHfuQe1nvnWJeDMYN0uFgfz2tl57I44rJMB0lUgowjd2FFIC8u8J0Ao+j8sLtUyov4HKMznvsr9fDWTL4j3lpOmegWSJFPDOJjsYMRO0d1ThqK+VmPXgg8Z6FLrAloqNn0NoKpGfoPsR2veSUm2/iRFGCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535421; c=relaxed/simple; bh=WWe0qL6V5tKEk/+A8p3kqlVeR+nH2UxolAAnmCbJTYE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d2AwCSPTT72lMMpQ0JXeJJvkQ2twECmXmLwv25INKSjE1HgnKZEP/AVFhGpoH3pE0na9UBo8XDod/P1F5MpqyTmKDAZZLLJVAbs73W+fOmKxqRpgdUjVfO/iQ87UCbkVl49ditUdNG7gnIksfbvbGG/XSWI05oJk642L2hb3Ylk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=0ROSdziR; arc=none smtp.client-ip=209.85.166.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="0ROSdziR" Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-87c6dfca35bso136011239f.1 for ; Sat, 26 Jul 2025 06:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535416; x=1754140216; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nWDAnLqXm2iHilxdbHntQ50x96Qw+sd/grNlV6D19Rs=; b=0ROSdziRP5jUPzOqJYedZAjrmYATDhnTrmQ2PkUGC+6SbxEanQqOBhyejeYgQLamUn xmS6GQ52IVlXrKVyTrSu0HPBMek1YpSZODni1NW7imt9DdBHorA2kqRB9kXxjyQlihBr cjByj8GItuBdYMW3V7Y4QFs5wsQ0655uO0jNqL9DrY2wub8EaP/dpGTKnM+JocbTJMQW PdPKvDzZFmE0AXDDYOZYjdlxjmkVpHK6VrXaJPtsWyzExxy3ds+GUW6gKnutbTjs+rvc X7xrmmeaJfk1Ttfvn5tegJo64WR+rjwG76Tojnt2wdQDuHudC+r+mMBrtA2dtZ+ARTmb KIOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535416; x=1754140216; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nWDAnLqXm2iHilxdbHntQ50x96Qw+sd/grNlV6D19Rs=; b=l6CTt1XOniZKbj8pEmjpmZK8JCXT+HALOz3wOLbdkacU1ErgYsdaCh1HSWpblhe78Q Cfe6v6+ld84KDokclJN2dfsWGju3JYISD3TFKctdiPUXsYszMUz3+PJg5/XELBcm7XRL 4fcrjp2CUKen531I6SOJPWi4CfvOteymRv+SC0JcwqJYnwhs/iKpGKNiNRG2CPcfqd9X W5r8iDrymQQ/mNCgRDK+owVg3nWedwcs2+V2Jf6VJ3LevyTohkTAGi2qLMonwFlRWuEx so+m0wA+cfm/f1bG6hrEXNYrE2QZVir2Ywb392co+T5TEhecfbvndSduBZ9F9vTKS8Bv 29mg== X-Forwarded-Encrypted: i=1; AJvYcCVCtoSWfqqScbszMruAKtAetrmvRnRlzBVoU+SNymtywHDBAtHrGzH6BFzSMRxcSJDKoUnnPfPT+KKKu5E=@vger.kernel.org X-Gm-Message-State: AOJu0YyQflqf9an0ZjJyrxwOL0F77Daahprur1iUuYgL6wTG7cr4nh8l bQ6snnzZDrPE9hqiqTUJV6pVcXfsvX4NN//fDQq+Qhy1axOe0/dxIIJoQ2D/7rwAMh8= X-Gm-Gg: ASbGnctZhxeIyHEnrqhzsNDUGJKKs3uLW1ajdF2iMDr/irVvk1Es2MzTMxYxOikGpB/ ln+IMgu+mEeuIw9oj1udb1mrrRE/WR1uJVKpbs7p5fTOcWl5f/TAUutxpfRKEdWFRy5eL9kqpp9 DY249Nhb6IHdqMwFqXgk9psSso2NlhLftYpDjHBmWHB1ibhXP4GrjyyhWvh2ByWwbqvFKpHDIU5 fcwq6L7nlsuIQJ7AOffRM5M6L/Zz+UY+sGrbrGf4dMeuwZG+3lB7jm8vpG61SkMxZcQeWPAk268 xSRGMRYReUrtYUzUAjiLyye72x+dfB3lD7LTmH8guHlJuQudYtqsqcBchfMZQqeOiPJurOmdQyq +grFC3PzcpJ47vQNMq8KaqE1TvGMIqwzAaye0QWXrCY0MjlEMkzOi6BtW96l+XZyAdA== X-Google-Smtp-Source: AGHT+IHt5uOOL7s9LWq7FTyLraGVQKqRq5m7R48mL6Vm8wp9Nx+wyJDwHfVD0iK0tpZwkTTlHy/FMw== X-Received: by 2002:a05:6602:6308:b0:881:34a:c4f5 with SMTP id ca18e2360f4ac-881034ad105mr125908239f.4.1753535416455; Sat, 26 Jul 2025 06:10:16 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:16 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 4/8] regulator: spacemit: support SpacemiT P1 regulators Date: Sat, 26 Jul 2025 08:09:58 -0500 Message-ID: <20250726131003.3137282-5-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the regulators found in the SpacemiT P1 PMIC. This PMIC provides 6 buck converters and 12 LDO regulators. The PMIC is implemented as a multi-function device. These regulators are probed based on this driver being named in a MFD cell in the simple MFD I2C driver. Signed-off-by: Alex Elder Reviewed-by: Mark Brown --- drivers/regulator/Kconfig | 12 +++ drivers/regulator/Makefile | 1 + drivers/regulator/spacemit-p1.c | 157 ++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 drivers/regulator/spacemit-p1.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index eaa6df1c9f806..7d5f79a468761 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1395,6 +1395,18 @@ config REGULATOR_SLG51000 The SLG51000 is seven compact and customizable low dropout regulators. =20 +config REGULATOR_SPACEMIT_P1 + tristate "SpacemiT P1 regulators" + depends on ARCH_SPACEMIT || COMPILE_TEST + select MFD_SPACEMIT_P1 + default ARCH_SPACEMIT + help + Enable support for regulators implemented by the SpacemiT P1 + power controller. The P1 implements 6 high-efficiency buck + converters and 12 programmable LDO regulators. To compile this + driver as a module, choose M here. The module will be called + "spacemit-pmic". + config REGULATOR_STM32_BOOSTER tristate "STMicroelectronics STM32 BOOSTER" depends on ARCH_STM32 || COMPILE_TEST diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index be98b29d6675d..278f5b8d1c7d7 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -162,6 +162,7 @@ obj-$(CONFIG_REGULATOR_S5M8767) +=3D s5m8767.o obj-$(CONFIG_REGULATOR_SC2731) +=3D sc2731-regulator.o obj-$(CONFIG_REGULATOR_SKY81452) +=3D sky81452-regulator.o obj-$(CONFIG_REGULATOR_SLG51000) +=3D slg51000-regulator.o +obj-$(CONFIG_REGULATOR_SPACEMIT_P1) +=3D spacemit-p1.o obj-$(CONFIG_REGULATOR_STM32_BOOSTER) +=3D stm32-booster.o obj-$(CONFIG_REGULATOR_STM32_VREFBUF) +=3D stm32-vrefbuf.o obj-$(CONFIG_REGULATOR_STM32_PWR) +=3D stm32-pwr.o diff --git a/drivers/regulator/spacemit-p1.c b/drivers/regulator/spacemit-p= 1.c new file mode 100644 index 0000000000000..d437e6738ea1e --- /dev/null +++ b/drivers/regulator/spacemit-p1.c @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for regulators found in the SpacemiT P1 PMIC + * + * Copyright (C) 2025 by RISCstar Solutions Corporation. All rights reser= ved. + * Derived from code from SpacemiT. + * Copyright (c) 2023, SPACEMIT Co., Ltd + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MOD_NAME "spacemit-p1-regulator" + +enum p1_regulator_id { + P1_BUCK1, + P1_BUCK2, + P1_BUCK3, + P1_BUCK4, + P1_BUCK5, + P1_BUCK6, + + P1_ALDO1, + P1_ALDO2, + P1_ALDO3, + P1_ALDO4, + + P1_DLDO1, + P1_DLDO2, + P1_DLDO3, + P1_DLDO4, + P1_DLDO5, + P1_DLDO6, + P1_DLDO7, +}; + +static const struct regulator_ops p1_regulator_ops =3D { + .list_voltage =3D regulator_list_voltage_linear_range, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .set_voltage_time_sel =3D regulator_set_voltage_time_sel, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, +}; + +/* Selector value 255 can be used to disable the buck converter on sleep */ +static const struct linear_range p1_buck_ranges[] =3D { + REGULATOR_LINEAR_RANGE(500000, 0, 170, 5000), + REGULATOR_LINEAR_RANGE(1375000, 171, 254, 25000), +}; + +/* Selector value 0 can be used for suspend */ +static const struct linear_range p1_ldo_ranges[] =3D { + REGULATOR_LINEAR_RANGE(500000, 11, 127, 25000), +}; + +/* These define the voltage selector field for buck and LDO regulators */ +#define BUCK_MASK GENMASK(7, 0) +#define LDO_MASK GENMASK(6, 0) + +#define P1_ID(_TYPE, _n) P1_ ## _TYPE ## _n +#define P1_ENABLE_REG(_off, _n) ((_off) + 3 * ((_n) - 1)) + +#define P1_REG_DESC(_TYPE, _type, _n, _s, _off, _mask, _nv, _ranges) \ + { \ + .name =3D #_type #_n, \ + .supply_name =3D _s, \ + .of_match =3D of_match_ptr(#_type #_n), \ + .regulators_node =3D of_match_ptr("regulators"), \ + .id =3D P1_ID(_TYPE, _n), \ + .n_voltages =3D _nv, \ + .ops =3D &p1_regulator_ops, \ + .owner =3D THIS_MODULE, \ + .linear_ranges =3D _ranges, \ + .n_linear_ranges =3D ARRAY_SIZE(_ranges), \ + .vsel_reg =3D P1_ENABLE_REG(_off, _n) + 1, \ + .vsel_mask =3D _mask, \ + .enable_reg =3D P1_ENABLE_REG(_off, _n), \ + .enable_mask =3D BIT(0), \ + } + +#define P1_BUCK_DESC(_n) \ + P1_REG_DESC(BUCK, buck, _n, "vcc", 0x47, BUCK_MASK, 254, p1_buck_ranges) + +#define P1_ALDO_DESC(_n) \ + P1_REG_DESC(ALDO, aldo, _n, "vcc", 0x5b, LDO_MASK, 117, p1_ldo_ranges) + +#define P1_DLDO_DESC(_n) \ + P1_REG_DESC(DLDO, dldo, _n, "buck5", 0x67, LDO_MASK, 117, p1_ldo_ranges) + +static const struct regulator_desc p1_regulator_desc[] =3D { + P1_BUCK_DESC(1), + P1_BUCK_DESC(2), + P1_BUCK_DESC(3), + P1_BUCK_DESC(4), + P1_BUCK_DESC(5), + P1_BUCK_DESC(6), + + P1_ALDO_DESC(1), + P1_ALDO_DESC(2), + P1_ALDO_DESC(3), + P1_ALDO_DESC(4), + + P1_DLDO_DESC(1), + P1_DLDO_DESC(2), + P1_DLDO_DESC(3), + P1_DLDO_DESC(4), + P1_DLDO_DESC(5), + P1_DLDO_DESC(6), + P1_DLDO_DESC(7), +}; + +static int p1_regulator_probe(struct platform_device *pdev) +{ + struct regulator_config config =3D { }; + struct device *dev =3D &pdev->dev; + u32 i; + + /* + * The parent device (PMIC) owns the regmap. Since we don't + * provide one in the config structure, that one will be used. + */ + config.dev =3D dev->parent; + + for (i =3D 0; i < ARRAY_SIZE(p1_regulator_desc); i++) { + const struct regulator_desc *desc =3D &p1_regulator_desc[i]; + struct regulator_dev *rdev; + + rdev =3D devm_regulator_register(dev, desc, &config); + if (IS_ERR(rdev)) + return dev_err_probe(dev, PTR_ERR(rdev), + "error registering regulator %s\n", + desc->name); + } + + return 0; +} + +static struct platform_driver p1_regulator_driver =3D { + .probe =3D p1_regulator_probe, + .driver =3D { + .name =3D MOD_NAME, + }, +}; + +module_platform_driver(p1_regulator_driver); + +MODULE_DESCRIPTION("SpacemiT P1 regulator driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" MOD_NAME); --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B37724BCF5 for ; Sat, 26 Jul 2025 13:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535421; cv=none; b=eXsoaO4MwUkIFecTAKim9TjGuyHJ6/fqTrgOMBhmUUxnDaKENlrjtZQtXJeRvjKCFR42k83z4Ld4VH8uBgdNHL4tAJ72U6EQFLMWJy9syj2xDRiAr2I1Qalg+x3aaym0IYp332hMkiNmHnlwfr3OtHOiNUmHiwEyQrFPEuNeS0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535421; c=relaxed/simple; bh=C67aKO7FCd5ZDQiMSKTLq4HBKkrfUiLt/UEjYJGWykc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Te17mCg+MW5hl7A3r7jCoXgU0W6Z9GUpNDIwikq5IFswI3VTsT/yVnIYd5zH/n12UlLwyZ6UqesnoWiK3xBonbn+KeXY8G2QgQJMsejmj1nmlR4PbHWkWym8pq6A4MHPLev5zC0jdYsmPLSketAGyNkGQL7wMVAEKg3LLDwI9gA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=HBM71kzc; arc=none smtp.client-ip=209.85.166.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="HBM71kzc" Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-880f2623a6dso96369639f.1 for ; Sat, 26 Jul 2025 06:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535418; x=1754140218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=skQxKpPrKNdpCm7T4rAP4k9qKdZRbQN/uiLC1I5fUpk=; b=HBM71kzcIZW5NUcBYnwVKpuykQClFbiE1le2kSNgWtxyw+7ADMxY43IcCgHaoVbXbe rvn3wZH4sdLURdXdi9F/EZfcoFqFypyyI1yFgviGH9sxAZNxa9rsBd7KAA5wTHY1LTja JXqIK76+L253ImPN+a82A0YJi4rBD1Z4YleFumsbB6uYocKY+mFray3vjTXB1MI1IcpB R6fLGDVaMjD/4CEnKNiCqgK7h17uF1AbNGuHO2t20ZK9XRZNMgE6CpoQrgwGYqCUNN2+ 4s4INkh5z++L6jHpv1oQsHRzKrPBywZduv4TFMD3USf8J15t9T3IQanLskSlAJ2NDtvQ 76lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535418; x=1754140218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=skQxKpPrKNdpCm7T4rAP4k9qKdZRbQN/uiLC1I5fUpk=; b=VSje7Mn9wv/V4BDuocutzQAqP3x+ndwxc9elTEIXVfV9N6TxJ9UNIt2bGbVnVsbC7O 6EsBHxU/sGEjpQiD/8aj6Qctk+GMdMqCJ/VCpNAZ76HKAot8rh1q5XWM9m7TC58UpNNH zn7vpaIi+ds5vzf4cgczTGpyrFGj2IVJa08LtRS9XZkQmz7I5uz08RIkAknModmXaaG0 W63hlhE0g4bab6ROHRomzzQsUQtLRz2QUTqoalOrH2VX969wJOB3bWMUwCA2+fXrqEAq I/qLjbMTZ63BD0mA4zk2lBoKLKvH1Rwn6a5K8RYJjFl/l+S1Btwc4cy8zDoFX7CJ9CjQ 7urA== X-Forwarded-Encrypted: i=1; AJvYcCWU17eWmn5IkmjcbILiCplKYW+HqqOQzK//oyhNTZz2/vYVSVGMGc2XPle77nOcbFaoDj+BtHuEOKnLR6w=@vger.kernel.org X-Gm-Message-State: AOJu0YxTadJIU/ig3LYJNK5LHPYQyiG5dgQW+nFMSd+SMqEA69SGAYYO 1loOxIFvyiuh5YZhjV5KYieOPRlLZKB5JsxaSiPbreFR0GteqsSd4wR6VxDnnAp1x3A= X-Gm-Gg: ASbGnctNZR4g0S0m2kOzxLJx1fZ0VRZ74DuG9XjS5KmN2p8Xm8gOi3SgnnsG8/e0uVR RK1qGVfFj+gYO8bjXsVZ91Ceok/RafjNEnZJ+KJ1ivVWpelj67o31bKuk5bqYy5Xa06uyRwC1a+ HHyoy49XnncbUk67SY6OuP7VG0jkPB2+pYml/eRRym2Hcc33uNkF4rwsg5e6nDUSHKgTGJj/Xuu H4e/p2HsrIJUET8Nf0lLtB9h0UR3qP4vL4qXnpKB0guc3xn4rWFZbmZG8nDGVluBdcqTLDvIcMz yp/QWRpxueFdZata9ybMQZ9Lh8aqQ1QJSRUoULOaEyT+eUEs2gV2bLbtyL1lWPfBvPXo/dQ0Av/ ZCAKObSKJGJHy5vPf/x4ikvOIBkcYDmI2+2znXUrPhMNi6VWoIlrIHtlq79yvHs+PDQ== X-Google-Smtp-Source: AGHT+IEOUDVs8LinrMieT7Bj2nM5l4zO9dDYMygetDt1jIp1At+3JnR8H5mlhp0nDQK9+1WX3RkAVQ== X-Received: by 2002:a05:6602:60cc:b0:879:c9db:cbf0 with SMTP id ca18e2360f4ac-8800f101692mr1086353239f.2.1753535418382; Sat, 26 Jul 2025 06:10:18 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:17 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 5/8] rtc: spacemit: support the SpacemiT P1 RTC Date: Sat, 26 Jul 2025 08:09:59 -0500 Message-ID: <20250726131003.3137282-6-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the RTC found in the SpacemiT P1 PMIC. Initially only setting and reading the time are supported. The PMIC is implemented as a multi-function device. This RTC is probed based on this driver being named in a MFD cell in the simple MFD I2C driver. Signed-off-by: Alex Elder Acked-by: Alexandre Belloni --- drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-spacemit-p1.c | 167 ++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 drivers/rtc/rtc-spacemit-p1.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 64f6e9756aff4..31d355b103d43 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -406,6 +406,16 @@ config RTC_DRV_MAX77686 This driver can also be built as a module. If so, the module will be called rtc-max77686. =20 +config RTC_DRV_SPACEMIT_P1 + tristate "SpacemiT P1 RTC" + depends on ARCH_SPACEMIT || COMPILE_TEST + select MFD_SPACEMIT_P1 + default ARCH_SPACEMIT + help + Enable support for the RTC function in the SpacemiT P1 PMIC. + This driver can also be built as a module, which will be called + "spacemit-p1-rtc". + config RTC_DRV_NCT3018Y tristate "Nuvoton NCT3018Y" depends on OF diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 789bddfea99d8..f41fdb4fabae9 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -171,6 +171,7 @@ obj-$(CONFIG_RTC_DRV_SD2405AL) +=3D rtc-sd2405al.o obj-$(CONFIG_RTC_DRV_SD3078) +=3D rtc-sd3078.o obj-$(CONFIG_RTC_DRV_SH) +=3D rtc-sh.o obj-$(CONFIG_RTC_DRV_SNVS) +=3D rtc-snvs.o +obj-$(CONFIG_RTC_DRV_SPACEMIT_P1) +=3D rtc-spacemit-p1.o obj-$(CONFIG_RTC_DRV_SPEAR) +=3D rtc-spear.o obj-$(CONFIG_RTC_DRV_STARFIRE) +=3D rtc-starfire.o obj-$(CONFIG_RTC_DRV_STK17TA8) +=3D rtc-stk17ta8.o diff --git a/drivers/rtc/rtc-spacemit-p1.c b/drivers/rtc/rtc-spacemit-p1.c new file mode 100644 index 0000000000000..43ab62494bb4b --- /dev/null +++ b/drivers/rtc/rtc-spacemit-p1.c @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for the RTC found in the SpacemiT P1 PMIC + * + * Copyright (C) 2025 by RISCstar Solutions Corporation. All rights reser= ved. + */ + +#include +#include +#include +#include +#include +#include + +#define MOD_NAME "spacemit-p1-rtc" + +/* + * Six consecutive 1-byte registers hold the seconds, minutes, hours, + * day-of-month, month, and year (respectively). + * + * The range of values in these registers is: + * seconds 0-59 + * minutes 0-59 + * hours 0-59 + * day 0-30 (struct tm is 1-31) + * month 0-11 + * year years since 2000 (struct tm is since 1900) + * + * Note that the day and month must be converted after reading and + * before writing. + */ +#define RTC_TIME 0x0d /* Offset of the seconds register */ + +#define RTC_CTRL 0x1d +#define RTC_EN BIT(2) + +/* Number of attempts to read a consistent time stamp before giving up */ +#define RTC_READ_TRIES 20 /* At least 1 */ + +struct p1_rtc { + struct regmap *regmap; + struct rtc_device *rtc; +}; + +/* + * The P1 hardware documentation states that the register values are + * latched to ensure a consistent time snapshot within the registers, + * but these are in fact unstable due to a bug in the hardware design. + * So we loop until we get two identical readings. + */ +static int p1_rtc_read_time(struct device *dev, struct rtc_time *t) +{ + struct p1_rtc *p1 =3D dev_get_drvdata(dev); + struct regmap *regmap =3D p1->regmap; + u32 count =3D RTC_READ_TRIES; + u8 seconds; + u8 time[6]; + int ret; + + if (!regmap_test_bits(regmap, RTC_CTRL, RTC_EN)) + return -EINVAL; /* RTC is disabled */ + + ret =3D regmap_bulk_read(regmap, RTC_TIME, time, sizeof(time)); + if (ret) + return ret; + + do { + seconds =3D time[0]; + ret =3D regmap_bulk_read(regmap, RTC_TIME, time, sizeof(time)); + if (ret) + return ret; + } while (time[0] !=3D seconds && --count); + + if (!count) + return -EIO; /* Unable to get a consistent result */ + + t->tm_sec =3D time[0] & GENMASK(5, 0); + t->tm_min =3D time[1] & GENMASK(5, 0); + t->tm_hour =3D time[2] & GENMASK(4, 0); + t->tm_mday =3D (time[3] & GENMASK(4, 0)) + 1; + t->tm_mon =3D time[4] & GENMASK(3, 0); + t->tm_year =3D (time[5] & GENMASK(5, 0)) + 100; + + return 0; +} + +/* + * The P1 hardware documentation states that values in the registers are + * latched so when written they represent a consistent time snapshot. + * Nevertheless, this is not guaranteed by the implementation, so we must + * disable the RTC while updating it. + */ +static int p1_rtc_set_time(struct device *dev, struct rtc_time *t) +{ + struct p1_rtc *p1 =3D dev_get_drvdata(dev); + struct regmap *regmap =3D p1->regmap; + u8 time[6]; + int ret; + + time[0] =3D t->tm_sec; + time[1] =3D t->tm_min; + time[2] =3D t->tm_hour; + time[3] =3D t->tm_mday - 1; + time[4] =3D t->tm_mon; + time[5] =3D t->tm_year - 100; + + /* Disable the RTC to update; re-enable again when done */ + ret =3D regmap_clear_bits(regmap, RTC_CTRL, RTC_EN); + if (ret) + return ret; + + /* If something goes wrong, leave the RTC disabled */ + ret =3D regmap_bulk_write(regmap, RTC_TIME, time, sizeof(time)); + if (ret) + return ret; + + return regmap_set_bits(regmap, RTC_CTRL, RTC_EN); +} + +static const struct rtc_class_ops p1_rtc_class_ops =3D { + .read_time =3D p1_rtc_read_time, + .set_time =3D p1_rtc_set_time, +}; + +static int p1_rtc_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct rtc_device *rtc; + struct p1_rtc *p1; + + p1 =3D devm_kzalloc(dev, sizeof(*p1), GFP_KERNEL); + if (!p1) + return -ENOMEM; + dev_set_drvdata(dev, p1); + + p1->regmap =3D dev_get_regmap(dev->parent, NULL); + if (!p1->regmap) + return dev_err_probe(dev, -ENODEV, "failed to get regmap\n"); + + rtc =3D devm_rtc_allocate_device(dev); + if (IS_ERR(rtc)) + return dev_err_probe(dev, PTR_ERR(rtc), + "error allocating device\n"); + p1->rtc =3D rtc; + + rtc->ops =3D &p1_rtc_class_ops; + rtc->range_min =3D RTC_TIMESTAMP_BEGIN_2000; + rtc->range_max =3D RTC_TIMESTAMP_END_2063; + + clear_bit(RTC_FEATURE_ALARM, rtc->features); + clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); + + return devm_rtc_register_device(rtc); +} + +static struct platform_driver p1_rtc_driver =3D { + .probe =3D p1_rtc_probe, + .driver =3D { + .name =3D MOD_NAME, + }, +}; + +module_platform_driver(p1_rtc_driver); + +MODULE_DESCRIPTION("SpacemiT P1 RTC driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" MOD_NAME); --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6E7D24678A for ; Sat, 26 Jul 2025 13:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535423; cv=none; b=RwA+zFAslwdBEINRCd3nlAyp+toeRlK+SClZb3tDqC+j3QRDA6RGKQIyWOXO0ZbWkcSohfwIU4MkgMBicuZRnMuXyivXTcWfNE/e9WEgvOMFoe+ZB3lcyoZ+WJBzf9n+U+yvAZeBTJWQkiMi0NQn03nYAn4N1r45TfCmvbFWvPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535423; c=relaxed/simple; bh=QGEqlYXIwxO55BW2Qob9nSxq1Am14CofBss2UkP4kt8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kLcy9f0iJ3wu1Y94SszNouGtLfGp5RA7bBAtoXNyzgVMba/mb3XMj2xebEs5bZ0TpYxcvA8tcFLDFgMTtygqXhEA8mKyPKcz8uc27vrIh6BSv5TerF5LzzGdQ2ryI5bWP0qqcKPTi2aRY9j25NnOFwwHwkq0/YA/RqiotJpOxaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=ha83cEQM; arc=none smtp.client-ip=209.85.166.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="ha83cEQM" Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-87c205ca4easo70873239f.2 for ; Sat, 26 Jul 2025 06:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535420; x=1754140220; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XO2Fy/81E/WhCOJwM6NoWD+/CZxHHhnDjYEWoZW3i/Q=; b=ha83cEQMyAac6y9RdUpuNluiqdFTtq6vqW8WN0rUikBbLmVlvFPixN2VFCR+zEu7dw El/GzfRbowVdEGSlGKpvqYrGedqm5p+2SK1uzLHCeFmMZ701aZxcvVVlZGhLHYpd4afD MpkWeYzbuxBGwr2uCigmS1XrSZ6AOrk7NOM+PQKGFS0uUIKMZhZT+I11cBTpOnPAc8iI Ct/h18HzGkHBdEnsHQthq04cRQS+jXELPNTFSCMOsIHTEweES/mSSjwtAs/DNQ4ekGWH VEea/xI6ih7XF/zCsE3rQ7mBU8i5xaFijZd6HEgSWUsyH3l/0HlY/BuCWUy6S5H0og3g tQnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535420; x=1754140220; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XO2Fy/81E/WhCOJwM6NoWD+/CZxHHhnDjYEWoZW3i/Q=; b=F2b5ytvOjwjE8IQKFLHjtuwG7/nAUsKkn8jeER0AE+qaHpL+ogba9bZfJFcjQPx6SL tOR3QYSa/GIb9AoTojR79eJIKf3my7VwSE6YMrXBWJfBqW2Xi9AGu3sc8yzJHj3qzMgW /wtDp+5pL0DBj3GjOlHMhmDQTsLdq0vw/wzvxUv8GR9JBfkEY7FfmzDWjMWOFYgzoKZX sVb/Xc/YM9walaiM0PxhJJEN9p+8De7we9DGII01gfVEH2FT/SGv21u9TFrNgfsMmPrr DDMnEQSPdkbh8oeHB92ADrCy8HBqzKBiIzoYE7olprufeh8qbJ1GN58J8CxXYcK1wTxX O/Mg== X-Forwarded-Encrypted: i=1; AJvYcCVUayJCLJVe10EkJTE4JR4Xtis3AzsW/xHQItr2Yppg3+hXVbzZ4bumXN7uMqCODFxEdxoTJJd9l/x5I0g=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0Zw7J4WT2qxkNlDNvjK2/+6W5Ks+Ihb+yjI4mgkUbah4QuvXF X05prN48VnLVzVizwFzdXw3hDuzi0EuFvgj6aUMSga5xlYsA/8GfClQTyGdp0CKkFG8= X-Gm-Gg: ASbGnculxiOeU2ZR5ZNIb3n5E8/dcCJ/9+9z1lc4W5MyZO61aU2S6W+yhMDYuR7GE/4 a44CRsyRzkJFu/tABn5wIuhKYRriIQZn0ODbPE+Q+8dd7LKdFHO/spJu9oO/tikhrIqOAZ3MtU2 Ddis97CwStFih1JSReV4yipSK/8fkqeuTu/FT/V8wYYyBbgZoQkVavZNWb4OPNHKd3M4RfjcR/D CFjVpGtA9gWtaItDkC1On3xrKfo0Ezshp2QKie+BvvitXvGsK0krLRk7vHsW0QLdVEH0TQl8YG1 YOKcMMbf/7ZNXWckZH27M6CT5ASUayqE9Uc3raD5WgNbVqsBvplfbO77xhpN1p/1VNCHbk2uD0c KaJSjmmR3jVClHdWUwvGDy9wXg4ghMpUDAWKdKxBd0QARPvMD4r6IBa9g5hjHDxtr0A== X-Google-Smtp-Source: AGHT+IFowWZBk8AVURVAXWPSaWfOPiE/GFgKH2Cki+djIREns99xE2XqEQbxbnTzUozYyQveuIR00w== X-Received: by 2002:a05:6602:2dd0:b0:86d:60:702f with SMTP id ca18e2360f4ac-87fff9442fcmr893288639f.0.1753535420282; Sat, 26 Jul 2025 06:10:20 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:19 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 6/8] riscv: dts: spacemit: enable the i2c8 adapter Date: Sat, 26 Jul 2025 08:10:00 -0500 Message-ID: <20250726131003.3137282-7-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define properties for the I2C adapter that provides access to the SpacemiT P1 PMIC. Enable this adapter on the Banana Pi BPI-F3. Signed-off-by: Alex Elder --- v10: - Move a few things around as suggested by Yixun Lan arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 12 ++++++++++++ arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 7 +++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 13 +++++++++++++ 3 files changed, 32 insertions(+) diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/b= oot/dts/spacemit/k1-bananapi-f3.dts index fe22c747c5012..ae9409fe398b2 100644 --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts @@ -40,6 +40,18 @@ &emmc { status =3D "okay"; }; =20 +&i2c8 { + pinctrl-0 =3D <&i2c8_cfg>; + pinctrl-names =3D "default"; + status =3D "okay"; + + pmic@41 { + compatible =3D "spacemit,p1"; + reg =3D <0x41>; + interrupts =3D <64>; + }; +}; + &uart0 { pinctrl-names =3D "default"; pinctrl-0 =3D <&uart0_2_cfg>; diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot= /dts/spacemit/k1-pinctrl.dtsi index 3810557374228..96d7a46d4bf77 100644 --- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi +++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi @@ -11,6 +11,13 @@ #define K1_GPIO(x) (x / 32) (x % 32) =20 &pinctrl { + i2c8_cfg: i2c8-cfg { + i2c8-0-pins { + pinmux =3D , /* PWR_SCL */ + ; /* PWR_SDA */ + }; + }; + uart0_2_cfg: uart0-2-cfg { uart0-2-pins { pinmux =3D , diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spa= cemit/k1.dtsi index abde8bb07c95c..580f77b5e838a 100644 --- a/arch/riscv/boot/dts/spacemit/k1.dtsi +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi @@ -459,6 +459,19 @@ pwm7: pwm@d401bc00 { status =3D "disabled"; }; =20 + i2c8: i2c@d401d800 { + compatible =3D "spacemit,k1-i2c"; + reg =3D <0x0 0xd401d800 0x0 0x38>; + #address-cells =3D <1>; + #size-cells =3D <0>; + clocks =3D <&syscon_apbc CLK_TWSI8>, + <&syscon_apbc CLK_TWSI8_BUS>; + clock-names =3D "func", "bus"; + clock-frequency =3D <400000>; + interrupts =3D <19>; + status =3D "disabled"; + }; + pinctrl: pinctrl@d401e000 { compatible =3D "spacemit,k1-pinctrl"; reg =3D <0x0 0xd401e000 0x0 0x400>; --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1223124EABC for ; Sat, 26 Jul 2025 13:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535424; cv=none; b=AFjQf2LeK528mXVH7mpeX5WMfByzt/FXgt4MoWEzDfUhLLHcenekju2va9zRG28+qabPrsJo4NFMjn94r86lFZnqcZFI5GdA6QuIJPK685LuxlwG1baJXocC3xnX0p8Wav0dXkmcBQAVhMR/S0v723BWbetrv2lS4P/CgOKz9QU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535424; c=relaxed/simple; bh=4MkO0yPVEXokF7BKWo63wkxjH8l6ox9Iw2xywkWl/sg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GolXjW+AjNAJf2ICLmMaYAZLnQ1y60H1NLaXY0UDoqrdYU/CHZEAbsPzvyNGSptiEigBZb6dJsgyiBVes+FOeSub75FnKlgtct46XGjx2QkyPVsOHlM77OLbCVBQDqtZtJHyIGc7iCEA1meFOxKWGw0mB4NpS+nge+88pAYXN/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=FQG1gclc; arc=none smtp.client-ip=209.85.166.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="FQG1gclc" Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-87c46159b24so110268239f.0 for ; Sat, 26 Jul 2025 06:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535422; x=1754140222; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TzbsCOAJDq8e6tJqb71PLkWE7SOSqQYLq4powgsnVhU=; b=FQG1gclcMfJrpj4/g/oaNZtD5RlK4KFDPTm2TXy9p+Vi0tHwXqst19q4CcGlSm7Lcc Ty7YrnNLlznsBhlq1FV972i7ylEr/5TGjSRxuZT+MksNmAvhADipy5cwPLE/uVehq6zs UsDL2lLT2DevxM1U4fdgwNY5yREVEtCNJRGWo8n6pNjR1IQt+YtzKVjIfPpFojA9im5J LuaDNjbRa35Qr3/AFTWx3l8X22qcaFQjRzyEDNH3oIa9UEp6KYxNQwOva6AscUxVtaM2 ckPywOskiH7anEmgTt/Q5isK/kLuuecEtfemBWB+yNM10b1QOtdi9slj2NJb42pXdyd3 dKFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535422; x=1754140222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TzbsCOAJDq8e6tJqb71PLkWE7SOSqQYLq4powgsnVhU=; b=p4mSxcpDv+COp2wqGWLuw7DgJ+h7W4iHdfDp0vRzJ0W8rfaRoDrytMlAk0kvqVdilH JyZ3nKxjI5k/UZp5Ls8Uqy4rL3WX4QUCIaztLY6MUYNjMAUGssy8OmGspgK32HpMkg9b JT8QEkK93/n5FvnUkVuf/6j0gsfsaGPuMSOkSXh+OTDhmLGOJcp4m9VB+SY82jahXn7B Z680nehD0M4JrrkLCNsP06CSGqLy8naJgAgOAx1AmtTTH/Fy0gkaecmyVVgwoV80dIrG Tjhgxps2a/NK/Ib+/crk3D3g069jkO1YrGRms5LmXtcR2FcNeLuH96pSYR20miD2Ic/I 5VtQ== X-Forwarded-Encrypted: i=1; AJvYcCX0EeKdKSskS5eLivCE00DR2tsUtLpVwyJV5kT85tT72zkA0pEwou/inr2Nv5qLRIgX9haCS+aNbGDvrQg=@vger.kernel.org X-Gm-Message-State: AOJu0YymasdY5qSXr6TzHFnCfIYwgPM7tuOv6EmuOUTp3gc4932/06dO JFmDLxRab+94Yik/SRYpkkBQAUZPKcMSicmHPjVXKFp62p221zn67ioKcknM9wUTjt0= X-Gm-Gg: ASbGnctPmL1RBsQ/ivOG/2p/1RO2Zs+M3CkdYKEuxYYbjizYSgVexELnSrrygoMrojl 5C+IDEzvaqN1OzVx5NhRtcr/Wbe/t74d47tfYEKK12kJT7YBU3Kp5NHqLAy2vmdJFenCcaficlh i8LK/6N4120AiFY88BV0GrGUlaoyypY9QTon53wh5PqnbUje43OtzD0IrAFFhplLKy6mqSbHd3+ tRNQVTaWj+hfeT6T5Gv3PMYX/yVNmFRkMb0oBfEljD6IG9a4R6IRZZoGK2aX1JCYW86hVx16lKB bKIY9sEPMkeTcRANIcZan06PubwFclr6IDf+VXAGPHvsXj9dC54Ku2zujzU2BxorrUmBs/B5nKI zi4mdsj2vvObLI6lpN4FnYPdvh7szPb4OmNIqv6GORk5vWBz/r2RQqd6incgjzWzb4w== X-Google-Smtp-Source: AGHT+IEpZQvcDQ2Fiuw6rkA+hiigtzBH5kJa9koi+D0lRnfSJ/J4FDcv2OYkyFVUHNTZGcQVha87bQ== X-Received: by 2002:a05:6602:29d2:b0:85b:476e:ede2 with SMTP id ca18e2360f4ac-8802293bd79mr913033239f.13.1753535422246; Sat, 26 Jul 2025 06:10:22 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:21 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 7/8] riscv: dts: spacemit: define fixed regulators Date: Sat, 26 Jul 2025 08:10:01 -0500 Message-ID: <20250726131003.3137282-8-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define the DC power input and the 4v power as fixed supplies in the Banana Pi BPI-F3. Signed-off-by: Alex Elder --- .../boot/dts/spacemit/k1-bananapi-f3.dts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/b= oot/dts/spacemit/k1-bananapi-f3.dts index ae9409fe398b2..a11a60b9f369b 100644 --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts @@ -28,6 +28,25 @@ led1 { default-state =3D "on"; }; }; + + reg_dc_in: dc-in-12v { + compatible =3D "regulator-fixed"; + regulator-name =3D "dc_in_12v"; + regulator-min-microvolt =3D <12000000>; + regulator-max-microvolt =3D <12000000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_vcc_4v: vcc-4v { + compatible =3D "regulator-fixed"; + regulator-name =3D "vcc_4v"; + regulator-min-microvolt =3D <4000000>; + regulator-max-microvolt =3D <4000000>; + regulator-boot-on; + regulator-always-on; + vin-supply =3D <®_dc_in>; + }; }; =20 &emmc { --=20 2.48.1 From nobody Mon Oct 6 01:28:19 2025 Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B1CC253355 for ; Sat, 26 Jul 2025 13:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535427; cv=none; b=tDhjjUerIamazB9SJaAFfByqVYHyl+lKBQmlNAHw7Mzzgd10OXYk+u6x0pz5vRZ9oPpp1T8aUUTP/Tu8IY1t94EbqLOcxTenP4cEjhEFVr+irI6GGibg8cgM4+58H9gDi/TxyX2rRI0q5bUzfghz5kkIEVcADk2XqNsPZngt25g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753535427; c=relaxed/simple; bh=D00Agu9o5lMwHglRF8JEmN9Mz2SwGM8gIpQ2brQAJHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YDWwnXDM2wcwbhiZz037H68FuXl1aMyVvnZ8HQiZfLVJaIsq+T7nPMnqzF1U5HDuaVInWeKYzctrJD9bk+6cW/E+MX7lA/TF+aaXuvJpFwepno9Vz4bEgI24+rc+bUan7u/e6sCjEguY/iTJM+GQA+zxbaH8o0E8xlxrwG0tHaU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=MIgG3OiW; arc=none smtp.client-ip=209.85.166.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="MIgG3OiW" Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-87c0bb1ee4eso66810739f.2 for ; Sat, 26 Jul 2025 06:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753535424; x=1754140224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RmHcfUIrXFFWAxyqlPf+YQqXo4C+Q0QbA66Hg5xFlzs=; b=MIgG3OiWocH0+YrJu0UW2sfZ02Qu5DeqnDLOyS1orbwuxEfznU6OWLHP4tjSVHwNgk c3kx5dj7SipUwFbb/6whTDp/sB0SWyTOGesoc6uKcKwXHt6wE+pZuCNy4t+xUeyYlxo8 6LeDmk2Xk2CXiFP1UJTm2m6LEtX9PRPEyPXp8xNPw7G3FkKcWron/KA72a87pSlwiyPT SKSsDTWG0G02DHRlInTT3a+eION9aHpLyIETznKyyaamm1XB6pqFE4Oad9ZqPDkTAn/J pGCD09obhs/iBYIXdHGQ43dsDXmwvFkoPl4p09to+rqj+qbmVyn4xNyN+SoqidB3nxa5 5uyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753535424; x=1754140224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RmHcfUIrXFFWAxyqlPf+YQqXo4C+Q0QbA66Hg5xFlzs=; b=etxKah3x/0W2r896s49tzoOmKU/C/VRH4CBjZ0CGQYjqCpzvuWGVFCcJcaoc0zrymb WPKR4v2B2ySegnorSV8RX1Qb+ZKzsei0991ELPEVaZJHndEhj1XJIwyBccAeOIxR53o8 DCsuajz3qL4XSaGJd1h1/MvzXRS08OyW8IXn94jtGaGCAogwUbW7uhjRxMi0z4x3dr/I g324/HzxQVjRV2SYrhtrFGaBKRGQll6mVJdPQkNQvnkNJ9iML5NEjfDTDGfplr3GkiwB AfOFOlky+oyV3/rUE6lh3hgLr+V5sOx0KVSGdX7sAQy2+rErB9uXnU4vheoPzW2B8Qkn BC6g== X-Forwarded-Encrypted: i=1; AJvYcCVr4eApyx6aBe4vCSVB9IWVslRjlY4mUBk9OTYYuJ6n40SmEin4CPfAS7jxkTmPOfFriJ0HPUNLsJMr3XU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx192JvBLm936vOVujshK1I+5ztmFzOkP0dTVQdY8E+nddt2Dcs JvzEGf4IAn7lAPEgsvgdExEgVj1k32kktTyrOROGLqZ8AadzuxNfIWXKGU0sOscpSK4= X-Gm-Gg: ASbGncu3kUypIgCmO1yndyR9QexrTy6Oy6qGfWRPPNPq8JiZqGucsVOwT3qOEZN4BPt OMcrs1gWyMPqi6p8GaVLvAZavf89nslA30SJ+IQc1k85tm8INh9U6MBUlp5I189VfhohAZzCxxw SHOlRoOMPjrpD0cAE9fMFqSrH4GpVwGbpEu4Chm6fHcfFCr0p8kEixo+LfYFYBBFmYUuKL+Iy2Z kjreWOShNZKnXdejGAc9hzhdq0chXZi30+LbOe7i8cgTf89s2NaQ/XiTKBMNMyPOcoH40pY9oYY gKZeFDc3VUXYXFxzGZRCN8zCu/SgXPXOF/guEMvaepu6RX3bMB1hYEJy7SRgSgd+7QGwqRci4E8 JUdtXnTi3+MGSBzoi+3oY9kv6sIVT5DlfhWQdH3+pguJa/9HI7YzGpT2HyKbXViY2CA== X-Google-Smtp-Source: AGHT+IHnZ5VxjnvnLu84xJpltA7xsi0CvkodJCb16fAczrWGpj/N0ZZOz3kKEjYSRbp1bBk68OHmvg== X-Received: by 2002:a05:6602:2dd0:b0:867:6680:cfd with SMTP id ca18e2360f4ac-8800f0e76f4mr1007709139f.1.1753535424237; Sat, 26 Jul 2025 06:10:24 -0700 (PDT) Received: from zippy.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-880f7a4ee9fsm49551439f.33.2025.07.26.06.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jul 2025 06:10:23 -0700 (PDT) From: Alex Elder To: lee@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, alexandre.belloni@bootlin.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mat.jonczyk@o2.pl, dlan@gentoo.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, linux.amoon@gmail.com, troymitchell988@gmail.com, guodong@riscstar.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v10 8/8] riscv: dts: spacemit: define regulator constraints Date: Sat, 26 Jul 2025 08:10:02 -0500 Message-ID: <20250726131003.3137282-9-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250726131003.3137282-1-elder@riscstar.com> References: <20250726131003.3137282-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define basic constraints for the regulators in the SpacemiT P1 PMIC, as implemented in the Banana Pi BPI-F3. Signed-off-by: Alex Elder --- .../boot/dts/spacemit/k1-bananapi-f3.dts | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/b= oot/dts/spacemit/k1-bananapi-f3.dts index a11a60b9f369b..a9a2596a94e89 100644 --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts @@ -68,6 +68,110 @@ pmic@41 { compatible =3D "spacemit,p1"; reg =3D <0x41>; interrupts =3D <64>; + vin-supply =3D <®_vcc_4v>; + + regulators { + buck1 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3450000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + buck2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3450000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + buck3 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <1800000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + buck4 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3300000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + buck5 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3450000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + buck6 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3450000>; + regulator-ramp-delay =3D <5000>; + regulator-always-on; + }; + + aldo1 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-boot-on; + }; + + aldo2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + aldo3 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + aldo4 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + dldo1 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-boot-on; + }; + + dldo2 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + dldo3 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + dldo4 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-always-on; + }; + + dldo5 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + + dldo6 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + regulator-always-on; + }; + + dldo7 { + regulator-min-microvolt =3D <500000>; + regulator-max-microvolt =3D <3400000>; + }; + }; }; }; =20 --=20 2.48.1