Re: Help needed on an error during SD card enumeration
Hi Shashidhar Hiremath, snip mmc0:host doesn't support card's voltages set_ios invoked Poweroff Done mmc0: error -22 whilst initializing SDIO card Could you check whether the MMC host controller regulator is configured properly. eventhough I have inserted a SD card Which SD card you are using ? snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] omap_hsmmc - use threaded irq handler for card-detect.
On Thu, Dec 29, 2011 at 8:35 PM, NeilBrown ne...@suse.de wrote: As the card-detect irq handler just schedules work to be done by a thread, we can use request_threaded_irq to do much of the work for us. This means that interrupts which arrive by handle_nested_irq actually work. Reviewed-by: Felipe Balbi ba...@ti.com Tested-by: Grazvydas Ignotas nota...@gmail.com Signed-off-by: NeilBrown ne...@suse.de I have done some thing similar but didn't pushed it :-( Anyways Acked-by: Kishore Kadiyala kishorek.kadiy...@gmail.com diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index d5fe43d..56f6cfc 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -24,7 +24,6 @@ #include linux/delay.h #include linux/dma-mapping.h #include linux/platform_device.h -#include linux/workqueue.h #include linux/timer.h #include linux/clk.h #include linux/mmc/host.h @@ -163,7 +162,6 @@ struct omap_hsmmc_host { */ struct regulator *vcc; struct regulator *vcc_aux; - struct work_struct mmc_carddetect_work; void __iomem *base; resource_size_t mapbase; spinlock_t irq_lock; /* Prevent races with irq handler */ @@ -1280,17 +1278,16 @@ static void omap_hsmmc_protect_card(struct omap_hsmmc_host *host) } /* - * Work Item to notify the core about card insertion/removal + * irq handler to notify the core about card insertion/removal */ -static void omap_hsmmc_detect(struct work_struct *work) +static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id) { - struct omap_hsmmc_host *host = - container_of(work, struct omap_hsmmc_host, mmc_carddetect_work); + struct omap_hsmmc_host *host = dev_id; struct omap_mmc_slot_data *slot = mmc_slot(host); int carddetect; if (host-suspended) - return; + return IRQ_HANDLED; sysfs_notify(host-mmc-class_dev.kobj, NULL, cover_switch); @@ -1305,19 +1302,6 @@ static void omap_hsmmc_detect(struct work_struct *work) mmc_detect_change(host-mmc, (HZ * 200) / 1000); else mmc_detect_change(host-mmc, (HZ * 50) / 1000); -} - -/* - * ISR for handling card insertion and removal - */ -static irqreturn_t omap_hsmmc_cd_handler(int irq, void *dev_id) -{ - struct omap_hsmmc_host *host = (struct omap_hsmmc_host *)dev_id; - - if (host-suspended) - return IRQ_HANDLED; - schedule_work(host-mmc_carddetect_work); - return IRQ_HANDLED; } @@ -1919,7 +1903,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host-next_data.cookie = 1; platform_set_drvdata(pdev, host); - INIT_WORK(host-mmc_carddetect_work, omap_hsmmc_detect); mmc-ops = omap_hsmmc_ops; @@ -2047,10 +2030,11 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) /* Request IRQ for card detect */ if ((mmc_slot(host).card_detect_irq)) { - ret = request_irq(mmc_slot(host).card_detect_irq, - omap_hsmmc_cd_handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - mmc_hostname(mmc), host); + ret = request_threaded_irq(mmc_slot(host).card_detect_irq, + NULL, + omap_hsmmc_detect, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + mmc_hostname(mmc), host); if (ret) { dev_dbg(mmc_dev(host-mmc), Unable to grab MMC CD IRQ\n); @@ -2129,7 +2113,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev) free_irq(host-irq, host); if (mmc_slot(host).card_detect_irq) free_irq(mmc_slot(host).card_detect_irq, host); - flush_work_sync(host-mmc_carddetect_work); pm_runtime_put_sync(host-dev); pm_runtime_disable(host-dev); @@ -2176,7 +2159,6 @@ static int omap_hsmmc_suspend(struct device *dev) return ret; } } - cancel_work_sync(host-mmc_carddetect_work); ret = mmc_suspend_host(host-mmc); if (ret == 0) { -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
On Wed, Dec 28, 2011 at 5:46 AM, Shashidhar hiremath shashidh...@vayavyalabs.com wrote: From: Shashidhar Hiremath shashidh...@vayavyalabs.com The Patch adds a check to disable the IOCTL from running when the card is mounted or device is opened elsewhere. Signed-off-by: Shashidhar Hiremath shashidh...@vayavyalabs.com --- drivers/mmc/card/block.c | 6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 0cad48a..e680929 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, err = -EINVAL; goto cmd_done; } + /* Disallow the IOCTL run if card is already mounted or device is + * opened elsewhere */ Fix multi line comment Can refer : Documentation/kernel-doc-nano-HOWTO.txt + if (md-usage 3) { + err = -EINVAL; + goto cmd_done; + } card = md-queue.card; if (IS_ERR(card)) { -- 1.7.6.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] omap: hsmmc: Normalize dma cleanup operations
On Fri, Sep 2, 2011 at 12:35 AM, Venkatraman S svenk...@ti.com wrote: Reuse omap_hsmmc_dma_cleanup even for normal dma teardown in omap_hsmmc_dma_cb. Consolidate multiple points of dma unmap into a single location in post_req function, to prevent double unmapping. Signed-off-by: Venkatraman S svenk...@ti.com --- drivers/mmc/host/omap_hsmmc.c | 20 +--- 1 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 21e4a79..5b7776c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -999,7 +999,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) { int dma_ch; - host-data-error = errno; + if (host-data) The condition check above becomes redundant since dma_cleanup is called during errors in omap_hsmmc_do_irq. Better have this check in the dma_cb where dma_cleanup is newly added. + host-data-error = errno; spin_lock(host-irq_lock); dma_ch = host-dma_ch; @@ -1007,12 +1008,8 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) spin_unlock(host-irq_lock); if (host-use_dma dma_ch != -1) { - dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, - host-data-sg_len, - omap_hsmmc_get_dma_dir(host, host-data)); omap_free_dma(dma_ch); } - host-data = NULL; No need to remove the above one. } /* @@ -1370,7 +1367,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) { struct omap_hsmmc_host *host = cb_data; struct mmc_data *data; - int dma_ch, req_in_progress; + int req_in_progress; if (!(ch_status OMAP_DMA_BLOCK_IRQ)) { dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n, @@ -1394,16 +1391,9 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) return; } - if (!data-host_cookie) - dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len, - omap_hsmmc_get_dma_dir(host, data)); - req_in_progress = host-req_in_progress; - dma_ch = host-dma_ch; - host-dma_ch = -1; spin_unlock(host-irq_lock); - - omap_free_dma(dma_ch); + omap_hsmmc_dma_cleanup(host, 0); /* If DMA has finished after TC, complete the request */ if (!req_in_progress) { @@ -1575,7 +1565,7 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, struct omap_hsmmc_host *host = mmc_priv(mmc); struct mmc_data *data = mrq-data; - if (host-use_dma) { Here also , the above conditional check is required. + if (data-host_cookie) { dma_unmap_sg(mmc_dev(host-mmc), data-sg, data-sg_len, omap_hsmmc_get_dma_dir(host, data)); data-host_cookie = 0; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] OMAP4: MMC: fix power and audio issue, decouple USBC1 from MMC1
On Fri, Jul 22, 2011 at 12:59 AM, Bryan Buckley bryan.buck...@ti.com wrote: Remove OMAP4_USBC1_ICUSB_PWRDNZ_MASK during enable/disable PWRDNZ mode for MMC1_PBIAS and associated extended-drain MMC1 I/O cell. This is in accordance with the control module programming guide. This fixes a bug where if trying to use gpio_98 or gpio_99 and MMC1 at the same time the GPIO signal will be affected by a changing SDMMC1_VDDS. Software must keep MMC1_PBIAS cell and MMC1_IO cell PWRDNZ signals low whenever SDMMC1_VDDS ramps up/down or changes for cell protection purposes. MMC1 is based on SDMMC1_VDDS whereas USBC1 is based on SIM_VDDS therefore they can operate independently. Signed-off-by: Bryan Buckley bryan.buck...@ti.com Good catch, Acked-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/hsmmc.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 3842405..a6135df 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -144,8 +144,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot, */ reg = omap4_ctrl_pad_readl(control_pbias_offset); reg = ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | - OMAP4_MMC1_PWRDNZ_MASK | - OMAP4_USBC1_ICUSB_PWRDNZ_MASK); + OMAP4_MMC1_PWRDNZ_MASK); omap4_ctrl_pad_writel(reg, control_pbias_offset); } @@ -165,8 +164,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot, else reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK; reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | - OMAP4_MMC1_PWRDNZ_MASK | - OMAP4_USBC1_ICUSB_PWRDNZ_MASK); + OMAP4_MMC1_PWRDNZ_MASK); omap4_ctrl_pad_writel(reg, control_pbias_offset); /* 4 microsec delay for comparator to generate an error*/ udelay(4); @@ -174,16 +172,14 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot, if (reg OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) { pr_err(Pbias Voltage is not same as LDO\n); /* Caution : On VMODE_ERROR Power Down MMC IO */ - reg = ~(OMAP4_MMC1_PWRDNZ_MASK | - OMAP4_USBC1_ICUSB_PWRDNZ_MASK); + reg = ~(OMAP4_MMC1_PWRDNZ_MASK); omap4_ctrl_pad_writel(reg, control_pbias_offset); } } else { reg = omap4_ctrl_pad_readl(control_pbias_offset); reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | OMAP4_MMC1_PWRDNZ_MASK | - OMAP4_MMC1_PBIASLITE_VMODE_MASK | - OMAP4_USBC1_ICUSB_PWRDNZ_MASK); + OMAP4_MMC1_PBIASLITE_VMODE_MASK); omap4_ctrl_pad_writel(reg, control_pbias_offset); } } -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: enable background operations for emmc4.41 with HPI support
snip How does BKOPS work with card power management ? On some controllers, regulators are switched off in between transactions after some delay. Wouldn't the card need power to do it's BKOPS ? AFAIK eMMC card has two voltages one for core rail and other for IO rail. Power Management is done with IO rail but the core rail voltages should be present through out and I think BKOPS uses core rail voltages. Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 11/11] mmc: add handling for two parallel block requests in issue_rw_rq
Hi Per, snip --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -108,6 +108,7 @@ static DEFINE_MUTEX(open_lock); enum mmc_blk_status { MMC_BLK_SUCCESS = 0, + MMC_BLK_PARTIAL, MMC_BLK_RETRY, MMC_BLK_DATA_ERR, MMC_BLK_CMD_ERR, snip -static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) +static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq-data; struct mmc_card *card = md-queue.card; - struct mmc_blk_request *brq = mq-mqrq_cur-brq; - int ret = 1, disable_multi = 0; + struct mmc_blk_request *brq; + int ret = 1; + int disable_multi = 0; enum mmc_blk_status status; Can initialize here enum mmc_blk_status = MMC_BLK_SUCCESS + struct mmc_queue_req *mq_rq; + struct request *req; + struct mmc_async_req *areq; + + if (!rqc !mq-mqrq_prev-req) + goto out; snip I meant doing initialization in block.c itself and not core.c as above. The intention is to make this function available for SDIO as well. Totally agree, having the API access to SDIO int err = 0; is set at the top of mmc_start_req(). Default err condition is 0. What do you think about the following changes? * @areq: async request to start - * @error: non zero in case of error + * @error: out parameter returns 0 for success, otherwise non zero * * Start a new MMC custom command request for a host. * If there is on ongoing async request wait for completion @@ -334,9 +334,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, mmc_post_req(host, areq-mrq, -EINVAL); host-areq = NULL; - if (error) - *error = err; - return data; + goto out; } } @@ -347,6 +345,7 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host, mmc_post_req(host, host-areq-mrq, 0); host-areq = areq; + out: if (error) *error = err; return data; The above change reduced the code size but still since 'error' is pointer to the 'status' which is uninitialized, so if(error) will be always true. If you want to update *error in success/failure case [based on 'err' ]then can remove the if(error) check else to update the error case only can look at the way proposed in my previous mail. Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 02/11] omap_hsmmc: add support for pre_req and post_req
Hi Per, On Tue, Jun 21, 2011 at 12:21 PM, Per Forlin per.for...@linaro.org wrote: On 21 June 2011 07:41, Kishore Kadiyala kishorek.kadiy...@gmail.com wrote: snip + +static void omap_hsmmc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq, + bool is_first_req) I don't see the usage of is_first_req below. Is it required? It is not required. It is only an indication that this request is the first in a series of request. The host driver may do various optimisations based on this information. The first request in a series of jobs can't be prepared in parallel to the previous job. The host driver can do the following to minimise latency for the first job. * Preparing the cache while the MMC read/write cmd is being processed. In this case the pre_req could do nothing and the job is instead run in parallel to the read/write cmd being sent. If the is_first_req is false pre_req will run in parallel to an active transfer, in this case it is more efficient to prepare the request in pre_req. * Run PIO mode instead of DMA * Maybe there can be power related optimisations based on if it is one single transfer or multiple ones. Ok, thanks for making things clear. snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 11/11] mmc: add handling for two parallel block requests in issue_rw_rq
On Mon, Jun 20, 2011 at 2:47 AM, Per Forlin per.for...@linaro.org wrote: Change mmc_blk_issue_rw_rq() to become asynchronous. The execution flow looks like this: The mmc-queue calls issue_rw_rq(), which sends the request to the host and returns back to the mmc-queue. The mmc-queue calls issue_rw_rq() again with a new request. This new request is prepared, in isuue_rw_rq(), then it waits for the active request to complete before pushing it to the host. When to mmc-queue is empty it will call isuue_rw_rq() with req=NULL to finish off the active request without starting a new request. Signed-off-by: Per Forlin per.for...@linaro.org --- drivers/mmc/card/block.c | 121 +- drivers/mmc/card/queue.c | 17 +-- drivers/mmc/card/queue.h | 1 + 3 files changed, 101 insertions(+), 38 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 6a84a75..66db77a 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -108,6 +108,7 @@ static DEFINE_MUTEX(open_lock); enum mmc_blk_status { MMC_BLK_SUCCESS = 0, + MMC_BLK_PARTIAL, MMC_BLK_RETRY, MMC_BLK_DATA_ERR, MMC_BLK_CMD_ERR, @@ -668,14 +669,16 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, } } -static enum mmc_blk_status mmc_blk_err_check(struct mmc_blk_request *brq, - struct request *req, - struct mmc_card *card, - struct mmc_blk_data *md) +static int mmc_blk_err_check(struct mmc_card *card, + struct mmc_async_req *areq) { struct mmc_command cmd; u32 status = 0; enum mmc_blk_status ret = MMC_BLK_SUCCESS; + struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req, + mmc_active); + struct mmc_blk_request *brq = mq_mrq-brq; + struct request *req = mq_mrq-req; /* * Check for errors here, but don't jump to cmd_err @@ -770,7 +773,11 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_blk_request *brq, else ret = MMC_BLK_DATA_ERR; } -out: + + if (ret == MMC_BLK_SUCCESS + blk_rq_bytes(req) != brq-data.bytes_xfered) + ret = MMC_BLK_PARTIAL; + out: return ret; } @@ -901,27 +908,59 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq-data.sg_len = i; } + mqrq-mmc_active.mrq = brq-mrq; + mqrq-mmc_active.err_check = mmc_blk_err_check; + mmc_queue_bounce_pre(mqrq); } -static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) +static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq-data; struct mmc_card *card = md-queue.card; - struct mmc_blk_request *brq = mq-mqrq_cur-brq; - int ret = 1, disable_multi = 0; + struct mmc_blk_request *brq; + int ret = 1; + int disable_multi = 0; enum mmc_blk_status status; + struct mmc_queue_req *mq_rq; + struct request *req; + struct mmc_async_req *areq; + + if (!rqc !mq-mqrq_prev-req) + goto out; do { - mmc_blk_rw_rq_prep(mq-mqrq_cur, card, disable_multi, mq); - mmc_wait_for_req(card-host, brq-mrq); + if (rqc) { + mmc_blk_rw_rq_prep(mq-mqrq_cur, card, 0, mq); + areq = mq-mqrq_cur-mmc_active; + } else + areq = NULL; + areq = mmc_start_req(card-host, areq, (int *) status); I think 'status' is used uninitialized. With this struct mmc_async_req *mmc_start_req in your first patch if (error) *error = err; return data; condition which always passes. You can have enum mmc_blk_status status = MMC_BLK_SUCCESS; struct mmc_async_req *mmc_start_req { err = host-areq-err_check(host-card, host-areq); if (err) { ... ... *error = err; } no need to update * error here in success case return data } Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 02/11] omap_hsmmc: add support for pre_req and post_req
snip + +static void omap_hsmmc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq, + bool is_first_req) I don't see the usage of is_first_req below. Is it required? +{ + struct omap_hsmmc_host *host = mmc_priv(mmc); + + if (mrq-data-host_cookie) { + mrq-data-host_cookie = 0; + return ; + } + + if (host-use_dma) + if (omap_hsmmc_pre_dma_transfer(host, mrq-data, + host-next_data)) + mrq-data-host_cookie = 0; +} + /* Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Dynamic MMC device naming vs. bootloaders
On Wed, Apr 6, 2011 at 2:58 AM, Stephen Warren swar...@nvidia.com wrote: Kishore Kadiyala wrote at Tuesday, April 05, 2011 12:38 AM: Hi Stephen, On Mon, Apr 4, 2011 at 11:09 PM, Stephen Warren swar...@nvidia.com wrote: Chris et. al., I'm working on an ARM system that contains at least two MMC/SD devices; specifically the board has an internal MMC device, and an SD card slot, although the SoC has four MMC/SD hosts IIRC. The kernel's naming of these devices is dynamic. If the SD card is not plugged in, the internal MMC is always known as mmcblock0. If the SD card is plugged in too, sometimes the internal MMC is mmcblk0 and sometimes it's mmcblk1. I assume this is timing related; 2.6.37 usually seemed to name them in order, whereas 2.6.38 usually seems to name them backwards. This causes problems with the bootloader scripts I'm using, which assumes that the internal MMC is always device 0 and the SD slot is always device 1, and hence provides kernel command-line argument root=/dev/mmcblk0p3 or root=/dev/mmcblk1p3 based on whether it booted from SD or internal MMC (SD is searched for a valid image first by the bootloader). Just follow this thread which discusses the same but for OMAP4 controller http://www.mail-archive.com/linux-omap@vger.kernel.org/msg47853.html Kishore, thanks for the pointer. However, I don't see anything in that thread that affects MMC block device IDs. The thread ended with the original poster requesting the patch be dropped, since he'd made a mistake in his bootloader settings. Just perhaps the registration order change is enough to change the timing of device (memory device, not host controller?) probing, which just happens to affect the ID assignment? One solution could be make your internal MMC always registered as mmcblk0 and the removable one as next device. That's essentially what the patch I gave previously does. Your change was in mmc/card/block.c, but you can handle this by changing sequence during device registeration. Following change in the patch does that https://patchwork.kernel.org/patch/595861/ diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 1a943be..f914099 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -349,11 +349,6 @@ static struct twl4030_usb_data omap4_usbphy_data = { static struct omap2_hsmmc_info mmc[] = { { - .mmc= 1, - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, - .gpio_wp= -EINVAL, - }, - { .mmc= 2, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_cd= -EINVAL, @@ -361,19 +356,24 @@ static struct omap2_hsmmc_info mmc[] = { .nonremovable = true, .ocr_mask = MMC_VDD_29_30, }, + { + .mmc= 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, + .gpio_wp= -EINVAL, + }, {} /* Terminator */ }; Regards, Kishore -- nvpublic -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Dynamic MMC device naming vs. bootloaders
Hi Stephen, On Mon, Apr 4, 2011 at 11:09 PM, Stephen Warren swar...@nvidia.com wrote: Chris et. al., I'm working on an ARM system that contains at least two MMC/SD devices; specifically the board has an internal MMC device, and an SD card slot, although the SoC has four MMC/SD hosts IIRC. The kernel's naming of these devices is dynamic. If the SD card is not plugged in, the internal MMC is always known as mmcblock0. If the SD card is plugged in too, sometimes the internal MMC is mmcblk0 and sometimes it's mmcblk1. I assume this is timing related; 2.6.37 usually seemed to name them in order, whereas 2.6.38 usually seems to name them backwards. This causes problems with the bootloader scripts I'm using, which assumes that the internal MMC is always device 0 and the SD slot is always device 1, and hence provides kernel command-line argument root=/dev/mmcblk0p3 or root=/dev/mmcblk1p3 based on whether it booted from SD or internal MMC (SD is searched for a valid image first by the bootloader). Just follow this thread which discusses the same but for OMAP4 controller http://www.mail-archive.com/linux-omap@vger.kernel.org/msg47853.html One solution could be make your internal MMC always registered as mmcblk0 and the removable one as next device. Regards, Kishore This could be solved by naming the kernel MMC devices statically based on the host controller, rather than dynamically based on the first available ID when the actual storage is detected. The patch below implements this. Is this patch conceptually acceptable for the MMC driver? Obviously, a complete patch would need to also remove the dev_use structure etc. Another solution might be for the kernel command-line to specify the filesystem UUID, rather than a device node. However, this entails much more work for the bootloader. I'm not sure whether U-Boot can do this right now? And actually, the filesystem images I'm using don't always have a UUID by dDefault IIRC. diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index bfc8a8a..5131b02 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -581,7 +581,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) struct mmc_blk_data *md; int devidx, ret; - devidx = find_first_zero_bit(dev_use, max_devices); + devidx = card-host-index; if (devidx = max_devices) return ERR_PTR(-ENOSPC); __set_bit(devidx, dev_use); Thanks for any feedback. -- nvpublic -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 149/177] drivers/mmc/host/omap_hsmmc.c: use resource_size()
On Wed, Mar 23, 2011 at 5:04 AM, a...@linux-foundation.org wrote: From: Chris Ball c...@laptop.org Use resource_size(). Signed-off-by: Chris Ball c...@laptop.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: linux-mmc@vger.kernel.org Signed-off-by: Andrew Morton a...@linux-foundation.org Feel free to add Acked-by: Kishore Kadiyala kishore.kadiy...@ti.com --- drivers/mmc/host/omap_hsmmc.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff -puN drivers/mmc/host/omap_hsmmc.c~drivers-mmc-host-omap_hsmmcc-use-resource_size drivers/mmc/host/omap_hsmmc.c --- a/drivers/mmc/host/omap_hsmmc.c~drivers-mmc-host-omap_hsmmcc-use-resource_size +++ a/drivers/mmc/host/omap_hsmmc.c @@ -2047,8 +2047,7 @@ static int __init omap_hsmmc_probe(struc res-start += pdata-reg_offset; res-end += pdata-reg_offset; - res = request_mem_region(res-start, res-end - res-start + 1, - pdev-name); + res = request_mem_region(res-start, resource_size(res), pdev-name); if (res == NULL) return -EBUSY; @@ -2287,7 +2286,7 @@ err1: err_alloc: omap_hsmmc_gpio_free(pdata); err: - release_mem_region(res-start, res-end - res-start + 1); + release_mem_region(res-start, resource_size(res)); return ret; } @@ -2324,7 +2323,7 @@ static int omap_hsmmc_remove(struct plat res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res) - release_mem_region(res-start, res-end - res-start + 1); + release_mem_region(res-start, resource_size(res)); platform_set_drvdata(pdev, NULL); return 0; _ -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch 148/177] drivers/mmc/host/omap.c: use resource_size()
On Wed, Mar 23, 2011 at 5:04 AM, a...@linux-foundation.org wrote: From: Chris Ball c...@laptop.org Signed-off-by: Chris Ball c...@laptop.org Cc: Jarkko Lavinen jarkko.lavi...@nokia.com Cc: Tony Lindgren t...@atomide.com Cc: linux-mmc@vger.kernel.org Signed-off-by: Andrew Morton a...@linux-foundation.org Acked-by: Kishore Kadiyala kishore.kadiy...@ti.com --- drivers/mmc/host/omap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff -puN drivers/mmc/host/omap.c~drivers-mmc-host-omapc-use-resource_size drivers/mmc/host/omap.c --- a/drivers/mmc/host/omap.c~drivers-mmc-host-omapc-use-resource_size +++ a/drivers/mmc/host/omap.c @@ -1417,7 +1417,7 @@ static int __init mmc_omap_probe(struct if (res == NULL || irq 0) return -ENXIO; - res = request_mem_region(res-start, res-end - res-start + 1, + res = request_mem_region(res-start, resource_size(res), pdev-name); if (res == NULL) return -EBUSY; @@ -1457,7 +1457,7 @@ static int __init mmc_omap_probe(struct host-irq = irq; host-phys_base = host-mem_res-start; - host-virt_base = ioremap(res-start, res-end - res-start + 1); + host-virt_base = ioremap(res-start, resource_size(res)); if (!host-virt_base) goto err_ioremap; @@ -1514,7 +1514,7 @@ err_free_mmc_host: err_ioremap: kfree(host); err_free_mem_region: - release_mem_region(res-start, res-end - res-start + 1); + release_mem_region(res-start, resource_size(res)); return ret; } _ -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 8/8] OMAP: hsmmc: Rename the device and driver
Modifying the device driver name from mmci-omap-hs to omap_hsmmc. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +++--- arch/arm/mach-omap2/board-4430sdp.c | 14 +++--- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +++--- arch/arm/mach-omap2/board-igep0030.c |6 +++--- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +++--- arch/arm/mach-omap2/board-omap4panda.c |4 ++-- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 ++-- arch/arm/mach-omap2/clock3xxx_data.c | 12 ++-- arch/arm/mach-omap2/clock44xx_data.c | 20 ++-- arch/arm/mach-omap2/hsmmc.c |2 +- drivers/mmc/host/omap_hsmmc.c|2 +- 17 files changed, 54 insertions(+), 54 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index cc42d47..ab0880b 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void) } static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 8950ecc..40b0174 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -410,15 +410,15 @@ static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = { }; static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vsim_supplies[] = { - REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.1), }; /* diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 1a943be..f914099 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -349,11 +349,6 @@ static struct twl4030_usb_data omap4_usbphy_data = { static struct omap2_hsmmc_info mmc[] = { { - .mmc= 1, - .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, - .gpio_wp= -EINVAL, - }, - { .mmc= 2, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_cd= -EINVAL, @@ -361,19 +356,24 @@ static struct omap2_hsmmc_info mmc[] = { .nonremovable = true, .ocr_mask = MMC_VDD_29_30, }, + { + .mmc= 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, + .gpio_wp= -EINVAL, + }, {} /* Terminator */ }; static struct regulator_consumer_supply sdp4430_vaux_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.1, + .dev_name = omap_hsmmc.1, }, }; static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.0, + .dev_name = omap_hsmmc.0, }, }; diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 54abdd0..c9170f4 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c @@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) } static struct regulator_consumer_supply devkit8000_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* ads7846 on SPI */ diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 54e6318..1877c28 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { } #endif static struct regulator_consumer_supply igep2_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* VMMC1 for OMAP
[PATCH v6 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver
Add a device attribute to hwmod data of omap2430, omap3, omap4. Currently the device attribute holds information regarding dual volt MMC card support by the controller which will be later passed to the host driver via platform data. Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 arch/arm/plat-omap/include/plat/mmc.h |9 + 4 files changed, 29 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index cba1800..d144540 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -19,6 +19,7 @@ #include plat/i2c.h #include plat/gpio.h #include plat/mcspi.h +#include plat/mmc.h #include plat/l3_2xxx.h #include omap_hwmod_common_data.h @@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { omap2430_l4_core__mmc1, }; +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap2430_mmc1_hwmod = { .name = mmc1, .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, @@ -1604,6 +1609,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap2430_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), .class = omap2430_mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 7726932..07065c3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -22,6 +22,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include plat/mcspi.h @@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { omap3xxx_l4_core__mmc1, }; +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap3xxx_mmc1_hwmod = { .name = mmc1, .mpu_irqs = omap34xx_mmc1_mpu_irqs, @@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = { .idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap3xxx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves), .class = omap34xx_mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index dd39e75..0f7d02b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -25,6 +25,7 @@ #include plat/gpio.h #include plat/dma.h #include plat/mcspi.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { }; /* mmc1 */ + static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { { .irq = 83 + OMAP44XX_IRQ_GIC_START }, }; @@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = { omap44xx_l4_per__mmc1, }; +/* mmc1 dev_attr */ +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap44xx_mmc1_hwmod = { .name = mmc1, .class = omap44xx_mmc_hwmod_class, @@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = { .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap44xx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves), .masters= omap44xx_mmc1_masters, diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index e5de5d4..a7afab0 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -43,6 +43,12 @@ #define OMAP_MMC_MAX_SLOTS 2 +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1) + +struct omap_mmc_dev_attr { + u8 flags; +}; + struct omap_mmc_platform_data { /* back-link to device */ struct device *dev; @@ -71,6 +77,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Integrating attributes from the omap_hwmod layer */ + u8 controller_flags; + /* Register offset deviation */ u16 reg_offset; -- 1.7.1 -- To unsubscribe from
[PATCH v6 1/8] omap: mmc: split out init for 2420
From: Anand Gadiyar gadi...@ti.com The MMC controller on the OMAP2420 is different from those on the OMAP2430, OMAP3 and OMAP4 families - all of the latter are identical. The one on the OMAP2420 is closer to that on OMAP1 chips. Currently, the n8x0 is the only OMAP2420 platform supported in mainline which registers the MMC controller. Upcoming changes to register the controllers using hwmod data are potentially invasive. To reduce the risk, separate out the 2420 controller registration from the common init function and update its only user. Also seperating out mux settings for OMAP2420. Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Chris Ball c...@laptop.org --- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/devices.c | 88 + arch/arm/plat-omap/include/plat/mmc.h |4 ++ 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index b36cbd2..e710cd9 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void) } mmc_data[0] = mmc1_data; - omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); + omap242x_init_mmc(mmc_data); } #else diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 9ee876f..100bb42 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -650,11 +650,10 @@ err1: static inline void omap_hsmmc_reset(void) {} #endif -#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ - defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) +static inline void omap242x_mmc_mux(struct omap_mmc_platform_data + *mmc_controller) { if ((mmc_controller-slots[0].switch_pin 0) \ (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) @@ -665,33 +664,61 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap2420() controller_nr == 0) { - omap_mux_init_signal(sdmmc_cmd, 0); - omap_mux_init_signal(sdmmc_clki, 0); - omap_mux_init_signal(sdmmc_clko, 0); - omap_mux_init_signal(sdmmc_dat0, 0); - omap_mux_init_signal(sdmmc_dat_dir0, 0); - omap_mux_init_signal(sdmmc_cmd_dir, 0); - if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { - omap_mux_init_signal(sdmmc_dat1, 0); - omap_mux_init_signal(sdmmc_dat2, 0); - omap_mux_init_signal(sdmmc_dat3, 0); - omap_mux_init_signal(sdmmc_dat_dir1, 0); - omap_mux_init_signal(sdmmc_dat_dir2, 0); - omap_mux_init_signal(sdmmc_dat_dir3, 0); - } + omap_mux_init_signal(sdmmc_cmd, 0); + omap_mux_init_signal(sdmmc_clki, 0); + omap_mux_init_signal(sdmmc_clko, 0); + omap_mux_init_signal(sdmmc_dat0, 0); + omap_mux_init_signal(sdmmc_dat_dir0, 0); + omap_mux_init_signal(sdmmc_cmd_dir, 0); + if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { + omap_mux_init_signal(sdmmc_dat1, 0); + omap_mux_init_signal(sdmmc_dat2, 0); + omap_mux_init_signal(sdmmc_dat3, 0); + omap_mux_init_signal(sdmmc_dat_dir1, 0); + omap_mux_init_signal(sdmmc_dat_dir2, 0); + omap_mux_init_signal(sdmmc_dat_dir3, 0); + } - /* -* Use internal loop-back in MMC/SDIO Module Input Clock -* selection -*/ - if (mmc_controller-slots[0].internal_clock) { - u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); - v |= (1 24); - omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); - } + /* +* Use internal loop-back in MMC/SDIO Module Input Clock +* selection +*/ + if (mmc_controller-slots[0].internal_clock) { + u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); + v |= (1 24); + omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); + } +} + +void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) +{ + char *name = mmci-omap; + + if (!mmc_data[0]) { + pr_err(%s fails: Incomplete platform data
[PATCH v6 3/8] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 209 arch/arm/mach-omap2/prcm-common.h |4 + 2 files changed, 213 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index e9d0012..7726932 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1; static struct omap_hwmod omap34xx_mcspi2; static struct omap_hwmod omap34xx_mcspi3; static struct omap_hwmod omap34xx_mcspi4; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; static struct omap_hwmod am35xx_usbhsotg_hwmod; static struct omap_hwmod omap3xxx_dma_system_hwmod; @@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = { { @@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1) }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap34xx_mmc_class = { + .name = mmc, + .sysc = omap34xx_mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info omap34xx_mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info omap34xx_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { + omap3xxx_l4_core__mmc1, +}; + +static struct omap_hwmod omap3xxx_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = omap34xx_mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap34xx_mmc1_mpu_irqs), + .sdma_reqs = omap34xx_mmc1_sdma_reqs
[PATCH v6 0/8] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework. Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. The series takes care of spliting out the mmc device init for omap2420 and thus doing hwmod adaptation for hsmmc drivers. Also includes moving of mux setting API for hsmmc devices from devices.c to hsmmc.c and renaming of device driver name. The patch series is based on omap-for-linus and tested on OMAP2430, OMAP3430SDP, OMAP4430SDP OMAP4Panda.Also boot tested on OMAP2420SDP. For testing hsmmc with hwmod adaptaion on OMAP2430SDP,has dependency on: http://www.spinics.net/lists/linux-omap/msg47088.html V6: --- In the previous versions, implementation for adaptation of hsmmc to hwmod framework was based on omap_hwmod_for_each_by_class and using this will not support flexible resgistration of hsmmc devices. The current implemetation uses omap_hwmod_lookup and supports flexible registration of hsmmc devices based on the entry in board file. V5: --- http://www.spinics.net/lists/linux-omap/msg47046.html V4: --- http://www.spinics.net/lists/linux-mmc/msg06237.html V3: -- http://www.spinics.net/lists/linux-omap/msg46783.html V2: --- http://www.spinics.net/lists/linux-omap/msg45443.html V1: --- http://www.spinics.net/lists/linux-mmc/msg05689.html Anand Gadiyar (2): omap: mmc: split out init for 2420 OMAP4: hwmod data: enable HSMMC Kishore Kadiyala (4): OMAP: hwmod data: Add dev_attr and use in the host driver OMAP: hsmmc: Move mux configuration to hsmmc.c OMAP: adapt hsmmc to hwmod framework OMAP: hsmmc: Rename the device and driver Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +- arch/arm/mach-omap2/board-4430sdp.c | 14 +- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +- arch/arm/mach-omap2/board-igep0030.c |6 +- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +- arch/arm/mach-omap2/board-omap4panda.c |4 +- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 +- arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 +- arch/arm/mach-omap2/clock3xxx_data.c | 12 +- arch/arm/mach-omap2/clock44xx_data.c | 20 +- arch/arm/mach-omap2/devices.c| 293 ++ arch/arm/mach-omap2/hsmmc.c | 424 +- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 154 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 215 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 18 +- arch/arm/mach-omap2/prcm-common.h|4 + arch/arm/plat-omap/include/plat/mmc.h| 29 +- drivers/mmc/host/omap_hsmmc.c|6 +- 24 files changed, 765 insertions(+), 484 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 7/8] OMAP: adapt hsmmc to hwmod framework
OMAP2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. Removing all base address macro defines except keeping one for OMAP2420 and adapting only hsmmc device registration and driver to hwmod framework. Changes involves: 1) Remove controller reset in devices.c which is taken care of by hwmod framework. 2) Using omap-device layer to register device and utilizing data from hwmod data file for base address, dma channel number, Irq_number, device attribute. 3) Update the driver to use dev_attr to find whether controller supports dual volt cards Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Reviewed-by: Balaji T K balaj...@ti.com Cc: Benoit Cousson b-cous...@ti.com CC: Kevin Hilman khil...@deeprootsystems.com Cc: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/devices.c | 168 arch/arm/mach-omap2/hsmmc.c | 346 +++-- arch/arm/plat-omap/include/plat/mmc.h | 20 +-- drivers/mmc/host/omap_hsmmc.c |4 +- 4 files changed, 200 insertions(+), 338 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2f4a598..31632ac 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { } /*-*/ -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - -#define MMCHS_SYSCONFIG0x0010 -#define MMCHS_SYSCONFIG_SWRESET(1 1) -#define MMCHS_SYSSTATUS0x0014 -#define MMCHS_SYSSTATUS_RESETDONE (1 0) - -static struct platform_device dummy_pdev = { - .dev = { - .bus = platform_bus_type, - }, -}; - -/** - * omap_hsmmc_reset() - Full reset of each HS-MMC controller - * - * Ensure that each MMC controller is fully reset. Controllers - * left in an unknown state (by bootloader) may prevent retention - * or OFF-mode. This is especially important in cases where the - * MMC driver is not enabled, _or_ built as a module. - * - * In order for reset to work, interface, functional and debounce - * clocks must be enabled. The debounce clock comes from func_32k_clk - * and is not under SW control, so we only enable i- and f-clocks. - **/ -static void __init omap_hsmmc_reset(void) -{ - u32 i, nr_controllers; - struct clk *iclk, *fclk; - - if (cpu_is_omap242x()) - return; - - nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC : - (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC); - - for (i = 0; i nr_controllers; i++) { - u32 v, base = 0; - struct device *dev = dummy_pdev.dev; - - switch (i) { - case 0: - base = OMAP2_MMC1_BASE; - break; - case 1: - base = OMAP2_MMC2_BASE; - break; - case 2: - base = OMAP3_MMC3_BASE; - break; - case 3: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC4_BASE; - break; - case 4: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC5_BASE; - break; - } - - if (cpu_is_omap44xx()) - base += OMAP4_MMC_REG_OFFSET; - - dummy_pdev.id = i; - dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i); - iclk = clk_get(dev, ick); - if (IS_ERR(iclk)) - goto err1; - if (clk_enable(iclk)) - goto err2; - - fclk = clk_get(dev, fck); - if (IS_ERR(fclk)) - goto err3; - if (clk_enable(fclk)) - goto err4; - - omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG); - v = omap_readl(base + MMCHS_SYSSTATUS); - while (!(omap_readl(base + MMCHS_SYSSTATUS) -MMCHS_SYSSTATUS_RESETDONE)) - cpu_relax(); - - clk_disable(fclk); - clk_put(fclk); - clk_disable(iclk); - clk_put(iclk); - } - return; - -err4: - clk_put(fclk); -err3: - clk_disable(iclk); -err2: - clk_put(iclk); -err1: - printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, - cannot reset.\n, __func__, i); -} -#else -static inline void omap_hsmmc_reset(void) {} -#endif - #if defined(CONFIG_MMC_OMAP) || defined
[PATCH v6 6/8] OMAP: hsmmc: Move mux configuration to hsmmc.c
Moving the definition of mux setting API from devices.c to hsmmc.c and renaming it from omap2_mmc_mux to omap_hsmmc_mux. Also calling omap_hsmmc_mux from omap2_hsmmc_init. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Chris Ball c...@laptop.org Cc: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/devices.c | 83 arch/arm/mach-omap2/hsmmc.c | 84 + 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 100bb42..2f4a598 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) -{ - if ((mmc_controller-slots[0].switch_pin 0) \ - (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) - omap_mux_init_gpio(mmc_controller-slots[0].switch_pin, - OMAP_PIN_INPUT_PULLUP); - if ((mmc_controller-slots[0].gpio_wp 0) \ - (mmc_controller-slots[0].gpio_wp OMAP_MAX_GPIO_LINES)) - omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, - OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap34xx()) { - if (controller_nr == 0) { - omap_mux_init_signal(sdmmc1_clk, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_cmd, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat0, - OMAP_PIN_INPUT_PULLUP); - if (mmc_controller-slots[0].caps - (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { - omap_mux_init_signal(sdmmc1_dat1, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat2, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat3, - OMAP_PIN_INPUT_PULLUP); - } - if (mmc_controller-slots[0].caps - MMC_CAP_8_BIT_DATA) { - omap_mux_init_signal(sdmmc1_dat4, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat5, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat6, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat7, - OMAP_PIN_INPUT_PULLUP); - } - } - if (controller_nr == 1) { - /* MMC2 */ - omap_mux_init_signal(sdmmc2_clk, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_cmd, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat0, - OMAP_PIN_INPUT_PULLUP); - - /* -* For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed -* in the board-*.c files -*/ - if (mmc_controller-slots[0].caps - (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { - omap_mux_init_signal(sdmmc2_dat1, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat2, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat3, - OMAP_PIN_INPUT_PULLUP); - } - if (mmc_controller-slots[0].caps - MMC_CAP_8_BIT_DATA) { - omap_mux_init_signal(sdmmc2_dat4.sdmmc2_dat4, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat5.sdmmc2_dat5, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat6.sdmmc2_dat6, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat7.sdmmc2_dat7
[PATCH v6 4/8] OMAP4: hwmod data: enable HSMMC
From: Anand Gadiyar gadi...@ti.com Enabling hsmmc hwmod for OMAP4 Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 79a8601..dd39e75 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { omap44xx_mcspi4_hwmod, /* mmc class */ -/* omap44xx_mmc1_hwmod, */ -/* omap44xx_mmc2_hwmod, */ -/* omap44xx_mmc3_hwmod, */ -/* omap44xx_mmc4_hwmod, */ -/* omap44xx_mmc5_hwmod, */ + omap44xx_mmc1_hwmod, + omap44xx_mmc2_hwmod, + omap44xx_mmc3_hwmod, + omap44xx_mmc4_hwmod, + omap44xx_mmc5_hwmod, /* mpu class */ omap44xx_mpu_hwmod, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RESEND v5 PATCH 5/8] OMAP: hwmod data: Add dev_attr and use in the host driver
Add a device attribute to hwmod data of omap2430, omap3, omap4. Currently the device attribute holds information regarding dual volt MMC card support by the controller which will be later passed to the host driver via platform data. Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |8 arch/arm/plat-omap/include/plat/mmc.h |9 + 4 files changed, 29 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index cba1800..d144540 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -19,6 +19,7 @@ #include plat/i2c.h #include plat/gpio.h #include plat/mcspi.h +#include plat/mmc.h #include plat/l3_2xxx.h #include omap_hwmod_common_data.h @@ -1585,6 +1586,10 @@ static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { omap2430_l4_core__mmc1, }; +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap2430_mmc1_hwmod = { .name = mmc1, .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, @@ -1604,6 +1609,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap2430_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), .class = omap2430_mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 7726932..07065c3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -22,6 +22,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include plat/mcspi.h @@ -2309,6 +2310,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { omap3xxx_l4_core__mmc1, }; +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap3xxx_mmc1_hwmod = { .name = mmc1, .mpu_irqs = omap34xx_mmc1_mpu_irqs, @@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = { .idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap3xxx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves), .class = omap34xx_mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index dd39e75..0f7d02b 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -25,6 +25,7 @@ #include plat/gpio.h #include plat/dma.h #include plat/mcspi.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -3383,6 +3384,7 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { }; /* mmc1 */ + static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { { .irq = 83 + OMAP44XX_IRQ_GIC_START }, }; @@ -3420,6 +3422,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = { omap44xx_l4_per__mmc1, }; +/* mmc1 dev_attr */ +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod omap44xx_mmc1_hwmod = { .name = mmc1, .class = omap44xx_mmc_hwmod_class, @@ -3433,6 +3440,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = { .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap44xx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves), .masters= omap44xx_mmc1_masters, diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index e5de5d4..a7afab0 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -43,6 +43,12 @@ #define OMAP_MMC_MAX_SLOTS 2 +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1) + +struct omap_mmc_dev_attr { + u8 flags; +}; + struct omap_mmc_platform_data { /* back-link to device */ struct device *dev; @@ -71,6 +77,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Integrating attributes from the omap_hwmod layer */ + u8 controller_flags; + /* Register offset deviation */ u16 reg_offset; -- 1.7.1 -- To unsubscribe from
[RESEND v5 PATCH 2/8] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. For testing OMAP2430SDP with hsmmc hwmod adaptation has dependency on 1) Pauls clock domain fix patch for hsmmc2 http://www.spinics.net/lists/linux-omap/msg47088.html 2) Balaji's regulator patch https://patchwork.kernel.org/patch/538301/ Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 148 1 files changed, 148 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index de0015d..cba1800 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod; static struct omap_hwmod omap2430_mcspi1_hwmod; static struct omap_hwmod omap2430_mcspi2_hwmod; static struct omap_hwmod omap2430_mcspi3_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = { omap2430_l4_core__usbhsotg, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs2_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -1508,6 +1548,112 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = { +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_mmc_class = { + .name = mmc, + .sysc = omap2430_mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb1_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1, + .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, + .mpu_irqs = omap2430_mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap2430_mmc1_mpu_irqs), + .sdma_reqs = omap2430_mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap2430_mmc1_sdma_reqs), + .opt_clks = omap2430_mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc1_opt_clks), + .main_clk = mmchs1_fck
[PATCH v5 0/8] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework. Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. The series takes care spliting out the mmc device init for omap2420 and takes care of hwmod adaptation for hsmmc drivers. This was already posted at : http://www.mail-archive.com/linux-omap@vger.kernel.org/msg45190.html Also includes renaming of device driver name. The patch series is based on omap-for-linus and tested on OMAP2430, OMAP3430SDP OMAP4430SDP. Also boot tested on OMAP2420SDP. V4: --- http://www.spinics.net/lists/linux-mmc/msg06237.html V3: -- http://www.spinics.net/lists/linux-omap/msg46783.html V2: --- http://www.spinics.net/lists/linux-omap/msg45443.html V1: --- http://www.spinics.net/lists/linux-mmc/msg05689.html Anand Gadiyar (2): omap: mmc: split out init for 2420 OMAP4: hwmod data: enable HSMMC Kishore Kadiyala (4): OMAP: hwmod data: Add dev_attr and use in the host driver OMAP: hsmmc: Move mux configuration to hsmmc.c OMAP: adapt hsmmc to hwmod framework OMAP: hsmmc: Rename the device and driver Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +- arch/arm/mach-omap2/board-4430sdp.c |4 +- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +- arch/arm/mach-omap2/board-igep0030.c |6 +- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +- arch/arm/mach-omap2/board-omap4panda.c |4 +- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 +- arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 +- arch/arm/mach-omap2/clock3xxx_data.c | 12 +- arch/arm/mach-omap2/clock44xx_data.c | 20 +- arch/arm/mach-omap2/devices.c| 293 ++ arch/arm/mach-omap2/hsmmc.c | 419 +- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 152 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 215 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 18 +- arch/arm/mach-omap2/prcm-common.h|4 + arch/arm/plat-omap/include/plat/mmc.h| 29 +- drivers/mmc/host/omap_hsmmc.c|6 +- 24 files changed, 753 insertions(+), 479 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/8] omap: mmc: split out init for 2420
From: Anand Gadiyar gadi...@ti.com The MMC controller on the OMAP2420 is different from those on the OMAP2430, OMAP3 and OMAP4 families - all of the latter are identical. The one on the OMAP2420 is closer to that on OMAP1 chips. Currently, the n8x0 is the only OMAP2420 platform supported in mainline which registers the MMC controller. Upcoming changes to register the controllers using hwmod data are potentially invasive. To reduce the risk, separate out the 2420 controller registration from the common init function and update its only user. Also seperating out mux settings for OMAP2420. Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Chris Ball c...@laptop.org --- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/devices.c | 88 + arch/arm/plat-omap/include/plat/mmc.h |4 ++ 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index b36cbd2..e710cd9 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void) } mmc_data[0] = mmc1_data; - omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); + omap242x_init_mmc(mmc_data); } #else diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 9ee876f..100bb42 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -650,11 +650,10 @@ err1: static inline void omap_hsmmc_reset(void) {} #endif -#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ - defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) +static inline void omap242x_mmc_mux(struct omap_mmc_platform_data + *mmc_controller) { if ((mmc_controller-slots[0].switch_pin 0) \ (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) @@ -665,33 +664,61 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap2420() controller_nr == 0) { - omap_mux_init_signal(sdmmc_cmd, 0); - omap_mux_init_signal(sdmmc_clki, 0); - omap_mux_init_signal(sdmmc_clko, 0); - omap_mux_init_signal(sdmmc_dat0, 0); - omap_mux_init_signal(sdmmc_dat_dir0, 0); - omap_mux_init_signal(sdmmc_cmd_dir, 0); - if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { - omap_mux_init_signal(sdmmc_dat1, 0); - omap_mux_init_signal(sdmmc_dat2, 0); - omap_mux_init_signal(sdmmc_dat3, 0); - omap_mux_init_signal(sdmmc_dat_dir1, 0); - omap_mux_init_signal(sdmmc_dat_dir2, 0); - omap_mux_init_signal(sdmmc_dat_dir3, 0); - } + omap_mux_init_signal(sdmmc_cmd, 0); + omap_mux_init_signal(sdmmc_clki, 0); + omap_mux_init_signal(sdmmc_clko, 0); + omap_mux_init_signal(sdmmc_dat0, 0); + omap_mux_init_signal(sdmmc_dat_dir0, 0); + omap_mux_init_signal(sdmmc_cmd_dir, 0); + if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { + omap_mux_init_signal(sdmmc_dat1, 0); + omap_mux_init_signal(sdmmc_dat2, 0); + omap_mux_init_signal(sdmmc_dat3, 0); + omap_mux_init_signal(sdmmc_dat_dir1, 0); + omap_mux_init_signal(sdmmc_dat_dir2, 0); + omap_mux_init_signal(sdmmc_dat_dir3, 0); + } - /* -* Use internal loop-back in MMC/SDIO Module Input Clock -* selection -*/ - if (mmc_controller-slots[0].internal_clock) { - u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); - v |= (1 24); - omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); - } + /* +* Use internal loop-back in MMC/SDIO Module Input Clock +* selection +*/ + if (mmc_controller-slots[0].internal_clock) { + u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); + v |= (1 24); + omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); + } +} + +void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) +{ + char *name = mmci-omap; + + if (!mmc_data[0]) { + pr_err(%s fails: Incomplete platform data
[PATCH v5 8/8] OMAP: hsmmc: Rename the device and driver
Modifying the device driver name from mmci-omap-hs to omap_hsmmc. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +++--- arch/arm/mach-omap2/board-4430sdp.c |4 ++-- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +++--- arch/arm/mach-omap2/board-igep0030.c |6 +++--- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +++--- arch/arm/mach-omap2/board-omap4panda.c |4 ++-- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 ++-- arch/arm/mach-omap2/clock3xxx_data.c | 12 ++-- arch/arm/mach-omap2/clock44xx_data.c | 20 ++-- arch/arm/mach-omap2/hsmmc.c |2 +- drivers/mmc/host/omap_hsmmc.c|2 +- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index cc42d47..ab0880b 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void) } static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 8950ecc..40b0174 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -410,15 +410,15 @@ static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = { }; static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vsim_supplies[] = { - REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.1), }; /* diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 1a943be..cca2fbc 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -367,13 +367,13 @@ static struct omap2_hsmmc_info mmc[] = { static struct regulator_consumer_supply sdp4430_vaux_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.1, + .dev_name = omap_hsmmc.1, }, }; static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.0, + .dev_name = omap_hsmmc.0, }, }; diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 54abdd0..c9170f4 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c @@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) } static struct regulator_consumer_supply devkit8000_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* ads7846 on SPI */ diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 54e6318..1877c28 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { } #endif static struct regulator_consumer_supply igep2_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ static struct regulator_init_data igep2_vmmc1 = { @@ -268,7 +268,7 @@ static struct regulator_init_data igep2_vmmc1 = { }; static struct regulator_consumer_supply igep2_vio_supply = - REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.1); + REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.1); static struct regulator_init_data igep2_vio = { .constraints = { @@ -286,7 +286,7 @@ static struct regulator_init_data igep2_vio = { }; static struct regulator_consumer_supply igep2_vmmc2_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.1); static struct regulator_init_data igep2_vmmc2 = { .constraints= { diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach
[PATCH v5 4/8] OMAP4: hwmod data: enable HSMMC
From: Anand Gadiyar gadi...@ti.com Enabling hsmmc hwmod for OMAP4 Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 79a8601..dd39e75 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { omap44xx_mcspi4_hwmod, /* mmc class */ -/* omap44xx_mmc1_hwmod, */ -/* omap44xx_mmc2_hwmod, */ -/* omap44xx_mmc3_hwmod, */ -/* omap44xx_mmc4_hwmod, */ -/* omap44xx_mmc5_hwmod, */ + omap44xx_mmc1_hwmod, + omap44xx_mmc2_hwmod, + omap44xx_mmc3_hwmod, + omap44xx_mmc4_hwmod, + omap44xx_mmc5_hwmod, /* mpu class */ omap44xx_mpu_hwmod, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 6/8] OMAP: hsmmc: Move mux configuration to hsmmc.c
Moving the definition of mux setting API from devices.c to hsmmc.c and renaming it from omap2_mmc_mux to omap_hsmmc_mux. Also calling omap_hsmmc_mux from omap2_hsmmc_init. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Chris Ball c...@laptop.org Cc: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/devices.c | 83 arch/arm/mach-omap2/hsmmc.c | 84 + 2 files changed, 84 insertions(+), 83 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 100bb42..2f4a598 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -708,87 +708,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) -{ - if ((mmc_controller-slots[0].switch_pin 0) \ - (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) - omap_mux_init_gpio(mmc_controller-slots[0].switch_pin, - OMAP_PIN_INPUT_PULLUP); - if ((mmc_controller-slots[0].gpio_wp 0) \ - (mmc_controller-slots[0].gpio_wp OMAP_MAX_GPIO_LINES)) - omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, - OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap34xx()) { - if (controller_nr == 0) { - omap_mux_init_signal(sdmmc1_clk, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_cmd, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat0, - OMAP_PIN_INPUT_PULLUP); - if (mmc_controller-slots[0].caps - (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { - omap_mux_init_signal(sdmmc1_dat1, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat2, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat3, - OMAP_PIN_INPUT_PULLUP); - } - if (mmc_controller-slots[0].caps - MMC_CAP_8_BIT_DATA) { - omap_mux_init_signal(sdmmc1_dat4, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat5, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat6, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc1_dat7, - OMAP_PIN_INPUT_PULLUP); - } - } - if (controller_nr == 1) { - /* MMC2 */ - omap_mux_init_signal(sdmmc2_clk, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_cmd, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat0, - OMAP_PIN_INPUT_PULLUP); - - /* -* For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed -* in the board-*.c files -*/ - if (mmc_controller-slots[0].caps - (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { - omap_mux_init_signal(sdmmc2_dat1, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat2, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat3, - OMAP_PIN_INPUT_PULLUP); - } - if (mmc_controller-slots[0].caps - MMC_CAP_8_BIT_DATA) { - omap_mux_init_signal(sdmmc2_dat4.sdmmc2_dat4, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat5.sdmmc2_dat5, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat6.sdmmc2_dat6, - OMAP_PIN_INPUT_PULLUP); - omap_mux_init_signal(sdmmc2_dat7.sdmmc2_dat7
[PATCH v5 7/8] OMAP: adapt hsmmc to hwmod framework
Changes involves: 1) Remove controller reset in devices.c which is taken care of by hwmod framework. 2) Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. Removing all base address macro defines except keeping one for OMAP2420. 3) Using omap-device layer to register device and utilizing data from hwmod data file for base address, dma channel number, Irq_number, device attribute. 4) Update the driver to use dev_attr to find whether controller supports dual volt cards Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com CC: Kevin Hilman khil...@deeprootsystems.com --- arch/arm/mach-omap2/devices.c | 168 arch/arm/mach-omap2/hsmmc.c | 343 ++-- arch/arm/plat-omap/include/plat/mmc.h | 20 +-- drivers/mmc/host/omap_hsmmc.c |4 +- 4 files changed, 196 insertions(+), 339 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2f4a598..31632ac 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -544,112 +544,6 @@ static inline void omap_init_aes(void) { } /*-*/ -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - -#define MMCHS_SYSCONFIG0x0010 -#define MMCHS_SYSCONFIG_SWRESET(1 1) -#define MMCHS_SYSSTATUS0x0014 -#define MMCHS_SYSSTATUS_RESETDONE (1 0) - -static struct platform_device dummy_pdev = { - .dev = { - .bus = platform_bus_type, - }, -}; - -/** - * omap_hsmmc_reset() - Full reset of each HS-MMC controller - * - * Ensure that each MMC controller is fully reset. Controllers - * left in an unknown state (by bootloader) may prevent retention - * or OFF-mode. This is especially important in cases where the - * MMC driver is not enabled, _or_ built as a module. - * - * In order for reset to work, interface, functional and debounce - * clocks must be enabled. The debounce clock comes from func_32k_clk - * and is not under SW control, so we only enable i- and f-clocks. - **/ -static void __init omap_hsmmc_reset(void) -{ - u32 i, nr_controllers; - struct clk *iclk, *fclk; - - if (cpu_is_omap242x()) - return; - - nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC : - (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC); - - for (i = 0; i nr_controllers; i++) { - u32 v, base = 0; - struct device *dev = dummy_pdev.dev; - - switch (i) { - case 0: - base = OMAP2_MMC1_BASE; - break; - case 1: - base = OMAP2_MMC2_BASE; - break; - case 2: - base = OMAP3_MMC3_BASE; - break; - case 3: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC4_BASE; - break; - case 4: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC5_BASE; - break; - } - - if (cpu_is_omap44xx()) - base += OMAP4_MMC_REG_OFFSET; - - dummy_pdev.id = i; - dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i); - iclk = clk_get(dev, ick); - if (IS_ERR(iclk)) - goto err1; - if (clk_enable(iclk)) - goto err2; - - fclk = clk_get(dev, fck); - if (IS_ERR(fclk)) - goto err3; - if (clk_enable(fclk)) - goto err4; - - omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG); - v = omap_readl(base + MMCHS_SYSSTATUS); - while (!(omap_readl(base + MMCHS_SYSSTATUS) -MMCHS_SYSSTATUS_RESETDONE)) - cpu_relax(); - - clk_disable(fclk); - clk_put(fclk); - clk_disable(iclk); - clk_put(iclk); - } - return; - -err4: - clk_put(fclk); -err3: - clk_disable(iclk); -err2: - clk_put(iclk); -err1: - printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, - cannot reset.\n, __func__, i); -} -#else -static inline void omap_hsmmc_reset(void) {} -#endif - #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) static inline void omap242x_mmc_mux(struct omap_mmc_platform_data @@ -706,67 +600,6 @@ void __init omap242x_init_mmc(struct
[PATCH v5 2/8] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 146 1 files changed, 146 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index de0015d..a1c3c5e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod; static struct omap_hwmod omap2430_mcspi1_hwmod; static struct omap_hwmod omap2430_mcspi2_hwmod; static struct omap_hwmod omap2430_mcspi3_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = { omap2430_l4_core__usbhsotg, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs2_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -1508,6 +1548,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = { +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap2430_mmc_class = { + .name = mmc, + .sysc = omap2430_mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info omap2430_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = omap2430_mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap2430_mmc1_mpu_irqs), + .sdma_reqs = omap2430_mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap2430_mmc1_sdma_reqs), + .opt_clks = omap2430_mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(omap2430_mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 2, + .module_bit = OMAP2430_EN_MMCHS1_SHIFT, + .idlest_reg_id = 2, + .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT
[PATCH v5 3/8] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 209 arch/arm/mach-omap2/prcm-common.h |4 + 2 files changed, 213 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index e9d0012..7726932 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1; static struct omap_hwmod omap34xx_mcspi2; static struct omap_hwmod omap34xx_mcspi3; static struct omap_hwmod omap34xx_mcspi4; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; static struct omap_hwmod am35xx_usbhsotg_hwmod; static struct omap_hwmod omap3xxx_dma_system_hwmod; @@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = { { @@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1) }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class omap34xx_mmc_class = { + .name = mmc, + .sysc = omap34xx_mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info omap34xx_mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info omap34xx_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { + omap3xxx_l4_core__mmc1, +}; + +static struct omap_hwmod omap3xxx_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = omap34xx_mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap34xx_mmc1_mpu_irqs), + .sdma_reqs = omap34xx_mmc1_sdma_reqs
[PATCH v4 3/6] OMAP4: hwmod data: enable HSMMC
From: Anand Gadiyar gadi...@ti.com Enabling hsmmc hwmod for OMAP4 Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Acked-by: Benoit Coussonb-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 79a8601..dd39e75 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { omap44xx_mcspi4_hwmod, /* mmc class */ -/* omap44xx_mmc1_hwmod, */ -/* omap44xx_mmc2_hwmod, */ -/* omap44xx_mmc3_hwmod, */ -/* omap44xx_mmc4_hwmod, */ -/* omap44xx_mmc5_hwmod, */ + omap44xx_mmc1_hwmod, + omap44xx_mmc2_hwmod, + omap44xx_mmc3_hwmod, + omap44xx_mmc4_hwmod, + omap44xx_mmc5_hwmod, /* mpu class */ omap44xx_mpu_hwmod, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 0/6] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework. The patch series is based on omap-for-linus and tested on OMAP2430, OMAP3430SDP OMAP4430SDP. Also boot tested on OMAP2420SDP. V4: --- Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. The series takes care of hwmod adaptation of hsmmc drivers and thus excluding the omap2420 platforms. Also includes renaming of device driver name. The patch series has dependency on : 1)https://patchwork.kernel.org/patch/585281/ 2)https://patchwork.kernel.org/patch/538301/ V3: -- http://www.spinics.net/lists/linux-omap/msg46783.html V2: --- http://www.spinics.net/lists/linux-omap/msg45443.html V1: --- http://www.spinics.net/lists/linux-mmc/msg05689.html Anand Gadiyar (1): OMAP4: hwmod data: enable HSMMC Kishore Kadiyala (2): OMAP: hwmod data: Add dev_attr and use in the host driver OMAP: adapt hsmmc to hwmod framework OMAP: hsmmc: Rename the device and driver Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +- arch/arm/mach-omap2/board-4430sdp.c |4 +- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +- arch/arm/mach-omap2/board-igep0030.c |6 +- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +- arch/arm/mach-omap2/board-omap4panda.c |4 +- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 +- arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 +- arch/arm/mach-omap2/clock3xxx_data.c | 12 +- arch/arm/mach-omap2/clock44xx_data.c | 20 +- arch/arm/mach-omap2/devices.c| 251 arch/arm/mach-omap2/hsmmc.c | 417 +- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 152 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 215 + arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 16 +- arch/arm/mach-omap2/prcm-common.h|4 + arch/arm/plat-omap/include/plat/mmc.h| 29 +-- drivers/mmc/host/omap_hsmmc.c|6 +- 23 files changed, 713 insertions(+), 471 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 4/6] OMAP: hwmod data: Add dev_attr and use in the host driver
Add a device attribute to hwmod data of omap2430, omap3, omap4. Currently the device attribute holds information regarding dual volt MMC card support by the controller which will be later passed to the host driver via platform data. Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com Cc: Paul Walmsley p...@pwsan.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |6 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c |6 ++ arch/arm/plat-omap/include/plat/mmc.h |9 + 4 files changed, 27 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 9c99083..cbb7c9d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -19,6 +19,7 @@ #include plat/i2c.h #include plat/gpio.h #include plat/mcspi.h +#include plat/mmc.h #include plat/l3_2xxx.h #include omap_hwmod_common_data.h @@ -1568,6 +1569,10 @@ static struct omap_hwmod_class mmc_class = { /* MMC/SD/SDIO1 */ +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { { .irq = 83 }, }; @@ -1603,6 +1608,7 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap2430_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), .class = mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index d4e734e..7fa2dfb 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -22,6 +22,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include plat/mcspi.h @@ -2292,6 +2293,10 @@ static struct omap_hwmod_class mmc_class = { /* MMC/SD/SDIO1 */ +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { { .irq = 83, }, }; @@ -2327,6 +2332,7 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = { .idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap3xxx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves), .class = mmc_class, diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index dd39e75..28031e3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -25,6 +25,7 @@ #include plat/gpio.h #include plat/dma.h #include plat/mcspi.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { }; /* mmc1 */ +static struct omap_mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { { .irq = 83 + OMAP44XX_IRQ_GIC_START }, }; @@ -3433,6 +3438,7 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = { .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, }, }, + .dev_attr = mmc1_dev_attr, .slaves = omap44xx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves), .masters= omap44xx_mmc1_masters, diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index e5de5d4..a7afab0 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -43,6 +43,12 @@ #define OMAP_MMC_MAX_SLOTS 2 +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1) + +struct omap_mmc_dev_attr { + u8 flags; +}; + struct omap_mmc_platform_data { /* back-link to device */ struct device *dev; @@ -71,6 +77,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Integrating attributes from the omap_hwmod layer */ + u8 controller_flags; + /* Register offset deviation */ u16 reg_offset; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/6] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 146 1 files changed, 146 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index de0015d..9c99083 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -54,6 +54,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod; static struct omap_hwmod omap2430_mcspi1_hwmod; static struct omap_hwmod omap2430_mcspi2_hwmod; static struct omap_hwmod omap2430_mcspi3_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -250,6 +252,42 @@ static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = { omap2430_l4_core__usbhsotg, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs2_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -258,6 +296,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -1508,6 +1548,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = { +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks = mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 2, + .module_bit = OMAP2430_EN_MMCHS1_SHIFT, + .idlest_reg_id = 2, + .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT, + }, + }, + .slaves = omap2430_mmc1_slaves, + .slaves_cnt
[PATCH v4 2/6] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 209 arch/arm/mach-omap2/prcm-common.h |4 + 2 files changed, 213 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index e9d0012..d4e734e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -68,6 +68,9 @@ static struct omap_hwmod omap34xx_mcspi1; static struct omap_hwmod omap34xx_mcspi2; static struct omap_hwmod omap34xx_mcspi3; static struct omap_hwmod omap34xx_mcspi4; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; static struct omap_hwmod am35xx_usbhsotg_hwmod; static struct omap_hwmod omap3xxx_dma_system_hwmod; @@ -158,6 +161,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = { { @@ -2212,11 +2272,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1) }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { + omap3xxx_l4_core__mmc1, +}; + +static struct omap_hwmod omap3xxx_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks
[PATCH v4 6/6] OMAP: hsmmc: Rename the device and driver
Modifying the device driver name from mmci-omap-hs to omap_hsmmc. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Benoit Cousson b-cous...@ti.com Cc: Paul Walmsley p...@pwsan.com Cc: Chris Ball c...@laptop.org Cc: Tony Lindgren t...@atomide.com --- arch/arm/mach-omap2/board-2430sdp.c |2 +- arch/arm/mach-omap2/board-3430sdp.c |6 +++--- arch/arm/mach-omap2/board-4430sdp.c |4 ++-- arch/arm/mach-omap2/board-devkit8000.c |2 +- arch/arm/mach-omap2/board-igep0020.c |6 +++--- arch/arm/mach-omap2/board-igep0030.c |6 +++--- arch/arm/mach-omap2/board-omap3evm.c |2 +- arch/arm/mach-omap2/board-omap3pandora.c |6 +++--- arch/arm/mach-omap2/board-omap4panda.c |4 ++-- arch/arm/mach-omap2/board-rm680.c|2 +- arch/arm/mach-omap2/board-rx51-peripherals.c |8 arch/arm/mach-omap2/board-zoom-peripherals.c |2 +- arch/arm/mach-omap2/clock2430_data.c | 12 ++-- arch/arm/mach-omap2/clock3xxx_data.c | 12 ++-- arch/arm/mach-omap2/clock44xx_data.c | 20 ++-- arch/arm/mach-omap2/hsmmc.c |2 +- drivers/mmc/host/omap_hsmmc.c|2 +- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index cc42d47..ab0880b 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -149,7 +149,7 @@ static void __init omap_2430sdp_init_early(void) } static struct regulator_consumer_supply sdp2430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 8950ecc..40b0174 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -410,15 +410,15 @@ static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = { }; static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vsim_supplies[] = { - REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.0), + REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.0), }; static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = { - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1), + REGULATOR_SUPPLY(vmmc, omap_hsmmc.1), }; /* diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 1a943be..cca2fbc 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -367,13 +367,13 @@ static struct omap2_hsmmc_info mmc[] = { static struct regulator_consumer_supply sdp4430_vaux_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.1, + .dev_name = omap_hsmmc.1, }, }; static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { { .supply = vmmc, - .dev_name = mmci-omap-hs.0, + .dev_name = omap_hsmmc.0, }, }; diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 54abdd0..c9170f4 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c @@ -140,7 +140,7 @@ static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) } static struct regulator_consumer_supply devkit8000_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* ads7846 on SPI */ diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 54e6318..1877c28 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -250,7 +250,7 @@ static inline void __init igep2_init_smsc911x(void) { } #endif static struct regulator_consumer_supply igep2_vmmc1_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.0); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.0); /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ static struct regulator_init_data igep2_vmmc1 = { @@ -268,7 +268,7 @@ static struct regulator_init_data igep2_vmmc1 = { }; static struct regulator_consumer_supply igep2_vio_supply = - REGULATOR_SUPPLY(vmmc_aux, mmci-omap-hs.1); + REGULATOR_SUPPLY(vmmc_aux, omap_hsmmc.1); static struct regulator_init_data igep2_vio = { .constraints = { @@ -286,7 +286,7 @@ static struct regulator_init_data igep2_vio = { }; static struct regulator_consumer_supply igep2_vmmc2_supply = - REGULATOR_SUPPLY(vmmc, mmci-omap-hs.1); + REGULATOR_SUPPLY(vmmc, omap_hsmmc.1); static struct
[PATCH 1/6] omap: mmc: split out init for 2420
From: Anand Gadiyar gadi...@ti.com The MMC controller on the OMAP2420 is different from those on the OMAP2430, OMAP3 and OMAP4 families - all of the latter are identical. The one on the OMAP2420 is closer to that on OMAP1 chips. Currently, the n8x0 is the only OMAP2420 platform supported in mainline which registers the MMC controller. Upcoming changes to register the controllers using hwmod data are potentially invasive. To reduce the risk, separate out the 2420 controller registration from the common init function and update its only user. Also seperating out mux settings for OMAP2420. Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Chris Ball c...@laptop.org --- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/devices.c | 88 + arch/arm/plat-omap/include/plat/mmc.h |4 ++ 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index b36cbd2..e710cd9 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void) } mmc_data[0] = mmc1_data; - omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); + omap242x_init_mmc(mmc_data); } #else diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 71f099b..7b35c87 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -609,11 +609,10 @@ err1: static inline void omap_hsmmc_reset(void) {} #endif -#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ - defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) +static inline void omap242x_mmc_mux(struct omap_mmc_platform_data + *mmc_controller) { if ((mmc_controller-slots[0].switch_pin 0) \ (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) @@ -624,33 +623,61 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap2420() controller_nr == 0) { - omap_mux_init_signal(sdmmc_cmd, 0); - omap_mux_init_signal(sdmmc_clki, 0); - omap_mux_init_signal(sdmmc_clko, 0); - omap_mux_init_signal(sdmmc_dat0, 0); - omap_mux_init_signal(sdmmc_dat_dir0, 0); - omap_mux_init_signal(sdmmc_cmd_dir, 0); - if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { - omap_mux_init_signal(sdmmc_dat1, 0); - omap_mux_init_signal(sdmmc_dat2, 0); - omap_mux_init_signal(sdmmc_dat3, 0); - omap_mux_init_signal(sdmmc_dat_dir1, 0); - omap_mux_init_signal(sdmmc_dat_dir2, 0); - omap_mux_init_signal(sdmmc_dat_dir3, 0); - } + omap_mux_init_signal(sdmmc_cmd, 0); + omap_mux_init_signal(sdmmc_clki, 0); + omap_mux_init_signal(sdmmc_clko, 0); + omap_mux_init_signal(sdmmc_dat0, 0); + omap_mux_init_signal(sdmmc_dat_dir0, 0); + omap_mux_init_signal(sdmmc_cmd_dir, 0); + if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { + omap_mux_init_signal(sdmmc_dat1, 0); + omap_mux_init_signal(sdmmc_dat2, 0); + omap_mux_init_signal(sdmmc_dat3, 0); + omap_mux_init_signal(sdmmc_dat_dir1, 0); + omap_mux_init_signal(sdmmc_dat_dir2, 0); + omap_mux_init_signal(sdmmc_dat_dir3, 0); + } - /* -* Use internal loop-back in MMC/SDIO Module Input Clock -* selection -*/ - if (mmc_controller-slots[0].internal_clock) { - u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); - v |= (1 24); - omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); - } + /* +* Use internal loop-back in MMC/SDIO Module Input Clock +* selection +*/ + if (mmc_controller-slots[0].internal_clock) { + u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); + v |= (1 24); + omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); + } +} + +void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) +{ + char *name = mmci-omap; + + if (!mmc_data[0]) { + pr_err(%s fails: Incomplete platform data
[PATCH] omap: mmc: split out init for 2420
From: Anand Gadiyar gadi...@ti.com The MMC controller on the OMAP2420 is different from those on the OMAP2430, OMAP3 and OMAP4 families - all of the latter are identical. The one on the OMAP2420 is closer to that on OMAP1 chips. Currently, the n8x0 is the only OMAP2420 platform supported in mainline which registers the MMC controller. Upcoming changes to register the controllers using hwmod data are potentially invasive. To reduce the risk, separate out the 2420 controller registration from the common init function and update its only user. Also seperating out mux settings for OMAP2420. Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Chris Ball c...@laptop.org --- arch/arm/mach-omap2/board-n8x0.c |2 +- arch/arm/mach-omap2/devices.c | 88 + arch/arm/plat-omap/include/plat/mmc.h |4 ++ 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index b36cbd2..e710cd9 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -536,7 +536,7 @@ static void __init n8x0_mmc_init(void) } mmc_data[0] = mmc1_data; - omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); + omap242x_init_mmc(mmc_data); } #else diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 71f099b..7b35c87 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -609,11 +609,10 @@ err1: static inline void omap_hsmmc_reset(void) {} #endif -#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ - defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) +#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr) +static inline void omap242x_mmc_mux(struct omap_mmc_platform_data + *mmc_controller) { if ((mmc_controller-slots[0].switch_pin 0) \ (mmc_controller-slots[0].switch_pin OMAP_MAX_GPIO_LINES)) @@ -624,33 +623,61 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, omap_mux_init_gpio(mmc_controller-slots[0].gpio_wp, OMAP_PIN_INPUT_PULLUP); - if (cpu_is_omap2420() controller_nr == 0) { - omap_mux_init_signal(sdmmc_cmd, 0); - omap_mux_init_signal(sdmmc_clki, 0); - omap_mux_init_signal(sdmmc_clko, 0); - omap_mux_init_signal(sdmmc_dat0, 0); - omap_mux_init_signal(sdmmc_dat_dir0, 0); - omap_mux_init_signal(sdmmc_cmd_dir, 0); - if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { - omap_mux_init_signal(sdmmc_dat1, 0); - omap_mux_init_signal(sdmmc_dat2, 0); - omap_mux_init_signal(sdmmc_dat3, 0); - omap_mux_init_signal(sdmmc_dat_dir1, 0); - omap_mux_init_signal(sdmmc_dat_dir2, 0); - omap_mux_init_signal(sdmmc_dat_dir3, 0); - } + omap_mux_init_signal(sdmmc_cmd, 0); + omap_mux_init_signal(sdmmc_clki, 0); + omap_mux_init_signal(sdmmc_clko, 0); + omap_mux_init_signal(sdmmc_dat0, 0); + omap_mux_init_signal(sdmmc_dat_dir0, 0); + omap_mux_init_signal(sdmmc_cmd_dir, 0); + if (mmc_controller-slots[0].caps MMC_CAP_4_BIT_DATA) { + omap_mux_init_signal(sdmmc_dat1, 0); + omap_mux_init_signal(sdmmc_dat2, 0); + omap_mux_init_signal(sdmmc_dat3, 0); + omap_mux_init_signal(sdmmc_dat_dir1, 0); + omap_mux_init_signal(sdmmc_dat_dir2, 0); + omap_mux_init_signal(sdmmc_dat_dir3, 0); + } - /* -* Use internal loop-back in MMC/SDIO Module Input Clock -* selection -*/ - if (mmc_controller-slots[0].internal_clock) { - u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); - v |= (1 24); - omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); - } + /* +* Use internal loop-back in MMC/SDIO Module Input Clock +* selection +*/ + if (mmc_controller-slots[0].internal_clock) { + u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); + v |= (1 24); + omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); + } +} + +void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) +{ + char *name = mmci-omap; + + if (!mmc_data[0]) { + pr_err(%s fails: Incomplete platform data
[PATCH v3 0/5] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework. The patch series is based on -rc6 and tested on OMAP2430, OMAP3430SDP OMAP4430SDP. V3: --- Omap2420 platform consists of mmc block as in omap1 and not the hsmmc block as present in omap2430, omap3, omap4 platforms. The series takes care of hwmod adaptation of hsmmc drivers and thus excluding the omap2420 platforms. The patch series has dependency on : 1)https://patchwork.kernel.org/patch/585281/ 2)https://patchwork.kernel.org/patch/538301/ V2: --- http://www.spinics.net/lists/linux-omap/msg45443.html V1: --- http://www.spinics.net/lists/linux-mmc/msg05689.html Anand Gadiyar (1): OMAP4: hwmod data: enable HSMMC Kishore Kadiyala (2): OMAP: hwmod data: Add dev_attr and use in the host driver OMAP: adapt hsmmc to hwmod framework Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC arch/arm/mach-omap2/devices.c | 251 arch/arm/mach-omap2/hsmmc.c| 153 -- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 155 + arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 221 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 26 +++- arch/arm/mach-omap2/prcm-common.h |4 + arch/arm/plat-omap/include/plat/mmc.h | 24 +-- drivers/mmc/host/omap_hsmmc.c |4 +- 8 files changed, 554 insertions(+), 284 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/5] OMAP: adapt hsmmc to hwmod framework
Changes involves: 1) Remove controller reset in devices.c which is taken care of by hwmod framework. 2) Removing all base address macro defines except keeping one for OMAP2420. 3) Using omap-device layer to register device and utilizing data from hwmod data file for base address, dma channel number, Irq_number, device attribute. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com CC: Kevin Hilman khil...@deeprootsystems.com --- arch/arm/mach-omap2/devices.c | 251 - arch/arm/mach-omap2/hsmmc.c | 153 ++-- arch/arm/plat-omap/include/plat/mmc.h | 14 -- 3 files changed, 141 insertions(+), 277 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 7b35c87..2d2deb6 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -503,112 +503,6 @@ static inline void omap_init_aes(void) { } /*-*/ -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - -#define MMCHS_SYSCONFIG0x0010 -#define MMCHS_SYSCONFIG_SWRESET(1 1) -#define MMCHS_SYSSTATUS0x0014 -#define MMCHS_SYSSTATUS_RESETDONE (1 0) - -static struct platform_device dummy_pdev = { - .dev = { - .bus = platform_bus_type, - }, -}; - -/** - * omap_hsmmc_reset() - Full reset of each HS-MMC controller - * - * Ensure that each MMC controller is fully reset. Controllers - * left in an unknown state (by bootloader) may prevent retention - * or OFF-mode. This is especially important in cases where the - * MMC driver is not enabled, _or_ built as a module. - * - * In order for reset to work, interface, functional and debounce - * clocks must be enabled. The debounce clock comes from func_32k_clk - * and is not under SW control, so we only enable i- and f-clocks. - **/ -static void __init omap_hsmmc_reset(void) -{ - u32 i, nr_controllers; - struct clk *iclk, *fclk; - - if (cpu_is_omap242x()) - return; - - nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC : - (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC); - - for (i = 0; i nr_controllers; i++) { - u32 v, base = 0; - struct device *dev = dummy_pdev.dev; - - switch (i) { - case 0: - base = OMAP2_MMC1_BASE; - break; - case 1: - base = OMAP2_MMC2_BASE; - break; - case 2: - base = OMAP3_MMC3_BASE; - break; - case 3: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC4_BASE; - break; - case 4: - if (!cpu_is_omap44xx()) - return; - base = OMAP4_MMC5_BASE; - break; - } - - if (cpu_is_omap44xx()) - base += OMAP4_MMC_REG_OFFSET; - - dummy_pdev.id = i; - dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i); - iclk = clk_get(dev, ick); - if (IS_ERR(iclk)) - goto err1; - if (clk_enable(iclk)) - goto err2; - - fclk = clk_get(dev, fck); - if (IS_ERR(fclk)) - goto err3; - if (clk_enable(fclk)) - goto err4; - - omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG); - v = omap_readl(base + MMCHS_SYSSTATUS); - while (!(omap_readl(base + MMCHS_SYSSTATUS) -MMCHS_SYSSTATUS_RESETDONE)) - cpu_relax(); - - clk_disable(fclk); - clk_put(fclk); - clk_disable(iclk); - clk_put(iclk); - } - return; - -err4: - clk_put(fclk); -err3: - clk_disable(iclk); -err2: - clk_put(iclk); -err1: - printk(KERN_WARNING %s: Unable to enable clocks for MMC%d, - cannot reset.\n, __func__, i); -} -#else -static inline void omap_hsmmc_reset(void) {} -#endif - #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) static inline void omap242x_mmc_mux(struct omap_mmc_platform_data @@ -665,150 +559,6 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) #endif -#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) - -static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, - int controller_nr
[PATCH v3 4/5] OMAP: hwmod data: Add dev_attr and use in the host driver
Add a device attribute to hwmod data of omap2430, omap3, omap4. Currently the device attribute holds information regarding dual volt MMC card support by the controller which will be later passed to the host driver via platform data. Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com Cc: Paul Walmsley p...@pwsan.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c |9 + arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 12 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 16 arch/arm/plat-omap/include/plat/mmc.h | 10 ++ drivers/mmc/host/omap_hsmmc.c |4 ++-- 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4d45b7d..e050355 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -19,6 +19,7 @@ #include plat/i2c.h #include plat/gpio.h #include plat/mcspi.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -1290,6 +1291,10 @@ static struct omap_hwmod_class mmc_class = { /* MMC/SD/SDIO1 */ +static struct mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { { .irq = 83 }, }; @@ -1328,11 +1333,14 @@ static struct omap_hwmod omap2430_mmc1_hwmod = { .slaves = omap2430_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves), .class = mmc_class, + .dev_attr = mmc1_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), }; /* MMC/SD/SDIO2 */ +static struct mmc_dev_attr mmc2_dev_attr; + static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = { { .irq = 86 }, }; @@ -1371,6 +1379,7 @@ static struct omap_hwmod omap2430_mmc2_hwmod = { .slaves = omap2430_mmc2_slaves, .slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves), .class = mmc_class, + .dev_attr = mmc2_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), }; diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index c8f2725..6afdf7f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -21,6 +21,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include plat/mcspi.h @@ -1868,6 +1869,10 @@ static struct omap_hwmod_class mmc_class = { /* MMC/SD/SDIO1 */ +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { { .irq = 83, }, }; @@ -1906,11 +1911,14 @@ static struct omap_hwmod omap3xxx_mmc1_hwmod = { .slaves = omap3xxx_mmc1_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves), .class = mmc_class, + .dev_attr = omap_mmc1_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; /* MMC/SD/SDIO2 */ +static struct mmc_dev_attr omap_mmc2_dev_attr; + static struct omap_hwmod_irq_info mmc2_mpu_irqs[] = { { .irq = INT_24XX_MMC2_IRQ, }, }; @@ -1949,11 +1957,14 @@ static struct omap_hwmod omap3xxx_mmc2_hwmod = { .slaves = omap3xxx_mmc2_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves), .class = mmc_class, + .dev_attr = omap_mmc2_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; /* MMC/SD/SDIO3 */ +static struct mmc_dev_attr omap_mmc3_dev_attr; + static struct omap_hwmod_irq_info mmc3_mpu_irqs[] = { { .irq = 94, }, }; @@ -1991,6 +2002,7 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = { .slaves = omap3xxx_mmc3_slaves, .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc3_slaves), .class = mmc_class, + .dev_attr = omap_mmc3_dev_attr, .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), }; diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index dd39e75..6c4ccfd 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -25,6 +25,7 @@ #include plat/gpio.h #include plat/dma.h #include plat/mcspi.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -3383,6 +3384,10 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { }; /* mmc1 */ +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { { .irq = 83 + OMAP44XX_IRQ_GIC_START }, }; @@ -3437,10 +3442,14 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = { .slaves_cnt
[PATCH v3 2/5] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 209 arch/arm/mach-omap2/prcm-common.h |4 + 2 files changed, 213 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 879f55f..c8f2725 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -61,6 +61,9 @@ static struct omap_hwmod omap34xx_mcspi1; static struct omap_hwmod omap34xx_mcspi2; static struct omap_hwmod omap34xx_mcspi3; static struct omap_hwmod omap34xx_mcspi4; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; static struct omap_hwmod am35xx_usbhsotg_hwmod; static struct omap_hwmod omap3xxx_dma_system_hwmod; @@ -138,6 +141,63 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = { { @@ -1788,11 +1848,160 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES3_1) }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = { + omap3xxx_l4_core__mmc1, +}; + +static struct omap_hwmod omap3xxx_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks
[PATCH v3 3/5] OMAP4: hwmod data: enable HSMMC
From: Anand Gadiyar gadi...@ti.com Enabling hsmmc hwmod for OMAP4 Signed-off-by: Anand Gadiyar gadi...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com Cc: Paul Walmsley p...@pwsan.com CC: Kevin Hilman khil...@deeprootsystems.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 79a8601..dd39e75 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -5077,11 +5077,11 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { omap44xx_mcspi4_hwmod, /* mmc class */ -/* omap44xx_mmc1_hwmod, */ -/* omap44xx_mmc2_hwmod, */ -/* omap44xx_mmc3_hwmod, */ -/* omap44xx_mmc4_hwmod, */ -/* omap44xx_mmc5_hwmod, */ + omap44xx_mmc1_hwmod, + omap44xx_mmc2_hwmod, + omap44xx_mmc3_hwmod, + omap44xx_mmc4_hwmod, + omap44xx_mmc5_hwmod, /* mpu class */ omap44xx_mpu_hwmod, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/5] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Benoit Cousson b-cous...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 146 1 files changed, 146 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 7ba688a..4d45b7d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -49,6 +49,8 @@ static struct omap_hwmod omap2430_dma_system_hwmod; static struct omap_hwmod omap2430_mcspi1_hwmod; static struct omap_hwmod omap2430_mcspi2_hwmod; static struct omap_hwmod omap2430_mcspi3_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -232,6 +234,42 @@ static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = { omap2430_l4_core__usbhsotg, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs2_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -240,6 +278,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -1230,6 +1270,110 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = { +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks = mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 2, + .module_bit = OMAP2430_EN_MMCHS1_SHIFT, + .idlest_reg_id = 2, + .idlest_idle_bit = OMAP2430_ST_MMCHS1_SHIFT, + }, + }, + .slaves = omap2430_mmc1_slaves, + .slaves_cnt
Re: [PATCH] omap: hsmmc: fix ocr mask usage
On Mon, Feb 21, 2011 at 11:37 AM, Anand Gadiyar gadi...@ti.com wrote: The OMAP HSMMC driver uses an ocr_mask to determine the list of voltages supported by the card. It populates this mask based on the list of voltages supported by the regulator that supplies the voltage. Commit 64be97822b (omap4 hsmmc: Update ocr mask for MMC2 for regulator to use) passed a fixed ocr_mask from the OMAP4 SDP board file to limit the voltage to 2.9-3.0 Volts, and updated the driver to use this mask if provided, instead of using the regulator's supported voltages. However the commit is buggy - the ocr_mask is overridden by the regulator's capabilities anyway. Fix this. (The bug shows up when a system-wide suspend is attempted on the OMAP4 SDP/Blaze platforms. The eMMC card comes up at 3V, but drops to 1.65V after the system resumes). Signed-off-by: Anand Gadiyar gadi...@ti.com Tested this patch on OMAP4430SDP OMAP4 Blaze. Tested-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Chris Ball c...@laptop.org --- Tony, Chris, This is only a partial fix. It fixes the obvious bug introduced in the commit I noted above, however it is not the final fix. I'm not convinced the way the regulators are handled in this driver is correct - I'm still studying the code and will come up with a proper fix later. However, this does fix a real bug and I believe the bug is obvious. Would be nice to get this into the -rc series if we still can. - Anand drivers/mmc/host/omap_hsmmc.c | 1 - 1 file changed, 1 deletion(-) Index: linux-2.6/drivers/mmc/host/omap_hsmmc.c === --- linux-2.6.orig/drivers/mmc/host/omap_hsmmc.c +++ linux-2.6/drivers/mmc/host/omap_hsmmc.c @@ -413,7 +413,6 @@ static int omap_hsmmc_reg_get(struct oma return -EINVAL; } } - mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg); /* Allow an aux regulator */ reg = regulator_get(host-dev, vmmc_aux); -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/5] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. Also update the device attribute structure. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 155 1 files changed, 155 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 8ecfbcd..166391d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -18,6 +18,7 @@ #include plat/serial.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -45,6 +46,8 @@ static struct omap_hwmod omap2430_gpio3_hwmod; static struct omap_hwmod omap2430_gpio4_hwmod; static struct omap_hwmod omap2430_gpio5_hwmod; static struct omap_hwmod omap2430_dma_system_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -189,6 +192,42 @@ static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs2_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -197,6 +236,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -919,6 +960,118 @@ static struct omap_hwmod omap2430_dma_system_hwmod = { .flags = HWMOD_NO_IDLEST, }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1_hwmod, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks = mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD
[PATCH v2 5/5] OMAP: devices: Modify HSMMC device to adapt to hwmod framework
Changes involves: 1) Remove controller reset in devices.c which is taken care by hwmod framework. 2) Removing all base address macro defines. 3) Using omap-device layer to register device and utilizing data from hwmod data file for base address, dma channel number, Irq_number, device attribute. 4) Update the driver to use dev_attr to find whether controller supports dual volt cards. 5) Moving omap_mmc_add api from plat-omap/devices.c to mach-omap1/devices.c Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap1/devices.c | 41 +++ arch/arm/mach-omap2/board-n8x0.c |6 +- arch/arm/mach-omap2/devices.c | 207 +++-- arch/arm/mach-omap2/hsmmc.c |6 +- arch/arm/plat-omap/devices.c | 50 arch/arm/plat-omap/include/plat/mmc.h | 36 ++- drivers/mmc/host/omap_hsmmc.c |4 +- 7 files changed, 100 insertions(+), 250 deletions(-) diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index b0f4c23..eae41b6 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c @@ -72,6 +72,47 @@ static inline void omap_init_mbox(void) { } #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) +#define OMAP_MMC_NR_RES2 + +int __init omap_mmc_add(const char *name, int id, unsigned long base, + unsigned long size, unsigned int irq, + struct omap_mmc_platform_data *data) +{ + struct platform_device *pdev; + struct resource res[OMAP_MMC_NR_RES]; + int ret; + + pdev = platform_device_alloc(name, id); + if (!pdev) + return -ENOMEM; + + memset(res, 0, OMAP_MMC_NR_RES * sizeof(struct resource)); + res[0].start = base; + res[0].end = base + size - 1; + res[0].flags = IORESOURCE_MEM; + res[1].start = irq; + res[1].end = irq; + res[1].flags = IORESOURCE_IRQ; + + ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); + if (ret == 0) + ret = platform_device_add_data(pdev, data, sizeof(*data)); + if (ret) + goto fail; + + ret = platform_device_add(pdev); + if (ret) + goto fail; + + /* return device handle to board setup code */ + data-dev = pdev-dev; + return 0; + +fail: + platform_device_put(pdev); + return ret; +} + static inline void omap1_mmc_mux(struct omap_mmc_platform_data *mmc_controller, int controller_nr) { diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 1cb53bc..5c9cd31 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -594,8 +594,6 @@ static struct omap_mmc_platform_data mmc1_data = { }, }; -static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; - static void __init n8x0_mmc_init(void) { @@ -637,8 +635,8 @@ static void __init n8x0_mmc_init(void) gpio_direction_output(N810_EMMC_VIO_GPIO, 0); } - mmc_data[0] = mmc1_data; - omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); + hsmmc_data[0] = mmc1_data; + omap_hwmod_for_each_by_class(mmc, omap2_init_mmc, NULL); } #else diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index e0f0ef9..80e46b3 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -610,112 +610,6 @@ static inline void omap_init_aes(void) { } /*-*/ -#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) - -#define MMCHS_SYSCONFIG0x0010 -#define MMCHS_SYSCONFIG_SWRESET(1 1) -#define MMCHS_SYSSTATUS0x0014 -#define MMCHS_SYSSTATUS_RESETDONE (1 0) - -static struct platform_device dummy_pdev = { - .dev = { - .bus = platform_bus_type, - }, -}; - -/** - * omap_hsmmc_reset() - Full reset of each HS-MMC controller - * - * Ensure that each MMC controller is fully reset. Controllers - * left in an unknown state (by bootloader) may prevent retention - * or OFF-mode. This is especially important in cases where the - * MMC driver is not enabled, _or_ built as a module. - * - * In order for reset to work, interface, functional and debounce - * clocks must be enabled. The debounce clock comes from func_32k_clk - * and is not under SW control, so we only enable i- and f-clocks. - **/ -static void __init omap_hsmmc_reset(void) -{ - u32 i, nr_controllers; - struct clk *iclk, *fclk; - - if (cpu_is_omap242x()) - return; - - nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC : - (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC); - - for (i = 0; i
[PATCH v2 1/5] OMAP2420: hwmod data: Add HSMMC
Update the omap2420 hwmod data with the HSMMC info. Add a device attribute structure which will be used by the host driver to find whether the HSMMC controller supports DUAL VOLT cards. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 80 arch/arm/plat-omap/include/plat/mmc.h |7 +++ 2 files changed, 87 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index b85c630..19fec6a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -18,6 +18,7 @@ #include plat/serial.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -44,6 +45,7 @@ static struct omap_hwmod omap2420_gpio2_hwmod; static struct omap_hwmod omap2420_gpio3_hwmod; static struct omap_hwmod omap2420_gpio4_hwmod; static struct omap_hwmod omap2420_dma_system_hwmod; +static struct omap_hwmod omap2420_mmc_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -95,6 +97,24 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC interface */ +static struct omap_hwmod_addr_space omap2420_mmc_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c07f, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_core__mmc = { + .master = omap2420_l4_core_hwmod, + .slave = omap2420_mmc_hwmod, + .clk= mmc_ick, + .addr = omap2420_mmc_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_mmc_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap2420_uart1_addr_space[] = { { @@ -196,6 +216,7 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { omap2420_l4_core__l4_wkup, + omap2420_l4_core__mmc, omap2_l4_core__uart1, omap2_l4_core__uart2, omap2_l4_core__uart3, @@ -864,6 +885,64 @@ static struct omap_hwmod omap2420_dma_system_hwmod = { .flags = HWMOD_NO_IDLEST, }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x3c, + .sysc_offs = 0x64, + .syss_offs = 0x68, + .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr mmc_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC_RX */ +}; + +static struct omap_hwmod_ocp_if *omap2420_mmc_slaves[] = { + omap2420_l4_core__mmc, +}; + +static struct omap_hwmod omap2420_mmc_hwmod = { + .name = mmc_hwmod, + .mpu_irqs = mmc_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc_mpu_irqs), + .sdma_reqs = mmc_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc_sdma_reqs), + .main_clk = mmc_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 1, + .module_bit = OMAP2420_EN_MMC_SHIFT, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT, + }, + }, + .slaves = omap2420_mmc_slaves, + .slaves_cnt = ARRAY_SIZE(omap2420_mmc_slaves), + .class = mmc_class, + .dev_attr = mmc_dev_attr, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_l3_main_hwmod, omap2420_l4_core_hwmod, @@ -871,6 +950,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_mpu_hwmod, omap2420_iva_hwmod, omap2420_wd_timer2_hwmod, + omap2420_mmc_hwmod, omap2420_uart1_hwmod, omap2420_uart2_hwmod, omap2420_uart3_hwmod, diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index f57f36a..7821344 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -43,6
[PATCH v2 3/5] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 221 arch/arm/mach-omap2/prcm-common.h |2 + arch/arm/mach-omap2/prm-regbits-34xx.h |4 + 3 files changed, 227 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 8d81813..47ca2ee 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -21,6 +21,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include omap_hwmod_common_data.h @@ -107,6 +108,9 @@ static struct omap_hwmod omap3xxx_uart1_hwmod; static struct omap_hwmod omap3xxx_uart2_hwmod; static struct omap_hwmod omap3xxx_uart3_hwmod; static struct omap_hwmod omap3xxx_uart4_hwmod; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -301,6 +305,63 @@ static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = { .user = OCP_USER_MPU, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = { omap3xxx_l3_main__l4_core, @@ -1356,11 +1417,171 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1), }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves
[PATCH v2 0/5] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2420/OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework V2: --- Updated hwmod data for OMAP2420 OMAP2430. The patch series is rebased on v2.6.38-rc4 and tested on OMAP4430SDP, OMAP3430SDP OMAP2430SDP. For OMAP2430SDP validation, the patch series has dependency on https://patchwork.kernel.org/patch/538301/ Testing on N8x0 is pending due to unavailability of working ones. Will be thankful if some body test this series on N8x0. V1: --- http://www.spinics.net/lists/linux-mmc/msg05689.html Kishore Kadiyala (2): OMAP2420: hwmod data: Add HSMMC OMAP: devices: Modify HSMMC device to adapt to hwmod framework Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC Benoit Cousson (1): OMAP4: hwmod data: Add HSMMC arch/arm/mach-omap1/devices.c | 41 arch/arm/mach-omap2/board-n8x0.c |6 +- arch/arm/mach-omap2/devices.c | 207 - arch/arm/mach-omap2/hsmmc.c|6 +- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 80 +++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 155 + arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 221 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 339 arch/arm/mach-omap2/prcm-common.h |2 + arch/arm/mach-omap2/prm-regbits-34xx.h |4 + arch/arm/plat-omap/devices.c | 50 arch/arm/plat-omap/include/plat/mmc.h | 43 ++--- drivers/mmc/host/omap_hsmmc.c |4 +- 13 files changed, 908 insertions(+), 250 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/5] OMAP4: hwmod data: Add HSMMC
From: Benoit Cousson b-cous...@ti.com Update the omap4 hwmod data with the HSMMC info. Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 339 1 files changed, 339 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index c2806bd..ec46835 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -24,6 +24,7 @@ #include plat/cpu.h #include plat/gpio.h #include plat/dma.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -53,6 +54,8 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod; static struct omap_hwmod omap44xx_l4_cfg_hwmod; static struct omap_hwmod omap44xx_l4_per_hwmod; static struct omap_hwmod omap44xx_l4_wkup_hwmod; +static struct omap_hwmod omap44xx_mmc1_hwmod; +static struct omap_hwmod omap44xx_mmc2_hwmod; static struct omap_hwmod omap44xx_mpu_hwmod; static struct omap_hwmod omap44xx_mpu_private_hwmod; @@ -229,6 +232,22 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* mmc1 - l3_main_1 */ +static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = { + .master = omap44xx_mmc1_hwmod, + .slave = omap44xx_l3_main_1_hwmod, + .clk= l3_div_ck, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mmc2 - l3_main_1 */ +static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = { + .master = omap44xx_mmc2_hwmod, + .slave = omap44xx_l3_main_1_hwmod, + .clk= l3_div_ck, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* mpu - l3_main_1 */ static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = { .master = omap44xx_mpu_hwmod, @@ -242,6 +261,8 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_main_1_slaves[] = { omap44xx_dsp__l3_main_1, omap44xx_l3_main_2__l3_main_1, omap44xx_l4_cfg__l3_main_1, + omap44xx_mmc1__l3_main_1, + omap44xx_mmc2__l3_main_1, omap44xx_mpu__l3_main_1, }; @@ -1435,6 +1456,317 @@ static struct omap_hwmod omap44xx_iva_hwmod = { }; /* + * 'mmc' class + * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller + */ + +static struct omap_hwmod_class_sysconfig omap44xx_mmc_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE | + SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE | + SYSC_HAS_SOFTRESET), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | + MSTANDBY_SMART), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { + .name = mmc, + .sysc = omap44xx_mmc_sysc, +}; + +/* mmc1 */ +static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { + { .irq = 83 + OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 60 + OMAP44XX_DMA_REQ_START }, + { .name = rx, .dma_req = 61 + OMAP44XX_DMA_REQ_START }, +}; + +/* mmc1 master ports */ +static struct omap_hwmod_ocp_if *omap44xx_mmc1_masters[] = { + omap44xx_mmc1__l3_main_1, +}; + +static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c3ff, + .flags = ADDR_TYPE_RT + }, +}; + +/* l4_per - mmc1 */ +static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = { + .master = omap44xx_l4_per_hwmod, + .slave = omap44xx_mmc1_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_mmc1_addrs, + .addr_cnt = ARRAY_SIZE(omap44xx_mmc1_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mmc1 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = { + omap44xx_l4_per__mmc1, +}; + +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod omap44xx_mmc1_hwmod = { + .name = mmc1, + .class = omap44xx_mmc_hwmod_class, + .mpu_irqs = omap44xx_mmc1_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_mmc1_irqs), + .sdma_reqs = omap44xx_mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_mmc1_sdma_reqs), + .main_clk = mmc1_fck, + .prcm = { + .omap4 = { + .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, + }, + }, + .slaves = omap44xx_mmc1_slaves
[PATCH 0/5] OMAP: HSMMC: hwmod adaptation
Adding hwmod data for hsmmc device on OMAP2420/OMAP2430/OMAP3/OMAP4. Adapting the omap_hsmmc driver to hwmod framework. The patch series is based on v2.6.38-rc3 and tested on OMAP4430SDP OMAP3430SDP. Testing pending on OMAP2420SDP OMAP2430SDP since mmc/sd cards are not getting detected. Currently omap2_hsmmc_init call is missing in the board files, but updating it is not helping though. Investigation is under progress and any pointers on working version of MMC/SD on OMAP2420/2430 SDP would be helpful. Kishore Kadiyala (2): OMAP2420: hwmod data: Add HSMMC OMAP: devices: Modify HSMMC device to adapt to hwmod framework Paul Walmsley (2): OMAP2430: hwmod data: Add HSMMC OMAP3: hwmod data: Add HSMMC Benoit Cousson (1): OMAP4: hwmod data: Add HSMMC arch/arm/mach-omap1/devices.c | 41 arch/arm/mach-omap2/board-n8x0.c |6 +- arch/arm/mach-omap2/devices.c | 207 - arch/arm/mach-omap2/hsmmc.c|6 +- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 88 +++ arch/arm/mach-omap2/omap_hwmod_2430_data.c | 155 + arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 221 ++ arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 339 arch/arm/mach-omap2/prcm-common.h |2 + arch/arm/mach-omap2/prm-regbits-34xx.h |4 + arch/arm/plat-omap/devices.c | 50 arch/arm/plat-omap/include/plat/mmc.h | 43 ++--- drivers/mmc/host/omap_hsmmc.c |4 +- 13 files changed, 916 insertions(+), 250 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] OMAP2420: hwmod data: Add HSMMC
Update the omap2420 hwmod data with the HSMMC info. Add a device attribute structure which will be used by the host driver to find whether the HSMMC controller supports DUAL VOLT cards. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2420_data.c | 88 arch/arm/plat-omap/include/plat/mmc.h |7 ++ 2 files changed, 95 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index b85c630..1fbb618 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c @@ -18,6 +18,7 @@ #include plat/serial.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -44,6 +45,7 @@ static struct omap_hwmod omap2420_gpio2_hwmod; static struct omap_hwmod omap2420_gpio3_hwmod; static struct omap_hwmod omap2420_gpio4_hwmod; static struct omap_hwmod omap2420_dma_system_hwmod; +static struct omap_hwmod omap2420_mmc1_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { @@ -95,6 +97,24 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2420_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c07f, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2420_l4_core__mmc1 = { + .master = omap2420_l4_core_hwmod, + .slave = omap2420_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2420_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2420_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* L4 CORE - UART1 interface */ static struct omap_hwmod_addr_space omap2420_uart1_addr_space[] = { { @@ -196,6 +216,7 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = { omap2420_l4_core__l4_wkup, + omap2420_l4_core__mmc1, omap2_l4_core__uart1, omap2_l4_core__uart2, omap2_l4_core__uart3, @@ -864,6 +885,72 @@ static struct omap_hwmod omap2420_dma_system_hwmod = { .flags = HWMOD_NO_IDLEST, }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x3c, + .sysc_offs = 0x64, + .syss_offs = 0x68, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2420_mmc1_slaves[] = { + omap2420_l4_core__mmc1, +}; + +static struct omap_hwmod omap2420_mmc1_hwmod = { + .name = mmc1_hwmod, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks = mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD, + .prcm_reg_id = 1, + .module_bit = OMAP2420_EN_MMC_SHIFT, + .idlest_reg_id = 1, + .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT, + }, + }, + .slaves = omap2420_mmc1_slaves, + .slaves_cnt = ARRAY_SIZE(omap2420_mmc1_slaves), + .class = mmc_class, + .dev_attr = mmc1_dev_attr, + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), +}; + static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_l3_main_hwmod, omap2420_l4_core_hwmod, @@ -871,6 +958,7 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { omap2420_mpu_hwmod, omap2420_iva_hwmod
[PATCH 3/5] OMAP3: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap3 hwmod data with the HSMMC info. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 221 arch/arm/mach-omap2/prcm-common.h |2 + arch/arm/mach-omap2/prm-regbits-34xx.h |4 + 3 files changed, 227 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 8d81813..47ca2ee 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -21,6 +21,7 @@ #include plat/l4_3xxx.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include plat/smartreflex.h #include omap_hwmod_common_data.h @@ -107,6 +108,9 @@ static struct omap_hwmod omap3xxx_uart1_hwmod; static struct omap_hwmod omap3xxx_uart2_hwmod; static struct omap_hwmod omap3xxx_uart3_hwmod; static struct omap_hwmod omap3xxx_uart4_hwmod; +static struct omap_hwmod omap3xxx_mmc1_hwmod; +static struct omap_hwmod omap3xxx_mmc2_hwmod; +static struct omap_hwmod omap3xxx_mmc3_hwmod; /* L4_CORE - L4_WKUP interface */ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = { @@ -301,6 +305,63 @@ static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = { .user = OCP_USER_MPU, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap3xxx_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc2_hwmod, + .clk= mmchs2_ick, + .addr = omap3xxx_mmc2_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + +/* L4 CORE - MMC3 interface */ +static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = { + { + .pa_start = 0x480ad000, + .pa_end = 0x480ad1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = { + .master = omap3xxx_l4_core_hwmod, + .slave = omap3xxx_mmc3_hwmod, + .clk= mmchs3_ick, + .addr = omap3xxx_mmc3_addr_space, + .addr_cnt = ARRAY_SIZE(omap3xxx_mmc3_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, + .flags = OMAP_FIREWALL_L4 +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = { omap3xxx_l3_main__l4_core, @@ -1356,11 +1417,171 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3630ES1), }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83, }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61, }, + { .name = rx, .dma_req = 62, }, +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = omap_32k_fck, }, +}; + +static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves
[PATCH 4/5] OMAP4: hwmod data: Add HSMMC
From: Benoit Cousson b-cous...@ti.com Update the omap4 hwmod data with the HSMMC info. Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 339 1 files changed, 339 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index c2806bd..ec46835 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -24,6 +24,7 @@ #include plat/cpu.h #include plat/gpio.h #include plat/dma.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -53,6 +54,8 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod; static struct omap_hwmod omap44xx_l4_cfg_hwmod; static struct omap_hwmod omap44xx_l4_per_hwmod; static struct omap_hwmod omap44xx_l4_wkup_hwmod; +static struct omap_hwmod omap44xx_mmc1_hwmod; +static struct omap_hwmod omap44xx_mmc2_hwmod; static struct omap_hwmod omap44xx_mpu_hwmod; static struct omap_hwmod omap44xx_mpu_private_hwmod; @@ -229,6 +232,22 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* mmc1 - l3_main_1 */ +static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = { + .master = omap44xx_mmc1_hwmod, + .slave = omap44xx_l3_main_1_hwmod, + .clk= l3_div_ck, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mmc2 - l3_main_1 */ +static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = { + .master = omap44xx_mmc2_hwmod, + .slave = omap44xx_l3_main_1_hwmod, + .clk= l3_div_ck, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* mpu - l3_main_1 */ static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = { .master = omap44xx_mpu_hwmod, @@ -242,6 +261,8 @@ static struct omap_hwmod_ocp_if *omap44xx_l3_main_1_slaves[] = { omap44xx_dsp__l3_main_1, omap44xx_l3_main_2__l3_main_1, omap44xx_l4_cfg__l3_main_1, + omap44xx_mmc1__l3_main_1, + omap44xx_mmc2__l3_main_1, omap44xx_mpu__l3_main_1, }; @@ -1435,6 +1456,317 @@ static struct omap_hwmod omap44xx_iva_hwmod = { }; /* + * 'mmc' class + * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller + */ + +static struct omap_hwmod_class_sysconfig omap44xx_mmc_sysc = { + .rev_offs = 0x, + .sysc_offs = 0x0010, + .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE | + SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE | + SYSC_HAS_SOFTRESET), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | + MSTANDBY_SMART), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap44xx_mmc_hwmod_class = { + .name = mmc, + .sysc = omap44xx_mmc_sysc, +}; + +/* mmc1 */ +static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = { + { .irq = 83 + OMAP44XX_IRQ_GIC_START }, +}; + +static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 60 + OMAP44XX_DMA_REQ_START }, + { .name = rx, .dma_req = 61 + OMAP44XX_DMA_REQ_START }, +}; + +/* mmc1 master ports */ +static struct omap_hwmod_ocp_if *omap44xx_mmc1_masters[] = { + omap44xx_mmc1__l3_main_1, +}; + +static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c3ff, + .flags = ADDR_TYPE_RT + }, +}; + +/* l4_per - mmc1 */ +static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = { + .master = omap44xx_l4_per_hwmod, + .slave = omap44xx_mmc1_hwmod, + .clk= l4_div_ck, + .addr = omap44xx_mmc1_addrs, + .addr_cnt = ARRAY_SIZE(omap44xx_mmc1_addrs), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* mmc1 slave ports */ +static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = { + omap44xx_l4_per__mmc1, +}; + +static struct mmc_dev_attr omap_mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod omap44xx_mmc1_hwmod = { + .name = mmc1, + .class = omap44xx_mmc_hwmod_class, + .mpu_irqs = omap44xx_mmc1_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_mmc1_irqs), + .sdma_reqs = omap44xx_mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(omap44xx_mmc1_sdma_reqs), + .main_clk = mmc1_fck, + .prcm = { + .omap4 = { + .clkctrl_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL, + }, + }, + .slaves = omap44xx_mmc1_slaves
[PATCH 2/5] OMAP2430: hwmod data: Add HSMMC
From: Paul Walmsley p...@pwsan.com Update the omap2430 hwmod data with the HSMMC info. Also update the device attribute structure. Signed-off-by: Paul Walmsley p...@pwsan.com Signed-off-by: Kevin Hilman khil...@deeprootsystems.com Signed-off-by: Rajendra Nayak rna...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/omap_hwmod_2430_data.c | 155 1 files changed, 155 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 8ecfbcd..1fbc5c4 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c @@ -18,6 +18,7 @@ #include plat/serial.h #include plat/i2c.h #include plat/gpio.h +#include plat/mmc.h #include omap_hwmod_common_data.h @@ -45,6 +46,8 @@ static struct omap_hwmod omap2430_gpio3_hwmod; static struct omap_hwmod omap2430_gpio4_hwmod; static struct omap_hwmod omap2430_gpio5_hwmod; static struct omap_hwmod omap2430_dma_system_hwmod; +static struct omap_hwmod omap2430_mmc1_hwmod; +static struct omap_hwmod omap2430_mmc2_hwmod; /* L3 - L4_CORE interface */ static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { @@ -189,6 +192,42 @@ static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* L4 CORE - MMC1 interface */ +static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { + { + .pa_start = 0x4809c000, + .pa_end = 0x4809c1ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc1_hwmod, + .clk= mmchs1_ick, + .addr = omap2430_mmc1_addr_space, + .addr_cnt = ARRAY_SIZE(omap2430_mmc1_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +/* L4 CORE - MMC2 interface */ +static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = { + { + .pa_start = 0x480b4000, + .pa_end = 0x480b41ff, + .flags = ADDR_TYPE_RT, + }, +}; + +static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = { + .master = omap2430_l4_core_hwmod, + .slave = omap2430_mmc2_hwmod, + .addr = omap2430_mmc2_addr_space, + .clk= mmchs1_ick, + .addr_cnt = ARRAY_SIZE(omap2430_mmc2_addr_space), + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* Slave interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { omap2430_l3_main__l4_core, @@ -197,6 +236,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = { /* Master interfaces on the L4_CORE interconnect */ static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = { omap2430_l4_core__l4_wkup, + omap2430_l4_core__mmc1, + omap2430_l4_core__mmc2, }; /* L4 CORE */ @@ -919,6 +960,118 @@ static struct omap_hwmod omap2430_dma_system_hwmod = { .flags = HWMOD_NO_IDLEST, }; +/* MMC/SD/SDIO common */ + +static struct omap_hwmod_class_sysconfig mmc_sysc = { + .rev_offs = 0x1fc, + .sysc_offs = 0x10, + .syss_offs = 0x14, + .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | + SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | + SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), + .sysc_fields= omap_hwmod_sysc_type1, +}; + +static struct omap_hwmod_class mmc_class = { + .name = mmc, + .sysc = mmc_sysc, +}; + +/* MMC/SD/SDIO1 */ + +static struct mmc_dev_attr mmc1_dev_attr = { + .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, +}; + +static struct omap_hwmod_irq_info mmc1_mpu_irqs[] = { + { .irq = 83 }, +}; + +static struct omap_hwmod_dma_info mmc1_sdma_reqs[] = { + { .name = tx, .dma_req = 61 }, /* DMA_MMC1_TX */ + { .name = rx, .dma_req = 62 }, /* DMA_MMC1_RX */ +}; + +static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { + { .role = dbck, .clk = mmchsdb_fck }, +}; + +static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = { + omap2430_l4_core__mmc1, +}; + +static struct omap_hwmod omap2430_mmc1_hwmod = { + .name = mmc1_hwmod, + .mpu_irqs = mmc1_mpu_irqs, + .mpu_irqs_cnt = ARRAY_SIZE(mmc1_mpu_irqs), + .sdma_reqs = mmc1_sdma_reqs, + .sdma_reqs_cnt = ARRAY_SIZE(mmc1_sdma_reqs), + .opt_clks = mmc1_opt_clks, + .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks), + .main_clk = mmchs1_fck, + .prcm = { + .omap2 = { + .module_offs = CORE_MOD
[PATCH 0/4] omap4: hsmmc: Adding ADMA support
This patch series adds support for ADMA on MMC1 MMC2 controllers on OMAP4. There is no performance improvement observed using ADMA over SDMA. Advantage using ADMA could be reducing contention over SDMA. Also the series includes some cleanup. The series is based on 2.6.37-rc8 and tested on OMAP4430SDP OMAP3430SDP. Kishore Kadiyala (4): omap: hsmmc: Rename use_dma to xfer_type and define possible transfers omap: hsmmc: Rename and cleanup omap_hsmmc_dma_cleanup omap4: hsmmc: Adding ADMA support for MMC1 MMC2 controllers omap4: hsmmc: enable ADMA for MMC1 MMC2 arch/arm/mach-omap2/hsmmc.c | 13 ++- arch/arm/plat-omap/include/plat/mmc.h |1 + drivers/mmc/host/omap_hsmmc.c | 241 +++-- 3 files changed, 210 insertions(+), 45 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] omap: hsmmc: Rename use_dma to xfer_type and define possible transfers
OMAP4 introduces dedicated internal DMA which is ADMA for its MMC controllers HSMMC1 HSMMC2. Renaming use_dma member of the struct omap_hsmmc_host to xfer_type and defining the transfer modes PIO/SDMA/ADMA that can be used by the MMC controller. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Reviewed-by: Sukumar Ghorai s-gho...@ti.com --- drivers/mmc/host/omap_hsmmc.c | 20 +--- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5d46021..8fb8586 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -125,6 +125,11 @@ #define OMAP_MMC_SLEEP_TIMEOUT 1000 #define OMAP_MMC_OFF_TIMEOUT 8000 +/* Transfer Modes used by MMC controller */ +#defineOMAP_HSMMC_USE_PIO_XFER 0 +#defineOMAP_HSMMC_USE_SDMA_XFER1 +#defineOMAP_HSMMC_USE_ADMA_XFER2 + /* * One controller can have multiple slots, like on some omap boards using * omap.c controller driver. Luckily this is not currently done on any known @@ -172,7 +177,8 @@ struct omap_hsmmc_host { u32 bytesleft; int suspended; int irq; - int use_dma, dma_ch; + int dma_ch; + int xfer_type; /* Transfer can be PIO/SDMA/ADMA */ int dma_line_tx, dma_line_rx; int slot_id; int got_dbclk; @@ -545,7 +551,7 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host, { unsigned int irq_mask; - if (host-use_dma) + if (host-xfer_type != OMAP_HSMMC_USE_PIO_XFER) irq_mask = INT_EN_MASK ~(BRR_ENABLE | BWR_ENABLE); else irq_mask = INT_EN_MASK; @@ -835,7 +841,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, cmdreg = ~(DDIR); } - if (host-use_dma) + if (host-xfer_type != OMAP_HSMMC_USE_PIO_XFER) cmdreg |= DMA_EN; host-req_in_progress = 1; @@ -864,7 +870,7 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req omap_hsmmc_disable_irq(host); /* Do not complete the request if DMA is still in progress */ - if (mrq-data host-use_dma dma_ch != -1) + if (mrq-data host-xfer_type dma_ch != -1) return; host-mrq = NULL; mmc_request_done(host-mmc, mrq); @@ -942,7 +948,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) host-dma_ch = -1; spin_unlock(host-irq_lock); - if (host-use_dma dma_ch != -1) { + if (host-xfer_type dma_ch != -1) { dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, host-dma_len, omap_hsmmc_get_dma_dir(host, host-data)); omap_free_dma(dma_ch); @@ -1451,7 +1457,7 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req) | (req-data-blocks 16)); set_data_timeout(host, req-data-timeout_ns, req-data-timeout_clks); - if (host-use_dma) { + if (host-xfer_type) { ret = omap_hsmmc_start_dma_transfer(host, req); if (ret != 0) { dev_dbg(mmc_dev(host-mmc), MMC start dma failure\n); @@ -2050,7 +2056,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host-mmc = mmc; host-pdata = pdata; host-dev = pdev-dev; - host-use_dma = 1; + host-xfer_type = OMAP_HSMMC_USE_SDMA_XFER; host-dev-dma_mask = pdata-dma_mask; host-dma_ch= -1; host-irq = irq; -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] omap: hsmmc: Rename and cleanup omap_hsmmc_dma_cleanup
Renaming omap_hsmmc_dma_cleanup as omap_hsmmc_xfer_cleanup and doing some cleanup by handling the error success scenarios during a transfer for different xfer_type. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Reviewed-by: Sukumar Ghorai s-gho...@ti.com --- drivers/mmc/host/omap_hsmmc.c | 52 ++-- 1 files changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 8fb8586..7cf0383 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -935,25 +935,37 @@ omap_hsmmc_cmd_done(struct omap_hsmmc_host *host, struct mmc_command *cmd) } /* - * DMA clean up for command errors + * SDMA clean up during SDMA transfers. + * Also unmapping of sg list in case of error/transfer done during + * SDMA/ADMA transfers. */ -static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) +static void omap_hsmmc_xfer_cleanup(struct omap_hsmmc_host *host, int errno) { int dma_ch; + struct mmc_data *data = errno ? host-data : host-mrq-data; - host-data-error = errno; - - spin_lock(host-irq_lock); - dma_ch = host-dma_ch; - host-dma_ch = -1; - spin_unlock(host-irq_lock); - - if (host-xfer_type dma_ch != -1) { - dma_unmap_sg(mmc_dev(host-mmc), host-data-sg, host-dma_len, - omap_hsmmc_get_dma_dir(host, host-data)); + switch (host-xfer_type) { + case OMAP_HSMMC_USE_SDMA_XFER: + spin_lock(host-irq_lock); + dma_ch = host-dma_ch; + host-dma_ch = -1; + spin_unlock(host-irq_lock); + if (dma_ch != -1) + dma_unmap_sg(mmc_dev(host-mmc), data-sg, + host-dma_len, + omap_hsmmc_get_dma_dir(host, data)); omap_free_dma(dma_ch); + break; + case OMAP_HSMMC_USE_PIO_XFER: + /* TODO */ + break; + default: + dev_dbg(mmc_dev(host-mmc), Unknown xfer_type\n); + } + if (errno) { + host-data-error = errno; + host-data = NULL; } - host-data = NULL; } /* @@ -1059,7 +1071,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status) } if (host-data || host-response_busy) { if (host-data) - omap_hsmmc_dma_cleanup(host, + omap_hsmmc_xfer_cleanup(host, -ETIMEDOUT); host-response_busy = 0; omap_hsmmc_reset_controller_fsm(host, SRD); @@ -1072,7 +1084,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status) -ETIMEDOUT : -EILSEQ; if (host-data) - omap_hsmmc_dma_cleanup(host, err); + omap_hsmmc_xfer_cleanup(host, err); else host-mrq-cmd-error = err; host-response_busy = 0; @@ -1310,7 +1322,7 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) { struct omap_hsmmc_host *host = cb_data; struct mmc_data *data = host-mrq-data; - int dma_ch, req_in_progress; + int req_in_progress; if (!(ch_status OMAP_DMA_BLOCK_IRQ)) { dev_warn(mmc_dev(host-mmc), unexpected dma status %x\n, @@ -1332,16 +1344,10 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *cb_data) spin_unlock(host-irq_lock); return; } - - dma_unmap_sg(mmc_dev(host-mmc), data-sg, host-dma_len, - omap_hsmmc_get_dma_dir(host, data)); - req_in_progress = host-req_in_progress; - dma_ch = host-dma_ch; - host-dma_ch = -1; spin_unlock(host-irq_lock); - omap_free_dma(dma_ch); + omap_hsmmc_xfer_cleanup(host, 0); /* If DMA has finished after TC, complete the request */ if (!req_in_progress) { -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] omap4: hsmmc: Adding ADMA support for MMC1 MMC2 controllers
On OMAP4, MMC1 MMC2 controllers support ADMA feature which will provide direct access to internal data. Basically ADMA is a DMA controller embedded in the MMC controller. It fetches each descriptor line [address+length+attributes] from a descriptor table and executes the corresponding action [based on attributes]. Base address of Descriptor table in stored in MMCHS_ADMASAL register. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Signed-off-by: Venkatraman S svenk...@ti.com Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com Reviewed-by: Sukumar Ghorai s-gho...@ti.com --- arch/arm/plat-omap/include/plat/mmc.h |1 + drivers/mmc/host/omap_hsmmc.c | 223 +++-- 2 files changed, 184 insertions(+), 40 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index f57f36a..b13e927 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -110,6 +110,7 @@ struct omap_mmc_platform_data { /* we can put the features above into this variable */ #define HSMMC_HAS_PBIAS(1 0) #define HSMMC_HAS_UPDATED_RESET(1 1) +#define HSMMC_HAS_ADMA_SUPPORT (1 2) unsigned features; int switch_pin; /* gpio (card detect) */ diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 7cf0383..aaa113b 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -51,12 +51,15 @@ #define OMAP_HSMMC_RSP54 0x0118 #define OMAP_HSMMC_RSP76 0x011C #define OMAP_HSMMC_DATA0x0120 +#define OMAP_HSMMC_PSTATE 0x0124 #define OMAP_HSMMC_HCTL0x0128 #define OMAP_HSMMC_SYSCTL 0x012C #define OMAP_HSMMC_STAT0x0130 #define OMAP_HSMMC_IE 0x0134 #define OMAP_HSMMC_ISE 0x0138 #define OMAP_HSMMC_CAPA0x0140 +#define OMAP_HSMMC_ADMA_ES 0x0154 +#define OMAP_HSMMC_ADMA_SAL0x0158 #define VS18 (1 26) #define VS30 (1 25) @@ -104,6 +107,25 @@ #define SRD(1 26) #define SOFTRESET (1 1) #define RESETDONE (1 0) +#define DMAS (0x2 3) +#define CAPA_ADMA_SUPPORT (1 19) +#define ADMA_XFER_VALID(1 0) +#define ADMA_XFER_END (1 1) +#define ADMA_XFER_LINK (1 4) +#define ADMA_XFER_DESC (1 5) +#define DMA_MNS_ADMA_MODE (1 20) +#define ADMA_ERR (1 25) +#define ADMA_XFER_INT (1 3) + +#define ADMA_TABLE_SZ (PAGE_SIZE) +#define ADMA_TABLE_NUM_ENTRIES (ADMA_TABLE_SZ / sizeof(struct adma_desc_table)) + +/* + * According to TRM, it is possible to transfer upto 64kB per ADMA table entry. + * But 64kB = 0x1 cannot be represented using a 16bit integer + * in 1 ADMA table row. Hence rounding it to a lesser value. + */ +#define ADMA_MAX_XFER_PER_ROW (63 * 1024) /* * FIXME: Most likely all the data using these _DEVID defines should come @@ -146,6 +168,13 @@ #define OMAP_HSMMC_WRITE(base, reg, val) \ __raw_writel((val), (base) + OMAP_HSMMC_##reg) +/* ADMA descriptor table entry */ +struct adma_desc_table { + u16 attr; + u16 length; + dma_addr_t addr; +}; + struct omap_hsmmc_host { struct device *dev; struct mmc_host*mmc; @@ -179,6 +208,8 @@ struct omap_hsmmc_host { int irq; int dma_ch; int xfer_type; /* Transfer can be PIO/SDMA/ADMA */ + struct adma_desc_table *adma_table; + dma_addr_t phy_adma_table; int dma_line_tx, dma_line_rx; int slot_id; int got_dbclk; @@ -877,6 +908,44 @@ static void omap_hsmmc_request_done(struct omap_hsmmc_host *host, struct mmc_req } /* + * SDMA clean up during SDMA transfers. + * Also unmapping of sg list in case of error/transfer done during + * SDMA/ADMA transfers. + */ +static void omap_hsmmc_xfer_cleanup(struct omap_hsmmc_host *host, int errno) +{ + int dma_ch; + struct mmc_data *data = errno ? host-data : host-mrq-data; + + switch (host-xfer_type) { + case OMAP_HSMMC_USE_SDMA_XFER: + spin_lock(host-irq_lock); + dma_ch = host-dma_ch; + host-dma_ch = -1; + spin_unlock(host-irq_lock); + if (dma_ch != -1) + dma_unmap_sg(mmc_dev(host-mmc), data-sg, + host-dma_len, + omap_hsmmc_get_dma_dir(host, data)); + omap_free_dma(dma_ch); + break; + case OMAP_HSMMC_USE_ADMA_XFER: + dma_unmap_sg(mmc_dev(host-mmc), data-sg, + host-dma_len, omap_hsmmc_get_dma_dir(host, data
[PATCH 4/4] omap4: hsmmc: enable ADMA for MMC1 MMC2
Enable ADMA support for MMC1 MMC2 controller on omap4 by updating features of struct omap_mmc_platform_data. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Signed-off-by: Venkatraman S svenk...@ti.com Reviewed-by: Sukumar Ghorai s-gho...@ti.com --- arch/arm/mach-omap2/hsmmc.c | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 34272e4..2ac7271 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -307,8 +307,17 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) else mmc-slots[0].features |= HSMMC_HAS_PBIAS; - if (cpu_is_omap44xx() (omap_rev() OMAP4430_REV_ES1_0)) - mmc-slots[0].features |= HSMMC_HAS_UPDATED_RESET; + /* +* OMAP4: MMC1 MMC2 controllers support ADMA. +* Default works with SDMA. +* For ADMA support, update respective BIT in features. +*/ + if (cpu_is_omap44xx()) { + mmc-slots[0].features |= HSMMC_HAS_ADMA_SUPPORT; + if (omap_rev() OMAP4430_REV_ES1_0) + mmc-slots[0].features |= + HSMMC_HAS_UPDATED_RESET; + } switch (c-mmc) { case 1: -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] MMC: Proposals on reworking clock and power management
On Fri, Oct 29, 2010 at 2:21 AM, Ohad Ben-Cohen o...@wizery.com wrote: On Thu, Oct 28, 2010 at 6:40 PM, Kishore Kadiyala kishorek.kadiy...@gmail.com wrote: On Thu, Oct 28, 2010 at 9:43 PM, Nicolas Pitre n...@fluxnic.net wrote: This is not clear that this is something that the core can effectively help with. Opportunistic power saving at the host controller level is pretty much hardware dependent and may wildly vary in capabilities... and bugs. So in this later case I think the driver for the host controller is the best place to just set up a timer and gate the clock after a certain period of inactivity for example. makes sense, thanks. Agree, So briefly, calling pm_runtime_put_sync using a activity based timer in the host Controller driver will gate the clock to the controller . Just make sure you call pm_suspend_ignore_children(), because you want to be able to gate that clock even when the card is still active Thanks will have a look into this On idle notification to PM runtime core, which will trigger a call to the runtime_suspend hook in bus.c [https://patchwork.kernel.org/patch/226671/ ] which will perform powering off the Card Kishore, I'm not sure what you meant in the last sentence ? I meant -- put_sync/get_sync [host driver] -- runtime_suspend/runtime_resume --mmc_bus_suspend/resume [core.c] -- card power OFF/ON [thorugh set_ios] Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] MMC: Proposals on reworking clock and power management
Nicolas, snip 2.a) Card sleep, Power cutoff to the card: This should be handled in the core where based on block layer activity, calling corresponding API's from bus layer: mmc_power_save_host/ mmc_power_restore_host Same issue here. Card power is for the core to decide, but the controller driver may perform opportunistic power down of the controller itself when it is possible and the core does not need to know about it. I think card power decision is taken care in the core as per below patch : https://patchwork.kernel.org/patch/226631/ And regarding opportunistic power down of the controller can be done by adapting driver to PM-Runtime snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] MMC: Proposals on reworking clock and power management
On Thu, Oct 28, 2010 at 9:43 PM, Nicolas Pitre n...@fluxnic.net wrote: On Thu, 28 Oct 2010, Ohad Ben-Cohen wrote: On Thu, Oct 28, 2010 at 5:39 PM, Kishore Kadiyala kishorek.kadiy...@gmail.com wrote: Wouldn't adapting the host driver just to PM-Runtime will answer the above issues? It's not enough. When the card is runtime suspended, sure, the host controller will immediately get idle notification by runtime PM core. But you may still want to gate the clock to the host controller on bus inactivity, even if the card is not runtime suspended. The decision to do this should come from the mmc core. This is not clear that this is something that the core can effectively help with. Opportunistic power saving at the host controller level is pretty much hardware dependent and may wildly vary in capabilities... and bugs. So in this later case I think the driver for the host controller is the best place to just set up a timer and gate the clock after a certain period of inactivity for example. Agree, So briefly, calling pm_runtime_put_sync using a activity based timer in the host Controller driver will gate the clock to the controller . On idle notification to PM runtime core, which will trigger a call to the runtime_suspend hook in bus.c [https://patchwork.kernel.org/patch/226671/ ] which will perform powering off the Card Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] MMC: Proposals on reworking clock and power management
On Wed, Oct 27, 2010 at 8:02 PM, Alan Cox a...@lxorguk.ukuu.org.uk wrote: 2. Ideally host-driver driver should not tell the core to shut down the upper layers, instead the core should decide when to disabled clock or cut the power. How will the core know ? I actually think you are simply perpetuating the mess in the existing MMC driver where everything is driven by a core which as a result is a twisty maze of exceptions and flags to say except for this except for that. The core MMC code only knows when the *core* parts are no longer requiring power. It shouldn't know about anything deeper and if you are using the runtime PM layer the runtime PM refcounting can do all your work. Agree Alan, Its better adapting the driver to Runtime PM instead fixing some thing in the core. Regards, Kishore Alan -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Ping !! On Wed, Sep 29, 2010 at 4:11 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Gentle Reminder ! Regards, Kishore On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Hi Samuel, Could you please review this patch which touches mfd/twl6030-irq.c for card detect support of MMC1 controller on OMAP4. Regards, Kishore On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Cc: Samuel Ortiz sa...@linux.intel.com On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala kishore.kadiy...@ti.com wrote: Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 73 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 31 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..2d3bb82 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + /* + * Intially Configuring MMC_CTRL for receving interrupts + * Card status on TWL6030 for MMC1 + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Samuel, Sorry , I will ensure to CC you for MFD related changes in future. Regards, Kishore On Fri, Oct 1, 2010 at 4:59 PM, Samuel Ortiz sa...@linux.intel.com wrote: On Fri, Oct 01, 2010 at 12:29:48PM +0530, kishore kadiyala wrote: Ping !! Applied !! BTW, please add the full patch when you cc me, so that I don't have to dig through patchwork to grab something I can git-am. Cheers, Samuel. On Wed, Sep 29, 2010 at 4:11 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Gentle Reminder ! Regards, Kishore On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Hi Samuel, Could you please review this patch which touches mfd/twl6030-irq.c for card detect support of MMC1 controller on OMAP4. Regards, Kishore On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Cc: Samuel Ortiz sa...@linux.intel.com On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala kishore.kadiy...@ti.com wrote: Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 73 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 31 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..2d3bb82 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + /* + * Intially Configuring MMC_CTRL for receving interrupts + * Card status on TWL6030 for MMC1 + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
On Fri, Oct 1, 2010 at 8:11 PM, Varadarajan, Charulatha ch...@ti.com wrote: snip diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 6de90bf..e64894c 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -141,6 +141,16 @@ #define TWL6030_CHARGER_CTRL_INT_MASK 0x10 #define TWL6030_CHARGER_FAULT_INT_MASK 0x60 +#define TWL6030_MMCCTRL 0xEE +#define VMMC_AUTO_OFF (0x1 3) +#define SW_FC (0x1 2) +#define STS_MMC 0x1 + +#define TWL6030_CFG_INPUT_PUPD3 0xF2 +#define MMC_PU (0x1 3) +#define MMC_PD (0x1 2) + + #define TWL4030_CLASS_ID 0x4030 #define TWL6030_CLASS_ID 0x6030 @@ -173,6 +183,27 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); int twl6030_interrupt_mask(u8 bit_mask, u8 offset); +/* Card detect Configuration for MMC1 Controller on OMAP4 */ +#ifdef CONFIG_TWL4030_CORE +int twl6030_mmc_card_detect_config(void); +#else +static inline int twl6030_mmc_card_detect_config(void) +{ + pr_debug(twl6030_mmc_card_detect_config not supported\n); + return 0; +} +#endif + +/* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */ +#ifdef CONFIG_TWL4030_CORE +int twl6030_mmc_card_detect(struct device *dev, int slot); +#else +static inline int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + pr_debug(Call back twl6030_mmc_card_detect not supported\n); Use dev_dbg() instead of pr_debug... Same comment applies across this patch series whereever pr_err/pr_debug APIs are used. Couldn't get it how it makes a difference ? could you explain Regards, Kishore + return -EIO; +} +#endif snip -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 3/4] omap4 hsmmc: Register offset handling
Manju, On Fri, Oct 1, 2010 at 8:32 PM, G, Manjunath Kondaiah manj...@ti.com wrote: -Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kadiyala, Kishore Sent: Saturday, September 18, 2010 10:04 PM To: linux-mmc@vger.kernel.org; linux-o...@vger.kernel.org; linux-arm-ker...@lists.infradead.org Cc: khil...@deeprootsystems.com; Cousson, Benoit Subject: [PATCH v2 3/4] omap4 hsmmc: Register offset handling The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver. Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver. The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/devices.c | 8 +++- arch/arm/mach-omap2/hsmmc.c | 4 arch/arm/plat-omap/include/plat/mmc.h | 3 +++ drivers/mmc/host/omap_hsmmc.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2dbb265..bb7ec13 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq = OMAP44XX_IRQ_MMC4; break; case 4: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC5_BASE; irq = OMAP44XX_IRQ_MMC5; break; default: @@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size = OMAP2420_MMC_SIZE; name = mmci-omap; } else if (cpu_is_omap44xx()) { - if (i 3) { - base += OMAP4_MMC_REG_OFFSET; + if (i 3) irq += OMAP44XX_IRQ_GIC_START; - } size = OMAP4_HSMMC_SIZE; name = mmci-omap-hs; } else { diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index c8f647b..49d76a7 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc-slots[0].wires = c-wires; mmc-slots[0].internal_clock = !c-ext_clock; mmc-dma_mask = 0x; + if (cpu_is_omap44xx()) + mmc-reg_offset = OMAP4_MMC_REG_OFFSET; + else + mmc-reg_offset = 0; 1. Since you mentioned that, this is useful for hwmod, the register offsets should use enum and static tables. You can refer to i2c-omap.c for more details and dma hwmod review comments for more details. https://patchwork.kernel.org/patch/126251/ I've avoided using static tables for register offset handling as suggested by Benoit for HSMMC driver.Instead had the offset updated in hsmmc.c and used in driver. Could you check the latest version V4 http://www.spinics.net/lists/linux-omap/msg37226.html 2. Replace macros with inline functions for low level read/write functions. Didn't touch this in the latest V4 Regards, Kishore -Manjunath -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Gentle Reminder ! Regards, Kishore On Tue, Sep 28, 2010 at 12:22 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Hi Samuel, Could you please review this patch which touches mfd/twl6030-irq.c for card detect support of MMC1 controller on OMAP4. Regards, Kishore On Mon, Sep 27, 2010 at 1:25 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Cc: Samuel Ortiz sa...@linux.intel.com On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala kishore.kadiy...@ti.com wrote: Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 73 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 31 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..2d3bb82 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + /* + * Intially Configuring MMC_CTRL for receving interrupts + * Card status on TWL6030 for MMC1 + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Hi Tony, On Sat, Sep 25, 2010 at 6:08 AM, Tony Lindgren t...@atomide.com wrote: * kishore kadiyala kishore.kadiy...@ti.com [100924 10:05]: Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c Looks like this patch should be sent to Samuel Ortiz as it's mostly mfd related. Thanks , I will send this patch to Samuel. snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Cc: Samuel Ortiz sa...@linux.intel.com On Fri, Sep 24, 2010 at 10:43 PM, kishore kadiyala kishore.kadiy...@ti.com wrote: Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 73 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 31 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..2d3bb82 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + /* + * Intially Configuring MMC_CTRL for receving interrupts + * Card status on TWL6030 for MMC1 + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config); + +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg = 0; + struct platform_device *pdev = to_platform_device(dev); + + if (pdev-id) { + /* TWL6030 provide's Card detect support for + * only MMC1 controller. + */ + pr_err(Unkown MMC controller
[PATCH v4 0/4] omap4 hsmmc: Card detect and Register offset handling
The patch series is based on mainline 2.6.36-rc5. The series is tested on OMAP3430SDP and OMAP4430SDP and has dependency on http://www.mail-archive.com/linux-o...@vger.kernel.org/msg34718.html V3: http://www.mail-archive.com/linux-o...@vger.kernel.org/msg35423.html V2: http://www.mail-archive.com/linux-o...@vger.kernel.org/msg35135.html V1: http://www.mail-archive.com/linux-o...@vger.kernel.org/msg34040.html Kishore Kadiyala (3): omap4 hsmmc : Adding card detect support for MMC1 omap4 hsmmc: Register offset handling omap4 hsmmc: Update ocr mask for MMC2 for regulator to use Benoit Cousson (1); omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set arch/arm/mach-omap2/board-4430sdp.c | 16 ++- arch/arm/mach-omap2/devices.c |8 +-- arch/arm/mach-omap2/hsmmc.c |4 ++ arch/arm/plat-omap/include/plat/mmc.h |3 + drivers/mfd/twl6030-irq.c | 73 + drivers/mmc/host/omap_hsmmc.c | 18 +++- include/linux/i2c/twl.h | 31 ++ 7 files changed, 144 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/4] omap4 hsmmc: Adding card detect support for MMC1
Adding card detect callback function and card detect configuration function for MMC1 Controller on OMAP4. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, card detect interrupt source is twl6030 which is non-gpio. The card detect call back function provides card present/absent status by reading MMC Control register present on twl6030. Since OMAP4 doesn't use any GPIO line as used in OMAP3 for card detect, the suspend/resume initialization which was done in omap_hsmmc_gpio_init previously is moved to the probe thus making it generic for both OMAP3 OMAP4. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |7 +++- drivers/mfd/twl6030-irq.c | 73 +++ drivers/mmc/host/omap_hsmmc.c |4 +- include/linux/i2c/twl.h | 31 +++ 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..2d3bb82 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,78 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + /* +* Intially Configuring MMC_CTRL for receving interrupts +* Card status on TWL6030 for MMC1 +*/ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config); + +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg = 0; + struct platform_device *pdev = to_platform_device(dev); + + if (pdev-id) { + /* TWL6030 provide's Card detect support for +* only MMC1 controller. +*/ + pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__); + return ret; + } + /* +* BIT0 of MMC_CTRL on TWL6030 provides card status for MMC1 +* 0 - Card not present ,1 - Card present +*/ + ret
[PATCH v4 4/4] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use
On OMAP4, MMC2 controller has eMMC which draws power from VAUX regulator on TWL. Though the eMMC supports dual voltage[1.8v/3v] as per ocr register, its VCC is fixed at 3V for operation. With this once the mmc core selects the minimum voltage[1.8] supported based on the ocr value read from OCR register, eMMC will not get detected. Thus the platform data for MMC2 is updated with ocr mask and same will be communicated to core which will set the regulator to always operate at 3V when ever turned ON. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |1 + drivers/mmc/host/omap_hsmmc.c | 12 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 7978a79..8b0e71a 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -202,6 +202,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd= -EINVAL, .gpio_wp= -EINVAL, .nonremovable = true, + .ocr_mask = MMC_VDD_29_30, }, {} /* Terminator */ }; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 8cb007c..f629acf 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -364,6 +364,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) { struct regulator *reg; int ret = 0; + int ocr_value = 0; switch (host-id) { case OMAP_MMC1_DEVID: @@ -396,6 +397,17 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) } } else { host-vcc = reg; + ocr_value = mmc_regulator_get_ocrmask(reg); + if (!mmc_slot(host).ocr_mask) { + mmc_slot(host).ocr_mask = ocr_value; + } else { + if (!(mmc_slot(host).ocr_mask ocr_value)) { + pr_err(MMC%d ocrmask %x is not supported\n, + host-id, mmc_slot(host).ocr_mask); + mmc_slot(host).ocr_mask = 0; + return -EINVAL; + } + } mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg); /* Allow an aux regulator */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/4] omap4 hsmmc: Register offset handling
In OMAP4, as per new PM programming model, the legacy registers which were there in OMAP3 are all shifted by 0x100 while new one's are added from offset 0 to 0x10. For OMAP4, the register offset appending of 0x100 done in devices.c currently, is moved to driver file.This change fits in for current implementation as well as once the driver undergoes hwmod adaptation. Cc: Tony Lindgren t...@atomide.com Cc: Andrew Morton a...@linux-foundation.org Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/devices.c |8 +++- arch/arm/mach-omap2/hsmmc.c |4 arch/arm/plat-omap/include/plat/mmc.h |3 +++ drivers/mmc/host/omap_hsmmc.c |2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2dbb265..bb7ec13 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq = OMAP44XX_IRQ_MMC4; break; case 4: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC5_BASE; irq = OMAP44XX_IRQ_MMC5; break; default: @@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size = OMAP2420_MMC_SIZE; name = mmci-omap; } else if (cpu_is_omap44xx()) { - if (i 3) { - base += OMAP4_MMC_REG_OFFSET; + if (i 3) irq += OMAP44XX_IRQ_GIC_START; - } size = OMAP4_HSMMC_SIZE; name = mmci-omap-hs; } else { diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index c8f647b..49d76a7 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc-slots[0].wires = c-wires; mmc-slots[0].internal_clock = !c-ext_clock; mmc-dma_mask = 0x; + if (cpu_is_omap44xx()) + mmc-reg_offset = OMAP4_MMC_REG_OFFSET; + else + mmc-reg_offset = 0; mmc-get_context_loss_count = hsmmc_get_context_loss; diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index 9b89ec6..4e6ef07 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -71,6 +71,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Register offset deviation */ + u16 reg_offset; + struct omap_mmc_slot_data { /* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index a51894d..8cb007c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2009,6 +2009,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) if (res == NULL || irq 0) return -ENXIO; + res-start += pdata-reg_offset; + res-end += pdata-reg_offset; res = request_mem_region(res-start, res-end - res-start + 1, pdev-name); if (res == NULL) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/4] omap4 hsmmc: Card detect and Register offset handling
The patch series is based on mainline 2.6.36-rc5. The series is tested on OMAP3430SDP and OMAP4430SDP and has dependency on http://www.mail-archive.com/linux-o...@vger.kernel.org/msg34718.html V2: http://www.mail-archive.com/linux-o...@vger.kernel.org/msg35135.html V1: http://www.mail-archive.com/linux-o...@vger.kernel.org/msg34040.html Kishore Kadiyala (3): omap4 hsmmc : Adding card detect support for MMC1 omap4 hsmmc: Register offset handling omap4 hsmmc: Update ocr mask for MMC2 for regulator to use Benoit Cousson (1); omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set arch/arm/mach-omap2/board-4430sdp.c | 16 ++- arch/arm/mach-omap2/devices.c |8 +-- arch/arm/mach-omap2/hsmmc.c |4 ++ arch/arm/plat-omap/include/plat/mmc.h |3 + drivers/mfd/twl6030-irq.c | 72 + drivers/mmc/host/omap_hsmmc.c | 18 +++- include/linux/i2c/twl.h | 31 ++ 7 files changed, 143 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/4] omap4 hsmmc: Register offset handling
In OMAP4, as per new PM programming model, the legacy registers which were there in OMAP3 are all shifted by 0x100 while new one's are added from offset 0 to 0x10. For OMAP4, the register offset appending of 0x100 done in devices.c currently, is moved to driver file.This change fits in for current implementation as well as once the driver undergoes hwmod adaptation. Cc: Kevin Hilman khil...@deeprootsystems.com Cc: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/devices.c |8 +++- arch/arm/mach-omap2/hsmmc.c |4 arch/arm/plat-omap/include/plat/mmc.h |3 +++ drivers/mmc/host/omap_hsmmc.c |2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2dbb265..bb7ec13 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq = OMAP44XX_IRQ_MMC4; break; case 4: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC5_BASE; irq = OMAP44XX_IRQ_MMC5; break; default: @@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size = OMAP2420_MMC_SIZE; name = mmci-omap; } else if (cpu_is_omap44xx()) { - if (i 3) { - base += OMAP4_MMC_REG_OFFSET; + if (i 3) irq += OMAP44XX_IRQ_GIC_START; - } size = OMAP4_HSMMC_SIZE; name = mmci-omap-hs; } else { diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index c8f647b..49d76a7 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc-slots[0].wires = c-wires; mmc-slots[0].internal_clock = !c-ext_clock; mmc-dma_mask = 0x; + if (cpu_is_omap44xx()) + mmc-reg_offset = OMAP4_MMC_REG_OFFSET; + else + mmc-reg_offset = 0; mmc-get_context_loss_count = hsmmc_get_context_loss; diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index 9b89ec6..4e6ef07 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -71,6 +71,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Register offset deviation */ + u16 reg_offset; + struct omap_mmc_slot_data { /* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index a51894d..8cb007c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2009,6 +2009,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) if (res == NULL || irq 0) return -ENXIO; + res-start += pdata-reg_offset; + res-end += pdata-reg_offset; res = request_mem_region(res-start, res-end - res-start + 1, pdev-name); if (res == NULL) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/4] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use
On OMAP4, MMC2 controller has eMMC which draws power from VAUX regulator on TWL. Though the eMMC supports dual voltage[1.8v/3v] as per ocr register, its VCC is fixed at 3V for operation. With this once the mmc core selects the minimum voltage[1.8] supported based on the ocr value read from OCR register, eMMC will not get detected. Thus the platform data for MMC2 is updated with ocr mask and same will be communicated to core which will set the regulator to always operate at 3V when ever turned ON. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |1 + drivers/mmc/host/omap_hsmmc.c | 12 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index ac8541c..9fd1044 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -202,6 +202,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd= -EINVAL, .gpio_wp= -EINVAL, .nonremovable = true, + .ocr_mask = MMC_VDD_29_30, }, {} /* Terminator */ }; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 8cb007c..f629acf 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -364,6 +364,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) { struct regulator *reg; int ret = 0; + int ocr_value = 0; switch (host-id) { case OMAP_MMC1_DEVID: @@ -396,6 +397,17 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) } } else { host-vcc = reg; + ocr_value = mmc_regulator_get_ocrmask(reg); + if (!mmc_slot(host).ocr_mask) { + mmc_slot(host).ocr_mask = ocr_value; + } else { + if (!(mmc_slot(host).ocr_mask ocr_value)) { + pr_err(MMC%d ocrmask %x is not supported\n, + host-id, mmc_slot(host).ocr_mask); + mmc_slot(host).ocr_mask = 0; + return -EINVAL; + } + } mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg); /* Allow an aux regulator */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/4] omap4 hsmmc: Adding card detect support for MMC1
Hi Hari, On Thu, Sep 23, 2010 at 1:19 AM, Kanigeri, Hari h-kanige...@ti.com wrote: Kishore, +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg = 0; + struct platform_device *pdev = to_platform_device(dev); + + switch (pdev-id) { + case 0: + /* + * BIT0 of REG_MMC_CTRL + * 0 - Card not present ,1 - Card present + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg, + TWL6030_MMCCTRL); + if (ret = 0) + ret = read_reg STS_MMC; + break; nitpick: may be you don't need a switch statement for only one case. From future perspective,since there are 5 MMC controllers on OMAP4 and current patch supports card detect feature only for one controller i.e MMC1 as of now. Once the interfaces connected on the remaining 4 MMC controllers are defined further additions will be required for respective cases. snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 3/4] omap4 hsmmc: Register offset handling
Hi Benoit, On Tue, Sep 21, 2010 at 2:26 AM, Cousson, Benoit b-cous...@ti.com wrote: Hi Kishore On 9/18/2010 6:34 PM, Kadiyala, Kishore wrote: The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver. Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver. That explanation does not sound very accurate to me. The fact that the hwmods are auto-generated has nothing to do with your offset problem. Agree the change log needs to be updated as said but when coming to implementation this how it is: With current mainline kernel, offset appending is already implemented in mach-omap2/devices.c and works fine [here bases are updated with 0x100 and then passed to driver which has same register offset's as OMAP3]. When hwmod modifications are done to the MMC driver, the base address are picked from omap_hwmod_44xx_data.c and omap_device is build. Coming to the driver it still has the same old register offset's as OMAP3 and there should be a way to add 0x100 some where. The current patch moves the offset appending to the driver file which is updated in mach-omap2/hsmmc.c which will fit for current implementation and even hwmod adaptation. The real cause is due to the update of the IP to support the new PM programming model. Because of that, and to keep a certain level of compatibility, the legacy registers were all shifted by 0x100 and the new one were added from offset 0 to 0x10. Regards, Benoit snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/4] omap4 hsmmc: Adding card detect support for MMC1
Adding card detect callback function and card detect configuration function for MMC1 Controller. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, Card detect interrupt source is twl6030 and the card detect call back function provides card present/absent status by reading MMC Control register. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |7 +++- drivers/mfd/twl6030-irq.c | 76 +++ drivers/mmc/host/omap_hsmmc.c |4 +- include/linux/i2c/twl.h | 31 ++ 4 files changed, 115 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..de232b1 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,81 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + if (twl_class_is_6030()) { + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + } + + /* +* Intially Configuring MMC_CTRL for receving interrupts +* Card status on TWL6030 for MMC1 +*/ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + return ret; + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config); + +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg = 0; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + + switch (pdev-id) { + case 0: + /* +* BIT0 of REG_MMC_CTRL +* 0 - Card not present ,1 - Card present +*/ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg, + TWL6030_MMCCTRL); + if (ret = 0) + ret = read_reg STS_MMC; + break; + default: + pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__); + } + return ret; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect); + int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) { diff --git a/drivers/mmc/host/omap_hsmmc.c b
[PATCH v2 2/4] omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set
From: Benoit Cousson b-cous...@ti.com Avoid possible crash if CONFIG_MMC_OMAP_HS is not set Signed-off-by: Benoit Cousson b-cous...@ti.com Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index a49f285..ac8541c 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -240,8 +240,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) { - struct omap_mmc_platform_data *pdata = dev-platform_data; + struct omap_mmc_platform_data *pdata; + /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ + if (!dev) { + pr_err(Failed omap4_twl6030_hsmmc_set_late_init\n); + return; + } + pdata = dev-platform_data; pdata-init = omap4_twl6030_hsmmc_late_init; } -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/4] omap4 hsmmc: Register offset handling
The offset handling implementation of omap4 mmc registers which was already present can't be reused once hwmod modifications are done for mmc driver. Since hwmod data file for OMAP4 is an auto generated the base address for MMC will remain same as OMAP3 and thus the offset deviation of registers should be updated in the hsmmc driver. The omap-mmc platform data is updated with a register offset which will be updated and used in the driver accordingly. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/devices.c |8 +++- arch/arm/mach-omap2/hsmmc.c |4 arch/arm/plat-omap/include/plat/mmc.h |3 +++ drivers/mmc/host/omap_hsmmc.c |2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2dbb265..bb7ec13 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -745,13 +745,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq = OMAP44XX_IRQ_MMC4; break; case 4: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC5_BASE; irq = OMAP44XX_IRQ_MMC5; break; default: @@ -762,10 +762,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size = OMAP2420_MMC_SIZE; name = mmci-omap; } else if (cpu_is_omap44xx()) { - if (i 3) { - base += OMAP4_MMC_REG_OFFSET; + if (i 3) irq += OMAP44XX_IRQ_GIC_START; - } size = OMAP4_HSMMC_SIZE; name = mmci-omap-hs; } else { diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index c8f647b..49d76a7 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -261,6 +261,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc-slots[0].wires = c-wires; mmc-slots[0].internal_clock = !c-ext_clock; mmc-dma_mask = 0x; + if (cpu_is_omap44xx()) + mmc-reg_offset = OMAP4_MMC_REG_OFFSET; + else + mmc-reg_offset = 0; mmc-get_context_loss_count = hsmmc_get_context_loss; diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index 9b89ec6..4e6ef07 100644 --- a/arch/arm/plat-omap/include/plat/mmc.h +++ b/arch/arm/plat-omap/include/plat/mmc.h @@ -71,6 +71,9 @@ struct omap_mmc_platform_data { u64 dma_mask; + /* Register offset deviation */ + u16 reg_offset; + struct omap_mmc_slot_data { /* 4 wire signaling is optional, and is used for SD/SDIO/HSMMC; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index a51894d..bfca9ca 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2034,7 +2034,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host-irq = irq; host-id= pdev-id; host-slot_id = 0; - host-mapbase = res-start; + host-mapbase = res-start + pdata-reg_offset; host-base = ioremap(host-mapbase, SZ_4K); host-power_mode = MMC_POWER_OFF; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/4] omap4 hsmmc: Update ocr mask for MMC2 for regulator to use
On OMAP4, MMC2 controller has eMMC which draws power from VAUX regulator on TWL. Though the eMMC supports dual voltage[1.8v/3v] as per ocr register, its VCC is fixed at 3V for operation. With this once the mmc core selects the minimum voltage supported based on the ocr value read from OCR register, eMMC will not get detected. Thus the platform data for MMC2 is updated with ocr mask and same will be communicated to core which will set the regulator to always operate at 3V when turned ON. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |1 + drivers/mmc/host/omap_hsmmc.c | 12 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index ac8541c..9fd1044 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -202,6 +202,7 @@ static struct omap2_hsmmc_info mmc[] = { .gpio_cd= -EINVAL, .gpio_wp= -EINVAL, .nonremovable = true, + .ocr_mask = MMC_VDD_29_30, }, {} /* Terminator */ }; diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index bfca9ca..00d16d1 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -364,6 +364,7 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) { struct regulator *reg; int ret = 0; + int ocr_value = 0; switch (host-id) { case OMAP_MMC1_DEVID: @@ -396,6 +397,17 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) } } else { host-vcc = reg; + ocr_value = mmc_regulator_get_ocrmask(reg); + if (!mmc_slot(host).ocr_mask) { + mmc_slot(host).ocr_mask = ocr_value; + } else { + if (!(mmc_slot(host).ocr_mask ocr_value)) { + pr_err(MMC%d ocrmask %x is not supported\n, + host-id, mmc_slot(host).ocr_mask); + mmc_slot(host).ocr_mask = 0; + return -EINVAL; + } + } mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg); /* Allow an aux regulator */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] omap3/omap4 hsmmc: Register offset handling
Hi Benoit, On Fri, Sep 3, 2010 at 1:51 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: Hi Benoit snip + while (!(omap_readl(base + reg_off) MMCHS_SYSSTATUS_RESETDONE)) cpu_relax(); Why does that series not seems to be based on your hwmod migration? The reset is fully handle by the hwmod framework now. Agree. But Kevin has suggested to post this patch independent of hwmod. Does this patch has to go in hwmod series ? BTW, when do you have to apply a reset in your case? Do you have the need for an API accessible by the driver? I'm asking because for the moment the framework does not expose the reset API and use it only at init time. Correct , I don't need reset API access in the driver. One correction here , in case of context restore , driver does software reset apart from the initial reset. So reset is required and so both the tables needs registers SYSCONFIG and SYSSTATUS. In which case offset deviation of 0x100 can't be maintained. Regards, Kishore snip +enum { + OMAP_HSMMC_SYSCONFIG = 0, + OMAP_HSMMC_SYSSTATUS, + OMAP_HSMMC_CON, + OMAP_HSMMC_BLK, + OMAP_HSMMC_ARG, + OMAP_HSMMC_CMD, + OMAP_HSMMC_RSP10, + OMAP_HSMMC_RSP32, + OMAP_HSMMC_RSP54, + OMAP_HSMMC_RSP76, + OMAP_HSMMC_DATA, + OMAP_HSMMC_PSTATE, + OMAP_HSMMC_HCTL, + OMAP_HSMMC_SYSCTL, + OMAP_HSMMC_STAT, + OMAP_HSMMC_IE, + OMAP_HSMMC_ISE, + OMAP_HSMMC_CAPA, + OMAP_HSMMC_REV, + OMAP_HSMMC_CUR_CAPA, + OMAP_HSMMC_FE, + OMAP_HSMMC_ADMA_ES, + OMAP_HSMMC_ADMA_SAL, +}; + +static const u16 omap3_mmc_reg_map[] = { + [OMAP_HSMMC_SYSCONFIG] = 0x0010, + [OMAP_HSMMC_SYSSTATUS] = 0x0014, + [OMAP_HSMMC_CON] = 0x002C, + [OMAP_HSMMC_BLK] = 0x0104, + [OMAP_HSMMC_ARG] = 0x0108, + [OMAP_HSMMC_CMD] = 0x010C, + [OMAP_HSMMC_RSP10] = 0x0110, + [OMAP_HSMMC_RSP32] = 0x0114, + [OMAP_HSMMC_RSP54] = 0x0118, + [OMAP_HSMMC_RSP76] = 0x011C, + [OMAP_HSMMC_DATA] = 0x0120, + [OMAP_HSMMC_PSTATE] = 0x0124, + [OMAP_HSMMC_HCTL] = 0x0128, + [OMAP_HSMMC_SYSCTL] = 0x012C, + [OMAP_HSMMC_STAT] = 0x0130, + [OMAP_HSMMC_IE] = 0x0134, + [OMAP_HSMMC_ISE] = 0x0138, + [OMAP_HSMMC_CAPA] = 0x0140, + [OMAP_HSMMC_REV] = 0x01FC, +}; + +static const u16 omap4_mmc_reg_map[] = { + [OMAP_HSMMC_SYSCONFIG] = 0x0010, /* Use Highlander Version */ + [OMAP_HSMMC_SYSSTATUS] = 0x0114, In fact that sysstatus is a legacy register that is not needed anymore in the highlander version. The resetdone is in the sysconfig now. So you can ignore it in OMAP4. Just verified and thanks for pointing this. ok will avoid checking resetdone in sysstatus for OMAP4 + [OMAP_HSMMC_CON] = 0x012C, + [OMAP_HSMMC_BLK] = 0x0204, + [OMAP_HSMMC_ARG] = 0x0208, + [OMAP_HSMMC_CMD] = 0x020C, + [OMAP_HSMMC_RSP10] = 0x0210, + [OMAP_HSMMC_RSP32] = 0x0214, + [OMAP_HSMMC_RSP54] = 0x0218, + [OMAP_HSMMC_RSP76] = 0x021C, + [OMAP_HSMMC_DATA] = 0x0220, + [OMAP_HSMMC_PSTATE] = 0x0224, + [OMAP_HSMMC_HCTL] = 0x0228, + [OMAP_HSMMC_SYSCTL] = 0x022C, + [OMAP_HSMMC_STAT] = 0x0230, + [OMAP_HSMMC_IE] = 0x0234, + [OMAP_HSMMC_ISE] = 0x0238, + [OMAP_HSMMC_CAPA] = 0x0240, + [OMAP_HSMMC_REV] = 0x, /* Use Highlander Version */ + [OMAP_HSMMC_CUR_CAPA] = 0x0248, + [OMAP_HSMMC_FE] = 0x0250, + [OMAP_HSMMC_ADMA_ES] = 0x0254, + [OMAP_HSMMC_ADMA_SAL] = 0x0258, I didn't check all the registers, but it seems that there is a constant 0x100 offset for most of these registers. Cannot you simplify this table? Sure will simplify and post. Regards, Benoit snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] omap3/omap4 hsmmc: Register offset handling
Hi Benoit snip + while (!(omap_readl(base + reg_off) MMCHS_SYSSTATUS_RESETDONE)) cpu_relax(); Why does that series not seems to be based on your hwmod migration? The reset is fully handle by the hwmod framework now. Agree. But Kevin has suggested to post this patch independent of hwmod. Does this patch has to go in hwmod series ? BTW, when do you have to apply a reset in your case? Do you have the need for an API accessible by the driver? I'm asking because for the moment the framework does not expose the reset API and use it only at init time. Correct , I don't need reset API access in the driver. snip +enum { + OMAP_HSMMC_SYSCONFIG = 0, + OMAP_HSMMC_SYSSTATUS, + OMAP_HSMMC_CON, + OMAP_HSMMC_BLK, + OMAP_HSMMC_ARG, + OMAP_HSMMC_CMD, + OMAP_HSMMC_RSP10, + OMAP_HSMMC_RSP32, + OMAP_HSMMC_RSP54, + OMAP_HSMMC_RSP76, + OMAP_HSMMC_DATA, + OMAP_HSMMC_PSTATE, + OMAP_HSMMC_HCTL, + OMAP_HSMMC_SYSCTL, + OMAP_HSMMC_STAT, + OMAP_HSMMC_IE, + OMAP_HSMMC_ISE, + OMAP_HSMMC_CAPA, + OMAP_HSMMC_REV, + OMAP_HSMMC_CUR_CAPA, + OMAP_HSMMC_FE, + OMAP_HSMMC_ADMA_ES, + OMAP_HSMMC_ADMA_SAL, +}; + +static const u16 omap3_mmc_reg_map[] = { + [OMAP_HSMMC_SYSCONFIG] = 0x0010, + [OMAP_HSMMC_SYSSTATUS] = 0x0014, + [OMAP_HSMMC_CON] = 0x002C, + [OMAP_HSMMC_BLK] = 0x0104, + [OMAP_HSMMC_ARG] = 0x0108, + [OMAP_HSMMC_CMD] = 0x010C, + [OMAP_HSMMC_RSP10] = 0x0110, + [OMAP_HSMMC_RSP32] = 0x0114, + [OMAP_HSMMC_RSP54] = 0x0118, + [OMAP_HSMMC_RSP76] = 0x011C, + [OMAP_HSMMC_DATA] = 0x0120, + [OMAP_HSMMC_PSTATE] = 0x0124, + [OMAP_HSMMC_HCTL] = 0x0128, + [OMAP_HSMMC_SYSCTL] = 0x012C, + [OMAP_HSMMC_STAT] = 0x0130, + [OMAP_HSMMC_IE] = 0x0134, + [OMAP_HSMMC_ISE] = 0x0138, + [OMAP_HSMMC_CAPA] = 0x0140, + [OMAP_HSMMC_REV] = 0x01FC, +}; + +static const u16 omap4_mmc_reg_map[] = { + [OMAP_HSMMC_SYSCONFIG] = 0x0010, /* Use Highlander Version */ + [OMAP_HSMMC_SYSSTATUS] = 0x0114, In fact that sysstatus is a legacy register that is not needed anymore in the highlander version. The resetdone is in the sysconfig now. So you can ignore it in OMAP4. Just verified and thanks for pointing this. ok will avoid checking resetdone in sysstatus for OMAP4 + [OMAP_HSMMC_CON] = 0x012C, + [OMAP_HSMMC_BLK] = 0x0204, + [OMAP_HSMMC_ARG] = 0x0208, + [OMAP_HSMMC_CMD] = 0x020C, + [OMAP_HSMMC_RSP10] = 0x0210, + [OMAP_HSMMC_RSP32] = 0x0214, + [OMAP_HSMMC_RSP54] = 0x0218, + [OMAP_HSMMC_RSP76] = 0x021C, + [OMAP_HSMMC_DATA] = 0x0220, + [OMAP_HSMMC_PSTATE] = 0x0224, + [OMAP_HSMMC_HCTL] = 0x0228, + [OMAP_HSMMC_SYSCTL] = 0x022C, + [OMAP_HSMMC_STAT] = 0x0230, + [OMAP_HSMMC_IE] = 0x0234, + [OMAP_HSMMC_ISE] = 0x0238, + [OMAP_HSMMC_CAPA] = 0x0240, + [OMAP_HSMMC_REV] = 0x, /* Use Highlander Version */ + [OMAP_HSMMC_CUR_CAPA] = 0x0248, + [OMAP_HSMMC_FE] = 0x0250, + [OMAP_HSMMC_ADMA_ES] = 0x0254, + [OMAP_HSMMC_ADMA_SAL] = 0x0258, I didn't check all the registers, but it seems that there is a constant 0x100 offset for most of these registers. Cannot you simplify this table? Sure will simplify and post. Regards, Benoit snip Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] omap4 hsmmc : Adding card detect support for MMC1
Adding card detect callback function and card detect configuration function for MMC1 Controller. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, Card detect interrupt source is twl6030 and the card detect call back function provides card present/absent status by reading MMC Control register. Cc: Tony Lindgren t...@atomide.com Cc: Adrian Hunter adrian.hun...@nokia.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Andrew Morton a...@linux-foundation.org Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/board-4430sdp.c |7 +++- drivers/mfd/twl6030-irq.c | 76 +++ drivers/mmc/host/omap_hsmmc.c |4 +- include/linux/i2c/twl.h | 31 ++ 4 files changed, 115 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 9447644..a49f285 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..91a6a45 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,81 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + if (twl_class_is_6030()) { + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + } + + /* +* Intially Configuring MMC_CTRL for receving interrupts +* Card status on TWL6030 for MMC1 +*/ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + return ret; + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + return ret; + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config); + +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg = 0; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + + switch (pdev-id) { + case 0: + /* +* BIT0 of REG_MMC_CTRL +* 0 - Card not present ,1 - Card present +*/ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, read_reg, + TWL6030_MMCCTRL); + if (ret = 0) + ret = read_reg STS_MMC; + break; + default: + pr_err(Unkown MMC controller %d in %s\n, pdev-id, __func__); + } + return ret
[PATCH 0/3] OMAP hsmmc : card detect and Register offset handling
Hi, The patch series includes : adding carddetect feature for MMC1 controller on OMAP4 and register offset handling for OMAP3 OMAP4 and followed by a fix when CONFIG_MMC_OMAP_HS not selected for OMAP4. Patch series has been tested on OMAP3430SDP and OMAP4430SDP Kishore Kadiyala (2): omap4 hsmmc : Adding card detect support for MMC1 omap3/omap4 hsmmc: Register offset handling Benoit Cousson (1); omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set arch/arm/mach-omap2/board-4430sdp.c | 15 ++- arch/arm/mach-omap2/devices.c | 30 +++-- arch/arm/mach-omap2/hsmmc.c |6 + arch/arm/plat-omap/include/plat/mmc.h | 78 ++- drivers/mfd/twl6030-irq.c | 76 ++ drivers/mmc/host/omap_hsmmc.c | 255 +++-- include/linux/i2c/twl.h | 31 7 files changed, 340 insertions(+), 151 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] omap3/omap4 hsmmc: Register offset handling
OMAP4 not only have newly added hsmmc registers but also have registers which were there in OMAP3 and which doesn't have a common offset deviation compared to OMAP3. For generic handling, OMAP3 and OMAP4 has different array's of register offset maintained and right one is choosen during run time. Cc: Tony Lindgren t...@atomide.com Cc: Adrian Hunter adrian.hun...@nokia.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Andrew Morton a...@linux-foundation.org Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com --- arch/arm/mach-omap2/devices.c | 30 +++-- arch/arm/mach-omap2/hsmmc.c |6 + arch/arm/plat-omap/include/plat/mmc.h | 78 ++- drivers/mmc/host/omap_hsmmc.c | 251 +++-- 4 files changed, 218 insertions(+), 147 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 2dbb265..03add6e 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -506,6 +506,8 @@ static inline void omap_init_sham(void) { } #define MMCHS_SYSCONFIG_SWRESET(1 1) #define MMCHS_SYSSTATUS0x0014 #define MMCHS_SYSSTATUS_RESETDONE (1 0) +#define OMAP4_MMCHS_SYSCONFIG_SWRESET (1 0) +#define OMAP4_MMCHS_OFFSET 0x100 static struct platform_device dummy_pdev = { .dev = { @@ -528,6 +530,8 @@ static struct platform_device dummy_pdev = { static void __init omap_hsmmc_reset(void) { u32 i, nr_controllers; + u32 reg_val = 0; + u32 reg_off = 0; if (cpu_is_omap242x()) return; @@ -562,9 +566,6 @@ static void __init omap_hsmmc_reset(void) break; } - if (cpu_is_omap44xx()) - base += OMAP4_MMC_REG_OFFSET; - dummy_pdev.id = i; dev_set_name(dummy_pdev.dev, mmci-omap-hs.%d, i); iclk = clk_get(dev, ick); @@ -582,9 +583,18 @@ static void __init omap_hsmmc_reset(void) break; } - omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG); - v = omap_readl(base + MMCHS_SYSSTATUS); - while (!(omap_readl(base + MMCHS_SYSSTATUS) + if (cpu_is_omap44xx()) + reg_val = MMCHS_SYSCONFIG_SWRESET; + else + reg_val = MMCHS_SYSCONFIG_SWRESET; + omap_writel(reg_val, base + MMCHS_SYSCONFIG); + + reg_off = MMCHS_SYSSTATUS; + if (cpu_is_omap44xx()) + reg_off += OMAP4_MMCHS_OFFSET; + v = omap_readl(base + reg_off); + + while (!(omap_readl(base + reg_off) MMCHS_SYSSTATUS_RESETDONE)) cpu_relax(); @@ -745,13 +755,13 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, case 3: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC4_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC4_BASE; irq = OMAP44XX_IRQ_MMC4; break; case 4: if (!cpu_is_omap44xx()) return; - base = OMAP4_MMC5_BASE + OMAP4_MMC_REG_OFFSET; + base = OMAP4_MMC5_BASE; irq = OMAP44XX_IRQ_MMC5; break; default: @@ -762,10 +772,8 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, size = OMAP2420_MMC_SIZE; name = mmci-omap; } else if (cpu_is_omap44xx()) { - if (i 3) { - base += OMAP4_MMC_REG_OFFSET; + if (i 3) irq += OMAP44XX_IRQ_GIC_START; - } size = OMAP4_HSMMC_SIZE; name = mmci-omap-hs; } else { diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index c8f647b..d93b704 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c @@ -262,6 +262,12 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) mmc-slots[0].internal_clock = !c-ext_clock; mmc-dma_mask = 0x; + /* Register offset Mapping */ + if (cpu_is_omap44xx()) + mmc-regs_map = (u16 *) omap4_mmc_reg_map; + else + mmc-regs_map = (u16 *) omap3_mmc_reg_map; + mmc-get_context_loss_count = hsmmc_get_context_loss; mmc-slots[0].switch_pin = c-gpio_cd; diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h index 9b89ec6
Re: [PATCH v3 9/9] omap: zoom: add mmc3/wl1271 device support
Ohad, On Wed, Aug 11, 2010 at 9:08 PM, Ohad Ben-Cohen o...@wizery.com wrote: On Wed, Aug 11, 2010 at 11:37 AM, Roger Quadros roger.quad...@nokia.com wrote: + .ocr_mask = MMC_VDD_165_195, Do we really need to specify ocr_mask here? Since you specified the voltage source is fixed, and if MMC3 has any dedicated regulator as MMC1 MMC2 you can go with Roger's comments. If the LDO is fixed voltage source from TWL then since regulator framework supports only adjustable LDO's, I think you can have ocr_mask defined as above in board file. Regards, Kishore Removed, thanks! -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6] OMAP4 HSMMC: Adding Card detect support for MMC1 on OMAP4
Madhu, On Thu, Aug 5, 2010 at 4:26 AM, Madhusudhan madhu...@ti.com wrote: snip arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 76 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 16 +++ 4 files changed, 100 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach- omap2/board-4430sdp.c index f287461..388b96d 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; You are assigning an exported fn here. What if somebody disables CONFIG_TWL4030_CORE in the omap_4430sdp_defconfig file? Does the driver behave nicely with only loosing the hotplug capability? On mainline 2.6.35 omap3_defconfig works for OMAP4 but without hotplug functionality Disabling CONFIG_TWL4030_CORE in defconfig means disabling regulator's and eventually on bootup mmc host drivers probe fails as omap_hsmmc_reg_get( ) fails. Seems like MMC and TWL are tightly coupled because of LDO dependency. With this V6 patch and omap3_defconfig , disabling CONFIG_TWL4030_CORE [also need to disable USB comment board-devkit8000.c in mach-omap2/Makefile as they have dependency on twl_i2c_write_u8/twl_i2c_read_u8 defined in twl-core.c] doesn't compile due to undefined reference to those exported functions twl6030_mmc_card_detect_config twl6030_mmc_card_detect . Having below one[in twl.h] in addition to V6 : /* Card detect Configuration for MMC1 Controller on OMAP4 */ +#if defined(CONFIG_TWL4030_CORE) int twl6030_mmc_card_detect_config(void); +#else +static inline int twl6030_mmc_card_detect_config(void) +{ + pr_err(twl6030_mmc_card_detect_config not supported\n); + return 0; +} +#endif /* MMC1 Controller on OMAP4 uses Phoenix irq for Card detect */ +#if defined(CONFIG_TWL4030_CORE) int twl6030_mmc_card_detect(struct device *dev, int slot); - +#else +static inline int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + pr_err(Call back twl6030_mmc_card_detect not supported\n); + return -EIO; +} +#endif With the above change compilation as well as booting goes well but mmc probe fails. Shall I go with above changes and post V7 ? snip Thanks , Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6] OMAP4 HSMMC: Adding Card detect support for MMC1 on OMAP4
Andrew, Can this patch be taken now as there are no comments. Regards, Kishore On Wed, Jul 7, 2010 at 7:42 PM, kishore kadiyala kishore.kadiy...@ti.com wrote: Adding card detect callback function and card detect configuration function for MMC1 Controller. Card detect configuration function does initial configuration of the MMC Control PullUp-PullDown registers of Phoenix. For MMC1 Controller, Card detect interrupt source is twl6030 and the card detect call back function provides card present/absent status by reading MMC Control register. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Cc: Tony Lindgren t...@atomide.com Cc: Madhusudhan Chikkature madhu...@ti.com Cc: Adrian Hunter adrian.hun...@nokia.com --- V5: https://patchwork.kernel.org/patch/106697/ https://patchwork.kernel.org/patch/106698/ V4: http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg01958.html http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg01949.html arch/arm/mach-omap2/board-4430sdp.c | 7 +++- drivers/mfd/twl6030-irq.c | 76 +++ drivers/mmc/host/omap_hsmmc.c | 4 +- include/linux/i2c/twl.h | 16 +++ 4 files changed, 100 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index f287461..388b96d 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -227,9 +227,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev) struct omap_mmc_platform_data *pdata = dev-platform_data; /* Setting MMC1 Card detect Irq */ - if (pdev-id == 0) + if (pdev-id == 0) { + ret = twl6030_mmc_card_detect_config(); + if (ret) + pr_err(Failed configuring MMC1 card detect\n); pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; + pdata-slots[0].card_detect = twl6030_mmc_card_detect; + } return ret; } diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 10bf228..c027692 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c @@ -36,6 +36,7 @@ #include linux/irq.h #include linux/kthread.h #include linux/i2c/twl.h +#include linux/platform_device.h /* * TWL6030 (unlike its predecessors, which had two level interrupt handling) @@ -223,6 +224,81 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset) } EXPORT_SYMBOL(twl6030_interrupt_mask); +int twl6030_mmc_card_detect_config(void) +{ + int ret; + u8 reg_val = 0; + + /* Unmasking the Card detect Interrupt line for MMC1 from Phoenix */ + if (twl_class_is_6030()) { + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_LINE_B); + twl6030_interrupt_unmask(TWL6030_MMCDETECT_INT_MASK, + REG_INT_MSK_STS_B); + } + + /* + * Intially Configuring MMC_CTRL for receving interrupts + * Card status on TWL6030 for MMC1 + */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret); + return ret; + } + reg_val = ~VMMC_AUTO_OFF; + reg_val |= SW_FC; + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL); + if (ret 0) { + return ret; + pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret); + } + + /* Configuring PullUp-PullDown register */ + ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + return ret; + pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n, + ret); + } + reg_val = ~(MMC_PU | MMC_PD); + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, + TWL6030_CFG_INPUT_PUPD3); + if (ret 0) { + pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n, + ret); + return ret; + } + return 0; +} +EXPORT_SYMBOL(twl6030_mmc_card_detect_config); + +int twl6030_mmc_card_detect(struct device *dev, int slot) +{ + int ret = -EIO; + u8 read_reg; + struct platform_device *pdev = container_of(dev, + struct platform_device, dev); + + switch (pdev-id) { + case 0
Re: [PATCH] omap: hsmmc funtionality breaks when CONFIG_PM not define
Hi Adrian, Is there any use case or a valid scenario whether to use omap_hsmmc_ps_ops or omap_hsmmc_ops ? I meant using power_saving option and without power_saving option Ideally I feel having omap_hsmmc_ps_ops as default with or without CONFIG_PM would be better as it internally has a state handling. Regards, Kishore On Tue, Jul 20, 2010 at 2:43 PM, Adrian Hunter adrian.hun...@nokia.com wrote: Ghorai, Sukumar wrote: -Original Message- From: Adrian Hunter [mailto:adrian.hun...@nokia.com] Sent: Tuesday, July 20, 2010 2:10 PM To: Ghorai, Sukumar Cc: linux-mmc@vger.kernel.org; linux-o...@vger.kernel.org; Shilimkar, Santosh; Chikkature Rajashekar, Madhusudhan; Andrew Morton Subject: Re: [PATCH] omap: hsmmc funtionality breaks when CONFIG_PM not define Ghorai, Sukumar wrote: Adrian, -Original Message- From: Adrian Hunter [mailto:adrian.hun...@nokia.com] Sent: Tuesday, July 20, 2010 1:40 PM To: Ghorai, Sukumar Cc: linux-mmc@vger.kernel.org; linux-o...@vger.kernel.org; Shilimkar, Santosh; Chikkature Rajashekar, Madhusudhan; Andrew Morton Subject: Re: [PATCH] omap: hsmmc funtionality breaks when CONFIG_PM not define Ghorai, Sukumar wrote: -Original Message- From: Adrian Hunter [mailto:adrian.hun...@nokia.com] Sent: Tuesday, July 20, 2010 12:39 PM To: Ghorai, Sukumar Cc: linux-mmc@vger.kernel.org; linux-o...@vger.kernel.org; Shilimkar, Santosh; Chikkature Rajashekar, Madhusudhan; Andrew Morton Subject: Re: [PATCH] omap: hsmmc funtionality breaks when CONFIG_PM not define Sukumar Ghorai wrote: Issue if power_saving option passed from board file and CONFIG_PM not define. This is because hosts refer to wrong operation table and that try to power save. power_saving is not related to power management. It should work with or without CONFIG_PM. What problem are you seeing? [Ghorai] when CONFIG_PM is not defined but power_saving flag is TRUE, then host operation table point to table which handles in state machine as: ENABLE - CARDSLEEP - REGSLEEP - DISABLED for power/clock cut. And do the reverse for the enable clock/power. And power saving is not required and wont work when CONFIG_PM is not enabled. How is that a problem? It would be useful to know what you need? [Ghorai] do men when CONFIG_PM is not enabled still we should do power saving in mmc? Why not? Because issue is iclk/fclk is quite depended on PRCM framework when we are using omap_hsmmc_ps_ops operation table. iclk is left alone. fclk is manipulated with or without power_saving. I still do not understand your problem sorry :-( [Ghorai] thanks and need input again, we have two tables - 1. static const struct mmc_host_ops omap_hsmmc_ops = { } -- This is without CONFIG_PM, assumed. No it is independent of CONFIG_PM With CONFIG_PM - the driver will restore registers if the host controller has been powered off / on by PRCM - suspend / resume can be used 2. static const struct mmc_host_ops omap_hsmmc_ps_ops = { } - this with CONFIG_PM, assumed. No it is independent of CONFIG_PM Without CONFIG_PM - card will be put to sleep after 1 second - card will be powered off after another 8 seconds a. And you feel we should remove #1 Nothing should need to be removed. b. use omap_hsmmc_ps_ops default. With power_saving it is yes. c. And it should work in all case? It should work in all cases. So if CONFIG_PM is not enable, then it should do simple clock disable/enable, and not via the power state machine. If that is what you want, simply change your board file: #if CONFIG_PM .power_saving = true, #else .power_saving = false, #end [Ghorai] the fix I send is to guard in MMC/SD host driver to avoid mistake in board file(s). And this file is used for multiple omap3, omap4 boards. Signed-off-by: Sukumar Ghorai s-gho...@ti.com Signed-off-by: Santosh Shilimkar santosh.shilim...@ti.com CC: Madhusudhan Chikkature madhu...@ti.com CC: Andrew Morton a...@linux-foundation.org --- Tested on omap3, omap4430 ES2.0 drivers/mmc/host/omap_hsmmc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index b032828..f84eed0 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2015,9 +2015,11 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, host); INIT_WORK(host-mmc_carddetect_work, omap_hsmmc_detect); +#ifdef CONFIG_PM if (mmc_slot(host).power_saving) mmc-ops = omap_hsmmc_ps_ops; else +#endif mmc-ops = omap_hsmmc_ops; /* -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at
Re: [PATCH v5] OMAP: Fix for bus width which improves SD card's peformance.
Tony, Could this patch be taken ? Thanks, kishore On Tue, Jun 15, 2010 at 1:37 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: From: Kishore Kadiyala kishore.kadiy...@ti.com This patch improves low speeds for SD cards. OMAP-MMC controller's can support maximum bus width of '8'. when bus width is mentioned as 8 in controller data,the SD stack will check whether bus width is 4 and if not it will set bus width to 1 and there by degrading performance. This patch fixes the issue and improves the performance of SD cards. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Signed-off-by: Venkatraman S svenk...@ti.com Signed-off-by: Nishanth Menon n...@ti.com Acked-by: Madhusudhan Chikkature madhu...@ti.com Tested-by: Jarkko Nikula jhnik...@gmail.com --- In V5 : Rebasing on 2.6.35-rc3 In V4 : Updated with Nishanth's comments and appened his Signed-off http://marc.info/?t=12716914936r=1w=2 In V3 : Updated with Madhu's comments and appended Tested by Nikula In V2 : Appended Signed-off by Venkat and Ack by Madhu Here are my experiment numbers, on a Class 6 SDHC card: Read peformance is increased by 220% Write Performance is increased by 52% drivers/mmc/host/omap_hsmmc.c | 17 +++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index b032828..a0c8515 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2096,10 +2096,23 @@ static int __init omap_hsmmc_probe(struct mmc-caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | MMC_CAP_WAIT_WHILE_BUSY; - if (mmc_slot(host).wires = 8) + switch (mmc_slot(host).wires) { + case 8: mmc-caps |= MMC_CAP_8_BIT_DATA; - else if (mmc_slot(host).wires = 4) + /* Fall through */ + case 4: mmc-caps |= MMC_CAP_4_BIT_DATA; + break; + case 1: + /* Nothing to crib here */ + case 0: + /* Assuming nothing was given by board, Core use's 1-Bit */ + break; + default: + /* Completely unexpected.. Core goes with 1-Bit Width */ + dev_crit(mmc_dev(host-mmc), Invalid width %d\n used! + using 1 instead\n, mmc_slot(host).wires); + } if (mmc_slot(host).nonremovable) mmc-caps |= MMC_CAP_NONREMOVABLE; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5] OMAP: Fix for bus width which improves SD card's peformance.
Hi Andrew, If no further comments on this patch, can this be taken? Regards, Kishore On Tue, Jun 15, 2010 at 1:37 PM, kishore kadiyala kishorek.kadiy...@gmail.com wrote: From: Kishore Kadiyala kishore.kadiy...@ti.com This patch improves low speeds for SD cards. OMAP-MMC controller's can support maximum bus width of '8'. when bus width is mentioned as 8 in controller data,the SD stack will check whether bus width is 4 and if not it will set bus width to 1 and there by degrading performance. This patch fixes the issue and improves the performance of SD cards. Signed-off-by: Kishore Kadiyala kishore.kadiy...@ti.com Signed-off-by: Venkatraman S svenk...@ti.com Signed-off-by: Nishanth Menon n...@ti.com Acked-by: Madhusudhan Chikkature madhu...@ti.com Tested-by: Jarkko Nikula jhnik...@gmail.com --- In V5 : Rebasing on 2.6.35-rc3 In V4 : Updated with Nishanth's comments and appened his Signed-off http://marc.info/?t=12716914936r=1w=2 In V3 : Updated with Madhu's comments and appended Tested by Nikula In V2 : Appended Signed-off by Venkat and Ack by Madhu Here are my experiment numbers, on a Class 6 SDHC card: Read peformance is increased by 220% Write Performance is increased by 52% drivers/mmc/host/omap_hsmmc.c | 17 +++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index b032828..a0c8515 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2096,10 +2096,23 @@ static int __init omap_hsmmc_probe(struct mmc-caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | MMC_CAP_WAIT_WHILE_BUSY; - if (mmc_slot(host).wires = 8) + switch (mmc_slot(host).wires) { + case 8: mmc-caps |= MMC_CAP_8_BIT_DATA; - else if (mmc_slot(host).wires = 4) + /* Fall through */ + case 4: mmc-caps |= MMC_CAP_4_BIT_DATA; + break; + case 1: + /* Nothing to crib here */ + case 0: + /* Assuming nothing was given by board, Core use's 1-Bit */ + break; + default: + /* Completely unexpected.. Core goes with 1-Bit Width */ + dev_crit(mmc_dev(host-mmc), Invalid width %d\n used! + using 1 instead\n, mmc_slot(host).wires); + } if (mmc_slot(host).nonremovable) mmc-caps |= MMC_CAP_NONREMOVABLE; -- 1.6.3.3 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/2] OMAP4 HSMMC: Adding card detect support for MMC1 Controller
On Tue, Jun 29, 2010 at 1:00 PM, Adrian Hunter adrian.hun...@nokia.com wrote: ext kishore kadiyala wrote: Adrian , Sorry for the late response snip As per my email 5/5/10, I would suggest the only change to omap_hsmmc is: Agreed and followed the changes mostly but made some more changes on top of it. snip And that the late init function is used to do the rest e.g. find a home for these 3 functions: I agree just having the 3 functions makes it work. static int omap4_twl6030_hsmmc_late_init(struct device *dev) { int ret = 0; struct platform_device *pdev = container_of(dev, struct platform_device, dev); struct omap_mmc_platform_data *pdata = dev-platform_data; /* MMC1 Card detect Configuration */ if (pdev-id == 0) { ret = omap4_hsmmc1_card_detect_config(); if (ret 0) pr_err(Unable to configure Card detect for MMC1\n); pdata-slots[0].card_detect = twl6030_mmc_card_detect; pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; } return ret; snip Few Comments below: 1) In the above function, initializing card_detect in the driver as done in omap_hsmmc_gpio_init might be more readable and this has been done in nongpio_init instead. Even having initialization of card_detect_irq inside nongpio_init is fine. The problem is that referencing twl6030 from omap_hsmmc.c is not ok. The driver must work with any platform and that is the reason that platform data provides callbacks. ok, in that case how about having handler initialized in mach-omap2/hsmmc.c for both gpio and non-gpio case. -Kishore 2)Also calling omap_hsmmc_gpio_init in case of a card detect line which is not GPIO doesn't make sense though it assigns -EINVAL to switch_pin in case of invalid GPIO which is intended for a non-removable card . 3) And also having some thing like GPIO and NON_GPIO flag to distinguish might make sense. Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 2/2] OMAP4 HSMMC: Adding card detect support for MMC1 Controller
On Tue, Jun 29, 2010 at 1:48 PM, Adrian Hunter adrian.hun...@nokia.com wrote: kishore kadiyala wrote: On Tue, Jun 29, 2010 at 1:00 PM, Adrian Hunter adrian.hun...@nokia.com wrote: ext kishore kadiyala wrote: Adrian , Sorry for the late response snip As per my email 5/5/10, I would suggest the only change to omap_hsmmc is: Agreed and followed the changes mostly but made some more changes on top of it. snip And that the late init function is used to do the rest e.g. find a home for these 3 functions: I agree just having the 3 functions makes it work. static int omap4_twl6030_hsmmc_late_init(struct device *dev) { int ret = 0; struct platform_device *pdev = container_of(dev, struct platform_device, dev); struct omap_mmc_platform_data *pdata = dev-platform_data; /* MMC1 Card detect Configuration */ if (pdev-id == 0) { ret = omap4_hsmmc1_card_detect_config(); if (ret 0) pr_err(Unable to configure Card detect for MMC1\n); pdata-slots[0].card_detect = twl6030_mmc_card_detect; pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE + MMCDETECT_INTR_OFFSET; } return ret; snip Few Comments below: 1) In the above function, initializing card_detect in the driver as done in omap_hsmmc_gpio_init might be more readable and this has been done in nongpio_init instead. Even having initialization of card_detect_irq inside nongpio_init is fine. The problem is that referencing twl6030 from omap_hsmmc.c is not ok. The driver must work with any platform and that is the reason that platform data provides callbacks. ok, in that case how about having handler initialized in mach-omap2/hsmmc.c for both gpio and non-gpio case. Unless twl6030 is part of OMAP4 then it doesn't belong in hsmmc.c either ok, I'll make changes as suggested and post next version. Regards, Kishore -Kishore 2)Also calling omap_hsmmc_gpio_init in case of a card detect line which is not GPIO doesn't make sense though it assigns -EINVAL to switch_pin in case of invalid GPIO which is intended for a non-removable card . 3) And also having some thing like GPIO and NON_GPIO flag to distinguish might make sense. Regards, Kishore -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html