[PATCH 3/3] arm: dts: licheepi-nano: enable usb device mode

2023-06-09 Thread
>From fff53ba354c8eca33cb9901888778420db637073 Mon Sep 17 00:00:00 2001
From: Lu Hui 
Date: Fri, 9 Jun 2023 22:05:53 +0800
Subject: [PATCH 3/3] arm: dts: licheepi-nano: enable usb device mode

---
 arch/arm/dts/suniv-f1c100s-licheepi-nano.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts
b/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts
index 43896723a9..0ab6353727 100644
--- a/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts
+++ b/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts
@@ -5,6 +5,7 @@

 /dts-v1/;
 #include "suniv-f1c100s.dtsi"
+#include 

 #include 

@@ -71,3 +72,17 @@
 usb0_id_det-gpios = < 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
 status = "okay";
 };
+
+_sram {
+status = "okay";
+};
+
+_otg {
+dr_mode = "peripheral";
+status = "okay";
+};
+
+ {
+usb0_id_det-gpio = < 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
+status = "okay";
+};
-- 
2.40.1


[PATCH 2/3] drivers: musb-new: add allwinner f1c100s

2023-06-09 Thread
>From fe7d48e84bb3c72d219f37eed51ea766f83b4bec Mon Sep 17 00:00:00 2001
From: Lu Hui 
Date: Fri, 9 Jun 2023 22:05:23 +0800
Subject: [PATCH 2/3] drivers: musb-new: add allwinner f1c100s configuration

---
 drivers/usb/musb-new/sunxi.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index dc4cfc2194..1c90739cea 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -4,6 +4,7 @@
  *
  * Copyright © 2015 Hans de Goede 
  * Copyright © 2013 Jussi Kivilinna 
+ * Copyright © 2023 Lu Hui 
  *
  * Based on the sw_usb "Allwinner OTG Dual Role Controller" code.
  *  Copyright 2007-2012 (C) Allwinner Technology Co., Ltd.
@@ -519,6 +520,10 @@ static const struct sunxi_musb_config sun8i_h3_cfg = {
 .config = _config_h3,
 };

+static const struct sunxi_musb_config suniv_f1c100s_cfg = {
+.config = _config,
+};
+
 static const struct udevice_id sunxi_musb_ids[] = {
 { .compatible = "allwinner,sun4i-a10-musb",
 .data = (ulong)_a10_cfg },
@@ -528,6 +533,8 @@ static const struct udevice_id sunxi_musb_ids[] = {
 .data = (ulong)_a31_cfg },
 { .compatible = "allwinner,sun8i-h3-musb",
 .data = (ulong)_h3_cfg },
+{ .compatible = "allwinner,suniv-f1c100s-musb",
+.data = (ulong)_f1c100s_cfg },
 { }
 };

-- 
2.40.1


[PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

2023-06-09 Thread
>From 09a85536f92cfd22f2a6feba8ea91fae4bc41ed8 Mon Sep 17 00:00:00 2001
From: Lu Hui 
Date: Fri, 9 Jun 2023 22:04:56 +0800
Subject: [PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

---
 drivers/phy/allwinner/phy-sun4i-usb.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 6428163c18..8425a83c84 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2017 Jagan Teki 
  * Copyright (C) 2015 Hans de Goede 
  * Copyright (C) 2014 Roman Byshko 
+ * Copyright (C) 2023 Lu Hui 
  *
  * Modelled arch/arm/mach-sunxi/usb_phy.c to compatible with generic-phy.
  *
@@ -83,6 +84,7 @@ enum sun4i_usb_phy_type {
 sun8i_v3s_phy,
 sun50i_a64_phy,
 sun50i_h6_phy,
+suniv_f1c100s_phy,
 };

 struct sun4i_usb_phy_cfg {
@@ -372,8 +374,9 @@ static int sun4i_usb_phy_xlate(struct phy *phy,
 {
 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);

-if (args->args_count >= data->cfg->num_phys)
+if (args->args_count > data->cfg->num_phys) {
 return -EINVAL;
+}

 if (data->cfg->missing_phys & BIT(args->args[0]))
 return -ENODEV;
@@ -531,6 +534,14 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
 return 0;
 }

+static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
+.num_phys = 1,
+.type = suniv_f1c100s_phy,
+.disc_thresh = 3,
+.phyctl_offset = REG_PHYCTL_A10,
+.dedicated_clocks = true,
+};
+
 static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
 .num_phys = 3,
 .type = sun4i_a10_phy,
@@ -659,6 +670,7 @@ static const struct udevice_id sun4i_usb_phy_ids[] = {
 { .compatible = "allwinner,sun20i-d1-usb-phy", .data =
(ulong)_d1_cfg },
 { .compatible = "allwinner,sun50i-a64-usb-phy", .data =
(ulong)_a64_cfg},
 { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
(ulong)_h6_cfg},
+{ .compatible = "allwinner,suniv-f1c100s-usb-phy", .data =
(ulong)_f1c100s_cfg},
 { }
 };

-- 
2.40.1


[PATCH] drivers: pinctrl-sunxi: add suniv spi1 function

2023-06-09 Thread
>From 570b40e19de75511d9ce066e1a28333ada04baf2 Mon Sep 17 00:00:00 2001
From: Lu Hui 
Date: Mon, 29 May 2023 22:26:25 +0800
Subject: [PATCH] drivers: pinctrl-sunxi: add suniv spi1 function

---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index e510218090..c448e40ab0 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -240,6 +240,7 @@ static const struct sunxi_pinctrl_function
suniv_f1c100s_pinctrl_functions[] = {
 { "mmc0",2 },/* PF0-PF5 */
 { "mmc1",3 },/* PC0-PC2 */
 { "spi0",2 },/* PC0-PC3 */
+{ "spi1",6 },/* PA0-PA3 */
 #if IS_ENABLED(CONFIG_UART0_PORT_F)
 { "uart0",3 },/* PF2-PF4 */
 #else
-- 
2.40.1