Re: round2 [PATCH 5/6] Added support for AMBA bus. The device is a AMBA bus if it is a child of prom node "ambapp" (AMBA plug and play). Two functions leon_trans_init() and leon_node_init() (defined in sparc/kernel/leon.c) are called in the prom_build_tree() path if CONFIG_SPARC_LEON is defined. leon_node_init() will build up the device tree using AMBA plug and play.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -24,6 +24,7 @@
>  
>  #include <asm/prom.h>
>  #include <asm/oplib.h>
> +#include <asm/leon.h>
>  
>  #include "prom.h"
>  
> @@ -131,6 +132,39 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
>  		regs->which_io, regs->phys_addr);
>  }
>  
> +#ifdef CONFIG_SPARC_LEON
> +
> +/* "name@irq,addrlo" */
> +static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
> +{
> +	struct amba_prom_registers *regs; unsigned int *intr;
> +	unsigned int *device, *vendor;
> +	struct property *prop;
> +
> +	prop = of_find_property(dp, "reg", NULL);
> +	if (!prop)
> +		return;
> +	regs = prop->value;
> +	prop = of_find_property(dp, "interrupts", NULL);
> +	if (!prop)
> +		return;
> +	intr = prop->value;
> +	prop = of_find_property(dp, "vendor", NULL);
> +	if (!prop)
> +		return;
> +	vendor = prop->value;
> +	prop = of_find_property(dp, "device", NULL);
> +	if (!prop)
> +		return;
> +	device = prop->value;
> +
> +	sprintf(tmp_buf, "%s:%d:%d@%x,%x",
> +		dp->name, *vendor, *device,
> +		*intr, regs->phys_addr);
> +}
> +
> +#endif

Does this belong in leon_amba.c?


> +
>  static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
>  {
>  	struct device_node *parent = dp->parent;
> @@ -143,6 +177,10 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
>  			return sbus_path_component(dp, tmp_buf);
>  		if (!strcmp(parent->type, "ebus"))
>  			return ebus_path_component(dp, tmp_buf);
> +#ifdef CONFIG_SPARC_LEON
> +		if (!strcmp(parent->type, "ambapp"))
> +			return ambapp_path_component(dp, tmp_buf);
> +#endif

Why is this ifdef needed?


>  
>  		/* "isa" is handled with platform naming */
>  	}
> diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
> index 0fb5789..6f661ee 100644
> --- a/arch/sparc/kernel/prom_common.c
> +++ b/arch/sparc/kernel/prom_common.c
> @@ -22,9 +22,12 @@
>  #include <linux/of.h>
>  #include <asm/prom.h>
>  #include <asm/oplib.h>
> +#include <asm/leon.h>
>  
>  #include "prom.h"
>  
> +void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp);
> +
Move to a header file.


>  struct device_node *of_console_device;
>  EXPORT_SYMBOL(of_console_device);
>  
> @@ -161,7 +164,7 @@ static struct property * __init build_one_prop(phandle node, char *prev,
>  			name = prom_nextprop(node, prev, p->name);
>  		}
>  
> -		if (strlen(name) == 0) {
> +		if (!name || strlen(name) == 0) {
>  			tmp = p;
>  			return NULL;
>  		}
> @@ -242,7 +245,7 @@ static struct device_node * __init prom_create_node(phandle node,
>  	return dp;
>  }
>  
> -static char * __init build_full_name(struct device_node *dp)
> +SPARC_LEON_STATIC char * __init build_full_name(struct device_node *dp)

No - drop the static if you need to call this function.

>  {
>  	int len, ourlen, plen;
>  	char *n;
> @@ -289,6 +292,9 @@ static struct device_node * __init prom_build_tree(struct device_node *parent,
>  
>  		dp->child = prom_build_tree(dp, prom_getchild(node), nextp);
>  
> +		if (prom_build_more)
> +			prom_build_more(dp, nextp);
> +		
>  		node = prom_getsibling(node);
>  	}
>  

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux