Skip to content

Commit

Permalink
Merge branch 'for-linus-sa1100' of git://git.armlinux.org.uk/~rmk/lin…
Browse files Browse the repository at this point in the history
…ux-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
  • Loading branch information
torvalds committed Apr 9, 2018
2 parents 4a1e005 + 64b2f12 commit 7886e8a
Show file tree
Hide file tree
Showing 20 changed files with 307 additions and 477 deletions.
4 changes: 4 additions & 0 deletions arch/arm/mach-sa1100/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ config SA1100_ASSABET
bool "Assabet"
select ARM_SA1110_CPUFREQ
select GPIO_REG
select REGULATOR
select REGULATOR_FIXED_VOLTAGE
help
Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
Microprocessor Development Board (also known as the Assabet).
Expand Down Expand Up @@ -137,6 +139,8 @@ config SA1100_PLEB
config SA1100_SHANNON
bool "Shannon"
select ARM_SA1100_CPUFREQ
select REGULATOR
select REGULATOR_FIXED_VOLTAGE
help
The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
limited edition webphone produced by Philips. The Shannon is a SA1100
Expand Down
39 changes: 38 additions & 1 deletion arch/arm/mach-sa1100/assabet.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/gpio/gpio-reg.h>
#include <linux/gpio/machine.h>
#include <linux/ioport.h>
#include <linux/platform_data/sa11x0-serial.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/mfd/ucb1x00.h>
Expand Down Expand Up @@ -445,6 +448,29 @@ static struct resource neponset_resources[] = {
};
#endif

static struct gpiod_lookup_table assabet_cf_gpio_table = {
.dev_id = "sa11x0-pcmcia.1",
.table = {
GPIO_LOOKUP("gpio", 21, "ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 22, "detect", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio", 24, "bvd2", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 25, "bvd1", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("assabet", 1, "reset", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("assabet", 7, "bus-enable", GPIO_ACTIVE_LOW),
{ },
},
};

static struct regulator_consumer_supply assabet_cf_vcc_consumers[] = {
REGULATOR_SUPPLY("vcc", "sa11x0-pcmcia.1"),
};

static struct fixed_voltage_config assabet_cf_vcc_pdata __initdata = {
.supply_name = "cf-power",
.microvolts = 3300000,
.enable_high = 1,
};

static void __init assabet_init(void)
{
/*
Expand Down Expand Up @@ -490,6 +516,11 @@ static void __init assabet_init(void)
platform_device_register_simple("neponset", 0,
neponset_resources, ARRAY_SIZE(neponset_resources));
#endif
} else {
sa11x0_register_fixed_regulator(0, &assabet_cf_vcc_pdata,
assabet_cf_vcc_consumers,
ARRAY_SIZE(assabet_cf_vcc_consumers));

}

#ifndef ASSABET_PAL_VIDEO
Expand All @@ -501,6 +532,9 @@ static void __init assabet_init(void)
ARRAY_SIZE(assabet_flash_resources));
sa11x0_register_irda(&assabet_irda_data);
sa11x0_register_mcp(&assabet_mcp_data);

if (!machine_has_neponset())
sa11x0_register_pcmcia(1, &assabet_cf_gpio_table);
}

/*
Expand Down Expand Up @@ -768,6 +802,7 @@ fs_initcall(assabet_leds_init);

void __init assabet_init_irq(void)
{
unsigned int assabet_gpio_base;
u32 def_val;

sa1100_init_irq();
Expand All @@ -782,7 +817,9 @@ void __init assabet_init_irq(void)
*
* This must precede any driver calls to BCR_set() or BCR_clear().
*/
assabet_init_gpio((void *)&ASSABET_BCR, def_val);
assabet_gpio_base = assabet_init_gpio((void *)&ASSABET_BCR, def_val);

assabet_cf_vcc_pdata.gpio = assabet_gpio_base + 0;
}

MACHINE_START(ASSABET, "Intel-Assabet")
Expand Down
18 changes: 15 additions & 3 deletions arch/arm/mach-sa1100/cerf.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/init.h>
#include <linux/gpio/machine.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/platform_data/sa11x0-serial.h>
Expand Down Expand Up @@ -45,6 +46,19 @@ static struct platform_device cerfuart2_device = {
.resource = cerfuart2_resources,
};

/* Compact Flash */
static struct gpiod_lookup_table cerf_cf_gpio_table = {
.dev_id = "sa11x0-pcmcia.1",
.table = {
GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW),
{ },
},
};

/* LEDs */
struct gpio_led cerf_gpio_leds[] = {
{
Expand Down Expand Up @@ -151,9 +165,6 @@ static void __init cerf_map_io(void)
sa1100_register_uart(0, 3);
sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
sa1100_register_uart(2, 1);

/* set some GPDR bits here while it's safe */
GPDR |= CERF_GPIO_CF_RESET;
}

static struct mcp_plat_data cerf_mcp_data = {
Expand All @@ -167,6 +178,7 @@ static void __init cerf_init(void)
platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
sa11x0_register_mcp(&cerf_mcp_data);
sa11x0_register_pcmcia(1, &cerf_cf_gpio_table);
}

MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-sa1100/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ static struct clk_lookup sa11xx_clkregs[] = {
CLKDEV_INIT("sa1100-rtc", NULL, NULL),
CLKDEV_INIT("sa11x0-fb", NULL, &clk_cpu),
CLKDEV_INIT("sa11x0-pcmcia", NULL, &clk_cpu),
CLKDEV_INIT("sa11x0-pcmcia.0", NULL, &clk_cpu),
CLKDEV_INIT("sa11x0-pcmcia.1", NULL, &clk_cpu),
/* sa1111 names devices using internal offsets, PCMCIA is at 0x1800 */
CLKDEV_INIT("1800", NULL, &clk_cpu),
CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864),
Expand Down
44 changes: 43 additions & 1 deletion arch/arm/mach-sa1100/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* published by the Free Software Foundation.
*/
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
Expand All @@ -20,6 +21,8 @@
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/irqchip/irq-sa11x0.h>

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

static bool sa11x0pcmcia_legacy = true;
static struct platform_device sa11x0pcmcia_device = {
.name = "sa11x0-pcmcia",
.id = -1,
};

void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *table)
{
if (table)
gpiod_add_lookup_table(table);
platform_device_register_simple("sa11x0-pcmcia", socket, NULL, 0);
sa11x0pcmcia_legacy = false;
}

static struct platform_device sa11x0mtd_device = {
.name = "sa1100-mtd",
.id = -1,
Expand Down Expand Up @@ -311,14 +323,19 @@ static struct platform_device *sa11x0_devices[] __initdata = {
&sa11x0uart1_device,
&sa11x0uart3_device,
&sa11x0ssp_device,
&sa11x0pcmcia_device,
&sa11x0rtc_device,
&sa11x0dma_device,
};

static int __init sa1100_init(void)
{
pm_power_off = sa1100_power_off;

if (sa11x0pcmcia_legacy)
platform_device_register(&sa11x0pcmcia_device);

regulator_has_full_constraints();

return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
}

Expand All @@ -329,6 +346,31 @@ void __init sa11x0_init_late(void)
sa11x0_pm_init();
}

int __init sa11x0_register_fixed_regulator(int n,
struct fixed_voltage_config *cfg,
struct regulator_consumer_supply *supplies, unsigned num_supplies)
{
struct regulator_init_data *id;

cfg->init_data = id = kzalloc(sizeof(*cfg->init_data), GFP_KERNEL);
if (!cfg->init_data)
return -ENOMEM;

if (cfg->gpio < 0)
id->constraints.always_on = 1;
id->constraints.name = cfg->supply_name;
id->constraints.min_uV = cfg->microvolts;
id->constraints.max_uV = cfg->microvolts;
id->constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
id->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
id->consumer_supplies = supplies;
id->num_consumer_supplies = num_supplies;

platform_device_register_resndata(NULL, "reg-fixed-voltage", n,
NULL, 0, cfg, sizeof(*cfg));
return 0;
}

/*
* Common I/O mapping:
*
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/mach-sa1100/generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,11 @@ static inline int sa11x0_pm_init(void) { return 0; }
#endif

int sa11xx_clk_init(void);

struct gpiod_lookup_table;
void sa11x0_register_pcmcia(int socket, struct gpiod_lookup_table *);

struct fixed_voltage_config;
struct regulator_consumer_supply;
int sa11x0_register_fixed_regulator(int n, struct fixed_voltage_config *cfg,
struct regulator_consumer_supply *supplies, unsigned num_supplies);
17 changes: 17 additions & 0 deletions arch/arm/mach-sa1100/h3xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include <linux/kernel.h>
#include <linux/gpio/machine.h>
#include <linux/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
Expand Down Expand Up @@ -264,8 +265,24 @@ static struct platform_device *h3xxx_devices[] = {
&h3xxx_micro_asic,
};

static struct gpiod_lookup_table h3xxx_pcmcia_gpio_table = {
.dev_id = "sa11x0-pcmcia",
.table = {
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD0,
"pcmcia0-detect", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ0,
"pcmcia0-ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_CD1,
"pcmcia1-detect", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio", H3XXX_GPIO_PCMCIA_IRQ1,
"pcmcia1-ready", GPIO_ACTIVE_HIGH),
{ },
},
};

void __init h3xxx_mach_init(void)
{
gpiod_add_lookup_table(&h3xxx_pcmcia_gpio_table);
sa1100_register_uart_fns(&h3xxx_port_fns);
sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-sa1100/include/mach/assabet.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,4 @@ extern void assabet_uda1341_reset(int set);
#define ASSABET_GPIO_BATT_LOW GPIO_GPIO (26) /* Low battery */
#define ASSABET_GPIO_RCLK GPIO_GPIO (26) /* CCLK/2 */

/* These are gpiolib GPIO numbers, not bitmasks */
#define ASSABET_GPIO_CF_IRQ 21 /* CF IRQ */
#define ASSABET_GPIO_CF_CD 22 /* CF CD */
#define ASSABET_GPIO_CF_BVD2 24 /* CF BVD / IOSPKR */
#define ASSABET_GPIO_CF_BVD1 25 /* CF BVD / IOSTSCHG */

#endif
23 changes: 23 additions & 0 deletions arch/arm/mach-sa1100/nanoengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include <linux/init.h>
#include <linux/gpio/machine.h>
#include <linux/kernel.h>
#include <linux/platform_data/sa11x0-serial.h>
#include <linux/mtd/mtd.h>
Expand Down Expand Up @@ -99,8 +100,30 @@ static void __init nanoengine_map_io(void)
Ser2HSCR0 = 0;
}

static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = {
.dev_id = "sa11x0-pcmcia.0",
.table = {
GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH),
{ },
},
};

static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = {
.dev_id = "sa11x0-pcmcia.1",
.table = {
GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH),
{ },
},
};

static void __init nanoengine_init(void)
{
sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table);
sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table);
sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
ARRAY_SIZE(nanoengine_flash_resources));
}
Expand Down
Loading

0 comments on commit 7886e8a

Please sign in to comment.