Compare commits

...

10 Commits

Author SHA1 Message Date
Yilin Sun 36e82a0265
configs: tlt113i-minievm: Added env ubi partition.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 09:36:38 +08:00
Yilin Sun 738ce1e4fd
arm: dts: Add fixed partition for TLT113-i SPI NAND.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 09:34:49 +08:00
Yilin Sun 9aa63a2ab5
drivers: mtd: nand: Add FORESEE F35SQA001G/002G support.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 09:34:15 +08:00
Yilin Sun 4eb8e11576
configs: sun8i-t113i-tronlong-tlt113-minievm: Add UBI CMD.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 00:21:30 +08:00
Yilin Sun ffb7ad153e
configs: Add defconfig for Tronlong TLT113-MiniEVM.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 00:15:42 +08:00
Yilin Sun a5ec3a143d
arm: dts: sun8i-t113i-tronlong-tlt113-minevm: Initial support
This patch add support for Tronlong TLT113-MiniEVM board.

Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 00:14:37 +08:00
Yilin Sun 0afbe90ad2
arm: dts: sun8i-t113i: Add dts.
T113-i is an industrial-grade DRAM-less SoC which is pretty much
identical to T113-S3 or R528.

Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 00:12:37 +08:00
Yilin Sun aca390cb24
sunxi: Enable additional UART2 pinmux on PORTG.
This patch enables additional pinmux for UART2 on PORT G PG17/PG18. This
is available on certain sun8i devices, e.g. T113

Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-01-11 00:11:11 +08:00
Jookia 89e8047f7a arm: dts: sun8i-t113s-mangopi-mq-r-t113: Add USB nodes 2023-12-08 20:57:06 +11:00
Jookia e27886d3c4 musb-new: Fix compilation for device model 2023-12-08 20:57:06 +11:00
15 changed files with 439 additions and 19 deletions

View File

@ -810,6 +810,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
sun8i-v3-sl631-imx179.dtb \
sun8i-v3s-licheepi-zero.dtb
dtb-$(CONFIG_MACH_SUN8I_R528) += \
sun8i-t113i-tronlong-tlt113-minievm.dtb \
sun8i-t113s-mangopi-mq-r-t113.dtb
dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-bananapi-m2-plus.dtb \

View File

@ -0,0 +1,33 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2022 Arm Ltd.
#include <dt-bindings/interrupt-controller/irq.h>
/dts-v1/;
#include "sun8i-t113i.dtsi"
#include "sunxi-t113i-tronlong-tlt113.dtsi"
/ {
model = "Tronlong TLT113-MiniEVM";
compatible = "tronlong,tlt113-minievm", "allwinner,sun8i-t113i";
};
&cpu0 {
cpu-supply = <&reg_vcc_core>;
};
&cpu1 {
cpu-supply = <&reg_vcc_core>;
};
&mmc0 {
pinctrl-0 = <&mmc0_pins>;
pinctrl-names = "default";
vmmc-supply = <&reg_3v3>;
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
disable-wp;
bus-width = <4>;
status = "okay";
};

View File

@ -0,0 +1,59 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2022 Arm Ltd.
#define SOC_PERIPHERAL_IRQ(nr) GIC_SPI nr
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <../../riscv/dts/sunxi-d1s-t113.dtsi>
#include <../../riscv/dts/sunxi-d1-t113.dtsi>
/ {
interrupt-parent = <&gic>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <0>;
clocks = <&ccu CLK_CPUX>;
clock-names = "cpu";
};
cpu1: cpu@1 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <1>;
clocks = <&ccu CLK_CPUX>;
clock-names = "cpu";
};
};
gic: interrupt-controller@1c81000 {
compatible = "arm,gic-400";
reg = <0x03021000 0x1000>,
<0x03022000 0x2000>,
<0x03024000 0x2000>,
<0x03026000 0x2000>;
interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
interrupt-controller;
#interrupt-cells = <3>;
};
timer {
compatible = "arm,armv7-timer";
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
};
pmu {
compatible = "arm,cortex-a7-pmu";
interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
interrupt-affinity = <&cpu0>, <&cpu1>;
};
};

