public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marcin Wojtas" <mw@semihalf.com>
To: devel@edk2.groups.io
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
	nadavh@marvell.com, mw@semihalf.com, jsd@semihalf.com,
	jaz@semihalf.com, kostap@marvell.com, jeremy.linton@arm.com,
	Jici.Gao@arm.com, Mark Kettenis <kettenis@jive.eu>
Subject: [edk2-platforms: PATCH 1/6] Marvell/Armada7k8k: RealTimeClockLib: Update bus parameters
Date: Fri, 12 Apr 2019 12:19:31 +0200	[thread overview]
Message-ID: <1555064376-22302-2-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1555064376-22302-1-git-send-email-mw@semihalf.com>

From: Mark Kettenis <kettenis@jive.eu>

Adjust bus timing parameters to make reading and updating the RTC
reliable.

This patch aligns the bus configuration to the one used by Linux.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.h | 7 ++++++-
 Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.h
index 922f959..ee0c303 100644
--- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.h
+++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.h
@@ -41,10 +41,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define RTC_IRQ_2_CONFIG_REG                    0x8
 #define RTC_IRQ_ALARM_EN                        0x1
 #define RTC_ALARM_2_REG                         0x14
+#define RTC_BRIDGE_TIMING_CTRL0_REG_OFFS        0x80
 #define RTC_BRIDGE_TIMING_CTRL1_REG_OFFS        0x84
 #define RTC_IRQ_STATUS_REG                      0x90
 #define RTC_IRQ_ALARM_MASK                      0x1
+#define RTC_WRITE_PERIOD_DELAY_MASK             0xFFFF
+#define RTC_WRITE_PERIOD_DELAY_DEFAULT          0x3FF
+#define RTC_WRITE_SETUP_DELAY_MASK              (0xFFFF << 16)
+#define RTC_WRITE_SETUP_DELAY_DEFAULT           (0x29 << 16)
 #define RTC_READ_OUTPUT_DELAY_MASK              0xFFFF
-#define RTC_READ_OUTPUT_DELAY_DEFAULT           0x1F
+#define RTC_READ_OUTPUT_DELAY_DEFAULT           0x3F
 
 #endif /* __RTCLIB_H__ */
diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
index 087bd9a..7de5ed7 100644
--- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
+++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c
@@ -250,6 +250,11 @@ LibRtcInitialize (
 
   /* Update RTC-MBUS bridge timing parameters */
   MmioAndThenOr32 (
+          mArmadaRtcBase + RTC_BRIDGE_TIMING_CTRL0_REG_OFFS,
+          ~(RTC_WRITE_SETUP_DELAY_MASK | RTC_WRITE_PERIOD_DELAY_MASK),
+          (RTC_WRITE_SETUP_DELAY_DEFAULT | RTC_WRITE_PERIOD_DELAY_DEFAULT)
+          );
+  MmioAndThenOr32 (
           mArmadaRtcBase + RTC_BRIDGE_TIMING_CTRL1_REG_OFFS,
           ~RTC_READ_OUTPUT_DELAY_MASK,
           RTC_READ_OUTPUT_DELAY_DEFAULT
-- 
2.7.4


  reply	other threads:[~2019-04-12 10:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 10:19 [edk2-platforms: PATCH 0/6] Armada7k8k misc improvements Marcin Wojtas
2019-04-12 10:19 ` Marcin Wojtas [this message]
2019-04-12 10:19 ` [edk2-platforms: PATCH 2/6] Marvell/Armada7k8k: AcpiTables: Enable edge trigger of PMU interrupt Marcin Wojtas
2019-04-12 10:19 ` [edk2-platforms: PATCH 3/6] Marvell/Armada7k8k: Implement custom DtLoaderLib Marcin Wojtas
2019-04-12 21:14   ` Ard Biesheuvel
2019-04-15  9:52     ` Marcin Wojtas
2019-04-15 19:01       ` Ard Biesheuvel
2019-04-16  4:54         ` Marcin Wojtas
2019-04-16  5:01           ` Ard Biesheuvel
2019-04-16  5:49             ` Marcin Wojtas
2019-04-12 10:19 ` [edk2-platforms: PATCH 4/6] Marvell/Armada7k8k: Switch to software-based watchdog Marcin Wojtas
2019-04-12 10:19 ` [edk2-platforms: PATCH 5/6] Marvell/Armada7k8k: ArmadaSoCDescLib: Add more I2C controllers Marcin Wojtas
2019-04-12 10:19 ` [edk2-platforms: PATCH 6/6] Marvell/Armada80x0Db: Configure the CP1, comphy-2 to work with SFI 10G Marcin Wojtas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1555064376-22302-2-git-send-email-mw@semihalf.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox