Re: [RFC, PATCH v2 2/3] net: add ar231x-eth support

2013-05-27 Thread Sascha Hauer
On Sat, May 25, 2013 at 05:57:02PM +0200, Oleksij Rempel wrote:
> Am 24.05.2013 09:09, schrieb Sascha Hauer:
> >On Wed, May 22, 2013 at 09:49:48AM +0200, Oleksij Rempel wrote:
> >>This driver should work with some Atheros WiSoCs:
> >>- ar2312, ar2313
> >>- ar2315, ar2316 ...
> >>
> >>Signed-off-by: Oleksij Rempel 
> >>---
> >>  drivers/net/Kconfig  |   7 +
> >>  drivers/net/Makefile |   1 +
> >>  drivers/net/ar231x.c | 429 
> >> +++
> >>  drivers/net/ar231x.h | 219 ++
> >>  4 files changed, 656 insertions(+)
> >>  create mode 100644 drivers/net/ar231x.c
> >>  create mode 100644 drivers/net/ar231x.h
> >>
> >>+
> >>+   /* FIXME: priv->{t,r}x_ring are virtual addresses,
> >>+* use virt-to-phys convertion */
> >
> >We use 1:1 mappings, so I think this comment should be removed.
> 
> This part should be fixed after Anthonys "MIPS: add initial cache support"
> 
> >>+
> >>+static void ar231x_allocate_dma_descriptors(struct eth_device *edev)
> >>+{
> >>+   struct ar231x_eth_priv *priv = edev->priv;
> >>+   u16 ar231x_descr_size = sizeof(struct ar231x_descr);
> >>+   u16 i;
> >>+
> >>+   priv->tx_ring = xmalloc(ar231x_descr_size);
> >
> >What alignment do you need here? This may or may not be safe.
> 
> Currently there is no other choice.
> 
> >>+
> >>+static int ar231x_eth_recv(struct eth_device *edev)
> >>+{
> >>+   struct ar231x_eth_priv *priv = edev->priv;
> >>+
> >>+   while (1) {
> >>+   struct ar231x_descr *rxdsc = priv->next_rxdsc;
> >>+   u32 status = rxdsc->status;
> >>+
> >>+   /* owned by DMA? */
> >>+   if (status & DMA_RX_OWN)
> >>+   break;
> >>+
> >>+   /* Pick only packets what we can handle:
> >>+* - only complete packet per buffer
> >>+*   (First and Last at same time)
> >>+* - drop multicast */
> >>+   if (!priv->kill_rx_ring &&
> >>+   ((status & DMA_RX_MASK) == DMA_RX_FSLS)) {
> >>+   u16 length =
> >>+   ((status >> DMA_RX_LEN_SHIFT) & 0x3fff)
> >>+   - CRC_LEN;
> >>+   net_receive((void *)rxdsc->buffer_ptr, length);
> >>+   }
> >>+   /* Clean descriptor. now it is owned by DMA. */
> >>+   priv->next_rxdsc = (struct ar231x_descr *)rxdsc->next_dsc_ptr;
> >>+   ar231x_flash_rxdsc(rxdsc);
> >>+   }
> >
> >This loop looks wrong. You should only receive a single packet for each
> >call of this function.
> 
> This loop is needed to filter broadcast packtes. If remove this loop
> and reduce rx buffer, i will get really bad packet losses.

What I meant is that you should only pull a single packet out of the
queue each time you enter ar231x_eth_recv. You shouldn't have to reduce
the rx buffer for this.

Anyway, thinking about it it should be fine to call net_receive on all
currently available buffers like you did above. Just keep it like it is
now.

So with the request_mem_region fix this driver should be fine.

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


v2013.05.1 stable release

2013-05-27 Thread Sascha Hauer
Hi All,

We have a stable update for the may release. This contains a fix
on ARM for a corrupt memset, so all ARM users should update. Various
ARM v7 cache patches also make it worth updating for affected users.
For more details what's included see below.

Sascha


Alexander Shiyan (1):
  ARM: ccmx51: Another fix SDRAM size detection

Alexandre Belloni (1):
  sama5d3xek: correct rootfs nand partition

Enrico Scholz (3):
  ARM v7: fix mmu-off operation
  ARM v7: v7_mmu_cache_flush(): do not restore r0-r3 (minor optimization)
  ARM v7: added v7_mmu_cache_invalidate()

Juergen Beisert (1):
  MXS: fix SoC detecting

Lucas Stach (1):
  arm: properly init alignment trap bit

Nicolas Pitre (1):
  ARM: fix the memset fix

Sascha Hauer (8):
  fdt: Fix dt memreserve entry
  ARM: invalidate data caches during early init
  ARM: i.MX: Allow disabling SDRAM autodetection
  ARM: i.MX: ccxmx51: detect SDRAM size by board id
  pbl: Fix typo in make causing pbl files to be rebuilt
  ARM: pbl: fix make dependencies
  make: Add barebox_default_env.* to targets
  Release v2013.05.1

Steffen Trumtrar (2):
  defaultenv-2: Fix settings entry
  ARM i.MX53: tqma53: fix console entry

 Makefile|  2 +-
 arch/arm/Makefile   | 13 +-
 arch/arm/boards/ccxmx51/ccxmx51.c   | 63 +++-
 arch/arm/boards/ccxmx51/ccxmx51.h   |  1 +
 arch/arm/boards/ccxmx51/lowlevel.c  |  4 +-
 arch/arm/boards/sama5d3xek/env/config   |  2 +-
 arch/arm/boards/tqma53/env/config-board |  2 +-
 arch/arm/cpu/cache-armv7.S  | 74 -
 arch/arm/cpu/cache.c| 21 ++
 arch/arm/cpu/start-pbl.c|  2 +
 arch/arm/cpu/start.c|  2 +
 arch/arm/include/asm/barebox-arm-head.h |  2 +-
 arch/arm/include/asm/cache.h|  5 +++
 arch/arm/lib/memset.S   | 33 ++-
 arch/arm/mach-imx/esdctl.c  | 14 +++
 arch/arm/mach-imx/include/mach/esdctl.h |  1 +
 arch/arm/mach-mxs/imx.c |  1 +
 common/Makefile |  2 +
 defaultenv-2/menu/menu/settings |  2 +-
 drivers/of/fdt.c|  3 +-
 scripts/Makefile.build  |  2 +-
 21 files changed, 161 insertions(+), 90 deletions(-)
-- 
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: [RFC, EXPERIMENTAL] MIPS: add initial cache support

2013-05-27 Thread Sascha Hauer
Hi Antony,

On Fri, May 24, 2013 at 02:47:25PM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov 
> ---
>  arch/mips/include/asm/cache.h|8 +
>  arch/mips/include/asm/cacheops.h |   78 +++
>  arch/mips/include/asm/cpu-info.h |1 +
>  arch/mips/include/asm/io.h   |   66 ++
>  arch/mips/include/asm/r4kcache.h |  443 
> ++
>  arch/mips/lib/Makefile   |1 +
>  arch/mips/lib/c-r4k.c|   97 +
>  arch/mips/lib/dma.c  |   27 +++
>  include/linux/const.h|   24 +++
>  9 files changed, 745 insertions(+)
>  create mode 100644 arch/mips/include/asm/cache.h
>  create mode 100644 arch/mips/include/asm/cacheops.h
>  create mode 100644 arch/mips/include/asm/r4kcache.h
>  create mode 100644 arch/mips/lib/dma.c
>  create mode 100644 include/linux/const.h
> 
> diff --git a/arch/mips/lib/dma.c b/arch/mips/lib/dma.c
> new file mode 100644
> index 000..0ca53f1
> --- /dev/null
> +++ b/arch/mips/lib/dma.c
> @@ -0,0 +1,27 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static inline void __iomem *ioremap_nocache(phys_t offset, unsigned long 
> size)
> +{
> + return (void __iomem *) (unsigned long)CKSEG1ADDR(offset);
> +}
> +
> +void *dma_alloc_coherent(size_t size)
> +{
> + void *ret;
> +
> + ret = xmemalign(4096, size);
> +
> + dma_inv_range((unsigned long)ret, (unsigned long)ret + size);

Is this needed? I mean you return the corresponding CKSEG1ADDR anyway
which should be coherent memory.

> +
> + ret = ioremap_nocache((phys_t)ret, size);
> +
> + return ret;
> +}
> +
> +void dma_free_coherent(void *mem, size_t size)
> +{
> + free(mem);
> +}

I would expect to invalidate the cache here instead.

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: MIPS: XBurst: rzx50: enable pbl support

2013-05-27 Thread Sascha Hauer
On Sun, May 26, 2013 at 03:26:58PM +0400, Antony Pavlov wrote:
> This patch series enables trivial pbl support for Ritmix RZX-50.
> 
> [PATCH 1/3] MIPS: rzx50: add trivial board_pbl_start
> [PATCH 2/3] MIPS: XBurst: enable pbl support
> [PATCH 3/3] MIPS: rzx50: enable pbl in defconfig

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 3/3] USB: imx-usb-phy: add device tree support

2013-05-27 Thread Philipp Zabel
Signed-off-by: Philipp Zabel 
---
 drivers/usb/imx/imx-usb-phy.c |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index ce9c93f..8eb832e 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -93,13 +93,26 @@ err_free:
return ret;
 };
 
+static __maybe_unused struct of_device_id imx_usbphy_dt_ids[] = {
+   {
+   .compatible = "fsl,imx23-usbphy",
+   }, {
+   /* sentinel */
+   }
+};
+
 static struct driver_d imx_usbphy_driver = {
.name   = "imx-usb-phy",
.probe  = imx_usbphy_probe,
+   .of_compatible = DRV_OF_COMPAT(imx_usbphy_dt_ids),
 };
 
 static int imx_usbphy_init(void)
 {
return platform_driver_register(&imx_usbphy_driver);
 }
-coredevice_initcall(imx_usbphy_init);
+/*
+ * Make sure this is initialized after gpt, since we
+ * need timers for the udelay in imx_usbphy_enable.
+ */
+fs_initcall(imx_usbphy_init);
-- 
1.7.10.4


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


[PATCH 1/3] USB: imx-usb-misc: add device tree support

2013-05-27 Thread Philipp Zabel
Signed-off-by: Philipp Zabel 
---
 drivers/usb/imx/imx-usb-misc.c |   43 
 1 file changed, 43 insertions(+)

diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 901ced4..b9c6fb9 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -506,10 +506,53 @@ static int imx_usbmisc_probe(struct device_d *dev)
return 0;
 }
 
+static __maybe_unused struct of_device_id imx_usbmisc_dt_ids[] = {
+#ifdef CONFIG_ARCH_IMX25
+   {
+   .compatible = "fsl,imx25-usbmisc",
+   .data = (unsigned long)&mx25_data,
+   },
+#endif
+#if defined(CONFIG_ARCH_IMX27) || defined(CONFIG_ARCH_IMX31)
+   {
+   .compatible = "fsl,imx27-usbmisc",
+   .data = (unsigned long)&mx27_mx31_data,
+   },
+#endif
+#ifdef CONFIG_ARCH_IMX35
+   {
+   .compatible = "fsl,imx35-usbmisc",
+   .data = (unsigned long)&mx35_data,
+   },
+#endif
+#ifdef CONFIG_ARCH_IMX51
+   {
+   .compatible = "fsl,imx51-usbmisc",
+   .data = (unsigned long)&mx5_data,
+   },
+#endif
+#ifdef CONFIG_ARCH_IMX53
+   {
+   .name = "fsl,imx53-usbmisc",
+   .data = (unsigned long)&mx5_data,
+   },
+#endif
+#ifdef CONFIG_ARCH_IMX6
+   {
+   .compatible = "fsl,imx6q-usbmisc",
+   .data = (unsigned long)&mx6_data,
+   },
+#endif
+   {
+   /* sentinel */
+   }
+};
+
 static struct driver_d imx_usbmisc_driver = {
.name   = "imx-usbmisc",
.probe  = imx_usbmisc_probe,
.id_table = imx_usbmisc_ids,
+   .of_compatible = DRV_OF_COMPAT(imx_usbmisc_dt_ids),
 };
 
 static int imx_usbmisc_init(void)
