* Re: [PATCH 1/3] hpsa: remove unneeded loop
From: Tomas Henzl @ 2013-08-01 14:05 UTC (permalink / raw)
To: scameron; +Cc: 'linux-scsi@vger.kernel.org', stephenmcameron, mikem
In-Reply-To: <20130801133951.GX24664@beardog.cce.hp.com>
On 08/01/2013 03:39 PM, scameron@beardog.cce.hp.com wrote:
> On Thu, Aug 01, 2013 at 03:11:22PM +0200, Tomas Henzl wrote:
>> From: Tomas Henzl <thenzl@redhat.com>
>>
>> The cmd_pool_bits is protected everywhere with a spinlock,
>> we don't need the test_and_set_bit, set_bit is enough and the loop
>> can be removed too.
>>
>> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
>> ---
>> drivers/scsi/hpsa.c | 15 ++++++---------
>> 1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>> index 796482b..d7df01e 100644
>> --- a/drivers/scsi/hpsa.c
>> +++ b/drivers/scsi/hpsa.c
>> @@ -2662,15 +2662,12 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
>> unsigned long flags;
>>
>> spin_lock_irqsave(&h->lock, flags);
>> - do {
>> - i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
>> - if (i == h->nr_cmds) {
>> - spin_unlock_irqrestore(&h->lock, flags);
>> - return NULL;
>> - }
>> - } while (test_and_set_bit
>> - (i & (BITS_PER_LONG - 1),
>> - h->cmd_pool_bits + (i / BITS_PER_LONG)) != 0);
>> + i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds);
>> + if (i == h->nr_cmds) {
>> + spin_unlock_irqrestore(&h->lock, flags);
>> + return NULL;
>> + }
>> + set_bit(i & (BITS_PER_LONG - 1), h->cmd_pool_bits + (i / BITS_PER_LONG));
>> h->nr_allocs++;
>> spin_unlock_irqrestore(&h->lock, flags);
>>
>> --
>> 1.8.3.1
>>
> Would it be better instead to just not use the spinlock for protecting
> cmd_pool_bits? I have thought about doing this for awhile, but haven't
> gotten around to it.
>
> I think the while loop is safe without the spin lock. And then it is
> not needed in cmd_free either.
I was evaluating the same idea for a while too, a loop and inside just the test_and_set_bit,
maybe even a stored value to start with a likely empty bit from last time to tune it a bit.
But I know almost nothing about the use pattern, so I decided for the least invasive change
to the existing code, to not make it worse.
>
> -- steve
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 7/7] ARM: dts: omap5: update omap-control-usb node
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros, Benoit Cousson
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
Split USB2 PHY and USB3 PHY into separate omap-control-usb
nodes. Update ti,mode property.
CC: Benoit Cousson <benoit.cousson@linaro.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 07be2cd..af8ef77 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -626,14 +626,20 @@
hw-caps-temp-alert;
};
- omap_control_usb: omap-control-usb@4a002300 {
+ omap_control_usb2phy: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a002370 0x4>;
- reg-names = "control_dev_conf", "phy_power_usb";
+ reg = <0x4a002300 0x4>;
+ reg-names = "power";
ti,type = <2>;
};
+ omap_control_usb3phy: omap-control-usb@0x4a002370 {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a002370 0x4>;
+ reg-names = "power";
+ ti,type = <3>;
+ };
+
omap_dwc3@4a020000 {
compatible = "ti,dwc3";
ti,hwmods = "usb_otg_ss";
@@ -661,7 +667,7 @@
usb2_phy: usb2phy@4a084000 {
compatible = "ti,omap-usb2";
reg = <0x4a084000 0x7c>;
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb2phy>;
};
usb3_phy: usb3phy@4a084400 {
@@ -670,7 +676,7 @@
<0x4a084800 0x64>,
<0x4a084c00 0x40>;
reg-names = "phy_rx", "phy_tx", "pll_ctrl";
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb3phy>;
};
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH v4] base.bbclass: Add support to EXTRA_DISTRO_FEATURES
From: Otavio Salvador @ 2013-08-01 14:05 UTC (permalink / raw)
To: OpenEmbedded Core Mailing List; +Cc: Otavio Salvador
This allow the addition and removal of distro features easily. To add
a feature, use:
EXTRA_DISTRO_FEATURES += "wayland"
and to remove, use '~' prefix, as:
EXTRA_DISTRO_FEATURES += "~x11"
This code has been mostly copied from Mentor Graphics public layer but
changed the variable name for a more descriptive name. The original
code can be seen at user_feature.bbclass at:
http://git.yoctoproject.org/cgit/cgit.cgi/meta-mentor
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes in v4:
- Drop _prepend/_append hack and remove/add DISTRO_FEATURES (thanks to
RP for the tip).
Changes in v3:
- Drop _prepend/_append flags from DISTRO_FEATURES to avoid the re-add
Changes in v2:
- Use data copy to fix wrong prepend/append expanding.
meta/classes/base.bbclass | 4 ++++
meta/lib/oe/utils.py | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 9c92e0b..83f6458 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -298,6 +298,9 @@ def buildcfg_neededvars(d):
if pesteruser:
bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
+EXTRA_DISTRO_FEATURES ?= ""
+EXTRA_DISTRO_FEATURES[type] = "list"
+
addhandler base_eventhandler
base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.BuildStarted"
python base_eventhandler() {
@@ -307,6 +310,7 @@ python base_eventhandler() {
preferred_ml_updates(e.data)
oe.utils.features_backfill("DISTRO_FEATURES", e.data)
oe.utils.features_backfill("MACHINE_FEATURES", e.data)
+ oe.utils.extra_distro_features(e.data)
if isinstance(e, bb.event.BuildStarted):
localdata = bb.data.createCopy(e.data)
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 82987e8..0c9dde0 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -117,6 +117,30 @@ def features_backfill(var,d):
if addfeatures:
d.appendVar(var, " " + " ".join(addfeatures))
+def extra_distro_features(d):
+ import oe.data
+
+ l = d.createCopy()
+ l.finalize()
+
+ extra_features = oe.data.typed_value('EXTRA_DISTRO_FEATURES', l)
+ if not extra_features:
+ return
+
+ distro_features = l.getVar('DISTRO_FEATURES', True).split()
+ for feature in extra_features:
+ if feature.startswith('~'):
+ feature = feature[1:]
+ if feature in distro_features:
+ distro_features.remove(feature)
+ else:
+ if feature not in distro_features:
+ distro_features.append(feature)
+
+ # Avoid readding the removed features later
+ d.delVar("DISTRO_FEATURES")
+
+ d.setVar('DISTRO_FEATURES', ' '.join(distro_features))
def packages_filter_out_system(d):
"""
--
1.8.3.2
^ permalink raw reply related
* [PATCH 6/7] ARM: dts: omap4: update omap-control-usb nodes
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros, Benoit Cousson
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
Split otghs_ctrl and USB2 PHY power down into separate
omap-control-usb nodes. Update ti,mode property.
CC: Benoit Cousson <benoit.cousson@linaro.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 22d9f2b..9a6fa27 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -519,7 +519,7 @@
usb2_phy: usb2phy@4a0ad080 {
compatible = "ti,omap-usb2";
reg = <0x4a0ad080 0x58>;
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb2phy>;
};
};
@@ -643,11 +643,17 @@
};
};
- omap_control_usb: omap-control-usb@4a002300 {
+ omap_control_usb2phy: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a00233c 0x4>;
- reg-names = "control_dev_conf", "otghs_control";
+ reg = <0x4a002300 0x4>;
+ reg-names = "power";
+ ti,type = <2>;
+ };
+
+ omap_control_usbotg: omap-control-usb@4a00233c {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a00233c 0x4>;
+ reg-names = "otghs_control";
ti,type = <1>;
};
@@ -662,6 +668,7 @@
num-eps = <16>;
ram-bits = <12>;
ti,has-mailbox;
+ ctrl-module = <&omap_control_usbotg>;
};
};
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH 7/7] ARM: dts: omap5: update omap-control-usb node
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros, Benoit Cousson
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
Split USB2 PHY and USB3 PHY into separate omap-control-usb
nodes. Update ti,mode property.
CC: Benoit Cousson <benoit.cousson@linaro.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/omap5.dtsi | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 07be2cd..af8ef77 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -626,14 +626,20 @@
hw-caps-temp-alert;
};
- omap_control_usb: omap-control-usb@4a002300 {
+ omap_control_usb2phy: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a002370 0x4>;
- reg-names = "control_dev_conf", "phy_power_usb";
+ reg = <0x4a002300 0x4>;
+ reg-names = "power";
ti,type = <2>;
};
+ omap_control_usb3phy: omap-control-usb@0x4a002370 {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a002370 0x4>;
+ reg-names = "power";
+ ti,type = <3>;
+ };
+
omap_dwc3@4a020000 {
compatible = "ti,dwc3";
ti,hwmods = "usb_otg_ss";
@@ -661,7 +667,7 @@
usb2_phy: usb2phy@4a084000 {
compatible = "ti,omap-usb2";
reg = <0x4a084000 0x7c>;
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb2phy>;
};
usb3_phy: usb3phy@4a084400 {
@@ -670,7 +676,7 @@
<0x4a084800 0x64>,
<0x4a084c00 0x40>;
reg-names = "phy_rx", "phy_tx", "pll_ctrl";
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb3phy>;
};
};
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH] Btrfs: stop all workers before cleaning up roots
From: Alex Lyakas @ 2013-08-01 14:05 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs
In-Reply-To: <1369947496-27707-1-git-send-email-jbacik@fusionio.com>
Hi Josef,
On Thu, May 30, 2013 at 11:58 PM, Josef Bacik <jbacik@fusionio.com> wrote:
> Dave reported a panic because the extent_root->commit_root was NULL in the
> caching kthread. That is because we just unset it in free_root_pointers, which
> is not the correct thing to do, we have to either wait for the caching kthread
> to complete or hold the extent_commit_sem lock so we know the thread has exited.
> This patch makes the kthreads all stop first and then we do our cleanup. This
> should fix the race. Thanks,
>
> Reported-by: David Sterba <dsterba@suse.cz>
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
> fs/btrfs/disk-io.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 2b53afd..77cb566 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3547,13 +3547,13 @@ int close_ctree(struct btrfs_root *root)
>
> btrfs_free_block_groups(fs_info);
do you think it would be safer to stop all workers first and make sure
they are stopped, then do btrfs_free_block_groups()? I see, for
example, that btrfs_free_block_groups() checks:
if (block_group->cached == BTRFS_CACHE_STARTED)
which could be perhaps racy with other people spawning caching_threads.
So maybe better to stop all threads (including cleaner and committer)
and then free everything?
>
> - free_root_pointers(fs_info, 1);
> + btrfs_stop_all_workers(fs_info);
>
> del_fs_roots(fs_info);
>
> - iput(fs_info->btree_inode);
> + free_root_pointers(fs_info, 1);
>
> - btrfs_stop_all_workers(fs_info);
> + iput(fs_info->btree_inode);
>
> #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
> if (btrfs_test_opt(root, CHECK_INTEGRITY))
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Alex.
^ permalink raw reply
* [Qemu-trivial] [PATCH] vmdk: fix comment for vmdk_co_write_zeroes
From: Fam Zheng @ 2013-08-01 10:12 UTC (permalink / raw)
To: qemu-devel, qemu-trivial; +Cc: Fam Zheng, mjt
The comment was truncated. Add the missing parts, especially explain why
we need zero_dry_run.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block/vmdk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 3756333..e6c50b1 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1200,8 +1200,10 @@ static coroutine_fn int vmdk_co_read(BlockDriverState *bs, int64_t sector_num,
/**
* vmdk_write:
* @zeroed: buf is ignored (data is zero), use zeroed_grain GTE feature
- * if possible, otherwise return -ENOTSUP.
- * @zero_dry_run: used for zeroed == true only, don't update L2 table, just
+ * if possible, otherwise return -ENOTSUP.
+ * @zero_dry_run: used for zeroed == true only, don't update L2 table, just try
+ * with each cluster. By dry run we can find if the zero write
+ * is possible without modifying image data.
*
* Returns: error code with 0 for success.
*/
@@ -1328,6 +1330,8 @@ static int coroutine_fn vmdk_co_write_zeroes(BlockDriverState *bs,
int ret;
BDRVVmdkState *s = bs->opaque;
qemu_co_mutex_lock(&s->lock);
+ /* write zeroes could fail if sectors not aligned to cluster, test it with
+ * dry_run == true before really updating image */
ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, true);
if (!ret) {
ret = vmdk_write(bs, sector_num, NULL, nb_sectors, true, false);
--
1.8.3.4
^ permalink raw reply related
* [PATCH 3/7] usb: phy: omap-usb3: Don't use omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.
As we don't support non-DT boot, we just bail out on probe
if device node is not present.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/phy/phy-omap-usb3.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c
index 4a7f27c..bad032e 100644
--- a/drivers/usb/phy/phy-omap-usb3.c
+++ b/drivers/usb/phy/phy-omap-usb3.c
@@ -26,6 +26,7 @@
#include <linux/pm_runtime.h>
#include <linux/delay.h>
#include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
#define PLL_STATUS 0x00000004
#define PLL_GO 0x00000008
@@ -198,6 +199,12 @@ static int omap_usb3_probe(struct platform_device *pdev)
{
struct omap_usb *phy;
struct resource *res;
+ struct device_node *node = pdev->dev.of_node;
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
+
+ if (!node)
+ return -ENODEV;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
@@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev)
return -EINVAL;
}
- phy->control_dev = omap_get_control_dev();
- if (IS_ERR(phy->control_dev)) {
- dev_dbg(&pdev->dev, "Failed to get control device\n");
+ control_node = of_parse_phandle(node, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(&pdev->dev, "Failed to get control device phandle\n");
return -ENODEV;
}
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
+ }
+
+ phy->control_dev = &control_pdev->dev;
omap_control_usb_phy_power(phy->control_dev, 0);
usb_add_phy_dev(&phy->phy);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 4/7] usb: musb: omap2430: Don't use omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/musb/omap2430.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ebb46ec..1db9588 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -38,6 +38,7 @@
#include <linux/delay.h>
#include <linux/usb/musb-omap.h>
#include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
#include "musb_core.h"
#include "omap2430.h"
@@ -547,12 +548,25 @@ static int omap2430_probe(struct platform_device *pdev)
}
if (pdata->has_mailbox) {
- glue->control_otghs = omap_get_control_dev();
- if (IS_ERR(glue->control_otghs)) {
- dev_vdbg(&pdev->dev, "Failed to get control device\n");
- ret = PTR_ERR(glue->control_otghs);
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
+
+ control_node = of_parse_phandle(np, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(&pdev->dev, "Failed to get control device phandle\n");
+ ret = -ENODEV;
+ goto err2;
+ }
+
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(&pdev->dev, "Failed to get control device\n");
+ ret = -ENODEV;
goto err2;
}
+
+ glue->control_otghs = &control_pdev->dev;
+
} else {
glue->control_otghs = ERR_PTR(-ENODEV);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 1/7] usb: phy: omap: Add new PHY types and remove omap_control_usb3_phy_power()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
TYPE2 meaning has changed. It is now a USB2 phy with Power down bit in
control_dev_conf register.
Introduce TYPE3 and TYPE4 PHY. TYPE3 is USB3 phy with DPLL and individual
TX/RX power control. TYPE4 is USB2 phy with power aux register.
Update DT binding information to reflect these changes.
Also get rid of omap_control_usb3_phy_power(). Just one function
i.e. omap_control_usb_phy_power() will now take care of all PHY types.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 23 ++--
drivers/usb/phy/phy-omap-control.c | 129 +++++++++++---------
drivers/usb/phy/phy-omap-usb2.c | 4 +
drivers/usb/phy/phy-omap-usb3.c | 6 +-
include/linux/usb/omap_control_usb.h | 18 ++--
5 files changed, 100 insertions(+), 80 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 57e71f6..e2606ab 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -75,20 +75,19 @@ OMAP CONTROL USB
Required properties:
- compatible: Should be "ti,omap-control-usb"
- reg : Address and length of the register set for the device. It contains
- the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"
- depending upon omap4 or omap5.
- - reg-names: The names of the register addresses corresponding to the registers
- filled in "reg".
- - ti,type: This is used to differentiate whether the control module has
- usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
- notify events to the musb core and omap5 has usb3 phy power register to
- power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
- phy power.
+ the address of "otghs_control" for type 1 or "power" register for other types.
+ For type 4, it must also contain "power_aux" register.
+ - reg-names: should be otghs_control for type 1 and "power" for other types.
+ - ti,type: This is used to specify the type of control register.
+ Should be one of the following:
+ 1 - if it has otghs_control mailbox register (e.g. on OMAP4)
+ 2 - if it has Power down bit in control_dev_conf register. e.g. USB2 PHY
+ 3 - if it has DPLL and individual Rx & Tx power control. e.g. USB3 PHY or SATA PHY
+ 4 - if it has both power down and power aux registers. e.g. USB2 PHY on DRA7
omap_control_usb: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a00233c 0x4>;
- reg-names = "control_dev_conf", "otghs_control";
+ reg = <0x4a00233c 0x4>;
+ reg-names = "otghs_control";
ti,type = <1>;
};
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c
index a4dda8e..cf93c5a 100644
--- a/drivers/usb/phy/phy-omap-control.c
+++ b/drivers/usb/phy/phy-omap-control.c
@@ -46,61 +46,76 @@ struct device *omap_get_control_dev(void)
EXPORT_SYMBOL_GPL(omap_get_control_dev);
/**
- * omap_control_usb3_phy_power - power on/off the serializer using control
- * module
+ * omap_control_usb_phy_power - power on/off the phy using control module reg
* @dev: the control module device
- * @on: 0 to off and 1 to on based on powering on or off the PHY
- *
- * usb3 PHY driver should call this API to power on or off the PHY.
+ * @on: 0 or 1, based on powering on or off the PHY
*/
-void omap_control_usb3_phy_power(struct device *dev, bool on)
+void omap_control_usb_phy_power(struct device *dev, int on)
{
- u32 val;
+ u32 val, val_aux;
unsigned long rate;
- struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+ struct omap_control_usb *control_usb;
- if (control_usb->type != OMAP_CTRL_DEV_TYPE2)
+ if (IS_ERR(dev) || !dev) {
+ pr_err("%s: invalid device\n", __func__);
return;
+ }
- rate = clk_get_rate(control_usb->sys_clk);
- rate = rate/1000000;
+ control_usb = dev_get_drvdata(dev);
+ if (!control_usb) {
+ dev_err(dev, "%s: invalid control usb device\n", __func__);
+ return;
+ }
- val = readl(control_usb->phy_power);
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE1)
+ return;
- if (on) {
- val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
- OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
- } else {
- val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- }
+ val = readl(control_usb->power);
- writel(val, control_usb->phy_power);
-}
-EXPORT_SYMBOL_GPL(omap_control_usb3_phy_power);
+ switch (control_usb->type) {
+ case OMAP_CTRL_DEV_TYPE2:
+ if (on)
+ val &= ~OMAP_CTRL_DEV_PHY_PD;
+ else
+ val |= OMAP_CTRL_DEV_PHY_PD;
+ break;
-/**
- * omap_control_usb_phy_power - power on/off the phy using control module reg
- * @dev: the control module device
- * @on: 0 or 1, based on powering on or off the PHY
- */
-void omap_control_usb_phy_power(struct device *dev, int on)
-{
- u32 val;
- struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+ case OMAP_CTRL_DEV_TYPE3:
+ rate = clk_get_rate(control_usb->sys_clk);
+ rate = rate/1000000;
+
+ if (on) {
+ val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
+ OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
+ val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
+ OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+ val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
+ } else {
+ val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
+ val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
+ OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+ }
+ break;
- val = readl(control_usb->dev_conf);
+ case OMAP_CTRL_DEV_TYPE4:
+ val_aux = readl(control_usb->power_aux);
+ if (on) {
+ val &= ~OMAP_CTRL_USB2_PHY_PD;
+ val_aux |= 0x100;
+ } else {
+ val |= OMAP_CTRL_USB2_PHY_PD;
+ val_aux &= ~0x100;
+ }
- if (on)
- val &= ~OMAP_CTRL_DEV_PHY_PD;
- else
- val |= OMAP_CTRL_DEV_PHY_PD;
+ writel(val_aux, control_usb->power_aux);
+ break;
+ default:
+ dev_err(dev, "%s: type %d not recognized\n",
+ __func__, control_usb->type);
+ break;
+ }
- writel(val, control_usb->dev_conf);
+ writel(val, control_usb->power);
}
EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
@@ -218,12 +233,6 @@ static int omap_control_usb_probe(struct platform_device *pdev)
control_usb->dev = &pdev->dev;
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "control_dev_conf");
- control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(control_usb->dev_conf))
- return PTR_ERR(control_usb->dev_conf);
-
if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"otghs_control");
@@ -231,16 +240,17 @@ static int omap_control_usb_probe(struct platform_device *pdev)
&pdev->dev, res);
if (IS_ERR(control_usb->otghs_control))
return PTR_ERR(control_usb->otghs_control);
- }
-
- if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
+ } else {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "phy_power_usb");
- control_usb->phy_power = devm_ioremap_resource(
- &pdev->dev, res);
- if (IS_ERR(control_usb->phy_power))
- return PTR_ERR(control_usb->phy_power);
+ "power");
+ control_usb->power = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_usb->power)) {
+ dev_err(&pdev->dev, "Couldn't get power register\n");
+ return PTR_ERR(control_usb->power);
+ }
+ }
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE3) {
control_usb->sys_clk = devm_clk_get(control_usb->dev,
"sys_clkin");
if (IS_ERR(control_usb->sys_clk)) {
@@ -249,6 +259,15 @@ static int omap_control_usb_probe(struct platform_device *pdev)
}
}
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE4) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "power_aux");
+ control_usb->power_aux = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_usb->power_aux)) {
+ dev_err(&pdev->dev, "Couldn't get power_aux register\n");
+ return PTR_ERR(control_usb->power_aux);
+ }
+ }
dev_set_drvdata(control_usb->dev, control_usb);
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/usb/phy/phy-omap-usb2.c
index 844ab68..376b367 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/usb/phy/phy-omap-usb2.c
@@ -123,6 +123,10 @@ static int omap_usb2_probe(struct platform_device *pdev)
{
struct omap_usb *phy;
struct usb_otg *otg;
+ struct device_node *node = pdev->dev.of_node;
+
+ if (!node)
+ return -ENODEV;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c
index fc15694..4a7f27c 100644
--- a/drivers/usb/phy/phy-omap-usb3.c
+++ b/drivers/usb/phy/phy-omap-usb3.c
@@ -100,7 +100,7 @@ static int omap_usb3_suspend(struct usb_phy *x, int suspend)
udelay(1);
} while (--timeout);
- omap_control_usb3_phy_power(phy->control_dev, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
phy->is_suspended = 1;
} else if (!suspend && phy->is_suspended) {
@@ -189,7 +189,7 @@ static int omap_usb3_init(struct usb_phy *x)
if (ret)
return ret;
- omap_control_usb3_phy_power(phy->control_dev, 1);
+ omap_control_usb_phy_power(phy->control_dev, 1);
return 0;
}
@@ -245,7 +245,7 @@ static int omap_usb3_probe(struct platform_device *pdev)
return -ENODEV;
}
- omap_control_usb3_phy_power(phy->control_dev, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
usb_add_phy_dev(&phy->phy);
platform_set_drvdata(pdev, phy);
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c..7f027d3 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -22,9 +22,9 @@
struct omap_control_usb {
struct device *dev;
- u32 __iomem *dev_conf;
u32 __iomem *otghs_control;
- u32 __iomem *phy_power;
+ u32 __iomem *power;
+ u32 __iomem *power_aux;
struct clk *sys_clk;
@@ -42,9 +42,10 @@ enum omap_control_usb_mode {
USB_MODE_DISCONNECT,
};
-/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
-#define OMAP_CTRL_DEV_TYPE1 0x1
-#define OMAP_CTRL_DEV_TYPE2 0x2
+#define OMAP_CTRL_DEV_TYPE1 0x1 /* Mailbox OTGHS_CONTROL */
+#define OMAP_CTRL_DEV_TYPE2 0x2 /* USB2_PHY, power down in CONTROL_DEV_CONF */
+#define OMAP_CTRL_DEV_TYPE3 0x3 /* USB3_PHY, DPLL & seperate Rx/Tx power */
+#define OMAP_CTRL_DEV_TYPE4 0x4 /* USB2 PHY, power and power_aux e.g. DRA7 */
#define OMAP_CTRL_DEV_PHY_PD BIT(0)
@@ -63,10 +64,11 @@ enum omap_control_usb_mode {
#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
+#define OMAP_CTRL_USB2_PHY_PD BIT(28)
+
#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
extern struct device *omap_get_control_dev(void);
extern void omap_control_usb_phy_power(struct device *dev, int on);
-extern void omap_control_usb3_phy_power(struct device *dev, bool on);
extern void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode);
#else
@@ -79,10 +81,6 @@ static inline void omap_control_usb_phy_power(struct device *dev, int on)
{
}
-static inline void omap_control_usb3_phy_power(struct device *dev, int on)
-{
-}
-
static inline void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode)
{
--
1.7.4.1
^ permalink raw reply related
* [PATCH 0/7] phy: omap-usb: Support multiple instances and new types
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
Hi,
This patchset does the following:
* Restructure and add support for new PHY types. We now support the follwing
four types
TYPE1 - if it has otghs_control mailbox register (e.g. on OMAP4)
TYPE2 - if it has Power down bit in control_dev_conf register. e.g. USB2 PHY
TYPE3 - if it has DPLL and individual Rx & Tx power control. e.g. USB3 PHY or SATA PHY
TYPE4 - if it has both power down and power aux registers. e.g. USB2 PHY on DRA7
* Have only one power control API "omap_control_usb_phy_power()" instead of a
different one for each PHY type.
* Get rid of omap_get_control_dev() so that we can support multiple instances
of the control device. We take advantage of the fact that omap control USB device
is only present on OMAP4 onwards and hence only supports DT boot. The users
of control USB device can get a reference to it from the device node's phandle.
Patches are based on top of v3.11-rc3 with balbi/next on top.
Smoke tested on OMAP4 panda with MUSB in gadget mode (g_zero).
You can find the patches in branch
usb-control-module
in git tree
git://github.com/rogerq/linux.git
cheers,
-roger
Roger Quadros (7):
usb: phy: omap: Add new PHY types and remove
omap_control_usb3_phy_power()
usb: phy: omap-usb2: Don't use omap_get_control_dev()
usb: phy: omap-usb3: Don't use omap_get_control_dev()
usb: musb: omap2430: Don't use omap_get_control_dev()
usb: phy: omap: get rid of omap_get_control_dev()
ARM: dts: omap4: update omap-control-usb nodes
ARM: dts: omap5: update omap-control-usb node
Documentation/devicetree/bindings/usb/omap-usb.txt | 23 ++--
arch/arm/boot/dts/omap4.dtsi | 17 ++-
arch/arm/boot/dts/omap5.dtsi | 18 ++-
drivers/usb/musb/omap2430.c | 22 +++-
drivers/usb/phy/phy-omap-control.c | 160 ++++++++++---------
drivers/usb/phy/phy-omap-usb2.c | 20 ++-
drivers/usb/phy/phy-omap-usb3.c | 26 +++-
include/linux/usb/omap_control_usb.h | 23 +--
8 files changed, 182 insertions(+), 127 deletions(-)
--
1.7.4.1
^ permalink raw reply
* Re: [PATCHv4 04/33] CLK: omap: move part of the machine specific clock header contents to driver
From: Nishanth Menon @ 2013-08-01 14:04 UTC (permalink / raw)
To: Tero Kristo
Cc: linux-omap, paul, khilman, tony, mturquette, rnayak,
linux-arm-kernel, devicetree@vger.kernel.org
In-Reply-To: <51F8E00E.7070506@ti.com>
On 07/31/2013 04:59 AM, Tero Kristo wrote:
> On 07/30/2013 09:22 PM, Nishanth Menon wrote:
>> this patch should be 3/33 to allow dpll.c to build.
>>
>> On 07/23/2013 02:19 AM, Tero Kristo wrote:
>>> Some of the clock.h contents are needed by the new OMAP clock driver,
>>> including dpll_data and clk_hw_omap. Thus, move these to the generic
>>> omap header file which can be accessed by the driver.
>>>
>> Looking at the change, I wonder what the rules are for the movement?
>> commit message was not clear.
>
> This is kind of a merge of almost everything that is needed by clock
> drivers at some point. I can move the changes along to the patches that
> actually need the exports for clarity and to keep compilation clean.
I think it is better to do in stages (while ensuring compilation is
clean) - it is a bit hard to understand need and context of movement
when a singular movement is done :(
[..]
>>> @@ -356,28 +230,13 @@ unsigned long omap_fixed_divisor_recalc(struct
>>> clk_hw *hw,
>>> /* DPLL Type and DCO Selection Flags */
>>> #define DPLL_J_TYPE 0x1
>>>
>>> -long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long
>>> target_rate,
>>> - unsigned long *parent_rate);
>>> -unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long
>>> parent_rate);
>>> -int omap3_noncore_dpll_enable(struct clk_hw *hw);
>>> -void omap3_noncore_dpll_disable(struct clk_hw *hw);
>>> -int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
>>> - unsigned long parent_rate);
>>
>> Why are these being moved to generic?
>
> These are used from the dpll.c by the ops.
The ops should probably move as well from mach-omap2. No reason to keep
it around in mach-omap2 then.
[...]
>>> diff --git a/include/linux/clk/omap.h b/include/linux/clk/omap.h
>>> index 647f02f..cba892a 100644
>>> --- a/include/linux/clk/omap.h
>>> +++ b/include/linux/clk/omap.h
>>> @@ -19,6 +19,161 @@
>>> #ifndef __LINUX_CLK_OMAP_H_
>>> #define __LINUX_CLK_OMAP_H_
>>>
>>> -int __init dt_omap_clk_init(void);
>>> +/**
>>> + * struct dpll_data - DPLL registers and integration data
>>> + * @mult_div1_reg: register containing the DPLL M and N bitfields
>>> + * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
>>> + * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
>>> + * @clk_bypass: struct clk pointer to the clock's bypass clock input
>>> + * @clk_ref: struct clk pointer to the clock's reference clock input
>>> + * @control_reg: register containing the DPLL mode bitfield
>>> + * @enable_mask: mask of the DPLL mode bitfield in @control_reg
>>> + * @last_rounded_rate: cache of the last rate result of
>>> omap2_dpll_round_rate()
>>> + * @last_rounded_m: cache of the last M result of
>>> omap2_dpll_round_rate()
>>> + * @last_rounded_m4xen: cache of the last M4X result of
>>> + * omap4_dpll_regm4xen_round_rate()
>>> + * @last_rounded_lpmode: cache of the last lpmode result of
>>> + * omap4_dpll_lpmode_recalc()
>>> + * @max_multiplier: maximum valid non-bypass multiplier value (actual)
>>> + * @last_rounded_n: cache of the last N result of
>>> omap2_dpll_round_rate()
>>> + * @min_divider: minimum valid non-bypass divider value (actual)
>>> + * @max_divider: maximum valid non-bypass divider value (actual)
>>> + * @modes: possible values of @enable_mask
>>> + * @autoidle_reg: register containing the DPLL autoidle mode bitfield
>>> + * @idlest_reg: register containing the DPLL idle status bitfield
>>> + * @autoidle_mask: mask of the DPLL autoidle mode bitfield in
>>> @autoidle_reg
>>> + * @freqsel_mask: mask of the DPLL jitter correction bitfield in
>>> @control_reg
>>> + * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
>>> + * @lpmode_mask: mask of the DPLL low-power mode bitfield in
>>> @control_reg
>>> + * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in
>>> @control_reg
>>> + * @auto_recal_bit: bitshift of the driftguard enable bit in
>>> @control_reg
>>> + * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for
>>> recalibration IRQs
>>> + * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for
>>> recalibration IRQs
>>> + * @flags: DPLL type/features (see below)
>>> + *
>>> + * Possible values for @flags:
>>> + * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
>> but the flag is in arch/arm/mach-omap2/clock.h ?
>
> I'll look at this and probably move the flag also.
>
>>
>>> + *
>>> + * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
>>> + *
>>> + * XXX Some DPLLs have multiple bypass inputs, so it's not technically
>>> + * correct to only have one @clk_bypass pointer.
>>> + *
>>> + * XXX The runtime-variable fields (@last_rounded_rate,
>>> @last_rounded_m,
>>> + * @last_rounded_n) should be separated from the runtime-fixed fields
>>> + * and placed into a different structure, so that the runtime-fixed
>>> data
>>> + * can be placed into read-only space.
>>> + */
>>> +struct dpll_data {
>>
>> is it necessary to export this? usage is limited to dpll.c and could be
>> made private to it alone, no?
>
> No, unfortunately dpll_data is used both by the dpll.c and the support
> code under mach-omap2. This is some sort of intermediate solution, so
> get DT clocks working first, then move the support code also under
> drivers/clk/omap.
looks like a case for omap_dpll.h instead of a single mega header with
everything in it?
[...]
--
Regards,
Nishanth Menon
^ permalink raw reply
* [PATCH 6/7] ARM: dts: omap4: update omap-control-usb nodes
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros, Benoit Cousson
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
Split otghs_ctrl and USB2 PHY power down into separate
omap-control-usb nodes. Update ti,mode property.
CC: Benoit Cousson <benoit.cousson@linaro.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/omap4.dtsi | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 22d9f2b..9a6fa27 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -519,7 +519,7 @@
usb2_phy: usb2phy@4a0ad080 {
compatible = "ti,omap-usb2";
reg = <0x4a0ad080 0x58>;
- ctrl-module = <&omap_control_usb>;
+ ctrl-module = <&omap_control_usb2phy>;
};
};
@@ -643,11 +643,17 @@
};
};
- omap_control_usb: omap-control-usb@4a002300 {
+ omap_control_usb2phy: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a00233c 0x4>;
- reg-names = "control_dev_conf", "otghs_control";
+ reg = <0x4a002300 0x4>;
+ reg-names = "power";
+ ti,type = <2>;
+ };
+
+ omap_control_usbotg: omap-control-usb@4a00233c {
+ compatible = "ti,omap-control-usb";
+ reg = <0x4a00233c 0x4>;
+ reg-names = "otghs_control";
ti,type = <1>;
};
@@ -662,6 +668,7 @@
num-eps = <16>;
ram-bits = <12>;
ti,has-mailbox;
+ ctrl-module = <&omap_control_usbotg>;
};
};
};
--
1.7.4.1
^ permalink raw reply related
* [PATCH 5/7] usb: phy: omap: get rid of omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
This function was preventing us from supporting multiple
instances. Get rid of it. Since we support DT boots only,
users can get the control device phandle from the DT node.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/phy/phy-omap-control.c | 31 ++++++++++---------------------
include/linux/usb/omap_control_usb.h | 5 -----
2 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c
index cf93c5a..015eeef 100644
--- a/drivers/usb/phy/phy-omap-control.c
+++ b/drivers/usb/phy/phy-omap-control.c
@@ -25,26 +25,6 @@
#include <linux/clk.h>
#include <linux/usb/omap_control_usb.h>
-static struct omap_control_usb *control_usb;
-
-/**
- * omap_get_control_dev - returns the device pointer for this control device
- *
- * This API should be called to get the device pointer for this control
- * module device. This device pointer should be used for called other
- * exported API's in this driver.
- *
- * To be used by PHY driver and glue driver.
- */
-struct device *omap_get_control_dev(void)
-{
- if (!control_usb)
- return ERR_PTR(-ENODEV);
-
- return control_usb->dev;
-}
-EXPORT_SYMBOL_GPL(omap_get_control_dev);
-
/**
* omap_control_usb_phy_power - power on/off the phy using control module reg
* @dev: the control module device
@@ -187,11 +167,19 @@ void omap_control_usb_set_mode(struct device *dev,
{
struct omap_control_usb *ctrl_usb;
- if (IS_ERR(dev) || control_usb->type != OMAP_CTRL_DEV_TYPE1)
+ if (IS_ERR(dev) || !dev)
return;
ctrl_usb = dev_get_drvdata(dev);
+ if (!ctrl_usb) {
+ dev_err(dev, "Invalid control usb device\n");
+ return;
+ }
+
+ if (ctrl_usb->type != OMAP_CTRL_DEV_TYPE1)
+ return;
+
switch (mode) {
case USB_MODE_HOST:
omap_control_usb_host_mode(ctrl_usb);
@@ -214,6 +202,7 @@ static int omap_control_usb_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct omap_control_usb_platform_data *pdata =
dev_get_platdata(&pdev->dev);
+ struct omap_control_usb *control_usb;
control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
GFP_KERNEL);
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 7f027d3..8b48584 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -67,15 +67,10 @@ enum omap_control_usb_mode {
#define OMAP_CTRL_USB2_PHY_PD BIT(28)
#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
-extern struct device *omap_get_control_dev(void);
extern void omap_control_usb_phy_power(struct device *dev, int on);
extern void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode);
#else
-static inline struct device *omap_get_control_dev(void)
-{
- return ERR_PTR(-ENODEV);
-}
static inline void omap_control_usb_phy_power(struct device *dev, int on)
{
--
1.7.4.1
^ permalink raw reply related
* [PATCH 4/7] usb: musb: omap2430: Don't use omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/musb/omap2430.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ebb46ec..1db9588 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -38,6 +38,7 @@
#include <linux/delay.h>
#include <linux/usb/musb-omap.h>
#include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
#include "musb_core.h"
#include "omap2430.h"
@@ -547,12 +548,25 @@ static int omap2430_probe(struct platform_device *pdev)
}
if (pdata->has_mailbox) {
- glue->control_otghs = omap_get_control_dev();
- if (IS_ERR(glue->control_otghs)) {
- dev_vdbg(&pdev->dev, "Failed to get control device\n");
- ret = PTR_ERR(glue->control_otghs);
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
+
+ control_node = of_parse_phandle(np, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(&pdev->dev, "Failed to get control device phandle\n");
+ ret = -ENODEV;
+ goto err2;
+ }
+
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(&pdev->dev, "Failed to get control device\n");
+ ret = -ENODEV;
goto err2;
}
+
+ glue->control_otghs = &control_pdev->dev;
+
} else {
glue->control_otghs = ERR_PTR(-ENODEV);
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/7] usb: phy: omap-usb3: Don't use omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.
As we don't support non-DT boot, we just bail out on probe
if device node is not present.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/phy/phy-omap-usb3.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c
index 4a7f27c..bad032e 100644
--- a/drivers/usb/phy/phy-omap-usb3.c
+++ b/drivers/usb/phy/phy-omap-usb3.c
@@ -26,6 +26,7 @@
#include <linux/pm_runtime.h>
#include <linux/delay.h>
#include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
#define PLL_STATUS 0x00000004
#define PLL_GO 0x00000008
@@ -198,6 +199,12 @@ static int omap_usb3_probe(struct platform_device *pdev)
{
struct omap_usb *phy;
struct resource *res;
+ struct device_node *node = pdev->dev.of_node;
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
+
+ if (!node)
+ return -ENODEV;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
@@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev)
return -EINVAL;
}
- phy->control_dev = omap_get_control_dev();
- if (IS_ERR(phy->control_dev)) {
- dev_dbg(&pdev->dev, "Failed to get control device\n");
+ control_node = of_parse_phandle(node, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(&pdev->dev, "Failed to get control device phandle\n");
return -ENODEV;
}
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
+ }
+
+ phy->control_dev = &control_pdev->dev;
omap_control_usb_phy_power(phy->control_dev, 0);
usb_add_phy_dev(&phy->phy);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/7] usb: phy: omap-usb2: Don't use omap_get_control_dev()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.
As we don't support non-DT boot, we just bail out on probe
if device node is not present.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/phy/phy-omap-usb2.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/usb/phy/phy-omap-usb2.c
index 376b367..77e0cf4 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/usb/phy/phy-omap-usb2.c
@@ -28,6 +28,7 @@
#include <linux/pm_runtime.h>
#include <linux/delay.h>
#include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
/**
* omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -124,6 +125,8 @@ static int omap_usb2_probe(struct platform_device *pdev)
struct omap_usb *phy;
struct usb_otg *otg;
struct device_node *node = pdev->dev.of_node;
+ struct device_node *control_node;
+ struct platform_device *control_pdev;
if (!node)
return -ENODEV;
@@ -148,11 +151,18 @@ static int omap_usb2_probe(struct platform_device *pdev)
phy->phy.otg = otg;
phy->phy.type = USB_PHY_TYPE_USB2;
- phy->control_dev = omap_get_control_dev();
- if (IS_ERR(phy->control_dev)) {
- dev_dbg(&pdev->dev, "Failed to get control device\n");
+ control_node = of_parse_phandle(node, "ctrl-module", 0);
+ if (!control_node) {
+ dev_err(&pdev->dev, "Failed to get control device phandle\n");
return -ENODEV;
}
+ control_pdev = of_find_device_by_node(control_node);
+ if (!control_pdev) {
+ dev_err(&pdev->dev, "Failed to get control device\n");
+ return -ENODEV;
+ }
+
+ phy->control_dev = &control_pdev->dev;
phy->is_suspended = 1;
omap_control_usb_phy_power(phy->control_dev, 0);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 1/7] usb: phy: omap: Add new PHY types and remove omap_control_usb3_phy_power()
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com>
TYPE2 meaning has changed. It is now a USB2 phy with Power down bit in
control_dev_conf register.
Introduce TYPE3 and TYPE4 PHY. TYPE3 is USB3 phy with DPLL and individual
TX/RX power control. TYPE4 is USB2 phy with power aux register.
Update DT binding information to reflect these changes.
Also get rid of omap_control_usb3_phy_power(). Just one function
i.e. omap_control_usb_phy_power() will now take care of all PHY types.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 23 ++--
drivers/usb/phy/phy-omap-control.c | 129 +++++++++++---------
drivers/usb/phy/phy-omap-usb2.c | 4 +
drivers/usb/phy/phy-omap-usb3.c | 6 +-
include/linux/usb/omap_control_usb.h | 18 ++--
5 files changed, 100 insertions(+), 80 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 57e71f6..e2606ab 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -75,20 +75,19 @@ OMAP CONTROL USB
Required properties:
- compatible: Should be "ti,omap-control-usb"
- reg : Address and length of the register set for the device. It contains
- the address of "control_dev_conf" and "otghs_control" or "phy_power_usb"
- depending upon omap4 or omap5.
- - reg-names: The names of the register addresses corresponding to the registers
- filled in "reg".
- - ti,type: This is used to differentiate whether the control module has
- usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to
- notify events to the musb core and omap5 has usb3 phy power register to
- power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3
- phy power.
+ the address of "otghs_control" for type 1 or "power" register for other types.
+ For type 4, it must also contain "power_aux" register.
+ - reg-names: should be otghs_control for type 1 and "power" for other types.
+ - ti,type: This is used to specify the type of control register.
+ Should be one of the following:
+ 1 - if it has otghs_control mailbox register (e.g. on OMAP4)
+ 2 - if it has Power down bit in control_dev_conf register. e.g. USB2 PHY
+ 3 - if it has DPLL and individual Rx & Tx power control. e.g. USB3 PHY or SATA PHY
+ 4 - if it has both power down and power aux registers. e.g. USB2 PHY on DRA7
omap_control_usb: omap-control-usb@4a002300 {
compatible = "ti,omap-control-usb";
- reg = <0x4a002300 0x4>,
- <0x4a00233c 0x4>;
- reg-names = "control_dev_conf", "otghs_control";
+ reg = <0x4a00233c 0x4>;
+ reg-names = "otghs_control";
ti,type = <1>;
};
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c
index a4dda8e..cf93c5a 100644
--- a/drivers/usb/phy/phy-omap-control.c
+++ b/drivers/usb/phy/phy-omap-control.c
@@ -46,61 +46,76 @@ struct device *omap_get_control_dev(void)
EXPORT_SYMBOL_GPL(omap_get_control_dev);
/**
- * omap_control_usb3_phy_power - power on/off the serializer using control
- * module
+ * omap_control_usb_phy_power - power on/off the phy using control module reg
* @dev: the control module device
- * @on: 0 to off and 1 to on based on powering on or off the PHY
- *
- * usb3 PHY driver should call this API to power on or off the PHY.
+ * @on: 0 or 1, based on powering on or off the PHY
*/
-void omap_control_usb3_phy_power(struct device *dev, bool on)
+void omap_control_usb_phy_power(struct device *dev, int on)
{
- u32 val;
+ u32 val, val_aux;
unsigned long rate;
- struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+ struct omap_control_usb *control_usb;
- if (control_usb->type != OMAP_CTRL_DEV_TYPE2)
+ if (IS_ERR(dev) || !dev) {
+ pr_err("%s: invalid device\n", __func__);
return;
+ }
- rate = clk_get_rate(control_usb->sys_clk);
- rate = rate/1000000;
+ control_usb = dev_get_drvdata(dev);
+ if (!control_usb) {
+ dev_err(dev, "%s: invalid control usb device\n", __func__);
+ return;
+ }
- val = readl(control_usb->phy_power);
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE1)
+ return;
- if (on) {
- val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
- OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
- } else {
- val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- }
+ val = readl(control_usb->power);
- writel(val, control_usb->phy_power);
-}
-EXPORT_SYMBOL_GPL(omap_control_usb3_phy_power);
+ switch (control_usb->type) {
+ case OMAP_CTRL_DEV_TYPE2:
+ if (on)
+ val &= ~OMAP_CTRL_DEV_PHY_PD;
+ else
+ val |= OMAP_CTRL_DEV_PHY_PD;
+ break;
-/**
- * omap_control_usb_phy_power - power on/off the phy using control module reg
- * @dev: the control module device
- * @on: 0 or 1, based on powering on or off the PHY
- */
-void omap_control_usb_phy_power(struct device *dev, int on)
-{
- u32 val;
- struct omap_control_usb *control_usb = dev_get_drvdata(dev);
+ case OMAP_CTRL_DEV_TYPE3:
+ rate = clk_get_rate(control_usb->sys_clk);
+ rate = rate/1000000;
+
+ if (on) {
+ val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
+ OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
+ val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
+ OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+ val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
+ } else {
+ val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
+ val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
+ OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+ }
+ break;
- val = readl(control_usb->dev_conf);
+ case OMAP_CTRL_DEV_TYPE4:
+ val_aux = readl(control_usb->power_aux);
+ if (on) {
+ val &= ~OMAP_CTRL_USB2_PHY_PD;
+ val_aux |= 0x100;
+ } else {
+ val |= OMAP_CTRL_USB2_PHY_PD;
+ val_aux &= ~0x100;
+ }
- if (on)
- val &= ~OMAP_CTRL_DEV_PHY_PD;
- else
- val |= OMAP_CTRL_DEV_PHY_PD;
+ writel(val_aux, control_usb->power_aux);
+ break;
+ default:
+ dev_err(dev, "%s: type %d not recognized\n",
+ __func__, control_usb->type);
+ break;
+ }
- writel(val, control_usb->dev_conf);
+ writel(val, control_usb->power);
}
EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
@@ -218,12 +233,6 @@ static int omap_control_usb_probe(struct platform_device *pdev)
control_usb->dev = &pdev->dev;
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "control_dev_conf");
- control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(control_usb->dev_conf))
- return PTR_ERR(control_usb->dev_conf);
-
if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"otghs_control");
@@ -231,16 +240,17 @@ static int omap_control_usb_probe(struct platform_device *pdev)
&pdev->dev, res);
if (IS_ERR(control_usb->otghs_control))
return PTR_ERR(control_usb->otghs_control);
- }
-
- if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
+ } else {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "phy_power_usb");
- control_usb->phy_power = devm_ioremap_resource(
- &pdev->dev, res);
- if (IS_ERR(control_usb->phy_power))
- return PTR_ERR(control_usb->phy_power);
+ "power");
+ control_usb->power = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_usb->power)) {
+ dev_err(&pdev->dev, "Couldn't get power register\n");
+ return PTR_ERR(control_usb->power);
+ }
+ }
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE3) {
control_usb->sys_clk = devm_clk_get(control_usb->dev,
"sys_clkin");
if (IS_ERR(control_usb->sys_clk)) {
@@ -249,6 +259,15 @@ static int omap_control_usb_probe(struct platform_device *pdev)
}
}
+ if (control_usb->type == OMAP_CTRL_DEV_TYPE4) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "power_aux");
+ control_usb->power_aux = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_usb->power_aux)) {
+ dev_err(&pdev->dev, "Couldn't get power_aux register\n");
+ return PTR_ERR(control_usb->power_aux);
+ }
+ }
dev_set_drvdata(control_usb->dev, control_usb);
diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/usb/phy/phy-omap-usb2.c
index 844ab68..376b367 100644
--- a/drivers/usb/phy/phy-omap-usb2.c
+++ b/drivers/usb/phy/phy-omap-usb2.c
@@ -123,6 +123,10 @@ static int omap_usb2_probe(struct platform_device *pdev)
{
struct omap_usb *phy;
struct usb_otg *otg;
+ struct device_node *node = pdev->dev.of_node;
+
+ if (!node)
+ return -ENODEV;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c
index fc15694..4a7f27c 100644
--- a/drivers/usb/phy/phy-omap-usb3.c
+++ b/drivers/usb/phy/phy-omap-usb3.c
@@ -100,7 +100,7 @@ static int omap_usb3_suspend(struct usb_phy *x, int suspend)
udelay(1);
} while (--timeout);
- omap_control_usb3_phy_power(phy->control_dev, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
phy->is_suspended = 1;
} else if (!suspend && phy->is_suspended) {
@@ -189,7 +189,7 @@ static int omap_usb3_init(struct usb_phy *x)
if (ret)
return ret;
- omap_control_usb3_phy_power(phy->control_dev, 1);
+ omap_control_usb_phy_power(phy->control_dev, 1);
return 0;
}
@@ -245,7 +245,7 @@ static int omap_usb3_probe(struct platform_device *pdev)
return -ENODEV;
}
- omap_control_usb3_phy_power(phy->control_dev, 0);
+ omap_control_usb_phy_power(phy->control_dev, 0);
usb_add_phy_dev(&phy->phy);
platform_set_drvdata(pdev, phy);
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c..7f027d3 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -22,9 +22,9 @@
struct omap_control_usb {
struct device *dev;
- u32 __iomem *dev_conf;
u32 __iomem *otghs_control;
- u32 __iomem *phy_power;
+ u32 __iomem *power;
+ u32 __iomem *power_aux;
struct clk *sys_clk;
@@ -42,9 +42,10 @@ enum omap_control_usb_mode {
USB_MODE_DISCONNECT,
};
-/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
-#define OMAP_CTRL_DEV_TYPE1 0x1
-#define OMAP_CTRL_DEV_TYPE2 0x2
+#define OMAP_CTRL_DEV_TYPE1 0x1 /* Mailbox OTGHS_CONTROL */
+#define OMAP_CTRL_DEV_TYPE2 0x2 /* USB2_PHY, power down in CONTROL_DEV_CONF */
+#define OMAP_CTRL_DEV_TYPE3 0x3 /* USB3_PHY, DPLL & seperate Rx/Tx power */
+#define OMAP_CTRL_DEV_TYPE4 0x4 /* USB2 PHY, power and power_aux e.g. DRA7 */
#define OMAP_CTRL_DEV_PHY_PD BIT(0)
@@ -63,10 +64,11 @@ enum omap_control_usb_mode {
#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
+#define OMAP_CTRL_USB2_PHY_PD BIT(28)
+
#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
extern struct device *omap_get_control_dev(void);
extern void omap_control_usb_phy_power(struct device *dev, int on);
-extern void omap_control_usb3_phy_power(struct device *dev, bool on);
extern void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode);
#else
@@ -79,10 +81,6 @@ static inline void omap_control_usb_phy_power(struct device *dev, int on)
{
}
-static inline void omap_control_usb3_phy_power(struct device *dev, int on)
-{
-}
-
static inline void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode)
{
--
1.7.4.1
^ permalink raw reply related
* [PATCH 0/7] phy: omap-usb: Support multiple instances and new types
From: Roger Quadros @ 2013-08-01 14:05 UTC (permalink / raw)
To: balbi
Cc: tony, kishon, george.cherian, dmurphy, linux-usb, linux-omap,
devicetree, linux-kernel, Roger Quadros
Hi,
This patchset does the following:
* Restructure and add support for new PHY types. We now support the follwing
four types
TYPE1 - if it has otghs_control mailbox register (e.g. on OMAP4)
TYPE2 - if it has Power down bit in control_dev_conf register. e.g. USB2 PHY
TYPE3 - if it has DPLL and individual Rx & Tx power control. e.g. USB3 PHY or SATA PHY
TYPE4 - if it has both power down and power aux registers. e.g. USB2 PHY on DRA7
* Have only one power control API "omap_control_usb_phy_power()" instead of a
different one for each PHY type.
* Get rid of omap_get_control_dev() so that we can support multiple instances
of the control device. We take advantage of the fact that omap control USB device
is only present on OMAP4 onwards and hence only supports DT boot. The users
of control USB device can get a reference to it from the device node's phandle.
Patches are based on top of v3.11-rc3 with balbi/next on top.
Smoke tested on OMAP4 panda with MUSB in gadget mode (g_zero).
You can find the patches in branch
usb-control-module
in git tree
git://github.com/rogerq/linux.git
cheers,
-roger
Roger Quadros (7):
usb: phy: omap: Add new PHY types and remove
omap_control_usb3_phy_power()
usb: phy: omap-usb2: Don't use omap_get_control_dev()
usb: phy: omap-usb3: Don't use omap_get_control_dev()
usb: musb: omap2430: Don't use omap_get_control_dev()
usb: phy: omap: get rid of omap_get_control_dev()
ARM: dts: omap4: update omap-control-usb nodes
ARM: dts: omap5: update omap-control-usb node
Documentation/devicetree/bindings/usb/omap-usb.txt | 23 ++--
arch/arm/boot/dts/omap4.dtsi | 17 ++-
arch/arm/boot/dts/omap5.dtsi | 18 ++-
drivers/usb/musb/omap2430.c | 22 +++-
drivers/usb/phy/phy-omap-control.c | 160 ++++++++++---------
drivers/usb/phy/phy-omap-usb2.c | 20 ++-
drivers/usb/phy/phy-omap-usb3.c | 26 +++-
include/linux/usb/omap_control_usb.h | 23 +--
8 files changed, 182 insertions(+), 127 deletions(-)
--
1.7.4.1
^ permalink raw reply
* [PATCHv4 04/33] CLK: omap: move part of the machine specific clock header contents to driver
From: Nishanth Menon @ 2013-08-01 14:04 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <51F8E00E.7070506@ti.com>
On 07/31/2013 04:59 AM, Tero Kristo wrote:
> On 07/30/2013 09:22 PM, Nishanth Menon wrote:
>> this patch should be 3/33 to allow dpll.c to build.
>>
>> On 07/23/2013 02:19 AM, Tero Kristo wrote:
>>> Some of the clock.h contents are needed by the new OMAP clock driver,
>>> including dpll_data and clk_hw_omap. Thus, move these to the generic
>>> omap header file which can be accessed by the driver.
>>>
>> Looking at the change, I wonder what the rules are for the movement?
>> commit message was not clear.
>
> This is kind of a merge of almost everything that is needed by clock
> drivers at some point. I can move the changes along to the patches that
> actually need the exports for clarity and to keep compilation clean.
I think it is better to do in stages (while ensuring compilation is
clean) - it is a bit hard to understand need and context of movement
when a singular movement is done :(
[..]
>>> @@ -356,28 +230,13 @@ unsigned long omap_fixed_divisor_recalc(struct
>>> clk_hw *hw,
>>> /* DPLL Type and DCO Selection Flags */
>>> #define DPLL_J_TYPE 0x1
>>>
>>> -long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long
>>> target_rate,
>>> - unsigned long *parent_rate);
>>> -unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long
>>> parent_rate);
>>> -int omap3_noncore_dpll_enable(struct clk_hw *hw);
>>> -void omap3_noncore_dpll_disable(struct clk_hw *hw);
>>> -int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
>>> - unsigned long parent_rate);
>>
>> Why are these being moved to generic?
>
> These are used from the dpll.c by the ops.
The ops should probably move as well from mach-omap2. No reason to keep
it around in mach-omap2 then.
[...]
>>> diff --git a/include/linux/clk/omap.h b/include/linux/clk/omap.h
>>> index 647f02f..cba892a 100644
>>> --- a/include/linux/clk/omap.h
>>> +++ b/include/linux/clk/omap.h
>>> @@ -19,6 +19,161 @@
>>> #ifndef __LINUX_CLK_OMAP_H_
>>> #define __LINUX_CLK_OMAP_H_
>>>
>>> -int __init dt_omap_clk_init(void);
>>> +/**
>>> + * struct dpll_data - DPLL registers and integration data
>>> + * @mult_div1_reg: register containing the DPLL M and N bitfields
>>> + * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
>>> + * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
>>> + * @clk_bypass: struct clk pointer to the clock's bypass clock input
>>> + * @clk_ref: struct clk pointer to the clock's reference clock input
>>> + * @control_reg: register containing the DPLL mode bitfield
>>> + * @enable_mask: mask of the DPLL mode bitfield in @control_reg
>>> + * @last_rounded_rate: cache of the last rate result of
>>> omap2_dpll_round_rate()
>>> + * @last_rounded_m: cache of the last M result of
>>> omap2_dpll_round_rate()
>>> + * @last_rounded_m4xen: cache of the last M4X result of
>>> + * omap4_dpll_regm4xen_round_rate()
>>> + * @last_rounded_lpmode: cache of the last lpmode result of
>>> + * omap4_dpll_lpmode_recalc()
>>> + * @max_multiplier: maximum valid non-bypass multiplier value (actual)
>>> + * @last_rounded_n: cache of the last N result of
>>> omap2_dpll_round_rate()
>>> + * @min_divider: minimum valid non-bypass divider value (actual)
>>> + * @max_divider: maximum valid non-bypass divider value (actual)
>>> + * @modes: possible values of @enable_mask
>>> + * @autoidle_reg: register containing the DPLL autoidle mode bitfield
>>> + * @idlest_reg: register containing the DPLL idle status bitfield
>>> + * @autoidle_mask: mask of the DPLL autoidle mode bitfield in
>>> @autoidle_reg
>>> + * @freqsel_mask: mask of the DPLL jitter correction bitfield in
>>> @control_reg
>>> + * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
>>> + * @lpmode_mask: mask of the DPLL low-power mode bitfield in
>>> @control_reg
>>> + * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in
>>> @control_reg
>>> + * @auto_recal_bit: bitshift of the driftguard enable bit in
>>> @control_reg
>>> + * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for
>>> recalibration IRQs
>>> + * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for
>>> recalibration IRQs
>>> + * @flags: DPLL type/features (see below)
>>> + *
>>> + * Possible values for @flags:
>>> + * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
>> but the flag is in arch/arm/mach-omap2/clock.h ?
>
> I'll look at this and probably move the flag also.
>
>>
>>> + *
>>> + * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
>>> + *
>>> + * XXX Some DPLLs have multiple bypass inputs, so it's not technically
>>> + * correct to only have one @clk_bypass pointer.
>>> + *
>>> + * XXX The runtime-variable fields (@last_rounded_rate,
>>> @last_rounded_m,
>>> + * @last_rounded_n) should be separated from the runtime-fixed fields
>>> + * and placed into a different structure, so that the runtime-fixed
>>> data
>>> + * can be placed into read-only space.
>>> + */
>>> +struct dpll_data {
>>
>> is it necessary to export this? usage is limited to dpll.c and could be
>> made private to it alone, no?
>
> No, unfortunately dpll_data is used both by the dpll.c and the support
> code under mach-omap2. This is some sort of intermediate solution, so
> get DT clocks working first, then move the support code also under
> drivers/clk/omap.
looks like a case for omap_dpll.h instead of a single mega header with
everything in it?
[...]
--
Regards,
Nishanth Menon
^ permalink raw reply
* Re: Network booting
From: Tomas Frydrych @ 2013-08-01 14:06 UTC (permalink / raw)
To: yocto
In-Reply-To: <51FA1764.4060408@r-finger.com>
[-- Attachment #1: Type: text/plain, Size: 1889 bytes --]
Hi Chris,
On 01/08/13 09:08, Tomas Frydrych wrote:
> On 31/07/13 21:30, Chris Tapp wrote:
> It's relatively easy to add support for tftp to the yocto live image
> scripts; this allows you to either boot from the network, or install
> from the network. I have have some raw patches kicking around, that add
> support for both tftp and scp, I have been meaning to clean it up and
> post an rfc to the list, I'll try to get that done this week.
I am attaching the patches I have, it's a bit raw, and needs more work
before submitting for consideration in oe-core, but I think out of the
box tftp support would be useful to have somewhere.
The patches include changes to the live/install scripts from the oe-core
initramfs recipes and an image recipe for an initrd image with the
necessary tools (I initially started to write separate recipes for the
scripts, but realized quickly that the differences from the standard
live image bits are so small that's hardly justified in comparison to
the increased maintenance burden.)
The main changes to the scripts are:
* use syslinux instead of grub, makes life lot simpler, 'naf said,
* rework the install script so that unassisted install is possible,
* support tfpt for kernel/rootfs loading, and scp for rootfs loading,
The test-ssh-key recipe provides a dummy (i.e., compromised) ssh key
that can be used for rudimentary testing of using scp for kernel
loading; scp is potentially useful for remote system updates from
outside of LAN boundaries, but a real set up would need bit of thought
on how to manage the real keys, etc.
The net-image also generates a sample config file for PXELinux in the
deploy/images directory (net-image.pxelinux.cfg), which documents fairly
well how to set it up. I hope this is of some use, at least to foster
more discussion. :)
Tomas
--
http://sleepfive.com
[-- Attachment #2: 0001-test-ssh-key-dummy-ssh-key-for-testing-of-scp-functi.patch --]
[-- Type: text/x-patch, Size: 4434 bytes --]
From 53e082c2b3eed2b1dafc604452d0414b6cdd9478 Mon Sep 17 00:00:00 2001
From: Tomas Frydrych <tomas@sleepfive.com>
Date: Thu, 1 Aug 2013 10:24:19 +0100
Subject: [PATCH 1/4] test-ssh-key: dummy ssh key for testing of scp
functionality
---
meta/recipes-support/test-ssh-key/test-ssh-key.bb | 73 +++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 meta/recipes-support/test-ssh-key/test-ssh-key.bb
diff --git a/meta/recipes-support/test-ssh-key/test-ssh-key.bb b/meta/recipes-support/test-ssh-key/test-ssh-key.bb
new file mode 100644
index 0000000..1e8fc86
--- /dev/null
+++ b/meta/recipes-support/test-ssh-key/test-ssh-key.bb
@@ -0,0 +1,73 @@
+DESCRIPTION = "Private ssh key for root user (for testing purposes only!)"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+
+# NB: THIS PACKAGE MUST NOT BE USED ON PRODUCTION IMAGES
+#
+# This package is intended for testing purposes only; it suffers from a number
+# of flaws:
+#
+# 1. The private key is not private and hence already compromized
+#
+# 2. The ssh config file is set up to avoid integrity checks on server keys
+# -- real set up would need to include a suitably pre-populated
+# known_hosts file.
+
+inherit allarch
+
+# SSHKEY and SSHKEY_PUB are variables, but are declared as functions so we
+# can use line breaks (a real package would source this from a file)
+
+SSHKEY () {
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAquOX/60//MR1gHpOjjTBkp4kl9Ry7ig3WY/r9h8nq3ody9zu
+tJmMIpTJKbDy0ZlSeFtE2ZwBrDBceuECH8jvHQC8EH3gj49eSwVOwbQu4A7ZdN0V
+l0Vm2vgG0Xvs3o2HzONm6NWYCrj2UfCeIeYrDFBuFpvCZSYxvw/qz9G8oSmi2brJ
+/Oqqz1BeAqgWraDwprdkQ7GHSNfkPdSZW+b1F/Gr2TTDU4N6IGGSgrMUxZZsf1kC
+D10qv73WyU3WODW5oycxw0kS7AisQis9A9n2XispYDfJuN3Fp6WcWI5GgILjqSWG
+g/rtvWU8EpK/nNJGei+cHXcFa8odzCVOqNO8lwIDAQABAoIBAQCiHgoL33Mtu77x
+JJazp+7fxjFW7JAfyX1A9R1YP5QlxFLSHQVDxctA3z+70od5OmgXkBZQDwUzMin5
+1M5sEvZs4E6JorFP4CYHK8DcWLCDlPLNQBQEjy2Vm+j0AQnk1AW55R2y0zdLLM9Z
+Stjpte6u3vqhbiDMTqCw7kvH3eSCSm2yV8e7ydFpRZxMjMcSNovjqq+hqSLKcLGL
+F4WoYotA5vomGT4D1YWWzD03QgElVnGT+VrOt0PtC5QHWvlsmkuZWeJukNOFLip7
++DH6/9fbTskO43O7p3tC1Lq1TkqUrXTJfUrVr5qjw6Nl07lO/gC/qFULA0FjUf8F
+Ayt7Ax35AoGBANR0+1FEvBBt5R16sdsbUdqLHMAq2efE0UdHSvyrIboj1frI+Xgn
+iN4p3rrJdWeKBJL4YH4XeOT/XYAmmfvffhEeiF1zB1Wy5/63TABXDf/uvh3GyO8P
+iL1ev0rswU56yqcQrX/j7SfOUtZwVyYnqblfemG/6v45uxdLyegDM8gNAoGBAM3p
+qQbJ8FDvgL9WoiRFN75bpV2wkx8ukHGfZt6I1nFvXreAwAa6zD5zxHjdn2R+sQUV
+wlqvgDjFjdp6xDiXMrsV47RSjJiByo15d+6jdXhZ8jrXXOYrZ4qDXE/wSnSei9bl
+iE82paKTNEeT7pz5psNf/DlRcb10ykX8Urgag+ozAoGAV5LYvQj+FC+YT2xxv4Ul
+WlYZRcTkCTsBoMXsTPYlctquqy8IVdTF//12R7we3szvUb172L3IIWx5mAdRVZcs
+GdZiE1ME5PhX1JCtjT5VEPfR+egkjxXyIUzawQGSNM08l1yyh5LmAJB1aNrpsVqM
+BVMr2PsI3D3jtpiQ40feokkCgYAuzV1N3bhxrP5mfxp7hAAXlF0R3oCSJdNPABwx
+mIilX9r3epwq62phB48wqa8A+IrjzP5P/nP2c3C6qAzRkAxH2cHXyquKPnX7khBg
+fWbF5Cvak/jZmCQAp7rjsIo7142RWrqQxqr/ONY5Lradl2EAJ2D85jYkCdev8Joc
+nmo9YQKBgG3EjvO1yJ0JxuImSNGq4W/2e8cXPMW/XTenQztPALU5mAAvxSCp7pi2
+zNmv60E3QHbdB4arglV73oCdGVpgFAamQbzvmVe9UptYs/iFVGIfktqlFqI7DelM
+4NmUlKy0OYMGvQ348Sg6trWQnaiw+F2I/Xtuw2cHRgv3N7346j2Q
+-----END RSA PRIVATE KEY-----
+}
+
+SSHKEY_PUB () {
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCq45f/rT/8xHWAek6ONMGSniSX1HLuKDdZj+v2Hyereh3L3O60mYwilMkpsPLRmVJ4W0TZnAGsMFx64QIfyO8dALwQfeCPj15LBU7BtC7gDtl03RWXRWba+AbRe+zejYfM42bo1ZgKuPZR8J4h5isMUG4Wm8JlJjG/D+rP0byhKaLZusn86qrPUF4CqBatoPCmt2RDsYdI1+Q91Jlb5vUX8avZNMNTg3ogYZKCsxTFlmx/WQIPXSq/vdbJTdY4NbmjJzHDSRLsCKxCKz0D2fZeKylgN8m43cWnpZxYjkaAguOpJYaD+u29ZTwSkr+c0kZ6L5wddwVryh3MJU6o07yX neftest@i7-990x
+}
+
+do_install () {
+ install -m 0700 -d ${D}/home/root/.ssh
+
+ echo "${SSHKEY}" > ${D}/home/root/.ssh/id_rsa
+ chmod 0700 ${D}/home/root/.ssh/id_rsa
+
+ echo "${SSHKEY_PUB}" > ${D}/home/root/.ssh/id_rsa.pub
+ chmod 0700 ${D}/home/root/.ssh/id_rsa.pub
+
+ echo "IdentityFile ~/.ssh/id_rsa" > ${D}/home/root/.ssh/config
+ echo "PreferredAuthentications publickey" >> ${D}/home/root/.ssh/config
+ echo "VisualHostKey no" >> ${D}/home/root/.ssh/config
+ echo "PreferredAuthentications publickey" >> ${D}/home/root/.ssh/config
+ echo "UserKnownHostsFile=/dev/null" >> ${D}/home/root/.ssh/config
+ echo "StrictHostKeyChecking=no" >> ${D}/home/root/.ssh/config
+ chmod 0700 ${D}/home/root/.ssh/config
+}
+
+FILES_${PN} = "/home/*"
--
1.7.10.4
[-- Attachment #3: 0002-initramfs-live-install-improve-install-script-for-un.patch --]
[-- Type: text/x-patch, Size: 8196 bytes --]
From bc0caeac7cfae173e98fa69c5217a9738b9284cb Mon Sep 17 00:00:00 2001
From: Tomas Frydrych <tomas@sleepfive.com>
Date: Thu, 1 Aug 2013 10:34:06 +0100
Subject: [PATCH 2/4] initramfs-live-install: improve install script for
unassisted tftp installs
This commit also modifies the script to use syslinux instead of grub
---
.../initrdscripts/files/init-install.sh | 194 ++++++++++++--------
.../initrdscripts/initramfs-live-install_1.0.bb | 4 +-
2 files changed, 119 insertions(+), 79 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index d2a0db3..8054173 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -1,6 +1,7 @@
#!/bin/sh -e
#
# Copyright (C) 2008-2011 Intel
+# Copyright (C) 2013 sleep(5) ltd
#
# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
#
@@ -13,43 +14,80 @@ boot_size=20
# 5% for the swap
swap_ratio=5
-found="no"
-
-echo "Searching for a hard drive..."
-for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
- do
- if [ -e /sys/block/${device}/removable ]; then
- if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
- found="yes"
-
- while true; do
+# parse current cmdline, strip out things we do not want, then append
+# the rest
+read_args() {
+ [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
+ for arg in $CMDLINE; do
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)' || :`
+ case $arg in
+ root=*) ;;
+ rootfstype=*) ;;
+ LABEL=*) ;;
+ initrd=*) ;;
+ ramdisk_size=*) ;;
+ ip=*) ;;
+ tftp_*) ;;
+ ro) ;;
+ BOOT_IMAGE=*) ;;
+ unassisted)
+ unassisted=yes ;;
+ install_dev=*)
+ install_dev=$optarg
+ unassisted=yes ;;
+ *) append="$append $arg" ;;
+ esac
+ done
+}
+
+append=
+unassisted=
+install_dev=
+read_args
+
+if [ "x$install_dev" = "x" ] ; then
+ found="no"
+
+ echo "Searching for a hard drive..."
+ for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
+ do
+ if [ -e /sys/block/${device}/removable ]; then
+ if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
+ found="yes"
+
+ if [ "x$unassisted" != "xyes" ] ; then
+ while true; do
# Try sleeping here to avoid getting kernel messages
# obscuring/confusing user
- sleep 5
- echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]"
- read answer
- if [ "$answer" = "y" ] ; then
- break
- fi
-
- if [ "$answer" = "n" ] ; then
- found=no
- break
- fi
-
- echo "Please answer by y or n"
- done
- fi
- fi
-
- if [ "$found" = "yes" ]; then
- break;
- fi
-
-done
-
-if [ "$found" = "no" ]; then
- exit 1
+ sleep 5
+ echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]"
+ read answer
+ if [ "$answer" = "y" ] ; then
+ break
+ fi
+
+ if [ "$answer" = "n" ] ; then
+ found=no
+ break
+ fi
+
+ echo "Please answer by y or n"
+ done
+ fi
+ fi
+ fi
+
+ if [ "$found" = "yes" ]; then
+ break;
+ fi
+
+ done
+
+ if [ "$found" = "no" ]; then
+ exit 1
+ fi
+else
+ device=$install_dev
fi
echo "Installing image on /dev/${device}"
@@ -80,6 +118,28 @@ fi
mkdir -p /tmp
cat /proc/mounts > /etc/mtab
+mkdir /rootmnt
+mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
+
+# check we have kernel in the image /boot directory before we do anything
+# else
+KERNEL_NAME=
+for k in `ls /rootmnt/boot/`; do
+ case $k in
+ bzImage|vmlinuz|zImage)
+ KERNEL_NAME=$k ;;
+ bzImage*|vmlinuz*|zImage*)
+ KERNEL_NAME=$k ;;
+ esac
+done
+
+if [ "x$KERNEL_NAME" != "x" ] ; then
+ echo "Using kernel $KERNEL_NAME"
+else
+ echo "Failed to locate kernel"
+ exit 1
+fi
+
disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
swap_size=$((disk_size*swap_ratio/100))
@@ -115,6 +175,7 @@ parted /dev/${device} mklabel msdos
echo "Creating boot partition on $bootfs"
parted /dev/${device} mkpart primary 0% $boot_size
+parted /dev/${device} "set" 1 boot on
echo "Creating rootfs partition on $rootfs"
parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
@@ -124,8 +185,8 @@ parted /dev/${device} mkpart primary $swap_start 100%
parted /dev/${device} print
-echo "Formatting $bootfs to ext3..."
-mkfs.ext3 $bootfs
+echo "Formatting $bootfs to FAT16..."
+mkfs.msdos -F 16 $bootfs
echo "Formatting $rootfs to ext3..."
mkfs.ext3 $rootfs
@@ -134,11 +195,10 @@ echo "Formatting swap partition...($swap)"
mkswap $swap
mkdir /ssd
-mkdir /rootmnt
mkdir /bootmnt
mount $rootfs /ssd
-mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt
+mount $bootfs /bootmnt
echo "Copying rootfs files..."
cp -a /rootmnt/* /ssd
@@ -152,49 +212,29 @@ if [ -d /ssd/etc/ ] ; then
fi
fi
-if [ -f /etc/grub.d/40_custom ] ; then
- echo "Preparing custom grub2 menu..."
- GRUBCFG="/bootmnt/boot/grub/grub.cfg"
- mount $bootfs /bootmnt
- mkdir -p $(dirname $GRUBCFG)
- cp /etc/grub.d/40_custom $GRUBCFG
- sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG
- sed -i "s/__VIDEO_MODE__/$3/g" $GRUBCFG
- sed -i "s/__VGA_MODE__/$4/g" $GRUBCFG
- sed -i "s/__CONSOLE__/$5/g" $GRUBCFG
- sed -i "/#/d" $GRUBCFG
- sed -i "/exec tail/d" $GRUBCFG
- chmod 0444 $GRUBCFG
- umount /bootmnt
-fi
-
umount /ssd
-umount /rootmnt
echo "Preparing boot partition..."
-mount $bootfs /ssd
-grub-install --root-directory=/ssd /dev/${device}
-
-echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map
-
-# If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst
-if [ ! -f /ssd/boot/grub/grub.cfg ] ; then
- echo "Preparing custom grub menu..."
- echo "default 0" > /ssd/boot/grub/menu.lst
- echo "timeout 30" >> /ssd/boot/grub/menu.lst
- echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst
- echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst
- echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst
-fi
-
-cp /media/$1/vmlinuz /ssd/boot/
-
-umount /ssd
+syslinux -i ${bootfs}
+dd bs=440 count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/${device}
+
+echo "Preparing syslinux menu..."
+echo "ALLOWOPTIONS 1" > /bootmnt/syslinux.cfg
+echo "DEFAULT default" >> /bootmnt/syslinux.cfg
+echo "TIMEOUT 10" >> /bootmnt/syslinux.cfg
+echo "PROMPT 1" >> /bootmnt/syslinux.cfg
+echo "LABEL default" >> /bootmnt/syslinux.cfg
+echo "KERNEL /vmlinuz" >> /bootmnt/syslinux.cfg
+echo "APPEND root=$rootfs rw $3 $4 $append" >> /bootmnt/syslinux.cfg
+
+cp /rootmnt/boot/$KERNEL_NAME /bootmnt/vmlinuz
+umount /bootmnt
sync
-echo "Remove your installation media, and press ENTER"
-
-read enter
+if [ "x$1" != "xtftp" ] ; then
+ echo "Remove your installation media, and press ENTER"
+ read enter
+fi
echo "Rebooting..."
reboot -f
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 3a8836d..6ba3bcf 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -5,13 +5,13 @@ SRC_URI = "file://init-install.sh"
PR = "r9"
-RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
+RDEPENDS_${PN} = "syslinux syslinux-mbr parted e2fsprogs-mke2fs"
do_install() {
install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh
}
-# While this package maybe an allarch due to it being a
+# While this package maybe an allarch due to it being a
# simple script, reality is that it is Host specific based
# on the COMPATIBLE_HOST below, which needs to take precedence
#inherit allarch
--
1.7.10.4
[-- Attachment #4: 0003-initramfs-live-boot-improve-script-to-support-tftp-b.patch --]
[-- Type: text/x-patch, Size: 9327 bytes --]
From bdd17fc507135d6c35c674cf1feb8e2e8ad92b98 Mon Sep 17 00:00:00 2001
From: Tomas Frydrych <tomas@sleepfive.com>
Date: Thu, 1 Aug 2013 10:35:34 +0100
Subject: [PATCH 3/4] initramfs-live-boot: improve script to support tftp
booting
---
meta/recipes-core/initrdscripts/files/init-live.sh | 240 ++++++++++++--------
1 file changed, 147 insertions(+), 93 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 890c562..45a5ebf 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -7,6 +7,8 @@ ROOT_IMAGE="rootfs.img"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"
ISOLINUX=""
+UNIONFS="no"
+SCP=`which scp`
# Copied from initramfs-framework. The core of this script probably should be
# turned into initramfs-framework modules to reduce duplication.
@@ -45,7 +47,7 @@ early_setup() {
read_args() {
[ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
for arg in $CMDLINE; do
- optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+ optarg=`expr "x$arg" : 'x[^=]*=\(.*\)' || :`
case $arg in
root=*)
ROOT_DEVICE=$optarg ;;
@@ -68,26 +70,39 @@ read_args() {
shelltimeout=30
else
shelltimeout=$optarg
- fi
+ fi ;;
+ BOOT_IMAGE=*)
+ bootimg=$optarg ;;
+ tftp_server=*)
+ tftp_server=$optarg ;;
+ tftp_rootimg=*)
+ tftp_rootimg=$optarg
+ ROOT_IMAGE=`basename $tftp_rootimg`;;
+ tftp_bootimg=*)
+ tftp_bootimg=$optarg ;;
+ tftp_protocol=*)
+ tftp_protocol=$optarg ;;
esac
done
+
+ if [ "x$tftp_bootimg" = "x" ] ; then
+ tftp_bootimg=$bootimg
+ fi
}
boot_live_root() {
- # Watches the udev event queue, and exits if all current events are handled
- udevadm settle --timeout=3 --quiet
- killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+ killall udevd 2>/dev/null
# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
- for dir in `awk '/\/dev.* \/media/{print $2}' /proc/mounts`; do
- mkdir -p ${ROOT_MOUNT}/$dir
- mount -n --move $dir ${ROOT_MOUNT}/$dir
- done
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
mount -n --move /dev ${ROOT_MOUNT}/dev
+ if [ "x$tftp_rootimg" = "x" ] ; then
+ # Move /media/$i over to the real root filesystem
+ mount -n --move /media/$i ${ROOT_MOUNT}/media/realroot
+ fi
cd $ROOT_MOUNT
exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init
}
@@ -98,112 +113,151 @@ fatal() {
exec sh
}
-early_setup
+# server, what, whereto
+fetch_tftp ()
+{
+ if [ "x$tftp_protocol" = "xssh" ] ; then
+ if ! $SCP $1:$2 $3 ; then
+ fatal "Failed to scp $2 from $1"
+ fi
+ else
+ if ! tftp -g -r $2 -l $3 $1 ; then
+ fatal "Failed to tftp $2 from $1"
+ fi
+ fi
+}
+install_tftp() {
+ mkdir -p /media/tftp
-[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+ echo "Downloading root image to install"
+ fetch_tftp $tftp_server $tftp_rootimg /media/tftp/$ROOT_IMAGE
-read_args
+ ./$label.sh tftp $ROOT_IMAGE $video_mode $vga_mode $console_params
+}
+
+boot_tftp() {
+ mkdir $ROOT_MOUNT
+ mknod /dev/loop0 b 7 0 2>/dev/null
+
+ echo "Downloading root image"
+ fetch_tftp $tftp_server $tftp_rootimg $ROOT_IMAGE
+
+ if [ "$UNIONFS" = "yes" ]; then
+ mkdir /rootfs-tmp
-echo "Waiting for removable media..."
-C=0
-while true
-do
- for i in `ls /media 2>/dev/null`; do
- if [ -f /media/$i/$ROOT_IMAGE ] ; then
+ if ! $MOUNT -o rw,loop,noatime,nodiratime /$ROOT_IMAGE /rootfs-tmp ; then
+ fatal "Could not mount rootfs image"
+ else
+ mkdir /cow
+ mount -t tmpfs -o rw,noatime,mode=755 tmpfs /cow
+ mount -t unionfs -o dirs=/cow:/rootfs-tmp=ro unionfs $ROOT_MOUNT
+ boot_live_root
+ fi
+ else
+ if ! $MOUNT -o rw,loop,noatime,nodiratime /$ROOT_IMAGE $ROOT_MOUNT ; then
+ fatal "Could not mount rootfs image"
+ else
+ boot_live_root
+ fi
+ fi
+}
+
+wait_for_removables() {
+ echo "Waiting for removable media..."
+ C=0
+ while true
+ do
+ for i in `ls /media 2>/dev/null`; do
+ if [ -f /media/$i/$ROOT_IMAGE ] ; then
found="yes"
break
- elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
+ elif [ -f /media/$i/isolinux/$ROOT_IMAGE ]; then
found="yes"
ISOLINUX="isolinux"
- break
- fi
- done
- if [ "$found" = "yes" ]; then
- break;
- fi
+ break
+ fi
+ done
+ if [ "$found" = "yes" ]; then
+ break;
+ fi
# don't wait for more than $shelltimeout seconds, if it's set
- if [ -n "$shelltimeout" ]; then
- echo -n " " $(( $shelltimeout - $C ))
- if [ $C -ge $shelltimeout ]; then
- echo "..."
- echo "Mounted filesystems"
- mount | grep media
- echo "Available block devices"
- ls /dev/sd*
- fatal "Cannot find rootfs.img file in /media/* , dropping to a shell "
- fi
- C=$(( C + 1 ))
- fi
- sleep 1
-done
-
-# Try to make a union mount of the root image.
-# If no unification filesystem is available, mount the image read-only.
-mount_and_boot() {
+ if [ -n "$shelltimeout" ]; then
+ echo -n " " $(( $shelltimeout - $C ))
+ if [ $C -ge $shelltimeout ]; then
+ echo "..."
+ echo "Mounted filesystems"
+ mount | grep media
+ echo "Available block devices"
+ ls /dev/sd*
+ fatal "Cannot find rootfs.img file in /media/* , dropping to a shell "
+ fi
+ C=$(( C + 1 ))
+ fi
+ sleep 1
+ done
+}
+
+boot_normal() {
+ wait_for_removables
+
mkdir $ROOT_MOUNT
mknod /dev/loop0 b 7 0 2>/dev/null
- # determine which unification filesystem to use
- union_fs_type=""
- if grep -q -w "overlayfs" /proc/filesystems; then
- union_fs_type="overlayfs"
- elif grep -q -w "aufs" /proc/filesystems; then
- union_fs_type="aufs"
+ if [ "$UNIONFS" = "yes" ]; then
+ mkdir /rootfs-tmp
+
+ if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs-tmp ; then
+ fatal "Could not mount rootfs image"
+ else
+ mkdir /cow
+ mount -t tmpfs -o rw,noatime,mode=755 tmpfs /cow
+ mount -t unionfs -o dirs=/cow:/rootfs-tmp=ro unionfs $ROOT_MOUNT
+ boot_live_root
+ fi
else
- union_fs_type=""
+ if ! $MOUNT -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
+ fatal "Could not mount rootfs image"
+ else
+ boot_live_root
+ fi
fi
+}
- # make a union mount if possible
- case $union_fs_type in
- "overlayfs")
- mkdir -p /rootfs.ro /rootfs.rw
- if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
- rm -rf /rootfs.ro /rootfs.rw
- fatal "Could not mount rootfs image"
- else
- mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
- mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
- mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
- mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
- mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
- fi
- ;;
- "aufs")
- mkdir -p /rootfs.ro /rootfs.rw
- if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE /rootfs.ro; then
- rm -rf /rootfs.ro /rootfs.rw
- fatal "Could not mount rootfs image"
- else
- mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
- mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT
- mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
- mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
- mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
- fi
- ;;
- "")
- if ! mount -o rw,loop,noatime,nodiratime /media/$i/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
- fatal "Could not mount rootfs image"
- fi
- ;;
- esac
-
- # boot the image
- boot_live_root
+install_normal() {
+ if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
+ ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
+ else
+ fatal "Could not find $label script"
+ fi
}
+early_setup
+
+[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
+
+tftp_protocol=tftp
+read_args
+
+if [ "x$tftp_protocol" = "xssh" -a "x$SCP" = "x" ] ; then
+ fatal "ssh protocol is not supported"
+fi
+
case $label in
- boot)
- mount_and_boot
- ;;
install|install-efi)
- if [ -f /media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
- ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
+ if [ "x$tftp_rootimg" = "x" ] ; then
+ install_normal
else
- fatal "Could not find $label script"
+ install_tftp
fi
# If we're getting here, we failed...
fatal "Installation image failed"
;;
+ *)
+ if [ "x$tftp_rootimg" = "x" ] ; then
+ boot_normal
+ else
+ boot_tftp
+ fi
+ ;;
esac
--
1.7.10.4
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-net-image-initrd-image-for-tfpt-booting.patch --]
[-- Type: text/x-patch; name="0004-net-image-initrd-image-for-tfpt-booting.patch", Size: 5463 bytes --]
From eb212f41a4b2aa0baaf90baf01f9a5365153a57c Mon Sep 17 00:00:00 2001
From: Tomas Frydrych <tomas@sleepfive.com>
Date: Thu, 1 Aug 2013 13:57:35 +0100
Subject: [PATCH 4/4] net-image: initrd image for tfpt booting
---
meta/recipes-core/images/net-image.bb | 121 +++++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 meta/recipes-core/images/net-image.bb
diff --git a/meta/recipes-core/images/net-image.bb b/meta/recipes-core/images/net-image.bb
new file mode 100644
index 0000000..3e78321
--- /dev/null
+++ b/meta/recipes-core/images/net-image.bb
@@ -0,0 +1,121 @@
+# Simple initramfs image. Mostly used for live images.
+DESCRIPTION = "Small image capable of booting a device. The kernel includes \
+the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
+first “init” program more efficiently."
+
+INITRAMFS_SSHKEY ?= "test-ssh-key"
+
+IMAGE_INSTALL = " \
+ initramfs-live-boot \
+ initramfs-live-install \
+ initramfs-live-install-efi \
+ busybox \
+ udev \
+ base-passwd \
+ init-ifupdown \
+ openssh-ssh \
+ openssh-scp \
+ ${INITRAMFS_SSHKEY} \
+ "
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "net-image"
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
+
+BAD_RECOMMENDATIONS += "busybox-syslog"
+
+python __anonymous() {
+ if d.getVar('INITRAMFS_SSHKEY', True) == 'test-ssh-key':
+ bb.warn('Package test-ssh-key is being used; the ssh key contained in this package should be considered compromized and should not be used in production.')
+}
+
+CM="#"
+
+create_pxe_config () {
+ cfg="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.pxelinux.cfg"
+
+ cat >> $cfg << EOF
+${CM}
+${CM} Sample PXELinux configuration
+${CM}
+${CM} General notes
+${CM} <tftpboot>: in the examples below this is the directory on your remote
+${CM} server where the file(s) reside.
+${CM}
+${CM} Kernel images: Yocto generates the kernel images with a .bin suffix, but
+${CM} please note that PXELinux will interpret this as a CD boot sector rather
+${CM} than Linux kernel, so either rename these, or use the 'linux' keyword
+${CM} instead of 'kernel'.
+${CM}
+${CM} Parameters:
+${CM} tftp_protocol: tftp or ssh; tftp is the default, using ssh
+${CM} requires for the initrd image to contain appropriate ssh key. Also note
+${CM} that the ssh protocol is only used to load the disk image, the kernel
+${CM} and initrd can only be loaded from a tftp server.
+${CM}
+${CM} tftp_server: the address of the remote server; when using ssh
+${CM} this should be in the 'user@address' form.
+${CM}
+${CM} tftp_rootimg: the disk image to fetch from the server.
+${CM}
+${CM} ramdisk_size: the ramdisk has to be big enough to hold both the initrd
+${CM} filesystem and the rootimg file.
+${CM}
+${CM} LABEL: this is used by Yocto to decide if the system should boot or
+${CM} switch over into install mode; for the latter the label has to be either
+${CM} 'install' or 'install-efi' (however, install-efi mode is currently not
+${CM} supported by net images).
+${CM}
+
+
+${CM}
+${CM} Sample configurations
+${CM}
+
+${CM} Boot system, loading disk image from a tftp server
+LABEL boot
+ linux <tftpboot>/vmlinuz-${MACHINE}
+ append initrd=<tftpboot>/${INITRD_IMAGE}-${MACHINE}.cpio.gz root=/dev/ram0 ramdisk_size=65536 ip=dhcp tftp_server=<yourserveraddress> tftp_rootimg=<tftpboot>/${IMAGE_BASENAME}.ext3 quiet LABEL=boot
+
+${CM} Boot system, loading disk image using ssh protocol
+LABEL boot-ssh
+ linux <tftpboot>/vmlinuz-${MACHINE}
+ append initrd=<tftpboot>/${INITRD_IMAGE}-${MACHINE}.cpio.gz root=/dev/ram0 ramdisk_size=65536 ip=dhcp tftp_server=<user@yourserveraddress> tftp_rootimg=<tftpboot>/${IMAGE_BASENAME}.ext3 tftp_protocol=ssh quiet LABEL=boot
+
+${CM} Boot system, download disk image from a tftp server and then install it
+${CM} on /dev/sda. If install_dev is not specified and 'unassisted' option is
+${CM} given instead, the first available disk will be used; if unassisted is not
+${CM} given, the user will be prompted on the console
+${CM}
+${CM} NB: the LABEL argument must be given and must be 'install', otherwise the
+${CM} the system will just boot
+LABEL install
+ linux <tftpboot>/vmlinuz-${MACHINE}
+ append initrd=<tftpboot>/${INITRD_IMAGE}-${MACHINE}.cpio.gz root=/dev/ram0 ramdisk_size=65536 ip=dhcp tftp_server=<yourserveraddress> tftp_rootimg=<tftpboot>/${IMAGE_BASENAME}.ext3 quiet LABEL=install install_dev=sda
+
+${CM} As above, but use ssh instead of tftp
+${CM}
+${CM} NB: the LABEL argument must be given and must be 'install', otherwise the
+${CM} system will just boot
+LABEL install-ssh
+ linux <tftpboot>/vmlinuz-${MACHINE}
+ append initrd=<tftpboot>/${INITRD_IMAGE}-${MACHINE}.cpio.gz root=/dev/ram0 ramdisk_size=65536 ip=dhcp tftp_server=<yourserveraddress> tftp_rootimg=<tftpboot>/${IMAGE_BASENAME}.ext3 quiet tftp_protocol=ssh LABEL=install install_dev=sda
+EOF
+
+ ln -sf $cfg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.pxelinux.cfg
+}
+
+python do_pxeconfig () {
+ bb.build.exec_func('create_pxe_config', d)
+}
+
+addtask pxeconfig after do_rootfs before do_build
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] get_line fixes for wide characters and overflows
From: Karel Zak @ 2013-08-01 14:04 UTC (permalink / raw)
To: Dr. David Alan Gilbert; +Cc: util-linux, rleigh
In-Reply-To: <20130801125703.GA7815@gallifrey>
On Thu, Aug 01, 2013 at 01:57:03PM +0100, Dr. David Alan Gilbert wrote:
> e to
> > reproduce the problem with the file from Suse bugzilla).
>
> Hi Karel,
> Thanks for the reply. I'll give it a go over the weekend,
> but I don't think it can handle the wchar problems I described and fixed
> in my follow up patch. If a 4byte wchar hapens to land at the end of the buffer
> how do you guarantee the space?
Ah, I probably see what you mean. So I have added p < &Line[LineLen - 1]
check to the for() where the code copies the multibyte buffer to line buffer.
See git tree for more details.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 6/8] perf: Account freq events per cpu
From: Peter Zijlstra @ 2013-08-01 14:03 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Jiri Olsa, LKML, Namhyung Kim, Ingo Molnar,
Arnaldo Carvalho de Melo, Stephane Eranian
In-Reply-To: <20130801135525.GE431@somewhere>
On Thu, Aug 01, 2013 at 03:55:27PM +0200, Frederic Weisbecker wrote:
> On Thu, Aug 01, 2013 at 03:31:55PM +0200, Peter Zijlstra wrote:
> >
> > Where the freq thing is new and shiney, but we already had the other
> > two. Of those, cgroup events must be per cpu so that should be good,
> > the branch_stack thing tests ATTACH_TASK, which should also be good, but
> > leaves me wonder wth they do for those that are attached to tasks.
> >
> > But yes, the frequency thing is borken.
>
> Aie, so the freq thing, I can either account to all CPUs (inc to all
> and send an IPI to all), or when the event scheds in/out. Probably we
> should do the former to avoid sending an IPI at all context switches.
Yeah, just go with a single global state for now..
^ permalink raw reply
* Re: [Qemu-devel] [RFC] [PATCHv4 10/13] aio / timers: Convert mainloop to use timeout
From: Alex Bligh @ 2013-08-01 13:43 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Kevin Wolf, Anthony Liguori, Stefan Hajnoczi, qemu-devel,
Alex Bligh, rth
In-Reply-To: <20130801124152.GF5245@mail.corp.redhat.com>
Paolo,
>> @@ -449,6 +460,7 @@ int main_loop_wait(int nonblocking)
>> {
>> int ret;
>> uint32_t timeout = UINT32_MAX;
>> + int64_t timeout_ns;
>>
>> if (nonblocking) {
>> timeout = 0;
>> @@ -462,7 +474,21 @@ int main_loop_wait(int nonblocking)
>> slirp_pollfds_fill(gpollfds);
>> # endif
>> qemu_iohandler_fill(gpollfds);
>> - ret = os_host_main_loop_wait(timeout);
>> +
>> + if (timeout == UINT32_MAX) {
>> + timeout_ns = -1;
>> + } else {
>> + timeout_ns = (uint64_t)timeout * (int64_t)(SCALE_MS);
>> + }
>> +
>> + timeout_ns = qemu_soonest_timeout(timeout_ns,
>> + qemu_clock_deadline_ns(rt_clock));
>> + timeout_ns = qemu_soonest_timeout(timeout_ns,
>> + qemu_clock_deadline_ns(vm_clock));
>
> This must not be included if use_icount.
Really? qemu_run_all_timers was running all 3 timers irrespective of
use_icount, and doing a qemu_notify if anything expired, so I'm merely
mimicking the existing behaviour here.
I'm not quite sure what use_icount does. Does vm_clock get disabled
if it is set? (in which case it won't matter).
> Allowing only one rt_clock clock for each AioContext is a simplification,
> but I'm worried that it will be a problem later. For example, the block
> layer wants to use vm_clock. Perhaps QEMUTimerList should really have
> three lists, one for each clock type?
Well currently each QEMUClock has a default QEMUTimerList, so that
wouldn't work well - see below.
The way it's done at the moment is that the QEMUTimerList user can
create as many QEMUTimerLists as he wants. So AioContext asks for one
of one type. It could equally ask for three - one of each type.
I think that's probably adequate.
> Once you do this, you get some complications due to more data structures,
> but other code is simplified noticeably. For example, you lose the
> concept of a default timerlist (it's just the timerlist of the default
> AioContext).
Yep - per the above that's really intrusive (I think I touched well over
a hundred files). The problem is that lots of things refer to vm_clock
to set a timer (when it's a clock so should use a timer list) and
also to vm_clock to read the timer (which is a clock function). Changing
vm_clock to vm_timerlist and vm_clock was truly horrible. Hence the
default timer list concept, which I admit is not great but saved a
horribly intrusive patch not all of which I could test. I did this
patch, and scrapped it.
> And because all timerlists have an AioContext,
Well old callers, particularly those not using an AioContext, would
not have an AioContext would they?
> you do not
> need to special case aio_notify() vs. qemu_notify_event().
Well, if I do a v5, I was going to make the constructor for
creating a timerlist specify a callback function to say what should
happen if the clock is enabled etc., and if none was specified
call qemu_notify_event(). The AioContext user would specify a callback
that called aio_notify(). This would be a bit nicer.
> There are a couple of places to be careful about, of course. For example,
>
> if (use_icount && qemu_clock_deadline(vm_clock) <= 0) {
> qemu_notify_event();
> }
>
> in cpus.c must be changed to iterate over all timerlists.
I was trying hard to avoid anything having to iterate over all
timerlists, and leave the timerlist to be per-thread where possible.
This may well fail for the clock warp stuff. I probably need to
exactly the same as on qemu_clock_enable() here if use_icount is
true. WDYT?
--
Alex Bligh
^ permalink raw reply
* Re: SP4_MACH_CRED
From: Adamson, Dros @ 2013-08-01 14:03 UTC (permalink / raw)
To: J. Bruce Fields; +Cc: linux-nfs list
In-Reply-To: <20130731234800.GC2668@fieldses.org>
On Jul 31, 2013, at 7:48 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
> On Wed, Jul 31, 2013 at 10:22:22PM +0000, Adamson, Dros wrote:
>>
>> On Jul 31, 2013, at 5:39 PM, "J. Bruce Fields" <bfields@fieldses.org>
>> wrote:
>>
>>> This should probably be cc'd to the mailing list.
>>
>> Agreed!
>>
>>>
>>> On Wed, Jul 31, 2013 at 09:25:29PM +0000, Adamson, Dros wrote:
>>>> I have a pretty functional client-side SP4_MACH_CRED implementation
>>>> and I'm trying to implement the server side so I can fully test the
>>>> client code. I was testing against another server, but that didn't
>>>> implement any useful set of operations other than the required ones.
>>>
>>> The latest Linux server implements SP4_MACH_CRED but only for the
>>> required operations. (But that hasn't really been tested--any testing
>>> even to make sure that basic stuff works would be welcomed.)
>>>
>>
>> Right, I'm happy to report that the initial implementation of the required operations seems to work with (at least) one small patch I'll send your way soon.
>>
>>>> I'm currently trying to figure out the best way to set nfsd's current cred to that of the user really doing the operation.
>>>>
>>>> i.e.:
>>>>
>>>> - WRITE, CLOSE, LOCKT, LOCKU are supported by SP4_MACH_CRED.
>>>
>>> "are supported by" means they're included in the spo_must_allow list
>>> returned by the server?
>>>
>>
>> Yes, what I meant was "the client thinks it can use the machine cred for these ops".
>>
>>>> - OPEN calls use the user cred
>>>> - When cred expires, SP4_MACH_CRED kicks in and cached WRITE calls are sent out using the machine cred.
>>>> - nfsd handles request with the machine cred as the current cred
>>>>
>>>> Currently, these writes fail in nfsd_permission (after I made a few other
>>>> changes) because the current cred (the machine cred of the client) maps to
>>>> a UID that is not the owner of the file (even though the io was done as the
>>>> user).
>>>>
>>>> I think what we need is a way to look up the cred associated with the state owner of the current operation's stateid and use that as the current credential when the machine cred is in use.
>>>
>>> Is there a rule that says a stateowner or stateid can only be used with
>>> one credential? If not, I'm not sure what you mean by "the cred
>>> associated with the state owner of the current operation's stateid".
>>>
>>> Maybe we could just pick "a cred" instead of "the cred"? So stash the
>>> last cred used with a given stateid in the stateid, and use that in this
>>> case?
>>
>> Yeah... I was a bit confused. This sounds like a good approach. Thanks!
>>
>>>
>>>> Does that make sense to you? Is there something like this already? If
>>>> not, any pointers on what you'd like to see?
>>>
>>> As a user I'd normally expect that once my credentials have expired, the
>>> client will no longer be able to write to my files.
>>
>> That's true with unbuffered writes, but what about buffered writes that are already considered written by the application?
>
> Well, the server can't distinguish between these two, all it can do is
> say that once you've allowed the client to open a file as you, it's
> going to continue allowing the client to access the file without needing
> your credentials.
>
Right! And using state protection here extends the trust to the client machine so it's not just allowing continued access without needing user credentials.
>> The problem I'm trying to solve initially with SP4_MACH_CRED is when there are a bunch of buffered writes and the user's credentials expire. Any client side operations initiated after the credentials expire will fail (as expected), but operations that have already been seen as successful still need to be flushed.
>>
>> Andy is addressing this in a different way by falling back to unbuffered writes and flushing all data right before a cred expires, but this method is better when available - and it's Trond requested.
>
> I understand the problem it solves, but it is a bit of a change to the
> security model and I just wonder what the right thing is to do by
> default.
So you think the default behavior should be that buffered writes just hang around forever in the client's buffer cache when a user cred expires? That seems really wrong to me.
If this isn't something you want, I'm not sure that we want any SP4_MACH_CRED support other than the required operations, which is kind of a moot point since we now use krb5i for state manager operations by default (whether in SP4_MACH_CRED or SP4_NONE).
The other case we are aiming for with the client is to be able to use the machine cred in recovery when the user's creds expire so that flushing of buffers can happen once recovery is complete. Of course, if you don't want to see the flushing changes, this is useless.
So… Is SP4_MACH_CRED support even worth the effort?
-dros
>
> --b.
>
>>
>>>
>>> This violates that assumption, so I wonder if it needs to be
>>> configurable, and even off by default.
>>>
>>
>> This will fix potential data corruption in a corner case of the way things currently work and doesn't change expected behavior from a user's perspective.
>>
>> -dros
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.