[PATCH 1/5] Warp Base Platform

Stephen Rothwell sfr at canb.auug.org.au
Fri Jan 11 17:42:59 EST 2008


On Wed, 09 Jan 2008 15:19:13 -0500 Sean MacLennan <smaclennan at pikatech.com> wrote:
>
> I have split up the patches slightly differently based on Josh's comments.
> 
> The first patch is basically the platform/44x files.
> 
> Signed-off-by: Sean MacLennan <smaclennan at pikatech.com>

> No comments? I really thought I would get raked over the coals for this one.

Ah ha! A challenge!  :-)

> +++ arch/powerpc/platforms/44x/warp.c	2008-01-08 17:59:48.000000000 -0500

> +void warp_set_power_leds(int green, int red)
> +{
> +	static void *gpio_base = NULL;
> +	unsigned leds;
> +
> +	if(gpio_base == NULL) {
          ^
space, please

> +		if((gpio_base = ioremap(WARP_GPIO_BASE, 0x148)) == NULL) {

and again. Also split the assignment from the test.

> +			printk("ERROR: Unable to remap GPIO base.\n");
> +			return;
> +		}
> +	}
> +
> +	leds = readl(gpio_base + 0x100);
> +
> +	switch(green) {

space

> +	case 0: leds &= ~0x80; break;
> +	case 1: leds |=  0x80; break;
> +	}
> +	switch(red) {

again

> +	case 0: leds &= ~0x40; break;
> +	case 1: leds |=  0x40; break;
> +	}
> +
> +	writel(leds, gpio_base + 0x100);
> +}
> +EXPORT_SYMBOL(warp_set_power_leds);
> +
> +
> +static int pika_dtm_thread(void *fpga)
> +{
> +	extern int ad7414_get_temp(int index);

no externs in C code - put it in a header file.

> +
> +	while(!kthread_should_stop()) {

space

> +static int __devinit warp_fpga_init(void)
> +{
> +	struct device_node *np;
> +	void *fpga;
> +	int irq;
> +	struct resource res;
> +	struct task_struct *dtm_thread;
> +
> +	if((np = of_find_compatible_node(NULL, NULL, "pika,fpga")) == NULL) {

space and split the assignment from the test.

> +		printk(KERN_ERR __FILE__ ": Unable to find fpga\n");
> +		return -ENOENT;
> +	}
> +
> +	if((irq = irq_of_parse_and_map(np, 0)) == NO_IRQ) {

again

> +		printk(KERN_ERR __FILE__ ": irq_of_parse_and_map failed\n");
> +		return -EBUSY;
> +	}
> +
> +	/* We do not call of_iomap here since it would map in the entire
> +	 * fpga space, which is over 8k.
> +	 */
> +	if(of_address_to_resource(np, 0, &res) ||
> +	   (fpga = ioremap(res.start, 0x24)) == NULL) {

and again

> +		printk(KERN_ERR __FILE__ ": Unable to map FPGA\n");
> +		return -ENOENT;
> +	}
> +
> +	/* Turn off the line LEDs */
> +	out_be32(fpga + 8, 0);
> +
> +	dtm_thread = kthread_run(pika_dtm_thread, fpga + 0x20, "pika-dtm");
> +
> +	if(IS_ERR(dtm_thread)) {

space

enough?  :-)
-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080111/17a389e8/attachment.pgp>


More information about the Linuxppc-dev mailing list