Re: [PATCH] net: phy: dp83867: reset PHY on probe
On Tue, May 07, 2024 at 03:39:52PM +0200, Roland Hieber wrote: > Some PHY variants set the DP83867_PHYCR_FORCE_LINK_GOOD bit by default, > which should be unset if we want to rely on autonegotiation. Port > dp83867_phy_reset() from Linux v6.9-rc7, which already does all > necessary things, and call it in dp83867_probe(). (Keep the functions in > the original order so that the diff stays clean.) > > Suggested-by: Oleksij Rempel > Signed-off-by: Roland Hieber Reviewed-by: Oleksij Rempel > --- > drivers/net/phy/dp83867.c | 18 ++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c > index 5dc5bac12536..aefc65148926 100644 > --- a/drivers/net/phy/dp83867.c > +++ b/drivers/net/phy/dp83867.c > @@ -362,6 +362,8 @@ static int dp83867_of_init(struct phy_device *phydev) > return 0; > } > > +static int dp83867_phy_reset(struct phy_device *phydev); /* see below */ > + > static int dp83867_probe(struct phy_device *phydev) > { > struct dp83867_private *dp83867; > @@ -370,6 +372,8 @@ static int dp83867_probe(struct phy_device *phydev) > > phydev->priv = dp83867; > > + dp83867_phy_reset(phydev); > + > return dp83867_of_init(phydev); > } > > @@ -563,6 +567,20 @@ static int dp83867_config_init(struct phy_device *phydev) > return 0; > } > > +static int dp83867_phy_reset(struct phy_device *phydev) > +{ > + int err; > + > + err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART); > + if (err < 0) > + return err; > + > + udelay(20); > + > + return phy_modify(phydev, MII_DP83867_PHYCTRL, > + DP83867_PHYCR_FORCE_LINK_GOOD, 0); > +} > + > static struct phy_driver dp83867_driver[] = { > { > .phy_id = DP83867_PHY_ID, > -- > 2.39.2 > > -- 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- |
[PATCH] net: phy: dp83867: reset PHY on probe
Some PHY variants set the DP83867_PHYCR_FORCE_LINK_GOOD bit by default, which should be unset if we want to rely on autonegotiation. Port dp83867_phy_reset() from Linux v6.9-rc7, which already does all necessary things, and call it in dp83867_probe(). (Keep the functions in the original order so that the diff stays clean.) Suggested-by: Oleksij Rempel Signed-off-by: Roland Hieber --- drivers/net/phy/dp83867.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index 5dc5bac12536..aefc65148926 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -362,6 +362,8 @@ static int dp83867_of_init(struct phy_device *phydev) return 0; } +static int dp83867_phy_reset(struct phy_device *phydev); /* see below */ + static int dp83867_probe(struct phy_device *phydev) { struct dp83867_private *dp83867; @@ -370,6 +372,8 @@ static int dp83867_probe(struct phy_device *phydev) phydev->priv = dp83867; + dp83867_phy_reset(phydev); + return dp83867_of_init(phydev); } @@ -563,6 +567,20 @@ static int dp83867_config_init(struct phy_device *phydev) return 0; } +static int dp83867_phy_reset(struct phy_device *phydev) +{ + int err; + + err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART); + if (err < 0) + return err; + + udelay(20); + + return phy_modify(phydev, MII_DP83867_PHYCTRL, +DP83867_PHYCR_FORCE_LINK_GOOD, 0); +} + static struct phy_driver dp83867_driver[] = { { .phy_id = DP83867_PHY_ID, -- 2.39.2
[PATCH] mtd: nand: raw: add back support for marking blocks as good
Support for marking blocks as good was lost during the last NAND layer update. Add that back. Signed-off-by: Sascha Hauer --- drivers/mtd/nand/raw/nand_base.c | 64 1 file changed, 64 insertions(+) diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 119e640eaf..c7cde7643f 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -493,6 +493,49 @@ static int nand_block_markbad_lowlevel(struct nand_chip *chip, loff_t ofs) return ret; } +/** + * nand_block_markgood_lowlevel - mark a block good + * @mtd: MTD device structure + * @ofs: offset from device start + * + * We try operations in the following order: + * (1) erase the affected block + * (2) check bad block marker + * (3) update the BBT + */ +static int nand_block_markgood_lowlevel(struct nand_chip *chip, loff_t ofs) +{ + struct mtd_info *mtd = nand_to_mtd(chip); + bool allow_erasebad; + int ret; + + if (!(chip->bbt_options & NAND_BBT_NO_OOB_BBM)) { + struct erase_info einfo; + + /* Attempt erase possibly bad block */ + allow_erasebad = mtd->allow_erasebad; + mtd->allow_erasebad = true; + memset(&einfo, 0, sizeof(einfo)); + einfo.mtd = mtd; + einfo.addr = ofs; + einfo.len = 1 << chip->phys_erase_shift; + nand_erase_nand(chip, &einfo, 0); + mtd->allow_erasebad = allow_erasebad; + } + + /* Mark block good in BBT */ + if (chip->bbt) { + ret = nand_markgood_bbt(chip, ofs); + if (ret) + return ret; + } + + if (mtd->ecc_stats.badblocks > 0) + mtd->ecc_stats.badblocks--; + + return 0; +} + /** * nand_block_isreserved - [GENERIC] Check if a block is marked reserved. * @mtd: MTD device structure @@ -4621,6 +4664,26 @@ static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs) return nand_block_markbad_lowlevel(mtd_to_nand(mtd), ofs); } +/** + * nand_block_markbad - [MTD Interface] Mark block at the given offset as bad + * @mtd: MTD device structure + * @ofs: offset relative to mtd start + */ +static int nand_block_markgood(struct mtd_info *mtd, loff_t ofs) +{ + int ret; + + ret = nand_block_isbad(mtd, ofs); + if (ret < 0) + return ret; + + if (!ret) + /* If it was good already, return success and do nothing */ + return 0; + + return nand_block_markgood_lowlevel(mtd_to_nand(mtd), ofs); +} + /** * nand_lock - [MTD Interface] Lock the NAND flash * @mtd: MTD device structure @@ -6213,6 +6276,7 @@ int nand_scan_tail(struct nand_chip *chip) mtd->_block_isbad = nand_block_isbad; mtd->_block_markbad = nand_block_markbad; mtd->_max_bad_blocks = nanddev_mtd_max_bad_blocks; + mtd->_block_markgood = nand_block_markgood; /* * Initialize bitflip_threshold to its default prior scan_bbt() call. -- 2.39.2
Re: [PATCH 0/3] add PBL handoff-data support
On Tue, 30 Apr 2024 12:53:07 +0200, Sascha Hauer wrote: > We need to pass data from the PBL to barebox proper. Right now we do > this with passing the data in registers which is quite limited. As the > amount of information that has to be passed increases it's time to > overcome this limitation. > > This series introduces handoff-data which is a linked list of memory > blobs that can be passed from PBL to barebox proper. Board and SoC > code can append this list with their own entries and pick them up later > in barebox proper. The ARM architecture is converted over to use handoff > data, other architectures could follow. > > [...] Applied, thanks! [1/3] ARM: move blob_is_arm_boarddata() to include https://git.pengutronix.de/cgit/barebox/commit/?id=c78e0862d540 (link may not be stable) [2/3] add handoff-data support https://git.pengutronix.de/cgit/barebox/commit/?id=6b17d1443632 (link may not be stable) [3/3] ARM: pass handoff data from PBL to proper https://git.pengutronix.de/cgit/barebox/commit/?id=637231379c32 (link may not be stable) Best regards, -- Sascha Hauer
Re: [PATCH master 1/3] pstore: ramoops: fix use of wrong types on 64-bit
On Mon, 06 May 2024 18:02:44 +0200, Ahmad Fatoum wrote: > The kernel struct persistent_ram_buffer uses atomic_t for start and size > members in the persistent_ram_buffer chunk, which are 32-bit always, > unlike resource_size_t that we used in barebox, which is 64-bit when > CONFIG_PHYS_ADDR_T_64BIT=y. > > To fix this, we could use either int32_t or atomic_t. To make > synchronization with Linux easier, let's use atomic_t. > > [...] Applied, thanks! [1/3] pstore: ramoops: fix use of wrong types on 64-bit https://git.pengutronix.de/cgit/barebox/commit/?id=914622436219 (link may not be stable) [2/3] pstore: fix size of OF fixup memory region https://git.pengutronix.de/cgit/barebox/commit/?id=0efa116b9f48 (link may not be stable) [3/3] pstore: return -ENOENT when file is missing https://git.pengutronix.de/cgit/barebox/commit/?id=e70a514bce4b (link may not be stable) Best regards, -- Sascha Hauer
Re: [PATCH] mtd: nand: mxc_nand: clear NAND_BBT_CREATE flag
On Fri, 03 May 2024 12:15:09 +0200, Sascha Hauer wrote: > On i.MX NAND the factory bad block markers are not at the place the NAND > core expects them to be, so the core also can't properly generate a bad > block table. Clear the NAND_BBT_CREATE flag to prevent the core from > doing so. This preserves the behaviour we had previously with the > barebox driver which was lost when we replaced it with the Kernel > driver. > > [...] Applied, thanks! [1/1] mtd: nand: mxc_nand: clear NAND_BBT_CREATE flag https://git.pengutronix.de/cgit/barebox/commit/?id=f4cc035245c6 (link may not be stable) Best regards, -- Sascha Hauer
Re: [PATCH v2 0/4] mtd: nand: mxc_nand: Only automatically create BBT if NAND seems to be pristine
On Mon, 06 May 2024 16:46:07 +0200, Uwe Kleine-König wrote: > this is v2 of this series. The changes are: > > - More cleanups > - Keep checkbad() function (Sascha) > - Check each block if it contains a barebox image or a UBI > > (implicit) v1 available at > https://lore.barebox.org/barebox/20240430094451.1038256-4-u.kleine-koe...@pengutronix.de/T/#t > > [...] Applied, thanks! [1/4] mtd: nand: mxc_nand: Improve comment about vendor BBM and address verschwurbelung https://git.pengutronix.de/cgit/barebox/commit/?id=4bad7cc26bbd (link may not be stable) [2/4] mtd: nand: mxc_nand: Cleanup code creating bad block table https://git.pengutronix.de/cgit/barebox/commit/?id=23686460eb8b (link may not be stable) [3/4] mtd: nand: mxc_nand: Add error message if BBT creation fails https://git.pengutronix.de/cgit/barebox/commit/?id=8695b02ffa13 (link may not be stable) [4/4] mtd: nand: mxc_nand: Only automatically create BBT if NAND seems to be pristine https://git.pengutronix.de/cgit/barebox/commit/?id=30130286232a (link may not be stable) Best regards, -- Sascha Hauer