View File

@ -60,3 +60,29 @@
};
};
};
&usb_otg {
status = "okay";
dr_mode = "peripheral";
};
&usbphy {
usb1_vbus-supply = <&reg_vcc5v>;
status = "okay";
};
&ohci0 {
status = "okay";
};
&ohci1 {
status = "okay";
};
&ehci0 {
status = "okay";
};
&ehci1 {
status = "okay";
};

View File

@ -0,0 +1,139 @@
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2022 Arm Ltd.
/*
* Common peripherals and configurations for MangoPi MQ-R boards.
*/
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
aliases {
serial2 = &uart2;
};
chosen {
stdout-path = "serial2:115200n8";
};
leds {
compatible = "gpio-leds";
led-0 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
};
led-1 {
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
};
};
/* EC2232E DC/DC regulator on SoM */
reg_vcc5v: regulator-5v {
compatible = "regulator-fixed";
regulator-name = "vcc-5v";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
/* EC2232E DC/DC regulator on SoM */
reg_3v3: regulator-3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
vin-supply = <&reg_vcc5v>;
};
/* EC2232E DC/DC regulator on SoM, also supplying VDD-SYS */
reg_vcc_core: regulator-core {
compatible = "regulator-fixed";
regulator-name = "vcc-core";
regulator-min-microvolt = <880000>;
regulator-max-microvolt = <880000>;
vin-supply = <&reg_vcc5v>;
};
};
&dcxo {
clock-frequency = <24000000>;
};
&ehci1 {
status = "okay";
};
&ohci1 {
status = "okay";
};
&pio {
vcc-pb-supply = <&reg_3v3>;
vcc-pd-supply = <&reg_3v3>;
vcc-pe-supply = <&reg_3v3>;
vcc-pf-supply = <&reg_3v3>;
vcc-pg-supply = <&reg_3v3>;
uart2_pg_pins: uart2_pg_pins {
pins = "PG17", "PG18";
function = "uart2";
};
};
&uart2 {
bootph-all;
pinctrl-names = "default";
pinctrl-0 = <&uart2_pg_pins>;
status = "okay";
};
&spi0 {
bootph-all;
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
status = "okay";
spi_nand@0 {
bootph-all;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fixed-partitions";
partition@0 {
label = "u-boot";
reg = <0x0 0x100000>; /* 1MB */
};
partition@100000 {
label = "env";
reg = <0x100000 0x400000>; /* 4MB */
};
partition@500000 {
label = "rootfs";
reg = <0x500000 0xfb00000>; /* 251MB */
};
};
};
};
/* The USB-C socket has its CC pins pulled to GND, so is hardwired as a UFP. */
&usb_otg {
dr_mode = "peripheral";
status = "okay";
};
&usbphy {
usb1_vbus-supply = <&reg_vcc5v>;
status = "okay";
};

View File

@ -729,6 +729,11 @@ config UART0_PORT_F
at the same time, the system can be only booted in the FEL mode.
Only enable this if you really know what you are doing.
config UART2_PORT_G
bool "UART2 on Port G"
---help---
Select this option for boards where UART2 uses the Port G pinmux.
config UART2_PORT_E
bool "UART2 on PE2 and PE3 pins"
---help---

View File

@ -172,6 +172,10 @@ static int gpio_init(void)
sunxi_gpio_set_cfgpin(SUNXI_GPE(2), 3);
sunxi_gpio_set_cfgpin(SUNXI_GPE(3), 3);
sunxi_gpio_set_pull(SUNXI_GPE(2), SUNXI_GPIO_PULL_UP);
#elif IS_ENABLED(CONFIG_UART2_PORT_G)
sunxi_gpio_set_cfgpin(SUNXI_GPG(17), SUN8I_R528_GPG_UART2);
sunxi_gpio_set_cfgpin(SUNXI_GPG(18), SUN8I_R528_GPG_UART2);
sunxi_gpio_set_pull(SUNXI_GPG(18), SUNXI_GPIO_PULL_UP);
#else
sunxi_gpio_set_cfgpin(SUNXI_GPB(0), 7);
sunxi_gpio_set_cfgpin(SUNXI_GPB(1), 7);
@ -476,6 +480,8 @@ void board_init_f(ulong dummy)
{
sunxi_sram_init();
spl_early_init();
#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_H3
/* Enable non-secure access to some peripherals */
tzpc_init();

View File

@ -0,0 +1,37 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_SYS_BOARD="tlt113-minievm"
CONFIG_DEFAULT_DEVICE_TREE="sun8i-t113i-tronlong-tlt113-minievm"
CONFIG_MACH_SUN8I_R528=y
CONFIG_OF_LIVE=y
# CONFIG_ENV_IS_IN_FAT is not set
# CONFIG_ENV_IS_IN_SPI_FLASH is not set
CONFIG_ENV_IS_IN_UBI=y
CONFIG_ENV_UBI_PART="env"
CONFIG_ENV_UBI_VOLUME="env"
CONFIG_ENV_UBI_VID_OFFSET=2048
CONFIG_SPL=y
CONFIG_SPL_DM=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_SPL_SPINAND_SUPPORT=y
CONFIG_SPL_SPINAND_PAGE_SIZE=0x800
CONFIG_SPL_SPINAND_BLOCK_SIZE=0x20000
CONFIG_SPL_SPI_SUNXI=y
CONFIG_SUNXI_MINIMUM_DRAM_MB=256
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_DRAM_CLK=792
CONFIG_DRAM_ZQ=8092667
CONFIG_DRAM_SUNXI_ODT_EN=1
CONFIG_DRAM_SUNXI_TPR0=0x004a2195
CONFIG_DRAM_SUNXI_TPR11=0x770000
CONFIG_DRAM_SUNXI_TPR12=0x2
CONFIG_DRAM_SUNXI_TPR13=0x34050100
CONFIG_CONS_INDEX=3
CONFIG_UART2_PORT_G=y
CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_MTD_SPI_NAND=y
CONFIG_SPI=y
CONFIG_CMD_MTD=y
CONFIG_CMD_UBI=y

View File

@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
spinand-objs := core.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o
spinand-objs := core.o foresee.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o

View File

@ -822,6 +822,7 @@ static const struct nand_ops spinand_ops = {
};
static const struct spinand_manufacturer *spinand_manufacturers[] = {
&foresee_spinand_manufacturer,
&gigadevice_spinand_manufacturer,
&macronix_spinand_manufacturer,
&micron_spinand_manufacturer,

View File

@ -0,0 +1,97 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2017 exceet electronics GmbH
* Copyright (c) 2024 Yilin Sun
*
* Authors:
* Frieder Schrempf <frieder.schrempf@exceet.de>
* Boris Brezillon <boris.brezillon@bootlin.com>
* Yilin Sun <imi415@imi.moe>
*/
#ifndef __UBOOT__
#include <linux/device.h>
#include <linux/kernel.h>
#endif
#include <linux/bug.h>
#include <linux/mtd/spinand.h>
#define SPINAND_MFR_FORESEE 0xCD
static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
static SPINAND_OP_VARIANTS(write_cache_variants,
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
SPINAND_PROG_LOAD(true, 0, NULL, 0));
static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
static int f35sqa001g_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
if (section > 3)
return -ERANGE;
region->offset = (16 * section) + 8;
region->length = 8;
return 0;
}
static int f35sqa001g_ooblayout_free(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
if (section > 3)
return -ERANGE;
region->offset = (16 * section) + 2;
region->length = 6;
return 0;
}
static const struct mtd_ooblayout_ops f35sqa001g_ooblayout = {
.ecc = f35sqa001g_ooblayout_ecc,
.rfree = f35sqa001g_ooblayout_free,
};
static const struct spinand_info foresee_spinand_table[] = {
SPINAND_INFO("F35SQA001G",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71, 0x71),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
0,
SPINAND_ECCINFO(&f35sqa001g_ooblayout, NULL)),
SPINAND_INFO("F35SQA002G",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x72, 0x72),
NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
0,
SPINAND_ECCINFO(&f35sqa001g_ooblayout, NULL)),
};
static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = {
};
const struct spinand_manufacturer foresee_spinand_manufacturer = {
.id = SPINAND_MFR_FORESEE,
.name = "FORESEE",
.chips = foresee_spinand_table,
.nchips = ARRAY_SIZE(foresee_spinand_table),
.ops = &foresee_spinand_manuf_ops,
};

