
This series adds support for the Pinebook, an allwinner A64 laptop produced by Pine64. It also adds support for mmc delay calibration, and the anx6345 video bridge, used on the Pinebook.
Vasily Khoruzhick (5): mmc: sunxi: add support for automatic delay calibration dm: video: bridge: don't fail to activate bridge if sleep gpio is missing video: anx6345: don't fail if there's no sleep or reset GPIOs sun50i: a64: add support for R_I2C controller sunxi: add support for Pinebook
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-pinebook.dts | 99 ++++++++++++++++++++++++++++++ arch/arm/dts/sun50i-a64.dtsi | 17 +++++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/include/asm/arch-sunxi/mmc.h | 6 +- arch/arm/mach-sunxi/Kconfig | 2 + board/sunxi/board.c | 6 ++ configs/pinebook_defconfig | 32 ++++++++++ drivers/mmc/Kconfig | 4 ++ drivers/mmc/sunxi_mmc.c | 20 +++++- drivers/video/bridge/anx6345.c | 2 +- drivers/video/bridge/video-bridge-uclass.c | 4 +- 12 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts create mode 100644 configs/pinebook_defconfig

From: Vasily Khoruzhick anarsoul@gmail.com
A64 supports automatic delay calibration and Linux driver uses it instead of hardcoded delays. Add support for it to u-boot driver.
Fixes eMMC instability on Pinebook
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org ---
arch/arm/include/asm/arch-sunxi/mmc.h | 6 +++++- arch/arm/mach-sunxi/Kconfig | 1 + drivers/mmc/Kconfig | 4 ++++ drivers/mmc/sunxi_mmc.c | 20 +++++++++++++++++++- 4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h index d98c53faaa..f2deafddd2 100644 --- a/arch/arm/include/asm/arch-sunxi/mmc.h +++ b/arch/arm/include/asm/arch-sunxi/mmc.h @@ -46,7 +46,9 @@ struct sunxi_mmc { u32 cbda; /* 0x94 */ u32 res2[26]; #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6) - u32 res3[64]; + u32 res3[17]; + u32 samp_dl; + u32 res4[46]; #endif u32 fifo; /* 0x100 / 0x200 FIFO access address */ }; @@ -130,5 +132,7 @@ struct sunxi_mmc { #define SUNXI_MMC_COMMON_CLK_GATE (1 << 16) #define SUNXI_MMC_COMMON_RESET (1 << 18)
+#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7) + struct mmc *sunxi_mmc_init(int sdc_no); #endif /* _SUNXI_MMC_H */ diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 686f38fec4..ae77ee9e8e 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -271,6 +271,7 @@ config MACH_SUN50I bool "sun50i (Allwinner A64)" select ARM64 select DM_I2C + select MMC_SUNXI_SUPPORTS_CALIBRATION select PHY_SUN4I_USB select SUNXI_DE2 select SUNXI_GEN_SUN6I diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 0a0d4aaf6c..fb8f6697d4 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -569,6 +569,10 @@ config MMC_SUNXI_HAS_NEW_MODE bool depends on MMC_SUNXI
+config MMC_SUNXI_SUPPORTS_CALIBRATION + bool + depends on MMC_SUNXI + config GENERIC_ATMEL_MCI bool "Atmel Multimedia Card Interface support" depends on DM_MMC && BLK && ARCH_AT91 diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 39f15eb423..7b064b482c 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -99,11 +99,15 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) { unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly; bool new_mode = false; + bool calibrate = false; u32 val = 0;
if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2)) new_mode = true;
+ if (IS_ENABLED(CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION)) + calibrate = true; + /* * The MMC clock has an extra /2 post-divider when operating in the new * mode. @@ -174,7 +178,11 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) val = CCM_MMC_CTRL_MODE_SEL_NEW; setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW); #endif - } else { + } else if (!calibrate) { + /* + * Use hardcoded delay values if controller doesn't support + * calibration + */ val = CCM_MMC_CTRL_OCLK_DLY(oclk_dly) | CCM_MMC_CTRL_SCLK_DLY(sclk_dly); } @@ -228,6 +236,16 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, struct mmc *mmc) rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK; writel(rval, &priv->reg->clkcr);
+#ifdef CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION + /* A64 supports calibration of delays on MMC controller and we + * have to set delay of zero before starting calibration. + * Allwinner BSP driver sets a delay only in the case of + * using HS400 which is not supported by mainline U-Boot or + * Linux at the moment + */ + writel(SUNXI_MMC_CAL_DL_SW_EN, &priv->reg->samp_dl); +#endif + /* Re-enable Clock */ rval |= SUNXI_MMC_CLK_ENABLE; writel(rval, &priv->reg->clkcr);

