Re: [PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-20 Thread Dan Carpenter
On Tue, Feb 20, 2024 at 09:38:01AM +0100, Frieder Schrempf wrote:
> Hi Dan,
> 
> On 20.02.24 06:56, Dan Carpenter wrote:
> > On Thu, Feb 15, 2024 at 02:35:20PM +0100, Frieder Schrempf wrote:
> >> +int board_mmc_getcd(struct mmc *mmc)
> > 
> > This function is never called.  Also for bool functions make them type
> > bool and name them so that it's clear they return true/false such as
> > board_mmc_getcd_was_successful() but less wordy.
> 
> What makes you think so? This is an implementation for the existing
> prototype from mmc.h. As far as I can see this is called by the mmc
> driver and I can't change it in any way.
> 

Ah, yes.  You're right.  My bad.

regards,
dan carpenter



Re: [PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-20 Thread Frieder Schrempf
Hi Dan,

On 20.02.24 06:56, Dan Carpenter wrote:
> On Thu, Feb 15, 2024 at 02:35:20PM +0100, Frieder Schrempf wrote:
>> +int board_mmc_getcd(struct mmc *mmc)
> 
> This function is never called.  Also for bool functions make them type
> bool and name them so that it's clear they return true/false such as
> board_mmc_getcd_was_successful() but less wordy.

What makes you think so? This is an implementation for the existing
prototype from mmc.h. As far as I can see this is called by the mmc
driver and I can't change it in any way.

> 
>> +{
>> +struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
>> +int ret = 0;
>> +
>> +switch (cfg->esdhc_base) {
>> +case USDHC3_BASE_ADDR:
>> +ret = !gpio_get_value(USDHC3_CD_GPIO);
>> +break;
>> +}
>> +
>> +return ret;
>> +}
>> +
>> +int board_mmc_init(struct bd_info *bis)
>> +{
>> +int i, ret;
>> +
>> +/*
>> + * According to the board_mmc_init() the following map is done:
>> + * (U-boot device node)(Physical Port)
>> + * mmc0USDHC1
>> + * mmc1USDHC2
>> + */
>> +for (i = 0; i < CFG_SYS_FSL_USDHC_NUM; i++) {
>> +switch (i) {
>> +case 0:
>> +imx_iomux_v3_setup_multiple_pads(usdhc3_pads,
>> + 
>> ARRAY_SIZE(usdhc3_pads));
>> +gpio_direction_input(USDHC3_CD_GPIO);
>> +usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
>> +break;
>> +default:
>> +printf("Warning: you configured more USDHC controllers \
>> +(%d) than supported by the board\n", i + 1);
>> +return -EINVAL;
> 
> This will look weird if it's ever printed:
> 
> "Warning: you configured more USDHC controllers   
> (%d) than supported by the board\n"
> 
> There is a checkpatch warnings for this.
> 
> WARNING: Avoid line continuations in quoted strings
> #1137: FILE: board/sielaff/imx6dl-sielaff/spl.c:96:
> +   printf("Warning: you configured more USDHC 
> controllers \

Agreed. Fabio already applied this to his tree. I can send a fixup for this.

Thanks
Frieder


Re: [PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-19 Thread Dan Carpenter
On Thu, Feb 15, 2024 at 02:35:20PM +0100, Frieder Schrempf wrote:
> +int board_mmc_getcd(struct mmc *mmc)

This function is never called.  Also for bool functions make them type
bool and name them so that it's clear they return true/false such as
board_mmc_getcd_was_successful() but less wordy.

> +{
> + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> + int ret = 0;
> +
> + switch (cfg->esdhc_base) {
> + case USDHC3_BASE_ADDR:
> + ret = !gpio_get_value(USDHC3_CD_GPIO);
> + break;
> + }
> +
> + return ret;
> +}
> +
> +int board_mmc_init(struct bd_info *bis)
> +{
> + int i, ret;
> +
> + /*
> +  * According to the board_mmc_init() the following map is done:
> +  * (U-boot device node)(Physical Port)
> +  * mmc0USDHC1
> +  * mmc1USDHC2
> +  */
> + for (i = 0; i < CFG_SYS_FSL_USDHC_NUM; i++) {
> + switch (i) {
> + case 0:
> + imx_iomux_v3_setup_multiple_pads(usdhc3_pads,
> +  
> ARRAY_SIZE(usdhc3_pads));
> + gpio_direction_input(USDHC3_CD_GPIO);
> + usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> + break;
> + default:
> + printf("Warning: you configured more USDHC controllers \
> + (%d) than supported by the board\n", i + 1);
> + return -EINVAL;

This will look weird if it's ever printed:

"Warning: you configured more USDHC controllers 
(%d) than supported by the board\n"

There is a checkpatch warnings for this.

WARNING: Avoid line continuations in quoted strings
#1137: FILE: board/sielaff/imx6dl-sielaff/spl.c:96:
+   printf("Warning: you configured more USDHC controllers \

regards,
dan carpenter



[PATCH v3 2/3] board: Add support for Sielaff i.MX6 Solo board

2024-02-15 Thread Frieder Schrempf
From: Frieder Schrempf 

The Sielaff i.MX6 Solo board is a control and HMI board for vending
machines. Add support for this board.

The devicetree files are taken from pending changes in the Linux
kernel that are available from linux-next and will likely be
part of Linux v6.9.

Signed-off-by: Frieder Schrempf 
---
Changes in v3:
* Add missing MAINTAINERS file

Changes in v2:
* Implement changes suggested by Fabio (Thanks!)
  * Fix system reset and remove unneeded cpu_reset()
  * Add 'static const' to nfc_pads[]
  * Remove hostname from env
  * Remove options to disable caches
* Enable watchdog and wdt command
* Enable LTO
---
 arch/arm/dts/Makefile |   1 +
 arch/arm/dts/imx6dl-sielaff-u-boot.dtsi   |  38 ++
 arch/arm/dts/imx6dl-sielaff.dts   | 533 ++
 arch/arm/mach-imx/mx6/Kconfig |  10 +
 board/sielaff/imx6dl-sielaff/Kconfig  |  15 +
 board/sielaff/imx6dl-sielaff/MAINTAINERS  |   9 +
 board/sielaff/imx6dl-sielaff/Makefile |   8 +
 board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c | 111 
 .../sielaff/imx6dl-sielaff/imx6dl-sielaff.env | 114 
 board/sielaff/imx6dl-sielaff/spl.c| 273 +
 configs/imx6dl_sielaff_defconfig  | 120 
 include/configs/imx6dl-sielaff.h  |  25 +
 12 files changed, 1257 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-sielaff-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx6dl-sielaff.dts
 create mode 100644 board/sielaff/imx6dl-sielaff/Kconfig
 create mode 100644 board/sielaff/imx6dl-sielaff/MAINTAINERS
 create mode 100644 board/sielaff/imx6dl-sielaff/Makefile
 create mode 100644 board/sielaff/imx6dl-sielaff/imx6dl-sielaff.c
 create mode 100644 board/sielaff/imx6dl-sielaff/imx6dl-sielaff.env
 create mode 100644 board/sielaff/imx6dl-sielaff/spl.c
 create mode 100644 configs/imx6dl_sielaff_defconfig
 create mode 100644 include/configs/imx6dl-sielaff.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0fcae77cefe..d60fa1179af 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -930,6 +930,7 @@ dtb-y += \
imx6dl-riotboard.dtb \
imx6dl-sabreauto.dtb \
imx6dl-sabresd.dtb \
+   imx6dl-sielaff.dtb \
imx6dl-wandboard-revd1.dtb \
imx6s-dhcom-drc02.dtb
 
diff --git a/arch/arm/dts/imx6dl-sielaff-u-boot.dtsi 
b/arch/arm/dts/imx6dl-sielaff-u-boot.dtsi
new file mode 100644
index 000..8f5a70ccb85
--- /dev/null
+++ b/arch/arm/dts/imx6dl-sielaff-u-boot.dtsi
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Copyright (C) 2022 Kontron Electronics GmbH
+ */
+
+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+   binman: binman {
+   filename = "flash.bin";
+   pad-byte = <0x00>;
+
+   spl: blob-ext@1 {
+   offset = <0x0>;
+   filename = "SPL";
+   };
+
+   uboot: blob-ext@2 {
+   offset = <0x11000>;
+   filename = "u-boot.img";
+   };
+   };
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   };
+};
+
+ {
+   phy-mode = "rmii";
+   phy-reset-gpios = < 2 GPIO_ACTIVE_LOW>;
+   phy-reset-duration = <100>;
+};
+
+ {
+   fsl,legacy-bch-geometry;
+};
diff --git a/arch/arm/dts/imx6dl-sielaff.dts b/arch/arm/dts/imx6dl-sielaff.dts
new file mode 100644
index 000..7de8d5f2651
--- /dev/null
+++ b/arch/arm/dts/imx6dl-sielaff.dts
@@ -0,0 +1,533 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * Copyright (C) 2022 Kontron Electronics GmbH
+ */
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include 
+#include 
+#include 
+
+/ {
+   model = "Sielaff i.MX6 Solo";
+   compatible = "sielaff,imx6dl-board", "fsl,imx6dl";
+
+   chosen {
+   stdout-path = 
+   };
+
+   backlight: pwm-backlight {
+   compatible = "pwm-backlight";
+   pinctrl-names = "default";
+   pinctrl-0 = <_backlight>;
+   pwms = < 0 5 0>;
+   brightness-levels = <0 0 64 88 112 136 184 232 255>;
+   default-brightness-level = <4>;
+   enable-gpios = < 16 GPIO_ACTIVE_HIGH>;
+   power-supply = <_backlight>;
+   };
+
+   cec {
+   compatible = "cec-gpio";
+   pinctrl-names = "default";
+   pinctrl-0 = <_hdmi_cec>;
+   cec-gpios = < 7 GPIO_ACTIVE_HIGH>;
+   hdmi-phandle = <>;
+   };
+
+   enet_ref: clock-enet-ref {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <5000>;
+   clock-output-names = "enet-ref";
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpio_keys>;
+
+   key-0 {
+