Re: [PATCH v2] driver: mtd: spi-nor: Add Micron MT25QU256A 1V8 SPI flash

2022-03-01 Thread Ahmad Fatoum
On 01.03.22 14:22, Joacim Zetterling wrote:
> Add the Micron MT25QU256A 1V8 SPI flash to the mtd/spi-nor driver.
> The flash has the same name as the 3V variant but as an other
> manufacturer ID (20 bb 19 instead of 20 ba 19).
> 
> This SPI/QSPI flash is used on i.e. NXP IMX8MN-EVK board.
> 
> Signed-off-by: Joacim Zetterling 

Reviewed-by: Ahmad Fatoum 

> ---
> 
> Changes v2:
>   - Renamed the device name n25q256a to mt25qu256a
>   
>  drivers/mtd/spi-nor/spi-nor.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index b3af3c4263b9..cf532b13999b 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -727,6 +727,7 @@ static const struct spi_device_id spi_nor_ids[] = {
>   { "n25q128a11",  INFO(0x20bb18, 0, 64 * 1024,  256, SPI_NOR_QUAD_READ) 
> },
>   { "n25q128a13",  INFO(0x20ba18, 0, 64 * 1024,  256, SPI_NOR_QUAD_READ) 
> },
>   { "n25q256a",INFO(0x20ba19, 0, 64 * 1024,  512, SECT_4K | 
> SPI_NOR_QUAD_READ) },
> + { "mt25qu256a",  INFO(0x20bb19, 0, 64 * 1024,  512, SECT_4K | 
> SPI_NOR_QUAD_READ) },
>   { "n25q512a",INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | 
> SPI_NOR_QUAD_READ) },
>   { "n25q512ax3",  INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | 
> SPI_NOR_QUAD_READ) },
>   { "n25q00",  INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
> SPI_NOR_QUAD_READ) },


-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] driver: mtd: spi-nor: Add Micron MT25QU256A 1V8 SPI flash

2022-03-01 Thread Joacim Zetterling
Add the Micron MT25QU256A 1V8 SPI flash to the mtd/spi-nor driver.
The flash has the same name as the 3V variant but as an other
manufacturer ID (20 bb 19 instead of 20 ba 19).

This SPI/QSPI flash is used on i.e. NXP IMX8MN-EVK board.

Signed-off-by: Joacim Zetterling 
---

Changes v2:
  - Renamed the device name n25q256a to mt25qu256a
  
 drivers/mtd/spi-nor/spi-nor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index b3af3c4263b9..cf532b13999b 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -727,6 +727,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "n25q128a11",  INFO(0x20bb18, 0, 64 * 1024,  256, SPI_NOR_QUAD_READ) 
},
{ "n25q128a13",  INFO(0x20ba18, 0, 64 * 1024,  256, SPI_NOR_QUAD_READ) 
},
{ "n25q256a",INFO(0x20ba19, 0, 64 * 1024,  512, SECT_4K | 
SPI_NOR_QUAD_READ) },
+   { "mt25qu256a",  INFO(0x20bb19, 0, 64 * 1024,  512, SECT_4K | 
SPI_NOR_QUAD_READ) },
{ "n25q512a",INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ) },
{ "n25q512ax3",  INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ) },
{ "n25q00",  INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | 
SPI_NOR_QUAD_READ) },
-- 
2.25.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] ARM: arch: dts: qspi: Add QSPI config to the NXP IMX8MN-EVK board

2022-03-01 Thread Joacim Zetterling
Add QSPI support in the default config and DTS files for the
NXP IMX8MN-EVK board. To be able to use it You also need the
QSPI driver enabled.

Tested on the NXP IMX8MN-EVK board as well as on an IMX8MN
custom bord supporting a QSPI flash. Tested with the memory
dump command i.e. 'md -s /dev/m25p0'.

Signed-off-by: Joacim Zetterling 
---

Changes v2:
  - Removed the "default" pinctrl names from iomuxc
  - Renamed the flexspi device name

 arch/arm/configs/imx_v8_defconfig |  1 +
 arch/arm/dts/imx8mn-evk.dts   | 30 ++
 2 files changed, 31 insertions(+)

