08 Nov, 2019
4 commits
-
There are no users outside of this file.
Fixes: 0604d53d4da8 ("fsi: Add fsi-master class")
Signed-off-by: kbuild test robot
Signed-off-by: Joel Stanley
Link: https://lore.kernel.org/r/20191108051945.7109-7-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman -
Subtracting the offset delta from four-byte alignment lead to wrapping
of the requested length where `count` is less than `off`. Generalise the
length handling to enable and optimise aligned access sizes for all
offset and size combinations. The new formula produces the following
results for given offset and count values:offset count | length
--------------+-------
0 1 | 1
0 2 | 2
0 3 | 2
0 4 | 4
0 5 | 4
1 1 | 1
1 2 | 1
1 3 | 1
1 4 | 1
1 5 | 1
2 1 | 1
2 2 | 2
2 3 | 2
2 4 | 2
2 5 | 2
3 1 | 1
3 2 | 1
3 3 | 1
3 4 | 1
3 5 | 1We might need something like this for the cfam chardevs as well, for
example we don't currently implement any alignment restrictions /
handling in the hardware master driver.Signed-off-by: Andrew Jeffery
Signed-off-by: Joel Stanley
Link: https://lore.kernel.org/r/20191108051945.7109-6-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman -
Populate fsi_master_class->dev_attrs with the existing attribute
definitions, so we don't need to explicitly register.Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Acked-by: Alistair Popple
Link: https://lore.kernel.org/r/20191108051945.7109-3-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman -
This change adds a device class for FSI masters, allowing access under
/sys/class/fsi-master/, and easier udev rules.Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Acked-by: Alistair Popple
Link: https://lore.kernel.org/r/20191108051945.7109-2-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman
03 Jul, 2019
2 commits
-
…i into char-misc-next
Joel writes:
FSI changes for 5.3
- Add MAINTAINERS entry. There is now a git tree and a mailing
list/patchwork for collecting FSI patches- Bug fix for error driver registration error paths
- Correction for the OCC hwmon driver to meet the spec
* tag 'fsi-for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/fsi:
fsi/core: Fix error paths on CFAM init
OCC: FSI and hwmon: Add sequence numbering
MAINTAINERS: Add FSI subsystem -
Change d1dcd67825 re-worked the struct fsi_slave initialisation in
fsi_slave_init, but introduced a few inconsitencies: the slave->dev is
now registered through cdev_device_add, but we may kfree() the device
out from underneath the cdev registration. We may also leave an IDA
allocated.This change fixes the error paths, so that we kfree() only before the
device is registered with the core code. We also move the smode write to
before we start creating proper devices, as it's the most likely to
fail. We also remove the IDA-allocated minor on error, and properly
clean up the of_node.Fixes: d1dcd6782576 ("fsi: Add cfam char devices")
Reported-by: Lei YU
Tested-by: John Wang
Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
31 May, 2019
1 commit
-
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more detailsextracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 655 file(s).
Signed-off-by: Thomas Gleixner
Reviewed-by: Allison Randal
Reviewed-by: Kate Stewart
Reviewed-by: Richard Fontana
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
Signed-off-by: Greg Kroah-Hartman
27 Jul, 2018
3 commits
-
The bus scanning process isn't terribly good at parallel attempts
at rescanning the same bus. Let's have a per-master mutex protecting
the scanning process.Signed-off-by: Benjamin Herrenschmidt
-
This aims to deprecate the "raw" sysfs file used for directly
accessing the CFAM and instead use a char device like the
other sub drivers.Since it reworks the slave creation code and adds a cfam device
type, we also use the opportunity to convert the attributes
to attribute groups and add a couple more.Signed-off-by: Benjamin Herrenschmidt
-
The various FSI devices (sbefifo, occ, scom, more to come)
currently use misc devices.This is problematic as the minor device space for misc is
limited and there can be a lot of them. Also it limits our
ability to move them to a dedicated /dev/fsi directory or
to be smart about device naming and numbering.It also means we have IDAs on every single of these drivers
This creates a common fsi "device_type" for the optional
/dev/fsi grouping and a dev_t allocator for all FSI devices."Legacy" devices get to use a backward compatible numbering
scheme (as long as chip id
23 Jul, 2018
1 commit
-
They get retrieved from the device-tree and exposed
as an attribute in sysfsSigned-off-by: Benjamin Herrenschmidt
12 Jul, 2018
3 commits
-
In the error path of fsi_master_register(), we currently
use device_unregister(). This will cause the last reference
to the structure to be dropped, thus freeing the enclosing
structure, which isn't what the callers want.Use device_del() instead so that we return to the caller
with a refcount of 1. The caller can then assume that it
must use put_device() after a call to fsi_master_register()
regardless of whether the latter suceeded or failed.Signed-off-by: Benjamin Herrenschmidt
-
Those values control the amount of "dummy" clocks between commands and
between a command and its response.This adds a way to configure them from sysfs (to be later extended to
defaults in the device-tree). The default remains 16 (the HW default).This is only supported if the backend supports the new link_config()
callback to configure the generation of those delays.Signed-off-by: Benjamin Herrenschmidt
Reviewed-by: Joel Stanley
--- -
Move fsi_slave_set_smode() and its helpers to before it's
first user and remove the corresponding forward declaration.Signed-off-by: Benjamin Herrenschmidt
Reviewed-by: Joel Stanley
18 Jun, 2018
1 commit
-
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:606:15: warning: incorrect type in assignment (different base types)
fsi-core.c:606:15: expected unsigned int [unsigned] [assigned] [usertype] smode
fsi-core.c:606:15: got restricted __be32 [usertype]
fsi-core.c:492:28: warning: expression using sizeof(void)
fsi-core.c:520:29: warning: expression using sizeof(void)
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:706:24: warning: incorrect type in assignment (different base types)
fsi-core.c:706:24: expected unsigned int [unsigned] [usertype] llmode
fsi-core.c:706:24: got restricted __be32 [usertype]Signed-off-by: Joel Stanley
Signed-off-by: Benjamin Herrenschmidt
15 Mar, 2018
5 commits
-
Prior to scanning a master check if the optional property
no-scan-on-init is present. If it is then avoid scanning. This is
necessary in cases where a master scan could interfere with another
FSI master on the same bus.Signed-off-by: Christopher Bostic
Acked-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
To reduce amount of console output during boot / power up make
all normal path scan related messages debug type.Signed-off-by: Christopher Bostic
Acked-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
This change populates device tree nodes for scanned FSI slaves and
engines. If the master populates ->of_node of the FSI master device,
we'll look for matching slaves, and under those slaves we'll look for
matching engines.This means that FSI drivers will have their ->of_node pointer populated
if there's a corresponding DT node, which they can use for further
device discover.Presence of device tree nodes is optional, and only required for
fsi device drivers that need extra properties, or subordinate devices,
to be enumerated.Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Address checker fixed to allow one and two byte reads/writes.
Address alignments for each size verified.Signed-off-by: Edward James
Signed-off-by: Christopher Bostic
Acked-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
We'll want non-core fsi code to trigger a rescan, so introduce a
non-static fsi_master_rescan() function. Use this for the existing
unscan/scan behaviour too.Signed-off-by: Jeremy Kerr
Reviewed-by: Joel Stanley
Reviewed-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman
04 Oct, 2017
1 commit
-
The functions fsi_slave_report_and_clear_errors and fsi_slave_handle_error
are local to the source and do not need to be in global scope, so make
them static.Cleans up sparse warnings:
symbol 'fsi_slave_report_and_clear_errors' was not declared. Should it
be static?
symbol 'fsi_slave_handle_error' was not declared. Should it be static?Signed-off-by: Colin Ian King
Signed-off-by: Greg Kroah-Hartman
28 Aug, 2017
1 commit
-
Declare bin_attribute structures as const as they are only passed as an
argument to the function device_create_bin_file. This argument is of
type const, so declare the structure as const.Signed-off-by: Bhumika Goyal
Signed-off-by: Greg Kroah-Hartman
17 Jul, 2017
2 commits
-
gcc warns about the return type of this function:
drivers/fsi/fsi-core.c:535:8: error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
This removes the 'const' attribute, as suggested by the warning.
Fixes: 2b37c3e285f9 ("drivers/fsi: Set slave SMODE to init communication")
Signed-off-by: Arnd Bergmann
Acked-by: Geert Uytterhoeven
Acked-by: Jeremy Kerr
Signed-off-by: Greg Kroah-Hartman -
When testing an i2c driver that is a fsi bus driver, I saw the following
oops:kernel BUG at drivers/base/driver.c:153!
Internal error: Oops - BUG: 0 [#1] ARM[] (driver_register) from [] (fsi_driver_register+0x2c/0x38)
[] (fsi_driver_register) from [] (fsi_i2c_driver_init+0x1c/0x24)
[] (fsi_i2c_driver_init) from [] (do_one_initcall+0xb4/0x170)
[] (do_one_initcall) from [] (kernel_init_freeable+0x120/0x1dc)
[] (kernel_init_freeable) from [] (kernel_init+0x18/0x104)
[] (kernel_init) from [] (ret_from_fork+0x14/0x2c)This is because the fsi bus had not been registered. This fix registers the bus
with postcore_initcall instead, to ensure it is registered earlier on.When the fsi core is used as a module this should not be a problem as the fsi
driver will depend on the fsi bus type symbol, and will therefore load the core
before the driver.Fixes: 0508ad1fff11 ("drivers/fsi: Add empty fsi bus definitions")
Signed-off-by: Joel Stanley
Acked-by: Jeremy Kerr
Signed-off-by: Greg Kroah-Hartman
09 Jun, 2017
16 commits
-
Add missing MODULE_LICENSE("GPL") to the core FSI driver.
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
For slaves that are behind a software-clocked master, we want FSI CFAMs
to run asynchronously to the FSI clock, so set up our slaves to be in
async mode.Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
This change implements error handling in the FSI core, by cleaining up
and retrying failed operations, using the SISC, TERM and BREAK
facilities.Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
Trace low level read and write FSI bus operations.
Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
Allow drivers to access the slave address ranges.
Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
This change adds a 'raw' file for reads & writes, and a 'term' file for
the TERM command, and a 'break' file for issuing a BREAK.Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Christopher Bostic
Signed-off-by: Greg Kroah-Hartman -
Add driver_register and driver_unregister wrappers for FSI.
Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Allow a master to undo a previous scan. Should a master scan a bus
twice it will need to ensure it doesn't double register any
previously detected device.Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
----
v7 - Unscan when unregistering master
- Remove leading '__'s from function names
- Return fail state for sysfs rescan file
Signed-off-by: Greg Kroah-Hartman -
This change introduces the fsi device API: simple read, write and peek
accessors for the devices' address spaces.Includes contributions from Christopher Bostic
and Edward A. James .Signed-off-by: Edward A. James
Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Now that we have fsi_slave devices, scan each for endpoints, and
register them on the fsi bus.Includes contributions from Christopher Bostic
.Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Set CFAM to appropriate ID so that the controlling master can manage
link memory ranges. Add slave engine register definitions.Includes changes from Jeremy Kerr .
Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Implement fsi_slave_init: if we can read a chip ID, create fsi_slave
devices and register with the driver core.Includes changes from Christopher Bostic .
Signed-off-by: Jeremy Kerr
Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Enable each link and send a break command, and try to detect a slave by
reading from the SMODE register.Signed-off-by: Christopher Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Introduce functions to perform reads/writes on the slave address space;
these simply pass the request on the slave's master with the correct
link and slave ID.We implement these on top of similar helpers for the master.
Signed-off-by: Jeremy Kerr
Signed-off-by: Joel Stanley
Signed-off-by: Chris Bostic
Signed-off-by: Greg Kroah-Hartman -
When a new fsi master is added, we will need to scan its links, and
slaves attached to those links. This change introduces a little shell to
iterate the links, which we will populate with the actual slave scan in
a later change.Signed-off-by: Jeremy Kerr
Signed-off-by: Chris Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman -
Add the initial fsi slave device, which is private to the core code.
This will be a child of the master, and parent to endpoint devices.Signed-off-by: Jeremy Kerr
Signed-off-by: Chris Bostic
Signed-off-by: Joel Stanley
Signed-off-by: Greg Kroah-Hartman