Re: [PATCH] Documentation: add mips boards files

2014-06-30 Thread Sascha Hauer
On Sat, Jun 28, 2014 at 08:29:19PM +0400, Antony Pavlov wrote:
 Signed-off-by: Antony Pavlov antonynpav...@gmail.com
 ---
  Documentation/boards/mips.rst   |  9 
  Documentation/boards/mips/dlink-dir-320.rst | 44 +++
  Documentation/boards/mips/loongson_ls1b.rst | 56 
  Documentation/boards/mips/qemu-malta.rst| 19 
  Documentation/boards/mips/ritmix-rzx50.rst  | 62 ++
  Documentation/boards/mips/tplink-mr3020.rst | 67 
 +
  6 files changed, 257 insertions(+)

Applied, thanks

Sascha

 
 diff --git a/Documentation/boards/mips.rst b/Documentation/boards/mips.rst
 new file mode 100644
 index 000..4bac35f
 --- /dev/null
 +++ b/Documentation/boards/mips.rst
 @@ -0,0 +1,9 @@
 +MIPS
 +
 +
 +.. toctree::
 +  :glob:
 +  :numbered:
 +  :maxdepth: 1
 +
 +  mips/*
 diff --git a/Documentation/boards/mips/dlink-dir-320.rst 
 b/Documentation/boards/mips/dlink-dir-320.rst
 new file mode 100644
 index 000..74d11ff
 --- /dev/null
 +++ b/Documentation/boards/mips/dlink-dir-320.rst
 @@ -0,0 +1,44 @@
 +D-Link DIR-320
 +==
 +
 +The D-Link DIR-320 wireless router has
 +
 +  * BCM5354 SoC;
 +  * 32 MiB SDRAM;
 +  * 4 MiB NOR type Flash Memory;
 +  * RS232 serial interface (LV-TTL levels on board!);
 +  * 1xUSB interface;
 +  * 4 + 1 ethernet interfaces;
 +  * 802.11b/g (WiFi) interface;
 +  * JTAG interface;
 +  * 5 LEDs;
 +  * 2 buttons.
 +
 +The router uses CFE as firmware.
 +
 +Running barebox
 +---
 +
 +Barebox can be started from CFE using tftp.
 +You must setup tftp-server on host 192.168.0.1.
 +Put your barebox.bin to tftp-server directory
 +(usual /tftpboot or /srv/tftp).
 +Connect your DIR-320 to your tftp-server network via
 +one of four LAN sockets.
 +
 +Next, setup network on DIR-320 and run barebox.bin, e.g.::
 +
 +  CFE ifconfig eth0 -addr=192.168.0.99
 +  CFE boot -tftp -addr=a080 -raw 192.168.0.1:barebox.bin
 +
 +
 +Links
 +-
 +
 +  * http://www.dlink.com.au/products/?pid=768
 +  * http://wiki.openwrt.org/toh/d-link/dir-320
 +
 +CFE links:
 +
 +  * 
 http://www.broadcom.com/support/communications_processors/downloads.php#cfe
 +  * http://www.linux-mips.org/wiki/CFE
 diff --git a/Documentation/boards/mips/loongson_ls1b.rst 
 b/Documentation/boards/mips/loongson_ls1b.rst
 new file mode 100644
 index 000..a833a86
 --- /dev/null
 +++ b/Documentation/boards/mips/loongson_ls1b.rst
 @@ -0,0 +1,56 @@
 +Loongson LS1B
 +=
 +
 +The LS1B is a development board made by Loongson Technology Corp. Ltd.
 +
 +The board has
 +
 +  * Loongson LS1B SoC 250 MHz;
 +  * 64 MiB SDRAM;
 +  * 512 KiB SPI boot ROM;
 +  * 128M x 8 Bit NAND Flash Memory;
 +  * 2 x RS232 serial interfaces (DB9 connectors);
 +  * 2 x Ethernet interfaces;
 +  * 4 x USB interfaces;
 +  * microSD card slot;
 +  * LCD display (480x272);
 +  * audio controller;
 +  * beeper;
 +  * buttons;
 +  * EJTAG 10-pin connector.
 +
 +The board uses PMON2000 as bootloader.
 +
 +Running barebox
 +---
 +
 +  1. Connect to the boards's UART2;
 +
 +  2. Turn board's power on;
 +
 +  3. Wait ``Press Enter to execute loading image`` prompt and press the 
 space key.
 +
 +  4. Build barebox and upload ``zbarebox.bin`` via Ymodem to the board:
 +
 +.. code-block:: none
 +
 +PMON ymodem base=0xa020
 +
 +..
 +
 +  5. Run barebox
 +
 +.. code-block:: none
 +
 +PMON g -e 0xa020
 +
 +..
 +
 +Links
 +-
 +
 +  * http://en.wikipedia.org/wiki/Loongson
 +  * http://www.linux-mips.org/wiki/Loongson
 +  * https://github.com/loongson-gz
 +  * http://www.linux-mips.org/wiki/PMON_2000
 +  * http://www.opsycon.se/PMON2000/Main
 diff --git a/Documentation/boards/mips/qemu-malta.rst 
 b/Documentation/boards/mips/qemu-malta.rst
 new file mode 100644
 index 000..be89ae3
 --- /dev/null
 +++ b/Documentation/boards/mips/qemu-malta.rst
 @@ -0,0 +1,19 @@
 +QEMU Malta
 +==
 +
 +QEMU run string::
 +
 +  qemu-system-mips -nodefaults -M malta -m 256 \
 +  -nographic -serial stdio -monitor null \
 +  -bios barebox-flash-image
 +
 +Also you can use GXemul::
 +
 +  gxemul -Q -x -e maltabe -M 256 0xbfc0:barebox-flash-image
 +
 +Links
 +-
 +
 +  * http://www.linux-mips.org/wiki/Mips_Malta
 +  * http://www.qemu.org/
 +  * http://gxemul.sourceforge.net/
 diff --git a/Documentation/boards/mips/ritmix-rzx50.rst 
 b/Documentation/boards/mips/ritmix-rzx50.rst
 new file mode 100644
 index 000..a51fe3f
 --- /dev/null
 +++ b/Documentation/boards/mips/ritmix-rzx50.rst
 @@ -0,0 +1,62 @@
 +Ritmix RZX-50
 +=
 +
 +Ritmix RZX-50 is a portable game console for the Russian market.
 +
 +The portable game console has
 +
 +  * Ingenic JZ4755 SoC;
 +  * 64 MiB SDRAM;
 +  * 4 GiB microSDHC card / 4 GiB NAND type Flash Memory (internal boot 
 device);
 +  * RS232 serial interface (LV-TTL levels on the board!);
 +  * LCD display (480x272);
 +  * Video out interface;
 +  * 1xUSB interface;
 

Re: in sphinx docs, what is @b barebox markup supposed to do?

2014-06-30 Thread Sascha Hauer
On Sat, Jun 28, 2014 at 09:06:27AM -0400, Robert P. J. Day wrote:
 
   a number of places in the docs contain the markup @b barebox. how
 is that supposed to render? it just shows up as, verbatim, @b
 barebox (see, for example, the board page for chumbyone).

I think it's doxygen for bold text. We should just drop this.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] kconfig: Fix compiler warning

2014-06-30 Thread Uwe Kleine-König
On Thu, Jun 26, 2014 at 11:02:18AM +0200, Alexander Aring wrote:
 Hi Sascha,
 
 I get this warning about 1 month and it makes me crazy and I am unsing
 gcc (GCC) 4.9.0 20140604 (prerelease).
 
 
 Why I didn't sent any patches?
 Because you say it here it's a compiler bug and the linux world doesn't
 fix it this way. Look at [0].
 
 ... since we will still want to catch unitialised use in the future,
 should we were to changethe code. - which sounds useful.
 
 They already add a comment to this. I think otherwise they get much
 patches because this warning.
 
 When I look into the current mainline code [1]. Then this is currently
 not fixed in any way (comment or setting to NULL
There is also the macro uninitialized_var (in both kernel and barebox)
that could be used here instead of the explicit = NULL.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |

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


Re: [PATCH] Documentation/boards/: Numerous grammar/typo/rendering fixes.

2014-06-30 Thread Sascha Hauer
On Sat, Jun 28, 2014 at 09:50:19AM -0400, Robert P. J. Day wrote:
 
 Various fixes related to fonts, rendering, grammar, etc., such as:
 
 * spelling mistakes
 * hyphenation
 * capitalization for proper names
 * proper bullet list formatting
 * sentence structure
 
 and so on.
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] Documentation: Clean up sandbox.rst, use definition list.

2014-06-30 Thread Sascha Hauer
On Sat, Jun 28, 2014 at 10:13:55AM -0400, Robert P. J. Day wrote:
 
 Some minor cleanup to the sandbox.rst documentation file, mostly
 involving using a definition list for the options.
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


[PATCH] imx6: add new chip revisions

2014-06-30 Thread Christian Hemp
Add new chip revisions for the new tap-out TO1.5 (i.MX6Q/D) and TO1.2
(i.MX6DL/S)

Signed-off-by: Christian Hemp c.h...@phytec.de
---
 arch/arm/mach-imx/imx6.c  |   12 
 arch/arm/mach-imx/include/mach/revision.h |2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index e14ce90..fabc161 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -130,6 +130,18 @@ int imx6_init(void)
mx6_silicon_revision = IMX_CHIP_REV_1_2;
break;
 
+   case 0x03:
+   mx6_silicon_revision = IMX_CHIP_REV_1_3;
+   break;
+
+   case 0x04:
+   mx6_silicon_revision = IMX_CHIP_REV_1_4;
+   break;
+
+   case 0x05:
+   mx6_silicon_revision = IMX_CHIP_REV_1_5;
+   break;
+
default:
mx6_silicon_revision = IMX_CHIP_REV_UNKNOWN;
}
diff --git a/arch/arm/mach-imx/include/mach/revision.h 
b/arch/arm/mach-imx/include/mach/revision.h
index bc6f20a..908a0a1 100644
--- a/arch/arm/mach-imx/include/mach/revision.h
+++ b/arch/arm/mach-imx/include/mach/revision.h
@@ -6,6 +6,8 @@
 #define IMX_CHIP_REV_1_1   0x11
 #define IMX_CHIP_REV_1_2   0x12
 #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_2_0   0x20
 #define IMX_CHIP_REV_2_1   0x21
 #define IMX_CHIP_REV_2_2   0x22
-- 
1.7.0.4


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


Re: [PATCH] Documentation: Minor editing changes to filesystems content.

2014-06-30 Thread Sascha Hauer
On Sat, Jun 28, 2014 at 06:22:39AM -0400, Robert P. J. Day wrote:
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha

 
 ---
 
 diff --git a/Documentation/filesystems/nfs.rst 
 b/Documentation/filesystems/nfs.rst
 index b8ad4f3..f4eda5d 100644
 --- a/Documentation/filesystems/nfs.rst
 +++ b/Documentation/filesystems/nfs.rst
 @@ -5,7 +5,7 @@
  NFS Support
  ===
 
 -barebox has readonly support for NFSv3 un UDP mode.
 +barebox has readonly support for NFSv3 in UDP mode.
 
  Example::
 
 diff --git a/Documentation/filesystems/ramfs.rst 
 b/Documentation/filesystems/ramfs.rst
 index 70e7282..b7ece1a 100644
 --- a/Documentation/filesystems/ramfs.rst
 +++ b/Documentation/filesystems/ramfs.rst
 @@ -3,10 +3,10 @@
  RAM filesystem
  ==
 
 -ramfs is a simple malloc based filesystem. An instance of ramfs is
 -mounted during startup on /. The filesystem type passed to mount is
 -'ramfs'
 +ramfs is a simple malloc-based filesystem. An instance of ramfs is
 +mounted during startup on /. The filesystem type passed to ``mount``
 +is ``ramfs``.
 
 -example::
 +Example::
 
mount none ramfs /somedir
 diff --git a/Documentation/filesystems/tftp.rst 
 b/Documentation/filesystems/tftp.rst
 index 273be5e..e0a1159 100644
 --- a/Documentation/filesystems/tftp.rst
 +++ b/Documentation/filesystems/tftp.rst
 @@ -8,8 +8,8 @@ TFTP support
  barebox has read/write support for the Trivial File Transfer Protocol.
 
  TFTP is not designed as a filesystem. It does not have support for listing
 -directories. This means a :ref:`command_ls` to a TFTP mounted path will show 
 an empty
 -directory. Nevertheless the files are there.
 +directories. This means a :ref:`command_ls` to a TFTP-mounted path will show 
 an empty
 +directory. Nevertheless, the files are there.
 
  Example::
 
 
 -- 
 
 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca
 
 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] imx6: add new chip revisions

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 08:12:01AM +0200, Christian Hemp wrote:
 Add new chip revisions for the new tap-out TO1.5 (i.MX6Q/D) and TO1.2
 (i.MX6DL/S)
 
 Signed-off-by: Christian Hemp c.h...@phytec.de

Applied, thanks

Sascha

 ---
  arch/arm/mach-imx/imx6.c  |   12 
  arch/arm/mach-imx/include/mach/revision.h |2 ++
  2 files changed, 14 insertions(+), 0 deletions(-)
 
 diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
 index e14ce90..fabc161 100644
 --- a/arch/arm/mach-imx/imx6.c
 +++ b/arch/arm/mach-imx/imx6.c
 @@ -130,6 +130,18 @@ int imx6_init(void)
   mx6_silicon_revision = IMX_CHIP_REV_1_2;
   break;
  
 + case 0x03:
 + mx6_silicon_revision = IMX_CHIP_REV_1_3;
 + break;
 +
 + case 0x04:
 + mx6_silicon_revision = IMX_CHIP_REV_1_4;
 + break;
 +
 + case 0x05:
 + mx6_silicon_revision = IMX_CHIP_REV_1_5;
 + break;
 +
   default:
   mx6_silicon_revision = IMX_CHIP_REV_UNKNOWN;
   }
 diff --git a/arch/arm/mach-imx/include/mach/revision.h 
 b/arch/arm/mach-imx/include/mach/revision.h
 index bc6f20a..908a0a1 100644
 --- a/arch/arm/mach-imx/include/mach/revision.h
 +++ b/arch/arm/mach-imx/include/mach/revision.h
 @@ -6,6 +6,8 @@
  #define IMX_CHIP_REV_1_1 0x11
  #define IMX_CHIP_REV_1_2 0x12
  #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_2_0 0x20
  #define IMX_CHIP_REV_2_1 0x21
  #define IMX_CHIP_REV_2_2 0x22
 -- 
 1.7.0.4
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] Fix misspellings of persistant - persistent in various places

2014-06-30 Thread Sascha Hauer
On Thu, Jun 26, 2014 at 04:25:05PM -0400, Robert P. J. Day wrote:
 
 Fix misspellings of persistent, including the renaming of a function
 to register_persistant_environment.
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH RFC 1/4] usb: add Marvell MVEBU USB support

2014-06-30 Thread Sascha Hauer
Hi Sebastian,


 + if (usb-mode == USB_DR_MODE_HOST 
 + IS_ENABLED(CONFIG_USB_MVEBU_HOST)) {
 + ret = regulator_enable(usb-vbus);
 + if (ret)
 + return ret;
 + ret = ehci_register(dev, usb-ehci);
 + if (ret)
 + regulator_disable(usb-vbus);
 + } else if (usb-mode == USB_DR_MODE_PERIPHERAL 
 +IS_ENABLED(CONFIG_USB_MVEBU_DEVICE)) {
 + ret = regulator_disable(usb-vbus);
 + if (ret)
 + return ret;
 + ret = ci_udc_register(dev, usb-base);
 + } else {
 + dev_err(dev, Unsupported USB role\n);
 + ret = -ENODEV;
 + }

This should probably be shared between i.MX and mvebu. I have a patch
somewhere which implements a device parameter to switch between host and
device mode. It could be used for both i.MX and mvebu.

Otherwise the series looks fine to me.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


doc branch now in -next

2014-06-30 Thread Sascha Hauer
The doc branch is now part of the -next branch, so please base
documentation patches on -next.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH RFC 1/4] usb: add Marvell MVEBU USB support

2014-06-30 Thread Sebastian Hesselbarth
On 06/30/2014 08:30 AM, Sascha Hauer wrote:
 +if (usb-mode == USB_DR_MODE_HOST 
 +IS_ENABLED(CONFIG_USB_MVEBU_HOST)) {
 +ret = regulator_enable(usb-vbus);
 +if (ret)
 +return ret;
 +ret = ehci_register(dev, usb-ehci);
 +if (ret)
 +regulator_disable(usb-vbus);
 +} else if (usb-mode == USB_DR_MODE_PERIPHERAL 
 +   IS_ENABLED(CONFIG_USB_MVEBU_DEVICE)) {
 +ret = regulator_disable(usb-vbus);
 +if (ret)
 +return ret;
 +ret = ci_udc_register(dev, usb-base);
 +} else {
 +dev_err(dev, Unsupported USB role\n);
 +ret = -ENODEV;
 +}
 
 This should probably be shared between i.MX and mvebu. I have a patch
 somewhere which implements a device parameter to switch between host and
 device mode. It could be used for both i.MX and mvebu.

Yes. As Jason already mentioned we probably should have a pure ChipIdea
probe() without any vendor-specific stuff.

For Marvell SoCs there is a set of registers that has to be configured
for DMA accesses, but I think we can move them into the bus driver
instead. We could have a list of compatibles and register offsets in
bus/mvebu.c that takes care of the registers on MVEBU for fooHCI IP.
I'll have to double-check if the register content is retained during
clk gating.

Having a ChipIdea probe() will also allow i.MX to reuse the same
function after it has set up the Freescale specific stuff.

 Otherwise the series looks fine to me.

Ok. BTW, I have a similar patch set for SDHCI that I'll send as RFC
in a day or two.

Sebastian



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


[PATCH] regulator: fixed: add always-on property

2014-06-30 Thread Steffen Trumtrar
Support the regulator-always-on property for fixed regulators.
The regulator gets enabled on probe and subsequent disable calls are
ignored.

Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
---
 drivers/regulator/fixed.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 7e64919..2515d3e 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -27,6 +27,7 @@
 struct regulator_fixed {
int gpio;
int active_low;
+   int always_on;
struct regulator_dev rdev;
 };
 
@@ -44,6 +45,9 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
 {
struct regulator_fixed *fix = container_of(rdev, struct 
regulator_fixed, rdev);
 
+   if (fix-always_on)
+   return 0;
+
if (!gpio_is_valid(fix-gpio))
return 0;
 
@@ -79,6 +83,11 @@ static int regulator_fixed_probe(struct device_d *dev)
 
fix-rdev.ops = fixed_ops;
 
+   if (of_find_property(dev-device_node, regulator-always-on, NULL)) {
+   fix-always_on = 1;
+   regulator_fixed_enable(fix-rdev);
+   }
+
ret = of_regulator_register(fix-rdev, dev-device_node);
if (ret)
return ret;
-- 
2.0.0


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


[PATCH] usb: chipidea: imx: add vbus regulator support

2014-06-30 Thread Steffen Trumtrar
The chipidea binding describes the optional property of a regulator
for vbus named vbus-supply.

Add support for this property to the driver so it can be used on boards
with a gpio-controlled regulator.

Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
---
 drivers/usb/imx/chipidea-imx.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 9b6829b..84522dc 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -18,6 +18,7 @@
 #include of.h
 #include errno.h
 #include driver.h
+#include regulator.h
 #include usb/usb.h
 #include usb/ehci.h
 #include usb/chipidea-imx.h
@@ -32,6 +33,7 @@ struct imx_chipidea {
struct ehci_data data;
unsigned long flags;
enum imx_usb_mode mode;
+   struct regulator *reg_vbus;
int portno;
enum usb_phy_interface phymode;
 };
@@ -41,6 +43,12 @@ static int imx_chipidea_port_init(void *drvdata)
struct imx_chipidea *ci = drvdata;
int ret;
 
+   if (ci-reg_vbus) {
+   ret = regulator_enable(ci-reg_vbus);
+   if (ret  0)
+   return ret;
+   }
+
if ((ci-flags  MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
dev_dbg(ci-dev, using ULPI phy\n);
if (IS_ENABLED(CONFIG_USB_ULPI)) {
@@ -54,8 +62,11 @@ static int imx_chipidea_port_init(void *drvdata)
ret = -ENODEV;
}
 
-   if (ret)
+   if (ret) {
+   if (ci-reg_vbus)
+   regulator_disable(ci-reg_vbus);
return ret;
+   }
}
 
ret = imx_usbmisc_port_init(ci-portno, ci-flags);
@@ -126,6 +137,8 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
disable-over-current, NULL))
ci-flags |= MXC_EHCI_DISABLE_OVERCURRENT;
 
+   ci-reg_vbus = regulator_get(ci-dev, vbus);
+
return 0;
 }
 
-- 
2.0.0


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


Re: [PATCH] usb: chipidea: imx: add vbus regulator support

2014-06-30 Thread Sebastian Hesselbarth
On 06/30/2014 09:52 AM, Steffen Trumtrar wrote:
 The chipidea binding describes the optional property of a regulator
 for vbus named vbus-supply.
 
 Add support for this property to the driver so it can be used on boards
 with a gpio-controlled regulator.
 
 Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
 ---
  drivers/usb/imx/chipidea-imx.c | 15 ++-
  1 file changed, 14 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
 index 9b6829b..84522dc 100644
 --- a/drivers/usb/imx/chipidea-imx.c
 +++ b/drivers/usb/imx/chipidea-imx.c
 @@ -18,6 +18,7 @@
  #include of.h
  #include errno.h
  #include driver.h
 +#include regulator.h
  #include usb/usb.h
  #include usb/ehci.h
  #include usb/chipidea-imx.h
 @@ -32,6 +33,7 @@ struct imx_chipidea {
   struct ehci_data data;
   unsigned long flags;
   enum imx_usb_mode mode;
 + struct regulator *reg_vbus;
   int portno;
   enum usb_phy_interface phymode;
  };
 @@ -41,6 +43,12 @@ static int imx_chipidea_port_init(void *drvdata)
   struct imx_chipidea *ci = drvdata;
   int ret;
  
 + if (ci-reg_vbus) {
 + ret = regulator_enable(ci-reg_vbus);
 + if (ret  0)
 + return ret;
 + }

Isn't barebox's regulator support using the dummy regulator, too?
A NULL regulator is interpreted as dummy regulator and can be used
with regulator API without checking each time.

   if ((ci-flags  MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
   dev_dbg(ci-dev, using ULPI phy\n);
   if (IS_ENABLED(CONFIG_USB_ULPI)) {
 @@ -54,8 +62,11 @@ static int imx_chipidea_port_init(void *drvdata)
   ret = -ENODEV;
   }
  
 - if (ret)
 + if (ret) {
 + if (ci-reg_vbus)
 + regulator_disable(ci-reg_vbus);
   return ret;
 + }
   }
  
   ret = imx_usbmisc_port_init(ci-portno, ci-flags);
 @@ -126,6 +137,8 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
   disable-over-current, NULL))
   ci-flags |= MXC_EHCI_DISABLE_OVERCURRENT;
  
 + ci-reg_vbus = regulator_get(ci-dev, vbus);
 +

Here, you should check for IS_ERR(ci-reg_vbus) and bail out if there is
an error. No property found should return NULL and therefore the dummy
regulator.

Sebastian

   return 0;
  }
  
 


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


Re: in sphinx docs, what is @b barebox markup supposed to do?

2014-06-30 Thread Holger Schurig
I found a Sphinx cheat sheet:
http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html
(where you have all the important things on just one page).

So you can convert This is @b foo bar to This is **foo** bar.

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


Re: in sphinx docs, what is @b barebox markup supposed to do?

2014-06-30 Thread Robert P. J. Day
On Mon, 30 Jun 2014, Holger Schurig wrote:

 I found a Sphinx cheat sheet:
 http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html
 (where you have all the important things on just one page).

 So you can convert This is @b foo bar to This is **foo** bar.

  except the standard *seems* to be to not mark up the name barebox
at all, so it would seem more appropriate to just remove the doxygen
markup for the word barebox entirely.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: [RFC v3 1/5] PCI: initial commit

2014-06-30 Thread Lucas Stach
Hi Antony,

nice to see a new revision of this PCI stuff. I've used v2 as a base for
my Tegra PCI hacking during our Techweek.

This revision looks really good and I think it removes most of the
issues I've stumbled across. Some comments below.

Regards,
Lucas

Am Donnerstag, den 26.06.2014, 02:32 +0400 schrieb Antony Pavlov:
 used shorten version of linux-2.6.39 pci_ids.h
 
 Signed-off-by: Antony Pavlov antonynpav...@gmail.com
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 ---
  drivers/Makefile|   1 +
  drivers/pci/Kconfig |  12 ++
  drivers/pci/Makefile|   8 ++
  drivers/pci/bus.c   | 110 
  drivers/pci/pci.c   | 282 
 
  include/linux/mod_devicetable.h |  20 +++
  include/linux/pci.h | 241 ++
  include/linux/pci_ids.h | 136 +++
  include/linux/pci_regs.h| 118 +
  9 files changed, 928 insertions(+)
  create mode 100644 drivers/pci/Kconfig
  create mode 100644 drivers/pci/Makefile
  create mode 100644 drivers/pci/bus.c
  create mode 100644 drivers/pci/pci.c
  create mode 100644 include/linux/mod_devicetable.h
  create mode 100644 include/linux/pci.h
  create mode 100644 include/linux/pci_ids.h
  create mode 100644 include/linux/pci_regs.h
 
 diff --git a/drivers/Makefile b/drivers/Makefile
 index ef3604f..1990e86 100644
 --- a/drivers/Makefile
 +++ b/drivers/Makefile
 @@ -26,3 +26,4 @@ obj-y += pinctrl/
  obj-y += bus/
  obj-$(CONFIG_REGULATOR) += regulator/
  obj-$(CONFIG_RESET_CONTROLLER) += reset/
 +obj-$(CONFIG_PCI) += pci/

Can we please move the Kconfig options for this into drivers/Kconfig? I
know you did it similar to the kernel, but it just does not feel right
to have those into the board/arch Kconfig. PCI is just another bus like
USB and the symbol HW_HAS_PCI should be enough to decide if we show this
options or not.

 diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
 new file mode 100644
 index 000..88b8dfb
 --- /dev/null
 +++ b/drivers/pci/Kconfig
 @@ -0,0 +1,12 @@
 +#
 +# PCI configuration
 +#
 +config PCI_DEBUG
 + bool PCI Debugging
 + depends on PCI
 + help
 +   Say Y here if you want the PCI core to produce a bunch of debug
 +   messages to the system log.  Select this if you are having a
 +   problem with PCI support and want to see more of what is going on.
 +
 +   When in doubt, say N.
 diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
 new file mode 100644
 index 000..c7d43c3
 --- /dev/null
 +++ b/drivers/pci/Makefile
 @@ -0,0 +1,8 @@
 +#
 +# Makefile for the PCI bus specific drivers.
 +#
 +obj-y+= pci.o bus.o
 +
 +ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
 +
 +CPPFLAGS += $(ccflags-y)

[...]

 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
 new file mode 100644
 index 000..9bee73f
 --- /dev/null
 +++ b/drivers/pci/pci.c
 @@ -0,0 +1,282 @@
 +#include common.h
 +#include linux/pci.h
 +
 +#ifdef DEBUG
 +#define DBG(x...) printk(x)
 +#else
 +#define DBG(x...)
 +#endif
 +
 +static struct pci_controller *hose_head, **hose_tail = hose_head;
 +
 +struct pci_bus *pci_root;
 +

This should really be a list, like it is in the kernel now. With the
introduction of PCI host controller drivers we have the situation where
a system may have more than one PCI root bus.

 +static struct pci_bus *pci_alloc_bus(void)
 +{
 + struct pci_bus *b;
 +
 + b = kzalloc(sizeof(*b), GFP_KERNEL);
 + if (b) {
 + INIT_LIST_HEAD(b-node);
 + INIT_LIST_HEAD(b-children);
 + INIT_LIST_HEAD(b-devices);
 + INIT_LIST_HEAD(b-slots);
 + INIT_LIST_HEAD(b-resources);
 + }
 + return b;
 +}
 +
 +void register_pci_controller(struct pci_controller *hose)
 +{
 + struct pci_bus *bus;
 +
 + *hose_tail = hose;
 + hose_tail = hose-next;
 +
 + bus = pci_alloc_bus();
 + hose-bus = bus;
 + bus-ops = hose-pci_ops;
 + bus-resource[0] = hose-mem_resource;
 + bus-resource[1] = hose-io_resource;
 +
 + pci_scan_bus(bus);
 +
 + pci_root = bus;
 +
 + return;
 +}
 +
[...]

-- 
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


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


Re: [RFC v3 2/5] commands: add 'lspci' command

2014-06-30 Thread Lucas Stach
Am Donnerstag, den 26.06.2014, 02:32 +0400 schrieb Antony Pavlov:
 Signed-off-by: Antony Pavlov antonynpav...@gmail.com
 ---
  commands/Kconfig  |  8 
  commands/Makefile |  1 +
  commands/lspci.c  | 49 +
  3 files changed, 58 insertions(+)
  create mode 100644 commands/lspci.c
 

[...]

 diff --git a/commands/lspci.c b/commands/lspci.c
 new file mode 100644
 index 000..5e1f6dd
 --- /dev/null
 +++ b/commands/lspci.c
 @@ -0,0 +1,49 @@
 +/*
 + * Copyright (C) 2011-2014 Antony Pavlov antonynpav...@gmail.com
 + *
 + * This file is part of barebox.
 + * 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.
 + *
 + */
 +
 +#include common.h
 +#include command.h
 +#include complete.h
 +#include linux/pci.h
 +
 +static int do_lspci(int argc, char *argv[])
 +{
 + struct pci_dev *dev;
 +
 + if (!pci_root) {
 + printf(no pci!\n);

Please rephrase this to something like No PCI root busses found.

 + return 1;
 + }
 +
 + list_for_each_entry(dev, pci_root-devices, bus_list) {
 + printf(%02x: %04x: %04x:%04x (rev %02x)\n,
 +   dev-devfn,
 +   (dev-class  8)  0x,
 +   dev-vendor,
 +   dev-device,
 +   dev-revision);
 + }
 +
 + return 0;
 +}
 +
 +BAREBOX_CMD_START(lspci)
 + .cmd= do_lspci,
 + BAREBOX_CMD_DESC(Show PCI info)
 + BAREBOX_CMD_GROUP(CMD_GRP_INFO)
 + BAREBOX_CMD_COMPLETE(empty_complete)
 +BAREBOX_CMD_END

-- 
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


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


[PATCH] boot: show all boot sources

2014-06-30 Thread Rolf Evers-Fischer
This patch fixes the presentation of all bootsources with 'boot -m' and
'boot -l' command.

Signed-off-by: Rolf Evers-Fischer embedde...@evers-fischer.de
---
 commands/boot.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/boot.c b/commands/boot.c
index c8eae10..1a1856d 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -433,12 +433,12 @@ static int do_boot(int argc, char *argv[])
        }

        if (do_list) {
-               bootsources_list(sources, num_sources);
+               bootsources_list(argv[optind], argc - optind);
                goto out;
        }

        if (do_menu) {
-               bootsources_menu(sources, num_sources);
+               bootsources_menu(argv[optind], argc - optind);
                goto out;
        }

--
1.7.4.4

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


[PATCH] boot: fix typo

2014-06-30 Thread Rolf Evers-Fischer
Signed-off-by: Rolf Evers-Fischer rolf.evers.fisc...@delphi.com
---
 commands/boot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/commands/boot.c b/commands/boot.c
index a23ffb1..c8eae10 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -151,7 +151,7 @@ static int bootscript_scan_path(struct blspec *blspec, const
char *path)
        glob(files, 0, NULL, globb);

        for (i = 0; i  globb.gl_pathc; i++) {
-               char *bootscript_path = globb.gl_pathv[i];;
+               char *bootscript_path = globb.gl_pathv[i];

                if (*basename(bootscript_path) == '.')
                        continue;
--
1.7.4.4

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


[PATCH] Documentation: device tree bindings.

2014-06-30 Thread Robert P. J. Day

Adjusted Sphinx markup for devicetree bindings pages.

Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

---

  not completely confident in my markup here so i'm open to
suggestions.

diff --git a/Documentation/devicetree/bindings/barebox/barebox,environment.rst 
b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
index d243484..d472f66 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,environment.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
@@ -4,18 +4,19 @@ barebox environment
 This driver provides an environment for barebox from the devicetree.

 Required properties:
-- compatible: should be barebox,environment
-- device-path: path to the environment
+
+* ``compatible``: should be ``barebox,environment``
+* ``device-path``: path to the environment

 The device-path is a multistring property. The first string should be a
 nodepath to the node containing the physical device of the environment.
 The subsequent strings are of the form type:options to further describe
 the path to the environment. Supported values for type:

-partname:partname  This describes a partition on a device. partname can
- be the label for mtd partitions, the number for DOS
-partitions (beginning with 0) or the name for GPT
-partitions
+``partname``:partname
+  This describes a partition on a device. partname can
+  be the label for MTD partitions, the number for DOS
+  partitions (beginning with 0) or the name for GPT partitions.

 Example::

diff --git a/Documentation/devicetree/bindings/leds/common.rst 
b/Documentation/devicetree/bindings/leds/common.rst
index 63a45bd..c1fd1ab 100644
--- a/Documentation/devicetree/bindings/leds/common.rst
+++ b/Documentation/devicetree/bindings/leds/common.rst
@@ -1,9 +1,10 @@
 Common leds properties
 ==

-- linux,default-trigger barebox,default-trigger:  This parameter, if present, 
is a
+* ``linux,default-trigger``, ``barebox,default-trigger``:  This parameter, if 
present, is a
 string defining the trigger assigned to the LED.  Current triggers are:
- heartbeat - LED flashes at a constant rate
- panic - LED turns on when barebox panics
- net - LED indicates network activity
+
+* ``heartbeat`` - LED flashes at a constant rate
+* ``panic`` - LED turns on when barebox panics
+* ``net`` - LED indicates network activity

diff --git a/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst 
b/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
index a067579..b9d5bcb 100644
--- a/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
+++ b/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
@@ -3,14 +3,14 @@ Freescale i.MX IIM (Ic Identification Module)

 Required properties:

-- compatible: fsl,imx27-iim
-- reg: physical register base and size
+* ``compatible``: ``fsl,imx27-iim``, ``fsl,imx51-iim``
+* ``reg``: physical register base and size

 Optional properties:

-- barebox,provide-mac-address: Provide MAC addresses for ethernet devices. This
-  can be multiple entries in the form phandle bankno fuseofs to specify a 
MAC
-  address to a ethernet device.
+* ``barebox,provide-mac-address``: Provide MAC addresses for Ethernet devices. 
This
+  can be multiple entries in the form phandle bankno fuseofs to assign a MAC
+  address to an Ethernet device.

 Example::

diff --git a/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst 
b/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
index 472b9e2..403863e 100644
--- a/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
+++ b/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
@@ -3,14 +3,14 @@ Freescale i.MX OCOTP (On-Chip OTP)

 Required properties:

-- compatible: fsl,imx6q-ocotp
-- reg: physical register base and size
+* ``compatible``: ``fsl,imx6q-ocotp``
+* ``reg``: physical register base and size

 Optional properties:

-- barebox,provide-mac-address: Provide MAC addresses for ethernet devices. This
-  can be multiple entries in the form phandle regofs to specify a MAC
-  address to a ethernet device.
+* ``barebox,provide-mac-address``: Provide MAC addresses for Ethernet devices. 
This
+  can be multiple entries in the form phandle regofs to assign a MAC
+  address to an Ethernet device.

 Example::


-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


[PATCH] Documentation: Fix glossary entry, FTD - FDT

2014-06-30 Thread Robert P. J. Day

Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

---

diff --git a/Documentation/glossary.rst b/Documentation/glossary.rst
index a702859..8bad7dc 100644
--- a/Documentation/glossary.rst
+++ b/Documentation/glossary.rst
@@ -5,7 +5,7 @@ Glossary

 .. glossary:: :sorted:

-   FTD
+   FDT
   Flattened Device Tree

DTB

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


[PATCH] sdma.h: Typo, interupt - interrupt

2014-06-30 Thread Robert P. J. Day

Fix only two interupt misspellings in entire barebox codebase.

Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

---

diff --git a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h 
b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
index 5e7ff5f..6a25d79 100644
--- a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
+++ b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
@@ -82,11 +82,11 @@ ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
 sdma-IntPend = (1  tasknum);\
 }

-/* get interupt pending bit of a task */
+/* get interrupt pending bit of a task */
 #define SDMA_GET_PENDINGBIT(tasknum)   \
((*(vu_long *)(MPC5XXX_SDMA + 0x14))  (1(tasknum)))

-/* get interupt mask bit of a task */
+/* get interrupt mask bit of a task */
 #define SDMA_GET_MASKBIT(tasknum)  \
((*(vu_long *)(MPC5XXX_SDMA + 0x18))  (1(tasknum)))


-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: in sphinx docs, what is @b barebox markup supposed to do?

2014-06-30 Thread Robert P. J. Day
On Mon, 30 Jun 2014, Holger Schurig wrote:

 I found a Sphinx cheat sheet:
 http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html
 (where you have all the important things on just one page).

 So you can convert This is @b foo bar to This is **foo** bar.

  hm ... a handy page but i'm puzzled by one of the first things
listed there; that is, that double backquotes are used to make a text
verbatim. it also appears to render it in courier, which is what i
use to represent things like commands, filenames, etc.

  other than that, that's a nice cheat sheet, thanks.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: in sphinx docs, what is @b barebox markup supposed to do?

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 05:56:37AM -0400, Robert P. J. Day wrote:
 On Mon, 30 Jun 2014, Holger Schurig wrote:
 
  I found a Sphinx cheat sheet:
  http://openalea.gforge.inria.fr/doc/openalea/doc/_build/html/source/sphinx/rest_syntax.html
  (where you have all the important things on just one page).
 
  So you can convert This is @b foo bar to This is **foo** bar.
 
   except the standard *seems* to be to not mark up the name barebox
 at all, so it would seem more appropriate to just remove the doxygen
 markup for the word barebox entirely.

Yes.

IMO it doesn't help the reader if every occurrence of the word
**barebox** in a **barebox** manual is in bold letters just because we
like **barebox** so much.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


[PATCH] Makefile: Add missing closing quote for make help

2014-06-30 Thread Robert P. J. Day

Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

---

  definitely prevents make help frum running.

diff --git a/Makefile b/Makefile
index 6dad637..a8e57ee 100644
--- a/Makefile
+++ b/Makefile
@@ -1076,7 +1076,7 @@ help:
@echo  'enough build support to build external 
modules'
@echo  '  mrproper- Remove all generated files + config + 
various backup files'
@echo  '  distclean   - mrproper + remove editor backup and patch 
files'
-   @echo  '  docs- build documentation
+   @echo  '  docs- build documentation'
@echo  ''
@echo  'Configuration targets:'
@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: AM335x NAND

2014-06-30 Thread Jan Lübbe
On Thu, 2014-06-26 at 22:58 +0200, Stefan Müller-Klieser wrote:
 So, should I port the features from the u-boot driver into barebox,
 e.g. ELM and HW BCH16 support, or are there different plans from the
 maintainer?

I've seen that the Phytec AM335x BSPs contain patches which add support
for the ELM. This wasn't mainlined, but might a good starting point.

Regards,
Jan
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


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


[PATCH] Documentation: User manual, barebox section

2014-06-30 Thread Robert P. J. Day

Various grammar/font fixes to that section, including adding an
additional section describing how to properly do out of tree
configuration and building.

Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

---

diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 70bdedc..6a679c0 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -13,8 +13,8 @@ All releases can be downloaded from:

 http://www.barebox.org/download/

-Development versions of barebox are accessible via git. A local repository 
clone
-can be created using git::
+Development versions of barebox are accessible via Git. A local repository 
clone
+can be checked out as follows::

   $ git clone git://git.pengutronix.de/git/barebox.git
   Cloning into 'barebox'...
@@ -26,8 +26,9 @@ can be created using git::
   Checking connectivity... done.
   Checking out files: 100% (5651/5651), done.

-After this, make sure to check out needed branch. If you want to
-develop for barebox, it's better to check the the next branch::
+After this, make sure to check out the appropriate branch. If you want to
+develop for barebox, it's best to check out the ``next`` branch rather than
+the ``master`` branch::

   $ git checkout -b next origin/remotes/next

@@ -39,11 +40,11 @@ http://git.pengutronix.de/?p=barebox.git.
 Configuration
 -

-barebox uses Kconfig from the Linux Kernel as a configuration tool.
-All configuration is accessible via the 'make' command. Before running
-it you have to specify your architecture with the ARCH environment
-variable and the cross compiler with the CROSS_COMPILE environment
-variable. ARCH has to be one of:
+barebox uses Kconfig from the Linux kernel as a configuration tool,
+where all configuration is done via the ``make`` command. Before running
+it you have to specify your architecture with the ``ARCH`` environment
+variable and the cross compiler with the ``CROSS_COMPILE`` environment
+variable. ``ARCH`` has to be one of:

 * arm
 * blackfin
@@ -54,17 +55,17 @@ variable. ARCH has to be one of:
 * sandbox
 * x86

-CROSS_COMPILE should be the prefix of your cross compiler. This can
+``CROSS_COMPILE`` should be the prefix of your cross compiler. This can
 either contain the full path or, if the cross compiler binary is
 in your $PATH, just the prefix.

-Either export ARCH and CROSS_COMPILE once before working on barebox::
+Either export ``ARCH`` and ``CROSS_COMPILE`` once before working on barebox::

   export ARCH=arm
   export CROSS_COMPILE=/path/to/arm-cortexa8-linux-gnueabihf-
   make ...

-or add them before each 'make' command::
+or add them to each invocation of the ``make`` command::

   ARCH=arm CROSS_COMPILE=/path/to/arm-cortexa8-linux-gnueabihf- make ...

@@ -73,11 +74,23 @@ For readability, ARCH/CROSS_COMPILE are skipped from the 
following examples.
 Configuring for a board
 ^^^

-All configuration files can be found under arch/$ARCH/configs/. For an
-overview type::
+All configuration files can be found under the ``arch/${ARCH}/configs/``
+directory. For an overview of possible Make targets for your architecture,
+type::

   make help

+Your output from ``make help`` will be based on the architecture you've
+selected via the ``ARCH`` variable. So if, for example, you had selected::
+
+  export ARCH=mips
+
+your help output would represent all of the generic (architecture-independent)
+targets, followed by the MIPS-specific ones::
+
+  make [ARCH=mips] help
+  ...
+  ... list of generic targets ...
   ...
   Architecture specific targets (mips):
 No architecture specific help defined for mips
@@ -100,20 +113,51 @@ with the most popular being ``menuconfig``::

   make menuconfig

-barebox used the same configuration system as Linux, so you can use
-all the things you know, e.g. ``make xconfig``, ``make allyesconfig`` etc.
+barebox uses the same (Kbuild) configuration system as Linux, so you can use
+all the kernel config targets you already know, e.g. ``make xconfig``,
+``make allyesconfig`` etc.
+
+Configuring and compiling out-of-tree
+^^^
+
+Before going any further, it's worth knowing how you can do all your barebox
+configuration and compilation out of tree; that is, how you can keep your
+source directory pristine and have all output from the various ``make`` 
commands
+generated in a separate build directory.
+
+Once you check out your barebox source directory, and before you do any
+configuration or building, set the environment variable ``KBUILD_OUTPUT``
+to point to your intended output directory, as in::
+
+  export KBUILD_OUTPUT=.../my_barebox_build_directory
+
+From that point on, all of the ``make`` commands you run in your source
+directory will generate their output in your specified output directory.
+Not only does this keep your source directory clean, but it allows several
+developers to share the same source directory while doing all their own
+configuration and 

recommendation for ARM cross-compiler for building for beaglebone black?

2014-06-30 Thread Robert P. J. Day

  been a while since i've build barebox for my BBB ... anyone here
doing that and can recommend a cross-compiler that's been working for
them? i know there are several out there, just curious what anyone
here is using for that particular board. thanks.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: [PATCH] Documentation: device tree bindings.

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 08:23:43AM -0400, Robert P. J. Day wrote:
 
 Adjusted Sphinx markup for devicetree bindings pages.
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca
 
 ---
 
   not completely confident in my markup here so i'm open to
 suggestions.

Looks fine in the source code, so applied.

I'll have a look at the rendered html result tomorrow.

Sascha


 
 diff --git 
 a/Documentation/devicetree/bindings/barebox/barebox,environment.rst 
 b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
 index d243484..d472f66 100644
 --- a/Documentation/devicetree/bindings/barebox/barebox,environment.rst
 +++ b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
 @@ -4,18 +4,19 @@ barebox environment
  This driver provides an environment for barebox from the devicetree.
 
  Required properties:
 -- compatible: should be barebox,environment
 -- device-path: path to the environment
 +
 +* ``compatible``: should be ``barebox,environment``
 +* ``device-path``: path to the environment
 
  The device-path is a multistring property. The first string should be a
  nodepath to the node containing the physical device of the environment.
  The subsequent strings are of the form type:options to further describe
  the path to the environment. Supported values for type:
 
 -partname:partname  This describes a partition on a device. partname can
 - be the label for mtd partitions, the number for DOS
 -  partitions (beginning with 0) or the name for GPT
 -  partitions
 +``partname``:partname
 +  This describes a partition on a device. partname can
 +  be the label for MTD partitions, the number for DOS
 +  partitions (beginning with 0) or the name for GPT partitions.
 
  Example::
 
 diff --git a/Documentation/devicetree/bindings/leds/common.rst 
 b/Documentation/devicetree/bindings/leds/common.rst
 index 63a45bd..c1fd1ab 100644
 --- a/Documentation/devicetree/bindings/leds/common.rst
 +++ b/Documentation/devicetree/bindings/leds/common.rst
 @@ -1,9 +1,10 @@
  Common leds properties
  ==
 
 -- linux,default-trigger barebox,default-trigger:  This parameter, if 
 present, is a
 +* ``linux,default-trigger``, ``barebox,default-trigger``:  This parameter, 
 if present, is a
  string defining the trigger assigned to the LED.  Current triggers are:
 - heartbeat - LED flashes at a constant rate
 - panic - LED turns on when barebox panics
 - net - LED indicates network activity
 +
 +* ``heartbeat`` - LED flashes at a constant rate
 +* ``panic`` - LED turns on when barebox panics
 +* ``net`` - LED indicates network activity
 
 diff --git a/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst 
 b/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
 index a067579..b9d5bcb 100644
 --- a/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
 +++ b/Documentation/devicetree/bindings/misc/fsl,imx-iim.rst
 @@ -3,14 +3,14 @@ Freescale i.MX IIM (Ic Identification Module)
 
  Required properties:
 
 -- compatible: fsl,imx27-iim
 -- reg: physical register base and size
 +* ``compatible``: ``fsl,imx27-iim``, ``fsl,imx51-iim``
 +* ``reg``: physical register base and size
 
  Optional properties:
 
 -- barebox,provide-mac-address: Provide MAC addresses for ethernet devices. 
 This
 -  can be multiple entries in the form phandle bankno fuseofs to specify a 
 MAC
 -  address to a ethernet device.
 +* ``barebox,provide-mac-address``: Provide MAC addresses for Ethernet 
 devices. This
 +  can be multiple entries in the form phandle bankno fuseofs to assign a 
 MAC
 +  address to an Ethernet device.
 
  Example::
 
 diff --git a/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst 
 b/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
 index 472b9e2..403863e 100644
 --- a/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
 +++ b/Documentation/devicetree/bindings/misc/fsl,imx-ocotp.rst
 @@ -3,14 +3,14 @@ Freescale i.MX OCOTP (On-Chip OTP)
 
  Required properties:
 
 -- compatible: fsl,imx6q-ocotp
 -- reg: physical register base and size
 +* ``compatible``: ``fsl,imx6q-ocotp``
 +* ``reg``: physical register base and size
 
  Optional properties:
 
 -- barebox,provide-mac-address: Provide MAC addresses for ethernet devices. 
 This
 -  can be multiple entries in the form phandle regofs to specify a MAC
 -  address to a ethernet device.
 +* ``barebox,provide-mac-address``: Provide MAC addresses for Ethernet 
 devices. This
 +  can be multiple entries in the form phandle regofs to assign a MAC
 +  address to an Ethernet device.
 
  Example::
 
 
 -- 
 
 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca
 
 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 

Re: [PATCH] Documentation: Fix glossary entry, FTD - FDT

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 08:26:20AM -0400, Robert P. J. Day wrote:
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca
 

Applied, thanks

Sascha

 ---
 
 diff --git a/Documentation/glossary.rst b/Documentation/glossary.rst
 index a702859..8bad7dc 100644
 --- a/Documentation/glossary.rst
 +++ b/Documentation/glossary.rst
 @@ -5,7 +5,7 @@ Glossary
 
  .. glossary:: :sorted:
 
 -   FTD
 +   FDT
Flattened Device Tree
 
 DTB
 
 -- 
 
 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca
 
 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] sdma.h: Typo, interupt - interrupt

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 08:43:39AM -0400, Robert P. J. Day wrote:
 
 Fix only two interupt misspellings in entire barebox codebase.
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha

 
 ---
 
 diff --git a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h 
 b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
 index 5e7ff5f..6a25d79 100644
 --- a/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
 +++ b/arch/ppc/mach-mpc5xxx/include/mach/sdma.h
 @@ -82,11 +82,11 @@ ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
  sdma-IntPend = (1  tasknum);\
  }
 
 -/* get interupt pending bit of a task */
 +/* get interrupt pending bit of a task */
  #define SDMA_GET_PENDINGBIT(tasknum)   \
   ((*(vu_long *)(MPC5XXX_SDMA + 0x14))  (1(tasknum)))
 
 -/* get interupt mask bit of a task */
 +/* get interrupt mask bit of a task */
  #define SDMA_GET_MASKBIT(tasknum)  \
   ((*(vu_long *)(MPC5XXX_SDMA + 0x18))  (1(tasknum)))
 
 
 -- 
 
 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca
 
 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] Makefile: Add missing closing quote for make help

2014-06-30 Thread Sascha Hauer
On Mon, Jun 30, 2014 at 09:16:23AM -0400, Robert P. J. Day wrote:
 
 Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

Applied, thanks

Sascha

 
 ---
 
   definitely prevents make help frum running.
 
 diff --git a/Makefile b/Makefile
 index 6dad637..a8e57ee 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -1076,7 +1076,7 @@ help:
   @echo  'enough build support to build external 
 modules'
   @echo  '  mrproper- Remove all generated files + config + 
 various backup files'
   @echo  '  distclean   - mrproper + remove editor backup and patch 
 files'
 - @echo  '  docs- build documentation
 + @echo  '  docs- build documentation'
   @echo  ''
   @echo  'Configuration targets:'
   @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
 
 -- 
 
 
 Robert P. J. Day Ottawa, Ontario, CANADA
 http://crashcourse.ca
 
 Twitter:   http://twitter.com/rpjday
 LinkedIn:   http://ca.linkedin.com/in/rpjday
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] Documentation: User manual, barebox section

2014-06-30 Thread Robert P. J. Day
On Mon, 30 Jun 2014, Sascha Hauer wrote:

 On Mon, Jun 30, 2014 at 10:41:58AM -0400, Robert P. J. Day wrote:
 
  Various grammar/font fixes to that section, including adding an
  additional section describing how to properly do out of tree
  configuration and building.
 
  Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

 Thanks for documenting the out of tree build. I always forget how to do
 this. Finally I have a place to look at ;)

 BTW buildinf the documentation out of tree is currently broken. This is
 because we autogenerate the command files:

   @$(srctree)/Documentation/gen_commands.py $(srctree) 
 $(srctree)/Documentation/command

 We should generate them in $(objtree), but then we the autogenerated
 command files in another place than the rest of the documentation.
 sphinx expects a single directory though.

 I have no good idea how to solve this, other than copying all doc files
 to $(objtree)/Documentation before calling sphinxs-build.

  hmm ... i seem to be able to generate the docs out of tree just
fine. i'll check again and make sure. all i'm doing is setting:

  $ export KBUILD_OUTPUT=dest dir

and running

  $ make docs

and the sphinx-based documentation appears to be created just fine in
that output/build directory. am i misunderstanding something here?

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: [PATCH] Documentation: User manual, barebox section

2014-06-30 Thread Robert P. J. Day
On Mon, 30 Jun 2014, Sascha Hauer wrote:

 On Mon, Jun 30, 2014 at 10:41:58AM -0400, Robert P. J. Day wrote:
 
  Various grammar/font fixes to that section, including adding an
  additional section describing how to properly do out of tree
  configuration and building.
 
  Signed-off-by: Robert P. J. Day rpj...@crashcourse.ca

 Thanks for documenting the out of tree build. I always forget how to do
 this. Finally I have a place to look at ;)

 BTW buildinf the documentation out of tree is currently broken. This is
 because we autogenerate the command files:

   @$(srctree)/Documentation/gen_commands.py $(srctree) 
 $(srctree)/Documentation/command

 We should generate them in $(objtree), but then we the autogenerated
 command files in another place than the rest of the documentation.
 sphinx expects a single directory though.

 I have no good idea how to solve this, other than copying all doc files
 to $(objtree)/Documentation before calling sphinxs-build.
 Sascha

  ah, i see what you mean ... i was running

  $ git status -u

to get a list of generated files in the source tree, but didn't notice
that .rst files were set as being ignored, so i can see them now with:

  $ git status -u --ignored

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: [RFC v3 2/5] commands: add 'lspci' command

2014-06-30 Thread Antony Pavlov
On Mon, 30 Jun 2014 12:21:50 +0200
Lucas Stach l.st...@pengutronix.de wrote:

 Am Donnerstag, den 26.06.2014, 02:32 +0400 schrieb Antony Pavlov:
  Signed-off-by: Antony Pavlov antonynpav...@gmail.com
  ---
   commands/Kconfig  |  8 
   commands/Makefile |  1 +
   commands/lspci.c  | 49 +
   3 files changed, 58 insertions(+)
   create mode 100644 commands/lspci.c
  
 
 [...]
 
  diff --git a/commands/lspci.c b/commands/lspci.c
  new file mode 100644
  index 000..5e1f6dd
  --- /dev/null
  +++ b/commands/lspci.c
  @@ -0,0 +1,49 @@
  +/*
  + * Copyright (C) 2011-2014 Antony Pavlov antonynpav...@gmail.com
  + *
  + * This file is part of barebox.
  + * 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.
  + *
  + */
  +
  +#include common.h
  +#include command.h
  +#include complete.h
  +#include linux/pci.h
  +
  +static int do_lspci(int argc, char *argv[])
  +{
  +   struct pci_dev *dev;
  +
  +   if (!pci_root) {
  +   printf(no pci!\n);
 
 Please rephrase this to something like No PCI root busses found.

Thanks for this remark!

I prefer the No PCI bus detected message from linux-2.0.0 :)

  +   return 1;
  +   }
  +
  +   list_for_each_entry(dev, pci_root-devices, bus_list) {
  +   printf(%02x: %04x: %04x:%04x (rev %02x)\n,
  + dev-devfn,
  + (dev-class  8)  0x,
  + dev-vendor,
  + dev-device,
  + dev-revision);
  +   }
  +
  +   return 0;
  +}
  +
  +BAREBOX_CMD_START(lspci)
  +   .cmd= do_lspci,
  +   BAREBOX_CMD_DESC(Show PCI info)
  +   BAREBOX_CMD_GROUP(CMD_GRP_INFO)
  +   BAREBOX_CMD_COMPLETE(empty_complete)
  +BAREBOX_CMD_END
 
 -- 
 Pengutronix e.K. | Lucas Stach |
 Industrial Linux Solutions   | http://www.pengutronix.de/  |
 


-- 
-- 
Best regards,
  Antony Pavlov

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


Re: [PATCH] Support for booting ELF images.

2014-06-30 Thread Owen Kirby

On 14-06-26 10:10 PM, Antony Pavlov wrote:

Yes, my kexec series have not been checked in.
I can fix it this weekend.

The main problem of my series is that it's a MIPS series but barebox is 
essentially a ARM bootloader.
It seems that I have to add kexec ARM support :)

Which hardware platform do you use?
We are indeed using an ARM platform (based on an Atmel AT91 SoC, but I 
haven't submitted a patch for our specific board yet). We are primarily 
using Barebox as a bootloader for the Linux kernel, but some of our 
customers want to our boards as eval kits for other operating systems 
(ie: eCos and FreeRTOS).


It's only for those other operating systems that we need the ability to 
load and execute ELF images, we're still using zImage for the Linux 
kernel and I'd feel bad for dumping a lot of kexec work on you when we 
don't really need to be able to boot Linux with it.


Cheers,
Owen


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


[RFC v4 3/6] commands: add 'lspci' command

2014-06-30 Thread Antony Pavlov
Signed-off-by: Antony Pavlov antonynpav...@gmail.com
---
 commands/Kconfig  |  8 
 commands/Makefile |  1 +
 commands/lspci.c  | 52 
 3 files changed, 61 insertions(+)

diff --git a/commands/Kconfig b/commands/Kconfig
index eed6fbd..c98dbc5 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -207,6 +207,14 @@ config CMD_REGULATOR
  the regulator command lists the currently registered regulators and
  their current state.
 
+config CMD_LSPCI
+   bool
+   depends on PCI
+   prompt lspci command
+   default y
+   help
+ The lspci command allows to list all PCI devices.
+
 config CMD_VERSION
tristate
default y
diff --git a/commands/Makefile b/commands/Makefile
index a84d333..d42aca5 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -99,3 +99,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_LSPCI)+= lspci.o
diff --git a/commands/lspci.c b/commands/lspci.c
new file mode 100644
index 000..c00b57f
--- /dev/null
+++ b/commands/lspci.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011-2014 Antony Pavlov antonynpav...@gmail.com
+ *
+ * This file is part of barebox.
+ * 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.
+ *
+ */
+
+#include common.h
+#include command.h
+#include complete.h
+#include linux/pci.h
+
+static int do_lspci(int argc, char *argv[])
+{
+   struct pci_bus *root_bus;
+   struct pci_dev *dev;
+
+   if (list_empty(pci_root_buses)) {
+   printf(No PCI bus detected\n);
+   return 1;
+   }
+
+   list_for_each_entry(root_bus, pci_root_buses, node) {
+   list_for_each_entry(dev, root_bus-devices, bus_list) {
+   printf(%02x: %04x: %04x:%04x (rev %02x)\n,
+ dev-devfn,
+ (dev-class  8)  0x,
+ dev-vendor,
+ dev-device,
+ dev-revision);
+   }
+   }
+
+   return 0;
+}
+
+BAREBOX_CMD_START(lspci)
+   .cmd= do_lspci,
+   BAREBOX_CMD_DESC(Show PCI info)
+   BAREBOX_CMD_GROUP(CMD_GRP_INFO)
+   BAREBOX_CMD_COMPLETE(empty_complete)
+BAREBOX_CMD_END
-- 
1.9.2


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


[RFC v4 5/6] MIPS: add PCI support for GT64120-based Malta board

2014-06-30 Thread Antony Pavlov
Signed-off-by: Antony Pavlov antonynpav...@gmail.com
---
 arch/mips/Kconfig|   1 +
 arch/mips/include/asm/gt64120.h  |  53 +
 arch/mips/mach-malta/Makefile|   1 +
 arch/mips/mach-malta/include/mach/mach-gt64120.h |   2 +
 arch/mips/mach-malta/pci.c   | 236 +++
 5 files changed, 293 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d4e9e1c..bc68c67 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -45,6 +45,7 @@ config MACH_MIPS_MALTA
select SYS_SUPPORTS_BIG_ENDIAN
select HAS_DEBUG_LL
select GPIOLIB
+   select HW_HAS_PCI
 
 config MACH_MIPS_AR231X
bool Atheros ar231x-based boards
diff --git a/arch/mips/include/asm/gt64120.h b/arch/mips/include/asm/gt64120.h
index 6b2ad0f..7e783c8 100644
--- a/arch/mips/include/asm/gt64120.h
+++ b/arch/mips/include/asm/gt64120.h
@@ -18,6 +18,8 @@
 #ifndef _ASM_GT64120_H
 #define _ASM_GT64120_H
 
+#define MSK(n) ((1  (n)) - 1)
+
 #define GT_DEF_BASE0x1400
 
 /*
@@ -34,4 +36,55 @@
 #define GT_PCI0M1LD_OFS0x080
 #define GT_PCI0M1HD_OFS0x088
 
+#define GT_PCI0IOREMAP_OFS 0x0f0
+#define GT_PCI0M0REMAP_OFS 0x0f8
+#define GT_PCI0M1REMAP_OFS 0x100
+
+/* Interrupts. */
+#define GT_INTRCAUSE_OFS   0xc18
+
+/* PCI Internal.  */
+#define GT_PCI0_CMD_OFS0xc00
+#define GT_PCI0_CFGADDR_OFS0xcf8
+#define GT_PCI0_CFGDATA_OFS0xcfc
+
+#define GT_PCI_DCRM_SHF21
+#define GT_PCI_LD_SHF  0
+#define GT_PCI_LD_MSK  (MSK(15)  GT_PCI_LD_SHF)
+#define GT_PCI_HD_SHF  0
+#define GT_PCI_HD_MSK  (MSK(7)  GT_PCI_HD_SHF)
+#define GT_PCI_REMAP_SHF   0
+#define GT_PCI_REMAP_MSK   (MSK(11)  GT_PCI_REMAP_SHF)
+
+#define GT_INTRCAUSE_MASABORT0_SHF 18
+#define GT_INTRCAUSE_MASABORT0_MSK (MSK(1)  GT_INTRCAUSE_MASABORT0_SHF)
+#define GT_INTRCAUSE_MASABORT0_BIT GT_INTRCAUSE_MASABORT0_MSK
+
+#define GT_INTRCAUSE_TARABORT0_SHF 19
+#define GT_INTRCAUSE_TARABORT0_MSK (MSK(1)  GT_INTRCAUSE_TARABORT0_SHF)
+#define GT_INTRCAUSE_TARABORT0_BIT GT_INTRCAUSE_TARABORT0_MSK
+
+#define GT_PCI0_CFGADDR_REGNUM_SHF 2
+#define GT_PCI0_CFGADDR_REGNUM_MSK (MSK(6)  GT_PCI0_CFGADDR_REGNUM_SHF)
+#define GT_PCI0_CFGADDR_FUNCTNUM_SHF   8
+#define GT_PCI0_CFGADDR_FUNCTNUM_MSK   (MSK(3)  GT_PCI0_CFGADDR_FUNCTNUM_SHF)
+#define GT_PCI0_CFGADDR_DEVNUM_SHF 11
+#define GT_PCI0_CFGADDR_DEVNUM_MSK (MSK(5)  GT_PCI0_CFGADDR_DEVNUM_SHF)
+#define GT_PCI0_CFGADDR_BUSNUM_SHF 16
+#define GT_PCI0_CFGADDR_BUSNUM_MSK (MSK(8)  GT_PCI0_CFGADDR_BUSNUM_SHF)
+#define GT_PCI0_CFGADDR_CONFIGEN_SHF   31
+#define GT_PCI0_CFGADDR_CONFIGEN_MSK   (MSK(1)  GT_PCI0_CFGADDR_CONFIGEN_SHF)
+#define GT_PCI0_CFGADDR_CONFIGEN_BIT   GT_PCI0_CFGADDR_CONFIGEN_MSK
+
+/*
+ * Because of an error/peculiarity in the Galileo chip, we need to swap the
+ * bytes when running bigendian.  We also provide non-swapping versions.
+ */
+#define __GT_READ(ofs) \
+   (*(volatile u32 *)(GT64120_BASE+(ofs)))
+#define __GT_WRITE(ofs, data)  \
+   do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
+#define GT_READ(ofs)   le32_to_cpu(__GT_READ(ofs))
+#define GT_WRITE(ofs, data)__GT_WRITE(ofs, cpu_to_le32(data))
+
 #endif /* _ASM_GT64120_H */
diff --git a/arch/mips/mach-malta/Makefile b/arch/mips/mach-malta/Makefile
index f3cc668..0c5a701 100644
--- a/arch/mips/mach-malta/Makefile
+++ b/arch/mips/mach-malta/Makefile
@@ -1 +1,2 @@
 obj-y += reset.o
+obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/mips/mach-malta/include/mach/mach-gt64120.h 
b/arch/mips/mach-malta/include/mach/mach-gt64120.h
index ed1e23e..8f20fcf 100644
--- a/arch/mips/mach-malta/include/mach/mach-gt64120.h
+++ b/arch/mips/mach-malta/include/mach/mach-gt64120.h
@@ -10,4 +10,6 @@
 
 #define MIPS_GT_BASE   0x1be0
 
+#define GT64120_BASE0xbbe0
+
 #endif /* _ASM_MACH_MIPS_MACH_GT64120_DEP_H */
diff --git a/arch/mips/mach-malta/pci.c b/arch/mips/mach-malta/pci.c
new file mode 100644
index 000..9035175
--- /dev/null
+++ b/arch/mips/mach-malta/pci.c
@@ -0,0 +1,236 @@
+#include common.h
+#include types.h
+#include driver.h
+#include init.h
+#include mach/hardware.h
+#include asm/io.h
+#include asm/addrspace.h
+
+#include linux/pci.h
+#include asm/gt64120.h
+
+#include mach/mach-gt64120.h
+
+#define PCI_ACCESS_READ  0
+#define PCI_ACCESS_WRITE 1
+
+static struct resource gt64120_mem_resource = {
+   .name   = GT-64120 PCI MEM,
+   .flags  = IORESOURCE_MEM,
+};
+
+static struct resource gt64120_io_resource = {
+   .name   = GT-64120 PCI I/O,
+   .flags  = IORESOURCE_IO,
+};
+
+static int gt64xxx_pci0_pcibios_config_access(unsigned char access_type,
+   struct pci_bus *bus, unsigned int devfn, int where, u32 

[RFC v4 1/6] MIPS: add dma_alloc_coherent()

2014-06-30 Thread Antony Pavlov
Signed-off-by: Antony Pavlov antonynpav...@gmail.com
---
 arch/mips/include/asm/dma-mapping.h | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/mips/include/asm/dma-mapping.h 
b/arch/mips/include/asm/dma-mapping.h
new file mode 100644
index 000..555efa5
--- /dev/null
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -0,0 +1,25 @@
+#ifndef _ASM_DMA_MAPPING_H
+#define _ASM_DMA_MAPPING_H
+
+#include xfuncs.h
+#include asm/addrspace.h
+#include asm/types.h
+#include malloc.h
+
+static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
+{
+   void *ret;
+
+   ret = xmemalign(PAGE_SIZE, size);
+
+   *dma_handle = CPHYSADDR(ret);
+
+   return (void *)CKSEG1ADDR(ret);
+}
+
+static inline void dma_free_coherent(void *vaddr)
+{
+   free(vaddr);
+}
+
+#endif /* _ASM_DMA_MAPPING_H */
-- 
1.9.2


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


[RFC v4 6/6] MIPS: qemu-malta_defconfig: enable PCI network stuff

2014-06-30 Thread Antony Pavlov
qemu usage:

  # ifconfig br0:1 172.20.0.1
  # qemu-system-mips -nodefaults -nographic -M malta -m 256 \
-serial stdio -monitor null \
-bios ./barebox-flash-image \
-net nic,vlan=0,model=rtl8139 \
-net tap,vlan=0,script=net_br0.sh

  ...

  barebox:/ eth0.ipaddr=172.20.0.2
  barebox:/ eth0.serverip=172.20.0.1
  barebox:/ ping 172.20.0.1
  phy0: Link is up - 100/Full
  host 172.20.0.1 is alive
  barebox:/

Sample net_br0.sh (for connecting to br0 interface, so you can
connect barebox to your real network):

  #!/bin/sh

  brctl addif br0 $1
  ifconfig $1 up

Signed-off-by: Antony Pavlov antonynpav...@gmail.com
---
 arch/mips/configs/qemu-malta_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/configs/qemu-malta_defconfig 
b/arch/mips/configs/qemu-malta_defconfig
index 78f175d..6ee302d 100644
--- a/arch/mips/configs/qemu-malta_defconfig
+++ b/arch/mips/configs/qemu-malta_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_UNCOMPRESS=y
 CONFIG_CMD_GETOPT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_DHCP=y
+CONFIG_CMD_MIITOOL=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_TFTP=y
 CONFIG_CMD_ECHO_E=y
@@ -56,6 +57,7 @@ CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_OFDEVICE=y
 CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_DRIVER_NET_RTL8139=y
 # CONFIG_SPI is not set
 CONFIG_I2C=y
 CONFIG_I2C_GPIO=y
@@ -66,6 +68,8 @@ CONFIG_DRIVER_CFI=y
 # CONFIG_DRIVER_CFI_BANK_WIDTH_2 is not set
 CONFIG_CFI_BUFFER_WRITE=y
 CONFIG_GPIO_MALTA_FPGA_I2C=y
+CONFIG_PCI=y
+CONFIG_PCI_DEBUG=y
 CONFIG_FS_CRAMFS=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
-- 
1.9.2


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


[RFC v4 2/6] PCI: initial commit

2014-06-30 Thread Antony Pavlov
used shorten version of linux-2.6.39 pci_ids.h

Signed-off-by: Antony Pavlov antonynpav...@gmail.com
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 drivers/Kconfig |   1 +
 drivers/Makefile|   1 +
 drivers/pci/Kconfig |  29 
 drivers/pci/Makefile|   8 ++
 drivers/pci/bus.c   | 110 +++
 drivers/pci/pci.c   | 285 +++
 include/linux/mod_devicetable.h |  20 +++
 include/linux/pci.h | 292 
 include/linux/pci_ids.h | 136 +++
 include/linux/pci_regs.h| 110 +++
 10 files changed, 992 insertions(+)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 53e1e97..12a9d8c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -27,5 +27,6 @@ source drivers/pinctrl/Kconfig
 source drivers/bus/Kconfig
 source drivers/regulator/Kconfig
 source drivers/reset/Kconfig
+source drivers/pci/Kconfig
 
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index ef3604f..1990e86 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -26,3 +26,4 @@ obj-y += pinctrl/
 obj-y += bus/
 obj-$(CONFIG_REGULATOR) += regulator/
 obj-$(CONFIG_RESET_CONTROLLER) += reset/
+obj-$(CONFIG_PCI) += pci/
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
new file mode 100644
index 000..9e46592
--- /dev/null
+++ b/drivers/pci/Kconfig
@@ -0,0 +1,29 @@
+config HW_HAS_PCI
+   bool
+
+if HW_HAS_PCI
+
+menu PCI bus options
+
+config PCI
+   bool Support for PCI controller
+   depends on HW_HAS_PCI
+   help
+ Find out whether you have a PCI motherboard. PCI is the name of a
+ bus system, i.e. the way the CPU talks to the other stuff inside
+ your box. If you have PCI, say Y, otherwise N.
+
+
+config PCI_DEBUG
+   bool PCI Debugging
+   depends on PCI
+   help
+ Say Y here if you want the PCI core to produce a bunch of debug
+ messages to the system log.  Select this if you are having a
+ problem with PCI support and want to see more of what is going on.
+
+ When in doubt, say N.
+
+endmenu
+
+endif
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
new file mode 100644
index 000..c7d43c3
--- /dev/null
+++ b/drivers/pci/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for the PCI bus specific drivers.
+#
+obj-y  += pci.o bus.o
+
+ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
+
+CPPFLAGS += $(ccflags-y)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
new file mode 100644
index 000..8215ee5
--- /dev/null
+++ b/drivers/pci/bus.c
@@ -0,0 +1,110 @@
+#include common.h
+#include init.h
+#include driver.h
+#include linux/pci.h
+
+/**
+ * pci_match_one_device - Tell if a PCI device structure has a matching
+ *PCI device id structure
+ * @id: single PCI device id structure to match
+ * @dev: the PCI device structure to match against
+ *
+ * Returns the matching pci_device_id structure or %NULL if there is no match.
+ */
+static inline const struct pci_device_id *
+pci_match_one_device(const struct pci_device_id *id, const struct pci_dev *dev)
+{
+   if ((id-vendor == PCI_ANY_ID || id-vendor == dev-vendor) 
+   (id-device == PCI_ANY_ID || id-device == dev-device) 
+   (id-subvendor == PCI_ANY_ID || id-subvendor == 
dev-subsystem_vendor) 
+   (id-subdevice == PCI_ANY_ID || id-subdevice == 
dev-subsystem_device) 
+   !((id-class ^ dev-class)  id-class_mask))
+   return id;
+   return NULL;
+}
+
+static int pci_match(struct device_d *dev, struct driver_d *drv)
+{
+   struct pci_dev *pdev = to_pci_dev(dev);
+   struct pci_driver *pdrv = to_pci_driver(drv);
+   struct pci_device_id *id;
+
+   for (id = (struct pci_device_id *)pdrv-id_table; id-vendor; id++)
+   if (pci_match_one_device(id, pdev)) {
+   dev-priv = id;
+   return 0;
+   }
+
+   return -1;
+}
+
+static int pci_probe(struct device_d *dev)
+{
+   struct pci_dev *pdev = to_pci_dev(dev);
+   struct pci_driver *pdrv = to_pci_driver(dev-driver);
+
+   return pdrv-probe(pdev, dev-priv);
+}
+
+static void pci_remove(struct device_d *dev)
+{
+   struct pci_dev *pdev = to_pci_dev(dev);
+   struct pci_driver *pdrv = to_pci_driver(dev-driver);
+
+   pdrv-remove(pdev);
+}
+
+struct bus_type pci_bus = {
+   .name = pci,
+   .match = pci_match,
+   .probe = pci_probe,
+   .remove = pci_remove,
+};
+
+static int pci_bus_init(void)
+{
+   return bus_register(pci_bus);
+}
+pure_initcall(pci_bus_init);
+
+int pci_register_driver(struct pci_driver *pdrv)
+{
+   struct driver_d *drv = pdrv-driver;
+
+   if (!pdrv-id_table)
+   return -EIO;
+
+   drv-name = pdrv-name;
+   drv-bus = pci_bus;
+
+   return register_driver(drv);
+}
+
+int 

[RFC v4 4/6] net: add RealTek RTL-8139 PCI Ethernet driver

2014-06-30 Thread Antony Pavlov
This driver is based on Linux 2.6.39 8139too driver.

Signed-off-by: Antony Pavlov antonynpav...@gmail.com
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 drivers/net/Kconfig |   8 +
 drivers/net/Makefile|   1 +
 drivers/net/rtl8139.c   | 616 
 include/linux/pci_ids.h |   5 +
 4 files changed, 630 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 7a0d5e1..975c927 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -130,6 +130,14 @@ config DRIVER_NET_ORION
select PHYLIB
select MDIO_MVEBU
 
+config DRIVER_NET_RTL8139
+   bool RealTek RTL-8139 PCI Ethernet driver
+   depends on PCI
+   select PHYLIB
+   help
+ This is a driver for the Fast Ethernet PCI network cards based on
+ the RTL 8139 chips.
+
 config DRIVER_NET_SMC911X
bool smc911x ethernet driver
select PHYLIB
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 65f0d8b..d907061 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_DRIVER_NET_MICREL)   += ksz8864rmn.o
 obj-$(CONFIG_DRIVER_NET_MPC5200)   += fec_mpc5200.o
 obj-$(CONFIG_DRIVER_NET_NETX)  += netx_eth.o
 obj-$(CONFIG_DRIVER_NET_ORION) += orion-gbe.o
+obj-$(CONFIG_DRIVER_NET_RTL8139)   += rtl8139.o
 obj-$(CONFIG_DRIVER_NET_SMC911X)   += smc911x.o
 obj-$(CONFIG_DRIVER_NET_SMC9)  += smc9.o
 obj-$(CONFIG_DRIVER_NET_TAP)   += tap.o
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
new file mode 100644
index 000..82c3585
--- /dev/null
+++ b/drivers/net/rtl8139.c
@@ -0,0 +1,616 @@
+#include common.h
+#include net.h
+#include malloc.h
+#include init.h
+#include xfuncs.h
+#include errno.h
+#include io.h
+#include linux/phy.h
+#include linux/pci.h
+
+#include asm/dma-mapping.h
+
+#define RTL8139_DEBUG
+#undef RTL8139_DEBUG
+
+/*
+ * Receive ring size
+ * Warning: 64K ring has hardware issues and may lock up.
+ */
+#define RX_BUF_IDX 0   /* 8K ring */
+#define RX_BUF_LEN (8192  RX_BUF_IDX)
+#define RX_BUF_PAD 16
+#define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */
+
+#if RX_BUF_LEN == 65536
+#define RX_BUF_TOT_LEN RX_BUF_LEN
+#else
+#define RX_BUF_TOT_LEN (RX_BUF_LEN + RX_BUF_PAD + RX_BUF_WRAP_PAD)
+#endif
+
+/* Number of Tx descriptor registers. */
+#define NUM_TX_DESC4
+
+/* max supported ethernet frame size -- must be at least (dev-mtu+14+4).*/
+#define MAX_ETH_FRAME_SIZE 1536
+
+/* Size of the Tx bounce buffers -- must be at least (dev-mtu+14+4). */
+#define TX_BUF_SIZEMAX_ETH_FRAME_SIZE
+#define TX_BUF_TOT_LEN (TX_BUF_SIZE * NUM_TX_DESC)
+
+/* PCI Tuning Parameters
+   Threshold is bytes transferred to chip before transmission starts. */
+#define TX_FIFO_THRESH 256 /* In bytes, rounded down to 32 byte units. */
+
+/* The following settings are log_2(bytes)-4:  0 == 16 bytes .. 6==1024, 
7==end of packet. */
+#define RX_FIFO_THRESH 7   /* Rx buffer level before first PCI xfer.  */
+#define RX_DMA_BURST   7   /* Maximum PCI burst, '6' is 1024 */
+#define TX_DMA_BURST   6   /* Maximum PCI burst, '6' is 1024 */
+#define TX_RETRY   8   /* 0-15.  retries = 16 + (TX_RETRY * 16) */
+
+struct rtl8139_priv {
+   struct eth_device   edev;
+   void __iomem*base;
+   struct pci_dev  *pci_dev;
+   unsigned char   *rx_ring;
+   unsigned intcur_rx; /* RX buf index of next pkt */
+   dma_addr_t  rx_ring_dma;
+
+   u32 rx_config;
+   unsigned inttx_flag;
+   unsigned long   cur_tx;
+   unsigned long   dirty_tx;
+   unsigned char   *tx_buf[NUM_TX_DESC];   /* Tx bounce buffers */
+   unsigned char   *tx_bufs;   /* Tx bounce buffer region. */
+   dma_addr_t  tx_bufs_dma;
+
+   struct mii_bus miibus;
+};
+
+#define ETH_ZLEN60  /* Min. octets in frame sans FCS */
+
+/* Registers */
+#define MAC0   0x00
+#define MAR0   0x08
+#define TxStatus0  0x10
+
+enum TxStatusBits {
+   TxHostOwns  = 0x2000,
+   TxUnderrun  = 0x4000,
+   TxStatOK= 0x8000,
+   TxOutOfWindow   = 0x2000,
+   TxAborted   = 0x4000,
+   TxCarrierLost   = 0x8000,
+};
+
+#define TxAddr00x20
+#define RxBuf  0x30
+#define ChipCmd0x37
+#define  CmdReset  0x10
+#define  CmdRxEnb  0x08
+#define  CmdTxEnb  0x04
+#define  RxBufEmpty0x01
+#define RxBufPtr   0x38
+#define RxBufAddr  0x3A
+#define IntrMask   0x3C
+#define IntrStatus 0x3E
+#define  PCIErr0x8000
+#define  PCSTimeout0x4000
+#define  RxFIFOOver0x0040
+#define  RxUnderrun0x0020
+#define  RxOverflow0x0010
+#define  TxErr 0x0008
+#define 

[RFC v4 0/6] barebox PCI support

2014-06-30 Thread Antony Pavlov
This patchseries introduce simple PCI bus support for barebox.

Changes since RFC v3:

  * rebase over latest 'next';
  * use list for pci_root_buses;
  * move common PCI Kconfig stuff from arch/mips to drivers/pci;
  * make pci_*_write_config_* PCIe-friendly (use 'int' type for
config register address);
  * drop some unused stuff;
  * change lspci no pci error message to No PCI bus detected;
  * rtl8139: use dma_alloc_coherent();
  * rtl8139: use pci_set_master()  pci_clear_master().

TODOs for RFC v3:

  * no PCI bridges support;
  * introduce pci_resource_start();
  * introduce pci_iomap();
  * clean '#if 0'.

This patchseries can be found on github:

  https://github.com/frantony/barebox/tree/pci.20140630

Antony Pavlov (6):
  MIPS: add dma_alloc_coherent()
  PCI: initial commit
  commands: add 'lspci' command
  net: add RealTek RTL-8139 PCI Ethernet driver
  MIPS: add PCI support for GT64120-based Malta board
  MIPS: qemu-malta_defconfig: enable PCI  network stuff

 arch/mips/Kconfig|   1 +
 arch/mips/configs/qemu-malta_defconfig   |   4 +
 arch/mips/include/asm/dma-mapping.h  |  25 +
 arch/mips/include/asm/gt64120.h  |  53 ++
 arch/mips/mach-malta/Makefile|   1 +
 arch/mips/mach-malta/include/mach/mach-gt64120.h |   2 +
 arch/mips/mach-malta/pci.c   | 236 +
 commands/Kconfig |   8 +
 commands/Makefile|   1 +
 commands/lspci.c |  52 ++
 drivers/Kconfig  |   1 +
 drivers/Makefile |   1 +
 drivers/net/Kconfig  |   8 +
 drivers/net/Makefile |   1 +
 drivers/net/rtl8139.c| 616 +++
 drivers/pci/Kconfig  |  29 ++
 drivers/pci/Makefile |   8 +
 drivers/pci/bus.c| 110 
 drivers/pci/pci.c| 285 +++
 include/linux/mod_devicetable.h  |  20 +
 include/linux/pci.h  | 292 +++
 include/linux/pci_ids.h  | 141 ++
 include/linux/pci_regs.h | 110 
 23 files changed, 2005 insertions(+)
 create mode 100644 arch/mips/include/asm/dma-mapping.h
 create mode 100644 arch/mips/mach-malta/pci.c
 create mode 100644 commands/lspci.c
 create mode 100644 drivers/net/rtl8139.c
 create mode 100644 drivers/pci/Kconfig
 create mode 100644 drivers/pci/Makefile
 create mode 100644 drivers/pci/bus.c
 create mode 100644 drivers/pci/pci.c
 create mode 100644 include/linux/mod_devicetable.h
 create mode 100644 include/linux/pci.h
 create mode 100644 include/linux/pci_ids.h
 create mode 100644 include/linux/pci_regs.h

-- 
1.9.2


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