07 Jul, 2022

1 commit

  • commit 62f79f3d0eb9f4c224bcc3c7f6fa758515a0a7fa upstream.

    Set and increment the sequence number during the submit operation.
    This prevents sequence number conflicts between different users of
    the interface. A sequence number conflict may result in a user
    getting an OCC response meant for a different command. Since the
    sequence number is now modified, the checksum must be calculated and
    set before submitting the command.

    Signed-off-by: Eddie James
    Reviewed-by: Joel Stanley
    Link: https://lore.kernel.org/r/20210721190231.117185-2-eajames@linux.ibm.com
    Signed-off-by: Joel Stanley
    Signed-off-by: Greg Kroah-Hartman

    Eddie James
     

08 Apr, 2022

3 commits

  • [ Upstream commit 83ba7e895debc529803a7a258653f2fe9bf3bf40 ]

    A struct device can never be devm_alloc()'ed.
    Here, it is embedded in "struct fsi_master", and "struct fsi_master" is
    embedded in "struct fsi_master_aspeed".

    Since "struct device" is embedded, the data structure embedding it must be
    released with the release function, as is already done here.

    So use kzalloc() instead of devm_kzalloc() when allocating "aspeed" and
    update all error handling branches accordingly.

    This prevent a potential double free().

    This also fix another issue if opb_readl() fails. Instead of a direct
    return, it now jumps in the error handling path.

    Fixes: 606397d67f41 ("fsi: Add ast2600 master driver")
    Suggested-by: Greg KH
    Suggested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck
    Signed-off-by: Christophe JAILLET
    Link: https://lore.kernel.org/r/2c123f8b0a40dc1a061fae982169fe030b4f47e6.1641765339.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Christophe JAILLET
     
  • [ Upstream commit ab1b79159ad5a6dc4e4994b49737f7feb13b7155 ]

    In commit f72ddbe1d7b7 ("fsi: scom: Remove retries") the retries were
    removed from get and put scoms. That patch missed the retires in get and
    put indirect scom.

    For the same reason, remove them from the scom driver to allow the
    caller to decide to retry.

    This removes the following special case which would have caused the
    retry code to return early:

    - if ((ind_data & XSCOM_DATA_IND_COMPLETE) || (err != SCOM_PIB_BLOCKED))
    - return 0;

    I believe this case is handled.

    Fixes: f72ddbe1d7b7 ("fsi: scom: Remove retries")
    Signed-off-by: Joel Stanley
    Reviewed-by: Eddie James
    Link: https://lore.kernel.org/r/20211207033811.518981-3-joel@jms.id.au
    Signed-off-by: Joel Stanley
    Signed-off-by: Sasha Levin

    Joel Stanley
     
  • [ Upstream commit d46fddd52d11eb6a3a7ed836f9f273e9cf8cd01c ]

    SCOM error handling is made complex by trying to pass around two bits of
    information: the function return code, and a status parameter that
    represents the CFAM error status register.

    The commit f72ddbe1d7b7 ("fsi: scom: Remove retries") removed the
    "hidden" retries in the SCOM driver, in preference of allowing the
    calling code (userspace or driver) to decide how to handle a failed
    SCOM. However it introduced a bug by attempting to be smart about the
    return codes that were "errors" and which were ok to fall through to the
    status register parsing.

    We get the following errors:

    - EINVAL or ENXIO, for indirect scoms where the value is invalid
    - EINVAL, where the size or address is incorrect
    - EIO or ETIMEOUT, where FSI write failed (aspeed master)
    - EAGAIN, where the master detected a crc error (GPIO master only)
    - EBUSY, where the bus is disabled (GPIO master in external mode)

    In all of these cases we should fail the SCOM read/write and return the
    error.

    Thanks to Dan Carpenter for the detailed bug report.

    Fixes: f72ddbe1d7b7 ("fsi: scom: Remove retries")
    Link: https://lists.ozlabs.org/pipermail/linux-fsi/2021-November/000235.html
    Reported-by: Dan Carpenter
    Signed-off-by: Joel Stanley
    Reviewed-by: Eddie James
    Link: https://lore.kernel.org/r/20211207033811.518981-2-joel@jms.id.au
    Signed-off-by: Joel Stanley
    Signed-off-by: Sasha Levin

    Joel Stanley
     

04 Jun, 2021

12 commits

  • On BMCs with lower timer resolution than 1ms, msleep(1) will take
    way longer than 1ms, so looping 10k times won't wait for 10s but
    significantly longer.

    Fix this by using jiffies like the rest of the code.

    Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO")
    Signed-off-by: Joachim Fenkes
    Link: https://lore.kernel.org/r/20200724071518.430515-3-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joachim Fenkes
     
  • When the SBE requests a reset via the down FIFO, that is also the
    FIFO we should go and reset ;)

    Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO")
    Signed-off-by: Joachim Fenkes
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20200724071518.430515-2-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joachim Fenkes
     
  • When devm_ioremap_resource() fails, a clear enough error message will be
    printed by its subfunction __devm_ioremap_resource(). The error
    information contains the device name, failure cause, and possibly resource
    information.

    Therefore, remove the error printing here to simplify code and reduce the
    binary size.

    Reported-by: Hulk Robot
    Signed-off-by: Zhen Lei
    Link: https://patchwork.ozlabs.org/project/linux-fsi/patch/20210511085745.4340-1-thunder.leizhen@huawei.com/
    Signed-off-by: Joel Stanley

    Zhen Lei
     
  • The lengthy timeout previously used sometimes resulted in
    scheduling problems, detailed below. Therefore reduce the timeout
    to 500us. This timeout selection is supported by the benchmarks
    collected below with various clock dividers. This is purely the time
    spent polling (reported by ktime_get()).

    div 1: max:150us avg: 2us
    div 2: max:155us avg: 3us
    div 4: max:149us avg: 7us
    div 8: max:153us avg: 13us
    div 16: max:197us avg: 21us
    div 32: max:181us avg: 50us
    div 64: max:262us avg:100us

    Jan 22 01:27:21 rain27bmc kernel: rcu: INFO: rcu_sched self-detected stall on CPU
    Jan 22 01:27:21 rain27bmc kernel: rcu: 0-....: (2099 ticks this GP) idle=0ca/1/0x40000002 softirq=349573/349573 fqs=1048
    Jan 22 01:27:21 rain27bmc kernel: (t=2100 jiffies g=841149 q=7163)
    Jan 22 01:27:21 rain27bmc kernel: NMI backtrace for cpu 0
    Jan 22 01:27:21 rain27bmc kernel: CPU: 0 PID: 5959 Comm: ibm-read-vpd Not tainted 5.8.17-a9b4ea8 #1
    Jan 22 01:27:21 rain27bmc kernel: Hardware name: Generic DT based system
    Jan 22 01:27:21 rain27bmc kernel: Backtrace:
    Jan 22 01:27:25 rain27bmc kernel: [] (dump_backtrace) from [] (show_stack+0x20/0x24)
    ...
    Jan 22 01:27:25 rain27bmc kernel: [] (gic_handle_irq) from [] (__irq_svc+0x6c/0x90)
    Jan 22 01:27:25 rain27bmc kernel: Exception stack(0xb79159b0 to 0xb79159f8)
    Jan 22 01:27:25 rain27bmc kernel: 59a0: 9e88e5d5 00000559 00000559 00000018
    Jan 22 01:27:25 rain27bmc kernel: 59c0: 00000000 9f217c55 00000003 00000559 a0201c00 bfa4d048 bfa4d000 b7915a44
    Jan 22 01:27:25 rain27bmc kernel: 59e0: 40e88f8a b7915a00 3254e553 80734924 80030113 ffffffff
    Jan 22 01:27:25 rain27bmc kernel: r9:b7914000 r8:a0201c00 r7:b79159e4 r6:ffffffff r5:80030113 r4:80734924
    Jan 22 01:27:25 rain27bmc kernel: [] (__opb_read) from [] (aspeed_master_read+0xbc/0xcc)
    Jan 22 01:27:25 rain27bmc kernel: r10:00000004 r9:00000002 r8:80734cdc r7:bd33fa40 r6:00000004 r5:bd33f840
    Jan 22 01:27:25 rain27bmc kernel: r4:00201c00
    Jan 22 01:27:25 rain27bmc kernel: [] (aspeed_master_read) from [] (fsi_master_read+0x6c/0x1bc)
    ...

    Signed-off-by: Eddie James
    Link: https://lore.kernel.org/r/20210211194846.35475-1-eajames@linux.ibm.com
    Signed-off-by: Joel Stanley

    Eddie James
     
  • Use devm_platform_ioremap_resource() to simplify code.

    Signed-off-by: Yangtao Li
    Reviewed-by: Andrew Jeffery
    Link: https://lore.kernel.org/r/20191228190631.26777-1-tiny.windzz@gmail.com
    Signed-off-by: Joel Stanley

    Yangtao Li
     
  • Log an error if the response checksum doesn't match the
    calculated checksum.

    Signed-off-by: Eddie James
    Reviewed-by: Joel Stanley
    Link: https://lore.kernel.org/r/20210209171235.20624-3-eajames@linux.ibm.com
    Signed-off-by: Joel Stanley

    Eddie James
     
  • If the OCC is not initialized and responds as such, the driver
    should continue waiting for a valid response until the timeout
    expires.

    Signed-off-by: Eddie James
    Reviewed-by: Joel Stanley
    Fixes: 7ed98dddb764 ("fsi: Add On-Chip Controller (OCC) driver")
    Link: https://lore.kernel.org/r/20210209171235.20624-2-eajames@linux.ibm.com
    Signed-off-by: Joel Stanley

    Eddie James
     
  • On a functioning FSI link there is not need to retry a write when doing
    a scom in the driver.

    Allow the higher layers (eg. userspace) to attempt a retry if they want,
    or to accept that the address they are talking to is not accessible.

    By removing the retries we can separate the error handling from retry
    logic. In particular -EBUSY was used to force the get/put scom logic to
    retry.

    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20210527070109.225198-1-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • The error bits in the FSI2PIB status are only cleared by a reset. So
    the driver needs to perform a reset after seeing any of the FSI2PIB
    errors, otherwise subsequent operations will also look like failures.

    Fixes: 6b293258cded ("fsi: scom: Major overhaul")
    Signed-off-by: Eddie James
    Reviewed-by: Joel Stanley
    Link: https://lore.kernel.org/r/20210329151344.14246-1-eajames@linux.ibm.com
    Signed-off-by: Joel Stanley

    Eddie James
     
  • When setting up a read or write to the OPB memory space, we must perform
    five or six AHB writes. The ordering of these up until the trigger write
    does not matter, so use writel_relaxed.

    The generated code goes from (Debian GCC 10.2.1-6):

    mov r8, r3
    mcr 15, 0, sl, cr7, cr10, {4}
    str sl, [r6, #20]
    mcr 15, 0, sl, cr7, cr10, {4}
    str r3, [r6, #24]
    mcr 15, 0, sl, cr7, cr10, {4}
    str r1, [r6, #28]
    mcr 15, 0, sl, cr7, cr10, {4}
    str r2, [r6, #32]
    mcr 15, 0, sl, cr7, cr10, {4}
    mov r1, #1
    str r1, [r6, #64] ; 0x40
    mcr 15, 0, sl, cr7, cr10, {4}
    str r1, [r6, #4]

    to this:

    str r3, [r7, #20]
    str r2, [r7, #24]
    str r1, [r7, #28]
    str r3, [r7, #64]
    mov r8, #0
    mcr 15, 0, r8, cr7, cr10, {4}
    str r3, [r7, #4]

    Signed-off-by: Joel Stanley
    Acked-by: Jeremy Kerr
    Reviewed-by: Eddie James
    Tested-by: Eddie James
    Link: https://lore.kernel.org/r/20210223041737.171274-1-joel@jms.id.au
    Signed-off-by: Joel Stanley

    Joel Stanley
     
  • Currently the cfam_read and cfam_write functions return the provided
    number of bytes given in the count parameter and not the error return
    code in variable rc, hence all failures of read/writes are being
    silently ignored. Fix this by returning the error code in rc.

    Addresses-Coverity: ("Unused value")
    Fixes: d1dcd6782576 ("fsi: Add cfam char devices")
    Signed-off-by: Colin Ian King
    Reviewed-by: Jeremy Kerr
    Link: https://lore.kernel.org/r/20210603122812.83587-1-colin.king@canonical.com
    Signed-off-by: Joel Stanley

    Colin Ian King
     
  • This patch adds missing MODULE_DEVICE_TABLE definition which generates
    correct modalias for automatic loading of this driver when it is built
    as an external module.

    Reported-by: Hulk Robot
    Signed-off-by: Zou Wei
    Link: https://lore.kernel.org/r/1620896249-52769-1-git-send-email-zou_wei@huawei.com
    Signed-off-by: Joel Stanley

    Zou Wei
     

16 Dec, 2020

1 commit

  • Pull hwmon updates from Guenter Roeck:
    "New drivers:
    - SB-TSI sensors
    - Lineat Technology LTC2992
    - Delta power supplies Q54SJ108A2
    - Maxim MAX127
    - Corsair PSU
    - STMicroelectronics PM6764 Voltage Regulator

    New chip support:
    - P10 added to fsi/occ driver
    - NCT6687D added to nct6883 driver
    - Intel-based Xserves added to applesmc driver
    - AMD family 19h model 01h added to amd_energy driver

    And various minor bug fixes and improvements"

    * tag 'hwmon-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (41 commits)
    dt-bindings: (hwmon/sbtsi_temp) Add SB-TSI hwmon driver bindings
    hwmon: (sbtsi) Add documentation
    hwmon: (sbtsi) Add basic support for SB-TSI sensors
    hwmon: (iio_hwmon) Drop bogus __refdata annotation
    hwmon: (xgene) Drop bogus __refdata annotation
    dt-bindings: hwmon: convert AD ADM1275 bindings to dt-schema
    hwmon: (occ) Add new temperature sensor type
    fsi: occ: Add support for P10
    dt-bindings: fsi: Add P10 OCC device documentation
    dt-bindings: hwmon: convert TI ADS7828 bindings to dt-schema
    dt-bindings: hwmon: convert AD AD741x bindings to dt-schema
    dt-bindings: hwmon: convert TI INA2xx bindings to dt-schema
    hwmon: (ltc2992) Fix less than zero comparisons with an unsigned integer
    hwmon: (pmbus/q54sj108a2) Correct title underline length
    dt-bindings: hwmon: Add documentation for ltc2992
    hwmon: (ltc2992) Add support for GPIOs.
    hwmon: (ltc2992) Add support
    hwmon: (pmbus) Driver for Delta power supplies Q54SJ108A2
    hwmon: Add driver for STMicroelectronics PM6764 Voltage Regulator
    hwmon: (nct6683) Support NCT6687D.
    ...

    Linus Torvalds
     

11 Dec, 2020

1 commit

  • The P10 OCC has a different SRAM address for the command and response
    buffers. In addition, the SBE commands to access the SRAM have changed
    format. Add versioning to the driver to handle these differences.

    Signed-off-by: Eddie James
    Reviewed-by: Joel Stanley
    Signed-off-by: Joel Stanley
    Link: https://lore.kernel.org/r/20201120010315.190737-3-joel@jms.id.au
    Signed-off-by: Guenter Roeck

    Eddie James
     

10 Dec, 2020

1 commit

  • 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

    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

5 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