linux-2.6-block.git
3 years agoAdd t6000-fpwm compatible
Andreas Heider [Thu, 10 Feb 2022 05:19:19 +0000 (05:19 +0000)]
Add t6000-fpwm compatible

3 years agopwm: apple-m1: Add Apple M1 FPWM controller driver
Pip Cet [Mon, 9 Aug 2021 08:07:19 +0000 (08:07 +0000)]
pwm: apple-m1: Add Apple M1 FPWM controller driver

This PWM module on the Apple M1 SoC is connected to the keyboard
backlight on at least some MacBook Pros (J293).

Signed-off-by: Pip Cet <pipcet@gmail.com>
3 years agoT6000: kill dead cores
Jens Axboe [Tue, 15 Feb 2022 21:31:10 +0000 (14:31 -0700)]
T6000: kill dead cores

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoapple-soc-cpufreq: use atomic poll timeout
Jens Axboe [Tue, 15 Feb 2022 19:19:31 +0000 (12:19 -0700)]
apple-soc-cpufreq: use atomic poll timeout

From jannau

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoapple-nvme: limit admin queue depth to 2
Jens Axboe [Fri, 11 Feb 2022 13:19:19 +0000 (06:19 -0700)]
apple-nvme: limit admin queue depth to 2

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoKill kbd crc mismatch message
Jens Axboe [Thu, 10 Feb 2022 17:07:45 +0000 (10:07 -0700)]
Kill kbd crc mismatch message

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoRemove local version
Jens Axboe [Sat, 19 Feb 2022 15:28:52 +0000 (08:28 -0700)]
Remove local version

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'master' of ssh://git.kernel.dk/data/git/linux-block into m1/2022-02-20
Jens Axboe [Sun, 20 Feb 2022 22:46:48 +0000 (15:46 -0700)]
Merge branch 'master' of ssh://git.kernel.dk/data/git/linux-block into m1/2022-02-20

* 'master' of ssh://git.kernel.dk/data/git/linux-block: (58 commits)
  Linux 5.17-rc5
  MAINTAINERS: remove duplicate entry for i2c-qcom-geni
  sched: Fix yet more sched_fork() races
  Input: psmouse - set up dependency between PS/2 and SMBus companions
  x86/ptrace: Fix xfpregs_set()'s incorrect xmm clearing
  i2c: brcmstb: fix support for DSL and CM variants
  bonding: force carrier update when releasing slave
  x86/sgx: Fix missing poison handling in reclaimer
  fs/file_table: fix adding missing kmemleak_not_leak()
  nfp: flower: netdev offload check for ip6gretap
  ipv6: fix data-race in fib6_info_hw_flags_set / fib6_purge_rt
  ipv4: fix data races in fib_alias_hw_flags_set
  net: dsa: lan9303: add VLAN IDs to master device
  net: dsa: lan9303: handle hwaccel VLAN tags
  mm: don't try to NUMA-migrate COW pages that have other uses
  vsock: remove vsock from connected table when connect is interrupted by a signal
  Revert "net: ethernet: bgmac: Use devm_platform_ioremap_resource_byname"
  ucounts: Handle wrapping in is_ucounts_overlimit
  ucounts: Move RLIMIT_NPROC handling after set_user
  ucounts: Base set_cred_ucounts changes on the real user
  ...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoLinux 5.17-rc5 v5.17-rc5
Linus Torvalds [Sun, 20 Feb 2022 21:07:20 +0000 (13:07 -0800)]
Linux 5.17-rc5

3 years agoMerge tag 'locking_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 Feb 2022 20:50:50 +0000 (12:50 -0800)]
Merge tag 'locking_urgent_for_v5.17_rc5' of git://git./linux/kernel/git/tip/tip

Pull locking fix from Borislav Petkov:
 "Fix a NULL ptr dereference when dumping lockdep chains through
  /proc/lockdep_chains"

* tag 'locking_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  lockdep: Correct lock_classes index mapping

3 years agoMerge tag 'x86_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 Feb 2022 20:46:21 +0000 (12:46 -0800)]
Merge tag 'x86_urgent_for_v5.17_rc5' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

 - Fix the ptrace regset xfpregs_set() callback to behave according to
   the ABI

 - Handle poisoned pages properly in the SGX reclaimer code

* tag 'x86_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/ptrace: Fix xfpregs_set()'s incorrect xmm clearing
  x86/sgx: Fix missing poison handling in reclaimer

3 years agoMerge tag 'sched_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 Feb 2022 20:40:20 +0000 (12:40 -0800)]
Merge tag 'sched_urgent_for_v5.17_rc5' of git://git./linux/kernel/git/tip/tip

Pull scheduler fix from Borislav Petkov:
 "Fix task exposure order when forking tasks"

* tag 'sched_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched: Fix yet more sched_fork() races

3 years agoMerge tag 'edac_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 Feb 2022 20:04:14 +0000 (12:04 -0800)]
Merge tag 'edac_urgent_for_v5.17_rc5' of git://git./linux/kernel/git/ras/ras

Pull EDAC fix from Borislav Petkov:
 "Fix a long-standing struct alignment bug in the EDAC struct allocation
  code"

* tag 'edac_urgent_for_v5.17_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  EDAC: Fix calculation of returned address and next offset in edac_align_ptr()

3 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 20 Feb 2022 19:51:49 +0000 (11:51 -0800)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Three fixes, all in drivers.

  The ufs and qedi fixes are minor; the lpfc one is a bit bigger because
  it involves adding a heuristic to detect and deal with common but not
  standards compliant behaviour"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: ufs: core: Fix divide by zero in ufshcd_map_queues()
  scsi: lpfc: Fix pt2pt NVMe PRLI reject LOGO loop
  scsi: qedi: Fix ABBA deadlock in qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp()

3 years agoMerge tag 'dmaengine-fix-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
Linus Torvalds [Sun, 20 Feb 2022 19:30:18 +0000 (11:30 -0800)]
Merge tag 'dmaengine-fix-5.17' of git://git./linux/kernel/git/vkoul/dmaengine

Pull dmaengine fixes from Vinod Koul:
 "A bunch of driver fixes for:

   - ptdma error handling in init

   - lock fix in at_hdmac

   - error path and error num fix for sh dma

   - pm balance fix for stm32"

* tag 'dmaengine-fix-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine:
  dmaengine: shdma: Fix runtime PM imbalance on error
  dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size
  dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe
  dmaengine: sh: rcar-dmac: Check for error num after setting mask
  dmaengine: at_xdmac: Fix missing unlock in at_xdmac_tasklet()
  dmaengine: ptdma: Fix the error handling path in pt_core_init()

3 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 20 Feb 2022 19:23:48 +0000 (11:23 -0800)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Some driver updates, a MAINTAINERS fix, and additions to COMPILE_TEST
  (so we won't miss build problems again)"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  MAINTAINERS: remove duplicate entry for i2c-qcom-geni
  i2c: brcmstb: fix support for DSL and CM variants
  i2c: qup: allow COMPILE_TEST
  i2c: imx: allow COMPILE_TEST
  i2c: cadence: allow COMPILE_TEST
  i2c: qcom-cci: don't put a device tree node before i2c_add_adapter()
  i2c: qcom-cci: don't delete an unregistered adapter
  i2c: bcm2835: Avoid clock stretching timeouts

3 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Sun, 20 Feb 2022 19:15:46 +0000 (11:15 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

 - a fix for Synaptics touchpads in RMI4 mode failing to suspend/resume
   properly because I2C client devices are now being suspended and
   resumed asynchronously which changed the ordering

 - a change to make sure we do not set right and middle buttons
   capabilities on touchpads that are "buttonpads" (i.e. do not have
   separate physical buttons)

 - a change to zinitix touchscreen driver adding more compatible
   strings/IDs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: psmouse - set up dependency between PS/2 and SMBus companions
  Input: zinitix - add new compatible strings
  Input: clear BTN_RIGHT/MIDDLE on buttonpads

3 years agoMerge tag 'for-v5.17-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux...
Linus Torvalds [Sun, 20 Feb 2022 19:07:46 +0000 (11:07 -0800)]
Merge tag 'for-v5.17-rc' of git://git./linux/kernel/git/sre/linux-power-supply

Pull power supply fixes from Sebastian Reichel:
 "Three regression fixes for the 5.17 cycle:

   - build warning fix for power-supply documentation

   - pointer size fix in cw2015 battery driver

   - OOM handling in bq256xx charger driver"

* tag 'for-v5.17-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: supply: bq256xx: Handle OOM correctly
  power: supply: core: fix application of sizeof to pointer
  power: supply: fix table problem in sysfs-class-power

3 years agoMerge tag 'fs.mount_setattr.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 Feb 2022 19:01:47 +0000 (11:01 -0800)]
Merge tag 'fs.mount_setattr.v5.17-rc4' of git://git./linux/kernel/git/brauner/linux

Pull mount_setattr test/doc fixes from Christian Brauner:
 "This contains a fix for one of the selftests for the mount_setattr
  syscall to create idmapped mounts, an entry for idmapped mounts for
  maintainers, and missing kernel documentation for the helper we split
  out some time ago to get and yield write access to a mount when
  changing mount properties"

* tag 'fs.mount_setattr.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
  fs: add kernel doc for mnt_{hold,unhold}_writers()
  MAINTAINERS: add entry for idmapped mounts
  tests: fix idmapped mount_setattr test

3 years agoMerge tag 'pidfd.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner...
Linus Torvalds [Sun, 20 Feb 2022 18:55:05 +0000 (10:55 -0800)]
Merge tag 'pidfd.v5.17-rc4' of git://git./linux/kernel/git/brauner/linux

Pull pidfd fix from Christian Brauner:
 "This fixes a problem reported by lockdep when installing a pidfd via
  fd_install() with siglock and the tasklisk write lock held in
  copy_process() when calling clone()/clone3() with CLONE_PIDFD.

  Originally a pidfd was created prior to holding any of these locks but
  this required a call to ksys_close(). So quite some time ago in
  6fd2fe494b17 ("copy_process(): don't use ksys_close() on cleanups") we
  switched to a get_unused_fd_flags() + fd_install() model.

  As part of that we moved fd_install() as late as possible. This was
  done for two main reasons. First, because we needed to ensure that we
  call fd_install() past the point of no return as once that's called
  the fd is live in the task's file table. Second, because we tried to
  ensure that the fd is visible in /proc/<pid>/fd/<pidfd> right when the
  task is visible.

  This fix moves the fd_install() to an even later point which means
  that a task will be visible in proc while the pidfd isn't yet under
  /proc/<pid>/fd/<pidfd>.

  While this is a user visible change it's very unlikely that this will
  have any impact. Nobody should be relying on that and if they do we
  need to come up with something better but again, it's doubtful this is
  relevant"

* tag 'pidfd.v5.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
  copy_process(): Move fd_install() out of sighand->siglock critical section

3 years agoMerge branch 'ucount-rlimit-fixes-for-v5.17' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sun, 20 Feb 2022 18:44:11 +0000 (10:44 -0800)]
Merge branch 'ucount-rlimit-fixes-for-v5.17' of git://git./linux/kernel/git/ebiederm/user-namespace

Pull ucounts fixes from Eric Biederman:
 "Michal Koutný recently found some bugs in the enforcement of
  RLIMIT_NPROC in the recent ucount rlimit implementation.

  In this set of patches I have developed a very conservative approach
  changing only what is necessary to fix the bugs that I can see
  clearly. Cleanups and anything that is making the code more consistent
  can follow after we have the code working as it has historically.

  The problem is not so much inconsistencies (although those exist) but
  that it is very difficult to figure out what the code should be doing
  in the case of RLIMIT_NPROC.

  All other rlimits are only enforced where the resource is acquired
  (allocated). RLIMIT_NPROC by necessity needs to be enforced in an
  additional location, and our current implementation stumbled it's way
  into that implementation"

* 'ucount-rlimit-fixes-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  ucounts: Handle wrapping in is_ucounts_overlimit
  ucounts: Move RLIMIT_NPROC handling after set_user
  ucounts: Base set_cred_ucounts changes on the real user
  ucounts: Enforce RLIMIT_NPROC not RLIMIT_NPROC+1
  rlimit: Fix RLIMIT_NPROC enforcement failure caused by capability calls in set_user

3 years agoMAINTAINERS: remove duplicate entry for i2c-qcom-geni
Wolfram Sang [Fri, 18 Feb 2022 10:49:04 +0000 (11:49 +0100)]
MAINTAINERS: remove duplicate entry for i2c-qcom-geni

The driver is already covered in the ARM/QUALCOMM section. Also, Akash
Asthana's email bounces meanwhile and Mukesh Savaliya has never
responded to mails regarding this driver.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
3 years agoMerge branches 'refs/heads/bits/000-devicetree', 'refs/heads/bits/010-mailbox', ...
Hector Martin [Sat, 19 Feb 2022 10:31:36 +0000 (19:31 +0900)]
Merge branches 'refs/heads/bits/000-devicetree', 'refs/heads/bits/010-mailbox', 'refs/heads/bits/020-t6000-bringup', 'refs/heads/bits/030-misc', 'refs/heads/bits/050-nvme', 'refs/heads/bits/060-spi', 'refs/heads/bits/070-audio', 'refs/heads/bits/080-wifi', 'refs/heads/bits/090-spi-hid', 'refs/heads/bits/100-shutdown-notifier', 'refs/heads/bits/110-smc', 'refs/heads/bits/120-spmi', 'refs/heads/bits/130-cpufreq' and 'refs/heads/bits/140-pci-pwren' into asahi

3 years agortc: Add new rtc-macsmc driver for Apple Silicon Macs
Hector Martin [Tue, 15 Feb 2022 09:47:13 +0000 (18:47 +0900)]
rtc: Add new rtc-macsmc driver for Apple Silicon Macs

Apple Silicon Macs (M1, etc.) have an RTC that is part of the PMU IC,
but most of the PMU functionality is abstracted out by the SMC.
On T600x machines, the RTC counter must be accessed via the SMC to
get full functionality, and it seems likely that future machines
will move towards making SMC handle all RTC functionality.

The SMC RTC counter access is implemented on all current machines
as of the time of this writing, on firmware 12.x. However, the RTC
offset (needed to set the time) is still only accessible via direct
PMU access. To handle this, we expose the RTC offset as an NVMEM
cell from the SPMI PMU device node, and this driver consumes that
cell and uses it to compute/set the current time.

Alarm functionality is not yet implemented. This would also go via
the PMU today, but could change in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: reset: macsmc-reboot: Add driver for rebooting via Apple SMC
Hector Martin [Tue, 8 Feb 2022 10:17:40 +0000 (19:17 +0900)]
power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC

This driver implements the reboot/shutdown support exposed by the SMC
on Apple Silicon machines, such as Apple M1 Macs.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Add AC power supply
Hector Martin [Mon, 14 Feb 2022 17:24:42 +0000 (02:24 +0900)]
power: supply: macsmc_power: Add AC power supply

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Turn off OBC flags if macOS left them on
Hector Martin [Mon, 14 Feb 2022 17:24:13 +0000 (02:24 +0900)]
power: supply: macsmc_power: Turn off OBC flags if macOS left them on

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Use BUIC instead of BRSC for charge
Hector Martin [Mon, 14 Feb 2022 17:23:33 +0000 (02:23 +0900)]
power: supply: macsmc_power: Use BUIC instead of BRSC for charge

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Add more props, rework others
Hector Martin [Mon, 14 Feb 2022 17:20:20 +0000 (02:20 +0900)]
power: supply: macsmc_power: Add more props, rework others

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Add present prop
Hector Martin [Tue, 8 Feb 2022 02:01:17 +0000 (11:01 +0900)]
power: supply: macsmc_power: Add present prop

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Add cycle count and health props
Hector Martin [Mon, 7 Feb 2022 17:51:35 +0000 (02:51 +0900)]
power: supply: macsmc_power: Add cycle count and health props

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agopower: supply: macsmc_power: Driver for Apple SMC power/battery stats
Hector Martin [Mon, 7 Feb 2022 17:30:16 +0000 (02:30 +0900)]
power: supply: macsmc_power: Driver for Apple SMC power/battery stats

This driver implements support for battery stats on top of the macsmc
framework, to support Apple M1 Mac machines.

Co-authored-by: Joey Gouly <joey.gouly@arm.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agogpio: Add new gpio-macsmc driver for Apple Macs
Hector Martin [Fri, 4 Feb 2022 03:52:52 +0000 (12:52 +0900)]
gpio: Add new gpio-macsmc driver for Apple Macs

This driver implements the GPIO service on top of the SMC framework
on Apple Mac machines. In particular, these are the GPIOs present in the
PMU IC which are used to control power to certain on-board devices.

Although the underlying hardware supports various pin config settings
(input/output, open drain, etc.), this driver does not implement that
functionality and leaves it up to the firmware to configure things
properly. We also don't yet support interrupts/events. This is
sufficient for device power control, which is the only thing we need to
support at this point. More features will be implemented when needed.

To our knowledge, only Apple Silicon Macs implement this SMC feature.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoplatform/apple: Add new Apple Mac SMC driver
Hector Martin [Fri, 4 Feb 2022 03:47:07 +0000 (12:47 +0900)]
platform/apple: Add new Apple Mac SMC driver

This driver implements support for the SMC (System Management
Controller) in Apple Macs. In contrast to the existing applesmc driver,
it uses pluggable backends that allow it to support different SMC
implementations, and uses the MFD subsystem to expose the core SMC
functionality so that specific features (gpio, hwmon, battery, etc.) can
be implemented by separate drivers in their respective downstream
subsystems.

The initial RTKit backend adds support for Apple Silicon Macs (M1 et
al). We hope a backend for T2 Macs will be written in the future
(since those are not supported by applesmc), and eventually an x86
backend would allow us to fully deprecate applesmc in favor of this
driver.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agolib/vsprintf: Add support for generic FOURCCs by extending %p4cc
Hector Martin [Mon, 31 Jan 2022 15:40:51 +0000 (00:40 +0900)]
lib/vsprintf: Add support for generic FOURCCs by extending %p4cc

%p4cc is designed for DRM/V4L2 FOURCCs with their specific quirks, but
it's useful to be able to print generic 4-character codes formatted as
an integer. Extend it to add format specifiers for printing generic
32-bit FOURCCs with various endian semantics:

%p4ch   Host-endian
%p4cl Little-endian
%p4cb Big-endian
%p4cr Reverse-endian

The endianness determines how bytes are interpreted as a u32, and the
FOURCC is then always printed MSByte-first (this is the opposite of
V4L/DRM FOURCCs). This covers most practical cases, e.g. %p4cr would
allow printing LSByte-first FOURCCs stored in host endian order
(other than the hex form being in character order, not the integer
value).

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoRevert "mm/sparsemem: fix 'mem_section' will never be NULL gcc 12 warning"
Hector Martin [Sat, 19 Feb 2022 10:23:13 +0000 (19:23 +0900)]
Revert "mm/sparsemem: fix 'mem_section' will never be NULL gcc 12 warning"

This reverts commit edecc06b4d34e92a5cd306d3436833e344eb3fa2.

3 years agoRevert "mm-sparsemem-fix-mem_section-will-never-be-null-gcc-12-warning-v2"
Hector Martin [Sat, 19 Feb 2022 10:23:08 +0000 (19:23 +0900)]
Revert "mm-sparsemem-fix-mem_section-will-never-be-null-gcc-12-warning-v2"

This reverts commit fff3b2a167db5495b47548cc71054e064c440031.

3 years agosched: Fix yet more sched_fork() races
Peter Zijlstra [Mon, 14 Feb 2022 09:16:57 +0000 (10:16 +0100)]
sched: Fix yet more sched_fork() races

Where commit 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an
invalid sched_task_group") fixed a fork race vs cgroup, it opened up a
race vs syscalls by not placing the task on the runqueue before it
gets exposed through the pidhash.

Commit 13765de8148f ("sched/fair: Fix fault in reweight_entity") is
trying to fix a single instance of this, instead fix the whole class
of issues, effectively reverting this commit.

Fixes: 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an invalid sched_task_group")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Tested-by: Zhang Qiao <zhangqiao22@huawei.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lkml.kernel.org/r/YgoeCbwj5mbCR0qA@hirez.programming.kicks-ass.net
3 years agoHACK: t8103.dtsi: Work around incompleteness of MCA driver
Martin Povišer [Sat, 19 Feb 2022 09:40:41 +0000 (10:40 +0100)]
HACK: t8103.dtsi: Work around incompleteness of MCA driver

3 years agodt: t8103.dtsi: Put in audio-related device nodes
Martin Povišer [Sat, 19 Feb 2022 08:49:59 +0000 (09:49 +0100)]
dt: t8103.dtsi: Put in audio-related device nodes

3 years agoASoC: cs42l42: Bypass device ID check
Martin Povišer [Sat, 19 Feb 2022 08:49:50 +0000 (09:49 +0100)]
ASoC: cs42l42: Bypass device ID check

The cs42l42 driver is also applicable to the cs42l83 part.

3 years agoHACK: ASoC: cs42l42: Disable regcache
Martin Povišer [Sat, 19 Feb 2022 08:49:48 +0000 (09:49 +0100)]
HACK: ASoC: cs42l42: Disable regcache

There's some issue that has yet to be pinned down.

3 years agoHACK: ASoC: tas2770: Set no of channels to 1
Martin Povišer [Sat, 19 Feb 2022 08:49:45 +0000 (09:49 +0100)]
HACK: ASoC: tas2770: Set no of channels to 1

3 years agoASoC: tas2770: Set correct FSYNC polarity
Martin Povišer [Sat, 19 Feb 2022 08:49:34 +0000 (09:49 +0100)]
ASoC: tas2770: Set correct FSYNC polarity

Fix setting of FSYNC polarity for DAI formats other than I2S. Also
add support for polarity inversion.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
3 years agoASoC: apple-mca: Add platform driver for Apple SoCs
Martin Povišer [Sat, 19 Feb 2022 09:33:16 +0000 (10:33 +0100)]
ASoC: apple-mca: Add platform driver for Apple SoCs

Add ASoC platform driver for the MCA block found on Apple SoCs
from the "Apple Silicon" family.

3 years agodmaengine: apple-admac: Add Apple ADMAC driver
Martin Povišer [Sat, 19 Feb 2022 08:49:23 +0000 (09:49 +0100)]
dmaengine: apple-admac: Add Apple ADMAC driver

Add driver for Audio DMA Controller present on Apple SoCs
from the "Apple Silicon" family.

3 years agodt-bindings: dma: Add apple,admac binding
Martin Povišer [Sat, 19 Feb 2022 08:50:39 +0000 (09:50 +0100)]
dt-bindings: dma: Add apple,admac binding

The Audio DMA Controller (ADMAC) is used to load and store audio
samples from/to system memory. It is present on Apple SoCs from
the "Apple Silicon" family.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
3 years agotps6598x: clear int mask on probe failure
Jens Axboe [Tue, 15 Feb 2022 18:22:04 +0000 (11:22 -0700)]
tps6598x: clear int mask on probe failure

The interrupt mask is enabled before any potential failure points in
the driver, which can leave a failure path where we exit with
interrupts enabled but the device not live. This causes an infinite
stream of interrupts on an Apple M1 Pro laptop on USB-C.

Add a failure label that's used post enabling interrupts, where we
mask them again before returning an error.

Suggested-by: Sven Peter <sven@svenpeter.dev>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
3 years agoMAINTAINERS: Add clk-apple-nco under ARM/APPLE MACHINE
Martin Povišer [Tue, 8 Feb 2022 18:10:30 +0000 (19:10 +0100)]
MAINTAINERS: Add clk-apple-nco under ARM/APPLE MACHINE

Acked-by: Sven Peter <sven@svenpeter.dev>
Acked-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
3 years agoclk: clk-apple-nco: Add driver for Apple NCO
Martin Povišer [Tue, 8 Feb 2022 18:13:17 +0000 (19:13 +0100)]
clk: clk-apple-nco: Add driver for Apple NCO

Add a common clock driver for NCO blocks found on Apple SoCs where they
are typically the generators of audio clocks.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
3 years agodt-bindings: clock: Add Apple NCO
Martin Povišer [Tue, 8 Feb 2022 18:10:03 +0000 (19:10 +0100)]
dt-bindings: clock: Add Apple NCO

The NCO block found on Apple SoCs is a programmable clock generator
performing fractional division of a high frequency input clock.

Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
3 years agoapple-nvme: remove superflous tcb clears
Jens Axboe [Tue, 15 Feb 2022 21:32:43 +0000 (14:32 -0700)]
apple-nvme: remove superflous tcb clears

We clear the whole array at init time, we don't need to clear in
both submit and nvmmu_inval.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoWIP: HID: transport: spi: add Apple SPI transport
Janne Grunau [Fri, 10 Dec 2021 18:38:43 +0000 (19:38 +0100)]
WIP: HID: transport: spi: add Apple SPI transport

Keyboard and trackpad of Apple Sillicon SoCs (M1, M1 Pro/Max) laptops
are are HID devices connected via SPI.

This is the same protocol as implemented by applespi.c. It was not
noticed that protocol is a transport for HID. Adding support for ACPI
based Intel MacBooks will be done in a separate commit.

How HID is mapped in this protocol is not yet fully understood.

Microsoft has a specification for HID over SPI [1] incompatible with the
transport protocol used by Apple.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/hid-over-spi

Signed-off-by: Janne Grunau <j@jannau.net>
3 years agoapple-nvme: defer cache flushes by a specified amount
Jens Axboe [Wed, 16 Feb 2022 19:17:58 +0000 (12:17 -0700)]
apple-nvme: defer cache flushes by a specified amount

Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
complete. This can slow down workloads considerably, pure random writes
end up being bound by the flush latency and hence run at 55-60 IOPS.

Add a deferred flush work around to provide better performance, at a
minimal risk. By default, flushes are delayed at most 1 second, but this
is configurable.

With this work-around, a pure random write workload runs at ~12K IOPS
rather than 56 IOPS.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoapple-nvme: serialize command issue
Jens Axboe [Tue, 15 Feb 2022 21:33:50 +0000 (14:33 -0700)]
apple-nvme: serialize command issue

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoarm64: dts: apple: Add CPUfreq nodes
Hector Martin [Tue, 15 Feb 2022 12:34:10 +0000 (21:34 +0900)]
arm64: dts: apple: Add CPUfreq nodes

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoarm64: dts: apple: Add PMU NVMEM and SMC RTC/reboot nodes
Hector Martin [Tue, 15 Feb 2022 09:54:35 +0000 (18:54 +0900)]
arm64: dts: apple: Add PMU NVMEM and SMC RTC/reboot nodes

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoarm64: dts: apple: Add SMC node to t8103/t6001 devicetrees
Hector Martin [Fri, 4 Feb 2022 03:59:39 +0000 (12:59 +0900)]
arm64: dts: apple: Add SMC node to t8103/t6001 devicetrees

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoarm64: dts: apple: Add PCI power enable GPIOs
Hector Martin [Sun, 6 Feb 2022 12:22:29 +0000 (21:22 +0900)]
arm64: dts: apple: Add PCI power enable GPIOs

t8103:
- WLAN (SMC PMU GPIO #13)
t600x:
- WLAN (SMC PMU GPIO #13)
- SD (SMC PMU GPIO #26)

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoarm64: dts: apple: Add WiFi module and antenna properties
Hector Martin [Tue, 21 Dec 2021 08:07:17 +0000 (17:07 +0900)]
arm64: dts: apple: Add WiFi module and antenna properties

Add the new module-instance/antenna-sku properties required to select
WiFi firmwares properly to all board device trees.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoarm64: dts: apple: t8103: Add spi3/keyboard nodes
Janne Grunau [Thu, 25 Nov 2021 23:24:15 +0000 (00:24 +0100)]
arm64: dts: apple: t8103: Add spi3/keyboard nodes

Enables keyboard and touchpad input on MacBook Air (M1, 2020) and
MacBook Pro (13-inch, M1, 2020).

Signed-off-by: Janne Grunau <j@jannau.net>
3 years agoarm64: dts: apple: t600x: Add spi3 and keyboard nodes
Janne Grunau [Thu, 11 Nov 2021 20:31:21 +0000 (21:31 +0100)]
arm64: dts: apple: t600x: Add spi3 and keyboard nodes

Enables keyboard and touchpad input on MacBook Pro (14/16-inch,
M1 Pro/Max, 2021).

Signed-off-by: Janne Grunau <j@jannau.net>
3 years agoarm64: dts: apple: t600x-j314-j316: Add NOR flash node
Hector Martin [Thu, 9 Dec 2021 12:58:29 +0000 (21:58 +0900)]
arm64: dts: apple: t600x-j314-j316: Add NOR flash node

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoMakefile: Add -asahi EXTRAVERSION
Hector Martin [Thu, 2 Dec 2021 11:37:25 +0000 (20:37 +0900)]
Makefile: Add -asahi EXTRAVERSION

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoPCI: apple: Add support for optional PWREN GPIO
Hector Martin [Sun, 6 Feb 2022 12:18:18 +0000 (21:18 +0900)]
PCI: apple: Add support for optional PWREN GPIO

WiFi and SD card devices on M1 Macs have a separate power enable GPIO.
Add support for this to the PCIe controller. This is modeled after how
pcie-fu740 does it.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoPCI: apple: Probe all GPIOs for availability first
Hector Martin [Sun, 6 Feb 2022 12:15:39 +0000 (21:15 +0900)]
PCI: apple: Probe all GPIOs for availability first

If we're probing the PCI controller and some GPIOs are not available and
cause a probe defer, we can end up leaving some ports initialized and
not others and making a mess.

Check for PERST# GPIOs for all ports first, and just return
-EPROBE_DEFER if any are not ready yet, without bringing anything up.

Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoPCI: apple: GPIO handling nitfixes
Hector Martin [Sun, 6 Feb 2022 12:13:17 +0000 (21:13 +0900)]
PCI: apple: GPIO handling nitfixes

- Use devm managed GPIO getter
- GPIO ops can sleep in this context

Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: common: Add support for external calibration blobs
Hector Martin [Sat, 25 Dec 2021 15:53:37 +0000 (00:53 +0900)]
brcmfmac: common: Add support for external calibration blobs

The calibration blob for a chip is normally stored in SROM and loaded
internally by the firmware. However, Apple ARM64 platforms instead store
it as part of platform configuration data, and provide it via the Apple
Device Tree. We forward this into the Linux DT in the bootloader.

Add support for taking this blob from the DT and loading it into the
dongle. The loading mechanism is the same as used for the CLM and TxCap
blobs.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Load and provide TxCap blobs
Hector Martin [Sat, 25 Dec 2021 15:26:10 +0000 (00:26 +0900)]
brcmfmac: pcie: Load and provide TxCap blobs

These blobs are named .txcap_blob, and exist alongside the existing
.clm_blob files. Use the existing firmware machinery to provide them to
the core.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: common: Add support for downloading TxCap blobs
Hector Martin [Sat, 25 Dec 2021 15:25:00 +0000 (00:25 +0900)]
brcmfmac: common: Add support for downloading TxCap blobs

The TxCap blobs are additional data blobs used on Apple devices, and
are uploaded analogously to CLM blobs. Add core support for doing this.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Add IDs/properties for BCM4387
Hector Martin [Tue, 21 Dec 2021 08:52:03 +0000 (17:52 +0900)]
brcmfmac: pcie: Add IDs/properties for BCM4387

This chip is present on Apple M1 Pro/Max (t600x) platforms:

* maldives   (apple,j314s): MacBook Pro (14-inch, M1 Pro, 2021)
* maldives   (apple,j314c): MacBook Pro (14-inch, M1 Max, 2021)
* madagascar (apple,j316s): MacBook Pro (16-inch, M1 Pro, 2021)
* madagascar (apple,j316c): MacBook Pro (16-inch, M1 Max, 2021)

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmflac: cfg80211: Use WSEC to set SAE password
Hector Martin [Thu, 6 Jan 2022 10:45:15 +0000 (19:45 +0900)]
brcmflac: cfg80211: Use WSEC to set SAE password

Using the WSEC command instead of sae_password seems to be the supported
mechanism on newer firmware, and also how the brcmdhd driver does it.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: cfg80211: Pass the PMK in binary instead of hex
Hector Martin [Mon, 20 Dec 2021 10:15:58 +0000 (19:15 +0900)]
brcmfmac: cfg80211: Pass the PMK in binary instead of hex

Apparently the hex passphrase mechanism does not work on newer
chips/firmware (e.g. BCM4387). It seems there was a simple way of
passing it in binary all along, so use that and avoid the hexification.

OpenBSD has been doing it like this from the beginning, so this should
work on all chips.

Also clear the structure before setting the PMK. This was leaking
uninitialized stack contents to the device.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: cfg80211: Add support for PMKID_V3 operations
Hector Martin [Mon, 20 Dec 2021 09:16:33 +0000 (18:16 +0900)]
brcmfmac: cfg80211: Add support for PMKID_V3 operations

Add support for the new PMKID_V3 API, which allows performing PMKID
mutations individually, instead of requiring the driver to keep track of
the full list. This new API is required by at least BCM4387.

Note that PMKID_V2 is not implemented yet.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: feature: Add support for setting feats based on WLC version
Hector Martin [Mon, 20 Dec 2021 09:15:10 +0000 (18:15 +0900)]
brcmfmac: feature: Add support for setting feats based on WLC version

The "wlc_ver" iovar returns information on the WLC and EPI versions.
This can be used to determine whether the PMKID_V2 and _V3 features are
supported.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: cfg80211: Add support for scan params v2
Hector Martin [Sun, 19 Dec 2021 18:39:44 +0000 (03:39 +0900)]
brcmfmac: cfg80211: Add support for scan params v2

This new API version is required for at least the BCM4387 firmware. Add
support for it, with a fallback to the v1 API.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: chip: Handle 1024-unit sizes for TCM blocks
Hector Martin [Tue, 21 Dec 2021 08:14:59 +0000 (17:14 +0900)]
brcmfmac: chip: Handle 1024-unit sizes for TCM blocks

BCM4387 has trailing odd-sized blocks as part of TCM which have
their size described as a multiple of 1024 instead of 8192. Handle this
so we can compute the TCM size properly.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: chip: Only disable D11 cores; handle an arbitrary number
Hector Martin [Mon, 20 Dec 2021 11:00:57 +0000 (20:00 +0900)]
brcmfmac: chip: Only disable D11 cores; handle an arbitrary number

At least on BCM4387, the D11 cores are held in reset on cold startup and
firmware expects to release reset itself. Just assert reset here and let
firmware deassert it. Premature deassertion results in the firmware
failing to initialize properly some of the time, with strange AXI bus
errors.

Also, BCM4387 has 3 cores, up from 2. The logic for handling that is in
brcmf_chip_ai_resetcore(), but since we aren't using that any more, just
handle it here.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Perform correct BCM4364 firmware selection
Hector Martin [Tue, 21 Dec 2021 08:51:52 +0000 (17:51 +0900)]
brcmfmac: pcie: Perform correct BCM4364 firmware selection

This chip exists in two revisions (B2=r3 and B3=r4) on different
platforms, and was added without regard to doing proper firmware
selection or differentiating between them. Fix this to have proper
per-revision firmwares and support Apple NVRAM selection.

Revision B2 is present on at least these Apple T2 Macs:

kauai:    MacBook Pro 15" (Touch/2018-2019)
maui:     MacBook Pro 13" (Touch/2018-2019)
lanai:    Mac mini (Late 2018)
ekans:    iMac Pro 27" (5K, Late 2017)

And these non-T2 Macs:

nihau:    iMac 27" (5K, 2019)

Revision B3 is present on at least these Apple T2 Macs:

bali:     MacBook Pro 16" (2019)
trinidad: MacBook Pro 13" (2020, 4 TB3)
borneo:   MacBook Pro 16" (2019, 5600M)
kahana:   Mac Pro (2019)
kahana:   Mac Pro (2019, Rack)
hanauma:  iMac 27" (5K, 2020)
kure:     iMac 27" (5K, 2020, 5700/XT)

Fixes: 24f0bd136264 ("brcmfmac: add the BRCM 4364 found in MacBook Pro 15,2")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Add IDs/properties for BCM4377
Hector Martin [Tue, 21 Dec 2021 08:51:31 +0000 (17:51 +0900)]
brcmfmac: pcie: Add IDs/properties for BCM4377

This chip is present on at least these Apple T2 Macs:

* tahiti:  MacBook Pro 13" (2020, 2 TB3)
* formosa: MacBook Pro 13" (Touch/2019)
* fiji:    MacBook Air 13" (Scissor, 2020)

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Add IDs/properties for BCM4355
Hector Martin [Tue, 21 Dec 2021 08:50:15 +0000 (17:50 +0900)]
brcmfmac: pcie: Add IDs/properties for BCM4355

This chip is present on at least these Apple T2 Macs:

* hawaii: MacBook Air 13" (Late 2018)
* hawaii: MacBook Air 13" (True Tone, 2019)

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Provide a buffer of random bytes to the device
Hector Martin [Thu, 23 Dec 2021 10:30:17 +0000 (19:30 +0900)]
brcmfmac: pcie: Provide a buffer of random bytes to the device

Newer Apple firmwares on chipsets without a hardware RNG require the
host to provide a buffer of 256 random bytes to the device on
initialization. This buffer is present immediately before NVRAM,
suffixed by a footer containing a magic number and the buffer length.

This won't affect chips/firmwares that do not use this feature, so do it
unconditionally.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: acpi: Add support for fetching Apple ACPI properties
Hector Martin [Thu, 23 Dec 2021 10:51:36 +0000 (19:51 +0900)]
brcmfmac: acpi: Add support for fetching Apple ACPI properties

On DT platforms, the module-instance and antenna-sku-info properties
are passed in the DT. On ACPI platforms, module-instance is passed via
the analogous Apple device property mechanism, while the antenna SKU
info is instead obtained via an ACPI method that grabs it from
non-volatile storage.

Add support for this, to allow proper firmware selection on Apple
platforms.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agoACPI / property: Support strings in Apple _DSM props
Hector Martin [Thu, 23 Dec 2021 10:51:11 +0000 (19:51 +0900)]
ACPI / property: Support strings in Apple _DSM props

The Wi-Fi module in Apple machines has a "module-instance" device
property that specifies the platform type and is used for firmware
selection. Its value is a string, so add support for string values in
acpi_extract_apple_properties().

Reviewed-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Add IDs/properties for BCM4378
Hector Martin [Tue, 21 Dec 2021 08:46:40 +0000 (17:46 +0900)]
brcmfmac: pcie: Add IDs/properties for BCM4378

This chip is present on Apple M1 (t8103) platforms:

* atlantisb (apple,j274): Mac mini (M1, 2020)
* honshu    (apple,j293): MacBook Pro (13-inch, M1, 2020)
* shikoku   (apple,j313): MacBook Air (M1, 2020)
* capri     (apple,j456): iMac (24-inch, 4x USB-C, M1, 2020)
* santorini (apple,j457): iMac (24-inch, 2x USB-C, M1, 2020)

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Support PCIe core revisions >= 64
Hector Martin [Tue, 21 Dec 2021 08:25:35 +0000 (17:25 +0900)]
brcmfmac: pcie: Support PCIe core revisions >= 64

These newer PCIe core revisions include new sets of registers that must
be used instead of the legacy ones. Introduce a brcmf_pcie_reginfo to
hold the specific register offsets and values to use for a given
platform, and change all the register accesses to indirect through it.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: msgbuf: Increase RX ring sizes to 1024
Hector Martin [Tue, 21 Dec 2021 08:39:04 +0000 (17:39 +0900)]
brcmfmac: msgbuf: Increase RX ring sizes to 1024

Newer chips used on Apple platforms have a max_rxbufpost greater than
512, which causes warnings when brcmf_msgbuf_rxbuf_data_fill tries to
put more entries in the ring than will fit. Increase the ring sizes
to 1024.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: firmware: Allow platform to override macaddr
Hector Martin [Thu, 23 Dec 2021 13:32:08 +0000 (22:32 +0900)]
brcmfmac: firmware: Allow platform to override macaddr

On Device Tree platforms, it is customary to be able to set the MAC
address via the Device Tree, as it is often stored in system firmware.
This is particularly relevant for Apple ARM64 platforms, where this
information comes from system configuration and passed through by the
bootloader into the DT.

Implement support for this by fetching the platform MAC address and
adding or replacing the macaddr= property in nvram. This becomes the
dongle's default MAC address.

On platforms with an SROM MAC address, this overrides it. On platforms
without one, such as Apple ARM64 devices, this is required for the
firmware to boot (it will fail if it does not have a valid MAC at all).

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Perform firmware selection for Apple platforms
Hector Martin [Tue, 21 Dec 2021 08:45:21 +0000 (17:45 +0900)]
brcmfmac: pcie: Perform firmware selection for Apple platforms

On Apple platforms, firmware selection uses the following elements:

  Property         Example   Source
  ==============   =======   ========================
* Chip name        4378      Device ID
* Chip revision    B1        OTP
* Platform         shikoku   DT (ARM64) or ACPI (x86)
* Module type      RASP      OTP
* Module vendor    m         OTP
* Module version   6.11      OTP
* Antenna SKU      X3        DT (ARM64) or ACPI (x86)

In macOS, these firmwares are stored using filenames in this format
under /usr/share/firmware/wifi:

    C-4378__s-B1/P-shikoku-X3_M-RASP_V-m__m-6.11.txt

To prepare firmwares for Linux, we rename these to a scheme following
the existing brcmfmac convention:

    brcmfmac<chip><lower(rev)>-pcie.apple,<platform>-<mod_type>-\
<mod_vendor>-<mod_version>-<antenna_sku>.txt

The NVRAM uses all the components, while the firmware and CLM blob only
use the chip/revision/platform/antenna_sku:

    brcmfmac<chip><lower(rev)>-pcie.apple,<platform>-<antenna_sku>.bin

e.g.

    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11-X3.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-X3.bin

In addition, since there are over 1000 files in total, many of which are
symlinks or outright duplicates, we deduplicate and prune the firmware
tree to reduce firmware filenames to fewer dimensions. For example, the
shikoku platform (MacBook Air M1 2020) simplifies to just 4 files:

    brcm/brcmfmac4378b1-pcie.apple,shikoku.clm_blob
    brcm/brcmfmac4378b1-pcie.apple,shikoku.bin
    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-u.txt

This reduces the total file count to around 170, of which 75 are
symlinks and 95 are regular files: 7 firmware blobs, 27 CLM blobs, and
61 NVRAM config files. We also slightly process NVRAM files to correct
some formatting issues.

To handle this, the driver must try the following path formats when
looking for firmware files:

    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11-X3.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m-6.11.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP-m.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-RASP.txt
    brcm/brcmfmac4378b1-pcie.apple,shikoku-X3.txt *
    brcm/brcmfmac4378b1-pcie.apple,shikoku.txt

* Not relevant for NVRAM, only for firmware/CLM.

The chip revision nominally comes from OTP on Apple platforms, but it
can be mapped to the PCI revision number, so we ignore the OTP revision
and continue to use the existing PCI revision mechanism to identify chip
revisions, as the driver already does for other chips. Unfortunately,
the mapping is not consistent between different chip types, so this has
to be determined experimentally.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: of: Fetch Apple properties
Hector Martin [Tue, 21 Dec 2021 08:27:19 +0000 (17:27 +0900)]
brcmfmac: of: Fetch Apple properties

On Apple ARM64 platforms, firmware selection requires two properties
that come from system firmware: the module-instance (aka "island", a
codename representing a given hardware platform) and the antenna-sku.
We map Apple's module codenames to board_types in the form
"apple,<module-instance>".

The mapped board_type is added to the DTS file in that form, while the
antenna-sku is forwarded by our bootloader from the Apple Device Tree
into the FDT. Grab them from the DT so firmware selection can use
them.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie: Read Apple OTP information
Hector Martin [Tue, 21 Dec 2021 08:26:34 +0000 (17:26 +0900)]
brcmfmac: pcie: Read Apple OTP information

On Apple platforms, the One Time Programmable ROM in the Broadcom chips
contains information about the specific board design (module, vendor,
version) that is required to select the correct NVRAM file. Parse this
OTP ROM and extract the required strings.

Note that the user OTP offset/size is per-chip. This patch does not add
any chips yet.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: firmware: Support passing in multiple board_types
Hector Martin [Fri, 7 Jan 2022 02:14:44 +0000 (11:14 +0900)]
brcmfmac: firmware: Support passing in multiple board_types

Apple platforms have firmware and config files identified with multiple
dimensions. We want to be able to find the most specific firmware
available for any given platform, progressively trying more general
firmwares.

To do this, first add support for passing in multiple board_types,
which will be tried in sequence.

Since this will cause more log spam due to missing firmwares, also
switch the secondary firmware fecthes to use the _nowarn variant, which
will not log if the firmware is not found.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: pcie/sdio/usb: Get CLM blob via standard firmware mechanism
Hector Martin [Tue, 21 Dec 2021 08:13:49 +0000 (17:13 +0900)]
brcmfmac: pcie/sdio/usb: Get CLM blob via standard firmware mechanism

Now that the firmware fetcher can handle per-board CLM files, load the
CLM blob alongside the other firmware files and change the bus API to
just return the existing blob, instead of fetching the filename.

This enables per-board CLM blobs, which are required on Apple platforms.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agobrcmfmac: firmware: Handle per-board clm_blob files
Hector Martin [Sat, 18 Dec 2021 11:52:04 +0000 (20:52 +0900)]
brcmfmac: firmware: Handle per-board clm_blob files

Teach brcm_alt_fw_paths to correctly split off variable length
extensions, and enable alt firmware lookups for the CLM blob firmware
requests.

Apple platforms have per-board CLM blob files.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agodt-bindings: net: bcm4329-fmac: Add Apple properties & chips
Hector Martin [Sun, 26 Dec 2021 13:04:09 +0000 (22:04 +0900)]
dt-bindings: net: bcm4329-fmac: Add Apple properties & chips

This binding is currently used for SDIO devices, but these chips are
also used as PCIe devices on DT platforms and may be represented in the
DT. Re-use the existing binding and add chip compatibles used by Apple
T2 and M1 platforms (the T2 ones are not known to be used in DT
platforms, but we might as well document them).

Then, add properties required for firmware selection and calibration on
M1 machines.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agocpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states
Hector Martin [Tue, 15 Feb 2022 12:33:32 +0000 (21:33 +0900)]
cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agonvmem: Add spmi-mfd-nvmem driver
Hector Martin [Tue, 15 Feb 2022 09:45:25 +0000 (18:45 +0900)]
nvmem: Add spmi-mfd-nvmem driver

This driver exposes part of an SPMI MFD device as an NVMEM device.
It is intended to be used with e.g. PMUs/PMICs that are used to
hold power-management configuration, such as used on Apple Silicon
Macs.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agomfd: Add a simple-mfd-spmi driver
Hector Martin [Tue, 15 Feb 2022 09:43:17 +0000 (18:43 +0900)]
mfd: Add a simple-mfd-spmi driver

This is the SPMI counterpart to simple-mfd-i2c. It merely exposes the
SPMI register address space as an MFD device, such that different
aspects of a device can be managed by separate drivers.

Signed-off-by: Hector Martin <marcan@marcan.st>
3 years agospmi: add a first basic spmi driver for Apple SoC that can be used for reading and...
Jean-Francois Bortolotti [Thu, 3 Feb 2022 23:06:13 +0000 (00:06 +0100)]
spmi: add a first basic spmi driver for Apple SoC that can be used for reading and writing time from the rtc

Signed-off-by: Jean-Francois Bortolotti <jeff@borto.fr>
3 years agoreboot: Remove pm_power_off_prepare()
Dmitry Osipenko [Sun, 30 Jan 2022 23:37:18 +0000 (02:37 +0300)]
reboot: Remove pm_power_off_prepare()

All pm_power_off_prepare() users were converted to sys-off handler API.
Remove the obsolete callback.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>