Skip to contentSkip to conversation

sunxi: Move ALL boards to the device-model

PATCH New Hans de Goede 4 participants 67 messages Apr 24, 2015 – May 4, 2015

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

cover sunxi: Move ALL boards to the device-model

Hi Simon, Ian,

As promised here is my patch-set to move all sunxi boards to the device-model, it was slightly more work then I expected, and as such the patch-set is also somewhat larger then expected, but it is done :)

Please review, since this all only touches sunxi specific files the intention is to merge this through the sunxi tree as soon as all the patches are acked.

Regards,

Hans

#1 lore raw

PATCH 1/21 sunxi: Do not build i2c support when we've no i2c controllers

This fixes the following errors being printed during boot:

Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible

---
 include/configs/sunxi-common.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
include/configs/sunxi-common.h +3 -4
index 3e49aba..f97e626 100644
@@ -261,14 +261,15 @@
 #define CONFIG_SPL_I2C_SUPPORT
 #endif
 
-#define CONFIG_SYS_I2C
 #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
     defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
     defined CONFIG_I2C4_ENABLE
+#define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MVTWSI
-#endif
 #define CONFIG_SYS_I2C_SPEED		400000
 #define CONFIG_SYS_I2C_SLAVE		0x7f
+#define CONFIG_CMD_I2C
+#endif
 
 #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
 #define CONFIG_SYS_I2C_SOFT
@@ -288,8 +289,6 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_VIDEO_LCD_I2C_BUS	-1 /* NA, but necessary to compile */
 #endif
 
-#define CONFIG_CMD_I2C
-
 /* PMU */
 #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
 #define CONFIG_SPL_POWER_SUPPORT
Signature · 1 line
2.3.5
#2 lore raw

PATCH 1/21 sunxi: Do not build i2c support when we've no i2c controllers

Hi Hans,

Quoted 6 lines · Hans de Goede

This fixes the following errors being printed during boot:

Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible

Where does the error come from?

Quoted 36 lines
---
 include/configs/sunxi-common.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
include/configs/sunxi-common.h +3 -5
index 3e49aba..f97e626 100644
@@ -261,14 +261,15 @@
 #define CONFIG_SPL_I2C_SUPPORT
 #endif
 
-#define CONFIG_SYS_I2C
 #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
     defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
     defined CONFIG_I2C4_ENABLE
+#define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_MVTWSI
-#endif
 #define CONFIG_SYS_I2C_SPEED           400000
 #define CONFIG_SYS_I2C_SLAVE           0x7f
+#define CONFIG_CMD_I2C
+#endif
 
 #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
 #define CONFIG_SYS_I2C_SOFT
@@ -288,8 +289,6 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_VIDEO_LCD_I2C_BUS       -1 /* NA, but necessary to compile */
 #endif
 
-#define CONFIG_CMD_I2C
-
 /* PMU */
 #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
 #define CONFIG_SPL_POWER_SUPPORT
--
Quoted 2 lines

2.3.5

Regards,
Simon

#3 lore raw

PATCH 1/21 sunxi: Do not build i2c support when we've no i2c controllers

Hi,

Quoted 11 lines · Simon Glass

Hi Hans,

Quoted 6 lines · Hans de Goede

This fixes the following errors being printed during boot:

Error, wrong i2c adapter 0 max 0 possible
Error, wrong i2c adapter 0 max 0 possible

Where does the error come from?

Somewhere in the i2c code I presume, I did not investigate, I started by trying to simply disable building the i2c stuff as it makes no sense to have i2c support build-in when there are no controllers, and that indeed fixed things.

Regards,

Hans

Quoted 45 lines
Quoted 36 lines
---
  include/configs/sunxi-common.h | 7 +++----
  1 file changed, 3 insertions(+), 4 deletions(-)
include/configs/sunxi-common.h +3 -5
index 3e49aba..f97e626 100644
@@ -261,14 +261,15 @@
  #define CONFIG_SPL_I2C_SUPPORT
  #endif
 
-#define CONFIG_SYS_I2C
  #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
      defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
      defined CONFIG_I2C4_ENABLE
+#define CONFIG_SYS_I2C
  #define CONFIG_SYS_I2C_MVTWSI
-#endif
  #define CONFIG_SYS_I2C_SPEED           400000
  #define CONFIG_SYS_I2C_SLAVE           0x7f
+#define CONFIG_CMD_I2C
+#endif
 
  #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
  #define CONFIG_SYS_I2C_SOFT
@@ -288,8 +289,6 @@ extern int soft_i2c_gpio_scl;
  #define CONFIG_VIDEO_LCD_I2C_BUS       -1 /* NA, but necessary to compile */
  #endif
 
-#define CONFIG_CMD_I2C
-
  /* PMU */
  #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
  #define CONFIG_SPL_POWER_SUPPORT
--
Quoted 2 lines

2.3.5

Regards,
Simon

#5 lore raw

PATCH 2/21 sunxi: mmc: Fix card-detect gpio handling to work with the device-model

In reply to Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi mmc code properly handle this.

---
 drivers/mmc/sunxi_mmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/sunxi_mmc.c +4 -3
index fcc278d..a664236 100644
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <asm/io.h>
@@ -37,7 +38,7 @@ static int sunxi_mmc_getcd_gpio(int sdc_no)
 	case 2: return sunxi_name_to_gpio(CONFIG_MMC2_CD_PIN);
 	case 3: return sunxi_name_to_gpio(CONFIG_MMC3_CD_PIN);
 	}
-	return -1;
+	return -EINVAL;
 }
 
 static int mmc_resource_init(int sdc_no)
@@ -72,7 +73,7 @@ static int mmc_resource_init(int sdc_no)
 	mmchost->mmc_no = sdc_no;
 
 	cd_pin = sunxi_mmc_getcd_gpio(sdc_no);
-	if (cd_pin != -1) {
+	if (cd_pin >= 0) {
 		ret = gpio_request(cd_pin, "mmc_cd");
 		if (!ret)
 			ret = gpio_direction_input(cd_pin);
@@ -424,7 +425,7 @@ static int sunxi_mmc_getcd(struct mmc *mmc)
 	int cd_pin;
 
 	cd_pin = sunxi_mmc_getcd_gpio(mmchost->mmc_no);
-	if (cd_pin == -1)
+	if (cd_pin < 0)
 		return 1;
 
 	return !gpio_get_value(cd_pin);
Signature · 1 line
2.3.5
#6 lore raw

PATCH 2/21 sunxi: mmc: Fix card-detect gpio handling to work with the device-model

HI Hans,

Quoted 2 lines · Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi mmc code properly handle this.

FYI I tend to call it 'drive model' rather than 'device model'. It might be good to change your commit messages it to avoid confusion.

Quoted 46 lines
---
 drivers/mmc/sunxi_mmc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/sunxi_mmc.c +4 -4
index fcc278d..a664236 100644
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <asm/io.h>
@@ -37,7 +38,7 @@ static int sunxi_mmc_getcd_gpio(int sdc_no)
        case 2: return sunxi_name_to_gpio(CONFIG_MMC2_CD_PIN);
        case 3: return sunxi_name_to_gpio(CONFIG_MMC3_CD_PIN);
        }
-       return -1;
+       return -EINVAL;
 }
 
 static int mmc_resource_init(int sdc_no)
@@ -72,7 +73,7 @@ static int mmc_resource_init(int sdc_no)
        mmchost->mmc_no = sdc_no;
 
        cd_pin = sunxi_mmc_getcd_gpio(sdc_no);
-       if (cd_pin != -1) {
+       if (cd_pin >= 0) {
                ret = gpio_request(cd_pin, "mmc_cd");
                if (!ret)
                        ret = gpio_direction_input(cd_pin);
@@ -424,7 +425,7 @@ static int sunxi_mmc_getcd(struct mmc *mmc)
        int cd_pin;
 
        cd_pin = sunxi_mmc_getcd_gpio(mmchost->mmc_no);
-       if (cd_pin == -1)
+       if (cd_pin < 0)
                return 1;
 
        return !gpio_get_value(cd_pin);
--
Quoted 2 lines

2.3.5

Regards,
Simon

#7 lore raw

PATCH 2/21 sunxi: mmc: Fix card-detect gpio handling to work with the device-model

Quoted 7 lines · Simon Glass

HI Hans,

Quoted 2 lines · Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi mmc code properly handle this.

FYI I tend to call it 'drive model' rather than 'device model'. It

                              ^r?
Quoted 3 lines

might be good to change your commit messages it to avoid confusion.

#8 lore raw

PATCH 3/21 sunxi: usbc: Fix vbus gpio handling to work with the device-model

In reply to Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi usbc properly handle this.

---
 arch/arm/cpu/armv7/sunxi/usbc.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
arch/arm/cpu/armv7/sunxi/usbc.c +10 -9
index 515549d..39452a7 100644
@@ -17,6 +17,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <common.h>
+#include <errno.h>
 #ifdef CONFIG_AXP152_POWER
 #include <axp152.h>
 #endif
@@ -90,7 +91,7 @@ static int get_vbus_gpio(int index)
 	case 1: return sunxi_name_to_gpio(CONFIG_USB1_VBUS_PIN);
 	case 2: return sunxi_name_to_gpio(CONFIG_USB2_VBUS_PIN);
 	}
-	return -1;
+	return -EINVAL;
 }
 
 static int get_vbus_detect_gpio(int index)
@@ -187,13 +188,13 @@ int sunxi_usbc_request_resources(int index)
 	int ret = 0;
 
 	sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
-	if (sunxi_usbc->gpio_vbus != -1) {
+	if (sunxi_usbc->gpio_vbus >= 0) {
 		ret |= gpio_request(sunxi_usbc->gpio_vbus, "usbc_vbus");
 		ret |= gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
 	}
 
 	sunxi_usbc->gpio_vbus_det = get_vbus_detect_gpio(index);
-	if (sunxi_usbc->gpio_vbus_det != -1) {
+	if (sunxi_usbc->gpio_vbus_det >= 0) {
 		ret |= gpio_request(sunxi_usbc->gpio_vbus_det, "usbc_vbus_det");
 		ret |= gpio_direction_input(sunxi_usbc->gpio_vbus_det);
 	}
@@ -206,10 +207,10 @@ int sunxi_usbc_free_resources(int index)
 	struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
 	int ret = 0;
 
-	if (sunxi_usbc->gpio_vbus != -1)
+	if (sunxi_usbc->gpio_vbus >= 0)
 		ret |= gpio_free(sunxi_usbc->gpio_vbus);
 
-	if (sunxi_usbc->gpio_vbus_det != -1)
+	if (sunxi_usbc->gpio_vbus_det >= 0)
 		ret |= gpio_free(sunxi_usbc->gpio_vbus_det);
 
 	return ret;
@@ -263,7 +264,7 @@ void sunxi_usbc_vbus_enable(int index)
 {
 	struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
 
-	if (sunxi_usbc->gpio_vbus != -1)
+	if (sunxi_usbc->gpio_vbus >= 0)
 		gpio_set_value(sunxi_usbc->gpio_vbus, 1);
 }
 
@@ -271,7 +272,7 @@ void sunxi_usbc_vbus_disable(int index)
 {
 	struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
 
-	if (sunxi_usbc->gpio_vbus != -1)
+	if (sunxi_usbc->gpio_vbus >= 0)
 		gpio_set_value(sunxi_usbc->gpio_vbus, 0);
 }
 
@@ -280,9 +281,9 @@ int sunxi_usbc_vbus_detect(int index)
 	struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
 	int err, retries = 3;
 
-	if (sunxi_usbc->gpio_vbus_det == -1) {
+	if (sunxi_usbc->gpio_vbus_det < 0) {
 		eprintf("Error: invalid vbus detection pin\n");
-		return -1;
+		return sunxi_usbc->gpio_vbus_det;
 	}
 
 	err = gpio_get_value(sunxi_usbc->gpio_vbus_det);
Signature · 1 line
2.3.5
#9 lore raw

PATCH 3/21 sunxi: usbc: Fix vbus gpio handling to work with the device-model

arch/arm/cpu/armv7/sunxi/usbc.c int sunxi_usbc_request_resources(int index) · line 191

Quoted 3 lines · Hans de Goede
        sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
arch/arm/cpu/armv7/sunxi/usbc.c +1 -1
-       if (sunxi_usbc->gpio_vbus != -1) {
+       if (sunxi_usbc->gpio_vbus >= 0) {

What about using dm_gpio_is_valid() instead?

Regards,

Fabio Estevam

#10 lore raw

PATCH 3/21 sunxi: usbc: Fix vbus gpio handling to work with the device-model

Hi,

Quoted 7 lines · Fabio Estevam

arch/arm/cpu/armv7/sunxi/usbc.c int sunxi_usbc_request_resources(int index) · line 191

Quoted 3 lines · Hans de Goede
         sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
arch/arm/cpu/armv7/sunxi/usbc.c +1 -1
-       if (sunxi_usbc->gpio_vbus != -1) {
+       if (sunxi_usbc->gpio_vbus >= 0) {

What about using dm_gpio_is_valid() instead?

dm_gpio_is_valid takes a struct gpio_desc *, where as this code is using good old gpio indexes (int). We will likely want to convert this to getting the gpio from devicetree directly in the future, but first we need this patch-set to convert all sunxi boards to the device-model, so that we can make such changes without the need to introduce a whole lot of #ifdef-s

Regards,

Hans

#11 lore raw

PATCH 3/21 sunxi: usbc: Fix vbus gpio handling to work with the device-model

Quoted 13 lines · Hans de Goede

Hi,

Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Hans de Goede
         sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
arch/arm/cpu/armv7/sunxi/usbc.c +1 -1
-       if (sunxi_usbc->gpio_vbus != -1) {
+       if (sunxi_usbc->gpio_vbus >= 0) {
Quoted 9 lines
Quoted 1 line

What about using dm_gpio_is_valid() instead?

dm_gpio_is_valid takes a struct gpio_desc *, where as this code is using good old gpio indexes (int). We will likely want to convert this to getting the gpio from devicetree directly in the future, but first we need this patch-set to convert all sunxi boards to the device-model, so that we can make such changes without the need to introduce a whole lot of #ifdef-s

I think this is a good first step, but have the same concern.

Quoted 3 lines

Regards,

Hans

#13 lore raw

PATCH 4/21 sunxi: display: Fix gpio handling to work with the device-model

In reply to Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi display code properly handle this.

---
 drivers/video/sunxi_display.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/video/sunxi_display.c +8 -8
index 07c7a18..79a513c 100644
@@ -600,19 +600,19 @@ static void sunxi_lcdc_panel_enable(void)
 	 * white while the lcd inits.
 	 */
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
-	if (pin != -1) {
+	if (pin >= 0) {
 		gpio_request(pin, "lcd_backlight_enable");
 		gpio_direction_output(pin, 0);
 	}
 
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
-	if (pin != -1) {
+	if (pin >= 0) {
 		gpio_request(pin, "lcd_backlight_pwm");
 		gpio_direction_output(pin, PWM_OFF);
 	}
 
 	reset_pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_RESET);
-	if (reset_pin != -1) {
+	if (reset_pin >= 0) {
 		gpio_request(reset_pin, "lcd_reset");
 		gpio_direction_output(reset_pin, 0); /* Assert reset */
 	}
@@ -620,12 +620,12 @@ static void sunxi_lcdc_panel_enable(void)
 	/* Give the backlight some time to turn off and power up the panel. */
 	mdelay(40);
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_POWER);
-	if (pin != -1) {
+	if (pin >= 0) {
 		gpio_request(pin, "lcd_power");
 		gpio_direction_output(pin, 1);
 	}
 
-	if (reset_pin != -1)
+	if (reset_pin >= 0)
 		gpio_direction_output(reset_pin, 1); /* De-assert reset */
 }
 
@@ -640,11 +640,11 @@ static void sunxi_lcdc_backlight_enable(void)
 	mdelay(40);
 
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
-	if (pin != -1)
+	if (pin >= 0)
 		gpio_direction_output(pin, 1);
 
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
-	if (pin != -1)
+	if (pin >= 0)
 		gpio_direction_output(pin, PWM_ON);
 }
 
@@ -961,7 +961,7 @@ static void sunxi_vga_external_dac_enable(void)
 	int pin;
 
 	pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
-	if (pin != -1) {
+	if (pin >= 0) {
 		gpio_request(pin, "vga_enable");
 		gpio_direction_output(pin, 1);
 	}
Signature · 1 line
2.3.5
#14 lore raw

PATCH 4/21 sunxi: display: Fix gpio handling to work with the device-model

Hi Hans,

Quoted 8 lines · Hans de Goede

The device-model gpio functions may return another value then -1 as error, make the sunxi display code properly handle this.

---
 drivers/video/sunxi_display.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

I'm interested in your plan to get rid of sunxi_name_to_gpio().

Quoted 66 lines
drivers/video/sunxi_display.c +8 -9
index 07c7a18..79a513c 100644
@@ -600,19 +600,19 @@ static void sunxi_lcdc_panel_enable(void)
         * white while the lcd inits.
         */
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
-       if (pin != -1) {
+       if (pin >= 0) {
                gpio_request(pin, "lcd_backlight_enable");
                gpio_direction_output(pin, 0);
        }
 
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
-       if (pin != -1) {
+       if (pin >= 0) {
                gpio_request(pin, "lcd_backlight_pwm");
                gpio_direction_output(pin, PWM_OFF);
        }
 
        reset_pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_RESET);
-       if (reset_pin != -1) {
+       if (reset_pin >= 0) {
                gpio_request(reset_pin, "lcd_reset");
                gpio_direction_output(reset_pin, 0); /* Assert reset */
        }
@@ -620,12 +620,12 @@ static void sunxi_lcdc_panel_enable(void)
        /* Give the backlight some time to turn off and power up the panel. */
        mdelay(40);
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_POWER);
-       if (pin != -1) {
+       if (pin >= 0) {
                gpio_request(pin, "lcd_power");
                gpio_direction_output(pin, 1);
        }
 
-       if (reset_pin != -1)
+       if (reset_pin >= 0)
                gpio_direction_output(reset_pin, 1); /* De-assert reset */
 }
 
@@ -640,11 +640,11 @@ static void sunxi_lcdc_backlight_enable(void)
        mdelay(40);
 
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_EN);
-       if (pin != -1)
+       if (pin >= 0)
                gpio_direction_output(pin, 1);
 
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_BL_PWM);
-       if (pin != -1)
+       if (pin >= 0)
                gpio_direction_output(pin, PWM_ON);
 }
 
@@ -961,7 +961,7 @@ static void sunxi_vga_external_dac_enable(void)
        int pin;
 
        pin = sunxi_name_to_gpio(CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN);
-       if (pin != -1) {
+       if (pin >= 0) {
                gpio_request(pin, "vga_enable");
                gpio_direction_output(pin, 1);
        }
--
Quoted 2 lines

2.3.5

Regards,
Simon

#16 lore raw

PATCH 5/21 sunxi: soft-i2c: Fix gpio handling to work with the device-model

In reply to Hans de Goede

i2c_init_board() gets called before the device-model (gpio) code is initialized, so move the setup of the soft-i2c pins out of i2c_init_board() and into board_init(), at which time the device-model setup has been done.

Also add proper error checking and properly request the gpios as that is mandatory with the device-model.

---
 board/sunxi/board.c | 44 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 6 deletions(-)
board/sunxi/board.c +38 -6
index 171f0bc..6b93f92 100644
@@ -29,6 +29,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/usbc.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include <linux/usb/musb.h>
 #include <net.h>
@@ -37,6 +38,41 @@
 /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
 int soft_i2c_gpio_sda;
 int soft_i2c_gpio_scl;
+
+static int soft_i2c_board_init(void)
+{
+	int ret;
+
+	soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
+	if (soft_i2c_gpio_sda < 0) {
+		printf("Error invalid soft i2c sda pin: '%s', err %d\n",
+		       CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda);
+		return soft_i2c_gpio_sda;
+	}
+	ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda");
+	if (ret) {
+		printf("Error requesting soft i2c sda pin: '%s', err %d\n",
+		       CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret);
+		return ret;
+	}
+
+	soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
+	if (soft_i2c_gpio_scl < 0) {
+		printf("Error invalid soft i2c scl pin: '%s', err %d\n",
+		       CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl);
+		return soft_i2c_gpio_scl;
+	}
+	ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl");
+	if (ret) {
+		printf("Error requesting soft i2c scl pin: '%s', err %d\n",
+		       CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret);
+		return ret;
+	}
+
+	return 0;
+}
+#else
+static int soft_i2c_board_init(void) { return 0; }
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -57,7 +93,8 @@ int board_init(void)
 		asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000));
 	}
 
-	return 0;
+	/* Uses dm gpio code so do this here and not in i2c_init_board() */
+	return soft_i2c_board_init();
 }
 
 int dram_init(void)
@@ -351,11 +388,6 @@ void i2c_init_board(void)
 	clock_twi_onoff(4, 1);
 #endif
 #endif
-
-#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
-	soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
-	soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
-#endif
 }
 
 #ifdef CONFIG_SPL_BUILD
Signature · 1 line
2.3.5
#17 lore raw

PATCH 5/21 sunxi: soft-i2c: Fix gpio handling to work with the device-model

Hi Hans,

Quoted 11 lines · Hans de Goede

i2c_init_board() gets called before the device-model (gpio) code is initialized, so move the setup of the soft-i2c pins out of i2c_init_board() and into board_init(), at which time the device-model setup has been done.

Also add proper error checking and properly request the gpios as that is mandatory with the device-model.

---
 board/sunxi/board.c | 44 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 6 deletions(-)

But see i2c-gpio.c which should handle all of this once you move to device tree.

Quoted 78 lines
board/sunxi/board.c +38 -7
index 171f0bc..6b93f92 100644
@@ -29,6 +29,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/usbc.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include <linux/usb/musb.h>
 #include <net.h>
@@ -37,6 +38,41 @@
 /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
 int soft_i2c_gpio_sda;
 int soft_i2c_gpio_scl;
+
+static int soft_i2c_board_init(void)
+{
+       int ret;
+
+       soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
+       if (soft_i2c_gpio_sda < 0) {
+               printf("Error invalid soft i2c sda pin: '%s', err %d\n",
+                      CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda);
+               return soft_i2c_gpio_sda;
+       }
+       ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda");
+       if (ret) {
+               printf("Error requesting soft i2c sda pin: '%s', err %d\n",
+                      CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret);
+               return ret;
+       }
+
+       soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
+       if (soft_i2c_gpio_scl < 0) {
+               printf("Error invalid soft i2c scl pin: '%s', err %d\n",
+                      CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl);
+               return soft_i2c_gpio_scl;
+       }
+       ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl");
+       if (ret) {
+               printf("Error requesting soft i2c scl pin: '%s', err %d\n",
+                      CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret);
+               return ret;
+       }
+
+       return 0;
+}
+#else
+static int soft_i2c_board_init(void) { return 0; }
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -57,7 +93,8 @@ int board_init(void)
                asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000));
        }
 
-       return 0;
+       /* Uses dm gpio code so do this here and not in i2c_init_board() */
+       return soft_i2c_board_init();
 }
 
 int dram_init(void)
