From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 1CC4E24DCE5 for ; Thu, 24 Jul 2025 20:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388719; cv=none; b=VKQOJca0zla457WFPL7CEGwiVGfvsDDPgq/nfg23rWxunl3QM5fylcW6YgxnvvkELZNgOheJ41/WO3rTayLKgUTCyncV66MAqQkFdUTyn7DPPaJOiRxHVM200cr6i82bPdJMel5H1PDwppfi4lno75vtZCUE7ToKdIFGXWX8SGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388719; c=relaxed/simple; bh=bU00eIbaxTlZ1yJH4SI23SGz9SQnCl2cghYFI+SdoQI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KylwGqcd+kTi4Xcp16cll9n09qdwkCux0lcYzs6l+UXUUCXvK5gbPsAhv2xcmEtacCWD8E+lVZcPPvutFif7Ixin+CIAl+KRZ3VSKrGZ21pWe9uC2NDvX4yTDkQi6Ycsmk/NOj3cp8GsG9me7Bu1vvP9O2RulOguq8yWHMHaZcs= 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=14fK59CQ; arc=none smtp.client-ip=209.85.166.47 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="14fK59CQ" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-86cdb330b48so80602139f.0 for ; Thu, 24 Jul 2025 13:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388717; x=1753993517; 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=+iG+v28WWuHGvV9OeNkoKxEvvahkCo7ownJvbOD1hUw=; b=14fK59CQShpyMeyQfVOyGWbPZd9PoG8QCa1txVBC0pg52II3RHniFvaHsAgPpu530+ XocnaIDkyt4uFFxP0Yy+JsQ+rb6dJ379I4AagEbYjHIVMzQ048vB8RnstXXIxyo+HaGf yZnroeiSDEJnbN/DVZSb3gQkSChw3nps5xZrG5snnCevVRxvBllUtBBSjDju9Q01OgME 3BXC+JtL0RcuGOqyb2NvYewUA451jqLf1TR617XIYxAuXNWfPq82U/0MrGs0ay7pW+yV YGxyyN1MzsBFyFKPSE15GgVsmbWZnibOmNTOeh4M8OqXzJ4prdp3HRxe2ra5q/PJtbQc RFTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388717; x=1753993517; 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=+iG+v28WWuHGvV9OeNkoKxEvvahkCo7ownJvbOD1hUw=; b=ENe+hiJnFUV5UIKJBpJM1exnsYQ91oh+qYdfdhgzVyZB3p2DkByCsi5JtPq0XgtIyE tcaG6lxlKyW178pDmtJ3MMp6qJq6vAOQAfNQ8qX9hwLXYGb50HnCz7DGQs0hz6rKO06f TNAqmnaO4QAVr4iGd1NmOlpG87KUbj+LD7jcdLrgB15+atVmkj4o7/txwH7FYX0rKC1R FZ40aYw522tVajdVQjE1qIAmWQ4J8KzLf5elvujtiXOSsVPl56hZ/S22br2LzIf0VRhd hyemcT6LYzoaSrT8tsaKKDZawnne8HApzZmGFgWGWdRwJmhO+ouZxZVDZiw5fEHwGKLw NbRg== X-Forwarded-Encrypted: i=1; AJvYcCUf1LGCfYPKGPzyQfD7TLcw5GqVBZ9AcoiM9Ye1/r+5ROcZhupI0hvg8m2mvb7QH+WvJvyG0CmgT4DPcM0=@vger.kernel.org X-Gm-Message-State: AOJu0YxbeLjy9d9ql6mIcwIBx/RpnIKPAKOJLLfoHrcID3JMyjkQpCTp Bw41zu7eAj1B8tOe/ecuUS+4buKSN8FWDtU6Rtz+XwqQcjl5PO1WvPTwSDNAY9DXhjQ= X-Gm-Gg: ASbGncsmF1j5K80tHoDqc7gAkPG3pIP7Gazit8o30TNLwM49HqC40+iO562fzz2Lzrz S6Vh9Wvp4LgZT0sNK439j10grbWRKn0eWWglNHgPu7xxDL04faInRHX2LFet+F2PIUiMBBbgdKg aIQo8hhbRKL/qufmDrEmN9gz7Or8YXDAsL+hWBQHQblyfxmTpOVG0ENe5SqI3u5UPIf2pcv78Uw FbdgDCluQD2UpFkhah3tGTPzg+DyuzY8qmpHFbzXq8e423HG0fn0G2jtE6mrA2dx1Ho4uzsMaDw st3IswFH0qeBmaEDp3/UEVfsYpXjMj7k/N/x6u53ydeqJs4OcAzxzJwRWLnt4tQ2HtINQbDI1UJ vgbr4ZB6bNimd73EKxrl1oemEn7E6Uy/sb5ycRANqoOMaXiWljqA= X-Google-Smtp-Source: AGHT+IF3MGunKrhFL7OMCRuAamAqvXPpD1zcQkVbRcO7EjbuhOz10E5IrYVw1aiHLFsX1ofJu4g53A== X-Received: by 2002:a05:6602:2cd5:b0:87c:31ad:abe2 with SMTP id ca18e2360f4ac-87c64faa2c6mr1456048539f.5.1753388717180; Thu, 24 Jul 2025 13:25:17 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25: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 v9 1/8] dt-bindings: mfd: add support the SpacemiT P1 PMIC Date: Thu, 24 Jul 2025 15:25:02 -0500 Message-ID: <20250724202511.499288-2-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (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 013EA25291B for ; Thu, 24 Jul 2025 20:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388721; cv=none; b=A0iCweFLFM9bJCOxgfkT7QArVKqmn+7UrHoQzn6vGwPIwX5HqfXCiNvemKUJB5Nrr8kpBAdoJ1+4h0ZtZUUjR31d+88FvkLnsWe6pn+k3sMBruZrcuspbCWtCA9PVg7SyEDvPSKKfqeVBkZFy2m2dbCLDwzEGEQzHdvmoeS63ik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388721; c=relaxed/simple; bh=UrNWY27+WGuXhBrr8FZ4VtBPQzBe5GWLS5gaqBEezLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bgem7+auKmb+D3+WKXDjT9FR3QHhML6pu3eQw7Zn0yWJ5B5+wOc5meuXXuI6M5Ie7yq8vzTVVla0nmKwfCBtyEn1Si5FUbFWJt/1rwLWzQkA8ARJoCSLXHl01UoIPUDeVLfDPqTYOSxmj/mVFJvYa2geNVOQiQeaOwrQtBAHGdI= 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=vyH00tth; arc=none smtp.client-ip=209.85.166.44 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="vyH00tth" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-879c3222a14so48248139f.1 for ; Thu, 24 Jul 2025 13:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388719; x=1753993519; 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=mUWJeO10MspBNvjbgvonhw7oiCj7Ud69EwF31dVMKc0=; b=vyH00tthU2gfIwChYemo5wrwz0yO+Mt7fE2TPm/dxXiKtOwHYHu/WxRXiDGsYXriZR S0PybRIXNuWgfTrz8P1RDd2niMKxibj9eqKQey/SYDDZOtvkNRJUdOrZ7LHUnDcBtjeq sBrpNWaVmhvO01JtVn2KxueAO3RtUNueOzNuW03qxJlpwdHYlznD3wr57jV2hfqm01Li sPCtE9LnQLV7rWnIUJZGY8/Dy8/y0tIArL6d8+HAl33lSKo5XBvxrl4JvDQ5i6m/v8Zu OLxNpWQj07ol5eB8Ua1ltRU2GWzO30zNb01Or1gngp6+dtyRAI5XJuXI5XRG5KGUNntx NsQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388719; x=1753993519; 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=mUWJeO10MspBNvjbgvonhw7oiCj7Ud69EwF31dVMKc0=; b=sQDzhX4FFp4Hr8WYZYqJ/TPYteESP7Pz32YcmNa9XPKrgY0TkravByUIjkex/nMxT1 mxtEm2RHWXhlTfhOVr0w4a2ZmprbOJ/Qd1wUcJzlvtoBOTlLoGSgMGHat/4+WPoI1UcZ FjVCPiFtKHM0ZV/8+el1KHRJ1apW27EKvmL3RQSeWBCPRdWJnmTcWcBgA+ksuqFwXZB7 ThE3iIxz/0jOsJAapg99Kr2xQ2TH69ms/Nr1I2Kn/6BL6rHrTEOqF4/gctSK1HQg+MB4 uSThySgc0FBDNcahzRblHJaSYkuuwMLDDJtU4h6qVMh/eQ3h6Eaf7xyp7RcecFS73sO7 OQRw== X-Forwarded-Encrypted: i=1; AJvYcCVq2DZfXiDL1Q3Y6BXwDcoR4CpmA6Ppr2ff+nlX/JMfDMNb+4nOvL1iGNOGRgCkOWjEbNDBQGVOu+Fo7Nw=@vger.kernel.org X-Gm-Message-State: AOJu0YwCtlMum5jffdFNAxBfliO5dFjGY3leMWU6Cjgf++yZJZh8wuOG kqLkj1eFAjRysL9LT1kWGccnlhb4yA8xpIrTg+oqfUkAQy8tXnxSD/Ih2I82hWkYP9s= X-Gm-Gg: ASbGncvJVL1mGOK9NFsH8XO0WcRgen9j+8h6CHK2Xna4fRO14Sq6ROS1utCLlqtYZlD lSRUaQihwaCqL89wiDjZXsvXm3AoFTNZ/5fSSv7M2GCSvYcjA/sqw5V2lyDp9LAxcyVeIqdjIDR LIR6eDUPcyyenkXkLfC6UUPEoEtE6HChLG8VziyqTx9PGY5DT2dEdxAeW34BpuYj7mSVSQcFO/N Wu6AEBAg9A97PzCPbLuO2MEMgQWBkhyI/MMHHbsFhz7SDb+qKCE5yp1P6ysUz7t4j9DS3nR07Nk 8eUmTnGnrQGkqRO987aM5AVlfbc3dSqGKe52WX1o4/JiXCRHeZN9m+YmoD29BBFx9bke/ujFAqz uDE8texcj/jcJm0NzKQqmEeEXHsvsQdEiSoBeohnd X-Google-Smtp-Source: AGHT+IFUp9h4K9IBStIoZAgqsn9asnHHUeYZME463FiGof5MP3p6oGHeDXOYqEh2MNkn2bzq84JyzQ== X-Received: by 2002:a05:6602:b8e:b0:876:7876:a587 with SMTP id ca18e2360f4ac-87c64dc5c35mr1342670039f.0.1753388719095; Thu, 24 Jul 2025 13:25:19 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:18 -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 v9 2/8] mfd: simple-mfd-i2c: specify max_register Date: Thu, 24 Jul 2025 15:25:03 -0500 Message-ID: <20250724202511.499288-3-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 --- v9: - max_register takes precedence over regmap_config in simple_mfd_data - New function simple_regmap_config() encapsulates providing config - simple_regmap_config() allocates a regmap_config if necessary - A small duplicated comment is removed in "simple-mfd-i2c.h" drivers/mfd/simple-mfd-i2c.c | 38 +++++++++++++++++++++++++++++++----- drivers/mfd/simple-mfd-i2c.h | 5 +---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 22159913bea03..f3ba79c112d4e 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -29,6 +29,36 @@ static const struct regmap_config regmap_config_8r_8v = =3D { .val_bits =3D 8, }; =20 +/* + * Determine regmap config to use. If no regmap_config is provided, + * regmap_config_8r_8v is used. If max_register is specified it is + * (also) used, whether or not regmap_config is provided. + */ +static const struct regmap_config * +simple_regmap_config(struct device *dev, const struct simple_mfd_data *dat= a) +{ + struct regmap_config *regmap_config; + + if (!data) + return ®map_config_8r_8v; + + if (data->regmap_config && !data->max_register) + return data->regmap_config; + + regmap_config =3D devm_kzalloc(dev, sizeof(*regmap_config), GFP_KERNEL); + if (!regmap_config) + return NULL; + + if (data->regmap_config) + *regmap_config =3D *data->regmap_config; + else + *regmap_config =3D regmap_config_8r_8v; + if (data->max_register) + regmap_config->max_register =3D data->max_register; + + return regmap_config; +} + static int simple_mfd_i2c_probe(struct i2c_client *i2c) { const struct simple_mfd_data *simple_mfd_data; @@ -38,11 +68,9 @@ 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(&i2c->dev, simple_mfd_data); + if (!regmap_config) + return -ENOMEM; =20 regmap =3D devm_regmap_init_i2c(i2c, regmap_config); if (IS_ERR(regmap)) 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.43.0 From nobody Mon Oct 6 04:57:06 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 605DB256C8A for ; Thu, 24 Jul 2025 20:25:22 +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=1753388724; cv=none; b=pd8CYDqZt+/xwRX8KdY24QuQjiurykIPf4vEn4mr9F9y6qLV3qUHG/UsVEim/ansggfXO9eDrXAU8NxkIa6IyXVBRHviqdHlbQVnx+zvL4Df5T0ysR8xk42JIvFYbF1Ye0VQSmHtjmjPG/h8sUHxY5L17YlFnmr5iMb7RL9sgk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388724; c=relaxed/simple; bh=l8Y690TjTxBtWa5UK1Ikcjm4OIFZIWjVnz92Fpv/IF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S1PzJwWAWBrDbZTHO2ooDmrghwEBd29oAqkj8FQwiHXP2uXP/wycm6DGn1lKovte/zriQBtTf9TMJoaL0MteaB85n/VG2d0A4aD9xEX0FAS/mCGwAzkPpFKeKtxVwLhkBOXNfz3LI4vNQZwlM5JkIHsOoFKv6drFZt6U4vpMqnk= 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=ghyKjXV8; 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="ghyKjXV8" Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-86cf3dd8c97so109002639f.2 for ; Thu, 24 Jul 2025 13:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388721; x=1753993521; 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=1fMagwIpZN5H+ZLBoespMypsP1iYS62LYPB3IOcPtBU=; b=ghyKjXV85vSUxEZHqpCTOBF2p426xlpy4aDdTVhoTI/M3CXUaHp2nUOswmDRh1V7up +BKuPwNSBH2jNkHiyJQ/XvczQo6OnfeEuPj3EOsQDKFVwYnWP9kGd6hDtjEVkX+LL3cn 9hxeT6f7LnbdHlbmvPEhQfwXLy0tst6m9lvHG2ZaoJ8ZGRZfYwCZvDiJNU7KrzWUkW7+ nHKd+IBO5Cp3LLGwkKInp5S5sU3utN2p1NSm0M7xtUe09SVVq930eiOAviH/cWFk9dEG cWW1TAYC8km83cXiFX/OcIA91uUcZizcm4x9zGOJc9V/902sF21JUWKimyot+Y6Hy3zs JJCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388721; x=1753993521; 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=1fMagwIpZN5H+ZLBoespMypsP1iYS62LYPB3IOcPtBU=; b=iEwetJkeOBF2V1s+iYSQLSdq3bktaIk+SeeWAMTrch+T02IHKN81WnRGaAAV8zJhDZ Y5YSq8SiYYw+o/LoOd35C4nrrXt6bJtWZo4Se1Hc5lSoFLo9z+7OdVs3TK+cu5qfZ3r/ nb0okqqWXip7Pp3qyQFKzKfs9qijdhazz6tP9PUetTU0rcqLKa2iSB3MZ47+n5CiL6fF LiS1nXIFTaSEkktRB+fc2t7JCvo7R9piyHYbFuxZ50l4/pK1CiPUmuJi52feV6/7b/K6 aaoTAioy00h2mYSrDQkgkOYy9SOoClmh/zkew6DDeHTidZZSRS8PX24VKhZs/BeUNYGH vscA== X-Forwarded-Encrypted: i=1; AJvYcCXN14P0OsU71eHYz15JjRRq3fbwmnJHlPVAmF74Q/SwoYzdOzE9hfMivUtay4jjvmW3zeW/1WwdMc3Bf3A=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4o7Nz5xUfAilofgu7OrNJko4GVhrZCJtM6Zipaf2miNcqJEJ+ wCHbh+NJfMoFPTA6cJz3N27W8T9vUNNcVX9P+j6xbpF2xIOfR93J0DjZTGEQ5qy0K6Q= X-Gm-Gg: ASbGncs9lFr2/0F2iqoy6kAJGr9vICIorEQyFvhsyIxpXIRS+9XqCOWIzqVogtP8qT2 qfUMXt2jCyL67nFymA0TTU7Tt9iVLKuitHcNRJq24qfAUW3hPLDzDMzxKhTy0eU4ECHyGn1szJ7 pb7PVoFRTniPtebqMsbEhZqp6GqobqDxI+hOU35rDrCBk6J4FRah/pwXbQTba+FVU8avsyGM4W0 kusDuFTDyclqo3TJ2PoH9uBfeWXhCvo7E1JIsrt9BTrw/f6eHEkoDHpl1gUdue4rsO6ulDbkR7u ZVPONYhWASxzkPsyxDVZPSeeMUaEzMvwX2/72a/C7XYmmTFvzc+SVD6u031g3PWvm9+cLT4ES0K 8U2A2ffooQ7g/YZNS6/9tOM1BZBtttreAUZKKwAQP X-Google-Smtp-Source: AGHT+IEzuYz5qj+oH/RB69ZJfeLnXb048BakkEMmEAOuLS639h8MxrVG/7gNIToNr5fzMcWgRRoxxQ== X-Received: by 2002:a05:6602:2c85:b0:879:c609:f5a1 with SMTP id ca18e2360f4ac-87c6504722bmr1515412339f.12.1753388721347; Thu, 24 Jul 2025 13:25:21 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:20 -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 v9 3/8] mfd: simple-mfd-i2c: add SpacemiT P1 support Date: Thu, 24 Jul 2025 15:25:04 -0500 Message-ID: <20250724202511.499288-4-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 0ea3a97bb93d1..21b117eddfea4 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1182,6 +1182,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 f3ba79c112d4e..fd5d7b60433fe 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -121,12 +121,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.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (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 0DA0325A2AE for ; Thu, 24 Jul 2025 20:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388727; cv=none; b=Xb2d++PF1X/BlIiD47NY/kBTN57ptLIq6blzDIUFpqyJgWysoXn6HKZABJYdOVbbUiEpyd5/JLrC2EMqKkyJCCE9XUDsV8qYabTLTkwnhf43G0OEYUg6VUMlrG4VKKJoAoanlfDo9R+IoZQlGWVaw2CKnppnIXvc2z4sFg5fT4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388727; c=relaxed/simple; bh=9yAQfyGYVLXyfkkTfqeVQq5G8Mv2h6aGEzS6CgeOAAI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A0NnAM+k+Pq/03EigVMQ0oQ5QvdBqZKQzRXxAzx2Qzqeu1/Z91WSWwRELinHXWJ2IcW6AbapEYwxPbDmGaloDTYcKSGPCwH56xRDT24bRQ6hkqOvwKMykuoQu+MyzwE0KDoE9rrYTn0W27Bf8bOtYbqG4tKgaW5FUFxuHPBtBpo= 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=N5MlcpK6; arc=none smtp.client-ip=209.85.166.44 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="N5MlcpK6" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-87c4bacb68eso43731839f.3 for ; Thu, 24 Jul 2025 13:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388723; x=1753993523; 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=lc2aqqc97NOP0EfL+BSZC9Lj19cWycz2K5gJfriPT8I=; b=N5MlcpK6fEylzdeky4PnSYqrHQrypsGCGjbGrn9S4rPryi6Yl6jwjOd3rWDGcm9Z+n NzmIv65jJEx8BiEwjFdSWbJAmNYhnjfNwnsTbC+drsvc9Lksev0HmshvUd6WgX2bOHkV 4OgW74UCaKQzyvMnZkyxvOIrytwO5EVbGX9CnVJR8156Iks8f1p0zqvt2/E54bkrJxq4 /Z3b7GlMUldCpnM4NufmY6UBrLa6Rxr8lIlOU77zIdawtH4ZZ1fkzqKb6Bd4vWqCfj9G LYOhAaDRzMAAoFIA2sgRsHRXGgnkJdQWpvLeY66T4tG7DvLzcbfneZlA0PWoXANPazkO 0MZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388723; x=1753993523; 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=lc2aqqc97NOP0EfL+BSZC9Lj19cWycz2K5gJfriPT8I=; b=CR8zco1RX+vJ77CYeScofb+VPPrPXg7qvlx8lOiTNmcOU7uEHOIJU14y9yVYZ5JkDK 6Yq/bx310Q/pEo2W7ntnyEFptXKwe8HXexja8mUdKj5dfI5wXTmaZzA3p+csBcAbOMb6 rHDDjfk4dGKPgnuaWphCjnZNSaESRFORp67TOyH+Z2drCSxI2v2U1zn9Tly3FlT53orh gSPKqwUdvUl/I/e/0EzLUX+tJQ98yepeuXsJ9Et17wssyjsj7aviBd38Uld6+6whzyt8 KT4cR3gNMdaiE1wO8//jVNCj9sqJLmONynu4MD97piuUDfOOQBEVHBvS8sLb1sN8m4G9 R6Bg== X-Forwarded-Encrypted: i=1; AJvYcCVRmyVN93+5mWaiRxbX//mKhOKf472V/xdLb+qaX1+iowzDSZTDDSJb/QBCU6DlIdowMJKwr9X8q77mmPY=@vger.kernel.org X-Gm-Message-State: AOJu0Ywyk0Ft7aDX8tadN1ay4lgWO7AM2mW8YM3ArfRlNoXQP1ERSqo7 Vr/r2AJ20ASsAv7tuXcsKwHmo77PjmTo958mCxZ/sFyogmZCMK4CoE5wEruh3gA2RxBxLDJpjCk O63ni X-Gm-Gg: ASbGncuoeGDqkiAn/TzBLV0XNfM4Dpn8ntcrSyxfJeC8cp27CZqnFgSfDl2VoCt7/OH Yd+AIJbZVeUjKlargb1DMAAvlXg6WWx9JY9KGOFF3P8Itq9IEe/52eqzjL/9U8m1Jwbc28vW+4Z ZJoNLVL+EpM4XR1TtITB/SUC66IvWRzGeCDzCI7MMe2OhHWXI/r/Jrzadsfa1p+DHdL7rFjUrH2 9+qfsxEjqeE2Z4oUl4edtko0lKEl+b2GPDBC6lSrkWZ9na7uom781/xvcPCf0sEqRrC1kc8O2fF edMurGucFEDdgjyFMVPpgOhJWGskEbzUTFHazzr6mFdo9cecTAjdiJqbeP5Lfp4ruk1wpcRz8Ug EdUEW/fdr+q/kiQ3P1OmScDJP5DE4G43LVeJJLvUW X-Google-Smtp-Source: AGHT+IG5crWSYMqOT4gzv3/s0kwhaMnMRggcqK/SrWQWiRkfz5Jy1E/lYbJb+xTUBrb7PdJVKYvuFQ== X-Received: by 2002:a05:6602:3710:b0:876:19b9:1aaa with SMTP id ca18e2360f4ac-87c65037cbamr1427124639f.9.1753388723127; Thu, 24 Jul 2025 13:25:23 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:22 -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 v9 4/8] regulator: spacemit: support SpacemiT P1 regulators Date: Thu, 24 Jul 2025 15:25:05 -0500 Message-ID: <20250724202511.499288-5-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 7423954153b07..3e7feeebf8aca 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.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 DBC5B25DAFC for ; Thu, 24 Jul 2025 20:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388727; cv=none; b=sP0O9krIk2qnWWOSPvpsOWiWrOPin8EtKzn3/inZqnjfadxk7/luA08xX2Hz8EmXjIgo78xTa5oiYfZQEo+E49yJ44G5TeAZJFh3iiqWeAXE9/kTUAWdEoyaJXFYLznkVUju6kFt7BP5TGiB/CsA4lp1w5ZGxG55A/0ZXdFap+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388727; c=relaxed/simple; bh=zvtBU+DZiryJKPaGlyRisToaBx8a76/8IgaDipJlpKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pKmHTz//bjyouVvPhioL5NsGyDNckoNZF2W55roZbjV8B8qS6BQFFdVBen4Fnm/kx3MTQMaPZC7vrK+xYdzWi8a6Y7Ha+MrRpguP7/TrkJd0u73kHyHrxFyl1VhCHLf8iaRafUXmUHGSlaB4KYXS7JazJa7JF7dadb8V34ZIHj8= 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=I+rSztEe; arc=none smtp.client-ip=209.85.166.54 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="I+rSztEe" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-87c017978e6so71081239f.1 for ; Thu, 24 Jul 2025 13:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388725; x=1753993525; 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=FgtiipmWphMgAJou3O815VDaDuhp8ssEMPmLvEqJK1A=; b=I+rSztEepCt0+c892Ej3OxCOcmEslTQ1CmHuGDXZ/DFJLsomfFsQkCBZGz42MU1JFF wxOu1ihvOgeUDXkizdxZ0Lf3Kfi6qvo3BHiOCHt8kzmTyNsWRGy2WaBUF6tyHuAdsXWx zbulQWq07QSjyascbBS1o3zBygbdJzR0weJEXt8sTwY4OHzdnzS6mbA0j44ydWUHnX5j jKOeZFjkp0AP1u3nuD5oKY5/HAEK5Fqgr0u5FHiN/IaVNluRlP6ni43FvKbU1s7QB5ha b9OF3qyQJWonwKBPqV3CVtvAjA6R3JhU/8yi4KYj7ez8R8tSa+0l9W2RVJTNzF6cpuyG q+xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388725; x=1753993525; 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=FgtiipmWphMgAJou3O815VDaDuhp8ssEMPmLvEqJK1A=; b=Q9PSznjUo1nTCSJoPfSY2wVYei4j6Oh6r7RextJr3nZVuUX66DFEyhYGol1/qzZl7J jK7SM5nvGlU08VA/pJiFp++D/KAxhbG1oi315IB5R7vIrYyk5818EnQTE6NGb9l3uAcF 53VXK0rWh+f1qAiPJpg+k2PN/VtilZLECt4FFbKYth9SnSR+TV+WrvokVTGog6dFyjyF d+f85ew/B0V/A65kzkKIASSgzp9ecgT7DV3FhPFoozkbyGXbQk8KOXDgfm68FZV7IH7K 21poJD9nSF0LkScOek9c3aZhApwaIULHjiDqSjBcTmHhlGAJdVmu9xdUQVmxhrasKgYJ YWtQ== X-Forwarded-Encrypted: i=1; AJvYcCWrhqI8n47BRMnepjWFPPTeWW1xgpeR5GSLX4uE1e+20vnwK4mY+q1ytuJ/8G4db9kpF0yKrYcsC3HV8so=@vger.kernel.org X-Gm-Message-State: AOJu0YxLTodIKUrV7r/vLNfoZ+LfIXN07lnokDblLth82JHQXdOR4Ju7 gSyrITBjuh47fPtpYOEbU1YhjUZj7XBWqujRO9PXy1bO8Sub7RKgZHHDrY48BWyv9Xc= X-Gm-Gg: ASbGncsiGqG8uemUoR9CV5tAVa1ns70Y2ZYiLMlR12fBkbYZg6/xKc4cIayQo9JrGIK HeaE8KsaYRhnhH1TTBYDKTNqQmqYTl4dr3VnpkBhq3+6LyEPXedZq2BXcRXWojrptKMGSBSF++y V+H71eMKojAhXfiYFp6jqIax6AgM2GlekJBbxw3HuI/GFmCGf0/1pLtuJN4SJZAFI6jma5jlgac YMMa3kJ487qfwusrjZYh7onINd6UkwucCvKKU2BTOGDftZg3drdv/G5XiU91J9M8ItkjFbVDVX5 mAEG82+FDA/EHm/hhL7V2AuN/vvDhKdKC6crfjwsfxVh5GUpB30b1CS72wisk9sUv1ruZKIdchz ZNkit4/VpbzlJcyKMg4ir4pTc0f91Tb5p7Vcn+G+q X-Google-Smtp-Source: AGHT+IHcP0ElOWvZrgpLuhTxBtnKJ+jEvgaRwOE0f2zEOL16hOo8jW2NcEn379cGMpxfti4Lu3eObw== X-Received: by 2002:a6b:d20c:0:b0:858:7b72:ec89 with SMTP id ca18e2360f4ac-87c7628a365mr403682539f.5.1753388724877; Thu, 24 Jul 2025 13:25:24 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:24 -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 v9 5/8] rtc: spacemit: support the SpacemiT P1 RTC Date: Thu, 24 Jul 2025 15:25:06 -0500 Message-ID: <20250724202511.499288-6-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 --- v9: - Added Alexandre Belloni's Acked-by tag 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.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 A938B246BA1 for ; Thu, 24 Jul 2025 20:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388729; cv=none; b=e1Sc58+gO5tbYjKXwbFOANszxe6ryqjuVEpNFJL5L0ADLV3YijbLbbt0rXNxvrxNm1pf88dk6o5XNcKbJ/x1LhzFiA6xwLhsKdXLubRgzrD9rBOEfxAl4/06ji+mIVlzZZAShI9dHMdssHHXllq8WuXNBRUkU48iv+qHgMaQuFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388729; c=relaxed/simple; bh=MXcjaXpjv7EjaAY7kMP4uQh7uHeIBr5NeRkMjZEmHFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qOvK3sIFsbzGj/XfIL41U5MSwBK0kjogRLNVbSK0dQUcrnKD9GooB6hbevz1+WYYo569nG/hugGRKXdID5PAzjW6MxJ6cBsFa2lE9ChJRiyU+gkNJTBADkmJwZ+hgc5zw5qulGsAQ1nfNw2lFQNLFa8DLHHSt24WQTyYcG3F4hU= 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=ADsMoe9B; arc=none smtp.client-ip=209.85.166.54 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="ADsMoe9B" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-87c0bb1ee4eso36944039f.2 for ; Thu, 24 Jul 2025 13:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388727; x=1753993527; 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=UZU8vkaDk2qb4Gs1NhAs//+b9ebi++Ho3LYwlzWZCXY=; b=ADsMoe9Bf+nSQNW1jrgtHmKCBg76PqfVI7D39/S/Cery5pwaQ+Cwmpq1L5aHsB9lMS vG0R8G90JCvJIKfBWAxehBNuCoOYimdxouTy+t4yt8J45dSCFveh45xHSYnSs7XT5aVc Xx7QW4X02BRqkSXz3wZ0johLBHch5zCsjLbnEPSYRaFhEmb20qYxSK/R04OZHSgwiMEh JC11u1TF8ScfmfDnolzf4QDBs7bGZlUFsd+5jBeUfA//UedoMywRas0VKOysWN95i/p7 m+7uCp9sEbVo6hg9f5Zaa3sN4QDnzhHibyZX0Jo1uQBRwN9rc5m8bibi7/f0ZYJH4k1b 4BFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388727; x=1753993527; 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=UZU8vkaDk2qb4Gs1NhAs//+b9ebi++Ho3LYwlzWZCXY=; b=o4Zu+UqhJtaZW9bubjbZCNf7gjaiDp5hK/TxMoqKJ7BSKIa9L7HxlN9FghjOYAQUGj 6prXXE0cCa7cbUEc99CKBeJSrsp8TnVhis2Fu+aRy29u0z6UGoj2vMXrQCwpALuGCRzb 5UWcnHqRxSgI4Jtbti01xZK3QgpcgRxb1Jxc6zozJ5B39xRc2QMnmw/pX1IziytBtcyg As4+PcUy6zee0aSHXu1T0ihroeZ2xUXWz1yJNDH+FA5VjowpocXP/b1NxY4MPP7d32dK FNmhNRmbK7oa2U25C0aG3ZrMs5tnVknKL6GDFeJuIBoUrcU+9npJm1HXZhhQtK9ydx+G 4buA== X-Forwarded-Encrypted: i=1; AJvYcCUf4Q0Nfk/PFidoJimInj+DOVimOFjaFlTi2qBhqYXvITkkscQVJjGmqx1kHTFE5VUGw/S/2jTnwjcuDpM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx86kDonrBG0sIIfLvMs1GIIRGJ+uaPmc6qey9fUPX+VF8918ag guMocqOQ+GTYBsqASU9u4hcf7PeYh+N7hvrFcjunwv9qGZ55cRZmOl0TTQK9uTizloQ= X-Gm-Gg: ASbGnctUYixGQvdzM7Rhrk9ju3P7znpVPGRRdr8fUaGPfpQa8wxsPGPjwwKjPQWtKju jc6Za2VF2lZ5u6UQJxnJ/Yheg2NKs/o6trU32M0owPNxXBe/hvuDGfm5SYbDPK8zxPCqLJP/HtD TKCy1W0MH2P/+Z/JOtzXbXRDLpGOCna0uUKQM9yoDEvjE8uX8exX5oDacLYXL4P1MqlDuq07XxQ gF1R/UFOAnTpgusQPntG2L6047XKksbE0zmFHLJ8jMSWMlUp5CC+iXbWCLOWICXhYgA4Aq9tLhN SpbABtG6lHT+n2O28zN8mg7jMxgDYRUJPm24q+/1opPzKkT/3WxVGA6az87gL0uyXatVDji4pQK 1teiXMhjk8jasHdW/X4V35mmQYgF5jsC7OkifyKtC7UoLrL/QbdE= X-Google-Smtp-Source: AGHT+IGsD3HwADo3Oj0KCwtP/jsKopOJoqzhN2wHyyLonxBBo4A1qnAS9cZXjozcGyBbHnw7RWwe/A== X-Received: by 2002:a05:6602:358f:b0:87c:d3b:a358 with SMTP id ca18e2360f4ac-87c64fdc182mr1615756739f.8.1753388726816; Thu, 24 Jul 2025 13:25:26 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:26 -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 v9 6/8] riscv: dts: spacemit: enable the i2c8 adapter Date: Thu, 24 Jul 2025 15:25:07 -0500 Message-ID: <20250724202511.499288-7-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 --- arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 15 +++++++++++++++ arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 7 +++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 11 +++++++++++ 3 files changed, 33 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..7c9f91c88e01a 100644 --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts @@ -40,6 +40,21 @@ &emmc { status =3D "okay"; }; =20 +&i2c8 { + pinctrl-0 =3D <&i2c8_cfg>; + pinctrl-names =3D "default"; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "okay"; + + pmic@41 { + compatible =3D "spacemit,p1"; + reg =3D <0x41>; + interrupts =3D <64>; + status =3D "okay"; + }; +}; + &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..2a5a132d5a774 100644 --- a/arch/riscv/boot/dts/spacemit/k1.dtsi +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi @@ -459,6 +459,17 @@ pwm7: pwm@d401bc00 { status =3D "disabled"; }; =20 + i2c8: i2c@d401d800 { + compatible =3D "spacemit,k1-i2c"; + reg =3D <0x0 0xd401d800 0x0 0x38>; + interrupts =3D <19>; + clocks =3D <&syscon_apbc CLK_TWSI8>, + <&syscon_apbc CLK_TWSI8_BUS>; + clock-names =3D "func", "bus"; + clock-frequency =3D <400000>; + status =3D "disabled"; + }; + pinctrl: pinctrl@d401e000 { compatible =3D "spacemit,k1-pinctrl"; reg =3D <0x0 0xd401e000 0x0 0x400>; --=20 2.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 D124426CE03 for ; Thu, 24 Jul 2025 20:25:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388731; cv=none; b=r0nz6I4V4UvKvHBfZHGHGCuSYzF0cA9trYD5kRK0RSYNrwo6Mq5D9CDPTTt9ZPsKza0Xm3vC6+vBiCDzaJJhVanAD8oupZ4HQvF0/3gG2c6aWwxsb0MWundcLf333snRf1/KPSGbnmWWFCm52hfg3+mxQiCnkqg6u3YDVV+bLFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388731; c=relaxed/simple; bh=jwtN0xCvslGhNw0OABByaDpfspJTfiR2J4AISKnWXAY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jN+idoxv5BKn/VJuAnbQJwG/P7HNFKiw1SMIV9UkKQKSitGWh2rBggyR0igUK2YuNQTv2Ypzf+DhX/D//9OdBWOr+cXB4AAduVsP6qRdzcQmaNfnvS+c5hevlJQg3IlH8WLUHYCPNTXD3oWOddd/MefifCdePF360qZg5zcCdfs= 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=lcHSB8N0; arc=none smtp.client-ip=209.85.166.54 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="lcHSB8N0" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-87c14e0675dso46596739f.2 for ; Thu, 24 Jul 2025 13:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388729; x=1753993529; 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=MBB5jxvs8tf52E+gAfvEPPxENYUnIxfjNegdT7+viL8=; b=lcHSB8N0Vxdjg91au7/sOHy9D+49+ZlQPEUteDYPOKjumUkpz+3ctegZDYkmk8HHJT 6xEerDisLjs8GDMZSaz05a1kUmjp89YroNWO9EdzXN8L1atWwF2rrvkQKg6vh+L3Pkqc 85AZ3LwuzbTFuPFwJ/rVIBzenhzsyQBuYNG3e+Np3MWdlSoq9760xeUxmuYQ150QG8rC B8euYxpgQ2mhKCWBG6RHoHceG10UN4CiyvZh/EvJOUua9Wwx6lvOTRD6bchcN+dokjYP zgm37niX67vpk/XxjY7QjX3In5UVOrvOFbUdfc5vRrUKyeJKUf/awauJ+kXmfBEE81pK uoyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388729; x=1753993529; 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=MBB5jxvs8tf52E+gAfvEPPxENYUnIxfjNegdT7+viL8=; b=GcWNFDSy9+lrlanoNspQUpPh1cobgHOMQ3trrGlujrWOYoJmO0QfOLWO9avu5EypTX ikrFbumr3Hf8FX0W1BNLnZBVuNQUFCSWcUCqS2zs+jKuOOAvmqOH/0OPaG5WOyWWGRvc 4T20u4jwF+T1RCrHQnIzPmmkk9VyNKX8wF3s8mGKd9EUEnk0vEf4AeTPgzk2kwAlIl2D 56pLlgTutWauOiOBU/w278tHZ37NyctNs90cK6f/+k1NfWehvgS2ayQRtLJOxc/b0TLf P5XSj0RmPmnoRPKZqfx2R9fqu4Xfu9tN9gSBO/Gi+80VAdVnn3UHft3O3dJBIMvqkzCX 7drg== X-Forwarded-Encrypted: i=1; AJvYcCUuR31JU045ZeBVTitwFM3vlsq3nB6SX6P6DsQxcEz+iwdy4OaRA6eXXXG5yeNATJnpaScZMz2qOZydKkM=@vger.kernel.org X-Gm-Message-State: AOJu0YxKyesEimGzTJs8jptB6xtjb2e4LbHTtZf3x68ZLGQZo6tBJwol 7p+WEyi3Q7cyUSuyK8S8ZY9evgV5FUMNUNOydDo4nR4Eo9KrguAHw2yrpxmeeI4b71Y= X-Gm-Gg: ASbGncsYIRznfsicvAqQYhYGRogo0dOSIWhAj/r/k4hGcqlqFNVZk0/vGpt90/4tjor UkslRxFsBI4RCd4y8HfJcqiaIHEJn+TtIwioHVUmr+5irusSwDBStQiutSA4bvtbZ+Jj7Dvb2wE l4FjJZhnHj++0OmpoYCJt2kF7s51YVSXoQ2VrWZgZu4ulN9NB4JI12YF2B4Fxtw1OgEJhyO1Qtw +jO2EywueX0qOp4wBv/GulIekMyB2iHDsQrKEnqA5IUa9ZnD+U5/5FZ63EmxSKR8q/YniUwNFyK D8RytHmGRyLysidx2ur2JyXNb3n3UBbx7q+Z652xDfUQVCB5lNvVYlSjECxbQ2QLHCpe8WuRVOF nM+V9aW72YVRLKE1vGQBkOsEg8IviWoGt7xpyn7BW X-Google-Smtp-Source: AGHT+IFA8t+gyzjGKf5ISSrexvmdiq2MvEH9qXOnl6ziXQ6Yu+XepclK9trDk+vKuFcx+/4K7eM8jA== X-Received: by 2002:a05:6602:6d04:b0:87c:3495:41b3 with SMTP id ca18e2360f4ac-87c64f2f532mr1543017839f.1.1753388728685; Thu, 24 Jul 2025 13:25:28 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:28 -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 v9 7/8] riscv: dts: spacemit: define fixed regulators Date: Thu, 24 Jul 2025 15:25:08 -0500 Message-ID: <20250724202511.499288-8-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 7c9f91c88e01a..a1c184b814262 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.43.0 From nobody Mon Oct 6 04:57:06 2025 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (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 ED96626F47D for ; Thu, 24 Jul 2025 20:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388733; cv=none; b=RhyfK4N0FVrcihv4uQQqhMr/cYcxChTW4Gl4iwzCx1T8J7EiNfpSZ8dmCIbvmoEZKq1LLYk4hOih2jVAVyY/ari5uX5AarcL6VL+4zkeTPEoKGdCzEcD437hsogvG/+J0nwdWJ3DA31TgG/XheEmU6H1fmBLAJ8ci2cvfpB1DhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753388733; c=relaxed/simple; bh=gQgnEu46nXffeDK/T2EsMnfRsMV5amrAJvwckiMVDxI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bNjfCu3JKcLv7EpKHRnK+XiLnVCR6bMpkQ8w9Lf6kpdvhZ1nAc70B/WJVu7YwC88Y7hwt8/XyQNolI7EuI1eWtPalsQKbWUXOsUqkPVySXJw65qLyCFmZtenwL1zIR2uH/KLzTJRSNzCoPqRRrWXTWTCSXFa0uM3hZNqJGzqIo0= 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=e6qNgGpk; arc=none smtp.client-ip=209.85.166.49 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="e6qNgGpk" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-86a052d7897so42735739f.0 for ; Thu, 24 Jul 2025 13:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1753388731; x=1753993531; 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=EEiPn0cbVvyWonyoHzSQ1laMwOj6/PCdxE3K2rEb90M=; b=e6qNgGpk/Zvo72makg5Wbl7ZUFGc6Ee4S2kr8+Y/9brDu/BZaE5rGekaJDZ800mz33 BXTI/vuQdDnsA7KZ76Xm7KPH0rh/DyjIs3E4Xy2cJlPohAFU30e+GmRjmbO+XdL9biZy 2LKmLedSx+fvSU05sX3jYIjlckztJW95WeAMrBxFxBh9UbJ7Gwbirf1zEQR1dz2ENlWf L/3bWhizGGq8fcgG49ytVFKrUzhWphcbO/Lhtr8Bm+DWBF0BHEPb4km3iGLluo5FdD6Q eyNMv7JUi2TtHwyy3m1eOsgZH7Gz5+cuzDkhDWlRV8GAv/7HRZyc/OKgntJJSdoabkoW ++zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753388731; x=1753993531; 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=EEiPn0cbVvyWonyoHzSQ1laMwOj6/PCdxE3K2rEb90M=; b=vNwy3TmcQ/xCsYSQTpiDFSQQR/hTCigL5V+3OGuwkzAetP1Rvdyvvy2vJh4AUIUa71 vXjJiN3HOokLircTid/0QfykupLw2TxfFQc7qttpJUoyhvmnW5yVAPIyj2UqVbHC1Mcy NnL/018MZMRQrQ62mzQUQ0IYp9h+03bhtCfxCizBmOl3ZC1uJlgzRuvks3YXKopv3yLL jumYNJxcBLuTwEq7+LkgrjuVh1xDltyVaI/dZ1IojnFQb1mMajLhUxNigMB6UBgK5CvB gARjC1FHtb3ANiNS+MpQMKSFPdI4dpWZ+S2H5bLW8YvzR3NRDmNsEh3f7M7OgB8UaWRg fSzQ== X-Forwarded-Encrypted: i=1; AJvYcCWzCd4yUsYRsPPFVVC4Eueh+jsGWMZI5Vq6GoYOJwS8/vmX73fov1dJgPJRRaj3b7LUo1IT8CbPeLYJ9KQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzFD7pyMCKsq0lO7Bv1l/M0KFGniwPsjv11kWL5Yht4EVbkfW9B K8mfPGsIwxgaGq72thX+dc+8T4FdQovILVVB4FfLILl9+7EmgWcZQ4dSgLbgCD31b5A= X-Gm-Gg: ASbGncu3u9TtXIrCOvunae7YOV796uiMOfjN61tNLxsBy3XYcyH8XkLi9y0Eo68vZpq zjla2EgyjccQKdqKUhyHhd2P2DKeCOw3WrTItKYtJ1aNeJwPKbR3Ej+nIX0A4fsw9yFkP4ZoASg 9wX4ikSzYRGTkj//sy6JZhBs960dCeNbO+bkQ+oRjpnvkV/DnM8j4VeKTfOHFBEmJUYMys48TWv D842910VpmOhmKDWJ4eC9fRnt/BXrAY04JRSfJVGeRVnNqsWJ0Fv5EXipS+E9y0qiQOsixa/+Y0 6c5dBzsoPLjJVJHpW2necC7ITvusCbjTEAF8tMw/VxSvEDd3Sz1ZaUNfzi8/45N4YX4AwNuOl7E Svk9Bcd/cdWwoH8Cg8dl/rH8w2xP3VPl5J8Cj+83m X-Google-Smtp-Source: AGHT+IEOCPJEmS++a59jxbnEfzm6BGBxv4jrcgvVSaZ5cgZIE4C2TYD/gzvOZX8xyz7qYVEph48/fQ== X-Received: by 2002:a05:6602:3421:b0:87c:4496:329d with SMTP id ca18e2360f4ac-87c64f64aafmr1508845939f.5.1753388730846; Thu, 24 Jul 2025 13:25:30 -0700 (PDT) Received: from zoltan.localdomain ([199.59.116.160]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-87c74316a3bsm63080239f.23.2025.07.24.13.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 13:25:30 -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 v9 8/8] riscv: dts: spacemit: define regulator constraints Date: Thu, 24 Jul 2025 15:25:09 -0500 Message-ID: <20250724202511.499288-9-elder@riscstar.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724202511.499288-1-elder@riscstar.com> References: <20250724202511.499288-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 a1c184b814262..83907cc1d5ccf 100644 --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts @@ -70,7 +70,111 @@ pmic@41 { compatible =3D "spacemit,p1"; reg =3D <0x41>; interrupts =3D <64>; + vin-supply =3D <®_vcc_4v>; status =3D "okay"; + + 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.43.0