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
81
82
83
84
85
86
87
88
89
90
|
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/spi/spidev.h>
#include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h>
#include <linux/pwm.h>
static bool disable = 0;
module_param(disable, bool, 0);
MODULE_PARM_DESC(disable, "set 1 to disable BYT brd file");
static struct pxa2xx_spi_chip chip_data = {
.gpio_cs = -EINVAL,
.dma_burst_size = 32,
};
static struct spi_board_info byt_spi_slaves[] = {
{
.modalias = "spidev",
.max_speed_hz = 50000000,
.bus_num = 0,
.chip_select = 0,
.controller_data = &chip_data,
.mode = SPI_MODE_0,
}
};
static int byt_spi_board_setup(void)
{
int ret = -1;
/* Register the SPI devices */
if (!spi_register_board_info
(byt_spi_slaves, ARRAY_SIZE(byt_spi_slaves)))
ret = 0;
return ret;
}
static int byt_clk_setup(void)
{
struct clk *clk;
/* Make clock tree required by the SPI driver */
clk = clk_register_fixed_rate(NULL, "lpss_clk", NULL, CLK_IS_ROOT,
100000000);
if (IS_ERR(clk))
return PTR_ERR(clk);
clk = clk_register_fixed_rate(NULL, "spi_clk", "lpss_clk", 0, 50000000);
if (IS_ERR(clk))
return PTR_ERR(clk);
clk_register_clkdev(clk, NULL, "0000:00:1e.5");
/* Make clock tree required by the PWM driver */
clk = clk_register_fixed_rate(NULL, "pwm_clk", "lpss_clk", 0, 25000000);
if (IS_ERR(clk))
return PTR_ERR(clk);
clk_register_clkdev(clk, NULL, "0000:00:1e.1");
clk_register_clkdev(clk, NULL, "0000:00:1e.2");
return 0;
}
static int __init byt_board_init(void)
{
int ret;
if (disable)
return 0;
ret = byt_clk_setup();
if (ret)
goto exit;
ret = byt_spi_board_setup();
if (ret)
goto exit;
exit:
return ret;
}
arch_initcall(byt_board_init);
MODULE_LICENSE(GPL);
|