| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/arm/mach-ep93xx/vision_ep9307.c |
|---|
| 3 | 4 | * Vision Engraving Systems EP9307 SoM support. |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2008-2011 Vision Engraving Systems |
|---|
| 6 | 7 | * H Hartley Sweeten <hsweeten@visionengravers.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or (at |
|---|
| 11 | | - * your option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 18 | 14 | #include <linux/platform_device.h> |
|---|
| 19 | 15 | #include <linux/irq.h> |
|---|
| 20 | 16 | #include <linux/gpio.h> |
|---|
| 17 | +#include <linux/gpio/machine.h> |
|---|
| 21 | 18 | #include <linux/fb.h> |
|---|
| 22 | 19 | #include <linux/io.h> |
|---|
| 23 | 20 | #include <linux/mtd/partitions.h> |
|---|
| .. | .. |
|---|
| 30 | 27 | |
|---|
| 31 | 28 | #include <sound/cs4271.h> |
|---|
| 32 | 29 | |
|---|
| 33 | | -#include <mach/hardware.h> |
|---|
| 30 | +#include "hardware.h" |
|---|
| 34 | 31 | #include <linux/platform_data/video-ep93xx.h> |
|---|
| 35 | 32 | #include <linux/platform_data/spi-ep93xx.h> |
|---|
| 36 | | -#include <mach/gpio-ep93xx.h> |
|---|
| 33 | +#include "gpio-ep93xx.h" |
|---|
| 37 | 34 | |
|---|
| 38 | 35 | #include <asm/mach-types.h> |
|---|
| 39 | 36 | #include <asm/mach/map.h> |
|---|
| .. | .. |
|---|
| 202 | 199 | .detect_delay = 100, |
|---|
| 203 | 200 | .powerup_msecs = 100, |
|---|
| 204 | 201 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
|---|
| 205 | | - .flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO, |
|---|
| 206 | | - .cd_gpio = EP93XX_GPIO_LINE_EGPIO15, |
|---|
| 207 | | - .cd_debounce = 1, |
|---|
| 208 | | - .ro_gpio = EP93XX_GPIO_LINE_F(0), |
|---|
| 209 | 202 | .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, |
|---|
| 203 | +}; |
|---|
| 204 | + |
|---|
| 205 | +static struct gpiod_lookup_table vision_spi_mmc_gpio_table = { |
|---|
| 206 | + .dev_id = "mmc_spi.2", /* "mmc_spi @ CS2 */ |
|---|
| 207 | + .table = { |
|---|
| 208 | + /* Card detect */ |
|---|
| 209 | + GPIO_LOOKUP_IDX("B", 7, NULL, 0, GPIO_ACTIVE_LOW), |
|---|
| 210 | + /* Write protect */ |
|---|
| 211 | + GPIO_LOOKUP_IDX("F", 0, NULL, 1, GPIO_ACTIVE_HIGH), |
|---|
| 212 | + { }, |
|---|
| 213 | + }, |
|---|
| 210 | 214 | }; |
|---|
| 211 | 215 | |
|---|
| 212 | 216 | /************************************************************************* |
|---|
| .. | .. |
|---|
| 237 | 241 | }, |
|---|
| 238 | 242 | }; |
|---|
| 239 | 243 | |
|---|
| 240 | | -static int vision_spi_chipselects[] __initdata = { |
|---|
| 241 | | - EP93XX_GPIO_LINE_EGPIO6, |
|---|
| 242 | | - EP93XX_GPIO_LINE_EGPIO7, |
|---|
| 243 | | - EP93XX_GPIO_LINE_G(2), |
|---|
| 244 | +static struct gpiod_lookup_table vision_spi_cs_gpio_table = { |
|---|
| 245 | + .dev_id = "spi0", |
|---|
| 246 | + .table = { |
|---|
| 247 | + GPIO_LOOKUP_IDX("A", 6, "cs", 0, GPIO_ACTIVE_LOW), |
|---|
| 248 | + GPIO_LOOKUP_IDX("A", 7, "cs", 1, GPIO_ACTIVE_LOW), |
|---|
| 249 | + GPIO_LOOKUP_IDX("G", 2, "cs", 2, GPIO_ACTIVE_LOW), |
|---|
| 250 | + { }, |
|---|
| 251 | + }, |
|---|
| 244 | 252 | }; |
|---|
| 245 | 253 | |
|---|
| 246 | 254 | static struct ep93xx_spi_info vision_spi_master __initdata = { |
|---|
| 247 | | - .chipselect = vision_spi_chipselects, |
|---|
| 248 | | - .num_chipselect = ARRAY_SIZE(vision_spi_chipselects), |
|---|
| 249 | 255 | .use_dma = 1, |
|---|
| 250 | 256 | }; |
|---|
| 251 | 257 | |
|---|
| .. | .. |
|---|
| 286 | 292 | |
|---|
| 287 | 293 | ep93xx_register_i2c(vision_i2c_info, |
|---|
| 288 | 294 | ARRAY_SIZE(vision_i2c_info)); |
|---|
| 295 | + gpiod_add_lookup_table(&vision_spi_mmc_gpio_table); |
|---|
| 296 | + gpiod_add_lookup_table(&vision_spi_cs_gpio_table); |
|---|
| 289 | 297 | ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, |
|---|
| 290 | 298 | ARRAY_SIZE(vision_spi_board_info)); |
|---|
| 291 | 299 | vision_register_i2s(); |
|---|