Xilinx: updated device tree compatibility to match uboot bsp generator.
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-1-git-send-email-stephen.neuendorffer@xilinx.com
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-2-git-send-email-stephen.neuendorffer@xilinx.com
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-3-git-send-email-stephen.neuendorffer@xilinx.com
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-4-git-send-email-stephen.neuendorffer@xilinx.com
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-5-git-send-email-stephen.neuendorffer@xilinx.com
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-6-git-send-email-stephen.neuendorffer@xilinx.com
PATCH 6/7 Xilinx: updated device tree compatibility to match uboot bsp generator.
Missed this one in the boot loader before.
--- arch/powerpc/boot/serial.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/powerpc/boot/serial.c +2 -1
@@ -128,7 +128,8 @@ int serial_console_init(void) rc =cpm_console_init (devp, &serial_cd); else if (dt_is_compatible(devp, "mpc5200-psc-uart")) rc =mpc5200_psc_console_init (devp, &serial_cd); - else if (dt_is_compatible(devp, "xilinx,uartlite")) + else if (dt_is_compatible(devp, "xlnx,opb-uartlite-1.00.b") || + dt_is_compatible(devp, "xlnx,xps-uartlite-1.00.a")) rc =uartlite_console_init (devp, &serial_cd);/* Add other serial console driver calls here */
Signature · 1 line
1.5.3.4-dirty
A message that is not in the archive (sent off-list or not yet received): 1199820909-32341-7-git-send-email-stephen.neuendorffer@xilinx.com
PATCH 7/7 Xilinx: Uartlite: Section type fixups
All the __devexit functions are now appropriately tagged. This fixes some ppc link warnings.
--- drivers/serial/uartlite.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/uartlite.c +2 -2
@@ -594,7 +594,7 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)* * @dev: pointer to device structure */ -static int __devinit ulite_release (struct device *dev) +static int __devexit ulite_release(struct device *dev) {struct uart_port *port =dev_get_drvdata (dev);int rc =0 ;
@@ -627,7 +627,7 @@ static int __devinit ulite_probe(struct platform_device *pdev)return ulite_assign (&pdev->dev, pdev->id, res->start, res2->start); } -static int ulite_remove (struct platform_device *pdev) +static int __devexit ulite_remove(struct platform_device *pdev) {return ulite_release (&pdev->dev); }
Signature · 1 line
1.5.3.4-dirty
Re: [PATCH 7/7] [POWERPC] Xilinx: Uartlite: Section type fixups
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stephen" == Stephen Neuendorffer <[email protected]> writes:
Stephen> All the __devexit functions are now appropriately tagged. This fixes Stephen> some ppc link warnings.
You forgot to add __devexit_p(ulite_remove) in ulite_platform_driver, otherwise:
Stephen> Signed-off-by: Stephen Neuendorffer <[email protected]> Stephen> ---
Stephen> drivers/serial/uartlite.c | 4 ++--
Stephen> 1 files changed, 2 insertions(+), 2 deletions(-)
Stephen> diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
Stephen> index 02c2d89..ecd5540 100644
Stephen> --- a/drivers/serial/uartlite.c
Stephen> +++ b/drivers/serial/uartlite.c
Stephen> @@ -594,7 +594,7 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)
Stephen> *
Stephen> * @dev: pointer to device structure
Stephen> */
Stephen> -static int __devinit ulite_release(struct device *dev)
Stephen> +static int __devexit ulite_release(struct device *dev)
Stephen> {
Stephen> struct uart_port *port = dev_get_drvdata(dev);
Stephen> int rc = 0; Stephen> @@ -627,7 +627,7 @@ static int __devinit ulite_probe(struct platform_device *pdev)
Stephen> return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start);
Stephen> }
Stephen> -static int ulite_remove(struct platform_device *pdev) Stephen> +static int __devexit ulite_remove(struct platform_device *pdev)
Stephen> {
Stephen> return ulite_release(&pdev->dev);
Stephen> } Stephen> --
Stephen> 1.5.3.4-dirty
Stephen> _______________________________________________ Stephen> Linuxppc-dev mailing list
Stephen> [email protected]
Stephen> https://ozlabs.org/mailman/listinfo/linuxppc-dev
Signature · 1 line
Bye, Peter Korsgaard
PATCH 5/7 Xilinx: Update booting-without-of.
In reply to a message not in the archiveThis now better describes what the UBoot device tree generator actually does. In particular:
1) Nodes have a label derived from the device name, and a node name derived from a generic version of the device type, e.g. 'ethernet', 'serial', etc.
2) Usage of compound nodes (representing more than one device in the same IP) which actually works. This requires having a valid compatible node, and all the other things that a bus normally has. I've chosen 'xlnx,compound' as the bus name to describe these compound nodes.
In addition, I've clarified some of the language relating to how mhs nodes should be represent in the device tree.
--- Documentation/powerpc/booting-without-of.txt | 56 +++++++++++++++----------- 1 files changed, 33 insertions(+), 23 deletions(-)
Documentation/powerpc/booting-without-of.txt +33 -23
@@ -2276,7 +2276,7 @@ platforms are moved over to use the flattened-device-tree model. properties of the device node. In general, device nodes for IP-cores will take the following form: - (name)@(base-address) { + (name): (generic-name)@(base-address) { compatible = "xlnx,(ip-core-name)-(HW_VER)" [, (list of compatible devices), ...]; reg = <(baseaddr) (size)>;
@@ -2286,6 +2286,9 @@ platforms are moved over to use the flattened-device-tree model. xlnx,(parameter2) = <(int-value)>; }; + (generic-name): an open firmware-style name that describes the + generic class of device. Preferably, this is one word, such + as 'serial' or 'ethernet'. (ip-core-name): the name of the ip block (given after the BEGIN directive in system.mhs). Should be in lowercase and all underscores '_' converted to dashes '-'.
@@ -2294,9 +2297,9 @@ platforms are moved over to use the flattened-device-tree model. dropped from the parameter name, the name is converted to lowercase and all underscore '_' characters are converted to dashes '-'. - (baseaddr): the C_BASEADDR parameter. + (baseaddr): the baseaddr parameter value (often named C_BASEADDR). (HW_VER): from the HW_VER parameter. - (size): equals C_HIGHADDR - C_BASEADDR + 1 + (size): the address range size (often C_HIGHADDR - C_BASEADDR + 1). Typically, the compatible list will include the exact IP core version followed by an older IP core version which implements the same
@@ -2326,11 +2329,11 @@ platforms are moved over to use the flattened-device-tree model. becomes the following device tree node: - opb-uartlite-0@ec100000 { + opb_uartlite_0: serial@ec100000 { device_type = "serial"; compatible = "xlnx,opb-uartlite-1.00.b"; reg = <ec100000 10000>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <1 0>; // got this from the opb_intc parameters current-speed = <d#115200>; // standard serial device prop clock-frequency = <d#50000000>; // standard serial device prop
@@ -2339,16 +2342,19 @@ platforms are moved over to use the flattened-device-tree model. xlnx,use-parity = <0>; }; - Some IP cores actually implement 2 or more logical devices. In this case, - the device should still describe the whole IP core with a single node - and add a child node for each logical device. The ranges property can - be used to translate from parent IP-core to the registers of each device. - (Note: this makes the assumption that both logical devices have the same - bus binding. If this is not true, then separate nodes should be used for - each logical device). The 'cell-index' property can be used to enumerate - logical devices within an IP core. For example, the following is the - system.mhs entry for the dual ps2 controller found on the ml403 reference - design. + Some IP cores actually implement 2 or more logical devices. In + this case, the device should still describe the whole IP core with + a single node and add a child node for each logical device. The + ranges property can be used to translate from parent IP-core to the + registers of each device. In addition, the parent node should be + compatible with the bus type 'xlnx,compound', and should contain + #address-cells and #size-cells, as with any other bus. (Note: this + makes the assumption that both logical devices have the same bus + binding. If this is not true, then separate nodes should be used + for each logical device). The 'cell-index' property can be used to + enumerate logical devices within an IP core. For example, the + following is the system.mhs entry for the dual ps2 controller found + on the ml403 reference design. BEGIN opb_ps2_dual_ref PARAMETER INSTANCE = opb_ps2_dual_ref_0
@@ -2370,21 +2376,24 @@ platforms are moved over to use the flattened-device-tree model. It would result in the following device tree nodes: - opb_ps2_dual_ref_0@a9000000 { + opb_ps2_dual_ref_0: opb-ps2-dual-ref@a9000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "xlnx,compound"; ranges = <0 a9000000 2000>; // If this device had extra parameters, then they would // go here. ps2@0 { compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <0 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; }; ps2@1000 { compatible = "xlnx,opb-ps2-dual-ref-1.00.a"; reg = <1000 40>; - interrupt-parent = <&opb-intc>; + interrupt-parent = <&opb_intc_0>; interrupts = <3 0>; cell-index = <0>; };
@@ -2447,17 +2456,18 @@ platforms are moved over to use the flattened-device-tree model. Gives this device tree (some properties removed for clarity): - plb-v34-0 { + plb@0 { #address-cells = <1>; #size-cells = <1>; + compatible = "xlnx,plb-v34-1.02.a"; device_type = "ibm,plb"; ranges; // 1:1 translation - plb-bram-if-cntrl-0@ffff0000 { + plb_bram_if_cntrl_0: bram@ffff0000 { reg = <ffff0000 10000>; } - opb-v20-0 { + opb@20000000 { #address-cells = <1>; #size-cells = <1>; ranges = <20000000 20000000 20000000
@@ -2465,11 +2475,11 @@ platforms are moved over to use the flattened-device-tree model. 80000000 80000000 40000000 c0000000 c0000000 20000000>; - opb-uart16550-0@a0000000 { + opb_uart16550_0: serial@a0000000 { reg = <a00000000 2000>; }; - opb-intc-0@d1000fc0 { + opb_intc_0: interrupt-controller@d1000fc0 { reg = <d1000fc0 20>; }; };
Signature · 1 line
1.5.3.4-dirty
PATCH 4/7 Xilinx: Add correct compatible list for device tree bus bindings.
In reply to a message not in the archiveIncludes both flavors of plb, opb, dcr, and a pseudo 'compound' bus for representing compound peripherals containing more than one logical device.
--- arch/powerpc/platforms/40x/virtex.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
arch/powerpc/platforms/40x/virtex.c +11 -1
@@ -15,12 +15,22 @@#include <asm/time.h> #include <asm/xilinx_intc.h> +static struct of_device_id xilinx_of_bus_ids[] = { + { .compatible ="xlnx,plb-v46-1.00.a" , }, + { .compatible ="xlnx,plb-v34-1.01.a" , }, + { .compatible ="xlnx,plb-v34-1.02.a" , }, + { .compatible ="xlnx,opb-v20-1.10.c" , }, + { .compatible ="xlnx,dcr-v29-1.00.a" , }, + { .compatible ="xlnx,compound" , }, + {}, +}; +static int __init virtex_device_probe (void ) {if (!machine_is (virtex))return 0 ; -of_platform_bus_probe (NULL ,NULL ,NULL ); +of_platform_bus_probe (NULL , xilinx_of_bus_ids,NULL );return 0 ; }
Signature · 1 line
1.5.3.4-dirty
Re: [PATCH 4/7] [POWERPC] Xilinx: Add correct compatible list for device tree bus bindings.
Hi Stephen,
Quoted 2 lines · On Tue, 8 Jan 2008 11:35:06 -0800 Stephen Neuendorffer…
+static struct
of_device_idxilinx_of_bus_ids[] = {
Should be __initdata.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
PATCH 3/7 Xilinx: Update compatible to use values generated by BSP generator.
In reply to a message not in the archiveMainly, this involves two changes:
1) xilinx->xlnx (recognized standard is to use the stock ticker)
2) In order to have the device tree focus on describing what the hardware is as exactly as possible, the compatible strings contain the full IP name and IP version.
--- arch/powerpc/platforms/40x/virtex.c | 2 +- drivers/block/xsysace.c | 4 ++- drivers/serial/uartlite.c | 43 ++++++++++++++++++++++------------- drivers/video/xilinxfb.c | 2 +- 4 files changed, 32 insertions(+), 19 deletions(-)
arch/powerpc/platforms/40x/virtex.c +1 -1
@@ -30,7 +30,7 @@ static int __init virtex_probe(void) {unsigned long root =of_get_flat_dt_root (); -if (!of_flat_dt_is_compatible (root,"xilinx,virtex" )) +if (!of_flat_dt_is_compatible (root,"xlnx,virtex" ))return 0 ;return 1 ;
drivers/block/xsysace.c +3 -1
@@ -1208,7 +1208,9 @@ static int __devexit ace_of_remove(struct of_device *op)/* Match table for of_platform binding */ static struct of_device_id __devinit ace_of_match[] = { - { .compatible ="xilinx,xsysace" , }, + { .compatible ="xlnx,opb-sysace-1.00.b" , }, + { .compatible ="xlnx,opb-sysace-1.00.c" , }, + { .compatible ="xlnx,xps-sysace-1.00.a" , }, {}, };MODULE_DEVICE_TABLE (of, ace_of_match);
drivers/serial/uartlite.c +27 -16
68 lines not on this page · raw message
drivers/video/xilinxfb.c +1 -1
@@ -460,7 +460,7 @@ static int __devexit xilinxfb_of_remove(struct of_device *op)/* Match table for of_platform binding */ static struct of_device_id __devinit xilinxfb_of_match[] = { - { .compatible ="xilinx,ml300-fb" , }, + { .compatible ="xlnx,plb-tft-cntlr-ref-1.00.a" , }, {}, };MODULE_DEVICE_TABLE (of, xilinxfb_of_match);
Signature · 1 line
1.5.3.4-dirty
PATCH 2/7 Xilinx: update compatible list for interrupt controller
In reply to a message not in the archiveThese values now match what is generated by the uboot BSP generator.
--- arch/powerpc/sysdev/xilinx_intc.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/powerpc/sysdev/xilinx_intc.c +7 -1
@@ -135,10 +135,16 @@ void __init xilinx_intc_init_tree(void)struct device_node *np;/* find top level interrupt controller */ -for_each_compatible_node (np,NULL ,"xilinx,intc" ) { +for_each_compatible_node (np,NULL ,"xlnx,opb-intc-1.00.c" ) {if (!of_get_property (np,"interrupts" ,NULL ))break ; } +if (!np) { +for_each_compatible_node (np,NULL ,"xlnx,xps-intc-1.00.a" ) { +if (!of_get_property (np,"interrupts" ,NULL )) +break ; + } + }/* xilinx interrupt controller needs to be top level */ BUG_ON (!np);
Signature · 1 line
1.5.3.4-dirty
PATCH 1/7 Xilinx: Uartlite: Make console output actually work.
In reply to a message not in the archiveFrom: Grant Likely <[email protected]>
Fixed to apply against 2.6.24-rc5, and remove DEBUG information.
--- drivers/serial/uartlite.c | 121 +++++++++++++++++++++++++++++---------------- 1 files changed, 79 insertions(+), 42 deletions(-)
drivers/serial/uartlite.c +79 -42
@@ -9,6 +9,8 @@* kind, whether express or implied. */ +#undef DEBUG +#include <linux/platform_device.h> #include <linux/module.h> #include <linux/console.h>
@@ -321,6 +323,49 @@ static struct uart_ops ulite_ops = { .verify_port = ulite_verify_port }; +/** +* ulite_get_port: Get the uart_port for a given port number and base addr +*/ +static struct uart_port *ulite_get_port (int id) +{ +struct uart_port *port; + +/* 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 )) { +printk (KERN_WARNING "uartlite: invalid id: %i\n" , id); +return NULL ; + } + +/* The ID is valid, so get the address of the uart_port structure */ + port = &ulite_ports[id]; + +/* Is the structure is already initialized? */ +if (port->mapbase) +return port; + +/* At this point, we've got an empty uart_port struct, initialize it */ +spin_lock_init (&port->lock); + port->membase =NULL ; + port->fifosize =16 ; + port->regshift =2 ; + port->iotype =UPIO_MEM ; + port->iobase =1 ;/* mark port in use */ + port->ops = &ulite_ops; + port->irq =NO_IRQ ; + port->flags =UPF_BOOT_AUTOCONF ; + port->dev =NULL ; + port->type =PORT_UNKNOWN ; + port->line = id; + +return port; +} +/* --------------------------------------------------------------------- * Console driver operations */
@@ -376,7 +421,7 @@ static void ulite_console_write(struct console *co, const char *s, }#if defined(CONFIG_OF ) -static inline void __init ulite_console_of_find_device (int id) +static inline u32 __init ulite_console_of_find_device (int id) {struct device_node *np;struct resource res;
@@ -392,13 +437,14 @@ static inline void __init ulite_console_of_find_device(int id)if (rc)continue ; - ulite_ports[id].mapbase = res.start;of_node_put (np); - return; + return res.start+3; } + +return 0 ; }#else /* CONFIG_OF */ -static inline void __init ulite_console_of_find_device (int id) {/* do nothing */ } +static inline u32 __init ulite_console_of_find_device (int id) {return 0 ; }#endif /* CONFIG_OF */ static int __init ulite_console_setup (struct console *co,char *options)
@@ -408,25 +454,33 @@ static int __init ulite_console_setup(struct console *co, char *options)int bits =8 ;int parity ='n' ;int flow ='n' ; +u32 base; -if (co->index <0 || co->index >=ULITE_NR_UARTS ) -return -EINVAL ; +/* Find a matching uart port in the device tree */ + base =ulite_console_of_find_device (co->index); - port = &ulite_ports[co->index]; +/* Get the port structure */ + port =ulite_get_port (co->index); +if (!port) +return -ENODEV ; -/* Check if it is an OF device */ -if (!port->mapbase) -ulite_console_of_find_device (co->index); +/* was it initialized for this device? */ +if (base) { +if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ;/* port used by another device; bail */ + } + port->mapbase = base; + } -/* Do we have a device now? */ -if (!port->mapbase) { -pr_debug ("console on ttyUL%i not present\n" , co->index); +if (!port->mapbase)return -ENODEV ; - } -/* not initialized yet? */ +/* registers mapped yet? */ if (!port->membase) { -if (ulite_request_port (port)) + port->membase =ioremap (port->mapbase,ULITE_REGION ); +if (!port->membase)return -ENODEV ; }
@@ -488,39 +542,22 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)struct uart_port *port;int rc; -/* 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 ; + port =ulite_get_port (id); +if (!port) { +dev_err (dev,"Cannot get uart_port structure\n" ); +return -ENODEV ; } -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 ; +/* was it initialized for this device? */ +if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ; } - port = &ulite_ports[id]; - -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 */
Signature · 1 line
1.5.3.4-dirty
Re: [PATCH 1/7] [POWERPC] Xilinx: Uartlite: Make console output actually work.
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stephen" == Stephen Neuendorffer <[email protected]> writes:
From: Grant Likely <[email protected]>
Signed-off-by Grant Likely <[email protected]>Fixed to apply against 2.6.24-rc5, and remove DEBUG information.
Please CC me and the linux-serial list on uartlite patches.
The subject seems to be wrong, as console output works ok here (non-OF). Perhaps change to uartlite: fix OF console setup ?
Quoted 10 lines
Signed-off-by Stephen Neuendorffer <[email protected]>--- drivers/serial/uartlite.c | 121 +++++++++++++++++++++++++++++---------------- 1 files changed, 79 insertions(+), 42 deletions(-)drivers/serial/uartlite.c +0
-0
drivers/serial/uartlite.c line 13
Quoted 5 lines
drivers/serial/uartlite.c +2
-0@@ -9,6 +9,8 @@* kind, whether express or implied. */ +#undef DEBUG +
Don't do that! What are you trying to do?
Quoted 13 lines
drivers/serial/uartlite.c +6
-0#include <linux/platform_device.h> #include <linux/module.h> #include <linux/console.h> @@ -321,6 +323,49 @@ static struct uart_ops ulite_ops = { .verify_port = ulite_verify_port }; +/** +* ulite_get_port: Get the uart_port for a given port number and base addr +*/ +static struct uart_port *ulite_get_port (int id) +{ +struct uart_port *port;
drivers/serial/uartlite.c static struct uart_ops ulite_ops = { · line 341
Quoted 10 lines
drivers/serial/uartlite.c +10
-0+ +/* 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 )) { +printk (KERN_WARNING "uartlite: invalid id: %i\n" , id);
pr_warn
Quoted 13 lines
drivers/serial/uartlite.c +13
-0+return NULL ; + } + +/* The ID is valid, so get the address of the uart_port structure */ + port = &ulite_ports[id]; + +/* Is the structure is already initialized? */ +if (port->mapbase) +return port; + +/* At this point, we've got an empty uart_port struct, initialize it */ +spin_lock_init (&port->lock); + port->membase =NULL ;
drivers/serial/uartlite.c static struct uart_ops ulite_ops = { · line 364
Quoted 10 lines
drivers/serial/uartlite.c +10
-0+ port->fifosize =16 ; + port->regshift =2 ; + port->iotype =UPIO_MEM ; + port->iobase =1 ;/* mark port in use */ + port->ops = &ulite_ops; + port->irq =NO_IRQ ; + port->flags =UPF_BOOT_AUTOCONF ; + port->dev =NULL ; + port->type =PORT_UNKNOWN ; + port->line = id;
Please put the above in a conditional istead of 2 returns, E.G.
if (!port->mapbase) {
spin_lock_init ..
drivers/serial/uartlite.c static void ulite_console_write(struct console *co, const char *s, · line 424
Quoted 13 lines
drivers/serial/uartlite.c +5
-1+ +return port; +} +/* --------------------------------------------------------------------- * Console driver operations */ @@ -376,7 +421,7 @@ static void ulite_console_write(struct console *co, const char *s, }#if defined(CONFIG_OF ) -static inline void __init ulite_console_of_find_device (int id) +static inline u32 __init ulite_console_of_find_device (int id)
resource_size_t?
drivers/serial/uartlite.c static inline void __init ulite_console_of_find_device(int id) · line 441
Quoted 11 lines
drivers/serial/uartlite.c +1
-2{struct device_node *np;struct resource res;@@ -392,13 +437,14 @@ static inline void __init ulite_console_of_find_device(int id)if (rc)continue ; - ulite_ports[id].mapbase = res.start;of_node_put (np); -return ; +return res.start+3 ;
Are all OF users big endian?
Quoted 22 lines
drivers/serial/uartlite.c +6
-4} + +return 0 ; }#else /* CONFIG_OF */ -static inline void __init ulite_console_of_find_device (int id) {/* do nothing */ } +static inline u32 __init ulite_console_of_find_device (int id) {return 0 ; }#endif /* CONFIG_OF */ static int __init ulite_console_setup (struct console *co,char *options)@@ -408,25 +454,33 @@ static int __init ulite_console_setup(struct console *co, char *options)int bits =8 ;int parity ='n' ;int flow ='n' ; +u32 base; -if (co->index <0 || co->index >=ULITE_NR_UARTS ) -return -EINVAL ; +/* Find a matching uart port in the device tree */ + base =ulite_console_of_find_device (co->index); - port = &ulite_ports[co->index];
drivers/serial/uartlite.c static int __init ulite_console_setup(struct console *co, char *options) · line 468
Quoted 10 lines
drivers/serial/uartlite.c +6
-3+/* Get the port structure */ + port =ulite_get_port (co->index); +if (!port) +return -ENODEV ; -/* Check if it is an OF device */ -if (!port->mapbase) -ulite_console_of_find_device (co->index); +/* was it initialized for this device? */ +if (base) {
I preferred the old way, where it was clearer that this stuff is only done in the OF case, E.G.:
/* Check if it is an OF device */
if (!port->mapbase)
port->mapbase = ulite_console_of_find_device(co->index);
drivers/serial/uartlite.c static int __init ulite_console_setup(struct console *co, char *options) · line 472
Quoted 4 lines
drivers/serial/uartlite.c +4
-0+if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ;/* port used by another device; bail */
You have this both here and in ulite_assign - Couldn't this be moved to ulite_get_port?
Quoted 8 lines
drivers/serial/uartlite.c +4
-3+ } + port->mapbase = base; + } -/* Do we have a device now? */ -if (!port->mapbase) { -pr_debug ("console on ttyUL%i not present\n" , co->index); +if (!port->mapbase)
drivers/serial/uartlite.c static int __init ulite_console_setup(struct console *co, char *options) · line 484
Quoted 10 lines
drivers/serial/uartlite.c +3
-3return -ENODEV ; - } -/* not initialized yet? */ +/* registers mapped yet? */ if (!port->membase) { -if (ulite_request_port (port)) + port->membase =ioremap (port->mapbase,ULITE_REGION ); +if (!port->membase)return -ENODEV ;
Why not use request_port?
Quoted 8 lines
drivers/serial/uartlite.c +0
-2}@@ -488,39 +542,22 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq)struct uart_port *port;int rc; -/* if id = -1; then scan for a free id and use that */ -if (id <0 ) {
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 547
Quoted 10 lines
drivers/serial/uartlite.c +3
-7-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 ; + port =ulite_get_port (id); +if (!port) { +dev_err (dev,"Cannot get uart_port structure\n" );
ulite_get_port can only fail in the invalid id case, where a suitable error message has already been printed. This doesn't really add anything.
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 548
Quoted 1 line
drivers/serial/uartlite.c +1
-0+return -ENODEV ;
Why change the error code?
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 555
Quoted 11 lines
drivers/serial/uartlite.c +5
-4} -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 ; +/* was it initialized for this device? */ +if ((port->mapbase) && (port->mapbase != base)) { +pr_debug (KERN_DEBUG "ulite: addr mismatch; %x != %x\n" , + port->mapbase, base); +return -ENODEV ;
Why change the error message? I found the old better. Also use dev_err istead of pr_debug.
You again changed the error code.
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 514
Quoted 9 lines
drivers/serial/uartlite.c +0
-7} - port = &ulite_ports[id]; - -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;
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 517
Quoted 2 lines
drivers/serial/uartlite.c +0
-2- port->membase =NULL ; - port->ops = &ulite_ops;
port-> irq = irq;
drivers/serial/uartlite.c static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) · line 519
Quoted 1 line
drivers/serial/uartlite.c +0
-1- port->flags =UPF_BOOT_AUTOCONF ;
port-> dev = dev;
Quoted 15 lines
drivers/serial/uartlite.c +0
-3- port->type =PORT_UNKNOWN ; - port->line = id; -dev_set_drvdata (dev, port);/* Register the port */ Signature · 8 lines
1.5.3.4-dirty _______________________________________________ Linuxppc-dev mailing list [email protected] https://ozlabs.org/mailman/listinfo/linuxppc-dev
Signature · 1 line
Bye, Peter Korsgaard