diff --git a/arch/arm/configs/imx_v8_defconfig 
b/arch/arm/configs/imx_v8_defconfig
index b28c868a99bf..fe6398cc873d 100644
--- a/arch/arm/configs/imx_v8_defconfig
+++ b/arch/arm/configs/imx_v8_defconfig
@@ -99,6 +99,7 @@ CONFIG_NET_USB=y
 CONFIG_NET_USB_ASIX=y
 CONFIG_NET_USB_SMSC95XX=y
 CONFIG_DRIVER_SPI_IMX=y
+CONFIG_SPI_NXP_FLEXSPI=y
 CONFIG_I2C=y
 CONFIG_I2C_IMX=y
 CONFIG_MTD=y
diff --git a/arch/arm/dts/imx8mn-evk.dts b/arch/arm/dts/imx8mn-evk.dts
index 9fe24b3184f1..b8e7e1acf539 100644
--- a/arch/arm/dts/imx8mn-evk.dts
+++ b/arch/arm/dts/imx8mn-evk.dts
@@ -60,3 +60,33 @@
  {
barebox,provide-mac-address = < 0x640>;
 };
+
+ {
+   pinctrl_flexspi0: flexspi0grp {
+   fsl,pins = <
+   MX8MN_IOMUXC_NAND_ALE_QSPI_A_SCLK   0x1c4
+   MX8MN_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B0x84
+   MX8MN_IOMUXC_NAND_DATA00_QSPI_A_DATA0   0x84
+   MX8MN_IOMUXC_NAND_DATA01_QSPI_A_DATA1   0x84
+   MX8MN_IOMUXC_NAND_DATA02_QSPI_A_DATA2   0x84
+   MX8MN_IOMUXC_NAND_DATA03_QSPI_A_DATA3   0x84
+   >;
+   };
+};
+
+ {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_flexspi0>;
+
+   system_flash: flash@0 {
+   reg = <0>;
+   compatible = "jedec,spi-nor";
+   spi-max-frequency = <8000>;
+   spi-tx-bus-width = <4>;
+   spi-rx-bus-width = <4>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   };
+};
+
-- 
2.25.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] ARM: imx: spi: Add NXP IMX8 Flex SPI/QSPI support

2022-03-01 Thread Joacim Zetterling
This driver is ported from the linux kernel and adapted to barebox
for the NXP IMX8 platforms.

This commit add support for the NXP IMX8 Flex SPI controller in master
mode. Up to four slave devices can be connected on two buses with two
chip selects each. This controller does not support generic SPI messages
and only supports the high-level SPI memory interface.

Tested on the NXP IMX8MN-EVK evaluation board as well as on a
IMX8MN custom board supporting a Micron N25Q00 QSPI flash.

Signed-off-by: Joacim Zetterling 
---

Changes v2:
  - Removed the /dts/Bindings/spi/spi-nxp-fspi.yaml part
  - Changed /drivers/spi/Kconfig SPI_NXP_FLEXSPI config
HAS_IOMEM doesn't exist in barebox. Replaced it with 
COMPILE_TEST instead.

 drivers/spi/Kconfig|   10 +
 drivers/spi/Makefile   |1 +
 drivers/spi/spi-nxp-fspi.c | 1061 
 3 files changed, 1072 insertions(+)
 create mode 100644 drivers/spi/spi-nxp-fspi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b0137d21e073..7df7561718c2 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -114,6 +114,16 @@ config DRIVER_SPI_STM32
  Enable the STM32 Serial Peripheral Interface (SPI) driver for STM32MP
  SoCs.
 
