From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A68553E3C58; Mon, 4 May 2026 17:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915027; cv=none; b=WwZH1T4QJHJ7Eg7S/Fxhk2shEnWlv/nbr5bxP74jdqmEf/OBWUX9gqxzThosZyGIVbCvd/0ujD8QuGHes4bigioQ4n+d/v9eBHRkJSrPQm02GFc6V25IqerxDbQGbNNCTvK4C1b97FpJZqn8m4a3JbmRAZzeuVtTFfDHFQdBCXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915027; c=relaxed/simple; bh=xQsf8JNwL2iAqB2xFn5mc4i4/5YmfHhtdi3f2/Blbd0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Rmt1kskdpt7ahyYkDvJnOfElVvm0H5Ov02yLv9l82kFcSVD0QA2iDFBolG0vSttovWftjVY7Yfd8UN/MDjoMbnUM4eSCFJmqf4bt3YXSLQPNOGZoa5ojlJrtRTa6RkQj/LpuGiysrFPeeBepdbHYzQdb8VyV2YtgV5vl3fcbVng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=PJYYE4Dc; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="PJYYE4Dc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zk62V5Oyi/C0dBrJeWuDQbb0Ke9NcjBJqyGJq6gOxTY=; b=PJYYE4DcF9Hvwjt5GcatrBouZj6gPLUiqA7zM2pr3Tf06mm0wRrGgODHjv3I/lbkOjDEov O0caF1JX09GwVc3S7/ELkq6fHzWn7lUSSz1fLHTBSLb4oz3RmVuHwx9J/JpALHbgoczxT3 2felQuDbmpYnspsbnvGXTcnHjQkxKCk= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 0f146065 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:42 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:39 +0200 Subject: [PATCH 01/10] m68k: mcf5441x: fix clocks numbering Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-1-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Fix clocks numbering, set correct values for eport and DAC, as per RM Rev 5, 05/2018, table 9.5. Fixes: bea8bcb12da09 ("m68knommu: Add support for the Coldfire m5441x.") Fixes: 007f84ede6e3e ("m68k: coldfire: remove private clk_get/clk_put") Signed-off-by: Angelo Dureghello --- arch/m68k/coldfire/m5441x.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c index 7a25cfc7ac07..ac9c17d0ee64 100644 --- a/arch/m68k/coldfire/m5441x.c +++ b/arch/m68k/coldfire/m5441x.c @@ -41,9 +41,9 @@ DEFINE_CLK(0, "mcfpit.0", 32, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.1", 33, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.2", 34, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.3", 35, MCF_BUSCLK); -DEFINE_CLK(0, "mcfeport.0", 37, MCF_CLK); -DEFINE_CLK(0, "mcfadc.0", 38, MCF_CLK); -DEFINE_CLK(0, "mcfdac.0", 39, MCF_CLK); +DEFINE_CLK(0, "mcfeport.0", 36, MCF_CLK); +DEFINE_CLK(0, "mcfadc.0", 37, MCF_CLK); +DEFINE_CLK(0, "mcfdac.0", 38, MCF_CLK); DEFINE_CLK(0, "mcfrtc.0", 42, MCF_CLK); DEFINE_CLK(0, "mcfsim.0", 43, MCF_CLK); DEFINE_CLK(0, "mcfusb-otg.0", 44, MCF_CLK); @@ -103,9 +103,9 @@ static struct clk_lookup m5411x_clk_lookup[] =3D { CLKDEV_INIT("mcfpit.1", NULL, &__clk_0_33), CLKDEV_INIT("mcfpit.2", NULL, &__clk_0_34), CLKDEV_INIT("mcfpit.3", NULL, &__clk_0_35), - CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_37), - CLKDEV_INIT("mcfadc.0", NULL, &__clk_0_38), - CLKDEV_INIT("mcfdac.0", NULL, &__clk_0_39), + CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_36), + CLKDEV_INIT("mcfadc.0", NULL, &__clk_0_37), + CLKDEV_INIT("mcfdac.0", NULL, &__clk_0_38), CLKDEV_INIT("mcfrtc.0", NULL, &__clk_0_42), CLKDEV_INIT("mcfsim.0", NULL, &__clk_0_43), CLKDEV_INIT("mcfusb-otg.0", NULL, &__clk_0_44), @@ -156,7 +156,7 @@ static struct clk * const enable_clks[] __initconst =3D= { &__clk_0_27, /* uart3 */ =20 &__clk_0_33, /* pit.1 */ - &__clk_0_37, /* eport */ + &__clk_0_36, /* eport */ &__clk_0_48, /* pll */ &__clk_0_51, /* esdhc */ =20 @@ -174,8 +174,8 @@ static struct clk * const disable_clks[] __initconst = =3D { &__clk_0_32, /* pit.0 */ &__clk_0_34, /* pit.2 */ &__clk_0_35, /* pit.3 */ - &__clk_0_38, /* adc */ - &__clk_0_39, /* dac */ + &__clk_0_37, /* adc */ + &__clk_0_38, /* dac.0 */ &__clk_0_44, /* usb otg */ &__clk_0_45, /* usb host */ &__clk_0_47, /* ssi.0 */ --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F40F3E3C6F; Mon, 4 May 2026 17:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915030; cv=none; b=Jkf42541HGagVmQyrxu+RA5c4L0yeHPMnPQF2moPYQXcwj1ij72DjBhXzzDWmYCXryGKthbDLX/ul9CzSGgsKrhXjEONQvOq1z5cGOb3EY9TmrpthJoSB5VxCmdsS9HWdHuQiFxTiGHmNy6HZF743ZDjh27OtuF4pHxSqBStoGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915030; c=relaxed/simple; bh=x/p6lSR5zaS+HSarkkJG7tWSTCyX3lPJ2dec2Cyl5HE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ohe/utD1zj6VdcIpxCo9F25aqbvQFhJgGFYbQzwtG6Hmz7XGENTeI0UVJ/j8DwRetbAY7bdRPonUd+0rCzyIZDxteTmfrbAqqS7ktJdICWLHK65+ylIcWDZcPKzhPwFaXy4/gJdU562biOk1e+O8r6bJ19Lv3/WrkLZWR49kdpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=Xk5eSbah; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="Xk5eSbah" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SiZHKsBA9q3RNVJyvvIFpV/3SFXznU73L9UIwTbpm5Q=; b=Xk5eSbahj590fUOUqQ7RtX087QTRzaEX3B/Xj8R0g8e2hT4C4ALKXYwg9njOhpXgwzINnl X5JJNGSNIh5AknafdwJ6KbaWB+r6djZhF5SfGGbj+Se2NWiVDIKwF4vhioUTBWQ7/je2UD 95RNnHNk6BJgsRoppPWOrMQ/7r5s4uY= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 1aead968 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:43 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:40 +0200 Subject: [PATCH 02/10] m68k: mcf5441x: add clock for DAC channel 1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-2-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add missing clock for mcf5441x DAC channel 1. Signed-off-by: Angelo Dureghello --- arch/m68k/coldfire/m5441x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c index ac9c17d0ee64..5c33d3896cf7 100644 --- a/arch/m68k/coldfire/m5441x.c +++ b/arch/m68k/coldfire/m5441x.c @@ -44,6 +44,7 @@ DEFINE_CLK(0, "mcfpit.3", 35, MCF_BUSCLK); DEFINE_CLK(0, "mcfeport.0", 36, MCF_CLK); DEFINE_CLK(0, "mcfadc.0", 37, MCF_CLK); DEFINE_CLK(0, "mcfdac.0", 38, MCF_CLK); +DEFINE_CLK(0, "mcfdac.1", 39, MCF_CLK); DEFINE_CLK(0, "mcfrtc.0", 42, MCF_CLK); DEFINE_CLK(0, "mcfsim.0", 43, MCF_CLK); DEFINE_CLK(0, "mcfusb-otg.0", 44, MCF_CLK); @@ -106,6 +107,7 @@ static struct clk_lookup m5411x_clk_lookup[] =3D { CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_36), CLKDEV_INIT("mcfadc.0", NULL, &__clk_0_37), CLKDEV_INIT("mcfdac.0", NULL, &__clk_0_38), + CLKDEV_INIT("mcfdac.1", NULL, &__clk_0_39), CLKDEV_INIT("mcfrtc.0", NULL, &__clk_0_42), CLKDEV_INIT("mcfsim.0", NULL, &__clk_0_43), CLKDEV_INIT("mcfusb-otg.0", NULL, &__clk_0_44), @@ -176,6 +178,7 @@ static struct clk * const disable_clks[] __initconst = =3D { &__clk_0_35, /* pit.3 */ &__clk_0_37, /* adc */ &__clk_0_38, /* dac.0 */ + &__clk_0_39, /* dac.1 */ &__clk_0_44, /* usb otg */ &__clk_0_45, /* usb host */ &__clk_0_47, /* ssi.0 */ --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AD4D3E2745; Mon, 4 May 2026 17:17:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915031; cv=none; b=fSmWkSQc/m5YELYDdAIdWmLhDPjC5Od3M+6XBPnSHq5DJmoDRbc9yva6wrVHGpnl5/cOqhqHaIiV9otWbXOD+Y5sJvVdIIBQNa5B62dblpdeWgDRh6NwSLTV+OMwFShYmJtTKGAkxNJ+EBUQWUNUoxvkIbS1R3E+3HeJx6ff3Vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915031; c=relaxed/simple; bh=XK4gbLCyPxDWg3kaxQ80NPr0aOIc2JZzkkU8Yu7ETVM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bpX8UQWv0zY7mEfof0YKkbz8pqdEWbom1AQ8bUrqCwZhmIdlD0h+p2SVfAFHbnwRqg32DhAketmaQ8Cmc0ZP49O2JjZ8+nQ2nnTeT7z6kOZDFpopPlZc40o6b3flgYjbcbkT1ndwKkrUAhwwmO5pVaie7Gi80DBefK9aJoWEu9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=vqktDZFo; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="vqktDZFo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j9fbcKoaqme5Vz1fCTzuqtyu8Za4tl10mh+oXgKUmQo=; b=vqktDZFoJYnKsBv7Qg3+jR2KORdYcXNDAAApS5NXnpUaTfHbLvr8OfuEzxzckPuibuLM5u eaFoMh+hPSMYYR8kKZoNrCBtFIhAgqK7d/m6cjzE/ccJGbTgGKxse//ia/IZKONSmkl/3g 60Rhk+UlCDDKSdYz0PKhuwt/S+WP+L4= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 2e036497 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:43 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:41 +0200 Subject: [PATCH 03/10] m68k: mcf5441x: setup DAC clock name as per driver name Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-3-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Later in this patchset, the mcf54415 DAC driver is added. Considering some other different ColdFire cpu DACs exists, the DAC driver is named as "mcf54415_dac", related to the mcf5441x family SoCs with DACs (mcf54415/6/7/8). So updating DAC clock names to bind with proper driver name. Signed-off-by: Angelo Dureghello --- arch/m68k/coldfire/m5441x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c index 5c33d3896cf7..b21638844fd4 100644 --- a/arch/m68k/coldfire/m5441x.c +++ b/arch/m68k/coldfire/m5441x.c @@ -43,8 +43,8 @@ DEFINE_CLK(0, "mcfpit.2", 34, MCF_BUSCLK); DEFINE_CLK(0, "mcfpit.3", 35, MCF_BUSCLK); DEFINE_CLK(0, "mcfeport.0", 36, MCF_CLK); DEFINE_CLK(0, "mcfadc.0", 37, MCF_CLK); -DEFINE_CLK(0, "mcfdac.0", 38, MCF_CLK); -DEFINE_CLK(0, "mcfdac.1", 39, MCF_CLK); +DEFINE_CLK(0, "mcf54415_dac.0", 38, MCF_CLK); +DEFINE_CLK(0, "mcf54415_dac.1", 39, MCF_CLK); DEFINE_CLK(0, "mcfrtc.0", 42, MCF_CLK); DEFINE_CLK(0, "mcfsim.0", 43, MCF_CLK); DEFINE_CLK(0, "mcfusb-otg.0", 44, MCF_CLK); @@ -106,8 +106,8 @@ static struct clk_lookup m5411x_clk_lookup[] =3D { CLKDEV_INIT("mcfpit.3", NULL, &__clk_0_35), CLKDEV_INIT("mcfeport.0", NULL, &__clk_0_36), CLKDEV_INIT("mcfadc.0", NULL, &__clk_0_37), - CLKDEV_INIT("mcfdac.0", NULL, &__clk_0_38), - CLKDEV_INIT("mcfdac.1", NULL, &__clk_0_39), + CLKDEV_INIT("mcf54415_dac.0", NULL, &__clk_0_38), + CLKDEV_INIT("mcf54415_dac.1", NULL, &__clk_0_39), CLKDEV_INIT("mcfrtc.0", NULL, &__clk_0_42), CLKDEV_INIT("mcfsim.0", NULL, &__clk_0_43), CLKDEV_INIT("mcfusb-otg.0", NULL, &__clk_0_44), --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 435003E3DBE; Mon, 4 May 2026 17:17:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915033; cv=none; b=LkQavwtDBHNs2amuUPwshy7C9PEp+B8EgQp6vSb/5XXh1szhvpc1oSh8MB6U8PQH6qjJpjVTFfNL1LVESBOiJiFNTixTSYLRQyXhJnqMASJklK4SWk/o/iu7i3mCISlWAbNG9iBOfNZK+PHUUlxUP+cbKMYW4tbGE6elOP7LGT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915033; c=relaxed/simple; bh=0FPRuvNNSFiFkawKVCalHb3yLDUTC8vh4qdYQm7Z9t4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LSLuw60Gb5BObrZfYjc5yQbcdA8u4lTUKhVpOranplwVDXGTqnXlEmBTtas2dkygatlNlQIt+jiMm3KZt5/9rOHs8l4M9udKMXqKd8quM78zSOYHo0Do4gpk9KIDgreB8Fm860o49MRgkzk/l0o8O1KGKyllsmy7sjT6gpH7BaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=IHWfVUeN; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="IHWfVUeN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=00ruy8kpQH+b21j+wCBZYocT5CVhNgJL2HRPgVpHHfE=; b=IHWfVUeNiYLI1b0cX6OPSGhFy0PS5SCUQ3LbgLZUaE97G/SeEZyATgq2iy9gWCnvJybk9G 050pyCyRVUjelXZVlF+/BLeYTmbUfZlAKzusLCON20Bry4n2hlXGBkMVSqgUr3xjSjcXuZ pO1OGpD22Sf1QrdAD4fwZeeAh+vjLCs= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 6d3cd3bc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:44 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:42 +0200 Subject: [PATCH 04/10] m68k: defconfig: update stmark2 defconfig Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-4-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Update stmark2 defconfig enabling MCF5441X DACs. Signed-off-by: Angelo Dureghello --- arch/m68k/configs/stmark2_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/m68k/configs/stmark2_defconfig b/arch/m68k/configs/stmark= 2_defconfig index b3fb95f73a95..3941113bc60b 100644 --- a/arch/m68k/configs/stmark2_defconfig +++ b/arch/m68k/configs/stmark2_defconfig @@ -76,6 +76,8 @@ CONFIG_DMADEVICES=3Dy CONFIG_MCF_EDMA=3Dy # CONFIG_VIRTIO_MENU is not set # CONFIG_VHOST_MENU is not set +CONFIG_IIO=3Dy +CONFIG_MCF54415_DAC=3Dy CONFIG_EXT2_FS=3Dy CONFIG_EXT2_FS_XATTR=3Dy CONFIG_EXT2_FS_POSIX_ACL=3Dy --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8E5F3E4C79; Mon, 4 May 2026 17:17:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915037; cv=none; b=FbHY/1/oRWj8aL/oR9ydOoa/hfQnwh3XREsnpnJ5k1PfQ/v0Kx9JzTIp3GCDIVGawLQmd1DITAspUVrrKEmcCM5F00mdZZch5St8+5fZ8fk/7O3ZUu/uyljxcvJuCcUWNQrA61+ZQKpfvZ967EuoAJ+4/YJfeVqpxokcvZQXV2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915037; c=relaxed/simple; bh=BTzMq5e9Ct1iS05RorpLyh1aN78tCIlpP86CvhH3+is=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RnZGf6LHqhyzRqWzeE9I6p+PoynoDnR6L6HGLOpov19oNW27MIQ6iIAOS8iSp8qOIQICPTxNZG0VHmdc1nusL8lFpulLfJtBsLZ9PkO+n1RlJvA6TuHDZX2wut1WcxOSHJcuN7Q8zsIdkFWbxfRWRFMAtwiUujfTJ31kr8K/qpk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=BF4e+y+F; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="BF4e+y+F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=66sbIWl/UECZcngzqfN9gySpU5b7WSWy5FgqX8acPdE=; b=BF4e+y+FI93bmhmBDVYOS9Ywi3UsNwZ9B+nk/SFmHSkqT4n/jl++VpZSEEgYjk786kgiWq 3+YgTbehRHNoNXXR+coeZLVsbMqaPAQgho3Tk1wlwOhIqHTt98tJRn/bWv9jMwYhFqs6/B dYJJVVEHO2P347vzmmkLM4ucda/T3u0= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 31d53e53 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:44 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:43 +0200 Subject: [PATCH 05/10] m68k: add DAC modules base addresses Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-5-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add DAC controller 0 and 1 base addresses. Signed-off-by: Angelo Dureghello --- arch/m68k/include/asm/m5441xsim.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m544= 1xsim.h index f48cf63bd782..f5acc962bb95 100644 --- a/arch/m68k/include/asm/m5441xsim.h +++ b/arch/m68k/include/asm/m5441xsim.h @@ -191,6 +191,11 @@ #define MCFEPORT_EPPAR 0xfc090000 #define MCFEPORT_EPIER 0xfc090003 #define MCFEPORT_EPFR 0xfc090006 +/* + * DAC Modules. + */ +#define MCFDAC_BASE0 0xfc098000 +#define MCFDAC_BASE1 0xfc09c000 /* * RTC Module. */ --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ED943E3C6F; Mon, 4 May 2026 17:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915037; cv=none; b=mDoxEogYkAvNdPFL8p8A4YsXWhSegiEWxrIWRxb7Ga/vAX/heHHAEMR1C6isfVB9TMF9nsZnVQwqKIzDnWUAHKzPq2dUcz5jcJWnFlAPzExS2l65xmOiWmpHNaiKvC1tHJ4LfelmuOAaFn/oNYFOLr7cjro5zBuA2qLY0Km9M+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915037; c=relaxed/simple; bh=n0b364dDBrWM4RGQrGIAbMsbTV+2t0ZGtLdE7nGAO9Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Odn6Y7gnXIN70r/63Z+m7KQ/rdbI/o4nob7ZWNO49g21op5CXmA1bDk+yqZLJ4kDzcQopCEZOGHqmZUqTpG9vb2klRTh5GzMriC3LI6a+8giA4nj4+e61tdbiG9Bkr9i4sf53TMSD2cRuJDEpLzq36LcZdvxseY2RVFT0KoO7Kg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=MldD+GhP; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="MldD+GhP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mqVoCiMOeXwzd334lL+Kbbn+xeppyD+CHd7jRk3nty8=; b=MldD+GhPDuS3G03v762xI38Yl1c0ElHUytTd6dJ/Qw2i98k1hfKxzTaRliQ/L4c/fLMelm AF4w86WrbY52ZHA6+j71C340r4AmmG8OHOlKO9yAvredhdcBu7V1/s+6ZslXic7IMDvJ3d dCFfMWi4WYoQ1FRt7sZg9j7cMF97kvE= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id ffaf193d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:45 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:44 +0200 Subject: [PATCH 06/10] m68k: mcf5441x: add CCM registers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-6-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add CCM module register offsets. Signed-off-by: Angelo Dureghello --- arch/m68k/include/asm/m5441xsim.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m544= 1xsim.h index f5acc962bb95..9ce2cbb05316 100644 --- a/arch/m68k/include/asm/m5441xsim.h +++ b/arch/m68k/include/asm/m5441xsim.h @@ -125,6 +125,26 @@ #define MCFPM_PPMHR1 0xfc040038 #define MCFPM_PPMLR1 0xfc04003c #define MCFPM_LPCR 0xec090007 + +/* + * Chip Configuration Module (CCM). + */ +#define MCF_CCM_CCR 0xec090004 +#define MCF_CCM_RCON 0xec090008 +#define MCF_CCM_CIR 0xec09000a +#define MCF_CCM_MISCCR 0xec09000e +#define MCF_CCM_CDRH 0xec090010 +#define MCF_CCM_CDRL 0xec090012 +#define MCF_CCM_UOCSR 0xec090014 +#define MCF_CCM_UHCSR 0xec090016 +#define MCF_CCM_MISCCR3 0xec090018 +#define MCF_CCM_MISCCR2 0xec09001a +#define MCF_CCM_ADCTSR 0xec09001c +#define MCF_CCM_DACTSR 0xec09001e +#define MCF_CCM_SBFSR 0xec090020 +#define MCF_CCM_SBFCR 0xec090022 +#define MCF_CCM_FNACR 0xec090024 + /* * UART module. */ --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FDCE3E3DAB; Mon, 4 May 2026 17:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915042; cv=none; b=cvdULllDp7d6t0p7Y9Xb0STsxHjqZniy/MCtwLxzCq66RG4E+KWvarhGxXKutfggsrUn2ErrhFNWN7KskEBCQWfHXdbK3Gq4rrV2l/Kgvs4zWIIu9f8Hf6cqyJUMS+ZzL+eYDSD/vLrA7pgzp/OMJbl0nxsDJUT0nAclDMn9zbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915042; c=relaxed/simple; bh=nMlnkc4zykaVGWF7hNBUVTTmwan+JJt9iwyVMoVyz6U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a0kLNf4gwlVynb7XvpmmS/SZMRiA8k+wtgpbZE4ZbwmvESrepL/fXy1wv9iMhPTqoRRLMeWhEVp4q6LKv7mcoD1NxG3jsq2ZWeS+oItRUdDYMolRF/WVb+NliyuXTNVPSWvn1EwskRDfsej88La/nCMl23MCHbDmB7ttThjqqEU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=BvBon1b0; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="BvBon1b0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e5qBFQ0vyH0w70M/WIM2MXWzXlakBBcfbEZV0cspLfw=; b=BvBon1b0Ac2uWcOxxKX1jbZA7VLFP2snmM+/uiv3OIolIZ7o3/Lg2OkmV6QnNWMNYUJH+T 9NJoUh532sVKOovqQWMXGqOs3xryuBR2De039F/zvcwpgGXwefLrn3RqZ88iNsqOrkrnLs I8ixcFxDhKbc/ABDdgHFqVUCOqfUl8I= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id f28eb5b7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:45 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:45 +0200 Subject: [PATCH 07/10] m68k: mcf5441x: add CCR MISCCR2 bitfields Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-7-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add CCR MISCCR2 register bitfields. Signed-off-by: Angelo Dureghello --- arch/m68k/include/asm/m5441xsim.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/m68k/include/asm/m5441xsim.h b/arch/m68k/include/asm/m544= 1xsim.h index 9ce2cbb05316..93f7943d5550 100644 --- a/arch/m68k/include/asm/m5441xsim.h +++ b/arch/m68k/include/asm/m5441xsim.h @@ -145,6 +145,21 @@ #define MCF_CCM_SBFCR 0xec090022 #define MCF_CCM_FNACR 0xec090024 =20 +/* Bit definitions and macros for MCF_CCM_MISCCR2 */ +#define MCF_CCM_MISCCR2_ULPI BIT(0) +#define MCF_CCM_MISCCR2_FB_HALF BIT(1) +#define MCF_CCM_MISCCR2_ADC3_EN BIT(2) +#define MCF_CCM_MISCCR2_ADC7_EN BIT(3) +#define MCF_CCM_MISCCR2_ADC_EN BIT(4) +#define MCF_CCM_MISCCR2_DAC0_SEL BIT(5) +#define MCF_CCM_MISCCR2_DAC1_SEL BIT(6) +#define MCF_CCM_MISCCR2_DCC_BYP BIT(7) +#define MCF_CCM_MISCCR2_PLL_MODE GENMASK(9, 7) +#define MCF_CCM_MISCCR2_SWT_SCR BIT(12) +#define MCF_CCM_MISCCR2_RGPIO_HALF BIT(13) +#define MCF_CCM_MISCCR2_DDR2_CLK BIT(14) +#define MCF_CCM_MISCCR2_EXTCLK_BYP BIT(15) + /* * UART module. */ --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E401D3E4C95; Mon, 4 May 2026 17:17:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915045; cv=none; b=OoBgHZlmnlCUHsTGZzrKkWIPCDXWJEaTo39umCG5VCtUGBJSwBcZOPpZ/KzbJT3szA2Wj6hQZ0Z4z/36P7GL4JJXSZBd1LMDCrCPXB7+4DHEit6qpF6luoypwoEWtcBfPBMnpG06OGiI188fpn6YUH1P0eyIMd3qKIJYjO1zHMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915045; c=relaxed/simple; bh=DdiJJP6JWxTYdbbRr6DCUunKojbBZ9SL5aGjDPR7h54=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fcRb4ZwgV/BQkxVXBf4NV5G1FtHRybvquHrtNKqe0dyXvvh+zJn2oet87ZRsWobkTIuavOGPpCCpj2SxGgHropGdj2+8gg3OV6O4smDNX0Zpff+fMrrJLo6HiXUB2MZQSi/Wfcx5pHRkcKIFHVWE33Ql3eGmHvNqClyVOe/QW9E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=AdIGNAC/; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="AdIGNAC/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=htwcYAHQIOqaxElDjDYg+njAl/ofitRP9nvq1PHSWrQ=; b=AdIGNAC/f8eX5Nk4/DYRKJ47wDOaG5+Tm6BE7r0ce9U566IdBy2yLs6p8pj3MvelWbnPLz 7Eok+5yzAdilxJ2cWdXWxP3de5HbS4RP7rcRyCLLUWkjYv8xQ2o6d/rSHkh1zxK0TP8xd/ 4Dj3Hvu8ShfBwj6Cyg9g7ZITiB/Q0Jw= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 2d248f23 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:46 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:46 +0200 Subject: [PATCH 08/10] m68k: stmark2: add mcf5441x DAC platform devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-8-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add mcf5441x DAC platform devices. Signed-off-by: Angelo Dureghello --- arch/m68k/coldfire/stmark2.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/arch/m68k/coldfire/stmark2.c b/arch/m68k/coldfire/stmark2.c index 85502b81175e..30da9bcbfd63 100644 --- a/arch/m68k/coldfire/stmark2.c +++ b/arch/m68k/coldfire/stmark2.c @@ -94,8 +94,42 @@ static struct platform_device dspi_spi0_device =3D { }, }; =20 +static struct resource dspi_dac0_resource[] =3D { + [0] =3D { + .start =3D MCFDAC_BASE0, + .end =3D MCFDAC_BASE0 + 0xFF, + .flags =3D IORESOURCE_MEM, + }, +}; + +/* DAC controller, id =3D bus number */ +static struct platform_device dac0_device =3D { + .name =3D "mcf54415_dac", + .id =3D 0, + .num_resources =3D ARRAY_SIZE(dspi_dac0_resource), + .resource =3D dspi_dac0_resource, +}; + +static struct resource dspi_dac1_resource[] =3D { + [0] =3D { + .start =3D MCFDAC_BASE1, + .end =3D MCFDAC_BASE1 + 0xFF, + .flags =3D IORESOURCE_MEM, + }, +}; + +/* DAC controller, id =3D bus number */ +static struct platform_device dac1_device =3D { + .name =3D "mcf54415_dac", + .id =3D 1, + .num_resources =3D ARRAY_SIZE(dspi_dac1_resource), + .resource =3D dspi_dac1_resource, +}; + static struct platform_device *stmark2_devices[] __initdata =3D { &dspi_spi0_device, + &dac0_device, + &dac1_device, }; =20 /* --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E41323E4C96; Mon, 4 May 2026 17:17:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915044; cv=none; b=qQFDau8bQMbsRUt7/RaOF9NaohthV9CMWq28HlbwYqATaIeH+Yi91Udwx05Xu2apOpULSsTApI0nTTVJxHO+ngXJffgXKveW3yZC7wt5yDnH9oWLHTZP/pxKCjafaBPwN3S/rpsRCdSU5W8IPuqytD4bgs1U6FcHDks9DB33LF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915044; c=relaxed/simple; bh=LEoXmLzP8u1byop8FDTRBhZ5Z22QUE2UD2zdAdad/Jw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UzN1JHqfFnxDJK6vmkjbw9eUmpqySixadQ43WwBSMheDB+0ClpNwXzC9woIUERZw9lP2ORS2V+FEnMY5lSWHiHNPcb0R4S/UyibDdY1lFAiBFG+laLL/irZ0A866D6cbn86puJe5mEP9lQwFmntAacEZ2iSEMOt/XJXVLotI1uQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=iLg/MXtU; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="iLg/MXtU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k1f7lV1i+r+6Lv1WVQN+EfQy8NFT78JqLVT0pvpLNVQ=; b=iLg/MXtUWb5ZCYGjJG85EyQ8vX+B2wx//mvd1xmEWOBK2JTI+AmfdVIDI5zec2l4I0PfGl KZxwJiWfE+uaAX5RJWzft4QTXPESRLPeRvSYZN+JUnm0PameHLRZayyHdxwAQ62bv7vEDM LD/MhbyolFAelaT+TvviDPYdH34+i5U= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id 66349e3f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:46 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:47 +0200 Subject: [PATCH 09/10] m68k: stmark2: enable DACs outputs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-9-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Enabled DAC0 and DAC1 outpus disabling shared ADC inputs on ADC3 and ADC7. Signed-off-by: Angelo Dureghello --- arch/m68k/coldfire/stmark2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/m68k/coldfire/stmark2.c b/arch/m68k/coldfire/stmark2.c index 30da9bcbfd63..8fdfb9415cd7 100644 --- a/arch/m68k/coldfire/stmark2.c +++ b/arch/m68k/coldfire/stmark2.c @@ -137,6 +137,8 @@ static struct platform_device *stmark2_devices[] __init= data =3D { */ static int __init init_stmark2(void) { + uint16_t val; + /* DSPI0, all pins as DSPI, and using CS1 */ __raw_writeb(0x80, MCFGPIO_PAR_DSPIOWL); __raw_writeb(0xfc, MCFGPIO_PAR_DSPIOWH); @@ -149,6 +151,12 @@ static int __init init_stmark2(void) /* CAN pads */ __raw_writeb(0x50, MCFGPIO_PAR_CANI2C); =20 + /* Enable DAC0 and 1 */ + val =3D __raw_readw(MCF_CCM_MISCCR2); + val &=3D ~(MCF_CCM_MISCCR2_ADC3_EN | MCF_CCM_MISCCR2_ADC7_EN); + val |=3D MCF_CCM_MISCCR2_DAC0_SEL | MCF_CCM_MISCCR2_DAC1_SEL; + __raw_writew(val, MCF_CCM_MISCCR2); + platform_add_devices(stmark2_devices, ARRAY_SIZE(stmark2_devices)); =20 spi_register_board_info(stmark2_board_info, --=20 2.54.0 From nobody Sun Jun 14 01:35:58 2026 Received: from mail.kernel-space.org (v2202511311555398556.powersrv.de [46.38.245.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04A913E3D94; Mon, 4 May 2026 17:17:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.245.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915045; cv=none; b=TFtHX4Gh+r3+vBPBIfZnzDyN/Dgl0rtwcPKfPnESWuEWGrmUXja4z3OMOIDDd055Vo4peMDTSsifsFHUo4LbYiXO3YfFBsW93EXKG3f3ncLdmEdiybeXP9+55dJ01WXFht+ZLjpcfQftbYdI71xF0IwncM2f02a11H+kmmraaHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777915045; c=relaxed/simple; bh=cuHant5v1i0R8QScEMhqBEqLyPQGj9LB7hQLGCNzG2Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SJc/0gnDJysk2K3JVunka4qFddoWYhjijnA1Wlyl4ta+Ohu5woZwNWSLxL/1uCDKSaHVmqG/QEIo3O9t/WCrBjEzx/ouJsdokQz0G4IaSR8g37JgdwnyIZRwXpyN/4HEtYsPTt6YBLpwYurXrwgMuM2cfPmheipv2jXn+0t6YDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org; spf=pass smtp.mailfrom=kernel-space.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b=eDT1bIqi; arc=none smtp.client-ip=46.38.245.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel-space.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=kernel-space.org header.i=@kernel-space.org header.b="eDT1bIqi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-space.org; s=s1; t=1777915007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SF9ujtZqkg8d6XrkmCnPPxOB0sj3C+v6KmHyURSyaJQ=; b=eDT1bIqixS8pNGPoQK/ss2hnGH1OH0SjZe5QFAo6c9FMidY5MsieyhPUIKzeva+kRSBOeA 5XuTrTUtMwhfJ8uO74jX13XA/eFrWpF4JyRQ2aTDMTo0ID16V5szTJV3HiM5UuXAii/5aN a1yJAk6VktBHWRHb9+yZE3Vy8fOx23U= Received: from [192.168.0.2] ( [2a07:7e81:7daa:0:62cf:84ff:feee:627]) by oreshnik (OpenSMTPD) with ESMTPSA id a01d32f2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 May 2026 17:16:47 +0000 (UTC) From: Angelo Dureghello Date: Mon, 04 May 2026 19:16:48 +0200 Subject: [PATCH 10/10] iio: dac: add mcf54415 DAC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260504-wip-stmark2-dac-v1-10-874c36a4910d@baylibre.com> References: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> In-Reply-To: <20260504-wip-stmark2-dac-v1-0-874c36a4910d@baylibre.com> To: Greg Ungerer , Geert Uytterhoeven , Steven King , Arnd Bergmann , Maxime Coquelin , Alexandre Torgue , Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: Greg Ungerer , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.15.2 From: Angelo Dureghello Add basic version of mcf54415 DAC driver. DAC is embedded in the cpu and DAC configuration registers are mapped in the internal IO address space. The DAC accepts a 12-bit digital signal and creates a monotonic 12-bit analog output varying from ~DAC_VREFL to ~DAC_VREFH. The DAC module consists of a conversion unit, an output amplifier, and the associated digital control blocks. DAC_VREFL and DAC_VREFH defaults respectivley to 0 and 0xfff. This initial version of the driver is minimalistic, "output raw" only, to be extended in the future. DMA and external sync are disabled, default mode is high speed, default format is right-justified 12bit on 16bit word. Basic tests done on stmark2 mcf54415-based board, voltage check on DAC0: /sys/bus/iio/devices/iio:device0 # ls name out_voltage_raw subsystem out_conversion_mode out_voltage_scale uevent /sys/bus/iio/devices/iio:device0 # cat name mcf54415_dac.0 /sys/bus/iio/devices/iio:device0 # echo 4095 > out_voltage_raw =3D> voltage abt 3.3V by oscilloscope echo 4096 > out_voltage_raw =3D> roll over to 0V echo 0 > out_voltage_raw =3D> voltage is 0V echo 2048 > out_voltage_raw =3D> voltage is abt 1.7V, mid scale Same behavior for /sys/bus/iio/devices/iio:device1. Generated a sine wave by shell script, sine shape is good. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/Kconfig | 10 +++ drivers/iio/dac/Makefile | 1 + drivers/iio/dac/mcf54415_dac.c | 200 +++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 211 insertions(+) diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index cd4870b65415..17550e99cfdd 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -516,6 +516,16 @@ config MAX5821 Say yes here to build support for Maxim MAX5821 10 bits DAC. =20 +config MCF54415_DAC + tristate "NXP MCF54415 DAC driver" + depends on M5441x + help + Say yes here to build support for NXP MCF54415 + 12bit DAC. + + To compile this driver as a module, choose M here: the module + will be called mcf54415_dac. + config MCP4725 tristate "MCP4725/6 DAC driver" depends on I2C diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile index 2a80bbf4e80a..1cb93e83d0eb 100644 --- a/drivers/iio/dac/Makefile +++ b/drivers/iio/dac/Makefile @@ -51,6 +51,7 @@ obj-$(CONFIG_MAX517) +=3D max517.o obj-$(CONFIG_MAX22007) +=3D max22007.o obj-$(CONFIG_MAX5522) +=3D max5522.o obj-$(CONFIG_MAX5821) +=3D max5821.o +obj-$(CONFIG_MCF54415_DAC) +=3D mcf54415_dac.o obj-$(CONFIG_MCP4725) +=3D mcp4725.o obj-$(CONFIG_MCP4728) +=3D mcp4728.o obj-$(CONFIG_MCP47FEB02) +=3D mcp47feb02.o diff --git a/drivers/iio/dac/mcf54415_dac.c b/drivers/iio/dac/mcf54415_dac.c new file mode 100644 index 000000000000..4031a5dc1f9d --- /dev/null +++ b/drivers/iio/dac/mcf54415_dac.c @@ -0,0 +1,200 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * NXP mcf54415 DAC driver + * + * Copyright 2026 BayLibre - adureghello@baylibre.com + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MCF54415_DAC_CR 0x00 +#define MCF54415_DAC_CR_PDN BIT(0) +#define MCF54415_DAC_CR_HSLS BIT(6) +#define MCF54415_DAC_CR_WMLVL GENMASK(9, 8) +#define MCF54415_DAC_CR_FILT BIT(12) + +#define MCF54415_DAC_DATA 0x02 + +#define MCF54415_DAC_READY_US 12 + +struct mcf54415_dac { + struct clk *clk; + struct device *dev; + void __iomem *regs; +}; + +static void mcf54415_dac_init(struct mcf54415_dac *info) +{ + int val; + + /* Keeping defaults and enable DAC (bit 0 set to 0) */ + val =3D MCF54415_DAC_CR_FILT; + val |=3D FIELD_PREP(MCF54415_DAC_CR_WMLVL, 1); + + writew(val, info->regs + MCF54415_DAC_CR); + + /* DAC is ready after 12us, from RM table 40-3 */ + fsleep(MCF54415_DAC_READY_US); +} + +static void mcf54415_dac_exit(void *data) +{ + struct mcf54415_dac *info =3D data; + int val; + + val =3D readw(info->regs + MCF54415_DAC_CR); + val |=3D MCF54415_DAC_CR_PDN; + writew(val, info->regs + MCF54415_DAC_CR); +} + +#define MCF54415_DAC_CHAN { \ + .type =3D IIO_VOLTAGE, \ + .output =3D 1, \ + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type =3D BIT(IIO_CHAN_INFO_SCALE), \ +} + +static const struct iio_chan_spec mcf54415_dac_iio_channels[] =3D { + MCF54415_DAC_CHAN +}; + +static int mcf54415_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, + long mask) +{ + struct mcf54415_dac *info =3D iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + *val =3D readw(info->regs + MCF54415_DAC_DATA); + return IIO_VAL_INT; + case IIO_CHAN_INFO_SCALE: + /* Reference voltage as per ColdFire datasheet is 3.3V */ + *val =3D 3300 /* mV */; + *val2 =3D 12; + return IIO_VAL_FRACTIONAL_LOG2; + default: + return -EINVAL; + } + + return 0; +} + +static int mcf54415_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, + long mask) +{ + struct mcf54415_dac *info =3D iio_priv(indio_dev); + + switch (mask) { + case IIO_CHAN_INFO_RAW: + writew(val, info->regs + MCF54415_DAC_DATA); + return 0; + + default: + return -EINVAL; + } +} + +static const struct iio_info mcf54415_dac_iio_info =3D { + .read_raw =3D &mcf54415_read_raw, + .write_raw =3D &mcf54415_write_raw, +}; + +static int mcf54415_dac_probe(struct platform_device *pdev) +{ + struct iio_dev *indio_dev; + struct mcf54415_dac *info; + int ret; + + indio_dev =3D devm_iio_device_alloc(&pdev->dev, + sizeof(struct mcf54415_dac)); + if (!indio_dev) + return -ENOMEM; + + info =3D iio_priv(indio_dev); + info->dev =3D &pdev->dev; + + info->regs =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(info->regs)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->regs), + "failed to get io regs\n"); + + info->clk =3D devm_clk_get_enabled(&pdev->dev, "dac"); + if (IS_ERR(info->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), + "failed getting clock\n"); + + platform_set_drvdata(pdev, indio_dev); + + indio_dev->name =3D dev_name(&pdev->dev); + indio_dev->info =3D &mcf54415_dac_iio_info; + indio_dev->modes =3D INDIO_DIRECT_MODE; + indio_dev->channels =3D mcf54415_dac_iio_channels; + indio_dev->num_channels =3D ARRAY_SIZE(mcf54415_dac_iio_channels); + + mcf54415_dac_init(info); + + ret =3D devm_add_action_or_reset(&pdev->dev, mcf54415_dac_exit, info); + if (ret) + return ret; + + ret =3D devm_iio_device_register(&pdev->dev, indio_dev); + if (ret) + dev_err(&pdev->dev, "couldn't register the device\n"); + + return ret; +} + +static int mcf54415_dac_suspend(struct device *dev) +{ + struct iio_dev *indio_dev =3D dev_get_drvdata(dev); + struct mcf54415_dac *info =3D iio_priv(indio_dev); + + mcf54415_dac_exit(info); + clk_disable_unprepare(info->clk); + + return 0; +} + +static int mcf54415_dac_resume(struct device *dev) +{ + struct iio_dev *indio_dev =3D dev_get_drvdata(dev); + struct mcf54415_dac *info =3D iio_priv(indio_dev); + int ret; + + ret =3D clk_prepare_enable(info->clk); + if (ret) + return ret; + + mcf54415_dac_init(info); + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(mcf54415_dac_pm_ops, mcf54415_dac_suspend, + mcf54415_dac_resume); + +static struct platform_driver mcf54415_dac_driver =3D { + .probe =3D mcf54415_dac_probe, + .driver =3D { + .name =3D "mcf54415_dac", + .pm =3D pm_sleep_ptr(&mcf54415_dac_pm_ops), + }, +}; +module_platform_driver(mcf54415_dac_driver); + +MODULE_AUTHOR("Angelo Dureghello "); +MODULE_DESCRIPTION("NXP MCF54415 DAC driver"); +MODULE_LICENSE("GPL"); --=20 2.54.0