aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-01-05 05:23:38 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-01-05 05:23:38 -0500
commit1051b9f0f9eab8091fe3bf98320741adf36b4cfa (patch)
tree68ea1c8f9c446d6ebd96caf3ba4ec73f1fa5ace6 /drivers
parentcde9efef401563943d5a58eb9b7274bfdc08ca9b (diff)
parenta58154d1c3535f451a409abbd0bda6770b2d9380 (diff)
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel-stable
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/imx-sdma.c174
-rw-r--r--drivers/usb/gadget/fsl_mxc_udc.c4
-rw-r--r--drivers/usb/host/ehci-mxc.c44
-rw-r--r--drivers/watchdog/imx2_wdt.c2
4 files changed, 113 insertions, 111 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index d0602dd5d1b2..d5a5d4d9c19b 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -273,50 +273,6 @@ struct sdma_channel {
273#define MXC_SDMA_MIN_PRIORITY 1 273#define MXC_SDMA_MIN_PRIORITY 1
274#define MXC_SDMA_MAX_PRIORITY 7 274#define MXC_SDMA_MAX_PRIORITY 7
275 275
276/**
277 * struct sdma_script_start_addrs - SDMA script start pointers
278 *
279 * start addresses of the different functions in the physical
280 * address space of the SDMA engine.
281 */
282struct sdma_script_start_addrs {
283 u32 ap_2_ap_addr;
284 u32 ap_2_bp_addr;
285 u32 ap_2_ap_fixed_addr;
286 u32 bp_2_ap_addr;
287 u32 loopback_on_dsp_side_addr;
288 u32 mcu_interrupt_only_addr;
289 u32 firi_2_per_addr;
290 u32 firi_2_mcu_addr;
291 u32 per_2_firi_addr;
292 u32 mcu_2_firi_addr;
293 u32 uart_2_per_addr;
294 u32 uart_2_mcu_addr;
295 u32 per_2_app_addr;
296 u32 mcu_2_app_addr;
297 u32 per_2_per_addr;
298 u32 uartsh_2_per_addr;
299 u32 uartsh_2_mcu_addr;
300 u32 per_2_shp_addr;
301 u32 mcu_2_shp_addr;
302 u32 ata_2_mcu_addr;
303 u32 mcu_2_ata_addr;
304 u32 app_2_per_addr;
305 u32 app_2_mcu_addr;
306 u32 shp_2_per_addr;
307 u32 shp_2_mcu_addr;
308 u32 mshc_2_mcu_addr;
309 u32 mcu_2_mshc_addr;
310 u32 spdif_2_mcu_addr;
311 u32 mcu_2_spdif_addr;
312 u32 asrc_2_mcu_addr;
313 u32 ext_mem_2_ipu_addr;
314 u32 descrambler_addr;
315 u32 dptc_dvfs_addr;
316 u32 utra_addr;
317 u32 ram_code_start_addr;
318};
319
320#define SDMA_FIRMWARE_MAGIC 0x414d4453 276#define SDMA_FIRMWARE_MAGIC 0x414d4453
321 277
322/** 278/**
@@ -1127,8 +1083,74 @@ static void sdma_issue_pending(struct dma_chan *chan)
1127 */ 1083 */
1128} 1084}
1129 1085
1130static int __init sdma_init(struct sdma_engine *sdma, 1086#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 34
1131 void *ram_code, int ram_code_size) 1087
1088static void sdma_add_scripts(struct sdma_engine *sdma,
1089 const struct sdma_script_start_addrs *addr)
1090{
1091 s32 *addr_arr = (u32 *)addr;
1092 s32 *saddr_arr = (u32 *)sdma->script_addrs;
1093 int i;
1094
1095 for (i = 0; i < SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1; i++)
1096 if (addr_arr[i] > 0)
1097 saddr_arr[i] = addr_arr[i];
1098}
1099
1100static int __init sdma_get_firmware(struct sdma_engine *sdma,
1101 const char *cpu_name, int to_version)
1102{
1103 const struct firmware *fw;
1104 char *fwname;
1105 const struct sdma_firmware_header *header;
1106 int ret;
1107 const struct sdma_script_start_addrs *addr;
1108 unsigned short *ram_code;
1109
1110 fwname = kasprintf(GFP_KERNEL, "sdma-%s-to%d.bin", cpu_name, to_version);
1111 if (!fwname)
1112 return -ENOMEM;
1113
1114 ret = request_firmware(&fw, fwname, sdma->dev);
1115 if (ret) {
1116 kfree(fwname);
1117 return ret;
1118 }
1119 kfree(fwname);
1120
1121 if (fw->size < sizeof(*header))
1122 goto err_firmware;
1123
1124 header = (struct sdma_firmware_header *)fw->data;
1125
1126 if (header->magic != SDMA_FIRMWARE_MAGIC)
1127 goto err_firmware;
1128 if (header->ram_code_start + header->ram_code_size > fw->size)
1129 goto err_firmware;
1130
1131 addr = (void *)header + header->script_addrs_start;
1132 ram_code = (void *)header + header->ram_code_start;
1133
1134 clk_enable(sdma->clk);
1135 /* download the RAM image for SDMA */
1136 sdma_load_script(sdma, ram_code,
1137 header->ram_code_size,
1138 sdma->script_addrs->ram_code_start_addr);
1139 clk_disable(sdma->clk);
1140
1141 sdma_add_scripts(sdma, addr);
1142
1143 dev_info(sdma->dev, "loaded firmware %d.%d\n",
1144 header->version_major,
1145 header->version_minor);
1146
1147err_firmware:
1148 release_firmware(fw);
1149
1150 return ret;
1151}
1152
1153static int __init sdma_init(struct sdma_engine *sdma)
1132{ 1154{
1133 int i, ret; 1155 int i, ret;
1134 dma_addr_t ccb_phys; 1156 dma_addr_t ccb_phys;
@@ -1192,11 +1214,6 @@ static int __init sdma_init(struct sdma_engine *sdma,
1192 1214
1193 __raw_writel(ccb_phys, sdma->regs + SDMA_H_C0PTR); 1215 __raw_writel(ccb_phys, sdma->regs + SDMA_H_C0PTR);
1194 1216
1195 /* download the RAM image for SDMA */
1196 sdma_load_script(sdma, ram_code,
1197 ram_code_size,
1198 sdma->script_addrs->ram_code_start_addr);
1199
1200 /* Set bits of CONFIG register with given context switching mode */ 1217 /* Set bits of CONFIG register with given context switching mode */
1201 __raw_writel(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG); 1218 __raw_writel(SDMA_H_CONFIG_CSM, sdma->regs + SDMA_H_CONFIG);
1202 1219
@@ -1216,14 +1233,9 @@ err_dma_alloc:
1216static int __init sdma_probe(struct platform_device *pdev) 1233static int __init sdma_probe(struct platform_device *pdev)
1217{ 1234{
1218 int ret; 1235 int ret;
1219 const struct firmware *fw;
1220 const struct sdma_firmware_header *header;
1221 const struct sdma_script_start_addrs *addr;
1222 int irq; 1236 int irq;
1223 unsigned short *ram_code;
1224 struct resource *iores; 1237 struct resource *iores;
1225 struct sdma_platform_data *pdata = pdev->dev.platform_data; 1238 struct sdma_platform_data *pdata = pdev->dev.platform_data;
1226 char *fwname;
1227 int i; 1239 int i;
1228 dma_cap_mask_t mask; 1240 dma_cap_mask_t mask;
1229 struct sdma_engine *sdma; 1241 struct sdma_engine *sdma;
@@ -1262,38 +1274,9 @@ static int __init sdma_probe(struct platform_device *pdev)
1262 if (ret) 1274 if (ret)
1263 goto err_request_irq; 1275 goto err_request_irq;
1264 1276
1265 fwname = kasprintf(GFP_KERNEL, "sdma-%s-to%d.bin", 1277 sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL);
1266 pdata->cpu_name, pdata->to_version);
1267 if (!fwname) {
1268 ret = -ENOMEM;
1269 goto err_cputype;
1270 }
1271
1272 ret = request_firmware(&fw, fwname, &pdev->dev);
1273 if (ret) {
1274 dev_err(&pdev->dev, "request firmware \"%s\" failed with %d\n",
1275 fwname, ret);
1276 kfree(fwname);
1277 goto err_cputype;
1278 }
1279 kfree(fwname);
1280
1281 if (fw->size < sizeof(*header))
1282 goto err_firmware;
1283
1284 header = (struct sdma_firmware_header *)fw->data;
1285
1286 if (header->magic != SDMA_FIRMWARE_MAGIC)
1287 goto err_firmware;
1288 if (header->ram_code_start + header->ram_code_size > fw->size)
1289 goto err_firmware;
1290
1291 addr = (void *)header + header->script_addrs_start;
1292 ram_code = (void *)header + header->ram_code_start;
1293 sdma->script_addrs = kmalloc(sizeof(*addr), GFP_KERNEL);
1294 if (!sdma->script_addrs) 1278 if (!sdma->script_addrs)
1295 goto err_firmware; 1279 goto err_alloc;
1296 memcpy(sdma->script_addrs, addr, sizeof(*addr));
1297 1280
1298 sdma->version = pdata->sdma_version; 1281 sdma->version = pdata->sdma_version;
1299 1282
@@ -1316,10 +1299,15 @@ static int __init sdma_probe(struct platform_device *pdev)
1316 list_add_tail(&sdmac->chan.device_node, &sdma->dma_device.channels); 1299 list_add_tail(&sdmac->chan.device_node, &sdma->dma_device.channels);
1317 } 1300 }
1318 1301
1319 ret = sdma_init(sdma, ram_code, header->ram_code_size); 1302 ret = sdma_init(sdma);
1320 if (ret) 1303 if (ret)
1321 goto err_init; 1304 goto err_init;
1322 1305
1306 if (pdata->script_addrs)
1307 sdma_add_scripts(sdma, pdata->script_addrs);
1308
1309 sdma_get_firmware(sdma, pdata->cpu_name, pdata->to_version);
1310
1323 sdma->dma_device.dev = &pdev->dev; 1311 sdma->dma_device.dev = &pdev->dev;
1324 1312
1325 sdma->dma_device.device_alloc_chan_resources = sdma_alloc_chan_resources; 1313 sdma->dma_device.device_alloc_chan_resources = sdma_alloc_chan_resources;
@@ -1336,10 +1324,6 @@ static int __init sdma_probe(struct platform_device *pdev)
1336 goto err_init; 1324 goto err_init;
1337 } 1325 }
1338 1326
1339 dev_info(&pdev->dev, "initialized (firmware %d.%d)\n",
1340 header->version_major,
1341 header->version_minor);
1342
1343 /* request channel 0. This is an internal control channel 1327 /* request channel 0. This is an internal control channel
1344 * to the SDMA engine and not available to clients. 1328 * to the SDMA engine and not available to clients.
1345 */ 1329 */
@@ -1347,15 +1331,13 @@ static int __init sdma_probe(struct platform_device *pdev)
1347 dma_cap_set(DMA_SLAVE, mask); 1331 dma_cap_set(DMA_SLAVE, mask);
1348 dma_request_channel(mask, NULL, NULL); 1332 dma_request_channel(mask, NULL, NULL);
1349 1333
1350 release_firmware(fw); 1334 dev_info(sdma->dev, "initialized\n");
1351 1335
1352 return 0; 1336 return 0;
1353 1337
1354err_init: 1338err_init:
1355 kfree(sdma->script_addrs); 1339 kfree(sdma->script_addrs);
1356err_firmware: 1340err_alloc:
1357 release_firmware(fw);
1358err_cputype:
1359 free_irq(irq, sdma); 1341 free_irq(irq, sdma);
1360err_request_irq: 1342err_request_irq:
1361 iounmap(sdma->regs); 1343 iounmap(sdma->regs);
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c
index 5bdbfe619853..77b1eb577029 100644
--- a/drivers/usb/gadget/fsl_mxc_udc.c
+++ b/drivers/usb/gadget/fsl_mxc_udc.c
@@ -93,9 +93,9 @@ void fsl_udc_clk_finalize(struct platform_device *pdev)
93 93
94 /* workaround ENGcm09152 for i.MX35 */ 94 /* workaround ENGcm09152 for i.MX35 */
95 if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { 95 if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
96 v = readl(MX35_IO_ADDRESS(MX35_OTG_BASE_ADDR + 96 v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
97 USBPHYCTRL_OTGBASE_OFFSET)); 97 USBPHYCTRL_OTGBASE_OFFSET));
98 writel(v | USBPHYCTRL_EVDO, MX35_IO_ADDRESS(MX35_OTG_BASE_ADDR + 98 writel(v | USBPHYCTRL_EVDO, MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
99 USBPHYCTRL_OTGBASE_OFFSET)); 99 USBPHYCTRL_OTGBASE_OFFSET));
100 } 100 }
101#endif 101#endif
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index bce85055019a..a22d2df769a9 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -28,7 +28,7 @@
28#define ULPI_VIEWPORT_OFFSET 0x170 28#define ULPI_VIEWPORT_OFFSET 0x170
29 29
30struct ehci_mxc_priv { 30struct ehci_mxc_priv {
31 struct clk *usbclk, *ahbclk; 31 struct clk *usbclk, *ahbclk, *phy1clk;
32 struct usb_hcd *hcd; 32 struct usb_hcd *hcd;
33}; 33};
34 34
@@ -168,17 +168,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
168 goto err_ioremap; 168 goto err_ioremap;
169 } 169 }
170 170
171 /* call platform specific init function */
172 if (pdata->init) {
173 ret = pdata->init(pdev);
174 if (ret) {
175 dev_err(dev, "platform init failed\n");
176 goto err_init;
177 }
178 /* platforms need some time to settle changed IO settings */
179 mdelay(10);
180 }
181
182 /* enable clocks */ 171 /* enable clocks */
183 priv->usbclk = clk_get(dev, "usb"); 172 priv->usbclk = clk_get(dev, "usb");
184 if (IS_ERR(priv->usbclk)) { 173 if (IS_ERR(priv->usbclk)) {
@@ -196,6 +185,28 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
196 clk_enable(priv->ahbclk); 185 clk_enable(priv->ahbclk);
197 } 186 }
198 187
188 /* "dr" device has its own clock */
189 if (pdev->id == 0) {
190 priv->phy1clk = clk_get(dev, "usb_phy1");
191 if (IS_ERR(priv->phy1clk)) {
192 ret = PTR_ERR(priv->phy1clk);
193 goto err_clk_phy;
194 }
195 clk_enable(priv->phy1clk);
196 }
197
198
199 /* call platform specific init function */
200 if (pdata->init) {
201 ret = pdata->init(pdev);
202 if (ret) {
203 dev_err(dev, "platform init failed\n");
204 goto err_init;
205 }
206 /* platforms need some time to settle changed IO settings */
207 mdelay(10);
208 }
209
199 /* setup specific usb hw */ 210 /* setup specific usb hw */
200 ret = mxc_initialize_usb_hw(pdev->id, pdata->flags); 211 ret = mxc_initialize_usb_hw(pdev->id, pdata->flags);
201 if (ret < 0) 212 if (ret < 0)
@@ -230,6 +241,11 @@ err_add:
230 if (pdata && pdata->exit) 241 if (pdata && pdata->exit)
231 pdata->exit(pdev); 242 pdata->exit(pdev);
232err_init: 243err_init:
244 if (priv->phy1clk) {
245 clk_disable(priv->phy1clk);
246 clk_put(priv->phy1clk);
247 }
248err_clk_phy:
233 if (priv->ahbclk) { 249 if (priv->ahbclk) {
234 clk_disable(priv->ahbclk); 250 clk_disable(priv->ahbclk);
235 clk_put(priv->ahbclk); 251 clk_put(priv->ahbclk);
@@ -273,6 +289,10 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
273 clk_disable(priv->ahbclk); 289 clk_disable(priv->ahbclk);
274 clk_put(priv->ahbclk); 290 clk_put(priv->ahbclk);
275 } 291 }
292 if (priv->phy1clk) {
293 clk_disable(priv->phy1clk);
294 clk_put(priv->phy1clk);
295 }
276 296
277 kfree(priv); 297 kfree(priv);
278 298
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 2ee7dac55a3c..86f7cac1026c 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -270,7 +270,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
270 return -ENOMEM; 270 return -ENOMEM;
271 } 271 }
272 272
273 imx2_wdt.clk = clk_get_sys("imx-wdt.0", NULL); 273 imx2_wdt.clk = clk_get(&pdev->dev, NULL);
274 if (IS_ERR(imx2_wdt.clk)) { 274 if (IS_ERR(imx2_wdt.clk)) {
275 dev_err(&pdev->dev, "can't get Watchdog clock\n"); 275 dev_err(&pdev->dev, "can't get Watchdog clock\n");
276 return PTR_ERR(imx2_wdt.clk); 276 return PTR_ERR(imx2_wdt.clk);