mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC 0/4] Run barebox on sc6531e-based feature phone
@ 2023-06-10 10:32 Antony Pavlov
  2023-06-10 10:32 ` [RFC 1/4] clocksource: add sc6531e driver Antony Pavlov
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-06-10 10:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This patch series adds initial support for SC6531E chip.

SC6431E chip is specially designed solution for creating
feature phones. It contains

  * ARM926EJ-S core (up to 208 MHz)
  * embedded PSRAM
  * peripherals: USB, SPI, UART, IIS, PCM, I2C, keypad, LCD
  * SIM card and GSM/GPRS/FM/BT stuff

This work is based on FPDoom, see [1], [2], [3] for details.

At the moment only timer and debug_ll output via USB
are supported.

After adding lcd and keypad driver running bareDOOM [4]
on SC6531E will be possible.

  [1] https://github.com/ilyakurdyukov/fpdoom
  [2] https://habr.com/ru/articles/706766/
  [3] https://www.youtube.com/watch?v=tln_Iace1O8
  [4] https://github.com/a3f/bareDOOM

Antony Pavlov (4):
  clocksource: add sc6531e driver
  ARM: add sc6531e and F+ Ezzy 4 phone support
  sc6531e: add debug_ll support
  Documentation: add sc6531e instructions

 Documentation/boards/sc6531e.rst          | 187 +++++++++
 arch/arm/Kconfig                          |  10 +
 arch/arm/Makefile                         |   1 +
 arch/arm/boards/Makefile                  |   1 +
 arch/arm/boards/ezzy-4/Makefile           |   6 +
 arch/arm/boards/ezzy-4/env/init/automount |  27 ++
 arch/arm/boards/ezzy-4/lowlevel.c         |  19 +
 arch/arm/boards/ezzy-4/usbio.c            | 449 ++++++++++++++++++++++
 arch/arm/configs/ezzy-4_defconfig         |  49 +++
 arch/arm/cpu/uncompress.c                 |   7 +
 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/ezzy-4.dts                   |  22 ++
 arch/arm/include/asm/debug_ll.h           |   2 +
 arch/arm/mach-sc6531e/Kconfig             |  17 +
 arch/arm/mach-sc6531e/Makefile            |   3 +
 drivers/clocksource/Makefile              |   1 +
 drivers/clocksource/timer-sc6531e.c       |  70 ++++
 include/mach/sc6531e/debug_ll.h           |  17 +
 18 files changed, 889 insertions(+)
 create mode 100644 Documentation/boards/sc6531e.rst
 create mode 100644 arch/arm/boards/ezzy-4/Makefile
 create mode 100644 arch/arm/boards/ezzy-4/env/init/automount
 create mode 100644 arch/arm/boards/ezzy-4/lowlevel.c
 create mode 100644 arch/arm/boards/ezzy-4/usbio.c
 create mode 100644 arch/arm/configs/ezzy-4_defconfig
 create mode 100644 arch/arm/dts/ezzy-4.dts
 create mode 100644 arch/arm/mach-sc6531e/Kconfig
 create mode 100644 arch/arm/mach-sc6531e/Makefile
 create mode 100644 drivers/clocksource/timer-sc6531e.c
 create mode 100644 include/mach/sc6531e/debug_ll.h

-- 
2.39.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC 1/4] clocksource: add sc6531e driver
  2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
@ 2023-06-10 10:32 ` Antony Pavlov
  2023-06-10 10:32 ` [RFC 2/4] ARM: add sc6531e and F+ Ezzy 4 phone support Antony Pavlov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-06-10 10:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/clocksource/Makefile        |  1 +
 drivers/clocksource/timer-sc6531e.c | 70 +++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index eceaa990d43..863a7e931cf 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -26,3 +26,4 @@ obj-$(CONFIG_CLINT_TIMER) += timer-clint.o
 obj-$(CONFIG_RISCV_TIMER) += timer-riscv.o
 obj-$(CONFIG_ARMV7M_SYSTICK) += armv7m_systick.o
 obj-$(CONFIG_CLKSRC_STM32) += timer-stm32.o
+obj-$(CONFIG_ARCH_SC6531E) += timer-sc6531e.o
diff --git a/drivers/clocksource/timer-sc6531e.c b/drivers/clocksource/timer-sc6531e.c
new file mode 100644
index 00000000000..c5f095f1a2e
--- /dev/null
+++ b/drivers/clocksource/timer-sc6531e.c
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2023 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ */
+
+#include <common.h>
+#include <io.h>
+#include <init.h>
+#include <clock.h>
+#include <linux/err.h>
+
+#include <debug_ll.h>
+
+#define SC6531E_TIMER_CLOCK 1000
+
+#define SYST_VALUE_SHDW 0x0c
+
+static void __iomem *timer_base;
+
+static uint64_t sc6531e_cs_read(void)
+{
+	return (uint64_t)readl(timer_base + SYST_VALUE_SHDW);
+}
+
+static struct clocksource sc6531e_cs = {
+	.read	= sc6531e_cs_read,
+	.mask   = CLOCKSOURCE_MASK(32),
+	.priority = 60,
+};
+
+static int sc6531e_timer_probe(struct device *dev)
+{
+	struct resource *iores;
+
+	/* use only one timer */
+	if (timer_base)
+		return -EBUSY;
+
+	iores = dev_request_mem_resource(dev, 0);
+	if (IS_ERR(iores)) {
+		dev_err(dev, "could not get memory region\n");
+		return PTR_ERR(iores);
+	}
+
+	timer_base = IOMEM(iores->start);
+	clocks_calc_mult_shift(&sc6531e_cs.mult, &sc6531e_cs.shift,
+		SC6531E_TIMER_CLOCK, NSEC_PER_SEC, 1);
+
+	init_clock(&sc6531e_cs);
+
+	return 0;
+}
+
+static __maybe_unused struct of_device_id sc6531e_timer_dt_ids[] = {
+	{
+		.compatible = "sc6531e-timer",
+	}, {
+		/* sentinel */
+	}
+};
+
+static struct driver sc6531e_timer_driver = {
+	.probe	= sc6531e_timer_probe,
+	.name	= "sc6531e-timer",
+	.of_compatible = DRV_OF_COMPAT(sc6531e_timer_dt_ids),
+};
+
+coredevice_platform_driver(sc6531e_timer_driver);
-- 
2.39.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC 2/4] ARM: add sc6531e and F+ Ezzy 4 phone support
  2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
  2023-06-10 10:32 ` [RFC 1/4] clocksource: add sc6531e driver Antony Pavlov