@@ -351,11 +388,6 @@ void i2c_init_board(void)
        clock_twi_onoff(4, 1);
 #endif
 #endif
-
-#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
-       soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
-       soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
-#endif
 }
 
 #ifdef CONFIG_SPL_BUILD
--
Quoted 2 lines

2.3.5

Regards,
Simon

#18 lore raw

PATCH 5/21 sunxi: soft-i2c: Fix gpio handling to work with the device-model

In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

i2c_init_board() gets called before the device-model (gpio) code is initialized, so move the setup of the soft-i2c pins out of i2c_init_board() and into board_init(), at which time the device-model setup has been done.

Also add proper error checking and properly request the gpios as that is mandatory with the device-model.

#19 lore raw

PATCH 6/21 sunxi: gpio: Rename GPIOs to include a 'P' prefix

In reply to Hans de Goede

From: Simon Glass <[email protected]>

By convention, sunxi GPIOs are named PA1, PA2 instead of A1, A2. Change the driver model GPIO driver for sunxi to use these names.

---
 drivers/gpio/sunxi_gpio.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpio/sunxi_gpio.c +4 -3
index cf5c624..29301c4 100644
@@ -249,10 +249,11 @@ static char *gpio_bank_name(int bank)
 {
 	char *name;
 
-	name = malloc(2);
+	name = malloc(3);
 	if (name) {
-		name[0] = 'A' + bank;
-		name[1] = '\0';
+		name[0] = 'P';
+		name[1] = 'A' + bank;
+		name[2] = '\0';
 	}
 
 	return name;
Signature · 1 line
2.3.5
#20 lore raw

PATCH 7/21 sunxi: gpio: Add temporary implementation of name_to_gpio()

In reply to Hans de Goede

From: Simon Glass <[email protected]>

Until sunxi moves to device tree (e.g. for USB) we need to convert named GPIOs to numbers. Add a function to do this.

This fixes the USB / EHCI support not working on the LinkSprite pcDuino3 (which uses devicemodel).

---
 drivers/gpio/sunxi_gpio.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpio/sunxi_gpio.c +11 -0
index 29301c4..89209df 100644
@@ -172,6 +172,17 @@ int sunxi_name_to_gpio(const char *name)
 #endif
 
 #ifdef CONFIG_DM_GPIO
+/* TODO(sjg at chromium.org): Remove this function and use device tree */
+int sunxi_name_to_gpio(const char *name)
+{
+	unsigned int gpio;
+	int ret;
+
+	ret = gpio_lookup_name(name, NULL, NULL, &gpio);
+
+	return ret ? ret : gpio;
+}
+
 static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
Signature · 1 line
2.3.5
#21 lore raw

PATCH 8/21 sunxi: gpio: Add compatible strings for all supported SoCs

In reply to Hans de Goede

We want to use device-model/fdt with other model SoCs too, so add compatible strings for the other SoCs to the dm sunxi gpio code.

---
 drivers/gpio/sunxi_gpio.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpio/sunxi_gpio.c +7 -0
index 89209df..e6a90b9 100644
@@ -322,7 +322,14 @@ static int gpio_sunxi_bind(struct udevice *parent)
 }
 
 static const struct udevice_id sunxi_gpio_ids[] = {
+	{ .compatible = "allwinner,sun4i-a10-pinctrl" },
+	{ .compatible = "allwinner,sun5i-a10s-pinctrl" },
+	{ .compatible = "allwinner,sun5i-a13-pinctrl" },
+	{ .compatible = "allwinner,sun6i-a31-pinctrl" },
+	{ .compatible = "allwinner,sun6i-a31s-pinctrl" },
 	{ .compatible = "allwinner,sun7i-a20-pinctrl" },
+	{ .compatible = "allwinner,sun8i-a23-pinctrl" },
+	{ .compatible = "allwinner,sun9i-a80-pinctrl" },
 	{ }
 };
 
Signature · 1 line
2.3.5
#22 lore raw

PATCH 8/21 sunxi: gpio: Add compatible strings for all supported SoCs

Quoted 7 lines · Hans de Goede

We want to use device-model/fdt with other model SoCs too, so add compatible strings for the other SoCs to the dm sunxi gpio code.

---
 drivers/gpio/sunxi_gpio.c | 7 +++++++
 1 file changed, 7 insertions(+)
Quoted 23 lines
drivers/gpio/sunxi_gpio.c +7 -1
index 89209df..e6a90b9 100644
@@ -322,7 +322,14 @@ static int gpio_sunxi_bind(struct udevice *parent)
 }
 
 static const struct udevice_id sunxi_gpio_ids[] = {
+       { .compatible = "allwinner,sun4i-a10-pinctrl" },
+       { .compatible = "allwinner,sun5i-a10s-pinctrl" },
+       { .compatible = "allwinner,sun5i-a13-pinctrl" },
+       { .compatible = "allwinner,sun6i-a31-pinctrl" },
+       { .compatible = "allwinner,sun6i-a31s-pinctrl" },
        { .compatible = "allwinner,sun7i-a20-pinctrl" },
+       { .compatible = "allwinner,sun8i-a23-pinctrl" },
+       { .compatible = "allwinner,sun9i-a80-pinctrl" },
        { }
 };
 
--

2.3.5

#24 lore raw

PATCH 9/21 sunxi: gpio: Build sunxi_name_to_gpio_bank for device-model code too

In reply to Hans de Goede

When doing a device-model enabled build we still need sunxi_name_to_gpio_bank (for now) for the mmc pinmux code in board/sunxi/board.c, so build it for device-model enabled builds too.

---
 drivers/gpio/sunxi_gpio.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/gpio/sunxi_gpio.c +14 -14
index e6a90b9..91af1a5 100644
@@ -118,20 +118,6 @@ int gpio_set_value(unsigned gpio, int value)
 	return sunxi_gpio_output(gpio, value);
 }
 
-int sunxi_name_to_gpio_bank(const char *name)
-{
-	int group = 0;
-
-	if (*name == 'P' || *name == 'p')
-		name++;
-	if (*name >= 'A') {
-		group = *name - (*name > 'a' ? 'a' : 'A');
-		return group;
-	}
-
-	return -1;
-}
-
 int sunxi_name_to_gpio(const char *name)
 {
 	int group = 0;
@@ -171,6 +157,20 @@ int sunxi_name_to_gpio(const char *name)
 }
 #endif
 
+int sunxi_name_to_gpio_bank(const char *name)
+{
+	int group = 0;
+
+	if (*name == 'P' || *name == 'p')
+		name++;
+	if (*name >= 'A') {
+		group = *name - (*name > 'a' ? 'a' : 'A');
+		return group;
+	}
+
+	return -1;
+}
+
 #ifdef CONFIG_DM_GPIO
 /* TODO(sjg at chromium.org): Remove this function and use device tree */
 int sunxi_name_to_gpio(const char *name)
Signature · 1 line
2.3.5
#25 lore raw

PATCH 9/21 sunxi: gpio: Build sunxi_name_to_gpio_bank for device-model code too

Quoted 8 lines · Hans de Goede

When doing a device-model enabled build we still need sunxi_name_to_gpio_bank (for now) for the mmc pinmux code in board/sunxi/board.c, so build it for device-model enabled builds too.

---
 drivers/gpio/sunxi_gpio.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Oh dear! Hope it goes away soon.

Quoted 50 lines
drivers/gpio/sunxi_gpio.c +14 -15
index e6a90b9..91af1a5 100644
@@ -118,20 +118,6 @@ int gpio_set_value(unsigned gpio, int value)
        return sunxi_gpio_output(gpio, value);
 }
 
-int sunxi_name_to_gpio_bank(const char *name)
-{
-       int group = 0;
-
-       if (*name == 'P' || *name == 'p')
-               name++;
-       if (*name >= 'A') {
-               group = *name - (*name > 'a' ? 'a' : 'A');
-               return group;
-       }
-
-       return -1;
-}
-
 int sunxi_name_to_gpio(const char *name)
 {
        int group = 0;
@@ -171,6 +157,20 @@ int sunxi_name_to_gpio(const char *name)
 }
 #endif
 
+int sunxi_name_to_gpio_bank(const char *name)
+{
+       int group = 0;
+
+       if (*name == 'P' || *name == 'p')
+               name++;
+       if (*name >= 'A') {
+               group = *name - (*name > 'a' ? 'a' : 'A');
+               return group;
+       }
+
+       return -1;
+}
+
 #ifdef CONFIG_DM_GPIO
 /* TODO(sjg at chromium.org): Remove this function and use device tree */
 int sunxi_name_to_gpio(const char *name)
--

2.3.5

#27 lore raw

PATCH 10/21 sunxi: gpio: Change axp_gpio_foo prototype to match gpio uclass ops

In reply to Hans de Goede

Change the axp_gpio_foo function prototypes to match the gpio uclass op prototypes, so that they can be used directly when adding device-model support for the axp gpios.

---
 drivers/gpio/sunxi_gpio.c |  8 ++++----
 drivers/power/axp209.c    | 10 +++++-----
 drivers/power/axp221.c    | 10 +++++-----
 include/axp209.h          | 10 ++++++----
 include/axp221.h          | 10 ++++++----
 5 files changed, 26 insertions(+), 22 deletions(-)
drivers/gpio/sunxi_gpio.c +4 -4
index 91af1a5..0774b70 100644
@@ -81,7 +81,7 @@ int gpio_direction_input(unsigned gpio)
 {
 #ifdef AXP_GPIO
 	if (gpio >= SUNXI_GPIO_AXP0_START)
-		return axp_gpio_direction_input(gpio - SUNXI_GPIO_AXP0_START);
+		return axp_gpio_direction_input(NULL, gpio - SUNXI_GPIO_AXP0_START);
 #endif
 	sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_INPUT);
 
@@ -92,7 +92,7 @@ int gpio_direction_output(unsigned gpio, int value)
 {
 #ifdef AXP_GPIO
 	if (gpio >= SUNXI_GPIO_AXP0_START)
-		return axp_gpio_direction_output(gpio - SUNXI_GPIO_AXP0_START,
+		return axp_gpio_direction_output(NULL, gpio - SUNXI_GPIO_AXP0_START,
 						 value);
 #endif
 	sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_OUTPUT);
@@ -104,7 +104,7 @@ int gpio_get_value(unsigned gpio)
 {
 #ifdef AXP_GPIO
 	if (gpio >= SUNXI_GPIO_AXP0_START)
-		return axp_gpio_get_value(gpio - SUNXI_GPIO_AXP0_START);
+		return axp_gpio_get_value(NULL, gpio - SUNXI_GPIO_AXP0_START);
 #endif
 	return sunxi_gpio_input(gpio);
 }
@@ -113,7 +113,7 @@ int gpio_set_value(unsigned gpio, int value)
 {
 #ifdef AXP_GPIO
 	if (gpio >= SUNXI_GPIO_AXP0_START)
-		return axp_gpio_set_value(gpio - SUNXI_GPIO_AXP0_START, value);
+		return axp_gpio_set_value(NULL, gpio - SUNXI_GPIO_AXP0_START, value);
 #endif
 	return sunxi_gpio_output(gpio, value);
 }
drivers/power/axp209.c +5 -5
index 1d7be49..98c214f 100644
@@ -167,7 +167,7 @@ static u8 axp209_get_gpio_ctrl_reg(unsigned int pin)
 	return 0;
 }
 
-int axp_gpio_direction_input(unsigned int pin)
+int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
 {
 	if (pin == SUNXI_GPIO_AXP0_VBUS_DETECT)
 		return 0;
@@ -179,7 +179,7 @@ int axp_gpio_direction_input(unsigned int pin)
 	return axp209_write(reg, val);
 }
 
-int axp_gpio_direction_output(unsigned int pin, unsigned int val)
+int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
 {
 	u8 reg = axp209_get_gpio_ctrl_reg(pin);
 
@@ -194,7 +194,7 @@ int axp_gpio_direction_output(unsigned int pin, unsigned int val)
 	return axp209_write(reg, val);
 }
 
-int axp_gpio_get_value(unsigned int pin)
+int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 {
 	u8 val, mask;
 	int rc;
@@ -215,7 +215,7 @@ int axp_gpio_get_value(unsigned int pin)
 	return (val & mask) ? 1 : 0;
 }
 
-int axp_gpio_set_value(unsigned int pin, unsigned int val)
+int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 {
-	return axp_gpio_direction_output(pin, val);
+	return axp_gpio_direction_output(dev, pin, val);
 }
drivers/power/axp221.c +5 -5
index dc3a7f1..4970ab4 100644
@@ -386,7 +386,7 @@ int axp221_get_sid(unsigned int *sid)
 	return 0;
 }
 
-int axp_gpio_direction_input(unsigned int pin)
+int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
 {
 	switch (pin) {
 	case SUNXI_GPIO_AXP0_VBUS_DETECT:
@@ -396,7 +396,7 @@ int axp_gpio_direction_input(unsigned int pin)
 	}
 }
 
-int axp_gpio_direction_output(unsigned int pin, unsigned int val)
+int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
 {
 	int ret;
 
@@ -407,13 +407,13 @@ int axp_gpio_direction_output(unsigned int pin, unsigned int val)
 		if (ret)
 			return ret;
 
-		return axp_gpio_set_value(pin, val);
+		return axp_gpio_set_value(dev, pin, val);
 	default:
 		return -EINVAL;
 	}
 }
 
-int axp_gpio_get_value(unsigned int pin)
+int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 {
 	int ret;
 	u8 val;
@@ -430,7 +430,7 @@ int axp_gpio_get_value(unsigned int pin)
 	}
 }
 
-int axp_gpio_set_value(unsigned int pin, unsigned int val)
+int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 {
 	int ret;
 
include/axp209.h +6 -4
index d36da41..fe4a169 100644
@@ -4,6 +4,8 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+struct udevice;
+
 enum axp209_reg {
 	AXP209_POWER_STATUS = 0x00,
 	AXP209_CHIP_VERSION = 0x03,
@@ -53,7 +55,7 @@ extern int axp209_init(void);
 extern int axp209_poweron_by_dc(void);
 extern int axp209_power_button(void);
 
-extern int axp_gpio_direction_input(unsigned int pin);
-extern int axp_gpio_direction_output(unsigned int pin, unsigned int val);
-extern int axp_gpio_get_value(unsigned int pin);
-extern int axp_gpio_set_value(unsigned int pin, unsigned int val);
+extern int axp_gpio_direction_input(struct udevice *dev, unsigned offset);
+extern int axp_gpio_direction_output(struct udevice *dev, unsigned offset, int val);
+extern int axp_gpio_get_value(struct udevice *dev, unsigned offset);
+extern int axp_gpio_set_value(struct udevice *dev, unsigned offset, int val);
include/axp221.h +6 -4
index 0aac04d..e826ca8 100644
@@ -6,6 +6,8 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+struct udevice;
+
 #define AXP221_CHIP_ADDR 0x68
 #define AXP221_CTRL_ADDR 0x3e
 #define AXP221_INIT_DATA 0x3e
@@ -80,7 +82,7 @@ int axp221_set_eldo(int eldo_num, unsigned int mvolt);
 int axp221_init(void);
 int axp221_get_sid(unsigned int *sid);
 
-int axp_gpio_direction_input(unsigned int pin);
-int axp_gpio_direction_output(unsigned int pin, unsigned int val);
-int axp_gpio_get_value(unsigned int pin);
-int axp_gpio_set_value(unsigned int pin, unsigned int val);
+int axp_gpio_direction_input(struct udevice *dev, unsigned offset);
+int axp_gpio_direction_output(struct udevice *dev, unsigned offset, int val);
+int axp_gpio_get_value(struct udevice *dev, unsigned offset);
+int axp_gpio_set_value(struct udevice *dev, unsigned offset, int val);
Signature · 1 line
2.3.5
#28 lore raw

PATCH 10/21 sunxi: gpio: Change axp_gpio_foo prototype to match gpio uclass ops

Hi Hans,

Quoted 4 lines · Hans de Goede

Change the axp_gpio_foo function prototypes to match the gpio uclass op prototypes, so that they can be used directly when adding device-model support for the axp gpios.

Quoted 8 lines
---
 drivers/gpio/sunxi_gpio.c |  8 ++++----
 drivers/power/axp209.c    | 10 +++++-----
 drivers/power/axp221.c    | 10 +++++-----
 include/axp209.h          | 10 ++++++----
 include/axp221.h          | 10 ++++++----
 5 files changed, 26 insertions(+), 22 deletions(-)

This AXP think should be a separate GPIO driver.

Quoted 180 lines
drivers/gpio/sunxi_gpio.c +4 -4
index 91af1a5..0774b70 100644
@@ -81,7 +81,7 @@ int gpio_direction_input(unsigned gpio)
 {
 #ifdef AXP_GPIO
        if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_direction_input(gpio - SUNXI_GPIO_AXP0_START);
+               return axp_gpio_direction_input(NULL, gpio - SUNXI_GPIO_AXP0_START);
 #endif
        sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_INPUT);
 
@@ -92,7 +92,7 @@ int gpio_direction_output(unsigned gpio, int value)
 {
 #ifdef AXP_GPIO
        if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_direction_output(gpio - SUNXI_GPIO_AXP0_START,
+               return axp_gpio_direction_output(NULL, gpio - SUNXI_GPIO_AXP0_START,
                                                 value);
 #endif
        sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_OUTPUT);
@@ -104,7 +104,7 @@ int gpio_get_value(unsigned gpio)
 {
 #ifdef AXP_GPIO
        if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_get_value(gpio - SUNXI_GPIO_AXP0_START);
+               return axp_gpio_get_value(NULL, gpio - SUNXI_GPIO_AXP0_START);
 #endif
        return sunxi_gpio_input(gpio);
 }
@@ -113,7 +113,7 @@ int gpio_set_value(unsigned gpio, int value)
 {
 #ifdef AXP_GPIO
        if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_set_value(gpio - SUNXI_GPIO_AXP0_START, value);
+               return axp_gpio_set_value(NULL, gpio - SUNXI_GPIO_AXP0_START, value);
 #endif
        return sunxi_gpio_output(gpio, value);
 }
drivers/power/axp209.c +5 -5
index 1d7be49..98c214f 100644
@@ -167,7 +167,7 @@ static u8 axp209_get_gpio_ctrl_reg(unsigned int pin)
        return 0;
 }
 
-int axp_gpio_direction_input(unsigned int pin)
+int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
 {
        if (pin == SUNXI_GPIO_AXP0_VBUS_DETECT)
                return 0;
@@ -179,7 +179,7 @@ int axp_gpio_direction_input(unsigned int pin)
        return axp209_write(reg, val);
 }
 
-int axp_gpio_direction_output(unsigned int pin, unsigned int val)
+int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
 {
        u8 reg = axp209_get_gpio_ctrl_reg(pin);
 
@@ -194,7 +194,7 @@ int axp_gpio_direction_output(unsigned int pin, unsigned int val)
        return axp209_write(reg, val);
 }
 
-int axp_gpio_get_value(unsigned int pin)
+int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 {
        u8 val, mask;
        int rc;
@@ -215,7 +215,7 @@ int axp_gpio_get_value(unsigned int pin)
        return (val & mask) ? 1 : 0;
 }
 
-int axp_gpio_set_value(unsigned int pin, unsigned int val)
+int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 {
-       return axp_gpio_direction_output(pin, val);
+       return axp_gpio_direction_output(dev, pin, val);
 }
drivers/power/axp221.c +5 -5
index dc3a7f1..4970ab4 100644
@@ -386,7 +386,7 @@ int axp221_get_sid(unsigned int *sid)
        return 0;
 }
 
-int axp_gpio_direction_input(unsigned int pin)
+int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
 {
        switch (pin) {
        case SUNXI_GPIO_AXP0_VBUS_DETECT:
@@ -396,7 +396,7 @@ int axp_gpio_direction_input(unsigned int pin)
        }
 }
 
-int axp_gpio_direction_output(unsigned int pin, unsigned int val)
+int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
 {
        int ret;
 
@@ -407,13 +407,13 @@ int axp_gpio_direction_output(unsigned int pin, unsigned int val)
                if (ret)
                        return ret;
 
-               return axp_gpio_set_value(pin, val);
+               return axp_gpio_set_value(dev, pin, val);
        default:
                return -EINVAL;
        }
 }
 
-int axp_gpio_get_value(unsigned int pin)
+int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 {
        int ret;
        u8 val;
@@ -430,7 +430,7 @@ int axp_gpio_get_value(unsigned int pin)
        }
 }
 
-int axp_gpio_set_value(unsigned int pin, unsigned int val)
+int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 {
        int ret;
 
include/axp209.h +6 -4
index d36da41..fe4a169 100644
@@ -4,6 +4,8 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+struct udevice;
+
 enum axp209_reg {
        AXP209_POWER_STATUS = 0x00,
        AXP209_CHIP_VERSION = 0x03,
@@ -53,7 +55,7 @@ extern int axp209_init(void);
 extern int axp209_poweron_by_dc(void);
 extern int axp209_power_button(void);
 
-extern int axp_gpio_direction_input(unsigned int pin);
-extern int axp_gpio_direction_output(unsigned int pin, unsigned int val);
-extern int axp_gpio_get_value(unsigned int pin);
-extern int axp_gpio_set_value(unsigned int pin, unsigned int val);
+extern int axp_gpio_direction_input(struct udevice *dev, unsigned offset);
+extern int axp_gpio_direction_output(struct udevice *dev, unsigned offset, int val);
+extern int axp_gpio_get_value(struct udevice *dev, unsigned offset);
+extern int axp_gpio_set_value(struct udevice *dev, unsigned offset, int val);
include/axp221.h +6 -5
index 0aac04d..e826ca8 100644
@@ -6,6 +6,8 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+struct udevice;
+
 #define AXP221_CHIP_ADDR 0x68
 #define AXP221_CTRL_ADDR 0x3e
 #define AXP221_INIT_DATA 0x3e
@@ -80,7 +82,7 @@ int axp221_set_eldo(int eldo_num, unsigned int mvolt);
 int axp221_init(void);
 int axp221_get_sid(unsigned int *sid);
 
-int axp_gpio_direction_input(unsigned int pin);
-int axp_gpio_direction_output(unsigned int pin, unsigned int val);
-int axp_gpio_get_value(unsigned int pin);
-int axp_gpio_set_value(unsigned int pin, unsigned int val);
+int axp_gpio_direction_input(struct udevice *dev, unsigned offset);
+int axp_gpio_direction_output(struct udevice *dev, unsigned offset, int val);
+int axp_gpio_get_value(struct udevice *dev, unsigned offset);
+int axp_gpio_set_value(struct udevice *dev, unsigned offset, int val);
--
Quoted 2 lines

2.3.5

Regards,
Simon

#29 lore raw

PATCH 11/21 sunxi: gpio: Add support for AXP gpios to the dm gpio code

In reply to Hans de Goede

This really should be part of the axp pmic driver, but that is not converted yet to device-model, and the upstream kernel does not support axp gpios yet so there is no devicetree binding for them yet.

So for now bolt on the axp gpio support to the SoC's own gpio support like we've been doing for the non dm case. This allows boards using axp gpios to be converted to dm.

---
 arch/arm/include/asm/arch-sunxi/gpio.h |  6 ++--
 drivers/gpio/sunxi_gpio.c              | 64 +++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 10 deletions(-)
arch/arm/include/asm/arch-sunxi/gpio.h +4 -2
index c9bfb4c..cbb3328 100644
@@ -204,8 +204,10 @@ enum sunxi_gpio_number {
 #define SUNXI_GPIO_PULL_DOWN	2
 
 /* Virtual AXP0 GPIOs */
-#define SUNXI_GPIO_AXP0_VBUS_DETECT	8
-#define SUNXI_GPIO_AXP0_VBUS_ENABLE	9
+#define SUNXI_GPIO_AXP0_PREFIX "AXP0-"
+#define SUNXI_GPIO_AXP0_VBUS_DETECT	4
+#define SUNXI_GPIO_AXP0_VBUS_ENABLE	5
+#define SUNXI_GPIO_AXP0_GPIO_COUNT	6
 
 void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val);
 void sunxi_gpio_set_cfgpin(u32 pin, u32 val);
drivers/gpio/sunxi_gpio.c +56 -8

109 lines not on this page · raw message

Signature · 1 line
2.3.5
#30 lore raw

PATCH 11/21 sunxi: gpio: Add support for AXP gpios to the dm gpio code

Hi,

On 24-04-15 15:48, Hans de Goede wrote:

<snip>

drivers/gpio/sunxi_gpio.c static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset, · line 272

Quoted 9 lines
drivers/gpio/sunxi_gpio.c +1 -1
@@ -222,7 +266,7 @@ static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset,
  	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
  	u32 num = GPIO_NUM(offset);
 
-	clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
+;	clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
  	return 0;
  }
 

No idea how that got in there, dropped in my personal tree.

Regards,

Hans

#31 lore raw

PATCH 11/21 sunxi: gpio: Add support for AXP gpios to the dm gpio code

In reply to Hans de Goede

Hi Hans,

Quoted 8 lines · Hans de Goede

This really should be part of the axp pmic driver, but that is not converted yet to device-model, and the upstream kernel does not support axp gpios yet so there is no devicetree binding for them yet.

So for now bolt on the axp gpio support to the SoC's own gpio support like we've been doing for the non dm case. This allows boards using axp gpios to be converted to dm.

Quoted 5 lines
---
 arch/arm/include/asm/arch-sunxi/gpio.h |  6 ++--
 drivers/gpio/sunxi_gpio.c              | 64 +++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 10 deletions(-)

This doesn't seem like a good idea. The device tree binding is just an I2C one isn't it? Is the real problem that you are trying to convert to driver model without converting to device tree? For I2C at least, that is not supported.

Quoted 137 lines
arch/arm/include/asm/arch-sunxi/gpio.h +4 -2
index c9bfb4c..cbb3328 100644
@@ -204,8 +204,10 @@ enum sunxi_gpio_number {
 #define SUNXI_GPIO_PULL_DOWN   2
 
 /* Virtual AXP0 GPIOs */
-#define SUNXI_GPIO_AXP0_VBUS_DETECT    8
-#define SUNXI_GPIO_AXP0_VBUS_ENABLE    9
+#define SUNXI_GPIO_AXP0_PREFIX "AXP0-"
+#define SUNXI_GPIO_AXP0_VBUS_DETECT    4
+#define SUNXI_GPIO_AXP0_VBUS_ENABLE    5
+#define SUNXI_GPIO_AXP0_GPIO_COUNT     6
 
 void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val);
 void sunxi_gpio_set_cfgpin(u32 pin, u32 val);
drivers/gpio/sunxi_gpio.c +56 -9
index 0774b70..38d72b7 100644
@@ -126,7 +126,7 @@ int sunxi_name_to_gpio(const char *name)
        char *eptr;
 
 #ifdef AXP_GPIO
-       if (strncasecmp(name, "AXP0-", 5) == 0) {
+       if (strncasecmp(name, SUNXI_GPIO_AXP0_PREFIX, 5) == 0) {
                name += 5;
                if (strcmp(name, "VBUS-DETECT") == 0)
                        return SUNXI_GPIO_AXP0_START +
@@ -172,12 +172,56 @@ int sunxi_name_to_gpio_bank(const char *name)
 }
 
 #ifdef CONFIG_DM_GPIO
+
+#ifdef AXP_GPIO
+/* FIXME this should be part of the axp drivers */
+static const struct dm_gpio_ops gpio_axp_ops = {
+       .direction_input        = axp_gpio_direction_input,
+       .direction_output       = axp_gpio_direction_output,
+       .get_value              = axp_gpio_get_value,
+       .set_value              = axp_gpio_set_value,
+};
+
+static int gpio_axp_probe(struct udevice *dev)
+{
+       struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+
+       /* Tell the uclass how many GPIOs we have */
+       uc_priv->bank_name = strdup(SUNXI_GPIO_AXP0_PREFIX);
+       uc_priv->gpio_count = SUNXI_GPIO_AXP0_GPIO_COUNT;
+
+       return 0;
+}
+
+struct driver gpio_axp_driver = {
+       .name   = "gpio_axp",
+       .id     = UCLASS_GPIO,
+       .ops    = &gpio_axp_ops,
+       .probe  = gpio_axp_probe,
+};
+#endif
+
 /* TODO(sjg at chromium.org): Remove this function and use device tree */
 int sunxi_name_to_gpio(const char *name)
 {
        unsigned int gpio;
        int ret;
-
+#ifdef AXP_GPIO
+       char lookup[8];
+
+       if (strncasecmp(name, SUNXI_GPIO_AXP0_PREFIX, 5) == 0) {
+               int len = strlen(SUNXI_GPIO_AXP0_PREFIX);
+               if (strcmp(name + len, "VBUS-DETECT") == 0) {
+                       sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d",
+                               SUNXI_GPIO_AXP0_VBUS_DETECT);
+                       name = lookup;
+               } else if (strcmp(name + len, "VBUS-ENABLE") == 0) {
+                       sprintf(lookup, "AXP0-%d\n",
+                               SUNXI_GPIO_AXP0_VBUS_ENABLE);
+                       name = lookup;
+               }
+       }
+#endif
        ret = gpio_lookup_name(name, NULL, NULL, &gpio);
 
        return ret ? ret : gpio;
@@ -222,7 +266,7 @@ static int sunxi_gpio_set_value(struct udevice *dev, unsigned offset,
        struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
        u32 num = GPIO_NUM(offset);
 
-       clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
+;      clrsetbits_le32(&plat->regs->dat, 1 << num, value ? (1 << num) : 0);
        return 0;
 }
 
@@ -289,21 +333,19 @@ static int gpio_sunxi_probe(struct udevice *dev)
  */
 static int gpio_sunxi_bind(struct udevice *parent)
 {
-       struct sunxi_gpio_platdata *plat = parent->platdata;
+       struct sunxi_gpio_platdata *plat;
        struct sunxi_gpio_reg *ctlr;
+       struct udevice *dev;
        int bank;
        int ret;
 
        /* If this is a child device, there is nothing to do here */
-       if (plat)
+       if (parent->platdata)
                return 0;
 
        ctlr = (struct sunxi_gpio_reg *)fdtdec_get_addr(gd->fdt_blob,
                                                   parent->of_offset, "reg");
        for (bank = 0; bank < SUNXI_GPIO_BANKS; bank++) {
-               struct sunxi_gpio_platdata *plat;
-               struct udevice *dev;
-
                plat = calloc(1, sizeof(*plat));
                if (!plat)
                        return -ENOMEM;
@@ -318,6 +360,12 @@ static int gpio_sunxi_bind(struct udevice *parent)
                dev->of_offset = parent->of_offset;
        }
 
+#ifdef AXP_GPIO
+       /* FIXME this should be a child of the axp device */
+       ret = device_bind(parent, &gpio_axp_driver, "AXP", NULL, -1, &dev);
+       if (ret)
+               return ret;
+#endif
        return 0;
 }
 
--
Quoted 2 lines

2.3.5

Regards,
Simon

#32 lore raw

PATCH 12/21 sunxi: gmac: Move sunxi_gmac_initialize proto out of netdev.h

In reply to Hans de Goede

netdev.h should not be included in device-model enabled builds (doing so causes compiler warnings about struct eth_device not being declared), but we do use sunxi_gmac_initialize in the device-model case, so move it out of netdev.h .

---
 arch/arm/include/asm/arch-sunxi/sys_proto.h | 3 +++
 include/netdev.h                            | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-sunxi/sys_proto.h +3 -0
index 60a5bd8..9df3744 100644
@@ -23,4 +23,7 @@ void sdelay(unsigned long);
  */
 void return_to_fel(uint32_t lr, uint32_t sp);
 
+/* Board / SoC level designware gmac init */
+int sunxi_gmac_initialize(bd_t *bis);
+
 #endif
include/netdev.h +0 -1
index d96e1da..e6bdfdf 100644
@@ -81,7 +81,6 @@ int skge_initialize(bd_t *bis);
 int smc91111_initialize(u8 dev_num, int base_addr);
 int smc911x_initialize(u8 dev_num, int base_addr);
 int sunxi_emac_initialize(bd_t *bis);
-int sunxi_gmac_initialize(bd_t *bis);
 int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
 int uli526x_initialize(bd_t *bis);
Signature · 1 line
2.3.5
#33 lore raw

PATCH 12/21 sunxi: gmac: Move sunxi_gmac_initialize proto out of netdev.h

Quoted 11 lines · Hans de Goede

netdev.h should not be included in device-model enabled builds (doing so causes compiler warnings about struct eth_device not being declared), but we do use sunxi_gmac_initialize in the device-model case, so move it out of netdev.h .

---
 arch/arm/include/asm/arch-sunxi/sys_proto.h | 3 +++
 include/netdev.h                            | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
Quoted 27 lines
arch/arm/include/asm/arch-sunxi/sys_proto.h +3 -0
index 60a5bd8..9df3744 100644
@@ -23,4 +23,7 @@ void sdelay(unsigned long);
  */
 void return_to_fel(uint32_t lr, uint32_t sp);
 
+/* Board / SoC level designware gmac init */
+int sunxi_gmac_initialize(bd_t *bis);
+
 #endif
include/netdev.h +0 -2
index d96e1da..e6bdfdf 100644
@@ -81,7 +81,6 @@ int skge_initialize(bd_t *bis);
 int smc91111_initialize(u8 dev_num, int base_addr);
 int smc911x_initialize(u8 dev_num, int base_addr);
 int sunxi_emac_initialize(bd_t *bis);
-int sunxi_gmac_initialize(bd_t *bis);
 int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
 int uli526x_initialize(bd_t *bis);
--

2.3.5

#34 lore raw

PATCH 12/21 sunxi: gmac: Move sunxi_gmac_initialize proto out of netdev.h

In reply to Hans de Goede
Quoted 4 lines · Hans de Goede

netdev.h should not be included in device-model enabled builds (doing so causes compiler warnings about struct eth_device not being declared), but we do use sunxi_gmac_initialize in the device-model case, so move it out of netdev.h .

Worth keeping the emac one alongside?

Regardless:

Quoted 1 line
#35 lore raw

PATCH 12/21 sunxi: gmac: Move sunxi_gmac_initialize proto out of netdev.h

Hi,

Thanks for the reviews!

Quoted 7 lines · Ian Campbell
Quoted 4 lines · Hans de Goede

netdev.h should not be included in device-model enabled builds (doing so causes compiler warnings about struct eth_device not being declared), but we do use sunxi_gmac_initialize in the device-model case, so move it out of netdev.h .

Worth keeping the emac one alongside?

It gets completely removed in "sunxi: emac: Remove non device-model code" :)

Regards,

Hans

#36 lore raw

PATCH 13/21 sunxi: emac: port to phylib

In reply to Hans de Goede

This is a preparation-patch for adding device-model support to the emac driver.

---
 drivers/net/sunxi_emac.c       | 111 +++++++++++++++++++++++++----------------
 include/configs/sunxi-common.h |   2 +
 2 files changed, 71 insertions(+), 42 deletions(-)
drivers/net/sunxi_emac.c +69 -42
index 7b31f8c..b9fd1b8 100644
@@ -156,9 +156,9 @@ struct sunxi_sramc_regs {
 #define DMA_CPU_TRRESHOLD	2000
 
 struct emac_eth_dev {
-	u32 speed;
-	u32 duplex;
-	u32 phy_configured;
+	struct emac_regs *regs;
+	struct mii_dev *bus;
+	struct phy_device *phydev;
 	int link_printed;
 };
 
@@ -195,11 +195,10 @@ static void emac_outblk_32bit(void *reg, void *data, int count)
 }
 
 /* Read a word from phyxcer */
-static int emac_phy_read(const char *devname, unsigned char addr,
-			  unsigned char reg, unsigned short *value)
+static int emac_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)
 {
-	struct eth_device *dev = eth_get_dev_by_name(devname);
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	struct emac_eth_dev *priv = bus->priv;
+	struct emac_regs *regs = priv->regs;
 
 	/* issue the phy address and reg */
 	writel(addr << 8 | reg, &regs->mac_madr);
@@ -213,18 +212,16 @@ static int emac_phy_read(const char *devname, unsigned char addr,
 	/* push down the phy io line */
 	writel(0x0, &regs->mac_mcmd);
 
-	/* and write data */
-	*value = readl(&regs->mac_mrdd);
-
-	return 0;
+	/* And read data */
+	return readl(&regs->mac_mrdd);
 }
 
 /* Write a word to phyxcer */
-static int emac_phy_write(const char *devname, unsigned char addr,
-			   unsigned char reg, unsigned short value)
+static int emac_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
+			  u16 value)
 {
-	struct eth_device *dev = eth_get_dev_by_name(devname);
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	struct emac_eth_dev *priv = bus->priv;
+	struct emac_regs *regs = priv->regs;
 
 	/* issue the phy address and reg */
 	writel(addr << 8 | reg, &regs->mac_madr);
@@ -244,12 +241,44 @@ static int emac_phy_write(const char *devname, unsigned char addr,
 	return 0;
 }
 
-static void emac_setup(struct eth_device *dev)
+static int sunxi_emac_init_phy(struct emac_eth_dev *priv, void *dev)
 {
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	int ret, mask = 0xffffffff;
+
+#ifdef CONFIG_PHY_ADDR
+	mask = 1 << CONFIG_PHY_ADDR;
+#endif
+
+	priv->bus = mdio_alloc();
+	if (!priv->bus) {
+		printf("Failed to allocate MDIO bus\n");
+		return -ENOMEM;
+	}
+
+	priv->bus->read = emac_mdio_read;
+	priv->bus->write = emac_mdio_write;
+	priv->bus->priv = priv;
+	strcpy(priv->bus->name, "emac");
+
+	ret = mdio_register(priv->bus);
+	if (ret)
+		return ret;
+
+	priv->phydev = phy_find_by_mask(priv->bus, mask,
+					PHY_INTERFACE_MODE_MII);
+	if (!priv->phydev)
+		return -ENODEV;
+
+	phy_connect_dev(priv->phydev, dev);
+	phy_config(priv->phydev);
+
+	return 0;
+}
+
+static void emac_setup(struct emac_eth_dev *priv)
+{
+	struct emac_regs *regs = priv->regs;
 	u32 reg_val;
-	u16 phy_val;
-	u32 duplex_flag;
 
 	/* Set up TX */
 	writel(EMAC_TX_SETUP, &regs->tx_mode);
@@ -262,12 +291,8 @@ static void emac_setup(struct eth_device *dev)
 	writel(EMAC_MAC_CTL0_SETUP, &regs->mac_ctl0);
 
 	/* Set MAC CTL1 */
-	emac_phy_read(dev->name, 1, 0, &phy_val);
-	debug("PHY SETUP, reg 0 value: %x\n", phy_val);
-	duplex_flag = !!(phy_val & (1 << 8));
-
 	reg_val = 0;
-	if (duplex_flag)
+	if (priv->phydev->duplex == DUPLEX_FULL)
 		reg_val = (0x1 << 0);
 	writel(EMAC_MAC_CTL1_SETUP | reg_val, &regs->mac_ctl1);
 
@@ -302,7 +327,7 @@ static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
 {
 	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
 	struct emac_eth_dev *priv = dev->priv;
-	u16 phy_reg;
+	int ret;
 
 	/* Init EMAC */
 
@@ -320,7 +345,7 @@ static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
 	udelay(1);
 
 	/* Set up EMAC */
-	emac_setup(dev);
+	emac_setup(priv);
 
 	writel(dev->enetaddr[0] << 16 | dev->enetaddr[1] << 8 |
 	       dev->enetaddr[2], &regs->mac_a1);
@@ -332,29 +357,32 @@ static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
 	emac_reset(dev);
 
 	/* PHY POWER UP */
-	emac_phy_read(dev->name, 1, 0, &phy_reg);
-	emac_phy_write(dev->name, 1, 0, phy_reg & (~(0x1 << 11)));
-	mdelay(1);
-
-	emac_phy_read(dev->name, 1, 0, &phy_reg);
-
-	priv->speed = miiphy_speed(dev->name, 0);
-	priv->duplex = miiphy_duplex(dev->name, 0);
+	ret = phy_startup(priv->phydev);
+	if (ret) {
+		printf("Could not initialize PHY %s\n",
+		       priv->phydev->dev->name);
+		return ret;
+	}
 
 	/* Print link status only once */
 	if (!priv->link_printed) {
 		printf("ENET Speed is %d Mbps - %s duplex connection\n",
-		       priv->speed, (priv->duplex == HALF) ? "HALF" : "FULL");
+		       priv->phydev->speed,
+		       priv->phydev->duplex ? "FULL" : "HALF");
 		priv->link_printed = 1;
 	}
 
 	/* Set EMAC SPEED depend on PHY */
-	clrsetbits_le32(&regs->mac_supp, 1 << 8,
-			((phy_reg & (0x1 << 13)) >> 13) << 8);
+	if (priv->phydev->speed == SPEED_100)
+		setbits_le32(&regs->mac_supp, 1 << 8);
+	else
+		clrbits_le32(&regs->mac_supp, 1 << 8);
 
 	/* Set duplex depend on phy */
-	clrsetbits_le32(&regs->mac_ctl1, 1 << 0,
-			((phy_reg & (0x1 << 8)) >> 8) << 0);
+	if (priv->phydev->duplex == DUPLEX_FULL)
+		setbits_le32(&regs->mac_ctl1, 1 << 0);
+	else
+		clrbits_le32(&regs->mac_ctl1, 1 << 0);
 
 	/* Enable RX/TX */
 	setbits_le32(&regs->ctl, 0x7);
@@ -505,6 +533,7 @@ int sunxi_emac_initialize(void)
 	/* Set MII clock */
 	clrsetbits_le32(&regs->mac_mcfg, 0xf << 2, 0xd << 2);
 
+	priv->regs = regs;
 	dev->iobase = (int)regs;
 	dev->priv = priv;
 	dev->init = sunxi_emac_eth_init;
@@ -515,7 +544,5 @@ int sunxi_emac_initialize(void)
 
 	eth_register(dev);
 
-	miiphy_register(dev->name, emac_phy_read, emac_phy_write);
-
-	return 0;
+	return sunxi_emac_init_phy(priv, dev);
 }
include/configs/sunxi-common.h +2 -0
index f97e626..40c7f63 100644
@@ -350,7 +350,9 @@ extern int soft_i2c_gpio_scl;
 
 /* Ethernet support */
 #ifdef CONFIG_SUNXI_EMAC
+#define CONFIG_PHY_ADDR		1
 #define CONFIG_MII			/* MII PHY management		*/
+#define CONFIG_PHYLIB
 #endif
 
 #ifdef CONFIG_SUNXI_GMAC
Signature · 1 line
2.3.5
#37 lore raw

PATCH 13/21 sunxi: emac: port to phylib

Quoted 4 lines · Hans de Goede

This is a preparation-patch for adding device-model support to the emac driver.

Think I saw this and the following few patches in a separate v2, so I've ignored them here. Let me know if I got things the wrong way around.

Ian.

#38 lore raw

PATCH 14/21 sunxi: emac: Prepare for device-model support

In reply to Hans de Goede

Split all the core functionality out into functions taking a struct emac_eth_dev *priv argument as preparation for adding device-model support.

---
 drivers/net/sunxi_emac.c | 115 +++++++++++++++++++++++++++++------------------
 1 file changed, 71 insertions(+), 44 deletions(-)
drivers/net/sunxi_emac.c +71 -44
index b9fd1b8..038f474 100644
@@ -309,9 +309,9 @@ static void emac_setup(struct emac_eth_dev *priv)
 	writel(EMAC_MAC_MFL, &regs->mac_maxf);
 }
 
-static void emac_reset(struct eth_device *dev)
+static void emac_reset(struct emac_eth_dev *priv)
 {
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	struct emac_regs *regs = priv->regs;
 
 	debug("resetting device\n");
 
@@ -323,10 +323,9 @@ static void emac_reset(struct eth_device *dev)
 	udelay(200);
 }
 
-static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
+static int _sunxi_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr)
 {
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
-	struct emac_eth_dev *priv = dev->priv;
+	struct emac_regs *regs = priv->regs;
 	int ret;
 
 	/* Init EMAC */
@@ -347,14 +346,14 @@ static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
 	/* Set up EMAC */
 	emac_setup(priv);
 
-	writel(dev->enetaddr[0] << 16 | dev->enetaddr[1] << 8 |
-	       dev->enetaddr[2], &regs->mac_a1);
-	writel(dev->enetaddr[3] << 16 | dev->enetaddr[4] << 8 |
-	       dev->enetaddr[5], &regs->mac_a0);
+	writel(enetaddr[0] << 16 | enetaddr[1] << 8 | enetaddr[2],
+	       &regs->mac_a1);
+	writel(enetaddr[3] << 16 | enetaddr[4] << 8 | enetaddr[5],
+	       &regs->mac_a0);
 
 	mdelay(1);
 
-	emac_reset(dev);
+	emac_reset(priv);
 
 	/* PHY POWER UP */
 	ret = phy_startup(priv->phydev);
@@ -390,14 +389,9 @@ static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bd)
 	return 0;
 }
 
-static void sunxi_emac_eth_halt(struct eth_device *dev)
+static int _sunxi_emac_eth_recv(struct emac_eth_dev *priv, void *packet)
 {
-	/* Nothing to do here */
-}
-
-static int sunxi_emac_eth_recv(struct eth_device *dev)
-{
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	struct emac_regs *regs = priv->regs;
 	struct emac_rxhdr rxhdr;
 	u32 rxcount;
 	u32 reg_val;
@@ -415,7 +409,7 @@ static int sunxi_emac_eth_recv(struct eth_device *dev)
 		/* Had one stuck? */
 		rxcount = readl(&regs->rx_fbc);
 		if (!rxcount)
-			return 0;
+			return -EAGAIN;
 	}
 
 	reg_val = readl(&regs->rx_io_data);
@@ -431,7 +425,7 @@ static int sunxi_emac_eth_recv(struct eth_device *dev)
 		/* Enable RX */
 		setbits_le32(&regs->ctl, 0x1 << 2);
 
-		return 0;
+		return -EAGAIN;
 	}
 
 	/* A packet ready now
@@ -463,22 +457,19 @@ static int sunxi_emac_eth_recv(struct eth_device *dev)
 	if (good_packet) {
 		if (rx_len > DMA_CPU_TRRESHOLD) {
 			printf("Received packet is too big (len=%d)\n", rx_len);
-		} else {
-			emac_inblk_32bit((void *)&regs->rx_io_data,
-					 net_rx_packets[0], rx_len);
-
-			/* Pass to upper layer */
-			net_process_received_packet(net_rx_packets[0], rx_len);
-			return rx_len;
+			return -EMSGSIZE;
 		}
+		emac_inblk_32bit((void *)&regs->rx_io_data, packet, rx_len);
+		return rx_len;
 	}
 
-	return 0;
+	return -EIO; /* Bad packet */
 }
 
-static int sunxi_emac_eth_send(struct eth_device *dev, void *packet, int len)
+static int _sunxi_emac_eth_send(struct emac_eth_dev *priv, void *packet,
+				int len)
 {
-	struct emac_regs *regs = (struct emac_regs *)dev->iobase;
+	struct emac_regs *regs = priv->regs;
 
 	/* Select channel 0 */
 	writel(0, &regs->tx_ins);
@@ -495,17 +486,64 @@ static int sunxi_emac_eth_send(struct eth_device *dev, void *packet, int len)
 	return 0;
 }
 
-int sunxi_emac_initialize(void)
+static void sunxi_emac_board_setup(struct emac_eth_dev *priv)
 {
 	struct sunxi_ccm_reg *const ccm =
 		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 	struct sunxi_sramc_regs *sram =
 		(struct sunxi_sramc_regs *)SUNXI_SRAMC_BASE;
+	struct emac_regs *regs = priv->regs;
+	int pin;
+
+	/* Map SRAM to EMAC */
+	setbits_le32(&sram->ctrl1, 0x5 << 2);
+
+	/* Configure pin mux settings for MII Ethernet */
+	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(17); pin++)
+		sunxi_gpio_set_cfgpin(pin, SUNXI_GPA_EMAC);
+
+	/* Set up clock gating */
+	setbits_le32(&ccm->ahb_gate0, 0x1 << AHB_GATE_OFFSET_EMAC);
+
+	/* Set MII clock */
+	clrsetbits_le32(&regs->mac_mcfg, 0xf << 2, 0xd << 2);
+}
+
+static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bis)
+{
+	return _sunxi_emac_eth_init(dev->priv, dev->enetaddr);
+}
+
+static void sunxi_emac_eth_halt(struct eth_device *dev)
+{
+	/* Nothing to do here */
+}
+
+static int sunxi_emac_eth_recv(struct eth_device *dev)
+{
+	int rx_len;
+
+	rx_len = _sunxi_emac_eth_recv(dev->priv, net_rx_packets[0]);
+	if (rx_len <= 0)
+		return 0;
+
+	/* Pass to upper layer */
+	net_process_received_packet(net_rx_packets[0], rx_len);
+
+	return rx_len;
+}
+
+static int sunxi_emac_eth_send(struct eth_device *dev, void *packet, int length)
+{
+	return _sunxi_emac_eth_send(dev->priv, packet, length);
+}
+
+int sunxi_emac_initialize(void)
+{
 	struct emac_regs *regs =
 		(struct emac_regs *)SUNXI_EMAC_BASE;
 	struct eth_device *dev;
 	struct emac_eth_dev *priv;
-	int pin;
 
 	dev = malloc(sizeof(*dev));
 	if (dev == NULL)
@@ -520,19 +558,6 @@ int sunxi_emac_initialize(void)
 	memset(dev, 0, sizeof(*dev));
 	memset(priv, 0, sizeof(struct emac_eth_dev));
 
-	/* Map SRAM to EMAC */
-	setbits_le32(&sram->ctrl1, 0x5 << 2);
-
-	/* Configure pin mux settings for MII Ethernet */
-	for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(17); pin++)
-		sunxi_gpio_set_cfgpin(pin, SUNXI_GPA_EMAC);
-
-	/* Set up clock gating */
-	setbits_le32(&ccm->ahb_gate0, 0x1 << AHB_GATE_OFFSET_EMAC);
-
-	/* Set MII clock */
-	clrsetbits_le32(&regs->mac_mcfg, 0xf << 2, 0xd << 2);
-
 	priv->regs = regs;
 	dev->iobase = (int)regs;
 	dev->priv = priv;
@@ -542,6 +567,8 @@ int sunxi_emac_initialize(void)
 	dev->recv = sunxi_emac_eth_recv;
 	strcpy(dev->name, "emac");
 
+	sunxi_emac_board_setup(priv);
+
 	eth_register(dev);
 
 	return sunxi_emac_init_phy(priv, dev);
Signature · 1 line
2.3.5
#39 lore raw

PATCH 15/21 sunxi: emac: Add device model support

In reply to Hans de Goede

Modify the sunxi-emac eth driver to support device model.

---
 arch/arm/cpu/armv7/sunxi/board.c |  4 +-
 drivers/net/sunxi_emac.c         | 81 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +3 -1
index 7e9cf11..cde13ef 100644
@@ -12,7 +12,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#ifndef CONFIG_DM_ETH
 #include <netdev.h>
+#endif
 #include <miiphy.h>
 #include <serial.h>
 #ifdef CONFIG_SPL_BUILD
@@ -224,7 +226,7 @@ int cpu_eth_init(bd_t *bis)
 	mdelay(200);
 #endif
 
-#ifdef CONFIG_SUNXI_EMAC
+#if defined CONFIG_SUNXI_EMAC && !defined CONFIG_DM_ETH
 	rc = sunxi_emac_initialize(bis);
 	if (rc < 0) {
 		printf("sunxi: failed to initialize emac\n");
drivers/net/sunxi_emac.c +81 -0

102 lines not on this page · raw message

Signature · 1 line
2.3.5
#40 lore raw

PATCH 15/21 sunxi: emac: Add device model support

Hi Hans,

Quoted 44 lines · Hans de Goede

Modify the sunxi-emac eth driver to support device model.

---
 arch/arm/cpu/armv7/sunxi/board.c |  4 +-
 drivers/net/sunxi_emac.c         | 81 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +3 -1
index 7e9cf11..cde13ef 100644
@@ -12,7 +12,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#ifndef CONFIG_DM_ETH
 #include <netdev.h>
+#endif
 #include <miiphy.h>
 #include <serial.h>
 #ifdef CONFIG_SPL_BUILD
@@ -224,7 +226,7 @@ int cpu_eth_init(bd_t *bis)
        mdelay(200);
 #endif
 
-#ifdef CONFIG_SUNXI_EMAC
+#if defined CONFIG_SUNXI_EMAC && !defined CONFIG_DM_ETH
        rc = sunxi_emac_initialize(bis);
        if (rc < 0) {
                printf("sunxi: failed to initialize emac\n");
drivers/net/sunxi_emac.c +1 -0
index 038f474..a9efe11 100644
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <linux/err.h>
 #include <malloc.h>
 #include <miiphy.h>

drivers/net/sunxi_emac.c struct emac_eth_dev { · line 165

Quoted 5 lines
drivers/net/sunxi_emac.c +2 -0
@@ -160,6 +161,9 @@ struct emac_eth_dev {
        struct mii_dev *bus;
        struct phy_device *phydev;
        int link_printed;
+#ifdef CONFIG_DM_ETH
+       uchar rx_buf[DMA_CPU_TRRESHOLD];

THRESHOLD

Also does this need to be DMA-aligned? - e.g. DM_FLAG_ALLOC_PRIV_DMA

Quoted 93 lines
drivers/net/sunxi_emac.c +78 -1
+#endif
 };
 
 struct emac_rxhdr {
@@ -509,6 +513,7 @@ static void sunxi_emac_board_setup(struct emac_eth_dev *priv)
        clrsetbits_le32(&regs->mac_mcfg, 0xf << 2, 0xd << 2);
 }
 
+#ifndef CONFIG_DM_ETH
 static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bis)
 {
        return _sunxi_emac_eth_init(dev->priv, dev->enetaddr);
@@ -573,3 +578,79 @@ int sunxi_emac_initialize(void)
 
        return sunxi_emac_init_phy(priv, dev);
 }
+#endif
+
+#ifdef CONFIG_DM_ETH
+static int sunxi_emac_eth_start(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       return _sunxi_emac_eth_init(dev->priv, pdata->enetaddr);
+}
+
+static int sunxi_emac_eth_send(struct udevice *dev, void *packet, int length)
+{
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+
+       return _sunxi_emac_eth_send(priv, packet, length);
+}
+
+static int sunxi_emac_eth_recv(struct udevice *dev, uchar **packetp)
+{
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+       int rx_len;
+
+       rx_len = _sunxi_emac_eth_recv(priv, priv->rx_buf);
+       *packetp = priv->rx_buf;
+
+       return rx_len;
+}
+
+static void sunxi_emac_eth_stop(struct udevice *dev)
+{
+       /* Nothing to do here */
+}
+
+static int sunxi_emac_eth_probe(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+
+       priv->regs = (struct emac_regs *)pdata->iobase;
+       sunxi_emac_board_setup(priv);
+
+       return sunxi_emac_init_phy(priv, dev);
+}
+
+static const struct eth_ops sunxi_emac_eth_ops = {
+       .start                  = sunxi_emac_eth_start,
+       .send                   = sunxi_emac_eth_send,
+       .recv                   = sunxi_emac_eth_recv,
+       .stop                   = sunxi_emac_eth_stop,
+};
+
+static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       pdata->iobase = dev_get_addr(dev);
+
+       return 0;
+}
+
+static const struct udevice_id sunxi_emac_eth_ids[] = {
+       { .compatible = "allwinner,sun4i-a10-emac" },
+       { }
+};
+
+U_BOOT_DRIVER(eth_sunxi_emac) = {
+       .name   = "eth_sunxi_emac",
+       .id     = UCLASS_ETH,
+       .of_match = sunxi_emac_eth_ids,
+       .ofdata_to_platdata = sunxi_emac_eth_ofdata_to_platdata,
+       .probe  = sunxi_emac_eth_probe,
+       .ops    = &sunxi_emac_eth_ops,
+       .priv_auto_alloc_size = sizeof(struct emac_eth_dev),
+       .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+};
+#endif
--
Quoted 2 lines

2.3.5

Regards,
Simon

#41 lore raw

PATCH 15/21 sunxi: emac: Add device model support

Hi,

Quoted 41 lines · Simon Glass

Hi Hans,

Quoted 38 lines · Hans de Goede

Modify the sunxi-emac eth driver to support device model.

---
  arch/arm/cpu/armv7/sunxi/board.c |  4 +-
  drivers/net/sunxi_emac.c         | 81 ++++++++++++++++++++++++++++++++++++++++
  2 files changed, 84 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +3 -1
index 7e9cf11..cde13ef 100644
@@ -12,7 +12,9 @@
 
  #include <common.h>
  #include <i2c.h>
+#ifndef CONFIG_DM_ETH
  #include <netdev.h>
+#endif
  #include <miiphy.h>
  #include <serial.h>
  #ifdef CONFIG_SPL_BUILD
@@ -224,7 +226,7 @@ int cpu_eth_init(bd_t *bis)
         mdelay(200);
  #endif
 
-#ifdef CONFIG_SUNXI_EMAC
+#if defined CONFIG_SUNXI_EMAC && !defined CONFIG_DM_ETH
         rc = sunxi_emac_initialize(bis);
         if (rc < 0) {
                 printf("sunxi: failed to initialize emac\n");
drivers/net/sunxi_emac.c +0 -0
index 038f474..a9efe11 100644
@@ -7,6 +7,7 @@
   */
 
Quoted 13 lines

drivers/net/sunxi_emac.c struct emac_eth_dev { · line 165

Quoted 11 lines
drivers/net/sunxi_emac.c +3 -0
  #include <common.h>
+#include <dm.h>
  #include <linux/err.h>
  #include <malloc.h>
  #include <miiphy.h>
@@ -160,6 +161,9 @@ struct emac_eth_dev {
         struct mii_dev *bus;
         struct phy_device *phydev;
         int link_printed;
+#ifdef CONFIG_DM_ETH
+       uchar rx_buf[DMA_CPU_TRRESHOLD];

THRESHOLD

This define already exists and actually has the typo in it, I can do another preparation patch fixing this I guess.

Quoted 1 line

Also does this need to be DMA-aligned? - e.g. DM_FLAG_ALLOC_PRIV_DMA

Nope, this driver only uses mmio, not dma, the name of the variable not only has a typo it is also misleading. Guess I better do a preparation patch to slot in before this one to fixup the define's name.

Regards,

Hans

Quoted 100 lines
Quoted 94 lines
drivers/net/sunxi_emac.c +78 -1
+#endif
  };
 
  struct emac_rxhdr {
@@ -509,6 +513,7 @@ static void sunxi_emac_board_setup(struct emac_eth_dev *priv)
         clrsetbits_le32(&regs->mac_mcfg, 0xf << 2, 0xd << 2);
  }
 
+#ifndef CONFIG_DM_ETH
  static int sunxi_emac_eth_init(struct eth_device *dev, bd_t *bis)
  {
         return _sunxi_emac_eth_init(dev->priv, dev->enetaddr);
@@ -573,3 +578,79 @@ int sunxi_emac_initialize(void)
 
         return sunxi_emac_init_phy(priv, dev);
  }
+#endif
+
+#ifdef CONFIG_DM_ETH
+static int sunxi_emac_eth_start(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       return _sunxi_emac_eth_init(dev->priv, pdata->enetaddr);
+}
+
+static int sunxi_emac_eth_send(struct udevice *dev, void *packet, int length)
+{
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+
+       return _sunxi_emac_eth_send(priv, packet, length);
+}
+
+static int sunxi_emac_eth_recv(struct udevice *dev, uchar **packetp)
+{
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+       int rx_len;
+
+       rx_len = _sunxi_emac_eth_recv(priv, priv->rx_buf);
+       *packetp = priv->rx_buf;
+
+       return rx_len;
+}
+
+static void sunxi_emac_eth_stop(struct udevice *dev)
+{
+       /* Nothing to do here */
+}
+
+static int sunxi_emac_eth_probe(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct emac_eth_dev *priv = dev_get_priv(dev);
+
+       priv->regs = (struct emac_regs *)pdata->iobase;
+       sunxi_emac_board_setup(priv);
+
+       return sunxi_emac_init_phy(priv, dev);
+}
+
+static const struct eth_ops sunxi_emac_eth_ops = {
+       .start                  = sunxi_emac_eth_start,
+       .send                   = sunxi_emac_eth_send,
+       .recv                   = sunxi_emac_eth_recv,
+       .stop                   = sunxi_emac_eth_stop,
+};
+
+static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev)
+{
+       struct eth_pdata *pdata = dev_get_platdata(dev);
+
+       pdata->iobase = dev_get_addr(dev);
+
+       return 0;
+}
+
+static const struct udevice_id sunxi_emac_eth_ids[] = {
+       { .compatible = "allwinner,sun4i-a10-emac" },
+       { }
+};
+
+U_BOOT_DRIVER(eth_sunxi_emac) = {
+       .name   = "eth_sunxi_emac",
+       .id     = UCLASS_ETH,
+       .of_match = sunxi_emac_eth_ids,
+       .ofdata_to_platdata = sunxi_emac_eth_ofdata_to_platdata,
+       .probe  = sunxi_emac_eth_probe,
+       .ops    = &sunxi_emac_eth_ops,
+       .priv_auto_alloc_size = sizeof(struct emac_eth_dev),
+       .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+};
+#endif
--
Quoted 2 lines

2.3.5

Regards,
Simon

#42 lore raw

PATCH 16/21 sunxi: dts: Sync all dts files with upstream kernel

In reply to Hans de Goede

Bring all the sunxi dts files (and update existing ones) from mripard/sunxi/dt-for-4.1 (which will be merged into upstream master any day now). This is necessary so that we can move all sunxi boards over to the device model.

---
 arch/arm/dts/Makefile                           |   55 +-
 arch/arm/dts/axp209.dtsi                        |   97 +++
 arch/arm/dts/sun4i-a10-a1000.dts                |  198 +++++
 arch/arm/dts/sun4i-a10-ba10-tvbox.dts           |  154 ++++
 arch/arm/dts/sun4i-a10-chuwi-v7-cw0825.dts      |  135 +++
 arch/arm/dts/sun4i-a10-cubieboard.dts           |  223 +++++
 arch/arm/dts/sun4i-a10-gemei-g9.dts             |  176 ++++
 arch/arm/dts/sun4i-a10-hackberry.dts            |  166 ++++
 arch/arm/dts/sun4i-a10-hyundai-a7hd.dts         |  113 +++
 arch/arm/dts/sun4i-a10-inet97fv2.dts            |  128 +++
 arch/arm/dts/sun4i-a10-marsboard.dts            |  191 ++++
 arch/arm/dts/sun4i-a10-mini-xplus.dts           |  140 +++
 arch/arm/dts/sun4i-a10-mk802.dts                |  117 +++
 arch/arm/dts/sun4i-a10-mk802ii.dts              |  121 +++
 arch/arm/dts/sun4i-a10-olinuxino-lime.dts       |  194 +++++
 arch/arm/dts/sun4i-a10-pcduino.dts              |  202 +++++
 arch/arm/dts/{sun7i-a20.dtsi => sun4i-a10.dtsi} |  810 +++++++++--------
 arch/arm/dts/sun5i-a10s-auxtek-t004.dts         |  159 ++++
 arch/arm/dts/sun5i-a10s-mk802.dts               |  133 +++
 arch/arm/dts/sun5i-a10s-olinuxino-micro.dts     |  251 ++++++
 arch/arm/dts/sun5i-a10s-r7-tv-dongle.dts        |  145 ++++
 arch/arm/dts/sun5i-a10s.dtsi                    |  201 +++++
 arch/arm/dts/sun5i-a13-hsg-h702.dts             |  169 ++++
 arch/arm/dts/sun5i-a13-olinuxino-micro.dts      |  155 ++++
 arch/arm/dts/sun5i-a13-olinuxino.dts            |  205 +++++
 arch/arm/dts/sun5i-a13-utoo-p66.dts             |  223 +++++
 arch/arm/dts/sun5i-a13.dtsi                     |  171 ++++
 arch/arm/dts/sun5i.dtsi                         |  611 +++++++++++++
 arch/arm/dts/sun6i-a31-app4-evb1.dts            |   98 +++
 arch/arm/dts/sun6i-a31-colombus.dts             |  138 +++
 arch/arm/dts/sun6i-a31-hummingbird.dts          |  255 ++++++
 arch/arm/dts/sun6i-a31-i7.dts                   |  154 ++++
 arch/arm/dts/sun6i-a31-m9.dts                   |  154 ++++
 arch/arm/dts/sun6i-a31.dtsi                     | 1060 +++++++++++++++++++++++
 arch/arm/dts/sun6i-a31s-cs908.dts               |  103 +++
 arch/arm/dts/sun6i-a31s.dtsi                    |   58 ++
 arch/arm/dts/sun7i-a20-bananapi.dts             |  226 +++++
 arch/arm/dts/sun7i-a20-bananapro.dts            |  272 ++++++
 arch/arm/dts/sun7i-a20-cubieboard2.dts          |  216 +++++
 arch/arm/dts/sun7i-a20-cubietruck.dts           |  301 +++++++
 arch/arm/dts/sun7i-a20-hummingbird.dts          |  286 ++++++
 arch/arm/dts/sun7i-a20-i12-tvbox.dts            |  252 ++++++
 arch/arm/dts/sun7i-a20-m3.dts                   |  178 ++++
 arch/arm/dts/sun7i-a20-olinuxino-lime.dts       |  183 ++++
 arch/arm/dts/sun7i-a20-olinuxino-lime2.dts      |  238 +++++
 arch/arm/dts/sun7i-a20-olinuxino-micro.dts      |  285 ++++++
 arch/arm/dts/sun7i-a20-orangepi-mini.dts        |  255 ++++++
 arch/arm/dts/sun7i-a20-orangepi.dts             |  233 +++++
 arch/arm/dts/sun7i-a20-pcduino3-nano.dts        |  199 +++++
 arch/arm/dts/sun7i-a20-pcduino3.dts             |  267 +++---
 arch/arm/dts/sun7i-a20-wexler-tab7200.dts       |  188 ++++
 arch/arm/dts/sun7i-a20.dtsi                     |  583 +++++++++----
 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts        |   59 ++
 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts          |  132 +++
 arch/arm/dts/sun8i-a23.dtsi                     |  633 ++++++++++++++
 arch/arm/dts/sun9i-a80-cubieboard4.dts          |   99 +++
 arch/arm/dts/sun9i-a80-optimus.dts              |  217 +++++
 arch/arm/dts/sun9i-a80.dtsi                     |  764 ++++++++++++++++
 arch/arm/dts/sunxi-common-regulators.dtsi       |  124 ++-
 include/dt-bindings/dma/sun4i-a10.h             |   56 ++
 include/dt-bindings/pinctrl/sun4i-a10.h         |   62 ++
 include/dt-bindings/thermal/thermal.h           |   17 +
 62 files changed, 13320 insertions(+), 668 deletions(-)
 create mode 100644 arch/arm/dts/axp209.dtsi
 create mode 100644 arch/arm/dts/sun4i-a10-a1000.dts
 create mode 100644 arch/arm/dts/sun4i-a10-ba10-tvbox.dts
 create mode 100644 arch/arm/dts/sun4i-a10-chuwi-v7-cw0825.dts
 create mode 100644 arch/arm/dts/sun4i-a10-cubieboard.dts
 create mode 100644 arch/arm/dts/sun4i-a10-gemei-g9.dts
 create mode 100644 arch/arm/dts/sun4i-a10-hackberry.dts
 create mode 100644 arch/arm/dts/sun4i-a10-hyundai-a7hd.dts
 create mode 100644 arch/arm/dts/sun4i-a10-inet97fv2.dts
 create mode 100644 arch/arm/dts/sun4i-a10-marsboard.dts
 create mode 100644 arch/arm/dts/sun4i-a10-mini-xplus.dts
 create mode 100644 arch/arm/dts/sun4i-a10-mk802.dts
 create mode 100644 arch/arm/dts/sun4i-a10-mk802ii.dts
 create mode 100644 arch/arm/dts/sun4i-a10-olinuxino-lime.dts
 create mode 100644 arch/arm/dts/sun4i-a10-pcduino.dts
 copy arch/arm/dts/{sun7i-a20.dtsi => sun4i-a10.dtsi} (50%)
 create mode 100644 arch/arm/dts/sun5i-a10s-auxtek-t004.dts
 create mode 100644 arch/arm/dts/sun5i-a10s-mk802.dts
 create mode 100644 arch/arm/dts/sun5i-a10s-olinuxino-micro.dts
 create mode 100644 arch/arm/dts/sun5i-a10s-r7-tv-dongle.dts
 create mode 100644 arch/arm/dts/sun5i-a10s.dtsi
 create mode 100644 arch/arm/dts/sun5i-a13-hsg-h702.dts
 create mode 100644 arch/arm/dts/sun5i-a13-olinuxino-micro.dts
 create mode 100644 arch/arm/dts/sun5i-a13-olinuxino.dts
 create mode 100644 arch/arm/dts/sun5i-a13-utoo-p66.dts
 create mode 100644 arch/arm/dts/sun5i-a13.dtsi
 create mode 100644 arch/arm/dts/sun5i.dtsi
 create mode 100644 arch/arm/dts/sun6i-a31-app4-evb1.dts
 create mode 100644 arch/arm/dts/sun6i-a31-colombus.dts
 create mode 100644 arch/arm/dts/sun6i-a31-hummingbird.dts
 create mode 100644 arch/arm/dts/sun6i-a31-i7.dts
 create mode 100644 arch/arm/dts/sun6i-a31-m9.dts
 create mode 100644 arch/arm/dts/sun6i-a31.dtsi
 create mode 100644 arch/arm/dts/sun6i-a31s-cs908.dts
 create mode 100644 arch/arm/dts/sun6i-a31s.dtsi
 create mode 100644 arch/arm/dts/sun7i-a20-bananapi.dts
 create mode 100644 arch/arm/dts/sun7i-a20-bananapro.dts
 create mode 100644 arch/arm/dts/sun7i-a20-cubieboard2.dts
 create mode 100644 arch/arm/dts/sun7i-a20-cubietruck.dts
 create mode 100644 arch/arm/dts/sun7i-a20-hummingbird.dts
 create mode 100644 arch/arm/dts/sun7i-a20-i12-tvbox.dts
 create mode 100644 arch/arm/dts/sun7i-a20-m3.dts
 create mode 100644 arch/arm/dts/sun7i-a20-olinuxino-lime.dts
 create mode 100644 arch/arm/dts/sun7i-a20-olinuxino-lime2.dts
 create mode 100644 arch/arm/dts/sun7i-a20-olinuxino-micro.dts
 create mode 100644 arch/arm/dts/sun7i-a20-orangepi-mini.dts
 create mode 100644 arch/arm/dts/sun7i-a20-orangepi.dts
 create mode 100644 arch/arm/dts/sun7i-a20-pcduino3-nano.dts
 create mode 100644 arch/arm/dts/sun7i-a20-wexler-tab7200.dts
 create mode 100644 arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts
 create mode 100644 arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts
 create mode 100644 arch/arm/dts/sun8i-a23.dtsi
 create mode 100644 arch/arm/dts/sun9i-a80-cubieboard4.dts
 create mode 100644 arch/arm/dts/sun9i-a80-optimus.dts
 create mode 100644 arch/arm/dts/sun9i-a80.dtsi
 create mode 100644 include/dt-bindings/dma/sun4i-a10.h
 create mode 100644 include/dt-bindings/pinctrl/sun4i-a10.h
 create mode 100644 include/dt-bindings/thermal/thermal.h
arch/arm/dts/Makefile +54 -1
index 09708d9..3ff55dd 100644
@@ -1,4 +1,3 @@
-dtb-$(CONFIG_MACH_SUN7I) +=  sun7i-a20-pcduino3.dtb
 dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb
 dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb
 dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
@@ -57,6 +56,60 @@ dtb-$(CONFIG_SOCFPGA) +=				\
 dtb-$(CONFIG_LS102XA) += ls1021a-qds.dtb \
 	ls1021a-twr.dtb
 
+dtb-$(CONFIG_MACH_SUN4I) += \
+	sun4i-a10-a1000.dtb \
+	sun4i-a10-ba10-tvbox.dtb \
+	sun4i-a10-chuwi-v7-cw0825.dtb \
+	sun4i-a10-cubieboard.dtb \
+	sun4i-a10-gemei-g9.dtb \
+	sun4i-a10-hackberry.dtb \
+	sun4i-a10-hyundai-a7hd.dtb \
+	sun4i-a10-inet97fv2.dtb \
+	sun4i-a10-marsboard.dtb \
+	sun4i-a10-mini-xplus.dtb \
+	sun4i-a10-mk802.dtb \
+	sun4i-a10-mk802ii.dtb \
+	sun4i-a10-olinuxino-lime.dtb \
+	sun4i-a10-pcduino.dtb
+dtb-$(CONFIG_MACH_SUN5I) += \
+	sun5i-a10s-auxtek-t004.dtb \
+	sun5i-a10s-mk802.dtb \
+	sun5i-a10s-olinuxino-micro.dtb \
+	sun5i-a10s-r7-tv-dongle.dtb \
+	sun5i-a13-hsg-h702.dtb \
+	sun5i-a13-olinuxino.dtb \
+	sun5i-a13-olinuxino-micro.dtb \
+	sun5i-a13-utoo-p66.dtb
+dtb-$(CONFIG_MACH_SUN6I) += \
+	sun6i-a31-app4-evb1.dtb \
+	sun6i-a31-colombus.dtb \
+	sun6i-a31-hummingbird.dtb \
+	sun6i-a31-i7.dtb \
+	sun6i-a31-m9.dtb \
+	sun6i-a31s-cs908.dtb
+dtb-$(CONFIG_MACH_SUN7I) += \
+	sun7i-a20-bananapi.dtb \
+	sun7i-a20-bananapro.dtb \
+	sun7i-a20-cubieboard2.dtb \
+	sun7i-a20-cubietruck.dtb \
+	sun7i-a20-hummingbird.dtb \
+	sun7i-a20-i12-tvbox.dtb \
+	sun7i-a20-m3.dtb \
+	sun7i-a20-olinuxino-lime.dtb \
+	sun7i-a20-olinuxino-lime2.dtb \
+	sun7i-a20-olinuxino-micro.dtb \
+	sun7i-a20-orangepi.dtb \
+	sun7i-a20-orangepi-mini.dtb \
+	sun7i-a20-pcduino3.dtb \
+	sun7i-a20-pcduino3-nano.dtb \
+	sun7i-a20-wexler-tab7200.dtb
+dtb-$(CONFIG_MACH_SUN8I_A23) += \
+	sun8i-a23-ippo-q8h-v5.dtb \
+	sun8i-a23-ippo-q8h-v1.2.dtb
+dtb-$(CONFIG_MACH_SUN9I) += \
+	sun9i-a80-optimus.dtb \
+	sun9i-a80-cubieboard4.dtb
+
 targets += $(dtb-y)
 
 DTC_FLAGS += -R 4 -p 0x1000
arch/arm/dts/axp209.dtsi new file +97 -0

97 lines not on this page · raw message

arch/arm/dts/sun4i-a10-a1000.dts new file +198 -0

198 lines not on this page · raw message

arch/arm/dts/sun4i-a10-ba10-tvbox.dts new file +154 -0

154 lines not on this page · raw message

arch/arm/dts/sun4i-a10-chuwi-v7-cw0825.dts new file +135 -0

135 lines not on this page · raw message

arch/arm/dts/sun4i-a10-cubieboard.dts new file +223 -0

223 lines not on this page · raw message

arch/arm/dts/sun4i-a10-gemei-g9.dts new file +176 -0

176 lines not on this page · raw message

arch/arm/dts/sun4i-a10-hackberry.dts new file +166 -0

166 lines not on this page · raw message

arch/arm/dts/sun4i-a10-hyundai-a7hd.dts new file +113 -0

113 lines not on this page · raw message

arch/arm/dts/sun4i-a10-inet97fv2.dts new file +128 -0

128 lines not on this page · raw message

arch/arm/dts/sun4i-a10-marsboard.dts new file +191 -0

191 lines not on this page · raw message

arch/arm/dts/sun4i-a10-mini-xplus.dts new file +140 -0

140 lines not on this page · raw message

arch/arm/dts/sun4i-a10-mk802.dts new file +117 -0

117 lines not on this page · raw message

arch/arm/dts/sun4i-a10-mk802ii.dts new file +121 -0

121 lines not on this page · raw message

arch/arm/dts/sun4i-a10-olinuxino-lime.dts new file +194 -0

194 lines not on this page · raw message

arch/arm/dts/sun4i-a10-pcduino.dts new file +202 -0

202 lines not on this page · raw message

arch/arm/dts/sun4i-a10.dtsi renamed from arch/arm/dts/sun7i-a20.dtsi +434 -376

581 lines not on this page · raw message

arch/arm/dts/sun5i-a10s-auxtek-t004.dts new file +159 -0

159 lines not on this page · raw message

arch/arm/dts/sun5i-a10s-mk802.dts new file +133 -0

133 lines not on this page · raw message

arch/arm/dts/sun5i-a10s-olinuxino-micro.dts new file +251 -0

251 lines not on this page · raw message

arch/arm/dts/sun5i-a10s-r7-tv-dongle.dts new file +145 -0

145 lines not on this page · raw message

arch/arm/dts/sun5i-a10s.dtsi new file +201 -0

201 lines not on this page · raw message

arch/arm/dts/sun5i-a13-hsg-h702.dts new file +169 -0

169 lines not on this page · raw message

arch/arm/dts/sun5i-a13-olinuxino-micro.dts new file +155 -0

155 lines not on this page · raw message

arch/arm/dts/sun5i-a13-olinuxino.dts new file +205 -0

205 lines not on this page · raw message

arch/arm/dts/sun5i-a13-utoo-p66.dts new file +223 -0

223 lines not on this page · raw message

arch/arm/dts/sun5i-a13.dtsi new file +171 -0

171 lines not on this page · raw message

arch/arm/dts/sun5i.dtsi new file +611 -0

611 lines not on this page · raw message

arch/arm/dts/sun6i-a31-app4-evb1.dts new file +98 -0

98 lines not on this page · raw message

arch/arm/dts/sun6i-a31-colombus.dts new file +138 -0

138 lines not on this page · raw message

arch/arm/dts/sun6i-a31-hummingbird.dts new file +255 -0

255 lines not on this page · raw message

arch/arm/dts/sun6i-a31-i7.dts new file +154 -0

154 lines not on this page · raw message

arch/arm/dts/sun6i-a31-m9.dts new file +154 -0

154 lines not on this page · raw message

arch/arm/dts/sun6i-a31.dtsi new file +1060 -0

1,060 lines not on this page · raw message

arch/arm/dts/sun6i-a31s-cs908.dts new file +103 -0

103 lines not on this page · raw message

arch/arm/dts/sun6i-a31s.dtsi new file +58 -0

58 lines not on this page · raw message

arch/arm/dts/sun7i-a20-bananapi.dts new file +226 -0

226 lines not on this page · raw message

arch/arm/dts/sun7i-a20-bananapro.dts new file +272 -0

272 lines not on this page · raw message

arch/arm/dts/sun7i-a20-cubieboard2.dts new file +216 -0

216 lines not on this page · raw message

arch/arm/dts/sun7i-a20-cubietruck.dts new file +301 -0

301 lines not on this page · raw message

arch/arm/dts/sun7i-a20-hummingbird.dts new file +286 -0

286 lines not on this page · raw message

arch/arm/dts/sun7i-a20-i12-tvbox.dts new file +252 -0

252 lines not on this page · raw message

arch/arm/dts/sun7i-a20-m3.dts new file +178 -0

178 lines not on this page · raw message

arch/arm/dts/sun7i-a20-olinuxino-lime.dts new file +183 -0

183 lines not on this page · raw message

arch/arm/dts/sun7i-a20-olinuxino-lime2.dts new file +238 -0

238 lines not on this page · raw message

arch/arm/dts/sun7i-a20-olinuxino-micro.dts new file +285 -0

285 lines not on this page · raw message

arch/arm/dts/sun7i-a20-orangepi-mini.dts new file +255 -0

255 lines not on this page · raw message

arch/arm/dts/sun7i-a20-orangepi.dts new file +233 -0

233 lines not on this page · raw message

arch/arm/dts/sun7i-a20-pcduino3-nano.dts new file +199 -0

199 lines not on this page · raw message

arch/arm/dts/sun7i-a20-pcduino3.dts +154 -113

267 lines not on this page · raw message

arch/arm/dts/sun7i-a20-wexler-tab7200.dts new file +188 -0

188 lines not on this page · raw message

arch/arm/dts/sun7i-a20.dtsi +435 -148

583 lines not on this page · raw message

arch/arm/dts/sun8i-a23-ippo-q8h-v1.2.dts new file +59 -0

59 lines not on this page · raw message

arch/arm/dts/sun8i-a23-ippo-q8h-v5.dts new file +132 -0

132 lines not on this page · raw message

arch/arm/dts/sun8i-a23.dtsi new file +633 -0

633 lines not on this page · raw message

arch/arm/dts/sun9i-a80-cubieboard4.dts new file +99 -0

99 lines not on this page · raw message

arch/arm/dts/sun9i-a80-optimus.dts new file +217 -0

217 lines not on this page · raw message

arch/arm/dts/sun9i-a80.dtsi new file +764 -0

764 lines not on this page · raw message

arch/arm/dts/sunxi-common-regulators.dtsi +94 -30

124 lines not on this page · raw message

include/dt-bindings/dma/sun4i-a10.h new file +56 -0

56 lines not on this page · raw message

include/dt-bindings/pinctrl/sun4i-a10.h new file +62 -0

62 lines not on this page · raw message

include/dt-bindings/thermal/thermal.h new file +17 -0
new file mode 100644
index 0000000..b5e6b00

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.3.5

Part of the diff is not shown here. View the raw message.

#43 lore raw

PATCH 16/21 sunxi: dts: Sync all dts files with upstream kernel

Quoted 6 lines · Hans de Goede

Bring all the sunxi dts files (and update existing ones) from mripard/sunxi/dt-for-4.1 (which will be merged into upstream master any day now). This is necessary so that we can move all sunxi boards over to the device model.

#44 lore raw

PATCH 16/21 sunxi: dts: Sync all dts files with upstream kernel

In reply to Hans de Goede
Quoted 2 lines · Hans de Goede

Bring all the sunxi dts files (and update existing ones) from mripard/sunxi/dt-for-4.1

A specific SHA1 might be a useful reference for whomever does the next update and/or the specific runes used to update (cp sun*.dts ... ?)

Quoted 5 lines

(which will be merged into upstream master any
day now). This is necessary so that we can move all sunxi boards over to the device model.

#45 lore raw

PATCH 17/21 sunxi: dts: Add dts files which have been submitted but not yet merged upstream

In reply to Hans de Goede

We need dts files for all boards we support, so bring in a few unmerged ones, these will be replaced with the upstream merged versions the next time we sync dts files.

---
 arch/arm/dts/Makefile                 |   2 +
 arch/arm/dts/sun4i-a10-jesurun-q5.dts | 194 ++++++++++++++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-primo73.dts    | 102 ++++++++++++++++++
 3 files changed, 298 insertions(+)
 create mode 100644 arch/arm/dts/sun4i-a10-jesurun-q5.dts
 create mode 100644 arch/arm/dts/sun7i-a20-primo73.dts
arch/arm/dts/Makefile +2 -0
index 3ff55dd..a18c565 100644
@@ -65,6 +65,7 @@ dtb-$(CONFIG_MACH_SUN4I) += \
 	sun4i-a10-hackberry.dtb \
 	sun4i-a10-hyundai-a7hd.dtb \
 	sun4i-a10-inet97fv2.dtb \
+	sun4i-a10-jesurun-q5.dtb \
 	sun4i-a10-marsboard.dtb \
 	sun4i-a10-mini-xplus.dtb \
 	sun4i-a10-mk802.dtb \
@@ -102,6 +103,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-orangepi-mini.dtb \
 	sun7i-a20-pcduino3.dtb \
 	sun7i-a20-pcduino3-nano.dtb \
+	sun7i-a20-primo73.dtb \
 	sun7i-a20-wexler-tab7200.dtb
 dtb-$(CONFIG_MACH_SUN8I_A23) += \
 	sun8i-a23-ippo-q8h-v5.dtb \
arch/arm/dts/sun4i-a10-jesurun-q5.dts new file +194 -0

194 lines not on this page · raw message

arch/arm/dts/sun7i-a20-primo73.dts new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.3.5
#46 lore raw

PATCH 17/21 sunxi: dts: Add dts files which have been submitted but not yet merged upstream

Quoted 4 lines · Hans de Goede

We need dts files for all boards we support, so bring in a few unmerged ones, these will be replaced with the upstream merged versions the next time we sync dts files.

Quoted 8 lines
---
 arch/arm/dts/Makefile                 |   2 +
 arch/arm/dts/sun4i-a10-jesurun-q5.dts | 194 ++++++++++++++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-primo73.dts    | 102 ++++++++++++++++++
 3 files changed, 298 insertions(+)
 create mode 100644 arch/arm/dts/sun4i-a10-jesurun-q5.dts
 create mode 100644 arch/arm/dts/sun7i-a20-primo73.dts
#48 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

In reply to Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

---
 arch/arm/dts/Makefile                              | 20 +++++++-
 arch/arm/dts/sun4i-a10-inet-3f.dts                 | 29 +++++++++++
 arch/arm/dts/sun4i-a10-inet-3w.dts                 | 29 +++++++++++
 arch/arm/dts/sun5i-a13-ampe-a76.dts                | 29 +++++++++++
 arch/arm/dts/sun5i-a13-forfun-q88db.dts            | 29 +++++++++++
 arch/arm/dts/sun5i-a13-inet-86vs.dts               | 29 +++++++++++
 arch/arm/dts/sun5i-a13-tzx-q8-713b7.dts            | 29 +++++++++++
 arch/arm/dts/sun6i-a31-mixtile-loftq.dts           | 57 ++++++++++++++++++++++
 arch/arm/dts/sun6i-a31s-primo81.dts                | 29 +++++++++++
 arch/arm/dts/sun7i-a20-ainol-aw1.dts               | 29 +++++++++++
 arch/arm/dts/sun7i-a20-m5.dts                      | 57 ++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-mk808c.dts                  | 45 +++++++++++++++++
 arch/arm/dts/sun7i-a20-wits-pro-a20-dkt.dts        | 57 ++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-yones-toptech-bd1078.dts    | 29 +++++++++++
 arch/arm/dts/sun8i-a33-astar-mid756.dts            | 29 +++++++++++
 .../dts/sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts    | 29 +++++++++++
 16 files changed, 553 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/sun4i-a10-inet-3f.dts
 create mode 100644 arch/arm/dts/sun4i-a10-inet-3w.dts
 create mode 100644 arch/arm/dts/sun5i-a13-ampe-a76.dts
 create mode 100644 arch/arm/dts/sun5i-a13-forfun-q88db.dts
 create mode 100644 arch/arm/dts/sun5i-a13-inet-86vs.dts
 create mode 100644 arch/arm/dts/sun5i-a13-tzx-q8-713b7.dts
 create mode 100644 arch/arm/dts/sun6i-a31-mixtile-loftq.dts
 create mode 100644 arch/arm/dts/sun6i-a31s-primo81.dts
 create mode 100644 arch/arm/dts/sun7i-a20-ainol-aw1.dts
 create mode 100644 arch/arm/dts/sun7i-a20-m5.dts
 create mode 100644 arch/arm/dts/sun7i-a20-mk808c.dts
 create mode 100644 arch/arm/dts/sun7i-a20-wits-pro-a20-dkt.dts
 create mode 100644 arch/arm/dts/sun7i-a20-yones-toptech-bd1078.dts
 create mode 100644 arch/arm/dts/sun8i-a33-astar-mid756.dts
 create mode 100644 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts
arch/arm/dts/Makefile +18 -2
index a18c565..190844b 100644
@@ -64,6 +64,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
 	sun4i-a10-gemei-g9.dtb \
 	sun4i-a10-hackberry.dtb \
 	sun4i-a10-hyundai-a7hd.dtb \
+	sun4i-a10-inet-3f.dtb \
+	sun4i-a10-inet-3w.dtb \
 	sun4i-a10-inet97fv2.dtb \
 	sun4i-a10-jesurun-q5.dtb \
 	sun4i-a10-marsboard.dtb \
@@ -77,9 +79,13 @@ dtb-$(CONFIG_MACH_SUN5I) += \
 	sun5i-a10s-mk802.dtb \
 	sun5i-a10s-olinuxino-micro.dtb \
 	sun5i-a10s-r7-tv-dongle.dtb \
+	sun5i-a13-ampe-a76.dtb \
+	sun5i-a13-forfun-q88db.dtb \
 	sun5i-a13-hsg-h702.dtb \
+	sun5i-a13-inet-86vs.dtb \
 	sun5i-a13-olinuxino.dtb \
 	sun5i-a13-olinuxino-micro.dtb \
+	sun5i-a13-tzx-q8-713b7.dtb \
 	sun5i-a13-utoo-p66.dtb
 dtb-$(CONFIG_MACH_SUN6I) += \
 	sun6i-a31-app4-evb1.dtb \
@@ -87,8 +93,11 @@ dtb-$(CONFIG_MACH_SUN6I) += \
 	sun6i-a31-hummingbird.dtb \
 	sun6i-a31-i7.dtb \
 	sun6i-a31-m9.dtb \
-	sun6i-a31s-cs908.dtb
+	sun6i-a31-mixtile-loftq.dtb \
+	sun6i-a31s-cs908.dtb \
+	sun6i-a31s-primo81.dtb
 dtb-$(CONFIG_MACH_SUN7I) += \
+	sun7i-a20-ainol-aw1.dtb \
 	sun7i-a20-bananapi.dtb \
 	sun7i-a20-bananapro.dtb \
 	sun7i-a20-cubieboard2.dtb \
@@ -96,6 +105,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-hummingbird.dtb \
 	sun7i-a20-i12-tvbox.dtb \
 	sun7i-a20-m3.dtb \
+	sun7i-a20-m5.dtb \
+	sun7i-a20-mk808c.dtb \
 	sun7i-a20-olinuxino-lime.dtb \
 	sun7i-a20-olinuxino-lime2.dtb \
 	sun7i-a20-olinuxino-micro.dtb \
@@ -104,10 +115,15 @@ dtb-$(CONFIG_MACH_SUN7I) += \
 	sun7i-a20-pcduino3.dtb \
 	sun7i-a20-pcduino3-nano.dtb \
 	sun7i-a20-primo73.dtb \
-	sun7i-a20-wexler-tab7200.dtb
+	sun7i-a20-wexler-tab7200.dtb \
+	sun7i-a20-wits-pro-a20-dkt.dtb \
+	sun7i-a20-yones-toptech-bd1078.dtb
 dtb-$(CONFIG_MACH_SUN8I_A23) += \
 	sun8i-a23-ippo-q8h-v5.dtb \
 	sun8i-a23-ippo-q8h-v1.2.dtb
+dtb-$(CONFIG_MACH_SUN8I_A33) += \
+	sun8i-a33-astar-mid756.dtb \
+	sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
 	sun9i-a80-cubieboard4.dtb
arch/arm/dts/sun4i-a10-inet-3f.dts new file +29 -0
new file mode 100644
index 0000000..d2805c5
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the iNet 3F for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+
+/ {
+	model = "iNet 3F";
+	compatible = "inet,3f", "allwinner,sun4i-a10";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun4i-a10-inet-3w.dts new file +29 -0
new file mode 100644
index 0000000..96fa826
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the iNet 3W for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+
+/ {
+	model = "iNet 3W";
+	compatible = "inet,3w", "allwinner,sun4i-a10";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun5i-a13-ampe-a76.dts new file +29 -0
new file mode 100644
index 0000000..f216f27
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Ampe A76 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun5i-a13.dtsi"
+
+/ {
+	model = "Ampe A76";
+	compatible = "ampe,a76", "allwinner,sun5i-a13";
+
+	aliases {
+		serial0 = &uart1;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins_b>;
+	status = "okay";
+};
arch/arm/dts/sun5i-a13-forfun-q88db.dts new file +29 -0
new file mode 100644
index 0000000..24de86c
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Forfun Q88db for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun5i-a13.dtsi"
+
+/ {
+	model = "Forfun Q88db";
+	compatible = "forfun,q88db", "allwinner,sun5i-a13";
+
+	aliases {
+		serial0 = &uart1;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins_b>;
+	status = "okay";
+};
arch/arm/dts/sun5i-a13-inet-86vs.dts new file +29 -0
new file mode 100644
index 0000000..d073294
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the iNet 86VS for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun5i-a13.dtsi"
+
+/ {
+	model = "iNet 86VS";
+	compatible = "inet,86vs", "allwinner,sun5i-a13";
+
+	aliases {
+		serial0 = &uart1;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins_b>;
+	status = "okay";
+};
arch/arm/dts/sun5i-a13-tzx-q8-713b7.dts new file +29 -0
new file mode 100644
index 0000000..47f630e
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the TZX Q8 713b7 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun5i-a13.dtsi"
+
+/ {
+	model = "TZX Q8 713b7";
+	compatible = "tzx,q8-713b7", "allwinner,sun5i-a13";
+
+	aliases {
+		serial0 = &uart1;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins_b>;
+	status = "okay";
+};
arch/arm/dts/sun6i-a31-mixtile-loftq.dts new file +57 -0

57 lines not on this page · raw message

arch/arm/dts/sun6i-a31s-primo81.dts new file +29 -0
new file mode 100644
index 0000000..cfdc03e
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the MSI Primo81 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun6i-a31s.dtsi"
+
+/ {
+	model = "MSI Primo81";
+	compatible = "msi,primo81", "allwinner,sun6i-a31s";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun7i-a20-ainol-aw1.dts new file +29 -0
new file mode 100644
index 0000000..8b730cd
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Ainol AW1 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+
+/ {
+	model = "Ainol AW1";
+	compatible = "ainol,aw1", "allwinner,sun7i-a20";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun7i-a20-m5.dts new file +57 -0

57 lines not on this page · raw message

arch/arm/dts/sun7i-a20-mk808c.dts new file +45 -0

45 lines not on this page · raw message

arch/arm/dts/sun7i-a20-wits-pro-a20-dkt.dts new file +57 -0

57 lines not on this page · raw message

arch/arm/dts/sun7i-a20-yones-toptech-bd1078.dts new file +29 -0
new file mode 100644
index 0000000..759ec9d
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Yones Toptech BD1078 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun7i-a20.dtsi"
+
+/ {
+	model = "Yones Toptech BD1078";
+	compatible = "yones,toptech-bd1078", "allwinner,sun7i-a20";
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun8i-a33-astar-mid756.dts new file +29 -0
new file mode 100644
index 0000000..d9ce446
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Astar MID756 for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun8i-a23.dtsi"
+
+/ {
+	model = "Astar MID756";
+	compatible = "astar,mid756", "allwinner,sun8i-a23";
+
+	aliases {
+		serial0 = &r_uart;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&r_uart {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_uart_pins_a>;
+	status = "okay";
+};
arch/arm/dts/sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts new file +29 -0
new file mode 100644
index 0000000..4a43187
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Hans de Goede <[email protected]>
+ *
+ * Minimal dts file for the Ippo Q8H V1.2 (A33, 1024x600) for u-boot only
+ *
+ * SPDX-License-Identifier:     GPL-2.0+ or X11
+ */
+
+/dts-v1/;
+#include "sun8i-a23.dtsi"
+
+/ {
+	model = "Ippo Q8H V1.2 (A33, 1024x600)";
+	compatible = "ippo,q8h-v1.2-a33-lcd1024x600", "allwinner,sun8i-a23";
+
+	aliases {
+		serial0 = &r_uart;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
+
+&r_uart {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_uart_pins_a>;
+	status = "okay";
+};
Signature · 1 line
2.3.5
#49 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

Quoted 30 lines · Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

---
 arch/arm/dts/Makefile                              | 20 +++++++-
 arch/arm/dts/sun4i-a10-inet-3f.dts                 | 29 +++++++++++
 arch/arm/dts/sun4i-a10-inet-3w.dts                 | 29 +++++++++++
 arch/arm/dts/sun5i-a13-ampe-a76.dts                | 29 +++++++++++
 arch/arm/dts/sun5i-a13-forfun-q88db.dts            | 29 +++++++++++
 arch/arm/dts/sun5i-a13-inet-86vs.dts               | 29 +++++++++++
 arch/arm/dts/sun5i-a13-tzx-q8-713b7.dts            | 29 +++++++++++
 arch/arm/dts/sun6i-a31-mixtile-loftq.dts           | 57 ++++++++++++++++++++++
 arch/arm/dts/sun6i-a31s-primo81.dts                | 29 +++++++++++
 arch/arm/dts/sun7i-a20-ainol-aw1.dts               | 29 +++++++++++
 arch/arm/dts/sun7i-a20-m5.dts                      | 57 ++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-mk808c.dts                  | 45 +++++++++++++++++
 arch/arm/dts/sun7i-a20-wits-pro-a20-dkt.dts        | 57 ++++++++++++++++++++++
 arch/arm/dts/sun7i-a20-yones-toptech-bd1078.dts    | 29 +++++++++++
 arch/arm/dts/sun8i-a33-astar-mid756.dts            | 29 +++++++++++
 .../dts/sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts    | 29 +++++++++++
 16 files changed, 553 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/sun4i-a10-inet-3f.dts
 create mode 100644 arch/arm/dts/sun4i-a10-inet-3w.dts
 create mode 100644 arch/arm/dts/sun5i-a13-ampe-a76.dts
 create mode 100644 arch/arm/dts/sun5i-a13-forfun-q88db.dts
 create mode 100644 arch/arm/dts/sun5i-a13-inet-86vs.dts
 create mode 100644 arch/arm/dts/sun5i-a13-tzx-q8-713b7.dts
 create mode 100644 arch/arm/dts/sun6i-a31-mixtile-loftq.dts
Quoted 8 lines
 create mode 100644 arch/arm/dts/sun6i-a31s-primo81.dts
 create mode 100644 arch/arm/dts/sun7i-a20-ainol-aw1.dts
 create mode 100644 arch/arm/dts/sun7i-a20-m5.dts
 create mode 100644 arch/arm/dts/sun7i-a20-mk808c.dts
 create mode 100644 arch/arm/dts/sun7i-a20-wits-pro-a20-dkt.dts
 create mode 100644 arch/arm/dts/sun7i-a20-yones-toptech-bd1078.dts
 create mode 100644 arch/arm/dts/sun8i-a33-astar-mid756.dts
 create mode 100644 arch/arm/dts/sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts
#50 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

In reply to Hans de Goede
Quoted 3 lines · Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

Can these minimal things not be submitted to mainline regardless? I mean they are factually accurate descriptions of the h/w so far as they go, so why not?

Quoted 1 line

+ * [...] for u-boot only

These aren't really "for u-boot only", they are still generic facts about the board, just perhaps a bit incomplete.

#51 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

Hi,

Quoted 8 lines · Ian Campbell
Quoted 3 lines · Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

Can these minimal things not be submitted to mainline regardless? I mean they are factually accurate descriptions of the h/w so far as they go, so why not?

These are not tested on the actual boards, and Maxime will not take untested dts patches.

Quoted 4 lines
Quoted 1 line

+ * [...] for u-boot only

These aren't really "for u-boot only", they are still generic facts about the board, just perhaps a bit incomplete.

They lack mmc controller info for one, so no rootfs support on many boards, iow not really useful. I'm afraid that we will just have to live with these ones, and not accept any new boards unless they come with a proper dts (which has been submitted upstream).

Hopefully over time these will get a proper dts too.

Regards,

Hans

#52 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

Quoted 8 lines · Hans de Goede

Hi,

Quoted 5 lines · Ian Campbell
Quoted 3 lines · Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

Quoted 5 lines
Quoted 3 lines

Can these minimal things not be submitted to mainline regardless? I mean they are factually accurate descriptions of the h/w so far as they go, so why not?

These are not tested on the actual boards,

Not even with u-boot?

Can we CC the people listed in board/sunxi/MAINTAINERS as responsible for the relevant boards and get them tested?

Quoted 1 line

and Maxime will not take untested dts patches.

I presume/hope here you mean "completely untested" as opposed to "not tested with Linux"? (Otherwise I'm going to have a little hissy fit on some other list ;-))

Quoted 17 lines
Quoted 5 lines
Quoted 2 lines

+ * [...] for u-boot only

These aren't really "for u-boot only", they are still generic facts about the board, just perhaps a bit incomplete.

They lack mmc controller info for one, so no rootfs support on many boards, iow not really useful. I'm afraid that we will just have to live with these ones, and not accept any new boards unless they come with a proper dts (which has been submitted upstream).

Hopefully over time these will get a proper dts too.

Regards,

Hans

#53 lore raw

PATCH 18/21 sunxi: dts: Add minimal dts files for board which lack a dts sofar

Hi,

Quoted 9 lines · Ian Campbell
Quoted 8 lines · Hans de Goede

Hi,

Quoted 5 lines · Ian Campbell
Quoted 3 lines · Hans de Goede

u-boot has support for a number of boards for which a dts file still needs to be written, add minimal dts files for these boards so that we can switch them over to device-model / fdt.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Can these minimal things not be submitted to mainline regardless? I mean they are factually accurate descriptions of the h/w so far as they go, so why not?

These are not tested on the actual boards,

Not even with u-boot?

I must admit that they are not even tested with u-boot.

Quoted 2 lines

Can we CC the people listed in board/sunxi/MAINTAINERS as responsible for the relevant boards and get them tested?

That is a good idea, I will mail them to test things once the dust has settled a bit (wrt the merge window) and I'll also ask them to write full dts files for the upstream kernel.

Quoted 5 lines
Quoted 1 line

and Maxime will not take untested dts patches.

I presume/hope here you mean "completely untested" as opposed to "not tested with Linux"? (Otherwise I'm going to have a little hissy fit on some other list ;-))

Yes I mean completely untested :)

Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

+ * [...] for u-boot only

These aren't really "for u-boot only", they are still generic facts about the board, just perhaps a bit incomplete.

They lack mmc controller info for one, so no rootfs support on many boards, iow not really useful. I'm afraid that we will just have to live with these ones, and not accept any new boards unless they come with a proper dts (which has been submitted upstream).

Quoted 8 lines
Quoted 6 lines

Hopefully over time these will get a proper dts too.

Regards,

Hans

Regards,

Hans

#54 lore raw

PATCH 19/21 sunxi: dts: Add a CONFIG_DEFAULT_DEVICE_TREE setting to all sunxi boards

In reply to Hans de Goede

This is a preparation patch for switching all sunxi boards over to using the device model.

Note that rather then defining both CONFIG_DEFAULT_DEVICE_TREE (for u-boot) and CONFIG_FDTFILE (for the kernel), this commit simply replaces all CONFIG_FDTFILE defconfig settings with CONFIG_DEFAULT_DEVICE_TREE and uses CONFIG_DEFAULT_DEVICE_TREE for setting the default fdtfile env value in sunxi-common.h .

---
 board/sunxi/Kconfig                          | 3 ---
 configs/A10-OLinuXino-Lime_defconfig         | 2 +-
 configs/A10s-OLinuXino-M_defconfig           | 2 +-
 configs/A13-OLinuXinoM_defconfig             | 2 +-
 configs/A13-OLinuXino_defconfig              | 2 +-
 configs/A20-OLinuXino-Lime2_defconfig        | 2 +-
 configs/A20-OLinuXino-Lime_defconfig         | 2 +-
 configs/A20-OLinuXino_MICRO_defconfig        | 2 +-
 configs/Ainol_AW1_defconfig                  | 2 +-
 configs/Ampe_A76_defconfig                   | 2 +-
 configs/Astar_MID756_defconfig               | 2 +-
 configs/Auxtek-T004_defconfig                | 2 +-
 configs/Bananapi_defconfig                   | 2 +-
 configs/Bananapro_defconfig                  | 2 +-
 configs/CSQ_CS908_defconfig                  | 2 +-
 configs/Chuwi_V7_CW0825_defconfig            | 2 +-
 configs/Colombus_defconfig                   | 2 +-
 configs/Cubieboard2_defconfig                | 2 +-
 configs/Cubieboard_defconfig                 | 2 +-
 configs/Cubietruck_defconfig                 | 2 +-
 configs/Hummingbird_A31_defconfig            | 2 +-
 configs/Hyundai_A7HD_defconfig               | 2 +-
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig | 2 +-
 configs/Ippo_q8h_v1_2_defconfig              | 2 +-
 configs/Ippo_q8h_v5_defconfig                | 2 +-
 configs/Linksprite_pcDuino3_Nano_defconfig   | 2 +-
 configs/Linksprite_pcDuino3_defconfig        | 3 +--
 configs/Linksprite_pcDuino_defconfig         | 2 +-
 configs/MK808C_defconfig                     | 2 +-
 configs/MSI_Primo73_defconfig                | 2 +-
 configs/MSI_Primo81_defconfig                | 2 +-
 configs/Marsboard_A10_defconfig              | 2 +-
 configs/Mele_A1000_defconfig                 | 2 +-
 configs/Mele_I7_defconfig                    | 2 +-
 configs/Mele_M3_defconfig                    | 2 +-
 configs/Mele_M5_defconfig                    | 2 +-
 configs/Mele_M9_defconfig                    | 2 +-
 configs/Merrii_A80_Optimus_defconfig         | 2 +-
 configs/Mini-X_defconfig                     | 2 +-
 configs/Orangepi_defconfig                   | 2 +-
 configs/Orangepi_mini_defconfig              | 2 +-
 configs/TZX-Q8-713B7_defconfig               | 2 +-
 configs/UTOO_P66_defconfig                   | 2 +-
 configs/Wexler_TAB7200_defconfig             | 2 +-
 configs/Wits_Pro_A20_DKT_defconfig           | 2 +-
 configs/Yones_Toptech_BD1078_defconfig       | 2 +-
 configs/ba10_tv_box_defconfig                | 2 +-
 configs/forfun_q88db_defconfig               | 2 +-
 configs/i12-tvbox_defconfig                  | 2 +-
 configs/iNet_3F_defconfig                    | 2 +-
 configs/iNet_3W_defconfig                    | 2 +-
 configs/iNet_86VS_defconfig                  | 2 +-
 configs/jesurun_q5_defconfig                 | 2 +-
 configs/mixtile_loftq_defconfig              | 1 +
 configs/mk802_a10s_defconfig                 | 2 +-
 configs/mk802_defconfig                      | 2 +-
 configs/mk802ii_defconfig                    | 2 +-
 configs/r7-tv-dongle_defconfig               | 2 +-
 configs/sunxi_Gemei_G9_defconfig             | 2 +-
 include/configs/sunxi-common.h               | 2 +-
 60 files changed, 59 insertions(+), 62 deletions(-)
board/sunxi/Kconfig +0 -3
index 7e9325e..3831d3b 100644
@@ -200,9 +200,6 @@ 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 FDTFILE
-	string "Default fdtfile env setting for this board"
-
 config OLD_SUNXI_KERNEL_COMPAT
 	boolean "Enable workarounds for booting old kernels"
 	default n
configs/A10-OLinuXino-Lime_defconfig +1 -1
index 3e19424..0713652 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-olinuxino-lime.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-olinuxino-lime"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/A10s-OLinuXino-M_defconfig +1 -1
index 73b7894..e738923 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,SUNXI_EMAC,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a10s-olinuxino-micro.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-olinuxino-micro"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=1
 CONFIG_USB1_VBUS_PIN="PB10"
 CONFIG_MMC0_CD_PIN="PG1"
configs/A13-OLinuXinoM_defconfig +1 -1
index ab890c6..f558a6c 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a13-olinuxino-micro.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino-micro"
 CONFIG_USB1_VBUS_PIN="PG11"
 CONFIG_VIDEO_HDMI=n
 CONFIG_VIDEO_VGA_VIA_LCD=y
configs/A13-OLinuXino_defconfig +1 -1
index b923d3e..7fb466c 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a13-olinuxino.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino"
 CONFIG_USB1_VBUS_PIN="PG11"
 CONFIG_VIDEO_HDMI=n
 CONFIG_VIDEO_VGA_VIA_LCD=y
configs/A20-OLinuXino-Lime2_defconfig +1 -1
index f7231c6..7c1490e 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-olinuxino-lime2.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime2"
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_USB0_VBUS_PIN="PC17"
 CONFIG_USB0_VBUS_DET="PH5"
configs/A20-OLinuXino-Lime_defconfig +1 -1
index 7868d6e..879b939 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-olinuxino-lime.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
configs/A20-OLinuXino_MICRO_defconfig +1 -1
index 11fb760..a530d13 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-olinuxino-micro.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-micro"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=3
 CONFIG_VIDEO_VGA=y
 CONFIG_MMC0_CD_PIN="PH1"
configs/Ainol_AW1_defconfig +1 -1
index e5c2e21..a91a598 100644
@@ -5,7 +5,7 @@
 # Also see: http://linux-sunxi.org/Ainol_AW1
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun7i-a20-ainol-aw1.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ainol-aw1"
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB9"
configs/Ampe_A76_defconfig +1 -1
index af7638d..7bceb50 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
-CONFIG_FDTFILE="sun5i-a13-ampe-a76.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-ampe-a76"
 CONFIG_MMC0_CD_PIN="PG0"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PG12"
configs/Astar_MID756_defconfig +1 -1
index 2634a27..ab55cbf 100644
@@ -4,7 +4,7 @@
 # Also see: http://linux-sunxi.org/Softwinner_astar-rda
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
-CONFIG_FDTFILE="sun8i-a33-astar-mid756.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-astar-mid756"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
 CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
configs/Auxtek-T004_defconfig +1 -1
index ee6d6f6..f3f42e4 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a10s-auxtek-t004.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-auxtek-t004"
 CONFIG_USB1_VBUS_PIN="PG13"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/Bananapi_defconfig +1 -1
index 36a8671..0e1d7b5 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-bananapi.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-bananapi"
 CONFIG_GMAC_TX_DELAY=3
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/Bananapro_defconfig +1 -1
index 236a992..b68333f 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-bananapro.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-bananapro"
 CONFIG_USB1_VBUS_PIN="PH0"
 CONFIG_USB2_VBUS_PIN="PH1"
 CONFIG_GMAC_TX_DELAY=3
configs/CSQ_CS908_defconfig +1 -1
index 776636e..4d9e1e9 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
-CONFIG_FDTFILE="sun6i-a31s-cs908.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31s-cs908"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN6I=y
configs/Chuwi_V7_CW0825_defconfig +1 -1
index 03f9361..9053075 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun4i-a10-chuwi-v7-cw0825.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-chuwi-v7-cw0825"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB9"
 CONFIG_USB0_VBUS_DET="PH5"
configs/Colombus_defconfig +1 -1
index 810c88f..96b55ba 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
-CONFIG_FDTFILE="sun6i-a31-colombus.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-colombus"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN6I=y
configs/Cubieboard2_defconfig +1 -1
index 7f65c1d..ca0be1f 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPB(8),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-cubieboard2.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-cubieboard2"
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/Cubieboard_defconfig +1 -1
index 0b5c536..09b67ff 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8),USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-cubieboard.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-cubieboard"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/Cubietruck_defconfig +1 -1
index b8418f7..a05cf2b 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(12),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-cubietruck.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-cubietruck"
 CONFIG_GMAC_TX_DELAY=1
 CONFIG_VIDEO_VGA=y
 CONFIG_ARM=y
configs/Hummingbird_A31_defconfig +1 -1
index 8a11e09..a389b0a 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
-CONFIG_FDTFILE="sun6i-a31-hummingbird.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-hummingbird"
 CONFIG_VIDEO_VGA_VIA_LCD=y
 CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25"
 CONFIG_ARM=y
configs/Hyundai_A7HD_defconfig +1 -1
index b2bba11..3b71719 100644
@@ -3,7 +3,7 @@
 # headphones port for details see: http://linux-sunxi.org/Hyundai_A7HD
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun4i-a10-hyundai-a7hd.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-hyundai-a7hd"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB09"
 CONFIG_USB0_VBUS_DET="PH5"
configs/Ippo_q8h_v1_2_a33_1024x600_defconfig +1 -1
index 52a390d..a07c625 100644
@@ -2,7 +2,7 @@
 # with an A33 SoC (the pcb can take an A23 or an A33), and a 1024x600 LCD
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
-CONFIG_FDTFILE="sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-ippo-q8h-v1.2-lcd1024x600"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
 CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
configs/Ippo_q8h_v1_2_defconfig +1 -1
index d9455c8..606472b 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
-CONFIG_FDTFILE="sun8i-a23-ippo-q8h-v1.2.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v1.2"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
 CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
configs/Ippo_q8h_v5_defconfig +1 -1
index 4cc9a5e..f75737e 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
-CONFIG_FDTFILE="sun8i-a23-ippo-q8h-v5.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
 CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
configs/Linksprite_pcDuino3_Nano_defconfig +1 -1
index 9d171bd..51f811a 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-pcduino3-nano.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3-nano"
 CONFIG_GMAC_TX_DELAY=3
 CONFIG_USB1_VBUS_PIN="PH11"
 CONFIG_ARM=y
configs/Linksprite_pcDuino3_defconfig +1 -2
index e5aabdb..d51d34d 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
@@ -10,7 +10,6 @@ CONFIG_DRAM_EMR1=4
 CONFIG_DM=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_SERIAL=y
-CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_DISABLE_OF_CONTROL=y
 CONFIG_OF_SEPARATE=y
configs/Linksprite_pcDuino_defconfig +1 -1
index 3bed6aa..93366d3 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-pcduino.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-pcduino"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/MK808C_defconfig +1 -1
index d50d785..fcacfc6 100644
@@ -4,7 +4,7 @@
 # 1 USB A, 1 USB mini OTG, Bluetooth and Wireless LAN.
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-mk808c.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-mk808c"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
configs/MSI_Primo73_defconfig +1 -1
index 5227b6f..c767b3d 100644
@@ -8,7 +8,7 @@
 #    http://linux-sunxi.org/MSI_Primo73
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun7i-a20-primo73.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-primo73"
 CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:60000,le:60,ri:160,up:13,lo:12,hs:100,vs:10,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_DCLK_PHASE=0
 CONFIG_VIDEO_LCD_POWER="PH8"
configs/MSI_Primo81_defconfig +1 -1
index b6aa876..7e41e4b 100644
@@ -9,7 +9,7 @@
 
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS=""
-CONFIG_FDTFILE="sun6i-a31s-primo81.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31s-primo81"
 CONFIG_VIDEO_LCD_MODE="x:768,y:1024,depth:18,pclk_khz:66000,le:56,ri:60,up:30,lo:36,hs:64,vs:50,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828=y
 CONFIG_VIDEO_LCD_SSD2828_TX_CLK=27
configs/Marsboard_A10_defconfig +1 -1
index 74ce12c..e47709f 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="SUNXI_EMAC,AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-marsboard.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-marsboard"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/Mele_A1000_defconfig +1 -1
index c30e18b..32b20a7 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-a1000.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-a1000"
 CONFIG_VIDEO_VGA=y
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/Mele_I7_defconfig +1 -1
index e91d507..9f14461 100644
@@ -6,7 +6,7 @@
 # For more details see: http://linux-sunxi.org/Mele_I7
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
-CONFIG_FDTFILE="sun6i-a31-i7.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-i7"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN6I=y
configs/Mele_M3_defconfig +1 -1
index a74dd2d..10bf880 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-m3.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-m3"
 CONFIG_VIDEO_VGA=y
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_MMC0_CD_PIN="PH1"
configs/Mele_M5_defconfig +1 -1
index d0f0425..7e37140 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,AHCI,USB_EHCI,STATUSLED=234"
-CONFIG_FDTFILE="sun7i-a20-m5.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-m5"
 CONFIG_VIDEO_HDMI=y
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_USB1_VBUS_PIN="PH6"
configs/Mele_M9_defconfig +1 -1
index 592322d..da592fa 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
-CONFIG_FDTFILE="sun6i-a31-m9.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-m9"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN6I=y
configs/Merrii_A80_Optimus_defconfig +1 -1
index e65eea4..6bd5273 100644
@@ -1,4 +1,4 @@
-CONFIG_FDTFILE="sun9i-a80-optimus.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-optimus"
 CONFIG_VIDEO=n
 CONFIG_USB_KEYBOARD=n
 CONFIG_MMC0_CD_PIN="PH18"
configs/Mini-X_defconfig +1 -1
index a4cd5c7..434c561 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-mini-xplus.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mini-xplus"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/Orangepi_defconfig +1 -1
index 5bf9cac..110ec0c 100644
@@ -7,7 +7,7 @@
 # http://www.orangepi.org/
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-orangepi.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-orangepi"
 CONFIG_GMAC_TX_DELAY=3
 CONFIG_USB1_VBUS_PIN="PH26"
 CONFIG_USB2_VBUS_PIN="PH22"
configs/Orangepi_mini_defconfig +1 -1
index fce0555..119b803 100644
@@ -8,7 +8,7 @@
 # http://www.orangepi.org/
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-orangepi-mini.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-orangepi-mini"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=3
 CONFIG_MMC0_CD_PIN="PH10"
 CONFIG_MMC3_CD_PIN="PH11"
configs/TZX-Q8-713B7_defconfig +1 -1
index 0953554..1c1fbaa 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
-CONFIG_FDTFILE="sun5i-a13-tzx-q8-713b7.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-tzx-q8-713b7"
 CONFIG_MMC0_CD_PIN="PG0"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PG12"
configs/UTOO_P66_defconfig +1 -1
index 19ccd70..48997ca 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun5i-a13-utoo-p66.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-utoo-p66"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB04"
 CONFIG_USB0_VBUS_DET="PG01"
configs/Wexler_TAB7200_defconfig +1 -1
index 3f9318f..9c6dfd6 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-wexler-tab7200.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-wexler-tab7200"
 CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:33000,le:45,ri:210,up:22,lo:22,hs:1,vs:1,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_POWER="PH8"
 CONFIG_VIDEO_LCD_BL_EN="PH7"
configs/Wits_Pro_A20_DKT_defconfig +1 -1
index 92c33b3..4bb4452 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-wits-pro-a20-dkt.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-wits-pro-a20-dkt"
 CONFIG_VIDEO_LCD_MODE="x:1024,y:768,depth:24,pclk_khz:65000,le:159,ri:160,up:22,lo:15,hs:1,vs:1,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_POWER="PH8"
 CONFIG_VIDEO_LCD_BL_EN="PH7"
configs/Yones_Toptech_BD1078_defconfig +1 -1
index 00ede67..6f6e89d 100644
@@ -6,7 +6,7 @@
 # Also see: http://linux-sunxi.org/Yones_Toptech_BD1078
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun7i-a20-yones-toptech-bd1078.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-yones-toptech-bd1078"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=1
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_MMC1_CD_PIN="PH2"
configs/ba10_tv_box_defconfig +1 -1
index 503cd87..9909a94 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-ba10-tvbox.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-ba10-tvbox"
 CONFIG_USB2_VBUS_PIN="PH12"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/forfun_q88db_defconfig +1 -1
index 8151eac..bafbed9 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun5i-a13-forfun-q88db.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-forfun-q88db"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PG12"
 CONFIG_USB0_VBUS_DET="PG1"
configs/i12-tvbox_defconfig +1 -1
index b10f4d0..6027b87 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,MACPWR=SUNXI_GPH(21),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-i12-tvbox.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-i12-tvbox"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN7I=y
configs/iNet_3F_defconfig +1 -1
index 4225b85..0ae11a7 100644
@@ -2,7 +2,7 @@
 # Also see: http://linux-sunxi.org/INet_3F
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun4i-a10-inet-3f.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet-3f"
 CONFIG_MMC0_CD_PIN="PH1"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB9"
configs/iNet_3W_defconfig +1 -1
index 0a8e0f5..204f887 100644
@@ -2,7 +2,7 @@
 # Also see: http://linux-sunxi.org/INet_3W
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun4i-a10-inet-3w.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-inet-3w"
 CONFIG_MMC0_CD_PIN="PH20"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PB9"
configs/iNet_86VS_defconfig +1 -1
index e5c103f..869a6d7 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-CONFIG_FDTFILE="sun5i-a13-inet-86vs.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-inet-86vs"
 CONFIG_USB_MUSB_SUNXI=y
 CONFIG_USB0_VBUS_PIN="PG12"
 CONFIG_USB0_VBUS_DET="PG1"
configs/jesurun_q5_defconfig +1 -1
index 8c98019..c0d87cc 100644
@@ -11,7 +11,7 @@
 # For more details see: http://linux-sunxi.org/Jesurun_Q5
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI,MACPWR=SUNXI_GPH(19)"
-CONFIG_FDTFILE="sun4i-a10-jesurun-q5.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-jesurun-q5"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/mixtile_loftq_defconfig +1 -0
index 8275df8..6505822 100644
@@ -6,6 +6,7 @@
 # Also see http://focalcrest.com/en/pc.html#pro02
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPA(21)"
+CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-mixtile-loftq"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN6I=y
configs/mk802_a10s_defconfig +1 -1
index 701b92b..8e070b9 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a10s-mk802.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-mk802"
 CONFIG_USB1_VBUS_PIN="PB10"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/mk802_defconfig +1 -1
index 0fe6edb..92b9ae4 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-mk802.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mk802"
 CONFIG_USB2_VBUS_PIN="PH12"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/mk802ii_defconfig +1 -1
index 073d519..447d128 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun4i-a10-mk802ii.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mk802ii"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
configs/r7-tv-dongle_defconfig +1 -1
index 563fa1a..d7ed165 100644
@@ -1,6 +1,6 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun5i-a10s-r7-tv-dongle.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-r7-tv-dongle"
 CONFIG_USB1_VBUS_PIN="PG13"
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
configs/sunxi_Gemei_G9_defconfig +1 -1
index 1e13fea..c46b725 100644
@@ -6,7 +6,7 @@
 # More details are available at: http://linux-sunxi.org/Gemei_G9
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI"
-CONFIG_FDTFILE="sun4i-gemei-g9.dtb"
+CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-gemei-g9"
 CONFIG_VIDEO_LCD_MODE="x:1024,y:768,depth:18,pclk_khz:100000,le:799,ri:260,up:15,lo:16,hs:1,vs:1,sync:3,vmode:0"
 CONFIG_VIDEO_LCD_PANEL_LVDS=y
 CONFIG_VIDEO_LCD_POWER="PH8"
include/configs/sunxi-common.h +1 -1
index 40c7f63..4c3fb47 100644
@@ -453,7 +453,7 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONSOLE_ENV_SETTINGS \
 	MEM_LAYOUT_ENV_SETTINGS \
-	"fdtfile=" CONFIG_FDTFILE "\0" \
+	"fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
 	"console=ttyS0,115200\0" \
 	BOOTENV
 
Signature · 1 line
2.3.5
#55 lore raw

PATCH 19/21 sunxi: dts: Add a CONFIG_DEFAULT_DEVICE_TREE setting to all sunxi boards

Quoted 8 lines · Hans de Goede

This is a preparation patch for switching all sunxi boards over to using the device model.

Note that rather then defining both CONFIG_DEFAULT_DEVICE_TREE (for u-boot) and CONFIG_FDTFILE (for the kernel), this commit simply replaces all CONFIG_FDTFILE defconfig settings with CONFIG_DEFAULT_DEVICE_TREE and uses CONFIG_DEFAULT_DEVICE_TREE for setting the default fdtfile env value in sunxi-common.h .

#56 lore raw

PATCH 19/21 sunxi: dts: Add a CONFIG_DEFAULT_DEVICE_TREE setting to all sunxi boards

In reply to Hans de Goede
Quoted 10 lines · Hans de Goede

This is a preparation patch for switching all sunxi boards over to using the device model.

Note that rather then defining both CONFIG_DEFAULT_DEVICE_TREE (for u-boot) and CONFIG_FDTFILE (for the kernel), this commit simply replaces all CONFIG_FDTFILE defconfig settings with CONFIG_DEFAULT_DEVICE_TREE and uses CONFIG_DEFAULT_DEVICE_TREE for setting the default fdtfile env value in sunxi-common.h .

#57 lore raw

PATCH 20/21 sunxi: Move all boards to the device-model

In reply to Hans de Goede

Now that we've everything prepared for it remove the DM settings from the defconfig(s) and simply always set them for sunxi, so that all sunxi boards will allways use dm now.

---
 arch/arm/Kconfig                           |  5 +++++
 board/sunxi/Kconfig                        | 12 ++++++++++++
 configs/A20-OLinuXino-Lime2_defconfig      |  2 --
 configs/A20-OLinuXino-Lime_defconfig       |  2 --
 configs/A20-OLinuXino_MICRO_defconfig      |  2 --
 configs/Bananapi_defconfig                 |  2 --
 configs/Bananapro_defconfig                |  2 --
 configs/CSQ_CS908_defconfig                |  2 --
 configs/Colombus_defconfig                 |  2 --
 configs/Cubieboard2_defconfig              |  2 --
 configs/Cubietruck_defconfig               |  2 --
 configs/Hummingbird_A31_defconfig          |  2 --
 configs/Linksprite_pcDuino3_Nano_defconfig |  2 --
 configs/Linksprite_pcDuino3_defconfig      |  9 ---------
 configs/Mele_I7_defconfig                  |  2 --
 configs/Mele_M3_defconfig                  |  2 --
 configs/Mele_M5_defconfig                  |  2 --
 configs/Mele_M9_defconfig                  |  2 --
 configs/Orangepi_defconfig                 |  2 --
 configs/Orangepi_mini_defconfig            |  2 --
 configs/UTOO_P66_defconfig                 |  1 +
 configs/Wits_Pro_A20_DKT_defconfig         |  2 --
 configs/i12-tvbox_defconfig                |  2 --
 configs/mixtile_loftq_defconfig            |  2 --
 include/configs/sunxi-common.h             |  2 +-
 25 files changed, 19 insertions(+), 50 deletions(-)
arch/arm/Kconfig +5 -0
index b39bb4f..d681fcc 100644
@@ -627,6 +627,11 @@ config TARGET_SOCFPGA_CYCLONE5
 
 config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
+	select DM
+	select DM_GPIO
+	select OF_CONTROL
+	select OF_SEPARATE
+	select SPL_DISABLE_OF_CONTROL
 
 config TARGET_SNOWBALL
 	bool "Support snowball"
board/sunxi/Kconfig +12 -0
index 3831d3b..3997637 100644
@@ -529,4 +529,16 @@ config GMAC_TX_DELAY
 	---help---
 	Set the GMAC Transmit Clock Delay Chain value.
 
+config NET
+	default y
+
+config NETDEVICES
+	default y
+
+config DM_ETH
+	default y
+
+config DM_SERIAL
+	default y
+
 endif
configs/A20-OLinuXino-Lime2_defconfig +0 -2
index 7c1490e..59e7473 100644
@@ -11,5 +11,3 @@ CONFIG_DRAM_CLK=480
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/A20-OLinuXino-Lime_defconfig +0 -2
index 879b939..2ba70f7 100644
@@ -8,5 +8,3 @@ CONFIG_DRAM_CLK=480
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/A20-OLinuXino_MICRO_defconfig +0 -2
index a530d13..7d2e810 100644
@@ -12,5 +12,3 @@ CONFIG_DRAM_CLK=384
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Bananapi_defconfig +0 -2
index 0e1d7b5..8dcf4a7 100644
@@ -9,5 +9,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Bananapro_defconfig +0 -2
index b68333f..d3e015c 100644
@@ -11,5 +11,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/CSQ_CS908_defconfig +0 -2
index 4d9e1e9..817cd6d 100644
@@ -14,5 +14,3 @@ CONFIG_AXP221_ALDO1_VOLT=3300
 CONFIG_USB1_VBUS_PIN=""
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Colombus_defconfig +0 -2
index 96b55ba..c7efabc 100644
@@ -11,5 +11,3 @@ CONFIG_AXP221_ALDO1_VOLT=3300
 # No Vbus gpio for usb1
 CONFIG_USB1_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Cubieboard2_defconfig +0 -2
index ca0be1f..092d6b0 100644
@@ -9,5 +9,3 @@ CONFIG_DRAM_CLK=480
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Cubietruck_defconfig +0 -2
index a05cf2b..50d6d66 100644
@@ -10,5 +10,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Hummingbird_A31_defconfig +0 -2
index a389b0a..9e049b2 100644
@@ -15,5 +15,3 @@ CONFIG_USB1_VBUS_PIN="PH24"
 # No Vbus gpio for usb2
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Linksprite_pcDuino3_Nano_defconfig +0 -2
index 51f811a..60d2357 100644
@@ -10,5 +10,3 @@ CONFIG_DRAM_CLK=408
 CONFIG_DRAM_ZQ=122
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Linksprite_pcDuino3_defconfig +0 -9
index d51d34d..83e539d 100644
@@ -7,13 +7,4 @@ CONFIG_MACH_SUN7I=y
 CONFIG_DRAM_CLK=480
 CONFIG_DRAM_ZQ=122
 CONFIG_DRAM_EMR1=4
-CONFIG_DM=y
-CONFIG_DM_GPIO=y
-CONFIG_DM_SERIAL=y
-CONFIG_OF_CONTROL=y
-CONFIG_SPL_DISABLE_OF_CONTROL=y
-CONFIG_OF_SEPARATE=y
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
-CONFIG_DM_ETH=y
configs/Mele_I7_defconfig +0 -2
index 9f14461..adcf3b2 100644
@@ -25,5 +25,3 @@ CONFIG_USB1_VBUS_PIN="PC27"
 # No Vbus gpio for usb2
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Mele_M3_defconfig +0 -2
index 10bf880..e2f8d65 100644
@@ -11,5 +11,3 @@ CONFIG_DRAM_CLK=384
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Mele_M5_defconfig +0 -2
index 7e37140..78fba71 100644
@@ -12,5 +12,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=122
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Mele_M9_defconfig +0 -2
index da592fa..ea35024 100644
@@ -19,5 +19,3 @@ CONFIG_USB1_VBUS_PIN="PC27"
 # No Vbus gpio for usb2
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Orangepi_defconfig +0 -2
index 110ec0c..cd25521 100644
@@ -19,5 +19,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/Orangepi_mini_defconfig +0 -2
index 119b803..0bef159 100644
@@ -22,5 +22,3 @@ CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/UTOO_P66_defconfig +1 -0
index 48997ca..a449936 100644
@@ -19,3 +19,4 @@ CONFIG_MACH_SUN5I=y
 CONFIG_DRAM_CLK=432
 CONFIG_DRAM_ZQ=123
 CONFIG_DRAM_EMR1=0
+CONFIG_DM_SERIAL=n
configs/Wits_Pro_A20_DKT_defconfig +0 -2
index 4bb4452..19b8f39 100644
@@ -14,5 +14,3 @@ CONFIG_DRAM_CLK=384
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/i12-tvbox_defconfig +0 -2
index 6027b87..e579fde 100644
@@ -8,5 +8,3 @@ CONFIG_DRAM_CLK=384
 CONFIG_DRAM_ZQ=127
 CONFIG_DRAM_EMR1=4
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
configs/mixtile_loftq_defconfig +0 -2
index 6505822..4162627 100644
@@ -21,5 +21,3 @@ CONFIG_USB1_VBUS_PIN="PH24"
 # No Vbus gpio for usb2
 CONFIG_USB2_VBUS_PIN=""
 CONFIG_ETH_DESIGNWARE=y
-CONFIG_NETDEVICES=y
-CONFIG_NET=y
include/configs/sunxi-common.h +1 -1
index 4c3fb47..b937925 100644
@@ -115,7 +115,7 @@
 
 #endif
 
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM)
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL)
 # define CONFIG_DW_SERIAL
 #endif
 
Signature · 1 line
2.3.5
#58 lore raw

PATCH 20/21 sunxi: Move all boards to the device-model

Quoted 24 lines · Hans de Goede

Now that we've everything prepared for it remove the DM settings from the defconfig(s) and simply always set them for sunxi, so that all sunxi boards will allways use dm now.

---
 arch/arm/Kconfig                           |  5 +++++
 board/sunxi/Kconfig                        | 12 ++++++++++++
 configs/A20-OLinuXino-Lime2_defconfig      |  2 --
 configs/A20-OLinuXino-Lime_defconfig       |  2 --
 configs/A20-OLinuXino_MICRO_defconfig      |  2 --
 configs/Bananapi_defconfig                 |  2 --
 configs/Bananapro_defconfig                |  2 --
 configs/CSQ_CS908_defconfig                |  2 --
 configs/Colombus_defconfig                 |  2 --
 configs/Cubieboard2_defconfig              |  2 --
 configs/Cubietruck_defconfig               |  2 --
 configs/Hummingbird_A31_defconfig          |  2 --
 configs/Linksprite_pcDuino3_Nano_defconfig |  2 --
 configs/Linksprite_pcDuino3_defconfig      |  9 ---------
 configs/Mele_I7_defconfig                  |  2 --
 configs/Mele_M3_defconfig                  |  2 --
 configs/Mele_M5_defconfig                  |  2 --
 configs/Mele_M9_defconfig                  |  2 --
Quoted 8 lines
 configs/Orangepi_defconfig                 |  2 --
 configs/Orangepi_mini_defconfig            |  2 --
 configs/UTOO_P66_defconfig                 |  1 +
 configs/Wits_Pro_A20_DKT_defconfig         |  2 --
 configs/i12-tvbox_defconfig                |  2 --
 configs/mixtile_loftq_defconfig            |  2 --
 include/configs/sunxi-common.h             |  2 +-
 25 files changed, 19 insertions(+), 50 deletions(-)
#59 lore raw

PATCH 20/21 sunxi: Move all boards to the device-model

In reply to Hans de Goede
Quoted 9 lines · Hans de Goede
board/sunxi/Kconfig +1 -0
index 3831d3b..3997637 100644
@@ -529,4 +529,16 @@ config GMAC_TX_DELAY
 	---help---
 	Set the GMAC Transmit Clock Delay Chain value.
 
+config NET

board/sunxi/Kconfig config GMAC_TX_DELAY · line 542

Quoted 10 lines
board/sunxi/Kconfig +10 -0
+	default y
+
+config NETDEVICES
+	default y
+
+config DM_ETH
+	default y
+
+config DM_SERIAL
+	default y

None of these have a more appropriate home than sunxi/Kconfig?

#60 lore raw

PATCH 20/21 sunxi: Move all boards to the device-model

Hi,

Quoted 9 lines · Ian Campbell
Quoted 8 lines · Hans de Goede
board/sunxi/Kconfig +0 -0
index 3831d3b..3997637 100644
@@ -529,4 +529,16 @@ config GMAC_TX_DELAY
  	---help---
  	Set the GMAC Transmit Clock Delay Chain value.
 
Quoted 13 lines

board/sunxi/Kconfig config GMAC_TX_DELAY · line 542

Quoted 11 lines
board/sunxi/Kconfig +11 -0
+config NET
+	default y
+
+config NETDEVICES
+	default y
+
+config DM_ETH
+	default y
+
+config DM_SERIAL
+	default y

None of these have a more appropriate home than sunxi/Kconfig?

The CONFIG_foo options themselves are defined in more appropriate places, we are just enabling them for all sunxi boards here.

Another way would be to add "default y if ARCH_SUNXI" to the place where they are actually defined.

Doing things this way was copied from arch/sandbox/Kconfig, I've tried using select in arch/arm/Kconfig
for the NET ones but that leads to:

warning: (ARCH_SUNXI) selects NET which has unmet direct dependencies (SANDBOX)
warning: (ARCH_SUNXI) selects NET which has unmet direct dependencies (SANDBOX)

Which really seems to be an issue with the SANDBOX Kconfig file to me, which has:

menu "Sandbox architecture"
depends on SANDBOX

...

config NET
default y

config NETDEVICES
default y

config DM_ETH
default y

...

endmenu

I would be happy to see this fixed, but for now I've just copied what the sandbox code is doing.

Regards,

Hans

#61 lore raw

PATCH 20/21 sunxi: Move all boards to the device-model

Quoted 2 lines · Hans de Goede

I would be happy to see this fixed, but for now I've just copied what the sandbox code is doing.

OK, since Simon is happy with it I have no objections:

#62 lore raw

PATCH 21/21 sunxi: emac: Remove non device-model code

In reply to Hans de Goede

All sunxi boards now use the device-model, so remove the non device-model code.

---
 arch/arm/cpu/armv7/sunxi/board.c | 12 -------
 drivers/net/sunxi_emac.c         | 69 ----------------------------------------
 include/netdev.h                 |  1 -
 3 files changed, 82 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +0 -12
index cde13ef..f0d87a8 100644
@@ -12,10 +12,6 @@
 
 #include <common.h>
 #include <i2c.h>
-#ifndef CONFIG_DM_ETH
-#include <netdev.h>
-#endif
-#include <miiphy.h>
 #include <serial.h>
 #ifdef CONFIG_SPL_BUILD
 #include <spl.h>
@@ -226,14 +222,6 @@ int cpu_eth_init(bd_t *bis)
 	mdelay(200);
 #endif
 
-#if defined CONFIG_SUNXI_EMAC && !defined CONFIG_DM_ETH
-	rc = sunxi_emac_initialize(bis);
-	if (rc < 0) {
-		printf("sunxi: failed to initialize emac\n");
-		return rc;
-	}
-#endif
-
 #ifdef CONFIG_SUNXI_GMAC
 	rc = sunxi_gmac_initialize(bis);
 	if (rc < 0) {
drivers/net/sunxi_emac.c +0 -69

78 lines not on this page · raw message

include/netdev.h +0 -1
index e6bdfdf..662d173 100644
@@ -80,7 +80,6 @@ int sh_eth_initialize(bd_t *bis);
 int skge_initialize(bd_t *bis);
 int smc91111_initialize(u8 dev_num, int base_addr);
 int smc911x_initialize(u8 dev_num, int base_addr);
-int sunxi_emac_initialize(bd_t *bis);
 int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
 int uli526x_initialize(bd_t *bis);
Signature · 1 line
2.3.5
#63 lore raw

PATCH 21/21 sunxi: emac: Remove non device-model code

Quoted 9 lines · Hans de Goede

All sunxi boards now use the device-model, so remove the non device-model code.

---
 arch/arm/cpu/armv7/sunxi/board.c | 12 -------
 drivers/net/sunxi_emac.c         | 69 ----------------------------------------
 include/netdev.h                 |  1 -
 3 files changed, 82 deletions(-)
#65 lore raw

cover sunxi: Move ALL boards to the device-model

In reply to Hans de Goede

Hi Hans,

Quoted 8 lines · Hans de Goede

Hi Simon, Ian,

As promised here is my patch-set to move all sunxi boards to the device-model, it was slightly more work then I expected, and as such the patch-set is also somewhat larger then expected, but it is done :)

Please review, since this all only touches sunxi specific files the intention is to merge this through the sunxi tree as soon as all the patches are acked.

General comments:
Can you add to this cover letter *what* you are moving the driver model. I think it is GPIOs and Ethernet, is that right?
- s/device model/driver model/ (or driver-model which is often more correct)

Regards,
Simon

#66 lore raw

cover sunxi: Move ALL boards to the device-model

Hi Simon,

Thanks for the quick review.

Quoted 9 lines · Simon Glass

Hi Hans,

Quoted 6 lines · Hans de Goede

Hi Simon, Ian,

As promised here is my patch-set to move all sunxi boards to the device-model, it was slightly more work then I expected, and as such the patch-set is also somewhat larger then expected, but it is done :)

Quoted 6 lines
Quoted 2 lines

Please review, since this all only touches sunxi specific files the intention is to merge this through the sunxi tree as soon as all the patches are acked.

General comments:
Can you add to this cover letter *what* you are moving the driver model. I think it is GPIOs and Ethernet, is that right?

Right, this moves the bits which have been converted to the driver-model over to the driver model for all boards. Currently that is only gpio and ethernet AFAIK, and only for u-boot proper, not for the SPL.

Quoted 1 line

- s/device model/driver model/ (or driver-model which is often more correct)

Ah, oops, will fix in all the patches.

Regards,

Hans