+config SPI_NXP_FLEXSPI
+   tristate "NXP Flex SPI controller"
+   depends on ARCH_IMX8M || COMPILE_TEST
+   help
+ This enables support for the Flex SPI controller in master mode.
+ Up to four slave devices can be connected on two buses with two
+ chipselects each.
+ This controller does not support generic SPI messages and only
+ supports the high-level SPI memory interface.
+
 endif
 
 endmenu
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 39be9d41e450..64c8e2645a94 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -15,4 +15,5 @@ obj-$(CONFIG_SPI_ATMEL_QUADSPI) += atmel-quadspi.o
 obj-$(CONFIG_DRIVER_SPI_OMAP3) += omap3_spi.o
 obj-$(CONFIG_DRIVER_SPI_DSPI) += dspi_spi.o
 obj-$(CONFIG_SPI_ZYNQ_QSPI) += zynq_qspi.o
+obj-$(CONFIG_SPI_NXP_FLEXSPI) += spi-nxp-fspi.o
 obj-$(CONFIG_DRIVER_SPI_STM32) += stm32_spi.o
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
new file mode 100644
index ..673b91d6dc75
--- /dev/null
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -0,0 +1,1061 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * NXP FlexSPI(FSPI) controller driver.
+ *
+ * Copyright 2019-2020 NXP
+ * Copyright 2020 Puresoftware Ltd.
+ * Copyright 2021 Westermo Network Technologies AB
+ *
+ * FlexSPI is a flexsible SPI host controller which supports two SPI
+ * channels and up to 4 external devices. Each channel supports
+ * Single/Dual/Quad/Octal mode data transfer (1/2/4/8 bidirectional
+ * data lines).
+ *
+ * FlexSPI controller is driven by the LUT(Look-up Table) registers
+ * LUT registers are a look-up-table for sequences of instructions.
+ * A valid sequence consists of four LUT registers.
+ * Maximum 32 LUT sequences can be programmed simultaneously.
+ *
+ * LUTs are being created at run-time based on the commands passed
+ * from the spi-mem framework, thus using single LUT index.
+ *
+ * Software triggered Flash read/write access by IP Bus.
+ *
+ * Memory mapped read access by AHB Bus.
+ *
+ * Based on SPI MEM interface and spi-fsl-qspi.c driver.
+ *
+ * Author:
+ * Yogesh Narayan Gaur 
+ * Boris Brezillon 
+ * Frieder Schrempf 
+ * Joacim Zetterling 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * The driver only uses one single LUT entry, that is updated on
+ * each call of exec_op(). Index 0 is preset at boot with a basic
+ * read operation, so let's use the last entry (31).
+ */
+#defineSEQID_LUT   31
+
+/* Registers used by the driver */
+#define FSPI_MCR0  0x00
+#define FSPI_MCR0_AHB_TIMEOUT(x)   ((x) << 24)
+#define FSPI_MCR0_IP_TIMEOUT(x)((x) << 16)
+#define FSPI_MCR0_LEARN_EN BIT(15)
+#define FSPI_MCR0_SCRFRUN_EN   BIT(14)
+#define FSPI_MCR0_OCTCOMB_EN   BIT(13)
+#define FSPI_MCR0_DOZE_EN  BIT(12)
+#define FSPI_MCR0_HSEN BIT(11)
+#define FSPI_MCR0_SERCLKDIVBIT(8)
+#define FSPI_MCR0_ATDF_EN  BIT(7)
+#define FSPI_MCR0_ARDF_EN  BIT(6)
+#define FSPI_MCR0_RXCLKSRC(x)  ((x) << 4)
+#define FSPI_MCR0_END_CFG(x)   ((x) << 2)
+#define FSPI_MCR0_MDIS BIT(1)
+#define FSPI_MCR0_SWRSTBIT(0)
+
+#define FSPI_MCR1  0x04
+#define FSPI_MCR1_SEQ_TIMEOUT(x)   ((x) << 16)
+#define FSPI_MCR1_AHB_TIMEOUT(x)   (x)
+
+#define FSPI_MCR2  0x08
+#define FSPI_MCR2_IDLE_WAIT(x) ((x) << 24)
+#define FSPI_MCR2_SAMEDEVICEEN BIT(15)

[PATCH] bootm: add missing space in error message

2022-03-01 Thread Ahmad Fatoum
There is no space between the "at" and the hex base address currently.
Fix the formatting.

Signed-off-by: Ahmad Fatoum 
---
 common/bootm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 89e3e93f2ce0..a8b560c046c3 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -113,7 +113,7 @@ int bootm_load_os(struct image_data *data, unsigned long 
load_address)
load_address, kernel_size);
if (!data->os_res) {
pr_err("unable to request SDRAM region for kernel at"
-   "0x%08llx-0x%08llx\n",
+   " 0x%08llx-0x%08llx\n",
(unsigned long long)load_address,
(unsigned long long)load_address + kernel_size 
- 1);
return -ENOMEM;
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] Re-enable warning for non-existent symbols.

2022-03-01 Thread Sascha Hauer
Hi,

On Wed, Feb 23, 2022 at 08:30:25PM +0100, Christian Melki wrote:
> From the kernel:
> Commit f072181e6403b0fe2e2aa800a005497b748fd284 ("kconfig: drop the
> ""trying to assign nonexistent symbol" warning").
> 
> Rationale behind re-enabling this is that as an embedded developer,
> I often find myself doing oldconfigs during upgrades. Symbols
> do change names and are sometimes lost silently, with the occasional
> headache. My need for these warnings are probably different than
> the need of the typical kernel developer.
> 
> (Un)fortunatly, a lot of projects directly inherit the kernel kconfig/lxdialog
> variant without much thought into their own symbols and practices.
> The kernel itself has some 1k+ non-existent symbols in various
> defconfigs as developers are not nagged about their cleanliness.
> 
> This warning could do well in various projects. Barebox, ptxdist,
> U-boot, busybox etc.

I am still unsure about this one. First of all Masahiro frequently
syncs the kconfig files with recent Linux, so I don't know how long
this change will last. Then from time to time we regenerate defconfigs
which means the warnings will just vanish without further notice.

Maybe you just have to do a

make x_defconfig; make savedefconfig; mv defconfig arch/y/configs/x_defconfig; 
git diff

from time to time.

Sascha

> 
> Signed-off-by: Christian Melki 
> ---
>  scripts/kconfig/confdata.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index cf72680cd..d189e088d 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -439,6 +439,7 @@ load:
>   if (def == S_DEF_USER) {
>   sym = sym_find(line + 2 + strlen(CONFIG_));
>   if (!sym) {
> + conf_warning("trying to assign 
> nonexistent symbol %s", line + 2 + strlen(CONFIG_));
>   conf_set_changed(true);
>   continue;
>   }
> @@ -481,8 +482,10 @@ load:
>* include/config/FOO must be touched.
>*/
>   conf_touch_dep(line + strlen(CONFIG_));
> - else
> + else {
>   conf_set_changed(true);
> + conf_warning("trying to assign 
> nonexistent symbol %s", line + strlen(CONFIG_));
> + }
>   continue;
>   }
>  
> -- 
> 2.30.2
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] usb: host: ehci: reorder code in ehci_probe()

2022-03-01 Thread Denis Orlov
Currently, after successful memory region requests the driver
initialization could still fail, leaving those regions allocated. By
reordering the code those requests can be placed later, after the
possibly failing calls.

Signed-off-by: Denis Orlov 
---
 drivers/usb/host/ehci-hcd.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index facfb3a95b..068504557b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1421,20 +1421,6 @@ static int ehci_probe(struct device_d *dev)
 */
data.flags = EHCI_HAS_TT;
 
-   iores = dev_request_mem_resource(dev, 0);
-   if (IS_ERR(iores))
-   return PTR_ERR(iores);
-   data.hccr = IOMEM(iores->start);
-
-   if (dev->num_resources > 1) {
-   iores = dev_request_mem_resource(dev, 1);
-   if (IS_ERR(iores))
-   return PTR_ERR(iores);
-   data.hcor = IOMEM(iores->start);
-   }
-   else
-   data.hcor = NULL;
-
usb2_generic_phy = phy_optional_get(dev, "usb");
if (IS_ERR(usb2_generic_phy))
return PTR_ERR(usb2_generic_phy);
@@ -1456,6 +1442,20 @@ static int ehci_probe(struct device_d *dev)
if (ret)
return ret;
 
+   iores = dev_request_mem_resource(dev, 0);
+   if (IS_ERR(iores))
+   return PTR_ERR(iores);
+   data.hccr = IOMEM(iores->start);
+
+   if (dev->num_resources > 1) {
+   iores = dev_request_mem_resource(dev, 1);
+   if (IS_ERR(iores))
+   return PTR_ERR(iores);
+   data.hcor = IOMEM(iores->start);
+   }
+   else
+   data.hcor = NULL;
+
ehci = ehci_register(dev, );
if (IS_ERR(ehci))
return PTR_ERR(ehci);
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig

2022-03-01 Thread Denis Orlov
With GENERIC_PHY disabled, EHCI driver initialization fails in
ehci_probe() as calling phy_optional_get() returns "Function not
implemented" value. So it seems reasonable to make USB_EHCI explicitly
depend on GENERIC_PHY.

Signed-off-by: Denis Orlov 
---
 drivers/usb/host/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d38b4dcac4..cc71b76902 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -2,6 +2,7 @@
 config USB_EHCI
bool "EHCI driver"
depends on HAS_DMA
+   depends on GENERIC_PHY
 
 config USB_EHCI_OMAP
depends on ARCH_OMAP3
-- 
2.20.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] regulator: fix memory leak

