提交 f9ed561e 编写于 作者: K Kukjin Kim

Merge branch 'next/dt-samsung' into next/devel-samsung-spi

* Samsung SPI Controller
The Samsung SPI controller is used to interface with various devices such as flash
and display controllers using the SPI communication interface.
Required SoC Specific Properties:
- compatible: should be one of the following.
- samsung,s3c2443-spi: for s3c2443, s3c2416 and s3c2450 platforms
- samsung,s3c6410-spi: for s3c6410 platforms
- samsung,s5p6440-spi: for s5p6440 and s5p6450 platforms
- samsung,s5pv210-spi: for s5pv210 and s5pc110 platforms
- samsung,exynos4210-spi: for exynos4 and exynos5 platforms
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: The interrupt number to the cpu. The interrupt specifier format
depends on the interrupt controller.
- tx-dma-channel: The dma channel specifier for tx operations. The format of
the dma specifier depends on the dma controller.
- rx-dma-channel: The dma channel specifier for rx operations. The format of
the dma specifier depends on the dma controller.
Required Board Specific Properties:
- #address-cells: should be 1.
- #size-cells: should be 0.
- gpios: The gpio specifier for clock, mosi and miso interface lines (in the
order specified). The format of the gpio specifier depends on the gpio
controller.
Optional Board Specific Properties:
- samsung,spi-src-clk: If the spi controller includes a internal clock mux to
select the clock source for the spi bus clock, this property can be used to
indicate the clock to be used for driving the spi bus clock. If not specified,
the clock number 0 is used as default.
- num-cs: Specifies the number of chip select lines supported. If
not specified, the default number of chip select lines is set to 1.
SPI Controller specific data in SPI slave nodes:
- The spi slave nodes should provide the following information which is required
by the spi controller.
- cs-gpio: A gpio specifier that specifies the gpio line used as
the slave select line by the spi controller. The format of the gpio
specifier depends on the gpio controller.
- samsung,spi-feedback-delay: The sampling phase shift to be applied on the
miso line (to account for any lag in the miso line). The following are the
valid values.
- 0: No phase shift.
- 1: 90 degree phase shift sampling.
- 2: 180 degree phase shift sampling.
- 3: 270 degree phase shift sampling.
Aliases:
- All the SPI controller nodes should be represented in the aliases node using
the following format 'spi{n}' where n is a unique number for the alias.
Example:
- SoC Specific Portion:
spi_0: spi@12d20000 {
compatible = "samsung,exynos4210-spi";
reg = <0x12d20000 0x100>;
interrupts = <0 66 0>;
tx-dma-channel = <&pdma0 5>;
rx-dma-channel = <&pdma0 4>;
};
- Board Specific Portion:
spi_0: spi@12d20000 {
#address-cells = <1>;
#size-cells = <0>;
gpios = <&gpa2 4 2 3 0>,
<&gpa2 6 2 3 0>,
<&gpa2 7 2 3 0>;
w25q80bw@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "w25x80";
reg = <0>;
spi-max-frequency = <10000>;
controller-data {
cs-gpio = <&gpa2 5 1 0 3>;
samsung,spi-feedback-delay = <0>;
};
partition@0 {
label = "U-Boot";
reg = <0x0 0x40000>;
read-only;
};
partition@40000 {
label = "Kernel";
reg = <0x40000 0xc0000>;
};
};
};
...@@ -134,4 +134,16 @@ ...@@ -134,4 +134,16 @@
i2c@138D0000 { i2c@138D0000 {
status = "disabled"; status = "disabled";
}; };
spi_0: spi@13920000 {
status = "disabled";
};
spi_1: spi@13930000 {
status = "disabled";
};
spi_2: spi@13940000 {
status = "disabled";
};
}; };
...@@ -179,4 +179,42 @@ ...@@ -179,4 +179,42 @@
i2c@138D0000 { i2c@138D0000 {
status = "disabled"; status = "disabled";
}; };
spi_0: spi@13920000 {
status = "disabled";
};
spi_1: spi@13930000 {
status = "disabled";
};
spi_2: spi@13940000 {
gpios = <&gpc1 1 5 3 0>,
<&gpc1 3 5 3 0>,
<&gpc1 4 5 3 0>;
w25x80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "w25x80";
reg = <0>;
spi-max-frequency = <1000000>;
controller-data {
cs-gpio = <&gpc1 2 1 0 3>;
samsung,spi-feedback-delay = <0>;
};
partition@0 {
label = "U-Boot";
reg = <0x0 0x40000>;
read-only;
};
partition@40000 {
label = "Kernel";
reg = <0x40000 0xc0000>;
};
};
};
}; };
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
compatible = "samsung,exynos4210"; compatible = "samsung,exynos4210";
interrupt-parent = <&gic>; interrupt-parent = <&gic>;
aliases {
spi0 = &spi_0;
spi1 = &spi_1;
spi2 = &spi_2;
};
gic:interrupt-controller@10490000 { gic:interrupt-controller@10490000 {
compatible = "arm,cortex-a9-gic"; compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>; #interrupt-cells = <3>;
...@@ -33,6 +39,17 @@ ...@@ -33,6 +39,17 @@
reg = <0x10490000 0x1000>, <0x10480000 0x100>; reg = <0x10490000 0x1000>, <0x10480000 0x100>;
}; };
combiner:interrupt-controller@10440000 {
compatible = "samsung,exynos4210-combiner";
#interrupt-cells = <2>;
interrupt-controller;
reg = <0x10440000 0x1000>;
interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
<0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
<0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
<0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>;
};
watchdog@10060000 { watchdog@10060000 {
compatible = "samsung,s3c2410-wdt"; compatible = "samsung,s3c2410-wdt";
reg = <0x10060000 0x100>; reg = <0x10060000 0x100>;
...@@ -147,6 +164,36 @@ ...@@ -147,6 +164,36 @@
interrupts = <0 65 0>; interrupts = <0 65 0>;
}; };
spi_0: spi@13920000 {
compatible = "samsung,exynos4210-spi";
reg = <0x13920000 0x100>;
interrupts = <0 66 0>;
tx-dma-channel = <&pdma0 7>;
rx-dma-channel = <&pdma0 6>;
#address-cells = <1>;
#size-cells = <0>;
};
spi_1: spi@13930000 {
compatible = "samsung,exynos4210-spi";
reg = <0x13930000 0x100>;
interrupts = <0 67 0>;
tx-dma-channel = <&pdma1 7>;
rx-dma-channel = <&pdma1 6>;
#address-cells = <1>;
#size-cells = <0>;
};
spi_2: spi@13940000 {
compatible = "samsung,exynos4210-spi";
reg = <0x13940000 0x100>;
interrupts = <0 68 0>;
tx-dma-channel = <&pdma0 9>;
rx-dma-channel = <&pdma0 8>;
#address-cells = <1>;
#size-cells = <0>;
};
amba { amba {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
......
...@@ -71,4 +71,42 @@ ...@@ -71,4 +71,42 @@
i2c@12CD0000 { i2c@12CD0000 {
status = "disabled"; status = "disabled";
}; };
spi_0: spi@12d20000 {
status = "disabled";
};
spi_1: spi@12d30000 {
gpios = <&gpa2 4 2 3 0>,
<&gpa2 6 2 3 0>,
<&gpa2 7 2 3 0>;
w25q80bw@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "w25x80";
reg = <0>;
spi-max-frequency = <1000000>;
controller-data {
cs-gpio = <&gpa2 5 1 0 3>;
samsung,spi-feedback-delay = <0>;
};
partition@0 {
label = "U-Boot";
reg = <0x0 0x40000>;
read-only;
};
partition@40000 {
label = "Kernel";
reg = <0x40000 0xc0000>;
};
};
};
spi_2: spi@12d40000 {
status = "disabled";
};
}; };
...@@ -23,6 +23,12 @@ ...@@ -23,6 +23,12 @@
compatible = "samsung,exynos5250"; compatible = "samsung,exynos5250";
interrupt-parent = <&gic>; interrupt-parent = <&gic>;
aliases {
spi0 = &spi_0;
spi1 = &spi_1;
spi2 = &spi_2;
};
gic:interrupt-controller@10481000 { gic:interrupt-controller@10481000 {
compatible = "arm,cortex-a9-gic"; compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>; #interrupt-cells = <3>;
...@@ -146,6 +152,36 @@ ...@@ -146,6 +152,36 @@
#size-cells = <0>; #size-cells = <0>;
}; };
spi_0: spi@12d20000 {
compatible = "samsung,exynos4210-spi";
reg = <0x12d20000 0x100>;
interrupts = <0 66 0>;
tx-dma-channel = <&pdma0 5>;
rx-dma-channel = <&pdma0 4>;
#address-cells = <1>;
#size-cells = <0>;
};
spi_1: spi@12d30000 {
compatible = "samsung,exynos4210-spi";
reg = <0x12d30000 0x100>;
interrupts = <0 67 0>;
tx-dma-channel = <&pdma1 5>;
rx-dma-channel = <&pdma1 4>;
#address-cells = <1>;
#size-cells = <0>;
};
spi_2: spi@12d40000 {
compatible = "samsung,exynos4210-spi";
reg = <0x12d40000 0x100>;
interrupts = <0 68 0>;
tx-dma-channel = <&pdma0 7>;
rx-dma-channel = <&pdma0 6>;
#address-cells = <1>;
#size-cells = <0>;
};
amba { amba {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
......
...@@ -586,17 +586,17 @@ static struct clk exynos4_init_clocks_off[] = { ...@@ -586,17 +586,17 @@ static struct clk exynos4_init_clocks_off[] = {
.ctrlbit = (1 << 13), .ctrlbit = (1 << 13),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "exynos4210-spi.0",
.enable = exynos4_clk_ip_peril_ctrl, .enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit = (1 << 16), .ctrlbit = (1 << 16),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "exynos4210-spi.1",
.enable = exynos4_clk_ip_peril_ctrl, .enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit = (1 << 17), .ctrlbit = (1 << 17),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.2", .devname = "exynos4210-spi.2",
.enable = exynos4_clk_ip_peril_ctrl, .enable = exynos4_clk_ip_peril_ctrl,
.ctrlbit = (1 << 18), .ctrlbit = (1 << 18),
}, { }, {
...@@ -1242,40 +1242,67 @@ static struct clksrc_clk exynos4_clk_sclk_mmc3 = { ...@@ -1242,40 +1242,67 @@ static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
.reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 }, .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 },
}; };
static struct clksrc_clk exynos4_clk_mdout_spi0 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.0",
},
.sources = &exynos4_clkset_group,
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
};
static struct clksrc_clk exynos4_clk_mdout_spi1 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.1",
},
.sources = &exynos4_clkset_group,
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
};
static struct clksrc_clk exynos4_clk_mdout_spi2 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.2",
},
.sources = &exynos4_clkset_group,
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
};
static struct clksrc_clk exynos4_clk_sclk_spi0 = { static struct clksrc_clk exynos4_clk_sclk_spi0 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.0", .devname = "exynos4210-spi.0",
.parent = &exynos4_clk_mdout_spi0.clk,
.enable = exynos4_clksrc_mask_peril1_ctrl, .enable = exynos4_clksrc_mask_peril1_ctrl,
.ctrlbit = (1 << 16), .ctrlbit = (1 << 16),
}, },
.sources = &exynos4_clkset_group, .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 8, .size = 8 },
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 16, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 0, .size = 4 },
}; };
static struct clksrc_clk exynos4_clk_sclk_spi1 = { static struct clksrc_clk exynos4_clk_sclk_spi1 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.1", .devname = "exynos4210-spi.1",
.parent = &exynos4_clk_mdout_spi1.clk,
.enable = exynos4_clksrc_mask_peril1_ctrl, .enable = exynos4_clksrc_mask_peril1_ctrl,
.ctrlbit = (1 << 20), .ctrlbit = (1 << 20),
}, },
.sources = &exynos4_clkset_group, .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 24, .size = 8 },
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 20, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL1, .shift = 16, .size = 4 },
}; };
static struct clksrc_clk exynos4_clk_sclk_spi2 = { static struct clksrc_clk exynos4_clk_sclk_spi2 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.2", .devname = "exynos4210-spi.2",
.parent = &exynos4_clk_mdout_spi2.clk,
.enable = exynos4_clksrc_mask_peril1_ctrl, .enable = exynos4_clksrc_mask_peril1_ctrl,
.ctrlbit = (1 << 24), .ctrlbit = (1 << 24),
}, },
.sources = &exynos4_clkset_group, .reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 8, .size = 8 },
.reg_src = { .reg = EXYNOS4_CLKSRC_PERIL1, .shift = 24, .size = 4 },
.reg_div = { .reg = EXYNOS4_CLKDIV_PERIL2, .shift = 0, .size = 4 },
}; };
/* Clock initialization code */ /* Clock initialization code */
...@@ -1331,7 +1358,9 @@ static struct clksrc_clk *exynos4_clksrc_cdev[] = { ...@@ -1331,7 +1358,9 @@ static struct clksrc_clk *exynos4_clksrc_cdev[] = {
&exynos4_clk_sclk_spi0, &exynos4_clk_sclk_spi0,
&exynos4_clk_sclk_spi1, &exynos4_clk_sclk_spi1,
&exynos4_clk_sclk_spi2, &exynos4_clk_sclk_spi2,
&exynos4_clk_mdout_spi0,
&exynos4_clk_mdout_spi1,
&exynos4_clk_mdout_spi2,
}; };
static struct clk_lookup exynos4_clk_lookup[] = { static struct clk_lookup exynos4_clk_lookup[] = {
...@@ -1347,9 +1376,9 @@ static struct clk_lookup exynos4_clk_lookup[] = { ...@@ -1347,9 +1376,9 @@ static struct clk_lookup exynos4_clk_lookup[] = {
CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
}; };
static int xtal_rate; static int xtal_rate;
......
...@@ -131,6 +131,11 @@ static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable) ...@@ -131,6 +131,11 @@ static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable)
return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable); return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable);
} }
static int exynos5_clksrc_mask_peric1_ctrl(struct clk *clk, int enable)
{
return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC1, clk, enable);
}
static int exynos5_clk_ip_acp_ctrl(struct clk *clk, int enable) static int exynos5_clk_ip_acp_ctrl(struct clk *clk, int enable)
{ {
return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP, clk, enable); return s5p_gatectrl(EXYNOS5_CLKGATE_IP_ACP, clk, enable);
...@@ -740,6 +745,24 @@ static struct clk exynos5_init_clocks_off[] = { ...@@ -740,6 +745,24 @@ static struct clk exynos5_init_clocks_off[] = {
.parent = &exynos5_clk_aclk_66.clk, .parent = &exynos5_clk_aclk_66.clk,
.enable = exynos5_clk_ip_peric_ctrl, .enable = exynos5_clk_ip_peric_ctrl,
.ctrlbit = (1 << 14), .ctrlbit = (1 << 14),
}, {
.name = "spi",
.devname = "exynos4210-spi.0",
.parent = &exynos5_clk_aclk_66.clk,
.enable = exynos5_clk_ip_peric_ctrl,
.ctrlbit = (1 << 16),
}, {
.name = "spi",
.devname = "exynos4210-spi.1",
.parent = &exynos5_clk_aclk_66.clk,
.enable = exynos5_clk_ip_peric_ctrl,
.ctrlbit = (1 << 17),
}, {
.name = "spi",
.devname = "exynos4210-spi.2",
.parent = &exynos5_clk_aclk_66.clk,
.enable = exynos5_clk_ip_peric_ctrl,
.ctrlbit = (1 << 18),
}, { }, {
.name = SYSMMU_CLOCK_NAME, .name = SYSMMU_CLOCK_NAME,
.devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0),
...@@ -1034,6 +1057,69 @@ static struct clksrc_clk exynos5_clk_sclk_mmc3 = { ...@@ -1034,6 +1057,69 @@ static struct clksrc_clk exynos5_clk_sclk_mmc3 = {
.reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 }, .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 },
}; };
static struct clksrc_clk exynos5_clk_mdout_spi0 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.0",
},
.sources = &exynos5_clkset_group,
.reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 16, .size = 4 },
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 0, .size = 4 },
};
static struct clksrc_clk exynos5_clk_mdout_spi1 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.1",
},
.sources = &exynos5_clkset_group,
.reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 20, .size = 4 },
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 16, .size = 4 },
};
static struct clksrc_clk exynos5_clk_mdout_spi2 = {
.clk = {
.name = "mdout_spi",
.devname = "exynos4210-spi.2",
},
.sources = &exynos5_clkset_group,
.reg_src = { .reg = EXYNOS5_CLKSRC_PERIC1, .shift = 24, .size = 4 },
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 0, .size = 4 },
};
static struct clksrc_clk exynos5_clk_sclk_spi0 = {
.clk = {
.name = "sclk_spi",
.devname = "exynos4210-spi.0",
.parent = &exynos5_clk_mdout_spi0.clk,
.enable = exynos5_clksrc_mask_peric1_ctrl,
.ctrlbit = (1 << 16),
},
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 8, .size = 8 },
};
static struct clksrc_clk exynos5_clk_sclk_spi1 = {
.clk = {
.name = "sclk_spi",
.devname = "exynos4210-spi.1",
.parent = &exynos5_clk_mdout_spi1.clk,
.enable = exynos5_clksrc_mask_peric1_ctrl,
.ctrlbit = (1 << 20),
},
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC1, .shift = 24, .size = 8 },
};
static struct clksrc_clk exynos5_clk_sclk_spi2 = {
.clk = {
.name = "sclk_spi",
.devname = "exynos4210-spi.2",
.parent = &exynos5_clk_mdout_spi2.clk,
.enable = exynos5_clksrc_mask_peric1_ctrl,
.ctrlbit = (1 << 24),
},
.reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 },
};
static struct clksrc_clk exynos5_clksrcs[] = { static struct clksrc_clk exynos5_clksrcs[] = {
{ {
.clk = { .clk = {
...@@ -1148,6 +1234,12 @@ static struct clksrc_clk *exynos5_sysclks[] = { ...@@ -1148,6 +1234,12 @@ static struct clksrc_clk *exynos5_sysclks[] = {
&exynos5_clk_dout_mmc4, &exynos5_clk_dout_mmc4,
&exynos5_clk_aclk_acp, &exynos5_clk_aclk_acp,
&exynos5_clk_pclk_acp, &exynos5_clk_pclk_acp,
&exynos5_clk_sclk_spi0,
&exynos5_clk_sclk_spi1,
&exynos5_clk_sclk_spi2,
&exynos5_clk_mdout_spi0,
&exynos5_clk_mdout_spi1,
&exynos5_clk_mdout_spi2,
}; };
static struct clk *exynos5_clk_cdev[] = { static struct clk *exynos5_clk_cdev[] = {
...@@ -1176,6 +1268,9 @@ static struct clk_lookup exynos5_clk_lookup[] = { ...@@ -1176,6 +1268,9 @@ static struct clk_lookup exynos5_clk_lookup[] = {
CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk),
CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk),
CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk),
CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos5_clk_sclk_spi0.clk),
CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos5_clk_sclk_spi1.clk),
CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos5_clk_sclk_spi2.clk),
CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0),
CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1),
CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1),
......
...@@ -195,6 +195,10 @@ ...@@ -195,6 +195,10 @@
#define IRQ_IIC6 EXYNOS4_IRQ_IIC6 #define IRQ_IIC6 EXYNOS4_IRQ_IIC6
#define IRQ_IIC7 EXYNOS4_IRQ_IIC7 #define IRQ_IIC7 EXYNOS4_IRQ_IIC7
#define IRQ_SPI0 EXYNOS4_IRQ_SPI0
#define IRQ_SPI1 EXYNOS4_IRQ_SPI1
#define IRQ_SPI2 EXYNOS4_IRQ_SPI2
#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST #define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST
#define IRQ_OTG EXYNOS4_IRQ_USB_HSOTG #define IRQ_OTG EXYNOS4_IRQ_USB_HSOTG
......
...@@ -154,6 +154,9 @@ ...@@ -154,6 +154,9 @@
#define EXYNOS4_PA_SPI0 0x13920000 #define EXYNOS4_PA_SPI0 0x13920000
#define EXYNOS4_PA_SPI1 0x13930000 #define EXYNOS4_PA_SPI1 0x13930000
#define EXYNOS4_PA_SPI2 0x13940000 #define EXYNOS4_PA_SPI2 0x13940000
#define EXYNOS5_PA_SPI0 0x12D20000
#define EXYNOS5_PA_SPI1 0x12D30000
#define EXYNOS5_PA_SPI2 0x12D40000
#define EXYNOS4_PA_GPIO1 0x11400000 #define EXYNOS4_PA_GPIO1 0x11400000
#define EXYNOS4_PA_GPIO2 0x11000000 #define EXYNOS4_PA_GPIO2 0x11000000
......
...@@ -55,6 +55,12 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { ...@@ -55,6 +55,12 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = {
"exynos4-sdhci.3", NULL), "exynos4-sdhci.3", NULL),
OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0), OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0),
"s3c2440-i2c.0", NULL), "s3c2440-i2c.0", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0,
"exynos4210-spi.0", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1,
"exynos4210-spi.1", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI2,
"exynos4210-spi.2", NULL),
OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL), OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL), OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
{}, {},
......
...@@ -47,6 +47,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { ...@@ -47,6 +47,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
"s3c2440-i2c.0", NULL), "s3c2440-i2c.0", NULL),
OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
"s3c2440-i2c.1", NULL), "s3c2440-i2c.1", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
"exynos4210-spi.0", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
"exynos4210-spi.1", NULL),
OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
"exynos4210-spi.2", NULL),
OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
......
...@@ -9,21 +9,10 @@ ...@@ -9,21 +9,10 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/s3c64xx-spi.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x1ff,
.rx_lvl_offset = 15,
.high_speed = 1,
.clk_from_cmu = true,
.tx_st_done = 25,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(EXYNOS4_GPB(0), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(EXYNOS4_GPB(0), S3C_GPIO_SFN(2));
s3c_gpio_setpull(EXYNOS4_GPB(0), S3C_GPIO_PULL_UP); s3c_gpio_setpull(EXYNOS4_GPB(0), S3C_GPIO_PULL_UP);
...@@ -34,15 +23,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) ...@@ -34,15 +23,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI1 #ifdef CONFIG_S3C64XX_DEV_SPI1
struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = { int s3c64xx_spi1_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 15,
.high_speed = 1,
.clk_from_cmu = true,
.tx_st_done = 25,
};
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(EXYNOS4_GPB(4), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(EXYNOS4_GPB(4), S3C_GPIO_SFN(2));
s3c_gpio_setpull(EXYNOS4_GPB(4), S3C_GPIO_PULL_UP); s3c_gpio_setpull(EXYNOS4_GPB(4), S3C_GPIO_PULL_UP);
...@@ -53,15 +34,7 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) ...@@ -53,15 +34,7 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI2 #ifdef CONFIG_S3C64XX_DEV_SPI2
struct s3c64xx_spi_info s3c64xx_spi2_pdata __initdata = { int s3c64xx_spi2_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 15,
.high_speed = 1,
.clk_from_cmu = true,
.tx_st_done = 25,
};
int s3c64xx_spi2_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(EXYNOS4_GPC1(1), S3C_GPIO_SFN(5)); s3c_gpio_cfgpin(EXYNOS4_GPC1(1), S3C_GPIO_SFN(5));
s3c_gpio_setpull(EXYNOS4_GPC1(1), S3C_GPIO_PULL_UP); s3c_gpio_setpull(EXYNOS4_GPC1(1), S3C_GPIO_PULL_UP);
......
...@@ -144,7 +144,8 @@ static struct clk_lookup s3c2416_clk_lookup[] = { ...@@ -144,7 +144,8 @@ static struct clk_lookup s3c2416_clk_lookup[] = {
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk), CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk),
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk), CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk),
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &hsspi_mux.clk), /* s3c2443-spi.0 is used on s3c2416 and s3c2450 as well */
CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &hsspi_mux.clk),
}; };
void __init s3c2416_init_clocks(int xtal) void __init s3c2416_init_clocks(int xtal)
......
...@@ -181,7 +181,7 @@ static struct clk *clks[] __initdata = { ...@@ -181,7 +181,7 @@ static struct clk *clks[] __initdata = {
static struct clk_lookup s3c2443_clk_lookup[] = { static struct clk_lookup s3c2443_clk_lookup[] = {
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_hsspi.clk), CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &clk_hsspi.clk),
}; };
void __init s3c2443_init_clocks(int xtal) void __init s3c2443_init_clocks(int xtal)
......
...@@ -559,7 +559,7 @@ static struct clk hsmmc1_clk = { ...@@ -559,7 +559,7 @@ static struct clk hsmmc1_clk = {
static struct clk hsspi_clk = { static struct clk hsspi_clk = {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s3c2443-spi.0",
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2443_clkcon_enable_p, .enable = s3c2443_clkcon_enable_p,
.ctrlbit = S3C2443_PCLKCON_HSSPI, .ctrlbit = S3C2443_PCLKCON_HSSPI,
...@@ -633,7 +633,7 @@ static struct clk_lookup s3c2443_clk_lookup[] = { ...@@ -633,7 +633,7 @@ static struct clk_lookup s3c2443_clk_lookup[] = {
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk), CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk),
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &hsspi_clk), CLKDEV_INIT("s3c2443-spi.0", "spi_busclk0", &hsspi_clk),
}; };
void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
......
...@@ -13,20 +13,12 @@ ...@@ -13,20 +13,12 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/s3c64xx-spi.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/regs-gpio.h> #include <mach/regs-gpio.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.tx_st_done = 21,
.high_speed = 1,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *pdev)
{ {
/* enable hsspi bit in misccr */ /* enable hsspi bit in misccr */
s3c2410_modify_misccr(S3C2416_MISCCR_HSSPI_EN2, 1); s3c2410_modify_misccr(S3C2416_MISCCR_HSSPI_EN2, 1);
......
...@@ -178,13 +178,13 @@ static struct clk init_clocks_off[] = { ...@@ -178,13 +178,13 @@ static struct clk init_clocks_off[] = {
.ctrlbit = S3C_CLKCON_PCLK_KEYPAD, .ctrlbit = S3C_CLKCON_PCLK_KEYPAD,
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s3c6410-spi.0",
.parent = &clk_p, .parent = &clk_p,
.enable = s3c64xx_pclk_ctrl, .enable = s3c64xx_pclk_ctrl,
.ctrlbit = S3C_CLKCON_PCLK_SPI0, .ctrlbit = S3C_CLKCON_PCLK_SPI0,
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "s3c6410-spi.1",
.parent = &clk_p, .parent = &clk_p,
.enable = s3c64xx_pclk_ctrl, .enable = s3c64xx_pclk_ctrl,
.ctrlbit = S3C_CLKCON_PCLK_SPI1, .ctrlbit = S3C_CLKCON_PCLK_SPI1,
...@@ -331,7 +331,7 @@ static struct clk init_clocks_off[] = { ...@@ -331,7 +331,7 @@ static struct clk init_clocks_off[] = {
static struct clk clk_48m_spi0 = { static struct clk clk_48m_spi0 = {
.name = "spi_48m", .name = "spi_48m",
.devname = "s3c64xx-spi.0", .devname = "s3c6410-spi.0",
.parent = &clk_48m, .parent = &clk_48m,
.enable = s3c64xx_sclk_ctrl, .enable = s3c64xx_sclk_ctrl,
.ctrlbit = S3C_CLKCON_SCLK_SPI0_48, .ctrlbit = S3C_CLKCON_SCLK_SPI0_48,
...@@ -339,7 +339,7 @@ static struct clk clk_48m_spi0 = { ...@@ -339,7 +339,7 @@ static struct clk clk_48m_spi0 = {
static struct clk clk_48m_spi1 = { static struct clk clk_48m_spi1 = {
.name = "spi_48m", .name = "spi_48m",
.devname = "s3c64xx-spi.1", .devname = "s3c6410-spi.1",
.parent = &clk_48m, .parent = &clk_48m,
.enable = s3c64xx_sclk_ctrl, .enable = s3c64xx_sclk_ctrl,
.ctrlbit = S3C_CLKCON_SCLK_SPI1_48, .ctrlbit = S3C_CLKCON_SCLK_SPI1_48,
...@@ -802,7 +802,7 @@ static struct clksrc_clk clk_sclk_mmc2 = { ...@@ -802,7 +802,7 @@ static struct clksrc_clk clk_sclk_mmc2 = {
static struct clksrc_clk clk_sclk_spi0 = { static struct clksrc_clk clk_sclk_spi0 = {
.clk = { .clk = {
.name = "spi-bus", .name = "spi-bus",
.devname = "s3c64xx-spi.0", .devname = "s3c6410-spi.0",
.ctrlbit = S3C_CLKCON_SCLK_SPI0, .ctrlbit = S3C_CLKCON_SCLK_SPI0,
.enable = s3c64xx_sclk_ctrl, .enable = s3c64xx_sclk_ctrl,
}, },
...@@ -814,7 +814,7 @@ static struct clksrc_clk clk_sclk_spi0 = { ...@@ -814,7 +814,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
static struct clksrc_clk clk_sclk_spi1 = { static struct clksrc_clk clk_sclk_spi1 = {
.clk = { .clk = {
.name = "spi-bus", .name = "spi-bus",
.devname = "s3c64xx-spi.1", .devname = "s3c6410-spi.1",
.ctrlbit = S3C_CLKCON_SCLK_SPI1, .ctrlbit = S3C_CLKCON_SCLK_SPI1,
.enable = s3c64xx_sclk_ctrl, .enable = s3c64xx_sclk_ctrl,
}, },
...@@ -858,10 +858,10 @@ static struct clk_lookup s3c64xx_clk_lookup[] = { ...@@ -858,10 +858,10 @@ static struct clk_lookup s3c64xx_clk_lookup[] = {
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), CLKDEV_INIT("s3c6410-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_48m_spi0), CLKDEV_INIT("s3c6410-spi.0", "spi_busclk2", &clk_48m_spi0),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), CLKDEV_INIT("s3c6410-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk2", &clk_48m_spi1), CLKDEV_INIT("s3c6410-spi.1", "spi_busclk2", &clk_48m_spi1),
}; };
#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
enum dma_ch { enum dma_ch {
/* DMA0/SDMA0 */ /* DMA0/SDMA0 */
DMACH_DT_PROP = -1, /* not yet supported, do not use */
DMACH_UART0 = 0, DMACH_UART0 = 0,
DMACH_UART0_SRC2, DMACH_UART0_SRC2,
DMACH_UART1, DMACH_UART1,
......
...@@ -799,7 +799,7 @@ static void __init crag6410_machine_init(void) ...@@ -799,7 +799,7 @@ static void __init crag6410_machine_init(void)
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
samsung_keypad_set_platdata(&crag6410_keypad_data); samsung_keypad_set_platdata(&crag6410_keypad_data);
s3c64xx_spi0_set_platdata(&s3c64xx_spi0_pdata, 0, 1); s3c64xx_spi0_set_platdata(NULL, 0, 1);
platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
......
...@@ -9,19 +9,10 @@ ...@@ -9,19 +9,10 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/s3c64xx-spi.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.tx_st_done = 21,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3, s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3,
S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
...@@ -30,13 +21,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) ...@@ -30,13 +21,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI1 #ifdef CONFIG_S3C64XX_DEV_SPI1
struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = { int s3c64xx_spi1_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.tx_st_done = 21,
};
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3, s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3,
S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
......
...@@ -227,13 +227,13 @@ static struct clk init_clocks_off[] = { ...@@ -227,13 +227,13 @@ static struct clk init_clocks_off[] = {
.ctrlbit = (1 << 17), .ctrlbit = (1 << 17),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s5p64x0-spi.0",
.parent = &clk_pclk_low.clk, .parent = &clk_pclk_low.clk,
.enable = s5p64x0_pclk_ctrl, .enable = s5p64x0_pclk_ctrl,
.ctrlbit = (1 << 21), .ctrlbit = (1 << 21),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "s5p64x0-spi.1",
.parent = &clk_pclk_low.clk, .parent = &clk_pclk_low.clk,
.enable = s5p64x0_pclk_ctrl, .enable = s5p64x0_pclk_ctrl,
.ctrlbit = (1 << 22), .ctrlbit = (1 << 22),
...@@ -467,7 +467,7 @@ static struct clksrc_clk clk_sclk_uclk = { ...@@ -467,7 +467,7 @@ static struct clksrc_clk clk_sclk_uclk = {
static struct clksrc_clk clk_sclk_spi0 = { static struct clksrc_clk clk_sclk_spi0 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.0", .devname = "s5p64x0-spi.0",
.ctrlbit = (1 << 20), .ctrlbit = (1 << 20),
.enable = s5p64x0_sclk_ctrl, .enable = s5p64x0_sclk_ctrl,
}, },
...@@ -479,7 +479,7 @@ static struct clksrc_clk clk_sclk_spi0 = { ...@@ -479,7 +479,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
static struct clksrc_clk clk_sclk_spi1 = { static struct clksrc_clk clk_sclk_spi1 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.1", .devname = "s5p64x0-spi.1",
.ctrlbit = (1 << 21), .ctrlbit = (1 << 21),
.enable = s5p64x0_sclk_ctrl, .enable = s5p64x0_sclk_ctrl,
}, },
...@@ -519,8 +519,8 @@ static struct clk_lookup s5p6440_clk_lookup[] = { ...@@ -519,8 +519,8 @@ static struct clk_lookup s5p6440_clk_lookup[] = {
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
......
...@@ -236,13 +236,13 @@ static struct clk init_clocks_off[] = { ...@@ -236,13 +236,13 @@ static struct clk init_clocks_off[] = {
.ctrlbit = (1 << 17), .ctrlbit = (1 << 17),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s5p64x0-spi.0",
.parent = &clk_pclk_low.clk, .parent = &clk_pclk_low.clk,
.enable = s5p64x0_pclk_ctrl, .enable = s5p64x0_pclk_ctrl,
.ctrlbit = (1 << 21), .ctrlbit = (1 << 21),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "s5p64x0-spi.1",
.parent = &clk_pclk_low.clk, .parent = &clk_pclk_low.clk,
.enable = s5p64x0_pclk_ctrl, .enable = s5p64x0_pclk_ctrl,
.ctrlbit = (1 << 22), .ctrlbit = (1 << 22),
...@@ -528,7 +528,7 @@ static struct clksrc_clk clk_sclk_uclk = { ...@@ -528,7 +528,7 @@ static struct clksrc_clk clk_sclk_uclk = {
static struct clksrc_clk clk_sclk_spi0 = { static struct clksrc_clk clk_sclk_spi0 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.0", .devname = "s5p64x0-spi.0",
.ctrlbit = (1 << 20), .ctrlbit = (1 << 20),
.enable = s5p64x0_sclk_ctrl, .enable = s5p64x0_sclk_ctrl,
}, },
...@@ -540,7 +540,7 @@ static struct clksrc_clk clk_sclk_spi0 = { ...@@ -540,7 +540,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
static struct clksrc_clk clk_sclk_spi1 = { static struct clksrc_clk clk_sclk_spi1 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.1", .devname = "s5p64x0-spi.1",
.ctrlbit = (1 << 21), .ctrlbit = (1 << 21),
.enable = s5p64x0_sclk_ctrl, .enable = s5p64x0_sclk_ctrl,
}, },
...@@ -562,8 +562,8 @@ static struct clk_lookup s5p6450_clk_lookup[] = { ...@@ -562,8 +562,8 @@ static struct clk_lookup s5p6450_clk_lookup[] = {
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
......
...@@ -9,21 +9,10 @@ ...@@ -9,21 +9,10 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/cpu.h>
#include <plat/s3c64xx-spi.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x1ff,
.rx_lvl_offset = 15,
.tx_st_done = 25,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
{ {
if (soc_is_s5p6450()) if (soc_is_s5p6450())
s3c_gpio_cfgall_range(S5P6450_GPC(0), 3, s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
...@@ -36,13 +25,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) ...@@ -36,13 +25,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI1 #ifdef CONFIG_S3C64XX_DEV_SPI1
struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = { int s3c64xx_spi1_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 15,
.tx_st_done = 25,
};
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
{ {
if (soc_is_s5p6450()) if (soc_is_s5p6450())
s3c_gpio_cfgall_range(S5P6450_GPC(4), 3, s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
......
...@@ -564,19 +564,19 @@ static struct clk init_clocks_off[] = { ...@@ -564,19 +564,19 @@ static struct clk init_clocks_off[] = {
.ctrlbit = (1 << 5), .ctrlbit = (1 << 5),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s5pc100-spi.0",
.parent = &clk_div_d1_bus.clk, .parent = &clk_div_d1_bus.clk,
.enable = s5pc100_d1_4_ctrl, .enable = s5pc100_d1_4_ctrl,
.ctrlbit = (1 << 6), .ctrlbit = (1 << 6),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "s5pc100-spi.1",
.parent = &clk_div_d1_bus.clk, .parent = &clk_div_d1_bus.clk,
.enable = s5pc100_d1_4_ctrl, .enable = s5pc100_d1_4_ctrl,
.ctrlbit = (1 << 7), .ctrlbit = (1 << 7),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.2", .devname = "s5pc100-spi.2",
.parent = &clk_div_d1_bus.clk, .parent = &clk_div_d1_bus.clk,
.enable = s5pc100_d1_4_ctrl, .enable = s5pc100_d1_4_ctrl,
.ctrlbit = (1 << 8), .ctrlbit = (1 << 8),
...@@ -702,7 +702,7 @@ static struct clk clk_hsmmc0 = { ...@@ -702,7 +702,7 @@ static struct clk clk_hsmmc0 = {
static struct clk clk_48m_spi0 = { static struct clk clk_48m_spi0 = {
.name = "spi_48m", .name = "spi_48m",
.devname = "s3c64xx-spi.0", .devname = "s5pc100-spi.0",
.parent = &clk_mout_48m.clk, .parent = &clk_mout_48m.clk,
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
.ctrlbit = (1 << 7), .ctrlbit = (1 << 7),
...@@ -710,7 +710,7 @@ static struct clk clk_48m_spi0 = { ...@@ -710,7 +710,7 @@ static struct clk clk_48m_spi0 = {
static struct clk clk_48m_spi1 = { static struct clk clk_48m_spi1 = {
.name = "spi_48m", .name = "spi_48m",
.devname = "s3c64xx-spi.1", .devname = "s5pc100-spi.1",
.parent = &clk_mout_48m.clk, .parent = &clk_mout_48m.clk,
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
.ctrlbit = (1 << 8), .ctrlbit = (1 << 8),
...@@ -718,7 +718,7 @@ static struct clk clk_48m_spi1 = { ...@@ -718,7 +718,7 @@ static struct clk clk_48m_spi1 = {
static struct clk clk_48m_spi2 = { static struct clk clk_48m_spi2 = {
.name = "spi_48m", .name = "spi_48m",
.devname = "s3c64xx-spi.2", .devname = "s5pc100-spi.2",
.parent = &clk_mout_48m.clk, .parent = &clk_mout_48m.clk,
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
.ctrlbit = (1 << 9), .ctrlbit = (1 << 9),
...@@ -1085,7 +1085,7 @@ static struct clksrc_clk clk_sclk_mmc2 = { ...@@ -1085,7 +1085,7 @@ static struct clksrc_clk clk_sclk_mmc2 = {
static struct clksrc_clk clk_sclk_spi0 = { static struct clksrc_clk clk_sclk_spi0 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.0", .devname = "s5pc100-spi.0",
.ctrlbit = (1 << 4), .ctrlbit = (1 << 4),
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
}, },
...@@ -1097,7 +1097,7 @@ static struct clksrc_clk clk_sclk_spi0 = { ...@@ -1097,7 +1097,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
static struct clksrc_clk clk_sclk_spi1 = { static struct clksrc_clk clk_sclk_spi1 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.1", .devname = "s5pc100-spi.1",
.ctrlbit = (1 << 5), .ctrlbit = (1 << 5),
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
}, },
...@@ -1109,7 +1109,7 @@ static struct clksrc_clk clk_sclk_spi1 = { ...@@ -1109,7 +1109,7 @@ static struct clksrc_clk clk_sclk_spi1 = {
static struct clksrc_clk clk_sclk_spi2 = { static struct clksrc_clk clk_sclk_spi2 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.2", .devname = "s5pc100-spi.2",
.ctrlbit = (1 << 6), .ctrlbit = (1 << 6),
.enable = s5pc100_sclk0_ctrl, .enable = s5pc100_sclk0_ctrl,
}, },
...@@ -1315,12 +1315,12 @@ static struct clk_lookup s5pc100_clk_lookup[] = { ...@@ -1315,12 +1315,12 @@ static struct clk_lookup s5pc100_clk_lookup[] = {
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_48m_spi0), CLKDEV_INIT("s5pc100-spi.0", "spi_busclk1", &clk_48m_spi0),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_sclk_spi0.clk), CLKDEV_INIT("s5pc100-spi.0", "spi_busclk2", &clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_48m_spi1), CLKDEV_INIT("s5pc100-spi.1", "spi_busclk1", &clk_48m_spi1),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk2", &clk_sclk_spi1.clk), CLKDEV_INIT("s5pc100-spi.1", "spi_busclk2", &clk_sclk_spi1.clk),
CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk1", &clk_48m_spi2), CLKDEV_INIT("s5pc100-spi.2", "spi_busclk1", &clk_48m_spi2),
CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk2", &clk_sclk_spi2.clk), CLKDEV_INIT("s5pc100-spi.2", "spi_busclk2", &clk_sclk_spi2.clk),
}; };
void __init s5pc100_register_clocks(void) void __init s5pc100_register_clocks(void)
......
...@@ -9,20 +9,10 @@ ...@@ -9,20 +9,10 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/s3c64xx-spi.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.high_speed = 1,
.tx_st_done = 21,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgall_range(S5PC100_GPB(0), 3, s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
...@@ -31,14 +21,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) ...@@ -31,14 +21,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI1 #ifdef CONFIG_S3C64XX_DEV_SPI1
struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = { int s3c64xx_spi1_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.high_speed = 1,
.tx_st_done = 21,
};
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgall_range(S5PC100_GPB(4), 3, s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
...@@ -47,14 +30,7 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) ...@@ -47,14 +30,7 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI2 #ifdef CONFIG_S3C64XX_DEV_SPI2
struct s3c64xx_spi_info s3c64xx_spi2_pdata __initdata = { int s3c64xx_spi2_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 13,
.high_speed = 1,
.tx_st_done = 21,
};
int s3c64xx_spi2_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
......
...@@ -445,19 +445,19 @@ static struct clk init_clocks_off[] = { ...@@ -445,19 +445,19 @@ static struct clk init_clocks_off[] = {
.ctrlbit = (1 << 11), .ctrlbit = (1 << 11),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.0", .devname = "s5pv210-spi.0",
.parent = &clk_pclk_psys.clk, .parent = &clk_pclk_psys.clk,
.enable = s5pv210_clk_ip3_ctrl, .enable = s5pv210_clk_ip3_ctrl,
.ctrlbit = (1<<12), .ctrlbit = (1<<12),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.1", .devname = "s5pv210-spi.1",
.parent = &clk_pclk_psys.clk, .parent = &clk_pclk_psys.clk,
.enable = s5pv210_clk_ip3_ctrl, .enable = s5pv210_clk_ip3_ctrl,
.ctrlbit = (1<<13), .ctrlbit = (1<<13),
}, { }, {
.name = "spi", .name = "spi",
.devname = "s3c64xx-spi.2", .devname = "s5pv210-spi.2",
.parent = &clk_pclk_psys.clk, .parent = &clk_pclk_psys.clk,
.enable = s5pv210_clk_ip3_ctrl, .enable = s5pv210_clk_ip3_ctrl,
.ctrlbit = (1<<14), .ctrlbit = (1<<14),
...@@ -1035,7 +1035,7 @@ static struct clksrc_clk clk_sclk_mmc3 = { ...@@ -1035,7 +1035,7 @@ static struct clksrc_clk clk_sclk_mmc3 = {
static struct clksrc_clk clk_sclk_spi0 = { static struct clksrc_clk clk_sclk_spi0 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.0", .devname = "s5pv210-spi.0",
.enable = s5pv210_clk_mask0_ctrl, .enable = s5pv210_clk_mask0_ctrl,
.ctrlbit = (1 << 16), .ctrlbit = (1 << 16),
}, },
...@@ -1047,7 +1047,7 @@ static struct clksrc_clk clk_sclk_spi0 = { ...@@ -1047,7 +1047,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
static struct clksrc_clk clk_sclk_spi1 = { static struct clksrc_clk clk_sclk_spi1 = {
.clk = { .clk = {
.name = "sclk_spi", .name = "sclk_spi",
.devname = "s3c64xx-spi.1", .devname = "s5pv210-spi.1",
.enable = s5pv210_clk_mask0_ctrl, .enable = s5pv210_clk_mask0_ctrl,
.ctrlbit = (1 << 17), .ctrlbit = (1 << 17),
}, },
...@@ -1331,8 +1331,8 @@ static struct clk_lookup s5pv210_clk_lookup[] = { ...@@ -1331,8 +1331,8 @@ static struct clk_lookup s5pv210_clk_lookup[] = {
CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk), CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
}; };
void __init s5pv210_register_clocks(void) void __init s5pv210_register_clocks(void)
......
...@@ -9,20 +9,10 @@ ...@@ -9,20 +9,10 @@
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h>
#include <plat/gpio-cfg.h> #include <plat/gpio-cfg.h>
#include <plat/s3c64xx-spi.h>
#ifdef CONFIG_S3C64XX_DEV_SPI0 #ifdef CONFIG_S3C64XX_DEV_SPI0
struct s3c64xx_spi_info s3c64xx_spi0_pdata = { int s3c64xx_spi0_cfg_gpio(void)
.fifo_lvl_mask = 0x1ff,
.rx_lvl_offset = 15,
.high_speed = 1,
.tx_st_done = 25,
};
int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2));
s3c_gpio_setpull(S5PV210_GPB(0), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S5PV210_GPB(0), S3C_GPIO_PULL_UP);
...@@ -33,14 +23,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) ...@@ -33,14 +23,7 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
#endif #endif
#ifdef CONFIG_S3C64XX_DEV_SPI1 #ifdef CONFIG_S3C64XX_DEV_SPI1
struct s3c64xx_spi_info s3c64xx_spi1_pdata = { int s3c64xx_spi1_cfg_gpio(void)
.fifo_lvl_mask = 0x7f,
.rx_lvl_offset = 15,
.high_speed = 1,
.tx_st_done = 25,
};
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
{ {
s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2));
s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_UP);
......
...@@ -1513,7 +1513,7 @@ static struct resource s3c64xx_spi0_resource[] = { ...@@ -1513,7 +1513,7 @@ static struct resource s3c64xx_spi0_resource[] = {
}; };
struct platform_device s3c64xx_device_spi0 = { struct platform_device s3c64xx_device_spi0 = {
.name = "s3c64xx-spi", .name = "s3c6410-spi",
.id = 0, .id = 0,
.num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
.resource = s3c64xx_spi0_resource, .resource = s3c64xx_spi0_resource,
...@@ -1523,13 +1523,10 @@ struct platform_device s3c64xx_device_spi0 = { ...@@ -1523,13 +1523,10 @@ struct platform_device s3c64xx_device_spi0 = {
}, },
}; };
void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs) int num_cs)
{ {
if (!pd) { struct s3c64xx_spi_info pd;
pr_err("%s:Need to pass platform data\n", __func__);
return;
}
/* Reject invalid configuration */ /* Reject invalid configuration */
if (!num_cs || src_clk_nr < 0) { if (!num_cs || src_clk_nr < 0) {
...@@ -1537,12 +1534,11 @@ void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, ...@@ -1537,12 +1534,11 @@ void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd,
return; return;
} }
pd->num_cs = num_cs; pd.num_cs = num_cs;
pd->src_clk_nr = src_clk_nr; pd.src_clk_nr = src_clk_nr;
if (!pd->cfg_gpio) pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
pd->cfg_gpio = s3c64xx_spi0_cfg_gpio;
s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0); s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
} }
#endif /* CONFIG_S3C64XX_DEV_SPI0 */ #endif /* CONFIG_S3C64XX_DEV_SPI0 */
...@@ -1555,7 +1551,7 @@ static struct resource s3c64xx_spi1_resource[] = { ...@@ -1555,7 +1551,7 @@ static struct resource s3c64xx_spi1_resource[] = {
}; };
struct platform_device s3c64xx_device_spi1 = { struct platform_device s3c64xx_device_spi1 = {
.name = "s3c64xx-spi", .name = "s3c6410-spi",
.id = 1, .id = 1,
.num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
.resource = s3c64xx_spi1_resource, .resource = s3c64xx_spi1_resource,
...@@ -1565,26 +1561,20 @@ struct platform_device s3c64xx_device_spi1 = { ...@@ -1565,26 +1561,20 @@ struct platform_device s3c64xx_device_spi1 = {
}, },
}; };
void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs) int num_cs)
{ {
if (!pd) {
pr_err("%s:Need to pass platform data\n", __func__);
return;
}
/* Reject invalid configuration */ /* Reject invalid configuration */
if (!num_cs || src_clk_nr < 0) { if (!num_cs || src_clk_nr < 0) {
pr_err("%s: Invalid SPI configuration\n", __func__); pr_err("%s: Invalid SPI configuration\n", __func__);
return; return;
} }
pd->num_cs = num_cs; pd.num_cs = num_cs;
pd->src_clk_nr = src_clk_nr; pd.src_clk_nr = src_clk_nr;
if (!pd->cfg_gpio) pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
pd->cfg_gpio = s3c64xx_spi1_cfg_gpio;
s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1); s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
} }
#endif /* CONFIG_S3C64XX_DEV_SPI1 */ #endif /* CONFIG_S3C64XX_DEV_SPI1 */
...@@ -1597,7 +1587,7 @@ static struct resource s3c64xx_spi2_resource[] = { ...@@ -1597,7 +1587,7 @@ static struct resource s3c64xx_spi2_resource[] = {
}; };
struct platform_device s3c64xx_device_spi2 = { struct platform_device s3c64xx_device_spi2 = {
.name = "s3c64xx-spi", .name = "s3c6410-spi",
.id = 2, .id = 2,
.num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource),
.resource = s3c64xx_spi2_resource, .resource = s3c64xx_spi2_resource,
...@@ -1607,13 +1597,10 @@ struct platform_device s3c64xx_device_spi2 = { ...@@ -1607,13 +1597,10 @@ struct platform_device s3c64xx_device_spi2 = {
}, },
}; };
void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs) int num_cs)
{ {
if (!pd) { struct s3c64xx_spi_info pd;
pr_err("%s:Need to pass platform data\n", __func__);
return;
}
/* Reject invalid configuration */ /* Reject invalid configuration */
if (!num_cs || src_clk_nr < 0) { if (!num_cs || src_clk_nr < 0) {
...@@ -1621,11 +1608,10 @@ void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, ...@@ -1621,11 +1608,10 @@ void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd,
return; return;
} }
pd->num_cs = num_cs; pd.num_cs = num_cs;
pd->src_clk_nr = src_clk_nr; pd.src_clk_nr = src_clk_nr;
if (!pd->cfg_gpio) pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
pd->cfg_gpio = s3c64xx_spi2_cfg_gpio;
s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2); s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
} }
#endif /* CONFIG_S3C64XX_DEV_SPI2 */ #endif /* CONFIG_S3C64XX_DEV_SPI2 */
...@@ -19,72 +19,79 @@ ...@@ -19,72 +19,79 @@
#include <mach/dma.h> #include <mach/dma.h>
static unsigned samsung_dmadev_request(enum dma_ch dma_ch, static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
struct samsung_dma_info *info) struct samsung_dma_req *param)
{ {
struct dma_chan *chan;
dma_cap_mask_t mask; dma_cap_mask_t mask;
struct dma_slave_config slave_config;
void *filter_param; void *filter_param;
dma_cap_zero(mask); dma_cap_zero(mask);
dma_cap_set(info->cap, mask); dma_cap_set(param->cap, mask);
/* /*
* If a dma channel property of a device node from device tree is * If a dma channel property of a device node from device tree is
* specified, use that as the fliter parameter. * specified, use that as the fliter parameter.
*/ */
filter_param = (dma_ch == DMACH_DT_PROP) ? (void *)info->dt_dmach_prop : filter_param = (dma_ch == DMACH_DT_PROP) ?
(void *)dma_ch; (void *)param->dt_dmach_prop : (void *)dma_ch;
chan = dma_request_channel(mask, pl330_filter, filter_param); return (unsigned)dma_request_channel(mask, pl330_filter, filter_param);
}
static int samsung_dmadev_release(unsigned ch, void *param)
{
dma_release_channel((struct dma_chan *)ch);
if (info->direction == DMA_DEV_TO_MEM) { return 0;
}
static int samsung_dmadev_config(unsigned ch,
struct samsung_dma_config *param)
{
struct dma_chan *chan = (struct dma_chan *)ch;
struct dma_slave_config slave_config;
if (param->direction == DMA_DEV_TO_MEM) {
memset(&slave_config, 0, sizeof(struct dma_slave_config)); memset(&slave_config, 0, sizeof(struct dma_slave_config));
slave_config.direction = info->direction; slave_config.direction = param->direction;
slave_config.src_addr = info->fifo; slave_config.src_addr = param->fifo;
slave_config.src_addr_width = info->width; slave_config.src_addr_width = param->width;
slave_config.src_maxburst = 1; slave_config.src_maxburst = 1;
dmaengine_slave_config(chan, &slave_config); dmaengine_slave_config(chan, &slave_config);
} else if (info->direction == DMA_MEM_TO_DEV) { } else if (param->direction == DMA_MEM_TO_DEV) {
memset(&slave_config, 0, sizeof(struct dma_slave_config)); memset(&slave_config, 0, sizeof(struct dma_slave_config));
slave_config.direction = info->direction; slave_config.direction = param->direction;
slave_config.dst_addr = info->fifo; slave_config.dst_addr = param->fifo;
slave_config.dst_addr_width = info->width; slave_config.dst_addr_width = param->width;
slave_config.dst_maxburst = 1; slave_config.dst_maxburst = 1;
dmaengine_slave_config(chan, &slave_config); dmaengine_slave_config(chan, &slave_config);
} else {
pr_warn("unsupported direction\n");
return -EINVAL;
} }
return (unsigned)chan;
}
static int samsung_dmadev_release(unsigned ch,
struct s3c2410_dma_client *client)
{
dma_release_channel((struct dma_chan *)ch);
return 0; return 0;
} }
static int samsung_dmadev_prepare(unsigned ch, static int samsung_dmadev_prepare(unsigned ch,
struct samsung_dma_prep_info *info) struct samsung_dma_prep *param)
{ {
struct scatterlist sg; struct scatterlist sg;
struct dma_chan *chan = (struct dma_chan *)ch; struct dma_chan *chan = (struct dma_chan *)ch;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
switch (info->cap) { switch (param->cap) {
case DMA_SLAVE: case DMA_SLAVE:
sg_init_table(&sg, 1); sg_init_table(&sg, 1);
sg_dma_len(&sg) = info->len; sg_dma_len(&sg) = param->len;
sg_set_page(&sg, pfn_to_page(PFN_DOWN(info->buf)), sg_set_page(&sg, pfn_to_page(PFN_DOWN(param->buf)),
info->len, offset_in_page(info->buf)); param->len, offset_in_page(param->buf));
sg_dma_address(&sg) = info->buf; sg_dma_address(&sg) = param->buf;
desc = dmaengine_prep_slave_sg(chan, desc = dmaengine_prep_slave_sg(chan,
&sg, 1, info->direction, DMA_PREP_INTERRUPT); &sg, 1, param->direction, DMA_PREP_INTERRUPT);
break; break;
case DMA_CYCLIC: case DMA_CYCLIC:
desc = dmaengine_prep_dma_cyclic(chan, desc = dmaengine_prep_dma_cyclic(chan, param->buf,
info->buf, info->len, info->period, info->direction); param->len, param->period, param->direction);
break; break;
default: default:
dev_err(&chan->dev->device, "unsupported format\n"); dev_err(&chan->dev->device, "unsupported format\n");
...@@ -96,8 +103,8 @@ static int samsung_dmadev_prepare(unsigned ch, ...@@ -96,8 +103,8 @@ static int samsung_dmadev_prepare(unsigned ch,
return -EFAULT; return -EFAULT;
} }
desc->callback = info->fp; desc->callback = param->fp;
desc->callback_param = info->fp_param; desc->callback_param = param->fp_param;
dmaengine_submit((struct dma_async_tx_descriptor *)desc); dmaengine_submit((struct dma_async_tx_descriptor *)desc);
...@@ -119,6 +126,7 @@ static inline int samsung_dmadev_flush(unsigned ch) ...@@ -119,6 +126,7 @@ static inline int samsung_dmadev_flush(unsigned ch)
static struct samsung_dma_ops dmadev_ops = { static struct samsung_dma_ops dmadev_ops = {
.request = samsung_dmadev_request, .request = samsung_dmadev_request,
.release = samsung_dmadev_release, .release = samsung_dmadev_release,
.config = samsung_dmadev_config,
.prepare = samsung_dmadev_prepare, .prepare = samsung_dmadev_prepare,
.trigger = samsung_dmadev_trigger, .trigger = samsung_dmadev_trigger,
.started = NULL, .started = NULL,
......
...@@ -16,7 +16,13 @@ ...@@ -16,7 +16,13 @@
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <mach/dma.h> #include <mach/dma.h>
struct samsung_dma_prep_info { struct samsung_dma_req {
enum dma_transaction_type cap;
struct property *dt_dmach_prop;
struct s3c2410_dma_client *client;
};
struct samsung_dma_prep {
enum dma_transaction_type cap; enum dma_transaction_type cap;
enum dma_transfer_direction direction; enum dma_transfer_direction direction;
dma_addr_t buf; dma_addr_t buf;
...@@ -26,19 +32,17 @@ struct samsung_dma_prep_info { ...@@ -26,19 +32,17 @@ struct samsung_dma_prep_info {
void *fp_param; void *fp_param;
}; };
struct samsung_dma_info { struct samsung_dma_config {
enum dma_transaction_type cap;
enum dma_transfer_direction direction; enum dma_transfer_direction direction;
enum dma_slave_buswidth width; enum dma_slave_buswidth width;
dma_addr_t fifo; dma_addr_t fifo;
struct s3c2410_dma_client *client;
struct property *dt_dmach_prop;
}; };
struct samsung_dma_ops { struct samsung_dma_ops {
unsigned (*request)(enum dma_ch ch, struct samsung_dma_info *info); unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param);
int (*release)(unsigned ch, struct s3c2410_dma_client *client); int (*release)(unsigned ch, void *param);
int (*prepare)(unsigned ch, struct samsung_dma_prep_info *info); int (*config)(unsigned ch, struct samsung_dma_config *param);
int (*prepare)(unsigned ch, struct samsung_dma_prep *param);
int (*trigger)(unsigned ch); int (*trigger)(unsigned ch);
int (*started)(unsigned ch); int (*started)(unsigned ch);
int (*flush)(unsigned ch); int (*flush)(unsigned ch);
......
...@@ -18,7 +18,6 @@ struct platform_device; ...@@ -18,7 +18,6 @@ struct platform_device;
* @fb_delay: Slave specific feedback delay. * @fb_delay: Slave specific feedback delay.
* Refer to FB_CLK_SEL register definition in SPI chapter. * Refer to FB_CLK_SEL register definition in SPI chapter.
* @line: Custom 'identity' of the CS line. * @line: Custom 'identity' of the CS line.
* @set_level: CS line control.
* *
* This is per SPI-Slave Chipselect information. * This is per SPI-Slave Chipselect information.
* Allocate and initialize one in machine init code and make the * Allocate and initialize one in machine init code and make the
...@@ -27,57 +26,41 @@ struct platform_device; ...@@ -27,57 +26,41 @@ struct platform_device;
struct s3c64xx_spi_csinfo { struct s3c64xx_spi_csinfo {
u8 fb_delay; u8 fb_delay;
unsigned line; unsigned line;
void (*set_level)(unsigned line_id, int lvl);
}; };
/** /**
* struct s3c64xx_spi_info - SPI Controller defining structure * struct s3c64xx_spi_info - SPI Controller defining structure
* @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field. * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
* @clk_from_cmu: If the SPI clock/prescalar control block is present
* by the platform's clock-management-unit and not in SPI controller.
* @num_cs: Number of CS this controller emulates. * @num_cs: Number of CS this controller emulates.
* @cfg_gpio: Configure pins for this SPI controller. * @cfg_gpio: Configure pins for this SPI controller.
* @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
* @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
* @high_speed: If the controller supports HIGH_SPEED_EN bit
* @tx_st_done: Depends on tx fifo_lvl field
*/ */
struct s3c64xx_spi_info { struct s3c64xx_spi_info {
int src_clk_nr; int src_clk_nr;
bool clk_from_cmu;
int num_cs; int num_cs;
int (*cfg_gpio)(void);
int (*cfg_gpio)(struct platform_device *pdev);
/* Following two fields are for future compatibility */
int fifo_lvl_mask;
int rx_lvl_offset;
int high_speed;
int tx_st_done;
}; };
/** /**
* s3c64xx_spi_set_platdata - SPI Controller configure callback by the board * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
* initialization code. * initialization code.
* @pd: SPI platform data to set. * @cfg_gpio: Pointer to gpio setup function.
* @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
* @num_cs: Number of elements in the 'cs' array. * @num_cs: Number of elements in the 'cs' array.
* *
* Call this from machine init code for each SPI Controller that * Call this from machine init code for each SPI Controller that
* has some chips attached to it. * has some chips attached to it.
*/ */
extern void s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs); int num_cs);
extern void s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs); int num_cs);
extern void s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
int src_clk_nr, int num_cs); int num_cs);
/* defined by architecture to configure gpio */ /* defined by architecture to configure gpio */
extern int s3c64xx_spi0_cfg_gpio(struct platform_device *dev); extern int s3c64xx_spi0_cfg_gpio(void);
extern int s3c64xx_spi1_cfg_gpio(struct platform_device *dev); extern int s3c64xx_spi1_cfg_gpio(void);
extern int s3c64xx_spi2_cfg_gpio(struct platform_device *dev); extern int s3c64xx_spi2_cfg_gpio(void);
extern struct s3c64xx_spi_info s3c64xx_spi0_pdata; extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
extern struct s3c64xx_spi_info s3c64xx_spi1_pdata; extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
......
...@@ -36,30 +36,26 @@ static void s3c_dma_cb(struct s3c2410_dma_chan *channel, void *param, ...@@ -36,30 +36,26 @@ static void s3c_dma_cb(struct s3c2410_dma_chan *channel, void *param,
} }
static unsigned s3c_dma_request(enum dma_ch dma_ch, static unsigned s3c_dma_request(enum dma_ch dma_ch,
struct samsung_dma_info *info) struct samsung_dma_req *param)
{ {
struct cb_data *data; struct cb_data *data;
if (s3c2410_dma_request(dma_ch, info->client, NULL) < 0) { if (s3c2410_dma_request(dma_ch, param->client, NULL) < 0) {
s3c2410_dma_free(dma_ch, info->client); s3c2410_dma_free(dma_ch, param->client);
return 0; return 0;
} }
if (param->cap == DMA_CYCLIC)
s3c2410_dma_setflags(dma_ch, S3C2410_DMAF_CIRCULAR);
data = kzalloc(sizeof(struct cb_data), GFP_KERNEL); data = kzalloc(sizeof(struct cb_data), GFP_KERNEL);
data->ch = dma_ch; data->ch = dma_ch;
list_add_tail(&data->node, &dma_list); list_add_tail(&data->node, &dma_list);
s3c2410_dma_devconfig(dma_ch, info->direction, info->fifo);
if (info->cap == DMA_CYCLIC)
s3c2410_dma_setflags(dma_ch, S3C2410_DMAF_CIRCULAR);
s3c2410_dma_config(dma_ch, info->width);
return (unsigned)dma_ch; return (unsigned)dma_ch;
} }
static int s3c_dma_release(unsigned ch, struct s3c2410_dma_client *client) static int s3c_dma_release(unsigned ch, void *param)
{ {
struct cb_data *data; struct cb_data *data;
...@@ -68,16 +64,24 @@ static int s3c_dma_release(unsigned ch, struct s3c2410_dma_client *client) ...@@ -68,16 +64,24 @@ static int s3c_dma_release(unsigned ch, struct s3c2410_dma_client *client)
break; break;
list_del(&data->node); list_del(&data->node);
s3c2410_dma_free(ch, client); s3c2410_dma_free(ch, param);
kfree(data); kfree(data);
return 0; return 0;
} }
static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep_info *info) static int s3c_dma_config(unsigned ch, struct samsung_dma_config *param)
{
s3c2410_dma_devconfig(ch, param->direction, param->fifo);
s3c2410_dma_config(ch, param->width);
return 0;
}
static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep *param)
{ {
struct cb_data *data; struct cb_data *data;
int len = (info->cap == DMA_CYCLIC) ? info->period : info->len; int len = (param->cap == DMA_CYCLIC) ? param->period : param->len;
list_for_each_entry(data, &dma_list, node) list_for_each_entry(data, &dma_list, node)
if (data->ch == ch) if (data->ch == ch)
...@@ -85,11 +89,11 @@ static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep_info *info) ...@@ -85,11 +89,11 @@ static int s3c_dma_prepare(unsigned ch, struct samsung_dma_prep_info *info)
if (!data->fp) { if (!data->fp) {
s3c2410_dma_set_buffdone_fn(ch, s3c_dma_cb); s3c2410_dma_set_buffdone_fn(ch, s3c_dma_cb);
data->fp = info->fp; data->fp = param->fp;
data->fp_param = info->fp_param; data->fp_param = param->fp_param;
} }
s3c2410_dma_enqueue(ch, (void *)data, info->buf, len); s3c2410_dma_enqueue(ch, (void *)data, param->buf, len);
return 0; return 0;
} }
...@@ -117,6 +121,7 @@ static inline int s3c_dma_stop(unsigned ch) ...@@ -117,6 +121,7 @@ static inline int s3c_dma_stop(unsigned ch)
static struct samsung_dma_ops s3c_dma_ops = { static struct samsung_dma_ops s3c_dma_ops = {
.request = s3c_dma_request, .request = s3c_dma_request,
.release = s3c_dma_release, .release = s3c_dma_release,
.config = s3c_dma_config,
.prepare = s3c_dma_prepare, .prepare = s3c_dma_prepare,
.trigger = s3c_dma_trigger, .trigger = s3c_dma_trigger,
.started = s3c_dma_started, .started = s3c_dma_started,
......
此差异已折叠。
...@@ -74,7 +74,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream) ...@@ -74,7 +74,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
struct runtime_data *prtd = substream->runtime->private_data; struct runtime_data *prtd = substream->runtime->private_data;
dma_addr_t pos = prtd->dma_pos; dma_addr_t pos = prtd->dma_pos;
unsigned int limit; unsigned int limit;
struct samsung_dma_prep_info dma_info; struct samsung_dma_prep dma_info;
pr_debug("Entered %s\n", __func__); pr_debug("Entered %s\n", __func__);
...@@ -146,7 +146,8 @@ static int dma_hw_params(struct snd_pcm_substream *substream, ...@@ -146,7 +146,8 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
unsigned long totbytes = params_buffer_bytes(params); unsigned long totbytes = params_buffer_bytes(params);
struct s3c_dma_params *dma = struct s3c_dma_params *dma =
snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
struct samsung_dma_info dma_info; struct samsung_dma_req req;
struct samsung_dma_config config;
pr_debug("Entered %s\n", __func__); pr_debug("Entered %s\n", __func__);
...@@ -166,16 +167,17 @@ static int dma_hw_params(struct snd_pcm_substream *substream, ...@@ -166,16 +167,17 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
prtd->params->ops = samsung_dma_get_ops(); prtd->params->ops = samsung_dma_get_ops();
dma_info.cap = (samsung_dma_has_circular() ? req.cap = (samsung_dma_has_circular() ?
DMA_CYCLIC : DMA_SLAVE); DMA_CYCLIC : DMA_SLAVE);
dma_info.client = prtd->params->client; req.client = prtd->params->client;
dma_info.direction = config.direction =
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM); ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
dma_info.width = prtd->params->dma_size; config.width = prtd->params->dma_size;
dma_info.fifo = prtd->params->dma_addr; config.fifo = prtd->params->dma_addr;
prtd->params->ch = prtd->params->ops->request( prtd->params->ch = prtd->params->ops->request(
prtd->params->channel, &dma_info); prtd->params->channel, &req);
prtd->params->ops->config(prtd->params->ch, &config);
} }
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册