| .. | .. |
|---|
| 36 | 36 | #include <linux/platform_device.h> |
|---|
| 37 | 37 | #include <linux/dma-mapping.h> |
|---|
| 38 | 38 | #include <linux/slab.h> |
|---|
| 39 | +#include <linux/pgtable.h> |
|---|
| 39 | 40 | |
|---|
| 40 | 41 | #include <asm/bootinfo.h> |
|---|
| 41 | | -#include <asm/pgtable.h> |
|---|
| 42 | 42 | #include <asm/io.h> |
|---|
| 43 | 43 | #include <asm/dma.h> |
|---|
| 44 | 44 | #include <asm/jazz.h> |
|---|
| .. | .. |
|---|
| 147 | 147 | dev->dev_addr[i*2+1] = val >> 8; |
|---|
| 148 | 148 | } |
|---|
| 149 | 149 | |
|---|
| 150 | | - err = -ENOMEM; |
|---|
| 151 | | - |
|---|
| 152 | | - /* Initialize the device structure. */ |
|---|
| 153 | | - |
|---|
| 154 | 150 | lp->dma_bitmode = SONIC_BITMODE32; |
|---|
| 155 | 151 | |
|---|
| 156 | | - /* Allocate the entire chunk of memory for the descriptors. |
|---|
| 157 | | - Note that this cannot cross a 64K boundary. */ |
|---|
| 158 | | - lp->descriptors = dma_alloc_coherent(lp->device, |
|---|
| 159 | | - SIZEOF_SONIC_DESC * |
|---|
| 160 | | - SONIC_BUS_SCALE(lp->dma_bitmode), |
|---|
| 161 | | - &lp->descriptors_laddr, |
|---|
| 162 | | - GFP_KERNEL); |
|---|
| 163 | | - if (lp->descriptors == NULL) |
|---|
| 152 | + err = sonic_alloc_descriptors(dev); |
|---|
| 153 | + if (err) |
|---|
| 164 | 154 | goto out; |
|---|
| 165 | | - |
|---|
| 166 | | - /* Now set up the pointers to point to the appropriate places */ |
|---|
| 167 | | - lp->cda = lp->descriptors; |
|---|
| 168 | | - lp->tda = lp->cda + (SIZEOF_SONIC_CDA |
|---|
| 169 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 170 | | - lp->rda = lp->tda + (SIZEOF_SONIC_TD * SONIC_NUM_TDS |
|---|
| 171 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 172 | | - lp->rra = lp->rda + (SIZEOF_SONIC_RD * SONIC_NUM_RDS |
|---|
| 173 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 174 | | - |
|---|
| 175 | | - lp->cda_laddr = lp->descriptors_laddr; |
|---|
| 176 | | - lp->tda_laddr = lp->cda_laddr + (SIZEOF_SONIC_CDA |
|---|
| 177 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 178 | | - lp->rda_laddr = lp->tda_laddr + (SIZEOF_SONIC_TD * SONIC_NUM_TDS |
|---|
| 179 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 180 | | - lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS |
|---|
| 181 | | - * SONIC_BUS_SCALE(lp->dma_bitmode)); |
|---|
| 182 | 155 | |
|---|
| 183 | 156 | dev->netdev_ops = &sonic_netdev_ops; |
|---|
| 184 | 157 | dev->watchdog_timeo = TX_TIMEOUT; |
|---|