@ 2023-06-10 10:32 ` Antony Pavlov
  2023-06-10 10:32 ` [RFC 3/4] sc6531e: add debug_ll support Antony Pavlov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-06-10 10:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/arm/Kconfig                          |  9 +++++
 arch/arm/Makefile                         |  1 +
 arch/arm/boards/Makefile                  |  1 +
 arch/arm/boards/ezzy-4/Makefile           |  3 ++
 arch/arm/boards/ezzy-4/env/init/automount | 27 +++++++++++++
 arch/arm/boards/ezzy-4/lowlevel.c         | 19 +++++++++
 arch/arm/configs/ezzy-4_defconfig         | 49 +++++++++++++++++++++++
 arch/arm/dts/Makefile                     |  1 +
 arch/arm/dts/ezzy-4.dts                   | 22 ++++++++++
 arch/arm/mach-sc6531e/Kconfig             | 17 ++++++++
 arch/arm/mach-sc6531e/Makefile            |  3 ++
 11 files changed, 152 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e76ee0f6dfe..b46d73f5084 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -84,6 +84,14 @@ config ARCH_DIGIC
 	help
 	  Support for Canon's digital cameras that use the DIGIC4 chip.
 
+config ARCH_SC6531E
+	bool "SC6531E-based devices"
+	depends on 32BIT
+	select CPU_ARM926T
+	select GPIOLIB
+	help
+	  Support for feature phones based on the SC6531E chipset.
+
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
 	depends on 32BIT
@@ -330,6 +338,7 @@ source "arch/arm/mach-nomadik/Kconfig"
 source "arch/arm/mach-omap/Kconfig"
 source "arch/arm/mach-pxa/Kconfig"
 source "arch/arm/mach-rockchip/Kconfig"
+source "arch/arm/mach-sc6531e/Kconfig"
 source "arch/arm/mach-socfpga/Kconfig"
 source "arch/arm/mach-stm32mp/Kconfig"
 source "arch/arm/mach-versatile/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 2208b071ac1..96a32aca8b4 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -104,6 +104,7 @@ machine-$(CONFIG_ARCH_OMAP)		+= omap
 machine-$(CONFIG_ARCH_PXA)		+= pxa
 machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
 machine-$(CONFIG_ARCH_SAMSUNG)		+= samsung
+machine-$(CONFIG_ARCH_SC6531E)		+= sc6531e
 machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_ARCH_STM32MP)		+= stm32mp
 machine-$(CONFIG_ARCH_VERSATILE)	+= versatile
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 2877debad53..8abd8872757 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_MACH_EMBEST_MARSBOARD)		+= embest-marsboard/
 obj-$(CONFIG_MACH_EMBEST_RIOTBOARD)		+= embest-riotboard/
 obj-$(CONFIG_MACH_ELTEC_HIPERCAM)		+= eltec-hipercam/
 obj-y						+= freescale-mx51-babbage/
+obj-$(CONFIG_MACH_EZZY4)			+= ezzy-4/
 obj-$(CONFIG_MACH_FREESCALE_MX53_LOCO)		+= freescale-mx53-qsb/
 obj-$(CONFIG_MACH_FREESCALE_MX53_VMX53)		+= freescale-mx53-vmx53/
 obj-$(CONFIG_MACH_FREESCALE_MX7_SABRESD)	+= freescale-mx7-sabresd/
diff --git a/arch/arm/boards/ezzy-4/Makefile b/arch/arm/boards/ezzy-4/Makefile
new file mode 100644
index 00000000000..458f5209008
--- /dev/null
+++ b/arch/arm/boards/ezzy-4/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/ezzy-4/env/init/automount b/arch/arm/boards/ezzy-4/env/init/automount
new file mode 100644
index 00000000000..6be2b6508a0
--- /dev/null
+++ b/arch/arm/boards/ezzy-4/env/init/automount
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+version
+echo
+help
+echo
+cpuinfo
+echo
+iomem
+echo
+meminfo
+echo
+of_dump
+echo
+drvinfo
+echo
+
+timeout 3
+echo
+
+echo sleep 0
+sleep 1
+echo sleep 1
+sleep 1
+echo sleep 2
+sleep 1
+echo sleep 3
diff --git a/arch/arm/boards/ezzy-4/lowlevel.c b/arch/arm/boards/ezzy-4/lowlevel.c
new file mode 100644
index 00000000000..e06ac493bc6
--- /dev/null
+++ b/arch/arm/boards/ezzy-4/lowlevel.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+extern char __dtb_ezzy_4_start[];
+
+void __naked barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
+{
+	void *fdt;
+
+	arm_cpu_lowlevel_init();
+
+	fdt = __dtb_ezzy_4_start + get_runtime_offset();
+
+	barebox_arm_entry(0x14000000, SZ_4M, fdt);
+}
diff --git a/arch/arm/configs/ezzy-4_defconfig b/arch/arm/configs/ezzy-4_defconfig
new file mode 100644
index 00000000000..4701f78fc6a
--- /dev/null
+++ b/arch/arm/configs/ezzy-4_defconfig
@@ -0,0 +1,49 @@
+CONFIG_TEXT_BASE=0x14300000
+CONFIG_ARCH_SC6531E=y
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_IMAGE_COMPRESSION_NONE=y
+CONFIG_MALLOC_SIZE=0x100000
+CONFIG_PROMPT="ezzy-4 > "
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/ezzy-4/env"
+CONFIG_DEBUG_LL=y
+CONFIG_DEBUG_INITCALLS=y
+CONFIG_DEBUG_PBL=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=y
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_GO=y
+# CONFIG_CMD_MOUNT is not set
+# CONFIG_CMD_UMOUNT is not set
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_MD5SUM=y
+# CONFIG_CMD_PWD is not set
+CONFIG_CMD_SHA1SUM=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_SLEEP=y
+# CONFIG_CMD_CLEAR is not set
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_MM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_UPTIME=y
+CONFIG_OFDEVICE=y
+# CONFIG_SPI is not set
+CONFIG_CLOCKSOURCE_DUMMY_RATE=2000
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_ZLIB=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 98f4c4e0194..ef21d1ab60c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -8,6 +8,7 @@ lwl-$(CONFIG_MACH_ADVANTECH_ROM_742X) += imx6dl-advantech-rom-7421.dtb.o
 lwl-$(CONFIG_MACH_AFI_GF) += am335x-afi-gf.dtb.o
 lwl-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o
 lwl-$(CONFIG_MACH_CANON_A1100) += canon-a1100.dtb.o
+lwl-$(CONFIG_MACH_EZZY4) += ezzy-4.dtb.o
 lwl-$(CONFIG_MACH_CLEP7212) += ep7212-clep7212.dtb.o
 lwl-$(CONFIG_MACH_CM_FX6) += imx6dl-cm-fx6.dtb.o imx6q-cm-fx6.dtb.o imx6q-utilite.dtb.o
 lwl-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs700-m60-6s.dtb.o
