Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/egtvedt/linux-avr32

Pull AVR32 updates from Hans-Christian Noren Egtvedt.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32:
  mmc: atmel: get rid of struct mci_dma_data
  mmc: atmel-mci: restore dma on AVR32
  avr32: wire up missing syscalls
  avr32: wire up accept4 syscall
  • Loading branch information
torvalds committed Jan 18, 2016
2 parents c1a198d + 238d1c6 commit d90f351
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
4 changes: 4 additions & 0 deletions arch/avr32/include/uapi/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,9 @@
#define __NR_memfd_create 318
#define __NR_bpf 319
#define __NR_execveat 320
#define __NR_accept4 321
#define __NR_userfaultfd 322
#define __NR_membarrier 323
#define __NR_mlock2 324

#endif /* _UAPI__ASM_AVR32_UNISTD_H */
4 changes: 4 additions & 0 deletions arch/avr32/kernel/syscall_table.S
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,8 @@ sys_call_table:
.long sys_memfd_create
.long sys_bpf
.long sys_execveat /* 320 */
.long sys_accept4
.long sys_userfaultfd
.long sys_membarrier
.long sys_mlock2
.long sys_ni_syscall /* r8 is saturated at nr_syscalls */
31 changes: 23 additions & 8 deletions arch/avr32/mach-at32ap/at32ap700x.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/spi/spi.h>
#include <linux/usb/atmel_usba_udc.h>

#include <linux/platform_data/mmc-atmel-mci.h>
#include <linux/atmel-mci.h>

#include <asm/io.h>
Expand Down Expand Up @@ -1321,11 +1320,26 @@ static struct clk atmel_mci0_pclk = {
.index = 9,
};

static bool at32_mci_dma_filter(struct dma_chan *chan, void *pdata)
{
struct dw_dma_slave *sl = pdata;

if (!sl)
return false;

if (sl->dma_dev == chan->device->dev) {
chan->private = sl;
return true;
}

return false;
}

struct platform_device *__init
at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
{
struct platform_device *pdev;
struct mci_dma_data *slave;
struct dw_dma_slave *slave;
u32 pioa_mask;
u32 piob_mask;

Expand All @@ -1344,17 +1358,18 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
ARRAY_SIZE(atmel_mci0_resource)))
goto fail;

slave = kzalloc(sizeof(struct mci_dma_data), GFP_KERNEL);
slave = kzalloc(sizeof(*slave), GFP_KERNEL);
if (!slave)
goto fail;

slave->sdata.dma_dev = &dw_dmac0_device.dev;
slave->sdata.src_id = 0;
slave->sdata.dst_id = 1;
slave->sdata.src_master = 1;
slave->sdata.dst_master = 0;
slave->dma_dev = &dw_dmac0_device.dev;
slave->src_id = 0;
slave->dst_id = 1;
slave->src_master = 1;
slave->dst_master = 0;

data->dma_slave = slave;
data->dma_filter = at32_mci_dma_filter;

if (platform_device_add_data(pdev, data,
sizeof(struct mci_platform_data)))
Expand Down
18 changes: 17 additions & 1 deletion drivers/mmc/host/atmel-mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/types.h>
#include <linux/platform_data/mmc-atmel-mci.h>

#include <linux/mmc/host.h>
#include <linux/mmc/sdio.h>
Expand Down Expand Up @@ -2439,6 +2438,23 @@ static int atmci_configure_dma(struct atmel_mci *host)
{
host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev,
"rxtx");

if (PTR_ERR(host->dma.chan) == -ENODEV) {
struct mci_platform_data *pdata = host->pdev->dev.platform_data;
dma_cap_mask_t mask;

if (!pdata->dma_filter)
return -ENODEV;

dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);

host->dma.chan = dma_request_channel(mask, pdata->dma_filter,
pdata->dma_slave);
if (!host->dma.chan)
host->dma.chan = ERR_PTR(-ENODEV);
}

if (IS_ERR(host->dma.chan))
return PTR_ERR(host->dma.chan);

Expand Down
4 changes: 3 additions & 1 deletion include/linux/atmel-mci.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __LINUX_ATMEL_MCI_H

#include <linux/types.h>
#include <linux/dmaengine.h>

#define ATMCI_MAX_NR_SLOTS 2

Expand Down Expand Up @@ -36,7 +37,8 @@ struct mci_slot_pdata {
* @slot: Per-slot configuration data.
*/
struct mci_platform_data {
struct mci_dma_data *dma_slave;
void *dma_slave;
dma_filter_fn dma_filter;
struct mci_slot_pdata slot[ATMCI_MAX_NR_SLOTS];
};

Expand Down
22 changes: 0 additions & 22 deletions include/linux/platform_data/mmc-atmel-mci.h

This file was deleted.

0 comments on commit d90f351

Please sign in to comment.