30 Dec, 2020

1 commit

  • [ Upstream commit dfd7f2c1c532efaeff6084970bb60ec2f2e44191 ]

    There is nothing to prevent multiple commands being executed
    simultaneously. Add a mutex to prevent this.

    Fixes: 606397d67f41 ("fsi: Add ast2600 master driver")
    Reviewed-by: Joel Stanley
    Reviewed-by: Milton Miller
    Signed-off-by: Eddie James
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20201120004929.185239-1-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Eddie James
     

10 Sep, 2020

14 commits

  • Systems have a line for restting the remote CFAM. This is not part of
    the FSI master, but is associated with it, so it makes sense to include
    it in the master driver.

    This exposes a sysfs interface to reset the cfam, abstracting away the
    direction and polarity of the GPIO, as well as the timing of the reset
    pulse. Userspace will be blocked until the reset pulse is finished.

    The reset is hard coded to be in the range of (900, 1000) us. It was
    observed with a scope to regularly be just over 1ms.

    If the device tree property is not preset the driver will silently
    continue.

    Reviewed-by: Andrew Jeffery
    Link: https://lore.kernel.org/r/20200728025527.174503-6-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • For testing and hardware debugging a user may wish to override the
    divisor at runtime. By setting fsi_master_aspeed.bus_div=N, the divisor
    will be set to N, if 0 < N
    Link: https://lore.kernel.org/r/20200728025527.174503-5-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • Testing of Tacoma has shown that the ASPEED master can be run at maximum
    speed.

    The exception is when wired externally with a cable, in which case we
    use a divisor of two to ensure reliable operation.

    Reviewed-by: Eddie James
    Link: https://lore.kernel.org/r/20200728025527.174503-4-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • Some FSI capable systems have internal FSI signals, and some have
    external cabled FSI. Software can detect which machine this is by
    reading a jumper GPIO, and also control which pins the signals are
    routed to through a mux GPIO.

    This attempts to find the GPIOs at probe time. If they are not present
    in the device tree the driver will not error and continue as before.

    The mux GPIO is owned by the FSI driver to ensure it is not modified at
    runtime. The routing jumper obtained as non-exclusive to allow other
    software to inspect it's state.

    Reviewed-by: Andrew Jeffery
    Link: https://lore.kernel.org/r/20200728025527.174503-3-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • The only usage of scom_ids is to assign its address to the id_table
    field in the fsi_driver struct, which is a const pointer, so make it
    const to allow the compiler to put it in read-only memory

    Signed-off-by: Rikard Falkeborn
    Signed-off-by: Joel Stanley

    Rikard Falkeborn
     
  • The only usage of sbefifo_ids is to assign its address to the id_table
    field in the fsi_driver struct, which is a const pointer, so make it
    const to allow the compiler to put it in read-only memory

    Signed-off-by: Rikard Falkeborn
    Signed-off-by: Joel Stanley

    Rikard Falkeborn
     
  • The only usage of hub_master_ids is to assign its address to the
    id_table field in the fsi_driver struct, which is a const pointer, so
    make it const to allow the compiler to put it in read-only memory.

    Signed-off-by: Rikard Falkeborn
    Signed-off-by: Joel Stanley

    Rikard Falkeborn
     
  • Both the Aspeed and hub masters read back the link enable register
    after enabling the link, but this is unnecessary, so remove it.

    Signed-off-by: Eddie James
    Signed-off-by: Joel Stanley

    Eddie James
     
  • The driver ought to claim local bus ownership of the slave it's
    communicating with.

    This is for multi-master setups. The slave (in theory) will deny access
    to masters who try to access the CFAM address space but who don't "own"
    the bus.

    As driver doesn't seem to perform any other teardown there is no need to
    "un-claim" ownership at teardown. Also I'm not aware of any multi-master
    setup using this driver so it shouldn't actually matter. Also, the
    hardware doesn't seem to enforce this despite being required in the
    specification...

    Signed-off-by: Eddie James
    Signed-off-by: Joel Stanley

    Eddie James
     
  • In the case that links don't have slaves or fail to be accessed, the
    master should disable the link during the scan since it won't be using
    the slave.

    Signed-off-by: Eddie James
    Signed-off-by: Joel Stanley

    Eddie James
     
  • Add the ability to disable a link with a boolean parameter to the
    link_enable function. This is necessary so that the master can disable
    links that it isn't using; for example, links to slaves that fail
    initialization.

    Signed-off-by: Eddie James
    Signed-off-by: Joel Stanley

    Eddie James
     
  • In case of error, the function platform_device_register_full()
    returns ERR_PTR() and never returns NULL. The NULL test in the
    return value check should be replaced with IS_ERR().

    Signed-off-by: Xu Wang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Joel Stanley

    Xu Wang
     
  • In order to access more than the second hub link, 23-bit addressing is
    required. The core provides the highest two bits of address as the slave
    ID to the master.

    Signed-off-by: Eddie James
    Acked-by: Jeremy Kerr
    Signed-off-by: Joel Stanley

    Eddie James
     
  • There is a spelling mistake in a dev_err error message. Fix it.

    Signed-off-by: Colin Ian King
    Reviewed-by: Andrew Jeffery
    Signed-off-by: Joel Stanley

    Colin Ian King
     

