Commit Graph

8 Commits

Author SHA1 Message Date
Knuth Posern a42fb351ca thunderbolt: Allow loading of module on recent Apple MacBooks with thunderbolt 2 controller
The pci device ids listed in the thunderbolt driver are to restrictive,
which prevents the driver from being loaded on recent Apple MacBooks
using a thunderbolt 2 controller. In particular this prevented any
hot-plugging functionality for thunderbolt based ethernet dongles
(i.e. Apples thunderbolt gigabit ethernet broadcom tg3 based dongle
Model A1433 EMC 2590).

Changing the subvendor and subdevice to PCI_ANY_ID the thunderbolt driver
loads and binds to the pci device 07:00.0 System peripheral:
Intel Corporation Device 156c which is the thunderbolt 2 controller on
the MacBookPro12,1.

Successfully tested on MacBookPro12,1. With the patch the thunderbolt
module gets now loaded on boot. And it provides hot-plugging support both
for a cold-plugged and a warm-plugged ethernet dongle.

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Acked-by: Knuth Posern <knuth@posern.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-20 15:20:11 -07:00
Himangi Saraogi 2a211f320e thunderbolt: Use kcalloc
The advantage of kcalloc is, that will prevent integer overflows
which could result from the multiplication of number of elements
and size and it is also a bit nicer to read.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-13 13:16:50 -07:00
Himangi Saraogi fc51768ba2 thunderbolt: Correct the size argument to devm_kzalloc
nhi->rx_rings does not have type as struct tb_ring *, as it is a
double pointer so the elements of the array should have pointer type,
not structure type.

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Cc: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-07 18:56:20 -07:00
Sachin Kamat 620863f71c thunderbolt: Staticize nhi_ids
'nhi_ids' is local to this file.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Acked-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-20 09:44:42 -07:00
Sachin Kamat f19b72c6e8 thunderbolt: Use NULL instead of 0 in nhi.c
'descriptors' is a pointer. Use NULL isntead of 0.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Acked-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-20 09:44:42 -07:00
Andreas Noever 23dd5bb49d thunderbolt: Add suspend/hibernate support
We use _noirq since we have to restore the pci tunnels before the pci
core wakes the tunneled devices.

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 14:13:00 -07:00
Andreas Noever d6cc51cd1a thunderbolt: Setup control channel
Add struct tb which will contain our view of the thunderbolt bus.  For
now it just contains a pointer to the control channel and a workqueue
for hotplug events.

Add thunderbolt_alloc_and_start() and thunderbolt_shutdown_and_free()
which are responsible for setup and teardown of struct tb.

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 14:07:07 -07:00
Andreas Noever 1660315366 thunderbolt: Add initial cactus ridge NHI support
Thunderbolt hotplug is supposed to be handled by the firmware. But Apple
decided to implement thunderbolt at the operating system level. The
firmare only initializes thunderbolt devices that are present at boot
time. This driver enables hotplug of thunderbolt of non-chained
thunderbolt devices on Apple systems with a cactus ridge controller.

This first patch adds the Kconfig file as well the parts of the driver
which talk directly to the hardware (that is pci device setup, interrupt
handling and RX/TX ring management).

Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 14:04:52 -07:00