forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/arch/arm/mach-ep93xx/vision_ep9307.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * arch/arm/mach-ep93xx/vision_ep9307.c
34 * Vision Engraving Systems EP9307 SoM support.
45 *
56 * Copyright (C) 2008-2011 Vision Engraving Systems
67 * 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.
128 */
139
1410 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -18,6 +14,7 @@
1814 #include <linux/platform_device.h>
1915 #include <linux/irq.h>
2016 #include <linux/gpio.h>
17
+#include <linux/gpio/machine.h>
2118 #include <linux/fb.h>
2219 #include <linux/io.h>
2320 #include <linux/mtd/partitions.h>
....@@ -30,10 +27,10 @@
3027
3128 #include <sound/cs4271.h>
3229
33
-#include <mach/hardware.h>
30
+#include "hardware.h"
3431 #include <linux/platform_data/video-ep93xx.h>
3532 #include <linux/platform_data/spi-ep93xx.h>
36
-#include <mach/gpio-ep93xx.h>
33
+#include "gpio-ep93xx.h"
3734
3835 #include <asm/mach-types.h>
3936 #include <asm/mach/map.h>
....@@ -202,11 +199,18 @@
202199 .detect_delay = 100,
203200 .powerup_msecs = 100,
204201 .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),
209202 .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
+ },
210214 };
211215
212216 /*************************************************************************
....@@ -237,15 +241,17 @@
237241 },
238242 };
239243
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
+ },
244252 };
245253
246254 static struct ep93xx_spi_info vision_spi_master __initdata = {
247
- .chipselect = vision_spi_chipselects,
248
- .num_chipselect = ARRAY_SIZE(vision_spi_chipselects),
249255 .use_dma = 1,
250256 };
251257
....@@ -286,6 +292,8 @@
286292
287293 ep93xx_register_i2c(vision_i2c_info,
288294 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);
289297 ep93xx_register_spi(&vision_spi_master, vision_spi_board_info,
290298 ARRAY_SIZE(vision_spi_board_info));
291299 vision_register_i2s();