-
Notifications
You must be signed in to change notification settings - Fork 2
/
865-gpiommc_dirry_hack.patch
80 lines (75 loc) · 2.63 KB
/
865-gpiommc_dirry_hack.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- a/drivers/mmc/host/gpiommc.c
+++ b/drivers/mmc/host/gpiommc.c
@@ -102,12 +102,13 @@
goto err_free_pdata;
platform_set_drvdata(pdev, d);
+ printk(KERN_INFO PFX "MMC-Card ATATA\n");
printk(KERN_INFO PFX "MMC-Card \"%s\" "
- "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n",
+ "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u, activelow=%u, nospi=%u, max_bus_speed=%u, mode=%u\n",
mmc_pdata->name, mmc_pdata->pins.gpio_di,
mmc_pdata->pins.gpio_do,
mmc_pdata->pins.gpio_clk,
- mmc_pdata->pins.gpio_cs);
+ mmc_pdata->pins.gpio_cs,mmc_pdata->pins.cs_activelow, mmc_pdata->no_spi_delay, mmc_pdata->max_bus_speed, mmc_pdata->mode);
return 0;
@@ -342,6 +343,51 @@
return 0;
}
+static int gpiommc_initsd(void){
+ int err;
+ struct platform_device *pdev;
+ struct gpiommc_platform_data pdata;
+
+ strcpy(pdata.name, "default");
+ // PINOUT HERE
+ pdata.pins.gpio_di = 9;
+ pdata.pins.gpio_do = 13;
+ pdata.pins.gpio_clk = 8;
+ pdata.pins.gpio_cs = 0;
+ pdata.pins.cs_activelow = 1;
+ pdata.mode = 0;
+ pdata.no_spi_delay = 0;
+ pdata.max_bus_speed = 5000000;
+
+ printk(KERN_INFO PFX "[DIRRY-HACK] platform_device_alloc...\n");
+ pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id());
+
+ if (!pdev){
+ printk(KERN_INFO PFX "[DIRRY-HACK] ERROR platform_device_alloc\n");
+ return -ENOMEM;
+ }
+
+ printk(KERN_INFO PFX "[DIRRY-HACK] platform_device_add_data...\n");
+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+ if (err) {
+ printk(KERN_INFO PFX "[DIRRY-HACK] ERROR platform_device_add_data %d\n", err);
+ platform_device_put(pdev);
+ return err;
+ }
+
+ printk(KERN_INFO PFX "[DIRRY-HACK] platform_device_add...\n");
+ err = platform_device_add(pdev);
+
+ if (err) {
+ printk(KERN_INFO PFX "[DIRRY-HACK] ERROR platform_device_add %d\n", err);
+ platform_device_put(pdev);
+ return err;
+ }
+
+ printk(KERN_INFO PFX "[DIRRY-HACK] OK! WAIT FOR GPIO-SPI...\n");
+ return 0;
+}
+
static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev)
{
if (!gpiommc_is_registered(dev))
@@ -606,6 +652,9 @@
}
#endif /* CONFIG_GPIOMMC_CONFIGFS */
+ printk(KERN_INFO PFX "[DIRRY-HACK] Init\n");
+ gpiommc_initsd();
+
return 0;
}
module_init(gpiommc_modinit);