[U-Boot] [PATCH v2 02/10] usb: Generic USB Kconfig option, that fits both host and gadget and comments

2015-08-04 Thread Hans de Goede
From: Paul Kocialkowski cont...@paulk.fr

There is no particular reason why the USB Kconfig option should be specific to
host mode. In prevision of adding MUSB host and gadget to Kconfig, this moves
the title and help message of the USB Kconfig option to a more generic format.

Adding comments to the usb Kconfig allows for a better separation and more
readability in generated configs and in menuconfig.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
 drivers/usb/Kconfig | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fed510b..adce3f6 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -1,7 +1,5 @@
-menu USB
-
-config USB
-   bool Support for Host-side USB
+menuconfig USB
+   bool USB support
---help---
  Universal Serial Bus (USB) is a specification for a serial bus
  subsystem which offers higher speeds and more features than the
@@ -15,8 +13,10 @@ config USB
  such as scanners, keyboards, mice, modems, cameras, disks,
  flash memory, network links, and printers to the PC.
 
- Say Y here if your computer has a host-side USB port and you want
- to use USB devices.  You then need to say Y to at least one of the
+ Say Y here if your device has an USB port, either host, peripheral or
+ dual-role.
+
+ For an USB host port, you then need to say Y to at least one of the
  Host Controller Driver (HCD) options below.  Choose a USB 1.1
  controller, such as UHCI HCD support or OHCI HCD support,
  and EHCI HCD (USB 2.0) support except for older systems that
@@ -51,6 +51,8 @@ source drivers/usb/host/Kconfig
 
 source drivers/usb/emul/Kconfig
 
+comment USB peripherals
+
 config USB_STORAGE
bool USB Mass Storage support
---help---
@@ -85,4 +87,3 @@ endchoice
 endif
 
 endif
-endmenu
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/10] musb: sunxi: Force EP0 on re-enable

2015-08-04 Thread Hans de Goede
From: Maxime Ripard maxime.rip...@free-electrons.com

Currently, the second use of a gadget will fail, while the first one works.

Forcing the EP0 at every enable fix this issue.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com
---
 drivers/usb/musb-new/sunxi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 85ac28d..16a264a 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -200,6 +200,9 @@ static int sunxi_musb_enable(struct musb *musb)
 
pr_debug(%s():\n, __func__);
 
+   musb_ep_select(musb-mregs, 0);
+   musb_writeb(musb-mregs, MUSB_FADDR, 0);
+
if (enabled)
return 0;
 
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 08/10] sunxi: MUSB gadget config provisions, with fastboot and USB mass storage support

2015-08-04 Thread Hans de Goede
From: Paul Kocialkowski cont...@paulk.fr

This adds some config options to the sunxi-common config to enable the USB
download gadget and the fastboot and USB mass storage functions.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
 include/configs/sunxi-common.h | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 7ed208c..edcacd5 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -329,6 +329,36 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_USB_MUSB_PIO_ONLY
 #endif
 
+#ifdef CONFIG_USB_MUSB_GADGET
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW0
+
+#define CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_USB_FUNCTION_FASTBOOT
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#endif
+
+#ifdef CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_G_DNL_VENDOR_NUM0x1f3a
+#define CONFIG_G_DNL_PRODUCT_NUM   0x1010
+#define CONFIG_G_DNL_MANUFACTURER  Allwinner Technology
+#endif
+
+#ifdef CONFIG_USB_FUNCTION_FASTBOOT
+#define CONFIG_CMD_FASTBOOT
+#define CONFIG_FASTBOOT_BUF_ADDR   CONFIG_SYS_LOAD_ADDR
+#define CONFIG_FASTBOOT_BUF_SIZE   0x200
+
+#define CONFIG_FASTBOOT_FLASH
+#define CONFIG_FASTBOOT_FLASH_MMC_DEV  0
+#define CONFIG_EFI_PARTITION
+#endif
+
+#ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_CMD_USB_MASS_STORAGE
+#endif
+
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_PREBOOT
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/10] usb: musb-new: CONFIG_MUSB prefix replacement with CONFIG_USB_MUSB

2015-08-04 Thread Hans de Goede
From: Paul Kocialkowski cont...@paulk.fr

USB-related options are usually prefixed with CONFIG_USB and platform-specific
adaptation for the MUSB controller already have a CONFIG_USB_MUSB prefix, so
this switches all MUSB-related options to a CONFIG_USB_MUSB prefix, for
consistency.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
 arch/arm/cpu/armv7/am33xx/board.c |  2 +-
 arch/arm/include/asm/arch-sunxi/usb_phy.h |  2 +-
 board/birdland/bav335x/board.c|  2 +-
 board/compulab/cm_t3517/cm_t3517.c|  6 +++---
 board/logicpd/am3517evm/am3517evm.c   |  8 
 board/phytec/pcm051/board.c   |  2 +-
 board/siemens/draco/board.c   |  2 +-
 board/siemens/pxm2/board.c|  2 +-
 board/siemens/rut/board.c |  2 +-
 board/ti/am335x/board.c   |  2 +-
 board/ti/beagle/beagle.c  |  8 
 board/vscom/baltos/board.c|  2 +-
 drivers/usb/gadget/gadget_chips.h |  2 +-
 drivers/usb/musb-new/Makefile |  6 +++---
 drivers/usb/musb-new/musb_core.c  | 12 ++--
 drivers/usb/musb-new/musb_core.h  |  4 ++--
 drivers/usb/musb-new/musb_dma.h   |  2 +-
 drivers/usb/musb-new/musb_gadget.c|  4 ++--
 drivers/usb/musb-new/musb_uboot.c | 12 ++--
 drivers/usb/musb-new/sunxi.c  |  6 +++---
 drivers/usb/musb/Makefile |  4 ++--
 drivers/usb/musb/musb_core.c  |  8 
 drivers/usb/musb/musb_hcd.c   |  6 +++---
 drivers/usb/musb/musb_hcd.h   |  4 ++--
 include/configs/am335x_evm.h  | 16 
 include/configs/am3517_crane.h| 14 +++---
 include/configs/am3517_evm.h  | 16 
 include/configs/baltos.h  | 16 
 include/configs/bav335x.h | 16 
 include/configs/bf526-ezbrd.h |  4 ++--
 include/configs/bf527-ezkit.h |  4 ++--
 include/configs/bf548-ezkit.h |  4 ++--
 include/configs/cam_enc_4xx.h |  2 +-
 include/configs/cm_t35.h  |  2 +-
 include/configs/cm_t3517.h|  4 ++--
 include/configs/da830evm.h| 10 +-
 include/configs/davinci_dm355evm.h|  4 ++--
 include/configs/davinci_dm365evm.h| 10 +-
 include/configs/davinci_dvevm.h   |  4 ++--
 include/configs/kwb.h | 10 +-
 include/configs/nokia_rx51.h  |  4 ++--
 include/configs/omap3_beagle.h|  4 ++--
 include/configs/omap3_evm.h   |  8 
 include/configs/omap3_evm_common.h|  8 
 include/configs/omap3_igep00x0.h  |  2 +-
 include/configs/omap3_mvblx.h |  2 +-
 include/configs/omap3_zoom1.h |  2 +-
 include/configs/pcm051.h  | 12 ++--
 include/configs/pengwyn.h | 12 ++--
 include/configs/siemens-am33x-common.h| 14 +++---
 include/configs/sunxi-common.h|  4 ++--
 include/configs/ti_omap4_common.h |  2 +-
 include/configs/tseries.h | 10 +-
 include/usb.h |  4 ++--
 54 files changed, 167 insertions(+), 167 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c 
b/arch/arm/cpu/armv7/am33xx/board.c
index 67bef23..377c611 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -124,7 +124,7 @@ int cpu_mmc_init(bd_t *bis)
 #endif
 
 /* AM33XX has two MUSB controllers which can be host or gadget */
-#if (defined(CONFIG_MUSB_GADGET) || defined(CONFIG_MUSB_HOST))  \
+#if (defined(CONFIG_USB_MUSB_GADGET) || defined(CONFIG_USB_MUSB_HOST))  \
(defined(CONFIG_AM335X_USB0) || defined(CONFIG_AM335X_USB1))
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
diff --git a/arch/arm/include/asm/arch-sunxi/usb_phy.h 
b/arch/arm/include/asm/arch-sunxi/usb_phy.h
index 17d31b8..cef6c98 100644
--- a/arch/arm/include/asm/arch-sunxi/usb_phy.h
+++ b/arch/arm/include/asm/arch-sunxi/usb_phy.h
@@ -21,7 +21,7 @@ int sunxi_usb_phy_id_detect(int index);
 void sunxi_usb_phy_enable_squelch_detect(int index, int enable);
 
 /* Not really phy related, but we have to declare this somewhere ... */
-#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
+#if defined(CONFIG_USB_MUSB_HOST) || defined(CONFIG_USB_MUSB_GADGET)
 void sunxi_musb_board_init(void);
 #else
 #define sunxi_musb_board_init()
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index 32ff7a4..67aca3c 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -363,7 +363,7 @@ static struct cpsw_platform_data cpsw_data = {
 #if ((defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)) 
\
defined(CONFIG_SPL_BUILD)) || \

[U-Boot] [PATCH v2 0/10] usb: MUSB gadget config provisions

2015-08-04 Thread Hans de Goede
Hi Marek and Paul,

Here is a new version of Paul's MUSB gadget Kconfig changes based on the
latest master. I've dropped the dependency on the Kconfig-menu changes
since similar changes for drivers/usb/Kconfig have already landed in
master via the arm: mx6: cm-fx6 changes. Likewise I've dropped the 2
patches related to moving the USB_KEYBOARD Kconfig from board/sunxi/Kconfig
to drivers/usb/Kconfig, as the arm: mx6: cm-fx6 changes already add a
USB_KEYBOARD Kconfig option to drivers/usb/Kconfig. I've replaced this
2 with a patch of my own simply dropping the duplicate USB_KEYBOARD
option from board/sunxi/Kconfig.

Marek, this version sits direct on top of current master, so you
should be able to take it right away, then maybe we can get these changes in
before things change underneath us again (lots of Kconfig churn lately).

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 10/10] sunxi: Drop our own copy of the USB_KEYBOARD options

2015-08-04 Thread Hans de Goede
USB_KEYBOARD is now defined in drivers/usb/Kconfig, drop our own duplicate
definition.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/Kconfig| 1 +
 board/sunxi/Kconfig | 7 ---
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 32fa2dd..8b8269f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -653,6 +653,7 @@ config ARCH_SUNXI
select SPL_DISABLE_OF_CONTROL
select USB
select USB_STORAGE
+   select USB_KEYBOARD
 
 config TARGET_SNOWBALL
bool Support snowball
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index e1c5e1d..c4b5a85 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -539,13 +539,6 @@ config VIDEO_LCD_TL059WV5C0
 endchoice
 
 
-config USB_KEYBOARD
-   boolean Enable USB keyboard support
-   default y
-   ---help---
-   Say Y here to add support for using a USB keyboard (typically used
-   in combination with a graphical console).
-
 config GMAC_TX_DELAY
int GMAC Transmit Clock Delay Chain
default 0
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/10] usb: USB storage-specific part ifdef in uclass

2015-08-04 Thread Hans de Goede
From: Paul Kocialkowski cont...@paulk.fr

usb_stor_reset is only defined when USB storage support is enabled, thus the
function is not declared when such support is missing.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
 drivers/usb/host/usb-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index c5d1e7f..b17a7d7 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -173,7 +173,9 @@ int usb_stop(void)
uclass_foreach_dev(dev, uc)
usb_emul_reset(dev);
 #endif
+#ifdef CONFIG_USB_STORAGE
usb_stor_reset();
+#endif
usb_hub_reset();
uc_priv-companion_device_count = 0;
usb_started = 0;
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] sunxi: Enable musb in host mode on the Jesurun Q5

2015-08-04 Thread Hans de Goede
The Jesurun Q5 has the musb hooked up to an usb-a receptacle, enable it
in host-only mode.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 configs/jesurun_q5_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configs/jesurun_q5_defconfig b/configs/jesurun_q5_defconfig
index a2115b6..46c38e5 100644
--- a/configs/jesurun_q5_defconfig
+++ b/configs/jesurun_q5_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
 CONFIG_DRAM_CLK=312
+CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-jesurun-q5
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
@@ -10,3 +11,5 @@ 
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(19)
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB0_VBUS_PIN=PB9
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/5] sunxi: display: Replace #ifdef-ery with helper functions

2015-08-03 Thread Hans de Goede
All the #ifdef-ery in selecting the default and fallback monitor type is
becoming unyielding and makes the code hard to read, replace it with a few
helper functions.

This will also be useful with the upcoming CHIP board which has display
adapter daughterboards which should be runtime detectable.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/video/sunxi_display.c | 90 +++
 1 file changed, 56 insertions(+), 34 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 269083b..3942d2f 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -1101,6 +1101,43 @@ ulong board_get_usable_ram_top(ulong total_size)
return gd-ram_top - CONFIG_SUNXI_MAX_FB_SIZE;
 }
 
+static bool sunxi_has_hdmi(void)
+{
+#ifdef CONFIG_VIDEO_HDMI
+   return true;
+#else
+   return false;
+#endif
+}
+
+static bool sunxi_has_lcd(void)
+{
+   char *lcd_mode = CONFIG_VIDEO_LCD_MODE;
+
+   return lcd_mode[0] != 0;
+}
+
+static bool sunxi_has_vga(void)
+{
+#if defined CONFIG_VIDEO_VGA || defined CONFIG_VIDEO_VGA_VIA_LCD
+   return true;
+#else
+   return false;
+#endif
+}
+
+static enum sunxi_monitor sunxi_get_default_mon(bool allow_hdmi)
+{
+   if (allow_hdmi  sunxi_has_hdmi())
+   return sunxi_monitor_dvi;
+   else if (sunxi_has_lcd())
+   return sunxi_monitor_lcd;
+   else if (sunxi_has_vga())
+   return sunxi_monitor_vga;
+   else
+   return sunxi_monitor_none;
+}
+
 void *video_hw_init(void)
 {
static GraphicDevice *graphic_device = sunxi_display.graphic_device;
@@ -1122,12 +1159,8 @@ void *video_hw_init(void)
hpd = video_get_option_int(options, hpd, 1);
hpd_delay = video_get_option_int(options, hpd_delay, 500);
edid = video_get_option_int(options, edid, 1);
-   sunxi_display.monitor = sunxi_monitor_dvi;
-#elif defined CONFIG_VIDEO_VGA_VIA_LCD
-   sunxi_display.monitor = sunxi_monitor_vga;
-#else
-   sunxi_display.monitor = sunxi_monitor_lcd;
 #endif
+   sunxi_display.monitor = sunxi_get_default_mon(true);
video_get_option_string(options, monitor, mon, sizeof(mon),
sunxi_get_mon_desc(sunxi_display.monitor));
for (i = 0; i = SUNXI_MONITOR_LAST; i++) {
@@ -1152,16 +1185,7 @@ void *video_hw_init(void)
mode = custom;
} else if (hpd) {
sunxi_hdmi_shutdown();
-   /* Fallback to lcd / vga / none */
-   if (lcd_mode[0]) {
-   sunxi_display.monitor = sunxi_monitor_lcd;
-   } else {
-#if defined CONFIG_VIDEO_VGA_VIA_LCD || defined CONFIG_VIDEO_VGA
-   sunxi_display.monitor = sunxi_monitor_vga;
-#else
-   sunxi_display.monitor = sunxi_monitor_none;
-#endif
-   }
+   sunxi_display.monitor = sunxi_get_default_mon(false);
} /* else continue with hdmi/dvi without a cable connected */
}
 #endif
@@ -1171,31 +1195,29 @@ void *video_hw_init(void)
return NULL;
case sunxi_monitor_dvi:
case sunxi_monitor_hdmi:
-#ifdef CONFIG_VIDEO_HDMI
+   if (!sunxi_has_hdmi()) {
+   printf(HDMI/DVI not supported on this board\n);
+   sunxi_display.monitor = sunxi_monitor_none;
+   return NULL;
+   }
break;
-#else
-   printf(HDMI/DVI not supported on this board\n);
-   sunxi_display.monitor = sunxi_monitor_none;
-   return NULL;
-#endif
case sunxi_monitor_lcd:
-   if (lcd_mode[0]) {
-   sunxi_display.depth = video_get_params(custom, 
lcd_mode);
-   mode = custom;
-   break;
+   if (!sunxi_has_lcd()) {
+   printf(LCD not supported on this board\n);
+   sunxi_display.monitor = sunxi_monitor_none;
+   return NULL;
}
-   printf(LCD not supported on this board\n);
-   sunxi_display.monitor = sunxi_monitor_none;
-   return NULL;
+   sunxi_display.depth = video_get_params(custom, lcd_mode);
+   mode = custom;
+   break;
case sunxi_monitor_vga:
-#if defined CONFIG_VIDEO_VGA_VIA_LCD || defined CONFIG_VIDEO_VGA
+   if (!sunxi_has_vga()) {
+   printf(VGA not supported on this board\n);
+   sunxi_display.monitor = sunxi_monitor_none;
+   return NULL;
+   }
sunxi_display.depth = 18;
break;
-#else
-   printf(VGA not supported on this board\n

[U-Boot] [PATCH 5/5] sunxi: display: Add composite video out support

2015-08-03 Thread Hans de Goede
Add composite video out support.

This only gets enabled on the Mele M3 for now, since that is were it
was tested. It will be enabled on more boards after testing.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 board/sunxi/Kconfig   |   7 ++
 configs/Mele_M3_defconfig |   1 +
 doc/README.video  |   7 +-
 drivers/video/sunxi_display.c | 200 +-
 4 files changed, 191 insertions(+), 24 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index b156701..7b4a23b 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -410,6 +410,13 @@ config VIDEO_VGA_EXTERNAL_DAC_EN
Set the enable pin for the external VGA DAC. This takes a string in the
format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
 
+config VIDEO_COMPOSITE
+   boolean Composite video output support
+   depends on VIDEO  (MACH_SUN4I || MACH_SUN5I || MACH_SUN7I)
+   default n
+   ---help---
+   Say Y here to add support for outputting composite video.
+
 config VIDEO_LCD_MODE
string LCD panel timing details
depends on VIDEO
diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig
index d498269..5c9796a 100644
--- a/configs/Mele_M3_defconfig
+++ b/configs/Mele_M3_defconfig
@@ -5,6 +5,7 @@ CONFIG_DRAM_CLK=384
 CONFIG_MMC0_CD_PIN=PH1
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_VIDEO_VGA=y
+CONFIG_VIDEO_COMPOSITE=y
 CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-m3
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
diff --git a/doc/README.video b/doc/README.video
index d0a3ad6..4f7a4b5 100644
--- a/doc/README.video
+++ b/doc/README.video
@@ -40,12 +40,15 @@ requires the CONFIG_VIDEO_LCD_MODE Kconfig value to be set.
 
 The sunxi u-boot driver supports the following video-mode options:
 
-- monitor=[none|dvi|hdmi|lcd] - Select the video output to use
+- monitor=[none|dvi|hdmi|lcd|vga|composite-*] - Select the video output to use
  none: Disable video output.
  dvi/hdmi: Selects output over the hdmi connector with dvi resp. hdmi output
format, if edid is used the format is automatically selected.
  lcd:  Selects video output to a LCD screen.
- vga:  Selects bideo output over the VGA connector.
+ vga:  Selects video output over the VGA connector.
+ composite-pal/composite-ntsc/composite-pal-m/composite-pal-nc:
+   Selects composite video output, note the specified resolution is
+   ignored with composite video output.
  Defaults to monitor=dvi.
 
 - hpd=[0|1] - Enable use of the hdmi HotPlug Detect feature
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index bed8a3e..75190db 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -2,7 +2,7 @@
  * Display driver for Allwinner SoCs.
  *
  * (C) Copyright 2013-2014 Luc Verhaegen l...@skynet.be
- * (C) Copyright 2014 Hans de Goede hdego...@redhat.com
+ * (C) Copyright 2014-2015 Hans de Goede hdego...@redhat.com
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
@@ -40,8 +40,12 @@ enum sunxi_monitor {
sunxi_monitor_hdmi,
sunxi_monitor_lcd,
sunxi_monitor_vga,
+   sunxi_monitor_composite_pal,
+   sunxi_monitor_composite_ntsc,
+   sunxi_monitor_composite_pal_m,
+   sunxi_monitor_composite_pal_nc,
 };
-#define SUNXI_MONITOR_LAST sunxi_monitor_vga
+#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_nc
 
 struct sunxi_display {
GraphicDevice graphic_device;
@@ -50,6 +54,12 @@ struct sunxi_display {
unsigned int fb_size;
 } sunxi_display;
 
+const struct ctfb_res_modes composite_video_modes[2] = {
+   /*  x y  hz  pixclk ps/kHz   le   ri  up  lo   hs vs  s  vmode */
+   { 720,  576, 50, 37037,  27000, 137,   5, 20, 27,   2, 2, 0, 
FB_VMODE_INTERLACED },
+   { 720,  480, 60, 37037,  27000, 116,  20, 16, 27,   2, 2, 0, 
FB_VMODE_INTERLACED },
+};
+
 #ifdef CONFIG_VIDEO_HDMI
 
 /*
@@ -390,6 +400,25 @@ static void sunxi_frontend_mode_set(const struct 
ctfb_res_modes *mode,
 static void sunxi_frontend_enable(void) {}
 #endif
 
+static bool sunxi_is_composite(void)
+{
+   switch (sunxi_display.monitor) {
+   case sunxi_monitor_none:
+   case sunxi_monitor_dvi:
+   case sunxi_monitor_hdmi:
+   case sunxi_monitor_lcd:
+   case sunxi_monitor_vga:
+   return false;
+   case sunxi_monitor_composite_pal:
+   case sunxi_monitor_composite_ntsc:
+   case sunxi_monitor_composite_pal_m:
+   case sunxi_monitor_composite_pal_nc:
+   return true;
+   }
+
+   return false; /* Never reached */
+}
+
 /*
  * This is the entity that mixes and matches the different layers and inputs.
  * Allwinner calls it the back-end, but i like composer better.
@@ -423,11 +452,18 @@ static void sunxi_composer_init(void)
setbits_le32(de_be-mode, SUNXI_DE_BE_MODE_ENABLE);
 }
 
+static u32 sunxi_rgb2yuv_coef[12] = {
+   0x0107, 0x0204

[U-Boot] [PATCH 4/5] sunxi: display: Add support for interlaced modes

2015-08-03 Thread Hans de Goede
Add support for interlaced modes, this is a preparation patch for adding
composite out support.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/video/sunxi_display.c | 34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 74a4280..bed8a3e 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -445,6 +445,10 @@ static void sunxi_composer_mode_set(const struct 
ctfb_res_modes *mode,
writel(SUNXI_DE_BE_LAYER_ATTR1_FMT_XRGB, de_be-layer0_attr1_ctrl);
 
setbits_le32(de_be-mode, SUNXI_DE_BE_MODE_LAYER0_ENABLE);
+   if (mode-vmode == FB_VMODE_INTERLACED)
+   setbits_le32(de_be-mode,
+SUNXI_DE_BE_MODE_DEFLICKER_ENABLE |
+SUNXI_DE_BE_MODE_INTERLACE_ENABLE);
 }
 
 static void sunxi_composer_enable(void)
@@ -668,6 +672,8 @@ static int sunxi_lcdc_get_clk_delay(const struct 
ctfb_res_modes *mode, int tcon)
int delay;
 
delay = mode-lower_margin + mode-vsync_len + mode-upper_margin;
+   if (mode-vmode == FB_VMODE_INTERLACED)
+   delay /= 2;
if (tcon == 1)
delay -= 2;
 
@@ -767,7 +773,7 @@ static void sunxi_lcdc_tcon1_mode_set(const struct 
ctfb_res_modes *mode,
 {
struct sunxi_lcdc_reg * const lcdc =
(struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE;
-   int bp, clk_delay, total, val;
+   int bp, clk_delay, total, val, yres;
 
/* Use tcon1 */
clrsetbits_le32(lcdc-ctrl, SUNXI_LCDC_CTRL_IO_MAP_MASK,
@@ -775,13 +781,18 @@ static void sunxi_lcdc_tcon1_mode_set(const struct 
ctfb_res_modes *mode,
 
clk_delay = sunxi_lcdc_get_clk_delay(mode, 1);
writel(SUNXI_LCDC_TCON1_CTRL_ENABLE |
+  SUNXI_LCDC_TCON1_CTRL_INTERLACE(
+   mode-vmode == FB_VMODE_INTERLACED) |
   SUNXI_LCDC_TCON1_CTRL_CLK_DELAY(clk_delay), lcdc-tcon1_ctrl);
 
-   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(mode-yres),
+   yres = mode-yres;
+   if (mode-vmode == FB_VMODE_INTERLACED)
+   yres /= 2;
+   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(yres),
   lcdc-tcon1_timing_source);
-   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(mode-yres),
+   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(yres),
   lcdc-tcon1_timing_scale);
-   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(mode-yres),
+   writel(SUNXI_LCDC_X(mode-xres) | SUNXI_LCDC_Y(yres),
   lcdc-tcon1_timing_out);
 
bp = mode-hsync_len + mode-left_margin;
@@ -791,7 +802,9 @@ static void sunxi_lcdc_tcon1_mode_set(const struct 
ctfb_res_modes *mode,
 
bp = mode-vsync_len + mode-upper_margin;
total = mode-yres + mode-lower_margin + bp;
-   writel(SUNXI_LCDC_TCON1_TIMING_V_TOTAL(2 * total) |
+   if (mode-vmode == FB_VMODE_NONINTERLACED)
+   total *= 2;
+   writel(SUNXI_LCDC_TCON1_TIMING_V_TOTAL(total) |
   SUNXI_LCDC_TCON1_TIMING_V_BP(bp), lcdc-tcon1_timing_v);
 
writel(SUNXI_LCDC_X(mode-hsync_len) | SUNXI_LCDC_Y(mode-vsync_len),
@@ -1223,14 +1236,6 @@ void *video_hw_init(void)
break;
}
 
-   if (mode-vmode != FB_VMODE_NONINTERLACED) {
-   printf(Only non-interlaced modes supported, falling back to 
1024x768\n);
-   mode = res_mode_init[RES_MODE_1024x768];
-   } else {
-   printf(Setting up a %dx%d %s console\n, mode-xres,
-  mode-yres, sunxi_get_mon_desc(sunxi_display.monitor));
-   }
-
sunxi_display.fb_size =
(mode-xres * mode-yres * 4 + 0xfff)  ~0xfff;
if (sunxi_display.fb_size  CONFIG_SUNXI_MAX_FB_SIZE) {
@@ -1240,6 +1245,9 @@ void *video_hw_init(void)
return NULL;
}
 
+   printf(Setting up a %dx%d %s console\n, mode-xres,
+  mode-yres, sunxi_get_mon_desc(sunxi_display.monitor));
+
gd-fb_base = gd-bd-bi_dram[0].start +
  gd-bd-bi_dram[0].size - sunxi_display.fb_size;
sunxi_engines_init();
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/5] sunxi: display: Correct clk_delay calculations for lcd displays

2015-08-03 Thread Hans de Goede
We should only substract 2 from the vblank time when using tcon1.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/video/sunxi_display.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index 3942d2f..fa4241e 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -663,11 +663,14 @@ static void sunxi_lcdc_backlight_enable(void)
gpio_direction_output(pin, PWM_ON);
 }
 
-static int sunxi_lcdc_get_clk_delay(const struct ctfb_res_modes *mode)
+static int sunxi_lcdc_get_clk_delay(const struct ctfb_res_modes *mode, int 
tcon)
 {
int delay;
 
-   delay = mode-lower_margin + mode-vsync_len + mode-upper_margin - 2;
+   delay = mode-lower_margin + mode-vsync_len + mode-upper_margin;
+   if (tcon == 1)
+   delay -= 2;
+
return (delay  30) ? 30 : delay;
 }
 
@@ -692,7 +695,7 @@ static void sunxi_lcdc_tcon0_mode_set(const struct 
ctfb_res_modes *mode,
clrsetbits_le32(lcdc-ctrl, SUNXI_LCDC_CTRL_IO_MAP_MASK,
SUNXI_LCDC_CTRL_IO_MAP_TCON0);
 
-   clk_delay = sunxi_lcdc_get_clk_delay(mode);
+   clk_delay = sunxi_lcdc_get_clk_delay(mode, 0);
writel(SUNXI_LCDC_TCON0_CTRL_ENABLE |
   SUNXI_LCDC_TCON0_CTRL_CLK_DELAY(clk_delay), lcdc-tcon0_ctrl);
 
@@ -770,7 +773,7 @@ static void sunxi_lcdc_tcon1_mode_set(const struct 
ctfb_res_modes *mode,
clrsetbits_le32(lcdc-ctrl, SUNXI_LCDC_CTRL_IO_MAP_MASK,
SUNXI_LCDC_CTRL_IO_MAP_TCON1);
 
-   clk_delay = sunxi_lcdc_get_clk_delay(mode);
+   clk_delay = sunxi_lcdc_get_clk_delay(mode, 1);
writel(SUNXI_LCDC_TCON1_CTRL_ENABLE |
   SUNXI_LCDC_TCON1_CTRL_CLK_DELAY(clk_delay), lcdc-tcon1_ctrl);
 
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] sunxi: display: Add a few extra register and constant defines

2015-08-03 Thread Hans de Goede
Add a few extra sunxi display registers and constant defines.
This is a preparation patch for adding composite video out support.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |  2 +-
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |  1 +
 arch/arm/include/asm/arch-sunxi/display.h | 45 ---
 drivers/video/sunxi_display.c |  8 ++---
 4 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
index 01d3e28..a7e25f4 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
@@ -291,7 +291,7 @@ struct sunxi_ccm_reg {
 #define CCM_LCD_CH0_CTRL_GATE  (0x1  31)
 
 #define CCM_LCD_CH1_CTRL_M(n)  n) - 1)  0xf)  0)
-/* We leave bit 11 set to 0, so sclk1 == sclk2 */
+#define CCM_LCD_CH1_CTRL_HALF_SCLK1(1  11)
 #define CCM_LCD_CH1_CTRL_PLL3  (0  24)
 #define CCM_LCD_CH1_CTRL_PLL7  (1  24)
 #define CCM_LCD_CH1_CTRL_PLL3_2X   (2  24)
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
index 8a26b9f..06c6feb 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
@@ -290,6 +290,7 @@ struct sunxi_ccm_reg {
 #define CCM_LCD_CH0_CTRL_GATE  (0x1  31)
 
 #define CCM_LCD_CH1_CTRL_M(n)  n) - 1)  0xf)  0)
+#define CCM_LCD_CH1_CTRL_HALF_SCLK10 /* no seperate sclk1  2 on sun6i */
 #define CCM_LCD_CH1_CTRL_PLL3  (0  24)
 #define CCM_LCD_CH1_CTRL_PLL7  (1  24)
 #define CCM_LCD_CH1_CTRL_PLL3_2X   (2  24)
diff --git a/arch/arm/include/asm/arch-sunxi/display.h 
b/arch/arm/include/asm/arch-sunxi/display.h
index ae95417..830ec42 100644
--- a/arch/arm/include/asm/arch-sunxi/display.h
+++ b/arch/arm/include/asm/arch-sunxi/display.h
@@ -151,6 +151,10 @@ struct sunxi_de_be_reg {
u32 layer1_attr1_ctrl;  /* 0x8a4 */
u32 layer2_attr1_ctrl;  /* 0x8a8 */
u32 layer3_attr1_ctrl;  /* 0x8ac */
+   u8 res5[0x110]; /* 0x8b0 */
+   u32 output_color_ctrl;  /* 0x9c0 */
+   u8 res6[0xc];   /* 0x9c4 */
+   u32 output_color_coef[12];  /* 0x9d0 */
 };
 
 struct sunxi_lcdc_reg {
@@ -298,7 +302,7 @@ struct sunxi_tve_reg {
u32 cbr_level;  /* 0x10c */
u32 burst_phase;/* 0x110 */
u32 burst_width;/* 0x114 */
-   u8 res2[0x04];  /* 0x118 */
+   u32 unknown2;   /* 0x118 */
u32 sync_vbi_level; /* 0x11c */
u32 white_level;/* 0x120 */
u32 active_num; /* 0x124 */
@@ -331,11 +335,14 @@ struct sunxi_tve_reg {
 #define SUNXI_DE_BE_HEIGHT(y)  (((y) - 1)  16)
 #define SUNXI_DE_BE_MODE_ENABLE(1  0)
 #define SUNXI_DE_BE_MODE_START (1  1)
+#define SUNXI_DE_BE_MODE_DEFLICKER_ENABLE  (1  4)
 #define SUNXI_DE_BE_MODE_LAYER0_ENABLE (1  8)
+#define SUNXI_DE_BE_MODE_INTERLACE_ENABLE  (1  28)
 #define SUNXI_DE_BE_LAYER_STRIDE(x)((x)  5)
 #define SUNXI_DE_BE_REG_CTRL_LOAD_REGS (1  0)
 #define SUNXI_DE_BE_LAYER_ATTR0_SRC_FE00x0002
 #define SUNXI_DE_BE_LAYER_ATTR1_FMT_XRGB   (0x09  8)
+#define SUNXI_DE_BE_OUTPUT_COLOR_CTRL_ENABLE   1
 
 /*
  * LCDC register constants.
@@ -372,11 +379,12 @@ struct sunxi_tve_reg {
 #define SUNXI_LCDC_TCON0_LVDS_INTF_ENABLE  (1  31)
 #define SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE(x)  ((x)  28)
 #define SUNXI_LCDC_TCON1_CTRL_CLK_DELAY(n) (((n)  0x1f)  4)
+#define SUNXI_LCDC_TCON1_CTRL_INTERLACE(n) ((n)  20)
 #define SUNXI_LCDC_TCON1_CTRL_ENABLE   (1  31)
 #define SUNXI_LCDC_TCON1_TIMING_H_BP(n)(((n) - 1)  0)
 #define SUNXI_LCDC_TCON1_TIMING_H_TOTAL(n) (((n) - 1)  16)
 #define SUNXI_LCDC_TCON1_TIMING_V_BP(n)(((n) - 1)  0)
-#define SUNXI_LCDC_TCON1_TIMING_V_TOTAL(n) (((n) * 2)  16)
+#define SUNXI_LCDC_TCON1_TIMING_V_TOTAL(n) ((n)  16)
 #ifdef CONFIG_SUNXI_GEN_SUN6I
 #define SUNXI_LCDC_LVDS_ANA0   0x40040320
 #define SUNXI_LCDC_LVDS_ANA0_EN_MB (1  31)
@@ -494,9 +502,22 @@ struct sunxi_tve_reg {
  */
 #define SUNXI_TVE_GCTRL_DAC_INPUT_MASK(dac)(0xf  (((dac) + 1) * 4))
 #define SUNXI_TVE_GCTRL_DAC_INPUT(dac, sel)((sel)  (((dac) + 1) * 4))
-#define SUNXI_TVE_GCTRL_CFG0_VGA   0x2000
-#define SUNXI_TVE_GCTRL_DAC_CFG0_VGA   0x403e1ac7
-#define SUNXI_TVE_GCTRL_UNKNOWN1_VGA   0x
+#define SUNXI_TVE_CFG0_VGA 0x2000
+#define SUNXI_TVE_CFG0_PAL 0x07030001
+#define SUNXI_TVE_CFG0_NTSC0x0703
+#define SUNXI_TVE_DAC_CFG0_VGA

Re: [U-Boot] [PATCH 3/3] sunxi: Do not add a stdout-path alias to dts on boards without a serial port

2015-08-03 Thread Hans de Goede

Hi,

On 02-08-15 20:57, Ian Campbell wrote:

On Sun, 2015-08-02 at 20:45 +0200, Hans de Goede wrote:



[...]

So for now to keep things working we need CONFIG_CONS_INDEX 1
even on the 1 board we have which does not have a serial port
(the uart1 pins which are routed to the outside on the A13
are used as gpio-s by the lcd.


Makes sense, thanks.

Acked-by: Ian Campbell i...@hellion.org.uk

Is it worth pasting some of your longer description into the commit
message?


Probably I'll improve the commit msg a bit before submitting a pull-req
for this.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/4] sunxi: nand: Basic NAND driver for SPL

2015-08-02 Thread Hans de Goede

Hi,

On 01-08-15 21:22, Scott Wood wrote:

On Sat, 2015-08-01 at 14:30 +0200, Boris Brezillon wrote:

Hi Hans,

On Sat, 1 Aug 2015 14:15:53 +0200
Hans de Goede hdego...@redhat.com wrote:


Hi,

On 23-07-15 14:33, Piotr Zierhoffer wrote:

This is a basic driver for the sunxi NAND controller for Allwinner A20.
It supports only SPL.

The driver uses DMA for data transfers. It does not support writing.


Thanks for your work on this.

I've merged patches 1 - 3 in my sunxi-wip branch,
and I'll include them in the next u-boot-sunxi pull-req.


Shouldn't we at least wait for Scoot's approval?


Or Scott's. :-)

ACK


Thanks.


though I'd encourage quickly implementing multiple spl payload locations
to work around the breakage of the bad block marker mechanism, as was
discussed.


I agree 100%, I've added note to my sunxi todo list for this. Note I only
have this on my todo list as a reminder, since a few other people are actively
working on sunxi nand support I hope that someone else will tackle this.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] sunxi: Do not add a stdout-path alias to dts on boards without a serial port

2015-08-02 Thread Hans de Goede

Hi,

On 02-08-15 18:28, Ian Campbell wrote:

On Sat, 2015-08-01 at 14:50 +0200, Hans de Goede wrote:

Do not add a bogus (pointing to a non existing serial port) stdout-path
alias to dts on boards without a serial port.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  include/configs/sunxi-common.h | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi
-common.h
index 71b2368..a2cbcf5 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -262,6 +262,7 @@ extern int soft_i2c_gpio_scl;
  #define CONFIG_CONS_INDEX  1   /* UART0 */
  #endif


Should this defaulting of CONFIG_CONS_INDEX not be gated as well


That is a good question, unfortunately we still need this for the
SPL, where we do not use DM_SERIAL and thus CONFIG_REQUIRE_SERIAL_CONSOLE
is not used.

We are getting away with this because the sun5i die actually has
an uart0, which in the A13 package is not routed to the outside,
so we are simply sending SPL bootup messages to the tx pin at the
edge of the die, and they go no further from there...

And sofar we only have one A13 board which does not have a serial
port, all others do have a serial port. This kinda makes sense since
the A13 is a much lower pincount package compared to all the other
sunxi SoCs.

Actually before we moved most things including serial over to the
device-model, we were (ab)using the present but not wired uart0
for both the SPL, u-boot proper.

So for now to keep things working we need CONFIG_CONS_INDEX 1
even on the 1 board we have which does not have a serial port
(the uart1 pins which are routed to the outside on the A13
are used as gpio-s by the lcd.

Regards,

Hans

 (or

even instead)? Perhaps incorporate an ifndef CONFIG_CONS_INDEX into the
chain of #elseif below  (making the #error only hit for defined-but
-unknown values) to achieve what this patch wants to do?


+#ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
  #if CONFIG_CONS_INDEX == 1
  #ifdef CONFIG_MACH_SUN9I
  #define OF_STDOUT_PATH/soc/serial@0700:115200
@@ -277,6 +278,7 @@ extern int soft_i2c_gpio_scl;
  #else
  #error Unsupported console port nr. Please fix stdout-path in sunxi
-common.h.
  #endif
+#endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */

  /* GPIO */
  #define CONFIG_SUNXI_GPIO

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] sunxi: Do not add a stdout-path alias to dts on boards without a serial port

2015-08-01 Thread Hans de Goede
Do not add a bogus (pointing to a non existing serial port) stdout-path
alias to dts on boards without a serial port.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 include/configs/sunxi-common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 71b2368..a2cbcf5 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -262,6 +262,7 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_CONS_INDEX  1   /* UART0 */
 #endif
 
+#ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
 #if CONFIG_CONS_INDEX == 1
 #ifdef CONFIG_MACH_SUN9I
 #define OF_STDOUT_PATH /soc/serial@0700:115200
@@ -277,6 +278,7 @@ extern int soft_i2c_gpio_scl;
 #else
 #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
 #endif
+#endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */
 
 /* GPIO */
 #define CONFIG_SUNXI_GPIO
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] sunxi: usb-phy: Never power off the usb ports

2015-08-01 Thread Hans de Goede
USB devices are not really designed to get the power bounced off and on
at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a usb reset and when
booting the kernel, causing the usb-power to bounce off and then back
on again.

This patch removes the powering off calls, fixing the undesirable power
bouncing.

Note this requires some special handling for the OTG port:
1) We must skip the external vbus check if we've already enabled our own
vbus to avoid false positives
2) If on an usb reset we no longer detect that the id-pin is grounded, turn
off vbus as that means an external vbus may be present now

Signed-off-by: Hans de Goede hdego...@redhat.com
---
Changes in v2:
-Skip the vbus detect for the otg port if we've already turned the power on,
 otherwise we get a false positive for having an external vbus  and the otg
 port is not usable after an usb reset
---
 arch/arm/cpu/armv7/sunxi/usb_phy.c|  7 +++
 arch/arm/include/asm/arch-sunxi/usb_phy.h |  1 +
 drivers/usb/host/ehci-sunxi.c |  1 -
 drivers/usb/host/ohci-sunxi.c |  1 -
 drivers/usb/musb-new/sunxi.c  | 28 
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c 
b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index 4d63a74..b7ca5d4 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -232,6 +232,13 @@ void sunxi_usb_phy_power_off(int index)
gpio_set_value(phy-gpio_vbus, 0);
 }
 
+int sunxi_usb_phy_power_is_on(int index)
+{
+   struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
+
+   return phy-power_on_count  0;
+}
+
 int sunxi_usb_phy_vbus_detect(int index)
 {
struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
diff --git a/arch/arm/include/asm/arch-sunxi/usb_phy.h 
b/arch/arm/include/asm/arch-sunxi/usb_phy.h
index cef6c98..6a14cad 100644
--- a/arch/arm/include/asm/arch-sunxi/usb_phy.h
+++ b/arch/arm/include/asm/arch-sunxi/usb_phy.h
@@ -16,6 +16,7 @@ void sunxi_usb_phy_init(int index);
 void sunxi_usb_phy_exit(int index);
 void sunxi_usb_phy_power_on(int index);
 void sunxi_usb_phy_power_off(int index);
+int sunxi_usb_phy_power_is_on(int index);
 int sunxi_usb_phy_vbus_detect(int index);
 int sunxi_usb_phy_id_detect(int index);
 void sunxi_usb_phy_enable_squelch_detect(int index, int enable);
diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
index 34130f8..38d5f92 100644
--- a/drivers/usb/host/ehci-sunxi.c
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -67,7 +67,6 @@ static int ehci_usb_remove(struct udevice *dev)
if (ret)
return ret;
 
-   sunxi_usb_phy_power_off(priv-phy_index);
sunxi_usb_phy_exit(priv-phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index e33a8f7..6079272 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -69,7 +69,6 @@ static int ohci_usb_remove(struct udevice *dev)
if (ret)
return ret;
 
-   sunxi_usb_phy_power_off(priv-phy_index);
sunxi_usb_phy_exit(priv-phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 16a264a..a146c08 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -196,8 +196,6 @@ static bool enabled = false;
 
 static int sunxi_musb_enable(struct musb *musb)
 {
-   int ret;
-
pr_debug(%s():\n, __func__);
 
musb_ep_select(musb-mregs, 0);
@@ -210,17 +208,26 @@ static int sunxi_musb_enable(struct musb *musb)
musb_writeb(musb-mregs, USBC_REG_o_VEND0, 0);
 
if (is_host_enabled(musb)) {
-   ret = sunxi_usb_phy_vbus_detect(0);
-   if (ret == 1) {
-   printf(A charger is plugged into the OTG: );
-   return -ENODEV;
+   int id = sunxi_usb_phy_id_detect(0);
+
+   if (id == 1  sunxi_usb_phy_power_is_on(0))
+   sunxi_usb_phy_power_off(0);
+
+   if (!sunxi_usb_phy_power_is_on(0)) {
+   int vbus = sunxi_usb_phy_vbus_detect(0);
+   if (vbus == 1) {
+   printf(A charger is plugged into the OTG: );
+   return -ENODEV;
+   }
}
-   ret = sunxi_usb_phy_id_detect(0);
-   if (ret == 1) {
+
+   if (id == 1) {
printf(No host cable detected: );
return -ENODEV;
}
-   sunxi_usb_phy_power_on(0); /* port power on */
+
+   if (!sunxi_usb_phy_power_is_on(0))
+   sunxi_usb_phy_power_on(0);
}
 
USBC_ForceVbusValidToHigh(musb-mregs);
@@ -236,9 +243,6 @@ static void sunxi_musb_disable(struct musb *musb

[U-Boot] [PATCH 2/3] sunxi: Add CONFIG_USB0_ID_DET setting to 2 more tablets

2015-08-01 Thread Hans de Goede
Now that we have code to check the id-pin and detect usb-host adapters
plugged into the otg port that way, enable it on the tablets which I own.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 configs/Chuwi_V7_CW0825_defconfig | 1 +
 configs/UTOO_P66_defconfig| 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/Chuwi_V7_CW0825_defconfig 
b/configs/Chuwi_V7_CW0825_defconfig
index 4011351..f44aede 100644
--- a/configs/Chuwi_V7_CW0825_defconfig
+++ b/configs/Chuwi_V7_CW0825_defconfig
@@ -5,6 +5,7 @@ CONFIG_DRAM_CLK=408
 CONFIG_DRAM_EMR1=4
 CONFIG_USB0_VBUS_PIN=PB9
 CONFIG_USB0_VBUS_DET=PH5
+CONFIG_USB0_ID_DET=PH4
 
CONFIG_VIDEO_LCD_MODE=x:1024,y:768,depth:24,pclk_khz:51000,le:19,ri:300,up:6,lo:31,hs:1,vs:1,sync:3,vmode:0
 CONFIG_VIDEO_LCD_POWER=PH8
 CONFIG_VIDEO_LCD_BL_EN=PH7
diff --git a/configs/UTOO_P66_defconfig b/configs/UTOO_P66_defconfig
index 0266299..169c2e8 100644
--- a/configs/UTOO_P66_defconfig
+++ b/configs/UTOO_P66_defconfig
@@ -7,6 +7,7 @@ CONFIG_MMC0_CD_PIN=PG0
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_USB0_VBUS_PIN=PB04
 CONFIG_USB0_VBUS_DET=PG01
+CONFIG_USB0_ID_DET=PG2
 CONFIG_AXP_GPIO=y
 
CONFIG_VIDEO_LCD_MODE=x:480,y:800,depth:18,pclk_khz:25000,le:2,ri:93,up:2,lo:93,hs:1,vs:1,sync:3,vmode:0
 CONFIG_VIDEO_LCD_DCLK_PHASE=0
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/4] sunxi: nand: Basic NAND driver for SPL

2015-08-01 Thread Hans de Goede

Hi,

On 23-07-15 14:33, Piotr Zierhoffer wrote:

This is a basic driver for the sunxi NAND controller for Allwinner A20.
It supports only SPL.

The driver uses DMA for data transfers. It does not support writing.


Thanks for your work on this.

I've merged patches 1 - 3 in my sunxi-wip branch,
and I'll include them in the next u-boot-sunxi pull-req.

We do need to do some more work on this, to support
more different sunxi SoCs, and to add some retry logic
in case the default boot pages of the nand are bad,
but that can both be done in follow-up commits.

Regards,

Hans





Changes in v3:
- moved pinmux and clock to board level
- code cleanup with significant size reduction
- renamed the driver file
- renamed constants to match Kconfig convention
- moved defines from .h to .c, and renamed them to be consistent with
   each other
- removed more magic values
- changed ecc_errors from static to local variable
- other minor changes
- added new options in Kconfig to support different chips
- changed descriptions to comply with patman rules

Changes in v2:
- removed traces of non-SPL-specific code
- moved the driver from boards/sunxi to drivers/mtd/nand
- moved magic values to defines (whenever possible)
- removed unnecesary late initialisation code
- code style changes as suggested for the first patch set:
   - changed visibility of some symbols
   - renamed unclear variables
   - renamed header protector
   - changed types of pointer variables
   - other minor changes
- removed traces of non-SPL specific code
- renamed defines to be more relevant
- moved Kconfig entry for the driver to drivers/mtd/nand
- reworded Kconfig entry help

Karol Gugala (1):
   sunxi: nand: Add pinmux and clock settings for NAND support

Piotr Zierhoffer (3):
   sunxi: nand: Add basic sunxi NAND driver for SPL with DMA support
   sunxi: nand: Add board configuration options
   sunxi: nand: Add information to sunxi that it was run from NAND in SPL

  arch/arm/cpu/armv7/sunxi/board.c  |   4 +
  arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   2 +
  arch/arm/include/asm/arch-sunxi/gpio.h|   1 +
  board/sunxi/board.c   |  27 ++
  drivers/mtd/nand/Kconfig  |  40 +++
  drivers/mtd/nand/Makefile |   1 +
  drivers/mtd/nand/sunxi_nand_spl.c | 353 ++
  include/configs/sunxi-common.h|  10 +
  8 files changed, 438 insertions(+)
  create mode 100644 drivers/mtd/nand/sunxi_nand_spl.c


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/4] sunxi: nand: Add basic sunxi NAND driver for SPL with DMA support

2015-07-31 Thread Hans de Goede

Hi,

On 31-07-15 16:25, Michal Suchanek wrote:

On 31 July 2015 at 11:24, Boris Brezillon
boris.brezil...@free-electrons.com wrote:

Hi Hans,

On Fri, 31 Jul 2015 10:36:43 +0200
Hans de Goede hdego...@redhat.com wrote:


Hi,

On 31-07-15 02:47, Scott Wood wrote:

On Thu, 2015-07-23 at 14:33 +0200, Piotr Zierhoffer wrote:

+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dest)
+{
+ void *current_dest;
+ uint32_t count;
+ uint32_t current_count;
+ uint32_t ecc_errors = 0;
+
+ memset(dest, 0x0, size); /* clean destination memory */
+ for (current_dest = dest;
+ current_dest  (dest + size);
+ current_dest += CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE) {
+ nand_read_page(offs, offs
+  CONFIG_NAND_SUNXI_SPL_SYNDROME_PARTITIONS_END,
+ecc_errors);
+ count = current_dest - dest;
+
+ if (size - count  CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE)
+ current_count = CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE;
+ else
+ current_count = size - count;
+
+ memcpy(current_dest,
+temp_buf,
+current_count);
+ offs += CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE;
+ }
+ return ecc_errors ? -1 : 0;
+}


No bad block marker handling?


The bootrom does not use bad block marker handling (and allwinner's
own FTL does neither for the non boot area, the actually mess up
things by writing metadata which looks like classic bad block
markers).


Hm, checking for bad block markers (and skipping bad blocks) is always a
good thing, even if it does not by itself guarantee that the data
stored in there are not corrupted.


Not on Allwinner hardware. Allwinner tools write data to the nand
which looks like bad block markers so skipping blocks which appear
marked as bad will inevitably skip valid blocks on many (most ?)
Allwinner devices.


Right this has been my observation as well.


Only in the case you soldered a new nand chip yourself and never used
Allwinner tools with it will the bad block markers remain valid. This
is overall very unlikely so it should not be something SPL handles.


Or if you've some device where the nand was not initialized from
the factory, I think some Olinuxino devices with nand fall into this
category.

I agree that is best to simply ignore bad block markers on sunxi
though, as they tend to lead to many false positives (think 60% of
the entire nand consisting of bad blocks in my experience)

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/4] sunxi: nand: Add basic sunxi NAND driver for SPL with DMA support

2015-07-31 Thread Hans de Goede

Hi,

On 31-07-15 02:47, Scott Wood wrote:

On Thu, 2015-07-23 at 14:33 +0200, Piotr Zierhoffer wrote:

+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dest)
+{
+ void *current_dest;
+ uint32_t count;
+ uint32_t current_count;
+ uint32_t ecc_errors = 0;
+
+ memset(dest, 0x0, size); /* clean destination memory */
+ for (current_dest = dest;
+ current_dest  (dest + size);
+ current_dest += CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE) {
+ nand_read_page(offs, offs
+  CONFIG_NAND_SUNXI_SPL_SYNDROME_PARTITIONS_END,
+ecc_errors);
+ count = current_dest - dest;
+
+ if (size - count  CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE)
+ current_count = CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE;
+ else
+ current_count = size - count;
+
+ memcpy(current_dest,
+temp_buf,
+current_count);
+ offs += CONFIG_NAND_SUNXI_SPL_ECC_PAGE_SIZE;
+ }
+ return ecc_errors ? -1 : 0;
+}


No bad block marker handling?


The bootrom does not use bad block marker handling (and allwinner's
own FTL does neither for the non boot area, the actually mess up
things by writing metadata which looks like classic bad block
markers).

What we should do (in a follow up patch) is run some sanity
checks (checksum of the image, etc.) and retry at a different
offset if that fails. This is also what the bootrom does for
loading the SPL itself, it simply tries to read it
at a number of fixed addresses at the beginningen of the nand,
so we should do the same looking for u-boot.bin at those same
addresses (taking into account that u-boot.bin will be written
after the SPL).

Regards,

Hans






-Scott


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] U-boot mini-summit @ ELCE 2015, Dublin, date ?

2015-07-31 Thread Hans de Goede

Hi,

On 31-07-15 10:10, Wolfgang Denk wrote:

Dear Hans,

In message 55b0b0ea.5040...@redhat.com you wrote:


I'm preparing my trip to ELCE in Dublin, Oct 5th - 7th,
and I was wondering if it is already known which day
the u-boot mini-summit will be.

My plan is to travel to Dublin Oct 4th, and back on Oct
8th, so my main question is, will the summit be during ELCE
itself, or a day before / after ?


Sorry for the late reply.


I was not sure how far along you were with organizing things,
so I find the reply time pretty quick actually, thanks for that.




The U-Boot summit will be on Monday, October 5, 2015, 9am - 3pm

See also the wiki page at [1].

[1] http://www.denx.de/wiki/U-Boot/SummitELCE2015

Best regards,

Wolfgang Denk



Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] sunxi: Enable USB DRC on Wexler TAB7200

2015-07-31 Thread Hans de Goede

Hi Aleksei,

On 30-07-15 19:33, Aleksei Mamlin wrote:

Enable the otg/drc usb controller on the Wexler TAB7200 tablet.

Signed-off-by: Aleksei Mamlin mamli...@gmail.com


There are some other u-boot USB patches pending which change
how to enable the MUSB controller in the defconfig. So I'm
going to hold of with merging this until those are merged.

Once those are merged I'll adjust your patch to the new
Kconfig options to use and then merge it.

Regards,

Hans



---
  configs/Wexler_TAB7200_defconfig | 5 +
  1 file changed, 5 insertions(+)

diff --git a/configs/Wexler_TAB7200_defconfig b/configs/Wexler_TAB7200_defconfig
index eadceb2..55e1b6b 100644
--- a/configs/Wexler_TAB7200_defconfig
+++ b/configs/Wexler_TAB7200_defconfig
@@ -2,10 +2,15 @@ CONFIG_ARM=y
  CONFIG_ARCH_SUNXI=y
  CONFIG_MACH_SUN7I=y
  CONFIG_DRAM_CLK=384
+CONFIG_USB0_VBUS_PIN=PB9
+CONFIG_USB0_VBUS_DET=AXP0-VBUS-DETECT
+CONFIG_USB0_ID_DET=PH4
+CONFIG_AXP_GPIO=y
  
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
  CONFIG_VIDEO_LCD_BL_PWM=PB2
+CONFIG_USB_MUSB_SUNXI=y
  CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-wexler-tab7200
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 00/11] USB and sunxi Kconfig and config changes leading up to fastboot support

2015-07-29 Thread Hans de Goede

Hi,

On 29-07-15 15:32, Paul Kocialkowski wrote:

This series is based off the following patch:
* drivers: hierarchize drivers Kconfig menu

that was sent to the list earlier.

Please pick it up as well when merging this series.


The entire series looks good to me:

Acked-by: Hans de Goede hdego...@redhat.com

Marek, since this consists of mostly generic USB chaages I
think it would be best for you to pick up this entire
series.

Regards,

Hans

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 08/12] sunxi: USB EHCI Kconfig option instead of config define

2015-07-27 Thread Hans de Goede

Hi,

On 27-07-15 14:31, Paul Kocialkowski wrote:

Hi,

Le mercredi 22 juillet 2015 à 11:31 +0200, Hans de Goede a écrit :

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

This makes sunxi boards use the USB_EHCI_HCD Kconfig option instead of defining
USB_EHCI as a config define. This allows for more flexibility in enabling the
controller and handling other Kconfig that may depend on USB EHCI.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr


This is already done by this commit:

https://github.com/jwrdegoede/u-boot-sunxi/commit/a38b760f8805dfa7d9a0d60fa08802412b38f463

My sunxi-wip tree has a whole bunch of patches to convert
the musb-host code to DM_USB so that the musb code can be built
in in host mode together with the ehci / uhci host drivers,
this is useful on boards where the musb is used in host only
mode such as the Mele A1000G quad where the musb is hooked up
to a usb2sata chip for the sata slot of the device.

The dm-usb bits of these series are queued up in:
http://git.denx.de/?p=u-boot/u-boot-dm.git;a=shortlog;h=refs/heads/next

And I'm waiting for those to go upstream before submitting
a pull-req with the sunxi bits of this, which is also why:

https://github.com/jwrdegoede/u-boot-sunxi/commit/a38b760f8805dfa7d9a0d60fa08802412b38f463

Has not been merged yet as it sits on top of all this...


Looks like everything was merged now. Can you confirm all the bits are
in the main u-boot repository? if so, I'll just adapt my series as
discussed on top of that.


Correct, everything is merged now, basing on top of master should be fine.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] dm: serial: Add a REQUIRE_SERIAL_CONSOLE option for boards with no serial port

2015-07-25 Thread Hans de Goede
Currently the serial code assumes that there is always at least one serial
port (and panics / crashes due to null pointer dereferences when there is
none).

This makes it impossible to use u-boot on boards where there is no (debug)
serial port, because e.g. all uart pins are muxed to another function.

This commit adds a CONFIG_REQUIRE_SERIAL_CONSOLE Kconfig option, which
defaults to y (preserving existing behavior), which can be set to n on
such boards to make them work.

This commit only implements this for CONFIG_DM_SERIAL=y configs, as allowing
running without a serial port for CONFIG_DM_SERIAL=n configs is non trivial,
and is not necessary at this moment.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/serial/Kconfig | 11 +++
 drivers/serial/serial-uclass.c | 20 +---
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 4829284..89d01d5 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1,3 +1,14 @@
+config REQUIRE_SERIAL_CONSOLE
+   bool Require a serial port for console
+   # Running without a serial console is not supported by the
+   # non dm serial code
+   depends on DM_SERIAL
+   default y
+   help
+ Require a serial port for the console, and panic of none is found
+ during serial port initialization (default y). Set this to n on
+ boards which have no debug serial port what so ever.
+
 config DM_SERIAL
bool Enable Driver Model for serial drivers
depends on DM
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 815fec3..df0f183 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -78,7 +78,9 @@ static void serial_find_console_or_panic(void)
 #undef INDEX
}
 
+#ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
panic_str(No serial driver found);
+#endif
 }
 
 /* Called prior to relocation */
@@ -140,28 +142,40 @@ static int _serial_tstc(struct udevice *dev)
 
 void serial_putc(char ch)
 {
-   _serial_putc(gd-cur_serial_dev, ch);
+   if (gd-cur_serial_dev)
+   _serial_putc(gd-cur_serial_dev, ch);
 }
 
 void serial_puts(const char *str)
 {
-   _serial_puts(gd-cur_serial_dev, str);
+   if (gd-cur_serial_dev)
+   _serial_puts(gd-cur_serial_dev, str);
 }
 
 int serial_getc(void)
 {
+   if (!gd-cur_serial_dev)
+   return 0;
+
return _serial_getc(gd-cur_serial_dev);
 }
 
 int serial_tstc(void)
 {
+   if (!gd-cur_serial_dev)
+   return 0;
+
return _serial_tstc(gd-cur_serial_dev);
 }
 
 void serial_setbrg(void)
 {
-   struct dm_serial_ops *ops = serial_get_ops(gd-cur_serial_dev);
+   struct dm_serial_ops *ops;
+
+   if (!gd-cur_serial_dev)
+   return;
 
+   ops = serial_get_ops(gd-cur_serial_dev);
if (ops-setbrg)
ops-setbrg(gd-cur_serial_dev, gd-baudrate);
 }
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-sunxi master

2015-07-25 Thread Hans de Goede

Hi Tom,

Here is the first sunxi pull-req for v2015.10, highlights:

-Some preparation patches for adding SPL nand support
-Your patch to cleanup the sunxi defconfigs
-Add device-model support to the sunxi musb-host code, allowing
 it to be built at the same time as the ehci  uhci code and
 enable the musb host together with ehci/uhci on various boards

The following changes since commit 413978d118bb7d7b0a8488d97d802f2899cd81ce:

  Merge git://git.denx.de/u-boot-uniphier (2015-07-23 11:46:05 -0400)

are available in the git repository at:

  http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to 7f7409ba6ab937b73f16bac8d83e215db86ace3d:

  sunxi: Enable both ehci and otg in host mode on various boards (2015-07-25 
11:22:55 +0200)


Daniel Kochmański (4):
  mmc: Protect `mmc_initialize` from initialising mmc multiple times
  sunxi: Create helper function veryfing valid boot signature on MMC
  sunxi: spl: Detect at runtime where SPL was read from
  sunxi: spl: Remove redundant check from `board_mmc_init` for signature

Hans de Goede (11):
  sunxi: Remove bogus uart entry from utoo-p66 dts file
  sunxi: Enable CMD_USB and USB_STORAGE by default on sunxi
  sunxi: usb-phy: Add support for reading otg id pin value
  sunxi: musb: Move vbus check to sunxi_musb_enable
  sunxi: musb: Add id pin support
  sunxi: musb: Move musb config and platdata to the sunxi-musb glue
  sunxi: musb: Use device-model for musb host mode
  sunxi: musb: Improve output during probing
  sunxi: musb: Stop treating not having a vbus-det gpio as an error
  sunxi: ga10h: Enable both otg and regular usb host controllers
  sunxi: Enable both ehci and otg in host mode on various boards

Tom Rini (1):
  sunxi: Update selects in arch/arm/Kconfig for DM conversions

 arch/arm/Kconfig |   6 ++
 arch/arm/cpu/armv7/sunxi/board.c |  52 +---
 arch/arm/cpu/armv7/sunxi/usb_phy.c   |  38 -
 arch/arm/dts/sun5i-a13-utoo-p66.dts  |  14 
 arch/arm/dts/sun8i-a23-a33.dtsi  |  18 +
 arch/arm/dts/sun8i-a33-ga10h-v1.1.dts|   8 ++
 arch/arm/include/asm/arch-sunxi/mmc.h|   1 +
 arch/arm/include/asm/arch-sunxi/usb_phy.h|   8 ++
 board/sunxi/Kconfig  |   7 ++
 board/sunxi/board.c  |  50 +++-
 configs/A10-OLinuXino-Lime_defconfig |   7 +-
 configs/A10s-OLinuXino-M_defconfig   |   7 +-
 configs/A13-OLinuXinoM_defconfig |   7 +-
 configs/A13-OLinuXino_defconfig  |   7 +-
 configs/A20-OLinuXino-Lime2_defconfig|   7 +-
 configs/A20-OLinuXino-Lime_defconfig |   7 +-
 configs/A20-OLinuXino_MICRO_defconfig|   7 +-
 configs/Ainol_AW1_defconfig  |   2 -
 configs/Ampe_A76_defconfig   |   2 -
 configs/Auxtek-T004_defconfig|   7 +-
 configs/Bananapi_defconfig   |   7 +-
 configs/Bananapro_defconfig  |   7 +-
 configs/CSQ_CS908_defconfig  |   8 +-
 configs/Chuwi_V7_CW0825_defconfig|   2 -
 configs/Colombus_defconfig   |   7 +-
 configs/Cubieboard2_defconfig|   7 +-
 configs/Cubieboard_defconfig |   7 +-
 configs/Cubietruck_defconfig |   7 +-
 configs/Et_q8_v1_6_defconfig |   2 -
 configs/Hummingbird_A31_defconfig|   7 +-
 configs/Hyundai_A7HD_defconfig   |   2 -
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig |   3 +-
 configs/Ippo_q8h_v1_2_defconfig  |   3 +-
 configs/Ippo_q8h_v5_defconfig|   3 +-
 configs/Linksprite_pcDuino3_Nano_defconfig   |   7 +-
 configs/Linksprite_pcDuino3_defconfig|   7 +-
 configs/Linksprite_pcDuino_defconfig |   7 +-
 configs/MK808C_defconfig |   7 +-
 configs/MSI_Primo73_defconfig|   4 -
 configs/MSI_Primo81_defconfig|   3 -
 configs/Marsboard_A10_defconfig  |   7 +-
 configs/Mele_A1000G_quad_defconfig   |   8 +-
 configs/Mele_A1000_defconfig |   7 +-
 configs/Mele_I7_defconfig|   7 +-
 configs/Mele_M3_defconfig|   7 +-
 configs/Mele_M5_defconfig|   7 +-
 configs/Mele_M9_defconfig|   7 +-
 configs/Merrii_A80_Optimus_defconfig |   4 -
 configs/Mini-X_defconfig |   9 +--
 configs/Orangepi_defconfig   |   7 +-
 configs/Orangepi_mini_defconfig  |   7 +-
 configs/Sinlinx_SinA33_defconfig |   4 -
 configs/TZX-Q8-713B7_defconfig   |   2 -
 configs/UTOO_P66_defconfig   |   2 +-
 configs/Wexler_TAB7200_defconfig |   7 +-
 configs/Wits_Pro_A20_DKT_defconfig

[U-Boot] U-boot mini-summit @ ELCE 2015, Dublin, date ?

2015-07-23 Thread Hans de Goede

Hi All,

I'm preparing my trip to ELCE in Dublin, Oct 5th - 7th,
and I was wondering if it is already known which day
the u-boot mini-summit will be.

My plan is to travel to Dublin Oct 4th, and back on Oct
8th, so my main question is, will the summit be during ELCE
itself, or a day before / after ?

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] USB and unbinding

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 05:48, Simon Glass wrote:

Hi Hans,

On 21 July 2015 at 13:52, Hans de Goede hdego...@redhat.com wrote:

Hi,

On 07/20/2015 05:49 PM, Simon Glass wrote:


Hi Hans,


On 20 July 2015 at 09:31, Hans de Goede hdego...@redhat.com wrote:


Hi,

On 20-07-15 04:23, Simon Glass wrote:



Hi Hans,

I've been thinking about the USB unbinding code. I know that I agreed
to go with it, but in retrospect I think that was a mistake.

I believe we should separate out the unbinding and make it an option,
so that it is not required in order to use USB. In effect this makes
one of driver model's design goals (the option to drop unused code)
useless since USB is a common interface.

If I recall the only problem the lack of unbinding caused was that the
keyboard driver broke. I suspect it broke in a way that can be fixed.
In fact I recently converted usb_ether to driver model and I'm willing
to do the keyboard side also.

I'd like the USB code to function with or without the unbinding (i.e.
it uses it if there). What do you think?




I strongly believe that unbinding is the proper thing todo for usb since
it is a hotplug bus.

IMHO the way the usb_find_emul_child() function was used before to re-use
udevice-s after e.g. a usb reset was an ugly hack which just happened
to
work, but it in no way reflects reality.

More importantly we need unbind support to properly stop usb controllers
when
booting the OS, so that they are not DMA-ing to/from their scratch-ram
area
in DRAM when the main OS boots, so not having unbind support combined
with
USB really is a no no.

This is why I suggested to simply select the unbind Kconfig when USB is
selected in Kconfig.



I think you are referring to remove(), not unbind().



Right I mean that the remove callback *must* be called on usb_stop to avoid
the usb controller dma-ing over random DRAM when the OS starts.


OK.




Although we might
consider spiting them so we have a DM_DEVICE_REMOVE and a separate
DM_DEVICE_UNBIND.



The actual unbind core code is not that big, so I believe that the best
solution is to always build the core if either DM_DEVICE_REMOVE *or*
DM_USB is selected, and non USB drivers can leave out their unbind
code if DM_DEVICE_REMOVE is not set, that should still give us most of
the size savings without needing to do ugly hacks for USB.



My main objection is that we tie USB such that it *will not work*
unless we support unbinding. I'm fine with it being recommended, but
core driver model features should be independent of subsystems. This
also seems quite unnecessary. Re your common about the 'ugly hack that
just happened to work', in principle we can just keep on creating new
devices and ignore the old ones.



That will still cause problems with code addressing the usb-devices
by index, as the old devices will still be there.


That's the idea behind not supporting
unbinding. There should be no problem with this approach.



This approach will only work if find_child_devnum is fixed to search
backwards through the childs list, so that it will check the newly
added nodes first.


Or that it just ignores the nodes that aren't active. Anyway that
function is a hang-over from the old code. It makes no sense to
enumerate the devices when you can just look up the data and find
them.


Right, walking over the tree is still necessary for the usb tree
command though.


I think it can be made to work for now, but perhaps we should
port the keyboard drivers to DM?


I agree that atleast the usb-keyb. driver should be ported to use DM
style binding like the usb-storage driver.

I've been thinking a bit about this, currently the driver will only
bind to the first available usb hid intf with a boot - keyb subclass.
If we move to DM binding we should support multiple keyboards, but
the current stdio.c code deals poorly with this, so I think that
it would be best to keep a list of usb-keyb-devices in common/usb_kbd.c
and register a stdio device for this when the first usb-keyb-device
gets registered (so the list is empty) and unregister it when the last
one gets removed.

All usb-keyboards would then feed keypresses into a single FIFO
(usb_kbd_buffer + usb_[in|out]_pointer in the current code), from
which the single stdio device would feed.

Note that the unregistering bit requires DM_DEVICE_REMOVE, we can do
without this though and just keep the stdio-device around with an
always empty keyevent fifo.


So I'd like to adjust the USB code so that it still works without
unbinding, even if it is not optimal. I think that is the right thing
to do in this case.



As said, the remove callback of usb-host drivers *must* always be called,
other then that if you can make things work without unbind that is
fine with me.


OK thanks, will give it a crack.


Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/12] sunxi: MUSB gadget config provisions, with fastboot and USB mass storage support

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

This adds some config options to the sunxi-common config to enable the USB
download gadget and the fastboot and USB mass storage functions.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr


Acked-by: Hans de Goede hdego...@redhat.com

Regards,

Hans




---
  include/configs/sunxi-common.h | 30 ++
  1 file changed, 30 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 3d57129..b2eb306 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -329,6 +329,36 @@ extern int soft_i2c_gpio_scl;
  #define CONFIG_USB_MUSB_PIO_ONLY
  #endif

+#ifdef CONFIG_USB_MUSB_GADGET
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW0
+
+#define CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_USB_FUNCTION_FASTBOOT
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#endif
+
+#ifdef CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_G_DNL_VENDOR_NUM0x1f3a
+#define CONFIG_G_DNL_PRODUCT_NUM   0x1010
+#define CONFIG_G_DNL_MANUFACTURER  Allwinner Technology
+#endif
+
+#ifdef CONFIG_USB_FUNCTION_FASTBOOT
+#define CONFIG_CMD_FASTBOOT
+#define CONFIG_FASTBOOT_BUF_ADDR   CONFIG_SYS_LOAD_ADDR
+#define CONFIG_FASTBOOT_BUF_SIZE   0x200
+
+#define CONFIG_FASTBOOT_FLASH
+#define CONFIG_FASTBOOT_FLASH_MMC_DEV  0
+#define CONFIG_EFI_PARTITION
+#endif
+
+#ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_CMD_USB_MASS_STORAGE
+#endif
+
  #if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST
  #define CONFIG_CMD_USB
  #endif


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 11/12] musb: sunxi: Force EP0 on re-enable

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

From: Maxime Ripard maxime.rip...@free-electrons.com

Currently, the second use of a gadget will fail, while the first one works.

Forcing the EP0 at every enable fix this issue.

Signed-off-by: Maxime Ripard maxime.rip...@free-electrons.com


Acked-by: Hans de Goede hdego...@redhat.com

Regards,

Hans


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

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 052e065..4effaaa 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -203,6 +203,9 @@ static void sunxi_musb_enable(struct musb *musb)
  {
pr_debug(%s():\n, __func__);

+   musb_ep_select(musb-mregs, 0);
+   musb_writeb(musb-mregs, MUSB_FADDR, 0);
+
if (enabled)
return;



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 08/12] sunxi: USB EHCI Kconfig option instead of config define

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

This makes sunxi boards use the USB_EHCI_HCD Kconfig option instead of defining
USB_EHCI as a config define. This allows for more flexibility in enabling the
controller and handling other Kconfig that may depend on USB EHCI.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr


This is already done by this commit:

https://github.com/jwrdegoede/u-boot-sunxi/commit/a38b760f8805dfa7d9a0d60fa08802412b38f463

My sunxi-wip tree has a whole bunch of patches to convert
the musb-host code to DM_USB so that the musb code can be built
in in host mode together with the ehci / uhci host drivers,
this is useful on boards where the musb is used in host only
mode such as the Mele A1000G quad where the musb is hooked up
to a usb2sata chip for the sata slot of the device.

The dm-usb bits of these series are queued up in:
http://git.denx.de/?p=u-boot/u-boot-dm.git;a=shortlog;h=refs/heads/next

And I'm waiting for those to go upstream before submitting
a pull-req with the sunxi bits of this, which is also why:

https://github.com/jwrdegoede/u-boot-sunxi/commit/a38b760f8805dfa7d9a0d60fa08802412b38f463

Has not been merged yet as it sits on top of all this...

I think that for v2 of this series it is best to base it
on my sunxi-wip branch, esp. since that contains the
addition of DM_USB support to the musb host code.

I'll rebase my sunxi-wip branch one of these days and push
everything in there which is ready for upstream, including the
dm-usb bits to u-boot-sunxi/next, so that people will have
something to base sunxi patches on.

Until then please use my sunxi-wip branch.

Regards,

Hans




---
  configs/A10-OLinuXino-Lime_defconfig   | 3 ++-
  configs/A10s-OLinuXino-M_defconfig | 3 ++-
  configs/A13-OLinuXinoM_defconfig   | 3 ++-
  configs/A13-OLinuXino_defconfig| 3 ++-
  configs/A20-OLinuXino-Lime2_defconfig  | 3 ++-
  configs/A20-OLinuXino-Lime_defconfig   | 3 ++-
  configs/A20-OLinuXino_MICRO_defconfig  | 3 ++-
  configs/Auxtek-T004_defconfig  | 3 ++-
  configs/Bananapi_defconfig | 3 ++-
  configs/Bananapro_defconfig| 3 ++-
  configs/CSQ_CS908_defconfig| 3 ++-
  configs/Colombus_defconfig | 3 ++-
  configs/Cubieboard2_defconfig  | 3 ++-
  configs/Cubieboard_defconfig   | 3 ++-
  configs/Cubietruck_defconfig   | 3 ++-
  configs/Hummingbird_A31_defconfig  | 3 ++-
  configs/Linksprite_pcDuino3_Nano_defconfig | 3 ++-
  configs/Linksprite_pcDuino3_defconfig  | 3 ++-
  configs/Linksprite_pcDuino_defconfig   | 3 ++-
  configs/MK808C_defconfig   | 3 ++-
  configs/Marsboard_A10_defconfig| 3 ++-
  configs/Mele_A1000G_quad_defconfig | 3 ++-
  configs/Mele_A1000_defconfig   | 3 ++-
  configs/Mele_I7_defconfig  | 3 ++-
  configs/Mele_M3_defconfig  | 3 ++-
  configs/Mele_M5_defconfig  | 3 ++-
  configs/Mele_M9_defconfig  | 3 ++-
  configs/Mini-X_defconfig   | 3 ++-
  configs/Orangepi_defconfig | 3 ++-
  configs/Orangepi_mini_defconfig| 3 ++-
  configs/Wexler_TAB7200_defconfig   | 3 ++-
  configs/Wits_Pro_A20_DKT_defconfig | 3 ++-
  configs/ba10_tv_box_defconfig  | 3 ++-
  configs/i12-tvbox_defconfig| 3 ++-
  configs/jesurun_q5_defconfig   | 3 ++-
  configs/mixtile_loftq_defconfig| 3 ++-
  configs/mk802_a10s_defconfig   | 3 ++-
  configs/mk802_defconfig| 2 ++
  configs/mk802ii_defconfig  | 3 ++-
  configs/r7-tv-dongle_defconfig | 3 ++-
  configs/sunxi_Gemei_G9_defconfig   | 3 ++-
  41 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index 87ade90..7fab4c4 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -7,7 +7,7 @@ CONFIG_SYS_CLK_FREQ=91200
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3)
  # CONFIG_CMD_IMLS is not set
  # CONFIG_CMD_FLASH is not set
  # CONFIG_CMD_FPGA is not set
@@ -15,3 +15,4 @@ CONFIG_DM_ETH=y
  CONFIG_DM_SERIAL=y
  CONFIG_USB=y
  CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
diff --git a/configs/A10s-OLinuXino-M_defconfig 
b/configs/A10s-OLinuXino-M_defconfig
index 5a450af..d45f7af 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -9,7 +9,7 @@ CONFIG_USB1_VBUS_PIN=PB10
  CONFIG_DEFAULT_DEVICE_TREE=sun5i-a10s-olinuxino-micro
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y

Re: [U-Boot] [PATCH 09/12] sunxi: Kconfig defaults for USB

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

USB_STORAGE and USB_KEYBOARD should only be selected when either USB_EHCI_HCD or
USB_MUSB_HOST is set. In addition, the musb controller should automatically be
selected when either USB_MUSB_HOST or USB_MUSB_GADGET is selected, not the other
way round.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr


You are mixing / matching 2 things here:

1) Updating the defconfigs for your USB_MUSB_HOST Kconfig addition, that
should have been done in the actual patch adding that option.

2) USB_STORAGE / USB_KEYBOARD related changes, AFAICT these are mostly
superceeded by:

https://github.com/jwrdegoede/u-boot-sunxi/commit/a38b760f8805dfa7d9a0d60fa08802412b38f463

Regards,

Hans



---
  board/sunxi/Kconfig  | 5 -
  configs/Ainol_AW1_defconfig  | 2 +-
  configs/Ampe_A76_defconfig   | 2 +-
  configs/Chuwi_V7_CW0825_defconfig| 2 +-
  configs/Et_q8_v1_6_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/MSI_Primo81_defconfig| 2 +-
  configs/TZX-Q8-713B7_defconfig   | 2 +-
  configs/UTOO_P66_defconfig   | 2 +-
  configs/Yones_Toptech_BD1078_defconfig   | 2 +-
  configs/forfun_q88db_defconfig   | 2 +-
  configs/ga10h_v1_1_defconfig | 2 +-
  configs/iNet_3F_defconfig| 2 +-
  configs/iNet_3W_defconfig| 2 +-
  configs/iNet_86VS_defconfig  | 2 +-
  drivers/usb/musb-new/Kconfig | 2 +-
  19 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 66d2c4e..01e2c82 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -531,8 +531,11 @@ config VIDEO_LCD_TL059WV5C0

  endchoice

+config USB_STORAGE
+   default y if USB_EHCI_HCD || USB_MUSB_HOST
+
  config USB_KEYBOARD
-   default y
+   default y if USB_EHCI_HCD || USB_MUSB_HOST

  config GMAC_TX_DELAY
int GMAC Transmit Clock Delay Chain
diff --git a/configs/Ainol_AW1_defconfig b/configs/Ainol_AW1_defconfig
index f94cd5a..50380db 100644
--- a/configs/Ainol_AW1_defconfig
+++ b/configs/Ainol_AW1_defconfig
@@ -11,7 +11,7 @@ 
CONFIG_VIDEO_LCD_MODE=x:800,y:480,depth:18,pclk_khz:4,le:87,ri:112,up:38,lo
  CONFIG_VIDEO_LCD_POWER=PH8
  CONFIG_VIDEO_LCD_BL_EN=PH7
  CONFIG_VIDEO_LCD_BL_PWM=PB2
-CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB_MUSB_HOST=y
  CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-ainol-aw1
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
diff --git a/configs/Ampe_A76_defconfig b/configs/Ampe_A76_defconfig
index 99aa141..bada534 100644
--- a/configs/Ampe_A76_defconfig
+++ b/configs/Ampe_A76_defconfig
@@ -10,7 +10,7 @@ 
CONFIG_VIDEO_LCD_MODE=x:800,y:480,depth:18,pclk_khz:33000,le:45,ri:82,up:22,lo:
  CONFIG_VIDEO_LCD_POWER=AXP0-0
  CONFIG_VIDEO_LCD_BL_EN=AXP0-1
  CONFIG_VIDEO_LCD_BL_PWM=PB2
-CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB_MUSB_HOST=y
  CONFIG_DEFAULT_DEVICE_TREE=sun5i-a13-ampe-a76
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
diff --git a/configs/Chuwi_V7_CW0825_defconfig 
b/configs/Chuwi_V7_CW0825_defconfig
index 3a2a219..298cf9c 100644
--- a/configs/Chuwi_V7_CW0825_defconfig
+++ b/configs/Chuwi_V7_CW0825_defconfig
@@ -10,7 +10,7 @@ CONFIG_VIDEO_LCD_POWER=PH8
  CONFIG_VIDEO_LCD_BL_EN=PH7
  CONFIG_VIDEO_LCD_BL_PWM=PB2
  CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM=y
-CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB_MUSB_HOST=y
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-chuwi-v7-cw0825
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
diff --git a/configs/Et_q8_v1_6_defconfig b/configs/Et_q8_v1_6_defconfig
index e36895c..23f7531 100644
--- a/configs/Et_q8_v1_6_defconfig
+++ b/configs/Et_q8_v1_6_defconfig
@@ -11,7 +11,7 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0
  CONFIG_VIDEO_LCD_POWER=PH7
  CONFIG_VIDEO_LCD_BL_EN=PH6
  CONFIG_VIDEO_LCD_BL_PWM=PH0
-CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB_MUSB_HOST=y
  CONFIG_DEFAULT_DEVICE_TREE=sun8i-a33-et-q8-v1.6
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
diff --git a/configs/Hyundai_A7HD_defconfig b/configs/Hyundai_A7HD_defconfig
index 7800fa2..f7983e0 100644
--- a/configs/Hyundai_A7HD_defconfig
+++ b/configs/Hyundai_A7HD_defconfig
@@ -12,7 +12,7 @@ CONFIG_VIDEO_LCD_BL_EN=PH9
  CONFIG_VIDEO_LCD_BL_PWM=PB2
  # CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW is not set
  CONFIG_VIDEO_LCD_PANEL_LVDS=y
-CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB_MUSB_HOST=y
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-hyundai-a7hd
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
diff --git a/configs/Ippo_q8h_v1_2_a33_1024x600_defconfig 
b/configs/Ippo_q8h_v1_2_a33_1024x600_defconfig
index 8e26f37..9faa0b9 100644
--- a/configs/Ippo_q8h_v1_2_a33_1024x600_defconfig
+++ 

Re: [U-Boot] [PATCH 06/12] usb: USB_MUSB_SUNXI move to musb-new Kconfig

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

Now that the musb-new driver has a Kconfig, we can move Kconfig options to
enable controllers to it, so that it's easier in e.g. menuconfig.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
  board/sunxi/Kconfig  |  9 -
  drivers/usb/musb-new/Kconfig | 14 ++
  2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 2a1cd3c..9c25d49 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -532,15 +532,6 @@ config VIDEO_LCD_TL059WV5C0
  endchoice


-config USB_MUSB_SUNXI
-   bool Enable sunxi OTG / DRC USB controller in host mode
-   default n
-   ---help---
-   Say y here to enable support for the sunxi OTG / DRC USB controller
-   used on almost all sunxi boards. Note currently u-boot can only have
-   one usb host controller enabled at a time, so enabling this on boards
-   which also use the ehci host controller will result in build errors.
-
  config USB_KEYBOARD
boolean Enable USB keyboard support
default y
diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig
index 34a8474..5be072a 100644
--- a/drivers/usb/musb-new/Kconfig
+++ b/drivers/usb/musb-new/Kconfig
@@ -12,3 +12,17 @@ config USB_MUSB_GADGET
bool MUSB gadget mode support
help
  Enables the MUSB USB dual-role controller in gadget mode.
+
+if USB_MUSB_HOST || USB_MUSB_GADGET
+
+config USB_MUSB_SUNXI
+   bool Enable sunxi OTG / DRC USB controller
+   depends on ARCH_SUNXI
+   default n
+   ---help---
+   Say y here to enable support for the sunxi OTG / DRC USB controller
+   used on almost all sunxi boards. Note currently u-boot can only have
+   one usb host controller enabled at a time, so enabling this on boards
+   which also use the ehci host controller will result in build errors.
+
+endif



AFAICT this will break MUSB host usage on current sunxi boards, since their
defconfig-s contain CONFIG_USB_MUSB_SUNXI=y but not CONFIG_USB_MUSB_HOST=y
please update all sunxi defconfigs which have CONFIG_USB_MUSB_SUNXI=y to also
set CONFIG_USB_MUSB_HOST=y in this patch to avoid this breakage.

Note all earlier patches in this series look good to me and are:

Acked-by: Hans de Goede hdego...@redhat.com

Regards,

Hans

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/12] usb: USB_KEYBOARD move to usb Kconfig

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

The USB_KEYBOARD Kconfig is not specific to sunxi, so we can move it to the
common USB Kconfig.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr
---
  board/sunxi/Kconfig | 5 -
  drivers/usb/Kconfig | 6 ++
  2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 9c25d49..66d2c4e 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -531,13 +531,8 @@ config VIDEO_LCD_TL059WV5C0

  endchoice

-
  config USB_KEYBOARD
-   boolean Enable USB keyboard support
default y
-   ---help---
-   Say Y here to add support for using a USB keyboard (typically used
-   in combination with a graphical console).

  config GMAC_TX_DELAY
int GMAC Transmit Clock Delay Chain


This leaves with just:

config USB_KEYBOARD
default y

And we've just gone to a whole bunch of removals of Kconfig
code like this because it breaks make savedefconfig when
used with non sunxi boards (in this case).


diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index d602e44..ab2a6a1 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -66,4 +66,10 @@ config USB_STORAGE
  Say Y here if you want to connect USB mass storage devices to your
  board's USB port.

+config USB_KEYBOARD
+   boolean Enable USB keyboard support
+   ---help---
+ Say Y here to add support for using a USB keyboard (typically used
+ in combination with a graphical console).
+
  endif


So we need to set the default here, how about we add a
CONFIG_USB_HAS_HCD hidden bool option, and then select that from
CONFIG_USB_EHCI, CONFIG_USB_MUSB_HOST, etc, and then here do:

default y if CONFIG_USB_HAS_HCD

?

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 10/12] sunxi: config update to stick with Kconfig changes

2015-07-22 Thread Hans de Goede

Hi,

On 22-07-15 10:45, Paul Kocialkowski wrote:

Now that some things were updated in Kconfig, they should be reflected on the
sunxi-common config too.

Signed-off-by: Paul Kocialkowski cont...@paulk.fr


Ack.

Regards,

Hans



---
  include/configs/sunxi-common.h | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index e34c57c..3d57129 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -318,7 +318,7 @@ extern int soft_i2c_gpio_scl;
  #define CONFIG_PHYLIB
  #endif

-#ifdef CONFIG_USB_EHCI
+#ifdef CONFIG_USB_EHCI_HCD
  #define CONFIG_USB_OHCI_NEW
  #define CONFIG_USB_OHCI_SUNXI
  #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
@@ -326,13 +326,11 @@ extern int soft_i2c_gpio_scl;
  #endif

  #ifdef CONFIG_USB_MUSB_SUNXI
-#define CONFIG_USB_MUSB_HOST
  #define CONFIG_USB_MUSB_PIO_ONLY
  #endif

-#if defined CONFIG_USB_EHCI || defined CONFIG_USB_MUSB_SUNXI
+#if defined CONFIG_USB_EHCI_HCD || defined CONFIG_USB_MUSB_HOST
  #define CONFIG_CMD_USB
-#define CONFIG_USB_STORAGE
  #endif

  #ifdef CONFIG_USB_KEYBOARD
@@ -384,7 +382,7 @@ extern int soft_i2c_gpio_scl;
  #define BOOT_TARGET_DEVICES_SCSI(func)
  #endif

-#ifdef CONFIG_USB_EHCI
+#ifdef CONFIG_USB_STORAGE
  #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
  #else
  #define BOOT_TARGET_DEVICES_USB(func)


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] USB and unbinding

2015-07-21 Thread Hans de Goede

Hi,

On 07/20/2015 05:49 PM, Simon Glass wrote:

Hi Hans,

On 20 July 2015 at 09:31, Hans de Goede hdego...@redhat.com wrote:

Hi,

On 20-07-15 04:23, Simon Glass wrote:


Hi Hans,

I've been thinking about the USB unbinding code. I know that I agreed
to go with it, but in retrospect I think that was a mistake.

I believe we should separate out the unbinding and make it an option,
so that it is not required in order to use USB. In effect this makes
one of driver model's design goals (the option to drop unused code)
useless since USB is a common interface.

If I recall the only problem the lack of unbinding caused was that the
keyboard driver broke. I suspect it broke in a way that can be fixed.
In fact I recently converted usb_ether to driver model and I'm willing
to do the keyboard side also.

I'd like the USB code to function with or without the unbinding (i.e.
it uses it if there). What do you think?



I strongly believe that unbinding is the proper thing todo for usb since
it is a hotplug bus.

IMHO the way the usb_find_emul_child() function was used before to re-use
udevice-s after e.g. a usb reset was an ugly hack which just happened to
work, but it in no way reflects reality.

More importantly we need unbind support to properly stop usb controllers
when
booting the OS, so that they are not DMA-ing to/from their scratch-ram area
in DRAM when the main OS boots, so not having unbind support combined with
USB really is a no no.

This is why I suggested to simply select the unbind Kconfig when USB is
selected in Kconfig.


I think you are referring to remove(), not unbind().


Right I mean that the remove callback *must* be called on usb_stop to avoid
the usb controller dma-ing over random DRAM when the OS starts.


Although we might
consider spiting them so we have a DM_DEVICE_REMOVE and a separate
DM_DEVICE_UNBIND.



The actual unbind core code is not that big, so I believe that the best
solution is to always build the core if either DM_DEVICE_REMOVE *or*
DM_USB is selected, and non USB drivers can leave out their unbind
code if DM_DEVICE_REMOVE is not set, that should still give us most of
the size savings without needing to do ugly hacks for USB.


My main objection is that we tie USB such that it *will not work*
unless we support unbinding. I'm fine with it being recommended, but
core driver model features should be independent of subsystems. This
also seems quite unnecessary. Re your common about the 'ugly hack that
just happened to work', in principle we can just keep on creating new
devices and ignore the old ones.


That will still cause problems with code addressing the usb-devices
by index, as the old devices will still be there.


That's the idea behind not supporting
unbinding. There should be no problem with this approach.


This approach will only work if find_child_devnum is fixed to search
backwards through the childs list, so that it will check the newly
added nodes first.


So I'd like to adjust the USB code so that it still works without
unbinding, even if it is not optimal. I think that is the right thing
to do in this case.


As said, the remove callback of usb-host drivers *must* always be called,
other then that if you can make things work without unbind that is
fine with me.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] USB and unbinding

2015-07-20 Thread Hans de Goede

Hi,

On 20-07-15 04:23, Simon Glass wrote:

Hi Hans,

I've been thinking about the USB unbinding code. I know that I agreed
to go with it, but in retrospect I think that was a mistake.

I believe we should separate out the unbinding and make it an option,
so that it is not required in order to use USB. In effect this makes
one of driver model's design goals (the option to drop unused code)
useless since USB is a common interface.

If I recall the only problem the lack of unbinding caused was that the
keyboard driver broke. I suspect it broke in a way that can be fixed.
In fact I recently converted usb_ether to driver model and I'm willing
to do the keyboard side also.

I'd like the USB code to function with or without the unbinding (i.e.
it uses it if there). What do you think?


I strongly believe that unbinding is the proper thing todo for usb since
it is a hotplug bus.

IMHO the way the usb_find_emul_child() function was used before to re-use
udevice-s after e.g. a usb reset was an ugly hack which just happened to
work, but it in no way reflects reality.

More importantly we need unbind support to properly stop usb controllers when
booting the OS, so that they are not DMA-ing to/from their scratch-ram area
in DRAM when the main OS boots, so not having unbind support combined with
USB really is a no no.

This is why I suggested to simply select the unbind Kconfig when USB is
selected in Kconfig.

The actual unbind core code is not that big, so I believe that the best
solution is to always build the core if either DM_DEVICE_REMOVE *or*
DM_USB is selected, and non USB drivers can leave out their unbind
code if DM_DEVICE_REMOVE is not set, that should still give us most of
the size savings without needing to do ugly hacks for USB.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] u-boot-with-spl.bin don't include the dtb image when enable CONFIG_OF_SEPARATE

2015-07-19 Thread Hans de Goede

Hi,

On 16-07-15 01:17, Simon Glass wrote:

Hi,

On 15 July 2015 at 02:42, Wang Haikun haikun.w...@freescale.com wrote:

Hi Simon,

It seems that we don't update the source image name to u-boot-dtb.bin in
case of enabling CONFIG_OF_SEPARATE when generate u-boot-with-spl.bin file.


ifdef CONFIG_TPL
SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
else
SPL_PAYLOAD := u-boot.bin
endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
  --pad-to=$(CONFIG_SPL_PAD_TO)
u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
   $(call if_changed,pad_cat)



At least for sunxi this worked for me. But perhaps sunxi is a special
case?


Yes I believe that sunxi has special code for this since we need to run
an utility to add a header to the spl binary.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-19 Thread Hans de Goede

Hi,

On 13-07-15 16:16, Bin Liu wrote:

Hi,

On 07/11/2015 08:04 AM, Hans de Goede wrote:

Hi,

On 10-07-15 17:31, Bin Liu wrote:

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for
full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...


Sorry I was too fast. CONFIG_USB_FULLSPEED_ONLY is IMHO not acceptable
as it is not granular enough. sunxi boards have both EHCI/OHCI usb
controller
pairs for host ports and an musb controller. One may be limited to
fullspeed
while the other is not.

Likewise I can see a case where some ports but not all ports are fullspeed
only, so we still want to build the gadged code with dual-speed
descriptors.


Good point.



I really believe that something like:

CONFIG_MUSB_FULLSPEED_ONLY


I am not sure like the idea of using two macros in config.h to control one thing. 
Please review the following patch which uses CONFIG_USB_GADGET_DUALSPEED and 
musb-board_mode instead. Beware that this patch is not tested.


The 2 macros do not control one thing, it is for example perfectly possible
to have multiple otg controllers, one which can only do fullspeed and one
which can do both high/full speed in this case one will want to build
the gadget code in dualspeed mode even though one of the usb controllers
is fullspeed only.

Regards,

Hans








diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index eeaacdf..55d1c20 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -931,6 +931,7 @@ void musb_start(struct musb *musb)
  {
 void __iomem*regs = musb-mregs;
 u8  devctl = musb_readb(regs, MUSB_DEVCTL);
+   u8  power;

 dev_dbg(musb-controller, == devctl %02x\n, devctl);

@@ -942,11 +943,12 @@ void musb_start(struct musb *musb)
 musb_writeb(regs, MUSB_TESTMODE, 0);

 /* put into basic highspeed mode and start session */
-   musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
-   | MUSB_POWER_HSENAB
-   /* ENSUSPEND wedges tusb */
-   /* | MUSB_POWER_ENSUSPEND */
-   );
+   power = MUSB_POWER_ISOUPDATE | MUSB_POWER_HSENAB;
+#ifndef CONFIG_USB_GADGET_DUALSPEED
+   if (musb-board_mode != MUSB_HOST)
+   power = ~MUSB_POWER_HSENAB;
+#endif
+   musb_writeb(regs, MUSB_POWER, power);

 musb-is_active = 0;
 devctl = musb_readb

Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-11 Thread Hans de Goede

Hi,

On 10-07-15 17:31, Bin Liu wrote:

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...


This works for me, as long as the submitter of this change ensures that
things do not regress for existing musb users, such as all sunxi boards,
which would have regressed with the original patch.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-11 Thread Hans de Goede

Hi,

On 10-07-15 17:31, Bin Liu wrote:

Hi,

On 07/10/2015 10:12 AM, Heiko Schocher wrote:

Hello Samuel,

Am 10.07.2015 um 16:50 schrieb Egli, Samuel:

Hi Hans,


-Original Message- From: Hans de Goede
[mailto:hdego...@redhat.com] Sent: Freitag, 10. Juli 2015 16:37
To: Egli, Samuel; ma...@denx.de Cc: u-boot@lists.denx.de;
tr...@konsulko.com; Bin Liu; Meier, Roger; Daniel Mack Subject:
Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if
CONFIG_USB_GADGET_DUALSPEED is not set, in which case Ether
gadget only operates in fullspeed.

Note: This patch is necessary for devices like some siemens
boards that allow only FULL SPEED USB 1.1, e.g. DFU
download.

Signed-off-by: Bin Liu b-...@ti.com Reviewed-by: Tom Rini
tr...@konsulko.com Tested-by: Samuel Egli
samuel.e...@siemens.com CC: Marek Vasut ma...@denx.de CC:
Heiko Schocher h...@denx.de CC: Daniel Mack
zon...@gmail.com CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb in
host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


My bad, I had a short thought about this when I was initially working on
this patch, but did not really think about it throughly. Thanks for
bring it up.



p.s.

Given that you want to use this as a hack to work around the
broken pcb design of your board I suggest adding a new option for
this


Well, lets not discuss the broken pcb design. It seems that
wiring protection is not that common. Unfortunately, such a
protection is too expensive for USB High speed :-(.


Agreed, we have seen many cases that have nothing to do with hardware
design, but MUSB has to work in full-speed mode.




titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED | MUSB_POWER_HSENAB
+#endif


This would be good enough. The point is indeed to limit it to full
speed.


Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since
this has nothing to do with enabling dualspeed mode for the
gadget code really.


I agree that the name is confusing.


Yes, I vote for Hans suggestion.


*Adding* a new macro CONFIG_USB_MUSB_NO_HIGHSPEED for musb driver causes
CONFIG_USB_GADGET_DUALSPEED redundant, because both control for full-speed.

I suggest to *rename* CONFIG_USB_GADGET_DUALSPEED to
CONFIG_USB_FULLSPEED_ONLY. So that we can use one macro for both gadget
and musb drivers. Considering supper-speed exists and future, I think
CONFIG_USB_NO_HIGHSPEED is confusing...


Sorry I was too fast. CONFIG_USB_FULLSPEED_ONLY is IMHO not acceptable
as it is not granular enough. sunxi boards have both EHCI/OHCI usb controller
pairs for host ports and an musb controller. One may be limited to fullspeed
while the other is not.

Likewise I can see a case where some ports but not all ports are fullspeed
only, so we still want to build the gadged code with dual-speed descriptors.

I really believe that something like:

CONFIG_MUSB_FULLSPEED_ONLY

Is what we need here, as that sets things at the granularity which we may
need in some cases.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-10 Thread Hans de Goede

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if CONFIG_USB_GADGET_DUALSPEED
is not set, in which case Ether gadget only operates in fullspeed.

Note:
This patch is necessary for devices like some siemens boards
that allow only FULL SPEED USB 1.1, e.g. DFU download.

Signed-off-by: Bin Liu b-...@ti.com
Reviewed-by: Tom Rini tr...@konsulko.com
Tested-by: Samuel Egli samuel.e...@siemens.com
CC: Marek Vasut ma...@denx.de
CC: Heiko Schocher h...@denx.de
CC: Daniel Mack zon...@gmail.com
CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb
in host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.

Regards,

Hans



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

diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 242cc30..4edd6d7 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -942,7 +942,9 @@ void musb_start(struct musb *musb)

/* put into basic highspeed mode and start session */
musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
+#ifdef CONFIG_USB_GADGET_DUALSPEED
| MUSB_POWER_HSENAB
+#endif
/* ENSUSPEND wedges tusb */
/* | MUSB_POWER_ENSUSPEND */
);
--
1.7.10.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] musb: set MUSB speed based on CONFIG

2015-07-10 Thread Hans de Goede

Hi,

On 10-07-15 16:30, Hans de Goede wrote:

Hi,

On 10-07-15 15:16, Samuel Egli wrote:

From: Bin Liu b-...@ti.com

Do not config MUSB to highspeed mode if CONFIG_USB_GADGET_DUALSPEED
is not set, in which case Ether gadget only operates in fullspeed.

Note:
This patch is necessary for devices like some siemens boards
that allow only FULL SPEED USB 1.1, e.g. DFU download.

Signed-off-by: Bin Liu b-...@ti.com
Reviewed-by: Tom Rini tr...@konsulko.com
Tested-by: Samuel Egli samuel.e...@siemens.com
CC: Marek Vasut ma...@denx.de
CC: Heiko Schocher h...@denx.de
CC: Daniel Mack zon...@gmail.com
CC: Roger Meier r.me...@siemens.com


Nack this breaks highspeed mode on boards which use the musb
in host mode, and thus do not set CONFIG_USB_GADGET_DUALSPEED.


p.s.

Given that you want to use this as a hack to work around the broken
pcb design of your board I suggest adding a new option for this
titled: CONFIG_USB_MUSB_NO_HIGHSPEED and then do:

+#ifndef CONFIG_USB_MUSB_NO_HIGHSPEED
   | MUSB_POWER_HSENAB
+#endif

Using CONFIG_USB_GADGET_DUALSPEED for this seems wrong, since this
has nothing to do with enabling dualspeed mode for the gadget code
really.

Regards,

Hans




Regards,

Hans



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

diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 242cc30..4edd6d7 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -942,7 +942,9 @@ void musb_start(struct musb *musb)

  /* put into basic highspeed mode and start session */
  musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
+#ifdef CONFIG_USB_GADGET_DUALSPEED
  | MUSB_POWER_HSENAB
+#endif
  /* ENSUSPEND wedges tusb */
  /* | MUSB_POWER_ENSUSPEND */
  );
--
1.7.10.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found

2015-07-08 Thread Hans de Goede

Hi Simon,

On 07-07-15 09:00, Hans de Goede wrote:

Hi,

On 06-07-15 18:39, Simon Glass wrote:

Hi Hans,

On 5 July 2015 at 12:56, Hans de Goede hdego...@redhat.com wrote:

Some boards simply do not have any serial ports. Also no one will see the
panic message as there is no where to print it if no serial port is found
(and other stdout options are not yet set up at this point).



It is visible (or will be when some patches land) if you have a debug
UART set up.


Ok.


Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/serial/serial-uclass.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 815fec3..f036499 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] = 
CONFIG_SYS_BAUDRATE_TABLE;
  #error Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to 
make this work
  #endif

-static void serial_find_console_or_panic(void)
+static void serial_find_console(void)
  {
 struct udevice *dev;
 int node;
@@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
 }
  #undef INDEX
 }
-
-   panic_str(No serial driver found);
  }

  /* Called prior to relocation */
  int serial_init(void)
  {
-   serial_find_console_or_panic();
+   serial_find_console();
 gd-flags |= GD_FLG_SERIAL_READY;

 return 0;
@@ -93,7 +91,7 @@ int serial_init(void)
  /* Called after relocation */
  void serial_initialize(void)
  {
-   serial_find_console_or_panic();
+   serial_find_console();
  }

  static void _serial_putc(struct udevice *dev, char ch)


How is this handled before driver model?


It was not, the boards involved all use the A13 SoC which is the
same die as the A10s but then in a different (cheaper) package
with way less pins. As such uart0 is not routed to the outside
on the A13. When not setting CONFIG_DM_SERIAL we are simply using
uart0 as serial console, and that ends at the bonding pads at the
edge of the die. doing things that way is not really useful,
but there is a serial console and u-boot is happy.

In the non devicetree world this sort of was a natural hack, we
simply left CONSOLE_INDEX undefined for these boards, which causes
it to default to 1 / uart0 and things just work. I had never given
this much thought until moving to devicetree.

As you can hopefully understand I do not want to do the samething
with DM_SERIAL builds as that would require hacking up the dts
to add a node for hardware which is effectively disabled for the
A13 package of the sun5i die.

  It is possible to mark a

device disabled in device tree - perhaps we should have a way to see
that the console is present (i.e. there is an alias) but it is
disabled?


That seems rather ugly, I really do not want to add an alias to
a non enabled device, that just feels wrong on all levels.


Normally a serial console is required, so I'd like to preserve this
behaviour for most boards.


Ok, I actually expected as much, this was actually my second solution
for the problem at hand, but as it was the simplest solution I decided
to submit this version first. My first / original solution is to add a
CONFIG_DM_SERIAL_NO_PANIC Kconfig option which can then be set on boards
which have no serial port.

Or probably better a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE option ?

This option would disable the panic / disable probing all together while
we would keep using DM_SERIAL on these boards, because:

1) Consistency I really want to use DM_FOO everywhere for sunxi
2) The non dm serial code cannot handle not having a serial port either,
and fixing it looks like it is going to be a bit harder (from a quick
glance).


You probably just have not gotten around to this yet, but in case it is
not clear, the above solution (adding a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE
Kconfig option) is a suggestion on how to fix. I'll happily implement this
if people like it, but atm I'm waiting for feedback on the suggestion.

Regards,

Hans

p.s.

I'm on vacation from July 11th - July 19th, so if I'm quiet that is why :)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-sunxi master (bugfix for v2015.07)

2015-07-08 Thread Hans de Goede

Hi Tom,

One of the sunxi dts files for a new board got merged into the
upstream kernel under a different name than that it was originally
submitted with. This pull-req contains a single patch adjusting
the name in u-boot, so that we do not end up shipping a u-boot
which looks for a differently named .dtb file then the kernel
ships with.

The following changes since commit 0a888f584c48984cb9657a5d42dc994b33c264a7:

  ARM: DRA72x: fix io delay calibration for ethernet (2015-07-07 20:15:52 -0400)

are available in the git repository at:

  http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to 8fa2e20913183133998cbbb78a5184bd20ccfcbe:

  sunxi: Adjust Ippo_q8h_v1_2_a33_1024x600 dts filename to match the upstream 
kernel (2015-07-08 16:21:27 +0200)


Hans de Goede (1):
  sunxi: Adjust Ippo_q8h_v1_2_a33_1024x600 dts filename to match the 
upstream kernel

 arch/arm/dts/Makefile   | 2 +-
 ...8i-a33-ippo-q8h-v1.2-lcd1024x600.dts = sun8i-a33-ippo-q8h-v1.2.dts} | 0
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig| 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename arch/arm/dts/{sun8i-a33-ippo-q8h-v1.2-lcd1024x600.dts = 
sun8i-a33-ippo-q8h-v1.2.dts} (100%)

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found

2015-07-08 Thread Hans de Goede

Hi,

On 08-07-15 16:08, Simon Glass wrote:

+Masahiro

Hi Hans,

On 8 July 2015 at 05:56, Hans de Goede hdego...@redhat.com wrote:

Hi Simon,


On 07-07-15 09:00, Hans de Goede wrote:


Hi,

On 06-07-15 18:39, Simon Glass wrote:


Hi Hans,

On 5 July 2015 at 12:56, Hans de Goede hdego...@redhat.com wrote:


Some boards simply do not have any serial ports. Also no one will see
the
panic message as there is no where to print it if no serial port is
found
(and other stdout options are not yet set up at this point).



It is visible (or will be when some patches land) if you have a debug
UART set up.



Ok.


Signed-off-by: Hans de Goede hdego...@redhat.com
---
   drivers/serial/serial-uclass.c | 8 +++-
   1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/serial-uclass.c
b/drivers/serial/serial-uclass.c
index 815fec3..f036499 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] =
CONFIG_SYS_BAUDRATE_TABLE;
   #error Serial is required before relocation - define
CONFIG_SYS_MALLOC_F_LEN to make this work
   #endif

-static void serial_find_console_or_panic(void)
+static void serial_find_console(void)
   {
  struct udevice *dev;
  int node;
@@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
  }
   #undef INDEX
  }
-
-   panic_str(No serial driver found);
   }

   /* Called prior to relocation */
   int serial_init(void)
   {
-   serial_find_console_or_panic();
+   serial_find_console();
  gd-flags |= GD_FLG_SERIAL_READY;

  return 0;
@@ -93,7 +91,7 @@ int serial_init(void)
   /* Called after relocation */
   void serial_initialize(void)
   {
-   serial_find_console_or_panic();
+   serial_find_console();
   }

   static void _serial_putc(struct udevice *dev, char ch)



How is this handled before driver model?



It was not, the boards involved all use the A13 SoC which is the
same die as the A10s but then in a different (cheaper) package
with way less pins. As such uart0 is not routed to the outside
on the A13. When not setting CONFIG_DM_SERIAL we are simply using
uart0 as serial console, and that ends at the bonding pads at the
edge of the die. doing things that way is not really useful,
but there is a serial console and u-boot is happy.

In the non devicetree world this sort of was a natural hack, we
simply left CONSOLE_INDEX undefined for these boards, which causes
it to default to 1 / uart0 and things just work. I had never given
this much thought until moving to devicetree.

As you can hopefully understand I do not want to do the samething
with DM_SERIAL builds as that would require hacking up the dts
to add a node for hardware which is effectively disabled for the
A13 package of the sun5i die.

   It is possible to mark a


device disabled in device tree - perhaps we should have a way to see
that the console is present (i.e. there is an alias) but it is
disabled?



That seems rather ugly, I really do not want to add an alias to
a non enabled device, that just feels wrong on all levels.


Normally a serial console is required, so I'd like to preserve this
behaviour for most boards.



Ok, I actually expected as much, this was actually my second solution
for the problem at hand, but as it was the simplest solution I decided
to submit this version first. My first / original solution is to add a
CONFIG_DM_SERIAL_NO_PANIC Kconfig option which can then be set on boards
which have no serial port.

Or probably better a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE option ?

This option would disable the panic / disable probing all together while
we would keep using DM_SERIAL on these boards, because:

1) Consistency I really want to use DM_FOO everywhere for sunxi
2) The non dm serial code cannot handle not having a serial port either,
 and fixing it looks like it is going to be a bit harder (from a quick
 glance).



You probably just have not gotten around to this yet, but in case it is
not clear, the above solution (adding a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE
Kconfig option) is a suggestion on how to fix. I'll happily implement this
if people like it, but atm I'm waiting for feedback on the suggestion.



I've been thinking about it. Perhaps an option to allow U-Boot to run
without a console is best. But instead of CONFIG_DM_SERIAL_NO_PANIC,
perhaps we could have CONFIG_REQUIRE_CONSOLE which is normally y.


That works for me, although I would prefer CONFIG_REQUIRE_SERIAL_CONSOLE,
the boards in question do have a console in the form of a cfb console.

Regards,

Hans

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] sunxi: usb-phy: Never power off the usb ports

2015-07-08 Thread Hans de Goede
USB devices are not really designed to get the power bounced off and on
at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a usb reset and when
booting the kernel, causing the usb-power to bounce off and then back
on again.

This patch removes the powering off calls, fixing the undesirable power
bouncing.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/cpu/armv7/sunxi/usb_phy.c| 17 -
 arch/arm/include/asm/arch-sunxi/usb_phy.h |  1 -
 drivers/usb/host/ehci-sunxi.c |  1 -
 drivers/usb/host/ohci-sunxi.c |  1 -
 drivers/usb/musb-new/sunxi.c  |  3 ---
 5 files changed, 23 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c 
b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index 4d63a74..74d251d 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -47,7 +47,6 @@ static struct sunxi_usb_phy {
int gpio_id_det;
int id;
int init_count;
-   int power_on_count;
 } sunxi_usb_phy[] = {
{
.usb_rst_mask = CCM_USB_CTRL_PHY0_RST | CCM_USB_CTRL_PHY0_CLK,
@@ -212,26 +211,10 @@ void sunxi_usb_phy_power_on(int index)
 {
struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
 
-   phy-power_on_count++;
-   if (phy-power_on_count != 1)
-   return;
-
if (phy-gpio_vbus = 0)
gpio_set_value(phy-gpio_vbus, 1);
 }
 
-void sunxi_usb_phy_power_off(int index)
-{
-   struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
-
-   phy-power_on_count--;
-   if (phy-power_on_count != 0)
-   return;
-
-   if (phy-gpio_vbus = 0)
-   gpio_set_value(phy-gpio_vbus, 0);
-}
-
 int sunxi_usb_phy_vbus_detect(int index)
 {
struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
diff --git a/arch/arm/include/asm/arch-sunxi/usb_phy.h 
b/arch/arm/include/asm/arch-sunxi/usb_phy.h
index 17d31b8..89a287c 100644
--- a/arch/arm/include/asm/arch-sunxi/usb_phy.h
+++ b/arch/arm/include/asm/arch-sunxi/usb_phy.h
@@ -15,7 +15,6 @@ int sunxi_usb_phy_remove(void);
 void sunxi_usb_phy_init(int index);
 void sunxi_usb_phy_exit(int index);
 void sunxi_usb_phy_power_on(int index);
-void sunxi_usb_phy_power_off(int index);
 int sunxi_usb_phy_vbus_detect(int index);
 int sunxi_usb_phy_id_detect(int index);
 void sunxi_usb_phy_enable_squelch_detect(int index, int enable);
diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
index 34130f8..38d5f92 100644
--- a/drivers/usb/host/ehci-sunxi.c
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -67,7 +67,6 @@ static int ehci_usb_remove(struct udevice *dev)
if (ret)
return ret;
 
-   sunxi_usb_phy_power_off(priv-phy_index);
sunxi_usb_phy_exit(priv-phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index e33a8f7..6079272 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -69,7 +69,6 @@ static int ohci_usb_remove(struct udevice *dev)
if (ret)
return ret;
 
-   sunxi_usb_phy_power_off(priv-phy_index);
sunxi_usb_phy_exit(priv-phy_index);
 
 #ifdef CONFIG_SUNXI_GEN_SUN6I
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 3a29b18..702c592 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -233,9 +233,6 @@ static void sunxi_musb_disable(struct musb *musb)
if (!enabled)
return;
 
-   if (is_host_enabled(musb))
-   sunxi_usb_phy_power_off(0); /* port power off */
-
USBC_ForceVbusValidToLow(musb-mregs);
mdelay(200); /* Wait for the current session to timeout */
 
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] sunxi: usb-phy: Never power off the usb ports

2015-07-08 Thread Hans de Goede

Hi,

On 08-07-15 17:02, Marek Vasut wrote:

On Wednesday, July 08, 2015 at 04:54:07 PM, Hans de Goede wrote:

USB devices are not really designed to get the power bounced off and on
at them. Esp. USB powered harddisks do not like this.

Currently we power off the USB ports both on a usb reset and when
booting the kernel, causing the usb-power to bounce off and then back
on again.

This patch removes the powering off calls, fixing the undesirable power
bouncing.

Signed-off-by: Hans de Goede hdego...@redhat.com


Shall I pick this through u-boot-usb or would you like this to go through
u-boot-sunxi ? Recently, I feel a bit left out :-)


Heh, sorry but we've a bunch of other sunxi/usb mixed patches already
queued up, so I think it is best if I take this one through the sunxi
tree to avoid conflicts.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found

2015-07-07 Thread Hans de Goede

Hi,

On 06-07-15 18:39, Simon Glass wrote:

Hi Hans,

On 5 July 2015 at 12:56, Hans de Goede hdego...@redhat.com wrote:

Some boards simply do not have any serial ports. Also no one will see the
panic message as there is no where to print it if no serial port is found
(and other stdout options are not yet set up at this point).



It is visible (or will be when some patches land) if you have a debug
UART set up.


Ok.


Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/serial/serial-uclass.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 815fec3..f036499 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] = 
CONFIG_SYS_BAUDRATE_TABLE;
  #error Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN to 
make this work
  #endif

-static void serial_find_console_or_panic(void)
+static void serial_find_console(void)
  {
 struct udevice *dev;
 int node;
@@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
 }
  #undef INDEX
 }
-
-   panic_str(No serial driver found);
  }

  /* Called prior to relocation */
  int serial_init(void)
  {
-   serial_find_console_or_panic();
+   serial_find_console();
 gd-flags |= GD_FLG_SERIAL_READY;

 return 0;
@@ -93,7 +91,7 @@ int serial_init(void)
  /* Called after relocation */
  void serial_initialize(void)
  {
-   serial_find_console_or_panic();
+   serial_find_console();
  }

  static void _serial_putc(struct udevice *dev, char ch)


How is this handled before driver model?


It was not, the boards involved all use the A13 SoC which is the
same die as the A10s but then in a different (cheaper) package
with way less pins. As such uart0 is not routed to the outside
on the A13. When not setting CONFIG_DM_SERIAL we are simply using
uart0 as serial console, and that ends at the bonding pads at the
edge of the die. doing things that way is not really useful,
but there is a serial console and u-boot is happy.

In the non devicetree world this sort of was a natural hack, we
simply left CONSOLE_INDEX undefined for these boards, which causes
it to default to 1 / uart0 and things just work. I had never given
this much thought until moving to devicetree.

As you can hopefully understand I do not want to do the samething
with DM_SERIAL builds as that would require hacking up the dts
to add a node for hardware which is effectively disabled for the
A13 package of the sun5i die.

 It is possible to mark a

device disabled in device tree - perhaps we should have a way to see
that the console is present (i.e. there is an alias) but it is
disabled?


That seems rather ugly, I really do not want to add an alias to
a non enabled device, that just feels wrong on all levels.


Normally a serial console is required, so I'd like to preserve this
behaviour for most boards.


Ok, I actually expected as much, this was actually my second solution
for the problem at hand, but as it was the simplest solution I decided
to submit this version first. My first / original solution is to add a
CONFIG_DM_SERIAL_NO_PANIC Kconfig option which can then be set on boards
which have no serial port.

Or probably better a CONFIG_DM_SERIAL_NO_SERIAL_CONSOLE option ?

This option would disable the panic / disable probing all together while
we would keep using DM_SERIAL on these boards, because:

1) Consistency I really want to use DM_FOO everywhere for sunxi
2) The non dm serial code cannot handle not having a serial port either,
   and fixing it looks like it is going to be a bit harder (from a quick
   glance).

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/4] musb device model support series

2015-07-05 Thread Hans de Goede

Hi,

On 01-07-15 21:47, Simon Glass wrote:

Hi Hans,

On 1 July 2015 at 12:52, Hans de Goede hdego...@redhat.com wrote:


Hi Simon, Marek,

Here is a series with just the patches which needed work after my v1
posting of this series.

I've a rebased version of the entire series (some patches needed adjustment
after the recent Kconfig / defconfig changes) in my personal tree.

Simon, AFAIK the plan is still for this to go upstream through your tree,
let me know when you're ready to take this series, and on which branch you
want it based, and I'll create a branch for you to pull.


Do you mean I should apply the entire series, or just the first 15 patches?


My initial intention was for you to take the entire series, but given
the recent Kconfig changes and conflicts in the sunxi bits I think it
is best if you just take the dm/usb and musb device-model conversion
patches. Then I'll merge the sunxi bits after u-boot-dm/next has
been merged.


I've set up a u-boot-dm/next. I'm planning to do that again to speed
up merging when the window opens.

But I'd prefer to take patches from patchwork - can I just do that?


Yes that should work. Note that my v2 series introduces a few new patches
as a result of your review of v1, so the entire series I would like you
to merge is (in order they should be merged):

usb: Drop device-model specific copy of usb_legacy_port_reset
usb: usb_setup_device: Drop unneeded portnr function argument
usb: Pass device instead of portnr to usb_legacy_port_reset
usb: Add an usb_device parameter to usb_reset_root_port
dm: Export device_remove_children / device_unbind_children (v2)
dm: usb: Fix usb tree output
dm: usb: Document that mixing DM_DEVICE_REMOVE and DM_USB is a bad idea (v2)
dm: usb: Use device_unbind_children to clean up usb devs on stop (v2)
dm: usb: Rename usb_find_child to usb_find_emul_child (v2)
dm: usb: Allow usb host drivers to implement usb_reset_root_port
dm: usb: Do not assume that first child is always a hub
musb: Allow musb_platform_enable to return an error code
musb: Update usb-compat to work with struct usb_device without a parent ptr
musb: Rename and wrap public functions
musb: Add musb_host_data struct to hold global data
musb: Add device-model support to the musb-host u-boot glue

I think you should be able to pick these from patchwork without
issues. Let me know if you hit any problems, then I will post a v3
of the entire series re-based on top of u-boot-dm/next.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-sunxi master (take 2)

2015-07-05 Thread Hans de Goede

Hi Tom,

Here is a rebased / fixed version of my previous pull-req for
two bug-fixes, and one new board.

Since the first one was no good I've done a forced push with
the new one to u-boot-sunxi/master .

The following changes since commit 891b487098ee2169a16b1bbb354aaef28aa90630:

  Merge branch 'master' of git://git.denx.de/u-boot-spi (2015-07-01 15:38:12 
-0400)

are available in the git repository at:

  http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to 4e87398fcc946c076339e8ed9bf1cc576fd42cf7:

  sunxi: Add Sinlinx SinA33 defconfig (2015-07-05 11:32:11 +0200)


Chen-Yu Tsai (5):
  sunxi: hardware-feature-specific function index defines for PORT F UART0
  sunxi: rsb: Enable R_PIO clock before configuring external pins
  sunxi: Add support for UART0 in PB pin group on A33
  sunxi: Sync sun8i dts files with the linux kernel
  sunxi: Add Sinlinx SinA33 defconfig

 arch/arm/cpu/armv7/sunxi/board.c  |  12 ++-
 arch/arm/cpu/armv7/sunxi/rsb.c|   5 +-
 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/sun8i-a23-a33.dtsi   |  10 +++
 arch/arm/dts/sun8i-a33-sinlinx-sina33.dts | 129 ++
 arch/arm/dts/sun8i-a33.dtsi   |   8 ++
 arch/arm/include/asm/arch-sunxi/gpio.h|   1 +
 board/sunxi/MAINTAINERS   |   6 ++
 configs/Sinlinx_SinA33_defconfig  |  16 
 9 files changed, 183 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/sun8i-a33-sinlinx-sina33.dts
 create mode 100644 configs/Sinlinx_SinA33_defconfig

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] sunxi: Fix wrong pinmux names in arch/arm/cpu/armv7/sunxi/board.c

2015-07-05 Thread Hans de Goede

Hi Tom,

On 29-06-15 23:03, Karsten Merker wrote:

Commit 487b3277d4f70bcb2e4a1930beb6438565f25910
(sunxi: GPIO pin mux hardware-feature-specific function index defines)
has removed and/or changed the names of various pinmux definitions,
but has missed two instances in arch/arm/cpu/armv7/sunxi/board.c that
still refer to the old-style names, which can now no longer be resolved.
Use the new-style pinmux names instead.

Signed-off-by: Karsten Merker mer...@debian.org


Thanks for the patch, I already had the exact same patch from ChenYu
queued up, and even send a pull-req for it, but that bounced due to
conflicts. I've just send a new pull-req for v2015.07 with ChenYu's
fix in there, so this should be fixed for the next rc.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] sunxi: Update selects in arch/arm/Kconfig for DM conversions

2015-07-05 Thread Hans de Goede
From: Tom Rini tr...@konsulko.com

With certain features being convert to DM now we want sunxi to default
to having DM enabled for ETH/SERIAL and USB in some cases.

Cc: Hans de Goede hdego...@redhat.com
Cc: Ian Campbell i...@hellion.org.uk
Signed-off-by: Tom Rini tr...@konsulko.com
[hdego...@redhat.com: Also select CONFIG_USB for all sunxi builds]
Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/Kconfig | 4 
 configs/A10-OLinuXino-Lime_defconfig | 7 ++-
 configs/A10s-OLinuXino-M_defconfig   | 7 ++-
 configs/A13-OLinuXinoM_defconfig | 7 ++-
 configs/A13-OLinuXino_defconfig  | 7 ++-
 configs/A20-OLinuXino-Lime2_defconfig| 7 ++-
 configs/A20-OLinuXino-Lime_defconfig | 7 ++-
 configs/A20-OLinuXino_MICRO_defconfig| 7 ++-
 configs/Ainol_AW1_defconfig  | 2 --
 configs/Ampe_A76_defconfig   | 2 --
 configs/Auxtek-T004_defconfig| 7 ++-
 configs/Bananapi_defconfig   | 7 ++-
 configs/Bananapro_defconfig  | 7 ++-
 configs/CSQ_CS908_defconfig  | 7 ++-
 configs/Chuwi_V7_CW0825_defconfig| 2 --
 configs/Colombus_defconfig   | 7 ++-
 configs/Cubieboard2_defconfig| 7 ++-
 configs/Cubieboard_defconfig | 7 ++-
 configs/Cubietruck_defconfig | 7 ++-
 configs/Et_q8_v1_6_defconfig | 2 --
 configs/Hummingbird_A31_defconfig| 7 ++-
 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   | 7 ++-
 configs/Linksprite_pcDuino3_defconfig| 7 ++-
 configs/Linksprite_pcDuino_defconfig | 7 ++-
 configs/MK808C_defconfig | 7 ++-
 configs/MSI_Primo73_defconfig| 4 
 configs/MSI_Primo81_defconfig| 3 ---
 configs/Marsboard_A10_defconfig  | 7 ++-
 configs/Mele_A1000G_quad_defconfig   | 7 ++-
 configs/Mele_A1000_defconfig | 7 ++-
 configs/Mele_I7_defconfig| 7 ++-
 configs/Mele_M3_defconfig| 7 ++-
 configs/Mele_M5_defconfig| 7 ++-
 configs/Mele_M9_defconfig| 7 ++-
 configs/Merrii_A80_Optimus_defconfig | 4 
 configs/Mini-X_defconfig | 7 ++-
 configs/Orangepi_defconfig   | 7 ++-
 configs/Orangepi_mini_defconfig  | 7 ++-
 configs/Sinlinx_SinA33_defconfig | 4 
 configs/TZX-Q8-713B7_defconfig   | 2 --
 configs/UTOO_P66_defconfig   | 1 -
 configs/Wexler_TAB7200_defconfig | 7 ++-
 configs/Wits_Pro_A20_DKT_defconfig   | 7 ++-
 configs/Yones_Toptech_BD1078_defconfig   | 2 --
 configs/ba10_tv_box_defconfig| 7 ++-
 configs/forfun_q88db_defconfig   | 2 --
 configs/ga10h_v1_1_defconfig | 2 --
 configs/i12-tvbox_defconfig  | 7 ++-
 configs/iNet_3F_defconfig| 2 --
 configs/iNet_3W_defconfig| 2 --
 configs/iNet_86VS_defconfig  | 2 --
 configs/jesurun_q5_defconfig | 7 ++-
 configs/mixtile_loftq_defconfig  | 7 ++-
 configs/mk802_a10s_defconfig | 7 ++-
 configs/mk802_defconfig  | 5 +
 configs/mk802ii_defconfig| 7 ++-
 configs/r7-tv-dongle_defconfig   | 7 ++-
 configs/sunxi_Gemei_G9_defconfig | 7 ++-
 62 files changed, 85 insertions(+), 250 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 192d9cf..c6202ee 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -646,9 +646,13 @@ config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
select DM_GPIO
+   select DM_ETH
+   select DM_SERIAL
+   select DM_USB if !USB_MUSB_SUNXI
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
+   select USB
 
 config TARGET_SNOWBALL
bool Support snowball
diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index 87ade90..0245bfc 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -7,11 +7,8 @@ CONFIG_SYS_CLK_FREQ=91200
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3

[U-Boot] [PATCH 1/3] dm: serial: Do not panic if no serial ports are found

2015-07-05 Thread Hans de Goede
Some boards simply do not have any serial ports. Also no one will see the
panic message as there is no where to print it if no serial port is found
(and other stdout options are not yet set up at this point).

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/serial/serial-uclass.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 815fec3..f036499 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -27,7 +27,7 @@ static const unsigned long baudrate_table[] = 
CONFIG_SYS_BAUDRATE_TABLE;
 #error Serial is required before relocation - define CONFIG_SYS_MALLOC_F_LEN 
to make this work
 #endif
 
-static void serial_find_console_or_panic(void)
+static void serial_find_console(void)
 {
struct udevice *dev;
int node;
@@ -77,14 +77,12 @@ static void serial_find_console_or_panic(void)
}
 #undef INDEX
}
-
-   panic_str(No serial driver found);
 }
 
 /* Called prior to relocation */
 int serial_init(void)
 {
-   serial_find_console_or_panic();
+   serial_find_console();
gd-flags |= GD_FLG_SERIAL_READY;
 
return 0;
@@ -93,7 +91,7 @@ int serial_init(void)
 /* Called after relocation */
 void serial_initialize(void)
 {
-   serial_find_console_or_panic();
+   serial_find_console();
 }
 
 static void _serial_putc(struct udevice *dev, char ch)
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] sunxi:Added difference MMC SLOT for booting

2015-07-05 Thread Hans de Goede

Hi,

On 29-06-15 11:48, ?? wrote:

 From 94a30632fb9db555b8dbfac4e46c922c73371960 Mon Sep 17 00:00:00 2001
From: Zhi Yuan Wan dv...@qq.com
Date: Thu, 25 Jun 2015 20:03:58 +0800
Subject: [PATCH 3/3] sunxi:Added difference MMC SLOT for booting
  Signed-off-by: Zhi Yuan Wan dv...@qq.com



There is a much simpler / easier way to do this, simply add a:

CONFIG_MMC_SUNXI_SLOT_EXTRA=2

Line to the defconfig, then an u-boot will be build which supports
booting from both the external sdcard slot as well as from the
emmc, and it will figure out where it is booting from and use
that as bootdevice itself.

Regards,

Hans



---
  board/sunxi/Kconfig|6 ++
  configs/Mele_I7_SD2_defconfig  |   16 
  include/configs/sunxi-common.h |2 ++
  3 files changed, 24 insertions(+)
  create mode 100644 configs/Mele_I7_SD2_defconfig

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index b2eca51..b711542 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -280,6 +280,12 @@ config MMC_SUNXI_SLOT_EXTRA
  slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
  support for this.

+config MMC_SUNXI_SLOT
+int default boot mmc slot number
+default 0
+---help---
+sunxi always boot from slot 0, but you still can modify the default 
setting of mmc slot number.
+
  config SPL_NAND_SUPPORT
  bool SPL/NAND mode support
  depends on SPL
diff --git a/configs/Mele_I7_SD2_defconfig b/configs/Mele_I7_SD2_defconfig
new file mode 100644
index 000..7fab694
--- /dev/null
+++ b/configs/Mele_I7_SD2_defconfig
@@ -0,0 +1,16 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN6I=y
+CONFIG_MMC_SUNXI_SLOT=2
+CONFIG_MMC_SUNXI_SLOT_EXTRA=0
+CONFIG_DRAM_ZQ=120
+CONFIG_USB1_VBUS_PIN=PC27
+CONFIG_USB2_VBUS_PIN=
+CONFIG_DEFAULT_DEVICE_TREE=sun6i-a31-i7
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS=USB_EHCI,SUNXI_GMAC
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_AXP221_DCDC1_VOLT=3300
+CONFIG_AXP221_DLDO1_VOLT=3300
+CONFIG_AXP221_DLDO4_VOLT=3300
+CONFIG_AXP221_ALDO1_VOLT=3300
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 07db736..b32c1bf 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -146,7 +146,9 @@
  #define CONFIG_GENERIC_MMC
  #define CONFIG_CMD_MMC
  #define CONFIG_MMC_SUNXI
+#ifndef CONFIG_MMC_SUNXI_SLOT
  #define CONFIG_MMC_SUNXI_SLOT0
+#endif
  #if !defined(CONFIG_SPL_NAND_SUPPORT)
  #define CONFIG_ENV_IS_IN_MMC
  #define CONFIG_SYS_MMC_ENV_DEV0/* first detected MMC controller */


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] sunxi:Added Mele i7 eMMC MOD DTS

2015-07-05 Thread Hans de Goede

Hi,

On 29-06-15 11:47, ?? wrote:

 From 83aa308eb836b0a63f0e30bd10d72040151a1e98 Mon Sep 17 00:00:00 2001
From: Zhi Yuan Wan dv...@qq.com
Date: Thu, 25 Jun 2015 20:00:46 +0800
Subject: [PATCH 2/3] sunxi:Added Mele i7 eMMC MOD DTS
  Signed-off-by: Zhi Yuan Wan dv...@qq.com

---
  arch/arm/dts/sun6i-a31-i7.dts |   10 ++
  configs/Mele_I7_defconfig |2 +-
  2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/sun6i-a31-i7.dts b/arch/arm/dts/sun6i-a31-i7.dts
index e9185da..1046864 100644
--- a/arch/arm/dts/sun6i-a31-i7.dts
+++ b/arch/arm/dts/sun6i-a31-i7.dts
@@ -51,6 +51,7 @@
  model = Mele I7 Quad top set box;
  compatible = mele,i7, allwinner,sun6i-a31;

+
  aliases {
  serial0 = uart0;
  };


Whitespace only change, please drop this bit.


@@ -107,6 +108,15 @@
  status = okay;
  };

+mmc2 {
+pinctrl-names = default;
+pinctrl-0 = mmc2_pins_a;
+vmmc-supply = reg_vcc3v3;
+bus-width = 4;
+non-removable;
+status = okay;
+};
+
  pio {
  led_pins_i7: led_pins@0 {
  allwinner,pins = PH13;


This bit looks good, but please submit dts file patches to the upstream
linux kernel first, using the standard kernel patch submission process.

Also as said before if your I7 version has an eMMC, please add
a new dts file for this titled: arch/arm/dts/sun6i-a31-mele-i7-emmc.dts .

Please submit this new file upstream.


diff --git a/configs/Mele_I7_defconfig b/configs/Mele_I7_defconfig
index bf67433..aad780b 100644
--- a/configs/Mele_I7_defconfig
+++ b/configs/Mele_I7_defconfig
@@ -1,7 +1,7 @@
  CONFIG_ARM=y
  CONFIG_ARCH_SUNXI=y
  CONFIG_MACH_SUN6I=y
-CONFIG_DRAM_ZQ=120
+CONFIG_DRAM_ZQ=251
  CONFIG_USB1_VBUS_PIN=PC27
  CONFIG_USB2_VBUS_PIN=
  CONFIG_DEFAULT_DEVICE_TREE=sun6i-a31-i7


This change is completely unrelated to the emmc changes, please
submit this as a separate patch. Please also explain why you are
making this change, where does the 251 value come from ?

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/3] sunxi: Update selects in arch/arm/Kconfig for DM

2015-07-05 Thread Hans de Goede
Hi All,

Here is a patch-set to cleanup the CONFIG_foo=y options which are present
in practically all sunxi defconfigs since Joe's latest patches.

Simon, the first patch in this patchset is necessary to be able to
use DM_SERIAL=y on all sunxi boards, without this things do not work
as some sunxi tablet motherboards do not have an uart (not even through
test pads), as all uart pins are used for other functions. Without this
these board will fail to boot due to a panic called from the dm serial
code. Can you please add this to u-boot-dm/next ? I'm assuming that you
prefer taking this upstream this way rather then through the sunxi tree.

The second patch is a slightly modified version of Tom's patch to cleanup
the sunxi defconfigs, and the 3th one is a patch I already had queued up
rebased on top of this, and with its commit message altered to reflect
the current state of things.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] sunxi: Enable CMD_USB and USB_STORAGE by default on sunxi