-- 
1.7.10.4


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


[PATCH 2/3] USB: chipidea-imx: add basic device tree support

2013-05-27 Thread Philipp Zabel
This adds device tree support to the chipidea-imx driver.
There is no way to set flags or enable ULPI yet. Only host
mode is supported for now.

Signed-off-by: Philipp Zabel 
---
 drivers/usb/imx/chipidea-imx.c |   33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 1570f90..87e6a9d 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -29,11 +29,11 @@ static int imx_chipidea_port_init(void *drvdata)
struct imxusb_platformdata *pdata = dev->platform_data;
int ret;
 
-   ret = imx_usbmisc_port_init(dev->id, pdata->flags);
+   ret = imx_usbmisc_port_init(dev->id, pdata ? pdata->flags : 0);
if (ret)
dev_err(dev, "misc init failed: %s\n", strerror(-ret));
 
-   if (pdata->init)
+   if (pdata && pdata->init)
pdata->init(dev->id);
 
return ret;
@@ -45,7 +45,7 @@ static int imx_chipidea_port_post_init(void *drvdata)
struct imxusb_platformdata *pdata = dev->platform_data;
int ret;
 
-   ret = imx_usbmisc_port_post_init(dev->id, pdata->flags);
+   ret = imx_usbmisc_port_post_init(dev->id, pdata ? pdata->flags : 0);
if (ret)
dev_err(dev, "post misc init failed: %s\n", strerror(-ret));
 
@@ -60,7 +60,16 @@ static int imx_chipidea_probe(struct device_d *dev)
struct ehci_data data = {};
uint32_t portsc;
 
-   if (!pdata) {
+   if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
+   const void *args;
+
+   ret = of_parse_phandles_with_args(dev->device_node,
+   "fsl,usbmisc", "#index-cells", 0, NULL, &args);
+   if (ret < 0)
+   return -EINVAL;
+
+   dev->id = be32_to_cpu(*((__be32 *)args));
+   } else if (!pdata) {
dev_err(dev, "no pdata!\n");
return -EINVAL;
}
@@ -75,12 +84,13 @@ static int imx_chipidea_probe(struct device_d *dev)
 
portsc = readl(base + 0x184);
portsc &= ~MXC_EHCI_PORTSC_MASK;
-   portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
+   if (pdata)
+   portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
writel(portsc, base + 0x184);
 
imx_chipidea_port_init(dev);
 
