aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-01-10 14:20:02 -0500
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-02-09 09:01:59 -0500
commit3d60ee1b04320d0695e071828dbadf3564d4568a (patch)
treee8c7ab2f9318cc751a98da4589857edfe2c79e11 /arch
parent7f9f4678637f9ee1a999cc0870c4668f32e1a7eb (diff)
[AVR32] SPI platform code update
Move stuff in spi.c into ATSTK1002 board code and update SPI platform device definitions according to the new GPIO API. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/avr32/boards/atstk1000/Makefile2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c14
-rw-r--r--arch/avr32/boards/atstk1000/spi.c27
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c44
4 files changed, 51 insertions, 36 deletions
diff --git a/arch/avr32/boards/atstk1000/Makefile b/arch/avr32/boards/atstk1000/Makefile
index df9499480530..8e0992201bb9 100644
--- a/arch/avr32/boards/atstk1000/Makefile
+++ b/arch/avr32/boards/atstk1000/Makefile
@@ -1,2 +1,2 @@
1obj-y += setup.o spi.o flash.o 1obj-y += setup.o flash.o
2obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o 2obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index bca815ff11f2..d47e39f0e971 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -8,15 +8,18 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/device.h>
11#include <linux/etherdevice.h> 12#include <linux/etherdevice.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/spi/spi.h>
17 19
18#include <asm/io.h> 20#include <asm/io.h>
19#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/arch/at32ap7000.h>
20#include <asm/arch/board.h> 23#include <asm/arch/board.h>
21#include <asm/arch/init.h> 24#include <asm/arch/init.h>
22#include <asm/arch/portmux.h> 25#include <asm/arch/portmux.h>
@@ -33,6 +36,16 @@ static struct eth_addr __initdata hw_addr[2];
33static struct eth_platform_data __initdata eth_data[2]; 36static struct eth_platform_data __initdata eth_data[2];
34extern struct lcdc_platform_data atstk1000_fb0_data; 37extern struct lcdc_platform_data atstk1000_fb0_data;
35 38
39static struct spi_board_info spi_board_info[] __initdata = {
40 {
41 .modalias = "ltv350qv",
42 .controller_data = (void *)GPIO_PIN_PA(4),
43 .max_speed_hz = 16000000,
44 .bus_num = 0,
45 .chip_select = 1,
46 },
47};
48
36/* 49/*
37 * The next two functions should go away as the boot loader is 50 * The next two functions should go away as the boot loader is
38 * supposed to initialize the macb address registers with a valid 51 * supposed to initialize the macb address registers with a valid
@@ -136,6 +149,7 @@ static int __init atstk1002_init(void)
136 149
137 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 150 set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
138 151
152 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
139 at32_add_device_spi(0); 153 at32_add_device_spi(0);
140 at32_add_device_lcdc(0, &atstk1000_fb0_data); 154 at32_add_device_lcdc(0, &atstk1000_fb0_data);
141 155
diff --git a/arch/avr32/boards/atstk1000/spi.c b/arch/avr32/boards/atstk1000/spi.c
deleted file mode 100644
index 567726c82c6e..000000000000
--- a/arch/avr32/boards/atstk1000/spi.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * ATSTK1000 SPI devices
3 *
4 * Copyright (C) 2005 Atmel Norway
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/device.h>
11#include <linux/spi/spi.h>
12
13static struct spi_board_info spi_board_info[] __initdata = {
14 {
15 .modalias = "ltv350qv",
16 .max_speed_hz = 16000000,
17 .bus_num = 0,
18 .chip_select = 1,
19 },
20};
21
22static int board_init_spi(void)
23{
24 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
25 return 0;
26}
27arch_initcall(board_init_spi);
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index 981d553e471b..c1e477ec7576 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -736,12 +736,19 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
736/* -------------------------------------------------------------------- 736/* --------------------------------------------------------------------
737 * SPI 737 * SPI
738 * -------------------------------------------------------------------- */ 738 * -------------------------------------------------------------------- */
739static struct resource spi0_resource[] = { 739static struct resource atmel_spi0_resource[] = {
740 PBMEM(0xffe00000), 740 PBMEM(0xffe00000),
741 IRQ(3), 741 IRQ(3),
742}; 742};
743DEFINE_DEV(spi, 0); 743DEFINE_DEV(atmel_spi, 0);
744DEV_CLK(mck, spi0, pba, 0); 744DEV_CLK(spi_clk, atmel_spi0, pba, 0);
745
746static struct resource atmel_spi1_resource[] = {
747 PBMEM(0xffe00400),
748 IRQ(4),
749};
750DEFINE_DEV(atmel_spi, 1);
751DEV_CLK(spi_clk, atmel_spi1, pba, 1);
745 752
746struct platform_device *__init at32_add_device_spi(unsigned int id) 753struct platform_device *__init at32_add_device_spi(unsigned int id)
747{ 754{
@@ -749,13 +756,33 @@ struct platform_device *__init at32_add_device_spi(unsigned int id)
749 756
750 switch (id) { 757 switch (id) {
751 case 0: 758 case 0:
752 pdev = &spi0_device; 759 pdev = &atmel_spi0_device;
753 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */ 760 select_peripheral(PA(0), PERIPH_A, 0); /* MISO */
754 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */ 761 select_peripheral(PA(1), PERIPH_A, 0); /* MOSI */
755 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */ 762 select_peripheral(PA(2), PERIPH_A, 0); /* SCK */
756 select_peripheral(PA(3), PERIPH_A, 0); /* NPCS0 */ 763
757 select_peripheral(PA(4), PERIPH_A, 0); /* NPCS1 */ 764 /* NPCS[2:0] */
758 select_peripheral(PA(5), PERIPH_A, 0); /* NPCS2 */ 765 at32_select_gpio(GPIO_PIN_PA(3),
766 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
767 at32_select_gpio(GPIO_PIN_PA(4),
768 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
769 at32_select_gpio(GPIO_PIN_PA(5),
770 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
771 break;
772
773 case 1:
774 pdev = &atmel_spi1_device;
775 select_peripheral(PB(0), PERIPH_B, 0); /* MISO */
776 select_peripheral(PB(1), PERIPH_B, 0); /* MOSI */
777 select_peripheral(PB(5), PERIPH_B, 0); /* SCK */
778
779 /* NPCS[2:0] */
780 at32_select_gpio(GPIO_PIN_PB(2),
781 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
782 at32_select_gpio(GPIO_PIN_PB(3),
783 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
784 at32_select_gpio(GPIO_PIN_PB(4),
785 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
759 break; 786 break;
760 787
761 default: 788 default:
@@ -877,7 +904,8 @@ struct clk *at32_clock_list[] = {
877 &macb0_pclk, 904 &macb0_pclk,
878 &macb1_hclk, 905 &macb1_hclk,
879 &macb1_pclk, 906 &macb1_pclk,
880 &spi0_mck, 907 &atmel_spi0_spi_clk,
908 &atmel_spi1_spi_clk,
881 &lcdc0_hclk, 909 &lcdc0_hclk,
882 &lcdc0_pixclk, 910 &lcdc0_pixclk,
883}; 911};