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 v2 1/6] Marvell/Armada7k8k: RealTimeClockLib: Update bus parameters
Date: Tue, 16 Apr 2019 11:22:21 +0200 [thread overview]
Message-ID: <1555406546-5261-2-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1555406546-5261-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
next prev parent reply other threads:[~2019-04-16 9:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 9:22 [edk2-platforms: PATCH v2 0/6] Armada7k8k misc improvements Marcin Wojtas
2019-04-16 9:22 ` Marcin Wojtas [this message]
2019-04-16 9:22 ` [edk2-platforms: PATCH v2 2/6] Marvell/Armada7k8k: AcpiTables: Enable edge trigger of PMU interrupt Marcin Wojtas
2019-04-16 9:22 ` [edk2-platforms: PATCH v2 3/6] Marvell/Armada7k8k: Implement PMU interrupt handling Marcin Wojtas
2019-04-16 18:51 ` Ard Biesheuvel
2019-04-16 9:22 ` [edk2-platforms: PATCH v2 4/6] Marvell/Armada7k8k: Switch to software-based watchdog Marcin Wojtas
2019-04-16 9:22 ` [edk2-platforms: PATCH v2 5/6] Marvell/Armada7k8k: ArmadaSoCDescLib: Add more I2C controllers Marcin Wojtas
2019-04-16 9:22 ` [edk2-platforms: PATCH v2 6/6] Marvell/Armada80x0Db: Configure the CP1, comphy-2 to work with SFI 10G Marcin Wojtas
2019-04-16 18:51 ` [edk2-platforms: PATCH v2 0/6] Armada7k8k misc improvements Ard Biesheuvel
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=1555406546-5261-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