[-mm patch 3/4] AVR32: Move spi device definitions into main board setup file

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

 



There's no point in having a separate file just to set up the board-
specific data for spi. By moving it into the rest of the board-
specific setup code, we can also make sure that the data is
registered before we register the spi master controller.

This patch also records the GPIO pin to use as chip select in the
controller_data member of the spi_board_info data for each device.

Signed-off-by: Haavard Skinnemoen <[email protected]>
---
 arch/avr32/boards/atstk1000/Makefile    |    2 +-
 arch/avr32/boards/atstk1000/atstk1002.c |   15 +++++++++++++++
 arch/avr32/boards/atstk1000/spi.c       |   27 ---------------------------
 3 files changed, 16 insertions(+), 28 deletions(-)

Index: linux-2.6.19-rc4-mm2/arch/avr32/boards/atstk1000/Makefile
===================================================================
--- linux-2.6.19-rc4-mm2.orig/arch/avr32/boards/atstk1000/Makefile	2006-11-07 11:29:15.000000000 +0100
+++ linux-2.6.19-rc4-mm2/arch/avr32/boards/atstk1000/Makefile	2006-11-07 11:31:00.000000000 +0100
@@ -1,2 +1,2 @@
-obj-y				+= setup.o spi.o flash.o
+obj-y				+= setup.o flash.o
 obj-$(CONFIG_BOARD_ATSTK1002)	+= atstk1002.o
Index: linux-2.6.19-rc4-mm2/arch/avr32/boards/atstk1000/atstk1002.c
===================================================================
--- linux-2.6.19-rc4-mm2.orig/arch/avr32/boards/atstk1000/atstk1002.c	2006-11-07 11:29:15.000000000 +0100
+++ linux-2.6.19-rc4-mm2/arch/avr32/boards/atstk1000/atstk1002.c	2006-11-07 11:33:09.000000000 +0100
@@ -7,11 +7,24 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/device.h>
 #include <linux/init.h>
+#include <linux/spi/spi.h>
 
+#include <asm/arch/at32ap7000.h>
 #include <asm/arch/board.h>
 #include <asm/arch/init.h>
 
+static struct spi_board_info spi_board_info[] __initdata = {
+	{
+		.modalias       = "ltv350qv",
+		.controller_data = (void *)GPIO_PIN_PA4,
+		.max_speed_hz   = 16000000,
+		.bus_num        = 0,
+		.chip_select    = 1,
+	},
+};
+
 struct eth_platform_data __initdata eth0_data = {
 	.valid		= 1,
 	.mii_phy_addr	= 0x10,
@@ -39,6 +52,8 @@ static int __init atstk1002_init(void)
 	at32_add_device_usart(2);
 
 	at32_add_device_eth(0, &eth0_data);
+
+	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 	at32_add_device_spi(0);
 	at32_add_device_lcdc(0, &atstk1000_fb0_data);
 
Index: linux-2.6.19-rc4-mm2/arch/avr32/boards/atstk1000/spi.c
===================================================================
--- linux-2.6.19-rc4-mm2.orig/arch/avr32/boards/atstk1000/spi.c	2006-11-07 11:29:15.000000000 +0100
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,27 +0,0 @@
-/*
- * ATSTK1000 SPI devices
- *
- * Copyright (C) 2005 Atmel Norway
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/device.h>
-#include <linux/spi/spi.h>
-
-static struct spi_board_info spi_board_info[] __initdata = {
-	{
-		.modalias	= "ltv350qv",
-		.max_speed_hz	= 16000000,
-		.bus_num	= 0,
-		.chip_select	= 1,
-	},
-};
-
-static int board_init_spi(void)
-{
-	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
-	return 0;
-}
-arch_initcall(board_init_spi);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux