diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_devices.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9_smc.h | 29 | ||||
-rw-r--r-- | arch/arm/mach-at91/sam9_smc.c | 76 | ||||
-rw-r--r-- | arch/arm/mach-at91/sam9_smc.h | 23 |
7 files changed, 109 insertions, 40 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 18bacec2b094..97676bdae998 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -83,7 +83,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
83 | * USB Device (Gadget) | 83 | * USB Device (Gadget) |
84 | * -------------------------------------------------------------------- */ | 84 | * -------------------------------------------------------------------- */ |
85 | 85 | ||
86 | #ifdef CONFIG_USB_AT91 | 86 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) |
87 | static struct at91_udc_data udc_data; | 87 | static struct at91_udc_data udc_data; |
88 | 88 | ||
89 | static struct resource udc_resources[] = { | 89 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 642ccb6d26b2..5a24f0b4554d 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -84,7 +84,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
84 | * USB Device (Gadget) | 84 | * USB Device (Gadget) |
85 | * -------------------------------------------------------------------- */ | 85 | * -------------------------------------------------------------------- */ |
86 | 86 | ||
87 | #ifdef CONFIG_USB_AT91 | 87 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) |
88 | static struct at91_udc_data udc_data; | 88 | static struct at91_udc_data udc_data; |
89 | 89 | ||
90 | static struct resource udc_resources[] = { | 90 | static struct resource udc_resources[] = { |
@@ -1215,8 +1215,7 @@ void __init at91_add_device_serial(void) {} | |||
1215 | * CF/IDE | 1215 | * CF/IDE |
1216 | * -------------------------------------------------------------------- */ | 1216 | * -------------------------------------------------------------------- */ |
1217 | 1217 | ||
1218 | #if defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) || \ | 1218 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ |
1219 | defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | ||
1220 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) | 1219 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) |
1221 | 1220 | ||
1222 | static struct at91_cf_data cf0_data; | 1221 | static struct at91_cf_data cf0_data; |
@@ -1313,10 +1312,8 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1313 | if (data->flags & AT91_CF_TRUE_IDE) | 1312 | if (data->flags & AT91_CF_TRUE_IDE) |
1314 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) | 1313 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) |
1315 | pdev->name = "pata_at91"; | 1314 | pdev->name = "pata_at91"; |
1316 | #elif defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | ||
1317 | pdev->name = "at91_ide"; | ||
1318 | #else | 1315 | #else |
1319 | #warning "board requires AT91_CF_TRUE_IDE: enable either at91_ide or pata_at91" | 1316 | #warning "board requires AT91_CF_TRUE_IDE: enable pata_at91" |
1320 | #endif | 1317 | #endif |
1321 | else | 1318 | else |
1322 | pdev->name = "at91_cf"; | 1319 | pdev->name = "at91_cf"; |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index fc59cbdb0e3c..1e28bed8f425 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -87,7 +87,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
87 | * USB Device (Gadget) | 87 | * USB Device (Gadget) |
88 | * -------------------------------------------------------------------- */ | 88 | * -------------------------------------------------------------------- */ |
89 | 89 | ||
90 | #ifdef CONFIG_USB_AT91 | 90 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) |
91 | static struct at91_udc_data udc_data; | 91 | static struct at91_udc_data udc_data; |
92 | 92 | ||
93 | static struct resource udc_resources[] = { | 93 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 7b46b2787022..366a7765635b 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -92,7 +92,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
92 | * USB Device (Gadget) | 92 | * USB Device (Gadget) |
93 | * -------------------------------------------------------------------- */ | 93 | * -------------------------------------------------------------------- */ |
94 | 94 | ||
95 | #ifdef CONFIG_USB_AT91 | 95 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) |
96 | static struct at91_udc_data udc_data; | 96 | static struct at91_udc_data udc_data; |
97 | 97 | ||
98 | static struct resource udc_resources[] = { | 98 | static struct resource udc_resources[] = { |
@@ -355,8 +355,8 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
355 | * Compact Flash (PCMCIA or IDE) | 355 | * Compact Flash (PCMCIA or IDE) |
356 | * -------------------------------------------------------------------- */ | 356 | * -------------------------------------------------------------------- */ |
357 | 357 | ||
358 | #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \ | 358 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ |
359 | defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | 359 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) |
360 | 360 | ||
361 | static struct at91_cf_data cf0_data; | 361 | static struct at91_cf_data cf0_data; |
362 | 362 | ||
@@ -450,7 +450,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
450 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ | 450 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ |
451 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ | 451 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ |
452 | 452 | ||
453 | pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf"; | 453 | pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf"; |
454 | platform_device_register(pdev); | 454 | platform_device_register(pdev); |
455 | } | 455 | } |
456 | #else | 456 | #else |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_smc.h b/arch/arm/mach-at91/include/mach/at91sam9_smc.h index eb18a70fa647..175e1fdd9fe8 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_smc.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_smc.h | |||
@@ -18,6 +18,35 @@ | |||
18 | 18 | ||
19 | #include <mach/cpu.h> | 19 | #include <mach/cpu.h> |
20 | 20 | ||
21 | #ifndef __ASSEMBLY__ | ||
22 | struct sam9_smc_config { | ||
23 | /* Setup register */ | ||
24 | u8 ncs_read_setup; | ||
25 | u8 nrd_setup; | ||
26 | u8 ncs_write_setup; | ||
27 | u8 nwe_setup; | ||
28 | |||
29 | /* Pulse register */ | ||
30 | u8 ncs_read_pulse; | ||
31 | u8 nrd_pulse; | ||
32 | u8 ncs_write_pulse; | ||
33 | u8 nwe_pulse; | ||
34 | |||
35 | /* Cycle register */ | ||
36 | u16 read_cycle; | ||
37 | u16 write_cycle; | ||
38 | |||
39 | /* Mode register */ | ||
40 | u32 mode; | ||
41 | u8 tdf_cycles:4; | ||
42 | }; | ||
43 | |||
44 | extern void sam9_smc_configure(int id, int cs, struct sam9_smc_config *config); | ||
45 | extern void sam9_smc_read(int id, int cs, struct sam9_smc_config *config); | ||
46 | extern void sam9_smc_read_mode(int id, int cs, struct sam9_smc_config *config); | ||
47 | extern void sam9_smc_write_mode(int id, int cs, struct sam9_smc_config *config); | ||
48 | #endif | ||
49 | |||
21 | #define AT91_SMC_SETUP 0x00 /* Setup Register for CS n */ | 50 | #define AT91_SMC_SETUP 0x00 /* Setup Register for CS n */ |
22 | #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ | 51 | #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ |
23 | #define AT91_SMC_NWESETUP_(x) ((x) << 0) | 52 | #define AT91_SMC_NWESETUP_(x) ((x) << 0) |
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c index 8294783b679d..99a0a1d2b7dc 100644 --- a/arch/arm/mach-at91/sam9_smc.c +++ b/arch/arm/mach-at91/sam9_smc.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/arch/arm/mach-at91/sam9_smc.c | 2 | * linux/arch/arm/mach-at91/sam9_smc.c |
3 | * | 3 | * |
4 | * Copyright (C) 2008 Andrew Victor | 4 | * Copyright (C) 2008 Andrew Victor |
5 | * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * 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 | * it under the terms of the GNU General Public License version 2 as |
@@ -22,7 +23,22 @@ | |||
22 | 23 | ||
23 | static void __iomem *smc_base_addr[2]; | 24 | static void __iomem *smc_base_addr[2]; |
24 | 25 | ||
25 | static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_config* config) | 26 | static void sam9_smc_cs_write_mode(void __iomem *base, |
27 | struct sam9_smc_config *config) | ||
28 | { | ||
29 | __raw_writel(config->mode | ||
30 | | AT91_SMC_TDF_(config->tdf_cycles), | ||
31 | base + AT91_SMC_MODE); | ||
32 | } | ||
33 | |||
34 | void sam9_smc_write_mode(int id, int cs, | ||
35 | struct sam9_smc_config *config) | ||
36 | { | ||
37 | sam9_smc_cs_write_mode(AT91_SMC_CS(id, cs), config); | ||
38 | } | ||
39 | |||
40 | static void sam9_smc_cs_configure(void __iomem *base, | ||
41 | struct sam9_smc_config *config) | ||
26 | { | 42 | { |
27 | 43 | ||
28 | /* Setup register */ | 44 | /* Setup register */ |
@@ -45,16 +61,66 @@ static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_con | |||
45 | base + AT91_SMC_CYCLE); | 61 | base + AT91_SMC_CYCLE); |
46 | 62 | ||
47 | /* Mode register */ | 63 | /* Mode register */ |
48 | __raw_writel(config->mode | 64 | sam9_smc_cs_write_mode(base, config); |
49 | | AT91_SMC_TDF_(config->tdf_cycles), | ||
50 | base + AT91_SMC_MODE); | ||
51 | } | 65 | } |
52 | 66 | ||
53 | void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config) | 67 | void sam9_smc_configure(int id, int cs, |
68 | struct sam9_smc_config *config) | ||
54 | { | 69 | { |
55 | sam9_smc_cs_configure(AT91_SMC_CS(id, cs), config); | 70 | sam9_smc_cs_configure(AT91_SMC_CS(id, cs), config); |
56 | } | 71 | } |
57 | 72 | ||
73 | static void sam9_smc_cs_read_mode(void __iomem *base, | ||
74 | struct sam9_smc_config *config) | ||
75 | { | ||
76 | u32 val = __raw_readl(base + AT91_SMC_MODE); | ||
77 | |||
78 | config->mode = (val & ~AT91_SMC_NWECYCLE); | ||
79 | config->tdf_cycles = (val & AT91_SMC_NWECYCLE) >> 16 ; | ||
80 | } | ||
81 | |||
82 | void sam9_smc_read_mode(int id, int cs, | ||
83 | struct sam9_smc_config *config) | ||
84 | { | ||
85 | sam9_smc_cs_read_mode(AT91_SMC_CS(id, cs), config); | ||
86 | } | ||
87 | |||
88 | static void sam9_smc_cs_read(void __iomem *base, | ||
89 | struct sam9_smc_config *config) | ||
90 | { | ||
91 | u32 val; | ||
92 | |||
93 | /* Setup register */ | ||
94 | val = __raw_readl(base + AT91_SMC_SETUP); | ||
95 | |||
96 | config->nwe_setup = val & AT91_SMC_NWESETUP; | ||
97 | config->ncs_write_setup = (val & AT91_SMC_NCS_WRSETUP) >> 8; | ||
98 | config->nrd_setup = (val & AT91_SMC_NRDSETUP) >> 16; | ||
99 | config->ncs_read_setup = (val & AT91_SMC_NCS_RDSETUP) >> 24; | ||
100 | |||
101 | /* Pulse register */ | ||
102 | val = __raw_readl(base + AT91_SMC_PULSE); | ||
103 | |||
104 | config->nwe_setup = val & AT91_SMC_NWEPULSE; | ||
105 | config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8; | ||
106 | config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16; | ||
107 | config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24; | ||
108 | |||
109 | /* Cycle register */ | ||
110 | val = __raw_readl(base + AT91_SMC_CYCLE); | ||
111 | |||
112 | config->write_cycle = val & AT91_SMC_NWECYCLE; | ||
113 | config->read_cycle = (val & AT91_SMC_NRDCYCLE) >> 16; | ||
114 | |||
115 | /* Mode register */ | ||
116 | sam9_smc_cs_read_mode(base, config); | ||
117 | } | ||
118 | |||
119 | void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) | ||
120 | { | ||
121 | sam9_smc_cs_read(AT91_SMC_CS(id, cs), config); | ||
122 | } | ||
123 | |||
58 | void __init at91sam9_ioremap_smc(int id, u32 addr) | 124 | void __init at91sam9_ioremap_smc(int id, u32 addr) |
59 | { | 125 | { |
60 | if (id > 1) { | 126 | if (id > 1) { |
diff --git a/arch/arm/mach-at91/sam9_smc.h b/arch/arm/mach-at91/sam9_smc.h index 039c5ce17aec..3e52dcd4a59f 100644 --- a/arch/arm/mach-at91/sam9_smc.h +++ b/arch/arm/mach-at91/sam9_smc.h | |||
@@ -8,27 +8,4 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | struct sam9_smc_config { | ||
12 | /* Setup register */ | ||
13 | u8 ncs_read_setup; | ||
14 | u8 nrd_setup; | ||
15 | u8 ncs_write_setup; | ||
16 | u8 nwe_setup; | ||
17 | |||
18 | /* Pulse register */ | ||
19 | u8 ncs_read_pulse; | ||
20 | u8 nrd_pulse; | ||
21 | u8 ncs_write_pulse; | ||
22 | u8 nwe_pulse; | ||
23 | |||
24 | /* Cycle register */ | ||
25 | u16 read_cycle; | ||
26 | u16 write_cycle; | ||
27 | |||
28 | /* Mode register */ | ||
29 | u32 mode; | ||
30 | u8 tdf_cycles:4; | ||
31 | }; | ||
32 | |||
33 | extern void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config); | ||
34 | extern void __init at91sam9_ioremap_smc(int id, u32 addr); | 11 | extern void __init at91sam9_ioremap_smc(int id, u32 addr); |