From 5ae585ba3a8bb2336d5cb6e1ef4c80a5ef445409 Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Wed, 2 Jan 2019 20:36:52 -0600 Subject: MTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LogicPD board uses a Micron Flash with ECC. To boot this from SPL, the ECC needs to be correctly configured or the BCH engine times out. Signed-off-by: Adam Ford Acked-by: Stefan Agner Tested-by: Jörg Krause Acked-by: Tim Harvey Tested-by: Tim Harvey --- drivers/mtd/nand/raw/mxs_nand.c | 6 ++++++ drivers/mtd/nand/raw/mxs_nand_spl.c | 1 + 2 files changed, 7 insertions(+) (limited to 'drivers') diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index e3341812a20..2d84bfffe2e 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand) nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE; nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE; + + if (is_mx6sx() || is_mx7()) + nand_info->max_ecc_strength_supported = 62; + else + nand_info->max_ecc_strength_supported = 40; + err = mxs_nand_alloc_buffers(nand_info); if (err) return err; diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index c628f3adec0..ba85baac603 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -201,6 +201,7 @@ static int mxs_nand_init(void) /* setup flash layout (does not scan as we override that) */ mtd->size = nand_chip.chipsize; nand_chip.scan_bbt(mtd); + mxs_nand_setup_ecc(mtd); return 0; } -- cgit v1.3.1 From 5645df9e00a01407730dc11d3a2bc4969203dc8c Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Sat, 12 Jan 2019 06:25:48 -0600 Subject: MTD: NAND: mxs_nand_init_dma: Make mxs_nand_init_dma static mxs_nand_init_dma is only referenced from mxs_nand.c. It's not referenced in any headers or outside code, so this patch defines it as static. Signed-off-by: Adam Ford --- drivers/mtd/nand/raw/mxs_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index 2d84bfffe2e..eff852328e6 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -1092,7 +1092,7 @@ int mxs_nand_alloc_buffers(struct mxs_nand_info *nand_info) /* * Initializes the NFC hardware. */ -int mxs_nand_init_dma(struct mxs_nand_info *info) +static int mxs_nand_init_dma(struct mxs_nand_info *info) { int i = 0, j, ret = 0; -- cgit v1.3.1 From 8f1a5ac797baac5b40f93eac80a7810f0a771ecf Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Tue, 15 Jan 2019 11:26:48 -0600 Subject: net: dm: fec: Fix regulator enable when using DM_REGULATOR When DM_REGULATOR is enabled, the driver attempts to call regulator_autoset() which expects the regulators to be on at boot and/or always on and fails if they are not true. For a more generic approach, this patch just calls regulator_set_enable() which shouldn't have such restrictions. Fixes: ad8c43cbcafb ("net: dm: fec: Support the phy-supply binding") Signed-off-by: Adam Ford Tested-by: Martin Fuzzey Acked-by: Joe Hershberger --- drivers/net/fec_mxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 1a59026a62f..a14fe43a5b0 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -1348,7 +1348,7 @@ static int fecmxc_probe(struct udevice *dev) #ifdef CONFIG_DM_REGULATOR if (priv->phy_supply) { - ret = regulator_autoset(priv->phy_supply); + ret = regulator_set_enable(priv->phy_supply, true); if (ret) { printf("%s: Error enabling phy supply\n", dev->name); return ret; -- cgit v1.3.1 From 04568bd0b6d673a325eed76bd857a9cbd0c556bc Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Thu, 17 Jan 2019 07:16:39 -0600 Subject: MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initialization of the NAND in SPL hard-coded ecc.bytes, ecc.size, and ecc.strength which may work for some NAND parts, but it not appropriate for others. With the pending patch "mxs_nand: Fix BCH read timeout error on boards requiring ECC" the driver can auto configure the ECC when these entries are blank. This patch has been tested in NAND flash with oob 64 and oob 128. Signed-off-by: Adam Ford Tested-by: Jörg Krause Acked-by: Tim Harvey Tested-by: Tim Harvey --- drivers/mtd/nand/raw/mxs_nand.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index eff852328e6..be4ee2c7f8a 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -1191,9 +1191,6 @@ int mxs_nand_init_spl(struct nand_chip *nand) nand->ecc.read_page = mxs_nand_ecc_read_page; nand->ecc.mode = NAND_ECC_HW; - nand->ecc.bytes = 9; - nand->ecc.size = 512; - nand->ecc.strength = 8; return 0; } -- cgit v1.3.1 From 69280961d72754f27b5196d392bd41b7f8fa2a42 Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Mon, 4 Feb 2019 12:56:52 -0800 Subject: net: mv88e61xx: fix autonegotiation on ports phy_reset should be called before autoneg is setup The only boards using MV88E61XX_SWITCH are: - alliedtelesis/SBx81LIFKW - alliedtelesis/SBx81LIFXCAT - gateworks/gw_ventana Cc: Chris Packham Signed-off-by: Tim Harvey Reviewed-by: Chris Packham --- drivers/net/phy/mv88e61xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c index ea54a153105..c1e28603291 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -945,14 +945,14 @@ static int mv88e61xx_phy_config(struct phy_device *phydev) continue; } - res = genphy_config_aneg(phydev); + res = phy_reset(phydev); if (res < 0) { - printf("Error setting PHY %i autoneg\n", i); + printf("Error resetting PHY %i\n", i); continue; } - res = phy_reset(phydev); + res = genphy_config_aneg(phydev); if (res < 0) { - printf("Error resetting PHY %i\n", i); + printf("Error setting PHY %i autoneg\n", i); continue; } -- cgit v1.3.1 From 921208ebca6f109990359b3089b5f416b269b07b Mon Sep 17 00:00:00 2001 From: Abel Vesa Date: Fri, 1 Feb 2019 16:40:08 +0000 Subject: usb: ehci-mx6: Make regulator DM_REGULATOR dependent Do the regulator related work only if the build has the DM_REGULATOR. Signed-off-by: Abel Vesa Reviewed-by: Peng Fan Reviewed-by: Fabio Estevam Reviewed-by: Lukasz Majewski --- drivers/usb/host/ehci-mx6.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index 1acf08dfb7e..948394709f7 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -404,6 +404,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) if (ret) return ret; +#if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) { ret = regulator_set_enable(priv->vbus_supply, (type == USB_INIT_DEVICE) ? @@ -413,6 +414,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) return ret; } } +#endif if (type == USB_INIT_DEVICE) return 0; @@ -514,15 +516,17 @@ static int ehci_usb_probe(struct udevice *dev) priv->portnr = dev->seq; priv->init_type = type; +#if CONFIG_IS_ENABLED(DM_REGULATOR) ret = device_get_supply_regulator(dev, "vbus-supply", &priv->vbus_supply); if (ret) debug("%s: No vbus supply\n", dev->name); - +#endif ret = ehci_mx6_common_init(ehci, priv->portnr); if (ret) return ret; +#if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) { ret = regulator_set_enable(priv->vbus_supply, (type == USB_INIT_DEVICE) ? @@ -532,6 +536,7 @@ static int ehci_usb_probe(struct udevice *dev) return ret; } } +#endif if (priv->init_type == USB_INIT_HOST) { setbits_le32(&ehci->usbmode, CM_HOST); -- cgit v1.3.1 From d76706c89adea229d2207b0280d1f3fb559671e4 Mon Sep 17 00:00:00 2001 From: Abel Vesa Date: Fri, 1 Feb 2019 16:40:11 +0000 Subject: mmc: fsl_esdhc: Fix DM_REGULATOR ifdefs for SPL builds Since the fsl_esdhc will also be used by SPL, make the preprocessor switches more generic to allow any kind of build. Signed-off-by: Abel Vesa Reviewed-by: Fabio Estevam Reviewed-by: Lukasz Majewski --- drivers/mmc/fsl_esdhc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 21fa2ab1d46..9e34557d165 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -804,7 +804,7 @@ static int esdhc_set_voltage(struct mmc *mmc) case MMC_SIGNAL_VOLTAGE_330: if (priv->vs18_enable) return -EIO; -#ifdef CONFIG_DM_REGULATOR +#if CONFIG_IS_ENABLED(DM_REGULATOR) if (!IS_ERR_OR_NULL(priv->vqmmc_dev)) { ret = regulator_set_value(priv->vqmmc_dev, 3300000); if (ret) { @@ -823,7 +823,7 @@ static int esdhc_set_voltage(struct mmc *mmc) return -EAGAIN; case MMC_SIGNAL_VOLTAGE_180: -#ifdef CONFIG_DM_REGULATOR +#if CONFIG_IS_ENABLED(DM_REGULATOR) if (!IS_ERR_OR_NULL(priv->vqmmc_dev)) { ret = regulator_set_value(priv->vqmmc_dev, 1800000); if (ret) { @@ -1442,7 +1442,7 @@ static int fsl_esdhc_probe(struct udevice *dev) int node = dev_of_offset(dev); struct esdhc_soc_data *data = (struct esdhc_soc_data *)dev_get_driver_data(dev); -#ifdef CONFIG_DM_REGULATOR +#if CONFIG_IS_ENABLED(DM_REGULATOR) struct udevice *vqmmc_dev; #endif fdt_addr_t addr; @@ -1500,7 +1500,7 @@ static int fsl_esdhc_probe(struct udevice *dev) priv->vs18_enable = 0; -#ifdef CONFIG_DM_REGULATOR +#if CONFIG_IS_ENABLED(DM_REGULATOR) /* * If emmc I/O has a fixed voltage at 1.8V, this must be provided, * otherwise, emmc will work abnormally. -- cgit v1.3.1 From a24532083c78fd599807e0af58410a5b406330b5 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Fri, 1 Feb 2019 16:04:50 +0100 Subject: imx: serial_mxc: disable ri and dcd irq in dte mode If the UART is used in DTE mode the RI and DCD bits in UCR3 become irq enable bits. Both are set to enabled after reset and both likely are pending. Disable the bits to prevent an interrupt storm when Linux enables the UART interrupts. Signed-off-by: Max Krummenacher Signed-off-by: Marcel Ziswiler --- drivers/serial/serial_mxc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 7e4e6d36b86..df35ac9114e 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -138,13 +138,18 @@ struct mxc_uart { u32 ts; }; -static void _mxc_serial_init(struct mxc_uart *base) +static void _mxc_serial_init(struct mxc_uart *base, int use_dte) { writel(0, &base->cr1); writel(0, &base->cr2); while (!(readl(&base->cr2) & UCR2_SRST)); + if (use_dte) + writel(0x404 | UCR3_ADNIMP, &base->cr3); + else + writel(0x704 | UCR3_ADNIMP, &base->cr3); + writel(0x704 | UCR3_ADNIMP, &base->cr3); writel(0x8000, &base->cr4); writel(0x2b, &base->esc); @@ -226,7 +231,7 @@ static int mxc_serial_tstc(void) */ static int mxc_serial_init(void) { - _mxc_serial_init(mxc_base); + _mxc_serial_init(mxc_base, false); serial_setbrg(); @@ -271,7 +276,7 @@ static int mxc_serial_probe(struct udevice *dev) { struct mxc_serial_platdata *plat = dev->platdata; - _mxc_serial_init(plat->reg); + _mxc_serial_init(plat->reg, plat->use_dte); return 0; } @@ -367,7 +372,7 @@ static inline void _debug_uart_init(void) { struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE; - _mxc_serial_init(base); + _mxc_serial_init(base, false); _mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE, false); } -- cgit v1.3.1