14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Feb, 2020

1 commit

  • Currently CONFIG_FSI_MASTER_ASPEED=y implicitly depends on
    CONFIG_HAS_IOMEM=y; consequently, on architectures without IOMEM we get
    the following build error:

    ld: drivers/fsi/fsi-master-aspeed.o: in function `fsi_master_aspeed_probe':
    drivers/fsi/fsi-master-aspeed.c:436: undefined reference to `devm_ioremap_resource'

    Fix the build error by adding the unspecified dependency.

    Fixes: 606397d67f41 ("fsi: Add ast2600 master driver")
    Cc: stable@vger.kernel.org
    Reported-by: Brendan Higgins
    Signed-off-by: Brendan Higgins
    Reviewed-by: Joel Stanley
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20200131034832.294268-1-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman

    Brendan Higgins
     

08 Nov, 2019

8 commits

  • The data byte order selection registers in the APB2OPB primarily expose some
    internal plumbing necessary to get correct write accesses onto the OPB.
    OPB write cycles require "data mirroring" across the 32-bit data bus to
    support variable data width slaves that don't implement "byte enables".
    For slaves that do implement byte enables the master can signal which
    bytes on the data bus the slave should consider valid.

    The data mirroring behaviour is specified by the following table:

    +-----------------+----------+-----------------------------------+
    | | | 32-bit Data Bus |
    +---------+-------+----------+---------+---------+-------+-------+
    | | | | | | | |
    | ABus | Mn_BE | Request | Dbus | Dbus | Dbus | Dbus |
    | (30:31) | (0:3) | Transfer | 0:7 | 8:15 | 16:23 | 24:31 |
    | | | Size | byte0 | byte1 | byte2 | byte3 |
    +---------+-------+----------+---------+---------+-------+-------+
    | 00 | 1111 | fullword | byte0 | byte1 | byte2 | byte3 |
    +---------+-------+----------+---------+---------+-------+-------+
    | 00 | 1110 | halfword | byte0 | byte1 | byte2 | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 01 | 0111 | byte | _byte1_ | byte1 | byte2 | byte3 |
    +---------+-------+----------+---------+---------+-------+-------+
    | 00 | 1100 | halfword | byte0 | byte1 | | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 01 | 0110 | byte | _byte1_ | byte1 | byte2 | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 10 | 0011 | halfword | _byte2_ | _byte3_ | byte2 | byte3 |
    +---------+-------+----------+---------+---------+-------+-------+
    | 00 | 1000 | byte | byte0 | | | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 01 | 0100 | byte | _byte1_ | byte1 | | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 10 | 0010 | byte | _byte2_ | | byte2 | |
    +---------+-------+----------+---------+---------+-------+-------+
    | 11 | 0001 | byte | _byte3_ | _byte3_ | | byte3 |
    +---------+-------+----------+---------+---------+-------+-------+

    Mirrored data values are highlighted by underscores in the Dbus columns.
    The values in the ABus and Request Transfer Size columns correspond to
    values in the field names listed in the write data order select register
    descriptions.

    Similar configuration registers are exposed for reads which enables the
    secondary purpose of configuring hardware endian conversions. It appears the
    data bus byte order is switched around in hardware so set the registers such
    that we can access the correct values for all widths. The values were
    determined by experimentation on hardware against fixed CFAM register
    values to configure the read data order, then in combination with the
    table above and the register layout documentation in the AST2600
    datasheet performing write/read cycles to configure the write data order
    registers.

    Signed-off-by: Andrew Jeffery
    Signed-off-by: Joel Stanley
    Acked-by: Alistair Popple
    Link: https://lore.kernel.org/r/20191108051945.7109-12-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman

    Andrew Jeffery
     
  • These trace points help with debugging the FSI master. They show the low
    level reads, writes and error states of the master.

    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20191108051945.7109-11-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     
  • The ast2600 BMC has a pair of FSI masters in it, behind an AHB to OPB
    bridge.

    The master driver supports reads and writes of full words, half word and
    byte accesses to remote CFAMs. It can perform very basic error recovery
    through resetting of the FSI port when an error is detected, and the
    issuing of breaks and terms.

    Signed-off-by: Joel Stanley
    Acked-by: Alistair Popple
    --
    v2:
    - remove debugging
    - squash in fixes
    Link: https://lore.kernel.org/r/20191108051945.7109-10-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     
  • The FSI master registers are common to the hub and AST2600 master (and
    the FSP2, if someone was to upstream a driver for that).

    Add defines to the fsi-master.h header, and introduce headings to
    delineate the existing low level details.

    Acked-by: Andrew Jeffery
    Acked-by: Jeremy Kerr
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20191108051945.7109-8-joel@jms.id.au
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     
  • 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

    kbuild test robot
     
  • 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 | 1

    We 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

    Andrew Jeffery
     
  • 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

    Jeremy Kerr
     
  • 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

    Jeremy Kerr
     

29 Aug, 2019

1 commit

  • The scom driver currently fails out of operations if certain system
    errors are flagged in the status register; system checkstop, special
    attention, or recoverable error. These errors won't impact the ability
    of the scom engine to perform operations, so the driver should continue
    under these conditions.
    Also, don't do a PIB reset for these conditions, since it won't help.

    Fixes: 6b293258cded ("fsi: scom: Major overhaul")
    Signed-off-by: Eddie James
    Cc: stable
    Acked-by: Jeremy Kerr
    Acked-by: Benjamin Herrenschmidt
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20190827041249.13381-1-jk@ozlabs.org
    Signed-off-by: Greg Kroah-Hartman

    Eddie James
     

04 Jul, 2019

1 commit

  • SBE fifo operations should be allowed while the SBE is in any of the
    "IPL" states. Operations should succeed in this state.

    Fixes: 9f4a8a2d7f9d fsi/sbefifo: Add driver for the SBE FIFO
    Reviewed-by: Joel Stanley
    Tested-by: Alistair Popple
    Signed-off-by: Eddie James
    Link: https://lore.kernel.org/r/1561575415-3282-1-git-send-email-eajames@linux.ibm.com
    Signed-off-by: Greg Kroah-Hartman

    Eddie James
     

03 Jul, 2019

3 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

    Greg Kroah-Hartman
     
  • 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

    Jeremy Kerr
     
  • Sequence numbering of the commands submitted to the OCC is required by
    the OCC interface specification. Add sequence numbering and check for
    the correct sequence number on the response.

    Signed-off-by: Eddie James
    Acked-by: Guenter Roeck
    Reviewed-by: Lei YU
    Signed-off-by: Joel Stanley

    Eddie James
     

23 Jun, 2019

1 commit


20 Jun, 2019

1 commit

  • This patch corrects the SPDX License Identifier style
    in header file related to Drivers for FRU Support Interface.
    For C header files Documentation/process/license-rules.rst
    mandates C-like comments (opposed to C source files where
    C++ style should be used)

    Changes made by using a script provided by Joe Perches here:
    https://lkml.org/lkml/2019/2/7/46

    Suggested-by: Joe Perches
    Signed-off-by: Nishad Kamdar
    Signed-off-by: Greg Kroah-Hartman

    Nishad Kamdar
     

19 Jun, 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 mergchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 2 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Enrico Weigelt
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081202.997941624@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

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 details

    extracted 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

    Thomas Gleixner
     

21 May, 2019

2 commits


03 Dec, 2018

1 commit

  • The OCC is a device embedded on a POWER processor that collects and
    aggregates sensor data from the processor and system. The OCC can
    provide the raw sensor data as well as perform thermal and power
    management on the system.

    This driver provides an atomic communications channel between a service
    processor (e.g. a BMC) and the OCC. The driver is dependent on the FSI
    SBEFIFO driver to get hardware access through the SBE to the OCC SRAM.
    Commands are issued to the SBE to send or fetch data to the SRAM.

    Signed-off-by: Eddie James
    Signed-off-by: Andrew Jeffery
    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Joel Stanley
    Signed-off-by: Guenter Roeck

    Eddie James
     

26 Nov, 2018

2 commits

  • Remove linux/cdev.h which is included more than once

    Signed-off-by: Brajeswar Ghosh
    Signed-off-by: Benjamin Herrenschmidt

    Brajeswar Ghosh
     
  • In randconfig builds without CONFIG_GENERIC_ALLOCATOR, this driver
    fails to link:

    ERROR: "gen_pool_alloc_algo" [drivers/fsi/fsi-master-ast-cf.ko] undefined!
    ERROR: "gen_pool_fixed_alloc" [drivers/fsi/fsi-master-ast-cf.ko] undefined!
    ERROR: "of_gen_pool_get" [drivers/fsi/fsi-master-ast-cf.ko] undefined!
    ERROR: "gen_pool_free" [drivers/fsi/fsi-master-ast-cf.ko] undefined!

    Select the dependency as all other users do.

    Fixes: 6a794a27daca ("fsi: master-ast-cf: Add new FSI master using Aspeed ColdFire")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Benjamin Herrenschmidt

    Arnd Bergmann
     

24 Oct, 2018

1 commit

  • In the iov_iter struct, separate the iterator type from the iterator
    direction and use accessor functions to access them in most places.

    Convert a bunch of places to use switch-statements to access them rather
    then chains of bitwise-AND statements. This makes it easier to add further
    iterator types. Also, this can be more efficient as to implement a switch
    of small contiguous integers, the compiler can use ~50% fewer compare
    instructions than it has to use bitwise-and instructions.

    Further, cease passing the iterator type into the iterator setup function.
    The iterator function can set that itself. Only the direction is required.

    Signed-off-by: David Howells

    David Howells