[U-Boot-Users] [PATCH 1/3] Add the RapidIO framework for U-Boot

Kumar Gala galak at kernel.crashing.org
Thu Jan 10 15:43:37 CET 2008


On Jan 10, 2008, at 5:38 AM, Zhang Wei wrote:

> The patch adds the RapidIO framework into U-Boot. The board  
> configuration
> can be added into individual rio_init_board() function. Some functions
> about RapidIO can be added later.

can you explain what might get added in the future.  At this point all  
this code seems to exist to just do fsl_rio_quirk.

> The support for Freescale PowerPC RapidIO controller is also added.
>
> Signed-off-by: Zhang Wei <wei.zhang at freescale.com>
> ---
> Makefile              |    1 +
> drivers/rio/Makefile  |   35 ++++++++++++++++++++++++++
> drivers/rio/fsl_rio.c |   64 ++++++++++++++++++++++++++++++++++++++++ 
> ++++++++
> drivers/rio/rio.c     |   65 ++++++++++++++++++++++++++++++++++++++++ 
> +++++++++
> include/common.h      |    3 ++
> include/rio.h         |   46 ++++++++++++++++++++++++++++++++++
> include/rio_ids.h     |    9 +++++++
> lib_ppc/board.c       |    5 ++++
> 8 files changed, 228 insertions(+), 0 deletions(-)
> create mode 100644 drivers/rio/Makefile
> create mode 100644 drivers/rio/fsl_rio.c
> create mode 100644 drivers/rio/rio.c
> create mode 100644 include/rio.h
> create mode 100644 include/rio_ids.h

[snip]

> diff --git a/drivers/rio/fsl_rio.c b/drivers/rio/fsl_rio.c
> new file mode 100644
> index 0000000..c8bfa92
> --- /dev/null
> +++ b/drivers/rio/fsl_rio.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (C) 2008 Freescale Semiconductor, Inc. All rights  
> reserved.
> + *
> + * Author: Zhang Wei, wei.zhang at freescale.com, Jan 2008
> + *
> + * Description:
> + * Freescale PowerPC RapidIO controller initialization file.
> + *
> + * This is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as  
> published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#include <common.h>
> +
> +#ifdef CONFIG_RAPIDIO

you don't need to do file protection like this anymore with the new  
build system.

>
> +#include <command.h>
> +#include <malloc.h>
> +#include <rio.h>
> +#include <rio_ids.h>
> +
> +#include <asm/processor.h>
> +#include <asm/io.h>
> +#include <asm/immap_86xx.h>
> +#include <asm/io.h>
> +
> +void fsl_rio_init(void *base, int busno)
> +{
> +	struct rio_dev *dev;
> +	volatile ccsr_rio_t *rio = base;
> +	struct rio_controller *hose;
> +
> +	dev = malloc(sizeof(struct rio_dev));
> +	memset(dev, 0, sizeof(struct rio_dev));
> +
> +	dev->vendor = in_be32(&rio->didcar) & 0xffff;
> +	dev->device = (in_be32(&rio->didcar) >> 16) & 0xffff;
> +
> +	hose = malloc(sizeof(struct rio_controller));
> +	memset(hose, 0, sizeof(struct rio_controller));
> +
> +	INIT_LIST_HEAD(&hose->dev_list);
> +	hose->busno = busno;
> +	hose->base = base;
> +	hose->self = dev;
> +	list_add_tail(&hose->node, &rio_hose_list);
> +
> +	printf("RIO%d (%04x:%04x) on 0x%08x\n", hose->busno, dev->vendor,
> +			dev->device, base);
> +}
> +
> +void fsl_rio_quirk(struct rio_controller *hose, struct rio_dev *rdev)
> +{
> +#ifdef FSL_RIO_IP_V2
> +	volatile ccsr_rio_t *rio = hose->base;
> +	/* Set the controller to accept all packets
> +	 * without checking the target ID
> +	 */
> +	out_be32(&rio->ptaacr, 1);
> +#endif
> +}
> +#endif
> diff --git a/drivers/rio/rio.c b/drivers/rio/rio.c
> new file mode 100644
> index 0000000..9391384
> --- /dev/null
> +++ b/drivers/rio/rio.c
> @@ -0,0 +1,65 @@
> +/*
> + * Copyright (C) 2007-2008 Freescale Semiconductor, Inc. All rights  
> reserved.
> + *
> + * Author: Zhang Wei, wei.zhang at freescale.com, Jun 2007
> + *
> + * Description:
> + * RapidIO initialization file.
> + *
> + * This is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as  
> published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + */
> +
> +#include <common.h>
> +
> +#ifdef CONFIG_RAPIDIO
> +
> +#include <command.h>
> +#include <linux/list.h>
> +#include <rio.h>
> +#include <rio_ids.h>
> +#include <asm/processor.h>
> +#include <asm/io.h>
> +
> +struct list_head rio_hose_list;
> +
> +struct rio_quirk rio_post_quirk[] = {
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8548E, fsl_rio_quirk},
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8548, fsl_rio_quirk},
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8568E, fsl_rio_quirk},
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8568, fsl_rio_quirk},
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8641, fsl_rio_quirk},
> +	{RIO_VENDOR_ID_FREESCALE, RIO_DEVICE_ID_MPC8641D, fsl_rio_quirk},
> +	{},
> +};
> +
> +void rio_hose_post(void)
> +{
> +	struct rio_controller *hose;
> +	struct rio_quirk *post_quirk;
> +
> +	list_for_each_entry(hose, &rio_hose_list, node)
> +		for (post_quirk = rio_post_quirk;
> +		     post_quirk->vendor || post_quirk->device; post_quirk++)
> +			if ((post_quirk->vendor == hose->self->vendor)
> +				  && (post_quirk->device == hose->self->device)
> +				  && post_quirk->quirk) {
> +				post_quirk->quirk(hose, hose->self);
> +				break;
> +			}
> +}

do we really need a full blown quirk system, or can we just let the  
board code handle this?

>
> +
> +void rio_init(void)
> +{
> +	INIT_LIST_HEAD(&rio_hose_list);
> +
> +	/* Call board specific rio_init() */
> +	rio_init_board();

what's the point of this.  Why not just do this from some pre-existing  
board init function?

>
> +
> +	rio_hose_post();
> +}
> +
> +#endif /* CONFIG_RAPIDIO */







More information about the U-Boot mailing list