summaryrefslogtreecommitdiffstats
path: root/drivers/net/fec_imx.c
Commit message (Collapse)AuthorAgeFilesLines
* fec_imx: Unregister MDIO when probe failsAndrey Smirnov2016-03-171-2/+4
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Deallocate DMA buffers when probe failsAndrey Smirnov2016-03-171-4/+17
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Implement reset timeoutAndrey Smirnov2016-03-171-1/+6
| | | | | | | | | | Don't wait for more than one second for IP block to finish resetting. If the block is dead it makes more sence to continue execution in hopes that the rest of the processor is fine, rather than spin indefinetly inside of the fec_probe function Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Use FEC_ECNTRL_RESET instead of a magic numberAndrey Smirnov2016-03-161-1/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Free phy_reset GPIO if when probe failsAndrey Smirnov2016-03-161-2/+5
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Deallocate I/O resources if probe failsAndrey Smirnov2016-03-161-5/+9
| | | | | | | | | | Add a proper check for I/O memory resource allocation failure and replace dev_request_mem_region with dev_request_mem_resource so it would be possible to correctly deallocate device's I/O resources when probe fails. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fec_imx: Deallocate clocks when probe failsAndrey Smirnov2016-03-161-4/+10
| | | | | 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-1/+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: fec: fix indentation and whitspacesStefan Christ2015-11-191-4/+4
| | | | | Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: implement dtb property phy-reset-durationStefan Christ2015-11-191-1/+4
| | | | | | | | Implement device tree property phy-reset-duration to adjust length of phy reset. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: set phy reset time to 1msStefan Christ2015-11-191-1/+1
| | | | | | | | According to the device tree bindings in dts/Bindings/net/fsl-fec.txt the default phy-reset time is 1ms. Signed-off-by: Stefan Christ <s.christ@phytec.de> 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>
* Merge branch 'for-next/of-device-id'Sascha Hauer2015-05-061-6/+6
|\
| * of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: fec: Fix RGMII-IDMarkus Pargmann2015-05-011-1/+4
|/ | | | | | | | | RGMII-ID just defines transmitter internal delays. Otherwise it is the same as RGMII. As the differences only influence the behaviour of the phy, the fec driver should handle it the same way as RGMII. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: convert to streaming DMA opsLucas Stach2015-03-061-4/+9
| | | | | | | | | 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-2/+2
| | | | | | | | | 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/randconfig'Sascha Hauer2014-12-081-6/+0
|\
| * net: fec_imx: remove unused includesSascha Hauer2014-11-271-6/+0
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: fec_imx: Add i.MX6sx compatible entrySascha Hauer2014-11-271-0/+3
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-of-phy'Sascha Hauer2014-06-041-0/+5
|\
| * net: fec_imx: Add devicetree support for mdio busSascha Hauer2014-05-231-0/+5
| | | | | | | | | | | | | | The fec has a mdio bus. This adds support for a subnode in which the phys on this bus can be specified. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/net'Sascha Hauer2014-06-041-1/+1
|\ \ | | | | | | | | | | | | Conflicts: drivers/net/dm9k.c
| * | net: Pass eth_device to net_receiveSascha Hauer2014-05-151-1/+1
| |/ | | | | | | | | | | | | So that barebox has the information which interface a packet came from. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: fec_imx: check return value of registration functionsSascha Hauer2014-05-211-2/+7
| | | | | | | | | | | | | | | | We do not care about releasing the resources in the error path, but at least check the return value of eth_register and mdiobus_register. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: fec_imx: mask mii register reads correctlySascha Hauer2014-05-211-1/+1
|/ | | | | | | mii registers are 16bit wide, so mask out the higher bits. The higher bits confuse mii-tool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.mx53: Parse Reset GPIO pin in FEC driver from DevicetreeRostislav Lisovy2013-11-251-0/+17
| | | | | Signed-off-by: Rostislav Lisovy <lisovy@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: Use clk API unconditionallySascha Hauer2013-06-201-22/+9
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx-oftree'Sascha Hauer2013-06-021-0/+3
|\ | | | | | | | | Conflicts: arch/arm/boards/freescale-mx51-pdk/board.c
| * net: fec: Add imx25 compatible propertySascha Hauer2013-05-211-0/+3
| | | | | | | | | | | | | | | | The i.MX53 fec claims to be compatible to i.MX25 and i.MX53. In barebox we do not have to make differences between i.MX25 and i.MX27 though, so just fall back to i.MX27. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: fec_imx: default phy address to -1 for dt probeSascha Hauer2013-05-271-0/+1
|/ | | | | | To enable automatic probing of the phy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: probe phy_mode from devicetreeSascha Hauer2013-04-041-1/+26
| | | | | | This allows to parse the phy mode from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: use standard phy type definesSascha Hauer2013-03-091-17/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: fec: drop sevenwire supportSascha Hauer2013-03-091-41/+34
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2013-03-041-8/+1
|\
| * 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>
* | Merge branch 'for-next/imx'Sascha Hauer2013-03-041-14/+25
|\ \
| * | net: fec_imx: ensure constant timeout in fec_haltHubert Feurstein2013-02-221-3/+8
| | | | | | | | | | | | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: fec_imx: use dev_err and dev_warn instead of printfHubert Feurstein2013-02-221-7/+7
| | | | | | | | | | | | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net fec_imx: add support for i.MX6 1000Mbps modeHubert Feurstein2013-02-111-4/+10
| |/ | | | | | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / net: imx_fec: fix RMII support for i.MX6Hubert Feurstein2013-02-211-1/+1
|/ | | | | Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2012-11-161-16/+56
|\ | | | | | | | | | | | | Conflicts: arch/arm/boards/guf-neso/lowlevel.c arch/arm/boards/pcm038/lowlevel.c commands/Makefile
| * ARM i.MX: get rid of imx-regs.hSascha Hauer2012-10-171-1/+0
| | | | | | | | | | | | | | | | | | - remove now unused __REG definitions - include individual SoC register files instead of imx-regs.h - move IMX_GPIO_NR to generic.h - finally remove imx-regs.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Merge branch 'for-next/clk' into for-next/imxSascha Hauer2012-10-171-3/+0
| |\ | | | | | | | | | | | | Conflicts: drivers/net/fec_imx.c
| | * ARM i.MX: Enable clocks in common placeSascha Hauer2012-10-101-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | On i.MX we enable all necessary clocks during startup of the clock controller driver, so we do not need the register hacking in the drivers anymore. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net fec_imx: determine fec version based on device idsSascha Hauer2012-10-051-12/+56
| |/ | | | | | | | | | | | | | | This adds the device id mechanism to the i.MX fec driver and uses it to determine the fec version. Also adds devicetree probing support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "net fec: connect phy at probe time"Sascha Hauer2012-11-161-30/+13
| | | | | | | | | | | | | | | | | | | | While this makes sure that the phy fixups are applied even if networking is not used on i.MX6, this patch due to latest phy changes causes the startup of barebox delayed until we have a link on the i.MX fec. Revert it for now and look for a better solution later. This reverts commit 3a17af33c01fd066ab3939c8218037c87ba26eed.
* | net fec: call fec_init at probe timeSascha Hauer2012-10-311-1/+2
| | | | | | | | | | | | | | | | | | fec_init() initializes some bits important for phy access, so do this before the mdiobus is registered. This fixes mdiobus support on i.MX28 boards in RMII mode. Reported-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net fec: connect phy at probe timeSascha Hauer2012-10-301-13/+30
|/ | | | | | | | | | | | Several i.MX boards (all i.MX6 boards) need to do some adjustments to phy registers. If barebox itself does not use network, networking won't work in the kernel if the kernel does not have the fixups. Connect the phy at probe time so that these tweaks are done during probe so that the kernel works without phy register tweaks. Also this has the effect that the phy device is present and introspectable without doing fake network transfers beforehand. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>