From: Grant Likely <hidden> Date: 2007-09-28 18:15:42
This series adds Xilinx Virtex support to arch/powerpc. Please review
and comment. It includes support for the uartlite and SystemACE devices
Cheers,
g.
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
@@ -61,13 +61,14 @@ config WALNUThelpThisoptionenablessupportfortheIBMPPC405GPevaluationboard.-#config XILINX_ML300-# bool "Xilinx-ML300"-# depends on 40x-# default y-# select VIRTEX_II_PRO-# help-# This option enables support for the Xilinx ML300 evaluation board.+configXILINX_VIRTEX_GENERIC_BOARD+bool"Generic Xilinx Virtex board"+depends on40x+defaulty+selectVIRTEX_II_PRO+selectVIRTEX_4_FX+help+ThisoptionenablesgenericsupportforXilinxVirtexbasedboards.# 40x specific CPU modules, selected based on the board above.configNP405H
@@ -126,6 +126,8 @@ int serial_console_init(void)dt_is_compatible(devp,"fsl,cpm2-scc-uart")||dt_is_compatible(devp,"fsl,cpm2-smc-uart"))rc=cpm_console_init(devp,&serial_cd);+elseif(dt_is_compatible(devp,"xilinx,uartlite"))+rc=uartlite_console_init(devp,&serial_cd);/* Add other serial console driver calls here */
@@ -30,6 +30,7 @@ obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.oobj-$(CONFIG_PPC_I8259)+=i8259.oobj-$(CONFIG_PPC_83xx)+=ipic.oobj-$(CONFIG_4xx)+=uic.o+obj-$(CONFIG_XILINX_VIRTEX)+=xilinx_intc.oendif# Temporary hack until we have migrated to asm-powerpc
From: Grant Likely <hidden> Date: 2007-09-28 18:17:04
From: Grant Likely <redacted>
Signed-off-by: Grant Likely <redacted>
---
Paul, is this okay by you? Josh has already okayed it.
Cheers,
g.
MAINTAINERS | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
@@ -314,7 +314,7 @@ static void ulite_console_wait_tx(struct uart_port *port)/* wait up to 10ms for the character(s) to be sent */for(i=0;i<10000;i++){-if(readb(port->membase+ULITE_STATUS)&ULITE_STATUS_TXEMPTY)+if(in_be32((void*)port->membase+ULITE_STATUS)&ULITE_STATUS_TXEMPTY)break;udelay(1);}
@@ -413,59 +413,90 @@ static struct uart_driver ulite_uart_driver = {#endif};-staticint__devinitulite_probe(structplatform_device*pdev)+staticint__devinitulite_assign(structdevice*dev,intid,u32base,intirq){-structresource*res,*res2;structuart_port*port;+intrc;-if(pdev->id<0||pdev->id>=ULITE_NR_UARTS)+/* if id = -1; then scan for a free id and use that */+if(id<0){+for(id=0;id<ULITE_NR_UARTS;id++)+if(ulite_ports[id].mapbase==0)+break;+}+if(id<0||id>=ULITE_NR_UARTS){+dev_err(dev,"%s%i too large\n",ULITE_NAME,id);return-EINVAL;+}-if(ulite_ports[pdev->id].membase)+if(ulite_ports[id].mapbase){+dev_err(dev,"cannot assign to %s%i; it is already in use\n",+ULITE_NAME,id);return-EBUSY;+}-res=platform_get_resource(pdev,IORESOURCE_MEM,0);-if(!res)-return-ENODEV;+port=&ulite_ports[id];-res2=platform_get_resource(pdev,IORESOURCE_IRQ,0);-if(!res2)-return-ENODEV;+spin_lock_init(&port->lock);+port->fifosize=16;+port->regshift=2;+port->iotype=UPIO_MEM;+port->iobase=1;/* mark port in use */+port->mapbase=base;+port->membase=NULL;+port->ops=&ulite_ops;+port->irq=irq;+port->flags=UPF_BOOT_AUTOCONF;+port->dev=dev;+port->type=PORT_UNKNOWN;+port->line=id;++dev_set_drvdata(dev,port);++/* Register the port */+rc=uart_add_one_port(&ulite_uart_driver,port);+if(rc){+dev_err(dev,"uart_add_one_port() failed; err=%i\n",rc);+port->mapbase=0;+dev_set_drvdata(dev,NULL);+returnrc;+}-port=&ulite_ports[pdev->id];+return0;+}-port->fifosize=16;-port->regshift=2;-port->iotype=UPIO_MEM;-port->iobase=1;/* mark port in use */-port->mapbase=res->start;-port->membase=NULL;-port->ops=&ulite_ops;-port->irq=res2->start;-port->flags=UPF_BOOT_AUTOCONF;-port->dev=&pdev->dev;-port->type=PORT_UNKNOWN;-port->line=pdev->id;+staticint__devinitulite_release(structdevice*dev)+{+structuart_port*port=dev_get_drvdata(dev);+intrc=0;-uart_add_one_port(&ulite_uart_driver,port);-platform_set_drvdata(pdev,port);+if(port){+rc=uart_remove_one_port(&ulite_uart_driver,port);+dev_set_drvdata(dev,NULL);+port->mapbase=0;+}-return0;+returnrc;}-staticintulite_remove(structplatform_device*pdev)+staticint__devinitulite_probe(structplatform_device*pdev){-structuart_port*port=platform_get_drvdata(pdev);+structresource*res,*res2;-platform_set_drvdata(pdev,NULL);+res=platform_get_resource(pdev,IORESOURCE_MEM,0);+if(!res)+return-ENODEV;-if(port)-uart_remove_one_port(&ulite_uart_driver,port);+res2=platform_get_resource(pdev,IORESOURCE_IRQ,0);+if(!res2)+return-ENODEV;-/* mark port as free */-port->membase=NULL;+returnulite_assign(&pdev->dev,pdev->id,res->start,res2->start);+}-return0;+staticintulite_remove(structplatform_device*pdev)+{+returnulite_release(&pdev->dev);}staticstructplatform_driverulite_platform_driver={
From: Grant Likely <hidden> Date: 2007-09-28 18:18:20
From: Grant Likely <redacted>
Changed to match naming convention used in the rest of the module
Signed-off-by: Grant Likely <redacted>
---
drivers/serial/uartlite.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
From: Grant Likely <hidden> Date: 2007-09-28 18:18:21
From: Grant Likely <redacted>
Changed to make the OF bus binding a wee bit cleaner
Signed-off-by: Grant Likely <redacted>
---
arch/powerpc/platforms/40x/Kconfig | 4 ++--
drivers/serial/uartlite.c | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
@@ -1158,6 +1162,85 @@ static struct platform_driver ace_platform_driver = {};/* ---------------------------------------------------------------------+*OF_PlatformBusSupport+*/++#if defined(CONFIG_OF)+staticint__devinit+ace_of_probe(structof_device*op,conststructof_device_id*match)+{+structresourceres;+unsignedlongphysaddr;+constu32*id;+intirq,bus_width,rc;++dev_dbg(&op->dev,"ace_of_probe(%p, %p)\n",op,match);++/* device id */+id=of_get_property(op->node,"port-number",NULL);++/* physaddr */+rc=of_address_to_resource(op->node,0,&res);+if(rc){+dev_err(&op->dev,"invalid address\n");+returnrc;+}+physaddr=res.start;++/* irq */+irq=irq_of_parse_and_map(op->node,0);++/* bus width */+bus_width=ACE_BUS_WIDTH_16;+if(of_find_property(op->node,"8-bit",NULL))+bus_width=ACE_BUS_WIDTH_8;++/* Call the bus-independant setup code */+returnace_alloc(&op->dev,id?*id:0,physaddr,irq,bus_width);+}++staticint__devexitace_of_remove(structof_device*op)+{+ace_free(&op->dev);+return0;+}++/* Match table for of_platform binding */+staticstructof_device_id__devinitace_of_match[]={+{.compatible="xilinx,xsysace",},+{},+};+MODULE_DEVICE_TABLE(of,ace_of_match);++staticstructof_platform_driverace_of_driver={+.owner=THIS_MODULE,+.name="xsysace",+.match_table=ace_of_match,+.probe=ace_of_probe,+.remove=ace_of_remove,+.driver={+.name="xsysace",+},+};++/* Registration helpers to keep the number of #ifdefs to a minimum */+staticint__initace_of_register(void)+{+pr_debug("xsysace: registering OF binding\n");+returnof_register_platform_driver(&ace_of_driver);+}++staticvoid__exitace_of_unregister(void)+{+of_unregister_platform_driver(&ace_of_driver);+}+#else /* CONFIG_OF */+/* CONFIG_OF not enabled; do nothing helpers */+staticint__initace_of_register(void){return0}+staticvoid__exitace_of_unregister(void){}+#endif /* CONFIG_OF */++/* ---------------------------------------------------------------------*Moduleinit/exitroutines*/staticint__initace_init(void)
@@ -413,6 +425,19 @@ static struct uart_driver ulite_uart_driver = {#endif};+/* ---------------------------------------------------------------------+*Portassignmentfunctions(mappingdevicestouart_portstructures)+*/++/** ulite_assign: register a uartlite device with the driver+*+*@dev:pointertodevicestructure+*@id:requestedidnumber.Pass-1forautomaticportassignment+*@base:baseaddressofuartliteregisters+*@irq:irqnumberforuartlite+*+*Returns:0onsuccess,<0otherwise+*/staticint__devinitulite_assign(structdevice*dev,intid,u32base,intirq){structuart_port*port;
@@ -465,6 +490,10 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)return0;}+/** ulite_release: register a uartlite device with the driver+*+*@dev:pointertodevicestructure+*/staticint__devinitulite_release(structdevice*dev){structuart_port*port=dev_get_drvdata(dev);
@@ -386,10 +411,20 @@ static int __init ulite_console_setup(struct console *co, char *options)port=&ulite_ports[co->index];+/* Check if it is an OF device */+if(!port->mapbase)+ulite_console_of_find_device(co->index);++/* Do we have a device now? */+if(!port->mapbase){+pr_debug("console on ttyUL%i not present\n",co->index);+return-ENODEV;+}+/* not initialized yet? */if(!port->membase){-pr_debug("console on ttyUL%i not initialized\n",co->index);-return-ENODEV;+if(ulite_request_port(port))+return-ENODEV;}if(options)
@@ -461,7 +496,7 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)return-EINVAL;}-if(ulite_ports[id].mapbase){+if((ulite_ports[id].mapbase)&&(ulite_ports[id].mapbase!=base)){dev_err(dev,"cannot assign to %s%i; it is already in use\n",ULITE_NAME,id);return-EBUSY;
From: Grant Likely <hidden> Date: 2007-09-28 18:19:14
From: Grant Likely <redacted>
Split the determination of device registers/irqs/etc from the actual
allocation and initialization of the device structure. This cleans
up the code a bit in preparation to add an of_platform bus binding
Signed-off-by: Grant Likely <redacted>
---
drivers/block/xsysace.c | 99 +++++++++++++++++++++++++++++------------------
1 files changed, 61 insertions(+), 38 deletions(-)
@@ -1033,7 +1033,7 @@ static int __devinit ace_setup(struct ace_device *ace)if(ace->irq!=NO_IRQ)free_irq(ace->irq,ace);err_ioremap:-printk(KERN_INFO"xsysace: error initializing device at 0x%lx\n",+dev_info(ace->dev,"xsysace: error initializing device at 0x%lx\n",ace->physaddr);return-ENOMEM;}
@@ -1056,68 +1056,91 @@ static void __devexit ace_teardown(struct ace_device *ace)iounmap(ace->baseaddr);}-/* ----------------------------------------------------------------------*PlatformBusSupport-*/--staticint__devinitace_probe(structplatform_device*dev)+staticint__devinit+ace_alloc(structdevice*dev,intid,unsignedlongphysaddr,+intirq,intbus_width){structace_device*ace;-inti;+intrc;+dev_dbg(dev,"ace_alloc(%p)\n",dev);-dev_dbg(&dev->dev,"ace_probe(%p)\n",dev);+if(!physaddr){+rc=-ENODEV;+gotoerr_noreg;+}-/*-*Allocatetheacedevicestructure-*/+/* Allocate and initialize the ace device structure */ace=kzalloc(sizeof(structace_device),GFP_KERNEL);-if(!ace)+if(!ace){+rc=-ENOMEM;gotoerr_alloc;--ace->dev=&dev->dev;-ace->id=dev->id;-ace->irq=NO_IRQ;--for(i=0;i<dev->num_resources;i++){-if(dev->resource[i].flags&IORESOURCE_MEM)-ace->physaddr=dev->resource[i].start;-if(dev->resource[i].flags&IORESOURCE_IRQ)-ace->irq=dev->resource[i].start;}-/* FIXME: Should get bus_width from the platform_device struct */-ace->bus_width=1;--platform_set_drvdata(dev,ace);+ace->dev=dev;+ace->id=id;+ace->physaddr=physaddr;+ace->irq=irq;+ace->bus_width=bus_width;-/* Call the bus-independant setup code */-if(ace_setup(ace)!=0)+/* Call the setup code */+if((rc=ace_setup(ace))!=0)gotoerr_setup;+dev_set_drvdata(dev,ace);return0;err_setup:-platform_set_drvdata(dev,NULL);+dev_set_drvdata(dev,NULL);kfree(ace);err_alloc:-printk(KERN_ERR"xsysace: could not initialize device\n");-return-ENOMEM;+err_noreg:+dev_err(dev,"could not initialize device, err=%i\n",rc);+returnrc;}-/*-*Platformbusremove()method-*/-staticint__devexitace_remove(structplatform_device*dev)+staticvoid__devexitace_free(structdevice*dev){-structace_device*ace=platform_get_drvdata(dev);-dev_dbg(&dev->dev,"ace_remove(%p)\n",dev);+structace_device*ace=dev_get_drvdata(dev);+dev_dbg(dev,"ace_free(%p)\n",dev);if(ace){ace_teardown(ace);-platform_set_drvdata(dev,NULL);+dev_set_drvdata(dev,NULL);kfree(ace);}+}++/* ---------------------------------------------------------------------+*PlatformBusSupport+*/++staticint__devinitace_probe(structplatform_device*dev)+{+unsignedlongphysaddr=0;+intbus_width=1;/* FIXME: should not be hard coded */+intid=dev->id;+intirq=NO_IRQ;+inti;++dev_dbg(&dev->dev,"ace_probe(%p)\n",dev);++for(i=0;i<dev->num_resources;i++){+if(dev->resource[i].flags&IORESOURCE_MEM)+physaddr=dev->resource[i].start;+if(dev->resource[i].flags&IORESOURCE_IRQ)+irq=dev->resource[i].start;+}++/* Call the bus-independant setup code */+returnace_alloc(&dev->dev,id,physaddr,irq,bus_width);+}+/*+*Platformbusremove()method+*/+staticint__devexitace_remove(structplatform_device*dev)+{+ace_free(&dev->dev);return0;}
@@ -982,7 +987,7 @@ static int __devinit ace_setup(struct ace_device *ace)snprintf(ace->gd->disk_name,32,"xs%c",ace->id+'a');/* set bus width */-if(ace->bus_width==1){+if(ace->bus_width==ACE_BUS_WIDTH_16){/* 0x0101 should work regardless of endianess */ace_out_le16(ace,ACE_BUSMODE,0x0101);
@@ -1117,7 +1122,7 @@ static void __devexit ace_free(struct device *dev)staticint__devinitace_probe(structplatform_device*dev){unsignedlongphysaddr=0;-intbus_width=1;/* FIXME: should not be hard coded */+intbus_width=ACE_BUS_WIDTH_16;/* FIXME: should not be hard coded */intid=dev->id;intirq=NO_IRQ;inti;
@@ -382,8 +387,10 @@ static int __init ulite_console_setup(struct console *co, char *options)port=&ulite_ports[co->index];/* not initialized yet? */-if(!port->membase)+if(!port->membase){+pr_debug("console on ttyUL%i not initialized\n",co->index);return-ENODEV;+}if(options)uart_parse_options(options,&baud,&parity,&bits,&flow);
@@ -542,6 +549,72 @@ static struct platform_driver ulite_platform_driver = {};/* ---------------------------------------------------------------------+*OFbusbindings+*/+#if defined(CONFIG_OF)+staticint__devinit+ulite_of_probe(structof_device*op,conststructof_device_id*match)+{+structresourceres;+constunsignedint*id;+intirq,rc;++dev_dbg(&op->dev,"%s(%p, %p)\n",__FUNCTION__,op,match);++rc=of_address_to_resource(op->node,0,&res);+if(rc){+dev_err(&op->dev,"invalide address\n");+returnrc;+}++irq=irq_of_parse_and_map(op->node,0);++id=of_get_property(op->node,"port-number",NULL);++returnulite_assign(&op->dev,id?*id:-1,res.start,irq);+}++staticintulite_of_remove(structof_device*op)+{+returnulite_release(&op->dev);+}++/* Match table for of_platform binding */+staticstructof_device_id__devinitulite_of_match[]={+{.type="serial",.compatible="xilinx,uartlite",},+{},+};+MODULE_DEVICE_TABLE(of,ulite_of_match);++staticstructof_platform_driverulite_of_driver={+.owner=THIS_MODULE,+.name="uartlite",+.match_table=ulite_of_match,+.probe=ulite_of_probe,+.remove=ulite_of_remove,+.driver={+.name="uartlite",+},+};++/* Registration helpers to keep the number of #ifdefs to a minimum */+staticinlineint__initulite_of_register(void)+{+pr_debug("uartlite: calling of_register_platform_driver()\n");+returnof_register_platform_driver(&ulite_of_driver);+}++staticinlinevoid__initulite_of_unregister(void)+{+of_unregister_platform_driver(&ulite_of_driver);+}+#else /* CONFIG_OF */+/* CONFIG_OF not enabled; do nothing helpers */+staticinlineint__initulite_of_register(void){return0;}+staticinlinevoid__initulite_of_unregister(void){}+#endif /* CONFIG_OF */++/* ---------------------------------------------------------------------*Modulesetup/teardown*/
From: Grant Likely <hidden> Date: 2007-09-28 18:19:21
From: Grant Likely <redacted>
The FSM needs to be initialized before it is safe to call the ISR
Signed-off-by: Grant Likely <redacted>
---
drivers/block/xsysace.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
@@ -949,15 +949,6 @@ static int __devinit ace_setup(struct ace_device *ace)if(!ace->baseaddr)gotoerr_ioremap;-if(ace->irq!=NO_IRQ){-rc=request_irq(ace->irq,ace_interrupt,0,"systemace",ace);-if(rc){-/* Failure - fall back to polled mode */-dev_err(ace->dev,"request_irq failed\n");-ace->irq=NO_IRQ;-}-}-/**Initializethestatemachinetaskletandstalltimer*/
@@ -1015,6 +1006,16 @@ static int __devinit ace_setup(struct ace_device *ace)val|=ACE_CTRL_DATABUFRDYIRQ|ACE_CTRL_ERRORIRQ;ace_out(ace,ACE_CTRL,val);+/* Now we can hook up the irq handler */+if(ace->irq!=NO_IRQ){+rc=request_irq(ace->irq,ace_interrupt,0,"systemace",ace);+if(rc){+/* Failure - fall back to polled mode */+dev_err(ace->dev,"request_irq failed\n");+ace->irq=NO_IRQ;+}+}+/* Print the identification */dev_info(ace->dev,"Xilinx SystemACE revision %i.%i.%i\n",(version>>12)&0xf,(version>>8)&0x0f,version&0xff);
@@ -1035,8 +1036,6 @@ static int __devinit ace_setup(struct ace_device *ace)blk_cleanup_queue(ace->queue);err_blk_initq:iounmap(ace->baseaddr);-if(ace->irq!=NO_IRQ)-free_irq(ace->irq,ace);err_ioremap:dev_info(ace->dev,"xsysace: error initializing device at 0x%lx\n",ace->physaddr);
From: Grant Likely <hidden> Date: 2007-09-28 18:19:23
From: Grant Likely <redacted>
SystemACE uses the platform bus binding, but it doesn't use the
platform bus API. Move to using the correct API for consistency
sake.
Signed-off-by: Grant Likely <redacted>
---
drivers/block/xsysace.c | 48 +++++++++++++++++++++++++++++------------------
1 files changed, 30 insertions(+), 18 deletions(-)
@@ -1075,7 +1074,7 @@ static int __devinit ace_probe(struct device *device)if(!ace)gotoerr_alloc;-ace->dev=device;+ace->dev=&dev->dev;ace->id=dev->id;ace->irq=NO_IRQ;
@@ -1089,7 +1088,7 @@ static int __devinit ace_probe(struct device *device)/* FIXME: Should get bus_width from the platform_device struct */ace->bus_width=1;-dev_set_drvdata(&dev->dev,ace);+platform_set_drvdata(dev,ace);/* Call the bus-independant setup code */if(ace_setup(ace)!=0)
@@ -1098,7 +1097,7 @@ static int __devinit ace_probe(struct device *device)return0;err_setup:-dev_set_drvdata(&dev->dev,NULL);+platform_set_drvdata(dev,NULL);kfree(ace);err_alloc:printk(KERN_ERR"xsysace: could not initialize device\n");
@@ -61,13 +61,14 @@ config WALNUThelpThisoptionenablessupportfortheIBMPPC405GPevaluationboard.-#config XILINX_ML300-# bool "Xilinx-ML300"-# depends on 40x-# default y-# select VIRTEX_II_PRO-# help-# This option enables support for the Xilinx ML300 evaluation board.+configXILINX_VIRTEX_GENERIC_BOARD+bool"Generic Xilinx Virtex board"+depends on40x+defaulty+selectVIRTEX_II_PRO+selectVIRTEX_4_FX+help+ThisoptionenablesgenericsupportforXilinxVirtexbasedboards.
I don't think we want default y here.
I just followed the lead of Walnut here. Perhaps for the embedded
targets all of them should be 'default n'. Josh, thoughts?
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
Shouldn't this be inline? It shouldn't matter much since most of the time
gcc -funit-at-a-time takes care of this, but it's common to make the inlining
explicit.
Arnd <><
Shouldn't this be inline? It shouldn't matter much since most of the time
gcc -funit-at-a-time takes care of this, but it's common to make the inlining
explicit.
heh, I even had the inline in there on an earlier version of the
patch. I can add it back it.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
This is a rather unusual style of commenting. IMHO it would be better if you
left out the ----- line.
I find the horizontal breaks useful when parsing through the code. If
others agree with you, then I'll happily remove them.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
When coding a spin-loop, it's better to do a cpu_relax() between
each attempt.
Is cpu_relax even implemented in the bootwrapper?
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
The defines are fairly generic, I guess you haven't ran across cases
where there's naming conflicts, but you might want to prefix them with
something more unique just in case.
I guess some of the above are open-coded instead of using virq_to_hw()
for performance reasons, it could be useful to have comments regarding
this so they aren't changed by some janitor down the road. Or, in case
they're not performance-critical, change them to use virq_to_hw.
-Olof
@@ -61,13 +61,14 @@ config WALNUThelpThisoptionenablessupportfortheIBMPPC405GPevaluationboard.-#config XILINX_ML300-# bool "Xilinx-ML300"-# depends on 40x-# default y-# select VIRTEX_II_PRO-# help-# This option enables support for the Xilinx ML300 evaluation board.+configXILINX_VIRTEX_GENERIC_BOARD+bool"Generic Xilinx Virtex board"+depends on40x+defaulty+selectVIRTEX_II_PRO+selectVIRTEX_4_FX+help+ThisoptionenablesgenericsupportforXilinxVirtexbasedboards.
I would appreciate a bit verboser help text here, i.e. including what
boards are considered generic. Maybe something like "...including ML403,
<x>, <y>, and other 4FX/IIPro-based boards"?
-Olof
The defines are fairly generic, I guess you haven't ran across cases
where there's naming conflicts, but you might want to prefix them with
something more unique just in case.
I guess some of the above are open-coded instead of using virq_to_hw()
for performance reasons, it could be useful to have comments regarding
this so they aren't changed by some janitor down the road. Or, in case
they're not performance-critical, change them to use virq_to_hw.
Or it was just that my example code from another driver wasn't using
virq_to_hw() either. I'll fix this.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
@@ -61,7 +61,7 @@ static int ulite_receive(struct uart_port *port, int stat)/* stats */if(stat&ULITE_STATUS_RXVALID){port->icount.rx++;-ch=readb(port->membase+ULITE_RX);+ch=in_be32((void*)port->membase+ULITE_RX);
Hmm, I see the start changed, and you're now reading/writing a full
32-bit word instead of individual bytes. Still, looks a little fishy to
me. Wouldn't it be more appropriate to change the ULITE_RX offset to be
3 higher and still read/write bytes?
Or are the registers defined as 32-bit ones? (I don't remember, it was
so long since I touched uartlite myself. :-)
(Same for the other functions below, but the general principle applies.)
Also, I'm not sure you need to cast port->membase to void*, do you? The
math will still be right since it's declared as char *.
-Olof
@@ -61,13 +61,14 @@ config WALNUThelpThisoptionenablessupportfortheIBMPPC405GPevaluationboard.-#config XILINX_ML300-# bool "Xilinx-ML300"-# depends on 40x-# default y-# select VIRTEX_II_PRO-# help-# This option enables support for the Xilinx ML300 evaluation board.+configXILINX_VIRTEX_GENERIC_BOARD+bool"Generic Xilinx Virtex board"+depends on40x+defaulty+selectVIRTEX_II_PRO+selectVIRTEX_4_FX+help+ThisoptionenablesgenericsupportforXilinxVirtexbasedboards.
I would appreciate a bit verboser help text here, i.e. including what
boards are considered generic. Maybe something like "...including ML403,
<x>, <y>, and other 4FX/IIPro-based boards"?
Done.
This option enables generic support for Xilinx Virtex based boards.
+ The generic virtex board support matches any device tree which
+ specifies 'xilinx,virtex' in its compatible field. This includes
+ the Xilinx ML3xx and ML4xx reference designs using the powerpc
+ core.
+
+ Most Virtex designs should use this unless it needs to do some
+ special configuration at board probe time.
+
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
@@ -61,7 +61,7 @@ static int ulite_receive(struct uart_port *port, int stat)/* stats */if(stat&ULITE_STATUS_RXVALID){port->icount.rx++;-ch=readb(port->membase+ULITE_RX);+ch=in_be32((void*)port->membase+ULITE_RX);
Hmm, I see the start changed, and you're now reading/writing a full
32-bit word instead of individual bytes. Still, looks a little fishy to
me. Wouldn't it be more appropriate to change the ULITE_RX offset to be
3 higher and still read/write bytes?
Or are the registers defined as 32-bit ones? (I don't remember, it was
so long since I touched uartlite myself. :-)
All the registers are defined as 32 bit ones. I think it makes more
sense to access the registers as they are documented, and it
eliminates the 'magic' +3 needed to make it work now.
(Same for the other functions below, but the general principle applies.)
Also, I'm not sure you need to cast port->membase to void*, do you? The
math will still be right since it's declared as char *.
membase is now defined as u32*, so the cast is needed.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Olof Johansson <hidden> Date: 2007-09-28 20:44:22
On Fri, Sep 28, 2007 at 02:42:32PM -0600, Grant Likely wrote:
On 9/28/07, Olof Johansson [off-list ref] wrote:
quoted
Hmm, I see the start changed, and you're now reading/writing a full
32-bit word instead of individual bytes. Still, looks a little fishy to
me. Wouldn't it be more appropriate to change the ULITE_RX offset to be
3 higher and still read/write bytes?
Or are the registers defined as 32-bit ones? (I don't remember, it was
so long since I touched uartlite myself. :-)
All the registers are defined as 32 bit ones. I think it makes more
sense to access the registers as they are documented, and it
eliminates the 'magic' +3 needed to make it work now.
Ok, thaks for the clarification. Feel free to add it as motivation in
the patch description. :)
quoted
(Same for the other functions below, but the general principle applies.)
Also, I'm not sure you need to cast port->membase to void*, do you? The
math will still be right since it's declared as char *.
membase is now defined as u32*, so the cast is needed.
Hm, I must have looked at a stale tree.
Thanks,
-Olof
From: Grant Likely <hidden> Date: 2007-09-28 20:50:32
On 9/28/07, Olof Johansson [off-list ref] wrote:
On Fri, Sep 28, 2007 at 02:42:32PM -0600, Grant Likely wrote:
quoted
On 9/28/07, Olof Johansson [off-list ref] wrote:
quoted
Also, I'm not sure you need to cast port->membase to void*, do you? The
math will still be right since it's declared as char *.
membase is now defined as u32*, so the cast is needed.
Hm, I must have looked at a stale tree.
No, wait. You're right. It is a char*. I'll drop the cast.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Grant Likely <hidden> Date: 2007-09-28 20:53:11
On 9/28/07, Grant Likely [off-list ref] wrote:
On 9/28/07, Olof Johansson [off-list ref] wrote:
quoted
On Fri, Sep 28, 2007 at 02:42:32PM -0600, Grant Likely wrote:
quoted
On 9/28/07, Olof Johansson [off-list ref] wrote:
quoted
Also, I'm not sure you need to cast port->membase to void*, do you? The
math will still be right since it's declared as char *.
membase is now defined as u32*, so the cast is needed.
Hm, I must have looked at a stale tree.
No, wait. You're right. It is a char*. I'll drop the cast.
Wait, I'm wrong again... it's in/out_be32 that expects an (unsigned*).
The compiler complains without the cast.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Peter Korsgaard <jacmet@sunsite.dk> Date: 2007-10-02 15:24:32
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Grant> From: Grant Likely [off-list ref]
Grant> Signed-off-by: Grant Likely [off-list ref]
Fine by me.
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
--
Bye, Peter Korsgaard
From: Peter Korsgaard <jacmet@sunsite.dk> Date: 2007-10-02 15:27:38
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Grant> From: Grant Likely [off-list ref]
Grant> Changed to match naming convention used in the rest of the module
Ok.
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
--
Bye, Peter Korsgaard
From: Grant Likely <hidden> Date: 2007-10-02 15:34:17
On 10/2/07, Peter Korsgaard [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Hi,
Grant> From: Grant Likely [off-list ref]
Grant> Changed to make the OF bus binding a wee bit cleaner
Grant> Signed-off-by: Grant Likely [off-list ref]
Grant> ---
Grant> arch/powerpc/platforms/40x/Kconfig | 4 ++--
Grant> drivers/serial/uartlite.c | 5 +++--
Grant> 2 files changed, 5 insertions(+), 4 deletions(-)
Grant> diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
Grant> index 1aae0e6..44f08dd 100644
Grant> --- a/arch/powerpc/platforms/40x/Kconfig
Grant> +++ b/arch/powerpc/platforms/40x/Kconfig
Grant> @@ -65,8 +65,8 @@ config XILINX_VIRTEX_GENERIC_BOARD
Grant> bool "Generic Xilinx Virtex board"
Grant> depends on 40x
Grant> default y
Grant> - select VIRTEX_II_PRO
Grant> - select VIRTEX_4_FX
Grant> + select XILINX_VIRTEX_II_PRO
Grant> + select XILINX_VIRTEX_4_FX
Huh? What does this have to do with $SUBJ?
This was a mess up on my part on this version of the patch set. v3
has it fixed.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Grant Likely <hidden> Date: 2007-10-02 15:54:36
On 10/2/07, Peter Korsgaard [off-list ref] wrote:
The uartlite driver is ofcause primarily used to drive Xilinx
OPB_Uartlite IP blocks, but that's not the only use - E.G. we are
using another simple UART with the same hardware interface but sitting
on a 16bit bus. With the current driver this works fine, but won't
with the out_be32.
Ugh. Alright I'll revert the patch.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Grant Likely <hidden> Date: 2007-10-02 15:56:33
On 10/2/07, Peter Korsgaard [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Grant> + pr_debug("uartlite: calling platform_driver_register()\n");
Grant> + if ((ret = platform_driver_register(&ulite_platform_driver)) != 0)
I prefer to not have assignments in the if ().
Already fixed in v3
Are all the pr_debug necessary? It looks quite messy.
Maybe messy, but *very* useful. Looks prettier in the v3 version with
the assignment and if() on separate lines.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Peter Korsgaard <jacmet@sunsite.dk> Date: 2007-10-02 16:02:06
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Hi,
Grant> On 10/2/07, Peter Korsgaard [off-list ref] wrote:
>> >>>>> "Grant" == Grant Likely [off-list ref] writes:
Grant> + pr_debug("uartlite: calling platform_driver_register()\n");
Grant> + if ((ret = platform_driver_register(&ulite_platform_driver)) != 0)
>>
>> I prefer to not have assignments in the if ().
Grant> Already fixed in v3
Ok, thanks.
>> Are all the pr_debug necessary? It looks quite messy.
Grant> Maybe messy, but *very* useful. Looks prettier in the v3 version with
Grant> the assignment and if() on separate lines.
Ok, I'll take a look (sorry, I'm behind on mails..)
--
Bye, Peter Korsgaard