2022-03-01 Thread Andrej Picej

On 1. 03. 22 09:47, Sascha Hauer wrote:

On Tue, Mar 01, 2022 at 09:21:34AM +0100, Andrej Picej wrote:

Gentle ping. The patch was probably missed as is was send as an reply to
Trent's memory leak find.

On 19. 11. 21 14:06, Andrej Picej wrote:

Fix memory leak of propname.

Signed-off-by: Andrej Picej 
---
   drivers/regulator/core.c | 6 --
   1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 097f7d779..c5cb9ee34 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -231,8 +231,10 @@ static struct regulator_internal *of_regulator_get(struct 
device_d *dev, const c
}
ret = of_device_ensure_probed(node);
-   if (ret)
-   return ERR_PTR(ret);
+   if (ret) {
+   ri = ERR_PTR(ret);
+   goto out;
+   }


This conflicts with b720625659 ("regulator: allow use of dummy regulator").
I fixed this up, see the result in next.


Ohh, ok. That was fast.

Thanks.
Andrej

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] ARM: stm32mp: ddrctl: add STM32MP131 RAM size querying support

2022-03-01 Thread Sascha Hauer
On Wed, Feb 23, 2022 at 12:38:47PM +0100, Ahmad Fatoum wrote:
> buswidth is read from HW. With nb_bytes == 2, there is a possibility
> that we get a zero size out here, if driver and device are
> mismatched, e.g. because barebox is booted in FIP with mismatched
> external device tree.
> 
> As this runs very early before relocation, round up instead of crashing
> to be a bit more on the safe side.
> 
> Signed-off-by: Ahmad Fatoum 
> ---
>  arch/arm/mach-stm32mp/ddrctrl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-stm32mp/ddrctrl.c b/arch/arm/mach-stm32mp/ddrctrl.c
> index 7f0944d7e77c..ed211cf58ebc 100644
> --- a/arch/arm/mach-stm32mp/ddrctrl.c
> +++ b/arch/arm/mach-stm32mp/ddrctrl.c
> @@ -101,7 +101,8 @@ static unsigned long ddrctrl_addrmap_ramsize(struct 
> stm32mp1_ddrctl __iomem *d,
>   if (LINE_UNUSED(reg, ADDRMAP6_ROW_B13)) rows--;
>   if (LINE_UNUSED(reg, ADDRMAP6_ROW_B12)) rows--;
>  
> - return memory_sdram_size(cols, rows, BIT(banks), nb_bytes / 
> BIT(buswidth));
> + return memory_sdram_size(cols, rows, BIT(banks),
> +  DIV_ROUND_UP(nb_bytes, BIT(buswidth)));
>  }
>  
>  static inline unsigned ddrctrl_ramsize(void __iomem *base, unsigned nb_bytes)
> -- 
> 2.30.2
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH master] regulator: fix enabling of always-on regulators

