New round of my IXP42x patches
Subsystems (14)
I've fixed the 3 remaining patches:
1. Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal operation. Exception: code which can consume arbitrary amount of RAM (example: files allocated in ramfs) must report error instead of panic().
This patch also fixes code which didn't check for NULL from malloc() etc.
Usage: malloc(), xmemalign() return NULL when out of RAM. xmalloc(), xmemalign() always return non-NULL or panic().
(I've removed the clkdev changes as requested)
2. ARM: support big/little endian switching in "bootz". I've renamed CONFIG_BOOTZ_ENDIANNESS_SWITCH to CONFIG_BOOT_ENDIANNESS_SWITCH anticipating support for endianness switching for bootm and bootu, either automatic or with additional parameter.
3. ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
Fixed the memalign() -> xmemalign() usage in IXP4xx Ethernet driver.
I'm currently using Barebox with these three patches applied.
Signature · 6 lines
Krzysztof Halasa _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/3 Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal operation. Exception: code which can consume arbitrary amount of RAM (example: files allocated in ramfs) must report error instead of panic().
This patch also fixes code which didn't check for NULL from malloc() etc.
Usage: malloc(), memalign() return NULL when out of RAM. xmalloc(), xmemalign() always return non-NULL or panic().
arch/arm/cpu/mmu.c +1 -7
@@ -95,13 +95,7 @@ void setup_dma_coherent(unsigned long offset)void *dma_alloc_coherent (size_t size) { -void *mem; - - mem =memalign (4096 , size); -if (mem) -return mem + dma_coherent_offset; - -return NULL ; +return xmemalign (4096 , size) + dma_coherent_offset; }unsigned long virt_to_phys (void *virt)
arch/arm/include/asm/mmu.h +1 -1
@@ -28,7 +28,7 @@ void *phys_to_virt(unsigned long phys);#else static inline void *dma_alloc_coherent (size_t size) { -return malloc (size); +return xmalloc (size); }static inline void dma_free_coherent (void *mem)
commands/edit.c +1 -3
@@ -184,10 +184,8 @@ static struct line *line_realloc(int len, struct line *line) {int size =32 ; -if (!line) { +if (!line) line =xzalloc (sizeof (struct line )); - line->data =malloc (32 ); - }while (size < len) size <<=1 ;
drivers/mci/mci-core.c +1 -4
@@ -1333,10 +1333,7 @@ static struct driver_d mci_driver = {static int mci_init (void ) { - sector_buf =memalign (32 ,512 ); -if (!sector_buf) -return -ENOMEM ; - + sector_buf =xmemalign (32 ,512 );return register_driver (&mci_driver); }
drivers/net/at91_ether.c +1 -1
@@ -263,7 +263,7 @@ static int at91rm9200_eth_init (struct device_d *dev)struct eth_device *edev;int i; - edev =malloc (sizeof (struct eth_device )); + edev =xmalloc (sizeof (struct eth_device )); dev->priv = edev; edev->open = at91rm9200_eth_open;
drivers/net/cs8900.c +2 -2
@@ -440,14 +440,14 @@ static int cs8900_probe(struct device_d *dev)debug ("cs8900_init()\n" ); - priv = (struct cs8900_priv *)malloc (sizeof (*priv)); + priv = (struct cs8900_priv *)xmalloc (sizeof (*priv)); priv->regs = (u16 *)dev->map_base;if (cs8900_check_id (priv)) {free (priv);return -1 ; } - edev = (struct eth_device *)malloc (sizeof (struct eth_device )); + edev = (struct eth_device *)xmalloc (sizeof (struct eth_device )); dev->type_data = edev; edev->priv = priv;
drivers/net/fec_mpc5200.c +2 -2
@@ -661,9 +661,9 @@ int mpc5xxx_fec_probe(struct device_d *dev)struct eth_device *edev;mpc5xxx_fec_priv *fec; - edev = (struct eth_device *)malloc (sizeof (struct eth_device )); + edev = (struct eth_device *)xmalloc (sizeof (struct eth_device )); dev->type_data = edev; - fec = (mpc5xxx_fec_priv *)malloc (sizeof (*fec)); + fec = (mpc5xxx_fec_priv *)xmalloc (sizeof (*fec)); edev->priv = fec; edev->open = mpc5xxx_fec_open, edev->init = mpc5xxx_fec_init,
drivers/net/tap.c +2 -2
@@ -79,7 +79,7 @@ int tap_probe(struct device_d *dev)struct tap_priv *priv;int ret =0 ; - priv =malloc (sizeof (struct tap_priv )); + priv =xmalloc (sizeof (struct tap_priv )); priv->name ="barebox" ; priv->fd =tap_alloc (priv->name);
@@ -88,7 +88,7 @@ int tap_probe(struct device_d *dev) goto out; } - edev =malloc (sizeof (struct eth_device )); + edev =xmalloc (sizeof (struct eth_device )); dev->type_data = edev; edev->priv = priv;
drivers/nor/cfi_flash.c +3 -3
@@ -305,7 +305,7 @@ static ulong flash_get_size (struct flash_info *info, ulong base)#endif /* first only malloc space for the first sector */ - info->start =malloc (sizeof (ulong)); + info->start =xmalloc (sizeof (ulong)); info->start[0 ] = base; info->protect =0 ;
@@ -394,8 +394,8 @@ static ulong flash_get_size (struct flash_info *info, ulong base) cur_offset += erase_region_size * erase_region_count;/* increase the space malloced for the sector start addresses */ - info->start =realloc (info->start,sizeof (ulong) * (erase_region_count + sect_cnt)); - info->protect =realloc (info->protect,sizeof (uchar) * (erase_region_count + sect_cnt)); + info->start =xrealloc (info->start,sizeof (ulong) * (erase_region_count + sect_cnt)); + info->protect =xrealloc (info->protect,sizeof (uchar) * (erase_region_count + sect_cnt));for (j =0 ; j < erase_region_count; j++) { info->start[sect_cnt] = sector;
drivers/serial/amba-pl011.c +1 -2
@@ -157,8 +157,7 @@ static int pl011_probe(struct device_d *dev)struct amba_uart_port *uart;struct console_device *cdev; - uart =malloc (sizeof (struct amba_uart_port )); - + uart =xmalloc (sizeof (struct amba_uart_port )); uart->clk =clk_get (dev,NULL );if (IS_ERR (uart->clk))
drivers/serial/atmel.c +1 -2
@@ -398,8 +398,7 @@ static int atmel_serial_probe(struct device_d *dev)struct atmel_uart_port *uart;struct console_device *cdev; - uart =malloc (sizeof (struct atmel_uart_port )); - + uart =xmalloc (sizeof (struct atmel_uart_port )); cdev = &uart->uart; dev->type_data = cdev; cdev->dev = dev;
drivers/serial/serial_blackfin.c +1 -1
@@ -115,7 +115,7 @@ static int blackfin_serial_probe(struct device_d *dev) {struct console_device *cdev; - cdev =malloc (sizeof (struct console_device )); + cdev =xmalloc (sizeof (struct console_device )); dev->type_data = cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ;
drivers/serial/serial_imx.c +1 -1
@@ -319,7 +319,7 @@ static int imx_serial_probe(struct device_d *dev)struct imx_serial_priv *priv;uint32_t val; - priv =malloc (sizeof (*priv)); + priv =xmalloc (sizeof (*priv)); cdev = &priv->cdev; priv->regs = (void __force __iomem *)dev->map_base;
drivers/serial/serial_netx.c +1 -1
@@ -140,7 +140,7 @@ static int netx_serial_probe(struct device_d *dev) {struct console_device *cdev; - cdev =malloc (sizeof (struct console_device )); + cdev =xmalloc (sizeof (struct console_device )); dev->type_data = cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ;
drivers/serial/serial_pl010.c +1 -1
@@ -141,7 +141,7 @@ static int pl010_probe(struct device_d *dev) {struct console_device *cdev; - cdev =malloc (sizeof (struct console_device )); + cdev =xmalloc (sizeof (struct console_device )); dev->type_data = cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ;
drivers/serial/serial_s3c24x0.c +1 -2
@@ -121,8 +121,7 @@ static int s3c24x0_serial_probe(struct device_d *dev) {struct console_device *cdev; - cdev =malloc (sizeof (struct console_device )); - + cdev =xmalloc (sizeof (struct console_device )); dev->type_data = cdev; cdev->dev = dev; cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ;
drivers/usb/gadget/composite.c +0 -3
@@ -903,9 +903,6 @@ static int __init composite_bind(struct usb_gadget *gadget)int status = -ENOMEM ; cdev =xzalloc (sizeof *cdev); -if (!cdev) -return status; - cdev->gadget = gadget;set_gadget_data (gadget, cdev);INIT_LIST_HEAD (&cdev->configs);
drivers/usb/gadget/fsl_udc.c +1 -3
@@ -1016,8 +1016,6 @@ fsl_alloc_request(struct usb_ep *_ep)struct fsl_req *req; req =xzalloc (sizeof *req); -if (!req) -return NULL ;INIT_LIST_HEAD (&req->queue);
@@ -2095,7 +2093,7 @@ static int struct_udc_setup(struct fsl_udc *udc, udc->status_req =container_of (fsl_alloc_request (NULL ), struct fsl_req, req);/* allocate a small amount of memory to get valid address */ - udc->status_req->req.buf =kmalloc (8 ,GFP_KERNEL ); + udc->status_req->req.buf =xmalloc (8 ); udc->resume_state =USB_STATE_NOTATTACHED ; udc->usb_state =USB_STATE_POWERED ; udc->ep0_dir =0 ;
drivers/usb/gadget/u_serial.c +1 -5
@@ -205,11 +205,7 @@ gs_alloc_req(struct usb_ep *ep, unsigned len)if (req !=NULL ) { req->length = len; - req->buf =memalign (32 , len); -if (req->buf ==NULL ) { -usb_ep_free_request (ep, req); -return NULL ; - } + req->buf =xmemalign (32 , len); }return req;
include/net.h +1 -1
@@ -392,7 +392,7 @@ struct net_connection {static inline char *net_alloc_packet (void ) { -return memalign (32 ,PKTSIZE ); +return xmemalign (32 ,PKTSIZE ); } struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,
include/xfuncs.h +1 -0
@@ -7,5 +7,6 @@ void *xmalloc(size_t size);void *xrealloc (void *ptr,size_t size);void *xzalloc (size_t size);char *xstrdup (const char *s); +void *xmemalign (size_t alignment,size_t bytes);#endif /* __XFUNCS_H */
lib/xfuncs.c +8 -0
@@ -70,3 +70,11 @@ char *xstrdup(const char *s) }EXPORT_SYMBOL (xstrdup); +void *xmemalign (size_t alignment,size_t bytes) +{ +void *p =memalign (alignment, bytes); +if (!p) +panic ("ERROR: out of memory\n" ); +return p; +} +EXPORT_SYMBOL (xmemalign);
net/net.c +2 -2
@@ -365,7 +365,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler)return ERR_PTR (-ENETDOWN ); con =xzalloc (sizeof (*con)); - con->packet =memalign (32 ,PKTSIZE ); + con->packet =xmemalign (32 ,PKTSIZE );memset (con->packet,0 ,PKTSIZE ); con->et = (struct ethernet *)con->packet;
@@ -658,7 +658,7 @@ static int net_init(void)int i;for (i =0 ; i <PKTBUFSRX ; i++) - NetRxPackets[i] =memalign (32 ,PKTSIZE ); + NetRxPackets[i] =xmemalign (32 ,PKTSIZE );return 0 ; }
scripts/basic/docproc.c +5 -2
@@ -122,8 +122,11 @@ int symfilecnt = 0;void add_new_symbol (struct symfile *sym,char * symname) { - sym->symbollist = -realloc (sym->symbollist, (sym->symbolcnt +1 ) *sizeof (char *)); + sym->symbollist =realloc (sym->symbollist, (sym->symbolcnt +1 ) *sizeof (char *)); +if (!sym->symbollist) { +fprintf (stderr,"docproc: out of memory\n" ); +exit (1 ); + } sym->symbollist[sym->symbolcnt++].name =strdup (symname); }
scripts/mod/modpost.c +1 -1
@@ -1317,7 +1317,7 @@ void buf_write(struct buffer *buf, const char *s, int len) {if (buf->size - buf->pos < len) { buf->size += len +SZ ; - buf->p =realloc (buf->p, buf->size); + buf->p =NOFAIL (realloc (buf->p, buf->size)); }strncpy (buf->p + buf->pos, s, len); buf->pos += len;
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/3 ARM: support big/little endian switching in "bootX".
In reply to Krzysztof HalasaCurrently implemented only in "bootz".
arch/arm/cpu/Kconfig +9 -0
@@ -73,6 +73,15 @@ config CPU_BIG_ENDIAN port must properly enable any big-endian related features of your chipset/board/processor. +config BOOT_ENDIANNESS_SWITCH + bool "Support switching of Linux kernel endianness" + help + Say Y here if you need to switch CPU endianness before running + Linux kernel, e.g. if you want big-endian Barebox to run + little-endian Linux. + + Currently implemented only by "bootz" command. + config ARCH_HAS_L2X0 bool
arch/arm/lib/armlinux.c +54 -15
153 lines not on this page · raw message
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/3 ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
In reply to Krzysztof HalasaDocumentation/boards.dox +1 -0
@@ -20,6 +20,7 @@ ARM type: @li @subpage board_babage @li @subpage chumbyone @li @subpage scb9328 +@li @subpage multilink @li @subpage netx @li @subpage dev_omap_arch @li @subpage a9m2440
arch/arm/Kconfig +8 -0
@@ -39,6 +39,13 @@ config ARCH_IMX bool "Freescale iMX-based" select GENERIC_GPIO +config ARCH_IXP4XX + bool "Intel IXP4xx-based" + select CPU_32v5 + select ARCH_SUPPORTS_BIG_ENDIAN + select CPU_BIG_ENDIAN + select ARCH_HAS_LOWLEVEL_INIT + config ARCH_STM bool "SigmaTel/FSL iMX-based" select GENERIC_GPIO
@@ -71,6 +78,7 @@ source arch/arm/cpu/Kconfig source arch/arm/mach-at91/Kconfig source arch/arm/mach-ep93xx/Kconfig source arch/arm/mach-imx/Kconfig +source arch/arm/mach-ixp4xx/Kconfig source arch/arm/mach-stm/Kconfig source arch/arm/mach-netx/Kconfig source arch/arm/mach-nomadik/Kconfig
arch/arm/Makefile +2 -0
@@ -41,6 +41,7 @@ CPPFLAGS += $(CFLAGS_ABI) $(arch-y) $(tune-y) machine-$(CONFIG_ARCH_AT91) := at91 machine-$(CONFIG_ARCH_EP93XX) := ep93xx machine-$(CONFIG_ARCH_IMX) := imx +machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx machine-$(CONFIG_ARCH_STM) := stm machine-$(CONFIG_ARCH_NOMADIK) := nomadik machine-$(CONFIG_ARCH_NETX) := netx
@@ -74,6 +75,7 @@ board-$(CONFIG_MACH_FREESCALE_MX35_3STACK) := freescale-mx35-3-stack board-$(CONFIG_MACH_IMX21ADS) := imx21ads board-$(CONFIG_MACH_IMX27ADS) := imx27ads board-$(CONFIG_MACH_MMCCPU) := mmccpu +board-$(CONFIG_MACH_MULTILINK) := multilink board-$(CONFIG_MACH_MX1ADS) := mx1ads board-$(CONFIG_MACH_NOMADIK_8815NHK) := nhk8815 board-$(CONFIG_MACH_NXDB500) := netx
arch/arm/boards/multilink/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += lowlevel_init.o multilink.o
arch/arm/boards/multilink/config.h new file +0 -0
arch/arm/boards/multilink/lowlevel_init.S new file +64 -0
64 lines not on this page · raw message
arch/arm/boards/multilink/multilink.c new file +144 -0
144 lines not on this page · raw message
arch/arm/boards/multilink/multilink.dox new file +36 -0
@@ -0,0 +1,36 @@ +/** @page multilink Goramo MultiLink + +These boards are based on Intel IXP42x CPU. + +Variants: + +MicroRouter module: IXP421 or IXP425 266 MHz CPU, 32 MiB SDRAM, + 1 or 2 Fast Ethernet ports, 2 sync serial ports, 1 RS-232 (console) port. + +MultiLink v.1: IXP425 266 or 533 MHz CPU, 64 - 256 MiB SDRAM, + 2 Fast Ethernet ports, 2 sync serial ports, 1 - 2 RS-232 ports, + a mini-PCI slot, 2 optional USB host connectors. + +MultiLink v.2: IXP425 266 or 533 MHz CPU, 64 - 256 MiB SDRAM, + 2 Fast Ethernet ports, 2 sync serial ports, 1 - 2 RS-232 ports, + 2 additional optional Fast or Gigabit Ethernet ports, a mini-PCI slot, + 4 optional USB host connectors, optional Real-Time Clock, + optional IDE connector. + +16 MiB Intel StrataFlash memory is partitioned as follows: + +0x00000-0x34000 : Barebox image +0x34000-0x39000 : NPE-A microcode +0x39000-0x3c000 : NPE-B microcode +0x3c000-0x40000 : NPE-C microcode +0x40000-0x60000 : env0 + +There is a factory configuration region within Barebox image at locations +0x40 - 0x7F. Details are in file multilink.c + +Barebox image and NPE microcode files are combined in first two blocks +of flash memory. NPE-A microcode is not used by Barebox (but may be used +by Linux HSS driver). NPE-B microcode is needed for eth0 and NPE-C for +eth1. Barebox needs version 2.4 of regular non-VLAN-aware microcode files +(with or without crypto support). +*/
arch/arm/mach-ixp4xx/Kconfig new file +26 -0
@@ -0,0 +1,26 @@ +if ARCH_IXP4XX + +choice + prompt "IXP4xx Board Type" + +config MACH_MULTILINK + bool "Goramo MultiLink" + select MACH_HAS_LOWLEVEL_INIT +endchoice + +config BOARDINFO + default "Goramo MultiLink" if MACH_MULTILINK + +config IXP4XX_QMGR + tristate "IXP4xx Queue Manager support" + help + This driver supports IXP4xx built-in hardware queue manager + and is required by the Ethernet driver. + +config IXP4XX_NPE + tristate "IXP4xx Network Processor Engine support" + help + This driver supports IXP4xx built-in network coprocessors + and is required by the Ethernet driver. + +endif
arch/arm/mach-ixp4xx/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += lowlevel_init.o generic.o +obj-$(CONFIG_IXP4XX_QMGR) += qmgr.o +obj-$(CONFIG_IXP4XX_NPE) += npe.o
arch/arm/mach-ixp4xx/generic.c new file +120 -0
120 lines not on this page · raw message
arch/arm/mach-ixp4xx/include/mach/cpu.h new file +70 -0
70 lines not on this page · raw message
arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h new file +365 -0
365 lines not on this page · raw message
arch/arm/mach-ixp4xx/include/mach/npe.h new file +30 -0
@@ -0,0 +1,30 @@ +#ifndef __IXP4XX_NPE_H +#define __IXP4XX_NPE_H + +#include <common.h> + +#define NPE_NAME_LENGTH 5 + +struct npe_regs { +u32 exec_addr, exec_data, exec_status_cmd, exec_count; +u32 action_points[4 ]; +u32 watchpoint_fifo, watch_count; +u32 profile_count; +u32 messaging_status, messaging_control; +u32 mailbox_status,/*messaging_*/ in_out_fifo; +}; + +struct npe { +struct npe_regs *regs; +int id, valid; +const char name[NPE_NAME_LENGTH +1 ]; +}; + +int npe_running (struct npe *npe); +int npe_send_message (struct npe *npe,const void *msg,const char *what); +int npe_recv_message (struct npe *npe,void *msg,const char *what); +int npe_send_recv_message (struct npe *npe,void *msg,const char *what); +int npe_load_firmware (struct npe *npe); +struct npe *npe_request (int id); + +#endif /* __IXP4XX_NPE_H */
arch/arm/mach-ixp4xx/include/mach/platform.h new file +15 -0
@@ -0,0 +1,15 @@ +#include <asm/types.h> + +#define IXP4XX_ETH_NPEA 0x00 +#define IXP4XX_ETH_NPEB 0x10 +#define IXP4XX_ETH_NPEC 0x20 + +/* Information about built-in Ethernet MAC interfaces */ +struct eth_plat_info { +void *regs; +u8 npe; +u8 phy;/* MII PHY ID, 0 - 31 */ +u8 rxq;/* configurable, currently 0 - 31 only */ +u8 txreadyq; +u8 hwaddr[6 ]; +};
arch/arm/mach-ixp4xx/include/mach/qmgr.h new file +164 -0
164 lines not on this page · raw message
arch/arm/mach-ixp4xx/lowlevel_init.S new file +17 -0
@@ -0,0 +1,17 @@ +#include <mach/ixp4xx-regs.h> + + .section ".text_bare_init", "ax" + + .globl arch_init_lowlevel +arch_init_lowlevel: + ldr r0, cfg + ldr r1, [r0] + and r1, r1, #~0x80000000 /* unmap EXP bus from 0x0 */ + str r1, [r0] + + /* return to ROM */ + orr lr, #0x50000000 + mov pc, lr + +cfg: + .word IXP4XX_EXP_CFG0
arch/arm/mach-ixp4xx/npe.c new file +668 -0
668 lines not on this page · raw message
arch/arm/mach-ixp4xx/qmgr.c new file +259 -0
259 lines not on this page · raw message
drivers/net/Kconfig +8 -0
@@ -77,6 +77,14 @@ config DRIVER_NET_MACB depends on HAS_MACB select MIIDEV +config DRIVER_NET_IXP4XX_ETH + tristate "Intel IXP4xx Ethernet support" + depends on ARCH_IXP4XX && IXP4XX_NPE && IXP4XX_QMGR + select MIIDEV + help + Say Y here if you want to use built-in Ethernet ports + on IXP4xx processor. + config DRIVER_NET_TAP bool "tap Ethernet driver" depends on LINUX
drivers/net/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-$(CONFIG_DRIVER_NET_MACB) += macb.o obj-$(CONFIG_DRIVER_NET_TAP) += tap.o obj-$(CONFIG_MIIDEV) += miidev.o obj-$(CONFIG_NET_USB) += usb/ +obj-$(CONFIG_DRIVER_NET_IXP4XX_ETH) += ixp4xx_eth.o
drivers/net/ixp4xx_eth.c new file +763 -0
763 lines not on this page · raw message
drivers/serial/serial_ns16550.c +8 -0
@@ -102,7 +102,11 @@ static void ns16550_serial_init_port(struct console_device *cdev) baud_divisor =ns16550_calc_divisor (cdev,CONFIG_BAUDRATE );/* initializing the device for the first time */ +#ifdef CONFIG_ARCH_IXP4XX + plat->reg_write (IER_UUE , base, ier);/* Enable UART operation */ +#else plat->reg_write (0x00 , base, ier); +#endif #ifdef CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS plat->reg_write (0x07 , base, mdr1);/* Disable */ #endif
@@ -181,7 +185,11 @@ static int ns16550_setbaudrate(struct console_device *cdev, int baud_rate) cdev->dev->platform_data;unsigned long base = cdev->dev->map_base;unsigned int baud_divisor =ns16550_calc_divisor (cdev, baud_rate); +#ifdef CONFIG_ARCH_IXP4XX + plat->reg_write (IER_UUE , base, ier);/* Enable UART operation */ +#else plat->reg_write (0x00 , base, ier); +#endif plat->reg_write (LCR_BKSE , base, lcr); plat->reg_write (baud_divisor &0xff , base, dll); plat->reg_write ((baud_divisor >>8 ) &0xff , base, dlm);
drivers/serial/serial_ns16550.h +2 -0
@@ -50,6 +50,8 @@#define dll rbr#define dlm ier +#define IER_UUE 0x40/* UART Unit Enable (XScale) */ +#define FCR_FIFO_EN 0x01/* Fifo enable */ #define FCR_RXSR 0x02/* Receiver soft reset */ #define FCR_TXSR 0x04/* Transmitter soft reset */
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
arch/arm/boards/multilink/multilink.c line 13
Quoted 3 lines
arch/arm/boards/multilink/multilink.c new file +3
-0+ +/* offsets from start of flash ROM = 0x50000000 */ +#define CFG_ETH0_ADDRESS 0x40/* 6 bytes */
^^^^^
whitespace please use tab for indent
Quoted 9 lines
arch/arm/boards/multilink/multilink.c new file +9
-0+#define CFG_ETH1_ADDRESS 0x46/* 6 bytes */ +#define CFG_REV 0x4C/* u32 */ +#define CFG_SDRAM_SIZE 0x50/* u32 */ +#define CFG_SDRAM_CONF 0x54/* u32 */ +#define CFG_SDRAM_MODE 0x58/* u32 */ +#define CFG_SDRAM_REFRESH 0x5C/* u32 */ + +#define CFG_HW_BITS 0x60/* u32 */ +#define CFG_HW_USB_PORTS 0x00000007/* 0 = no NEC chip, 1-5 = ports # */
arch/arm/boards/multilink/multilink.c line 32
Quoted 10 lines
arch/arm/boards/multilink/multilink.c new file +10
-0+#define CFG_HW_HAS_PCI_SLOT 0x00000008 +#define CFG_HW_HAS_ETH0 0x00000010 +#define CFG_HW_HAS_ETH1 0x00000020 +#define CFG_HW_HAS_HSS0 0x00000040 +#define CFG_HW_HAS_HSS1 0x00000080 +#define CFG_HW_HAS_UART0 0x00000100 +#define CFG_HW_HAS_UART1 0x00000200 +#define CFG_HW_HAS_EEPROM 0x00000400 + +#define ETH_ALEN 6
IIR we have a macro for it
arch/arm/boards/multilink/multilink.c line 43
Quoted 11 lines
arch/arm/boards/multilink/multilink.c new file +11
-0+ +#define BAREBOX_START 0x00000 +#define BAREBOX_LENGTH 0x34000 +#define NPE_A_START (BAREBOX_START + BAREBOX_LENGTH) +#define NPE_A_LENGTH 0x05000 +#define NPE_B_START (NPE_A_START + NPE_A_LENGTH) +#define NPE_B_LENGTH 0x03000 +#define NPE_C_START (NPE_B_START + NPE_B_LENGTH) +#define NPE_C_LENGTH 0x04000 +#define NPE_ENV0_START (NPE_C_START + NPE_C_LENGTH) +#define NPE_ENV0_LENGTH 0x20000
I prefer we use a fs to store it so we can share it Linux with a cramfs at least
Quoted 15 lines
arch/arm/boards/multilink/multilink.c new file +15
-0+ +static struct device_d cfi_dev = { + .name ="cfi_flash" , + .map_base =IXP4XX_EXP_BASE (0 ), + .size =16 *1024 *1024 , +}; + +static struct eth_plat_info eth_pinfo[2 ] = { + { + .regs = IXP4XX_EthB_BASE, + .npe =1 , + .phy =0 , + .rxq =20 , + .txreadyq =29 , + }, {
arch/arm/boards/multilink/multilink.c line 132
Quoted 10 lines
arch/arm/boards/multilink/multilink.c new file +10
-0+ .regs = IXP4XX_EthC_BASE, + .npe = 2, + .phy = 1, + .rxq = 21, + .txreadyq = 30, + } +}; + + + sdram_dev.size =__raw_readl (IXP4XX_EXP_BASE (0 ) +CFG_SDRAM_SIZE );
how about check the data before register
and if not good use the minimum memory size for the hardware design
arch/arm/boards/multilink/multilink.c line 143
Quoted 11 lines
arch/arm/boards/multilink/multilink.c new file +11
-0+ i =register_device (&sdram_dev); +if (i) + goto out; + +armlinux_add_dram (&sdram_dev); +armlinux_set_bootparams ((void *)(0x00000100 )); +armlinux_set_architecture (MACH_TYPE_GORAMO_MLR ); + +out: +return i; +}
+
arch/arm/mach-ixp4xx/include/mach/qmgr.h line 96
Quoted 7 lines
arch/arm/mach-ixp4xx/include/mach/qmgr.h new file +7
-0+static inline void qmgr_put_entry (unsigned int queue,u32 val) +{ +#if DEBUG_QMGR +BUG_ON (!qmgr_queue_descs[queue]);/* not yet requested */ + +fprintf (stderr,"Queue %s(%i) put %X\n" , + qmgr_queue_descs[queue], queue, val);
please use debug() instead of fprintf so no need of ifdef if no BUG_ON and it will be good to be able to enable the DEBUG via Kconfig
please avoid the #if 0
if no need remove it or use a CONFIG
othersize looks fine
I will test it on the nslu2 later
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
arch/arm/boards/multilink/multilink.c line 13
Quoted 2 lines
arch/arm/boards/multilink/multilink.c new file +2
-0+/* offsets from start of flash ROM = 0x50000000 */ +#define CFG_ETH0_ADDRESS 0x40/* 6 bytes */ ^^^^^whitespace please use tab for indent
Is it the official requirement that I should use tabs for visual indentation (I use tabs for syntactic indentation).
This forces anyone to display with tabs=8 (vide the discussions on lkml). Obviously one can decide to use tabs everywhere, I just want to see such decision has been taken.
Quoted 4 lines
arch/arm/boards/multilink/multilink.c line 48
Quoted 4 lines
arch/arm/boards/multilink/multilink.c new file +4
-0+static struct device_d cfi_dev = { + .name ="cfi_flash" , + .map_base =IXP4XX_EXP_BASE (0 ), + .size =16 *1024 *1024 ,
^^^^^^ I.e., I use tabs here.
Quoted 1 line
Quoted 1 line
+#define
CFG_ETH1_ADDRESS0x46/* 6 bytes */
^^^^^ but not here (probably).
Quoted 2 lines
Quoted 1 line
+#define
ETH_ALEN6IIR we have a macro for it
What's its name?
Quoted 4 lines
Quoted 4 lines
arch/arm/boards/multilink/multilink.c new file +4
-0+#define BAREBOX_START 0x00000 +#define BAREBOX_LENGTH 0x34000 +#define NPE_A_START (BAREBOX_START + BAREBOX_LENGTH) +#define NPE_A_LENGTH 0x05000
Quoted 8 lines
arch/arm/boards/multilink/multilink.c line 43
Quoted 6 lines
arch/arm/boards/multilink/multilink.c new file +6
-0+#define NPE_B_START (NPE_A_START + NPE_A_LENGTH) +#define NPE_B_LENGTH 0x03000 +#define NPE_C_START (NPE_B_START + NPE_B_LENGTH) +#define NPE_C_LENGTH 0x04000 +#define NPE_ENV0_START (NPE_C_START + NPE_C_LENGTH) +#define NPE_ENV0_LENGTH 0x20000I prefer we use a fs to store it so we can share it Linux with a cramfs at least
That means creating a CRAMFS in Barebox' two read/only blocks. Will look at it.
Quoted 2 lines
arch/arm/boards/multilink/multilink.c line 132
Quoted 1 line
arch/arm/boards/multilink/multilink.c new file +1
-0+ sdram_dev.size =__raw_readl (IXP4XX_EXP_BASE (0 ) +CFG_SDRAM_SIZE );how about check the data before register
The amount of RAM is simply stored at CFG_SDRAM_SIZE (there are boards with 32, 64, 128 and 256 MB). There is no way it can be invalid (it's written to flash with JTAG).
Quoted 1 line
and if not good use the minimum memory size for the hardware design
It can't be "no good". It would mean the config space is corrupted, and the best we could do in such case is some sort of panic(). Without the config space we don't know, for example, the number of SDRAM banks, what RAM chips are there, what are our assigned Ethernet MAC addresses (which is alone a sufficient reason to panic) etc.
Quoted 9 lines
arch/arm/mach-ixp4xx/include/mach/qmgr.h line 96
Quoted 7 lines
arch/arm/mach-ixp4xx/include/mach/qmgr.h new file +7
-0+static inline void qmgr_put_entry (unsigned int queue,u32 val) +{ +#if DEBUG_QMGR +BUG_ON (!qmgr_queue_descs[queue]);/* not yet requested */ + +fprintf (stderr,"Queue %s(%i) put %X\n" , + qmgr_queue_descs[queue], queue, val);please use
debug()instead of fprintf so no need of ifdef if noBUG_ONand it will be good to be able to enable the DEBUG viaKconfig
I'll look at it. Guess it will need another CONFIG_* for this. I'd been doing this for some time in Linux and my experience is users tend to select stuff like this unnecesarily. Perhaps a boot loader people are different than casual kernel compilers.
Quoted 2 lines
please avoid the #if 0
if no need remove it or use a CONFIG
It will probably be needed when using IRQs. At this point it's obviously unneeded. Using CONFIG for this is pointless since it's not yet implemented. This code is some sort of copy of (functional) Linux driver.
I can remove it if it's a problem, of course.
Signature · 6 lines
Krzysztof Halasa _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines
arch/arm/boards/multilink/multilink.c new file +4
-0+#define BAREBOX_START 0x00000 +#define BAREBOX_LENGTH 0x34000 +#define NPE_A_START (BAREBOX_START + BAREBOX_LENGTH) +#define NPE_A_LENGTH 0x05000
Quoted 8 lines
arch/arm/boards/multilink/multilink.c line 43
Quoted 6 lines
arch/arm/boards/multilink/multilink.c new file +6
-0+#define NPE_B_START (NPE_A_START + NPE_A_LENGTH) +#define NPE_B_LENGTH 0x03000 +#define NPE_C_START (NPE_B_START + NPE_B_LENGTH) +#define NPE_C_LENGTH 0x04000 +#define NPE_ENV0_START (NPE_C_START + NPE_C_LENGTH) +#define NPE_ENV0_LENGTH 0x20000I prefer we use a fs to store it so we can share it Linux with a cramfs at least
I wonder... how do I create an read-only environment variable in the board code? The variable should be created before env0 is mounted, but shouldn't be destroyed by mounting env0.
I'm thinking of some BAREBOX_PARTITIONS="0x34000@0(barebox),0xC000(barebox-cramfs)". It must be able to survive saveenv followed by a barebox update (which may change the cramfs address and size, i.e. the value saved in env0 must be discarded).
Signature · 6 lines
Krzysztof Halasa _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerRe: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
In reply to Krzysztof HalasaQuoted 9 lines · Krzysztof Halasa
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
arch/arm/boards/multilink/multilink.c line 13
Quoted 2 lines
arch/arm/boards/multilink/multilink.c new file +2
-0+/* offsets from start of flash ROM = 0x50000000 */ +#define CFG_ETH0_ADDRESS 0x40/* 6 bytes */ ^^^^^whitespace please use tab for indent
Is it the official requirement that I should use tabs for visual indentation (I use tabs for syntactic indentation).
It's not an official requirement. I prefer tabs here, but I never rejected a patch because of this.
Quoted 4 lines
This forces anyone to display with tabs=8 (vide the discussions on lkml). Obviously one can decide to use tabs everywhere, I just want to see such decision has been taken.
Have there been discussions? Do you have a pointer?
Quoted 7 lines
Quoted 5 lines
arch/arm/boards/multilink/multilink.c line 48
Quoted 5 lines
arch/arm/boards/multilink/multilink.c new file +4
-0+static struct device_d cfi_dev = { + .name ="cfi_flash" , + .map_base =IXP4XX_EXP_BASE (0 ), + .size =16 *1024 *1024 ,^^^^^^ I.e., I use tabs here.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
+#define
CFG_ETH1_ADDRESS0x46/* 6 bytes */^^^^^ but not here (probably).Quoted 2 lines
Quoted 1 line
+#define
ETH_ALEN6IIR we have a macro for it
What's its name?
I think I removed it during rewriting the network stuff.
Quoted 14 lines
Quoted 13 lines
arch/arm/boards/multilink/multilink.c line 43
Quoted 11 lines
arch/arm/boards/multilink/multilink.c new file +10
-0+#define BAREBOX_START 0x00000 +#define BAREBOX_LENGTH 0x34000 +#define NPE_A_START (BAREBOX_START + BAREBOX_LENGTH) +#define NPE_A_LENGTH 0x05000 +#define NPE_B_START (NPE_A_START + NPE_A_LENGTH) +#define NPE_B_LENGTH 0x03000 +#define NPE_C_START (NPE_B_START + NPE_B_LENGTH) +#define NPE_C_LENGTH 0x04000 +#define NPE_ENV0_START (NPE_C_START + NPE_C_LENGTH) +#define NPE_ENV0_LENGTH 0x20000I prefer we use a fs to store it so we can share it Linux with a cramfs at least
Quoted 2 lines
That means creating a CRAMFS in Barebox' two read/only blocks. Will look at it.
You could use a cramfs but it adds quite some binary size to the image. Is it even possible to share the firmware with Linux? I guess Linux does a request_firmware which either expects the firmware to be compiled in or under /lib/firmware.
Sascha
Signature · 9 lines
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-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
Quoted 5 lines · Sascha Hauer
Quoted 3 lines
This forces anyone to display with tabs=8 (vide the discussions on lkml). Obviously one can decide to use tabs everywhere, I just want to see such decision has been taken.
Have there been discussions? Do you have a pointer?
It's been beaten to death, several times, along with the 80-column limit (lifted some time ago). I think googling for "site:lkml.org tabs alignment" should show relevant threads. My personal opinion is that while we can easily use (and enforce) tabs for syntactic indentation, other things should be left unruled.
IMHO the ideal situation is using spaces for anything other than syntactic indentation, since it allows consistent viewing with any tab length. Unfortunately, most of the editor programs are not there yet (I'm told emacs can be told to do the "right thing" automatically).
Quoted 4 lines
You could use a cramfs but it adds quite some binary size to the image. Is it even possible to share the firmware with Linux? I guess Linux does a
request_firmwarewhich either expects the firmware to be compiled in or under/lib/firmware.
Yes, the firmware must be in /lib/firmware/NPE-[ABC], but we could get it, link etc. from cramfs. Even with a special tool reading cramfs and writing files in /lib/firmware.
At present we simply have another copy of microcode in Linux image.
Signature · 6 lines
Krzysztof Halasa _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
Quoted 8 lines · Krzysztof Halasa
Quoted 5 lines · Sascha Hauer
Quoted 3 lines
This forces anyone to display with tabs=8 (vide the discussions on lkml). Obviously one can decide to use tabs everywhere, I just want to see such decision has been taken.
Have there been discussions? Do you have a pointer?
Quoted 9 lines
It's been beaten to death, several times, along with the 80-column limit (lifted some time ago). I think googling for "site:lkml.org tabs alignment" should show relevant threads. My personal opinion is that while we can easily use (and enforce) tabs for syntactic indentation, other things should be left unruled.
IMHO the ideal situation is using spaces for anything other than syntactic indentation, since it allows consistent viewing with any tab length. Unfortunately, most of the editor programs are not there yet (I'm told emacs can be told to do the "right thing" automatically).
I do prefer tab personnaly
Quoted 11 lines
Quoted 5 lines
You could use a cramfs but it adds quite some binary size to the image. Is it even possible to share the firmware with Linux? I guess Linux does a
request_firmwarewhich either expects the firmware to be compiled in or under/lib/firmware.Yes, the firmware must be in /lib/firmware/NPE-[ABC], but we could get it, link etc. from cramfs. Even with a special tool reading cramfs and writing files in
/lib/firmware.At present we simply have another copy of microcode in Linux image.
a simple link will be enough so the cramfs is the best solution, I think so no data duplication and it will be more easy to update and maintain
And we do not have to known the size of the firmware in barebox just the fs location so more easy to update barebox
I'm working a the fs support for the env with the idea to have a ro part but I need more time to finish it. So for now on it the best solution.
for the size increasement it's impact is cover by the non data duplication and will be reduce againt with the envfs
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/3] ARM: Add support for IXP4xx CPU and for Goramo Multilink router platform.
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
a simple link will be enough so the cramfs is the best solution, I think so no data duplication and it will be more easy to update and maintain
And we do not have to known the size of the firmware in barebox just the fs location so more easy to update barebox
Agreed. For this I have to be able to set an env variable (then read-only) from within the board code. How do I do it? Or should I write this code myself?
Quoted 2 lines
I'm working a the fs support for the env with the idea to have a ro part but I need more time to finish it.
Yeah, though it seems a pure cramfs is better suited to my needs anyway, microcode isn't variable.
Quoted 2 lines
for the size increasement it's impact is cover by the non data duplication and will be reduce againt with the envfs
Not a factor for me.
Signature · 6 lines
Krzysztof Halasa _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox