1. 01 Jun, 2021 1 commit
    • Pali Rohár's avatar
      fix(plat/marvell/a3720/uart): fix configuring UART clock · b9185c75
      Pali Rohár authored
      
      
      When configuring the UART_BAUD_REG register, the function
      console_a3700_core_init() currently only changes the baud divisor field,
      leaving other fields to their previous value.
      
      This is incorrect, because the baud divisor is computed with the
      assumption that the parent clock rate is 25 MHz, and since the other
      fields in this register configure the parent clock, which could have
      been changed by U-Boot or Linux.
      
      Fix this function to also configure the other fields so that the UART
      parent clock is selected to be the xtal clock.
      
      For example without this change TF-A prints only
      
          ERROR: a3700_system_off needs to be implemented
      
      followed by garbage after plat_crash_console_init() is called.
      
      After applying this change instead of garbage it also print crash info:
      
          PANIC at PC : 0x0000000004023800
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: I72f338355cc60d939b8bb978d9c7fdd576416b81
      b9185c75
  2. 28 May, 2021 1 commit
    • Pali Rohár's avatar
      fix(plat/marvell/a3720/uart): fix UART clock rate value and divisor calculation · 66a77528
      Pali Rohár authored
      
      
      UART parent clock is by default the platform's xtal clock, which is
      25 MHz.
      
      The value defined in the driver, though, is 25.8048 MHz. This is a hack
      for the suboptimal divisor calculation
        Divisor = UART clock / (16 * baudrate)
      which does not use rounding division, resulting in a suboptimal value
      for divisor if the correct parent clock rate was used.
      
      Change the code for divisor calculation to
        Divisor = Round(UART clock / (16 * baudrate))
      and change the parent clock rate value to 25 MHz.
      
      The final UART divisor for default baudrate 115200 is not affected by
      this change.
      
      (Note that the parent clock rate should not be defined via a macro,
      since the xtal clock can also be 40 MHz. This is outside of the scope of
      this fix, though.)
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: Iaa401173df87aec94f2dd1b38a90fb6ed0bf0ec6
      66a77528
  3. 27 Apr, 2021 1 commit
    • Manish V Badarkhe's avatar
      fix(driver/auth): avoid NV counter upgrade without certificate validation · a2a5a945
      Manish V Badarkhe authored
      
      
      Platform NV counter get updated (if cert NV counter > plat NV counter)
      before authenticating the certificate if the platform specifies NV
      counter method before signature authentication in its CoT, and this
      provides an opportunity for a tempered certificate to upgrade the
      platform NV counter. This is theoretical issue, as in practice none
      of the standard CoT (TBBR, dualroot) or upstream platforms ones (NXP)
      exercised this issue.
      
      To fix this issue, modified the auth_nvctr method to do only NV
      counter check, and flags if the NV counter upgrade is needed or not.
      Then ensured that the platform NV counter gets upgraded with the NV
      counter value from the certificate only after that certificate gets
      authenticated.
      
      This change is verified manually by modifying the CoT that specifies
      certificate with:
      1. NV counter authentication before signature authentication
         method
      2. NV counter authentication method only
      
      Change-Id: I1ad17f1a911fb1035a1a60976cc26b2965b05166
      Signed-off-by: default avatarManish V Badarkhe <Manish.Badarkhe@arm.com>
      a2a5a945
  4. 20 Apr, 2021 26 commits
  5. 08 Apr, 2021 2 commits
  6. 06 Apr, 2021 3 commits
    • Pali Rohár's avatar
      drivers: marvell: comphy-a3700: Set TXDCLK_2X_SEL bit during PCIe initialization · 40d08192
      Pali Rohár authored
      
      
      Marvell Armada 3700 Functional Specifications, section 52.2 PCIe Link
      Initialization says that TXDCLK_2X_SEL bit needs to be enabled for PCIe
      Root Complex mode. Both U-Boot and Linux kernel support only Root Complex
      mode. Set this bit.
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: Id2a538c379b911b62597f9463b4842b7b5c24df7
      40d08192
    • Pali Rohár's avatar
      drivers: marvell: comphy-a3700: Set mask parameter for every reg_set call · ccec1bd5
      Pali Rohár authored
      
      
      The third argument of the reg_set() function has name 'mask', which
      indicates that it is a mask applied to the register value which is
      going to be updated. But the implementation of this function uses
      this argument to clear prior value of the register, i.e. instead of
        new_val = (old_val & ~mask) | (data & mask);
      it does
        new_val = (new_val & ~mask) | data;
      
      (The more proper name for this function should be reg_clrsetbits(),
       since internally it calls mmio_clrsetbits_32().)
      
      To make code more readable set 'mask' argument to real mask, i.e. bits
      of register values which are going to be updated.
      
      This patch does not make any functional change, only cosmetic, due to
      how 'mask' is interpreted.
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: Ifa0339e79c07d1994c7971b65d966b92cb735f65
      ccec1bd5
    • Pali Rohár's avatar
      drivers: marvell: comphy-a3700: Fix configuring polarity invert bits · ee4c70eb
      Pali Rohár authored
      
      
      TXD_INVERT_BIT or RXD_INVERT_BIT needs to be set only in case when
      appropriate polarity is inverted. Otherwise these bits should be
      cleared.
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: I8b09fab883a7b995fd72a7d8ae6233f0fa07011b
      ee4c70eb
  7. 01 Apr, 2021 1 commit
  8. 26 Mar, 2021 1 commit
    • Bharat Gooty's avatar
      driver: brcm: add i2c driver · 48c6a6b6
      Bharat Gooty authored
      
      
      Broadcom I2C controller driver. Follwoing API's are supported:-
      - i2c_init() Intialize ethe I2C controller
      - i2c_probe()
      - i2c_set_bus_speed() Set the I2C bus speed
      - i2c_get_bus_speed() Get the current bus speed
      - i2c_recv_byte() Receive one byte of data.
      - i2c_send_byte() Send one byteof data
      - i2c_read_byte() Read single byte of data
      - i2c_read() Read multiple bytes of data
      - i2c_write_byte Write single byte of data
      - i2c_write() Write multiple bytes of data
      
      This driver is verified by reading the DDR SPD data.
      Signed-off-by: default avatarBharat Gooty <bharat.gooty@broadcom.com>
      Change-Id: I2d7fe53950e8b12fab19d0293020523ff8b74e13
      48c6a6b6
  9. 24 Mar, 2021 4 commits