2022-03-01 Thread Sascha Hauer
On Mon, Feb 28, 2022 at 03:56:12PM +0100, Ahmad Fatoum wrote:
> We need to enable on either case, not if both are given.
> 
> Fixes: 9f542bd73948 ("regulator: respect "regulator-always-on" property")
> Signed-off-by: Ahmad Fatoum 
> ---
>  drivers/regulator/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 997b986d5f07..ecee4203187c 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -130,7 +130,7 @@ static struct regulator_internal * 
> __regulator_register(struct regulator_dev *rd
>   if (name)
>   ri->name = xstrdup(name);
>  
> - if (rd->boot_on && rd->always_on) {
> + if (rd->boot_on || rd->always_on) {
>   ret = regulator_enable_internal(ri);
>   if (ret && ret != -ENOSYS)
>   goto err;
> -- 
> 2.30.2
> 
> 
> ___
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] regulator: fix memory leak

2022-03-01 Thread Sascha Hauer
On Tue, Mar 01, 2022 at 09:21:34AM +0100, Andrej Picej wrote:
> Gentle ping. The patch was probably missed as is was send as an reply to
> Trent's memory leak find.
> 
> On 19. 11. 21 14:06, Andrej Picej wrote:
> > Fix memory leak of propname.
> > 
> > Signed-off-by: Andrej Picej 
> > ---
> >   drivers/regulator/core.c | 6 --
> >   1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> > index 097f7d779..c5cb9ee34 100644
> > --- a/drivers/regulator/core.c
> > +++ b/drivers/regulator/core.c
> > @@ -231,8 +231,10 @@ static struct regulator_internal 
> > *of_regulator_get(struct device_d *dev, const c
> > }
> > ret = of_device_ensure_probed(node);
> > -   if (ret)
> > -   return ERR_PTR(ret);
> > +   if (ret) {
> > +   ri = ERR_PTR(ret);
> > +   goto out;
> > +   }

This conflicts with b720625659 ("regulator: allow use of dummy regulator").
I fixed this up, see the result in next.

Sascha

-- 
Pengutronix e.K.   | |
Steuerwalder Str. 21   | http://www.pengutronix.de/  |
31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] regulator: fix memory leak #2

2022-03-01 Thread Sascha Hauer
Fix memory leak of propname.

Signed-off-by: Sascha Hauer 
---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d3c43ce9a3..827ccee9d5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -197,14 +197,14 @@ static struct regulator_internal *of_regulator_get(struct 
device_d *dev, const c
struct device_node *node, *node_parent;
int ret;
 
-   propname = basprintf("%s-supply", supply);
-
/*
 * If the device does have a device node return the dummy regulator.
 */
if (!dev->device_node)
return NULL;
 
+   propname = basprintf("%s-supply", supply);
+
/*
 * If the device node does not contain a supply property, this device 
doesn't
 * need a regulator. Return the dummy regulator in this case.
-- 
2.30.2


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] regulator: fix memory leak

2022-03-01 Thread Andrej Picej
Gentle ping. The patch was probably missed as is was send as an reply to 
Trent's memory leak find.


On 19. 11. 21 14:06, Andrej Picej wrote:

Fix memory leak of propname.

Signed-off-by: Andrej Picej 
---
  drivers/regulator/core.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 097f7d779..c5cb9ee34 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -231,8 +231,10 @@ static struct regulator_internal *of_regulator_get(struct 
device_d *dev, const c
}
  
  	ret = of_device_ensure_probed(node);

-   if (ret)
-   return ERR_PTR(ret);
+   if (ret) {
+   ri = ERR_PTR(ret);
+   goto out;
+   }
  
  	list_for_each_entry(ri, _list, list) {

if (ri->node == node) {


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox