Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel Updates for SDHCI and UART2 + Buildroot Updates #3

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/buildroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,20 @@ jobs:
xz -z sdcard.img
mv sdcard.img.xz sdcard-${{ matrix.target }}.img.xz
fi
if [ -f Image ]; then
mv Image Image-${{ matrix.target }}
if [ -f Image.lz4 ]; then
mv Image.lz4 Image-${{ matrix.target }}.lz4
fi
echo "PACKAGE=${{ github.workspace }}/buildroot/output/images/sdcard-${{ matrix.target }}.img.xz" >> $GITHUB_ENV
echo "KERNEL=${{ github.workspace }}/buildroot/output/images/Image-${{ matrix.target }}" >> $GITHUB_ENV
echo "KERNEL=${{ github.workspace }}/buildroot/output/images/Image-${{ matrix.target }}.lz4" >> $GITHUB_ENV
echo "DTB=${{ github.workspace }}/buildroot/output/images/bl808-*.dtb" >> $GITHUB_ENV
- name: Upload package
uses: actions/upload-artifact@master
with:
name: build artifacts
path: |
${{env.PACKAGE}}
${{env.KERNEL}}
${{env.DTB}}
lowload:
runs-on: ubuntu-22.04
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -173,7 +175,7 @@ jobs:
steps:
- name: install dependencies
run: |
sudo apt-get install -y python3 lz4
sudo apt-get install -y python3
- name: Checkout OpenBouffalo Buildroot
uses: actions/checkout@v3
with:
Expand All @@ -186,8 +188,6 @@ jobs:
- name: Create images
run: |
cd ${{ github.workspace }}/build
lz4 -9 -f Image-${{ matrix.target }} Image.lz4
cp ${{ github.workspace }}/buildroot_bouffalo/board/pine64/ox64/bl808-pine64-ox64.dtb .
${{ github.workspace }}/buildroot_bouffalo/package/mergebin/mergebin.py
mkdir firmware
cp d0_lowload/build/build_out/*.bin firmware/
Expand Down
Binary file removed board/pine64/ox64/bl808-pine64-ox64.dtb
Binary file not shown.
60 changes: 0 additions & 60 deletions board/pine64/ox64/bl808-pine64-ox64.dts

This file was deleted.

3 changes: 2 additions & 1 deletion board/pine64/ox64/linux_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,5 @@ CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_BFLB=y
CONFIG_GENERIC_IRQ_DEBUGFS=y
CONFIG_MAILBOX=y
CONFIG_BFLB_IPC=y
CONFIG_BFLB_IPC=y
CONFIG_EXT4_FS=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 1561f91d7f7f2952f3789b560144cdd56180bfb4 Mon Sep 17 00:00:00 2001
From: Allen Martin <[email protected]>
Date: Fri, 13 Jan 2023 03:02:41 -0800
Subject: [PATCH 16/26] disable card detection/dma/cap clock quirks

---
drivers/mmc/host/sdhci-bflb.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bflb.c b/drivers/mmc/host/sdhci-bflb.c
index a67ecb2a380d..c9141ddd7331 100644
--- a/drivers/mmc/host/sdhci-bflb.c
+++ b/drivers/mmc/host/sdhci-bflb.c
@@ -55,11 +55,7 @@ static const struct sdhci_pltfm_data sdhci_bflb_pdata = {
.quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
SDHCI_QUIRK_NO_BUSY_IRQ |
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
- SDHCI_QUIRK_NO_HISPD_BIT |
- SDHCI_QUIRK_BROKEN_CARD_DETECTION |
- SDHCI_QUIRK_BROKEN_DMA |
- SDHCI_QUIRK_BROKEN_ADMA |
- SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+ SDHCI_QUIRK_NO_HISPD_BIT,
};

static int sdhci_bflb_probe(struct platform_device *pdev)
--
2.25.1

125 changes: 125 additions & 0 deletions board/pine64/ox64/patches/linux/0014-UART2-working-under-Linux.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
From d0578027489b1e697a1910b7182d152a136c0a4e Mon Sep 17 00:00:00 2001
From: Alexander Horner <[email protected]>
Date: Sat, 14 Jan 2023 00:05:40 +0000
Subject: [PATCH 17/26] UART2 working under Linux!

---
arch/riscv/boot/dts/bouffalolab/Makefile | 1 +
.../dts/bouffalolab/bl808-pine64-ox64.dts | 60 +++++++++++++++++++
arch/riscv/boot/dts/bouffalolab/bl808.dtsi | 13 +++-
include/dt-bindings/mailbox/bflb-ipc.h | 1 +
4 files changed, 74 insertions(+), 1 deletion(-)
create mode 100644 arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts

diff --git a/arch/riscv/boot/dts/bouffalolab/Makefile b/arch/riscv/boot/dts/bouffalolab/Makefile
index 42e17e1a97bd..bc7aad3d5604 100644
--- a/arch/riscv/boot/dts/bouffalolab/Makefile
+++ b/arch/riscv/boot/dts/bouffalolab/Makefile
@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_SOC_BOUFFALOLAB) += bl808-sipeed-m1s.dtb
+dtb-$(CONFIG_SOC_BOUFFALOLAB) += bl808-pine64-ox64.dtb
diff --git a/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts b/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts
new file mode 100644
index 000000000000..a3b1ae9f0478
--- /dev/null
+++ b/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2022 Jisheng Zhang <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "bl808.dtsi"
+
+/ {
+ model = "Pine64 Ox64";
+ compatible = "sipeed,m1s", "bouffalolab,bl808";
+
+ aliases {
+ serial0 = &uart0;
+ serial1 = &uart1;
+ };
+
+ chosen {
+ stdout-path = "serial0:2000000n8";
+ bootargs = "console=ttyS0,2000000 loglevel=8 earlycon=sbi root=/dev/mtdblock0 ro rootfstype=squashfs";
+ linux,initrd-start = <0x0 0x52000000>;
+ linux,initrd-end = <0x0 0x52941784>;
+ };
+
+ memory@50000000 {
+ device_type = "memory";
+ reg = <0x50000000 0x04000000>;
+ };
+
+ xip_flash@58500000 {
+ compatible = "mtd-rom";
+ reg = <0x58500000 0x400000>;
+ linux,mtd-name = "xip-flash.0";
+ erase-size = <0x10000>;
+ bank-width = <4>;
+
+ rootfs@0 {
+ label = "rootfs";
+ reg = <0x00000 0x280000>;
+ read-only;
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&uart1 {
+ status = "okay";
+};
+
+&sdhci0 {
+ status = "okay";
+};
+
+&ipclic {
+ status = "okay";
+};
diff --git a/arch/riscv/boot/dts/bouffalolab/bl808.dtsi b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
index 6f859194f82c..755071f80b59 100644
--- a/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
+++ b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
@@ -60,7 +60,18 @@ uart0: serial@30002000 {
clocks = <&xtal>;
status = "disabled";
};
-
+
+ uart1: serial@0x2000AA00 {
+ compatible = "bouffalolab,uart";
+ reg = <0x2000AA00 0x0100>;
+ interrupts-extended = <&ipclic BFLB_IPC_SOURCE_M0
+ BFLB_IPC_DEVICE_UART2
+ IRQ_TYPE_EDGE_RISING>;
+ mboxes = <&ipclic BFLB_IPC_SOURCE_M0 BFLB_IPC_DEVICE_UART2>;
+ clocks = <&xtal>;
+ status = "disabled";
+ };
+
sdhci0: sdhci@20060000 {
compatible = "bouffalolab,bflb-sdhci";
reg = <0x20060000 0x100>;
diff --git a/include/dt-bindings/mailbox/bflb-ipc.h b/include/dt-bindings/mailbox/bflb-ipc.h
index 1d4c4be6292e..e96fe62cbeb9 100644
--- a/include/dt-bindings/mailbox/bflb-ipc.h
+++ b/include/dt-bindings/mailbox/bflb-ipc.h
@@ -12,5 +12,6 @@

/* Peripheral device ID */
#define BFLB_IPC_DEVICE_SDHCI 0
+#define BFLB_IPC_DEVICE_UART2 1

#endif
--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From ffab227813189651186b3cf2cc568d365c0753d9 Mon Sep 17 00:00:00 2001
From: Allen Martin <[email protected]>
Date: Sat, 14 Jan 2023 17:59:13 -0800
Subject: [PATCH 18/26] dts: bl808: add fake sdh clock at 96MHz

---
arch/riscv/boot/dts/bouffalolab/bl808.dtsi | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/bouffalolab/bl808.dtsi b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
index 755071f80b59..ecb285cd7763 100644
--- a/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
+++ b/arch/riscv/boot/dts/bouffalolab/bl808.dtsi
@@ -45,6 +45,13 @@ xtal: xtal-clk {
#clock-cells = <0>;
};

+ sdh: sdh-clk {
+ compatible = "fixed-clock";
+ clock-frequency = <96000000>;
+ clock-output-names = "sdh";
+ #clock-cells = <0>;
+ };
+
soc {
compatible = "simple-bus";
ranges;
@@ -79,7 +86,7 @@ sdhci0: sdhci@20060000 {
BFLB_IPC_DEVICE_SDHCI
IRQ_TYPE_EDGE_RISING>;
mboxes = <&ipclic BFLB_IPC_SOURCE_M0 BFLB_IPC_DEVICE_SDHCI>;
- clocks = <&xtal>;
+ clocks = <&sdh>;
status = "disabled";
};

--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0f81618bb5609e7e79b3afb454e269a1f50c9952 Mon Sep 17 00:00:00 2001
From: Allen Martin <[email protected]>
Date: Sun, 15 Jan 2023 01:07:35 -0800
Subject: [PATCH 19/26] sdhci-bflb: enable additional quirks

Write protect polarity is confirmed backwards, the other quirks
may not be needed.
---
drivers/mmc/host/sdhci-bflb.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-bflb.c b/drivers/mmc/host/sdhci-bflb.c
index c9141ddd7331..f6cc40dcf614 100644
--- a/drivers/mmc/host/sdhci-bflb.c
+++ b/drivers/mmc/host/sdhci-bflb.c
@@ -55,6 +55,10 @@ static const struct sdhci_pltfm_data sdhci_bflb_pdata = {
.quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
SDHCI_QUIRK_NO_BUSY_IRQ |
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
+ SDHCI_QUIRK_BROKEN_DMA |
+ SDHCI_QUIRK_BROKEN_ADMA |
+ SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+ SDHCI_QUIRK_INVERTED_WRITE_PROTECT |
SDHCI_QUIRK_NO_HISPD_BIT,
};

--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 3eda4a6ac2bc9909e6fbd9204df0fe5747342e51 Mon Sep 17 00:00:00 2001
From: Alexander Horner <[email protected]>
Date: Sun, 15 Jan 2023 13:38:26 +0000
Subject: [PATCH 20/26] Disable flash rootfs for now, edit bootargs to use
SDHCI ext4 partition 1 rootfs

---
arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts b/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts
index a3b1ae9f0478..d3d228c3d8c0 100644
--- a/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts
+++ b/arch/riscv/boot/dts/bouffalolab/bl808-pine64-ox64.dts
@@ -18,7 +18,7 @@ aliases {

chosen {
stdout-path = "serial0:2000000n8";
- bootargs = "console=ttyS0,2000000 loglevel=8 earlycon=sbi root=/dev/mtdblock0 ro rootfstype=squashfs";
+ bootargs = "console=ttyS0,2000000 loglevel=8 earlycon=sbi root=/dev/mmcblk0p2 rootwait rootfstype=ext4";
linux,initrd-start = <0x0 0x52000000>;
linux,initrd-end = <0x0 0x52941784>;
};
@@ -35,11 +35,11 @@ xip_flash@58500000 {
erase-size = <0x10000>;
bank-width = <4>;

- rootfs@0 {
+ /*rootfs@0 {
label = "rootfs";
- reg = <0x00000 0x280000>;
+ reg = <0x00000 0x400000>;
read-only;
- };
+ };*/
};
};

--
2.25.1

Loading