mb/clevo/l140cu: Make usage of variant mechanism

Clevo mainboards can be grouped by their common platform. Therefore,
restructure the mainboard directory as a first step, so that the variant
mechanism is used.

This moves most of the code into the variant dir, since the L140CU is
the only variant at the moment.

Change-Id: I9ad1c06f9db854cac1dd420c53dc0c9f010ed716
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45664
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/mainboard/clevo/l140cu/Kconfig b/src/mainboard/clevo/l140cu/Kconfig
index 9012dc6..c158add 100644
--- a/src/mainboard/clevo/l140cu/Kconfig
+++ b/src/mainboard/clevo/l140cu/Kconfig
@@ -27,19 +27,23 @@
 
 config MAINBOARD_PART_NUMBER
 	string
-	default "L140CU"
+	default "L140CU" if BOARD_CLEVO_L140CU
 
 config MAINBOARD_SMBIOS_PRODUCT_NAME
 	string
-	default "L140CU"
+	default "L140CU" if BOARD_CLEVO_L140CU
 
 config MAINBOARD_VERSION
 	string
-	default "2.1A"
+	default "2.1A" if BOARD_CLEVO_L140CU
+
+config DEVICETREE
+	string
+	default "variants/$(CONFIG_VARIANT_DIR)/devicetree.cb"
 
 config CBFS_SIZE
 	hex
-	default 0xc00000
+	default 0xc00000 if BOARD_CLEVO_L140CU
 
 config CONSOLE_POST
 	bool
@@ -51,11 +55,11 @@
 
 config MAX_CPUS
 	int
-	default 8
+	default 8 if BOARD_CLEVO_L140CU
 
 config DIMM_MAX
 	int
-	default 2
+	default 2 if BOARD_CLEVO_L140CU
 
 config DIMM_SPD_SIZE
 	int
@@ -71,10 +75,14 @@
 
 config TPM_PIRQ
 	hex
-	default 0x10 # GPP_A7/PIRQA#
+	default 0x10 if BOARD_CLEVO_L140CU # GPP_A7/PIRQA#
 
 config POST_DEVICE
 	bool
 	default n
 
+config VARIANT_DIR
+	string
+	default "l140cu" if BOARD_CLEVO_L140CU
+
 endif
diff --git a/src/mainboard/clevo/l140cu/Makefile.inc b/src/mainboard/clevo/l140cu/Makefile.inc
index 3d742d6..6a388f2 100644
--- a/src/mainboard/clevo/l140cu/Makefile.inc
+++ b/src/mainboard/clevo/l140cu/Makefile.inc
@@ -1,4 +1 @@
-bootblock-y += bootblock.c
-ramstage-y += ramstage.c
-ramstage-y += hda_verb.c
-SPD_SOURCES  = samsung-K4AAG165WA-BCTD
+subdirs-y += variants/$(VARIANT_DIR)
diff --git a/src/mainboard/clevo/l140cu/board_info.txt b/src/mainboard/clevo/l140cu/board_info.txt
index 421aa3d..6710993 100644
--- a/src/mainboard/clevo/l140cu/board_info.txt
+++ b/src/mainboard/clevo/l140cu/board_info.txt
@@ -1,7 +1,5 @@
 Vendor name: Clevo
-Board name: L140CU
 Category: laptop
-Release year: 2020
 ROM package: SOIC-8
 ROM protocol: SPI
 ROM socketed: n
diff --git a/src/mainboard/clevo/l140cu/variants/l140cu/Makefile.inc b/src/mainboard/clevo/l140cu/variants/l140cu/Makefile.inc
new file mode 100644
index 0000000..3d742d6
--- /dev/null
+++ b/src/mainboard/clevo/l140cu/variants/l140cu/Makefile.inc
@@ -0,0 +1,4 @@
+bootblock-y += bootblock.c
+ramstage-y += ramstage.c
+ramstage-y += hda_verb.c
+SPD_SOURCES  = samsung-K4AAG165WA-BCTD
diff --git a/src/mainboard/clevo/l140cu/variants/l140cu/board_info.txt b/src/mainboard/clevo/l140cu/variants/l140cu/board_info.txt
new file mode 100644
index 0000000..8623032
--- /dev/null
+++ b/src/mainboard/clevo/l140cu/variants/l140cu/board_info.txt
@@ -0,0 +1,2 @@
+Board name: L140CU
+Release year: 2020
diff --git a/src/mainboard/clevo/l140cu/bootblock.c b/src/mainboard/clevo/l140cu/variants/l140cu/bootblock.c
similarity index 100%
rename from src/mainboard/clevo/l140cu/bootblock.c
rename to src/mainboard/clevo/l140cu/variants/l140cu/bootblock.c
diff --git a/src/mainboard/clevo/l140cu/data.vbt b/src/mainboard/clevo/l140cu/variants/l140cu/data.vbt
similarity index 100%
rename from src/mainboard/clevo/l140cu/data.vbt
rename to src/mainboard/clevo/l140cu/variants/l140cu/data.vbt
Binary files differ
diff --git a/src/mainboard/clevo/l140cu/devicetree.cb b/src/mainboard/clevo/l140cu/variants/l140cu/devicetree.cb
similarity index 100%
rename from src/mainboard/clevo/l140cu/devicetree.cb
rename to src/mainboard/clevo/l140cu/variants/l140cu/devicetree.cb
diff --git a/src/mainboard/clevo/l140cu/gpio.h b/src/mainboard/clevo/l140cu/variants/l140cu/gpio.h
similarity index 100%
rename from src/mainboard/clevo/l140cu/gpio.h
rename to src/mainboard/clevo/l140cu/variants/l140cu/gpio.h
diff --git a/src/mainboard/clevo/l140cu/hda_verb.c b/src/mainboard/clevo/l140cu/variants/l140cu/hda_verb.c
similarity index 100%
rename from src/mainboard/clevo/l140cu/hda_verb.c
rename to src/mainboard/clevo/l140cu/variants/l140cu/hda_verb.c
diff --git a/src/mainboard/clevo/l140cu/ramstage.c b/src/mainboard/clevo/l140cu/variants/l140cu/ramstage.c
similarity index 100%
rename from src/mainboard/clevo/l140cu/ramstage.c
rename to src/mainboard/clevo/l140cu/variants/l140cu/ramstage.c
diff --git a/src/mainboard/clevo/l140cu/romstage.c b/src/mainboard/clevo/l140cu/variants/l140cu/romstage.c
similarity index 100%
rename from src/mainboard/clevo/l140cu/romstage.c
rename to src/mainboard/clevo/l140cu/variants/l140cu/romstage.c