summaryrefslogtreecommitdiffstats
path: root/drivers/net/macb.c
Commit message (Collapse)AuthorAgeFilesLines
* net: macb: extend support to Microchip SAMA5D2Ahmad Fatoum2019-08-161-0/+1
| | | | | | | | Tested on Microchip SAMA5D27 SOM1 EK1 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: init multiple dummy TX queuesOleksij Rempel2019-08-161-6/+26
| | | | | | | | | Microchip SAMA5D27 has more then one TX queue. So it will go in to TX timeout if only one was initialized. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: dma_sync_* receive buffersLadislav Michl2019-06-041-7/+20
| | | | | | | | | Receive buffers are properly synchronized only if Cadence is GEM. Fix it for MACB as well. Fixes: 86dc5259e25d (net: macb: no need for coherent memory for receive buffer) Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ultrascale'Sascha Hauer2019-01-151-0/+1
|\
| * zynqmp: enable macb Ethernet supportThomas Hämmerle2019-01-091-0/+1
| | | | | | | | | | Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | macb: disable second priority queue for zynqmp gem supportThomas Hämmerle2019-01-091-0/+21
| | | | | | | | | | | | | | | | | | Provide descriptors for second priority rx and tx queues and disable the the queues if hardware is GEM. Otherwise the function macb_send() will run into a timeout. Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | macb: fix memory leakage due to double allocation of rx_bufferThomas Hämmerle2019-01-091-2/+0
| | | | | | | | | | | | | | | | | | Remove memory allocation of rx buffer in function macb_init_rx_buffer_size, which caused a memory leak since it also is alocated in macb_probe(). Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | macb: fix check if hw is gemThomas Hämmerle2019-01-091-1/+1
| | | | | | | | | | | | | | | | Fix check for peripheral version in MACB_MID register to treat Xilinx ZynqMP as GEM. All MIDs >= 2 indicate a GEM not only MID == 2. Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | macb: fix format specifiers for debug outputThomas Hämmerle2019-01-091-1/+1
|/ | | | | | | | Fixes compiler warning "format '%d' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Wformat=]". Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: net: convert drivers to spdxOleksij Rempel2018-12-061-11/+1
| | | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: Add compatible for atmel,sama5d3-gemSascha Hauer2018-11-021-0/+1
| | | | | | | The macb driver works with the gigabit MAC found on Atmel sama5d3 SoCs. Add a compatible for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: add remove callbackSascha Hauer2018-11-021-0/+8
| | | | | | | The macb driver does DMA and thus should be quiesced on shutdown. Add the remove callback. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: simplify private data allocationSascha Hauer2018-11-021-3/+4
| | | | | | | | Instead of allocating struct macb_device and a struct eth_device separately just use the eth_device structure that is already embedded in struct macb_device but currently unused. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: remove unused variableSascha Hauer2018-11-021-2/+1
| | | | | | tx_tail is unused. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: no need for coherent memory for receive bufferSascha Hauer2018-11-021-2/+1
| | | | | | | The receive buffers are properly synchronized with dma_sync_*, no need to use coherent memory for them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: fix clock probing with DTSam Ravnborg2017-07-201-2/+2
| | | | | | | | | | | | | | | With DT enabled the following was logged: macb fffbc000.ethernet: no macb_clk macb fffbc000.ethernet: probe failed: Invalid argument The clock probed was with the name used in a non-DT setup. Fix so we use a proper name ("pclk") with DT, and keep current fuctionality without DT. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* net: macb: Add DT supportAndrey Smirnov2017-03-301-14/+42
| | | | | | Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-071-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Make set_ethaddr argument constSascha Hauer2015-06-261-1/+1
| | | | | | | The set_ethaddr callback should not modify the MAC address passed to it, so make it const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: convert to streaming DMA opsLucas Stach2015-03-061-2/+6
| | | | | | | | | Move to the common streaming DMA ops in order to get rid of the direct usage of the ARM MMU functions for the cache maintenance. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: move DMA alloc functions to dma.hLucas Stach2015-03-061-0/+1
| | | | | | | | | | This better separates the DMA from the MMU functionality. Also move all drivers that only depends on asm/mmu.h for the alloc functions over to the common header. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: change dma_alloc/free_coherent to match other architecturesLucas Stach2015-03-061-4/+6
| | | | | | | | | As a lot drivers currently rely on the 1:1 virt->phys mapping on ARM we define DMA_ADDRESS_BROKEN to mark them. In order to use them on other architectures with a different mapping they need proper fixing. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-err-ptr'Sascha Hauer2014-10-021-0/+2
|\
| * resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-161-0/+2
| | | | | | | | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: macb: enable GEM with only FE featureBo Shen2014-09-241-2/+4
|/ | | | | | | | | | | | If the GEM is used, however only FE featuren enabled, then it can not support FBLDO configured as 16, and no RGMII/GMII configuratin bit. So, in order to support GEM only with FE feature enabled, we do: - using default value for FBLDO. - using same bit for RMII/MII configuration as GEM for RGMII/GMII. Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: Pass eth_device to net_receiveSascha Hauer2014-05-151-2/+2
| | | | | | | So that barebox has the information which interface a packet came from. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: add support to read the mac address from registerJean-Christophe PLAGNIOL-VILLARD2013-10-061-0/+22
| | | | | | | check the 4 mac address register and return at the first valid Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: turn off endian_swp_pkt_enSteffen Trumtrar2013-04-031-0/+1
| | | | | | | | | | The core has a bit for swapping packet data endianism. Reset default from Cadence is off. Xilinx however, that uses this core on the Zynq SoCs, opted for on. Turn it off for all devices. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: rename platform dataJosh Cartwright2013-04-031-2/+2
| | | | | | | | | | The macb/gem core is used by the Zynq SoC. In preparation of sharing the macb driver between at91 and Zynq, rename the platform data to 'struct macb_platform_data', and move the definition to a common location. Signed-off-by: Josh Cartwright <joshc@eso.teric.us> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: fix gem_recv circular buffer handlingJean-Christophe PLAGNIOL-VILLARD2013-03-151-16/+16
| | | | | | | | | | | as we use a full buffer no need to check the SOF and reset the rx_tail fix at the same time the gem detection so we can have the rx_buffer allocated correctly according to the IP Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use new device_platform_driver() macro for driversAlexander Shiyan2013-02-131-8/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: add cadence Gigabit GEM supportJean-Christophe PLAGNIOL-VILLARD2013-02-111-41/+209
| | | | | | | | | | | | based on the kernel code detect it via IP version In the GEM we can use a full packet buffer for receive but the buffer size need to be 64bit size aligned. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: fix tx ring sizeJean-Christophe PLAGNIOL-VILLARD2013-02-111-15/+33
| | | | | | | | | the mininal tx ring size is 2 as if one we wrap on the same descriptor and can cause IP lock on GEM (gigabit version) this is always the case Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net macb: reset the IP at initJean-Christophe PLAGNIOL-VILLARD2013-02-111-0/+23
| | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net macb: enable Tramsmit and Receive at openJean-Christophe PLAGNIOL-VILLARD2013-02-111-2/+3
| | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net macb: use the macro as in linux for tx/rx buffer ring sizeJean-Christophe PLAGNIOL-VILLARD2013-02-111-16/+17
| | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net macb: sync remaining define with linuxJean-Christophe PLAGNIOL-VILLARD2013-02-111-49/+22
| | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net macb: call macb_init at probe explicitlyJean-Christophe PLAGNIOL-VILLARD2013-02-111-5/+3
| | | | | | | | | as eth_device init is planning for remove and we need the init before register the mdio bus Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: drop non used defineJean-Christophe PLAGNIOL-VILLARD2013-02-081-4/+0
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: report timeout on sendJean-Christophe PLAGNIOL-VILLARD2013-02-081-3/+5
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: use dev_xx messageJean-Christophe PLAGNIOL-VILLARD2013-02-081-14/+18
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: allow to pass the phy interfaceJean-Christophe PLAGNIOL-VILLARD2013-01-291-3/+3
| | | | | | | as we will add later the GMAC IP verion support (GEM) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: sync register access and clock with the kernelJean-Christophe PLAGNIOL-VILLARD2013-01-291-36/+27
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb/ether: split flags for drivers and phylibJean-Christophe PLAGNIOL-VILLARD2012-11-191-3/+2
| | | | | | | | | as in the kernel use is_rmii flags for pinctrl phy_flags for phylib flags Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* switch all platform_bus device/driver registering to ↵Jean-Christophe PLAGNIOL-VILLARD2012-10-041-1/+1
| | | | | | | | platform_driver/device_register now register_driver and register_device are for bus only usage. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Merge branch 'for-next/remove-fsf-address'Sascha Hauer2012-10-031-3/+0
|\ | | | | | | | | | | Conflicts: drivers/net/miidev.c include/miidev.h
| * Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-3/+0
| | | | | | | | | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: introduce phylibJean-Christophe PLAGNIOL-VILLARD2012-09-251-33/+46
|/ | | | | | | | | | | | | | | | Adapt phylib from linux switch all the driver to it reimplement mii bus This will allow to have - phy drivers - to only connect the phy at then opening of the device - if the phy is not ready or not up fail on open Same behaviour as in linux and will allow to share code and simplify porting. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* macb: fix mmu supportJean-Christophe PLAGNIOL-VILLARD2012-03-061-3/+5
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* macb: add timeout on sendJean-Christophe PLAGNIOL-VILLARD2012-03-061-0/+5
| | | | | | | This will ensure that we send an other packet only when the first one is send. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>