[no subject]

2016-06-29 Thread bob
Hello LKML. I have had a small ASUS usb screen gadget that came with my 
motherboard. Its been sitting on my desk for about 7 years. Having 
exhausted my patience waiting for a nifty Linux app to drive it, I wrote 
one. If you have such a beast and want the app, go to 
https://github.com/mayorbobster/screenduo4linux If you aren't 
interested, please disregard this notice. Thank you.





--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] hwrng: chaoskey - Fix URB warning due to timeout on Alea

2016-06-03 Thread Bob Ham
The first read on an Alea takes about 1.8 seconds, more than the
timeout value waiting for the read.  As a consequence, later URB reuse
causes the warning given below.  To avoid this, we increase the wait
time for the first read on the Alea.

[   78.293247] WARNING: CPU: 3 PID: 1892 at drivers/usb/core/urb.c:338 
usb_submit_urb+0x2b4/0x580 [usbcore]
[   78.293250] URB 8802135be3c0 submitted while active
[   78.293252] Modules linked in: chaoskey(+) rng_core rfcomm binfmt_misc bnep 
cfg80211 nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc 
bridge stp llc tun snd_hda_codec_hdmi snd_hda_codec_realtek 
snd_hda_codec_generic iTCO_wdt iTCO_vendor_support nls_utf8 nls_cp437 vfat fat 
intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel efi_pstore 
kvm irqbypass pcspkr btusb btrtl btbcm btintel uvcvideo joydev bluetooth 
videobuf2_vmalloc videobuf2_memops efivars videobuf2_v4l2 serio_raw i2c_i801 
videobuf2_core videodev cdc_mbim media lpc_ich shpchp mfd_core cdc_ncm usbnet 
mii cdc_wdm cdc_acm evdev snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core 
i915 snd_pcm snd_timer i2c_algo_bit drm_kms_helper wmi thinkpad_acpi drm nvram 
mei_me mei snd soundcore rfkill ac battery i2c_core
[   78.293335]  video button tpm_tis tpm fuse parport_pc ppdev lp parport 
autofs4 ext4 crc16 jbd2 mbcache algif_skcipher af_alg hid_generic usbhid hid 
dm_crypt dm_mod sg sr_mod cdrom sd_mod crct10dif_pclmul crc32_pclmul 
crc32c_intel jitterentropy_rng sha256_generic hmac drbg aesni_intel xhci_pci 
aes_x86_64 ahci glue_helper xhci_hcd ehci_pci lrw libahci gf128mul ablk_helper 
cryptd libata sdhci_pci psmouse sdhci scsi_mod ehci_hcd mmc_core usbcore 
usb_common thermal
[   78.293402] CPU: 3 PID: 1892 Comm: hwrng Not tainted 4.7.0-rc1-linux-14+ #16
[   78.293405] Hardware name: LENOVO 232577G/232577G, BIOS G2ET92WW (2.52 ) 
02/22/2013
[   78.293408]   812dfa0f 8801fa5b3d68 

[   78.293413]  81072224 8802135be3c0 8801fa5b3db8 
880212e44210
[   78.293418]  0040 880209fb32c0 880212e44200 
8107228f
[   78.293422] Call Trace:
[   78.293432]  [] ? dump_stack+0x5c/0x7d
[   78.293437]  [] ? __warn+0xc4/0xe0
[   78.293441]  [] ? warn_slowpath_fmt+0x4f/0x60
[   78.293451]  [] ? enqueue_task_fair+0xcd2/0x1260
[   78.293463]  [] ? usb_submit_urb+0x2b4/0x580 [usbcore]
[   78.293474]  [] ? __pm_runtime_resume+0x55/0x70
[   78.293484]  [] ? _chaoskey_fill+0x132/0x250 [chaoskey]
[   78.293485] usbcore: registered new interface driver chaoskey
[   78.293493]  [] ? wait_woken+0x90/0x90
[   78.293500]  [] ? devm_hwrng_register+0x80/0x80 [rng_core]
[   78.293505]  [] ? chaoskey_rng_read+0x127/0x140 [chaoskey]
[   78.293511]  [] ? devm_hwrng_register+0x80/0x80 [rng_core]
[   78.293515]  [] ? hwrng_fillfn+0x6e/0x120 [rng_core]
[   78.293520]  [] ? kthread+0xcf/0xf0
[   78.293529]  [] ? ret_from_fork+0x1f/0x40
[   78.293535]  [] ? kthread_park+0x50/0x50

Signed-off-by: Bob Ham <bob@collabora.com>
---
 drivers/usb/misc/chaoskey.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 9aef46b..6ddd08a 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -60,7 +60,8 @@ MODULE_LICENSE("GPL");
 
 #define CHAOSKEY_BUF_LEN   64  /* max size of USB full speed packet */
 
-#define NAK_TIMEOUT (HZ)   /* stall/wait timeout for device */
+#define NAK_TIMEOUT (HZ)   /* normal stall/wait timeout */
+#define ALEA_FIRST_TIMEOUT (HZ*3)  /* first stall/wait timeout for Alea */
 
 #ifdef CONFIG_USB_DYNAMIC_MINORS
 #define USB_CHAOSKEY_MINOR_BASE 0
@@ -88,6 +89,7 @@ struct chaoskey {
int open;   /* open count */
bool present;   /* device not disconnected */
bool reading;   /* ongoing IO */
+   bool reads_started; /* track first read for Alea */
int size;   /* size of buf */
int valid;  /* bytes of buf read */
int used;   /* bytes of buf consumed */
@@ -192,6 +194,9 @@ static int chaoskey_probe(struct usb_interface *interface,
 
dev->in_ep = in_ep;
 
+   if (udev->descriptor.idVendor != ALEA_VENDOR_ID)
+   dev->reads_started = 1;
+
dev->size = size;
dev->present = 1;
 
@@ -361,6 +366,7 @@ static int _chaoskey_fill(struct chaoskey *dev)
 {
DEFINE_WAIT(wait);
int result;
+   bool started;
 
usb_dbg(dev->interface, "fill");
 
@@ -393,10 +399,17 @@ static int _chaoskey_fill(struct chaoskey *dev)
goto out;
}
 
+   /* The first read on the Alea takes a little under 2 seconds.
+* Reads after the first read take only a few microseconds
+* though.  Presumably the entropy-gene

[PATCH 0/2] hwrng: chaoskey - Add support for Araneus Alea I USB RNG

2016-06-03 Thread Bob Ham
Two patches to add support for the Araneus Alea I USB RNG to the
chaoskey driver.  The first simply includes the Alea I as a device,
the second fixes an issue with the timeout on the first read.

Bob Ham (2):
  hwrng: chaoskey - Add support for Araneus Alea I USB RNG
  hwrng: chaoskey - Fix URB warning due to timeout on Alea

 drivers/usb/misc/Kconfig| 11 ++-
 drivers/usb/misc/chaoskey.c | 21 +++--
 2 files changed, 25 insertions(+), 7 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] hwrng: chaoskey - Add support for Araneus Alea I USB RNG

2016-06-03 Thread Bob Ham
Adds support for the Araneus Alea I USB hardware Random Number
Generator which is interfaced with in exactly the same way as the
Altus Metrum ChaosKey.  We just add the appropriate device ID and
modify the config help text.

Signed-off-by: Bob Ham <bob@collabora.com>
---
 drivers/usb/misc/Kconfig| 11 ++-
 drivers/usb/misc/chaoskey.c |  4 
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index e9e5ae5..6e70597 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -260,11 +260,12 @@ config USB_CHAOSKEY
tristate "ChaosKey random number generator driver support"
depends on HW_RANDOM
help
- Say Y here if you want to connect an AltusMetrum ChaosKey to
- your computer's USB port. The ChaosKey is a hardware random
- number generator which hooks into the kernel entropy pool to
- ensure a large supply of entropy for /dev/random and
- /dev/urandom and also provides direct access via /dev/chaoskeyX
+ Say Y here if you want to connect an AltusMetrum ChaosKey or
+ Araneus Alea I to your computer's USB port. These devices
+ are hardware random number generators which hook into the
+ kernel entropy pool to ensure a large supply of entropy for
+ /dev/random and /dev/urandom and also provides direct access
+ via /dev/chaoskeyX
 
  To compile this driver as a module, choose M here: the
  module will be called chaoskey.
diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c
index 76350e4..9aef46b 100644
--- a/drivers/usb/misc/chaoskey.c
+++ b/drivers/usb/misc/chaoskey.c
@@ -55,6 +55,9 @@ MODULE_LICENSE("GPL");
 #define CHAOSKEY_VENDOR_ID 0x1d50  /* OpenMoko */
 #define CHAOSKEY_PRODUCT_ID0x60c6  /* ChaosKey */
 
+#define ALEA_VENDOR_ID 0x12d8  /* Araneus */
+#define ALEA_PRODUCT_ID0x0001  /* Alea I */
+
 #define CHAOSKEY_BUF_LEN   64  /* max size of USB full speed packet */
 
 #define NAK_TIMEOUT (HZ)   /* stall/wait timeout for device */
@@ -69,6 +72,7 @@ MODULE_LICENSE("GPL");
 
 static const struct usb_device_id chaoskey_table[] = {
{ USB_DEVICE(CHAOSKEY_VENDOR_ID, CHAOSKEY_PRODUCT_ID) },
+   { USB_DEVICE(ALEA_VENDOR_ID, ALEA_PRODUCT_ID) },
{ },
 };
 MODULE_DEVICE_TABLE(usb, chaoskey_table);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hwrng: alea - Add support for Araneus Alea I USB RNG

2016-06-02 Thread Bob Ham
On Thu, 2016-06-02 at 12:43 +0200, Clemens Ladisch wrote:
> Bob Ham wrote:
> > Adds support for the Araneus Alea I USB hardware Random Number
> > Generator.  This RNG creates entropy at a high rate, about 100kb/s.
> >
> > Signed-off-by: Bob Ham <bob@collabora.com>
> > ---
> >
> > +++ b/drivers/char/hw_random/alea.c
> 
> Why didn't you just add the device ID to chaoskey.c?
> (Because that one is hidden in drivers/usb/misc? ;-)

Argh!  Because that one is hidden in drivers/usb/misc!  Pfft :-)

Thanks.

-- 
Bob Ham <bob@collabora.com>
Software Engineer
Collabora

>>>>>>>>
Open First
Collabora is hiring!
Please check out our latest opportunities here:
http://bit.ly/Collabora-Careers
<<<<<<<<


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] hwrng: alea - Add support for Araneus Alea I USB RNG

2016-06-02 Thread Bob Ham
Adds support for the Araneus Alea I USB hardware Random Number
Generator.  This RNG creates entropy at a high rate, about 100kb/s.

Signed-off-by: Bob Ham <bob@collabora.com>
---

Just a note about the name of the module, I haven't append "-rng" to
the name, like every other module in hw_random, because those modules
contain drivers for the RNG part of some more complex device. By
contrast, the Alea is solely an RNG so adding "-rng" to the name seems
redundant.


 drivers/char/hw_random/Kconfig  |  13 ++
 drivers/char/hw_random/Makefile |   1 +
 drivers/char/hw_random/alea.c   | 370 
 3 files changed, 384 insertions(+)
 create mode 100644 drivers/char/hw_random/alea.c

diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index ac51149..b3f5a89 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -396,6 +396,19 @@ config HW_RANDOM_PIC32
 
  If unsure, say Y.
 
+config HW_RANDOM_ALEA
+   tristate "Araneus Alea I USB Random Number Generator support"
+   depends on HW_RANDOM && USB
+   default n
+   ---help---
+ This driver provides kernel-side support for the Araneus
+ Alea I USB hardware Random Number Generator.
+
+ To compile this driver as a module, choose M here. the
+ module will be called alea.
+
+ If unsure, say N.
+
 endif # HW_RANDOM
 
 config UML_RANDOM
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index 63022b4..3709906 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -34,3 +34,4 @@ obj-$(CONFIG_HW_RANDOM_ST) += st-rng.o
 obj-$(CONFIG_HW_RANDOM_XGENE) += xgene-rng.o
 obj-$(CONFIG_HW_RANDOM_STM32) += stm32-rng.o
 obj-$(CONFIG_HW_RANDOM_PIC32) += pic32-rng.o
+obj-$(CONFIG_HW_RANDOM_ALEA) += alea.o
diff --git a/drivers/char/hw_random/alea.c b/drivers/char/hw_random/alea.c
new file mode 100644
index 000..50909da
--- /dev/null
+++ b/drivers/char/hw_random/alea.c
@@ -0,0 +1,370 @@
+/*
+ * Copyright (C) 2016 Collabora Ltd
+ * Written by Bob Ham <bob@collabora.com>
+ *
+ * An HWRNG driver to pull data from an Araneus Alea I
+ *
+ * derived from:
+ *
+ * USB Skeleton driver - 2.2
+ *
+ * Copyright (C) 2001-2004 Greg Kroah-Hartman (g...@kroah.com)
+ *
+ * This program 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, version 2.
+ *
+ * This driver is based on the 2.6.3 version of drivers/usb/usb-skeleton.c
+ * but has been rewritten to be easier to read and use.
+ *
+ */
+
+/*
+ * The Alea I is a really simple device.  There is one bulk read
+ * endpoint.  It spits out data in 64-byte chunks.  Each chunk
+ * contains entropy.  Simple.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define MODULE_NAME "alea"
+
+#define ARANEUS_VENDOR_ID  0x12d8
+#define ARANEUS_ALEA_I_PRODUCT_ID  0x0001
+
+/* table of devices that work with this driver */
+static const struct usb_device_id alea_table[] = {
+   { USB_DEVICE(ARANEUS_VENDOR_ID, ARANEUS_ALEA_I_PRODUCT_ID) },
+   { } /* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE (usb, alea_table);
+
+
+/* Structure to hold all of our device specific stuff */
+struct alea {
+   struct usb_device   *udev;  /* the usb device for 
this device */
+   struct usb_interface*interface; /* the interface for 
this device */
+   struct urb  *bulk_in_urb;   /* the urb to read data 
with */
+   unsigned char   *bulk_in_buffer;/* the buffer to 
receive data */
+   size_t  bulk_in_size;   /* the size of the 
receive buffer */
+   size_t  bulk_in_filled; /* number of bytes in 
the buffer */
+   __u8bulk_in_endpointAddr;   /* the address of the 
bulk in endpoint */
+   int errors; /* the last request 
tanked */
+   boolongoing_read;   /* a read is going on */
+   spinlock_t  err_lock;   /* lock for errors */
+   struct kref kref;
+   struct mutexio_mutex;   /* synchronize I/O with 
disconnect */
+   wait_queue_head_t   bulk_in_wait;   /* to wait for an 
ongoing read */
+   char*rng_name;  /* name for the hwrng 
subsystem */
+   struct hwrngrng;/* the hwrng info */
+};
+#define kref_to_alea(d) container_of(d, struct alea, kref)
+#define rng_to_alea(d) container_of(d, struct alea, rng)
+
+static struct usb_driver alea_driver;
+
+static voi

Re: [PATCH v5] musb: blackfin: add bf60x support

2013-02-21 Thread Bob Liu
ping..

On Mon, Feb 4, 2013 at 2:57 PM, Bob Liu lliu...@gmail.com wrote:
 This patch makes musb can work on blackfin bf60x series soc platform.
 Bf60x uses MHDRC RTL version 2.0 musb ip core which don't need a lot of
 blackfin specific anomalies anymore.

 Signed-off-by: Bob Liu lliu...@gmail.com
 ---
  drivers/usb/musb/Kconfig |2 +-
  drivers/usb/musb/blackfin.c  |   70 
 ++
  drivers/usb/musb/musb_core.c |7 +++--
  drivers/usb/musb/musb_core.h |2 +-
  drivers/usb/musb/musb_dma.h  |2 +-
  drivers/usb/musb/musb_io.h   |2 +-
  drivers/usb/musb/musb_regs.h |2 +-
  drivers/usb/musb/musbhsdma.c |2 +-
  drivers/usb/musb/musbhsdma.h |2 +-
  9 files changed, 56 insertions(+), 35 deletions(-)

 diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
 index 23a0b7f..d8633c0 100644
 --- a/drivers/usb/musb/Kconfig
 +++ b/drivers/usb/musb/Kconfig
 @@ -60,7 +60,7 @@ config USB_MUSB_DSPS

  config USB_MUSB_BLACKFIN
 tristate Blackfin
 -   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523)
 +   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523) || BF60x

  config USB_MUSB_UX500
 tristate U8500 and U5500
 diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
 index 14dab9f..ffbb4f5 100644
 --- a/drivers/usb/musb/blackfin.c
 +++ b/drivers/usb/musb/blackfin.c
 @@ -36,6 +36,7 @@ struct bfin_glue {
  /*
   * Load an endpoint's FIFO
   */
 +#ifndef CONFIG_BF60x
  void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
  {
 struct musb *musb = hw_ep-musb;
 @@ -164,6 +165,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 
 *dst)

 dump_fifo_data(dst, len);
  }
 +#endif

  static irqreturn_t blackfin_interrupt(int irq, void *__hci)
  {
 @@ -192,6 +194,9 @@ static irqreturn_t blackfin_interrupt(int irq, void 
 *__hci)
 musb-a_wait_bcon = TIMER_DELAY;
 }

 +   if (musb-hwvers = MUSB_HWVERS_2000)
 +   if (musb-int_usb  MUSB_INTR_DISCONNECT  
 is_host_active(musb))
 +   bfin_write_USB_VBUS_CTL(0x00);
 spin_unlock_irqrestore(musb-lock, flags);

 return retval;
 @@ -349,6 +354,7 @@ static int bfin_musb_adjust_channel_params(struct 
 dma_channel *channel,

  static void bfin_musb_reg_init(struct musb *musb)
  {
 +#ifndef CONFIG_BF60x
 if (ANOMALY_05000346) {
 bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
 SSYNC();
 @@ -383,29 +389,41 @@ static void bfin_musb_reg_init(struct musb *musb)
 EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
 EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
 SSYNC();
 +#else
 +   bfin_write_USB_PLLOSC_CTRL((480/musb-config-clkin)  1);
 +   SSYNC();
 +
 +   bfin_write_USB_VBUS_CTL(0x00);
 +   bfin_write_USB_APHY_CNTRL(0x80);
 +   SSYNC();
 +   musb-config-ram_bits = musb_readb(musb-mregs, MUSB_RAMINFO)  0xf;
 +#endif
  }

  static int bfin_musb_init(struct musb *musb)
  {
 +   if (musb-hwvers  MUSB_HWVERS_2000) {
 +   /*
 +* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both 
 DEVICE
 +* and OTG HOST modes, while rev 1.1 and greater require PE7 
 to
 +* be low for DEVICE mode and high for HOST mode. We set it 
 high
 +* here because we are in host mode
 +*/

 -   /*
 -* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
 -* and OTG HOST modes, while rev 1.1 and greater require PE7 to
 -* be low for DEVICE mode and high for HOST mode. We set it high
 -* here because we are in host mode
 -*/
 -
 -   if (gpio_request(musb-config-gpio_vrsel, USB_VRSEL)) {
 -   printk(KERN_ERR Failed ro request USB_VRSEL GPIO_%d\n,
 -   musb-config-gpio_vrsel);
 -   return -ENODEV;
 +   if (gpio_request(musb-config-gpio_vrsel, USB_VRSEL)) {
 +   printk(KERN_ERR Failed ro request USB_VRSEL 
 GPIO_%d\n,
 +   musb-config-gpio_vrsel);
 +   return -ENODEV;
 +   }
 +   gpio_direction_output(musb-config-gpio_vrsel, 0);
 +   musb-xceiv-set_power = bfin_musb_set_power;
 +   musb-double_buffer_not_ok = true;
 }
 -   gpio_direction_output(musb-config-gpio_vrsel, 0);
 -
 usb_nop_xceiv_register();
 musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 if (IS_ERR_OR_NULL(musb-xceiv)) {
 -   gpio_free(musb-config-gpio_vrsel);
 +   if (musb-hwvers  MUSB_HWVERS_2000)
 +   gpio_free(musb-config-gpio_vrsel);
 return -ENODEV;
 }

 @@ -414,10 +432,7 @@ static int bfin_musb_init(struct musb *musb)
 setup_timer(musb_conn_timer, musb_conn_timer_handler

Re: USB3 4K HDD boot

2013-02-12 Thread Bob Lemar
Thank you, Greg, I will ask them.

I couldn't find relevant information in grub/grub2 docs. And I suppose
it is simply impossible because it is not implemented yet.

So i think loading OS by kexec is more promising. But initial image
must be able to handle situation when root filesystem is at USB HDD.

Do you know who is responsible or experienced with linux starting up process?

On Tue, Feb 12, 2013 at 6:51 PM, Greg KH gre...@linuxfoundation.org wrote:
 On Tue, Feb 12, 2013 at 02:53:46PM +0300, Bob Lemar wrote:
 Hi, guys

 I got new SEAGATE Expansion USB 3.0 and want to boot linux from it.

 I have successfully booted various linuxes before with different
 loaders from USB thumb flashes. But I cannot do it with this external
 drive.

 There are three problems: USB3, 4K sectors and 2TB.

 I try grub2 (fedora 17). Grub2 doesn't power on external USB drive.
 The drive is spinning up only after some OS is starting to load after
 grub2. So grub2 and BIOS don't see external HDD.


 Can someone point me out:

 1. either how to turn on external USB3 driver while computer is in grub2?

 Try asking on the grub2 mailing list, nothing we can do here about that,
 sorry.

 2. or how to load OS with kexec from external USB3 4K sector drive
 (from OS which is located at internal HDD)?

 The sector size shouldn't matter at all for kexec, although I don't
 think that kexec supports booting from USB, but I haven't tried it to
 verify it or not.  Try asking the kexec developers.

 good luck,

 greg k-h



-- 
Best regards, Bob
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] musb: blackfin: add bf60x support

2013-01-29 Thread Bob Liu
On Tue, Jan 29, 2013 at 3:50 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Tue, Jan 29, 2013 at 03:41:39PM +0800, Bob Liu wrote:
 This patch makes musb can work on blackfin bf60x series platform.
 Bf60x uses MHDRC RTL version 2.0 musb ip core which don't need a lot of 
 blackfin
 specific anomalies anymore.

 Signed-off-by: Bob Liu lliu...@gmail.com
 ---
  drivers/usb/musb/Kconfig |2 +-
  drivers/usb/musb/blackfin.c  |   52 
 --
  drivers/usb/musb/musb_core.c |6 +++--
  drivers/usb/musb/musb_core.h |2 +-
  drivers/usb/musb/musb_dma.h  |2 +-
  drivers/usb/musb/musb_io.h   |2 +-
  drivers/usb/musb/musb_regs.h |2 +-
  drivers/usb/musb/musbhsdma.c |2 +-
  drivers/usb/musb/musbhsdma.h |2 +-
  10 files changed, 52 insertions(+), 26 deletions(-)

 diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
 index 23a0b7f..4d416bc 100644
 --- a/drivers/usb/musb/Kconfig
 +++ b/drivers/usb/musb/Kconfig
 @@ -60,7 +60,7 @@ config USB_MUSB_DSPS

  config USB_MUSB_BLACKFIN
   tristate Blackfin
 - depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523)
 + depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523) || (BF60x)

  config USB_MUSB_UX500
   tristate U8500 and U5500
 diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
 index 14dab9f..74dd8cf 100644
 --- a/drivers/usb/musb/blackfin.c
 +++ b/drivers/usb/musb/blackfin.c
 @@ -36,6 +36,7 @@ struct bfin_glue {
  /*
   * Load an endpoint's FIFO
   */
 +#ifndef CONFIG_BF60x
  void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
  {
   struct musb *musb = hw_ep-musb;
 @@ -164,6 +165,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, 
 u8 *dst)

   dump_fifo_data(dst, len);
  }
 +#endif

 no ifdefs, try some runtime revision detection or something similar.


I'm afraid this place can't use runtime revision detection .
It affect the function define but no global revision i can use in musb
framework.

For ifdefs inside a function i can replace them with musb-hwvers.

-- 
Thanks,
--Bob
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] musb: blackfin: add bf60x support

2013-01-29 Thread Bob Liu
This patch change blackfin.c to support musb for blackfin bf60x series soc
platform.

Signed-off-by: Bob Liu lliu...@gmail.com
---
 drivers/usb/musb/blackfin.c |   72 +++
 1 file changed, 46 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 14dab9f..933dd1d 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -36,6 +36,7 @@ struct bfin_glue {
 /*
  * Load an endpoint's FIFO
  */
+#ifndef CONFIG_BF60x
 void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 {
struct musb *musb = hw_ep-musb;
@@ -164,6 +165,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 
*dst)
 
dump_fifo_data(dst, len);
 }
+#endif
 
 static irqreturn_t blackfin_interrupt(int irq, void *__hci)
 {
@@ -192,6 +194,11 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
musb-a_wait_bcon = TIMER_DELAY;
}
 
+   if (musb-hwvers = MUSB_HWVERS_2000)
+   if (musb-int_usb  MUSB_INTR_DISCONNECT  
is_host_active(musb)) {
+   musb-xceiv-state = OTG_STATE_B_IDLE;
+   bfin_write_USB_VBUS_CTL(0x00);
+   }
spin_unlock_irqrestore(musb-lock, flags);
 
return retval;
@@ -349,6 +356,7 @@ static int bfin_musb_adjust_channel_params(struct 
dma_channel *channel,
 
 static void bfin_musb_reg_init(struct musb *musb)
 {
+#ifndef CONFIG_BF60x
if (ANOMALY_05000346) {
bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
SSYNC();
@@ -383,29 +391,41 @@ static void bfin_musb_reg_init(struct musb *musb)
EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
+#else
+   bfin_write_USB_PLLOSC_CTRL((480/musb-config-clkin)  1);
+   SSYNC();
+
+   bfin_write_USB_VBUS_CTL(0x00);
+   bfin_write_USB_APHY_CNTRL(0x80);
+   SSYNC();
+   musb-config-ram_bits = musb_readb(musb-mregs, MUSB_RAMINFO)  0xf;
+#endif
 }
 
 static int bfin_musb_init(struct musb *musb)
 {
+   if (musb-hwvers  MUSB_HWVERS_2000) {
+   /*
+* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
+* and OTG HOST modes, while rev 1.1 and greater require PE7 to
+* be low for DEVICE mode and high for HOST mode. We set it high
+* here because we are in host mode
+*/
 
-   /*
-* Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
-* and OTG HOST modes, while rev 1.1 and greater require PE7 to
-* be low for DEVICE mode and high for HOST mode. We set it high
-* here because we are in host mode
-*/
-
-   if (gpio_request(musb-config-gpio_vrsel, USB_VRSEL)) {
-   printk(KERN_ERR Failed ro request USB_VRSEL GPIO_%d\n,
-   musb-config-gpio_vrsel);
-   return -ENODEV;
+   if (gpio_request(musb-config-gpio_vrsel, USB_VRSEL)) {
+   printk(KERN_ERR Failed ro request USB_VRSEL GPIO_%d\n,
+   musb-config-gpio_vrsel);
+   return -ENODEV;
+   }
+   gpio_direction_output(musb-config-gpio_vrsel, 0);
+   musb-xceiv-set_power = bfin_musb_set_power;
+   musb-double_buffer_not_ok = true;
}
-   gpio_direction_output(musb-config-gpio_vrsel, 0);
-
usb_nop_xceiv_register();
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv)) {
-   gpio_free(musb-config-gpio_vrsel);
+   if (musb-hwvers  MUSB_HWVERS_2000)
+   gpio_free(musb-config-gpio_vrsel);
return -ENODEV;
}
 
@@ -414,10 +434,7 @@ static int bfin_musb_init(struct musb *musb)
setup_timer(musb_conn_timer, musb_conn_timer_handler,
(unsigned long) musb);
 
-   musb-xceiv-set_power = bfin_musb_set_power;
-
musb-isr = blackfin_interrupt;
-   musb-double_buffer_not_ok = true;
 
return 0;
 }
@@ -526,15 +543,12 @@ static int bfin_suspend(struct device *dev)
struct bfin_glue*glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
 
-   if (is_host_active(musb))
-   /*
-* During hibernate gpio_vrsel will change from high to low
-* low which will generate wakeup event resume the system
-* immediately.  Set it to 0 before hibernate to avoid this
-* wakeup event.
-*/
-   gpio_set_value(musb-config-gpio_vrsel, 0);
-
+   if (musb-hwvers = MUSB_HWVERS_2000) {
+   int aphy = 0;
+   aphy = bfin_read_USB_APHY_CNTRL();
+   bfin_write_USB_APHY_CNTRL(aphy | 0x1

[PATCH v3] musb: blackfin: add bf60x support

2013-01-28 Thread Bob Liu
This patch makes musb can work on blackfin bf60x series platform.
Bf60x uses MHDRC RTL version 2.0 musb ip core which don't need a lot of blackfin
specific anomalies anymore.

Signed-off-by: Bob Liu lliu...@gmail.com
---
 drivers/usb/musb/Kconfig |2 +-
 drivers/usb/musb/blackfin.c  |   52 --
 drivers/usb/musb/musb_core.c |6 +++--
 drivers/usb/musb/musb_core.h |2 +-
 drivers/usb/musb/musb_dma.h  |2 +-
 drivers/usb/musb/musb_io.h   |2 +-
 drivers/usb/musb/musb_regs.h |2 +-
 drivers/usb/musb/musbhsdma.c |2 +-
 drivers/usb/musb/musbhsdma.h |2 +-
 10 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 23a0b7f..4d416bc 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -60,7 +60,7 @@ config USB_MUSB_DSPS
 
 config USB_MUSB_BLACKFIN
tristate Blackfin
-   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523)
+   depends on (BF54x  !BF544) || (BF52x  ! BF522  !BF523) || (BF60x)
 
 config USB_MUSB_UX500
tristate U8500 and U5500
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 14dab9f..74dd8cf 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -36,6 +36,7 @@ struct bfin_glue {
 /*
  * Load an endpoint's FIFO
  */
+#ifndef CONFIG_BF60x
 void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)
 {
struct musb *musb = hw_ep-musb;
@@ -164,6 +165,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 
*dst)
 
dump_fifo_data(dst, len);
 }
+#endif
 
 static irqreturn_t blackfin_interrupt(int irq, void *__hci)
 {
@@ -192,6 +194,12 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
musb-a_wait_bcon = TIMER_DELAY;
}
 
+#ifdef CONFIG_BF60x
+   if (musb-int_usb  MUSB_INTR_DISCONNECT  is_host_active(musb)) {
+   musb-xceiv-state = OTG_STATE_B_IDLE;
+   bfin_write_USB_VBUS_CTL(0x00);
+   }
+#endif
spin_unlock_irqrestore(musb-lock, flags);
 
return retval;
@@ -349,6 +357,7 @@ static int bfin_musb_adjust_channel_params(struct 
dma_channel *channel,
 
 static void bfin_musb_reg_init(struct musb *musb)
 {
+#ifndef CONFIG_BF60x
if (ANOMALY_05000346) {
bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value);
SSYNC();
@@ -383,11 +392,20 @@ static void bfin_musb_reg_init(struct musb *musb)
EP2_RX_ENA | EP3_RX_ENA | EP4_RX_ENA |
EP5_RX_ENA | EP6_RX_ENA | EP7_RX_ENA);
SSYNC();
+#else
+   bfin_write_USB_PLLOSC_CTRL((480/musb-config-clkin)  1);
+   SSYNC();
+
+   bfin_write_USB_VBUS_CTL(0x00);
+   bfin_write_USB_APHY_CNTRL(0x80);
+   SSYNC();
+   musb-config-ram_bits = musb_readb(musb-mregs, MUSB_RAMINFO)  0xf;
+#endif
 }
 
 static int bfin_musb_init(struct musb *musb)
 {
-
+#ifndef CONFIG_BF60x
/*
 * Rev 1.0 BF549 EZ-KITs require PE7 to be high for both DEVICE
 * and OTG HOST modes, while rev 1.1 and greater require PE7 to
@@ -401,7 +419,7 @@ static int bfin_musb_init(struct musb *musb)
return -ENODEV;
}
gpio_direction_output(musb-config-gpio_vrsel, 0);
-
+#endif
usb_nop_xceiv_register();
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv)) {
@@ -414,10 +432,11 @@ static int bfin_musb_init(struct musb *musb)
setup_timer(musb_conn_timer, musb_conn_timer_handler,
(unsigned long) musb);
 
+#ifndef CONFIG_BF60x
musb-xceiv-set_power = bfin_musb_set_power;
-
-   musb-isr = blackfin_interrupt;
musb-double_buffer_not_ok = true;
+#endif
+   musb-isr = blackfin_interrupt;
 
return 0;
 }
@@ -523,18 +542,12 @@ static int bfin_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int bfin_suspend(struct device *dev)
 {
-   struct bfin_glue*glue = dev_get_drvdata(dev);
-   struct musb *musb = glue_to_musb(glue);
-
-   if (is_host_active(musb))
-   /*
-* During hibernate gpio_vrsel will change from high to low
-* low which will generate wakeup event resume the system
-* immediately.  Set it to 0 before hibernate to avoid this
-* wakeup event.
-*/
-   gpio_set_value(musb-config-gpio_vrsel, 0);
-
+#ifdef CONFIG_BF60x
+   int aphy = 0;
+   aphy = bfin_read_USB_APHY_CNTRL();
+   bfin_write_USB_APHY_CNTRL(aphy | 0x1);
+   SSYNC();
+#endif
return 0;
 }
 
@@ -542,7 +555,12 @@ static int bfin_resume(struct device *dev)
 {
struct bfin_glue*glue = dev_get_drvdata(dev);
struct musb *musb = glue_to_musb(glue);
-
+#ifdef CONFIG_BF60x
+   int aphy;
+   aphy = bfin_read_USB_APHY_CNTRL