recipes-kernel: merge the nuvoton npcm_adc driver and moved it to the outer layer

Both NPCM7xx and NPCM8xx need to update the NPCM ADC driver to the
latest commit, so I moved it out and reordered the original patches.

Tested:
build success.

Platforms-Affected: 7xx & 8xx
Fusion-Link: http://fusion2/85ee2e40-3fa0-3291-9e5c-b8483ec376ab
Google-Bug-Id: 386715774
Change-Id: I5bf598c386cfee973a0d5068dcc16ce1dee8e9ed
Signed-off-by: Charles Hsu <charles.hsu@quanta.corp-partner.google.com>
(cherry picked from commit 25dd72c3c3d9fcbdcdb7ec3684dee3e4ba571778)
diff --git a/recipes-kernel/linux/5.15/1005-drivers-iio-adc-sync-npcm-adc.patch b/recipes-kernel/linux/5.15/0001-drivers-iio-adc-sync-npcm-adc.patch
similarity index 94%
rename from recipes-kernel/linux/5.15/1005-drivers-iio-adc-sync-npcm-adc.patch
rename to recipes-kernel/linux/5.15/0001-drivers-iio-adc-sync-npcm-adc.patch
index ca01dc6..a84f82a 100644
--- a/recipes-kernel/linux/5.15/1005-drivers-iio-adc-sync-npcm-adc.patch
+++ b/recipes-kernel/linux/5.15/0001-drivers-iio-adc-sync-npcm-adc.patch
@@ -1,14 +1,14 @@
-From d6cf61a3d13b3a21dc614125569a4d9a2d220b3b Mon Sep 17 00:00:00 2001
+From 954956f22866f61813b267bd8fcd447001176b08 Mon Sep 17 00:00:00 2001
 From: David Wang <davidwang@quantatw.com>
 Date: Mon, 6 Nov 2023 10:46:35 +0800
-Subject: [PATCH 05/16] drivers: iio: adc: sync npcm adc
+Subject: [PATCH] drivers: iio: adc: sync npcm adc
 
 ---
- drivers/iio/adc/npcm_adc.c | 176 ++++++++++++++++++++++---------------
- 1 file changed, 107 insertions(+), 69 deletions(-)
+ drivers/iio/adc/npcm_adc.c | 180 +++++++++++++++++++++++--------------
+ 1 file changed, 111 insertions(+), 69 deletions(-)
 
 diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c
-index 62c1ef40b519..74bcadbce5b3 100644
+index 62c1ef40b519..de0f6462dbc1 100644
 --- a/drivers/iio/adc/npcm_adc.c
 +++ b/drivers/iio/adc/npcm_adc.c
 @@ -16,6 +16,17 @@
@@ -361,7 +361,15 @@
  	mutex_init(&info->lock);
  
  	info->dev = &pdev->dev;
-@@ -397,6 +429,12 @@ static int npcm_adc_probe(struct platform_device *pdev)
+@@ -393,10 +425,20 @@ static int npcm_adc_probe(struct platform_device *pdev)
+ 
+ 	/* calculate ADC clock sample rate */
+ 	reg_con = ioread32(info->regs + NPCM_ADCCON);
++	/* clear ADC interrupt status */
++	if (reg_con & NPCM_ADCCON_ADC_INT_ST)
++		iowrite32(reg_con, info->regs + NPCM_ADCCON);
++	reg_con = ioread32(info->regs + NPCM_ADCCON);
+ 	div = reg_con & NPCM_ADCCON_DIV_MASK;
  	div = div >> NPCM_ADCCON_DIV_SHIFT;
  	info->adc_sample_hz = clk_get_rate(info->adc_clk) / ((div + 1) * 2);
  
@@ -374,7 +382,7 @@
  	irq = platform_get_irq(pdev, 0);
  	if (irq <= 0) {
  		ret = -EINVAL;
-@@ -436,7 +474,7 @@ static int npcm_adc_probe(struct platform_device *pdev)
+@@ -436,7 +478,7 @@ static int npcm_adc_probe(struct platform_device *pdev)
  			  info->regs + NPCM_ADCCON);
  	}
  
@@ -384,5 +392,5 @@
  
  	reg_con = ioread32(info->regs + NPCM_ADCCON);
 -- 
-2.25.1
+2.34.1
 
diff --git a/recipes-kernel/linux/5.15/1006-drivers-char-ipmi-sync-npcm-kcs-bmc.patch b/recipes-kernel/linux/5.15/1005-drivers-char-ipmi-sync-npcm-kcs-bmc.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1006-drivers-char-ipmi-sync-npcm-kcs-bmc.patch
rename to recipes-kernel/linux/5.15/1005-drivers-char-ipmi-sync-npcm-kcs-bmc.patch
diff --git a/recipes-kernel/linux/5.15/1007-drivers-char-hwrng-npcm-sync-npcm-rng.patch b/recipes-kernel/linux/5.15/1006-drivers-char-hwrng-npcm-sync-npcm-rng.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1007-drivers-char-hwrng-npcm-sync-npcm-rng.patch
rename to recipes-kernel/linux/5.15/1006-drivers-char-hwrng-npcm-sync-npcm-rng.patch
diff --git a/recipes-kernel/linux/5.15/1008-drivers-spi-sync-npcm-spi.patch b/recipes-kernel/linux/5.15/1007-drivers-spi-sync-npcm-spi.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1008-drivers-spi-sync-npcm-spi.patch
rename to recipes-kernel/linux/5.15/1007-drivers-spi-sync-npcm-spi.patch
diff --git a/recipes-kernel/linux/5.15/1009-drivers-usb-host-sync-npcm-ehci-ohci.patch b/recipes-kernel/linux/5.15/1008-drivers-usb-host-sync-npcm-ehci-ohci.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1009-drivers-usb-host-sync-npcm-ehci-ohci.patch
rename to recipes-kernel/linux/5.15/1008-drivers-usb-host-sync-npcm-ehci-ohci.patch
diff --git a/recipes-kernel/linux/5.15/1010-drivers-edac-sync-npcm-edac.patch b/recipes-kernel/linux/5.15/1009-drivers-edac-sync-npcm-edac.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1010-drivers-edac-sync-npcm-edac.patch
rename to recipes-kernel/linux/5.15/1009-drivers-edac-sync-npcm-edac.patch
diff --git a/recipes-kernel/linux/5.15/1011-drivers-net-stmmac-add-npcm-support.patch b/recipes-kernel/linux/5.15/1010-drivers-net-stmmac-add-npcm-support.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1011-drivers-net-stmmac-add-npcm-support.patch
rename to recipes-kernel/linux/5.15/1010-drivers-net-stmmac-add-npcm-support.patch
diff --git a/recipes-kernel/linux/5.15/1012-drivers-char-sync-npcm-otp.patch b/recipes-kernel/linux/5.15/1011-drivers-char-sync-npcm-otp.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1012-drivers-char-sync-npcm-otp.patch
rename to recipes-kernel/linux/5.15/1011-drivers-char-sync-npcm-otp.patch
diff --git a/recipes-kernel/linux/5.15/1013-drivers-watchdog-sync-npcm-wdt.patch b/recipes-kernel/linux/5.15/1012-drivers-watchdog-sync-npcm-wdt.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1013-drivers-watchdog-sync-npcm-wdt.patch
rename to recipes-kernel/linux/5.15/1012-drivers-watchdog-sync-npcm-wdt.patch
diff --git a/recipes-kernel/linux/5.15/1014-drivers-i2c-sync-npcm-i2c.patch b/recipes-kernel/linux/5.15/1013-drivers-i2c-sync-npcm-i2c.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1014-drivers-i2c-sync-npcm-i2c.patch
rename to recipes-kernel/linux/5.15/1013-drivers-i2c-sync-npcm-i2c.patch
diff --git a/recipes-kernel/linux/5.15/1015-drivers-misc-sync-npcm-jtag-master.patch b/recipes-kernel/linux/5.15/1014-drivers-misc-sync-npcm-jtag-master.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1015-drivers-misc-sync-npcm-jtag-master.patch
rename to recipes-kernel/linux/5.15/1014-drivers-misc-sync-npcm-jtag-master.patch
diff --git a/recipes-kernel/linux/5.15/1016-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch b/recipes-kernel/linux/5.15/1015-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1016-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch
rename to recipes-kernel/linux/5.15/1015-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch
diff --git a/recipes-kernel/linux/5.15/1017-drivers-crypto-sync-npcm-crypto.patch b/recipes-kernel/linux/5.15/1016-drivers-crypto-sync-npcm-crypto.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1017-drivers-crypto-sync-npcm-crypto.patch
rename to recipes-kernel/linux/5.15/1016-drivers-crypto-sync-npcm-crypto.patch
diff --git a/recipes-kernel/linux/5.15/1018-drivers-gpio-sync-npcm-sgpio.patch b/recipes-kernel/linux/5.15/1017-drivers-gpio-sync-npcm-sgpio.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1018-drivers-gpio-sync-npcm-sgpio.patch
rename to recipes-kernel/linux/5.15/1017-drivers-gpio-sync-npcm-sgpio.patch
diff --git a/recipes-kernel/linux/5.15/1019-drivers-mailbox-sync-npcm-mailbox.patch b/recipes-kernel/linux/5.15/1018-drivers-mailbox-sync-npcm-mailbox.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1019-drivers-mailbox-sync-npcm-mailbox.patch
rename to recipes-kernel/linux/5.15/1018-drivers-mailbox-sync-npcm-mailbox.patch
diff --git a/recipes-kernel/linux/5.15/1020-drivers-soc-sync-npcm-soc.patch b/recipes-kernel/linux/5.15/1019-drivers-soc-sync-npcm-soc.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1020-drivers-soc-sync-npcm-soc.patch
rename to recipes-kernel/linux/5.15/1019-drivers-soc-sync-npcm-soc.patch
diff --git a/recipes-kernel/linux/5.15/1021-drivers-thermal-sync-npcm-thermal.patch b/recipes-kernel/linux/5.15/1020-drivers-thermal-sync-npcm-thermal.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1021-drivers-thermal-sync-npcm-thermal.patch
rename to recipes-kernel/linux/5.15/1020-drivers-thermal-sync-npcm-thermal.patch
diff --git a/recipes-kernel/linux/5.15/1022-drivers-clocksource-sync-timer-npcm.patch b/recipes-kernel/linux/5.15/1021-drivers-clocksource-sync-timer-npcm.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1022-drivers-clocksource-sync-timer-npcm.patch
rename to recipes-kernel/linux/5.15/1021-drivers-clocksource-sync-timer-npcm.patch
diff --git a/recipes-kernel/linux/5.15/1023-drivers-net-sync-npcm-emc.patch b/recipes-kernel/linux/5.15/1022-drivers-net-sync-npcm-emc.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1023-drivers-net-sync-npcm-emc.patch
rename to recipes-kernel/linux/5.15/1022-drivers-net-sync-npcm-emc.patch
diff --git a/recipes-kernel/linux/5.15/1024-drivers-i2c-add-slave-mqueue.patch b/recipes-kernel/linux/5.15/1023-drivers-i2c-add-slave-mqueue.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1024-drivers-i2c-add-slave-mqueue.patch
rename to recipes-kernel/linux/5.15/1023-drivers-i2c-add-slave-mqueue.patch
diff --git a/recipes-kernel/linux/5.15/1025-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch b/recipes-kernel/linux/5.15/1024-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1025-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch
rename to recipes-kernel/linux/5.15/1024-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch
diff --git a/recipes-kernel/linux/5.15/1026-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch b/recipes-kernel/linux/5.15/1025-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1026-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch
rename to recipes-kernel/linux/5.15/1025-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch
diff --git a/recipes-kernel/linux/5.15/1027-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch b/recipes-kernel/linux/5.15/1026-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1027-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch
rename to recipes-kernel/linux/5.15/1026-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch
diff --git a/recipes-kernel/linux/5.15/1029-drivers-rtc-sync-npcm-rtc.patch b/recipes-kernel/linux/5.15/1027-drivers-rtc-sync-npcm-rtc.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1029-drivers-rtc-sync-npcm-rtc.patch
rename to recipes-kernel/linux/5.15/1027-drivers-rtc-sync-npcm-rtc.patch
diff --git a/recipes-kernel/linux/5.15/1030-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch b/recipes-kernel/linux/5.15/1028-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1030-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch
rename to recipes-kernel/linux/5.15/1028-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch
diff --git a/recipes-kernel/linux/5.15/1028-iio-adc-npcm-clear-interrupt-status-at-probe.patch b/recipes-kernel/linux/5.15/1028-iio-adc-npcm-clear-interrupt-status-at-probe.patch
deleted file mode 100644
index 41b0a0f..0000000
--- a/recipes-kernel/linux/5.15/1028-iio-adc-npcm-clear-interrupt-status-at-probe.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From aa713e101cbd1134076575a7acec8391c99cd1a7 Mon Sep 17 00:00:00 2001
-From: Tomer Maimon <tmaimon77@gmail.com>
-Date: Thu, 7 Dec 2023 08:33:19 +0200
-Subject: [PATCH] iio: adc: npcm: clear interrupt status at probe
-
-Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
----
- drivers/iio/adc/npcm_adc.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c
-index 74bcadbce5b353..de0f6462dbc145 100644
---- a/drivers/iio/adc/npcm_adc.c
-+++ b/drivers/iio/adc/npcm_adc.c
-@@ -425,6 +425,10 @@ static int npcm_adc_probe(struct platform_device *pdev)
- 
- 	/* calculate ADC clock sample rate */
- 	reg_con = ioread32(info->regs + NPCM_ADCCON);
-+	/* clear ADC interrupt status */
-+	if (reg_con & NPCM_ADCCON_ADC_INT_ST)
-+		iowrite32(reg_con, info->regs + NPCM_ADCCON);
-+	reg_con = ioread32(info->regs + NPCM_ADCCON);
- 	div = reg_con & NPCM_ADCCON_DIV_MASK;
- 	div = div >> NPCM_ADCCON_DIV_SHIFT;
- 	info->adc_sample_hz = clk_get_rate(info->adc_clk) / ((div + 1) * 2);
diff --git a/recipes-kernel/linux/5.15/1031-soc-nuvoton-Add-mmbi-driver-401.patch b/recipes-kernel/linux/5.15/1029-soc-nuvoton-Add-mmbi-driver-401.patch
similarity index 100%
rename from recipes-kernel/linux/5.15/1031-soc-nuvoton-Add-mmbi-driver-401.patch
rename to recipes-kernel/linux/5.15/1029-soc-nuvoton-Add-mmbi-driver-401.patch
diff --git a/recipes-kernel/linux/linux-gbmc_5.15.bb b/recipes-kernel/linux/linux-gbmc_5.15.bb
index 1e4abe8..be85180 100644
--- a/recipes-kernel/linux/linux-gbmc_5.15.bb
+++ b/recipes-kernel/linux/linux-gbmc_5.15.bb
@@ -21,6 +21,7 @@
   file://0002-hwmon-max34451-Add-programming-feature.patch \
   file://0001-i2c-npcm-Sync-with-6.1.patch \
   file://0001-hwmon-mp2981-driver.patch \
+  file://0001-drivers-iio-adc-sync-npcm-adc.patch \
   file://0001-iio-adc-npcm-add-reset-method-to-fix-get-value-faile.patch \
   "
 
@@ -38,33 +39,31 @@
   file://1002-drivers-clk-npcm8xx-sync-npcm-clock.patch \
   file://1003-drivers-reset-sync-npcm-reset.patch \
   file://1004-drivers-pinctrl-nuvoton-sync-npcm-pinctrl.patch \
-  file://1005-drivers-iio-adc-sync-npcm-adc.patch \
-  file://1006-drivers-char-ipmi-sync-npcm-kcs-bmc.patch \
-  file://1007-drivers-char-hwrng-npcm-sync-npcm-rng.patch \
-  file://1008-drivers-spi-sync-npcm-spi.patch \
-  file://1009-drivers-usb-host-sync-npcm-ehci-ohci.patch \
-  file://1010-drivers-edac-sync-npcm-edac.patch \
-  file://1011-drivers-net-stmmac-add-npcm-support.patch \
-  file://1012-drivers-char-sync-npcm-otp.patch \
-  file://1013-drivers-watchdog-sync-npcm-wdt.patch \
-  file://1014-drivers-i2c-sync-npcm-i2c.patch \
-  file://1015-drivers-misc-sync-npcm-jtag-master.patch \
-  file://1016-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch \
-  file://1017-drivers-crypto-sync-npcm-crypto.patch \
-  file://1018-drivers-gpio-sync-npcm-sgpio.patch \
-  file://1019-drivers-mailbox-sync-npcm-mailbox.patch \
-  file://1020-drivers-soc-sync-npcm-soc.patch \
-  file://1021-drivers-thermal-sync-npcm-thermal.patch \
-  file://1022-drivers-clocksource-sync-timer-npcm.patch \
-  file://1023-drivers-net-sync-npcm-emc.patch \
-  file://1024-drivers-i2c-add-slave-mqueue.patch \
-  file://1025-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch \
-  file://1026-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch \
-  file://1027-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch \
-  file://1028-iio-adc-npcm-clear-interrupt-status-at-probe.patch \
-  file://1029-drivers-rtc-sync-npcm-rtc.patch \
-  file://1030-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch \
-  file://1031-soc-nuvoton-Add-mmbi-driver-401.patch \
+  file://1005-drivers-char-ipmi-sync-npcm-kcs-bmc.patch \
+  file://1006-drivers-char-hwrng-npcm-sync-npcm-rng.patch \
+  file://1007-drivers-spi-sync-npcm-spi.patch \
+  file://1008-drivers-usb-host-sync-npcm-ehci-ohci.patch \
+  file://1009-drivers-edac-sync-npcm-edac.patch \
+  file://1010-drivers-net-stmmac-add-npcm-support.patch \
+  file://1011-drivers-char-sync-npcm-otp.patch \
+  file://1012-drivers-watchdog-sync-npcm-wdt.patch \
+  file://1013-drivers-i2c-sync-npcm-i2c.patch \
+  file://1014-drivers-misc-sync-npcm-jtag-master.patch \
+  file://1015-drivers-misc-sync-npcm-lpc-and-pci-mbox.patch \
+  file://1016-drivers-crypto-sync-npcm-crypto.patch \
+  file://1017-drivers-gpio-sync-npcm-sgpio.patch \
+  file://1018-drivers-mailbox-sync-npcm-mailbox.patch \
+  file://1019-drivers-soc-sync-npcm-soc.patch \
+  file://1020-drivers-thermal-sync-npcm-thermal.patch \
+  file://1021-drivers-clocksource-sync-timer-npcm.patch \
+  file://1022-drivers-net-sync-npcm-emc.patch \
+  file://1023-drivers-i2c-add-slave-mqueue.patch \
+  file://1024-drivers-i3c-mctp-sync-npcm-i3c-mctp.patch \
+  file://1025-gpio-use-raw-spinlock-for-gpio-chip-shadowed-data.patch \
+  file://1026-arm64-Set-ARCH_NR_GPIO-to-1024-for-ARCH_NPCM.patch \
+  file://1027-drivers-rtc-sync-npcm-rtc.patch \
+  file://1028-arm64-dts-nuvoton-npcm845-set-FIU-UMA-read.patch \
+  file://1029-soc-nuvoton-Add-mmbi-driver-401.patch \
   file://npcm8xx_defconfig \
   "