diff options
author | Olof Johansson <olof@lixom.net> | 2013-12-29 13:15:03 -0800 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-12-29 13:15:03 -0800 |
commit | acdcbd63314f235fc3f4e580bf2db49161b35d06 (patch) | |
tree | 80ac064ea50697268f49cd4f9b771b733c9770c0 /arch/arm/mach-shmobile/board-lager.c | |
parent | 91a38be875f2dc8efc53ff2634beec5f05f25d7b (diff) | |
parent | be0647d556985ae58a42e7fc3751a293c418c41e (diff) |
Merge tag 'renesas-boards-for-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/boards
From Simon Horman:
Renesas ARM based SoC board updates for v3.14
* Global
- Kconfig: Mention Renesas ARM SoCs instead of SH-Mobile
* r7s72100 SoC (RZ/A1H) based Genmai Board
- Add Multiplatform support
- Add Reference DT
* r8a7791 (R-Car M2) based Koelsch board
- Add pinctrl_register_mappings() for Koelsch
- Hook up SW30-SW36 on Koelsch
- Mark GPIO keys as wake-up sources
- Use ->init_late()
- Add Multiplatform support
- Set .debounce_interval for GPIO keys
- Add SW2 to GPIO keys
- Add Led 6, 7 and 8 support
- Add reference DT
- Enable PFC/GPIO
* r8a7790 (R-Car H2) based Lager board
- Add gpio/fixed regulator for SDHI
- Add SPI FLASH support on QSPI
- Mark GPIO keys as wake-up sources
- Use ->init_late()
- Set .debounce_interval for GPIO keys
* r8a7778 (R-Car M1) based Bock-W board
- bockw: remove unused RSND_SSI_CLK_FROM_ADG
- Set .debounce_interval for GPIO keys
- Correct FPGA ioremap area
- Use regulator for MMCIF
* r8a7740 (R-Mobile A1) based Armadillo board
- Correct FSI address size
* sh7374 (SH-Mobile AP4) based Mackerel board
- Use pinconf API to configure pin pull-down
- clk_round_rate() can return a zero to indicate an error
* tag 'renesas-boards-for-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: (75 commits)
ARM: shmobile: lager: add gpio/fixed regulator for SDHI
ARM: shmobile: bockw: remove unused RSND_SSI_CLK_FROM_ADG
ARM: shmobile: armadillo: fixup FSI address size
ARM: Kconfig: Mention Renesas ARM SoCs instead of SH-Mobile
ARM: shmobile: mackerel: Use pinconf API to configure pin pull-down
ARM: shmobile: Lager:add SPI FLASH support on QSPI
ARM: shmobile: mackerel: clk_round_rate() can return a zero to indicate an error
ARM: shmobile: Add pinctrl_register_mappings() for Koelsch
ARM: shmobile: Use ->init_late() on Lager
ARM: shmobile: Hook up SW30-SW36 on Koelsch
ARM: shmobile: koelsch: mark GPIO keys as wake-up sources
ARM: shmobile: Use ->init_late() on Koelsch
ARM: shmobile: lager: mark GPIO keys as wake-up sources
ARM: shmobile: r7s72100 Genmai Multiplatform
ARM: shmobile: r7s72100 Genmai DT reference C bits
ARM: shmobile: r7s72100 Genmai DT reference DTS bits
ARM: shmobile: Initial r8a7791 and Koelsch multiplatform support
ARM: shmobile: koelsch: set .debounce_interval
ARM: shmobile: lager: set .debounce_interval
ARM: shmobile: bockw: add pin pull-up setting for SDHI
...
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-shmobile/board-lager.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-lager.c | 153 |
1 files changed, 150 insertions, 3 deletions
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index e0406fd37390..f20c10a18543 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -31,7 +31,9 @@ #include <linux/platform_data/rcar-du.h> #include <linux/platform_device.h> #include <linux/phy.h> +#include <linux/regulator/driver.h> #include <linux/regulator/fixed.h> +#include <linux/regulator/gpio-regulator.h> #include <linux/regulator/machine.h> #include <linux/sh_eth.h> #include <mach/common.h> @@ -39,6 +41,11 @@ #include <mach/r8a7790.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/mtd.h> +#include <linux/spi/flash.h> +#include <linux/spi/rspi.h> +#include <linux/spi/spi.h> /* DU */ static struct rcar_du_encoder_data lager_du_encoders[] = { @@ -120,7 +127,8 @@ static const struct gpio_led_platform_data lager_leds_pdata __initconst = { /* GPIO KEY */ #define GPIO_KEY(c, g, d, ...) \ - { .code = c, .gpio = g, .desc = d, .active_low = 1 } + { .code = c, .gpio = g, .desc = d, .active_low = 1, \ + .wakeup = 1, .debounce_interval = 20 } static struct gpio_keys_button gpio_buttons[] = { GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"), @@ -140,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] = REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"), }; +/* + * SDHI regulator macro + * + ** FIXME** + * Lager board vqmmc is provided via DA9063 PMIC chip, + * and we should use ${LINK}/drivers/mfd/da9063-* driver for it. + * but, it doesn't have regulator support at this point. + * It uses gpio-regulator for vqmmc as quick-hack. + */ +#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin) \ +static struct regulator_consumer_supply vcc_sdhi##idx##_consumer = \ + REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx); \ + \ +static struct regulator_init_data vcc_sdhi##idx##_init_data = { \ + .constraints = { \ + .valid_ops_mask = REGULATOR_CHANGE_STATUS, \ + }, \ + .consumer_supplies = &vcc_sdhi##idx##_consumer, \ + .num_consumer_supplies = 1, \ +}; \ + \ +static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\ + .supply_name = "SDHI" #idx "Vcc", \ + .microvolts = 3300000, \ + .gpio = vdd_pin, \ + .enable_high = 1, \ + .init_data = &vcc_sdhi##idx##_init_data, \ +}; \ + \ +static struct regulator_consumer_supply vccq_sdhi##idx##_consumer = \ + REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx); \ + \ +static struct regulator_init_data vccq_sdhi##idx##_init_data = { \ + .constraints = { \ + .input_uV = 3300000, \ + .min_uV = 1800000, \ + .max_uV = 3300000, \ + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \ + REGULATOR_CHANGE_STATUS, \ + }, \ + .consumer_supplies = &vccq_sdhi##idx##_consumer, \ + .num_consumer_supplies = 1, \ +}; \ + \ +static struct gpio vccq_sdhi##idx##_gpio = \ + { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx }; \ + \ +static struct gpio_regulator_state vccq_sdhi##idx##_states[] = { \ + { .value = 1800000, .gpios = 0 }, \ + { .value = 3300000, .gpios = 1 }, \ +}; \ + \ +static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\ + .supply_name = "vqmmc", \ + .gpios = &vccq_sdhi##idx##_gpio, \ + .nr_gpios = 1, \ + .states = vccq_sdhi##idx##_states, \ + .nr_states = ARRAY_SIZE(vccq_sdhi##idx##_states), \ + .type = REGULATOR_VOLTAGE, \ + .init_data = &vccq_sdhi##idx##_init_data, \ +}; + +SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29)); +SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30)); + /* MMCIF */ static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = { .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, @@ -148,7 +221,7 @@ static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = { }; static const struct resource mmcif1_resources[] __initconst = { - DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"), + DEFINE_RES_MEM(0xee220000, 0x80), DEFINE_RES_IRQ(gic_spi(170)), }; @@ -165,6 +238,59 @@ static const struct resource ether_resources[] __initconst = { DEFINE_RES_IRQ(gic_spi(162)), }; +/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64Mb) */ +static struct mtd_partition spi_flash_part[] = { + /* Reserved for user loader program, read-only */ + { + .name = "loader", + .offset = 0, + .size = SZ_256K, + .mask_flags = MTD_WRITEABLE, + }, + /* Reserved for user program, read-only */ + { + .name = "user", + .offset = MTDPART_OFS_APPEND, + .size = SZ_4M, + .mask_flags = MTD_WRITEABLE, + }, + /* All else is writable (e.g. JFFS2) */ + { + .name = "flash", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0, + }, +}; + +static struct flash_platform_data spi_flash_data = { + .name = "m25p80", + .parts = spi_flash_part, + .nr_parts = ARRAY_SIZE(spi_flash_part), + .type = "s25fl512s", +}; + +static const struct rspi_plat_data qspi_pdata __initconst = { + .num_chipselect = 1, +}; + +static const struct spi_board_info spi_info[] __initconst = { + { + .modalias = "m25p80", + .platform_data = &spi_flash_data, + .mode = SPI_MODE_0, + .max_speed_hz = 30000000, + .bus_num = 0, + .chip_select = 0, + }, +}; + +/* QSPI resource */ +static const struct resource qspi_resources[] __initconst = { + DEFINE_RES_MEM(0xe6b10000, 0x1000), + DEFINE_RES_IRQ(gic_spi(184)), +}; + static const struct pinctrl_map lager_pinctrl_map[] = { /* DU (CN10: ARGB0, CN13: LVDS) */ PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", @@ -197,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = { static void __init lager_add_standard_devices(void) { + int fixed_regulator_idx = 0; + int gpio_regulator_idx = 0; + r8a7790_clock_init(); pinctrl_register_mappings(lager_pinctrl_map, @@ -210,7 +339,8 @@ static void __init lager_add_standard_devices(void) platform_device_register_data(&platform_bus, "gpio-keys", -1, &lager_keys_pdata, sizeof(lager_keys_pdata)); - regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, + regulator_register_always_on(fixed_regulator_idx++, + "fixed-3.3V", fixed3v3_power_consumers, ARRAY_SIZE(fixed3v3_power_consumers), 3300000); platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, mmcif1_resources, ARRAY_SIZE(mmcif1_resources), @@ -222,6 +352,22 @@ static void __init lager_add_standard_devices(void) ðer_pdata, sizeof(ether_pdata)); lager_add_du_device(); + + platform_device_register_resndata(&platform_bus, "qspi", 0, + qspi_resources, + ARRAY_SIZE(qspi_resources), + &qspi_pdata, sizeof(qspi_pdata)); + spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); + + platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, + &vcc_sdhi0_info, sizeof(struct fixed_voltage_config)); + platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, + &vcc_sdhi2_info, sizeof(struct fixed_voltage_config)); + + platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, + &vccq_sdhi0_info, sizeof(struct gpio_regulator_config)); + platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, + &vccq_sdhi2_info, sizeof(struct gpio_regulator_config)); } /* @@ -260,5 +406,6 @@ DT_MACHINE_START(LAGER_DT, "lager") .init_early = r8a7790_init_early, .init_time = rcar_gen2_timer_init, .init_machine = lager_init, + .init_late = shmobile_init_late, .dt_compat = lager_boards_compat_dt, MACHINE_END |