Commit Graph

50595 Commits

Author SHA1 Message Date
Jon Lin 6193938767 mtd: spinand: Assign initial value 0 for bad block marker
This "= { }" smart initial methord is unreliable.

Change-Id: I64860e8d056f44e99461a4fb68bc9b91c7f95732
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-05 10:18:17 +08:00
Simon Xue 327380da2b misc: rockchip_decompress: add limit decompressed buffer size
In order to prevent physical memory from being written oversize,
limit the decompressed buffer size, user can assign a size to
decompress, the reserved destination buffer size is a choice

Change-Id: I8723c5ec8d58ec1d443c5607987941cf67cf1a01
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2020-06-05 09:14:02 +08:00
Jason Zhu a6f23aea12 common: spl: define maximum decompressible size to prevent memory overrun
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Ib0be02bc85cb16ccdd832abf9a56260b2f2e500d
2020-06-05 09:14:02 +08:00
Jon Lin 6c62cd54f5 configs: rv1126: increase the space of heap for SPL SPI Nand bbt
Change-Id: If32f76b24c0deb4440ed47441f5627672c08fc27
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jon Lin fd817f1d8b mtd: nand: fix error in BBT bit operation
Change-Id: I51aab1342d8ded7ac6c19612d27abb8799b85850
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jon Lin 29f0ea3bb6 mtd: nand: spi: select MTD_NAND_BBT_USING_FLASH
Change-Id: I41a287ab79886982a5f12815afce0641fa641b45
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jon Lin 53bfae0392 mtd: nand: add BBT using flash management strategy
Change-Id: Ib71dfbcf68283d1118742ab29079cab395ff99ca
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jon Lin b8af31a74b mtd: nand: spi: enable using BBT in flash
Change-Id: I4f793a10ae3f329c6be412785a01d0f117cd9b0b
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jon Lin d55257eea0 mtd: nand: Support using BBT in flash
Change-Id: I67c8859a711156d1264f783ec2749139999228f3
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-04 09:08:45 +08:00
Jason Zhu 747423edb6 rockchip: spl: bring up to kernel when CONFIG_ROCKCHIP_BOOT_MODE_REG is 0
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I3f576fa0527a42ebede6ec252586cf681974fa97
2020-06-03 20:04:17 +08:00
Joseph Chen 371e5b63ad rv1126: common.h: set fit as 1st boot image type
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Id36149c79eb0b08fbcb92bd2d55bb808a42bf9dd
2020-06-03 14:29:02 +08:00
Joseph Chen 25047d3f40 rockchip: board: update cli message format
"Cmd interface" is easy to understand.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I0c74ad595f6c24abaf1b98bf7a09dc5060a4755d
2020-06-03 14:29:02 +08:00
Jon Lin 360a291130 mtd: mtd_blk: Logical offset should not mix with map address
1.Logical offset should not mix with map address
2.Format with nand_read_skip_bad

Change-Id: I0e5adec374ce4de437e4ce7368caec4c7c07e83b
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-03 11:14:37 +08:00
Simon Glass 301f8dd17d UPSTREAM: mtd: Rename free() to rfree()
This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Change-Id: I2718843dd4646b7450c36e84cc16e6440c718959
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit 8d38a8459b0de45f5ff41f3e11c278a5cf395fd0)
2020-06-03 10:48:53 +08:00
William Zhang b16d7c2247 UPSTREAM: drivers: nand: brcmnand: fix nand_chip ecc layout structure
The current brcmnand driver is based on 4.18 linux kernel which uses
mtd_set_ooblayout to set ecc layout. But nand base code in u-boot is from
old kernel which does not use this new API and expect nand_chip.ecc.layout
structure to be set. This cause nand_scan_tail function running into a bug
check if the device has a different oob size than the default ones.

This patch ports the brcmstb_choose_ecc_layout function from kernel 4.6.7
that supports the ecc layout struture and replaces the mtd_set_ooblayout
method

Change-Id: I31aec45275decfb03af2829c744c3dda0e261d12
Signed-off-by: William Zhang <william.zhang@broadcom.com>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
(cherry picked from commit e365de90517ba4686d7a88417b1a729f5891d376)
2020-06-03 10:48:53 +08:00
Joseph Chen 5cc4c624ec dm: uclass: move new uclass id to the end
This patch handles the issue in SPL:

	U-Boot SPL board initspl_early_init()
	   - found match at 'rv1126_syscon'
	   - found match at 'rv1126_syscon'
	   - found match at 'syscon'
	   - found match at 'rockchip_rv1126_pmucru'
	   - found match at 'rockchip_rv1126_cru'
	   - found match at 'ns16550_serial'
	   - found match at 'rockchip_rk3288_dw_mshc'
	   - found match at 'rk_nandc_v6'
	   - found match at 'rockchip_sfc'
	   - found match at 'spi_nand'
	   - found match at 'spi_flash_std'
	   - found match at 'rockchip_crypto_v2'
	   - found match at 'rockchip_secure_otp_v2'
	Cannot find uclass for id 36: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
	Missing uclass for driver rockchip_secure_otp_v2
	secure_otp@0xff5d0000: ret=-96
	dm_scan_fdt() failed: -96
	dm_extended_scan_dt() failed: -96
	dm_init_and_scan() returned error -96
	spl_early_init() failed: -96
	......

The root cause is drivers/misc/rockchip-secure-otp-v2.S is pre-compile
but not compile every time, it occupies the UCLASS_MISC id as 36.

There are the same situation for other otp drivers, so let's move it to
the end.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I58a2bec703c2af743d209192fefda6ff6167b01c
2020-06-03 10:24:44 +08:00
Joseph Chen e3d9a19ada Revert "misc: otp: re-compile the code due to the UCLASS_MISC is changed"
This reverts commit 551ae2b922.

Change-Id: Ic2723614182b8c4cf2a5433f97ce17bceac4f8dc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2020-06-03 10:24:41 +08:00
Jason Zhu 551ae2b922 misc: otp: re-compile the code due to the UCLASS_MISC is changed
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: Icec8cf342f8cb5f0cf5bdae5644c2814a76c5860
2020-06-03 10:11:36 +08:00
Jon Lin bfb4edbc07 mtd: spinand: Propagate ECC information to the MTD structure
This is done by default in the raw NAND core (nand_base.c) but was
missing in the SPI-NAND core. Without these two lines the ecc_strength
and ecc_step_size values are not exported to the user through sysfs.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

Change-Id: I37f29616e1522d9ce9e9d7ec18a473c73e1d1551
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-03 10:08:02 +08:00
Jon Lin 0ebe729199 mtd: spinand: Do not erase the block before writing a bad block marker
Currently when marking a block, we use spinand_erase_op() to erase
the block before writing the marker to the OOB area. Doing so without
waiting for the operation to finish can lead to the marking failing
silently and no bad block marker being written to the flash.

In fact we don't need to do an erase at all before writing the BBM.
The ECC is disabled for raw accesses to the OOB data and we don't
need to work around any issues with chips reporting ECC errors as it
is known to be the case for raw NAND.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: stable@vger.kernel.org
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-4-frieder.schrempf@kontron.de

Change-Id: Ieaa72162810105bf5d62caf2efc16a1c2ef89d6d
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-03 10:08:02 +08:00
Jon Lin 35a88e77a0 mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB
When writing the bad block marker to the OOB area the access mode
should be set to MTD_OPS_RAW as it is done for reading the marker.
Currently this only works because req.mode is initialized to
MTD_OPS_PLACE_OOB (0) and spinand_write_to_cache_op() checks for
req.mode != MTD_OPS_AUTO_OOB.

Fix this by explicitly setting req.mode to MTD_OPS_RAW.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-3-frieder.schrempf@kontron.de

Change-Id: Id415efc0cd8d61d97d98e0340729f8bc60fc28cf
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-03 10:08:02 +08:00
Jon Lin d537a52df3 mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers
For reading and writing the bad block markers, spinand->oobbuf is
currently used as a buffer for the marker bytes. During the
underlying read and write operations to actually get/set the content
of the OOB area, the content of spinand->oobbuf is reused and changed
by accessing it through spinand->oobbuf and/or spinand->databuf.

This is a flaw in the original design of the SPI NAND core and at the
latest from 13c15e07eedf ("mtd: spinand: Handle the case where
PROGRAM LOAD does not reset the cache") on, it results in not having
the bad block marker written at all, as the spinand->oobbuf is
cleared to 0xff after setting the marker bytes to zero.

To fix it, we now just store the two bytes for the marker on the
stack and let the read/write operations copy it from/to the page
buffer later.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: stable@vger.kernel.org
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-2-frieder.schrempf@kontron.de

Change-Id: I5a47981f004c60d753da382ef6d683a7da1e436b
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-06-03 10:08:02 +08:00
Robert Marko e0242caf53 UPSTREAM: mtd: spi-nand: Import Toshiba SPI-NAND support
Linux has good support for Toshiba SPI-NAND, so lets import it.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Tested-by: Luka Kovacic <luka.kovacic@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
Change-Id: I70a328bf28c7e8740d818958faf749016dd9ca77
(cherry picked from commit 89127104848cea38bac5d40e3d6973fc203e2df6)
2020-06-03 10:08:02 +08:00
Finley Xiao d0999afb2e clk: rockchip: rk3308: add support to set and get sfc clock
Change-Id: I322471da6e50b0bad328dde015d0d7d0466cc3a9
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2020-06-03 09:57:07 +08:00
Finley Xiao d47b686da8 clk: rockchip: rv1126: Add support to get dpll rate
Change-Id: Icd7c40235d4627befc216812bfdcb288790e63e3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2020-06-03 09:56:37 +08:00
David Wu 664ab5ca74 configs: rv1126: Enable GMAC
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I9cce5c1f8e5488365c6e1c14d27e528fa0e952e8
2020-06-02 17:50:16 +08:00
David Wu 225d510420 configs: rv1126_common: reserve 1M nocache memory
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ibc82c3dd0a19c2ae5a7997fda077f8cfea830abf
2020-06-02 17:50:16 +08:00
David Wu 63a2faadfe net: dwc_eth_qos: Fix compile error for gpio
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ife092cc2aca2c359fc465058e44ca645afbc8114
2020-06-02 17:49:16 +08:00
David Wu dcfb333ad8 net: gmac_rockchip: Add RV1126 gmac support
This Soc is different from the previous Socs, need to
define eqos_config, and follow the dwc_eth_qos driver
process.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I4a1c1605dd46ed31fb7ca15c7c26572739f636ec
2020-06-02 16:10:47 +08:00
David Wu 65dd574d8d net: dwc_eth_qos: Add EQOS_MAC_MDIO_ADDRESS_CR_100_150 for Rockchip
The Rockchip CSR clock range is from 100M to 150M, add
EQOS_MAC_MDIO_ADDRESS_CR_100_150.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ib60f306cb9e8abec9557e92a6d04d76a7071b9ea
2020-06-02 16:10:47 +08:00
David Wu fc99c7ab03 net: dwc_eth_qos: Add eqos_rockchip_ops
The eqos_rockchip_ops is simillar to eqos_stm32_ops, and
export the eqos_rockchip_ops to use.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I214b0b2fbe04a139de911435c4abf224264f5495
2020-06-02 16:10:47 +08:00
David Wu 6f0a52e952 net: gmac_rockchip: Add dwc_eth_qos support
Change the original data structure so that Rockchip's Soc
gmac controller can support the designware.c and dwc_eth_qos.c
drivers, a Soc can only support one.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I313674274fc2eddb7717ba76c537cd668d6a492b
2020-06-02 16:10:47 +08:00
David Wu a494aeaa44 net: dwc_eth_qos: Fix the reset for RGMII
When using rgmii Gigabit mode, the wait_for_bit_le32()
reset method resulting in RX can not receive data, after
this patch, works well.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Id1d2405397d0c2f59b7bf1e341cdf66b023e4226
2020-06-02 16:10:47 +08:00
David Wu 23ca6f743c net: dwc_eth_qos: Export common struct and interface at head file
Open structure data and interface, so that Soc using dw_eth_qos
controller can reference.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ic845d330465c1bb8f7868fb188e5bf30c865b9b5
2020-06-02 16:10:47 +08:00
David Wu e2d5843168 net: dwc_eth_qos: make eqos_start_clks and eqos_stop_clks optional
If there are definitions for eqos_start_clks and eqos_stop_clks,
then call these callback function.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Id5ffc944a2c066d78a784aeb28ecb846b53e52fd
2020-06-02 16:10:47 +08:00
David Wu 5bcea7aac5 net: dwc_eth_qos: Split eqos_start() to get link speed
For Rockchip, need to obtain the current link speed to
configure the tx clocks, (for example, in rgmii mode,
1000M link: 125M, 100M link: 25M, 10M link is 2.5M rate)
and then enable gmac. So after the adjust_link(), before
the start gamc, this intermediate stage needs to configure
the clock according to the current link speed.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I9a46da28abca0544cb0a56b0a0574e2fd1de0c52
2020-06-02 16:10:47 +08:00
David Wu b29cefabfd net: dwc_eth_qos: Make clk_rx and clk_tx optional
For others using, clk_rx and clk_tx may not be necessary,
and their clock names are different.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I952ac6cc6a4278c887b530bd6d387752358c89a8
2020-06-02 16:10:47 +08:00
David Wu bbbbc81c01 net: dwc_eth_qos: Move interface() to eqos_ops structure
After moving to eqos_ops, if eqos_config is defined
outside file, can not export interface() definition,
only export eqos_ops struct defined in dwc_eth_qos.c.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ibc60f49f36bb2011454370ed7fcc6d9db3b34d9f
2020-06-02 16:10:47 +08:00
David Wu 13105a0ba7 net: dwc_eth_qos: Add option "snps,reset-gpio" phy-rst gpio for stm32
It can be seen that most of the Socs using STM mac, "snps,reset-gpio"
gpio is used, adding this option makes reset function more general.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I428c7158c113143a7e51296705fabde6f05eb0f6
2020-06-02 16:10:47 +08:00
David Wu dcf8de121a net: dwc_eth_qos: Use dev_ functions calls to get FDT data
It seems dev_ functions are more general than fdt_ functions.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ia1d19c61fb8a2c8540b3dfda53b6aeb3b72acb7f
2020-06-02 16:10:47 +08:00
Ye Li 4d0fb6f008 UPSTREAM: eQos: Implement the read_rom_hwaddr callback
Implement the read_rom_hwaddr callback to load MAC address from fuse
for imx8m platforms.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I4204948ae6a0408f7d642007d27923a3c6941562
2020-06-02 16:10:47 +08:00
Fugang Duan ad018a0c24 UPSTREAM: net: eqos: implement callbaks to get interface and set txclk rate
Implement the callbacks to get phy mode interface and txclk
rate configuration.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I0a5265347936c1bc821c175eea1698d2624d4873
2020-06-02 16:10:47 +08:00
Fugang Duan a7b3400fe0 UPSTREAM: net: dwc_eth_qos: add dwc eqos for imx support
Add dwc eqos for imx support.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I49127be057a49e6b45e37f940d523d808c20343b
2020-06-02 16:10:47 +08:00
Ye Li 8e3eceb053 UPSTREAM: net: Update eQos driver and FEC driver to use eth phy interfaces
Update eQoS and fec ethernet drivers to support shared MDIO framework

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Iaf5f3ca585190c6469b68195aaea2499242a0096
2020-06-02 16:10:47 +08:00
Ye Li 70664e19a3 UPSTREAM: net: Add eth phy generic driver for shared MDIO
For dual ethernet controllers, the HW design may connect ETH phys to
one MDIO ports. So two different ethernet drivers have to share MDIO bus.
Since two ethernet drivers are independent, we can't ensure their probe
order.

To resolve this problem, introduce an eth phy generic driver and uclass.

After eth-uclass binds, we search the mdio node and binds the phy node
with the eth-phy-generic driver.

When one eth driver get its phy device, the parent of phy device will
probe prior than phy device. So this ensure the eth driver ownes the
MDIO bus will be probed before using its MDIO.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ice83493e9e1caf3842f9ce0c129e29ad46cc0532
2020-06-02 16:10:47 +08:00
Alex Marginean 8a2d844d7d UPSTREAM: net: introduce MDIO DM class for MDIO devices
Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as
stand-alone devices.  Useful in particular for systems that support
DM_ETH and have a stand-alone MDIO hardware block shared by multiple
Ethernet interfaces.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I8e106f4360aa46289e0ed551f8f685cad9dc6269
2020-06-02 16:10:47 +08:00
Joe Hershberger 01b8c4d110 UPSTREAM: net: Make core net code depend on NET instead of CMD_NET
No commands are necessary to have a network stack.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Duncan Hare <dh@synoia.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I84cbc5d7fc65f2f4b9b85285226727d3f43363ab
2020-06-02 16:10:47 +08:00
Marek Vasut 0731427808 UPSTREAM: net: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor
The DMA may attempt to write a DMA descriptor in the ring while it is
being updated. By writing the DMA descriptor buffer address to 0, it
is assured the DMA will not use such a buffer and the buffer can be
updated without any interference.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: If70a57f195c146d571de20385b55ff75f7dea7db
2020-06-02 16:10:47 +08:00
Marek Vasut 076e66fb70 UPSTREAM: net: dwc_eth_qos: Invalidate RX packet DMA buffer
This patch prevents an issue where the RX packet might have been
accessed by the CPU, which now has cached data from the packet in
the caches and possibly various write buffers, and these data may
be evicted from the caches into the DRAM while the buffer is also
written by the DMA.

By invalidating the buffer after the CPU accessed it and before the
DMA populates the buffer, it is assured that the buffer will not be
corrupted.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I6271396aad6abac3fb11e5e742a3b2c9e7cc355b
2020-06-02 16:10:47 +08:00
Marek Vasut 865fce80b7 UPSTREAM: net: dwc_eth_qos: Invalidate RX descriptor before reading
The current code polls the RX desciptor ring for new packets by reading
the RX descriptor status. This works by accident, as the RX descriptors
are often in non-cacheable memory. However, the driver does support use
of RX descriptors in cacheable memory.

This patch adds a missing RX descriptor invalidation, which assures the
CPU will read a fresh copy of the RX descriptor instead of a cached one.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ia05e8a43d707088bc3699b7d00434c8d12d2692f
2020-06-02 16:10:47 +08:00