2015-07-05 Thread Hans de Goede
Start using the new Kconfig options which are available for these now,
and simply always enable them by selecting them as sunxi builds always
include USB support.

Signed-off-by: Hans de Goede hdego...@redhat.com
Acked-by: Ian Campbell i...@hellion.org.uk
---
 arch/arm/Kconfig   | 2 ++
 include/configs/sunxi-common.h | 5 -
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c6202ee..54c5088 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -644,6 +644,7 @@ config ARCH_SOCFPGA
 
 config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
+   select CMD_USB
select DM
select DM_GPIO
select DM_ETH
@@ -653,6 +654,7 @@ config ARCH_SUNXI
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
select USB
+   select USB_STORAGE
 
 config TARGET_SNOWBALL
bool Support snowball
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 9576bc1..5adcc39 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -330,11 +330,6 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_MUSB_PIO_ONLY
 #endif
 
-#if defined CONFIG_USB_EHCI || defined CONFIG_USB_MUSB_SUNXI
-#define CONFIG_CMD_USB
-#define CONFIG_USB_STORAGE
-#endif
-
 #ifdef CONFIG_USB_KEYBOARD
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_PREBOOT
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] sunxi:Added NAND Flash defines and MMC2 IO defines for sun6i

2015-07-05 Thread Hans de Goede

Hi,

First of all thanks for the patches.

I've a question about this series in general, this series is
for the Mele i7 board, correct?

AFAIK that board has regular NAND, not an eMMC.

It seems your version has an eMMC though, so it seems that
there are 2 versions of the board. Are you sure you have
an I7 and not some other Mele model?

Either way please create a new dts file and defconfig
for your board with emmc, if it really is an I7 use
Mele_I7_eMMC_defconfig as defconfig file name, and
sun6i-a31-mele-i7-emmc.dts as dts filename.

I've added some further comments to these patches inline.

On 29-06-15 11:47, ?? wrote:

 From 5c6f29ec1882c9f87c6e789e0ae06a974f6c32e0 Mon Sep 17 00:00:00 2001
From: Zhi Yuan Wan dv...@qq.com
Date: Thu, 25 Jun 2015 19:59:39 +0800
Subject: [PATCH 1/3] sunxi:Added NAND Flash defines and MMC2 IO defines for 
sun6i
  Signed-off-by: Zhi Yuan Wan dv...@qq.com

---
  arch/arm/dts/sun6i-a31.dtsi |   85 +++
  1 file changed, 85 insertions(+)

diff --git a/arch/arm/dts/sun6i-a31.dtsi b/arch/arm/dts/sun6i-a31.dtsi
index 008047a..a9100b9 100644
--- a/arch/arm/dts/sun6i-a31.dtsi
+++ b/arch/arm/dts/sun6i-a31.dtsi


Please submit dts file patches to the upstream linux kernel
first, using the standard kernel patch submission process.


@@ -306,6 +306,14 @@
   apb2_uart4, apb2_uart5;
  };

+nand_clk: clk@01c20080 {
+#clock-cells = 0;
+compatible = allwinner,sun4i-a10-mod0-clk;
+reg = 0x01c20080 0x4;
+clocks = osc24M, pll6 1;
+clock-output-names = nand;
+};
+
  mmc0_clk: clk@01c20088 {
  #clock-cells = 1;
  compatible = allwinner,sun4i-a10-mmc-clk;



You are only making nand related additions here, yet your
subject talks about mmc2 io-defines, please fix your
commit message to not mention the mmc2 io-defines.


@@ -427,6 +435,17 @@
  #size-cells = 1;
  ranges;

+nfc: nand@01c03000 {
+compatible = allwinner,sunxi-nand;


This is wrong, the correct compatible would be:
allwinner,sun4i-a10-nand have you tested this at all ?

Since you say you've a board with eMMC I believe this is
untested. Please do not submit untested changes.

If you are not using the nand bits, please drop this patch
from your patchset.


+reg = 0x01c03000 0x1000;
+interrupts = GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH;
+clocks = ahb1_gates 13, nand_clk;
+clock-names = ahb, mod;
+#address-cells = 1;
+#size-cells = 0;
+status = disabled;
+};
+
  dma: dma-controller@01c02000 {
  compatible = allwinner,sun6i-a31-dma;
  reg = 0x01c02000 0x1000;
@@ -647,6 +666,14 @@
  allwinner,pull = SUN4I_PINCTRL_NO_PULL;
  };

+mmc2_pins_a: mmc2@0 {
+allwinner,pins = PC6, PC7, PC8, PC9,
+ PC10, PC11;
+allwinner,function = mmc2;
+allwinner,drive = SUN4I_PINCTRL_30_MA;
+allwinner,pull = SUN4I_PINCTRL_NO_PULL;
+};
+
  gmac_pins_mii_a: gmac_mii@0 {
  allwinner,pins = PA0, PA1, PA2, PA3,
  PA8, PA9, PA11,
@@ -688,6 +715,59 @@
  allwinner,drive = SUN4I_PINCTRL_40_MA;
  allwinner,pull = SUN4I_PINCTRL_NO_PULL;
  };
+
+nand_pins_a: nand_base0@0 {
+allwinner,pins = PC0, PC1, PC2,
+PC5, PC8, PC9, PC10,
+PC11, PC12, PC13, PC14,
+PC15, PC16;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_cs0_pins_a: nand_cs@0 {
+allwinner,pins = PC4;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_cs1_pins_a: nand_cs@1 {
+allwinner,pins = PC3;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_cs2_pins_a: nand_cs@2 {
+allwinner,pins = PC25;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_cs3_pins_a: nand_cs@3 {
+allwinner,pins = PC26;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_rb0_pins_a: nand_rb@0 {
+allwinner,pins = PC6;
+allwinner,function = nand0;
+allwinner,drive = 0;
+allwinner,pull = 0;
+};
+
+nand_rb1_pins_a: 

Re: [U-Boot] New sunxi board: Lamobo Bananapi R1

2015-07-04 Thread Hans de Goede

Hi Fabioca,

On 15-06-15 15:17, fabioca wrote:

Please find patch below. I indicated as maintainer name Hans The Goede, as he
his the maintainer of all other sunxi boards. Hope that was the correct
thing to do.


For the next version of this patch please set the MAINTAINERS entry to
yourself, I do not have such a board so I cannot maintain it.


Fabio

commit dacdf4dc3174ef1e86884c7d47700abad19b5bb3
Author: Fabio Cannizzo fabio_canni...@yahoo.com
Date:   Sun Jun 14 21:22:21 2015 +0800

 ARM: sun7i: Add config and dts file for Lamobo bananapi R1 board.

 The config file is a copy of the one for bananapi

 This dts file is an almost exact copy of the one for bananapi, except
for the following differences:
 - changed the device name
 - overriden the value of PB3 to pull-up, to allow SATA to work with the
standard u-boot parameters
 Perhaps soemone with more experience of dts files should create an
include file with all common definitions.


Have you submitted the dts file for inclusion into the upstream kernel already?

Also please change the name to not use bananapi in imt, the bananaFOO boards
are made by lemaker.org and this is not a lemaker board, the print on the board
itself calls it the lamobo-rq, as does the linux-sunxi community page and
the lamobo page:

http://linux-sunxi.org/Lamobo_R1
http://www.lamobo.com/lamobor.html

So please call the defconfig Lamobo_R1_defconfig and the dts file
sun7i-a20-lamobo-r1.dts

And set the model and compatible fields in the dts
accordingly.

Also I understand that a CONFIG_GMAC_TX_DELAY=4 may be better
for this board, have you tested this ?

Regards,

Hans





---
View this message in context: 
http://u-boot.10912.n7.nabble.com/New-sunxi-board-Lamobo-Bananapi-R1-tp217120.html
Sent from the U-Boot mailing list archive at Nabble.com.

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9c735c6..a32d772 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -103,6 +103,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-ainol-aw1.dtb \
sun7i-a20-bananapi.dtb \
sun7i-a20-bananapro.dtb \
+   sun7i-a20-bananapir1.dtb \
sun7i-a20-cubieboard2.dtb \
sun7i-a20-cubietruck.dtb \
sun7i-a20-hummingbird.dtb \
diff --git a/arch/arm/dts/sun7i-a20-bananapir1.dts
b/arch/arm/dts/sun7i-a20-bananapir1.dts
new file mode 100644
index 000..a77fb5c
--- /dev/null
+++ b/arch/arm/dts/sun7i-a20-bananapir1.dts
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2014 Hans de Goede hdego...@redhat.com
+ *
+ * Hans de Goede hdego...@redhat.com
+ *
+ * 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 file 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 file 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 sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Lamobo Banana Pi R1;
+   compatible = lemaker,bananapi, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   serial1 = uart3;
+   serial2 = uart7

[U-Boot] [PATCH v2 0/4] musb device model support series

2015-07-01 Thread Hans de Goede
Hi Simon, Marek,

Here is a series with just the patches which needed work after my v1
posting of this series.

I've a rebased version of the entire series (some patches needed adjustment
after the recent Kconfig / defconfig changes) in my personal tree.

Simon, AFAIK the plan is still for this to go upstream through your tree,
let me know when you're ready to take this series, and on which branch you
want it based, and I'll create a branch for you to pull.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/4] dm: Export device_remove_children / device_unbind_children

2015-07-01 Thread Hans de Goede
These functions are useful to remove all children from an usb bus before
rescanning the bus. Give them a better name and export them.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
Changes in v2:
-Not only export but also rename the functions to device_remove_children /
 device_unbind_children
---
 drivers/core/device-remove.c | 22 --
 include/dm/device-internal.h | 26 ++
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 6a16b4f..6b87f86 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -18,16 +18,7 @@
 #include dm/uclass-internal.h
 #include dm/util.h
 
-/**
- * device_chld_unbind() - Unbind all device's children from the device
- *
- * On error, the function continues to unbind all children, and reports the
- * first error.
- *
- * @dev:   The device that is to be stripped of its children
- * @return 0 on success, -ve on error
- */
-static int device_chld_unbind(struct udevice *dev)
+int device_unbind_children(struct udevice *dev)
 {
struct udevice *pos, *n;
int ret, saved_ret = 0;
@@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
return saved_ret;
 }
 
-/**
- * device_chld_remove() - Stop all device's children
- * @dev:   The device whose children are to be removed
- * @return 0 on success, -ve on error
- */
-static int device_chld_remove(struct udevice *dev)
+int device_remove_children(struct udevice *dev)
 {
struct udevice *pos, *n;
int ret;
@@ -84,7 +70,7 @@ int device_unbind(struct udevice *dev)
return ret;
}
 
-   ret = device_chld_unbind(dev);
+   ret = device_unbind_children(dev);
if (ret)
return ret;
 
@@ -159,7 +145,7 @@ int device_remove(struct udevice *dev)
if (ret)
return ret;
 
-   ret = device_chld_remove(dev);
+   ret = device_remove_children(dev);
if (ret)
goto err;
 
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 687462b..402304f 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
 static inline int device_unbind(struct udevice *dev) { return 0; }
 #endif
 
+/**
+ * device_remove_children() - Stop all device's children
+ * @dev:   The device whose children are to be removed
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_remove_children(struct udevice *dev);
+#else
+static inline int device_remove_children(struct udevice *dev) { return 0; }
+#endif
+
+/**
+ * device_unbind_children() - Unbind all device's children from the device
+ *
+ * On error, the function continues to unbind all children, and reports the
+ * first error.
+ *
+ * @dev:   The device that is to be stripped of its children
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_unbind_children(struct udevice *dev);
+#else
+static inline int device_unbind_children(struct udevice *dev) { return 0; }
+#endif
+
 #ifdef CONFIG_DM_DEVICE_REMOVE
 void device_free(struct udevice *dev);
 #else
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] dm: usb: Document that mixing DM_DEVICE_REMOVE and DM_USB is a bad idea

2015-07-01 Thread Hans de Goede
Document that mixing DM_DEVICE_REMOVE and DM_USB is a bad idea, and also why
this is a bad idea.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/core/Kconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 2861b43..e40372d 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -38,6 +38,10 @@ config DM_DEVICE_REMOVE
  device. This is not normally required in SPL, so by default this
  option is disabled for SPL.
 
+ Note that this may have undesirable results in the USB subsystem as
+ it causes unplugged devices to linger around in the dm-tree, and it
+ causes USB host controllers to not be stopped when booting the OS.
+
 config DM_STDIO
bool Support stdio registration
depends on DM
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 4/4] dm: usb: Rename usb_find_child to usb_find_emul_child

2015-07-01 Thread Hans de Goede
Now that we unbind usb devices from usb_stop() usb_find_child() is
only necessary to deal with emulated usb devices.

Rename it to make this clear and add a #ifdef to make it a nop in
other cases.

Note the #ifdef turns usb_find_emul_child() into a nop, rather then not
building it and adding another #ifdef to the caller, this is done this way
because adding a #ifdef to the caller is somewhat hairy.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/usb/host/usb-uclass.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 2df6740..fd11cc6 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -485,15 +485,14 @@ error:
 }
 
 /**
- * usb_find_child() - Find an existing device which matches our needs
- *
- *
+ * usb_find_emul_child() - Find an existing device for emulated devices
  */
-static int usb_find_child(struct udevice *parent,
- struct usb_device_descriptor *desc,
- struct usb_interface_descriptor *iface,
- struct udevice **devp)
+static int usb_find_emul_child(struct udevice *parent,
+  struct usb_device_descriptor *desc,
+  struct usb_interface_descriptor *iface,
+  struct udevice **devp)
 {
+#ifdef CONFIG_SANDBOX
struct udevice *dev;
 
*devp = NULL;
@@ -512,7 +511,7 @@ static int usb_find_child(struct udevice *parent,
return 0;
}
}
-
+#endif
return -ENOENT;
 }
 
@@ -572,8 +571,8 @@ int usb_scan_device(struct udevice *parent, int port,
debug(read_descriptor for '%s': ret=%d\n, parent-name, ret);
if (ret)
return ret;
-   ret = usb_find_child(parent, udev-descriptor, iface, dev);
-   debug(** usb_find_child returns %d\n, ret);
+   ret = usb_find_emul_child(parent, udev-descriptor, iface, dev);
+   debug(** usb_find_emul_child returns %d\n, ret);
if (ret) {
if (ret != -ENOENT)
return ret;
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/4] dm: usb: Use device_unbind_children to clean up usb devs on stop

2015-07-01 Thread Hans de Goede
On an usb stop instead of leaving orphan usb devices behind simply remove
them.

The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
instead, before this commit the output would be:

 usb [ + ]`-- sunxi-musb
 usb_hub [   ]|-- usb_hub
 usb_mass_st [   ]|   |-- usb_mass_storage
 usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
 usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes usb_get_dev_index
to return NULL when probing the first child, which results in the usb kbd
code not binding to the keyboard.

With this commit in place the output after swapping and usb reset is:

 usb [ + ]`-- sunxi-musb
 usb_dev_gen [ + ]`-- generic_bus_0_dev_1

As expected, and usb_get_dev_index works properly and the keyboard works.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
Changes in v2:
-We only need to call device_unbind_children, the children are removed
 already by the device_remove call on the host
-Do not add #ifdef-s around usb_stop()
---
 drivers/usb/host/usb-uclass.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index bce6cec..2df6740 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -146,6 +146,9 @@ int usb_stop(void)
ret = device_remove(bus);
if (ret  !err)
err = ret;
+   ret = device_unbind_children(bus);
+   if (ret  !err)
+   err = ret;
}
 
 #ifdef CONFIG_SANDBOX
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/22] musb: Update usb-compat to work with struct usb_device without a parent ptr

2015-07-01 Thread Hans de Goede

Hi,

On 29-06-15 05:45, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

When building with CONFIG_DM_USB=y struct usb_device does not have a parent
pointer. This commit adds support to the musb code to deal with this.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/usb/musb-new/musb_host.c  |  4 +++
  drivers/usb/musb-new/musb_uboot.c |  2 +-
  drivers/usb/musb-new/usb-compat.h | 70 +++
  3 files changed, 75 insertions(+), 1 deletion(-)



Acked-by: Simon Glass s...@chromium.org

See note below.


diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c
index 437309c..40b9c66 100644
--- a/drivers/usb/musb-new/musb_host.c
+++ b/drivers/usb/musb-new/musb_host.c
@@ -2067,7 +2067,11 @@ int musb_urb_enqueue(

 /* precompute addressing for external hub/tt ports */
 if (musb-is_multipoint) {
+#ifndef __UBOOT__
 struct usb_device   *parent = urb-dev-parent;
+#else
+   struct usb_device   *parent = usb_dev_get_parent(urb-dev);
+#endif

  #ifndef __UBOOT__
 if (parent != hcd-self.root_hub) {
diff --git a/drivers/usb/musb-new/musb_uboot.c 
b/drivers/usb/musb-new/musb_uboot.c
index 70e87c9..a96e8d2 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -97,7 +97,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long 
pipe,
   buffer, len, setup, 0);

 /* Fix speed for non hub-attached devices */
-   if (!dev-parent)
+   if (!usb_dev_get_parent(dev))
 dev-speed = host_speed;

 return submit_urb(hcd, urb);
diff --git a/drivers/usb/musb-new/usb-compat.h 
b/drivers/usb/musb-new/usb-compat.h
index 50bad37..53fe4ff 100644
--- a/drivers/usb/musb-new/usb-compat.h
+++ b/drivers/usb/musb-new/usb-compat.h
@@ -1,6 +1,7 @@
  #ifndef __USB_COMPAT_H__
  #define __USB_COMPAT_H__

+#include dm.h
  #include usb.h

  struct usb_hcd {
@@ -66,6 +67,68 @@ static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd 
*hcd,
 return 0;
  }

+#ifdef CONFIG_DM_USB
+static inline u16 find_tt(struct usb_device *udev)
+{
+   struct udevice *parent;
+   struct usb_device *uparent, *ttdev;
+
+   /*
+* When called from usb-uclass.c: usb_scan_device() udev-dev points
+* to the parent udevice, not the actual udevice belonging to the
+* udev as the device is not instantiated yet. So when searching
+* for the first usb-2 parent start with udev-dev not
+* udev-dev-parent .
+*/
+   ttdev = udev;
+   parent = udev-dev;
+   uparent = dev_get_parentdata(parent);
+
+   while (uparent-speed != USB_SPEED_HIGH) {
+   struct udevice *dev = parent;
+
+   if (device_get_uclass_id(dev-parent) != UCLASS_USB_HUB) {
+   printf(musb: Error cannot find high speed parent of usb-1 
device\n);
+   return 0;
+   }
+
+   ttdev = dev_get_parentdata(dev);
+   parent = dev-parent;
+   uparent = dev_get_parentdata(parent);
+   }
+
+   return (uparent-devnum  8) | (ttdev-portnr - 1);
+}
+
+static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev)
+{
+   struct udevice *parent = udev-dev-parent;
+
+   /*
+* When called from usb-uclass.c: usb_scan_device() udev-dev points
+* to the parent udevice, not the actual udevice belonging to the
+* udev as the device is not instantiated yet.


Another option here is to somehow allow devices to be added before we
know what they are. In this case we could bind a 'generic' USB device
(UCLASS_USB_DEV_GENERIC). Then when we work out what it is, we could
unbind it (without throwing away the udevice and usb_device) and have
it bind again as the correct device. Something like
device_morph_child().


Right, I think that may end up being cleaner in the long term.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] sunxi: Select a bunch of CONFIG_foo options from ARCH_SUNXI

2015-07-01 Thread Hans de Goede

Hi,

On 30-06-15 22:46, Tom Rini wrote:

On Tue, Jun 30, 2015 at 10:33:17PM +0200, Hans de Goede wrote:


Select a bunch of CONFIG_foo options from ARCH_SUNXI, instead of having
them set to y  in every single sunxi defconfig.

Signed-off-by: Hans de Goede hdego...@redhat.com


Ug, sorry, I was waiting for some build results to come out before
posting my version of this.


No problem.


To update the USB side:
$ for F in `git grep -l SYS_EXTRA.*USB_EHCI`;do sed -i -e 's/,USB_EHCI//'
-e 's/USB_EHCI,//' $F  echo CONFIG_USB_EHCI_HCD=y  $F;done

And was there a reason you didn't include a 'select DM_SERIAL' in yours?


Yes setting that for all boards breaks booting of boards which do not
have a serial port as drivers/serial/serial-uclass.c:
serial_find_console_or_panic() will then panic (runtime error,
yeah).

And we've one such board. I've a fix for this, next step is to merge
your and mine patches as both have some good things the other one
does not have (I like your work on setting CONFIG_USB_EHCI_HCD,
but you're not selecting CONFIG_USB).

I've run out of steam for today, so I will try to get this done
tomorrow.


[snip]

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..6c4d138 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -645,10 +645,13 @@ config ARCH_SOCFPGA
  config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
+   select DM_ETH
select DM_GPIO
+   select DM_USB if !USB_MUSB_SUNXI
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
+   select USB


We really don't want to leave USB as a board choice?


All sunxi SoCs have 2 - 4 (*) usb controllers, and there
does not exist a single board which does not at least uses
one usb controller, and I like to keep things consistent
where ever possible to reduce the combinatorial explosion
problem all these Kconfig options give us.

Regards,

Hans


*) 3 - 6 if you count ehci/ohci seperately.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/22] usb: usb_setup_device: Drop unneeded portnr function argument

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:44, Simon Glass wrote:

Hi Hans.

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

Drop the unneeded portnr function argument, the portnr is part of the
usb_device struct which is passed via the dev argument.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  common/usb.c  | 10 +-
  drivers/usb/host/usb-uclass.c |  2 +-
  include/usb.h |  6 +++---
  3 files changed, 9 insertions(+), 9 deletions(-)


This was needed in the case where a fake usb_device was passed in. Has
your previous refactoring changed that?


The portnr is still passed but it is padded via the usb_device struct's
portnr member. When doing a CONFIG_DM_USB=y build the only call site of
usb_setup_device() is usb_scan_device() from drivers/usb/host/usb-uclass.c
which does:

udev-portnr = port;
debug(Calling usb_setup_device(), portnr=%d\n, udev-portnr);
parent_udev = device_get_uclass_id(parent) == UCLASS_USB_HUB ?
dev_get_parentdata(parent) : NULL;
ret = usb_setup_device(udev, priv-desc_before_addr, parent_udev);

So portnr is always set in the usb_device strict, and that is what gets
used after this patch.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 04/22] usb: Pass device instead of portnr to usb_legacy_port_reset

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:44, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

Pass the usb_device instead of the portnr to usb_legacy_port_reset and
rename it to usb_hub_port_reset as there is nothing legacy about it.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  common/usb.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)


Legacy as in not driver model.


Except that it gets used in both device-model and non device model
builds of the usb-stack.

Regards,

Hans

p.s.

Thanks for reviewing this largish series!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:45, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

On an usb stop instead of leaving orphan usb devices behind simply remove


On a usb_stop()

or

On a 'usb stop' command  ?


My intention was for both, since I was under the assumption that usb stop
on the cmdline, was the only caller of usb_stop(), but a quick grep to the
sources show that I'm wrong ...


them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
usb_stop() when that is set.


This seems a little unfortunate. I can see the reasoning, but do you
think this is necessary? I suspect people chasing code size may remove
that option and still want to use USB properly.


This was mostly a result of my thinking that usb_stop() is only used
on usb stop at the cmdline, which I know realize is wrong.

However my quick grep has learned that we do really need CONFIG_DM_DEVICE_REMOVE
to properly implement usb_stop():

From common/bootm.c :

#if defined(CONFIG_CMD_USB)
/*
 * turn off USB to prevent the host controller from writing to the
 * SDRAM while Linux is booting. This could happen (at least for OHCI
 * controller), because the HCCA (Host Controller Communication Area)
 * lies within the SDRAM and the host controller writes continously to
 * this area (as busmaster!). The HccaFrameNumber is for example
 * updated every 1 ms within the HCCA structure in SDRAM! For more
 * details see the OpenHCI specification.
 */
usb_stop();
#endif

And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's remove
callback and thus do not properly stop the usb controller.

So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already exists
before this patch. If you want I can split out the adding of the #ifdef
in a separate commit, spelling out why usb_stop() MUST have
CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this all to
Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?







The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
instead, before this commit the output would be:

  usb [ + ]`-- sunxi-musb
  usb_hub [   ]|-- usb_hub
  usb_mass_st [   ]|   |-- usb_mass_storage
  usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
  usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes usb_get_dev_index
to return NULL when probing the first child, which results in the usb kbd
code not binding to the keyboard.


Although I suspect that could be fixed.


Right, but just removing the children is a much cleaner solution, and also
makes the output of dm tree properly reflect reality.





With this commit in place the output after swapping and usb reset is:

  usb [ + ]`-- sunxi-musb
  usb_dev_gen [ + ]`-- generic_bus_0_dev_1

As expected, and usb_get_dev_index works properly and the keyboard works.

After this commit usb_find_child() is only necessary for emulated usb
devices, so make its body #ifdef CONFIG_USB_EMUL.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/usb/host/usb-uclass.c | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index bce6cec..8f26e35 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -128,6 +128,7 @@ int usb_alloc_device(struct usb_device *udev)
 return ops-alloc_device(bus, udev);
  }

+#ifdef CONFIG_DM_DEVICE_REMOVE
  int usb_stop(void)
  {
 struct udevice *bus;
@@ -143,6 +144,12 @@ int usb_stop(void)
 uc_priv = uc-priv;

 uclass_foreach_dev(bus, uc) {
+   ret = device_chld_remove(bus);
+   if (ret  !err)
+   err = ret;
+   ret = device_chld_unbind(bus);
+   if (ret  !err)
+   err = ret;
 ret = device_remove(bus);
 if (ret  !err)
 err = ret;
@@ -166,6 +173,7 @@ int usb_stop(void)

 return err;
  }
+#endif

  static void usb_scan_bus(struct udevice *bus, bool recurse)
  {
@@ -491,6 +499,7 @@ static int usb_find_child(struct udevice *parent,
   struct usb_interface_descriptor *iface,
   struct udevice **devp)
  {
+#ifdef CONFIG_USB_EMUL /* Emulated devices are explictily bound */


explicitly


Ack.


Can you add a comment about this? It seems that we should rename this
function to usb_find_emul_child() and have it present only when
CONFIG_USB_EMUL is around?


Renaming it to usb_find_emul_child() and only defining the function when
CONFIG_USB_EMUL works for me I will do that for v2.


Also, why bother with the #ifdef

Re: [U-Boot] [PATCH 06/22] dm: Export device_chld_remove / device_chld_unbind

2015-06-30 Thread Hans de Goede

Hi,

On 29-06-15 05:45, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:

These functions are useful to remove all children from an usb bus before
rescanning the bus.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  drivers/core/device-remove.c | 18 ++
  include/dm/device-internal.h | 26 ++
  2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index 6a16b4f..06de7e3 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -18,16 +18,7 @@
  #include dm/uclass-internal.h
  #include dm/util.h

-/**
- * device_chld_unbind() - Unbind all device's children from the device
- *
- * On error, the function continues to unbind all children, and reports the
- * first error.
- *
- * @dev:   The device that is to be stripped of its children
- * @return 0 on success, -ve on error
- */
-static int device_chld_unbind(struct udevice *dev)
+int device_chld_unbind(struct udevice *dev)


If we are exporting this can we give it a better name? Maybe
device_unbind_children()?


Will do for v2 of this set.

Regards,

Hans




  {
 struct udevice *pos, *n;
 int ret, saved_ret = 0;
@@ -43,12 +34,7 @@ static int device_chld_unbind(struct udevice *dev)
 return saved_ret;
  }

-/**
- * device_chld_remove() - Stop all device's children
- * @dev:   The device whose children are to be removed
- * @return 0 on success, -ve on error
- */
-static int device_chld_remove(struct udevice *dev)
+int device_chld_remove(struct udevice *dev)
  {
 struct udevice *pos, *n;
 int ret;
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 687462b..6c8fe23 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -107,6 +107,32 @@ int device_unbind(struct udevice *dev);
  static inline int device_unbind(struct udevice *dev) { return 0; }
  #endif

+/**
+ * device_chld_remove() - Stop all device's children
+ * @dev:   The device whose children are to be removed
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_chld_remove(struct udevice *dev);
+#else
+static inline int device_chld_remove(struct udevice *dev) { return 0; }
+#endif
+
+/**
+ * device_chld_unbind() - Unbind all device's children from the device
+ *
+ * On error, the function continues to unbind all children, and reports the
+ * first error.
+ *
+ * @dev:   The device that is to be stripped of its children
+ * @return 0 on success, -ve on error
+ */
+#ifdef CONFIG_DM_DEVICE_REMOVE
+int device_chld_unbind(struct udevice *dev);
+#else
+static inline int device_chld_unbind(struct udevice *dev) { return 0; }
+#endif
+
  #ifdef CONFIG_DM_DEVICE_REMOVE
  void device_free(struct udevice *dev);
  #else
--
2.4.3



Regards,
Simon


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 30-06-15 15:30, Ian Campbell wrote:

On Tue, 2015-06-30 at 15:11 +0200, Hans de Goede wrote:
[...]

The latest patch-series seems to do the exact reverse. More knowledge is
being moved away from a central place and into defconfig files. As said
ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
defconfig files need to set that explicitly.


CONFIG_DM* seems like the sort of thing which ought to be select'd not
default y'd


ACK. The problem is that there are some other not entirely clean
Kconfig bits un the u-boot tree which causes Kconfig to explain about
circular deps last time I tried to select them. Still I agree we need
to move to selecting these and fix any other issues this triggers.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 28-06-15 18:06, Tom Rini wrote:

On Sun, Jun 28, 2015 at 05:39:28PM +0200, Hans de Goede wrote:

Hi,

On 26-06-15 23:05, Tom Rini wrote:

On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:


Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

   Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

   http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

   sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)



NAK, this needs a rework now, sorry!  Joe's changes mean the new
defconfig needs updating.


Ugh, I'm somewhat surprised with these changes, both with the
contents of the changes, as with changes like these landing so
late in the cycle, esp. since these are not uncontroversial.

I've the feeling that these were merged without proper discussion
which is not good, and is esp. bad when it is done so late in the
cycle.


Yeah, it's a bit later than I'd have liked, but I asked Joe to get these
done because they help clean things up.  For example:


In essense these changes revert my earlier commit where I explictly added:

config CMD_SETEXPR
default y

config CMD_NET
default y


Right.  Your change kept sunxi boards from suddenly losing those
features to prevent breakage (which is good, and why I allowed it at the
time), but at the expense of adding lines to each of the sunxi defconfig
files (which is why these lines ended up in each of the sunxi defconfg
files, yes?)


That is not how I see it, with my change for sunxi boards the default for
these options was y, so they did not end up in the deconfigs with Joe's
recent changes removed the above 4 lines from board/sunxi/Kconfig now
all of a sudden all sunxi defconfig files need these lines, it is Joe's
changes which have caused a ton of extra lines to be added to the sunxi
defconfigs not mine, specifically this commit:

http://git.denx.de/?p=u-boot.git;a=commit;h=c9bb942e2f91d9f8e5f25ed1961eba2d64f65b8d

Which does:

--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -566,25 +566,4 @@ config GMAC_TX_DELAY
---help---
Set the GMAC Transmit Clock Delay Chain value.

-config SYS_MALLOC_CLEAR_ON_INIT
-   default n
-
-config NETDEVICES
-   default y
-
-config DM_ETH
-   default y
-
-config DM_SERIAL
-   default y
-
-config DM_USB
-   default y if !USB_MUSB_SUNXI
-
-config CMD_SETEXPR
-   default y
-
-config CMD_NET
-   default y
-
 endif

Which result in the following matching change for 60+ sunxi
defconfig's :
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -5,5 +5,13 @@ CONFIG_DRAM_CLK=480
 CONFIG_DRAM_EMR1=4
 CONFIG_SYS_CLK_FREQ=91200
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
 
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_NET=y
+CONFIG_DM_ETH=y
+CONFIG_NETDEVICES=y
+CONFIG_DM_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y

 and didn't help all of the other SoCs out.  What Joe's

changes do is remove them from the defconfig files under configs/ _and_
restore the original behaviour.


No what Joe's changes have them is ADD them to the defconfig files
under configs/ and force the new behavior of all things defaulting
to off unless explictly enabled in defconfig, resulting in 8 * 61 =
488 extra lines in sunxi defconfig's alone.

And for some reason Joe has not only done these change for CONFIG_CMD_*
but also for other unrelated options like CONFIG_DM_* which is really
BAD, as sunxi has been completely moved over to the device model and
simply will not build nor run when CONFIG_DM and friends are not set.


And not only does the just merged series revert these changes, to make
things worse it adds a whole lot more crap to the sunxi defconfigs.


It does in that it's now a direct translation of crap that used to be in
the config.h files (and done just once, true).  The next step is to
instead add smarts to the Kconfig logic so that if we don't have
NOR-style flash we don't ever ask about CMD_IMLS/CMD_FLASH and make
CMD_FPGA depend on FPGA being set.

We're trying to skip over the period of linux kernel history where the
defconfig files were hand-controlled files that had lots of
board-specific knowledge in them.  But at the same time, we can't kick
out nearly as much of that information as they were able to because...


The latest patch-series seems to do the exact reverse. More knowledge is
being moved away from a central place and into defconfig files. As said
ARCH_SUNXI builds must always have CONFIG_DM* set, and yet now all sunxi
defconfig files need to set that explicitly.


Excuse my language but I've no other words for this, something which
we want

Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 04:58 PM, Simon Glass wrote:

Hi Hans,

On 30 June 2015 at 06:54, Hans de Goede hdego...@redhat.com wrote:

Hi,

On 29-06-15 05:45, Simon Glass wrote:


Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:


On an usb stop instead of leaving orphan usb devices behind simply remove



On a usb_stop()

or

On a 'usb stop' command  ?



My intention was for both, since I was under the assumption that usb stop
on the cmdline, was the only caller of usb_stop(), but a quick grep to the
sources show that I'm wrong ...


them. This requires CONFIG_DM_DEVICE_REMOVE to be set, so only build
usb_stop() when that is set.



This seems a little unfortunate. I can see the reasoning, but do you
think this is necessary? I suspect people chasing code size may remove
that option and still want to use USB properly.



This was mostly a result of my thinking that usb_stop() is only used
on usb stop at the cmdline, which I know realize is wrong.

However my quick grep has learned that we do really need
CONFIG_DM_DEVICE_REMOVE
to properly implement usb_stop():

 From common/bootm.c :

#if defined(CONFIG_CMD_USB)
 /*
  * turn off USB to prevent the host controller from writing to the
  * SDRAM while Linux is booting. This could happen (at least for
OHCI
  * controller), because the HCCA (Host Controller Communication
Area)
  * lies within the SDRAM and the host controller writes continously
to
  * this area (as busmaster!). The HccaFrameNumber is for example
  * updated every 1 ms within the HCCA structure in SDRAM! For more
  * details see the OpenHCI specification.
  */
 usb_stop();
#endif

And without CONFIG_DM_DEVICE_REMOVE we end up never calling the hcd's remove
callback and thus do not properly stop the usb controller.

So this problem of usb_stop() needing CONFIG_DM_DEVICE_REMOVE already exists
before this patch. If you want I can split out the adding of the #ifdef
in a separate commit, spelling out why usb_stop() MUST have
CONFIG_DM_DEVICE_REMOVE in the commit message. Or maybe just move this all
to
Kconfig and make DM_USB conflict with CONFIG_DM_DEVICE_REMOVE?



I don't think that is necessary, it feels a bit too inflexible. But
perhaps you could add a comment to the Kconfig help for
CONFIG_DM_DEVICE_REMOVE?


Ok will do.


It is remove() that is needed, not unbind(). Actually I think it is
quite unfortunate to make usb_stop() call unbind. It is a waste of
time to do this just before booting the kernel - the current design
leaves all devices bound (but I hope we can remove() them at some
point).

Instead, I wonder if we can remove the children when we probe the bus?


That should work, but I do not really see any advantage in that,
removing the children is not that expensive and it feels like a
kludge.


Also, what happens to children that are in the device tree - i.e.
static USB devices like WiFi? The device tree might have parameters
for them. Still, that might not matter as I'm not sure that case is
handled correctly today.


AFAIK there is no such thing as usb devices in devicetree, which
makes sense as usb is a fully discoverable bus.












The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a keyb.
instead, before this commit the output would be:

   usb [ + ]`-- sunxi-musb
   usb_hub [   ]|-- usb_hub
   usb_mass_st [   ]|   |-- usb_mass_storage
   usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
   usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes
usb_get_dev_index
to return NULL when probing the first child, which results in the usb kbd
code not binding to the keyboard.



Although I suspect that could be fixed.



Right, but just removing the children is a much cleaner solution, and also
makes the output of dm tree properly reflect reality.


True, although you also have 'usb tree' for that. Another option would
be to mark devices that were found and remove the others after the
scan.


That seems like needless complexity. I believe that simply removing + unbinding
the children on usb_stop is the right thing to do, and it also is the KISS
solution.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 08/22] dm: usb: Use device_chld_remove and _unbind to clean up usb devs on stop

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 06:07 PM, Simon Glass wrote:

snip


Instead, I wonder if we can remove the children when we probe the bus?



That should work, but I do not really see any advantage in that,
removing the children is not that expensive and it feels like a
kludge.


That's how it currently works, from what I can see in the code. But
since there is a 'usb_started' boolean this is irrelevant.




Also, what happens to children that are in the device tree - i.e.
static USB devices like WiFi? The device tree might have parameters
for them. Still, that might not matter as I'm not sure that case is
handled correctly today.



AFAIK there is no such thing as usb devices in devicetree, which
makes sense as usb is a fully discoverable bus.


Sort-of. But as with PCI it is useful to be able to add settings for
the devices in some cases. You can match them using vendor/device or
interface IDs. Then the driver can access its settings.


AFAIK there is not a single example of having settings in devicetree
for an usb device, since usb-devices are always 100% self describing
since usb is a bus designed for hot(un)plug from the outset.


That's why I'm suggesting we unbind the devices that are no-longer present.


You're asking to make the code more complicated here using a what if
reasoning with a what if which is likely to never happen.
















The result of this commit is best seen in the output of dm tree after
plugging out an usb hub with 2 devices plugges in and plugging in a
keyb.
instead, before this commit the output would be:

usb [ + ]`-- sunxi-musb
usb_hub [   ]|-- usb_hub
usb_mass_st [   ]|   |-- usb_mass_storage
usb_dev_gen [   ]|   `-- generic_bus_0_dev_3
usb_dev_gen [ + ]`-- generic_bus_0_dev_1

Notice the non active usb_hub child and its 2 non active children. The
first child being non-active as in this example also causes
usb_get_dev_index
to return NULL when probing the first child, which results in the usb
kbd
code not binding to the keyboard.




Although I suspect that could be fixed.




Right, but just removing the children is a much cleaner solution, and
also
makes the output of dm tree properly reflect reality.



True, although you also have 'usb tree' for that. Another option would
be to mark devices that were found and remove the others after the
scan.



That seems like needless complexity. I believe that simply removing +
unbinding
the children on usb_stop is the right thing to do, and it also is the KISS
solution.


I'm good with the remove(), but less sure about the unbind().


The unbind is necessary for usb_get_dev_index() to work properly,
which is necessary for proper output of usb tree and for driver
binding to work properly, without the unbind usb-keyboards will e.g.
not work in certain circumstances.


The
state of 'dm tree' does not bother me,


The state if dm tree is what usb_get_dev_index() works from, so if
it is not in a good state, then usb_get_dev_index() will not work.


and I worry that we then limit
our ability to use usb_find_child() to locate a device's parameters
(i.e. support for more complex devices which need settings might be
harder).


Again this is a what if reasoning for a hypothetical future problem
which will likely never happen, where as the broken state of the
dm tree after a usb reset is causing real problems.


For now, can we just leave this alone? I really don't want to re-visit
this later.


Nope we cannot leave this alone, without unbinding usb devices which
no longer exist, the dm tree will be broken and with it
usb_get_dev_index() and through usb_get_dev_index() the keyboard
driver.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-30 Thread Hans de Goede

Hi,

On 06/30/2015 07:52 PM, Tom Rini wrote:

On Tue, Jun 30, 2015 at 03:11:02PM +0200, Hans de Goede wrote:


Hi,

On 28-06-15 18:06, Tom Rini wrote:

On Sun, Jun 28, 2015 at 05:39:28PM +0200, Hans de Goede wrote:

Hi,

On 26-06-15 23:05, Tom Rini wrote:

On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:


Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

   Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

   http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

   sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)



NAK, this needs a rework now, sorry!  Joe's changes mean the new
defconfig needs updating.


Ugh, I'm somewhat surprised with these changes, both with the
contents of the changes, as with changes like these landing so
late in the cycle, esp. since these are not uncontroversial.

I've the feeling that these were merged without proper discussion
which is not good, and is esp. bad when it is done so late in the
cycle.


Yeah, it's a bit later than I'd have liked, but I asked Joe to get these
done because they help clean things up.  For example:


In essense these changes revert my earlier commit where I explictly added:

config CMD_SETEXPR
default y

config CMD_NET
default y


Right.  Your change kept sunxi boards from suddenly losing those
features to prevent breakage (which is good, and why I allowed it at the
time), but at the expense of adding lines to each of the sunxi defconfig
files (which is why these lines ended up in each of the sunxi defconfg
files, yes?)


That is not how I see it, with my change for sunxi boards the default for
these options was y, so they did not end up in the deconfigs with Joe's
recent changes removed the above 4 lines from board/sunxi/Kconfig now
all of a sudden all sunxi defconfig files need these lines, it is Joe's
changes which have caused a ton of extra lines to be added to the sunxi
defconfigs not mine, specifically this commit:

http://git.denx.de/?p=u-boot.git;a=commit;h=c9bb942e2f91d9f8e5f25ed1961eba2d64f65b8d

Which does:

--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -566,25 +566,4 @@ config GMAC_TX_DELAY
 ---help---
 Set the GMAC Transmit Clock Delay Chain value.

-config SYS_MALLOC_CLEAR_ON_INIT
-   default n
-
-config NETDEVICES
-   default y
-
-config DM_ETH
-   default y
-
-config DM_SERIAL
-   default y
-
-config DM_USB
-   default y if !USB_MUSB_SUNXI
-
-config CMD_SETEXPR
-   default y
-
-config CMD_NET
-   default y
-
  endif

Which result in the following matching change for 60+ sunxi
defconfig's :
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -5,5 +5,13 @@ CONFIG_DRAM_CLK=480
  CONFIG_DRAM_EMR1=4
  CONFIG_SYS_CLK_FREQ=91200
  CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-olinuxino-lime
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
  
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_NET=y
+CONFIG_DM_ETH=y
+CONFIG_NETDEVICES=y
+CONFIG_DM_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y


OK, I see part of the problem.  One part of the problem, and this
probably isn't just a sunxi thing, is that arch/arm/Kconfig::config
ARCH_SUNXI hasn't been getting updated with select's like it should.

If we do:
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..48319c1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -646,6 +646,9 @@ config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
select DM_GPIO
+   select DM_ETH
+   select DM_SERIAL
+   select DM_USB if USB_EHCI_HCD
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL

We get:
diff --git a/configs/A20-OLinuXino-Lime2_defconfig 
b/configs/A20-OLinuXino-Lime2_defconfig
index 6445b25..a8aa8d2 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -8,12 +8,10 @@ CONFIG_USB0_VBUS_DET=PH5
  CONFIG_DEFAULT_DEVICE_TREE=sun7i-a20-olinuxino-lime2
  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
  CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3),USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)
  # CONFIG_CMD_IMLS is not set
  # CONFIG_CMD_FLASH is not set
  # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
  CONFIG_ETH_DESIGNWARE=y
-CONFIG_DM_SERIAL=y
  CONFIG_USB=y
-CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y

Which is much closer to what you were asking for, right Hans?  That
still leaves CONFIG_SYS_MALLOC_CLEAR_ON_INIT=n being added in each case
but that's a performance per-board tweak (and something that frankly we
need to pencil in making

[U-Boot] [PATCH] sunxi: Select a bunch of CONFIG_foo options from ARCH_SUNXI

2015-06-30 Thread Hans de Goede
Select a bunch of CONFIG_foo options from ARCH_SUNXI, instead of having
them set to y  in every single sunxi defconfig.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/Kconfig | 3 +++
 configs/A10-OLinuXino-Lime_defconfig | 3 ---
 configs/A10s-OLinuXino-M_defconfig   | 3 ---
 configs/A13-OLinuXinoM_defconfig | 3 ---
 configs/A13-OLinuXino_defconfig  | 3 ---
 configs/A20-OLinuXino-Lime2_defconfig| 3 ---
 configs/A20-OLinuXino-Lime_defconfig | 3 ---
 configs/A20-OLinuXino_MICRO_defconfig| 3 ---
 configs/Ainol_AW1_defconfig  | 1 -
 configs/Ampe_A76_defconfig   | 1 -
 configs/Auxtek-T004_defconfig| 3 ---
 configs/Bananapi_defconfig   | 3 ---
 configs/Bananapro_defconfig  | 3 ---
 configs/CSQ_CS908_defconfig  | 3 ---
 configs/Chuwi_V7_CW0825_defconfig| 1 -
 configs/Colombus_defconfig   | 3 ---
 configs/Cubieboard2_defconfig| 3 ---
 configs/Cubieboard_defconfig | 3 ---
 configs/Cubietruck_defconfig | 3 ---
 configs/Et_q8_v1_6_defconfig | 1 -
 configs/Hummingbird_A31_defconfig| 3 ---
 configs/Hyundai_A7HD_defconfig   | 1 -
 configs/Ippo_q8h_v1_2_a33_1024x600_defconfig | 1 -
 configs/Ippo_q8h_v1_2_defconfig  | 1 -
 configs/Ippo_q8h_v5_defconfig| 1 -
 configs/Linksprite_pcDuino3_Nano_defconfig   | 3 ---
 configs/Linksprite_pcDuino3_defconfig| 3 ---
 configs/Linksprite_pcDuino_defconfig | 3 ---
 configs/MK808C_defconfig | 3 ---
 configs/MSI_Primo73_defconfig| 3 ---
 configs/MSI_Primo81_defconfig| 2 --
 configs/Marsboard_A10_defconfig  | 3 ---
 configs/Mele_A1000G_quad_defconfig   | 3 ---
 configs/Mele_A1000_defconfig | 3 ---
 configs/Mele_I7_defconfig| 3 ---
 configs/Mele_M3_defconfig| 3 ---
 configs/Mele_M5_defconfig| 3 ---
 configs/Mele_M9_defconfig| 3 ---
 configs/Merrii_A80_Optimus_defconfig | 3 ---
 configs/Mini-X_defconfig | 3 ---
 configs/Orangepi_defconfig   | 3 ---
 configs/Orangepi_mini_defconfig  | 3 ---
 configs/Sinlinx_SinA33_defconfig | 3 ---
 configs/TZX-Q8-713B7_defconfig   | 1 -
 configs/UTOO_P66_defconfig   | 1 -
 configs/Wexler_TAB7200_defconfig | 3 ---
 configs/Wits_Pro_A20_DKT_defconfig   | 3 ---
 configs/Yones_Toptech_BD1078_defconfig   | 1 -
 configs/ba10_tv_box_defconfig| 3 ---
 configs/forfun_q88db_defconfig   | 1 -
 configs/ga10h_v1_1_defconfig | 1 -
 configs/i12-tvbox_defconfig  | 3 ---
 configs/iNet_3F_defconfig| 1 -
 configs/iNet_3W_defconfig| 1 -
 configs/iNet_86VS_defconfig  | 1 -
 configs/jesurun_q5_defconfig | 3 ---
 configs/mixtile_loftq_defconfig  | 3 ---
 configs/mk802_a10s_defconfig | 3 ---
 configs/mk802_defconfig  | 3 ---
 configs/mk802ii_defconfig| 3 ---
 configs/r7-tv-dongle_defconfig   | 3 ---
 configs/sunxi_Gemei_G9_defconfig | 3 ---
 62 files changed, 3 insertions(+), 150 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0829235..6c4d138 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -645,10 +645,13 @@ config ARCH_SOCFPGA
 config ARCH_SUNXI
bool Support sunxi (Allwinner) SoCs
select DM
+   select DM_ETH
select DM_GPIO
+   select DM_USB if !USB_MUSB_SUNXI
select OF_CONTROL
select OF_SEPARATE
select SPL_DISABLE_OF_CONTROL
+   select USB
 
 config TARGET_SNOWBALL
bool Support snowball
diff --git a/configs/A10-OLinuXino-Lime_defconfig 
b/configs/A10-OLinuXino-Lime_defconfig
index 87ade90..78e799f 100644
--- a/configs/A10-OLinuXino-Lime_defconfig
+++ b/configs/A10-OLinuXino-Lime_defconfig
@@ -11,7 +11,4 @@ 
CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPC(3),USB_
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
 CONFIG_DM_SERIAL=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
diff --git a/configs/A10s-OLinuXino-M_defconfig 
b/configs/A10s-OLinuXino-M_defconfig
index 5a450af..26fadcb 100644
--- a/configs/A10s-OLinuXino-M_defconfig
+++ b/configs/A10s-OLinuXino-M_defconfig
@@ -13,7 +13,4 @@ CONFIG_SYS_EXTRA_OPTIONS=AXP152_POWER,SUNXI_EMAC,USB_EHCI
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_DM_ETH=y
 CONFIG_DM_SERIAL=y
-CONFIG_USB=y
-CONFIG_DM_USB=y
diff --git a/configs/A13-OLinuXinoM_defconfig b/configs

Re: [U-Boot] FEL mode broken since sunxi: Move all boards to the driver-model

2015-06-28 Thread Hans de Goede

Hi,

On 26-06-15 21:50, Ian Campbell wrote:

Hi Hans,

Sorry for only just noticing this, but it looks like FEL mode doesn't
work on my cubietruck since this commit. I get the SPL output:

U-Boot SPL 2015.04-00665-gb6006ba (Jun 26 2015 - 20:38:50)
DRAM: 2048 MiB
CPU: 91200Hz, AXI/AHB/APB: 3/2/2

But then nothing.


Right, that is expected, all the fel spl command does is load the
spl, you need to do something like this to fel boot:

sudo ~hans/bin/fel version
echo Write SPL
sudo ~hans/bin/fel spl u-boot-sunxi-with-spl.bin
echo Exec SPL
sudo ~hans/bin/fel exe 0x2000
sleep 0.5
echo Write u-boot
sudo ~hans/bin/fel write 0x4a00 u-boot-dtb.bin
echo Exec u-boot
sudo ~hans/bin/fel exe 0x4a00

Are you doing that ? Also note that you now need to use
u-boot-dtb.bin not u-boot.bin .


Or have I missed some change in how I should be using it?

Later versions (with CONFIG_FEL gone) exhibit similar behaviour when
using the new spl fel method too, so I got that memo at least...

u-boot-sunxi.git#next has the issue too.

Do you know what this is likely to be


See above.


or shall I try and find some time
to investigate?


If that is not it it would be greay if you can find some time to
investigate this.

Regards,

Hans


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-28 Thread Hans de Goede

Hi,

On 26-06-15 23:05, Tom Rini wrote:

On Fri, Jun 26, 2015 at 12:13:51PM +0200, Hans de Goede wrote:


Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

   Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

   http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

   sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)



NAK, this needs a rework now, sorry!  Joe's changes mean the new
defconfig needs updating.


Ugh, I'm somewhat surprised with these changes, both with the
contents of the changes, as with changes like these landing so
late in the cycle, esp. since these are not uncontroversial.

I've the feeling that these were merged without proper discussion
which is not good, and is esp. bad when it is done so late in the
cycle.

In essense these changes revert my earlier commit where I explictly added:

config CMD_SETEXPR
default y

config CMD_NET
default y

And not only does the just merged series revert these changes, to make
things worse it adds a whole lot more crap to the sunxi defconfigs.

Excuse my language but I've no other words for this, something which
we want enabled on every single sunxi board does not belong in the
defconfigs, we now have defconfig files where more of the lines are
this crap / noise, rather then actual board config, we really need
a better solution for providing per SoC defaults then just having them
all in the defconfig, having them all in the defconfig is crazy, esp.
as more and more compile time config gets moved into Kconfig.

So once more I find both the contents and the time of merging of
this patch-set ill advised, and I'm NOT happy with these changes.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Please pull u-boot-sunxi master (fixes for v2015.07)

2015-06-26 Thread Hans de Goede

Hi Tom,

Please pull u-boot-sunxi/master into master for two bug-fixes,
and one new board:

The following changes since commit 325849ff3d4adeebb8f8f9bc5db950724df9bc21:

  Merge git://git.denx.de/u-boot-usb (2015-06-19 16:46:51 -0400)

are available in the git repository at:

  http://git.denx.de/u-boot-sunxi.git master

for you to fetch changes up to cbf389d94bf300a38d0a26f5aab2efbc9d76a56c:

  sunxi: Add Sinlinx SinA33 defconfig (2015-06-26 11:56:33 +0200)


Chen-Yu Tsai (5):
  sunxi: hardware-feature-specific function index defines for PORT F UART0
  sunxi: rsb: Enable R_PIO clock before configuring external pins
  sunxi: Add support for UART0 in PB pin group on A33
  sunxi: Sync sun8i dts files with the linux kernel
  sunxi: Add Sinlinx SinA33 defconfig

 arch/arm/cpu/armv7/sunxi/board.c  |  12 ++-
 arch/arm/cpu/armv7/sunxi/rsb.c|   5 +-
 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/sun8i-a23-a33.dtsi   |  10 +++
 arch/arm/dts/sun8i-a33-sinlinx-sina33.dts | 129 ++
 arch/arm/dts/sun8i-a33.dtsi   |   8 ++
 arch/arm/include/asm/arch-sunxi/gpio.h|   1 +
 board/sunxi/MAINTAINERS   |   6 ++
 configs/Sinlinx_SinA33_defconfig  |   8 ++
 9 files changed, 175 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/sun8i-a33-sinlinx-sina33.dts
 create mode 100644 configs/Sinlinx_SinA33_defconfig

Thanks  Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/5] sunxi: misc fixes and SinA33 support

2015-06-26 Thread Hans de Goede

Hi,

On 23-06-15 13:57, Chen-Yu Tsai wrote:

Hi,

This series adds support for Sinlinx SinA33, an A33 devboard, while
also fixing some things I encountered along the way.

Patch 1 fixes build break when using PORT F UART0. (It seems no one
uses it now that we have LCD support.)

Patch 2 fixes the RSB errors I ran into on my A33 devices.

Patch 3 adds support for UART0 on PB pin group, which is A33 specific.

Patch 4 syncs the sun8i dts files with the latest dts patches bound
for 4.2.

Patch 5 adds a defconfig for the Sinlinx SinA33.


Thanks, I've merged all 5 and just send a pull-req out to
get these included into v2015.07 (given the bug-fix nature
of the first 2 patches).

Regards,

Hans




Regards
ChenYu

Chen-Yu Tsai (5):
   sunxi: hardware-feature-specific function index defines for PORT F
 UART0
   sunxi: rsb: Enable R_PIO clock before configuring external pins
   sunxi: Add support for UART0 in PB pin group on A33
   sunxi: Sync sun8i dts files with the linux kernel
   sunxi: Add Sinlinx SinA33 defconfig

  arch/arm/cpu/armv7/sunxi/board.c   |  12 ++-
  arch/arm/cpu/armv7/sunxi/rsb.c |   5 +-
  arch/arm/dts/Makefile  |   3 +-
  arch/arm/dts/sun8i-a23-a33.dtsi|  10 ++
  ...sun8i-a33.dtsi = sun8i-a33-sinlinx-sina33.dts} | 106 ++---
  arch/arm/dts/sun8i-a33.dtsi|   8 ++
  arch/arm/include/asm/arch-sunxi/gpio.h |   1 +
  board/sunxi/MAINTAINERS|   6 ++
  configs/Sinlinx_SinA33_defconfig   |   8 ++
  9 files changed, 119 insertions(+), 40 deletions(-)
  copy arch/arm/dts/{sun8i-a33.dtsi = sun8i-a33-sinlinx-sina33.dts} (56%)
  create mode 100644 configs/Sinlinx_SinA33_defconfig


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] sunxi: musb: Fix usb reset handling

2015-06-26 Thread Hans de Goede

Hi,

On 26-06-15 12:20, Maxime Ripard wrote:

Hi,

On Sun, Jun 14, 2015 at 12:40:11PM +0200, Hans de Goede wrote:

Paul, can you test these with gadget mode? Specifically if they help the
problem you were seeing when switching roles?

Also this bit from the kernel code for the sunxi glue may be relevant
to your problems:

 if ((musb-int_usb  MUSB_INTR_RESET)  !is_host_active(musb)) {
 /* ep0 FADDR must be 0 when (re)entering peripheral mode */
 musb_ep_select(musb-mregs, 0);
 musb_writeb(musb-mregs, MUSB_FADDR, 0);
 }

This is from the interrupt handler in the sunxi-musb glue in the kernel,
maybe we can do the same, and/or maybe we need to do:

/* ep0 FADDR must be 0 when (re)entering peripheral mode */
musb_ep_select(musb-mregs, 0);
musb_writeb(musb-mregs, MUSB_FADDR, 0);

 From sunxi_musb_disable?


So, I was affected by this issue on a SinA33, even when not switching
roles (since the SinA33 is peripheral only). The issue I was seeing
what that when I was two subsequent use of any gadget (fastboot, USB
ethernet traffic), the second would silently fail on U-boot side with
the host failing to enumerate the device.

Paul pointed me to that thread, and your suggestion on EP0 seems like
a good lead, since the ugly http://pastebin.com/9Y6S9Hpw makes it work.


Ah, that is not that ugly actually, I can take that as is if you want me
too just submit it to the u-boot list with me in the Cc and I'll pick it
up and put it in u-boot-sunxi/next

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] sunxi: musb: Fix usb reset handling

2015-06-26 Thread Hans de Goede

Hi,

On 26-06-15 12:20, Maxime Ripard wrote:

Hi,

On Sun, Jun 14, 2015 at 12:40:11PM +0200, Hans de Goede wrote:

Paul, can you test these with gadget mode? Specifically if they help the
problem you were seeing when switching roles?

Also this bit from the kernel code for the sunxi glue may be relevant
to your problems:

 if ((musb-int_usb  MUSB_INTR_RESET)  !is_host_active(musb)) {
 /* ep0 FADDR must be 0 when (re)entering peripheral mode */
 musb_ep_select(musb-mregs, 0);
 musb_writeb(musb-mregs, MUSB_FADDR, 0);
 }

This is from the interrupt handler in the sunxi-musb glue in the kernel,
maybe we can do the same, and/or maybe we need to do:

/* ep0 FADDR must be 0 when (re)entering peripheral mode */
musb_ep_select(musb-mregs, 0);
musb_writeb(musb-mregs, MUSB_FADDR, 0);

 From sunxi_musb_disable?


So, I was affected by this issue on a SinA33, even when not switching
roles (since the SinA33 is peripheral only).


Missed this the first reply, are you sure, that is somewhat weird. I mean
it is possible if they did not hook up the id pin, or do not allow you
to send out +5v, but it is weird. I guess they did route the real usb-host
to an USB-A receptacle on that board, so it is not a big deal, right ?

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] sunxi: musb: Improve output during probing

2015-06-23 Thread Hans de Goede

Hi,

On 22-06-15 18:11, Ian Campbell wrote:

On Mon, 2015-06-22 at 17:39 +0200, Hans de Goede wrote:

How about the following:


Subject: [PATCH 1/3] sunxi: musb: Improve output during probing

When we return an error the usb core will log a message, so in this case
do not print anything.

Signed-off-by: Hans de Goede hdego...@redhat.com


Much better, especially given the below.

Acked-by: Ian Campbell ian.campb...@citrix.com


Thanks.





--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev)
   {
  struct musb_host_data *host = dev_get_priv(dev);
  struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+   int ret;


Wrong sort of w/space I suspect.


Nope, this comes from me copy and pasting the diff output
from a xterm, I just double checked and the whitespace is as
it should be in my tree :)

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-22 Thread Hans de Goede

Hi,

On 21-06-15 10:01, Ian Campbell wrote:

On Sat, 2015-06-20 at 17:35 +0200, Hans de Goede wrote:

Now that the device-model port of the musb mode makes it possible, enable
both the ehci and oth in host mode on boards where the otg is wired up in


otg?


Replaced with musb in my personal tree.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] sunxi: musb: Improve output during probing

2015-06-22 Thread Hans de Goede

Hi,

On 21-06-15 10:00, Ian Campbell wrote:

On Sat, 2015-06-20 at 17:35 +0200, Hans de Goede wrote:

When we return an error the usb core will log a message, so in this case
do not print a newline, instead print :  after our identifier as a
seperator between our identifier and the error message logged by the core.


separator.


Fixed in my personal tree.


This seems like a lot of fragile faff second guessing what some other
component does (and is going to do in the future).


Right, but if that other component changes all we end up with is less
then optimal console output it will not really break anything.

 Can we not have musb

take over init time logging completely


The problem is that all the other usb host drivers also depend on this
behavior of the usb core.


or just live with:
 MUSB OTG: Failed host init
 Flux capacitor has reversed polarity
which I suppose is roughly how it appears today?


I do not like just living with it, I believe a certain amount of spit
and polish is important, even for text messages like these.

I would not have written this if I did not consider the current situation
ugly :)

How about the following:


Subject: [PATCH 1/3] sunxi: musb: Improve output during probing

When we return an error the usb core will log a message, so in this case
do not print anything.

Signed-off-by: Hans de Goede hdego...@redhat.com

--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev)
 {
struct musb_host_data *host = dev_get_priv(dev);
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+   int ret;

priv-desc_before_addr = true;

if (!host-host) {
host-host = musb_init_controller(musb_plat, NULL,
  (void *)SUNXI_USB0_BASE);
-   if (!host-host) {
-   printf(Failed to init the controller\n);
+   if (!host-host)
return -EIO;
-   }
}

-   printf(MUSB OTG in host-mode\n);
+   ret = musb_lowlevel_init(host);
+   if (ret == 0)
+   printf(MUSB OTG\n);

-   return musb_lowlevel_init(host);
+   return ret;
 }

 int musb_usb_remove(struct udevice *dev)


This is exactly what the other host drivers do, only print
something on success, and leave printing errors up to the
caller.


Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede
Hi All,

Here is a small series enabling the combined use of ehci + musb-otg on more
sunxi boards. This applies on top of my large series for making this possible
posted earlier.

As said before I believe it is best if all the sunxi bits of that series
go upstream through u-boot-sunxi/master, the same applies for these 3.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] sunxi: musb: Stop treating not having a vbus-det gpio as an error

2015-06-20 Thread Hans de Goede
On some boards the otg is wired up in host-only mode in this case we
have no vbus-det gpio.

Stop logging an error from sunxi_usb_phy_vbus_detect() in this case, and
stop treating sunxi_usb_phy_vbus_detect() returning a negative errno, as
if a charger is plugged into the otg port.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 arch/arm/cpu/armv7/sunxi/usb_phy.c | 4 +---
 drivers/usb/musb-new/sunxi.c   | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c 
b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index 5e82ddc..4d63a74 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -237,10 +237,8 @@ int sunxi_usb_phy_vbus_detect(int index)
struct sunxi_usb_phy *phy = sunxi_usb_phy[index];
int err, retries = 3;
 
-   if (phy-gpio_vbus_det  0) {
-   eprintf(Error: invalid vbus detection pin\n);
+   if (phy-gpio_vbus_det  0)
return phy-gpio_vbus_det;
-   }
 
err = gpio_get_value(phy-gpio_vbus_det);
/*
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index bb88687..f091a2d 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -208,7 +208,7 @@ static int sunxi_musb_enable(struct musb *musb)
 
if (is_host_enabled(musb)) {
ret = sunxi_usb_phy_vbus_detect(0);
-   if (ret) {
+   if (ret == 1) {
printf(A charger is plugged into the OTG: );
return -ENODEV;
}
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede
Now that the device-model port of the musb mode makes it possible, enable
both the ehci and oth in host mode on boards where the otg is wired up in
host only mode, either via an usb-a receptacle or via an usb - sata
converter.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 configs/CSQ_CS908_defconfig| 4 +++-
 configs/Mele_A1000G_quad_defconfig | 4 +++-
 configs/Mini-X_defconfig   | 5 -
 configs/ba10_tv_box_defconfig  | 5 -
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig
index 850d70d..f89e67c 100644
--- a/configs/CSQ_CS908_defconfig
+++ b/configs/CSQ_CS908_defconfig
@@ -6,7 +6,9 @@ CONFIG_USB1_VBUS_PIN=
 CONFIG_USB2_VBUS_PIN=
 CONFIG_DEFAULT_DEVICE_TREE=sun6i-a31s-cs908
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=USB_EHCI,SUNXI_GMAC
+CONFIG_SYS_EXTRA_OPTIONS=SUNXI_GMAC
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
diff --git a/configs/Mele_A1000G_quad_defconfig 
b/configs/Mele_A1000G_quad_defconfig
index 3a746c8..3a2c155 100644
--- a/configs/Mele_A1000G_quad_defconfig
+++ b/configs/Mele_A1000G_quad_defconfig
@@ -16,9 +16,11 @@ CONFIG_USB1_VBUS_PIN=PC27
 CONFIG_USB2_VBUS_PIN=
 CONFIG_DEFAULT_DEVICE_TREE=sun6i-a31-mele-a1000g-quad
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=USB_EHCI,SUNXI_GMAC
+CONFIG_SYS_EXTRA_OPTIONS=SUNXI_GMAC
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_AXP221_DCDC1_VOLT=3300
 CONFIG_AXP221_DLDO1_VOLT=3300
 CONFIG_AXP221_DLDO4_VOLT=3300
 CONFIG_AXP221_ALDO1_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
diff --git a/configs/Mini-X_defconfig b/configs/Mini-X_defconfig
index 918b639..3ce3272 100644
--- a/configs/Mini-X_defconfig
+++ b/configs/Mini-X_defconfig
@@ -3,4 +3,7 @@ CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN4I=y
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-mini-xplus
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB0_VBUS_PIN=PB9
diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig
index f2ab415..111792f 100644
--- a/configs/ba10_tv_box_defconfig
+++ b/configs/ba10_tv_box_defconfig
@@ -6,4 +6,7 @@ CONFIG_DRAM_EMR1=4
 CONFIG_USB2_VBUS_PIN=PH12
 CONFIG_DEFAULT_DEVICE_TREE=sun4i-a10-ba10-tvbox
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC,USB_EHCI
+CONFIG_SYS_EXTRA_OPTIONS=AXP209_POWER,SUNXI_EMAC
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_SUNXI=y
+CONFIG_USB0_VBUS_PIN=PB9
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] sunxi: musb: Improve output during probing

2015-06-20 Thread Hans de Goede
When we return an error the usb core will log a message, so in this case
do not print a newline, instead print :  after our identifier as a
seperator between our identifier and the error message logged by the core.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/usb/musb-new/sunxi.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index d1cb8e0..bb88687 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -301,21 +301,26 @@ int musb_usb_probe(struct udevice *dev)
 {
struct musb_host_data *host = dev_get_priv(dev);
struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+   int ret;
 
priv-desc_before_addr = true;
 
+   printf(MUSB OTG);
+
if (!host-host) {
host-host = musb_init_controller(musb_plat, NULL,
  (void *)SUNXI_USB0_BASE);
if (!host-host) {
-   printf(Failed to init the controller\n);
+   printf(: );
return -EIO;
}
}
 
-   printf(MUSB OTG in host-mode\n);
+   ret = musb_lowlevel_init(host);
+
+   printf((ret == 0) ? \n : : );
 
-   return musb_lowlevel_init(host);
+   return ret;
 }
 
 int musb_usb_remove(struct udevice *dev)
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] sunxi: Enable both ehci and otg in host mode on various boards

2015-06-20 Thread Hans de Goede

Hi,

On 20-06-15 18:08, Marek Vasut wrote:

On Saturday, June 20, 2015 at 05:35:06 PM, Hans de Goede wrote:

Hi All,

Here is a small series enabling the combined use of ehci + musb-otg on more
sunxi boards. This applies on top of my large series for making this
possible posted earlier.

As said before I believe it is best if all the sunxi bits of that series
go upstream through u-boot-sunxi/master, the same applies for these 3.

Regards,


Series is

Reviewed-by: Marek Vasut ma...@denx.de


I assume this only applies to these 3, or do you mean both the original
series adding musb device-model support as well as these 3?

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 21/22] sunxi: Kconfig: Enable CONFIG_USB and friends by default on sunxi

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 09:46, Ian Campbell wrote:

On Wed, 2015-06-17 at 21:34 +0200, Hans de Goede wrote:

Start using the new Kconfig options which are available for most of the
USB settings now.

This also allows us to use CONFIG_USB_EHCI_HCD=y in defconfig files
for new boards instead of CONFIG_SYS_EXTRA_OPTIONS=USB_EHCI.


Should there not be a raft of defconfig changes at the same time? Or is
that nice but not necessary at this stage?


There could be a of defconfig changes at the same time, but it is not
necessary, so I decided to wait with cleaning this up till later.

I would like to first see all the other stuff from CONFIG_SYS_EXTRA_OPTIONS
by Kconfig-ified too, and then we can cleanup all the CONFIG_SYS_EXTRA_OPTIONS
usage in one go.

Regards,

Hans





Signed-off-by: Hans de Goede hdego...@redhat.com
---
  board/sunxi/Kconfig| 9 +
  include/configs/sunxi-common.h | 5 -
  2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 6a19f85..8d55cd6 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -594,4 +594,13 @@ config CMD_SETEXPR
  config CMD_NET
default y

+config CMD_USB
+   default y
+
+config USB
+   default y
+
+config USB_STORAGE
+   default y
+
  endif
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 063abd5..e2371a1 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -338,11 +338,6 @@ extern int soft_i2c_gpio_scl;
  #define CONFIG_MUSB_PIO_ONLY
  #endif

-#if defined CONFIG_USB_EHCI || defined CONFIG_USB_MUSB_SUNXI
-#define CONFIG_CMD_USB
-#define CONFIG_USB_STORAGE
-#endif
-
  #ifdef CONFIG_USB_KEYBOARD
  #define CONFIG_CONSOLE_MUX
  #define CONFIG_PREBOOT




___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 00/22] Convert musb host mode code to the device-model

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 15:10, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:


Hi Marek and Simon,

This series started out with the idea that it would be a nice small project
for the weekend, but it turned out to be a bit more work...

The main purpose of this series is to convert the musb host mode code to the
device-model this has also resulted in various usb fixes / cleanups /
reworking to make this possible, both in the generic usb code as well as in
the device model usb code.

Given that this touches both, I think it is probably best to merge the
first 15 patches through Simon's tree like we did last time, then once those
are place I can merge the sunxi bits. Note this is intended for v2015.10
(ofcourse).

Note that this series is useful for a bunch more boards then just the
single one the last patch updates to use musb + ehci + ohci, but that is
the one I've been testing with other defconfig-s will be updated with
followup patches.

Please review.


Thanks for putting this together. Actually I'm not sure what musb is.
Can you explain what it is used for - it seems to be referred to as a
new version of something else. Why do we have musb and non-musb? Is
there a README somewhere I could read?


musb stands for mentor-graphics usb it is an otg usb2 ip-block used in
various SoCs as otg controller. As an otg controller it can be used in
both host or peripheral mode. This series converts the code for using
it in host-mode to the device-model.

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 00/22] Convert musb host mode code to the device-model

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 15:10, Simon Glass wrote:

Hi Hans,

On 17 June 2015 at 13:33, Hans de Goede hdego...@redhat.com wrote:


Hi Marek and Simon,

This series started out with the idea that it would be a nice small project
for the weekend, but it turned out to be a bit more work...

The main purpose of this series is to convert the musb host mode code to the
device-model this has also resulted in various usb fixes / cleanups /
reworking to make this possible, both in the generic usb code as well as in
the device model usb code.

Given that this touches both, I think it is probably best to merge the
first 15 patches through Simon's tree like we did last time, then once those
are place I can merge the sunxi bits. Note this is intended for v2015.10
(ofcourse).

Note that this series is useful for a bunch more boards then just the
single one the last patch updates to use musb + ehci + ohci, but that is
the one I've been testing with other defconfig-s will be updated with
followup patches.

Please review.


Thanks for putting this together. Actually I'm not sure what musb is.
Can you explain what it is used for - it seems to be referred to as a
new version of something else. Why do we have musb and non-musb? Is
there a README somewhere I could read?


p.s.

As for there being both a drivers/usb/musb and a driver/usb/musb-new
directoyry, I believe that they both are drivers for the same hardware,
but not all boards have been ported to musb-new yet. musb-new is
derived from recent kernel code for the musb controller.

Regards,

Hans





Regards,
Simon


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] sunxi: musb: Fix usb reset handling

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 14:35, Marek Vasut wrote:

On Sunday, June 14, 2015 at 12:40:11 PM, Hans de Goede wrote:

Hi Ian, Paul,

Here is a patch to fix the problems where most usb devices will no longer
work after a usb reset , when connected to the otg controller in host
mode + a related cleanup patch.

Ian I would like to send out a PR with these 2 as fixed for v2015.07, can
you review them please? Note I've not tested this with the otg in gadget
mode, but we do not have gadget mode enabled by default anywhere atm, so
I still consider this suitable as a bugfix for v2015.07.

Paul, can you test these with gadget mode? Specifically if they help the
problem you were seeing when switching roles?

Also this bit from the kernel code for the sunxi glue may be relevant
to your problems:

 if ((musb-int_usb  MUSB_INTR_RESET)  !is_host_active(musb)) {
 /* ep0 FADDR must be 0 when (re)entering peripheral mode */
 musb_ep_select(musb-mregs, 0);
 musb_writeb(musb-mregs, MUSB_FADDR, 0);
 }

This is from the interrupt handler in the sunxi-musb glue in the kernel,
maybe we can do the same, and/or maybe we need to do:

/* ep0 FADDR must be 0 when (re)entering peripheral mode */
musb_ep_select(musb-mregs, 0);
musb_writeb(musb-mregs, MUSB_FADDR, 0);

 From sunxi_musb_disable?

 From my experience sofar we should avoid doing a full reset from musb_stop
/ sunxi_musb_disable as musb_init_controller never gets re-run, so doing a
full reset leaves things in a bad state where only ep0 still seems to
work, this may be what you were seeing before.


Hi,

do you want me to pick this via u-boot-usb/master ?


No, I've already send a pull-req for them via u-boot-sunxi/master and they
are already merged :)

Regards,

Hans
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 19/22] sunxi: musb: Move musb config and platdata to the sunxi-musb glue

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 09:43, Ian Campbell wrote:

On Wed, 2015-06-17 at 21:34 +0200, Hans de Goede wrote:

Move the musb config and platdata to the sunxi-musb glue, which is where
it really belongs. This is preparation patch for adding device-model
support for the sunxi-musb-host code.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
  arch/arm/include/asm/arch-sunxi/usb_phy.h |  7 +++
  board/sunxi/board.c   | 28 ++---
  drivers/usb/musb-new/sunxi.c  | 35 ++-
  3 files changed, 34 insertions(+), 36 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/usb_phy.h 
b/arch/arm/include/asm/arch-sunxi/usb_phy.h
index 5a9cacb..17d31b8 100644
--- a/arch/arm/include/asm/arch-sunxi/usb_phy.h
+++ b/arch/arm/include/asm/arch-sunxi/usb_phy.h
@@ -19,3 +19,10 @@ void sunxi_usb_phy_power_off(int index);
  int sunxi_usb_phy_vbus_detect(int index);
  int sunxi_usb_phy_id_detect(int index);
  void sunxi_usb_phy_enable_squelch_detect(int index, int enable);
+
+/* Not really phy related, but we have to declare this somewhere ... */


I guess arch/arm/include/asm/arch-sunxi/usbc.h isn't any better?


Well we do not have that, and I did not feel it was worth adding yet
another .h file for just this one function.



With it here or there:

Acked-by: Ian Campbell i...@hellion.org.uk


Regards,

Hans





+#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
+void sunxi_musb_board_init(void);
+#else
+#define sunxi_musb_board_init()
+#endif


Ian.


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 18/22] sunxi: musb: Add id pin support

2015-06-19 Thread Hans de Goede

Hi,

On 19-06-15 09:40, Ian Campbell wrote:

On Wed, 2015-06-17 at 21:34 +0200, Hans de Goede wrote:

When in host mode check if there is a host cable inserted into the otg
port by checking the id pin. If there is no host cable return an error to
make usb_lowlevel_init() exit early, rather then waiting for 1 second
for a device which will never show up.

Signed-off-by: Hans de Goede hdego...@redhat.com


I guess the defconfig fiddling is here because this is the culmination
of these three patches which makes it useful to set this value?


Right.


In which case:

Acked-by: Ian Campbell i...@hellion.org.uk


Thanks,

Hans



Although I'd have been inclined to do it where the Kconfig option was
added (ack to that too if you want to move).

Ian.



___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] usb: ehci: Properly deal with data toggle for interrupt endpoints

2015-06-18 Thread Hans de Goede
Without this we loose every other interrupt packet. We never noticed this
because with keyboards the packets which we were loosing would normally
be key release packets.

But now that we do keyrepeat in software instead of relying on the hid
idle functionality, missing a release will result in key repeat triggering.

This commit fixes this.

Signed-off-by: Hans de Goede hdego...@redhat.com
---
 drivers/usb/host/ehci-hcd.c | 26 +++---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 1e5a6e2..bf02221 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1214,6 +1214,7 @@ static int _ehci_submit_control_msg(struct usb_device 
*dev, unsigned long pipe,
 
 struct int_queue {
int elementsize;
+   unsigned long pipe;
struct QH *first;
struct QH *current;
struct QH *last;
@@ -1269,7 +1270,7 @@ static struct int_queue *_ehci_create_int_queue(struct 
usb_device *dev,
 {
struct ehci_ctrl *ctrl = ehci_get_ctrl(dev);
struct int_queue *result = NULL;
-   int i;
+   uint32_t i, toggle;
 
/*
 * Interrupt transfers requiring several transactions are not supported
@@ -1309,6 +1310,7 @@ static struct int_queue *_ehci_create_int_queue(struct 
usb_device *dev,
goto fail1;
}
result-elementsize = elementsize;
+   result-pipe = pipe;
result-first = memalign(USB_DMA_MINALIGN,
 sizeof(struct QH) * queuesize);
if (!result-first) {
@@ -1326,6 +1328,8 @@ static struct int_queue *_ehci_create_int_queue(struct 
usb_device *dev,
memset(result-first, 0, sizeof(struct QH) * queuesize);
memset(result-tds, 0, sizeof(struct qTD) * queuesize);
 
+   toggle = usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
+
for (i = 0; i  queuesize; i++) {
struct QH *qh = result-first + i;
struct qTD *td = result-tds + i;
@@ -1357,7 +1361,9 @@ static struct int_queue *_ehci_create_int_queue(struct 
usb_device *dev,
td-qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
debug(communication direction is '%s'\n,
  usb_pipein(pipe) ? in : out);
-   td-qt_token = cpu_to_hc32((elementsize  16) |
+   td-qt_token = cpu_to_hc32(
+   QT_TOKEN_DT(toggle) |
+   (elementsize  16) |
((usb_pipein(pipe) ? 1 : 0)  8) | /* IN/OUT token */
0x80); /* active */
td-qt_buffer[0] =
@@ -1372,6 +1378,7 @@ static struct int_queue *_ehci_create_int_queue(struct 
usb_device *dev,
cpu_to_hc32((td-qt_buffer[0] + 0x4000)  ~0xfff);
 
*buf = buffer + i * elementsize;
+   toggle ^= 1;
}
 
flush_dcache_range((unsigned long)buffer,
@@ -1426,6 +1433,8 @@ static void *_ehci_poll_int_queue(struct usb_device *dev,
 {
struct QH *cur = queue-current;
struct qTD *cur_td;
+   uint32_t token, toggle;
+   unsigned long pipe = queue-pipe;
 
/* depleted queue */
if (cur == NULL) {
@@ -1436,12 +1445,15 @@ static void *_ehci_poll_int_queue(struct usb_device 
*dev,
cur_td = queue-tds[queue-current - queue-first];
invalidate_dcache_range((unsigned long)cur_td,
ALIGN_END_ADDR(struct qTD, cur_td, 1));
-   if (QT_TOKEN_GET_STATUS(hc32_to_cpu(cur_td-qt_token)) 
-   QT_TOKEN_STATUS_ACTIVE) {
-   debug(Exit poll_int_queue with no completed intr transfer. 
token is %x\n,
- hc32_to_cpu(cur_td-qt_token));
+   token = hc32_to_cpu(cur_td-qt_token);
+   if (QT_TOKEN_GET_STATUS(token)  QT_TOKEN_STATUS_ACTIVE) {
+   debug(Exit poll_int_queue with no completed intr transfer. 
token is %x\n, token);
return NULL;
}
+
+   toggle = QT_TOKEN_GET_DT(token);
+   usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe), toggle);
+
if (!(cur-qh_link  QH_LINK_TERMINATE))
queue-current++;
else
@@ -1452,7 +1464,7 @@ static void *_ehci_poll_int_queue(struct usb_device *dev,
   queue-elementsize));
 
debug(Exit poll_int_queue with completed intr transfer. token is %x at 
%p (first at %p)\n,
- hc32_to_cpu(cur_td-qt_token), cur, queue-first);
+ token, cur, queue-first);
return cur-buffer;
 }
 
-- 
2.4.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


<    3   4   5   6   7   8   9   10   11   12   >