diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/dwc_ahsata.c | 34 | ||||
-rw-r--r-- | drivers/gpio/omap_gpio.c | 2 | ||||
-rw-r--r-- | drivers/spi/mxc_spi.c | 28 | ||||
-rw-r--r-- | drivers/usb/ulpi/omap-ulpi-viewport.c | 42 | ||||
-rw-r--r-- | drivers/video/mxsfb.c | 2 |
5 files changed, 47 insertions, 61 deletions
diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c index c9b71f7e1f9..98f2c52ee33 100644 --- a/drivers/block/dwc_ahsata.c +++ b/drivers/block/dwc_ahsata.c @@ -447,10 +447,13 @@ static int ahci_exec_ata_cmd(struct ahci_probe_ent *probe_ent, if (buf && buf_len) sg_count = ahci_fill_sg(probe_ent, port, buf, buf_len); opts = (sizeof(struct sata_fis_h2d) >> 2) | (sg_count << 16); - if (is_write) + if (is_write) { opts |= 0x40; + flush_cache((ulong)buf, buf_len); + } ahci_fill_cmd_slot(pp, cmd_slot, opts); + flush_cache((int)(pp->cmd_slot), AHCI_PORT_PRIV_DMA_SZ); writel_with_flush(1 << cmd_slot, &(port_mmio->ci)); if (waiting_for_cmd_completed((u8 *)&(port_mmio->ci), @@ -458,8 +461,12 @@ static int ahci_exec_ata_cmd(struct ahci_probe_ent *probe_ent, printf("timeout exit!\n"); return -1; } + invalidate_dcache_range((int)(pp->cmd_slot), + (int)(pp->cmd_slot)+AHCI_PORT_PRIV_DMA_SZ); debug("ahci_exec_ata_cmd: %d byte transferred.\n", pp->cmd_slot->status); + if (!is_write) + invalidate_dcache_range((ulong)buf, (ulong)buf+buf_len); return buf_len; } @@ -468,7 +475,8 @@ static void ahci_set_feature(u8 dev, u8 port) { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; memset(cfis, 0, sizeof(struct sata_fis_h2d)); cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D; @@ -615,7 +623,8 @@ static void dwc_ahsata_identify(int dev, u16 *id) { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; memset(cfis, 0, sizeof(struct sata_fis_h2d)); @@ -645,7 +654,8 @@ static u32 dwc_ahsata_rw_cmd(int dev, u32 start, u32 blkcnt, { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; u32 block; @@ -675,7 +685,8 @@ void dwc_ahsata_flush_cache(int dev) { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; memset(cfis, 0, sizeof(struct sata_fis_h2d)); @@ -692,7 +703,8 @@ static u32 dwc_ahsata_rw_cmd_ext(int dev, u32 start, lbaint_t blkcnt, { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; u64 block; @@ -728,7 +740,8 @@ u32 dwc_ahsata_rw_ncq_cmd(int dev, u32 start, lbaint_t blkcnt, { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; u64 block; @@ -769,7 +782,8 @@ void dwc_ahsata_flush_cache_ext(int dev) { struct ahci_probe_ent *probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv; - struct sata_fis_h2d h2d, *cfis = &h2d; + struct sata_fis_h2d h2d __aligned(ARCH_DMA_MINALIGN); + struct sata_fis_h2d *cfis = &h2d; u8 port = probe_ent->hard_port_no; memset(cfis, 0, sizeof(struct sata_fis_h2d)); @@ -912,7 +926,9 @@ int scan_sata(int dev) u8 port = probe_ent->hard_port_no; block_dev_desc_t *pdev = &(sata_dev_desc[dev]); - id = (u16 *)malloc(ATA_ID_WORDS * 2); + id = (u16 *)memalign(ARCH_DMA_MINALIGN, + roundup(ARCH_DMA_MINALIGN, + (ATA_ID_WORDS * 2))); if (!id) { printf("id malloc failed\n\r"); return -1; diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index a30d7f0603e..f16e9ae4d2b 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -55,7 +55,7 @@ static inline int get_gpio_index(int gpio) int gpio_is_valid(int gpio) { - return (gpio >= 0) && (gpio < 192); + return (gpio >= 0) && (gpio < OMAP_MAX_GPIO); } static int check_gpio(int gpio) diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 5bed858787f..0eca7767e0b 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -128,8 +128,8 @@ static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs, unsigned int max_hz, unsigned int mode) { u32 clk_src = mxc_get_clock(MXC_CSPI_CLK); - s32 pre_div = 0, post_div = 0, i, reg_ctrl, reg_config; - u32 ss_pol = 0, sclkpol = 0, sclkpha = 0; + s32 reg_ctrl, reg_config; + u32 ss_pol = 0, sclkpol = 0, sclkpha = 0, pre_div = 0, post_div = 0; struct cspi_regs *regs = (struct cspi_regs *)mxcs->base; if (max_hz == 0) { @@ -147,26 +147,20 @@ static s32 spi_cfg_mxc(struct mxc_spi_slave *mxcs, unsigned int cs, reg_ctrl |= MXC_CSPICTRL_EN; reg_write(®s->ctrl, reg_ctrl); - /* - * The following computation is taken directly from Freescale's code. - */ if (clk_src > max_hz) { - pre_div = DIV_ROUND_UP(clk_src, max_hz); - if (pre_div > 16) { - post_div = pre_div / 16; - pre_div = 15; - } - if (post_div != 0) { - for (i = 0; i < 16; i++) { - if ((1 << i) >= post_div) - break; - } - if (i == 16) { + pre_div = (clk_src - 1) / max_hz; + /* fls(1) = 1, fls(0x80000000) = 32, fls(16) = 5 */ + post_div = fls(pre_div); + if (post_div > 4) { + post_div -= 4; + if (post_div >= 16) { printf("Error: no divider for the freq: %d\n", max_hz); return -1; } - post_div = i; + pre_div >>= post_div; + } else { + post_div = 0; } } diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c index 3c1ea1a5240..4db7fa43ce1 100644 --- a/drivers/usb/ulpi/omap-ulpi-viewport.c +++ b/drivers/usb/ulpi/omap-ulpi-viewport.c @@ -22,18 +22,19 @@ #include <asm/io.h> #include <usb/ulpi.h> -#define OMAP_ULPI_WR_OPSEL (3 << 21) -#define OMAP_ULPI_ACCESS (1 << 31) +#define OMAP_ULPI_WR_OPSEL (2 << 22) +#define OMAP_ULPI_RD_OPSEL (3 << 22) +#define OMAP_ULPI_START (1 << 31) /* - * Wait for the ULPI Access to complete + * Wait for having ulpi in done state */ static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask) { int timeout = CONFIG_USB_ULPI_TIMEOUT; while (--timeout) { - if ((readl(ulpi_vp->viewport_addr) & mask)) + if (!(readl(ulpi_vp->viewport_addr) & mask)) return 0; udelay(1); @@ -43,40 +44,15 @@ static int ulpi_wait(struct ulpi_viewport *ulpi_vp, u32 mask) } /* - * Wake the ULPI PHY up for communication - * - * returns 0 on success. - */ -static int ulpi_wakeup(struct ulpi_viewport *ulpi_vp) -{ - int err; - - if (readl(ulpi_vp->viewport_addr) & OMAP_ULPI_ACCESS) - return 0; /* already awake */ - - writel(OMAP_ULPI_ACCESS, ulpi_vp->viewport_addr); - - err = ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS); - if (err) - debug("ULPI wakeup timed out\n"); - - return err; -} - -/* * Issue a ULPI read/write request */ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value) { int err; - err = ulpi_wakeup(ulpi_vp); - if (err) - return err; - writel(value, ulpi_vp->viewport_addr); - err = ulpi_wait(ulpi_vp, OMAP_ULPI_ACCESS); + err = ulpi_wait(ulpi_vp, OMAP_ULPI_START); if (err) debug("ULPI request timed out\n"); @@ -85,7 +61,7 @@ static int ulpi_request(struct ulpi_viewport *ulpi_vp, u32 value) int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value) { - u32 val = ((ulpi_vp->port_num & 0xf) << 24) | + u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) | OMAP_ULPI_WR_OPSEL | ((u32)reg << 16) | (value & 0xff); return ulpi_request(ulpi_vp, val); @@ -94,8 +70,8 @@ int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value) u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg) { int err; - u32 val = ((ulpi_vp->port_num & 0xf) << 24) | - OMAP_ULPI_WR_OPSEL | ((u32)reg << 16); + u32 val = OMAP_ULPI_START | (((ulpi_vp->port_num + 1) & 0xf) << 24) | + OMAP_ULPI_RD_OPSEL | ((u32)reg << 16); err = ulpi_request(ulpi_vp, val); if (err) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index b1894193583..b0f7ef8d478 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -137,7 +137,7 @@ void *video_hw_init(void) /* Suck display configuration from "videomode" variable */ penv = getenv("videomode"); if (!penv) { - printf("MXSFB: 'videomode' variable not set!"); + puts("MXSFB: 'videomode' variable not set!\n"); return NULL; } |