On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
A64 supports automatic delay calibration and Linux driver uses it instead of hardcoded delays. Add support for it to u-boot driver.
So technically that should be derived from the node's compatible string, like we do in Linux. But I see that we are not there yet in U-Boot. Meanwhile I don't think you should introduce a new Kconfig option, you could keep the hacky U-Boot style and just add an #if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6) to the two places instead. A better way would be to introduce a "can_calibrate" member to struct sunxi_mmc_priv, then set this once in sunxi_mmc_init(), guarded by the two MACH symbols as above. This would allow an easy transition to being DT driven later and would prevent us from forgetting about this.
Cheers, Andre.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org
arch/arm/include/asm/arch-sunxi/mmc.h | 6 +++++- arch/arm/mach-sunxi/Kconfig | 1 + drivers/mmc/Kconfig | 4 ++++ drivers/mmc/sunxi_mmc.c | 20 +++++++++++++++++++- 4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h index d98c53faaa..f2deafddd2 100644 --- a/arch/arm/include/asm/arch-sunxi/mmc.h +++ b/arch/arm/include/asm/arch-sunxi/mmc.h @@ -46,7 +46,9 @@ struct sunxi_mmc { u32 cbda; /* 0x94 */ u32 res2[26]; #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
- u32 res3[64];
- u32 res3[17];
- u32 samp_dl;
- u32 res4[46];
#endif u32 fifo; /* 0x100 / 0x200 FIFO access address */ }; @@ -130,5 +132,7 @@ struct sunxi_mmc { #define SUNXI_MMC_COMMON_CLK_GATE (1 << 16) #define SUNXI_MMC_COMMON_RESET (1 << 18)
+#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7)
struct mmc *sunxi_mmc_init(int sdc_no); #endif /* _SUNXI_MMC_H */ diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 686f38fec4..ae77ee9e8e 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -271,6 +271,7 @@ config MACH_SUN50I bool "sun50i (Allwinner A64)" select ARM64 select DM_I2C
- select MMC_SUNXI_SUPPORTS_CALIBRATION select PHY_SUN4I_USB select SUNXI_DE2 select SUNXI_GEN_SUN6I
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 0a0d4aaf6c..fb8f6697d4 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -569,6 +569,10 @@ config MMC_SUNXI_HAS_NEW_MODE bool depends on MMC_SUNXI
+config MMC_SUNXI_SUPPORTS_CALIBRATION
- bool
- depends on MMC_SUNXI
config GENERIC_ATMEL_MCI bool "Atmel Multimedia Card Interface support" depends on DM_MMC && BLK && ARCH_AT91 diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 39f15eb423..7b064b482c 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -99,11 +99,15 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) { unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly; bool new_mode = false;
bool calibrate = false; u32 val = 0;
if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2)) new_mode = true;
if (IS_ENABLED(CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION))
calibrate = true;
/*
- The MMC clock has an extra /2 post-divider when operating in the new
- mode.
@@ -174,7 +178,11 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) val = CCM_MMC_CTRL_MODE_SEL_NEW; setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW); #endif
- } else {
- } else if (!calibrate) {
/*
* Use hardcoded delay values if controller doesn't support
* calibration
val = CCM_MMC_CTRL_OCLK_DLY(oclk_dly) | CCM_MMC_CTRL_SCLK_DLY(sclk_dly); }*/
@@ -228,6 +236,16 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, struct mmc *mmc) rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK; writel(rval, &priv->reg->clkcr);
+#ifdef CONFIG_MMC_SUNXI_SUPPORTS_CALIBRATION
- /* A64 supports calibration of delays on MMC controller and we
* have to set delay of zero before starting calibration.
* Allwinner BSP driver sets a delay only in the case of
* using HS400 which is not supported by mainline U-Boot or
* Linux at the moment
*/
- writel(SUNXI_MMC_CAL_DL_SW_EN, &priv->reg->samp_dl);
+#endif
- /* Re-enable Clock */ rval |= SUNXI_MMC_CLK_ENABLE; writel(rval, &priv->reg->clkcr);

On Sun, Sep 30, 2018 at 04:16:36PM +0100, André Przywara wrote:
On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
A64 supports automatic delay calibration and Linux driver uses it instead of hardcoded delays. Add support for it to u-boot driver.
So technically that should be derived from the node's compatible string, like we do in Linux. But I see that we are not there yet in U-Boot. Meanwhile I don't think you should introduce a new Kconfig option, you could keep the hacky U-Boot style and just add an #if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6) to the two places instead.
IIRC, the calibration is only needed for the eMMC though, so we'd need to check that against the MMC number too.
Maxime

On Mon, 1 Oct 2018 10:09:55 +0200 Maxime Ripard maxime.ripard@bootlin.com wrote:
On Sun, Sep 30, 2018 at 04:16:36PM +0100, André Przywara wrote:
On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
A64 supports automatic delay calibration and Linux driver uses it instead of hardcoded delays. Add support for it to u-boot driver.
So technically that should be derived from the node's compatible string, like we do in Linux. But I see that we are not there yet in U-Boot. Meanwhile I don't think you should introduce a new Kconfig option, you could keep the hacky U-Boot style and just add an #if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6) to the two places instead.
IIRC, the calibration is only needed for the eMMC though, so we'd need to check that against the MMC number too.
Is that so? I was looking at the Linux driver, and that one sets can_calibrate for both the "normal" and eMMC A64 compatible strings. Isn't the difference between the two the new timing mode, which the eMMC doesn't have? This looks to be covered in U-Boot, though in a similar hacky way.
Cheers, Andre.

On Mon, Oct 01, 2018 at 09:48:37AM +0100, Andre Przywara wrote:
On Mon, 1 Oct 2018 10:09:55 +0200 Maxime Ripard maxime.ripard@bootlin.com wrote:
On Sun, Sep 30, 2018 at 04:16:36PM +0100, André Przywara wrote:
On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
A64 supports automatic delay calibration and Linux driver uses it instead of hardcoded delays. Add support for it to u-boot driver.
So technically that should be derived from the node's compatible string, like we do in Linux. But I see that we are not there yet in U-Boot. Meanwhile I don't think you should introduce a new Kconfig option, you could keep the hacky U-Boot style and just add an #if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6) to the two places instead.
IIRC, the calibration is only needed for the eMMC though, so we'd need to check that against the MMC number too.
Is that so? I was looking at the Linux driver, and that one sets can_calibrate for both the "normal" and eMMC A64 compatible strings. Isn't the difference between the two the new timing mode, which the eMMC doesn't have? This looks to be covered in U-Boot, though in a similar hacky way.
You're right, sorry for the noise...
Maxime

From: Vasily Khoruzhick anarsoul@gmail.com
Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio. We shouldn't fail early in case of missing sleep gpio, otherwise we won't deassert reset.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org ---
drivers/video/bridge/video-bridge-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index cd4959cc71..46936a0626 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool active)
debug("%s: %d\n", __func__, active); ret = dm_gpio_set_value(&uc_priv->sleep, !active); - if (ret) + if (ret != -ENOENT) return ret; if (active) { ret = dm_gpio_set_value(&uc_priv->reset, true); @@ -120,7 +120,7 @@ int video_bridge_set_active(struct udevice *dev, bool active) ret = dm_gpio_set_value(&uc_priv->reset, false); }
- return ret; + return 0; }
UCLASS_DRIVER(video_bridge) = {

Hi Vagrant,
On Sat, Sep 29, 2018 at 4:46 PM Vagrant Cascadian vagrant@debian.org wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio. We shouldn't fail early in case of missing sleep gpio, otherwise we won't deassert reset.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org
drivers/video/bridge/video-bridge-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index cd4959cc71..46936a0626 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool active)
debug("%s: %d\n", __func__, active); ret = dm_gpio_set_value(&uc_priv->sleep, !active);
if (ret)
if (ret != -ENOENT)
It should be 'if (ret && ret != -ENOENT)'. Btw, I fixed it in pinebook-wip-20180909 branch.
return ret; if (active) { ret = dm_gpio_set_value(&uc_priv->reset, true);
@@ -120,7 +120,7 @@ int video_bridge_set_active(struct udevice *dev, bool active) ret = dm_gpio_set_value(&uc_priv->reset, false); }
return ret;
return 0;
}
UCLASS_DRIVER(video_bridge) = {
2.11.0

On 2018-09-29, Vasily Khoruzhick anarsoul@gmail.com wrote:
On Sat, Sep 29, 2018 at 4:46 PM Vagrant Cascadian vagrant@debian.org wrote:
Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio. We shouldn't fail early in case of missing sleep gpio, otherwise we won't deassert reset.
...
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index cd4959cc71..46936a0626 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool active)
debug("%s: %d\n", __func__, active); ret = dm_gpio_set_value(&uc_priv->sleep, !active);
if (ret)
if (ret != -ENOENT)
It should be 'if (ret && ret != -ENOENT)'. Btw, I fixed it in pinebook-wip-20180909 branch.
That's where I pulled the patch from; it's present in the patch to anx6345.c, but apparently unpatched in this patch against video-bridge-uclass.c.
I'll submit the fixed version in a new patch series after collecting more comments...
Thanks for all your work on it!
live well, vagrant

On Sun, Sep 30, 2018 at 10:48 AM Vagrant Cascadian vagrant@debian.org wrote:
On 2018-09-29, Vasily Khoruzhick anarsoul@gmail.com wrote:
On Sat, Sep 29, 2018 at 4:46 PM Vagrant Cascadian vagrant@debian.org wrote:
Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio. We shouldn't fail early in case of missing sleep gpio, otherwise we won't deassert reset.
...
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index cd4959cc71..46936a0626 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool active)
debug("%s: %d\n", __func__, active); ret = dm_gpio_set_value(&uc_priv->sleep, !active);
if (ret)
if (ret != -ENOENT)
It should be 'if (ret && ret != -ENOENT)'. Btw, I fixed it in pinebook-wip-20180909 branch.
That's where I pulled the patch from; it's present in the patch to anx6345.c, but apparently unpatched in this patch against video-bridge-uclass.c.
You're right, I fixed it but forgot to push it. Sorry for the noise.
I'll submit the fixed version in a new patch series after collecting more comments...
Thanks for all your work on it!
Thanks a lot for submitting it!
live well, vagrant

On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
Sleep gpio is optional, so it's possible to have reset gpio, but no sleep gpio. We shouldn't fail early in case of missing sleep gpio, otherwise we won't deassert reset.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org
drivers/video/bridge/video-bridge-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c index cd4959cc71..46936a0626 100644 --- a/drivers/video/bridge/video-bridge-uclass.c +++ b/drivers/video/bridge/video-bridge-uclass.c @@ -110,7 +110,7 @@ int video_bridge_set_active(struct udevice *dev, bool active)
debug("%s: %d\n", __func__, active); ret = dm_gpio_set_value(&uc_priv->sleep, !active);
So if I get this correctly, uc_priv->sleep.dev would be NULL if there was no GPIO specified? So wouldn't it be cleaner to say: if (uc_priv->sleep.dev) { ret = dm_gpio_set_value(&uc_priv->sleep, !active); ...
- if (ret)
- if (ret != -ENOENT) return ret; if (active) { ret = dm_gpio_set_value(&uc_priv->reset, true);
@@ -120,7 +120,7 @@ int video_bridge_set_active(struct udevice *dev, bool active) ret = dm_gpio_set_value(&uc_priv->reset, false); }
- return ret;
- return 0;
This would loose the return value from the last statement in the if clause. So what about negating this clause: if (!active) return 0; and change the rest accordingly?
Cheers, Andre.
}
UCLASS_DRIVER(video_bridge) = {

From: Vasily Khoruzhick anarsoul@gmail.com
If there's no sleep or reset GPIOs, video_bridge_set_active() returns -ENOENT. Don't fail in this case, since these GPIOs are optional.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org ---
drivers/video/bridge/anx6345.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c index 3e3f0e2ce6..28cf2a9c2d 100644 --- a/drivers/video/bridge/anx6345.c +++ b/drivers/video/bridge/anx6345.c @@ -274,7 +274,7 @@ static int anx6345_enable(struct udevice *dev)
/* Deassert reset and enable power */ ret = video_bridge_set_active(dev, true); - if (ret) + if (ret && ret != -ENOENT) return ret;
/* Reset */

On 9/30/18 12:45 AM, Vagrant Cascadian wrote:
(CC:ing Anatolij)
From: Vasily Khoruzhick anarsoul@gmail.com
If there's no sleep or reset GPIOs, video_bridge_set_active() returns -ENOENT. Don't fail in this case, since these GPIOs are optional.
Are really *both* optional? If yes, you should apply the same check I suggested in the last patch there as well, to also cover reset. Something like:
int video_bridge_set_active(struct udevice *dev, bool active) { int ret = 0;
/* The sleep GPIO is optional. */ if (uc_priv->sleep.dev) { ret = dm_gpio_set_value(&uc_priv->sleep, !active); if (ret) return ret; } if (uc_priv->reset.dev && active) { ret = dm_gpio_set_value(&uc_priv->reset, true); ... }
return ret; }
This avoids any attempts of cleverly ignoring errors, also allows you to get rid of this patch at all. Plus it's a more suitable approach for this generic driver file.
Cheers, Andre.
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org
drivers/video/bridge/anx6345.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c index 3e3f0e2ce6..28cf2a9c2d 100644 --- a/drivers/video/bridge/anx6345.c +++ b/drivers/video/bridge/anx6345.c @@ -274,7 +274,7 @@ static int anx6345_enable(struct udevice *dev)
/* Deassert reset and enable power */ ret = video_bridge_set_active(dev, true);
- if (ret)
if (ret && ret != -ENOENT) return ret;
/* Reset */

From: Vasily Khoruzhick anarsoul@gmail.com
Allwinner A64 has a I2C controller, which is in the R_ MMIO zone and has two groups of pinmuxes on PL bank, so it's called R_I2C.
Add support for this I2C controller and the pinmux which doesn't conflict with RSB
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org ---
arch/arm/dts/sun50i-a64.dtsi | 17 +++++++++++++++++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/mach-sunxi/Kconfig | 1 + board/sunxi/board.c | 6 ++++++ 4 files changed, 25 insertions(+)
diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi index 7a083637c4..80ddcf0af3 100644 --- a/arch/arm/dts/sun50i-a64.dtsi +++ b/arch/arm/dts/sun50i-a64.dtsi @@ -627,6 +627,18 @@ }; };
+ r_i2c: i2c@1f02400 { + compatible = "allwinner,sun50i-a64-i2c", + "allwinner,sun6i-a31-i2c"; + reg = <0x01f02400 0x400>; + interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&r_ccu 9>; + resets = <&r_ccu 5>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + gic: interrupt-controller@1c81000 { compatible = "arm,gic-400"; reg = <0x01c81000 0x1000>, @@ -679,6 +691,11 @@ pins = "PL0", "PL1"; function = "s_rsb"; }; + + r_i2c_pins_a: i2c-a { + pins = "PL8", "PL9"; + function = "s_i2c"; + }; };
r_rsb: rsb@1f03400 { diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h index 6a5eafc3d3..2daf23f6f5 100644 --- a/arch/arm/include/asm/arch-sunxi/gpio.h +++ b/arch/arm/include/asm/arch-sunxi/gpio.h @@ -211,6 +211,7 @@ enum sunxi_gpio_number { #define SUN8I_H3_GPL_R_TWI 2 #define SUN8I_A23_GPL_R_TWI 3 #define SUN8I_GPL_R_UART 2 +#define SUN50I_GPL_R_TWI 2
#define SUN9I_GPN_R_RSB 3
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index ae77ee9e8e..fccef9d706 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -273,6 +273,7 @@ config MACH_SUN50I select DM_I2C select MMC_SUNXI_SUPPORTS_CALIBRATION select PHY_SUN4I_USB + select SUN6I_PRCM select SUNXI_DE2 select SUNXI_GEN_SUN6I select SUPPORT_SPL diff --git a/board/sunxi/board.c b/board/sunxi/board.c index d1d7f9f400..90f8bc0a6e 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -168,10 +168,16 @@ void i2c_init_board(void) #endif
#ifdef CONFIG_R_I2C_ENABLE +#ifdef CONFIG_MACH_SUN50I + clock_twi_onoff(5, 1); + sunxi_gpio_set_cfgpin(SUNXI_GPL(8), SUN50I_GPL_R_TWI); + sunxi_gpio_set_cfgpin(SUNXI_GPL(9), SUN50I_GPL_R_TWI); +#else clock_twi_onoff(5, 1); sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI); sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI); #endif +#endif }
#if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)

Hi,
On Sat, Sep 29, 2018 at 04:45:52PM -0700, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
Allwinner A64 has a I2C controller, which is in the R_ MMIO zone and has two groups of pinmuxes on PL bank, so it's called R_I2C.
Add support for this I2C controller and the pinmux which doesn't conflict with RSB
Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com Signed-off-by: Vagrant Cascadian vagrant@debian.org
arch/arm/dts/sun50i-a64.dtsi | 17 +++++++++++++++++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/mach-sunxi/Kconfig | 1 + board/sunxi/board.c | 6 ++++++ 4 files changed, 25 insertions(+)
diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi index 7a083637c4..80ddcf0af3 100644 --- a/arch/arm/dts/sun50i-a64.dtsi +++ b/arch/arm/dts/sun50i-a64.dtsi @@ -627,6 +627,18 @@ }; };
r_i2c: i2c@1f02400 {
compatible = "allwinner,sun50i-a64-i2c",
"allwinner,sun6i-a31-i2c";
reg = <0x01f02400 0x400>;
interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&r_ccu 9>;
resets = <&r_ccu 5>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
- gic: interrupt-controller@1c81000 { compatible = "arm,gic-400"; reg = <0x01c81000 0x1000>,
@@ -679,6 +691,11 @@ pins = "PL0", "PL1"; function = "s_rsb"; };
r_i2c_pins_a: i2c-a {
pins = "PL8", "PL9";
function = "s_i2c";
};
These changes are in the Linux DT, so we'd be better off syncing that DT, instead of adding just those two nodes.
Thanks! Maxime

From: Vasily Khoruzhick anarsoul@gmail.com
Pinebook is a laptop produced by Pine64, with USB-connected keyboard, USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP bridge from Analogix.
Signed-off-by: Icenowy Zheng icenowy@aosc.xyz Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com
Signed-off-by: Vagrant Cascadian vagrant@debian.org ---
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-pinebook.dts | 99 ++++++++++++++++++++++++++++++++++++ configs/pinebook_defconfig | 32 ++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts create mode 100644 configs/pinebook_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 44ebc50bfa..1bb5d0d47e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -403,7 +403,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-orangepi-win.dtb \ sun50i-a64-pine64-plus.dtb \ sun50i-a64-pine64.dtb \ - sun50i-a64-sopine-baseboard.dtb + sun50i-a64-sopine-baseboard.dtb \ + sun50i-a64-pinebook.dtb dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb \ diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts b/arch/arm/dts/sun50i-a64-pinebook.dts new file mode 100644 index 0000000000..48bee4cc7f --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinebook.dts @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2016 ARM Ltd. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; + +#include <dt-bindings/pwm/pwm.h> +#include "sun50i-a64-pine64.dts" + +/ { + model = "Pinebook"; + compatible = "pine64,pinebook", "allwinner,sun50i-a64"; + + aliases { + serial0 = &uart0; + i2c0 = "/i2c@1f02400"; + }; + + vdd_bl: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "bl-3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */ + enable-active-high; + }; + + + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 50000 0>; + brightness-levels = <0 10 20 30 40 50 60 70 100>; + default-brightness-level = <3>; + enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */ + power-supply = <&vdd_bl>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory { + reg = <0x40000000 0x40000000>; + }; +}; + +&pwm { + status = "okay"; +}; + +&r_i2c { + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins_a>; + status = "okay"; + anx6345: edp-bridge@38 { + compatible = "analogix,anx6345"; + reg = <0x38>; + reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */ + status = "okay"; + }; +}; diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig new file mode 100644 index 0000000000..15d0f50c41 --- /dev/null +++ b/configs/pinebook_defconfig @@ -0,0 +1,32 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_MACH_SUN50I=y +CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y +CONFIG_DRAM_CLK=552 +CONFIG_DRAM_ZQ=3881949 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_R_I2C_ENABLE=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set +CONFIG_CMD_POWEROFF=y +# CONFIG_CMD_FLASH is not set +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook" +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_DM_I2C_GPIO=y +# CONFIG_MMC_VERBOSE is not set +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_PWM=y +CONFIG_PWM_SUNXI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y +# CONFIG_USB_GADGET is not set +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y +CONFIG_VIDEO_BRIDGE=y +CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345=y

On Sat, Sep 29, 2018 at 04:45:53PM -0700, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
Pinebook is a laptop produced by Pine64, with USB-connected keyboard, USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP bridge from Analogix.
Signed-off-by: Icenowy Zheng icenowy@aosc.xyz Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com
Signed-off-by: Vagrant Cascadian vagrant@debian.org
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-pinebook.dts | 99 ++++++++++++++++++++++++++++++++++++ configs/pinebook_defconfig | 32 ++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts create mode 100644 configs/pinebook_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 44ebc50bfa..1bb5d0d47e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -403,7 +403,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-orangepi-win.dtb \ sun50i-a64-pine64-plus.dtb \ sun50i-a64-pine64.dtb \
- sun50i-a64-sopine-baseboard.dtb
- sun50i-a64-sopine-baseboard.dtb \
- sun50i-a64-pinebook.dtb
You should keep them sorted alphabetically.
dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb \ diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts b/arch/arm/dts/sun50i-a64-pinebook.dts new file mode 100644 index 0000000000..48bee4cc7f --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinebook.dts @@ -0,0 +1,99 @@ +/*
- Copyright (c) 2016 ARM Ltd.
- This file is dual-licensed: you can use it either under the terms
- of the GPL or the X11 license, at your option. Note that this dual
- licensing only applies to this file, and not this project as a
- whole.
- a) This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- Or, alternatively,
- b) Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
- */
+/dts-v1/;
+#include <dt-bindings/pwm/pwm.h> +#include "sun50i-a64-pine64.dts"
+/ {
- model = "Pinebook";
- compatible = "pine64,pinebook", "allwinner,sun50i-a64";
- aliases {
serial0 = &uart0;
i2c0 = "/i2c@1f02400";
- };
- vdd_bl: regulator@0 {
compatible = "regulator-fixed";
regulator-name = "bl-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
enable-active-high;
- };
- backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 50000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 100>;
default-brightness-level = <3>;
enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
power-supply = <&vdd_bl>;
- };
- chosen {
stdout-path = "serial0:115200n8";
- };
- memory {
reg = <0x40000000 0x40000000>;
- };
+};
+&pwm {
- status = "okay";
+};
+&r_i2c {
- pinctrl-names = "default";
- pinctrl-0 = <&r_i2c_pins_a>;
- status = "okay";
- anx6345: edp-bridge@38 {
compatible = "analogix,anx6345";
reg = <0x38>;
reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
status = "okay";
- };
+};
I'm not sure why that DT is that different from the one we have in Linux. Ideally, they should be identical.
diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig new file mode 100644 index 0000000000..15d0f50c41 --- /dev/null +++ b/configs/pinebook_defconfig @@ -0,0 +1,32 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_MACH_SUN50I=y +CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y +CONFIG_DRAM_CLK=552 +CONFIG_DRAM_ZQ=3881949 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_R_I2C_ENABLE=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set +CONFIG_CMD_POWEROFF=y
So the way we deal with defconfigs usually is that we don't really enable a command solely for one defconfig. Either we enable it for all the boards, or none.
+# CONFIG_CMD_FLASH is not set +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook" +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_DM_I2C_GPIO=y
Why are you using a bitbanged i2c bus? As far as I know, this is not enabled anywhere.
+# CONFIG_MMC_VERBOSE is not set
This should go away
+CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_PWM=y +CONFIG_PWM_SUNXI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y +# CONFIG_USB_GADGET is not set +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y
Those last three too.
Thanks! Maxime

于 2018年10月1日 GMT+08:00 下午4:17:24, Maxime Ripard maxime.ripard@bootlin.com 写到:
On Sat, Sep 29, 2018 at 04:45:53PM -0700, Vagrant Cascadian wrote:
From: Vasily Khoruzhick anarsoul@gmail.com
Pinebook is a laptop produced by Pine64, with USB-connected keyboard, USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP bridge from Analogix.
Signed-off-by: Icenowy Zheng icenowy@aosc.xyz Signed-off-by: Vasily Khoruzhick anarsoul@gmail.com
Signed-off-by: Vagrant Cascadian vagrant@debian.org
arch/arm/dts/Makefile | 3 +- arch/arm/dts/sun50i-a64-pinebook.dts | 99
++++++++++++++++++++++++++++++++++++
configs/pinebook_defconfig | 32 ++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts create mode 100644 configs/pinebook_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 44ebc50bfa..1bb5d0d47e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -403,7 +403,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-orangepi-win.dtb \ sun50i-a64-pine64-plus.dtb \ sun50i-a64-pine64.dtb \
- sun50i-a64-sopine-baseboard.dtb
- sun50i-a64-sopine-baseboard.dtb \
- sun50i-a64-pinebook.dtb
You should keep them sorted alphabetically.
dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb \ diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts
b/arch/arm/dts/sun50i-a64-pinebook.dts
new file mode 100644 index 0000000000..48bee4cc7f --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinebook.dts @@ -0,0 +1,99 @@ +/*
- Copyright (c) 2016 ARM Ltd.
- This file is dual-licensed: you can use it either under the terms
- of the GPL or the X11 license, at your option. Note that this
dual
- licensing only applies to this file, and not this project as a
- whole.
- a) This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as
published by the Free Software Foundation; either version 2
of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be
useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- Or, alternatively,
- b) Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom
the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall
be
included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
- */
+/dts-v1/;
+#include <dt-bindings/pwm/pwm.h> +#include "sun50i-a64-pine64.dts"
+/ {
- model = "Pinebook";
- compatible = "pine64,pinebook", "allwinner,sun50i-a64";
- aliases {
serial0 = &uart0;
i2c0 = "/i2c@1f02400";
- };
- vdd_bl: regulator@0 {
compatible = "regulator-fixed";
regulator-name = "bl-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
enable-active-high;
- };
- backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 50000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 100>;
default-brightness-level = <3>;
enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
power-supply = <&vdd_bl>;
- };
- chosen {
stdout-path = "serial0:115200n8";
- };
- memory {
reg = <0x40000000 0x40000000>;
- };
+};
+&pwm {
- status = "okay";
+};
+&r_i2c {
- pinctrl-names = "default";
- pinctrl-0 = <&r_i2c_pins_a>;
- status = "okay";
- anx6345: edp-bridge@38 {
compatible = "analogix,anx6345";
reg = <0x38>;
reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
status = "okay";
- };
+};
I'm not sure why that DT is that different from the one we have in Linux. Ideally, they should be identical.
Linux one has no ANX6345 yet, so they're not identical.
diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig new file mode 100644 index 0000000000..15d0f50c41 --- /dev/null +++ b/configs/pinebook_defconfig @@ -0,0 +1,32 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_MACH_SUN50I=y +CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y +CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y +CONFIG_DRAM_CLK=552 +CONFIG_DRAM_ZQ=3881949 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 +CONFIG_R_I2C_ENABLE=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set +CONFIG_CMD_POWEROFF=y
So the way we deal with defconfigs usually is that we don't really enable a command solely for one defconfig. Either we enable it for all the boards, or none.
+# CONFIG_CMD_FLASH is not set +# CONFIG_SPL_DOS_PARTITION is not set +# CONFIG_SPL_EFI_PARTITION is not set +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook" +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_DM_I2C_GPIO=y
Why are you using a bitbanged i2c bus? As far as I know, this is not enabled anywhere.
+# CONFIG_MMC_VERBOSE is not set
This should go away
+CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_PWM=y +CONFIG_PWM_SUNXI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y +# CONFIG_USB_GADGET is not set +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y
Those last three too.
Thanks! Maxime

On Mon, Oct 01, 2018 at 05:37:58PM +0800, Icenowy Zheng wrote:
dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb \ diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts
b/arch/arm/dts/sun50i-a64-pinebook.dts
new file mode 100644 index 0000000000..48bee4cc7f --- /dev/null +++ b/arch/arm/dts/sun50i-a64-pinebook.dts @@ -0,0 +1,99 @@ +/*
- Copyright (c) 2016 ARM Ltd.
- This file is dual-licensed: you can use it either under the terms
- of the GPL or the X11 license, at your option. Note that this
dual
- licensing only applies to this file, and not this project as a
- whole.
- a) This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as
published by the Free Software Foundation; either version 2
of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be
useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- Or, alternatively,
- b) Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom
the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall
be
included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
- */
+/dts-v1/;
+#include <dt-bindings/pwm/pwm.h> +#include "sun50i-a64-pine64.dts"
+/ {
- model = "Pinebook";
- compatible = "pine64,pinebook", "allwinner,sun50i-a64";
- aliases {
serial0 = &uart0;
i2c0 = "/i2c@1f02400";
- };
- vdd_bl: regulator@0 {
compatible = "regulator-fixed";
regulator-name = "bl-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
enable-active-high;
- };
- backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 50000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 100>;
default-brightness-level = <3>;
enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
power-supply = <&vdd_bl>;
- };
- chosen {
stdout-path = "serial0:115200n8";
- };
- memory {
reg = <0x40000000 0x40000000>;
- };
+};
+&pwm {
- status = "okay";
+};
+&r_i2c {
- pinctrl-names = "default";
- pinctrl-0 = <&r_i2c_pins_a>;
- status = "okay";
- anx6345: edp-bridge@38 {
compatible = "analogix,anx6345";
reg = <0x38>;
reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
status = "okay";
- };
+};
I'm not sure why that DT is that different from the one we have in Linux. Ideally, they should be identical.
Linux one has no ANX6345 yet, so they're not identical.
Right, but it's far from being the only difference.
Maxime
participants (6)
-
Andre Przywara
-
André Przywara
-
Icenowy Zheng
-
Maxime Ripard
-
Vagrant Cascadian
-
Vasily Khoruzhick