diff --git a/arch/arm/dts/ezzy-4.dts b/arch/arm/dts/ezzy-4.dts
new file mode 100644
index 00000000000..7b326bb23c8
--- /dev/null
+++ b/arch/arm/dts/ezzy-4.dts
@@ -0,0 +1,22 @@
+/dts-v1/;
+
+/ {
+	model = "F+ Ezzy 4";
+	compatible = "f+,ezzy-4";
+
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
+
+	memory {
+		device_type = "memory";
+		reg = <0x14000000 0x00400000>;
+	};
+
+	timer: timer@81003000 {
+		compatible = "sc6531e-timer";
+		reg = <0x81003000 0x100>;
+		status = "okay";
+	};
+};
diff --git a/arch/arm/mach-sc6531e/Kconfig b/arch/arm/mach-sc6531e/Kconfig
new file mode 100644
index 00000000000..f0c4b16550c
--- /dev/null
+++ b/arch/arm/mach-sc6531e/Kconfig
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+if ARCH_SC6531E
+
+choice
+	prompt "board type"
+
+config MACH_EZZY4
+	bool "F+ Ezzy 4"
+
+endchoice
+
+config ARCH_TEXT_BASE
+	hex
+	default 0x00001900 if MACH_EZZY4
+
+endif
diff --git a/arch/arm/mach-sc6531e/Makefile b/arch/arm/mach-sc6531e/Makefile
new file mode 100644
index 00000000000..1c2b374603c
--- /dev/null
+++ b/arch/arm/mach-sc6531e/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj- := __dummy__.o
-- 
2.39.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC 3/4] sc6531e: add debug_ll support
  2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
  2023-06-10 10:32 ` [RFC 1/4] clocksource: add sc6531e driver Antony Pavlov
  2023-06-10 10:32 ` [RFC 2/4] ARM: add sc6531e and F+ Ezzy 4 phone support Antony Pavlov
@ 2023-06-10 10:32 ` Antony Pavlov
  2023-06-10 10:32 ` [RFC 4/4] Documentation: add sc6531e instructions Antony Pavlov
  2023-07-04 12:03 ` [RFC 0/4] Run barebox on sc6531e-based feature phone Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-06-10 10:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/arm/Kconfig                |   1 +
 arch/arm/boards/ezzy-4/Makefile |   3 +
 arch/arm/boards/ezzy-4/usbio.c  | 449 ++++++++++++++++++++++++++++++++
 arch/arm/cpu/uncompress.c       |   7 +
 arch/arm/include/asm/debug_ll.h |   2 +
 include/mach/sc6531e/debug_ll.h |  17 ++
 6 files changed, 479 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index b46d73f5084..ffd2ff8b531 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -88,6 +88,7 @@ config ARCH_SC6531E
 	bool "SC6531E-based devices"
 	depends on 32BIT
 	select CPU_ARM926T
+	select HAS_DEBUG_LL
 	select GPIOLIB
 	help
 	  Support for feature phones based on the SC6531E chipset.
diff --git a/arch/arm/boards/ezzy-4/Makefile b/arch/arm/boards/ezzy-4/Makefile
index 458f5209008..c1253f3f64f 100644
--- a/arch/arm/boards/ezzy-4/Makefile
+++ b/arch/arm/boards/ezzy-4/Makefile
@@ -1,3 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 lwl-y += lowlevel.o
+
+lwl-y += usbio.o
+obj-y += usbio.o
diff --git a/arch/arm/boards/ezzy-4/usbio.c b/arch/arm/boards/ezzy-4/usbio.c
new file mode 100644
index 00000000000..954765d70fd
--- /dev/null
+++ b/arch/arm/boards/ezzy-4/usbio.c
@@ -0,0 +1,449 @@
+/*
+ * This file is part of fpdoom
+ * https://github.com/ilyakurdyukov/fpdoom/blob/main/fpdoom/usbio.c
+ */
+
+#include <stdint.h>
+#include <stddef.h>
+
+void *memcpy(void *dst, const void *src, size_t count);
+size_t strlen(const char *src);
+
+void usb_debug_ll_init(void);
+int usb_PUTC_LL(char ch);
+
+#define ALIGN(n) __attribute__((aligned(n)))
+
+#define readl(a) (*(volatile uint32_t *)(a))
+#define writel(v,a)	(*(volatile uint32_t *)(a) = (v))
+
+#define MEM4(addr) *(volatile uint32_t*)(addr)
+
+#define READ32_BE(p) (uint32_t)( \
+	((uint8_t*)(p))[0] << 24 | \
+	((uint8_t*)(p))[1] << 16 | \
+	((uint8_t*)(p))[2] << 8 | \
+	((uint8_t*)(p))[3])
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
+static inline uint32_t swap_be32(uint32_t v) {
+	uint32_t t = v >> 24 | v << 24, m = 0xff00;
+	return t | (v >> 8 & m) | (v & m) << 8;
+}
+#endif
+
+static unsigned fastchk16(unsigned crc, const void *src, int len)
+{
+	uint8_t *s = (uint8_t*)src;
+
+	while (len > 1) {
+		crc += s[1] << 8 | s[0]; s += 2;
+		len -= 2;
+	}
+
+	if (len)
+		crc += *s;
+
+	crc = (crc >> 16) + (crc & 0xffff);
+	crc += crc >> 16;
+
+	return crc & 0xffff;
+}
+
+enum {
+	HOST_CONNECT = 0x00,
+
+	CMD_MESSAGE = 0x80,
+	CMD_FOPEN = 0x81,
+	CMD_FREAD = 0x82,
+	CMD_FWRITE = 0x83,
+	CMD_FCLOSE = 0x84,
+	CMD_FSEEK = 0x85,
+	CMD_FTELL = 0x86,
+	CMD_GETARGS = 0x87,
+};
+
+#define CHECKSUM_INIT 0x5a5a
+#define USB_WAIT 1
+#define USB_NOWAIT 0
+
+#define USB_BASE_INIT
+#define USB_BASE 0x90000000
+
+#define USB_CR(o) MEM4(USB_BASE + o)
+
+#define USB_MAXREAD 64
+
+// not necessary, because USB is already
+// initialized by the bootloader
+#define INIT_USB 1
+
+#define USB_BUFSIZE 0x800
+
+#if (USB_BUFSIZE) & (USB_BUFSIZE - 1)
+#error
+#endif
+
+typedef struct {
+	uint32_t rpos, wpos;
+	uint8_t buf[USB_BUFSIZE];
+} usb_buf_t;
+
+usb_buf_t usb_buf;
+
+static const uint8_t dev_desc[] ALIGN(4) = {
+	0x12, 0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x40,
+	0x82, 0x17, 0x00, 0x4d, 0x02, 0x02, 0x00, 0x00,
+	0x00, 0x01
+};
+
+static const uint8_t config_desc[] ALIGN(4) = {
+	0x09, 0x02, 0x20, 0x00, 0x01, 0x01, 0x00, 0xc0, 0x32,
+	0x09, 0x04, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, 0x00,
+	0x07, 0x05, 0x83, 0x02, 0x40, 0x00, 0x00,
+	0x07, 0x05, 0x02, 0x02, 0x40, 0x00, 0x00
+};
+
+enum {
+	USB_CTRL = 0,
+	INT_STS = 0x18,
+	INT_CLR = 0x1c,
+	TIMEOUT_LMT = 0x28,
+
+	TR_SIZE_IN_ENDP0 = 0x40,
+	REQ_SETUP_LOW = 0x5c,
+	REQ_SETUP_HIGH = 0x60,
+	ENDP0_CTRL = 0x64,
+	INT_CTRL_ENDP0 = 0x68,
+	INT_STS_ENDP0 = 0x6c,
+	INT_CLR_ENDP0 = 0x70,
+
+	ENDP1_CTRL = 0xc0,
+	TRANS_SIZE_ENDP1 = 0xc8,
+	INT_CTRL_ENDP1 = 0xcc,
+	INT_STS_ENDP1 = 0xd0,
+	INT_CLR_ENDP1 = 0xd4,
+
+	ENDP2_CTRL = 0x100,
+	RCV_DATA_ENDP2 = 0x104,
+	INT_CTRL_ENDP2 = 0x10c,
+	INT_STS_ENDP2 = 0x110,
+	INT_CLR_ENDP2 = 0x114,
+
+	ENDP3_CTRL = 0x140,
+	TRANS_SIZE_ENDP3 = 0x148,
+	INT_CTRL_ENDP3 = 0x14c,
+	INT_STS_ENDP3 = 0x150,
+	INT_CLR_ENDP3 = 0x154,
+};
+
+#define FIFO_entry_endp0_in (uint32_t*)(USB_BASE + 0x80000)
+#define FIFO_entry_endp1 (FIFO_entry_endp0_in + 1)
+#define FIFO_entry_endp3 (FIFO_entry_endp0_in + 2)
+
+#define FIFO_entry_endp_out (uint32_t*)(USB_BASE + 0x8000c)
+#define FIFO_entry_endp2 (FIFO_entry_endp_out + 1)
+
+/* max packet size */
+#define USB_MAXPSIZE(o, n) \
+	(USB_CR(o) = (USB_CR(o) & ~0x7ff000) | (n) << 12)
+/* transfer size */
+#define USB_TRSIZE(o, n) \
+	(USB_CR(o) = (USB_CR(o) & ~0x1ffff) | (n))
+
+#if INIT_USB
+static void usb_init_endp0(void) {
+	USB_BASE_INIT
+	USB_MAXPSIZE(ENDP0_CTRL, 8);
+	USB_CR(INT_CLR_ENDP0) |= 1 << 8;
+	USB_CR(INT_CTRL_ENDP0) |= 1 << 8;
+	USB_CR(ENDP0_CTRL) |= 1 << 28; // buffer ready
+}
+
+static void usb_init_endp2(void) {
+	USB_BASE_INIT
+	USB_MAXPSIZE(ENDP2_CTRL, 0x40);
+	USB_TRSIZE(RCV_DATA_ENDP2, 0x2000);
+	USB_CR(INT_CLR_ENDP2) = 0x3fff;
+	USB_CR(INT_CTRL_ENDP2) = 0;
+	USB_CR(INT_CLR_ENDP2) |= 1;
+	USB_CR(INT_CTRL_ENDP2) |= 1;
+	USB_CR(ENDP2_CTRL) |= 1 << 25; // endpoint enable
+	USB_CR(ENDP2_CTRL) |= 1 << 28; // buffer ready
+}
+
+static void usb_init_endp3(void) {
+	USB_BASE_INIT
+	USB_MAXPSIZE(ENDP3_CTRL, 0x40);
+	USB_TRSIZE(TRANS_SIZE_ENDP3, 0x40);
+	USB_CR(INT_CLR_ENDP3) = 0x3fff;
+	USB_CR(INT_CTRL_ENDP3) = 0;
+	USB_CR(INT_CLR_ENDP3) |= 1 << 9;
+	USB_CR(INT_CTRL_ENDP3) |= 1 << 9;
+	USB_CR(ENDP3_CTRL) |= 1 << 25; // endpoint enable
+}
+#endif
+
+// len = 0..0x7ff
+static void usb_send(uint32_t ep, const void *src, uint32_t len) {
+	uint32_t i, ctrl, tr_size; uint32_t *fifo;
+	const uint32_t *s = (const uint32_t*)src;
+	USB_BASE_INIT
+	do {
+		if (ep == 0) {
+			ctrl = ENDP0_CTRL;
+			tr_size = TR_SIZE_IN_ENDP0;
+			fifo = FIFO_entry_endp0_in;
+		} else if (ep == 4) {
+			ctrl = ENDP3_CTRL;
+			tr_size = TRANS_SIZE_ENDP3;
+			fifo = FIFO_entry_endp3;
+		} else break;
+
+		USB_MAXPSIZE(ctrl, len);
+		USB_TRSIZE(tr_size, len);
+
+		for (i = 0; i < len; i += 4, s++)
+			*(volatile uint32_t*)fifo = READ32_BE(s);
+
+		USB_CR(ctrl) |= 1 << 27;
+
+		if (ep == 4) {
+			// TRANSFER_END
+			while ((USB_CR(INT_STS_ENDP3) & 1 << 9) == 0);
+			USB_CR(INT_CLR_ENDP3) |= 1 << 9;
+		}
+	} while (0);
+}
+
+static void usb_recv(uint32_t ep, uint32_t *dst, uint32_t len) {
+	uint32_t i, ctrl; uint32_t *fifo;
+	USB_BASE_INIT
+	do {
+		fifo = FIFO_entry_endp_out;
+		if (ep == 1) {
+			ctrl = ENDP0_CTRL;
+		} else if (ep == 3) {
+			ctrl = ENDP2_CTRL;
+			fifo += 1;	// FIFO_entry_endp2
+		} else break;
+
+		for (i = 0; i < len; i += 8) {
+			*dst++ = swap_be32(*(volatile uint32_t*)fifo);
+			*dst++ = swap_be32(*(volatile uint32_t*)fifo);
+		}
+
+		USB_CR(ctrl) |= 1 << 28;
+	} while (0);
+}
+
+#define USB_REC_DEVICE     0
+#define USB_REC_INTERFACE  1
+#define USB_REC_MASK       0x1f
+
+#define USB_REQ_STANDARD   (0 << 5)
+#define USB_REQ_CLASS      (1 << 5)
+#define USB_REQ_VENDOR     (2 << 5)
+#define USB_REQ_MASK       (3 << 5)
+
+#define USB_REQUEST_GET_DESCRIPTOR  6
+
+#define USB_DEVICE_DESCRIPTOR_TYPE  1
+#define USB_CONFIGURATION_DESCRIPTOR_TYPE  2
+
+static void usb_send_desc(int type, int len) {
+	const void *p; int n;
+	if (type == USB_DEVICE_DESCRIPTOR_TYPE) {
+		p = dev_desc; n = sizeof(dev_desc);
+	} else if (type == USB_CONFIGURATION_DESCRIPTOR_TYPE) {
+		p = config_desc; n = sizeof(config_desc);
+	} else return;
+
+	if (len > n) len = n;
+	usb_send(0, p, len);
+}
+
+static void usb_int_endp0(void) {
+	uint32_t a, b, len, req;
+	USB_BASE_INIT
+	if (USB_CR(INT_STS_ENDP0) & 1 << 8) { // SETUP_TRANS_END
+		a = USB_CR(REQ_SETUP_LOW);
+		len = USB_CR(REQ_SETUP_HIGH) >> 16; // wLength
+		req = (a >> 8) & 0xff;
+
+		b = a & (USB_REC_MASK | USB_REQ_MASK);
+		if (b == (USB_REC_DEVICE | USB_REQ_STANDARD)) {
+			if (req == USB_REQUEST_GET_DESCRIPTOR)
+				usb_send_desc(a >> 24, len);
+		}
+	}
+	USB_CR(INT_CLR_ENDP0) = 0x3fff;
+}
+
+static void usb_int_endp2(void) {
+	usb_buf_t *p; int i, len, wpos;
+	USB_BASE_INIT
+	if (USB_CR(INT_STS_ENDP2) & 1) { // TRANSACTION_END
+		uint8_t buf[USB_MAXREAD];
+		len = USB_CR(ENDP2_CTRL) & (USB_BUFSIZE - 1);
+		if (len > USB_MAXREAD) len = USB_MAXREAD;
+		usb_recv(3, (uint32_t*)buf, len);
+		p = &usb_buf;
+		wpos = p->wpos;
+		for (i = 0; i < len; i++) {
+			p->buf[wpos++] = buf[i];
+			wpos &= (USB_BUFSIZE - 1);
+		}
+		p->wpos = wpos;
+		USB_CR(ENDP2_CTRL) |= 1 << 28;
+	}
+	USB_CR(INT_CLR_ENDP2) = 0x3fff;
+}
+
+static void usb_int_endp3(void) {
+	USB_BASE_INIT
+	USB_CR(INT_CLR_ENDP3) = 0x3fff;
+}
+
+static void usb_check_int(void) {
+	USB_BASE_INIT
+	if ( readl(0x80001004) & (1 << 5) /* SC6531(DA/E) */ ) {
+		int mask = USB_CR(INT_STS);
+		if (mask & 0x3fff) {
+			if (mask & 1 << 10) usb_int_endp2();
+			if (mask & 1 << 11) usb_int_endp3();
+			if (mask & 1 << 8) usb_int_endp0();
+		}
+		USB_CR(INT_CLR) = 0x7f;
+	}
+}
+
+static void usb_init(void) {
+	usb_buf_t *p = &usb_buf;
+	p->rpos = 0;
+	p->wpos = 0;
+
+#if INIT_USB
+	USB_CR(USB_CTRL) |= 1; // USB_ENABLE
+	usb_init_endp0();
+	usb_init_endp2();
+	usb_init_endp3();
+	// 12MHz / 15 = 800kHz
+	USB_CR(TIMEOUT_LMT) = 15;
+#endif
+}
+
+static int usb_read(void *dst, unsigned len, int wait) {
+	usb_buf_t *p = &usb_buf;
+	uint8_t *d = (uint8_t*)dst;
+	unsigned rpos, n, n2;
+
+	while (len) {
+		// usb_buf_free - 1 >= USB_MAXREAD
+		if (((p->rpos - p->wpos - 1) & (USB_BUFSIZE - 1)) >= USB_MAXREAD)
+			usb_check_int();
+
+		rpos = p->rpos;
+		n = (p->wpos - rpos) & (USB_BUFSIZE - 1);
+		if (n) {
+			if (n > len) n = len;
+			len -= n;
+			n2 = USB_BUFSIZE - rpos;
+			if (n <= n2) {
+				memcpy(d, p->buf + rpos, n);
+			} else {
+				memcpy(d, p->buf + rpos, n2);
+				memcpy(d + n2, p->buf, n - n2);
+			}
+			d += n;
+			p->rpos = (rpos + n) & (USB_BUFSIZE - 1);
+		} else if (!wait) break;
+	}
+	return d - (uint8_t*)dst;
+}
+
+static int usb_write(const void *src, unsigned len) {
+	const uint8_t *s = (const uint8_t*)src;
+	for (; len > USB_MAXREAD; len -= USB_MAXREAD) {
+		usb_send(4, s, USB_MAXREAD);
+		s += USB_MAXREAD;
+	}
+	if (len) {
+		if (len == USB_MAXREAD) {
+			len >>= 1;
+			usb_send(4, s, len);
+			s += len;
+		}
+		usb_send(4, s, len);
+	}
+	return s - (uint8_t*)src;
+}
+
+static void _debug_msg(const char *msg)
+{
+	union { uint8_t u8[4]; uint16_t u16[2]; } buf;
+	int len;
+	unsigned tmp;
+
+	len = strlen(msg);
+	if (len > 255)
+		len = 255;
+
+	tmp = CMD_MESSAGE | len << 8;
+	buf.u16[0] = tmp;
+
+	tmp += CHECKSUM_INIT;
+	tmp = fastchk16(tmp, msg, len);
+	buf.u16[1] = tmp;
+
+	usb_write(buf.u16, 4);
+	usb_write(msg, len);
+}
+
+int usb_PUTC_LL(char ch)
+{
+	union { uint8_t u8[6]; uint16_t u16[3]; } buf;
+	unsigned tmp;
+
+	size_t size = 1;
+	void *src;
+
+	// stdout: handle = 1
+	int handle = 1;
+
+	src = &ch;
+
+	tmp = CMD_FWRITE | handle << 8;
+	buf.u16[0] = tmp;
+	buf.u16[1] = size;
+	tmp += CHECKSUM_INIT + size;
+	tmp = fastchk16(tmp, src, size);
+	buf.u16[2] = tmp;
+	usb_write(buf.u16, 6);
+	usb_write(src, size);
+	usb_read(buf.u16, 2, USB_WAIT);
+
+	return buf.u16[0];
+}
+
+void usb_debug_ll_init(void)
+{
+	static const uint8_t fdl_ack[8] = {
+		0x7e, 0, 0x80, 0, 0, 0xff, 0x7f, 0x7e };
+
+	usb_init();
+
+	usb_write(fdl_ack, sizeof(fdl_ack));
+
+	for (;;) {
+		char buf[4];
+
+		usb_read(buf, 1, USB_WAIT);
+
+		if (buf[0] == HOST_CONNECT)
+			break;
+	}
+
+	_debug_msg("debug_ll\n");
+}
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index a481c4634d7..a92115eddd1 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -79,6 +79,13 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
 
 	setup_c();
 
+	if (IS_ENABLED(CONFIG_ARCH_SC6531E) && IS_ENABLED(CONFIG_DEBUG_LL)) {
+		usb_debug_ll_init();
+
+		puts_ll("Hello world\n");
+		puts_ll("\n");
+	}
+
 	pr_debug("memory at 0x%08lx, size 0x%08lx\n", membase, memsize);
 
 	if (IS_ENABLED(CONFIG_MMU))
diff --git a/arch/arm/include/asm/debug_ll.h b/arch/arm/include/asm/debug_ll.h
index a1d5161ccf2..22628c5b4da 100644
--- a/arch/arm/include/asm/debug_ll.h
+++ b/arch/arm/include/asm/debug_ll.h
@@ -64,6 +64,8 @@
 #include <mach/clps711x/debug_ll.h>
 #elif defined CONFIG_ARCH_AT91
 #include <mach/at91/debug_ll.h>
+#elif defined CONFIG_ARCH_SC6531E
+#include <mach/sc6531e/debug_ll.h>
 #endif
 
 #endif
diff --git a/include/mach/sc6531e/debug_ll.h b/include/mach/sc6531e/debug_ll.h
new file mode 100644
index 00000000000..82c22fba647
--- /dev/null
+++ b/include/mach/sc6531e/debug_ll.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-FileCopyrightText: 2023 Antony Pavlov <antonynpavlov@gmail.com> */
+
+#ifndef __MACH_SC6531E_DEBUG_LL_H__
+#define __MACH_SC6531E_DEBUG_LL_H__
+
+#include <io.h>
+
+void usb_debug_ll_init(void);
+int usb_PUTC_LL(char ch);
+
+static inline void PUTC_LL(char ch)
+{
+	usb_PUTC_LL(ch);
+}
+
+#endif /* __MACH_SC6531E_DEBUG_LL_H__ */
-- 
2.39.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [RFC 4/4] Documentation: add sc6531e instructions
  2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
                   ` (2 preceding siblings ...)
  2023-06-10 10:32 ` [RFC 3/4] sc6531e: add debug_ll support Antony Pavlov
@ 2023-06-10 10:32 ` Antony Pavlov
  2023-07-04 12:03 ` [RFC 0/4] Run barebox on sc6531e-based feature phone Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-06-10 10:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 Documentation/boards/sc6531e.rst | 187 +++++++++++++++++++++++++++++++
 1 file changed, 187 insertions(+)

diff --git a/Documentation/boards/sc6531e.rst b/Documentation/boards/sc6531e.rst
new file mode 100644
index 00000000000..cbda8b6def0
--- /dev/null
+++ b/Documentation/boards/sc6531e.rst
@@ -0,0 +1,187 @@
+SC6531E
+=======
+
+F+ Ezzy 4
+---------
+
+Barebox has limited support for the SC6531E-based feature phones::
+
+  ARCH=arm make ezzy-4_defconfig
+  ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make
+
+The resulting ``./images/barebox.img`` can be loaded with
+``spd_dump`` utility::
+
+  git clone https://github.com/ilyakurdyukov/spreadtrum_flash
+  ( cd spreadtrum_flash && git log -1 --pretty='%h %s' && make )
+  6886a85 Readme update about smartphones.
+  
+  wget https://github.com/ilyakurdyukov/fpdoom/releases/download/1.20230513/fpdoom.zip
+  unzip fpdoom.zip nor_fdl1.bin
+  
+  git clone https://github.com/ilyakurdyukov/fpdoom
+  ( cd fpdoom/libc_server && git log -1 --pretty='%h %s' && make )
+  cc90d2a faster usb io
+  
+  ./spreadtrum_flash/spd_dump --wait 300 fdl nor_fdl1.bin 0x40004000 fdl images/barebox.img ram && ./fpdoom/libc_server/libc_server
+
+  BSL_REP_VER: "SPRD3\0"
+  BSL_REP_VER: "Custom FDL1: CHIP ID = 0x65620001\0"
+  + ./fpdoom/libc_server/libc_server
+  !!! debug_ll
+  
+  Hello world
+  
+  start.c: memory at 0x14000000, size 0x00400000
+  start.c: found DTB in boarddata, copying to 0x142ffe80
+  start.c: initializing malloc pool at 0x141ffe80 (size 0x00100000)
+  start.c: starting barebox...
+  initcall-> 0x143021fc
+  initcall-> 0x14307040
+  initcall-> 0x1430d598
+  initcall-> 0x1430dfd8
+  initcall-> 0x143263f4
+  initcall-> 0x1432a9c0
+  start.c: barebox_arm_boot_dtb: using barebox_boarddata
+  initcall-> 0x143012fc
+  initcall-> 0x143120f0
+  initcall-> 0x1432602c
+  initcall-> 0x14312060
+  initcall-> 0x14310844
+  initcall-> 0x14300058
+  initcall-> 0x14312390
+  initcall-> 0x14300590
+  initcall-> 0x1430bfe8
+  initcall-> 0x1430d6e4
+  initcall-> 0x143233fc
+  initcall-> 0x14324b7c
+  initcall-> 0x14325a10
+  initcall-> 0x14329c74
+  initcall-> 0x14301238
+  initcall-> 0x143090bc
+  initcall-> 0x14300dc8
+  initcall-> 0x143018ac
+  initcall-> 0x14304b8c
+  initcall-> 0x1430dbd0
+  initcall-> 0x1430de24
+  initcall-> 0x14312268
+  initcall-> 0x143127fc
+  initcall-> 0x143127bc
+  initcall-> 0x1431277c
+  initcall-> 0x1431273c
+  initcall-> 0x14323224
+  initcall-> 0x1432a228
+  initcall-> 0x143109ac
+  initcall-> 0x143000cc
+  initcall-> 0x14300b00
+  initcall-> 0x14303244
+  initcall-> 0x143049c0
+  initcall-> 0x14308588
+  malloc space: 0x141ffe80 -> 0x142ffe7f (size 1 MiB)
+  initcall-> 0x143088a0
+  initcall-> 0x1430b920
+  initcall-> 0x1430cf14
+  initcall-> 0x1430d794
+  initcall-> 0x14310fe4
+  initcall-> 0x1432af50
+  initcall-> 0x143012bc
+  environment load /dev/env0: No such file or directory
+  Maybe you have to create the partition.
+  initcalls done
+  Executing '/env/init/automount'...
+  
+  barebox 2023.05.0-00182-g726a6ded65fc-dirty #1 Sat Jun 10 10:50:06 MSK 2023
+  
+  
+  
+  Information commands:
+    ?, cpuinfo, devinfo, drvinfo, gpioinfo, help, iomem, meminfo, version
+  Boot commands:
+    boot, go
+  Partition commands:
+    automount
+  Environment commands:
+    export, global, nv, setenv
+  File commands:
+    basename, cat, cd, cp, digest, dirname, ll, ls, md5sum, mkdir, readlink, rm
+    rmdir, sha1sum
+  Scripting commands:
+    ., :, [, exit, false, getopt, let, msleep, sh, sleep, source, test, true
+  Console commands:
+    echo, edit, sedit, timeout, vi
+  Memory commands:
+    md, memcmp, memcpy, memset, memtest, mm, mw
+  Hardware manipulation commands:
+    gpio_direction_input, gpio_direction_output, gpio_get_value, gpio_set_value
+    led
+  Miscellaneous commands:
+    of_dump, of_node, of_property, oftree, time, uptime
+  Use 'help COMMAND' for more details.
+  
+  
+  implementer: ARM
+  architecture: v5TEJ
+  I-cache: 8192 bytes (linelen = 32)
+  D-cache: 8192 bytes (linelen = 32)
+  Control register: A W P D L I DT IT 
+  
+  0x00000000 - 0xffffffff (size 0x00000000) iomem
+    0x14000000 - 0x143fffff (size 0x00400000) ram0
+      0x141ffe80 - 0x142ffe7f (size 0x00100000) malloc space
+      0x142ffe80 - 0x142ffffe (size 0x0000017f) board data
+      0x14300000 - 0x1433149f (size 0x000314a0) barebox
+      0x143314a0 - 0x14333fbf (size 0x00002b20) barebox data
+      0x14333fc0 - 0x14336973 (size 0x000029b4) bss
+      0x143f0000 - 0x143f7fff (size 0x00008000) stack
+    0x81003000 - 0x810030ff (size 0x00000100) 81003000.timer@81003000.of
+  
+  Maximum system memory: 139648
+  Current system memory: 139648
+  in use: 136240
+  
+   {
+          model = "F+ Ezzy 4";
+          compatible = "f+,ezzy-4";
+          #address-cells = <0x1>;
+          #size-cells = <0x1>;
+          chosen {
+          };
+          memory {
+                  device_type = "memory";
+                  reg = <0x14000000 0x400000>;
+          };
+          timer@81003000 {
+                  compatible = "sc6531e-timer";
+                  reg = <0x81003000 0x100>;
+                  status = "okay";
+          };
+  };
+  
+  Driver	Device(s)
+  --------------------
+  sc6531e-timer
+  	81003000.timer@81003000.of
+  ramfs
+  	ramfs0
+  devfs
+  	devfs0
+  gpio-leds
+  mem
+  	mem0
+  	mem1
+  
+  Use 'devinfo DEVICE' for more information
+  
+     1
+  
+  sleep 0
+  sleep 1
+  sleep 2
+  sleep 3
+  Executing '/env/init/automount-ratp'...
+  Executing '/env/init/ps1'...
+  
+  Hit any to stop autoboot:    0
+  Booting entry 'net'
+  ifup: No such file or directory
+  host: No such file or directory
-- 
2.39.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC 0/4] Run barebox on sc6531e-based feature phone
  2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
                   ` (3 preceding siblings ...)
  2023-06-10 10:32 ` [RFC 4/4] Documentation: add sc6531e instructions Antony Pavlov
@ 2023-07-04 12:03 ` Sascha Hauer
  2023-07-05  9:37   ` Antony Pavlov
  4 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2023-07-04 12:03 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox, Ahmad Fatoum

Hi Antony,

This has stayed unanswered for some time.

I am not sure what I should do with it. In the current form I think it's
a bit too basic to be useful. Maybe we can add it once the LCD and
Keypad driver is ready?

Sascha

On Sat, Jun 10, 2023 at 01:32:16PM +0300, Antony Pavlov wrote:
> This patch series adds initial support for SC6531E chip.
> 
> SC6431E chip is specially designed solution for creating
> feature phones. It contains
> 
>   * ARM926EJ-S core (up to 208 MHz)
>   * embedded PSRAM
>   * peripherals: USB, SPI, UART, IIS, PCM, I2C, keypad, LCD
>   * SIM card and GSM/GPRS/FM/BT stuff
> 
> This work is based on FPDoom, see [1], [2], [3] for details.
> 
> At the moment only timer and debug_ll output via USB
> are supported.
> 
> After adding lcd and keypad driver running bareDOOM [4]
> on SC6531E will be possible.
> 
>   [1] https://github.com/ilyakurdyukov/fpdoom
>   [2] https://habr.com/ru/articles/706766/
>   [3] https://www.youtube.com/watch?v=tln_Iace1O8
>   [4] https://github.com/a3f/bareDOOM
> 
> Antony Pavlov (4):
>   clocksource: add sc6531e driver
>   ARM: add sc6531e and F+ Ezzy 4 phone support
>   sc6531e: add debug_ll support
>   Documentation: add sc6531e instructions
> 
>  Documentation/boards/sc6531e.rst          | 187 +++++++++
>  arch/arm/Kconfig                          |  10 +
>  arch/arm/Makefile                         |   1 +
>  arch/arm/boards/Makefile                  |   1 +
>  arch/arm/boards/ezzy-4/Makefile           |   6 +
>  arch/arm/boards/ezzy-4/env/init/automount |  27 ++
>  arch/arm/boards/ezzy-4/lowlevel.c         |  19 +
>  arch/arm/boards/ezzy-4/usbio.c            | 449 ++++++++++++++++++++++
>  arch/arm/configs/ezzy-4_defconfig         |  49 +++
>  arch/arm/cpu/uncompress.c                 |   7 +
>  arch/arm/dts/Makefile                     |   1 +
>  arch/arm/dts/ezzy-4.dts                   |  22 ++
>  arch/arm/include/asm/debug_ll.h           |   2 +
>  arch/arm/mach-sc6531e/Kconfig             |  17 +
>  arch/arm/mach-sc6531e/Makefile            |   3 +
>  drivers/clocksource/Makefile              |   1 +
>  drivers/clocksource/timer-sc6531e.c       |  70 ++++
>  include/mach/sc6531e/debug_ll.h           |  17 +
>  18 files changed, 889 insertions(+)
>  create mode 100644 Documentation/boards/sc6531e.rst
>  create mode 100644 arch/arm/boards/ezzy-4/Makefile
>  create mode 100644 arch/arm/boards/ezzy-4/env/init/automount
>  create mode 100644 arch/arm/boards/ezzy-4/lowlevel.c
>  create mode 100644 arch/arm/boards/ezzy-4/usbio.c
>  create mode 100644 arch/arm/configs/ezzy-4_defconfig
>  create mode 100644 arch/arm/dts/ezzy-4.dts
>  create mode 100644 arch/arm/mach-sc6531e/Kconfig
>  create mode 100644 arch/arm/mach-sc6531e/Makefile
>  create mode 100644 drivers/clocksource/timer-sc6531e.c
>  create mode 100644 include/mach/sc6531e/debug_ll.h
> 
> -- 
> 2.39.0
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC 0/4] Run barebox on sc6531e-based feature phone
  2023-07-04 12:03 ` [RFC 0/4] Run barebox on sc6531e-based feature phone Sascha Hauer
@ 2023-07-05  9:37   ` Antony Pavlov
  0 siblings, 0 replies; 7+ messages in thread
From: Antony Pavlov @ 2023-07-05  9:37 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Ahmad Fatoum

On Tue, 4 Jul 2023 14:03:56 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> Hi Antony,
> 
> This has stayed unanswered for some time.
> 
> I am not sure what I should do with it. In the current form I think it's
> a bit too basic to be useful. Maybe we can add it once the LCD and
> Keypad driver is ready?

It's just RFC. With LCD and keypad support SC6531E barebox port will be a nice
demo for barebox presentation and can be added to mainline repo.

There are some ready-to-use SC6531E drivers in the https://github.com/strongtz/linux-sprd repo.
LCD display is connected via SPI so drivers/spi/spi-sprd.c can be used,
also we need backlight driver.
Keypad is supported by drivers/input/keyboard/sprd_keypad.c.


> Sascha
> 
> On Sat, Jun 10, 2023 at 01:32:16PM +0300, Antony Pavlov wrote:
> > This patch series adds initial support for SC6531E chip.
> > 
> > SC6431E chip is specially designed solution for creating
> > feature phones. It contains
> > 
> >   * ARM926EJ-S core (up to 208 MHz)
> >   * embedded PSRAM
> >   * peripherals: USB, SPI, UART, IIS, PCM, I2C, keypad, LCD
> >   * SIM card and GSM/GPRS/FM/BT stuff
> > 
> > This work is based on FPDoom, see [1], [2], [3] for details.
> > 
> > At the moment only timer and debug_ll output via USB
> > are supported.
> > 
> > After adding lcd and keypad driver running bareDOOM [4]
> > on SC6531E will be possible.
> > 
> >   [1] https://github.com/ilyakurdyukov/fpdoom
> >   [2] https://habr.com/ru/articles/706766/
> >   [3] https://www.youtube.com/watch?v=tln_Iace1O8
> >   [4] https://github.com/a3f/bareDOOM
> > 
> > Antony Pavlov (4):
> >   clocksource: add sc6531e driver
> >   ARM: add sc6531e and F+ Ezzy 4 phone support
> >   sc6531e: add debug_ll support
> >   Documentation: add sc6531e instructions
> > 
> >  Documentation/boards/sc6531e.rst          | 187 +++++++++
> >  arch/arm/Kconfig                          |  10 +
> >  arch/arm/Makefile                         |   1 +
> >  arch/arm/boards/Makefile                  |   1 +
> >  arch/arm/boards/ezzy-4/Makefile           |   6 +
> >  arch/arm/boards/ezzy-4/env/init/automount |  27 ++
> >  arch/arm/boards/ezzy-4/lowlevel.c         |  19 +
> >  arch/arm/boards/ezzy-4/usbio.c            | 449 ++++++++++++++++++++++
> >  arch/arm/configs/ezzy-4_defconfig         |  49 +++
> >  arch/arm/cpu/uncompress.c                 |   7 +
> >  arch/arm/dts/Makefile                     |   1 +
> >  arch/arm/dts/ezzy-4.dts                   |  22 ++
> >  arch/arm/include/asm/debug_ll.h           |   2 +
> >  arch/arm/mach-sc6531e/Kconfig             |  17 +
> >  arch/arm/mach-sc6531e/Makefile            |   3 +
> >  drivers/clocksource/Makefile              |   1 +
> >  drivers/clocksource/timer-sc6531e.c       |  70 ++++
> >  include/mach/sc6531e/debug_ll.h           |  17 +
> >  18 files changed, 889 insertions(+)
> >  create mode 100644 Documentation/boards/sc6531e.rst
> >  create mode 100644 arch/arm/boards/ezzy-4/Makefile
> >  create mode 100644 arch/arm/boards/ezzy-4/env/init/automount
> >  create mode 100644 arch/arm/boards/ezzy-4/lowlevel.c
> >  create mode 100644 arch/arm/boards/ezzy-4/usbio.c
> >  create mode 100644 arch/arm/configs/ezzy-4_defconfig
> >  create mode 100644 arch/arm/dts/ezzy-4.dts
> >  create mode 100644 arch/arm/mach-sc6531e/Kconfig
> >  create mode 100644 arch/arm/mach-sc6531e/Makefile
> >  create mode 100644 drivers/clocksource/timer-sc6531e.c
> >  create mode 100644 include/mach/sc6531e/debug_ll.h
> > 
> > -- 
> > 2.39.0
> > 
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


-- 
Best regards,
  Antony Pavlov



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-05  9:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 10:32 [RFC 0/4] Run barebox on sc6531e-based feature phone Antony Pavlov
2023-06-10 10:32 ` [RFC 1/4] clocksource: add sc6531e driver Antony Pavlov
2023-06-10 10:32 ` [RFC 2/4] ARM: add sc6531e and F+ Ezzy 4 phone support Antony Pavlov
2023-06-10 10:32 ` [RFC 3/4] sc6531e: add debug_ll support Antony Pavlov
2023-06-10 10:32 ` [RFC 4/4] Documentation: add sc6531e instructions Antony Pavlov
2023-07-04 12:03 ` [RFC 0/4] Run barebox on sc6531e-based feature phone Sascha Hauer
2023-07-05  9:37   ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox