[PATCH] ARM: phytec-som-imx6: Add imx6dl with 512mb RAM

2020-03-11 Thread Christoph Fritz
This patch adds support for a phyCORE-i.MX 6Solo/DualLight variant with
512mb RAM.

Signed-off-by: Christoph Fritz 
Signed-off-by: Stefan Riedmüller 
---
 .../flash-header-phytec-pcm058dl-512mb.imxcfg| 9 +
 arch/arm/boards/phytec-som-imx6/lowlevel.c   | 1 +
 images/Makefile.imx  | 2 ++
 3 files changed, 12 insertions(+)
 create mode 100644 
arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-512mb.imxcfg

diff --git 
a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-512mb.imxcfg 
b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-512mb.imxcfg
new file mode 100644
index 00..5b92e5809c
--- /dev/null
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-512mb.imxcfg
@@ -0,0 +1,9 @@
+#define SETUP_MDCFG0   \
+   wm 32 0x021b000c 0x3c409b85
+
+#define SETUP_MDASP_MDCTL  \
+   wm 32 0x021b0040 0x0017;\
+   wm 32 0x021b 0x8319
+
+#include "flash-header-phytec-pcm058dl.h"
+#include 
diff --git a/arch/arm/boards/phytec-som-imx6/lowlevel.c 
b/arch/arm/boards/phytec-som-imx6/lowlevel.c
index 900aa19c19..2e38baa45d 100644
--- a/arch/arm/boards/phytec-som-imx6/lowlevel.c
+++ b/arch/arm/boards/phytec-som-imx6/lowlevel.c
@@ -111,6 +111,7 @@ PHYTEC_ENTRY(start_phytec_phyboard_subra_1gib_1bank, 
imx6q_phytec_phyboard_subra
 PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_nand_256mb, 
imx6dl_phytec_phycore_som_nand, SZ_256M, true);
 PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_lc_nand_256mb, 
imx6dl_phytec_phycore_som_lc_nand, SZ_256M, true);
 PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_nand_1gib, 
imx6dl_phytec_phycore_som_nand, SZ_1G, true);
+PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_emmc_512mb, 
imx6dl_phytec_phycore_som_emmc, SZ_512M, true);
 PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_emmc_1gib, 
imx6dl_phytec_phycore_som_emmc, SZ_1G, true);
 PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_lc_emmc_1gib, 
imx6dl_phytec_phycore_som_lc_emmc, SZ_1G, true);
 PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_nand_1gib, 
imx6q_phytec_phycore_som_nand, SZ_1G, true);
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 994fd951a0..708a9fbd24 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -293,6 +293,8 @@ $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, 
start_phytec_phycore_imx
 
 $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, 
start_phytec_phycore_imx6dl_som_lc_nand_256mb, 
phytec-som-imx6/flash-header-phytec-pcm058dl-256mb, 
phytec-phycore-imx6dl-som-lc-nand-256mb)
 
+$(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, 
start_phytec_phycore_imx6dl_som_emmc_512mb, 
phytec-som-imx6/flash-header-phytec-pcm058dl-512mb, 
phytec-phycore-imx6dl-som-emmc-512mb)
+
 $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, 
start_phytec_phycore_imx6dl_som_emmc_1gib, 
phytec-som-imx6/flash-header-phytec-pcm058dl-1gib, 
phytec-phycore-imx6dl-som-emmc-1gib)
 
 $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, 
start_phytec_phycore_imx6dl_som_lc_emmc_1gib, 
phytec-som-imx6/flash-header-phytec-pcm058dl-1gib, 
phytec-phycore-imx6dl-som-lc-emmc-1gib)
-- 
2.20.1



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] ARM: dts: advantech-rom-7421: Add ocotp node to provide mac address

2020-03-09 Thread Christoph Fritz
This patch adds an ocotp node to provide barebox with a mac address
for Advantech ROM-7421.

Signed-off-by: Christoph Fritz 
---
 arch/arm/dts/imx6dl-advantech-rom-7421.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/imx6dl-advantech-rom-7421.dts 
b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
index 22ce744307..f0e3f4aa1f 100755
--- a/arch/arm/dts/imx6dl-advantech-rom-7421.dts
+++ b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
@@ -86,6 +86,10 @@
status = "okay";
 };
 
+ {
+   barebox,provide-mac-address = < 0x620>;
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_uart1>;
-- 
2.20.1



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] ARM: dts: advantech-rom-7421: fix sd-card cd pin

2020-03-09 Thread Christoph Fritz
Enable possibility to auto detect sd-card insertion on Advantech
ROM-7421, this patch sets a necessary gpio to active-low.

Signed-off-by: Christoph Fritz 
---
 arch/arm/dts/imx6dl-advantech-rom-7421.dts | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/imx6dl-advantech-rom-7421.dts 
b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
index cdf378114a..22ce744307 100755
--- a/arch/arm/dts/imx6dl-advantech-rom-7421.dts
+++ b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
@@ -100,7 +100,7 @@
pinctrl-names = "default";
pinctrl-0 = <_usdhc2>;
bus-width = <8>;
-   cd-gpios = < 0 0>;
+   cd-gpios = < 0 GPIO_ACTIVE_LOW>;
status = "okay";
 
#address-cells = <1>;
@@ -121,9 +121,9 @@
pinctrl-names = "default";
pinctrl-0 = <_usdhc3>;
bus-width = <4>;
-   cd-gpios = < 1 0>;
-   en-gpios = < 2 0>;
-   wp-gpios = < 3 0>;
+   cd-gpios = < 1 GPIO_ACTIVE_LOW>;
+   en-gpios = < 2 GPIO_ACTIVE_HIGH>;
+   wp-gpios = < 3 GPIO_ACTIVE_HIGH>;
status = "okay";
 };
 
-- 
2.20.1



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


state: eMMC boot0-partitions backend for Linux

2019-11-03 Thread Christoph Fritz
Hi,

 I would like to use emmc-hardware-partition boot1 as a state backend,
this has the charm of keeping the big hw-partition clean while using SLC
for e.g. serial numbers.

Within barebox using an emmc-hardware-partition boot1 as a state backend
just works!

But trying to hand over this backend to Linux fails right before
starting the kernel:

  WARNING: Failed to fixup node in of_state_fixup+0x1/0x288: No such device

I guess dt-utils also has no support for using /dev/mmcblk1boot0 as a
backend (by default Linux doesn't allow to write to boot0/1) ?

What would be the best way to add this feature?

Any ideas?

 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mmc_extcsd command: Add cmd option to set bkops-enable

2018-06-18 Thread Christoph Fritz
This patch is for convenience to set bkops-enable (EXT_CSD_BKOPS_EN[163])
on devices which have it not yet activated.

Signed-off-by: Christoph Fritz 
---
 commands/mmc_extcsd.c | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index 82e0600..3a418ea 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -1482,7 +1482,7 @@ static int print_field(u8 *reg, int index)
str = "may";
else
str = "shall not";
-   printf("\t[1] AUTO_EN: Device %s perform background ops while"
+   printf("\t[1] AUTO_EN: Device %s perform background ops while\n"
   "\tnot servicing the host\n", str);
return 1;
 
@@ -2371,11 +2371,12 @@ static int do_mmc_extcsd(int argc, char *argv[])
int write_operation = 0;
int always_write = 0;
int print_as_raw = 0;
+   int set_bkops_en = 0;
 
if (argc < 2)
return COMMAND_ERROR_USAGE;
 
-   while ((opt = getopt(argc, argv, "i:v:yr")) > 0)
+   while ((opt = getopt(argc, argv, "i:v:yrb")) > 0)
switch (opt) {
case 'i':
index = simple_strtoul(optarg, NULL, 0);
@@ -2390,6 +2391,13 @@ static int do_mmc_extcsd(int argc, char *argv[])
case 'r':
print_as_raw = 1;
break;
+   case 'b':
+   set_bkops_en = 1;
+   index = EXT_CSD_BKOPS_EN;
+   value = BIT(0);
+   write_operation = 1;
+   always_write = 1;
+   break;
}
 
if (optind == argc)
@@ -2421,6 +2429,16 @@ static int do_mmc_extcsd(int argc, char *argv[])
goto error_with_mem;
}
 
+   if (set_bkops_en) {
+   if (dst[index]) {
+   printf("Abort: EXT_CSD [%u] already set to %#02x!\n",
+  index, dst[index]);
+   goto error_with_mem;
+   }
+   if (dst[EXT_CSD_REV] >= 7)
+   value |= BIT(1);/* set AUTO_EN bit too */
+   }
+
if (write_operation)
if (!print_field(dst, index)) {
printf("No field with this index found. Abort write 
operation!\n");
@@ -2466,12 +2484,14 @@ BAREBOX_CMD_HELP_OPT("-r", "print the register as raw 
data")
 BAREBOX_CMD_HELP_OPT("-v", "value which will be written")
 BAREBOX_CMD_HELP_OPT("-y", "don't request when writing to one time 
programmable fields")
 BAREBOX_CMD_HELP_OPT("",   "__CAUTION__: this could damage the device!")
+BAREBOX_CMD_HELP_OPT("-b", "set bkops-enable (EXT_CSD_BKOPS_EN[163])")
+BAREBOX_CMD_HELP_OPT("",   "__WARNING__: this is a write-once setting!")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(mmc_extcsd)
.cmd= do_mmc_extcsd,
BAREBOX_CMD_DESC("Read/write the extended CSD register.")
-   BAREBOX_CMD_OPTS("dev [-r | -i index [-r | -v value [-y]]]")
+   BAREBOX_CMD_OPTS("dev [-r | -b | -i index [-r | -v value [-y]]]")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_mmc_extcsd_help)
 BAREBOX_CMD_END
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: dts: advantech-rom-7421: add hog pinctrl node

2018-06-17 Thread Christoph Fritz
The Advantech ROM-7421 has a custom watchdog reset i2c chip that has
some control gpios. This watchdog is currently not used, therefore mux
its control pins as pull-downs to be sure that the watchdog is disabled
after e.g. a reboot.

For debug purposes this patch also adds i2c1 node.

Signed-off-by: Christoph Fritz 
---
 arch/arm/dts/imx6dl-advantech-rom-7421.dts | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/dts/imx6dl-advantech-rom-7421.dts 
b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
index 1d5fd89..cdf3781 100755
--- a/arch/arm/dts/imx6dl-advantech-rom-7421.dts
+++ b/arch/arm/dts/imx6dl-advantech-rom-7421.dts
@@ -79,6 +79,13 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c1>;
+   clock-frequency = <10>;
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_uart1>;
@@ -144,6 +151,17 @@
 
  {
pinctrl-names = "default";
+pinctrl-0 = <_hog>;
+
+   pinctrl_hog: hoggrp {
+   fsl,pins = <
+   /* custom watchdog controls disabled */
+   MX6QDL_PAD_NANDF_RB0__GPIO6_IO100x130b0
+   MX6QDL_PAD_GPIO_9__GPIO1_IO09   0x130b0
+   MX6QDL_PAD_GPIO_17__GPIO7_IO12  0x130b0
+
+   >;
+};
 
pinctrl_ecspi1: ecspi1grp {
fsl,pins = <
@@ -175,6 +193,13 @@
>;
};
 
+   pinctrl_i2c1: i2c1grp {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT8__I2C1_SDA  0x4001b8b1
+   MX6QDL_PAD_CSI0_DAT9__I2C1_SCL  0x4001b8b1
+   >;
+   };
+
pinctrl_uart1: uart1grp {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA0x1b0b1
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] USB: host: hub: increase delay after device removal

2018-05-22 Thread Christoph Fritz
On Tue, 2018-05-22 at 09:54 +0200, Sascha Hauer wrote:
> On Thu, May 17, 2018 at 06:19:32PM +0200, Christoph Fritz wrote:

> > # still 4 USB Devices found, ...?
> > # starting 'usb' again hits a NULL pointer dereference:
> 
> Disconnecting USB devices during runtime of barebox is not really
> supported. We should probably make that clear somewhere. The code is not
> prepared for that case and trying to fix it is likely to be a bottomless
> pit.
> 
> Can you reproduce a problem without removing a device?

Yes I can, please see the scenario below.
But the USB device plugged in isn't USB certified and Linux-Kernel needs
the quirk too... so...?

# on another hardware with a bit more debug output:
# just reset board, plug in USB device and start 'usb':

barebox@:/ usb
usb: USB: scanning bus for devices...
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x40
usb: set address 1
usb: usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 
length 0x0
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x12
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x9
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x19
usb: get_conf_no 0 Result 25, wLength 25
usb: if 0, ep 0
usb: ##EP epmaxpacketin[1] = 2
usb: set configuration 1
usb: usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 
length 0x0
usb: new device: Mfr=1, Product=2, SerialNumber=0
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x300 index 0x0 
length 0xFF
usb: USB device number 1 default language ID 0x1
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x301 index 0x1 
length 0xFF
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x302 index 0x1 
length 0xFF
usb: Bus 001 Device 001: ID : EHCI Host Controller
usb: matching: 0x 0x
usb: matching: 0x 0x
usb: matching: 0x 0x
usb: match: 0x 0x
usb: usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 
length 0x4
usb: usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0 
length 0x9
usb-hub usb1: 1 ports detected
usb-hub usb1: individual port power switching
usb-hub usb1: standalone hub
usb-hub usb1: global over-current protection
usb-hub usb1: power on to power good time: 20ms
usb-hub usb1: hub controller current requirement: 0mA
usb-hub usb1: port 1 is removable
usb: usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0 
length 0x4
usb-hub usb1: get_hub_status returned status 1, change 8101
usb-hub usb1: local power source is lost (inactive)
usb-hub usb1: no over-current condition exists
usb: usb_control_msg: request: 0x1, requesttype: 0x23, value 0x8 index 0x1 
length 0x0
usb-hub usb1: port 1 returns 0
usb-hub usb1: enabling power on all ports
usb: usb_control_msg: request: 0x3, requesttype: 0x23, value 0x8 index 0x1 
length 0x0
usb-hub usb1: port 1 returns 0
usb: usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 
length 0x4
usb-hub usb1: Port 1 Status 101 Change 1
usb-hub usb1: port 1 connection change
usb: usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 
length 0x4
usb-hub usb1: portstatus 101, change 1, 12 Mb/s
usb: usb_control_msg: request: 0x1, requesttype: 0x23, value 0x10 index 0x1 
length 0x0
usb-hub usb1: hub_port_reset: resetting port 0...
usb: usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 
length 0x0
usb: usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 
length 0x4
usb-hub usb1: portstatus 503, change 10, 480 Mb/s
usb-hub usb1: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
usb: usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x1 
length 0x0
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x40
usb-hub usb1: hub_port_reset: resetting port 0...
usb: usb_control_msg: request: 0x3, requesttype: 0x23, value 0x4 index 0x1 
length 0x0
usb: usb_control_msg: request: 0x0, requesttype: 0xA3, value 0x0 index 0x1 
length 0x4
usb-hub usb1: portstatus 503, change 10, 480 Mb/s
usb-hub usb1: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
usb: usb_control_msg: request: 0x1, requesttype: 0x23, value 0x14 index 0x1 
length 0x0
usb: set address 2
usb: usb_control_msg: request: 0x5, requesttype: 0x0, value 0x2 index 0x0 
length 0x0
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x12
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x9
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x29
usb: get_conf_no 0 Result 41, wLength 41
usb: if 0, ep 0
usb: if 0, ep 1
usb: ##EP epmaxpacketin[1] = 1
usb: set configuration 1
usb: usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 
length 0

Re: [PATCH] USB: host: hub: increase delay after device removal

2018-05-17 Thread Christoph Fritz
Hi Sascha

On Mon, 2017-01-09 at 09:38 +0100, Sascha Hauer wrote:
> Hi Christoph,
> 
> On Wed, Dec 28, 2016 at 04:29:44PM +0100, Christoph Fritz wrote:
> > This patch increases delay time for slow hubs after device removal.
> 
> Could you spent a few words what happens without this patch, i.e. how
> the symptons look and which hardware you observed that? Without this
> information it will be very hard to ever change this line again.
> 
> Sascha
> 
> > 
> > Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
> > ---
> >  drivers/usb/core/hub.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index f44aea5..0854e3a 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -201,7 +201,7 @@ static void usb_hub_port_connect_change(struct 
> > usb_device *dev, int port)
> > if (dev->children[port] && !(portstatus & USB_PORT_STAT_ENABLE))
> > usb_remove_device(dev->children[port]);
> >  
> > -   mdelay(200);
> > +   mdelay(500);
> >  
> > /* Reset the port */
> > if (hub_port_reset(dev, port, ) < 0) {
> > -- 
> > 2.1.4

While updating Barebox to a new version I stumbled upon this and did
some tests without the above patch applied:

# plug in a non certified USB device (which I suppose doesn't meet the init 
timing constrains,
# a certified one doesn't trigger the following error):

barebox:/ usb
usb: USB: scanning bus for devices...
usb: Bus 001 Device 001: ID : EHCI Host Controller
usb-hub usb1: hub_port_reset: resetting port 0...
usb-hub usb1: portstatus 503, change 10, 480 Mb/s
usb-hub usb1: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
usb-hub usb1: hub_port_reset: resetting port 0...
usb-hub usb1: portstatus 503, change 10, 480 Mb/s
usb-hub usb1: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
usb: Bus 001 Device 002: ID 04b4:6560
usb-hub usb1-0: hub_port_reset: resetting port 2...
usb-hub usb1-0: portstatus 103, change 10, 12 Mb/s
usb-hub usb1-0: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 
1
usb-hub usb1-0: hub_port_reset: resetting port 2...
usb-hub usb1-0: portstatus 103, change 10, 12 Mb/s
usb-hub usb1-0: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 
1
usb: Bus 001 Device 003: ID 10c4:ea60 CP2104 USB to UART Bridge Contr
usb: 3 USB Device(s) found

# now disconnect the USB device:

barebox:/ usb
usb: USB: scanning bus for devices...
usb1-0-0-2: removed
usb: 4 USB Device(s) found

# 4 USB Devices seems wrong, now connect the USB device again:

barebox@:/ usb
usb: USB: scanning bus for devices...
usb-hub usb1-0-0: hub_port_reset: resetting port 2...
usb-hub usb1-0-0: portstatus 103, change 10, 12 Mb/s
usb-hub usb1-0-0: STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  
USB_PORT_STAT_ENABLE 1
usb: 4 USB Device(s) found

# still 4 USB Devices found, ...?
# starting 'usb' again hits a NULL pointer dereference:

barebox@:/ usb
usb: USB: scanning bus for devices...
unable to handle NULL pointer dereference at address 0x0004
pc : [<2fe1d432>]lr : [<2fe1e24b>]
sp : 2ffefcb8  ip : 0016  fp : 0001
r10: 0100  r9 : 0001  r8 : 201836b4
r7 : 201836cc  r6 : 201859d0  r5 : 201859f4  r4 : 20184ee4
r3 :   r2 :   r1 :   r0 : 201859f4
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
[<2fe1d432>] (usb_remove_device+0x4e/0x98) from [<2fe1e24b>] 
(usb_hub_detect+0x97/0x1bc)
[<2fe1e24b>] (usb_hub_detect+0x97/0x1bc) from [<2fe1e361>] 
(usb_hub_detect+0x1ad/0x1bc)

[<2fe4e855>] (unwind_backtrace+0x1/0x58) from [<2fe00b65>] (panic+0x1d/0x2c)
[<2fe00b65>] (panic+0x1d/0x2c) from [<2fe4ccd1>] (do_exception+0xd/0x10)
[<2fe4ccd1>] (do_exception+0xd/0x10) from [<2fe4cd31>] (do_data_abort+0x21/0x2c)
[<2fe4cd31>] (do_data_abort+0x21/0x2c) from [<2fe4c474>] (do_abort_6+0x48/0x54)
[<2fe4c474>] (do_abort_6+0x48/0x54) from [<>] (0x0)



# on another hardware with a bit more debug output:
# just reset board, plug in USB device and start 'usb':

barebox@:/ usb
usb: USB: scanning bus for devices...
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x40
usb: set address 1
usb: usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 
length 0x0
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0 
length 0x12
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x9
usb: usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0 
length 0x19
usb: get_conf_no 0 Result 25, wLength 25
usb: if 0, ep 0
usb: ##EP epmaxpacketin[1] = 2
usb: set configuration 1
usb: usb_control_msg: request: 

[PATCH v2] ARM: Add Advantech imx6 board support

2018-04-09 Thread Christoph Fritz
Add support for Advantech i.MX6 SOM named ROM-7421.

Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
---
Changes since v0:
 - distinguish between MMC environment names in pr_notice() board.c
 - rework eMMC partition layout and don't use its hw-bootpartition for now
 - purge writing clock registers
 - rework and simplify lowlevel.c init and use imx6q_barebox_entry(fdt)
 - s/linux,stdout-path/stdout-path in dts
 - rework and simplify spi nor partition layout
 - remove additional pinctrl subnode from dts
 - remove setting of explicit ARCH_TEXT_BASE in Kconfig
 - use bitop Macro for ar8035_phy_fixup()
 - use imx_setup_pad() for early debug uart
---
 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/advantech-mx6/Makefile |   2 +
 arch/arm/boards/advantech-mx6/board.c  | 101 +
 .../flash-header-advantech-rom-7421.imxcfg |  66 ++
 arch/arm/boards/advantech-mx6/lowlevel.c   |  56 +
 arch/arm/configs/imx_v7_defconfig  |   1 +
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/imx6dl-advantech-rom-7421.dts | 225 +
 arch/arm/mach-imx/Kconfig  |   5 +
 images/Makefile.imx|   5 +
 10 files changed, 463 insertions(+)
 create mode 100644 arch/arm/boards/advantech-mx6/Makefile
 create mode 100644 arch/arm/boards/advantech-mx6/board.c
 create mode 100644 
arch/arm/boards/advantech-mx6/flash-header-advantech-rom-7421.imxcfg
 create mode 100644 arch/arm/boards/advantech-mx6/lowlevel.c
 create mode 100755 arch/arm/dts/imx6dl-advantech-rom-7421.dts

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index ca187cc..521f37d 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -1,4 +1,5 @@
 # keep sorted by CONFIG_* macro name.
+obj-$(CONFIG_MACH_ADVANTECH_ROM_742X)  += advantech-mx6/
 obj-$(CONFIG_MACH_AFI_GF)  += afi-gf/
 obj-$(CONFIG_MACH_ANIMEO_IP)   += animeo_ip/
 obj-$(CONFIG_MACH_ARCHOSG9)+= archosg9/
diff --git a/arch/arm/boards/advantech-mx6/Makefile 
b/arch/arm/boards/advantech-mx6/Makefile
new file mode 100644
index 000..01c7a25
--- /dev/null
+++ b/arch/arm/boards/advantech-mx6/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/advantech-mx6/board.c 
b/arch/arm/boards/advantech-mx6/board.c
new file mode 100644
index 000..4a30a84
--- /dev/null
+++ b/arch/arm/boards/advantech-mx6/board.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2018 Christoph Fritz <chf.fr...@googlemail.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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int ar8035_phy_fixup(struct phy_device *dev)
+{
+   u16 val;
+
+   /* Ar803x phy SmartEEE feature cause link status generates glitch,
+* which cause ethernet link down/up issue, so disable SmartEEE
+*/
+   phy_write(dev, 0xd, 0x3);
+   phy_write(dev, 0xe, 0x805d);
+   phy_write(dev, 0xd, 0x4003);
+
+   val = phy_read(dev, 0xe);
+   phy_write(dev, 0xe, val & ~BIT(8));
+
+   /* To enable AR8031 ouput a 125MHz clk from CLK_25M */
+   phy_write(dev, 0xd, 0x7);
+   phy_write(dev, 0xe, 0x8016);
+   phy_write(dev, 0xd, 0x4007);
+
+   val = phy_read(dev, 0xe);
+   val &= 0xffe3;
+   val |= 0x18;
+   phy_write(dev, 0xe, val);
+
+   /* introduce tx clock delay */
+   phy_write(dev, 0x1d, 0x5);
+   val = phy_read(dev, 0x1e);
+   val |= 0x0100;
+   phy_write(dev, 0x1e, val);
+
+   return 0;
+}
+
+static int advantech_mx6_devices_init(void)
+{
+   int ret;
+   char *environment_path, *envdev;
+
+   if (!of_machine_is_compatible("advantech,imx6dl-rom-7421"))
+   return 0;
+
+   phy_register_fixup_for_uid(0x004dd072, 0xffef, ar8035_phy_fixup);
+
+   switch (bootsource_get()) {
+   case BOOTSOURCE_MMC:
+   environment_path = basprintf("/chosen/environment-sd%d",
+bootsource_get_instance() + 1);
+   if (bootsource_get_instance() + 1 == 4)
+   envdev = "eMMC";
+   else if (bootsource_get_instance() + 1 == 2)
+   envdev = "microSD";
+   else
+   envdev = "MMC";
+  

Re: [PATCH] ARM: Add Advantech imx6 board support

2018-04-09 Thread Christoph Fritz
Hi Andrey,

 thanks for your input, I'll integrate your suggestions and send a v2
patch.

Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] ARM: Add Advantech imx6 board support

2018-04-09 Thread Christoph Fritz
Hi Sascha,

On Fri, 2018-04-06 at 21:21 +0200, Sascha Hauer wrote:
> Hi Christoph,
> 
> On Thu, Apr 05, 2018 at 03:15:49PM +0200, Christoph Fritz wrote:
> > +   phy_register_fixup_for_uid(0x004dd072, 0xffef, ar8035_phy_fixup);
> > +
> > +   switch (bootsource_get()) {
> > +   case BOOTSOURCE_MMC:
> > +   environment_path = basprintf("/chosen/environment-sd%d",
> > +bootsource_get_instance() + 1);
> > +   envdev = "MMC";
> > +   break;
> > +   case BOOTSOURCE_SPI:
> > +   default:
> > +   environment_path = basprintf("/chosen/environment-sd4");
> > +   envdev = "MMC";
> > +   break;
> > +   }
> > +
> > +   if (environment_path) {
> > +   ret = of_device_enable_path(environment_path);
> > +   if (ret < 0)
> > +   pr_warn("Failed to enable env partition '%s' (%d)\n",
> > +   environment_path, ret);
> > +   free(environment_path);
> > +   }
> > +
> > +   pr_notice("Using environment in %s\n", envdev);
> 
> This is always "MMC", not very informative. Maybe "eMMC" and "external
> SD"?

I'll fix that.

> 
> > +
> > +   imx6_bbu_internal_mmc_register_handler("mmc3", "/dev/mmc3",
> > +   BBU_HANDLER_FLAG_DEFAULT);
> 
> That would be the eMMC, right? For this I can recommend putting barebox
> into the boot partitions of the eMMC. Normally there are two of them
> and with imx6_bbu_internal_mmcboot_register_handler() you even get a
> robust barebox A/B update mechanism.

I'm currently using here a hybrid u-boot into barebox boot and can't use
the eMMC SLC boot-partitions without changes on the u-boot side. That's
why I kept this config.

If you really want me to go for the boot0 partition, I can adapt this in
this mainline barebox setup?

> > +
> > +   return 0;
> > +}
> > +device_initcall(advantech_mx6_devices_init);
> > diff --git 
> > a/arch/arm/boards/advantech-mx6/flash-header-advantech-rom-7421.imxcfg 
> > b/arch/arm/boards/advantech-mx6/flash-header-advantech-rom-7421.imxcfg
> > new file mode 100644
> > index 000..611e06b
> > --- /dev/null
> > +++ b/arch/arm/boards/advantech-mx6/flash-header-advantech-rom-7421.imxcfg
> > @@ -0,0 +1,73 @@
> > +soc imx6
> > +loadaddr 0x1000
> > +dcdofs 0x400
> > +
> > +wm 32 0x020e0774 0x000C
> 
> [...]
> 
> > +wm 32 0x021b0004 0x0002556D
> > +wm 32 0x021b0404 0x00011006
> > +wm 32 0x021b001c 0x
> 
> > +wm 32 0x020c4068 0x00C03F3F
> > +wm 32 0x020c406c 0x0030FC03
> > +wm 32 0x020c4070 0x0FFFC000
> > +wm 32 0x020c4074 0x3FF0
> > +wm 32 0x020c4078 0x00FFF300
> > +wm 32 0x020c407c 0x0FC3
> > +wm 32 0x020c4080 0x03FF
> 
> Please remove writing these clock registers here. The registers get
> overwritten in a few moments by barebox anyway. Often enough these gate
> settings disable the USB clocks and then booting this image from USB is
> no longer possible.

I'll fix that.

> 
> > +wm 32 0x020e0010 0xF0CF
> > +wm 32 0x020e0018 0x007F007F
> > +wm 32 0x020e001c 0x007F007F
> > diff --git a/arch/arm/boards/advantech-mx6/lowlevel.c 
> > b/arch/arm/boards/advantech-mx6/lowlevel.c
> > new file mode 100644
> > index 000..5efb91a
> > --- /dev/null
> > +++ b/arch/arm/boards/advantech-mx6/lowlevel.c
> > @@ -0,0 +1,58 @@
> > +/*
> > + * Copyright (C) 2018 Christoph Fritz <chf.fr...@googlemail.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; either version 2 of
> > + * the License, or (at your option) any later version.
> > + *
> > + * This program 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.
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +static inline void setup_uart(void)
> > +{
> > +   void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
> > +
> > +   writel(0x3, iomuxbase

[PATCH] ARM: Add Advantech imx6 board support

2018-04-05 Thread Christoph Fritz
Add support for Advantech i.MX6 SOM named ROM-7421.

Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
---
 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/advantech-mx6/Makefile |   2 +
 arch/arm/boards/advantech-mx6/board.c  |  93 +
 .../flash-header-advantech-rom-7421.imxcfg |  73 +++
 arch/arm/boards/advantech-mx6/lowlevel.c   |  58 ++
 arch/arm/configs/imx_v7_defconfig  |   1 +
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/imx6dl-advantech-rom-7421.dts | 227 +
 arch/arm/mach-imx/Kconfig  |   6 +
 images/Makefile.imx|   5 +
 10 files changed, 467 insertions(+)
 create mode 100644 arch/arm/boards/advantech-mx6/Makefile
 create mode 100644 arch/arm/boards/advantech-mx6/board.c
 create mode 100644 
arch/arm/boards/advantech-mx6/flash-header-advantech-rom-7421.imxcfg
 create mode 100644 arch/arm/boards/advantech-mx6/lowlevel.c
 create mode 100755 arch/arm/dts/imx6dl-advantech-rom-7421.dts

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index ca187cc..521f37d 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -1,4 +1,5 @@
 # keep sorted by CONFIG_* macro name.
+obj-$(CONFIG_MACH_ADVANTECH_ROM_742X)  += advantech-mx6/
 obj-$(CONFIG_MACH_AFI_GF)  += afi-gf/
 obj-$(CONFIG_MACH_ANIMEO_IP)   += animeo_ip/
 obj-$(CONFIG_MACH_ARCHOSG9)+= archosg9/
diff --git a/arch/arm/boards/advantech-mx6/Makefile 
b/arch/arm/boards/advantech-mx6/Makefile
new file mode 100644
index 000..01c7a25
--- /dev/null
+++ b/arch/arm/boards/advantech-mx6/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/advantech-mx6/board.c 
b/arch/arm/boards/advantech-mx6/board.c
new file mode 100644
index 000..8686a5e
--- /dev/null
+++ b/arch/arm/boards/advantech-mx6/board.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2018 Christoph Fritz <chf.fr...@googlemail.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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int ar8035_phy_fixup(struct phy_device *dev)
+{
+   u16 val;
+
+   /* Ar803x phy SmartEEE feature cause link status generates glitch,
+* which cause ethernet link down/up issue, so disable SmartEEE
+*/
+   phy_write(dev, 0xd, 0x3);
+   phy_write(dev, 0xe, 0x805d);
+   phy_write(dev, 0xd, 0x4003);
+
+   val = phy_read(dev, 0xe);
+   phy_write(dev, 0xe, val & ~(1 << 8));
+
+   /* To enable AR8031 ouput a 125MHz clk from CLK_25M */
+   phy_write(dev, 0xd, 0x7);
+   phy_write(dev, 0xe, 0x8016);
+   phy_write(dev, 0xd, 0x4007);
+
+   val = phy_read(dev, 0xe);
+   val &= 0xffe3;
+   val |= 0x18;
+   phy_write(dev, 0xe, val);
+
+   /* introduce tx clock delay */
+   phy_write(dev, 0x1d, 0x5);
+   val = phy_read(dev, 0x1e);
+   val |= 0x0100;
+   phy_write(dev, 0x1e, val);
+
+   return 0;
+}
+
+static int advantech_mx6_devices_init(void)
+{
+   int ret;
+   char *environment_path, *envdev;
+
+   if (!of_machine_is_compatible("advantech,imx6dl-rom-7421"))
+   return 0;
+
+   phy_register_fixup_for_uid(0x004dd072, 0xffef, ar8035_phy_fixup);
+
+   switch (bootsource_get()) {
+   case BOOTSOURCE_MMC:
+   environment_path = basprintf("/chosen/environment-sd%d",
+bootsource_get_instance() + 1);
+   envdev = "MMC";
+   break;
+   case BOOTSOURCE_SPI:
+   default:
+   environment_path = basprintf("/chosen/environment-sd4");
+   envdev = "MMC";
+   break;
+   }
+
+   if (environment_path) {
+   ret = of_device_enable_path(environment_path);
+   if (ret < 0)
+   pr_warn("Failed to enable env partition '%s' (%d)\n",
+   environment_path, ret);
+   free(environment_path);
+   }
+
+   pr_notice("Using environment in %s\n", envdev);
+
+   imx6_bbu_internal_mmc_register_handler("mmc3", "/dev/mmc3",
+   BBU_HANDLER_FLAG_DEFAULT);
+
+   return 0;
+}
+d

[PATCH] ARM: i.MX6: add new silicon revision number 1.6

2018-01-09 Thread Christoph Fritz
This patch adds new silicon revision number 1.6 as specified in document
IMX6DQCEC.pdf.

Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
---
 arch/arm/mach-imx/include/mach/imx6.h | 2 ++
 arch/arm/mach-imx/include/mach/revision.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/arch/arm/mach-imx/include/mach/imx6.h 
b/arch/arm/mach-imx/include/mach/imx6.h
index e0ced7e..288c753 100644
--- a/arch/arm/mach-imx/include/mach/imx6.h
+++ b/arch/arm/mach-imx/include/mach/imx6.h
@@ -109,6 +109,8 @@ static inline int __imx6_cpu_revision(void)
return IMX_CHIP_REV_1_4;
case 0x05:
return IMX_CHIP_REV_1_5;
+   case 0x06:
+   return IMX_CHIP_REV_1_6;
case 0x100:
return IMX_CHIP_REV_2_0;
}
diff --git a/arch/arm/mach-imx/include/mach/revision.h 
b/arch/arm/mach-imx/include/mach/revision.h
index 908a0a1..d9495d9 100644
--- a/arch/arm/mach-imx/include/mach/revision.h
+++ b/arch/arm/mach-imx/include/mach/revision.h
@@ -8,6 +8,7 @@
 #define IMX_CHIP_REV_1_3   0x13
 #define IMX_CHIP_REV_1_4   0x14
 #define IMX_CHIP_REV_1_5   0x15
+#define IMX_CHIP_REV_1_6   0x16
 #define IMX_CHIP_REV_2_0   0x20
 #define IMX_CHIP_REV_2_1   0x21
 #define IMX_CHIP_REV_2_2   0x22
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mci: be more verbose about wrong bus-width

2017-04-30 Thread Christoph Fritz
If configured or default bus-width is wrong for the current hardware,
registration of card/emmc is likely to fail.  This patch adds more verbosity
in the case of a failed detection:

| omap-hsmmc 4806.mmc: registered as 4806.mmc
| mmc0: detected MMC card version 4.41
| mmc0: Changing MMC bus width failed: -110
| mmc0: Card's startup fails with -110

Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
---
 drivers/mci/mci-core.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index b173a17..3da1c26 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -984,7 +984,7 @@ static int mci_startup_sd(struct mci *mci)
mci_setup_cmd(, SD_CMD_APP_SET_BUS_WIDTH, 2, MMC_RSP_R1);
err = mci_send_cmd(mci, , NULL);
if (err) {
-   dev_dbg(>dev, "Changing SD bus width failed: 
%d\n", err);
+   dev_warn(>dev, "Changing SD bus width failed: 
%d\n", err);
/* TODO continue with 1 bit? */
return err;
}
@@ -1041,8 +1041,11 @@ static int mci_startup_mmc(struct mci *mci)
err = mci_switch(mci, EXT_CSD_CMD_SET_NORMAL,
 EXT_CSD_BUS_WIDTH,
 ext_csd_bits[idx]);
-   if (err)
+   if (err) {
+   if (idx == 0)
+   dev_warn(>dev, "Changing MMC bus width 
failed: %d\n", err);
continue;
+   }
 
mci_set_bus_width(mci, bus_widths[idx]);
 
@@ -1051,7 +1054,7 @@ static int mci_startup_mmc(struct mci *mci)
break;
}
 
-   return 0;
+   return err;
 }
 
 /**
@@ -1693,7 +1696,7 @@ static int mci_card_probe(struct mci *mci)
 
rc = mci_startup(mci);
if (rc) {
-   dev_dbg(>dev, "Card's startup fails with %d\n", rc);
+   dev_warn(>dev, "Card's startup fails with %d\n", rc);
goto on_error;
}
 
-- 
2.1.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] USB: host: hub: increase delay after device removal

2016-12-28 Thread Christoph Fritz
This patch increases delay time for slow hubs after device removal.

Signed-off-by: Christoph Fritz <chf.fr...@googlemail.com>
---
 drivers/usb/core/hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f44aea5..0854e3a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -201,7 +201,7 @@ static void usb_hub_port_connect_change(struct usb_device 
*dev, int port)
if (dev->children[port] && !(portstatus & USB_PORT_STAT_ENABLE))
usb_remove_device(dev->children[port]);
 
-   mdelay(200);
+   mdelay(500);
 
/* Reset the port */
if (hub_port_reset(dev, port, ) < 0) {
-- 
2.1.4



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 11/18] musb: adapt driver to work on barebox

2014-06-17 Thread Christoph Fritz
Hi Michael

On Sat, 2014-06-14 at 22:53 +0200, Michael Grzeschik wrote:
 On Fri, Jun 13, 2014 at 09:54:28AM +0200, Christoph Fritz wrote:
  ---
   drivers/usb/musb/linux-compat.h |   31 +---
   drivers/usb/musb/musb.h |  164 
  +++
   drivers/usb/musb/musb_core.c|   20 +++--
   drivers/usb/musb/musb_core.h|   42 +++---
   drivers/usb/musb/musb_dsps.c|2 -
   drivers/usb/musb/musb_host.c|2 +-
   drivers/usb/musb/musb_io.h  |   19 -
   drivers/usb/musb/usb-compat.h   |2 +-
   include/usb/musb.h  |  162 
  --
 
 Why move musb.h in patch 6 first, when
 it got moved here again?

It's a left over from my development branch. Thanks for the hint.

 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 06/18] musb: move musb.h to path include/usb

2014-06-13 Thread Christoph Fritz
---
 include/linux/usb/musb.h |  162 --
 include/usb/musb.h   |  162 ++
 2 files changed, 162 insertions(+), 162 deletions(-)
 delete mode 100644 include/linux/usb/musb.h
 create mode 100644 include/usb/musb.h

diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
deleted file mode 100644
index 9f65ef9..000
--- a/include/linux/usb/musb.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * This is used to for host and peripheral modes of the driver for
- * Inventra (Multidrop) Highspeed Dual-Role Controllers:  (M)HDRC.
- *
- * Board initialization should put one of these into dev-platform_data,
- * probably on some platform_device named musb-hdrc.  It encapsulates
- * key configuration differences between boards.
- */
-
-#ifndef __LINUX_USB_MUSB_H
-#define __LINUX_USB_MUSB_H
-
-#ifndef __deprecated
-#define __deprecated
-#endif
-
-/* The USB role is defined by the connector used on the board, so long as
- * standards are being followed.  (Developer boards sometimes won't.)
- */
-enum musb_mode {
-   MUSB_UNDEFINED = 0,
-   MUSB_HOST,  /* A or Mini-A connector */
-   MUSB_PERIPHERAL,/* B or Mini-B connector */
-   MUSB_OTG/* Mini-AB connector */
-};
-
-struct clk;
-
-enum musb_fifo_style {
-   FIFO_RXTX,
-   FIFO_TX,
-   FIFO_RX
-} __attribute__ ((packed));
-
-enum musb_buf_mode {
-   BUF_SINGLE,
-   BUF_DOUBLE
-} __attribute__ ((packed));
-
-struct musb_fifo_cfg {
-   u8  hw_ep_num;
-   enum musb_fifo_stylestyle;
-   enum musb_buf_mode  mode;
-   u16 maxpacket;
-};
-
-#define MUSB_EP_FIFO(ep, st, m, pkt)   \
-{  \
-   .hw_ep_num  = ep,   \
-   .style  = st,   \
-   .mode   = m,\
-   .maxpacket  = pkt,  \
-}
-
-#define MUSB_EP_FIFO_SINGLE(ep, st, pkt)   \
-   MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
-
-#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt)   \
-   MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
-
-struct musb_hdrc_eps_bits {
-   const char  name[16];
-   u8  bits;
-};
-
-struct musb_hdrc_config {
-   struct musb_fifo_cfg*fifo_cfg;  /* board fifo configuration */
-   unsignedfifo_cfg_size;  /* size of the fifo 
configuration */
-
-   /* MUSB configuration-specific details */
-   unsignedmultipoint:1;   /* multipoint device */
-   unsigneddyn_fifo:1 __deprecated; /* supports dynamic fifo 
sizing */
-   unsignedsoft_con:1 __deprecated; /* soft connect required */
-   unsignedutm_16:1 __deprecated; /* utm data witdh is 16 bits */
-   unsignedbig_endian:1;   /* true if CPU uses big-endian */
-   unsignedmult_bulk_tx:1; /* Tx ep required for multbulk pkts */
-   unsignedmult_bulk_rx:1; /* Rx ep required for multbulk pkts */
-   unsignedhigh_iso_tx:1;  /* Tx ep required for HB iso */
-   unsignedhigh_iso_rx:1;  /* Rx ep required for HD iso */
-   unsigneddma:1 __deprecated; /* supports DMA */
-   unsignedvendor_req:1 __deprecated; /* vendor registers required 
*/
-
-   u8  num_eps;/* number of endpoints _with_ ep0 */
-   u8  dma_channels __deprecated; /* number of dma channels */
-   u8  dyn_fifo_size;  /* dynamic size in bytes */
-   u8  vendor_ctrl __deprecated; /* vendor control reg width */
-   u8  vendor_stat __deprecated; /* vendor status reg witdh */
-   u8  dma_req_chan __deprecated; /* bitmask for required dma 
channels */
-   u8  ram_bits;   /* ram address size */
-
-   struct musb_hdrc_eps_bits *eps_bits __deprecated;
-#ifdef CONFIG_BLACKFIN
-   /* A GPIO controlling VRSEL in Blackfin */
-   unsigned intgpio_vrsel;
-   unsigned intgpio_vrsel_active;
-   /* musb CLKIN in Blackfin in MHZ */
-   unsigned char   clkin;
-#endif
-
-};
-
-struct musb_hdrc_platform_data {
-   /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
-   u8  mode;
-
-   /* for clk_get() */
-   const char  *clock;
-
-   /* (HOST or OTG) switch VBUS on/off */
-   int (*set_vbus)(struct device *dev, int is_on);
-
-   /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
-   u8  power;
-
-   /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
-   u8  min_power;
-
-   /* (HOST or OTG) msec/2 after VBUS on till power good */
-   u8  potpgt;
-
-   /* (HOST or OTG) program PHY for external Vbus */
-   unsignedextvbus:1;
-
-   /* Power the device on or off */
-   int  

[PATCH 08/18] musb: use __BAREBOX__ macro

2014-06-13 Thread Christoph Fritz
---
 drivers/usb/musb/musb_core.c |   51 +-
 drivers/usb/musb/musb_core.h |   10 -
 drivers/usb/musb/musb_dsps.c |   41 +
 drivers/usb/musb/musb_host.c |   31 +
 drivers/usb/musb/musb_host.h |4 ++--
 drivers/usb/musb/musb_io.h   |2 +-
 6 files changed, 68 insertions(+), 71 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 36681b6..546f656 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -89,8 +89,7 @@
  * Most of the conditional compilation will (someday) vanish.
  */
 
-#define __UBOOT__
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 #include linux/module.h
 #include linux/kernel.h
 #include linux/sched.h
@@ -134,7 +133,7 @@ MODULE_LICENSE(GPL);
 MODULE_ALIAS(platform: MUSB_DRIVER_NAME);
 
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 /*-*/
 
 static inline struct musb *dev_to_musb(struct device *dev)
@@ -145,7 +144,7 @@ static inline struct musb *dev_to_musb(struct device *dev)
 
 /*-*/
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 #ifndef CONFIG_BLACKFIN
 static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
 {
@@ -360,7 +359,7 @@ void musb_load_testpacket(struct musb *musb)
musb_writew(regs, MUSB_CSR0, MUSB_CSR0_TXPKTRDY);
 }
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 /*-*/
 
 /*
@@ -450,7 +449,7 @@ void musb_hnp_stop(struct musb *musb)
 static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
u8 devctl, u8 power)
 {
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
struct usb_otg *otg = musb-xceiv-otg;
 #endif
irqreturn_t handled = IRQ_NONE;
@@ -458,7 +457,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
dev_dbg(musb-controller, == Power=%02x, DevCtl=%02x, 
int_usb=0x%x\n, power, devctl,
int_usb);
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
/* in host mode, the peripheral may issue remote wakeup.
 * in peripheral mode, the host may resume the link.
 * spurious RESUME irqs happen too, paired with SUSPEND.
@@ -712,7 +711,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
musb_writew(musb-mregs, MUSB_INTRTXE, musb-epmask);
musb_writew(musb-mregs, MUSB_INTRRXE, musb-epmask  0xfffe);
musb_writeb(musb-mregs, MUSB_INTRUSBE, 0xf7);
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
musb-port1_status = ~(USB_PORT_STAT_LOW_SPEED
|USB_PORT_STAT_HIGH_SPEED
|USB_PORT_STAT_ENABLE
@@ -763,7 +762,7 @@ b_host:
 #endif
}
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
if ((int_usb  MUSB_INTR_DISCONNECT)  !musb-ignore_disconnect) {
dev_dbg(musb-controller, DISCONNECT (%s) as %s, devctl 
%02x\n,
otg_state_string(musb-xceiv-state),
@@ -955,7 +954,7 @@ void musb_start(struct musb *musb)
devctl = ~MUSB_DEVCTL_SESSION;
 
if (is_otg_enabled(musb)) {
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
/* session started after:
 * (a) ID-grounded irq, host mode;
 * (b) vbus present/connect IRQ, peripheral mode;
@@ -1024,7 +1023,7 @@ void musb_stop(struct musb *musb)
musb_platform_try_idle(musb, 0);
 }
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 static void musb_shutdown(struct platform_device *pdev)
 {
struct musb *musb = dev_to_musb(pdev-dev);
@@ -1818,7 +1817,7 @@ static const struct attribute_group musb_attr_group = {
 
 #endif /* sysfs */
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 /* Only used to provide driver mode change events */
 static void musb_irq_work(struct work_struct *data)
 {
@@ -1843,7 +1842,7 @@ allocate_instance(struct device *dev,
struct musb *musb;
struct musb_hw_ep   *ep;
int epnum;
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
struct usb_hcd  *hcd;
 
hcd = usb_create_hcd(musb_hc_driver, dev, dev_name(dev));
@@ -1861,7 +1860,7 @@ allocate_instance(struct device *dev,
INIT_LIST_HEAD(musb-in_bulk);
INIT_LIST_HEAD(musb-out_bulk);
 
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
hcd-uses_new_polling = 1;
hcd-has_tt = 1;
 #endif
@@ -1920,7 +1919,7 @@ static void musb_free(struct musb *musb)
  * @mregs: virtual address of controller registers,
  * not yet corrected for platform-specific offsets
  */
-#ifndef __UBOOT__
+#ifndef __BAREBOX__
 static int __devinit
 musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 #else
@@ -1931,7 +1930,7 @@ musb_init_controller(struct musb_hdrc_platform_data 
*plat, struct 

[PATCH 02/18] arm: am33xx: add pinmux config for USB

2014-06-13 Thread Christoph Fritz
Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 arch/arm/mach-omap/am33xx_mux.c  |   24 
 arch/arm/mach-omap/include/mach/am33xx-mux.h |2 ++
 2 files changed, 26 insertions(+)

diff --git a/arch/arm/mach-omap/am33xx_mux.c b/arch/arm/mach-omap/am33xx_mux.c
index 8318713..8779f00 100644
--- a/arch/arm/mach-omap/am33xx_mux.c
+++ b/arch/arm/mach-omap/am33xx_mux.c
@@ -253,6 +253,20 @@ static const __maybe_unused struct module_pin_mux 
spi1_pin_mux[] = {
{-1},
 };
 
+static const __maybe_unused struct module_pin_mux usb0_pin_mux[] = {
+   {OFFSET(usb0_drvvbus), MODE(0)},
+   /* MCASP0_AHCLKR gpio3_17  */
+   {OFFSET(mcasp0_ahclkr), MODE(7) | PULLUDEN | RXACTIVE | PULLUP_EN},
+   {-1},
+};
+
+static const __maybe_unused struct module_pin_mux usb1_pin_mux[] = {
+   {OFFSET(usb1_drvvbus), MODE(0)},
+   /* MCASP0_ACLKR gpio3_18 */
+   {OFFSET(mcasp0_aclkr), MODE(7) | PULLUDEN | RXACTIVE | PULLUP_EN},
+   {-1},
+};
+
 /*
  * Configure the pin mux for the module
  */
@@ -321,3 +335,13 @@ void am33xx_enable_nand_pin_mux(void)
 {
configure_module_pin_mux(nand_pin_mux);
 }
+
+void am33xx_enable_usb0_pin_mux(void)
+{
+   configure_module_pin_mux(usb0_pin_mux);
+}
+
+void am33xx_enable_usb1_pin_mux(void)
+{
+   configure_module_pin_mux(usb1_pin_mux);
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-mux.h 
b/arch/arm/mach-omap/include/mach/am33xx-mux.h
index fe3168b..64ad078 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-mux.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-mux.h
@@ -258,5 +258,7 @@ extern void am33xx_enable_uart2_pin_mux(void);
 extern void am33xx_enable_mmc0_pin_mux(void);
 extern void am33xx_enable_spi0_pin_mux(void);
 extern void am33xx_enable_nand_pin_mux(void);
+extern void am33xx_enable_usb0_pin_mux(void);
+extern void am33xx_enable_usb1_pin_mux(void);
 
 #endif /*__AM33XX_MUX_H__ */
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 13/18] usb: add musb support

2014-06-13 Thread Christoph Fritz
---
 include/usb/usb.h |   62 +
 1 file changed, 62 insertions(+)

diff --git a/include/usb/usb.h b/include/usb/usb.h
index 1a369d2..6e204b4 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -27,6 +27,7 @@
 #include driver.h
 #include usb/usb_defs.h
 #include asm/byteorder.h
+#include asm/unaligned.h
 
 /* Everything is aribtrary */
 #define USB_ALTSETTINGALLOC4
@@ -41,6 +42,31 @@
 
 #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
 
+/**
+ * struct usb_ctrlrequest - SETUP data for a USB device control request
+ * @bRequestType: matches the USB bmRequestType field
+ * @bRequest: matches the USB bRequest field
+ * @wValue: matches the USB wValue field (le16 byte order)
+ * @wIndex: matches the USB wIndex field (le16 byte order)
+ * @wLength: matches the USB wLength field (le16 byte order)
+ *
+ * This structure is used to send control requests to a USB device.  It matches
+ * the different fields of the USB 2.0 Spec section 9.3, table 9-2.  See the
+ * USB spec for a fuller description of the different fields, and what they are
+ * used for.
+ *
+ * Note that the driver for any interface can issue control requests.
+ * For most devices, interfaces don't coordinate with each other, so
+ * such requests may be made at any time.
+ */
+struct usb_ctrlrequest {
+   __u8 bRequestType;
+   __u8 bRequest;
+   __le16 wValue;
+   __le16 wIndex;
+   __le16 wLength;
+} __attribute__ ((packed));
+
 /* String descriptor */
 struct usb_string_descriptor {
unsigned char   bLength;
@@ -539,4 +565,40 @@ enum usb_phy_interface {
USBPHY_INTERFACE_MODE_SERIAL,
USBPHY_INTERFACE_MODE_HSIC,
 };
+
+
+/**
+ * usb_endpoint_maxp - get endpoint's max packet size
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's max packet
+ */
+static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
+{
+   return __le16_to_cpu(get_unaligned(epd-wMaxPacketSize));
+}
+
+/**
+ * usb_endpoint_type - get the endpoint's transfer type
+ * @epd: endpoint to be checked
+ *
+ * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
+ * to @epd's transfer type.
+ */
+static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
+{
+   return epd-bmAttributes  USB_ENDPOINT_XFERTYPE_MASK;
+}
+
+/**
+ * usb_endpoint_num - get the endpoint's number
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's number: 0 to 15.
+ */
+static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
+{
+   return epd-bEndpointAddress  USB_ENDPOINT_NUMBER_MASK;
+}
+
 #endif /*_USB_H_ */
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 03/18] linux wrapper: add more dummy spin_lock stubs

2014-06-13 Thread Christoph Fritz
Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 include/linux/barebox-wrapper.h |2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/barebox-wrapper.h b/include/linux/barebox-wrapper.h
index 753fb52..4b5ea10 100644
--- a/include/linux/barebox-wrapper.h
+++ b/include/linux/barebox-wrapper.h
@@ -38,6 +38,8 @@ typedef int   spinlock_t;
 #define spin_lock_init(...)
 #define spin_lock(...)
 #define spin_unlock(...)
+#define spin_lock_irqsave(...)
+#define spin_unlock_irqrestore(...)
 
 #define mutex_init(...)
 #define mutex_lock(...)
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 09/18] musb: adapt Kconfig and Makefiles

2014-06-13 Thread Christoph Fritz
---
 drivers/usb/Kconfig   |2 ++
 drivers/usb/Makefile  |1 +
 drivers/usb/musb/Kconfig  |   21 +
 drivers/usb/musb/Makefile |5 -
 4 files changed, 24 insertions(+), 5 deletions(-)
 create mode 100644 drivers/usb/musb/Kconfig

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 0b349bf..15010f5 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -7,6 +7,8 @@ source drivers/usb/imx/Kconfig
 
 source drivers/usb/host/Kconfig
 
+source drivers/usb/musb/Kconfig
+
 source drivers/usb/otg/Kconfig
 
 source drivers/usb/storage/Kconfig
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 3cefab7..25820eb 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_USB_GADGET)+= gadget/
 obj-$(CONFIG_USB_STORAGE)  += storage/
 obj-y += host/
 obj-y += otg/
+obj-y += musb/
 
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
new file mode 100644
index 000..0a88355
--- /dev/null
+++ b/drivers/usb/musb/Kconfig
@@ -0,0 +1,21 @@
+config USB_MUSB_HOST
+   tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
+   depends on USB
+   select MUSB_PIO_ONLY
+   select USB_MUSB_DSPS
+   help
+ Say Y here if your system has a dual role high speed USB
+ controller based on the Mentor Graphics silicon IP.  Then
+ configure options to match your silicon and the board
+ it's being used with, including the USB peripheral role,
+ or the USB host role, or both.
+
+if USB_MUSB_HOST
+
+config USB_MUSB_DSPS
+   bool USB_MUSB_DSPS
+
+config MUSB_PIO_ONLY
+   bool MUSB_PIO_ONLY
+
+endif # USB_MUSB_HOST
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 64ebe06..e6cc408 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -4,8 +4,3 @@
 
 obj-$(CONFIG_USB_MUSB_HOST) += musb_host.o musb_core.o
 obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
-
-CFLAGS_NO_WARN := $(call cc-option,-Wno-unused-variable) \
-   $(call cc-option,-Wno-unused-but-set-variable) \
-   $(call cc-option,-Wno-unused-label)
-CFLAGS += $(CFLAGS_NO_WARN)
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 10/18] arm: pcm051: enable musb in defconfig

2014-06-13 Thread Christoph Fritz
---
 arch/arm/configs/am335x_defconfig |2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/am335x_defconfig 
b/arch/arm/configs/am335x_defconfig
index 0c92c96..a9bf5e0 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -96,6 +96,8 @@ CONFIG_NAND=y
 CONFIG_NAND_OMAP_GPMC=y
 CONFIG_MTD_UBI=y
 CONFIG_USB=y
+CONFIG_USB_MUSB_HOST=y
+CONFIG_USB_STORAGE=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_OMAP_HSMMC=y
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 16/18] musb: add barebox gluecode

2014-06-13 Thread Christoph Fritz
---
 drivers/usb/musb/Makefile   |2 +-
 drivers/usb/musb/musb_barebox.c |  306 +++
 2 files changed, 307 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/musb/musb_barebox.c

diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index e6cc408..6640e1c 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -2,5 +2,5 @@
 # for USB OTG silicon based on Mentor Graphics INVENTRA designs
 #
 
-obj-$(CONFIG_USB_MUSB_HOST) += musb_host.o musb_core.o
+obj-$(CONFIG_USB_MUSB_HOST) += musb_host.o musb_core.o musb_barebox.o
 obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o
diff --git a/drivers/usb/musb/musb_barebox.c b/drivers/usb/musb/musb_barebox.c
new file mode 100644
index 000..ecf18fd
--- /dev/null
+++ b/drivers/usb/musb/musb_barebox.c
@@ -0,0 +1,306 @@
+#include driver.h
+#include xfuncs.h
+#include common.h
+#include watchdog.h
+#include errno.h
+#include init.h
+#include stdio.h
+#include io.h
+#include malloc.h
+#include clock.h
+
+#include mach/am33xx-usb.h
+#include asm/omap_musb.h
+
+#include usb/usb.h
+#include linux-compat.h
+#include usb-compat.h
+#include musb_core.h
+#include musb_host.h
+
+static struct musb *host;
+static struct usb_hcd hcd;
+static int host_speed;
+
+struct am33xxusb_device {
+   struct device_d *dev;
+
+   void __iomem *usbss;
+   void __iomem *usb;
+   void __iomem *usbphy;
+   void __iomem *usbcore;
+
+   void __iomem *ctrl_base;
+};
+
+static void musb_host_complete_urb(struct urb *urb)
+{
+   urb-dev-status = ~USB_ST_NOT_PROC;
+   urb-dev-act_len = urb-actual_length;
+}
+
+static struct usb_host_endpoint hep;
+static struct urb urb;
+
+static struct urb *construct_urb(struct usb_device *dev, int endpoint_type,
+   unsigned long pipe, void *buffer, int len,
+   struct devrequest *setup, int interval)
+{
+   int epnum = usb_pipeendpoint(pipe);
+   int is_in = usb_pipein(pipe);
+
+   memset(urb, 0, sizeof(struct urb));
+   memset(hep, 0, sizeof(struct usb_host_endpoint));
+   INIT_LIST_HEAD(hep.urb_list);
+   INIT_LIST_HEAD(urb.urb_list);
+   urb.ep = hep;
+   urb.complete = musb_host_complete_urb;
+   urb.status = -EINPROGRESS;
+   urb.dev = dev;
+   urb.pipe = pipe;
+   urb.transfer_buffer = buffer;
+   urb.transfer_dma = (unsigned long)buffer;
+   urb.transfer_buffer_length = len;
+   urb.setup_packet = (unsigned char *)setup;
+
+   urb.ep-desc.wMaxPacketSize =
+   __cpu_to_le16(is_in ? dev-epmaxpacketin[epnum] :
+   dev-epmaxpacketout[epnum]);
+   urb.ep-desc.bmAttributes = endpoint_type;
+   urb.ep-desc.bEndpointAddress =
+   (is_in ? USB_DIR_IN : USB_DIR_OUT) | epnum;
+   urb.ep-desc.bInterval = interval;
+
+   return urb;
+}
+
+#define MUSB_HOST_TIMEOUT  0x3ff
+
+static int submit_urb(struct usb_hcd *hcd, struct urb *urb)
+{
+   struct musb *host = hcd-hcd_priv;
+   int ret;
+   int timeout;
+
+   ret = musb_urb_enqueue(hcd, urb, 0);
+   if (ret  0) {
+   printf(Failed to enqueue URB to controller\n);
+   return ret;
+   }
+
+   timeout = MUSB_HOST_TIMEOUT;
+   do {
+   if (ctrlc())
+   return -EIO;
+   host-isr(0, host);
+   } while ((urb-dev-status  USB_ST_NOT_PROC)  --timeout);
+
+   return urb-status;
+}
+
+int submit_control_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int len, struct devrequest *setup,
+   int timeout)
+{
+   struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_CONTROL, pipe,
+   buffer, len, setup, 0);
+
+   /* Fix speed for non hub-attached devices */
+   if (!dev-parent)
+   dev-speed = host_speed;
+
+   return submit_urb(hcd, urb);
+}
+
+
+int submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int len, int timeout)
+{
+   struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_BULK, pipe,
+   buffer, len, NULL, 0);
+   return submit_urb(hcd, urb);
+}
+
+int submit_int_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int len, int interval)
+{
+   struct urb *urb = construct_urb(dev, USB_ENDPOINT_XFER_INT, pipe,
+   buffer, len, NULL, interval);
+   return submit_urb(hcd, urb);
+}
+
+int usb_lowlevel_init(struct usb_host *bb_host)
+{
+   u8 power;
+   void *mbase;
+   int timeout = MUSB_HOST_TIMEOUT;
+   int rc;
+
+   if (!host) {
+   printf(MUSB host is not registered\n);
+   return -ENODEV;
+   }
+
+   musb_start(host);
+   mbase = host-mregs;
+   do {
+ 

[PATCH 15/18] arm: am33xx: add usb platform helper code

2014-06-13 Thread Christoph Fritz
---
 arch/arm/mach-omap/Makefile  |2 +-
 arch/arm/mach-omap/am33xx_usb.c  |   65 ++
 arch/arm/mach-omap/include/mach/am33xx-usb.h |   11 +
 3 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-omap/am33xx_usb.c
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-usb.h

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index c9b6f4b..789f91b 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -23,7 +23,7 @@ obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
 pbl-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
 obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
 pbl-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
-obj-pbl-$(CONFIG_ARCH_AM33XX) += am33xx_generic.o am33xx_clock.o am33xx_mux.o
+obj-pbl-$(CONFIG_ARCH_AM33XX) += am33xx_generic.o am33xx_clock.o am33xx_mux.o 
am33xx_usb.o
 obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 pbl-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
diff --git a/arch/arm/mach-omap/am33xx_usb.c b/arch/arm/mach-omap/am33xx_usb.c
new file mode 100644
index 000..b4d570e
--- /dev/null
+++ b/arch/arm/mach-omap/am33xx_usb.c
@@ -0,0 +1,65 @@
+#include driver.h
+#include common.h
+#include linux/ioport.h
+#include mach/am33xx-silicon.h
+#include mach/am33xx-usb.h
+
+#ifdef CONFIG_USB_MUSB_HOST
+static struct resource am33xx_usb_resources[] = {
+   {
+   .name   = am33xx_usbss,
+   .start  = AM33XX_USBSS_BASE,
+   .end= AM33XX_USBSS_BASE + 1024 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb0,
+   .start  = AM33XX_USB0_BASE,
+   .end= AM33XX_USB0_BASE + 767 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb1,
+   .start  = AM33XX_USB1_BASE,
+   .end= AM33XX_USB1_BASE + 767 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb0phy,
+   .start  = AM33XX_USB0_PHY_BASE,
+   .end= AM33XX_USB0_PHY_BASE + 255 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb1phy,
+   .start  = AM33XX_USB1_PHY_BASE,
+   .end= AM33XX_USB1_PHY_BASE + 255 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb0core,
+   .start  = AM33XX_USB0_CORE_BASE,
+   .end= AM33XX_USB0_CORE_BASE + 1023 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_usb1core,
+   .start  = AM33XX_USB1_CORE_BASE,
+   .end= AM33XX_USB1_CORE_BASE + 1023 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = am33xx_ctrl_device_base,
+   .start  = AM33XX_IDCODE_REG,
+   .end= AM33XX_IDCODE_REG + 128 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   },
+};
+
+struct device_d *am33xx_add_usb(struct am33xx_usb_pdata *a_pdata)
+{
+   return add_generic_device_res(am33xx_usb, -1,
+   am33xx_usb_resources,
+   ARRAY_SIZE(am33xx_usb_resources),
+   a_pdata);
+}
+#else
+struct device_d *am33xx_add_usb(struct am33xx_usb_pdata *a_pdata)
+{
+   return NULL;
+}
+#endif
+EXPORT_SYMBOL(am33xx_add_usb0);
diff --git a/arch/arm/mach-omap/include/mach/am33xx-usb.h 
b/arch/arm/mach-omap/include/mach/am33xx-usb.h
new file mode 100644
index 000..ff3b000
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/am33xx-usb.h
@@ -0,0 +1,11 @@
+#ifndef H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_AUSB_H
+#define H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_AUSB_H
+
+struct am33xx_usb_pdata {
+   unsigned intbus_number;
+};
+
+struct device_d;
+struct device_d *am33xx_add_usb(struct am33xx_usb_pdata *a_pdata);
+
+#endif /* H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_AUSB_H */
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 14/18] arm: am33xx: add usb base addresses

2014-06-13 Thread Christoph Fritz
---
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h 
b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
index 20b8e81..bccae89 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
@@ -76,6 +76,16 @@
 /* Watchdog Timer */
 #define AM33XX_WDT_BASE0x44E35000
 
+/* USB */
+#define AM33XX_USBSS_BASE  0x4740
+#define AM33XX_USB0_BASE   0x47401000
+#define AM33XX_USB0_PHY_BASE   0x47401300
+#define AM33XX_USB0_CORE_BASE  0x47401400
+#define USB1_OFFSET0x0800
+#define AM33XX_USB1_BASE   (AM33XX_USB0_BASE + USB1_OFFSET)
+#define AM33XX_USB1_PHY_BASE   (AM33XX_USB0_PHY_BASE + USB1_OFFSET)
+#define AM33XX_USB1_CORE_BASE  (AM33XX_USB0_CORE_BASE + USB1_OFFSET)
+
 /* EMIF Base address */
 #define AM33XX_EMIF4_0_CFG_BASE0x4C00
 #define AM33XX_EMIF4_1_CFG_BASE0x4D00
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 11/18] musb: adapt driver to work on barebox

2014-06-13 Thread Christoph Fritz
---
 drivers/usb/musb/linux-compat.h |   31 +---
 drivers/usb/musb/musb.h |  164 +++
 drivers/usb/musb/musb_core.c|   20 +++--
 drivers/usb/musb/musb_core.h|   42 +++---
 drivers/usb/musb/musb_dsps.c|2 -
 drivers/usb/musb/musb_host.c|2 +-
 drivers/usb/musb/musb_io.h  |   19 -
 drivers/usb/musb/usb-compat.h   |2 +-
 include/usb/musb.h  |  162 --
 9 files changed, 192 insertions(+), 252 deletions(-)
 create mode 100644 drivers/usb/musb/musb.h
 delete mode 100644 include/usb/musb.h

diff --git a/drivers/usb/musb/linux-compat.h b/drivers/usb/musb/linux-compat.h
index d7a5663..5cfa9d1 100644
--- a/drivers/usb/musb/linux-compat.h
+++ b/drivers/usb/musb/linux-compat.h
@@ -3,7 +3,7 @@
 
 #include malloc.h
 #include linux/list.h
-#include linux/compat.h
+#include notifier.h
 
 #define __init
 #define __devinit
@@ -16,21 +16,13 @@ struct unused {};
 typedef struct unused unused_t;
 
 typedef int irqreturn_t;
-typedef unused_t spinlock_t;
 
 struct work_struct {};
 
 struct timer_list {};
-struct notifier_block {};
 
 typedef unsigned long dmaaddr_t;
 
-#define spin_lock_init(lock) do {} while (0)
-#define spin_lock(lock) do {} while (0)
-#define spin_unlock(lock) do {} while (0)
-#define spin_lock_irqsave(lock, flags) do {} while (0)
-#define spin_unlock_irqrestore(lock, flags) do {} while (0)
-
 #define setup_timer(timer, func, data) do {} while (0)
 #define del_timer_sync(timer) do {} while (0)
 #define schedule_work(work) do {} while (0)
@@ -38,14 +30,6 @@ typedef unsigned long dmaaddr_t;
 
 #define cpu_relax() do {} while (0)
 
-#define pr_debug(fmt, args...) debug(fmt, ##args)
-
-#define WARN(condition, fmt, args...) ({   \
-   int ret_warn = !!condition; \
-   if (ret_warn)   \
-   printf(fmt, ##args);\
-   ret_warn; })
-
 #define pm_runtime_get_sync(dev) do {} while (0)
 #define pm_runtime_put(dev) do {} while (0)
 #define pm_runtime_put_sync(dev) do {} while (0)
@@ -53,20 +37,9 @@ typedef unsigned long dmaaddr_t;
 #define pm_runtime_set_autosuspend_delay(dev, delay) do {} while (0)
 #define pm_runtime_enable(dev) do {} while (0)
 
-#define MODULE_DESCRIPTION(desc)
-#define MODULE_AUTHOR(author)
-#define MODULE_LICENSE(license)
 #define MODULE_ALIAS(alias)
 #define module_param(name, type, perm)
 #define MODULE_PARM_DESC(name, desc)
-#define EXPORT_SYMBOL_GPL(name)
-
-#define writesl(a, d, s) __raw_writesl((unsigned long)a, d, s)
-#define readsl(a, d, s) __raw_readsl((unsigned long)a, d, s)
-#define writesw(a, d, s) __raw_writesw((unsigned long)a, d, s)
-#define readsw(a, d, s) __raw_readsw((unsigned long)a, d, s)
-#define writesb(a, d, s) __raw_writesb((unsigned long)a, d, s)
-#define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s)
 
 #define IRQ_NONE 0
 #define IRQ_HANDLED 0
@@ -80,8 +53,6 @@ typedef unsigned long dmaaddr_t;
 
 #define device_init_wakeup(dev, a) do {} while (0)
 
-#define platform_data device_data
-
 #ifndef wmb
 #define wmb()  asm volatile (   : : : memory)
 #endif
diff --git a/drivers/usb/musb/musb.h b/drivers/usb/musb/musb.h
new file mode 100644
index 000..2296a1b
--- /dev/null
+++ b/drivers/usb/musb/musb.h
@@ -0,0 +1,164 @@
+/*
+ * This is used to for host and peripheral modes of the driver for
+ * Inventra (Multidrop) Highspeed Dual-Role Controllers:  (M)HDRC.
+ *
+ * Board initialization should put one of these into dev-platform_data,
+ * probably on some platform_device named musb-hdrc.  It encapsulates
+ * key configuration differences between boards.
+ */
+
+#ifndef __LINUX_USB_MUSB_H
+#define __LINUX_USB_MUSB_H
+
+#ifndef __deprecated
+#define __deprecated
+#endif
+
+/* The USB role is defined by the connector used on the board, so long as
+ * standards are being followed.  (Developer boards sometimes won't.)
+ */
+enum musb_mode {
+   MUSB_UNDEFINED = 0,
+   MUSB_HOST,  /* A or Mini-A connector */
+   MUSB_PERIPHERAL,/* B or Mini-B connector */
+   MUSB_OTG/* Mini-AB connector */
+};
+
+struct clk;
+
+enum musb_fifo_style {
+   FIFO_RXTX,
+   FIFO_TX,
+   FIFO_RX
+} __attribute__ ((packed));
+
+enum musb_buf_mode {
+   BUF_SINGLE,
+   BUF_DOUBLE
+} __attribute__ ((packed));
+
+struct musb_fifo_cfg {
+   u8  hw_ep_num;
+   enum musb_fifo_stylestyle;
+   enum musb_buf_mode  mode;
+   u16 maxpacket;
+};
+
+#define MUSB_EP_FIFO(ep, st, m, pkt)   \
+{  \
+   .hw_ep_num  = ep,   \
+   .style  = st,   \
+   .mode   = m,\
+   .maxpacket  = pkt,  \
+}
+
+#define MUSB_EP_FIFO_SINGLE(ep, st, pkt)   \
+   MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
+
+#define 

[PATCH 18/18] arm: pcm051: enable USB

2014-06-13 Thread Christoph Fritz
---
 arch/arm/boards/phytec-phycore-am335x/board.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c 
b/arch/arm/boards/phytec-phycore-am335x/board.c
index 70b5db6..305c71b 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -31,6 +31,7 @@
 #include mach/am33xx-generic.h
 #include mach/am33xx-silicon.h
 #include mach/am33xx-clock.h
+#include mach/am33xx-usb.h
 #include mach/bbu.h
 
 
@@ -58,10 +59,15 @@ static char *xloadslots[] = {
/dev/nand0.xload_backup3.bb
 };
 
+static struct am33xx_usb_pdata pcm051_usb_data = {
+   .bus_number = 1,
+};
+
 static void pcm051_usb_init(void)
 {
am33xx_enable_usb0_pin_mux();
am33xx_enable_usb1_pin_mux();
+   am33xx_add_usb(pcm051_usb_data);
 }
 
 static int pcm051_devices_init(void)
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 12/18] musb: only support USB_SPEED_HIGH devices

2014-06-13 Thread Christoph Fritz
This patch enables usb high-speed power. To support full-speed or low-speed
devices, this patch needs to be reverted.
---
 drivers/usb/musb/musb_core.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 6dbf1cc..2847444 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -943,10 +943,7 @@ 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
-#ifdef CONFIG_USB_GADGET_DUALSPEED
-   | MUSB_POWER_HSENAB
-#endif
+   musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE | MUSB_POWER_HSENAB
/* ENSUSPEND wedges tusb */
/* | MUSB_POWER_ENSUSPEND */
);
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 17/18] arm: pcm051: enable USB pinmux

2014-06-13 Thread Christoph Fritz
---
 arch/arm/boards/phytec-phycore-am335x/board.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c 
b/arch/arm/boards/phytec-phycore-am335x/board.c
index 9482b80..70b5db6 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -27,8 +27,10 @@
 #include asm/armlinux.h
 #include generated/mach-types.h
 #include linux/phy.h
+#include mach/am33xx-mux.h
 #include mach/am33xx-generic.h
 #include mach/am33xx-silicon.h
+#include mach/am33xx-clock.h
 #include mach/bbu.h
 
 
@@ -56,6 +58,12 @@ static char *xloadslots[] = {
/dev/nand0.xload_backup3.bb
 };
 
+static void pcm051_usb_init(void)
+{
+   am33xx_enable_usb0_pin_mux();
+   am33xx_enable_usb1_pin_mux();
+}
+
 static int pcm051_devices_init(void)
 {
if (!of_machine_is_compatible(phytec,pcm051))
@@ -81,6 +89,8 @@ static int pcm051_devices_init(void)
am33xx_bbu_nand_xloadslots_register_handler(MLO.nand,
xloadslots, ARRAY_SIZE(xloadslots));
 
+   pcm051_usb_init();
+
return 0;
 }
 device_initcall(pcm051_devices_init);
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] commands: add 'findstr' to get string from file

2014-05-22 Thread Christoph Fritz
Hi Sascha

On Wed, 2014-05-21 at 15:51 +0200, Sascha Hauer wrote:
 On Tue, May 20, 2014 at 07:27:55PM +0200, Christoph Fritz wrote:
  Command 'findstr' can be for example used to find the string
  MAC=1C:BA:8C:F3:82:BB in file /dev/eeprom0 to set the
  appropriate variable:
  
   $ findstr -o 4 -l 17 -t eth0.ethaddr MAC /dev/eeprom0
  
  Usage: findstr [OPTIONS] STRING FILE
  Find string in file and print it
  -o offset set offset of string which gets printed
  -l length set length of string which gets printed
  -t varprint into variable instead of stdio
 
 I wonder how useful such a command is. I mean normally I would
 expect a MAC address to be stored in binary format and not ASCII.

Yes, and if a user wants to set it to another value, there is variable
'ethaddr' in 'env/network/eth0' which can be changed.

The use case here I'm facing: User wants to change 'ethaddr' and store
it in eeprom instead. If the whole /dev/eeprom0 would be a
barebox-script, it could be processed, but I can't rely on.

 Matching 'MAC' (what about the '='?) seems not very robust.

From the example above, the offset is 4 and a '=' or any other char gets
bypassed.

  What about strings with dynamic lengths?

A more robust and flexible approach I have in mind is this: Find string
xy and delimiter z in file and optionally execute what is in between as
a command. 

 If the command is primarily intended for the MAC address then maybe
 a more dedicated command or a piece of code called from board code
 is more robust.

That's what I'm already doing here, but want to get a more general
solution for all kinds of settings.

  If the command is intended as a general
 eeprom-variable-store then I think it's not flexible enough.

What do you think about the more robust approach from above?

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] commands: add 'findstr' to search file for string

2014-05-21 Thread Christoph Fritz
Command 'findstr' can be for example used to find string
MAC=1C:BA:8C:F3:82:BB in file /dev/eeprom0 to set an
appropriate environment variable:

 $ findstr -o 16 -l 17 -t eth0.ethaddr pcm051_eth0_MAC= /dev/eeprom0

Usage: findstr [OPTIONS] STRING FILE
Find ASCII string in file and print it
-o offset set offset of string which gets printed
-l length set length of string which gets printed
-t varprint into variable instead of stdio

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
Changes in v2:
 - fix Kconfig: 'default n' is default
 - add default branch to switch
 - fix search string read-buffer overlap
---
 commands/Kconfig   |6 +++
 commands/Makefile  |1 +
 commands/findstr.c |  140 
 3 files changed, 147 insertions(+)
 create mode 100644 commands/findstr.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 3ef8860..a795da9 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -149,6 +149,12 @@ config CMD_GLOBAL
help
  The global command allows to create global variables
 
+config CMD_FINDSTR
+   tristate
+   prompt findstr
+   help
+ Find ASCII string in file.
+
 endmenu
 
 menu file commands
diff --git a/commands/Makefile b/commands/Makefile
index f927d21..580b137 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -97,3 +97,4 @@ obj-$(CONFIG_CMD_READF)   += readf.o
 obj-$(CONFIG_CMD_MENUTREE) += menutree.o
 obj-$(CONFIG_CMD_2048) += 2048.o
 obj-$(CONFIG_CMD_REGULATOR)+= regulator.o
+obj-$(CONFIG_CMD_FINDSTR)  += findstr.o
diff --git a/commands/findstr.c b/commands/findstr.c
new file mode 100644
index 000..934c300
--- /dev/null
+++ b/commands/findstr.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014 Christoph Fritz chf.fr...@googlemail.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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.
+ *
+ */
+
+/**
+ * @file
+ * @brief Find string in file
+ */
+
+#include common.h
+#include command.h
+#include fs.h
+#include fcntl.h
+#include errno.h
+#include getopt.h
+#include environment.h
+
+#define FINDSTR_BUF_SIZE   RW_BUF_SIZE
+
+extern char *mem_rw_buf;
+
+/**
+ * @param[in] argc Argument count from command line
+ * @param[in] argv List of input arguments
+ */
+static int do_findstr(int argc, char *argv[])
+{
+   int opt, fd, r, ret = 1;
+   loff_t len = 0, offset = 0, idx = 0;
+   u_char *s, *t = NULL, *v = (u_char *)mem_rw_buf;
+   unsigned int v_idx, s_idx = 0;
+
+   if (argc  2)
+   return COMMAND_ERROR_USAGE;
+
+   while ((opt = getopt(argc, argv, o:l:t:))  0) {
+   switch (opt) {
+   case 'o':
+   offset = simple_strtoul(optarg, NULL, 0);
+   break;
+   case 'l':
+   len = simple_strtoul(optarg, NULL, 0);
+   break;
+   case 't':
+   t = optarg;
+   break;
+   default:
+   return COMMAND_ERROR_USAGE;
+   }
+   }
+
+   if (argc - optind != 2)
+   return COMMAND_ERROR_USAGE;
+
+   s = argv[optind];
+
+   fd = open(argv[optind+1], O_RDONLY);
+   if (fd  0)
+   return COMMAND_ERROR_USAGE;
+
+   while (1) {
+   r = read(fd, mem_rw_buf, FINDSTR_BUF_SIZE);
+   if (r  0) {
+   ret = -EIO;
+   goto out;
+   }
+   if (!r)
+   break;
+
+   v_idx = 0;
+
+   while (r) {
+   if (v[v_idx] == s[s_idx])
+   s_idx++;
+   else
+   s_idx = 0;
+
+   idx++;
+   v_idx++;
+
+   if (s_idx == strlen(s)) {   /* found */
+   loff_t hit = idx - strlen(s);
+
+   if (lseek(fd, hit + offset, SEEK_SET)  0) {
+   ret = -EIO;
+   goto out;
+   }
+
+   if (!len)
+   len = strlen(s);
+   r = read(fd, mem_rw_buf, len);
+   if (r != len) {
+   ret = -EIO;
+   goto out

Re: [PATCH v2] commands: add 'findstr' to search file for string

2014-05-21 Thread Christoph Fritz
Hi Antony

On Wed, 2014-05-21 at 13:22 +0400, Antony Pavlov wrote:
 On Wed, 21 May 2014 10:02:42 +0200
 Christoph Fritz chf.fr...@googlemail.com wrote:
 
  Command 'findstr' can be for example used to find string
 
 We already have some commands with string.h style names:
   memcmp, memcpy, memset
 
 Can we use 'strstr' name for your new command?

Sure, anyone with any objections?

 Another proposition:
  can we add offset from file start and no more N characters to
 search parameters?
 
 Using these parameters you can speed up your search and use your
 command with /dev/mem.

Ok, I can add this to a [PATCH v3], anyone with any objections?

  MAC=1C:BA:8C:F3:82:BB in file /dev/eeprom0 to set an
  appropriate environment variable:
  
   $ findstr -o 16 -l 17 -t eth0.ethaddr pcm051_eth0_MAC= /dev/eeprom0
  
  Usage: findstr [OPTIONS] STRING FILE
  Find ASCII string in file and print it
  -o offset set offset of string which gets printed
  -l length set length of string which gets printed
  -t varprint into variable instead of stdio

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] commands: add 'findstr' to get string from file

2014-05-20 Thread Christoph Fritz
Command 'findstr' can be for example used to find the string
MAC=1C:BA:8C:F3:82:BB in file /dev/eeprom0 to set the
appropriate variable:

 $ findstr -o 4 -l 17 -t eth0.ethaddr MAC /dev/eeprom0

Usage: findstr [OPTIONS] STRING FILE
Find string in file and print it
-o offset set offset of string which gets printed
-l length set length of string which gets printed
-t varprint into variable instead of stdio

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 commands/Kconfig   |7 +++
 commands/Makefile  |1 +
 commands/findstr.c |  138 
 3 files changed, 146 insertions(+)
 create mode 100644 commands/findstr.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 3ef8860..a2f817a 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -149,6 +149,13 @@ config CMD_GLOBAL
help
  The global command allows to create global variables
 
+config CMD_FINDSTR
+   tristate
+   default n
+   prompt findstr
+   help
+ Find string in file.
+
 endmenu
 
 menu file commands
diff --git a/commands/Makefile b/commands/Makefile
index f927d21..b7c7e31 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -97,3 +97,4 @@ obj-$(CONFIG_CMD_READF)   += readf.o
 obj-$(CONFIG_CMD_MENUTREE) += menutree.o
 obj-$(CONFIG_CMD_2048) += 2048.o
 obj-$(CONFIG_CMD_REGULATOR)+= regulator.o
+obj-$(CONFIG_CMD_FINDSTR)  += findstr.o
\ No newline at end of file
diff --git a/commands/findstr.c b/commands/findstr.c
new file mode 100644
index 000..37cfee3
--- /dev/null
+++ b/commands/findstr.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014 Christoph Fritz chf.fr...@googlemail.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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.
+ *
+ */
+
+/**
+ * @file
+ * @brief Find string in file
+ */
+
+#include common.h
+#include command.h
+#include fs.h
+#include fcntl.h
+#include errno.h
+#include getopt.h
+#include environment.h
+
+extern char *mem_rw_buf;
+
+/**
+ * @param[in] argc Argument count from command line
+ * @param[in] argv List of input arguments
+ */
+static int do_findstr(int argc, char *argv[])
+{
+   int opt, fd, r, ret = 1;
+   loff_t len = 0, offset = 0, idx = 0;
+   u_char *s, *t = NULL, *v = (u_char *)mem_rw_buf;
+   unsigned int v_idx, s_idx = 0;
+
+   if (argc  2)
+   return COMMAND_ERROR_USAGE;
+
+   while ((opt = getopt(argc, argv, o:l:t:))  0) {
+   switch (opt) {
+   case 'o':
+   offset = simple_strtoul(optarg, NULL, 0);
+   break;
+   case 'l':
+   len = simple_strtoul(optarg, NULL, 0);
+   break;
+   case 't':
+   t = optarg;
+   break;
+   }
+   }
+
+   if (argc - optind != 2)
+   return COMMAND_ERROR_USAGE;
+
+   s = argv[optind];
+
+   fd = open(argv[optind+1], O_RDONLY);
+   if (fd  0)
+   return COMMAND_ERROR_USAGE;
+
+   while (1) {
+   r = read(fd, mem_rw_buf, RW_BUF_SIZE);
+   if (r  0) {
+   ret = -EIO;
+   goto out;
+   }
+   if (!r)
+   break;
+
+   v_idx = 0;
+
+   while (r) {
+   if (v[v_idx] == s[s_idx])
+   s_idx++;
+   else
+   s_idx = 0;
+
+   idx++;
+   v_idx++;
+
+   if (s_idx == strlen(s)) {   /* found */
+   loff_t sz;
+   loff_t hit = idx - strlen(s);
+
+   if (lseek(fd, hit + offset, SEEK_SET)  0) {
+   ret = -EIO;
+   goto out;
+   }
+
+   if (!len)
+   len = strlen(s);
+   sz = min_t(loff_t, len, RW_BUF_SIZE - 1);
+   r = read(fd, mem_rw_buf, sz);
+   if (r != sz) {
+   ret = -EIO;
+   goto out;
+   }
+
+   v[sz] = '\0';
+
+   if (t

Re: [PATCH] commands: add 'findstr' to get string from file

2014-05-20 Thread Christoph Fritz
Hi Alexander

On Tue, 2014-05-20 at 20:08 +0200, Alexander Aring wrote:
 On Tue, May 20, 2014 at 07:27:55PM +0200, Christoph Fritz wrote:

  +config CMD_FINDSTR
  +   tristate
  +   default n
 not needed.

Ok

  +   while ((opt = getopt(argc, argv, o:l:t:))  0) {
  +   switch (opt) {
  +   case 'o':
  +   offset = simple_strtoul(optarg, NULL, 0);
  +   break;
  +   case 'l':
  +   len = simple_strtoul(optarg, NULL, 0);
  +   break;
  +   case 't':
  +   t = optarg;
  +   break;
  +   }
 
 switch case without default branch can occur compiler warnings.
 
 You should return COMMAND_ERROR_USAGE in the default branch if non valid
 parameter is given.

Ok

  +   fd = open(argv[optind+1], O_RDONLY);
  +   if (fd  0)
  +   return COMMAND_ERROR_USAGE;
  +
  +   while (1) {
  +   r = read(fd, mem_rw_buf, RW_BUF_SIZE);
  +   if (r  0) {
  +   ret = -EIO;
  +   goto out;
  +   }
  +   if (!r)
  +   break;
  +
  +   v_idx = 0;
  +
  +   while (r) {
  +   if (v[v_idx] == s[s_idx])
  +   s_idx++;
  +   else
  +   s_idx = 0;
  +
  +   idx++;
  +   v_idx++;
  +
  +   if (s_idx == strlen(s)) {   /* found */
  +   loff_t sz;
  +   loff_t hit = idx - strlen(s);
  +
  +   if (lseek(fd, hit + offset, SEEK_SET)  0) {
  +   ret = -EIO;
  +   goto out;
  +   }
  +
  +   if (!len)
  +   len = strlen(s);
  +   sz = min_t(loff_t, len, RW_BUF_SIZE - 1);
  +   r = read(fd, mem_rw_buf, sz);
  +   if (r != sz) {
  +   ret = -EIO;
  +   goto out;
  +   }
  +
  +   v[sz] = '\0';
  +
  +   if (t)
  +   setenv(t, v);
  +   else
  +   printf(%s\n, v);
  +
  +   ret = 0;
  +   goto out;
  +   }
  +   r--;
  +   }
 
 Why not use read_file and the awesome string function strstr and then
 write the file back.

read_file() reads the whole file which can get pretty slow over an i2c
link accessing an eeprom which mostly holds the configuration-string at
the beginning.

Why would I want to write the file back?

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: New driver crashes with unable to handle paging request

2014-05-13 Thread Christoph Fritz
Hey Alex

On Tue, 2014-05-13 at 13:03 +0200, Alexander Aring wrote:
 This was one year ago...

The port (with only host support) is that old, but simply due to lack of
time I haven't fixed the hacks in there. For example some delays need
proper wait_on_timeout(), therefore a reference manual would be nice.

I hope to find some time next weekend pushing the stuff to github or as
a RFC-Patchset.

Keep calm


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] [RFC] omap: xload - try to get partition from dts

2014-05-12 Thread Christoph Fritz
On Mon, 2014-05-12 at 16:57 +0200, Christoph Fritz wrote:
 dev_add_bb_dev(x, bbx) doesn't work here anymore.
 Since pcm051 supports dts, nand boot works again with this patch.
 
 Any ideas?
 ---
  arch/arm/mach-omap/xload.c |   26 +-
  1 file changed, 17 insertions(+), 9 deletions(-)
 
 diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
 index a309450..c360568 100644
 --- a/arch/arm/mach-omap/xload.c
 +++ b/arch/arm/mach-omap/xload.c
 @@ -56,18 +56,22 @@ static unsigned int get_image_size(void *head)
   return ret;
  }
  
 -static void *omap_xload_boot_nand(int offset, int part_size)
 +static void *omap_xload_boot_nand(unsigned int offset, unsigned int 
 part_size)
  {
   int ret;
   int size;
   void *to, *header;
   struct cdev *cdev;
 + const char *bbx = nand0.barebox;
  
 - devfs_add_partition(nand0, offset, part_size,
 + if (!cdev_by_name(bbx)) { /* currently not all support dts */
 + bbx = bbx;
 + devfs_add_partition(nand0, offset, part_size,
   DEVFS_PARTITION_FIXED, x);
 - dev_add_bb_dev(x, bbx);
 + dev_add_bb_dev(x, bbx);
 + }
  
 - header = read_image_head(bbx);
 + header = read_image_head(bbx);
   if (header == NULL)
   return NULL;
  
 @@ -79,7 +83,7 @@ static void *omap_xload_boot_nand(int offset, int part_size)
  
   to = xmalloc(size);
  
 - cdev = cdev_open(bbx, O_RDONLY);
 + cdev = cdev_open(bbx, O_RDONLY);
   if (!cdev) {
   printf(failed to open nand\n);
   return NULL;
 @@ -134,11 +138,15 @@ static void *omap_xload_boot_spi(int offset, int 
 part_size)
   int size;
   void *to, *header;
   struct cdev *cdev;
 + onst char *x = m25p0.barebox;

typo: const

  
 - devfs_add_partition(m25p0, offset, part_size,
 - DEVFS_PARTITION_FIXED, x);
 + if (!cdev_by_name(x)) { /* currently not all support dts */
 + x = x;
 + devfs_add_partition(m25p0, offset, part_size,
 + DEVFS_PARTITION_FIXED, x);
 + }
  
 - header = read_image_head(x);
 + header = read_image_head(x);
   if (header == NULL)
   return NULL;
  
 @@ -150,7 +158,7 @@ static void *omap_xload_boot_spi(int offset, int 
 part_size)
  
   to = xmalloc(size);
  
 - cdev = cdev_open(x, O_RDONLY);
 + cdev = cdev_open(x, O_RDONLY);
   if (!cdev) {
   printf(failed to open spi flash\n);
   return NULL;




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] common: fix macro WARN

2014-05-12 Thread Christoph Fritz

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 include/common.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/common.h b/include/common.h
index bfd3ce8..e7ab5fe 100644
--- a/include/common.h
+++ b/include/common.h
@@ -72,10 +72,11 @@
 #ifndef WARN
 #define WARN(condition, format...) ({  \
int __ret_warn_on = !!(condition);  \
-   if (unlikely(__ret_warn_on))\
+   if (unlikely(__ret_warn_on)) {  \
__WARN();   \
puts(WARNING: );  \
printf(format); \
+   }   \
unlikely(__ret_warn_on);\
 })
 #endif
-- 
1.7.10.4



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] net cpsw: check phy status on send and receive

2014-05-05 Thread Christoph Fritz
On Mon, 2014-05-05 at 09:22 +0200, Sascha Hauer wrote:
 On Wed, Apr 30, 2014 at 10:32:03AM +0200, chf.fr...@googlemail.com wrote:
  From: Christoph Fritz chf.fr...@googlemail.com
  
  This patch adds phy status checks on cpsw_send() and cpsw_recv().
  This is derived from upstream.
 
 What's the motivation for this? We already call phy_update_status every
 5 seconds which then calls phy_device-adjust_link. Isn't this enough?

I have no test to proof necessity. I'm fine dropping this patch.

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: New driver crashes with unable to handle paging request

2014-05-01 Thread Christoph Fritz
Hi Rolf,

 I have ported musb (host-support) from u-boot to barebox. I'll send a
patchset in the next days.


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[BUG] Fail to build: cp: target `defaultenv/barebox_default_env.genenv.tmp' is not a directory

2014-04-28 Thread Christoph Fritz
Hi,

 while building current Barebox, with out-of-tree make parameter O=,
there is an error which leads to lack of environment in final image. The
build process itself falsely doesn't get interrupted.


make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- 
O=../o_beagle omap3530_beagle_defconfig
make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- 
O=../o_beagle

  CC  drivers/of/mem_generic.o
  ENV defaultenv/barebox_default_env
  CC  drivers/of/partition.o
cp: target `defaultenv/barebox_default_env.genenv.tmp' is not a directory
  ENV defaultenv/defaultenv-2-base.bbenv
  CC  commands/automount.o
cp: target `defaultenv/defaultenv-2-base.bbenv.genenv.tmp' is not a directory
  CC  commands/global.o


in contrast to:

make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf- 
omap3530_beagle_defconfig
make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-cortexa8-linux-gnueabihf-

  AS  arch/arm/lib/memcpy.o
  LD  arch/arm/mach-omap/built-in.o
  ENV defaultenv/defaultenv-2-base.bbenv
  PBLLD   arch/arm/mach-omap/built-in-pbl.o
  CC  drivers/usb/core/usb.o
  ENVHdefaultenv/barebox_default_env.h


I haven't done bisecting, but barebox-2013.07 is fine.

Any ideas?

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] genenv: fix tempdir creation when target is a relative path

2014-04-28 Thread Christoph Fritz
On Mon, 2014-04-28 at 13:00 +0200, Sascha Hauer wrote:

 I can confirm this. Could you try the attached patch?

Yeah, it fixes the Bug. If you want you can add my

 Tested-by: Christoph Fritz chf.fr...@googlemail.com

Thanks
 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v3] omap4-fb: add driver

2013-06-12 Thread Christoph Fritz
This patch adds omap4 display controller support.

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
changes since v2:
- use dev_request_mem_region_by_name()
---
 arch/arm/mach-omap/Makefile|1 +
 arch/arm/mach-omap/include/mach/omap4-fb.h |   46 +++
 arch/arm/mach-omap/omap4_fb.c  |   27 ++
 drivers/video/Kconfig  |8 +
 drivers/video/Makefile |1 +
 drivers/video/omap4.c  |  507 
 drivers/video/omap4.h  |  408 ++
 7 files changed, 998 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/omap4-fb.h
 create mode 100644 arch/arm/mach-omap/omap4_fb.c
 create mode 100644 drivers/video/omap4.c
 create mode 100644 drivers/video/omap4.h

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 94e42c6..e70ddbd 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 pbl-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
 obj-$(CONFIG_SHELL_NONE) += xload.o
+obj-$(CONFIG_DRIVER_VIDEO_OMAP4) += omap4_fb.o
 obj-$(CONFIG_I2C_TWL6030) += omap4_twl6030_mmc.o
 obj-$(CONFIG_OMAP4_USBBOOT) += omap4_rom_usb.o
 obj-y += gpio.o
diff --git a/arch/arm/mach-omap/include/mach/omap4-fb.h 
b/arch/arm/mach-omap/include/mach/omap4-fb.h
new file mode 100644
index 000..5c0a54b
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/omap4-fb.h
@@ -0,0 +1,46 @@
+#ifndef H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H
+#define H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H
+
+#include fb.h
+
+#define OMAP_DSS_LCD_TFT   (1u  0)
+#define OMAP_DSS_LCD_IVS   (1u  1)
+#define OMAP_DSS_LCD_IHS   (1u  2)
+#define OMAP_DSS_LCD_IPC   (1u  3)
+#define OMAP_DSS_LCD_IEO   (1u  4)
+#define OMAP_DSS_LCD_RF(1u  5)
+#define OMAP_DSS_LCD_ONOFF (1u  6)
+
+#define OMAP_DSS_LCD_DATALINES(_l) ((_l)  10)
+#define OMAP_DSS_LCD_DATALINES_msk OMAP_DSS_LCD_DATALINES(3u)
+#define OMAP_DSS_LCD_DATALINES_12  OMAP_DSS_LCD_DATALINES(0u)
+#define OMAP_DSS_LCD_DATALINES_16  OMAP_DSS_LCD_DATALINES(1u)
+#define OMAP_DSS_LCD_DATALINES_18  OMAP_DSS_LCD_DATALINES(2u)
+#define OMAP_DSS_LCD_DATALINES_24  OMAP_DSS_LCD_DATALINES(3u)
+
+struct omap4fb_display {
+   struct fb_videomode mode;
+
+   unsigned long config;
+
+   unsigned int power_on_delay;
+   unsigned int power_off_delay;
+};
+
+struct omap4fb_platform_data {
+   struct omap4fb_display const *displays;
+   size_t num_displays;
+
+   unsigned int dss_clk_hz;
+
+   unsigned int bpp;
+
+   struct resource const *screen;
+
+   void (*enable)(int p);
+};
+
+struct device_d;
+struct device_d *omap4_add_display(void *pdata);
+
+#endif /* H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H */
diff --git a/arch/arm/mach-omap/omap4_fb.c b/arch/arm/mach-omap/omap4_fb.c
new file mode 100644
index 000..09a6af3
--- /dev/null
+++ b/arch/arm/mach-omap/omap4_fb.c
@@ -0,0 +1,27 @@
+#include driver.h
+#include common.h
+#include linux/ioport.h
+#include mach/omap4-fb.h
+
+static struct resource omap4_fb_resources[] = {
+   {
+   .name   = omap4_dss,
+   .start  = 0x4804,
+   .end= 0x4804 + 512 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   }, {
+   .name   = omap4_dispc,
+   .start  = 0x48041000,
+   .end= 0x48041000 + 3072 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   },
+};
+
+struct device_d *omap4_add_display(void *pdata)
+{
+   return add_generic_device_res(omap4_fb, -1,
+ omap4_fb_resources,
+ ARRAY_SIZE(omap4_fb_resources),
+ pdata);
+}
+EXPORT_SYMBOL(omap4_add_display);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6d6b08f..9dfa0cd 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -45,6 +45,14 @@ config DRIVER_VIDEO_S3C24XX
help
  Add support for the S3C244x LCD controller.
 
+config DRIVER_VIDEO_OMAP4
+   bool OMAP4 framebuffer driver
+   depends on ARCH_OMAP4
+   help
+ Add support for the OMAP4 Display Controller.
+ DSI is unsupported, only DISPC parallel mode on LCD2
+ is supported.
+
 if DRIVER_VIDEO_S3C24XX
 
 config DRIVER_VIDEO_S3C_VERBOSE
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 7429141..83feebb 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o
 obj-$(CONFIG_DRIVER_VIDEO_S3C24XX) += s3c24xx.o
 obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o
 obj-$(CONFIG_DRIVER_VIDEO_SDL) += sdl.o
+obj-$(CONFIG_DRIVER_VIDEO_OMAP4) += omap4.o
diff --git a/drivers/video

Re: [PATCH v2] omap4-fb: add driver

2013-06-02 Thread Christoph Fritz
*ping*

On Thu, 2013-04-11 at 21:01 +0200, Christoph Fritz wrote:
 Hi Jean-Christophe
 
 On Tue, 2013-04-09 at 15:29 +0200, Jean-Christophe PLAGNIOL-VILLARD
 wrote:
  On 09:16 Tue 09 Apr , Sascha Hauer wrote:
   On Mon, Apr 08, 2013 at 09:17:15AM +0200, Jean-Christophe 
   PLAGNIOL-VILLARD wrote:
On 00:15 Mon 08 Apr , Christoph Fritz wrote:
 This patch adds omap4 display controller support.
 
 +
 +static inline void fb_write(uint32_t v, void __iomem *addr)
 +{
 + __raw_writel(v, addr);
 +}
 +
 +static inline uint32_t fb_read(void const __iomem *addr)
 +{
 + return __raw_readl(addr);
 +}
what is the dif?
   
   Maybe Christoph understands what you mean here. I don't
  those 2 inline as useless
 
 You want me to purge the inline because gcc is smart enough to use
 inlining on its own?
 
 Or are you noting that using a function here is overkill for only one
 call inside?
 
 I use functions here because it makes debugging more easy and if you
 have a weird hardware config, here you can easily adapt the read and
 write functions.
 
 +
 + fbi-regs.dss   = dev_request_mem_region(dev, 
 OMAP4_FB_RESOURCE_DSS);
 + fbi-regs.dispc = dev_request_mem_region(dev, 
 OMAP4_FB_RESOURCE_DISPC);
use named dev_request
   
   We don't have such a function.
  yes we do
  
  dev_request_mem_region_by_name
 
 Ok
 
  Thanks
   -- Christoph
 




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: Installing barebox for karo-tx53 in nand-flash

2013-05-14 Thread Christoph Fritz
On Fri, 2013-05-10 at 14:53 +0200, Eric Bénard wrote:
   My boot sources are nand-flash (thats where u-boot is at the moment)
   (and SD-card for testing).
   
   I tried to flash zbarebox.bin to nand-flash. It started but with error
   nand: NAND type unknown, ec,f1
   nand: No NAND device found (-19)!
  
  Hm, strange. This should be a Samsung 128MiB NAND flash. The id is in
  the database. I currently have no good idea why this isa unknown.
  
 may you please try with his patch :
 http://lists.infradead.org/pipermail/barebox/2013-May/014470.html
 and tell if that solves this NAND flash issue.

Successfully tested your patch on an omap3-board: NAND detection works
again. Without the patch I get the same kind of error as above.

 It seems my tests for 4c2bdc8728016b3412523e3264651651fe752860 were
 wrong as all the board I'm using for my tests have ONFI flashes ...
 so I'll fit one with a non ONFI flash for the next time.


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2] omap4-fb: add driver

2013-04-11 Thread Christoph Fritz
Hi Jean-Christophe

On Tue, 2013-04-09 at 15:29 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:
 On 09:16 Tue 09 Apr , Sascha Hauer wrote:
  On Mon, Apr 08, 2013 at 09:17:15AM +0200, Jean-Christophe PLAGNIOL-VILLARD 
  wrote:
   On 00:15 Mon 08 Apr , Christoph Fritz wrote:
This patch adds omap4 display controller support.

+
+static inline void fb_write(uint32_t v, void __iomem *addr)
+{
+   __raw_writel(v, addr);
+}
+
+static inline uint32_t fb_read(void const __iomem *addr)
+{
+   return __raw_readl(addr);
+}
   what is the dif?
  
  Maybe Christoph understands what you mean here. I don't
 those 2 inline as useless

You want me to purge the inline because gcc is smart enough to use
inlining on its own?

Or are you noting that using a function here is overkill for only one
call inside?

I use functions here because it makes debugging more easy and if you
have a weird hardware config, here you can easily adapt the read and
write functions.

+
+   fbi-regs.dss   = dev_request_mem_region(dev, 
OMAP4_FB_RESOURCE_DSS);
+   fbi-regs.dispc = dev_request_mem_region(dev, 
OMAP4_FB_RESOURCE_DISPC);
   use named dev_request
  
  We don't have such a function.
 yes we do
 
 dev_request_mem_region_by_name

Ok

 Thanks
  -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM omap: add omap4_get_sysclk()

2013-04-04 Thread Christoph Fritz
This patch adds a function to get actual system clock.

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 arch/arm/mach-omap/include/mach/omap4-clock.h |4 
 arch/arm/mach-omap/omap4_clock.c  |   19 +++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-omap/include/mach/omap4-clock.h 
b/arch/arm/mach-omap/include/mach/omap4-clock.h
index 8f49aa3..9e53e16 100644
--- a/arch/arm/mach-omap/include/mach/omap4-clock.h
+++ b/arch/arm/mach-omap/include/mach/omap4-clock.h
@@ -4,7 +4,10 @@
 /* PRCM */
 #define CM_SYS_CLKSEL  0x4a306110
 
+#define CM_SYS_CLKSEL_12M  0x1
+#define CM_SYS_CLKSEL_16M8 0x3
 #define CM_SYS_CLKSEL_19M2 0x4
+#define CM_SYS_CLKSEL_26M  0x5
 #define CM_SYS_CLKSEL_38M4 0x7
 
 /* PRM.CKGEN module registers */
@@ -341,5 +344,6 @@ void omap4_enable_gpio1_wup_clocks(void);
 void omap4_enable_gpio_clocks(void);
 void omap4_enable_all_clocks(void);
 void omap4_do_scale_tps62361(u32 reg, u32 volt_mv);
+int omap4_get_sysclk(void);
 
 #endif /* __MACH_OMAP4_CLOCK_H */
diff --git a/arch/arm/mach-omap/omap4_clock.c b/arch/arm/mach-omap/omap4_clock.c
index 889d1f9..37af756 100644
--- a/arch/arm/mach-omap/omap4_clock.c
+++ b/arch/arm/mach-omap/omap4_clock.c
@@ -413,3 +413,22 @@ void omap4_do_scale_tps62361(u32 reg, u32 volt_mv)
OMAP44XX_PRM_VC_VAL_BYPASS, LDELAY))
debug(Scaling voltage failed for vdd_mpu from TPS\n);
 }
+
+int omap4_get_sysclk(void)
+{
+   int omap4_cm_sys_clks[] = {
+   -1,
+   1200, /* CM_SYS_CLKSEL_12M */
+   -1,
+   1680, /* CM_SYS_CLKSEL_16M8 */
+   1920, /* CM_SYS_CLKSEL_19M2 */
+   2600, /* CM_SYS_CLKSEL_26M */
+   -1,
+   3840, /* CM_SYS_CLKSEL_38M4 */
+   };
+   int v = __raw_readl(CM_SYS_CLKSEL);
+
+   if (v = ARRAY_SIZE(omap4_cm_sys_clks))
+   return -1;
+   return omap4_cm_sys_clks[v];
+}
-- 
1.7.10.4




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] omap4-fb: add driver

2013-04-04 Thread Christoph Fritz
This patch adds omap4 display controller support.

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 arch/arm/mach-omap/Makefile|1 +
 arch/arm/mach-omap/include/mach/omap4-fb.h |   52 +++
 arch/arm/mach-omap/omap4_fb.c  |   29 ++
 drivers/video/Kconfig  |8 +
 drivers/video/Makefile |1 +
 drivers/video/omap4.c  |  525 
 drivers/video/omap4.h  |  408 +
 7 files changed, 1024 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/omap4-fb.h
 create mode 100644 arch/arm/mach-omap/omap4_fb.c
 create mode 100644 drivers/video/omap4.c
 create mode 100644 drivers/video/omap4.h

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 94e42c6..e70ddbd 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 pbl-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
 obj-$(CONFIG_SHELL_NONE) += xload.o
+obj-$(CONFIG_DRIVER_VIDEO_OMAP4) += omap4_fb.o
 obj-$(CONFIG_I2C_TWL6030) += omap4_twl6030_mmc.o
 obj-$(CONFIG_OMAP4_USBBOOT) += omap4_rom_usb.o
 obj-y += gpio.o
diff --git a/arch/arm/mach-omap/include/mach/omap4-fb.h 
b/arch/arm/mach-omap/include/mach/omap4-fb.h
new file mode 100644
index 000..bb4c8e9
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/omap4-fb.h
@@ -0,0 +1,52 @@
+#ifndef H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H
+#define H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H
+
+#include fb.h
+
+/* device resource index */
+enum {
+   OMAP4_FB_RESOURCE_DSS,
+   OMAP4_FB_RESOURCE_DISPC,
+};
+
+#define OMAP_DSS_LCD_TFT   (1u  0)
+#define OMAP_DSS_LCD_IVS   (1u  1)
+#define OMAP_DSS_LCD_IHS   (1u  2)
+#define OMAP_DSS_LCD_IPC   (1u  3)
+#define OMAP_DSS_LCD_IEO   (1u  4)
+#define OMAP_DSS_LCD_RF(1u  5)
+#define OMAP_DSS_LCD_ONOFF (1u  6)
+
+#define OMAP_DSS_LCD_DATALINES(_l) ((_l)  10)
+#define OMAP_DSS_LCD_DATALINES_msk OMAP_DSS_LCD_DATALINES(3u)
+#define OMAP_DSS_LCD_DATALINES_12  OMAP_DSS_LCD_DATALINES(0u)
+#define OMAP_DSS_LCD_DATALINES_16  OMAP_DSS_LCD_DATALINES(1u)
+#define OMAP_DSS_LCD_DATALINES_18  OMAP_DSS_LCD_DATALINES(2u)
+#define OMAP_DSS_LCD_DATALINES_24  OMAP_DSS_LCD_DATALINES(3u)
+
+struct omap4fb_display {
+   struct fb_videomode mode;
+
+   unsigned long config;
+
+   unsigned int power_on_delay;
+   unsigned int power_off_delay;
+};
+
+struct omap4fb_platform_data {
+   struct omap4fb_display const *displays;
+   size_t num_displays;
+
+   unsigned int dss_clk_hz;
+
+   unsigned int bpp;
+
+   struct resource const *screen;
+
+   void (*enable)(int p);
+};
+
+struct device_d;
+struct device_d *omap4_add_display(void *pdata);
+
+#endif /* H_BAREBOX_ARCH_ARM_MACH_OMAP_MACH_FB4_H */
diff --git a/arch/arm/mach-omap/omap4_fb.c b/arch/arm/mach-omap/omap4_fb.c
new file mode 100644
index 000..70fbab6
--- /dev/null
+++ b/arch/arm/mach-omap/omap4_fb.c
@@ -0,0 +1,29 @@
+#include driver.h
+#include common.h
+#include linux/ioport.h
+#include mach/omap4-fb.h
+
+static struct resource omap4_fb_resources[] = {
+   [OMAP4_FB_RESOURCE_DSS] = {
+   .start  = 0x4804,
+   .end= 0x4804 + 512 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   .name   = DSS,
+   },
+
+   [OMAP4_FB_RESOURCE_DISPC] = {
+   .start  = 0x48041000,
+   .end= 0x48041000 + 3072 - 1,
+   .flags  = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
+   .name   = DISPC,
+   },
+};
+
+struct device_d *omap4_add_display(void *pdata)
+{
+   return add_generic_device_res(omap4_fb, -1,
+ omap4_fb_resources,
+ ARRAY_SIZE(omap4_fb_resources),
+ pdata);
+}
+EXPORT_SYMBOL(omap4_add_display);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6d6b08f..15eaa2f 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -45,6 +45,14 @@ config DRIVER_VIDEO_S3C24XX
help
  Add support for the S3C244x LCD controller.
 
+config DRIVER_VIDEO_OMAP4
+bool OMAP4 framebuffer driver
+   depends on ARCH_OMAP4
+   help
+ Add support for the OMAP4 Display Controller.
+ DSI is unsupported, only DISPC parallel mode on LCD2
+ is supported.
+
 if DRIVER_VIDEO_S3C24XX
 
 config DRIVER_VIDEO_S3C_VERBOSE
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 7429141..83feebb 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DRIVER_VIDEO_IMX_IPU) += imx-ipu-fb.o
 obj-$(CONFIG_DRIVER_VIDEO_S3C24XX) += s3c24xx.o
 obj-$(CONFIG_DRIVER_VIDEO_PXA) += pxa.o
 obj

Re: Re[5]: Omap4 DSS clocks

2013-03-15 Thread Christoph Fritz
On Thu, 2013-03-14 at 20:29 +0400, Alexander Shiyan wrote:
  On Thu, 2013-03-14 at 14:46 +0100, Christoph Fritz wrote:
   On Thu, 2013-03-14 at 14:33 +0100, Sascha Hauer wrote:
  
I wouldn't expect a bug in the code. This would have been discovered
already.
   
   Register CM_DSS_DSS_CLKCTRL (0x4a009120) reads 0x00070F02 and so the
   field [17:16] IDLEST reads 0x3 which means Module is disabled and
   cannot be accessed. On linux, its 0x2 which means functional.

Sascha, any comments on this?
 
  I already asked about this on the TI E2E Community forum
  http://e2e.ti.com/support/omap/f/849/t/251717.aspx but without gaining
  success.
  
  Overall, isn't it weird that DSS is offline (as indicated by IDLEST)?
  
  I suppose in ./arch/arm/mach-omap/omap4_clock.c this check:
  
  /* Check for DSS Clocks */
  while ((__raw_readl(0x4A009100)  0xF00) != 0xE00)
  ;
  
  should get extended to also check for correct IDLEST ...which would
  currently end in an endless loop :)
 
 I revised commands/mem. All correct in the code, so problem is not here.

Thanks for pointing this out.

 About DSS: I cannot help you with this CPU, but here is one point from
 OMAP4430TRM:
 The main access to all DSS registers is through the L3 interconnect.
 The access through the L4_PER interconnect is provided for back software
 compatibility.

I stumbled upon these lines too but have no clue what this means for
barebox command md concrete.

 Maybe it help you.

Thanks a lot for trying
 -- Christoph






___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Omap4 DSS clocks

2013-03-14 Thread Christoph Fritz
Hi,

 Barebox crashes while reading a DSS register:

  $ md 0x4804
  unable to handle paging request at address 0x4804

I suppose this is due to a turned off clock.

Any hints?


Thanks
 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: Re[3]: Omap4 DSS clocks

2013-03-14 Thread Christoph Fritz
On Thu, 2013-03-14 at 17:11 +0400, Alexander Shiyan wrote:
   On Thu, 2013-03-14 at 16:48 +0400, Alexander Shiyan wrote:
  Barebox crashes while reading a DSS register:
 
   $ md 0x4804
   unable to handle paging request at address 0x4804
 
 I suppose this is due to a turned off clock.
 
 Any hints?

Probably this is a bug. I reproduced it.

Try to specify start  end address, like:
md -l 0x4804-0x48040010
   
   I get the same effect: it crashes.
  
  OK. It seems rw_buf not initialized.
  
  So change line:
  static char *rw_buf; 
  to
  static char *rw_buf[RW_BUF_SIZE]; 
 Without asterisk, like:
  static char rw_buf[RW_BUF_SIZE]; 

malloc expects a pointer:
commands/mem.c:634: error: incompatible types when assigning to type
‘char[4096]’ from type ‘void *’

As you can see below, for a quick test I commented the lines, but
barebox still crashes.

Why don't you suppose that this is due to the non functional DSS?

diff --git a/commands/mem.c b/commands/mem.c
index 51aa04d..af5cc46 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -40,7 +40,7 @@
 #endif
 
 #define RW_BUF_SIZE4096
-static char *rw_buf;
+static char rw_buf[RW_BUF_SIZE];
 
 static char *DEVMEM = /dev/mem;
 
@@ -631,11 +631,11 @@ static struct driver_d mem_drv = {
 
 static int mem_init(void)
 {
-   rw_buf = malloc(RW_BUF_SIZE);
-   if(!rw_buf) {
-   printf(%s: Out of memory\n, __FUNCTION__);
-   return -1;
-   }
+// rw_buf = malloc(RW_BUF_SIZE);
+// if(!rw_buf) {
+// printf(%s: Out of memory\n, __FUNCTION__);
+// return -1;
+// }
 
add_mem_device(mem, 0, ~0, IORESOURCE_MEM_WRITEABLE);
platform_driver_register(mem_drv);




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: Re[3]: Omap4 DSS clocks

2013-03-14 Thread Christoph Fritz
On Thu, 2013-03-14 at 14:33 +0100, Sascha Hauer wrote:
 On Thu, Mar 14, 2013 at 02:23:56PM +0100, Christoph Fritz wrote:
  On Thu, 2013-03-14 at 17:11 +0400, Alexander Shiyan wrote:
 On Thu, 2013-03-14 at 16:48 +0400, Alexander Shiyan wrote:
Barebox crashes while reading a DSS register:
   
 $ md 0x4804
 unable to handle paging request at address 0x4804
   
   I suppose this is due to a turned off clock.
   
   Any hints?
  
  Probably this is a bug. I reproduced it.
  
  Try to specify start  end address, like:
  md -l 0x4804-0x48040010
 
 I get the same effect: it crashes.

OK. It seems rw_buf not initialized.

So change line:
static char *rw_buf; 
to
static char *rw_buf[RW_BUF_SIZE]; 
   Without asterisk, like:
static char rw_buf[RW_BUF_SIZE]; 
  
  malloc expects a pointer:
  commands/mem.c:634: error: incompatible types when assigning to type
  ‘char[4096]’ from type ‘void *’
  
  As you can see below, for a quick test I commented the lines, but
  barebox still crashes.
  
  Why don't you suppose that this is due to the non functional DSS?
 
 I wouldn't expect a bug in the code. This would have been discovered
 already.

Register CM_DSS_DSS_CLKCTRL (0x4a009120) reads 0x00070F02 and so the
field [17:16] IDLEST reads 0x3 which means Module is disabled and
cannot be accessed. On linux, its 0x2 which means functional.

Any hints?

Thanks
 -- Christoph



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] net: add multiple nameserver support

2012-12-10 Thread Christoph Fritz
On Sun, 2012-09-23 at 15:57 +0200, Christoph Fritz wrote:
 On Sun, 2012-09-23 at 15:29 +0200, Jean-Christophe PLAGNIOL-VILLARD
 wrote:
  On 14:11 Sun 23 Sep , Christoph Fritz wrote:
   Today limit it to 2
   
   Update dhcp support as option 6 allow to get n nameserver
   If more than 2 nameserver are provided by the DHCP server ignore them.
  I rethink about it and no I do not want wo check it the format here
  
  as I plan to make the globalvar more commoon and swtich net to it too
  
 
 I'm fine when the not modified version gets applied.
 
 You can add a
 Tested-by: Christoph Fritz chf.fr...@googlemail.com

*ping*, has this patch gotten lost?



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] i.MX25 35 usb config bits : fix host power bit

2012-11-16 Thread Christoph Fritz
This patch sets HPM (Host power mask bit) to bit 16 according to i.MX
Reference Manual. Falsely it was set to bit 8, but this controls pull-up
Impedance.

Reported-by: Michael Burkey mdbur...@gmail.com
Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 arch/arm/mach-imx/include/mach/usb.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/include/mach/usb.h 
b/arch/arm/mach-imx/include/mach/usb.h
index 9244989..0a88e7f 100644
--- a/arch/arm/mach-imx/include/mach/usb.h
+++ b/arch/arm/mach-imx/include/mach/usb.h
@@ -4,7 +4,7 @@
 /* configuration bits for i.MX25 and i.MX35 */
 #define MX35_H1_SIC_SHIFT  21
 #define MX35_H1_SIC_MASK   (0x3  MX35_H1_SIC_SHIFT)
-#define MX35_H1_PM_BIT (1  8)
+#define MX35_H1_PM_BIT (1  16)
 #define MX35_H1_IPPUE_UP_BIT   (1  7)
 #define MX35_H1_IPPUE_DOWN_BIT (1  6)
 #define MX35_H1_TLL_BIT(1  5)
-- 
1.7.10.4




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: regression: ARM: pca100: Use _text rather than TEXT_BASE

2012-10-01 Thread Christoph Fritz
On Tue, Sep 11, 2012 at 09:21:00PM +0200, Christoph Fritz wrote:
 Hi Sascha,
 
 your commit 244198e ARM boards: Use _text rather than TEXT_BASE
 breaks board pca100 (phycard-i.MX27): It doesn't boot.
 
 Revering the patch fixes the problem.
 
 Any ideas?

*ping*

---
Subject: [PATCH] ARM: pca100: revert TEXT_BASE changes

This reverts commit 244198ea8bdf592799ebfd430fe9ab165284e480
its changes for pca100.
---
 arch/arm/boards/phycard-i.MX27/lowlevel_init.S |8 ++--
 arch/arm/boards/phycard-i.MX27/pca100.c|2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/phycard-i.MX27/lowlevel_init.S 
b/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
index 0907382..7b700c5 100644
--- a/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
+++ b/arch/arm/boards/phycard-i.MX27/lowlevel_init.S
@@ -115,7 +115,7 @@ board_init_lowlevel:
bhi ret
 
/* Move ourselves out of NFC SRAM */
-   ldr r1, =_text
+   ldr r1, =TEXT_BASE
 
 copy_loop:
ldmia   r0!, {r3-r9}/* copy from source address [r0]*/
@@ -125,7 +125,11 @@ copy_loop:
 
ldr pc, =1f /* Jump to SDRAM*/
 1:
-   b   nand_boot   /* Load barebox from NAND Flash  */
+   bl  nand_boot   /* Load barebox from NAND Flash  */
+
+   ldr r1, =IMX_NFC_BASE - TEXT_BASE
+   sub r10, r10, r1/* adjust return address from NFC SRAM 
*/
+   /* to SDRAM
*/
 
 #endif /* CONFIG_NAND_IMX_BOOT */
 
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c 
b/arch/arm/boards/phycard-i.MX27/pca100.c
index b77e532..3e60ccd 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -339,7 +339,7 @@ console_initcall(pca100_console_init);
 #ifdef CONFIG_NAND_IMX_BOOT
 void __bare_init nand_boot(void)
 {
-   imx_nand_load_image(_text, barebox_image_size);
+   imx_nand_load_image((void *)TEXT_BASE, barebox_image_size);
 }
 #endif
 
-- 
1.7.2.5

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] net: add multiple nameserver support

2012-09-23 Thread Christoph Fritz
Today limit it to 2

Update dhcp support as option 6 allow to get n nameserver
If more than 2 nameserver are provided by the DHCP server ignore them.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 net/dhcp.c |   24 +++-
 net/dns.c  |   19 +++
 net/net.c  |   18 +-
 3 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 768255e..91d436f 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -137,12 +137,24 @@ static void gateway_handle(struct dhcp_opt *opt, unsigned 
char *popt, int optlen
net_set_gateway(ip);
 }
 
-static void env_ip_handle(struct dhcp_opt *opt, unsigned char *popt, int 
optlen)
+static void env_ip_multiple_handle(struct dhcp_opt *opt, unsigned char *popt, 
int optlen)
 {
+   char *var_name;
IPaddr_t ip;
+   int i;
+   int max = (int)opt-data;
 
-   ip = net_read_ip(popt);
-   setenv_ip(opt-barebox_var_name, ip);
+   for (i = 0 ; optlen  0  i  max; i++) {
+   var_name = asprintf(%s%d, opt-barebox_var_name, i);
+   if (!var_name)
+   return;
+
+   ip = net_read_ip(popt);
+   setenv_ip(var_name, ip);
+   optlen -= 4;
+   popt += 4;
+   free(var_name);
+   }
 }
 
 static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int 
optlen)
@@ -210,8 +222,10 @@ struct dhcp_opt dhcp_options[] = {
.handle = gateway_handle,
}, {
.option = 6,
-   .handle = env_ip_handle,
+   .handle = env_ip_multiple_handle,
.barebox_var_name = net.nameserver,
+   /* max today supported, ignore if more */
+   .data = (void*)2,
}, {
.option = 12,
.copy_only_if_valid = 1,
diff --git a/net/dns.c b/net/dns.c
index eb96c57..5cd29a5 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -194,7 +194,7 @@ static void dns_handler(void *ctx, char *packet, unsigned 
len)
}
 }
 
-IPaddr_t resolv(char *host)
+static IPaddr_t resolv_on(char *host, const char* nameserver)
 {
IPaddr_t ip;
const char *ns;
@@ -206,10 +206,10 @@ IPaddr_t resolv(char *host)
 
dns_state = STATE_INIT;
 
-   ns = getenv(net.nameserver);
+   ns = getenv(nameserver);
if (!ns || !*ns) {
-   printk(%s: no nameserver specified in $net.nameserver\n,
-   __func__);
+   printk(%s: no nameserver specified in $%s\n,
+   __func__, nameserver);
return 0;
}
 
@@ -241,6 +241,17 @@ IPaddr_t resolv(char *host)
return dns_ip;
 }
 
+IPaddr_t resolv(char *host)
+{
+   IPaddr_t ip;
+
+   ip = resolv_on(host, net.nameserver0);
+   if (ip == 0)
+   ip = resolv_on(host, net.nameserver1);
+
+   return ip;
+}
+
 static int do_host(int argc, char *argv[])
 {
IPaddr_t ip;
diff --git a/net/net.c b/net/net.c
index 3ac098f..171e644 100644
--- a/net/net.c
+++ b/net/net.c
@@ -669,6 +669,21 @@ static struct device_d net_device = {
.id = DEVICE_ID_SINGLE,
 };
 
+static int net_set_namesrv(struct device_d *dev, struct param_d *param, const 
char *val)
+{
+   IPaddr_t ip;
+
+   if (!val)
+   return -EINVAL;
+
+   if (string_to_ip(val, ip))
+   return -EINVAL;
+
+   dev_param_set_generic(dev, param, val);
+
+   return 0;
+}
+
 static int net_init(void)
 {
int i;
@@ -677,7 +692,8 @@ static int net_init(void)
NetRxPackets[i] = net_alloc_packet();
 
register_device(net_device);
-   dev_add_param(net_device, nameserver, NULL, NULL, 0);
+   dev_add_param(net_device, nameserver0, net_set_namesrv, NULL, 0);
+   dev_add_param(net_device, nameserver1, net_set_namesrv, NULL, 0);
dev_add_param(net_device, domainname, NULL, NULL, 0);
 
return 0;
-- 
1.7.2.5



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] net: add multiple nameserver support

2012-09-23 Thread Christoph Fritz
On Sun, 2012-09-23 at 15:29 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:
 On 14:11 Sun 23 Sep , Christoph Fritz wrote:
  Today limit it to 2
  
  Update dhcp support as option 6 allow to get n nameserver
  If more than 2 nameserver are provided by the DHCP server ignore them.
 I rethink about it and no I do not want wo check it the format here
 
 as I plan to make the globalvar more commoon and swtich net to it too
 

I'm fine when the not modified version gets applied.

You can add a
Tested-by: Christoph Fritz chf.fr...@googlemail.com

 Thanks,
   -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] defaultenv-2: add nameserver IPs to kernel-parameter ip=

2012-09-22 Thread Christoph Fritz
Due to lack of testing environment this patch is untested.

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 defaultenv-2/base/bin/bootargs-ip |4 +++-
 defaultenv-2/base/bin/bootargs-ip-barebox |5 -
 defaultenv-2/base/bin/ifup|4 
 defaultenv-2/base/network/eth0|2 ++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/defaultenv-2/base/bin/bootargs-ip 
b/defaultenv-2/base/bin/bootargs-ip
index 2d4486c..53623853 100644
--- a/defaultenv-2/base/bin/bootargs-ip
+++ b/defaultenv-2/base/bin/bootargs-ip
@@ -7,5 +7,7 @@
 if [ $ip = dhcp ]; then
global.linux.bootargs.dyn.ip=ip=dhcp
 else
-   
global.linux.bootargs.dyn.ip=ip=$ipaddr:$serverip:$gateway:$netmask::eth0:
+   
global.linux.bootargs.dyn.ip=ip=$ipaddr:$serverip:$gateway:$netmask::eth0::
+   
global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver0:
+   
global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver1
 fi
diff --git a/defaultenv-2/base/bin/bootargs-ip-barebox 
b/defaultenv-2/base/bin/bootargs-ip-barebox
index 5a3b984..09f42a8 100644
--- a/defaultenv-2/base/bin/bootargs-ip-barebox
+++ b/defaultenv-2/base/bin/bootargs-ip-barebox
@@ -4,4 +4,7 @@
 
 ifup eth0
 
-global.linux.bootargs.dyn.ip=ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:
+global.linux.bootargs.dyn.ip=ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:
+global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.netmask::eth0::
+global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver0:
+global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver1
diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
index 37b986c..fe5a242 100644
--- a/defaultenv-2/base/bin/ifup
+++ b/defaultenv-2/base/bin/ifup
@@ -26,6 +26,8 @@ netmask=
 gateway=
 serverip=
 ethaddr=
+nameserver0=
+nameserver1=
 
 . $cmd
 
@@ -51,6 +53,8 @@ if [ $ip = static ]; then
${interface}.netmask=$netmask
${interface}.serverip=$serverip
${interface}.gateway=$gateway
+   ${interface}.nameserver0=$nameserver0
+   ${interface}.nameserver1=$nameserver1
ret=0
 elif [ $ip = dhcp ]; then
dhcp
diff --git a/defaultenv-2/base/network/eth0 b/defaultenv-2/base/network/eth0
index 7e731ca..2ed64ca 100644
--- a/defaultenv-2/base/network/eth0
+++ b/defaultenv-2/base/network/eth0
@@ -9,6 +9,8 @@ ipaddr=
 netmask=
 gateway=
 serverip=
+nameserver0=
+nameserver1=
 
 # MAC address if needed
 #ethaddr=xx:xx:xx:xx:xx:xx
-- 
1.7.2.5




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2][v2] net: add nameserver IPs to kernel-parameter ip=

2012-09-22 Thread Christoph Fritz
Kernel-parameter ip= is used to assign network configuration.
With linux kernel 3.7 it is also possible to set nameserver IPs.

This patch adds two new variables (nameserver0 and nameserver1) to
barebox's $net configuration.

Signed-off-by: Christoph Fritz chf.fr...@googlemail.com
---
 net/dhcp.c |2 +-
 net/dns.c  |4 ++--
 net/net.c  |   18 +-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/net/dhcp.c b/net/dhcp.c
index 768255e..118a5a6 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -211,7 +211,7 @@ struct dhcp_opt dhcp_options[] = {
}, {
.option = 6,
.handle = env_ip_handle,
-   .barebox_var_name = net.nameserver,
+   .barebox_var_name = net.nameserver0,
}, {
.option = 12,
.copy_only_if_valid = 1,
diff --git a/net/dns.c b/net/dns.c
index eb96c57..e832f97 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -206,9 +206,9 @@ IPaddr_t resolv(char *host)
 
dns_state = STATE_INIT;
 
-   ns = getenv(net.nameserver);
+   ns = getenv(net.nameserver0);
if (!ns || !*ns) {
-   printk(%s: no nameserver specified in $net.nameserver\n,
+   printk(%s: no nameserver specified in $net.nameserver0\n,
__func__);
return 0;
}
diff --git a/net/net.c b/net/net.c
index 3ac098f..171e644 100644
--- a/net/net.c
+++ b/net/net.c
@@ -669,6 +669,21 @@ static struct device_d net_device = {
.id = DEVICE_ID_SINGLE,
 };
 
+static int net_set_namesrv(struct device_d *dev, struct param_d *param, const 
char *val)
+{
+   IPaddr_t ip;
+
+   if (!val)
+   return -EINVAL;
+
+   if (string_to_ip(val, ip))
+   return -EINVAL;
+
+   dev_param_set_generic(dev, param, val);
+
+   return 0;
+}
+
 static int net_init(void)
 {
int i;
@@ -677,7 +692,8 @@ static int net_init(void)
NetRxPackets[i] = net_alloc_packet();
 
register_device(net_device);
-   dev_add_param(net_device, nameserver, NULL, NULL, 0);
+   dev_add_param(net_device, nameserver0, net_set_namesrv, NULL, 0);
+   dev_add_param(net_device, nameserver1, net_set_namesrv, NULL, 0);
dev_add_param(net_device, domainname, NULL, NULL, 0);
 
return 0;
-- 
1.7.2.5




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 2/2] defaultenv-2: add nameserver IPs to kernel-parameter ip=

2012-09-22 Thread Christoph Fritz
Hi Jean-Christophe

On Sat, Sep 22, 2012 at 01:45:39PM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 On 12:59 Sat 22 Sep , Christoph Fritz wrote:
  --- a/defaultenv-2/base/bin/bootargs-ip
  +++ b/defaultenv-2/base/bin/bootargs-ip
  @@ -7,5 +7,7 @@
   if [ $ip = dhcp ]; then
  global.linux.bootargs.dyn.ip=ip=dhcp
   else
  -   
  global.linux.bootargs.dyn.ip=ip=$ipaddr:$serverip:$gateway:$netmask::eth0:
  +   
  global.linux.bootargs.dyn.ip=ip=$ipaddr:$serverip:$gateway:$netmask::eth0::
  +   
  global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver0:
  +   
  global.linux.bootargs.dyn.ip=$global.linux.bootargs.dyn.ip$eth0.nameserver1
 keep it on one line for grepping

ok

  diff --git a/defaultenv-2/base/bin/ifup b/defaultenv-2/base/bin/ifup
  index 37b986c..fe5a242 100644
  --- a/defaultenv-2/base/bin/ifup
  +++ b/defaultenv-2/base/bin/ifup
  @@ -26,6 +26,8 @@ netmask=
   gateway=
   serverip=
   ethaddr=
  +nameserver0=
  +nameserver1=
   
   . $cmd
   
  @@ -51,6 +53,8 @@ if [ $ip = static ]; then
  ${interface}.netmask=$netmask
  ${interface}.serverip=$serverip
  ${interface}.gateway=$gateway
  +   ${interface}.nameserver0=$nameserver0
  +   ${interface}.nameserver1=$nameserver1
 
 and this is not interface specific net.nameserver
 
 and dhcp??

When kernel-parameter ip=dhcp you can't set stuff like netmask, ip,
or nameservers.

As stated in the commit message, due to current lack of a
env-2 testing environment, I'm not sure how to implement the
following snippet from env-1 in env-2:

diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
index 4e2056e..61287d5 100644
--- a/defaultenv/bin/boot
+++ b/defaultenv/bin/boot
@@ -61,7 +61,7 @@ if [ x$ip = xdhcp -o ]; then
 elif [ x$ip = xnone ]; then
bootargs=$bootargs ip=none
 else
-   bootargs=$bootargs 
ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0:
+   bootargs=$bootargs 
ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask::eth0::$net.nameserver0:$net.nameserver1
 fi
 
 
diff --git a/defaultenv/config b/defaultenv/config
index 391ba47..38fab40 100644
--- a/defaultenv/config
+++ b/defaultenv/config
@@ -18,6 +18,8 @@ global.dhcp.vendor_id=barebox
 #eth0.netmask=a.b.c.d
 #eth0.serverip=a.b.c.d
 #eth0.gateway=a.b.c.d
++#net.nameserver0=a.b.c.d
++#net.nameserver1=a.b.c.d
 
 # can be either 'tftp', 'nfs', 'nand', 'nor' or 'disk'
 kernel_loc=tftp
-- 

Thanks,
 -- Christoph

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/1] net: add multiple nameserver support

2012-09-22 Thread Christoph Fritz
On Sat, 2012-09-22 at 20:27 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:

 +
  static int do_host(int argc, char *argv[])
  {
   IPaddr_t ip;
 diff --git a/net/net.c b/net/net.c
 index 3ac098f..edadf51 100644
 --- a/net/net.c
 +++ b/net/net.c
 @@ -677,7 +677,8 @@ static int net_init(void)
   NetRxPackets[i] = net_alloc_packet();
  
   register_device(net_device);
 - dev_add_param(net_device, nameserver, NULL, NULL, 0);
 + dev_add_param(net_device, nameserver0, NULL, NULL, 0);
 + dev_add_param(net_device, nameserver1, NULL, NULL, 0);

What do you think about a function that checks if nameserver0/1 is
really an IP, like this:

+static int net_set_namesrv(struct device_d *dev, struct param_d *param, const 
char *val)
+{
+   IPaddr_t ip;
+
+   if (!val)
+   return -EINVAL;
+
+   if (string_to_ip(val, ip))
+   return -EINVAL;
+
+   dev_param_set_generic(dev, param, val);
+
+   return 0;
+}
+
 static int net_init(void)
 {
int i;
@@ -677,7 +692,8 @@ static int net_init(void)
NetRxPackets[i] = net_alloc_packet();
 
register_device(net_device);
-   dev_add_param(net_device, nameserver, NULL, NULL, 0);
+   dev_add_param(net_device, nameserver0, net_set_namesrv, NULL, 0);
+   dev_add_param(net_device, nameserver1, net_set_namesrv, NULL, 0);
dev_add_param(net_device, domainname, NULL, NULL, 0);
 
return 0;
---

It has the benefit that you get an error message (set parameter:
Invalid argument) if it's defined wrong.

Thanks,
 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


regression: ARM: pca100: Use _text rather than TEXT_BASE

2012-09-11 Thread Christoph Fritz
Hi Sascha,

your commit 244198e ARM boards: Use _text rather than TEXT_BASE
breaks board pca100 (phycard-i.MX27): It doesn't boot.

Revering the patch fixes the problem.

Any ideas?

 Thanks,
   -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC][PATCH] pcm043: usb support --not working--

2012-08-01 Thread Christoph Fritz
On Wed, 2012-08-01 at 18:56 +0200, Eric Bénard wrote: 
  The clock settings seems to be the same as for eukrea_cpuimx35. Eric:
  Does USB work for you on your board?
  
 thanks for the heads up : now it works.

great :-)

  Sascha, I currently have no working config for kernel =3.5 to check for
  clocks in debugfs.
  
  Any thoughts on this?
  
 try to copy the config in that patch I just sent ;-)

I did - without success. I suppose the external phy needs to be
configured properly.

When you type the command usb, you are getting a list of connected
devices. Can you execute command usb a second and third time with the
same result?

If yes, I think the clocks on pcm043 aren't set properly.


Thanks,
 -- Christoph


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox