aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c13
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c94
-rw-r--r--arch/arm/mach-at91/board-flexibity.c12
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c80
-rw-r--r--arch/arm/mach-at91/include/mach/board.h6
5 files changed, 198 insertions, 7 deletions
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 366a7765635b..70709ab0102a 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -891,7 +891,8 @@ static struct platform_device at91sam9263_isi_device = {
891 .num_resources = ARRAY_SIZE(isi_resources), 891 .num_resources = ARRAY_SIZE(isi_resources),
892}; 892};
893 893
894void __init at91_add_device_isi(void) 894void __init at91_add_device_isi(struct isi_platform_data *data,
895 bool use_pck_as_mck)
895{ 896{
896 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ 897 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */
897 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ 898 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */
@@ -904,14 +905,20 @@ void __init at91_add_device_isi(void)
904 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ 905 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */
905 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ 906 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */
906 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ 907 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */
907 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
908 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ 908 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */
909 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ 909 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */
910 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ 910 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */
911 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ 911 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */
912
913 if (use_pck_as_mck) {
914 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
915
916 /* TODO: register the PCK for ISI_MCK and set its parent */
917 }
912} 918}
913#else 919#else
914void __init at91_add_device_isi(void) {} 920void __init at91_add_device_isi(struct isi_platform_data *data,
921 bool use_pck_as_mck) {}
915#endif 922#endif
916 923
917 924
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 96e2adcd5a84..bd4e68cd3e2f 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/clk.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
@@ -28,7 +29,10 @@
28#include <mach/at_hdmac.h> 29#include <mach/at_hdmac.h>
29#include <mach/atmel-mci.h> 30#include <mach/atmel-mci.h>
30 31
32#include <media/atmel-isi.h>
33
31#include "generic.h" 34#include "generic.h"
35#include "clock.h"
32 36
33 37
34/* -------------------------------------------------------------------- 38/* --------------------------------------------------------------------
@@ -870,6 +874,96 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)
870void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} 874void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
871#endif 875#endif
872 876
877/* --------------------------------------------------------------------
878 * Image Sensor Interface
879 * -------------------------------------------------------------------- */
880#if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
881static u64 isi_dmamask = DMA_BIT_MASK(32);
882static struct isi_platform_data isi_data;
883
884struct resource isi_resources[] = {
885 [0] = {
886 .start = AT91SAM9G45_BASE_ISI,
887 .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1,
888 .flags = IORESOURCE_MEM,
889 },
890 [1] = {
891 .start = AT91SAM9G45_ID_ISI,
892 .end = AT91SAM9G45_ID_ISI,
893 .flags = IORESOURCE_IRQ,
894 },
895};
896
897static struct platform_device at91sam9g45_isi_device = {
898 .name = "atmel_isi",
899 .id = 0,
900 .dev = {
901 .dma_mask = &isi_dmamask,
902 .coherent_dma_mask = DMA_BIT_MASK(32),
903 .platform_data = &isi_data,
904 },
905 .resource = isi_resources,
906 .num_resources = ARRAY_SIZE(isi_resources),
907};
908
909static struct clk_lookup isi_mck_lookups[] = {
910 CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL),
911};
912
913void __init at91_add_device_isi(struct isi_platform_data *data,
914 bool use_pck_as_mck)
915{
916 struct clk *pck;
917 struct clk *parent;
918
919 if (!data)
920 return;
921 isi_data = *data;
922
923 at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */
924 at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */
925 at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */
926 at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */
927 at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */
928 at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */
929 at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */
930 at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */
931 at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */
932 at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */
933 at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */
934 at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */
935 at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */
936 at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */
937 at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */
938
939 platform_device_register(&at91sam9g45_isi_device);
940
941 if (use_pck_as_mck) {
942 at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */
943
944 pck = clk_get(NULL, "pck1");
945 parent = clk_get(NULL, "plla");
946
947 BUG_ON(IS_ERR(pck) || IS_ERR(parent));
948
949 if (clk_set_parent(pck, parent)) {
950 pr_err("Failed to set PCK's parent\n");
951 } else {
952 /* Register PCK as ISI_MCK */
953 isi_mck_lookups[0].clk = pck;
954 clkdev_add_table(isi_mck_lookups,
955 ARRAY_SIZE(isi_mck_lookups));
956 }
957
958 clk_put(pck);
959 clk_put(parent);
960 }
961}
962#else
963void __init at91_add_device_isi(struct isi_platform_data *data,
964 bool use_pck_as_mck) {}
965#endif
966
873 967
874/* -------------------------------------------------------------------- 968/* --------------------------------------------------------------------
875 * LCD Controller 969 * LCD Controller
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index eec02cd57ced..1815152001f7 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-at91/board-flexibity.c 2 * linux/arch/arm/mach-at91/board-flexibity.c
3 * 3 *
4 * Copyright (C) 2010 Flexibity 4 * Copyright (C) 2010-2011 Flexibity
5 * Copyright (C) 2005 SAN People 5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2006 Atmel 6 * Copyright (C) 2006 Atmel
7 * 7 *
@@ -62,6 +62,13 @@ static struct at91_udc_data __initdata flexibity_udc_data = {
62 .pullup_pin = -EINVAL, /* pull-up driven by UDC */ 62 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
63}; 63};
64 64
65/* I2C devices */
66static struct i2c_board_info __initdata flexibity_i2c_devices[] = {
67 {
68 I2C_BOARD_INFO("ds1307", 0x68),
69 },
70};
71
65/* SPI devices */ 72/* SPI devices */
66static struct spi_board_info flexibity_spi_devices[] = { 73static struct spi_board_info flexibity_spi_devices[] = {
67 { /* DataFlash chip */ 74 { /* DataFlash chip */
@@ -141,6 +148,9 @@ static void __init flexibity_board_init(void)
141 at91_add_device_usbh(&flexibity_usbh_data); 148 at91_add_device_usbh(&flexibity_usbh_data);
142 /* USB Device */ 149 /* USB Device */
143 at91_add_device_udc(&flexibity_udc_data); 150 at91_add_device_udc(&flexibity_udc_data);
151 /* I2C */
152 at91_add_device_i2c(flexibity_i2c_devices,
153 ARRAY_SIZE(flexibity_i2c_devices));
144 /* SPI */ 154 /* SPI */
145 at91_add_device_spi(flexibity_spi_devices, 155 at91_add_device_spi(flexibity_spi_devices,
146 ARRAY_SIZE(flexibity_spi_devices)); 156 ARRAY_SIZE(flexibity_spi_devices));
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ea0d1b9c2b7b..57497e2b8878 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -24,11 +24,13 @@
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/clk.h>
28#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h>
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <video/atmel_lcdc.h> 31#include <video/atmel_lcdc.h>
32#include <media/soc_camera.h>
33#include <media/atmel-isi.h>
32 34
33#include <asm/setup.h> 35#include <asm/setup.h>
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -185,6 +187,71 @@ static void __init ek_add_device_nand(void)
185 187
186 188
187/* 189/*
190 * ISI
191 */
192static struct isi_platform_data __initdata isi_data = {
193 .frate = ISI_CFG1_FRATE_CAPTURE_ALL,
194 /* to use codec and preview path simultaneously */
195 .full_mode = 1,
196 .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10,
197 /* ISI_MCK is provided by programmable clock or external clock */
198 .mck_hz = 25000000,
199};
200
201
202/*
203 * soc-camera OV2640
204 */
205#if defined(CONFIG_SOC_CAMERA_OV2640) || \
206 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
207static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link)
208{
209 /* ISI board for ek using default 8-bits connection */
210 return SOCAM_DATAWIDTH_8;
211}
212
213static int i2c_camera_power(struct device *dev, int on)
214{
215 /* enable or disable the camera */
216 pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE");
217 at91_set_gpio_output(AT91_PIN_PD13, !on);
218
219 if (!on)
220 goto out;
221
222 /* If enabled, give a reset impulse */
223 at91_set_gpio_output(AT91_PIN_PD12, 0);
224 msleep(20);
225 at91_set_gpio_output(AT91_PIN_PD12, 1);
226 msleep(100);
227
228out:
229 return 0;
230}
231
232static struct i2c_board_info i2c_camera = {
233 I2C_BOARD_INFO("ov2640", 0x30),
234};
235
236static struct soc_camera_link iclink_ov2640 = {
237 .bus_id = 0,
238 .board_info = &i2c_camera,
239 .i2c_adapter_id = 0,
240 .power = i2c_camera_power,
241 .query_bus_param = isi_camera_query_bus_param,
242};
243
244static struct platform_device isi_ov2640 = {
245 .name = "soc-camera-pdrv",
246 .id = 0,
247 .dev = {
248 .platform_data = &iclink_ov2640,
249 },
250};
251#endif
252
253
254/*
188 * LCD Controller 255 * LCD Controller
189 */ 256 */
190#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 257#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
@@ -377,7 +444,12 @@ static struct gpio_led ek_pwm_led[] = {
377#endif 444#endif
378}; 445};
379 446
380 447static struct platform_device *devices[] __initdata = {
448#if defined(CONFIG_SOC_CAMERA_OV2640) || \
449 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
450 &isi_ov2640,
451#endif
452};
381 453
382static void __init ek_board_init(void) 454static void __init ek_board_init(void)
383{ 455{
@@ -399,6 +471,8 @@ static void __init ek_board_init(void)
399 ek_add_device_nand(); 471 ek_add_device_nand();
400 /* I2C */ 472 /* I2C */
401 at91_add_device_i2c(0, NULL, 0); 473 at91_add_device_i2c(0, NULL, 0);
474 /* ISI, using programmable clock as ISI_MCK */
475 at91_add_device_isi(&isi_data, true);
402 /* LCD Controller */ 476 /* LCD Controller */
403 at91_add_device_lcdc(&ek_lcdc_data); 477 at91_add_device_lcdc(&ek_lcdc_data);
404 /* Touch Screen */ 478 /* Touch Screen */
@@ -410,6 +484,8 @@ static void __init ek_board_init(void)
410 /* LEDs */ 484 /* LEDs */
411 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 485 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
412 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 486 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
487 /* Other platform devices */
488 platform_add_devices(devices, ARRAY_SIZE(devices));
413} 489}
414 490
415MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") 491MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK")
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 3b33f07b1e11..dc8d6d4f17cf 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -107,6 +107,8 @@ struct atmel_nand_data {
107 u8 ale; /* address line number connected to ALE */ 107 u8 ale; /* address line number connected to ALE */
108 u8 cle; /* address line number connected to CLE */ 108 u8 cle; /* address line number connected to CLE */
109 u8 bus_width_16; /* buswidth is 16 bit */ 109 u8 bus_width_16; /* buswidth is 16 bit */
110 u8 correction_cap; /* PMECC correction capability */
111 u16 sector_size; /* Sector size for PMECC */
110 struct mtd_partition *parts; 112 struct mtd_partition *parts;
111 unsigned int num_parts; 113 unsigned int num_parts;
112}; 114};
@@ -179,7 +181,9 @@ extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
179extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); 181extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
180 182
181 /* ISI */ 183 /* ISI */
182extern void __init at91_add_device_isi(void); 184struct isi_platform_data;
185extern void __init at91_add_device_isi(struct isi_platform_data *data,
186 bool use_pck_as_mck);
183 187
184 /* Touchscreen Controller */ 188 /* Touchscreen Controller */
185struct at91_tsadcc_data { 189struct at91_tsadcc_data {