-   if ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
+   if (pdata && ((pdata->flags & MXC_EHCI_PORTSC_MASK) == 
MXC_EHCI_MODE_ULPI)) {
dev_dbg(dev, "using ULPI phy\n");
if (IS_ENABLED(CONFIG_USB_ULPI)) {
ret = ulpi_setup(base + 0x170, 1);
@@ -97,7 +107,7 @@ static int imx_chipidea_probe(struct device_d *dev)
data.hcor = base + 0x140;
data.flags = EHCI_HAS_TT;
 
-   if (pdata->mode == IMX_USB_MODE_HOST && IS_ENABLED(CONFIG_USB_EHCI)) {
+   if (!pdata || (pdata->mode == IMX_USB_MODE_HOST && 
IS_ENABLED(CONFIG_USB_EHCI))) {
ret = ehci_register(dev, &data);
} else if (pdata->mode == IMX_USB_MODE_DEVICE && 
IS_ENABLED(CONFIG_USB_GADGET_DRIVER_ARC)) {
ret = ci_udc_register(dev, base);
@@ -109,8 +119,17 @@ static int imx_chipidea_probe(struct device_d *dev)
return ret;
 };
 
+static __maybe_unused struct of_device_id imx_chipidea_dt_ids[] = {
+   {
+   .compatible = "fsl,imx27-usb",
+   }, {
+   /* sentinel */
+   }
+};
+
 static struct driver_d imx_chipidea_driver = {
.name   = "imx-usb",
.probe  = imx_chipidea_probe,
+   .of_compatible = DRV_OF_COMPAT(imx_chipidea_dt_ids),
 };
 device_platform_driver(imx_chipidea_driver);
-- 
1.7.10.4


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


[PATCH 3/3] cfi: make hardware device parent of mtd device

2013-05-27 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nor/cfi_flash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index 645d93a..3b2346e 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -962,6 +962,7 @@ static void cfi_init_mtd(struct flash_info *info)
mtd->numeraseregions = info->numeraseregions;
mtd->flags = MTD_CAP_NORFLASH;
mtd->type = MTD_NORFLASH;
+   mtd->parent = info->dev;
 
add_mtd_device(mtd, "nor");
 }
-- 
1.8.2.rc2


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


Re: [PATCH] mtd: call mtd_erase with complete area if possible

2013-05-27 Thread Renaud Barbier

On 27/05/2013 09:38, Sascha Hauer wrote:

If a device does not have bad blocks loop over the eraseblocks
in the driver instead of the core. This allows the mtd_dataflash
driver to erase blocks instead of pages to gain more speed during
erasing. Also the mtd_dataflash driver modifies the erase_info
struct which causes the outer loop in the core to never end.

Signed-off-by: Sascha Hauer 
---

Renaud, you recently sent a patch to fix erase on non uniform
flashes. This patch should fix this (by accident) aswell (or maybe
it causes other problems ;). Could you please test this one?

Thanks
  Sascha



It does work.
If I define /dev/env0 to be 64KB i.e two sectors, then data in both 
sector has been erased.


barebox> / unprotect /dev/env0
barebox> / erase /dev/env0
mtd_op_erase = 65536
cfi_erase: erase 0x (size 65536)
intel_flash_erase_one:sect = 0
intel_flash_erase_one:sect = 1





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


[PATCH 2/3] cfi: Add dev * to flash_info and switch to dev_*

2013-05-27 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nor/cfi_flash.c | 55 +++--
 drivers/mtd/nor/cfi_flash.h |  1 +
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index 4b4e29d..645d93a 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -187,10 +187,10 @@ static ulong flash_read_long (struct flash_info *info, 
flash_sect_t sect, uint o
addr = flash_make_addr (info, sect, offset);
 
 #ifdef DEBUG
-   debug ("long addr is at %p info->portwidth = %d\n", addr,
+   dev_dbg(info->dev, "long addr is at %p info->portwidth = %d\n", addr,
   info->portwidth);
for (x = 0; x < 4 * info->portwidth; x++) {
-   debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x));
+   dev_dbg(info->dev, "addr[%x] = 0x%x\n", x, flash_read8(addr + 
x));
}
 #endif
 #if defined __LITTLE_ENDIAN
@@ -262,11 +262,11 @@ static int flash_detect_width (struct flash_info *info, 
struct cfi_qry *qry)
info->interface = 
le16_to_cpu(qry->interface_desc);
 

info->cfi_offset=flash_offset_cfi[cfi_offset];
-   debug ("device interface is %d\n",
+   dev_dbg(info->dev, "device interface is 
%d\n",
info->interface);
-   debug ("found port %d chip %d chip_lsb 
%d ",
+   dev_dbg(info->dev, "found port %d chip 
%d chip_lsb %d ",
info->portwidth, 
info->chipwidth, info->chip_lsb);
-   debug ("port %d bits chip %d bits\n",
+   dev_dbg(info->dev, "port %d bits chip 
%d bits\n",
info->portwidth << 
CFI_FLASH_SHIFT_WIDTH,
info->chipwidth << 
CFI_FLASH_SHIFT_WIDTH);
return 1;
@@ -274,7 +274,7 @@ static int flash_detect_width (struct flash_info *info, 
struct cfi_qry *qry)
}
}
}
-   debug ("not found\n");
+   dev_dbg(info->dev, "not found\n");
return 0;
 }
 
@@ -282,7 +282,7 @@ static int flash_detect_cfi (struct flash_info *info, 
struct cfi_qry *qry)
 {
int ret;
 
-   debug ("flash detect cfi\n");
+   dev_dbg(info->dev, "flash detect cfi\n");
 
info->chip_lsb = 0;
ret = flash_detect_width (info, qry);
@@ -354,7 +354,7 @@ static ulong flash_get_size (struct flash_info *info)
break;
 #endif
default:
-   printf("unsupported vendor\n");
+   dev_err(info->dev, "unsupported vendor\n");
return 0;
}
info->cfi_cmd_set->flash_read_jedec_ids (info);
@@ -362,11 +362,11 @@ static ulong flash_get_size (struct flash_info *info)
 
info->cfi_cmd_set->flash_fixup (info, &qry);
 
-   debug ("manufacturer is %d\n", info->vendor);
-   debug ("manufacturer id is 0x%x\n", info->manufacturer_id);
-   debug ("device id is 0x%x\n", info->device_id);
-   debug ("device id2 is 0x%x\n", info->device_id2);
-   debug ("cfi version is 0x%04x\n", info->cfi_version);
+   dev_dbg(info->dev, "manufacturer is %d\n", info->vendor);
+   dev_dbg(info->dev, "manufacturer id is 0x%x\n", 
info->manufacturer_id);
+   dev_dbg(info->dev, "device id is 0x%x\n", info->device_id);
+   dev_dbg(info->dev, "device id2 is 0x%x\n", info->device_id2);
+   dev_dbg(info->dev, "cfi version is 0x%04x\n", 
info->cfi_version);
 
size_ratio = info->portwidth / info->chipwidth;
/* if the chip is x8/x16 reduce the ratio by half */
@@ -374,10 +374,10 @@ static ulong flash_get_size (struct flash_info *info)
&& (info->chipwidth == FLASH_CFI_BY8)) {
size_ratio >>= 1;
}
-   debug ("size_ratio %d port %d bits chip %d bits\n",
+   dev_dbg(info->dev, "size_ratio %d port %d bits chip %d bits\n",
   size_ratio, info->portwidth << CFI_FLASH_SHIFT_WIDTH,
   info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
-   debug ("found %d erase regions\n", num_erase_regions);
+   dev_dbg(info->dev, "found %d erase regions\n", 
num_erase_regions);
info->eraseregions = xzalloc(sizeof(*(info->eraseregions)) * 
num_erase_regions);
info->numeraseregions = num_erase_regions;
sect_cnt = 0;
@@ -387,19 +387,19 @@ static ulong flash_get_size (struct flash_info *inf

[PATCH 1/3] cfi: remove unused field from struct flash_info

2013-05-27 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/mtd/nor/cfi_flash.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/nor/cfi_flash.h b/drivers/mtd/nor/cfi_flash.h
index 2a2454c..5c31d51 100644
--- a/drivers/mtd/nor/cfi_flash.h
+++ b/drivers/mtd/nor/cfi_flash.h
@@ -48,7 +48,6 @@ struct cfi_cmd_set;
  */
 
 struct flash_info {
-   struct driver_d driver;
ulong   size;   /* total bank size in bytes 
*/
ushort  sector_count;   /* number of erase units
*/
ulong   flash_id;   /* combined device & manufacturer code  
*/
-- 
1.8.2.rc2


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


[PATCH 3/7] mci: embed mci device into struct mci

2013-05-27 Thread Sascha Hauer
To safe a separate allocation and to make the code simpler.

Signed-off-by: Sascha Hauer 
---
 drivers/mci/mci-core.c | 217 ++---
 include/mci.h  |   2 +-
 2 files changed, 96 insertions(+), 123 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 9cc6cfb..1aa98db 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -215,7 +215,7 @@ static int mci_go_idle(struct mci *mci)
err = mci_send_cmd(mci, &cmd, NULL);
 
if (err) {
-   dev_dbg(mci->mci_dev, "Activating IDLE state failed: %d\n", 
err);
+   dev_dbg(&mci->dev, "Activating IDLE state failed: %d\n", err);
return err;
}
 
@@ -252,7 +252,7 @@ static int sd_send_op_cond(struct mci *mci)
mci_setup_cmd(&cmd, MMC_CMD_APP_CMD, 0, MMC_RSP_R1);
err = mci_send_cmd(mci, &cmd, NULL);
if (err) {
-   dev_dbg(mci->mci_dev, "Preparing SD for operating 
conditions failed: %d\n", err);
+   dev_dbg(&mci->dev, "Preparing SD for operating 
conditions failed: %d\n", err);
return err;
}
 
@@ -264,7 +264,7 @@ static int sd_send_op_cond(struct mci *mci)
mci_setup_cmd(&cmd, SD_CMD_APP_SEND_OP_COND, arg, MMC_RSP_R3);
err = mci_send_cmd(mci, &cmd, NULL);
if (err) {
-   dev_dbg(mci->mci_dev, "SD operation condition set 
failed: %d\n", err);
+   dev_dbg(&mci->dev, "SD operation condition set failed: 
%d\n", err);
return err;
}
udelay(1000);
@@ -277,7 +277,7 @@ static int sd_send_op_cond(struct mci *mci)
} while (busy && timeout--);
 
if (timeout <= 0) {
-   dev_dbg(mci->mci_dev, "SD operation condition set timed out\n");
+   dev_dbg(&mci->dev, "SD operation condition set timed out\n");
return -ENODEV;
}
 
@@ -320,7 +320,7 @@ static int mmc_send_op_cond(struct mci *mci)
err = mci_send_cmd(mci, &cmd, NULL);
 
if (err) {
-   dev_dbg(mci->mci_dev, "Preparing MMC for operating 
conditions failed: %d\n", err);
+   dev_dbg(&mci->dev, "Preparing MMC for operating 
conditions failed: %d\n", err);
return err;
}
 
@@ -328,7 +328,7 @@ static int mmc_send_op_cond(struct mci *mci)
} while (!(cmd.response[0] & OCR_BUSY) && timeout--);
 
if (timeout <= 0) {
-   dev_dbg(mci->mci_dev, "SD operation condition set timed out\n");
+   dev_dbg(&mci->dev, "SD operation condition set timed out\n");
return -ENODEV;
}
 
@@ -438,7 +438,7 @@ static int mmc_change_freq(struct mci *mci)
 
err = mci_send_ext_csd(mci, mci->ext_csd);
if (err) {
-   dev_dbg(mci->mci_dev, "Preparing for frequency setup failed: 
%d\n", err);
+   dev_dbg(&mci->dev, "Preparing for frequency setup failed: 
%d\n", err);
return err;
}
 
@@ -447,7 +447,7 @@ static int mmc_change_freq(struct mci *mci)
err = mci_switch(mci, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
 
if (err) {
-   dev_dbg(mci->mci_dev, "MMC frequency changing failed: %d\n", 
err);
+   dev_dbg(&mci->dev, "MMC frequency changing failed: %d\n", err);
return err;
}
 
@@ -455,13 +455,13 @@ static int mmc_change_freq(struct mci *mci)
err = mci_send_ext_csd(mci, mci->ext_csd);
 
if (err) {
-   dev_dbg(mci->mci_dev, "Verifying frequency change failed: 
%d\n", err);
+   dev_dbg(&mci->dev, "Verifying frequency change failed: %d\n", 
err);
return err;
}
 
/* No high-speed support */
if (!mci->ext_csd[EXT_CSD_HS_TIMING]) {
-   dev_dbg(mci->mci_dev, "No high-speed support\n");
+   dev_dbg(&mci->dev, "No high-speed support\n");
return 0;
}
 
@@ -544,14 +544,14 @@ static int sd_change_freq(struct mci *mci)
if (mmc_host_is_spi(host))
return 0;
 
-   dev_dbg(mci->mci_dev, "Changing transfer frequency\n");
+   dev_dbg(&mci->dev, "Changing transfer frequency\n");
mci->card_caps = 0;
 
/* Read the SCR to find out if this card supports higher speeds */
mci_setup_cmd(&cmd, MMC_CMD_APP_CMD, mci->rca << 16, MMC_RSP_R1);
err = mci_send_cmd(mci, &cmd, NULL);
if (err) {
-   dev_dbg(mci->mci_dev, "Query SD card capabilities failed: 
%d\n", err);
+   dev_dbg(&mci->dev, "Query SD card capabilities failed: %d\n", 
err);
return err;
}
 
@@ -560,7 +560,7 @@ static int sd_change_freq(struct mci *mci)
timeout = 3;
 
 retry_scr:
-   dev_dbg(mci->mci_dev, "Trying to read

[PATCH 1/7] driver: Attach info callback to device, not to driver

2013-05-27 Thread Sascha Hauer
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.

Signed-off-by: Sascha Hauer 
---
 arch/sandbox/board/hostfile.c |  5 +++--
 drivers/ata/ahci.c|  2 +-
 drivers/ata/sata-imx.c|  2 +-
 drivers/base/driver.c | 18 ++
 drivers/mci/atmel_mci.c   |  8 +++-
 drivers/mci/mci-core.c|  8 +++-
 drivers/mci/mxs.c | 14 +-
 drivers/mci/s3c.c |  8 +++-
 drivers/misc/jtag.c   | 40 
 drivers/mtd/nor/cfi_flash.c   |  3 ++-
 drivers/net/cs8900.c  |  3 ++-
 drivers/video/fb.c|  3 ++-
 drivers/video/s3c24xx.c   |  8 +++-
 drivers/video/stm.c   |  3 ++-
 include/driver.h  |  5 ++---
 15 files changed, 54 insertions(+), 76 deletions(-)

diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 48c6ea3..ac29cfa 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -77,6 +77,9 @@ static int hf_probe(struct device_d *dev)
priv->cdev.size = hf->size;
priv->cdev.ops = &hf_fops;
priv->cdev.priv = hf;
+
+   dev->info = hf_info;
+
 #ifdef CONFIG_FS_DEVFS
devfs_create(&priv->cdev);
 #endif
@@ -87,7 +90,6 @@ static int hf_probe(struct device_d *dev)
 static struct driver_d hf_drv = {
.name  = "hostfile",
.probe = hf_probe,
-   .info  = hf_info,
 };
 device_platform_driver(hf_drv);
 
@@ -111,4 +113,3 @@ int barebox_register_filedev(struct hf_platform_data *hf)
 
return sandbox_add_device(dev);
 }
-
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 37419f2..7def9a0 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -635,6 +635,7 @@ static int ahci_probe(struct device_d *dev)
ahci->dev = dev;
ahci->mmio_base = regs;
dev->priv = ahci;
+   dev->info = ahci_info;
 
ret = ahci_add_host(ahci);
if (ret)
@@ -654,7 +655,6 @@ static __maybe_unused struct of_device_id ahci_dt_ids[] = {
 static struct driver_d ahci_driver = {
.name   = "ahci",
.probe  = ahci_probe,
-   .info   = ahci_info,
.of_compatible = DRV_OF_COMPAT(ahci_dt_ids),
 };
 device_platform_driver(ahci_driver);
diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c
index bd48fae..13bf116 100644
--- a/drivers/ata/sata-imx.c
+++ b/drivers/ata/sata-imx.c
@@ -107,6 +107,7 @@ static int imx_sata_probe(struct device_d *dev)
 
imx_ahci->ahci.dev = dev;
dev->priv = &imx_ahci->ahci;
+   dev->info = ahci_info,
 
ret = ahci_add_host(&imx_ahci->ahci);
if (ret)
@@ -143,7 +144,6 @@ static struct platform_device_id imx_sata_ids[] = {
 static struct driver_d imx_sata_driver = {
.name   = "imx-sata",
.probe  = imx_sata_probe,
-   .info   = ahci_info,
.id_table = imx_sata_ids,
 };
 device_platform_driver(imx_sata_driver);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 30a4bc5..c885630 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -201,15 +201,6 @@ struct driver_d *get_driver_by_name(const char *name)
return NULL;
 }
 
-static void noinfo(struct device_d *dev)
-{
-   printf("no info available for %s\n", dev_name(dev));
-}
-
-static void noshortinfo(struct device_d *dev)
-{
-}
-
 int register_driver(struct driver_d *drv)
 {
struct device_d *dev = NULL;
@@ -221,11 +212,6 @@ int register_driver(struct driver_d *drv)
list_add_tail(&drv->list, &driver_list);
list_add_tail(&drv->bus_list, &drv->bus->driver_list);
 
-   if (!drv->info)
-   drv->info = noinfo;
-   if (!drv->shortinfo)
-   drv->shortinfo = noshortinfo;
-
bus_for_each_device(drv->bus, dev)
match(drv, dev);
 
@@ -489,8 +475,8 @@ static int do_devinfo(int argc, char *argv[])
printf("bus: %s\n\n", dev->bus ?
dev->bus->name : "none");
 
-   if (dev->driver)
-   dev->driver->info(dev);
+   if (dev->info)
+   dev->info(dev);
 
printf("%s\n", list_empty(&dev->parameters) ?
"no parameters available" : "Parameters:");
diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index c5fd306..b5873f9 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -470,7 +470,6 @@ static int atmci_request(struct mci_host *mci, struct 
mci_cmd *cmd, struct mci_d
return atmci_cmd_done(host, stat);
 }
 
-#ifdef CONFIG_MCI_INFO
 static void atmci_info(struct device_d *mci_dev)
 {
struct atmel_mci *host = mci_dev->priv;
@@ -493,7 +492,6 @@ static void atmci_info(struct device_d *mci_dev)
gpio_is_valid(pd->detect_pin) ? "yes" : "no");

[PATCH] MCI patches

2013-05-27 Thread Sascha Hauer
Some time ago we introduced the possibility to register the
SD/MMC device files with specific names to get persistent
names for them. The devices needed to probe/info the cards are
still named mcix though and still have dynamic numbers. This
series renames the devices to the same name as the device files.

Also for the i.MX ESDHC controller on i.MX51 we allow to specify
aliases for the controllers. The devices are now registered
using the aliases making it possible to have persistent names for
devicetree based boards.

Sascha


Sascha Hauer (7):
  driver: Attach info callback to device, not to driver
  mci: make mci device a pure device
  mci: embed mci device into struct mci
  mci: set name of mci device to same name as the filename
  of: Add of_alias_get function
  mci: imx-esdhc: allow to specify devicename via OF alias
  ARM: i.MX51: Add aliases for MMC controllers

 arch/arm/boards/freescale-mx51-pdk/board.c |   6 +-
 arch/arm/dts/imx51.dtsi|   4 +
 arch/sandbox/board/hostfile.c  |   5 +-
 drivers/ata/ahci.c |   2 +-
 drivers/ata/sata-imx.c |   2 +-
 drivers/base/driver.c  |  18 +--
 drivers/mci/atmel_mci.c|   8 +-
 drivers/mci/imx-esdhc.c|   7 +-
 drivers/mci/mci-core.c | 235 ++---
 drivers/mci/mxs.c  |  14 +-
 drivers/mci/s3c.c  |   8 +-
 drivers/misc/jtag.c|  40 ++---
 drivers/mtd/nor/cfi_flash.c|   3 +-
 drivers/net/cs8900.c   |   3 +-
 drivers/of/base.c  |  13 ++
 drivers/video/fb.c |   3 +-
 drivers/video/s3c24xx.c|   8 +-
 drivers/video/stm.c|   3 +-
 include/driver.h   |   5 +-
 include/mci.h  |   2 +-
 include/of.h   |   6 +
 21 files changed, 196 insertions(+), 199 deletions(-)

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


[PATCH 7/7] ARM: i.MX51: Add aliases for MMC controllers

2013-05-27 Thread Sascha Hauer
To get persistent names for the MMC controllers add aliases to
them

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/freescale-mx51-pdk/board.c | 6 +++---
 arch/arm/dts/imx51.dtsi| 4 
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/freescale-mx51-pdk/board.c 
b/arch/arm/boards/freescale-mx51-pdk/board.c
index 2c934b5..6807796 100644
--- a/arch/arm/boards/freescale-mx51-pdk/board.c
+++ b/arch/arm/boards/freescale-mx51-pdk/board.c
@@ -170,7 +170,7 @@ static int f3s_devices_init(void)
armlinux_set_bootparams((void *)0x9100);
armlinux_set_architecture(MACH_TYPE_MX51_BABBAGE);
 
-   imx51_bbu_internal_mmc_register_handler("mmc", "/dev/disk0",
+   imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0",
BBU_HANDLER_FLAG_DEFAULT, (void *)flash_header_start,
flash_header_end - flash_header_start, 0);
 
@@ -181,8 +181,8 @@ device_initcall(f3s_devices_init);
 
 static int f3s_part_init(void)
 {
-   devfs_add_partition("disk0", 0x0, 0x4, DEVFS_PARTITION_FIXED, 
"self0");
-   devfs_add_partition("disk0", 0x4, 0x2, DEVFS_PARTITION_FIXED, 
"env0");
+   devfs_add_partition("mmc0", 0x0, 0x4, DEVFS_PARTITION_FIXED, 
"self0");
+   devfs_add_partition("mmc0", 0x4, 0x2, DEVFS_PARTITION_FIXED, 
"env0");
 
return 0;
 }
diff --git a/arch/arm/dts/imx51.dtsi b/arch/arm/dts/imx51.dtsi
index 02c132d..a900287 100644
--- a/arch/arm/dts/imx51.dtsi
+++ b/arch/arm/dts/imx51.dtsi
@@ -22,6 +22,10 @@
gpio1 = &gpio2;
gpio2 = &gpio3;
gpio3 = &gpio4;
+   mmc0 = &esdhc1;
+   mmc1 = &esdhc2;
+   mmc2 = &esdhc3;
+   mmc3 = &esdhc4;
};
 
tzic: tz-interrupt-controller@e000 {
-- 
1.8.2.rc2


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


[PATCH 2/7] mci: make mci device a pure device

2013-05-27 Thread Sascha Hauer
No need to match and probe the device if all that we want is a logical
deivice for the mci.

Signed-off-by: Sascha Hauer 
---
 drivers/mci/mci-core.c | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 5c00018..9cc6cfb 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1629,15 +1629,11 @@ on_error:
return rc;
 }
 
-static struct driver_d mci_driver = {
-   .name   = "mci",
-   .probe  = mci_probe,
-};
-
 static int mci_init(void)
 {
sector_buf = xmemalign(32, 512);
-   return platform_driver_register(&mci_driver);
+
+   return 0;
 }
 
 device_initcall(mci_init);
@@ -1649,12 +1645,28 @@ device_initcall(mci_init);
  */
 int mci_register(struct mci_host *host)
 {
+   int ret;
struct device_d *mci_dev = xzalloc(sizeof(struct device_d));
 
+   strcpy(mci_dev->name, "mci");
mci_dev->id = DEVICE_ID_DYNAMIC;
-   strcpy(mci_dev->name, mci_driver.name);
mci_dev->platform_data = host;
mci_dev->parent = host->hw_dev;
 
-   return platform_device_register(mci_dev);
+   ret = register_device(mci_dev);
+   if (ret)
+   goto err_free;
+
+   ret = mci_probe(mci_dev);
+   if (ret)
+   goto err_unregister;
+
+   return 0;
+
+err_unregister:
+   unregister_device(mci_dev);
+err_free:
+   free(mci_dev);
+
+   return ret;
 }
-- 
1.8.2.rc2


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


[PATCH 4/7] mci: set name of mci device to same name as the filename

2013-05-27 Thread Sascha Hauer
We already have the possibility to register a mci with a certain
filename to get persistent names. However, the device needed to
find the probe parameter still has the name 'mcix'. This patch
changes this by registering the mci device with the same name
as the filename.

Signed-off-by: Sascha Hauer 
---
 drivers/mci/mci-core.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 1aa98db..4a463d5 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1608,8 +1608,14 @@ int mci_register(struct mci_host *host)
mci = xzalloc(sizeof(*mci));
mci->host = host;
 
-   strcpy(mci->dev.name, "mci");
-   mci->dev.id = DEVICE_ID_DYNAMIC;
+   if (host->devname) {
+   strcpy(mci->dev.name, host->devname);
+   mci->dev.id = DEVICE_ID_SINGLE;
+   } else {
+   strcpy(mci->dev.name, "mci");
+   mci->dev.id = DEVICE_ID_DYNAMIC;
+   }
+
mci->dev.platform_data = host;
mci->dev.parent = host->hw_dev;
 
-- 
1.8.2.rc2


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


[PATCH 6/7] mci: imx-esdhc: allow to specify devicename via OF alias

2013-05-27 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 drivers/mci/imx-esdhc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 46bd6d2..1e3b307 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -535,8 +535,13 @@ static int fsl_esdhc_probe(struct device_d *dev)
else
mci->host_caps = MMC_MODE_4BIT;
 
-   if (pdata && pdata->devname)
+   if (pdata && pdata->devname) {
mci->devname = pdata->devname;
+   } else if (dev->device_node) {
+   const char *alias = of_alias_get(dev->device_node);
+   if (alias)
+   mci->devname = xstrdup(alias);
+   }
 
if (caps & ESDHC_HOSTCAPBLT_HSS)
mci->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
-- 
1.8.2.rc2


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


[PATCH 5/7] of: Add of_alias_get function

2013-05-27 Thread Sascha Hauer
This is used to retrieve the name of the alias for a given
devicenode.

Signed-off-by: Sascha Hauer 
---
 drivers/of/base.c | 13 +
 include/of.h  |  6 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index e2a8bb5..b58a19b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -212,6 +212,19 @@ int of_alias_get_id(struct device_node *np, const char 
*stem)
 }
 EXPORT_SYMBOL_GPL(of_alias_get_id);
 
+const char *of_alias_get(struct device_node *np)
+{
+   struct property *pp;
+
+   list_for_each_entry(pp, &of_aliases->properties, list) {
+   if (!strcmp(np->full_name, pp->value))
+   return pp->name;
+   }
+
+   return NULL;
+}
+EXPORT_SYMBOL_GPL(of_alias_get);
+
 u64 of_translate_address(struct device_node *node, const __be32 *in_addr)
 {
struct property *p;
diff --git a/include/of.h b/include/of.h
index a804ec4..6c75cbd 100644
--- a/include/of.h
+++ b/include/of.h
@@ -178,6 +178,7 @@ struct cdev;
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
 
 int of_alias_get_id(struct device_node *np, const char *stem);
+const char *of_alias_get(struct device_node *np);
 int of_device_is_stdout_path(struct device_d *dev);
 const char *of_get_model(void);
 void *of_flatten_dtb(struct device_node *node);
@@ -197,6 +198,11 @@ static inline int of_alias_get_id(struct device_node *np, 
const char *stem)
return -ENOENT;
 }
 
+static inline const char *of_alias_get(struct device_node *np)
+{
+   return NULL;
+}
+
 static inline int of_device_is_stdout_path(struct device_d *dev)
 {
return 0;
-- 
1.8.2.rc2


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


[PATCH] mtd: call mtd_erase with complete area if possible

2013-05-27 Thread Sascha Hauer
If a device does not have bad blocks loop over the eraseblocks
in the driver instead of the core. This allows the mtd_dataflash
driver to erase blocks instead of pages to gain more speed during
erasing. Also the mtd_dataflash driver modifies the erase_info
struct which causes the outer loop in the core to never end.

Signed-off-by: Sascha Hauer 
---

Renaud, you recently sent a patch to fix erase on non uniform
flashes. This patch should fix this (by accident) aswell (or maybe
it causes other problems ;). Could you please test this one?

Thanks
 Sascha

 drivers/mtd/core.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 61744b6..f358098 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -107,6 +107,12 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, 
loff_t offset)
memset(&erase, 0, sizeof(erase));
erase.mtd = mtd;
erase.addr = offset;
+
+   if (!mtd->block_isbad) {
+   erase.len = count;
+   return mtd_erase(mtd, &erase);
+   }
+
erase.len = mtd->erasesize;
 
while (count > 0) {
-- 
1.8.2.rc2


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


Re: [PATCH 2/2] cfi_flash: size_ratio should not be 0

2013-05-27 Thread Sascha Hauer
On Wed, May 22, 2013 at 09:53:40AM +0200, Oleksij Rempel wrote:
> We will get size = 0 if size_ratio = 0
> 
> Signed-off-by: Oleksij Rempel 

Applied, thanks

Sascha

> ---
>  drivers/mtd/nor/cfi_flash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
> index 4b4e29d..85e96ce 100644
> --- a/drivers/mtd/nor/cfi_flash.c
> +++ b/drivers/mtd/nor/cfi_flash.c
> @@ -371,7 +371,8 @@ static ulong flash_get_size (struct flash_info *info)
>   size_ratio = info->portwidth / info->chipwidth;
>   /* if the chip is x8/x16 reduce the ratio by half */
>   if ((info->interface == FLASH_CFI_X8X16)
> - && (info->chipwidth == FLASH_CFI_BY8)) {
> + && (info->chipwidth == FLASH_CFI_BY8)
> + && (size_ratio != 1)) {
>   size_ratio >>= 1;
>   }
>   debug ("size_ratio %d port %d bits chip %d bits\n",
> -- 
> 1.8.1.2
> 
> 
> ___
> 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] ARM i.MX53: tqma53: fix console entry

2013-05-27 Thread Sascha Hauer
On Mon, May 27, 2013 at 09:38:20AM +0200, Steffen Trumtrar wrote:
> The default baseboard for the tqma53 (MBa53) uses UART2 for debug console.
> 
> Signed-off-by: Steffen Trumtrar 

Applied, thanks

Sascha

> ---
>  arch/arm/boards/tqma53/env/config-board | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boards/tqma53/env/config-board 
> b/arch/arm/boards/tqma53/env/config-board
> index 4776438..28d015e 100644
> --- a/arch/arm/boards/tqma53/env/config-board
> +++ b/arch/arm/boards/tqma53/env/config-board
> @@ -4,4 +4,4 @@
>  # instead
>  
>  global.hostname=tqma53
> -global.linux.bootargs.base="console=ttymxc0,115200"
> +global.linux.bootargs.base="console=ttymxc1,115200"
> -- 
> 1.8.2.rc2
> 
> 
> ___
> 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


[PATCH] ARM i.MX53: tqma53: fix console entry

2013-05-27 Thread Steffen Trumtrar
The default baseboard for the tqma53 (MBa53) uses UART2 for debug console.

Signed-off-by: Steffen Trumtrar 
---
 arch/arm/boards/tqma53/env/config-board | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/tqma53/env/config-board 
b/arch/arm/boards/tqma53/env/config-board
index 4776438..28d015e 100644
--- a/arch/arm/boards/tqma53/env/config-board
+++ b/arch/arm/boards/tqma53/env/config-board
@@ -4,4 +4,4 @@
 # instead
 
 global.hostname=tqma53
-global.linux.bootargs.base="console=ttymxc0,115200"
+global.linux.bootargs.base="console=ttymxc1,115200"
-- 
1.8.2.rc2


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


Re: Unable to Boot from NAND on Mini2440

2013-05-27 Thread Juergen Beisert
Vikram Narayanan wrote:
> On 21/05/2013 00:26, Juergen Beisert wrote:
> > Hmm, never had a Mini2440 with a 1 GiB NAND. Can you see, what kind of
> > SDRAM devices are on your Mini2440 board? Maybe they also changed the
> > SDRAMs...
>
> Sorry, I was totally away from mail access.
> Here is the name on the chip.
> K4S561632N -> 256 Mbit x 2

This memory is different from the HY57V561620 and MT48LC16M16 types I know and 
Barebox is adapted to.

Maybe your system doesn't come up due to a wrong SDRAM configuration.

You should compare the SDRAM datasheets and check if the SDRAM controller 
settings in Mini2440 'config.h' match the requirements of your SDRAM type.

Regards,
Juergen

-- 
Pengutronix e.K.  | Juergen Beisert |
Linux Solutions for Science and Industry  | http://www.pengutronix.de/  |

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