Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions arch/arm/boot/dts/at91sam9260.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,14 @@
};
};

i2c0 {
pinctrl_i2c0: i2c0-0 {
atmel,pins =
<0 23 0x1 0x0 /* PA23 periph A I2C0 data */
0 24 0x1 0x0>; /* PA24 periph A I2C0 clock */
};
};

pioA: gpio@fffff400 {
compatible = "atmel,at91rm9200-gpio";
reg = <0xfffff400 0x200>;
Expand Down Expand Up @@ -563,6 +571,8 @@
interrupts = <11 IRQ_TYPE_LEVEL_HIGH 6>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c0>;
status = "disabled";
};

Expand Down
55 changes: 55 additions & 0 deletions arch/arm/boot/dts/at91sam9x5.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
serial1 = &usart0;
serial2 = &usart1;
serial3 = &usart2;
serial4 = &usart3;
gpio0 = &pioA;
gpio1 = &pioB;
gpio2 = &pioC;
Expand Down Expand Up @@ -277,6 +278,11 @@
reg = <7>;
};

usart3_clk: usart3_clk {
#clock-cells = <0>;
reg = <8>;
};

twi0_clk: twi0_clk {
reg = <9>;
#clock-cells = <0>;
Expand Down Expand Up @@ -570,6 +576,29 @@
};
};

usart3 {
pinctrl_usart3: usart3-0 {
atmel,pins =
<AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PC22 periph B with pullup */
AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC23 periph B */
};

pinctrl_usart3_rts: usart3_rts-0 {
atmel,pins =
<AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC24 periph B */
};

pinctrl_usart3_cts: usart3_cts-0 {
atmel,pins =
<AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC25 periph B */
};

pinctrl_usart3_sck: usart3_sck-0 {
atmel,pins =
<AT91_PIOC 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC26 periph B */
};
};

uart0 {
pinctrl_uart0: uart0-0 {
atmel,pins =
Expand Down Expand Up @@ -944,6 +973,9 @@
reg = <0xfffff200 0x200>;
interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
pinctrl-names = "default";
dmas = <&dma1 1 0x8>,
<&dma1 1 0x209>;
dma-names = "tx", "rx";
pinctrl-0 = <&pinctrl_dbgu>;
clocks = <&mck>;
clock-names = "usart";
Expand All @@ -954,6 +986,9 @@
compatible = "atmel,at91sam9260-usart";
reg = <0xf801c000 0x200>;
interrupts = <5 IRQ_TYPE_LEVEL_HIGH 5>;
dmas = <&dma0 1 0x3>,
<&dma0 1 0x204>;
dma-names = "tx", "rx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart0>;
clocks = <&usart0_clk>;
Expand All @@ -965,6 +1000,9 @@
compatible = "atmel,at91sam9260-usart";
reg = <0xf8020000 0x200>;
interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
dmas = <&dma0 1 0x5>,
<&dma0 1 0x204>;
dma-names = "tx", "rx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart1>;
clocks = <&usart1_clk>;
Expand All @@ -976,13 +1014,30 @@
compatible = "atmel,at91sam9260-usart";
reg = <0xf8024000 0x200>;
interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
dmas = <&dma1 1 0xc>,
<&dma1 1 0x20d>;
dma-names = "tx", "rx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart2>;
clocks = <&usart2_clk>;
clock-names = "usart";
status = "disabled";
};

usart3: serial@f8028000 {
compatible = "atmel,at91sam9260-usart";
reg = <0xf8028000 0x200>;
interrupts = <8 4 5>;
dmas = <&dma1 1 0xe>,
<&dma1 1 0x20f>;
dma-names = "tx", "rx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usart3>;
clocks = <&usart3_clk>;
clock-names = "usart";
status = "disabled";
};

i2c0: i2c@f8010000 {
compatible = "atmel,at91sam9x5-i2c";
reg = <0xf8010000 0x100>;
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/boot/dts/sama5d35ek.dts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
status = "okay";
};

ssc0: ssc@f0008000 {
status = "okay";
};

can0: can@f000c000 {
status = "okay";
};
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/sama5d3xmb.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
*/
i2c0: i2c@f0014000 {
wm8904: wm8904@1a {
compatible = "wm8904";
compatible = "wlf,wm8904";
reg = <0x1a>;
clocks = <&pck0>;
clock-names = "mclk";
status = "okay";
};
};

Expand Down
8 changes: 8 additions & 0 deletions drivers/clk/at91/clk-peripheral.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph)
if (parent_rate >> shift <= periph->range.max)
break;
}

if (shift == PERIPHERAL_MAX_SHIFT) {
shift--;
printk(KERN_WARNING "clk: setting frequency of clock "
"per_id=%d to value %lu above upper limit %lu\n",
periph->id, parent_rate >> shift,
periph->range.max);
}
}

periph->auto_div = false;
Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,13 +1250,12 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
static void atmel_spi_cleanup(struct spi_device *spi)
{
struct atmel_spi_device *asd = spi->controller_state;
unsigned gpio = (unsigned) spi->controller_data;

if (!asd)
return;

spi->controller_state = NULL;
gpio_free(gpio);
gpio_free(asd->npcs_pin);
kfree(asd);
}

Expand Down
72 changes: 46 additions & 26 deletions drivers/tty/serial/atmel_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,40 +825,57 @@ static void atmel_rx_from_dma(struct uart_port *port)
struct dma_chan *chan = atmel_port->chan_rx;
struct dma_tx_state state;
enum dma_status dmastat;
size_t pending, count;
size_t pending, count, sg_len;


/* Reset the UART timeout early so that we don't miss one */
UART_PUT_CR(port, ATMEL_US_STTTO);
dmastat = dmaengine_tx_status(chan,
atmel_port->cookie_rx,
&state);
/* Restart a new tasklet if DMA status is error */
if (dmastat == DMA_ERROR) {
dev_dbg(port->dev, "Get residue error, restart tasklet\n");
UART_PUT_IER(port, ATMEL_US_TIMEOUT);
tasklet_schedule(&atmel_port->tasklet);
return;
}
/* current transfer size should no larger than dma buffer */
pending = sg_dma_len(&atmel_port->sg_rx) - state.residue;
BUG_ON(pending > sg_dma_len(&atmel_port->sg_rx));

/*
* This will take the chars we have so far,
* ring->head will record the transfer size, only new bytes come
* will insert into the framework.
sg_len = sg_dma_len(&atmel_port->sg_rx);

/* Loop untill all data are transferred from the ring buffer.
* dmaengine_tx_status() calculates residue taking in account only
* state of oldest sg buffer, so we should retry in case there is data
* in the new one.
*/
if (pending > ring->head) {
count = pending - ring->head;
while (1) {
dmastat = dmaengine_tx_status(chan,
atmel_port->cookie_rx,
&state);
/* Restart a new tasklet if DMA status is error */
if (dmastat == DMA_ERROR) {
dev_dbg(port->dev,
"Get residue error, restart tasklet\n");
UART_PUT_IER(port, ATMEL_US_TIMEOUT);
tasklet_schedule(&atmel_port->tasklet);
return;
}
/* current transfer size should no larger than dma buffer */
pending = sg_len - state.residue;
BUG_ON(pending > sg_len);

atmel_flip_buffer_rx_dma(port, ring->buf + ring->head, count);
/* DMA has filled ring buffer up to `pending`, and data
* up to `ring->head` was already transferred to TTY layer.
*
* Sometimes we have already rewound ring->head to 0, but
* `pending` is still at `sg_len` if no bytes were transferred.
* Second subcondition deals with this case.
*/
if ((pending > ring->head) &&
(pending - ring->head != sg_len)) {
count = pending - ring->head;

atmel_flip_buffer_rx_dma(port, ring->buf + ring->head,
count);

ring->head += count;
if (ring->head == sg_dma_len(&atmel_port->sg_rx))
ring->head = 0;
ring->head += count;
if (ring->head == sg_len)
ring->head = 0;

port->icount.rx += count;
port->icount.rx += count;
} else {
break;
}
}

UART_PUT_IER(port, ATMEL_US_TIMEOUT);
Expand All @@ -874,6 +891,9 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
int ret, nent;

ring = &atmel_port->rx_ring;
ring->head = 0;

port = &(atmel_port->uart);

dma_cap_zero(mask);
dma_cap_set(DMA_CYCLIC, mask);
Expand All @@ -887,7 +907,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
spin_lock_init(&atmel_port->lock_rx);
sg_init_table(&atmel_port->sg_rx, 1);
/* UART circular rx buffer is an aligned page. */
BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK);
BUG_ON((int)ring->buf & ~PAGE_MASK);
sg_set_page(&atmel_port->sg_rx,
virt_to_page(ring->buf),
ATMEL_SERIAL_RINGSIZE,
Expand Down
11 changes: 11 additions & 0 deletions sound/soc/atmel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,14 @@ config SND_AT91_SOC_AFEB9260
select SND_SOC_TLV320AIC23_I2C
help
Say Y here to support sound on AFEB9260 board.

config SND_AT91_SOC_SAMA5D3_WM8904
tristate "SoC Audio support for WM8904 based SAMA5D3-EK board"
depends on ATMEL_SSC && SND_ATMEL_SOC
select SND_ATMEL_SOC_DMA
select SND_ATMEL_SOC_SSC
select SND_SOC_WM8904
select SND_SOC_DMAENGINE_PCM
help
Say Y if you want to add support for audio SoC on an
SAMA5D3-EK board which uses WM8904 audio codec.
3 changes: 3 additions & 0 deletions sound/soc/atmel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
snd-atmel-soc-wm8904-objs := atmel_wm8904.o
snd-soc-sam9x5-wm8731-objs := sam9x5_wm8731.o
snd-soc-sama5d3-wm8904-objs := sama5d3_wm8904.o

obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o
obj-$(CONFIG_SND_ATMEL_SOC_WM8904) += snd-atmel-soc-wm8904.o
obj-$(CONFIG_SND_AT91_SOC_SAM9X5_WM8731) += snd-soc-sam9x5-wm8731.o
obj-$(CONFIG_SND_AT91_SOC_SAMA5D3_WM8904) += snd-soc-sama5d3-wm8904.o

obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o
Loading