View File

@ -615,6 +615,8 @@ static const struct sunxi_pinctrl_function sun20i_d1_pinctrl_functions[] = {
{ "uart1", 2 }, /* PG6-PG7 */
#if IS_ENABLED(CONFIG_UART2_PORT_E)
{ "uart2", 3 }, /* PE2-PE3 */
#elif IS_ENABLED(CONFIG_UART2_PORT_G)
{ "uart2", 2 }, /* PG17-PG18 */
#else
{ "uart2", 7 }, /* PB0-PB1 */
#endif

View File

@ -283,6 +283,17 @@ static void sunxi_musb_disable(struct musb *musb)
enabled = false;
}
#ifdef CONFIG_DM_USB_GADGET
int dm_usb_gadget_handle_interrupts(struct udevice *dev)
{
struct sunxi_glue *glue = dev_get_priv(dev);
struct musb_host_data *host = &glue->mdata;
host->host->isr(0, host->host);
return 0;
}
#endif
static int sunxi_musb_init(struct musb *musb)
{
struct sunxi_glue *glue = to_sunxi_glue(musb->controller);
@ -431,16 +442,13 @@ static struct musb_hdrc_config musb_config_h3 = {
static int musb_usb_probe(struct udevice *dev)
{
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
struct sunxi_glue *glue = dev_get_priv(dev);
struct musb_host_data *host = &glue->mdata;
struct musb_hdrc_platform_data pdata;
void *base = dev_read_addr_ptr(dev);
int ret;
#ifdef CONFIG_USB_MUSB_HOST
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
#endif
if (!base)
return -EINVAL;
@ -471,26 +479,30 @@ static int musb_usb_probe(struct udevice *dev)
pdata.platform_ops = &sunxi_musb_ops;
pdata.config = glue->cfg->config;
#ifdef CONFIG_USB_MUSB_HOST
priv->desc_before_addr = true;
if (IS_ENABLED(CONFIG_USB_MUSB_HOST)) {
priv->desc_before_addr = true;
pdata.mode = MUSB_HOST;
host->host = musb_init_controller(&pdata, &glue->dev, base);
if (!host->host)
return -EIO;
pdata.mode = MUSB_HOST;
host->host = musb_init_controller(&pdata, &glue->dev, base);
if (!host->host)
return -EIO;
return musb_lowlevel_init(host);
} else if (CONFIG_IS_ENABLED(DM_USB_GADGET)) {
pdata.mode = MUSB_PERIPHERAL;
host->host = musb_init_controller(&pdata, &glue->dev, base);
if (!host->host)
return -EIO;
printf("Allwinner mUSB OTG (Peripheral)\n");
musb_gadget_setup(host->host);
return usb_add_gadget_udc(&glue->dev, &host->host->g);
}
ret = musb_lowlevel_init(host);
if (!ret)
printf("Allwinner mUSB OTG (Host)\n");
#else
pdata.mode = MUSB_PERIPHERAL;
host->host = musb_register(&pdata, &glue->dev, base);
if (IS_ERR_OR_NULL(host->host))
return -EIO;
printf("Allwinner mUSB OTG (Peripheral)\n");
#endif
return ret;
}

View File

@ -245,6 +245,7 @@ struct spinand_manufacturer {
};
/* SPI NAND manufacturers */
extern const struct spinand_manufacturer foresee_spinand_manufacturer;
extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
extern const struct spinand_manufacturer macronix_spinand_manufacturer;
extern const struct spinand_manufacturer micron_spinand_manufacturer;

View File

@ -142,6 +142,7 @@ enum sunxi_gpio_number {
#define SUN6I_GPG_SDC1 2
#define SUN8I_GPG_SDC1 2
#define SUN8I_GPG_UART1 2
#define SUN8I_R528_GPG_UART2 2
#define SUN5I_GPG_UART1 4
#define SUN6I_GPH_PWM 2