Skip to content

Commit 7886e8a

Browse files
committed
Merge branch 'for-linus-sa1100' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM SA1100 updates from Russell King: "We have support for arbitary MMIO registers providing platform GPIOs, which allows us to abstract some of the SA11x0 CF support. This set of updates makes that change" * 'for-linus-sa1100' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: sa1100/simpad: switch simpad CF to use gpiod APIs ARM: sa1100/shannon: convert to generic CF sockets ARM: sa1100/nanoengine: convert to generic CF sockets ARM: sa1100/h3xxx: switch h3xxx PCMCIA to use gpiod APIs ARM: sa1100/cerf: convert to generic CF sockets ARM: sa1100/assabet: convert to generic CF sockets ARM: sa1100: provide infrastructure to support generic CF sockets pcmcia: sa1100: provide generic CF support
2 parents 4a1e005 + 64b2f12 commit 7886e8a

20 files changed

+307
-477
lines changed

arch/arm/mach-sa1100/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ config SA1100_ASSABET
66
bool "Assabet"
77
select ARM_SA1110_CPUFREQ
88
select GPIO_REG
9+
select REGULATOR
10+
select REGULATOR_FIXED_VOLTAGE
911
help
1012
Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
1113
Microprocessor Development Board (also known as the Assabet).
@@ -137,6 +139,8 @@ config SA1100_PLEB
137139
config SA1100_SHANNON
138140
bool "Shannon"
139141
select ARM_SA1100_CPUFREQ
142+
select REGULATOR
143+
select REGULATOR_FIXED_VOLTAGE
140144
help
141145
The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
142146
limited edition webphone produced by Philips. The Shannon is a SA1100

arch/arm/mach-sa1100/assabet.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#include <linux/module.h>
1515
#include <linux/errno.h>
1616
#include <linux/gpio/gpio-reg.h>
17+
#include <linux/gpio/machine.h>
1718
#include <linux/ioport.h>
1819
#include <linux/platform_data/sa11x0-serial.h>
20+
#include <linux/regulator/fixed.h>
21+
#include <linux/regulator/machine.h>
1922
#include <linux/serial_core.h>
2023
#include <linux/platform_device.h>
2124
#include <linux/mfd/ucb1x00.h>
@@ -445,6 +448,29 @@ static struct resource neponset_resources[] = {
445448
};
446449
#endif
447450

451+
static struct gpiod_lookup_table assabet_cf_gpio_table = {
452+
.dev_id = "sa11x0-pcmcia.1",
453+
.table = {
454+
GPIO_LOOKUP("gpio", 21, "ready", GPIO_ACTIVE_HIGH),
455+
GPIO_LOOKUP("gpio", 22, "detect", GPIO_ACTIVE_LOW),
456+
GPIO_LOOKUP("gpio", 24, "bvd2", GPIO_ACTIVE_HIGH),
457+
GPIO_LOOKUP("gpio", 25, "bvd1", GPIO_ACTIVE_HIGH),
458+
GPIO_LOOKUP("assabet", 1, "reset", GPIO_ACTIVE_HIGH),
459+
GPIO_LOOKUP("assabet", 7, "bus-enable", GPIO_ACTIVE_LOW),
460+
{ },
461+
},
462+
};
463+
464+
static struct regulator_consumer_supply assabet_cf_vcc_consumers[] = {
465+
REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"),
466+
};
467+
468+
static struct fixed_voltage_config assabet_cf_vcc_pdata __initdata = {
469+
.supply_name = "cf-power",
470+
.microvolts = 3300000,
471+
.enable_high = 1,
472+
};
473+
448474
static void __init assabet_init(void)
449475
{
450476
/*
@@ -490,6 +516,11 @@ static void __init assabet_init(void)
490516
platform_device_register_simple("neponset", 0,
491517
neponset_resources, ARRAY_SIZE(neponset_resources));
492518
#endif
519+
} else {
520+
sa11x0_register_fixed_regulator(0, &assabet_cf_vcc_pdata,
521+
assabet_cf_vcc_consumers,
522+
ARRAY_SIZE(assabet_cf_vcc_consumers));
523+
493524
}
494525

495526
#ifndef ASSABET_PAL_VIDEO
@@ -501,6 +532,9 @@ static void __init assabet_init(void)
501532
ARRAY_SIZE(assabet_flash_resources));
502533
sa11x0_register_irda(&assabet_irda_data);
503534
sa11x0_register_mcp(&assabet_mcp_data);
535+
536+
if (!machine_has_neponset())
537+
sa11x0_register_pcmcia(1, &assabet_cf_gpio_table);
504538
}
505539

506540
/*
@@ -768,6 +802,7 @@ fs_initcall(assabet_leds_init);
768802

769803
void __init assabet_init_irq(void)
770804
{
805+
unsigned int assabet_gpio_base;
771806
u32 def_val;
772807

773808
sa1100_init_irq();
@@ -782,7 +817,9 @@ void __init assabet_init_irq(void)
782817
*
783818
* This must precede any driver calls to BCR_set() or BCR_clear().
784819
*/
785-
assabet_init_gpio((void *)&ASSABET_BCR, def_val);
820+
assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val);
821+
822+
assabet_cf_vcc_pdata.gpio = assabet_gpio_base + 0;
786823
}
787824

788825
MACHINE_START(ASSABET, "Intel-Assabet")

arch/arm/mach-sa1100/cerf.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
#include <linux/init.h>
14+
#include <linux/gpio/machine.h>
1415
#include <linux/kernel.h>
1516
#include <linux/tty.h>
1617
#include <linux/platform_data/sa11x0-serial.h>
@@ -45,6 +46,19 @@ static struct platform_device cerfuart2_device = {
4546
.resource = cerfuart2_resources,
4647
};
4748

49+
/* Compact Flash */
50+
static struct gpiod_lookup_table cerf_cf_gpio_table = {
51+
.dev_id = "sa11x0-pcmcia.1",
52+
.table = {
53+
GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH),
54+
GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH),
55+
GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH),
56+
GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH),
57+
GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW),
58+
{ },
59+
},
60+
};
61+
4862
/* LEDs */
4963
struct gpio_led cerf_gpio_leds[] = {
5064
{
@@ -151,9 +165,6 @@ static void __init cerf_map_io(void)
151165
sa1100_register_uart(0, 3);
152166
sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
153167
sa1100_register_uart(2, 1);
154-
155-
/* set some GPDR bits here while it's safe */
156-
GPDR |= CERF_GPIO_CF_RESET;
157168
}
158169

159170
static struct mcp_plat_data cerf_mcp_data = {
@@ -167,6 +178,7 @@ static void __init cerf_init(void)
167178
platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
168179
sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
169180
sa11x0_register_mcp(&cerf_mcp_data);
181+
sa11x0_register_pcmcia(1, &cerf_cf_gpio_table);
170182
}
171183

172184
MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")

arch/arm/mach-sa1100/clock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ static struct clk_lookup sa11xx_clkregs[] = {
163163
CLKDEV_INIT("sa1100-rtc", NULL, NULL),
164164
CLKDEV_INIT("sa11x0-fb", NULL, &clk_cpu),
165165
CLKDEV_INIT("sa11x0-pcmcia", NULL, &clk_cpu),
166+
CLKDEV_INIT("sa11x0-pcmcia.0", NULL, &clk_cpu),
167+
CLKDEV_INIT("sa11x0-pcmcia.1", NULL, &clk_cpu),
166168
/* sa1111 names devices using internal offsets, PCMCIA is at 0x1800 */
167169
CLKDEV_INIT("1800", NULL, &clk_cpu),
168170
CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864),

arch/arm/mach-sa1100/generic.c

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* published by the Free Software Foundation.
1111
*/
1212
#include <linux/gpio.h>
13+
#include <linux/gpio/machine.h>
1314
#include <linux/module.h>
1415
#include <linux/kernel.h>
1516
#include <linux/init.h>
@@ -20,6 +21,8 @@
2021
#include <linux/ioport.h>
2122
#include <linux/platform_device.h>
2223
#include <linux/reboot.h>
24+
#include <linux/regulator/fixed.h>
25+
#include <linux/regulator/machine.h>
2326
#include <linux/irqchip/irq-sa11x0.h>
2427

2528
#include <video/sa1100fb.h>
@@ -232,11 +235,20 @@ void sa11x0_register_lcd(struct sa1100fb_mach_info *inf)
232235
sa11x0_register_device(&sa11x0fb_device, inf);
233236
}
234237

238+
static bool sa11x0pcmcia_legacy = true;
235239
static struct platform_device sa11x0pcmcia_device = {
236240
.name = "sa11x0-pcmcia",
237241
.id = -1,
238242
};
239243

244+
void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *table)
245+
{
246+
if (table)
247+
gpiod_add_lookup_table(table);
248+
platform_device_register_simple("sa11x0-pcmcia", socket, NULL, 0);
249+
sa11x0pcmcia_legacy = false;
250+
}
251+
240252
static struct platform_device sa11x0mtd_device = {
241253
.name = "sa1100-mtd",
242254
.id = -1,
@@ -311,14 +323,19 @@ static struct platform_device *sa11x0_devices[] __initdata = {
311323
&sa11x0uart1_device,
312324
&sa11x0uart3_device,
313325
&sa11x0ssp_device,
314-
&sa11x0pcmcia_device,
315326
&sa11x0rtc_device,
316327
&sa11x0dma_device,
317328
};
318329

319330
static int __init sa1100_init(void)
320331
{
321332
pm_power_off = sa1100_power_off;
333+
334+
if (sa11x0pcmcia_legacy)
335+
platform_device_register(&sa11x0pcmcia_device);
336+
337+
regulator_has_full_constraints();
338+
322339
return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
323340
}
324341

@@ -329,6 +346,31 @@ void __init sa11x0_init_late(void)
329346
sa11x0_pm_init();
330347
}
331348

349+
int __init sa11x0_register_fixed_regulator(int n,
350+
struct fixed_voltage_config *cfg,
351+
struct regulator_consumer_supply *supplies, unsigned num_supplies)
352+
{
353+
struct regulator_init_data *id;
354+
355+
cfg->init_data = id = kzalloc(sizeof(*cfg->init_data), GFP_KERNEL);
356+
if (!cfg->init_data)
357+
return -ENOMEM;
358+
359+
if (cfg->gpio < 0)
360+
id->constraints.always_on = 1;
361+
id->constraints.name = cfg->supply_name;
362+
id->constraints.min_uV = cfg->microvolts;
363+
id->constraints.max_uV = cfg->microvolts;
364+
id->constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
365+
id->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
366+
id->consumer_supplies = supplies;
367+
id->num_consumer_supplies = num_supplies;
368+
369+
platform_device_register_resndata(NULL, "reg-fixed-voltage", n,
370+
NULL, 0, cfg, sizeof(*cfg));
371+
return 0;
372+
}
373+
332374
/*
333375
* Common I/O mapping:
334376
*

arch/arm/mach-sa1100/generic.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,11 @@ static inline int sa11x0_pm_init(void) { return 0; }
4747
#endif
4848

4949
int sa11xx_clk_init(void);
50+
51+
struct gpiod_lookup_table;
52+
void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *);
53+
54+
struct fixed_voltage_config;
55+
struct regulator_consumer_supply;
56+
int sa11x0_register_fixed_regulator(int n, struct fixed_voltage_config *cfg,
57+
struct regulator_consumer_supply *supplies, unsigned num_supplies);

arch/arm/mach-sa1100/h3xxx.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
#include <linux/kernel.h>
14+
#include <linux/gpio/machine.h>
1415
#include <linux/gpio.h>
1516
#include <linux/gpio_keys.h>
1617
#include <linux/input.h>
@@ -264,8 +265,24 @@ static struct platform_device *h3xxx_devices[] = {
264265
&h3xxx_micro_asic,
265266
};
266267

268+
static struct gpiod_lookup_table h3xxx_pcmcia_gpio_table = {
269+
.dev_id = "sa11x0-pcmcia",
270+
.table = {
271+
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD0,
272+
"pcmcia0-detect", GPIO_ACTIVE_LOW),
273+
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ0,
274+
"pcmcia0-ready", GPIO_ACTIVE_HIGH),
275+
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD1,
276+
"pcmcia1-detect", GPIO_ACTIVE_LOW),
277+
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ1,
278+
"pcmcia1-ready", GPIO_ACTIVE_HIGH),
279+
{ },
280+
},
281+
};
282+
267283
void __init h3xxx_mach_init(void)
268284
{
285+
gpiod_add_lookup_table(&h3xxx_pcmcia_gpio_table);
269286
sa1100_register_uart_fns(&h3xxx_port_fns);
270287
sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
271288
platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));

arch/arm/mach-sa1100/include/mach/assabet.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,4 @@ extern void assabet_uda1341_reset(int set);
9696
#define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */
9797
#define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */
9898

99-
/* These are gpiolib GPIO numbers, not bitmasks */
100-
#define ASSABET_GPIO_CF_IRQ 21 /* CF IRQ */
101-
#define ASSABET_GPIO_CF_CD 22 /* CF CD */
102-
#define ASSABET_GPIO_CF_BVD2 24 /* CF BVD / IOSPKR */
103-
#define ASSABET_GPIO_CF_BVD1 25 /* CF BVD / IOSTSCHG */
104-
10599
#endif

arch/arm/mach-sa1100/nanoengine.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
#include <linux/init.h>
15+
#include <linux/gpio/machine.h>
1516
#include <linux/kernel.h>
1617
#include <linux/platform_data/sa11x0-serial.h>
1718
#include <linux/mtd/mtd.h>
@@ -99,8 +100,30 @@ static void __init nanoengine_map_io(void)
99100
Ser2HSCR0 = 0;
100101
}
101102

103+
static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = {
104+
.dev_id = "sa11x0-pcmcia.0",
105+
.table = {
106+
GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH),
107+
GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW),
108+
GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH),
109+
{ },
110+
},
111+
};
112+
113+
static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = {
114+
.dev_id = "sa11x0-pcmcia.1",
115+
.table = {
116+
GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH),
117+
GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW),
118+
GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH),
119+
{ },
120+
},
121+
};
122+
102123
static void __init nanoengine_init(void)
103124
{
125+
sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table);
126+
sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table);
104127
sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
105128
ARRAY_SIZE(nanoengine_flash_resources));
106129
}

0 commit comments

Comments
 (0)