Commit Graph

60 Commits (1634461bd208f4bd108ea5c3d3f1cf9eb56d4a7e)

Author SHA1 Message Date
Koen Vandeputte ada7322055 cns3xxx: use proper macros for defining partition regions
While at it, also reorder the items for
improved readability.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Mathias Kresin 22ae14d0e7 cns3xxx: fix mtu setting with kernel 4.14
Since kernel 4.10 commit 61e84623ace3 ("net: centralize net_device
min/max MTU checking"), the range of mtu is [min_mtu, max_mtu], which
is [68, 1500] by default.

It's necessary to set a max_mtu if a mtu > 1500 is supported.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte 0d283c0180 cns3xxx: ethernet: use circular queue checks consistently
Use the same method for setting queue index pointers consistenly
throughout the source file.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 06beefd6d5 cns3xxx: ethernet: cleanup code
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 23cdbf2644 cns3xxx: ethernet: fix signed/unsigned comparison
Fixes a compiler warning

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 5adf16b492 cns3xxx: remove linux 4.9 support
- Remove kernel 4.9 support
- Apply specific 4.14 changes directly to source
- Refreshed all

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Tim Harvey 79366b8194 cns3xxx: fix GPIO controller interrupt enable
The cns3xxx interrupt controller uses a single register and as such
the 'mask' reg/functions must be used as opposed to the 'enable'/'disable'
reg/functions.

This fixes an issue that occurs if more than one GPIO on a specific controller
(there is GPIOA and GPIOB each having 32 GPIO's) uses interrupts. When one
would get enabled all others would be disabled prior to this patch.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 years ago
Felix Fietkau e9f76f0f46 cns3xxx: clean up patches
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Koen Vandeputte 597ea08038 cns3xxx: use proper macro's for ID handling
Compiled & tested on cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 years ago
Koen Vandeputte 347884b345 cns3xxx: fix UART resource overlap
Port 1 registers the same IO resources as port 2 in the kernel resource
tree, which is wrong.
Fix this by using it's own resources as indicated in the overview
(cns3xxx.h).

Compiled & Tested on several GW2388-4 laguna boards which utilizes all 3
ports.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
8 years ago
Felix Fietkau 0b3a64f862 cns3xxx: eliminate hardcoded kernel/rootfs partition split
This changes the sysupgrade format. To support upgrades from the old
firmware to the new one, legacy images are provided. Because of the old
partition split, these have to be specific to the NOR or SPI device.

The new sysupgrade images are suitable for begin put on flash directly,
and they are independent of NOR vs SPI flash variant.

Flashing back to old firmware is supported via using the old full-flash
images instead of the old sysupgrade images.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 58fbe07560 cns3xxx: move laguna.c changes out of patches, update it in files/
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Tim Harvey 1974ad5a96 cns3xxx: add GW2386 support
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
8 years ago
Tim Harvey 1419087a35 cns3xxx: add GW2394 Support
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
8 years ago
Koen Vandeputte f532191c1c cns3xxx: fix RX softIRQ loop
Already reschedule when 1 or more frames came in.

Checking for a full queue could produce a re-schedule loop as
the checked RX ring location could contain undefined values
depending on activity in previous loops.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
8 years ago
Felix Fietkau 9ab08d665f cns3xxx: improve ethernet performance by using the page fragment allocation API
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48580
8 years ago
Felix Fietkau 3d4444f257 cns3xxx: fix ethernet DMA ring allocation issues
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48579
8 years ago
Felix Fietkau 87e4f9f009 cns3xxx: update to linux 4.4
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48334
8 years ago
Felix Fietkau 91278df70e cns3xxx: fix a ethernet driver napi poll handling bug
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48333
8 years ago
Felix Fietkau 136747c564 cns3xxx: clean up SMP related code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48332
8 years ago
Felix Fietkau f366dc25d3 cns3xxx: remove obsolete file
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48330
8 years ago
Felix Fietkau 2ac8b1c1fe cns3xxx: remove unused define and use of a deprecated function
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48329
8 years ago
John Crispin f0b708acdf cns3xxx: add GW2393 Support
Based off of the GW2391-C, but with the following changes:
 * 4x4in to 4x5in pcb
 * flat panel connector for LED signals

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>

SVN-Revision: 47920
9 years ago
John Crispin c6d95f0752 cns3xxx: Fix comment
Original comment was wrong about which pads are being set.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>

SVN-Revision: 47919
9 years ago
Felix Fietkau d0e4f71b9a cns3xxx: add missing dma mask for ethernet device
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43399
10 years ago
Felix Fietkau ebf6331c10 cns3xxx: switch to using the upstream dwc2 driver instead of dwc_otg
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43398
10 years ago
Felix Fietkau 211669da3b cns3xxx: update to linux 3.14
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43397
10 years ago
Felix Fietkau 8c136e6b56 cns3xxx: set base device for ethernet port netdevs
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43395
10 years ago
Felix Fietkau 365cf9d10c cns3xxx: fix passing the device to dma mapping ops
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 43394
10 years ago
Felix Fietkau fa5237d936 cns3xxx: Adopt irq_domain support for cns3xxx gpio driver
Have gpio driver adopt irqdomain support so that there are
non-overlapping allocations of irq numbers mapped to gpio's.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>

SVN-Revision: 42844
10 years ago
Felix Fietkau 0563e0225e cns3xxx: fix register for enabling MMC/SD pins
also fixes a GPIO related regression from the upgrade to 3.10

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42829
10 years ago
Felix Fietkau 3c7cd63b72 cns3xxx: update to linux 3.10
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 41917
10 years ago
Felix Fietkau 2603c9045d cns3xxx: ethernet - revert: clean up tx descs only when needed
This reverts commit 0772ab938c0aedd7f4cc7127059d6ce8cf929dfa.

Trying to optimize calls to eth_complete_tx in this fasion causes a regression
where when sending only the tx queue can get disabled until a packet is
received. This original call to eth_schedule_poll() is scheduled so it
should not cause a performance issue.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

SVN-Revision: 40592
10 years ago
Imre Kaloz 8411a5703f Add GW2385 support
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>

SVN-Revision: 39894
10 years ago
Imre Kaloz 68022cac64 various dwc (OTG) driver fixups
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>

SVN-Revision: 39892
10 years ago
Felix Fietkau 8665c57923 cns3xxx: ethernet - clean up tx descs only when needed
We already clean up tx descriptors in the napi eth_poll() function so it
would likely be rare to run out of available descriptors in eth_xmit. Thus
we can clean them up only when needed and return busy only when we
still don't have enough.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

SVN-Revision: 39762
10 years ago
Felix Fietkau 96eb3d883d cns3xxx: ethernet - resolve SMP issue
The combination of r35942 and r35952 causes an issue where eth_schedule_poll()
can be called from a different CPU between the call to napi_complete() and the
setting of cur_index which can break the rx ring accounting and cause ethernet
latency and/or ethernet stalls.  The issue can be easilly created by adding
a couple of artificial delays such as:

@@ -715,6 +715,7 @@ static int eth_poll(struct napi_struct *napi, int budget)

 	if (!received) {
 		napi_complete(napi);
+udelay(1000);
 		enable_irq(IRQ_CNS3XXX_SW_R0RXC);
 	}

@@ -727,6 +728,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
 	rx_ring->cur_index = i;

 	wmb();
+udelay(1000);
 	enable_rx_dma(sw);

 	return received;

This patch moves the setting of cur_index back up where it needs to be and
addresses the original corner case that r35942 was trying to catch in an
improved fashion by checking to see if the rx descriptor ring has become
full before interrupts were re-enabled so that a poll can be scheduled again
and avoid an rx stall caused by rx interrupts ceasing to fire again.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

SVN-Revision: 39761
10 years ago
Imre Kaloz b0fe7d1ec6 add pushbutton GPIO for GW2380/82/83
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

SVN-Revision: 38702
11 years ago
Felix Fietkau 6436b3f736 cns3xxx: fix USB ehci/ohci platform driver
Update ehci/ohci driver registration to conform to the new platform
drivers.

This fixes missing USB host support in 3.8.x

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

SVN-Revision: 36309
11 years ago
Felix Fietkau fde143b66f cns3xxx: remove the watchdog IRQ from the resources, it breaks the driver init and is useful only for testing
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 36241
11 years ago
Felix Fietkau bd6c9d6252 cns3xxx: ethernet - clean the tx ring before refilling the rx ring to reduce memory pressure
SVN-Revision: 35953
11 years ago
Felix Fietkau d7a529709a cns3xxx: ethernet - clean the tx ring only in the poll function, not in the xmit handler
SVN-Revision: 35952
11 years ago
Felix Fietkau 0d13baff1e cns3xxx: increase number of ethernet driver rx buffers
SVN-Revision: 35951
11 years ago
Felix Fietkau ee2b511e1f cns3xxx: prevent the ethernet driver from accessing uninitialized dma descriptor entries
SVN-Revision: 35950
11 years ago
Felix Fietkau d22ac8d8fb cns3xxx: minor ethernet driver cleanup
SVN-Revision: 35949
11 years ago
Felix Fietkau 9facda9570 cns3xxx: use kmalloc instead of kzalloc for ethernet rx buffers
SVN-Revision: 35943
11 years ago
Felix Fietkau c44506fcbd cns3xxx: fix an rx irq handling corner case
When an rx interrupt comes in, rx interrupts are disabled and NAPI
polling is scheduled. During the NAPI poll, the driver first processes
received frames in the ring, then fills the dma descriptor slots with
new buffers and calls tx complete, before finally re-enabling rx
interrupts and completing NAPI (if below the budget).
If the hardware rx queue overflows before the napi complete is called,
the hardware will not throw any further rx interrupts and rx processing
stops completely.
Fix this by keeping NAPI polling scheduled until it completes a poll
without receiving any packets, and also handle NAPI completion before
refilling rx or completing tx.

SVN-Revision: 35942
11 years ago
Felix Fietkau c1adc79328 cns3xxx: fix ethernet driver memory barrier usage
SVN-Revision: 35941
11 years ago
Felix Fietkau 446409f43e cns3xxx: reduce buffer allocation size to 2048 bytes, improves ethernet performance
SVN-Revision: 35917
11 years ago
Felix Fietkau 95f14d052a cns3xxx: add linux 3.8 support and use it by default
SVN-Revision: 35908
11 years ago