summaryrefslogtreecommitdiffstats
path: root/drivers/net/cpsw.c
Commit message (Collapse)AuthorAgeFilesLines
* net: cpsw: Make phy its own driverSascha Hauer2019-08-281-82/+96
| | | | | | | | | | | | | | | This makes of_phy_device_connect() work properly when the phy is specified in the device tree. Without it of_mdio_find_phy() will not find the right device. It will match: bus->parent->device_node == phy_node->parent Without this patch bus->parent->device_node will be the ethernet node and phy_node->parent will be the ti,cpsw-mdio node. With the MDIO device node registered as device of its own both nodes above will be the ti,cpsw-mdio node. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: adopt to upstream device tree changesSascha Hauer2019-07-101-6/+10
| | | | | | | | | | | | | | | | | Upstream device trees no longer have a "cpsw-phy-sel" property to find the phy_sel register, instead they have a child device of the pinctrl node compatible to "ti,am3352-phy-gmii-sel". Also the "rmii-clock-ext" property is no longer global to the cpsw but instead can be selected per slave. To adopt to these changes take the short way out for now and find the new node by its compatible and hardcode the "rmii-clock-ext" setting (which is set to true in am33xx-l4.dtsi and not overwritten by any board). This makes the cpsw driver work again. Tested on Beaglebone black board. Fixes: 1dc748b3b2 ("dts: update to v5.1-rc1") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: ethernet: cpsw: cpsw-phy-sel: Use phandle for phy selTeresa Remmet2019-02-131-6/+11
| | | | | | | | | | | | | | | With the usage of the interconnect target module hierarchy in device tree the cpsw-phy-sel node moved to the system control module. An phandle has been added instead to the device tree include. Try to use the cpsw-phy-sel phandle first then fall back looking for the cpsw-phy-sel child. This patch is based on the upstream kernel patch: 18eb8aea7fb2 ("net: ethernet: cpsw-phy-sel: prefer phandle for phy sel") Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2018-12-071-14/+1
|\
| * drivers: net: convert drivers to spdxOleksij Rempel2018-12-061-14/+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>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-071-1/+1
|\ \ | |/ |/|
| * net: cpsw: Make locally used function staticSascha Hauer2018-11-191-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: cpsw: support "phy-handle" and deprecate "phy_id"Sascha Hauer2018-11-191-2/+2
|/ | | | | | | | | Upstream dts files changed to the generic binding for mii phys, so we have to support it in barebox aswell. The barebox internal device trees haven't been changed, so support them until all have changed. We print a warning to add some motivation to change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-1/+1
| | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: fix probe with fixed-linkAndreas Schmidt2018-03-051-4/+6
| | | | | | | | | While cpsw is probe dt, it accepts only slaves nodes with "phy_id" property. In case of fixed-link there are no "phy_id" property and probe would be failed. This patch avoid the failure due to missing "phy_id" in case of fixed-link. Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: Call phy_device_connect() earlierSascha Hauer2018-02-221-15/+4
| | | | | | | | | We only want to register a slave when a valid phy is available. Instead of manually calling mdiobus_scan() and phy_register_device() we can let this do from phy_device_connect() which also works for fixed phys. 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: cpsw: unregister device on remove callbackSascha Hauer2015-04-281-5/+39
| | | | | | | | | | The CPSW uses DMA, so we should quiesce the device before leaving barebox. This patch unregisters the CPSW properly on the device remove callback. To do this we have to fix the error path in cpsw_slave_setup, since this function can fail and we need a known slave status in the remove function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: convert to streaming DMA opsLucas Stach2015-03-061-5/+7
| | | | | | | | | 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>
* net: cpsw: prevent stray cache writebackLucas Stach2015-03-031-0/+1
| | | | | | | | | | The cache should be invalidated when transfering ownership of a buffer to the device. Otherwise the writeback of dirty cache lines can corrupt the hardware written data. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: ignore error on slave setupSascha Hauer2015-01-061-15/+14
| | | | | | | | | | | The CPSW has two slaves. When one of them fails to setup continue anyway with the other one. This fixes a crash in the beaglebone black which only has one slave connected. The code doesn't find a phy on the second slave and bails out, but the error path is broken: It frees the private data structures which contains used resources. Reported-by: Philippe Leduc <ledphilippe@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-11-051-0/+13
|\
| * net: cpsw: Set phy device_node pointer in probeWadim Egorov2014-11-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | Set the phy device_node pointer to the equivalent cpsw slave node. We need this, because phy drivers using this pointer for their configuration. Create and register the phy device in cpsw_probe(), so that this phy device can be found later by phy_device_connect() in cpsw_open(). Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: cpsw: Fix probe for one port ethernetTeresa Gámez2014-10-141-2/+2
| | | | | | | | | | | | | | | | If only one port is pinned out, probe fails as the second port phy_id is not found. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: cpsw: Allow gigabit connectionJan Weitzel2014-10-081-2/+1
|/ | | | | Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-161-0/+3
| | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: Allow multiple slavesSascha Hauer2014-05-151-10/+6
| | | | | | | The driver is ready now for handling both slaved, so add support for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: Always write mac_control registerSascha Hauer2014-05-151-7/+0
| | | | | | | | | Instead of keeping track of the mac_control register value and only writing to it when it changed just always write it. This is more safe anyway since the mac_control register content is altered in the soft_reset functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: use slave device for dev_dbgSascha Hauer2014-05-151-15/+16
| | | | | | | | Since the cpsw has two slaves which handle one network interface each the slave number is interesting during debugging. use the slave device for dev_dbg. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: register slaves as devicesSascha Hauer2014-05-151-1/+12
| | | | | | | | This makes it possible to directly call dev_dbg and friends on the slave. Also the ethernet aliases in the devicetree now match the devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: Pass correct slaveSascha Hauer2014-05-151-2/+2
| | | | | | | Pass the current slave to cpsw_slave_init/cpsw_update_link, not the first one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* 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 cpsw: fix rx stability under heavy network loadChristoph Fritz2014-05-051-1/+6
| | | | | | | | | | | | RX DMA Head Descriptor Pointer can get 0 when there is a lot of traffic, which results in a timeout error. A good way to provoke this error is by sending lots of ARP requests. This patch makes sure that the RX DMA Head Descriptor Pointer is set. The origin driver, from which this is derived, already contains this fix. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: Fix gmii_sel configJan Weitzel2013-12-121-0/+1
| | | | | | | Prober slave_num is needed by cpsw_gmii_sel_am335x to calc reg value. Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: straighten error pathSascha Hauer2013-11-271-5/+13
| | | | | | This mainly has the effect of checking the return value of eth_register. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: attach slave to edev->privSascha Hauer2013-11-271-14/+20
| | | | | | | An ethernet device belongs to a slave, so set edev->priv to the slave and not to the cpsw. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: drop for_each_slaveSascha Hauer2013-11-271-26/+14
| | | | | | | | We currently only use one slave, so drop for_each_slave and hardcode slave[0] until we pass the proper context to the functions that makes this hack unnecessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: move eth_device into slaveSascha Hauer2013-11-271-17/+16
| | | | | | An ethernet device is per slave, not per cpsw. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cpsw: Add devicetree probe supportSascha Hauer2013-11-271-7/+159
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: cpsw: inline slave_dataSascha Hauer2013-11-221-5/+7
| | | | | | | Devicetree probed cpsw devices won't have platform_data, so inline the fields from slave_data instead of keeping a pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use new device_platform_driver() macro for driversAlexander Shiyan2013-02-131-7/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: net: add driver for TI CPSWJan Luebbe2013-01-101-0/+1070
Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>