forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 297b60346df8beafee954a0fd7c2d64f33f3b9bc
kernel/arch/arm/mach-pxa/zeus.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Support for the Arcom ZEUS.
34 *
....@@ -5,10 +6,6 @@
56 *
67 * Loosely based on Arcom's 2.6.16.28.
78 * Maintained by Marc Zyngier <maz@misterjones.org>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #include <linux/cpufreq.h>
....@@ -16,7 +13,9 @@
1613 #include <linux/leds.h>
1714 #include <linux/irq.h>
1815 #include <linux/pm.h>
16
+#include <linux/property.h>
1917 #include <linux/gpio.h>
18
+#include <linux/gpio/machine.h>
2019 #include <linux/serial_8250.h>
2120 #include <linux/dm9000.h>
2221 #include <linux/mmc/host.h>
....@@ -29,7 +28,6 @@
2928 #include <linux/platform_data/i2c-pxa.h>
3029 #include <linux/platform_data/pca953x.h>
3130 #include <linux/apm-emulation.h>
32
-#include <linux/can/platform/mcp251x.h>
3331 #include <linux/regulator/fixed.h>
3432 #include <linux/regulator/machine.h>
3533
....@@ -390,7 +388,7 @@
390388 };
391389
392390 /* SPI interface on SSP3 */
393
-static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = {
391
+static struct pxa2xx_spi_controller pxa2xx_spi_ssp3_master_info = {
394392 .num_chipselect = 1,
395393 .enable_dma = 1,
396394 };
....@@ -410,7 +408,6 @@
410408 static struct fixed_voltage_config can_regulator_pdata = {
411409 .supply_name = "CAN_SHDN",
412410 .microvolts = 3300000,
413
- .gpio = ZEUS_CAN_SHDN_GPIO,
414411 .init_data = &can_regulator_init_data,
415412 };
416413
....@@ -422,14 +419,24 @@
422419 },
423420 };
424421
425
-static struct mcp251x_platform_data zeus_mcp2515_pdata = {
426
- .oscillator_frequency = 16*1000*1000,
422
+static struct gpiod_lookup_table can_regulator_gpiod_table = {
423
+ .dev_id = "reg-fixed-voltage.0",
424
+ .table = {
425
+ GPIO_LOOKUP("gpio-pxa", ZEUS_CAN_SHDN_GPIO,
426
+ NULL, GPIO_ACTIVE_LOW),
427
+ { },
428
+ },
429
+};
430
+
431
+static const struct property_entry mcp251x_properties[] = {
432
+ PROPERTY_ENTRY_U32("clock-frequency", 16000000),
433
+ {}
427434 };
428435
429436 static struct spi_board_info zeus_spi_board_info[] = {
430437 [0] = {
431438 .modalias = "mcp2515",
432
- .platform_data = &zeus_mcp2515_pdata,
439
+ .properties = mcp251x_properties,
433440 .irq = PXA_GPIO_TO_IRQ(ZEUS_CAN_GPIO),
434441 .max_speed_hz = 1*1000*1000,
435442 .bus_num = 3,
....@@ -538,8 +545,6 @@
538545 static struct fixed_voltage_config zeus_ohci_regulator_config = {
539546 .supply_name = "vbus2",
540547 .microvolts = 5000000, /* 5.0V */
541
- .gpio = ZEUS_USB2_PWREN_GPIO,
542
- .enable_high = 1,
543548 .startup_delay = 0,
544549 .init_data = &zeus_ohci_regulator_data,
545550 };
....@@ -549,6 +554,15 @@
549554 .id = 1,
550555 .dev = {
551556 .platform_data = &zeus_ohci_regulator_config,
557
+ },
558
+};
559
+
560
+static struct gpiod_lookup_table zeus_ohci_regulator_gpiod_table = {
561
+ .dev_id = "reg-fixed-voltage.0",
562
+ .table = {
563
+ GPIO_LOOKUP("gpio-pxa", ZEUS_USB2_PWREN_GPIO,
564
+ NULL, GPIO_ACTIVE_HIGH),
565
+ { },
552566 },
553567 };
554568
....@@ -646,10 +660,18 @@
646660 static struct pxamci_platform_data zeus_mci_platform_data = {
647661 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
648662 .detect_delay_ms = 250,
649
- .gpio_card_detect = ZEUS_MMC_CD_GPIO,
650
- .gpio_card_ro = ZEUS_MMC_WP_GPIO,
651663 .gpio_card_ro_invert = 1,
652
- .gpio_power = -1
664
+};
665
+
666
+static struct gpiod_lookup_table zeus_mci_gpio_table = {
667
+ .dev_id = "pxa2xx-mci.0",
668
+ .table = {
669
+ GPIO_LOOKUP("gpio-pxa", ZEUS_MMC_CD_GPIO,
670
+ "cd", GPIO_ACTIVE_LOW),
671
+ GPIO_LOOKUP("gpio-pxa", ZEUS_MMC_WP_GPIO,
672
+ "wp", GPIO_ACTIVE_HIGH),
673
+ { },
674
+ },
653675 };
654676
655677 /*
....@@ -855,6 +877,8 @@
855877
856878 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
857879
880
+ gpiod_add_lookup_table(&can_regulator_gpiod_table);
881
+ gpiod_add_lookup_table(&zeus_ohci_regulator_gpiod_table);
858882 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
859883
860884 zeus_register_ohci();
....@@ -864,6 +888,7 @@
864888 else
865889 pxa_set_fb_info(NULL, &zeus_fb_info);
866890
891
+ gpiod_add_lookup_table(&zeus_mci_gpio_table);
867892 pxa_set_mci_info(&zeus_mci_platform_data);
868893 pxa_set_udc_info(&zeus_udc_info);
869894 pxa_set_ac97_info(&zeus_ac97_info);